Therakos AI — VS Code Extension
Chat with the Therakos AI developer assistant directly from VS Code.
Includes read-only Bitbucket access (repos, code search, PRs, diffs) via the Bitbucket MCP.
One-time Entra setup (admin, do once)
The extension reuses the existing SPA app registration (e4052e4a-…) and the
api://therakos-ai-api/access scope — no new app reg needed. You only need to add
a redirect URI for the desktop PKCE flow:
- Azure Portal → Microsoft Entra ID → App registrations → Therakos AI SPA
- Authentication → Add a platform → Mobile and desktop applications
- Add redirect URI:
http://localhost
- Save.
Entra accepts any port on localhost for this platform type, so the extension's
dynamic port selection works without further changes.
Build
cd addins/vscode
npm install
npm run compile # builds dist/extension.js + dist/webview.js
npm run package # produces therakos-ai-0.1.0.vsix
Install
# From the repo root (after npm run package)
code --install-extension addins/vscode/therakos-ai-0.1.0.vsix
Or: VS Code → Extensions (Ctrl+Shift+X) → ⋯ → Install from VSIX…
Configuration
| Setting |
Default |
Description |
therakos-ai.backendUrl |
Production Container App URL |
Backend API base URL |
therakos-ai.defaultAgentSlug |
dev-assistant |
Agent selected on first open |
Usage
- Click the T icon in the VS Code Activity Bar.
- Click Sign in with Microsoft — your browser opens Entra, you consent once, the
token is cached in VS Code's SecretStorage.
- Type a question and press Enter (Shift+Enter for a newline).
- Right-click selected code in any editor → Therakos AI: Ask About Selection to
insert the snippet into the chat input pre-formatted.
Database setup
Apply the seed SQL after the Bitbucket MCP Container App is deployed and is_enabled:
./scripts/apply-migrations.sh seed-dev-assistant-agent
Then flip the agent live:
UPDATE agents SET is_enabled = true WHERE slug = 'dev-assistant';
Architecture
VS Code Extension Host (Node)
│ acquires Entra token via MSAL Node PKCE
│ POST /api/chat (source='vscode_addin', Bearer token)
▼
Therakos AI Backend ←→ Bitbucket MCP ←→ api.bitbucket.org
│ SSE stream
▼
WebviewView (sandboxed browser)
renders streaming markdown
Token is cached in VS Code SecretStorage (OS keychain on macOS/Windows).
VS Code conversations are tagged source='vscode_addin' and excluded from the
SPA conversation list and the nightly add-in purge job (history persists).
Development
npm run watch # rebuilds on file change
Then press F5 in VS Code (with the repo open) to launch an Extension Development
Host with the extension pre-loaded. The launch.json configuration is standard:
{
"type": "extensionHost",
"request": "launch",
"name": "Run Extension",
"args": ["--extensionDevelopmentPath=${workspaceFolder}/addins/vscode"]
}