From 3dcde89bf90ed071d4c079a8eb55a190b1c844af Mon Sep 17 00:00:00 2001 From: vlamai <42vlamai@gmail.com> Date: Sun, 12 Jul 2026 17:56:17 +0500 Subject: [PATCH] feat: add Pi coding agent to supported tool configs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add 'pi' to AiTool type union with cli: 'pi', promptFlag: ['-p'] - Add 'pi' to VALID_AI_TOOLS in config.ts - Add Pi as option 7 in setup menu (renumber Multiple→8, None→9) - Pi uses AGENTS.md (same as Codex) which pi reads automatically at startup - Add Pi to tool-configs README table and setup examples - Update sync fallback message to include pi in supported CLIs Pi reads AGENTS.md from project root at startup, so integration uses the same template as Claude Code/Codex. The -p flag enables non-interactive mode for mex sync auto-repair. --- src/config.ts | 2 +- src/setup/index.ts | 16 ++++++++++------ src/sync/index.ts | 2 +- src/types.ts | 3 ++- templates/.tool-configs/README.md | 4 ++++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/config.ts b/src/config.ts index 90b6403..e80382f 100644 --- a/src/config.ts +++ b/src/config.ts @@ -117,7 +117,7 @@ interface MexPersistedConfig { [key: string]: unknown; } -const VALID_AI_TOOLS = new Set(["claude", "cursor", "windsurf", "copilot", "opencode", "codex"]); +const VALID_AI_TOOLS = new Set(["claude", "cursor", "windsurf", "copilot", "opencode", "codex", "pi"]); function loadAiTools(raw: MexPersistedConfig | null): AiTool[] { const arr = raw?.aiTools; diff --git a/src/setup/index.ts b/src/setup/index.ts index adaadaa..2777908 100644 --- a/src/setup/index.ts +++ b/src/setup/index.ts @@ -55,6 +55,7 @@ const TOOL_CONFIGS: Record = { "4": { src: ".tool-configs/copilot-instructions.md", dest: ".github/copilot-instructions.md" }, "5": { src: ".tool-configs/opencode.json", dest: ".opencode/opencode.json" }, "6": { src: ".tool-configs/CLAUDE.md", dest: "AGENTS.md" }, // Codex reads AGENTS.md at root + "7": { src: ".tool-configs/CLAUDE.md", dest: "AGENTS.md" }, // Pi reads AGENTS.md at startup }; // ── Helpers ── @@ -346,6 +347,7 @@ const TOOL_CHOICE_MAP: Record = { "4": "copilot", "5": "opencode", "6": "codex", + "7": "pi", }; async function selectToolConfig( @@ -361,11 +363,12 @@ async function selectToolConfig( console.log(" 4) GitHub Copilot"); console.log(" 5) OpenCode"); console.log(" 6) Codex (OpenAI)"); - console.log(" 7) Multiple (select next)"); - console.log(" 8) None / skip"); + console.log(" 7) Pi"); + console.log(" 8) Multiple (select next)"); + console.log(" 9) None / skip"); console.log(); - const choice = (await rl.question("Choice [1-8] (default: 1): ")).trim() || "1"; + const choice = (await rl.question("Choice [1-9] (default: 1): ")).trim() || "1"; let selectedClaude = false; const selectedTools: AiTool[] = []; @@ -409,16 +412,17 @@ async function selectToolConfig( case "4": case "5": case "6": + case "7": copyConfig(choice); break; - case "7": { - const multi = (await rl.question("Enter tool numbers separated by spaces (e.g. 1 2 5): ")).trim(); + case "8": { + const multi = (await rl.question("Enter tool numbers separated by spaces (e.g. 1 2 5 7): ")).trim(); for (const c of multi.split(/\s+/)) { copyConfig(c); } break; } - case "8": + case "9": info("Skipped tool config — AGENTS.md in .mex/ works with any tool that can read files"); break; default: diff --git a/src/sync/index.ts b/src/sync/index.ts index 400549b..2a549e9 100644 --- a/src/sync/index.ts +++ b/src/sync/index.ts @@ -186,7 +186,7 @@ export async function runSync( case "1": if (!syncTool) { console.log(chalk.yellow("No supported AI CLI detected. Falling back to prompts mode.")); - console.log(chalk.dim("Supported CLIs: claude, opencode, codex")); + console.log(chalk.dim("Supported CLIs: claude, opencode, codex, pi")); console.log(); mode = "prompts"; } else { diff --git a/src/types.ts b/src/types.ts index 1ae0e21..a972daf 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2,7 +2,7 @@ // ── AI Tool ── -export type AiTool = "claude" | "cursor" | "windsurf" | "copilot" | "opencode" | "codex"; +export type AiTool = "claude" | "cursor" | "windsurf" | "copilot" | "opencode" | "codex" | "pi"; export interface AiToolMeta { name: string; @@ -18,6 +18,7 @@ export const AI_TOOLS: Record = { copilot: { name: "Copilot", cli: null, promptFlag: [] }, opencode: { name: "OpenCode", cli: "opencode", promptFlag: ["run"] }, codex: { name: "Codex", cli: "codex", promptFlag: [] }, + pi: { name: "Pi", cli: "pi", promptFlag: ["-p"] }, }; // ── Config ── diff --git a/templates/.tool-configs/README.md b/templates/.tool-configs/README.md index d573080..2349095 100644 --- a/templates/.tool-configs/README.md +++ b/templates/.tool-configs/README.md @@ -13,6 +13,7 @@ Most embed the same content — a pointer to `.mex/ROUTER.md`. OpenCode uses a J | GitHub Copilot | `copilot-instructions.md` → copy to `.github/` in project root | | OpenCode | `opencode.json` → copy to `.opencode/` in project root | | Codex (OpenAI) | Copy `CLAUDE.md` as `AGENTS.md` to project root | +| Pi | Copy `CLAUDE.md` as `AGENTS.md` to project root | | Any other tool | Point agent to `.mex/AGENTS.md` | ## Setup @@ -37,6 +38,9 @@ mkdir -p .opencode && cp .tool-configs/opencode.json ./.opencode/opencode.json # Codex (OpenAI) cp .tool-configs/CLAUDE.md ./AGENTS.md + +# Pi +cp .tool-configs/CLAUDE.md ./AGENTS.md ``` ## If your tool is not listed