Skip to content

feat(installer): add Pi (pi-coding-agent) target - #2112

Open
roymina wants to merge 1 commit into
colbymchenry:mainfrom
roymina:feat/pi-agent-target
Open

roymina wants to merge 1 commit into
colbymchenry:mainfrom
roymina:feat/pi-agent-target

Conversation

@roymina

@roymina roymina commented Sep 30, 2026

Copy link
Copy Markdown

Adds Pi (@earendil-works/pi-coding-agent) as an installer target, so codegraph install --target=pi wires the CodeGraph MCP server into Pi the same way the existing targets do.

Global Project-local
MCP config ~/.pi/agent/mcp.json <cwd>/.pi/mcp.json
Instructions ~/.pi/agent/AGENTS.md <cwd>/AGENTS.md

The agent directory is resolved the way Pi resolves it — PI_CODING_AGENT_DIR when set, otherwise ~/.pi/agent — so the install can't silently write to a directory Pi never reads.

Why exposure: "direct"

Pi defaults every MCP server to codemode, where the server's tools are callable from codemode scripts but are not declared to the model. The CodeGraph guidance tells the agent to call codegraph_explore by name, so the entry sets "exposure": "direct" to put it on the native tool list. CodeGraph exposes a single tool by default, so there's no tool-list bloat to trade off (codemode stays available as a fallback).

Changes

  • src/installer/targets/pi.ts — the new target
  • src/installer/targets/registry.ts, src/installer/targets/types.ts — register pi
  • src/bin/codegraph.ts, src/installer/index.ts — help/header text
  • __tests__/installer-targets.test.ts — 6 Pi tests (global/local install, idempotent re-run, sibling-server preservation, uninstall round-trip, PI_CODING_AGENT_DIR override); the parameterized contract suite covers Pi automatically once it's in ALL_TARGETS
  • README.md, CHANGELOG.md

Testing

  • npx tsc — clean
  • npx vitest run __tests__/installer-targets.test.ts — 265 passed, 10 skipped
  • End-to-end against a real install (Windows, CodeGraph 1.6.1): codegraph install --target=pi --location=global --yes preserved the three pre-existing servers in ~/.pi/agent/mcp.json, wrote the AGENTS.md block, and a re-run reported Unchanged; codegraph uninstall --target=pi --keep-cli reversed it cleanly.
  • Confirmed Pi loads it: pi mcp list → codegraph: connected, 1 tool (direct, global) → codegraph_explore.
  • Direct MCP handshake (initialize + tools/list against codegraph serve --mcp) returns serverInfo codegraph 1.6.1 and tools: ["codegraph_explore"].

Happy to adjust the naming, the file layout, or the exposure choice.

Wires the CodeGraph MCP server into Pi via its mcp.json:

- global: <agent-dir>/mcp.json + <agent-dir>/AGENTS.md
- local:  <cwd>/.pi/mcp.json + <cwd>/AGENTS.md

<agent-dir> defaults to ~/.pi/agent and is overridable via
PI_CODING_AGENT_DIR, mirroring how Pi itself resolves it.

Sets exposure: "direct" on the MCP entry so codegraph_explore is
declared as a native tool instead of being hidden behind Pi's default
codemode exposure.
@roymina
roymina force-pushed the feat/pi-agent-target branch from 37ac40f to ac9ec7c Compare September 30, 2026 02:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant