Overview Version History Q & A Rating & Review
Freebuff for VS Code — Standalone Extension
Free AI coding assistant inside VS Code. This directory is fully decoupled from the freebuff monorepo — copy freebuff_vscode/ anywhere, npm install, and publish.
Features (parity with freebuff CLI)
Chat view in Activity Bar (Freebuff → Chat) — streaming responses, markdown, tool calls
Login via Freebuff: Log In (stores API key in SecretStorage, never in settings.json)
Agents — default base, @agent mentions, slash commands (/help, /new, /clear, /history)
File context — @file mentions via workspace findFiles, project files sent as initial context
Terminal — agent run_terminal_command uses VS Code Terminal with approval gate
History — /history / Freebuff: Clear Chat History (persisted via globalState)
BYOK / free mode compatible — respects SDK CodebuffClient same as CLI
Standalone / Decoupled
No workspace:* deps. Only npm dep is @codebuff/sdk@^0.10.7 (published).
No ../common or ../cli imports — extension host talks to SDK public API only.
Own tsconfig.json, esbuild.js, package.json. npm run build produces out/extension.js + out/webview.js.
npm run package (vsce package --no-dependencies) yields a publishable .vsix.
freebuff_vscode/ # copy this folder anywhere
package.json # publisher/name/version — independent
src/extension.ts
src/auth.ts
src/chatProvider.ts
src/codebuffClient.ts
src/webview/main.ts
out/ # built, .vscodeignore excludes src
Development
cd freebuff_vscode
npm install
npm run build # or npm run watch
# F5 in VS Code to launch Extension Development Host
Publish:
npm run package
vsce publish -p <token>
# or: npx @vscode/vsce publish
Configuration
Settings → Freebuff:
freebuff.apiKey — optional explicit key (prefer Freebuff: Log In)
freebuff.defaultAgent — base | custom agent id
freebuff.maxAgentSteps — e.g. 40
freebuff.autoApproveTerminal — skip approval quickpick
Architecture
src/extension.ts — activation, commands, SecretStorage → auth
src/auth.ts — getApiKey() (SecretStorage > settings > env)
src/codebuffClient.ts — creates CodebuffClient, handles wasm path, run() with streaming
src/chatProvider.ts — WebviewViewProvider for freebuff.chatView, message queue, globalState history
src/webview/main.ts — webview UI (no vscode import, talks via postMessage)
src/utils/* — file tree, slash commands, terminal broker shim
CLI parity notes: OpenTUI/React is replaced by webview (HTML/CSS/JS). All agent logic goes through @codebuff/sdk run() — same backend as cli/src/hooks/use-send-message.ts.