Write me a PowerShell script to teach this assistant about all the repos and wikis in my…
- User
Write me a PowerShell script to teach this assistant about all the repos and wikis in my Azure AD organization
Assistant
To teach the Aider assistant about all the repos and wikis in your Azure AD organization, you can use the Azure DevOps REST API to fetch the necessary information and then use PowerShell to format the data in a way that Aider can understand.
Here's a sample PowerShell script that demonstrates how to achieve this:
powershell# Import the necessary modules Install-Module -Name AzureAD -Force Install-Module -Name Az.Accounts -Force Import-Module -Name AzureAD Import-Module -Name Az.Accounts # Connect to Azure AD and Azure DevOps Connect-AzAccount $orgName = Read-Host "Enter your Azure DevOps organization name" $patToken = Read-Host "Enter your Azure DevOps personal access token" -AsSecureString $token = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($patToken)) # Define the API endpoint and headers $apiEndpoint = "https://dev.azure.com/$orgName/_apis/" $headers = @{ "Authorization" = "Bearer $token" "Content-Type" = "application/json" } # Get all projects in the organization $projectsUrl = "$apiEndpoint projects?api-version=6.1" $projectsResponse = Invoke-WebRequest -Uri $projectsUrl -Method Get -Headers $headers $projects = $projectsResponse.Content | ConvertFrom-Json # Loop through each project and get its repos and wikis foreach ($project in $projects.value) { $projectId = $project.id $projectName = $project.name Write-Host "Processing project: $projectName" # Get all repos in the project $reposUrl = "$apiEndpoint projects/$projectId/_apis/git/repositories?api-version=6.1" $reposResponse = Invoke-WebRequest -Uri $reposUrl -Method Get -Headers $headers $repos = $reposResponse.Content | ConvertFrom-Json # Loop through each repo and get its details foreach ($repo in $repos.value) { $repoId = $repo.id $repoName = $repo.name Write-Host "Processing repo: $repoName" # Get the repo's wiki $wikiUrl = "$apiEndpoint projects/$projectId/_apis/git/repositories/$repoId/wikis?api-version=6.1" $wikiResponse = Invoke-WebRequest -Uri $wikiUrl -Method Get -Headers $headers $wiki = $wikiResponse.Content | ConvertFrom-Json # Format the data for Aider $repoData = @{ "project" = $projectName "repo" = $repoName "wiki" = $wiki } $repoJson = $repoData | ConvertTo-Json Write-Host $repoJson } }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.