Pi 的配置、擴充、平台設定和 API 參考。

發展

請參閱 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"
  }
}

更改您的 fork 的 nameconfigDirbin 欄位。影響 CLI 橫幅、配置路徑和環境變數名稱。

路徑分辨率

三種執行模式:npm安裝、獨立二進位、來自原始碼的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