开发
参见 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 会保留调用者的当前工作目录。
复刻 / 重新品牌化
通过 package.json:
{
"piConfig": {
"name": "pi",
"configDir": ".pi"
}
}更改 name, configDir 和 bin 字段来配置你的复刻版本。这会影响 CLI 横幅、配置路径和环境变量名称。
路径解析
三种执行模式:npm install、独立二进制文件、从源码使用 tsx。
始终使用 src/config.ts 来获取包资源:
import { getPackageDir, getThemeDir } from "./config.js";切勿直接使用 __dirname 来获取包资源。
调试命令
/debug (隐藏)写入 ~/.pi/agent/pi-debug.log:
- 渲染的 TUI 行(含 ANSI 代码)
- 发送给 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