feat(coding-agent): isolate SproutClaw namespace from upstream pi
Some checks failed
CI / build-check-test (push) Has been cancelled
Some checks failed
CI / build-check-test (push) Has been cancelled
Use piConfig name sproutclaw and configDir .sproutclaw so commands, env vars, and project config no longer collide with the stock pi install. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
54
.gitignore
vendored
54
.gitignore
vendored
@@ -1,8 +1,8 @@
|
||||
node_modules/
|
||||
dist/
|
||||
|
||||
# Pi persistent config — never commit
|
||||
.pi/
|
||||
# SproutClaw persistent config — never commit
|
||||
.sproutclaw/
|
||||
*.log
|
||||
.DS_Store
|
||||
*.tsbuildinfo
|
||||
@@ -28,7 +28,7 @@ packages/*/dist-firefox/
|
||||
.npm/
|
||||
coverage/
|
||||
.nyc_output/
|
||||
.pi_config/
|
||||
.sproutclaw_config/
|
||||
tui-debug.log
|
||||
compaction-results/
|
||||
.opencode/
|
||||
@@ -39,34 +39,34 @@ out.html
|
||||
packages/coding-agent/binaries/
|
||||
todo.md
|
||||
plans/
|
||||
.pi/hf-sessions/
|
||||
.pi/hf-sessions-backup/
|
||||
.pi/sessions/
|
||||
.pi/extensions/webui/.webui.pid
|
||||
.pi/extensions/webui/.webui.log
|
||||
.sproutclaw/hf-sessions/
|
||||
.sproutclaw/hf-sessions-backup/
|
||||
.sproutclaw/sessions/
|
||||
.sproutclaw/extensions/webui/.webui.pid
|
||||
.sproutclaw/extensions/webui/.webui.log
|
||||
# Local runtime / secrets (do not commit)
|
||||
.local/
|
||||
progress.md
|
||||
|
||||
# Pi agent: track extensions, ignore local runtime secrets and sessions
|
||||
.pi/agent/sessions/
|
||||
.pi/agent/git/
|
||||
.pi/agent/npm/
|
||||
.pi/agent/bin/
|
||||
.pi/agent/data/
|
||||
.pi/agent/auth.json
|
||||
.pi/agent/models.json
|
||||
.pi/agent/settings.json
|
||||
.pi/agent/mcp.json
|
||||
.pi/agent/mcp-cache.json
|
||||
.pi/agent/mcp-npx-cache.json
|
||||
.pi/agent/run-history.jsonl
|
||||
.pi/agent/taskplane/
|
||||
.pi/agent/skills/
|
||||
.pi/agent/skills-disabled/
|
||||
.pi/agent/extensions/webui/frontend/node_modules/
|
||||
.pi/agent/extensions/webui/.webui.pid
|
||||
.pi/agent/extensions/webui/data/
|
||||
# SproutClaw agent: track extensions, ignore local runtime secrets and sessions
|
||||
.sproutclaw/agent/sessions/
|
||||
.sproutclaw/agent/git/
|
||||
.sproutclaw/agent/npm/
|
||||
.sproutclaw/agent/bin/
|
||||
.sproutclaw/agent/data/
|
||||
.sproutclaw/agent/auth.json
|
||||
.sproutclaw/agent/models.json
|
||||
.sproutclaw/agent/settings.json
|
||||
.sproutclaw/agent/mcp.json
|
||||
.sproutclaw/agent/mcp-cache.json
|
||||
.sproutclaw/agent/mcp-npx-cache.json
|
||||
.sproutclaw/agent/run-history.jsonl
|
||||
.sproutclaw/agent/taskplane/
|
||||
.sproutclaw/agent/skills/
|
||||
.sproutclaw/agent/skills-disabled/
|
||||
.sproutclaw/agent/extensions/webui/frontend/node_modules/
|
||||
.sproutclaw/agent/extensions/webui/.webui.pid
|
||||
.sproutclaw/agent/extensions/webui/data/
|
||||
tmp/
|
||||
bun.lock
|
||||
collect.sh
|
||||
|
||||
20
README.md
20
README.md
@@ -24,7 +24,7 @@
|
||||
| `scripts/sync-upstream.sh` | 合并上游 pi-mono 更新 |
|
||||
| `scripts/push-sproutclaw.sh` | 推送到 GitHub / Gitea |
|
||||
|
||||
> `.pi/agent/` 为本地持久化配置目录(settings、auth、sessions、extensions、skills 等),已整体加入 `.gitignore`,不进入版本控制。
|
||||
> `.sproutclaw/agent/` 为本地持久化配置目录(settings、auth、sessions、extensions、skills 等),已整体加入 `.gitignore`,不进入版本控制。与原版 pi 的 `~/.pi/agent/` 完全隔离。
|
||||
|
||||
## 常用命令
|
||||
|
||||
@@ -159,6 +159,7 @@ npm run build
|
||||
|
||||
合并上游时,以下内容**不要误删**:
|
||||
|
||||
- `packages/coding-agent/package.json` 中 `piConfig.name = sproutclaw`、`configDir = .sproutclaw`(命名空间隔离)
|
||||
- `showChangelogOnStartup` 设置项(关闭启动 What's New)
|
||||
- RPC 扩展:`reload` 命令、bash 流式输出(`bash_update`)、`get_extensions` 接口
|
||||
- `sproutclaw` / `build.sh` / `test.sh` 等启动脚本
|
||||
@@ -167,19 +168,32 @@ npm run build
|
||||
|
||||
## 本地配置
|
||||
|
||||
`.pi/agent/` 中以下内容不进 Git:
|
||||
`.sproutclaw/agent/` 中以下内容不进 Git:
|
||||
|
||||
- `settings.json` → 参考 `settings.example.json` 本地复制
|
||||
- `models.json`、`auth.json`、`mcp.json`
|
||||
- `sessions/`、`skills/`、`extensions/`、`prompts/`
|
||||
|
||||
环境变量(可选):
|
||||
|
||||
- `SPROUTCLAW_CODING_AGENT_DIR` — 覆盖 agent 配置目录,默认 `<repo>/.sproutclaw/agent`
|
||||
|
||||
首次部署:
|
||||
|
||||
```bash
|
||||
cp .pi/agent/settings.example.json .pi/agent/settings.json
|
||||
cp .sproutclaw/agent/settings.example.json .sproutclaw/agent/settings.json
|
||||
# 编辑 settings.json 填入 provider / model / auth 信息
|
||||
```
|
||||
|
||||
### 与原版 pi 并存
|
||||
|
||||
| | 原版 pi | SproutClaw |
|
||||
|---|---|---|
|
||||
| 命令 | `pi` | `sproutclaw` / `mengya` |
|
||||
| 全局配置 | `~/.pi/agent/` | `~/.sproutclaw/agent/` |
|
||||
| 项目配置 | `.pi/` | `.sproutclaw/` |
|
||||
| 环境变量 | `PI_CODING_AGENT_DIR` | `SPROUTCLAW_CODING_AGENT_DIR` |
|
||||
|
||||
## 说明
|
||||
|
||||
这个仓库是自用 fork,默认围绕树萌芽的服务器环境、部署规范和日常开发习惯调整。上游能力来自 pi-mono,通过 `git fetch upstream && git merge upstream/main` 定期同步,sproutclaw 定制在 `feature/*` 开发后合入 `main`。
|
||||
|
||||
@@ -6,8 +6,8 @@ set "SCRIPT_DIR=%~dp0"
|
||||
if "%SCRIPT_DIR:~-1%"=="\" set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
|
||||
set "PI_CLI_DIST=%SCRIPT_DIR%\packages\coding-agent\dist\cli.js"
|
||||
|
||||
if not defined PI_CODING_AGENT_DIR (
|
||||
set "PI_CODING_AGENT_DIR=%SCRIPT_DIR%\.pi\agent"
|
||||
if not defined SPROUTCLAW_CODING_AGENT_DIR (
|
||||
set "SPROUTCLAW_CODING_AGENT_DIR=%SCRIPT_DIR%\.sproutclaw\agent"
|
||||
)
|
||||
|
||||
set "NO_ENV=false"
|
||||
|
||||
2
build.sh
2
build.sh
@@ -4,7 +4,7 @@ set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PI_CLI_DIST="$SCRIPT_DIR/packages/coding-agent/dist/cli.js"
|
||||
|
||||
export PI_CODING_AGENT_DIR="${PI_CODING_AGENT_DIR:-$SCRIPT_DIR/.pi/agent}"
|
||||
export SPROUTCLAW_CODING_AGENT_DIR="${SPROUTCLAW_CODING_AGENT_DIR:-$SCRIPT_DIR/.sproutclaw/agent}"
|
||||
|
||||
NO_ENV=false
|
||||
ARGS=()
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
||||
"type": "module",
|
||||
"piConfig": {
|
||||
"configDir": ".pi"
|
||||
"name": "sproutclaw",
|
||||
"configDir": ".sproutclaw"
|
||||
},
|
||||
"bin": {
|
||||
"pi": "dist/cli.js"
|
||||
|
||||
@@ -4,7 +4,7 @@ set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PI_CLI_DIST="$SCRIPT_DIR/packages/coding-agent/dist/cli.js"
|
||||
|
||||
export PI_CODING_AGENT_DIR="${PI_CODING_AGENT_DIR:-$SCRIPT_DIR/.pi/agent}"
|
||||
export SPROUTCLAW_CODING_AGENT_DIR="${SPROUTCLAW_CODING_AGENT_DIR:-$SCRIPT_DIR/.sproutclaw/agent}"
|
||||
|
||||
if [[ ! -f "$PI_CLI_DIST" ]]; then
|
||||
echo "Build output not found: $PI_CLI_DIST" >&2
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
setlocal
|
||||
set "SCRIPT_DIR=%~dp0"
|
||||
if "%SCRIPT_DIR:~-1%"=="" set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
|
||||
if not defined PI_CODING_AGENT_DIR (
|
||||
set "PI_CODING_AGENT_DIR=%SCRIPT_DIR%.piagent"
|
||||
if not defined SPROUTCLAW_CODING_AGENT_DIR (
|
||||
set "SPROUTCLAW_CODING_AGENT_DIR=%SCRIPT_DIR%\.sproutclaw\agent"
|
||||
)
|
||||
|
||||
if "%~1"=="" goto run
|
||||
|
||||
3
test.ps1
3
test.ps1
@@ -1,6 +1,9 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
if (-not $env:SPROUTCLAW_CODING_AGENT_DIR) {
|
||||
$env:SPROUTCLAW_CODING_AGENT_DIR = Join-Path $scriptDir ".sproutclaw\agent"
|
||||
}
|
||||
$noEnv = $false
|
||||
$forwardArgs = New-Object System.Collections.Generic.List[string]
|
||||
|
||||
|
||||
2
test.sh
2
test.sh
@@ -5,7 +5,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Default to the repository-local pi config so this source checkout uses the
|
||||
# copied learning config instead of ~/.pi.
|
||||
export PI_CODING_AGENT_DIR="${PI_CODING_AGENT_DIR:-$SCRIPT_DIR/.pi/agent}"
|
||||
export SPROUTCLAW_CODING_AGENT_DIR="${SPROUTCLAW_CODING_AGENT_DIR:-$SCRIPT_DIR/.sproutclaw/agent}"
|
||||
|
||||
# Check for --no-env flag
|
||||
NO_ENV=false
|
||||
|
||||
Reference in New Issue
Block a user