Skip to content

LightningBerk/vspi

Repository files navigation

Pi Coding Agent for VS Code

Chat with the pi coding agent — bring your own API key, choose your model, use pi's full tool suite.

Features

  • Sidebar chat — Pi lives in its own sidebar panel. Ask questions, give instructions, review results.
  • Full tool suite — Pi reads, writes, edits files, runs shell commands, and searches your codebase.
  • Streaming — Responses stream in real-time with thinking blocks and tool execution indicators.
  • Model switching — Pick from available models via the header dropdown or command palette.
  • Bring your own key — Works with Anthropic, OpenAI, Google Gemini, AWS Bedrock, and more.
  • Your config — Pi uses your existing ~/.pi/ config, extensions, skills, and project settings.

IDE Integration

  • Active file context — Pi automatically sees the file and selection in your editor. Say "fix this" and it knows what you mean.
  • Auto-open edited files — When Pi writes or edits a file, it opens in your editor automatically.
  • Diff preview — Optionally review Pi's edits in a side-by-side diff before accepting or reverting. (off by default)
  • Diagnostics awareness — After Pi edits files, new type errors or lint issues are automatically detected and fed back so Pi can self-correct.

Install

Prerequisites

Install pi globally (the coding agent this extension wraps):

npm install -g @mariozechner/pi-coding-agent

Then configure at least one provider — run pi in a terminal and type /login.

Extension

Download the latest .vsix from GitHub Releases, then:

code --install-extension vspi-<version>.vsix

Or in VS Code: Extensions menu → Install from VSIX…

First Run

  1. Click the π icon in the activity bar (left sidebar)
  2. Start chatting — Pi operates on your open workspace

Or use the built-in walkthrough: Ctrl+Shift+P → "Get Started with Pi Coding Agent"

How It Works

The extension spawns pi --mode rpc as a local subprocess. Your messages go through JSONL over stdin/stdout — pi's streaming events are rendered in the sidebar. Pi runs with your existing config, API keys, extensions, and skills. Nothing is sent through a third-party proxy.

VS Code sidebar ←→ webview postMessage ←→ extension host ←→ pi subprocess (JSONL)
                                                                  ↓
                                                          your API keys + config

Settings

Setting Default Description
vspi.piPath "pi" Path to the pi executable
vspi.provider "" LLM provider (anthropic, openai, google, etc.)
vspi.model "" Default model ID
vspi.thinkingLevel "medium" Reasoning depth: off, minimal, low, medium, high, xhigh
vspi.showThinking true Show thinking/reasoning output
vspi.showToolOutput true Show tool execution results inline
vspi.includeActiveFile true Send active editor file + selection as context
vspi.openFilesOnEdit true Auto-open files after Pi writes/edits them
vspi.showDiffPreview false Show side-by-side diff with accept/revert actions
vspi.diagnosticsAwareness true Detect new errors after edits and feed back to Pi
vspi.diagnosticsSeverity "errors" Feed back errors only, or errors + warnings

Commands

Command Description
Pi: New Session Start a fresh conversation
Pi: Select Model Pick from available models
Pi: Abort Current Request Cancel the active request
Pi: Focus Chat Open/focus the Pi sidebar
Pi: Accept Diff Accept Pi's proposed changes (diff preview mode)
Pi: Reject / Revert Diff Revert to original content (diff preview mode)

Troubleshooting

Pi not found? Make sure pi is installed globally (npm install -g @mariozechner/pi-coding-agent) and available on your PATH. You can also set vspi.piPath to the full path.

No models available? Run pi in a terminal and type /login to configure an API key for at least one provider.

Extension crashes or behaves unexpectedly? Check the "Pi Agent" output channel: View → Output → Pi Agent

Architecture

See docs/CODEMAP.md for a full architectural map of the codebase.

Development

git clone https://github.com/LightningBerk/vspi.git
cd vspi
npm install
npm run compile    # Build extension + webview
npm run watch      # Rebuild on change (both targets)
npm run lint       # Type-check (tsc --noEmit)
npm test           # Run tests (vitest, 107 tests)
npm run package    # Build .vsix for local install
# Press F5 to launch Extension Development Host

The build has two esbuild targets: the extension (Node/CJS) and the webview (browser/IIFE, bundles marked + DOMPurify for secure markdown rendering).

Releasing

Releases are automated via GitHub Actions. To publish a new version:

npm version patch   # or minor / major — bumps package.json, commits, tags
git push origin main --tags

CI builds the .vsix and creates a GitHub Release with the artifact attached.

Security

  • CSP — Webview uses nonce-based script-src; no unsafe-inline or unsafe-eval
  • Markdown — Rendered via marked + DOMPurify (blocks XSS, restricts URI schemes to https: and mailto:)
  • Input validation — Tool call IDs validated, prompt length capped at 500 KB
  • Process spawn — Uses execFile (not exec) for the pi path; no shell injection
  • Dependenciesnpm audit reports 0 vulnerabilities

License

MIT

About

VSCode(ium) integration for the Pi agent harness

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors