feat: govern merged NC01 worktrees

This commit is contained in:
pikastech
2026-07-21 09:44:04 +02:00
parent 4bc272f47d
commit c001309ed5
7 changed files with 323 additions and 8 deletions
+26
View File
@@ -120,6 +120,32 @@ rm -rf -- /tmp/unidesk-cli-output
- provider host 统一使用 `bun scripts/cli.ts gc remote <providerId> ...`
- 远端长任务必须异步执行,并用 `status --job-id` 短查询,不得维持长 SSH 会话。
### 已合并 worktree
先读取 YAML 策略并只生成计划:
```bash
bun scripts/cli.ts gc remote <providerId> merged-worktrees plan
```
- 仅枚举 Git 登记且位于 `workspaceRoots` 的 worktree
- dirty、活跃、近期、未被 `baseRef` 吸收、cherry 检查超时和主 worktree 必须显示为 protected
- 手动入口与 policy timer 复用同一筛选器,批量上限分别读取 YAML 的手动和自动字段;
- 执行前逐项重新计划,只允许 `git worktree remove`,不得删除 branch 或使用 `rm -rf`
复核候选后才允许执行:
```bash
bun scripts/cli.ts gc remote <providerId> merged-worktrees run --confirm
```
周期 stage 通过以下入口核对 YAML 字段、stage 和 `inSync`
```bash
bun scripts/cli.ts gc remote <providerId> policy plan
bun scripts/cli.ts gc remote <providerId> policy status
```
### 内存分布与 Kubernetes 留存
先用紧凑 overview 归因真实内存压力: