Two VS Code extensions, side by side, against the same glean-code-cli
project at ../glean-code-cli. They share the basic shape (sidebar
webview, slash commands, keybindings) but differ in how they reach the
Glean API.
| Version 1: REPL | Version 2: JSON bridge | |
|---|---|---|
| What runs in Python | python3 -m glean_code (the full REPL) |
python/glean_bridge.py importing glean_code.client |
| Wire format | Raw stdout/stderr (line-buffered, ANSI-stripped) | Newline-delimited JSON request/response |
| UI rendering | One scrollback pane, plain text | Structured cards per method (chat, search, status, ...) |
| Citations / tracking tokens | Lost in the prose | First-class fields, used to wire feedback buttons |
| Tab completion | N/A — readline disabled because no TTY; webview has its own slash list | Same idea, but suggestions also include each command's summary |
| Status bar | Not visible (REPL only prints it in TTY mode) | Lives in the panel header; updated on /status, /login, /mode |
| Survives CLI UI changes | No (column widths, separators, banners are part of the contract) | Yes (the contract is the JSON, not the formatting) |
| Errors | Mixed in with stdout/stderr text | Per-request id + error field |
| Effort to add a new command | Add to slash list, hope the CLI's output is parseable | Add a method in glean_bridge.py, render path in webviewProvider.ts |
- Version 1 is the smaller diff if you treat the CLI as the source of truth and don't want any duplication. It's also the right call if the REPL grows commands frequently and you'd rather just expose them all with no per-command UI work. The cost is brittleness: the moment the CLI's prose changes, the panel changes.
- Version 2 is the right call if you want to actually do anything
with the data — build cards, link buttons, route follow-ups, render
citations. You're paying the cost of keeping the bridge methods in
sync with
glean_code.client, in exchange for a real API surface.
Both versions stop short of what Copilot or Claude Code do. They give you
a Glean assistant pane (chat + search + admin commands), not inline code
completion and not agentic file editing. Those would be different
extensions altogether — see the closing notes in
version-2-json-bridge/README.md.
glean-code-vscode-extension/
README.md (this file)
version-1-repl/ scrape-the-REPL extension
version-2-json-bridge/ JSON-RPC extension + Python bridge
- Python 3.9+ on
PATH(configurable per extension). - Node 18+ for
tsc. - A clone of
glean-code-clireachable as a sibling directory of this repo, or setgleanCode.cliPath(v1) /gleanCodeBridge.cliPath(v2). - No Python packages are required —
glean_codeuses only the standard library, which is the whole point of being able to spawn it cheaply.
cd version-1-repl # or version-2-json-bridge
npm install
npm run compile
code . # then F5 to launch the Extension Development HostIn the development host, look for the Glean Code icon in the activity
bar, or press cmd+alt+g / ctrl+alt+g.