Skip to content

About

Visual Studio Code and Cursor extension for Glean Code CLI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Glean Code — VS Code extension(s)

Note

🎉 Released. The Glean Code extension is out for VS Code, Cursor and VSCodium — download the latest release or install it with one line (see Install).

A Glean assistant in your sidebar: chat, search, and the admin commands from glean-code-cli, rendered as cards in a VS Code panel.

Two extensions live here. They solve the same problem two ways against the same CLI. version-2-json-bridge is the one to install.

Dark Light
Glean Code panel, dark theme Glean Code panel, light theme

Both images are generated from docs/sessions/getting-started.md by tools/replay.mjs, using the extension's own renderer. See docs/REPLAY.md.

In the editor

Glean Code panel in VS Code

/graph opens as an interactive tab — click a node for its edges, drag to move, scroll to zoom:

/graph opened as an interactive graph in VS Code

The same extension in VSCodium:

Glean Code panel in VSCodium

Install

One line — downloads the latest release and installs it into every VS Code, Cursor and VSCodium it finds. No clone, no Node, no build:

curl -fsSL https://raw.githubusercontent.com/barkz/glean-code-vscode-extension/main/get.sh | bash

That pipes a script into your shell, which is worth being wary of. To read it first:

curl -fsSL https://raw.githubusercontent.com/barkz/glean-code-vscode-extension/main/get.sh -o get.sh
less get.sh && bash get.sh

Useful flags: --editor code to pick one editor, --tag v0.2.4 for a specific release, --uninstall to remove it.

By hand, if you would rather not run a script: download the .vsix from the latest release, then:

code --install-extension glean-code-bridge-<version>.vsix     # or: cursor / codium

Either way the extension carries its own copy of the CLI, so the only prerequisite is Python 3.9+ on your PATH — a bundled zipapp still needs an interpreter. get.sh checks for it and tells you if it is missing.

From source:

git clone https://github.com/barkz/glean-code-vscode-extension.git
cd glean-code-vscode-extension
./install.sh

That builds a .vsix and installs it into every VS Code and Cursor it finds on your PATH, then checks whether the extension will be able to reach the CLI. Open the panel with Cmd+Alt+G (Ctrl+Alt+G on Windows/Linux).

./install.sh --version 1        # install the REPL version instead
./install.sh --editor cursor    # only Cursor
./install.sh --package-only     # just build the .vsix
./install.sh --uninstall

Requirements

  • Node 18+ — to compile and package.
  • Python 3.9+ — the extension spawns it to talk to Glean.
  • glean_code reachable by that interpreter. No pip install needed; the extension looks in several places (below).
  • No credentials required to try it. Without a token the CLI serves a built-in mock corpus, which is what the screenshots show.

How the extension finds the CLI

Version 2 needs no setup: ./install.sh builds the .vsix with its own copy of the CLI inside, and the extension uses that. The order it checks, stopping at the first hit:

  1. The gleanCodeBridge.cliPath setting (gleanCode.cliPath for v1).
  2. GLEAN_CODE_HOME.
  3. The copy bundled inside the extension (v2 only).
  4. Whether your python3 can already import glean_code.
  5. The zipapp python3 install.py installs at ~/.local/bin/glean, or glean on PATH.
  6. A glean-code-cli clone in or beside your workspace.

Set gleanCodeBridge.cliPath to use a different CLI checkout than the bundled one. For version 1, the simplest setup is running python3 install.py once in your glean-code-cli checkout, which covers step 5.

If none match, the panel tells you what it tried and offers to open Settings.

Knowledge graph and the full CLI

/graph <query> draws a knowledge graph over a query's results — the most connected documents and people, clusters, and the strongest links — and Open interactive graph shows it as a force-directed page in an editor tab.

Every other CLI command is listed in /help and the slash picker, tagged CLI; typing one offers Run in terminal, which opens the full Glean Code REPL and runs it there.

Dark Light
/graph in the panel, dark theme /graph in the panel, light theme

Generated from docs/sessions/graph.md.

Connecting to a real instance

/login --instance acme-be.glean.com --token <your-token>
/status

/mode live|mock|auto switches between a real tenant and the mock corpus.

The two versions

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
Citations / tracking tokens Lost in the prose First-class fields, used to wire feedback buttons
Status bar Not visible (the REPL only prints it under a TTY) In the panel header, updated on /status, /login, /mode
Survives CLI output changes No — column widths and banners are part of the contract Yes — the contract is the JSON
Errors Mixed into stdout/stderr text Per-request id plus an error field
Cost of a new command Add to the slash list, hope the output parses Bridge method + parseLine case + renderer

Pick v1 if you treat the CLI as the single source of truth and want no duplication — every REPL command shows up for free. You pay for it in brittleness.

Pick v2 if you want to do anything with the data: cards, buttons, citation links, per-result feedback. You keep the bridge methods in sync with glean_code.client in exchange for a real API surface.

Both are a Glean assistant pane — chat, search and admin commands. Neither does inline code completion or agentic file editing.

Development

cd version-2-json-bridge
npm install
npm run compile
npm test              # integration test inside your installed VS Code
npm run test:ci       # same, in a VS Code it downloads (what CI runs)
npm run package       # -> dist/glean-code-bridge-<version>.vsix

Releases are cut by pushing a v<version> tag; CI tests, packages and attaches the .vsix to a GitHub Release. See "Versioning and releases" in CLAUDE.md.

Press F5 in either extension folder to launch an Extension Development Host.

Screenshots and session transcripts are generated — see docs/REPLAY.md:

node tools/record.mjs --name my-demo '/status' '/search onboarding'
node tools/replay.mjs

CLAUDE.md documents the architecture and the conventions worth knowing before changing anything.

Layout

install.sh                  build + install a .vsix
CLAUDE.md                   architecture and conventions
.github/workflows/          CI and the tag-driven release
tools/                      record.mjs, replay.mjs, test-extension.sh, set_version.mjs
docs/
  REPLAY.md                 session file format
  sessions/                 recorded sessions (readable + replayable)
  img/                      screenshots generated from them
version-1-repl/             scrape-the-REPL extension
version-2-json-bridge/      JSON-RPC extension + Python bridge

License

MIT — see LICENSE.

About

Visual Studio Code and Cursor extension for Glean Code CLI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages