This project is a modern rewrite of AzureCodeGPT. It uses the official OpenAI v4 SDK against Azure OpenAI (commercial or AzureUSGovernment) via AzureCliCredential—no static API keys in VS Code. It targets teams that cannot use GitHub Copilot but still need AI coding assistance.
Prereqs
az login(Gov:az cloud set --name AzureUSGovernment)- Access to the configured Azure Key Vault (at least Secrets User)
Required Key Vault secrets
AOAIDeployment– e.g.,gpt-35-turbo,gpt-4oAOAIEndpoint– e.g.,https://{name}.openai.azure.us/orhttps://{name}.openai.azure.com/AOAIKey– AOAI keyAOAIAPIVersion– e.g.,2024-04-01-preview
Required settings in VS Code
ecma-codebuddy.azureCloud–AzureCloud(default) orAzureUSGovernmentecma-codebuddy.keyvaultName– Key Vault name (not URI)
The extension chooses the correct Graph / Key Vault endpoints based on azureCloud and validates GovCloud endpoints when AzureUSGovernment is selected.
- Pick the correct cloud for IL workloads; we sanity-check Gov endpoints but you own the classification.
- We use the official OpenAI v4 client and the Azure OpenAI migration guide.
npm audit shows 0 vulnerabilities as of 2024-10-01
Supercharge your coding with AI-powered assistance! Automatically write new code from scratch, ask questions, get explanations, refactor code, find bugs and more 🚀✨
- Github Repository
- Based on CodeGPT v1.1.2
- Updated to the latest
openaiv4 client; added "Write tests" command
- 💡 Ask general questions or use editor selections to query Azure OpenAI via the sidebar
- 🖱️ Right click on a code selection and run one of the context menu shortcuts
- automatically write documentation for your code
- explain the selected code
- refactor or optimize it
- find problems with it
- 💻 View GPT's responses in a panel next to the editor
- 📝 Insert code snippets from the AI's response into the active editor by clicking on them
- Clone this repo
- Install deps:
npm install(oryarn install) - Install vsce:
npm install -g vsce(ornpx vsce) - Package:
vsce package - Drag/drop the
.vsixinto VS Code Extensions
After installation, reload VS Code.
az login(Gov:az cloud set --name AzureUSGovernment)- Ensure the current user has Key Vault Secrets User (or higher)
- Create secrets:
AOAIAPIVersion,AOAIDeployment,AOAIEndpoint,AOAIKey
The extension uses AzureCliCredential to load AOAI secrets from Key Vault. Once logged in and configured:
- Open the ecma-codebuddy panel (sidebar icon)
- Enter a prompt; press Enter to send to Azure OpenAI
- Responses appear in the panel; click code blocks to paste (if enabled)
You can also select code in the editor and either enter a prompt in the side panel or right-click and choose Ask ecma-codebuddy. The selected code is automatically appended (optionally wrapped in a code block).
To insert a code snippet from the AI's response into the editor, simply click on the code block in the panel. The code will be automatically inserted at the cursor position in the active editor. This functionality is controlled by the setting pasteOnClick setting. If true, clicks within the results window will be pasted into the open document.
You can select code and right-click for these shortcuts:
ecma-codebuddy.ask— prompt input boxecma-codebuddy.explain— explain selectionecma-codebuddy.refactor— refactor & optimizeecma-codebuddy.findProblems— identify & fix issuesecma-codebuddy.documentation— write docsecma-codebuddy.writetests— generate tests
Ask ecma-codebuddy works with or without a selection. All prompt prefixes are configurable in VS Code settings.
| Setting | Default | Description |
|---|---|---|
ecma-codebuddy.azureCloud |
AzureCloud |
AzureCloud or AzureUSGovernment |
ecma-codebuddy.keyvaultName |
"" |
Key Vault name (no URI) |
ecma-codebuddy.maxTokens |
1024 |
Max tokens per response |
ecma-codebuddy.temperature |
0.5 |
Creativity vs. determinism |
ecma-codebuddy.pasteOnClick |
true |
Paste code blocks on click |
ecma-codebuddy.selectedInsideCodeblock |
true |
Wrap selection in fenced code |
ecma-codebuddy.promptPrefix.* |
(varies) | Customize prompts for each command |
Scripts (npm/yarn):
watch–webpack --watchcompile– production webpack bundlelint– ESLint onsrccompile-tests/watch-tests–tscintoout/test– VS Code extension tests scaffold (out/test/runTest.js)
Tests are scaffolded but not yet implemented; add tests and run
yarn testbefore PRs.
VS Code tasks exist for npm: watch and npm: watch-tests.
- When
AzureUSGovernmentis selected, the extension builds Gov Key Vault URIs and checksAOAIEndpointends with.us. - Graph scopes switch to
graph.microsoft.us.
MIT




