{"_id":"@cary222/pi-route","_rev":"3-7c4013bcde0e76cee7c8c8f946a0823f","name":"@cary222/pi-route","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@cary222/pi-route","version":"0.1.0","keywords":["pi-package","pi-extension","workflow-router","mode-router","slash-command","plugin-discovery"],"author":{"name":"Pi Extension Contributors"},"license":"MIT","_id":"@cary222/pi-route@0.1.0","maintainers":[{"name":"cary222","email":"bluescary0@gmail.com"}],"homepage":"https://github.com/earendil-works/pi-route#readme","bugs":{"url":"https://github.com/earendil-works/pi-route/issues"},"pi":{"image":"https://raw.githubusercontent.com/earendil-works/pi-route/main/assets/preview.png","extensions":["./dist/extensions/index.js"]},"dist":{"shasum":"ec6ccff3152245f40870eef900b8deb09c14f8cf","tarball":"https://registry.npmjs.org/@cary222/pi-route/-/pi-route-0.1.0.tgz","fileCount":182,"integrity":"sha512-UCODvAsZQyI6MSUnlXf0eiKbJ/OrbTe4CojNizDO0WCALKp778RfbxqjRsI/vfSLLvxRytU9x5B5fBclfmNi/A==","signatures":[{"sig":"MEUCIQC3VKCC4LAuuRVx2Pcsr6zJtD3r20W1LRuMbnE+a2eWggIgOk9WQcv+XDZBdyBLxeXkkMz78U3xkZG8ScPPyyR5yiQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":407643},"main":"./dist/src/index.js","type":"module","types":"./dist/src/index.d.ts","gitHead":"30218a03e1c23463ae7e3107e0a445c1ea8d2d18","scripts":{"test":"node --test dist/tests/unit/**/*.test.js dist/tests/integration/**/*.test.js dist/tests/e2e/**/*.test.js","build":"tsc","watch":"tsc --watch","pack-check":"npm pack --dry-run","test:coverage":"node --test --experimental-test-coverage dist/tests/unit/**/*.test.js dist/tests/integration/**/*.test.js dist/tests/e2e/**/*.test.js","prepublishOnly":"npm run build && npm test && npm run pack-check"},"_npmUser":{"name":"cary222","email":"bluescary0@gmail.com"},"repository":{"url":"git+https://github.com/earendil-works/pi-route.git","type":"git"},"_npmVersion":"10.9.8","description":"Capability-aware Mode & Slash Command Router for Pi Coding Agent","directories":{},"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.0","@types/node":"^22.0.0","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-route_0.1.0_1788318504474_0.7075548677717105","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@cary222/pi-route","version":"0.1.1","keywords":["pi-package","pi-extension","workflow-router","mode-router","slash-command","plugin-discovery"],"author":{"name":"Pi Extension Contributors"},"license":"MIT","_id":"@cary222/pi-route@0.1.1","maintainers":[{"name":"cary222","email":"bluescary0@gmail.com"}],"homepage":"https://github.com/earendil-works/pi-route#readme","bugs":{"url":"https://github.com/earendil-works/pi-route/issues"},"pi":{"image":"https://raw.githubusercontent.com/earendil-works/pi-route/main/assets/preview.png","extensions":["./dist/extensions/index.js"]},"dist":{"shasum":"493410b38cd8e189d405aa0ce08bb7af9d76fa92","tarball":"https://registry.npmjs.org/@cary222/pi-route/-/pi-route-0.1.1.tgz","fileCount":202,"integrity":"sha512-0RmUEV5ouiO1pqfoeUORvTgq+T2J75YszR68eUQTYmDZOJ+bBZHNtcxFTGSXavxqfAA0YRrAPm0Vs0vdxEr5rA==","signatures":[{"sig":"MEYCIQC+UpZgw5epfC+ew/WhSldHSEXpuzpoFONAETJfU/bNmwIhAMmjHFmqVByMo6LbsgGoolRgrpzKWpl4Y/4fU/p2EKh4","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":457213},"main":"./dist/src/index.js","type":"module","types":"./dist/src/index.d.ts","gitHead":"5eadded3fa06ba42e066fcba0d58edb4205f74e8","scripts":{"test":"node --test dist/tests/unit/**/*.test.js dist/tests/integration/**/*.test.js dist/tests/e2e/**/*.test.js","build":"tsc","watch":"tsc --watch","pack-check":"npm pack --dry-run","test:coverage":"node --test --experimental-test-coverage dist/tests/unit/**/*.test.js dist/tests/integration/**/*.test.js dist/tests/e2e/**/*.test.js","prepublishOnly":"npm run build && npm test && npm run pack-check"},"_npmUser":{"name":"cary222","email":"bluescary0@gmail.com"},"repository":{"url":"git+https://github.com/earendil-works/pi-route.git","type":"git"},"_npmVersion":"10.9.8","description":"Capability-aware Mode & Slash Command Router for Pi Coding Agent","directories":{},"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.0","@types/node":"^22.0.0","@earendil-works/pi-tui":"*","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-route_0.1.1_1788342988689_0.0648724671612757","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@cary222/pi-route","version":"0.1.2","description":"Capability-aware Mode & Slash Command Router for Pi Coding Agent","type":"module","main":"./dist/src/index.js","types":"./dist/src/index.d.ts","keywords":["pi-package","pi-extension","workflow-router","mode-router","slash-command","plugin-discovery"],"author":{"name":"Pi Extension Contributors"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/earendil-works/pi-route.git"},"bugs":{"url":"https://github.com/earendil-works/pi-route/issues"},"homepage":"https://github.com/earendil-works/pi-route#readme","scripts":{"build":"tsc","watch":"tsc --watch","test":"node --test dist/tests/unit/**/*.test.js dist/tests/integration/**/*.test.js dist/tests/e2e/**/*.test.js","test:coverage":"node --test --experimental-test-coverage dist/tests/unit/**/*.test.js dist/tests/integration/**/*.test.js dist/tests/e2e/**/*.test.js","pack-check":"npm pack --dry-run","prepublishOnly":"npm run build && npm test && npm run pack-check"},"pi":{"extensions":["./dist/extensions/index.js"],"image":"https://raw.githubusercontent.com/earendil-works/pi-route/main/assets/preview.png"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"devDependencies":{"@earendil-works/pi-coding-agent":"*","@earendil-works/pi-tui":"*","@types/node":"^22.0.0","typescript":"^5.5.0"},"_id":"@cary222/pi-route@0.1.2","gitHead":"6e664c09e802b4b1d7969f5307048a84f875e397","_nodeVersion":"22.23.2","_npmVersion":"10.9.8","dist":{"integrity":"sha512-q0THPdnHLFkPW4ZqB04EFyFjF3jnV5TveyDS71s3pfUiZML/GrMNaifor/an4leSAIQucYSpyywDqOFldhdFHg==","shasum":"d1f68dfc48ab9d078b88e9dd877955257694e9ed","tarball":"https://registry.npmjs.org/@cary222/pi-route/-/pi-route-0.1.2.tgz","fileCount":202,"unpackedSize":453734,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHvpePbDxfb5Ll1m6hWhP1xCajxizXL/uRw5l5N/5A0LAiEAtUP9irVkLHhIuPF5bgyPP2OOvs5fBcL+eYev+/nBb5M="}]},"_npmUser":{"name":"cary222","email":"bluescary0@gmail.com"},"directories":{},"maintainers":[{"name":"cary222","email":"bluescary0@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-route_0.1.2_1788401935898_0.73117601624869"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-02T03:08:24.294Z","modified":"2026-09-03T02:18:56.212Z","0.1.0":"2026-09-02T03:08:24.627Z","0.1.1":"2026-09-02T09:56:28.818Z","0.1.2":"2026-09-03T02:18:56.033Z"},"bugs":{"url":"https://github.com/earendil-works/pi-route/issues"},"author":{"name":"Pi Extension Contributors"},"license":"MIT","homepage":"https://github.com/earendil-works/pi-route#readme","keywords":["pi-package","pi-extension","workflow-router","mode-router","slash-command","plugin-discovery"],"repository":{"type":"git","url":"git+https://github.com/earendil-works/pi-route.git"},"description":"Capability-aware Mode & Slash Command Router for Pi Coding Agent","maintainers":[{"name":"cary222","email":"bluescary0@gmail.com"}],"readme":"# Pi Route (`@cary222/pi-route`)\n\n> **Pi Coding Agent 的能力感知模式路由器与工作流编排器 (Capability-aware Mode Router)**\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n[![npm version](https://img.shields.io/npm/v/@cary222/pi-route.svg)](https://www.npmjs.com/package/@cary222/pi-route)\n[![Pi Package](https://img.shields.io/badge/Pi-Package-orange)](https://pi.dev/packages/@cary222/pi-route)\n\n[English Documentation](README.md)\n\n---\n\n## 什么是 Pi Route？\n\n**Pi Route** 是一个位于其他 Pi 插件之前的**能力感知模式路由器 (Capability-aware Mode Router)**。当用户输入自然语言需求时，它能够：\n\n1. **意图深度分类**：覆盖方案规划 (Plan)、长任务执行 (Goal)、代码审查 (Audit)、官方/社区调研 (Research)、浏览器自动化 (Browser QA)、移动端开发 (Android)、安全审计 (Security) 等 11+ 种核心研发场景。\n2. **Runtime 能力权威校验**：直接调用 `pi.getCommands()` 与 `pi.getAllTools()` 获取真实可用能力，拒绝仅依赖配置文件的虚假推断。\n3. **情景预设方案 (Profile)**：支持针对移动端 App 开发、Web 全栈、深度研究、安全审计等场景定制常用插件与工作流。\n4. **探寻模式 (Explore Mode)**：当缺少关键插件时，可安全检索 npm / Pi Packages 市场并呈现候选方案。\n5. **平滑降级规划 (Fallback)**：当用户拒绝安装插件或离线时，仅依赖当前本机已有能力生成降级工作流，并清晰列出能力损失与局限。\n6. **一键填入命令**：仅负责推荐、确认与将首条命令填入输入框（如 `/plan`、`/goal`），不替代专业插件执行具体长任务，保持各插件职责独立。\n\n```\n/route <您的自然语言需求>\n       ↓\n  意图分析与本机能力清单权威核验\n       ↓\n  生成最佳工作流：/plan → /goal → Browser QA → Android 验证 → /audit\n       ↓\n  用户确认 / 降级使用 / 无副作用取消\n       ↓\n  首条命令自动填入输入框\n```\n\n---\n\n## 核心特性\n\n- **权威能力校验**：以 `pi.getCommands()` 为唯一权威，避免“安装了但被禁用”或“未加载”的误判。\n- **纯领域核心 (Pure Domain Core)**：业务逻辑与外部 I/O 及 Pi UI 彻底解耦，100% 独立可测试。\n- **双路由策略**：\n  - `preset`（预设策略）：优先根据当前 Profile 与本机能力快速推荐，不主动访问外网。\n  - `explore`（探寻策略）：结合全网与 npm 市场候选插件，给出最佳组合与安装建议。\n- **降级工作流**：拒绝安装时自动生成兜底方案，不虚构不存在的命令，不夸大普通提示词能力。\n- **严格安全安装**：使用参数数组的 `execFile` 执行 `pi install`，严格禁用 `shell: true`，屏蔽敏感环境变量并进行外网数据清理。\n- **零副作用取消**：在任何确认环节点击取消，不修改任何文件，不执行任何安装或指令。\n- **双端呈现协议**：支持终端交互式 TUI 视图，以及面向 RPC / Pi Web 的标准化 `pi-route.ui.v1` 事件协议。\n\n---\n\n## 安装与快速体验\n\n### 从 Pi Packages / npm 安装\n\n```bash\npi install npm:@cary222/pi-route\n```\n\n### 免安装临时体验\n\n```bash\npi -e npm:@cary222/pi-route\n```\n\n### 本地源码开发安装\n\n```bash\ngit clone https://github.com/earendil-works/pi-route.git\ncd pi-route\nnpm install\nnpm run build\npi -e .\n```\n\n---\n\n## 指令参考手册\n\n| 指令 | 作用说明 |\n|---|---|\n| `/route` | 打开 **Route Center** 交互式控制中心 |\n| `/route <需求描述>` | 基于当前激活 Profile 分析需求并推荐工作流 |\n| `/route --profile <id> -- <需求>` | 临时指定 Profile 进行需求分析（不改变当前默认方案） |\n| `/route explore -- <需求描述>` | 进入**探寻模式**，检索 npm 市场候选插件与能力 |\n| `/route profile list` | 查看全部内置、全局及项目级场景 Profile |\n| `/route profile create [名称]` | 打开方案创建交互向导 |\n| `/route profile use <id>` | 切换当前会话生效的 Profile |\n| `/route profile default <id>` | 设置以后新会话的默认 Profile |\n| `/route profile clone <id> [new-id]` | 复制现有方案为新方案 |\n| `/route profile edit <id>` | 在编辑器中直接编辑方案 JSON 配置 |\n| `/route profile delete <id>` | 删除自定义方案（内置 `general` 受保护禁止删除） |\n| `/route status` | 查看当前可用命令、工具状态与插件清单 |\n| `/route help` | 查看帮助手册 |\n\n> **使用技巧**：在输入包含 `profile` 或 `explore` 等词汇的复杂英文或中文需求时，使用 `--` 分隔符（如 `/route --profile app-dev -- 修复登录页面`）可确保参数解析万无一失。\n\n---\n\n## 内置场景方案 (Built-in Profiles)\n\n1. **通用开发 (`general`)**：标准全流程闭环开发（`/plan` 架构规划 → `/goal` 目标交付 → `/audit` 代码审计）。\n2. **App 开发 (`app-dev`)**：专为 Android、iOS 与 Expo 跨端开发打造，集成 `pi-android-cli`、ADB 调试与 Logcat 实时日志。\n3. **Web 全栈 (`web-fullstack`)**：专为前端与全栈开发打造，集成 `pi-agent-browser-native` 进行 DOM 树分析与自动化 QA。\n4. **深度研究 (`deep-research`)**：技术调研与文献综述，集成 `pi-web-access` 与 Feynman 跨平台多源交叉检索。\n5. **安全审计 (`security-audit`)**：代码安全扫描、CVE 漏洞核验与权限对抗审查，集成 `pi-lens` 与 Semgrep 规则库。\n\n---\n\n## 架构与安全\n\n- **架构设计文档**：参见 [docs/architecture.md](docs/architecture.md)\n- **Security Policy**：参见 [docs/security.md](docs/security.md)\n- **Catalog 维护规范**：参见 [docs/catalog-maintenance.md](docs/catalog-maintenance.md)\n- **Pi Web / RPC 协议对接**：参见 [docs/pi-web-integration.md](docs/pi-web-integration.md)\n- **发布指南**：参见 [docs/publishing.md](docs/publishing.md)\n\n---\n\n## 开源协议\n\n本项目采用 [MIT 许可证](LICENSE)。\n","readmeFilename":"README.zh-CN.md"}