Skip to content

feat(server): add pi coding agent extension support#26

Open
f1shy-dev wants to merge 1 commit into
mainfrom
feat/pi-extension
Open

feat(server): add pi coding agent extension support#26
f1shy-dev wants to merge 1 commit into
mainfrom
feat/pi-extension

Conversation

@f1shy-dev

Copy link
Copy Markdown
Owner

Adds @distracted/pi-extension package that integrates with the pi coding agent. The extension subscribes to pi lifecycle events and sends hook payloads to the local server, same as Claude Code and OpenCode integrations.

CLI changes:

  • --setup pi / --remove pi to configure the extension
  • --status now shows pi configuration state

Add @distracted/pi-extension package that integrates with pi coding agent.
CLI now supports --setup pi, --remove pi, and --status shows pi config.
Copilot AI review requested due to automatic review settings January 23, 2026 00:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class support for the Pi coding agent alongside Claude Code and OpenCode by wiring a new @distracted/pi-extension package into the local server’s hook and CLI setup flow.

Changes:

  • Extends the server’s hook payload and setup/CLI plumbing to recognize Pi as an additional agent (source: "pi", --setup/--remove pi, and --status reporting).
  • Introduces the @distracted/pi-extension package that subscribes to Pi lifecycle events and posts standardized hook payloads to the local distracted server.
  • Updates documentation and lockfile metadata to describe/track the new Pi integration and the OpenCode config path.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/server/src/types.ts Extends HookPayload.source to include "pi" so server-side state can attribute hooks to the new agent.
packages/server/src/setup/pi.ts Adds Pi setup/remove helpers that manage ~/.pi/agent/settings.json to register/unregister the @distracted/pi-extension.
packages/server/src/setup/index.ts Plumbs Pi into the generic setup/remove/status orchestration (agent type union, menu labels, status aggregation, and dispatch).
packages/server/src/bin.ts Extends CLI parsing/options and status output so --setup/--remove/--status understand the pi agent and include it in “all”.
packages/server/README.md Documents Pi as a supported agent, its config location, and the updated CLI usage examples.
packages/pi-extension/tsconfig.json Configures TypeScript compiler options for the new Pi extension package.
packages/pi-extension/src/index.ts Implements the Pi extension: listens to Pi events, derives a session ID, and POSTs standardized hook payloads (including source: "pi") to the distracted server.
packages/pi-extension/package.json Defines the published Pi extension package, including dev tooling and the pi.extensions entry that points to ./src/index.ts.
packages/pi-extension/knip.json Sets up Knip to analyze the Pi extension entrypoint and ignore unused TypeBox dependency.
packages/pi-extension/README.md Documents installation, configuration, lifecycle event mapping, and removal flow for the Pi extension (with one inaccurate claim about CLI-driven global install noted in review).
bun.lock Updates the Bun lockfile to include the new @distracted/pi-extension workspace and its dependency tree.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

cwd?: string;
transcript_path?: string;
source?: "claude" | "opencode";
source?: "claude" | "opencode" | "pi";

Copilot AI Jan 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that HookPayload.source includes the new "pi" variant, the HTTP handler in src/server.ts still only preserves "claude" and "opencode" values when mapping data.source into the HookPayload (all other values, including "pi", are dropped to undefined). To keep the type in sync with runtime behavior and ensure Pi-sourced hooks can be distinguished downstream, please update the source assignment in src/server.ts to also accept and forward "pi" as a valid value.

Suggested change
source?: "claude" | "opencode" | "pi";
source?: "claude" | "opencode";

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +19
This will:

1. Install the extension globally (if needed)
2. Configure pi's `~/.pi/agent/settings.json` to load the extension

Copilot AI Jan 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The installation section claims that running bunx @distracted/server --setup pi will "Install the extension globally (if needed)", but the current @distracted/server implementation only updates ~/.pi/agent/settings.json and never performs a global @distracted/pi-extension install. To avoid confusing users who haven't installed the package yet, please either adjust this text to describe only the configuration step or add explicit instructions here (or in the server docs) to run npm install -g @distracted/pi-extension before using the CLI setup path.

Copilot uses AI. Check for mistakes.
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.

2 participants