开发
更多指南请参阅 AGENTS.md。
设置
git clone https://github.com/earendil-works/pi-mono
cd pi-mono
npm install
npm run build
从源码运行:
/path/to/pi-mono/pi-test.sh
该脚本可以从任意目录运行。Pi 会保留调用者当前的工作目录。
Fork / 更名
通过 package.json 配置:
{
"piConfig": {
"name": "pi",
"configDir": ".pi"
}
}
为你的 fork 修改 name、configDir 和 bin 字段。会影响 CLI 横幅、配置路径和环境变量名称。
路径解析
三种执行模式:npm 安装、独立二进制文件、从源码使用 tsx。
始终使用 src/config.ts 来访问包资源:
import { getPackageDir, getThemeDir } from './config.js'
切勿直接为包资源使用 __dirname。
调试命令
/debug(隐藏)会写入 ~/.pi/agent/pi-debug.log:
- 带 ANSI 代码的已渲染 TUI 行
- 最后发送给 LLM 的消息
测试
./test.sh # 运行非 LLM 测试(不需要 API key)
npm test # 运行所有测试
npm test -- test/specific.test.ts # 运行指定测试
项目结构
packages/
ai/ # LLM provider 抽象
agent/ # Agent 循环和消息类型
tui/ # 终端 UI 组件
coding-agent/ # CLI 和交互模式