跳转到内容

开发

更多指南请参阅 AGENTS.md

Terminal window
git clone https://github.com/earendil-works/pi-mono
cd pi-mono
npm install
npm run build

从源码运行:

Terminal window
/path/to/pi-mono/pi-test.sh

该脚本可在任意目录运行。Pi 会保留调用者的当前工作目录。

通过 package.json 配置:

{
"piConfig": {
"name": "pi",
"configDir": ".pi"
}
}

修改 nameconfigDirbin 字段以适配你的 fork。这会影响 CLI 横幅、配置路径和环境变量名称。

三种运行方式:npm 安装、独立二进制、tsx 源码运行。

始终使用 src/config.ts 解析包内资源:

import { getPackageDir, getThemeDir } from "./config.js";

不要直接使用 __dirname 解析包资源。

/debug(隐藏命令)写入 ~/.pi/agent/pi-debug.log

  • 带 ANSI 码的 TUI 渲染行
  • 最近发送给 LLM 的消息
Terminal window
./test.sh # 运行非 LLM 测试(无需 API 密钥)
npm test # 运行全部测试
npm test -- test/specific.test.ts # 运行指定测试
packages/
ai/ # LLM 提供商抽象
agent/ # Agent 循环与消息类型
tui/ # 终端 UI 组件
coding-agent/ # CLI 与交互模式