Skip to content

Add pi as native target in CodeGraph installer #1603

Description

@Lokeraar

Summary

Add pi as a native target in CodeGraph's install command so users can run codegraph install --target pi to automatically configure CodeGraph's MCP server for Pi (Android/Termux).

Changes Made

  1. New file: src/installer/targets/pi.ts

    • Implements the AgentTarget interface for Pi
    • Configures MCP server entry to ~/.pi/agent/mcp.json (global) or .pi/mcp.json (local project)
    • Installs CodeGraph instructions to ~/.pi/agent/AGENTS.md (global) or .pi/AGENTS.md (local)
    • Uses standard mcpServers format (same as Claude/Cursor/opencode)
    • No permissions concept (Pi handles tool approval via its own UI)
  2. Modified: src/installer/targets/types.ts

    • Added 'pi' to the TargetId union type
  3. Modified: src/installer/targets/registry.ts

    • Imported piTarget from ./pi
    • Added piTarget to the ALL_TARGETS array

Testing Evidence (logs generated in IA-Generativa project)

All tests passed successfully:

  1. Pi Global Install ✓ - Creates ~/.pi/agent/mcp.json and ~/.pi/agent/AGENTS.md
  2. Pi Local Install ✓ - Creates .pi/mcp.json and .pi/AGENTS.md in project directory without affecting global config
  3. Pi Auto-Detection ✓ - codegraph install --target auto correctly detects Pi as installed
  4. Pi Uninstall ✓ - Correctly removes the configuration
  5. Idempotency ✓ - Re-runs correctly report "Unchanged"

Verification Commands

# Install Pi target globally
codegraph install --target pi --location global --yes

# Install Pi target locally (project-scoped)
codegraph install --target pi --location local --yes

# Auto-detect installed targets (Pi will be detected)
codegraph install --target auto --location global --yes

# Uninstall Pi from local project
codegraph uninstall --target pi --location local

Note

This PR follows the exact pattern of existing targets like opencode.ts, with Pi-specific config paths (~/.pi/agent/). The pi-mcp-adapter package (v2.27.0 with @ff-labs/fff-node@0.10.5 override for Android compatibility) is used for MCP server configuration.


Generated and tested on Android/Termux architecture aarch64/arm64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions