Pi 官方文档
开发
开发
另请参阅 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 install、独立二进制文件、从源码运行的 tsx。
包资源一律使用 src/config.ts:
import { getPackageDir, getThemeDir } from "./config.js";
不要直接对包资源使用 __dirname。
调试命令
隐藏的 /debug 会写入 ~/.pi/agent/pi-debug.log:
- 带有 ANSI 代码的渲染后 TUI 行
- 发送给 LLM 的最后几条消息
测试
./test.sh # Run non-LLM tests (no API keys needed)
npm test # Run all tests
npm test -- test/specific.test.ts # Run specific test
项目结构
packages/
ai/ # LLM provider abstraction
agent/ # Agent loop and message types
tui/ # Terminal UI components
coding-agent/ # CLI and interactive mode