teamsmith 0.0.0-stage → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +158 -2
- package/bin/team.mjs +59 -0
- package/install.sh +94 -0
- package/package.json +37 -4
- package/skills/teamsmith/CHANGELOG.md +763 -0
- package/skills/teamsmith/SKILL.md +312 -0
- package/skills/teamsmith/extension/team-bg.ts +435 -0
- package/skills/teamsmith/extension/team-inbox-watch.ts +1412 -0
- package/skills/teamsmith/extension/team-notify.ts +663 -0
- package/skills/teamsmith/references/agent-adapters.md +643 -0
- package/skills/teamsmith/references/config.md +477 -0
- package/skills/teamsmith/references/meeting.md +124 -0
- package/skills/teamsmith/references/memory.md +133 -0
- package/skills/teamsmith/references/migration.md +227 -0
- package/skills/teamsmith/references/openspec.md +222 -0
- package/skills/teamsmith/references/philosophy.md +95 -0
- package/skills/teamsmith/references/protocol.md +712 -0
- package/skills/teamsmith/references/troubleshooting.md +1384 -0
- package/skills/teamsmith/references/workflows.md +448 -0
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +1709 -0
- package/skills/teamsmith/scripts/lib/cmd-bg.sh +284 -0
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +311 -0
- package/skills/teamsmith/scripts/lib/cmd-config.sh +1156 -0
- package/skills/teamsmith/scripts/lib/cmd-death.sh +562 -0
- package/skills/teamsmith/scripts/lib/cmd-docs.sh +149 -0
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +124 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +212 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +904 -0
- package/skills/teamsmith/scripts/lib/cmd-outbox.sh +196 -0
- package/skills/teamsmith/scripts/lib/cmd-project.sh +642 -0
- package/skills/teamsmith/scripts/lib/cmd-review.sh +1393 -0
- package/skills/teamsmith/scripts/lib/cmd-status.sh +1399 -0
- package/skills/teamsmith/scripts/lib/cmd-update.sh +191 -0
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +1681 -0
- package/skills/teamsmith/scripts/lib/common.sh +4964 -0
- package/skills/teamsmith/scripts/lib/draft-entry.sh +51 -0
- package/skills/teamsmith/scripts/lib/outbox.sh +2042 -0
- package/skills/teamsmith/scripts/lib/tmux-argv.sh +165 -0
- package/skills/teamsmith/scripts/monitor.mjs +616 -0
- package/skills/teamsmith/scripts/panel/README.md +192 -0
- package/skills/teamsmith/scripts/panel/build.sh +47 -0
- package/skills/teamsmith/scripts/panel/bun.lock +109 -0
- package/skills/teamsmith/scripts/panel/draft-send.sh +68 -0
- package/skills/teamsmith/scripts/panel/package.json +24 -0
- package/skills/teamsmith/scripts/panel/panel.js +388 -0
- package/skills/teamsmith/scripts/panel/src/App.tsx +2150 -0
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +154 -0
- package/skills/teamsmith/scripts/panel/src/compose.ts +691 -0
- package/skills/teamsmith/scripts/panel/src/data.ts +555 -0
- package/skills/teamsmith/scripts/panel/src/format.ts +50 -0
- package/skills/teamsmith/scripts/panel/src/layout.ts +2562 -0
- package/skills/teamsmith/scripts/panel/src/main.tsx +894 -0
- package/skills/teamsmith/scripts/panel/src/markdown.ts +340 -0
- package/skills/teamsmith/scripts/panel/src/sanitize.ts +42 -0
- package/skills/teamsmith/scripts/panel/src/settings.ts +154 -0
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +416 -0
- package/skills/teamsmith/scripts/panel/src/strings/index.ts +65 -0
- package/skills/teamsmith/scripts/panel/src/strings/types.ts +9 -0
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +414 -0
- package/skills/teamsmith/scripts/panel/src/theme.ts +116 -0
- package/skills/teamsmith/scripts/panel/src/types.ts +652 -0
- package/skills/teamsmith/scripts/panel/src/width.ts +105 -0
- package/skills/teamsmith/scripts/panel/tsconfig.json +16 -0
- package/skills/teamsmith/scripts/shim/signal-gate +156 -0
- package/skills/teamsmith/scripts/shim/tmux +403 -0
- package/skills/teamsmith/scripts/team +143 -0
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +147 -0
- package/skills/teamsmith/templates/BOARD.md.tmpl +18 -0
- package/skills/teamsmith/templates/DECISIONS.md.tmpl +22 -0
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +25 -0
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +84 -0
- package/skills/teamsmith/templates/ROADMAP.md.tmpl +29 -0
- package/skills/teamsmith/templates/config.sh.tmpl +106 -0
- package/skills/teamsmith/templates/memory-seed.md.tmpl +46 -0
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +110 -0
- package/skills/teamsmith/templates/report.md.tmpl +36 -0
- package/skills/teamsmith/templates/task.md.tmpl +65 -0
- package/skills/teamsmith/templates/threads-README.md +17 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +682 -0
- package/skills/teamsmith/tests/bg-ledger.sh +307 -0
- package/skills/teamsmith/tests/checkout-shape-probe.sh +800 -0
- package/skills/teamsmith/tests/config-cli.sh +1562 -0
- package/skills/teamsmith/tests/container-tmux.sh +493 -0
- package/skills/teamsmith/tests/coverage-inventory.sh +173 -0
- package/skills/teamsmith/tests/death-cause.sh +564 -0
- package/skills/teamsmith/tests/delivery-truth.sh +1231 -0
- package/skills/teamsmith/tests/fake-tui.py +450 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/README.md +60 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-second.py +139 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/mock-server.py +29 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/observe.ts +20 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh +79 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +175 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +229 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/README.md +22 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/dev2.seen +8 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/dev2.wake +9 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/pm-nudges.wake +3 -0
- package/skills/teamsmith/tests/fixtures/signal-lint-cases.txt +40 -0
- package/skills/teamsmith/tests/flip-glue.sh +162 -0
- package/skills/teamsmith/tests/flip-m12-26c.sh +129 -0
- package/skills/teamsmith/tests/flip-m12.sh +185 -0
- package/skills/teamsmith/tests/flip-m16.sh +166 -0
- package/skills/teamsmith/tests/flip-m17.sh +204 -0
- package/skills/teamsmith/tests/flip-m33.sh +284 -0
- package/skills/teamsmith/tests/flip-m34.sh +96 -0
- package/skills/teamsmith/tests/flip-m37.sh +185 -0
- package/skills/teamsmith/tests/flip-m4.3.sh +375 -0
- package/skills/teamsmith/tests/flip-m43.sh +128 -0
- package/skills/teamsmith/tests/flip-m44.sh +262 -0
- package/skills/teamsmith/tests/flip-m45.sh +244 -0
- package/skills/teamsmith/tests/flip-m46.sh +238 -0
- package/skills/teamsmith/tests/flip-m48.sh +304 -0
- package/skills/teamsmith/tests/flip-m6.2.sh +205 -0
- package/skills/teamsmith/tests/flip-m6.3.sh +283 -0
- package/skills/teamsmith/tests/flip-m6.4.sh +267 -0
- package/skills/teamsmith/tests/flip-m6.5.sh +113 -0
- package/skills/teamsmith/tests/flip-m7.1.sh +135 -0
- package/skills/teamsmith/tests/flip-m7.2.sh +321 -0
- package/skills/teamsmith/tests/flip-p144.sh +112 -0
- package/skills/teamsmith/tests/flip-p156.sh +133 -0
- package/skills/teamsmith/tests/flip-p158.sh +301 -0
- package/skills/teamsmith/tests/flip-p160.sh +182 -0
- package/skills/teamsmith/tests/flip-p171.sh +249 -0
- package/skills/teamsmith/tests/flip-p18.1.sh +95 -0
- package/skills/teamsmith/tests/flip-p20.sh +286 -0
- package/skills/teamsmith/tests/flip-p201.sh +249 -0
- package/skills/teamsmith/tests/flip-p210.sh +239 -0
- package/skills/teamsmith/tests/flip-p211.sh +152 -0
- package/skills/teamsmith/tests/flip-p217.sh +288 -0
- package/skills/teamsmith/tests/flip-p22.sh +123 -0
- package/skills/teamsmith/tests/flip-p23.sh +239 -0
- package/skills/teamsmith/tests/flip-p25.sh +165 -0
- package/skills/teamsmith/tests/flip-p71.sh +184 -0
- package/skills/teamsmith/tests/flip-p72.sh +202 -0
- package/skills/teamsmith/tests/frames/README.md +176 -0
- package/skills/teamsmith/tests/frames/p78-conversation-rule-below-box.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-cursor-mid-draft.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor-line.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-blank-region.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-only.txt +5 -0
- package/skills/teamsmith/tests/frames/p78-spinner-row-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-wider-rule-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p86-f1-mixed-width-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/p86-f1-narrower-width-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/p86-f1-spinner-top-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/pi-0.85.1-update-banner.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-draft-half-sentence.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-empty-box.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-one-line-draft.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-project-trust-prompt.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.99.2-empty-editor.txt +32 -0
- package/skills/teamsmith/tests/frames/pi-0.99.2-human-draft.txt +32 -0
- package/skills/teamsmith/tests/frames/pi-1.0.0-git-error-in-box.txt +32 -0
- package/skills/teamsmith/tests/gate-guard.sh +112 -0
- package/skills/teamsmith/tests/guard-matrix.sh +233 -0
- package/skills/teamsmith/tests/install-shape.sh +731 -0
- package/skills/teamsmith/tests/ledger-ban.sh +612 -0
- package/skills/teamsmith/tests/lib/box-judge.sh +68 -0
- package/skills/teamsmith/tests/lib/checkout-shape.sh +129 -0
- package/skills/teamsmith/tests/lib/loop-scan.awk +114 -0
- package/skills/teamsmith/tests/lib/pty-wait.sh +676 -0
- package/skills/teamsmith/tests/lib/section-guard.sh +855 -0
- package/skills/teamsmith/tests/lib/shell-lex.pl +261 -0
- package/skills/teamsmith/tests/lib/tmp-root.sh +528 -0
- package/skills/teamsmith/tests/lib/tmux-cap.sh +35 -0
- package/skills/teamsmith/tests/lib/tmux-iso-call-probe.sh +81 -0
- package/skills/teamsmith/tests/lib/tmux-iso-probe.sh +46 -0
- package/skills/teamsmith/tests/lib/tmux-iso.sh +381 -0
- package/skills/teamsmith/tests/load-experiment.sh +290 -0
- package/skills/teamsmith/tests/loop-inventory.tsv +84 -0
- package/skills/teamsmith/tests/panel-b2-slow-stub.sh +19 -0
- package/skills/teamsmith/tests/panel-b2.sh +1183 -0
- package/skills/teamsmith/tests/panel-b3-pty-mouse.py +240 -0
- package/skills/teamsmith/tests/panel-b3-pty-tmux-mouse.py +138 -0
- package/skills/teamsmith/tests/panel-b3-stub.sh +279 -0
- package/skills/teamsmith/tests/panel-b3.sh +1301 -0
- package/skills/teamsmith/tests/panel-choices.sh +572 -0
- package/skills/teamsmith/tests/panel-clipboard-model.ts +187 -0
- package/skills/teamsmith/tests/panel-compose-model.ts +290 -0
- package/skills/teamsmith/tests/panel-contrast.mjs +81 -0
- package/skills/teamsmith/tests/panel-cpu-premise.sh +173 -0
- package/skills/teamsmith/tests/panel-cpu.sh +391 -0
- package/skills/teamsmith/tests/panel-flip-m54.sh +207 -0
- package/skills/teamsmith/tests/panel-flip-p123.sh +278 -0
- package/skills/teamsmith/tests/panel-flip-p125.sh +318 -0
- package/skills/teamsmith/tests/panel-flip-p128.sh +259 -0
- package/skills/teamsmith/tests/panel-keyprobe-pty.py +99 -0
- package/skills/teamsmith/tests/panel-keyprobe-stub.sh +41 -0
- package/skills/teamsmith/tests/panel-keyprobe.sh +82 -0
- package/skills/teamsmith/tests/panel-keyprobe.tsx +116 -0
- package/skills/teamsmith/tests/panel-knobs.sh +83 -0
- package/skills/teamsmith/tests/panel-p21.sh +2181 -0
- package/skills/teamsmith/tests/panel-snapshots.sh +802 -0
- package/skills/teamsmith/tests/panel-strings.mjs +195 -0
- package/skills/teamsmith/tests/perf.sh +740 -0
- package/skills/teamsmith/tests/pm-box-real.sh +350 -0
- package/skills/teamsmith/tests/pulse-nudge-key.sh +563 -0
- package/skills/teamsmith/tests/routes.sh +1652 -0
- package/skills/teamsmith/tests/section-budgets.tsv +150 -0
- package/skills/teamsmith/tests/section-guard.sh +231 -0
- package/skills/teamsmith/tests/section-needs-audit.sh +94 -0
- package/skills/teamsmith/tests/section-paths.tsv +142 -0
- package/skills/teamsmith/tests/section-select.sh +655 -0
- package/skills/teamsmith/tests/signal-gate.sh +366 -0
- package/skills/teamsmith/tests/signal-lint-legacy.txt +14 -0
- package/skills/teamsmith/tests/signal-lint.pl +416 -0
- package/skills/teamsmith/tests/skill-load.mjs +65 -0
- package/skills/teamsmith/tests/smoke.sh +19711 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-160.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-99.txt +32 -0
- package/skills/teamsmith/tests/spec-ledger-refs.tsv +78 -0
- package/skills/teamsmith/tests/spec-refs.sh +826 -0
- package/skills/teamsmith/tests/task-header-model.sh +267 -0
- package/skills/teamsmith/tests/team-bg-flip.sh +239 -0
- package/skills/teamsmith/tests/team-bg-harness.mjs +392 -0
- package/skills/teamsmith/tests/team-bg-stop.sh +434 -0
- package/skills/teamsmith/tests/team-inbox-watch-flip.sh +191 -0
- package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +1559 -0
- package/skills/teamsmith/tests/tmp-hygiene.sh +1190 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +31 -0
- package/skills/teamsmith/tests/tmux-lint.pl +604 -0
- package/skills/teamsmith-init/SKILL.md +100 -0
- package/skills/teamsmith-init/references/bootstrap.md +74 -0
- package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +46 -0
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# teamsmith · init / doctor / help
|
|
3
|
+
|
|
4
|
+
team_help() {
|
|
5
|
+
cat <<'EOF'
|
|
6
|
+
teamsmith — 用 Pi Agent 组建一个可复用的多 Agent 团队(PM 编排 + worker 并行)
|
|
7
|
+
|
|
8
|
+
用法: team <command> [args...] [--yes]
|
|
9
|
+
|
|
10
|
+
── 第一次使用 ─────────────────────────────────────────────
|
|
11
|
+
bootstrap [--agents "dev verify"] [--print] **推荐**:一条命令把项目初始化到可派单状态
|
|
12
|
+
(探测当前 tmux session/窗口 → 写配置 + 文档骨架 + AGENTS 段落 → 把 skill 装进项目
|
|
13
|
+
.pi/skills/ → 建 agent worktree → 起巡检窗口 → 打印下一步清单);幂等,可反复跑
|
|
14
|
+
init 只做配置/文档骨架 + 把 skill 装进项目 .pi/skills/(bootstrap 的其中一步)
|
|
15
|
+
--copy 复制一份(默认软链,跟随包更新);--no-skills 跳过装 skill;--force 覆盖冲突条目
|
|
16
|
+
doctor 环境自检(git/tmux/pi/门禁/forge/容量/容器)
|
|
17
|
+
|
|
18
|
+
── 观察 ───────────────────────────────────────────────────
|
|
19
|
+
roster 名册:agent、窗口是否在跑、分支、脏文件、领先提交数
|
|
20
|
+
status [ID] roster + 任务/report 状态;给 ID 时只显示该任务
|
|
21
|
+
ps 容量:RAM/swap/还能再跑几个 agent + 模型并发占用(派单前看)
|
|
22
|
+
bg list|stop <id> 后台作业车道:list 看本项目记录到的作业(pid/启动指纹/命令);stop 只按记录里的
|
|
23
|
+
(pid, 启动时间指纹) 停那一个作业(组内子孙一起;身份对不上就拒)
|
|
24
|
+
digest 给 PM 的待办摘要:收件箱未处理项 + 待复验报告 + 任务状态
|
|
25
|
+
inbox [agent] 打印收件箱(agent 在回合结束时自动追加)
|
|
26
|
+
paths 打印当前解析出的路径/ session(JSON),排障用
|
|
27
|
+
config list|set|log|set-agent-model
|
|
28
|
+
项目契约(.pi/team/config.sh)的读写面:list 列每个键的效果类(apply/restart/refuse)
|
|
29
|
+
与默认值;set 是**唯一写入口**(值校验 + sha256 指纹 CAS + 原子写 + 审计);
|
|
30
|
+
log 看审计尾部;set-agent-model 按席位改模型(- 移除覆盖)
|
|
31
|
+
|
|
32
|
+
── 文档契约(PM 维护) ─────────────────────────────────────
|
|
33
|
+
task ID --title ... [--agent a] [--deps ...] [--issue N]
|
|
34
|
+
生成任务书 <docs>/tasks/ID-slug.md 并在 BOARD.md 建行
|
|
35
|
+
board add|assign|set|row|ls BOARD.md 行管理(add [--allow-dup] / assign ID agent / set ID 状态 / row ID / ls)
|
|
36
|
+
change status <id> [--json]
|
|
37
|
+
change 的 readiness 视图(只读):任务/阶段/agent/看板/证据、delta 写者、阻塞项;
|
|
38
|
+
ready(至少一个任务且全部结束)→ 退出码 0,否则 1
|
|
39
|
+
thread <agent> ["msg"] 追加 / 读取往来记录(append-only)
|
|
40
|
+
report ID <agent> [--force] 生成报告骨架
|
|
41
|
+
|
|
42
|
+
── 派单与协作 ─────────────────────────────────────────────
|
|
43
|
+
add-agent <a> [--register] [--model m] [--create] [--no-install] [--print] 建长期 worktree(分支 agent/<a>);
|
|
44
|
+
名册:--register 走审计写入器(不带旗标的未知席位会被拒,并给出两条真路线)
|
|
45
|
+
dispatch <a> <ID> <task-file> [--model m] [--branch <name>] [--fresh] [--allow-overflow] [--print]
|
|
46
|
+
在 tmux 窗口起一个交互式 pi(默认复用会话,可断点续跑);--branch 声明这次必须用的任务分支
|
|
47
|
+
say <a> "<一句话>" [--now] 往 agent 窗口发消息;目标输入框里有草稿就**延后投递**(state/outbox/
|
|
48
|
+
+ 返回 queued);--now = 故意跳过守卫粘字(记入 outbox/forced.log)
|
|
49
|
+
notify <a> "<一句话>" [--from <发送者>] agent → PM 一句话(发送者按运行时目录解析;写收件箱 + 唤醒 PM 窗口)
|
|
50
|
+
draft [pm] 人的草稿入口:开/复用 draft 窗口跑 $EDITOR,保存退出后自动入队(不抢焦点)
|
|
51
|
+
draft send [<文件>] [--now] 无头形式:把草稿文件整段投递(守卫路径)
|
|
52
|
+
outbox [list] 延后队列:待投递条目(活动 + held,编号供 drop)
|
|
53
|
+
outbox flush [--now] 立刻排水(--now = 跳过守卫直投,留审计)
|
|
54
|
+
outbox drop <n|all> 人显式丢弃队列条目
|
|
55
|
+
|
|
56
|
+
── 定时巡检(pulse 由 PM 配置和维护) ────────────────────
|
|
57
|
+
pulse up|down|restart|status|logs [--print]
|
|
58
|
+
巡检(同 session 的 pulse 窗口跑 monitor + 定时巡检;只有一个后端,无容器依赖)
|
|
59
|
+
watchdog …/watchdog-status/install-watchdog/uninstall-watchdog
|
|
60
|
+
pulse 的旧名(别名期保留到 v2.0.0;先印一行弃用提示,再转交 pulse)
|
|
61
|
+
monitor [--once] [--print|--json] [--width N] [--height N] [--interval N] [--events K] [--no-pulse]
|
|
62
|
+
状态面板(pulse 窗口跑的就是它):默认 TUI(Ink),管道/--print 出纯文本,--json 出机读对象;
|
|
63
|
+
非 TTY 自动走纯文本;按周期顺带跑巡检(--no-pulse = 只看不巡)。需要 node/bun/tsx(D19)
|
|
64
|
+
watch [--once] [--interval N] [--ui] 手动/前台巡检(--ui = monitor)
|
|
65
|
+
standby [on|off|status] [--reason "..."] PM 主动停工:on 之后 pulse 不再叫醒(人处理完 off)
|
|
66
|
+
|
|
67
|
+
── 跨项目会议(PM 对 PM 的 peer 交流,不是指令通道) ─────────
|
|
68
|
+
meeting open <slug> --with <项目>[:<session>] --topic "…" [--ttl 72] [--yes]
|
|
69
|
+
meeting say <slug> --intent <info|question|report|proposal|request> "…" [--knock]
|
|
70
|
+
meeting read <slug> [--since N] [--peek] | meeting inbox | meeting list [--all]
|
|
71
|
+
meeting propose <slug> "…" | meeting agree <slug> <A1> [--note "…"] | meeting close <slug>
|
|
72
|
+
up [--agents] [--print] [--fresh-pm]
|
|
73
|
+
恢复 PM:建 tmux 场地 + 把 PM 拉起来(默认 pi -c 续上本目录上一个会话)
|
|
74
|
+
--fresh-pm = 本次启动新开一场对话(不 -c;旧会话文件原样留在历史里,作为开工记录);
|
|
75
|
+
它最优先:这一次启动里 TEAM_PM_SESSION_ID / TEAM_PM_RESUME_ARGS 都不生效,且只影响
|
|
76
|
+
这一次启动、不写进配置(守护/巡检按配置拉起 PM 时照旧续跑;--print 会打出判定与命令)
|
|
77
|
+
resume [--agent a] [--all] [--dry-run] PM 的工具:把停了但没交活的 agent 续跑
|
|
78
|
+
|
|
79
|
+
── 复验 / 合并 / 收尾 ─────────────────────────────────────
|
|
80
|
+
review ID --dir <独立checkout> [--no-gates] [--strong] [--allow-unresolved-branch]
|
|
81
|
+
独立 detached worktree 上 checkout 分支 → 跑门禁 → 写
|
|
82
|
+
<docs>/reviews/ID.md(PM 复验证据,不接受 agent 自述)
|
|
83
|
+
脏树 / 被忽略产物 / --branch 解析不到 → 默认拒绝(覆盖开关 TEAM_REVIEW_ALLOW_*)
|
|
84
|
+
close ID 收尾:更新 BOARD、关窗口、保留 worktree(git 由 PM 做)
|
|
85
|
+
teardown [--agent a] [--all] [--purge] [--force] [--register] 关窗口 / 删 worktree(--purge 才删 worktree);
|
|
86
|
+
--register = 先从名册移除该席位(同样走审计写入器)
|
|
87
|
+
|
|
88
|
+
smoke 在临时仓库里端到端自测这套工具(不碰当前项目)
|
|
89
|
+
perf 性能判定(交互首帧 / 帧装配 / 稳态窗格 CPU):默认在参考镜像里跑;--host = 宿主(非参考环境)
|
|
90
|
+
── 版本与更新(skill 更新怎么拿到) ─────────────────────────
|
|
91
|
+
mark-loaded [--version X] 记录本会话加载的 skill 版本(PM 开局跑一次)
|
|
92
|
+
version [--check] 看磁盘版本 / SKILL.md 版本 / CHANGELOG / 本会话加载版本;--check 给结论
|
|
93
|
+
changelog [--since X] 看 skill 变更史
|
|
94
|
+
reload [--done] 请求重载(在 Pi 里 /reload 或 /teamsmith-reload 立即生效)
|
|
95
|
+
version / help
|
|
96
|
+
|
|
97
|
+
配置:项目根 .pi/team/config.sh(见 references/config.md)。
|
|
98
|
+
协议:<docs>/PROTOCOL.md 或 SKILL.md 里的一页速览。
|
|
99
|
+
EOF
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# ---------------------------------------------------------------- init
|
|
103
|
+
team_write_section() { # <file> <begin-marker> <end-marker> <content-file>
|
|
104
|
+
local target="$1" begin="$2" end="$3" content="$4"
|
|
105
|
+
mkdir -p "$(dirname "$target")"
|
|
106
|
+
[ -f "$target" ] || : > "$target"
|
|
107
|
+
if grep -qF "$begin" "$target"; then
|
|
108
|
+
awk -v b="$begin" -v e="$end" -v cf="$content" '
|
|
109
|
+
$0==b { inb=1; print; while ((getline l < cf) > 0) { if (l==b || l==e) continue; print l }; close(cf); next }
|
|
110
|
+
inb { if ($0==e) { inb=0; print }; next }
|
|
111
|
+
{ print }
|
|
112
|
+
' "$target" > "$target.tmp" && mv "$target.tmp" "$target"
|
|
113
|
+
team_ok "update $target(协议段落已刷新)"
|
|
114
|
+
else
|
|
115
|
+
{ [ -s "$target" ] && printf '\n'; printf '%s\n' "$begin"; grep -vFxf <(printf '%s\n%s\n' "$begin" "$end") "$content"; printf '%s\n' "$end"; } >> "$target"
|
|
116
|
+
team_ok "append $target(团队协议段落)"
|
|
117
|
+
fi
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
team_gitignore_add() { # <entry> ...
|
|
121
|
+
local f="$TEAM_MAIN_ROOT/.gitignore" e added=0
|
|
122
|
+
touch "$f"
|
|
123
|
+
grep -q '^# teamsmith' "$f" || { printf '\n# teamsmith\n' >> "$f"; }
|
|
124
|
+
for e in "$@"; do
|
|
125
|
+
grep -qxF "$e" "$f" && continue
|
|
126
|
+
printf '%s\n' "$e" >> "$f"
|
|
127
|
+
added=$((added + 1))
|
|
128
|
+
done
|
|
129
|
+
[ "$added" -gt 0 ] && team_ok "update .gitignore($added 条)" || team_dim "skip .gitignore"
|
|
130
|
+
return 0
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
team_detect_gates() {
|
|
134
|
+
[ -n "$TEAM_GATES" ] && { printf '%s' "$TEAM_GATES"; return; }
|
|
135
|
+
local pm="-"
|
|
136
|
+
[ -f "$TEAM_MAIN_ROOT/pnpm-lock.yaml" ] && pm="pnpm"
|
|
137
|
+
[ -f "$TEAM_MAIN_ROOT/yarn.lock" ] && pm="yarn"
|
|
138
|
+
[ -f "$TEAM_MAIN_ROOT/bun.lockb" ] && pm="bun"
|
|
139
|
+
[ -f "$TEAM_MAIN_ROOT/package-lock.json" ] && pm="npm"
|
|
140
|
+
if [ -f "$TEAM_MAIN_ROOT/package.json" ]; then
|
|
141
|
+
if grep -q '"verify"[[:space:]]*:' "$TEAM_MAIN_ROOT/package.json"; then
|
|
142
|
+
case "$pm" in pnpm) printf 'pnpm verify' ;; yarn) printf 'yarn verify' ;; bun) printf 'bun run verify' ;; *) printf 'npm run verify' ;; esac
|
|
143
|
+
return
|
|
144
|
+
fi
|
|
145
|
+
if grep -q '"test"[[:space:]]*:' "$TEAM_MAIN_ROOT/package.json"; then
|
|
146
|
+
case "$pm" in pnpm) printf 'pnpm test' ;; yarn) printf 'yarn test' ;; bun) printf 'bun test' ;; *) printf 'npm test' ;; esac
|
|
147
|
+
return
|
|
148
|
+
fi
|
|
149
|
+
fi
|
|
150
|
+
printf ''
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
team_detect_vcs() {
|
|
154
|
+
local url; url="$(team_git remote get-url origin 2>/dev/null || true)"
|
|
155
|
+
case "$url" in
|
|
156
|
+
*github.com*) printf 'github' ;;
|
|
157
|
+
*gitlab*) printf 'gitlab' ;;
|
|
158
|
+
*) printf 'local' ;;
|
|
159
|
+
esac
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
team_cmd_init() {
|
|
163
|
+
local session="" agents="" vcs="" gates="" docs="" pmwin="" model="" force=0 install_mode=""
|
|
164
|
+
while [ $# -gt 0 ]; do
|
|
165
|
+
case "$1" in
|
|
166
|
+
--session) session="${2:?}"; shift 2 ;;
|
|
167
|
+
--agents) agents="${2:?}"; shift 2 ;;
|
|
168
|
+
--vcs) vcs="${2:?}"; shift 2 ;;
|
|
169
|
+
--gates) gates="${2:?}"; shift 2 ;;
|
|
170
|
+
--docs) docs="${2:?}"; shift 2 ;;
|
|
171
|
+
--pm-window) pmwin="${2:?}"; shift 2 ;;
|
|
172
|
+
--model) model="${2:?}"; shift 2 ;;
|
|
173
|
+
--copy) install_mode="--copy"; shift ;;
|
|
174
|
+
--no-skills) install_mode="--no-skills"; shift ;;
|
|
175
|
+
--force) force=1; shift ;;
|
|
176
|
+
*) team_usage_die "init: 未知参数 $1" ;;
|
|
177
|
+
esac
|
|
178
|
+
done
|
|
179
|
+
|
|
180
|
+
local project; project="$(basename "$TEAM_MAIN_ROOT")"
|
|
181
|
+
session="${session:-$project}"
|
|
182
|
+
agents="${agents:-dev verify}"
|
|
183
|
+
vcs="${vcs:-$(team_detect_vcs)}"
|
|
184
|
+
docs="${docs:-docs/team}"
|
|
185
|
+
pmwin="${pmwin:-pm}"
|
|
186
|
+
model="${model:-deepseek/deepseek-flash}"
|
|
187
|
+
# --force = 重渲染整份契约:此时不把**旧契约读回来的** TEAM_GATES 当模板值 —— 它是旧值,
|
|
188
|
+
# 不是这次要渲染的模板值(P99 身份 note 承诺的代价:其它键回到模板值)。真正从环境继承
|
|
189
|
+
# (export 过)的值仍算显式覆盖,照旧优先。
|
|
190
|
+
if [ "$force" = "1" ] && [ -z "$gates" ]; then
|
|
191
|
+
local _gates_exported=0 _gates_keep="$TEAM_GATES"
|
|
192
|
+
case "$(declare -p TEAM_GATES 2>/dev/null || true)" in "declare -x"*) _gates_exported=1 ;; esac
|
|
193
|
+
if [ "$_gates_exported" = "1" ]; then
|
|
194
|
+
gates="$TEAM_GATES"
|
|
195
|
+
else
|
|
196
|
+
TEAM_GATES=""
|
|
197
|
+
gates="$(team_detect_gates)"
|
|
198
|
+
TEAM_GATES="$_gates_keep"
|
|
199
|
+
fi
|
|
200
|
+
else
|
|
201
|
+
gates="${gates:-$(team_detect_gates)}"
|
|
202
|
+
fi
|
|
203
|
+
|
|
204
|
+
# 门禁值是契约里的一个键(P21 任务 1.7):写入前用唯一校验器验一遍。旧行为是把它塞进模板就完事,
|
|
205
|
+
# 值里带 `#` 时 notify 读取器会截断、带换行时契约直接坏掉,而 init 照样报成功。
|
|
206
|
+
if [ -n "$gates" ]; then
|
|
207
|
+
local gates_reason
|
|
208
|
+
if ! gates_reason="$(team_config_validate_value TEAM_GATES "$gates")"; then
|
|
209
|
+
team_err "init: --gates 的值不能写进契约($gates_reason)"
|
|
210
|
+
team_dim " 契约是单行 KEY='value' 文件:不能含换行或 #;要么换一个能表示的值,要么手改 .pi/team/config.sh"
|
|
211
|
+
return 1
|
|
212
|
+
fi
|
|
213
|
+
fi
|
|
214
|
+
|
|
215
|
+
team_hdr "teamsmith init → $TEAM_MAIN_ROOT"
|
|
216
|
+
|
|
217
|
+
# 1) 配置
|
|
218
|
+
TEAM_AGENTS="$agents"; TEAM_DOCS_DIR="$docs"
|
|
219
|
+
local cfg="$TEAM_MAIN_ROOT/.pi/team/config.sh" tmpl; tmpl="$(team_tmpl_dir)/config.sh.tmpl"
|
|
220
|
+
if [ -f "$cfg" ] && [ "$force" != "1" ]; then
|
|
221
|
+
team_dim "skip $cfg(已存在,--force 覆盖)"
|
|
222
|
+
else
|
|
223
|
+
mkdir -p "$(dirname "$cfg")"
|
|
224
|
+
team_render "$tmpl" \
|
|
225
|
+
"PROJECT=$project" "SESSION=$session" "PM_WINDOW=$pmwin" \
|
|
226
|
+
"DOCS_DIR=$docs" "AGENTS=$agents" "GATES=$(team_escape_dq "$gates")" "VCS=$vcs" \
|
|
227
|
+
"DEFAULT_MODEL=$model" "SKILL_DIR=$TEAM_SKILL_DIR" \
|
|
228
|
+
"DETECTED_VCS=$(team_detect_vcs)" "TODAY=$(date +%F)" > "$cfg"
|
|
229
|
+
team_ok "write $cfg"
|
|
230
|
+
fi
|
|
231
|
+
chmod 0644 "$cfg"
|
|
232
|
+
|
|
233
|
+
# 2) 文档骨架
|
|
234
|
+
local tdir; tdir="$(team_tmpl_dir)"
|
|
235
|
+
TEAM_DOCS_ABS="$TEAM_MAIN_ROOT/$docs"
|
|
236
|
+
mkdir -p "$TEAM_DOCS_ABS"/{tasks,reports,threads,inbox,reviews}
|
|
237
|
+
team_render_to "$tdir/BOARD.md.tmpl" "$TEAM_DOCS_ABS/BOARD.md" "$force" "PROJECT=$project" "TODAY=$(date +%F)"
|
|
238
|
+
team_render_to "$tdir/ROADMAP.md.tmpl" "$TEAM_DOCS_ABS/ROADMAP.md" "$force" "PROJECT=$project"
|
|
239
|
+
team_render_to "$tdir/OWNERSHIP.md.tmpl" "$TEAM_DOCS_ABS/OWNERSHIP.md" "$force" "PROJECT=$project"
|
|
240
|
+
team_render_to "$tdir/DECISIONS.md.tmpl" "$TEAM_DOCS_ABS/DECISIONS.md" "$force" "PROJECT=$project" "TODAY=$(date +%F)"
|
|
241
|
+
team_render_to "$tdir/threads-README.md" "$TEAM_DOCS_ABS/threads/README.md" "$force" "PROJECT=$project" "AGENTS=$agents"
|
|
242
|
+
team_render_to "$tdir/PROTOCOL.md.tmpl" "$TEAM_DOCS_ABS/PROTOCOL.md" "$force" \
|
|
243
|
+
"PROJECT=$project" "DOCS_DIR=$docs" "WORKTREES_DIR=$(basename "${TEAM_WORKTREES_DIR:-.worktrees}")" \
|
|
244
|
+
"SKILL_DIR=$TEAM_SKILL_DIR" "GATES=${gates:-<未配置>}" "SESSION=$session"
|
|
245
|
+
for d in tasks reports reviews; do
|
|
246
|
+
[ -f "$TEAM_DOCS_ABS/$d/.gitkeep" ] || : > "$TEAM_DOCS_ABS/$d/.gitkeep"
|
|
247
|
+
done
|
|
248
|
+
printf '# 临时收件箱:agent 回合结束自动追加,不入库\n*\n' > "$TEAM_DOCS_ABS/inbox/.gitignore"
|
|
249
|
+
printf '# 复验日志:本地证据,不入库\n*.log\n' > "$TEAM_DOCS_ABS/reviews/.gitignore"
|
|
250
|
+
|
|
251
|
+
# 3) AGENTS.md 协议段落
|
|
252
|
+
local section; section="$(mktemp)"
|
|
253
|
+
team_render "$tdir/AGENTS.section.md.tmpl" \
|
|
254
|
+
"PROJECT=$project" "DOCS_DIR=$docs" "SESSION=$session" "PM_WINDOW=$pmwin" \
|
|
255
|
+
"SKILL_DIR=$TEAM_SKILL_DIR" "AGENTS=$agents" "GATES=${gates:-<未配置>}" \
|
|
256
|
+
"WORKTREES_DIR=${TEAM_WORKTREES_DIR:-.worktrees}" "PROTECTED_BRANCH=main" > "$section"
|
|
257
|
+
# 旧名标记迁移(<=1.12 的项目 AGENTS.md 里是 pi-team:begin/end):
|
|
258
|
+
# 就地换成新标记,这样 team_write_section 认得出"段落已存在",不会重复注入。
|
|
259
|
+
local _agents="$TEAM_MAIN_ROOT/AGENTS.md"
|
|
260
|
+
if [ -f "$_agents" ] \
|
|
261
|
+
&& grep -qF '<!-- pi-team:begin -->' "$_agents" \
|
|
262
|
+
&& ! grep -qF '<!-- teamsmith:begin -->' "$_agents"; then
|
|
263
|
+
sed -i 's|<!-- pi-team:begin -->|<!-- teamsmith:begin -->|; s|<!-- pi-team:end -->|<!-- teamsmith:end -->|' "$_agents"
|
|
264
|
+
fi
|
|
265
|
+
team_write_section "$TEAM_MAIN_ROOT/AGENTS.md" \
|
|
266
|
+
"<!-- teamsmith:begin -->" "<!-- teamsmith:end -->" "$section"
|
|
267
|
+
rm -f "$section"
|
|
268
|
+
|
|
269
|
+
# 4) .gitignore
|
|
270
|
+
# token 文件必须默认忽略(PAT 泄漏是最容易犯的事)
|
|
271
|
+
team_gitignore_add ".pi/team/state/" "$docs/inbox/" "$docs/reviews/*.log" "${TEAM_WORKTREES_DIR:-.worktrees}/" \
|
|
272
|
+
"${TEAM_TOKEN_FILE:-.gh-pat}" "${TEAM_GITLAB_TOKEN_FILE:-.gitlab-pat}"
|
|
273
|
+
|
|
274
|
+
# 5) 项目本地 skill(<main worktree>/.pi/skills/):Pi 的项目级搜索路径。bootstrap 复用同一函数
|
|
275
|
+
# (见 cmd-init.sh)—— 一个实现,两个调用点;--copy/--no-skills 由 init 自己解析。
|
|
276
|
+
local install_args=()
|
|
277
|
+
[ -n "$install_mode" ] && install_args+=("$install_mode")
|
|
278
|
+
[ "$force" = "1" ] && install_args+=("--force")
|
|
279
|
+
team_init_install_skills ${install_args[@]+"${install_args[@]}"} || return 1
|
|
280
|
+
|
|
281
|
+
printf '\n'
|
|
282
|
+
team_hdr "下一步"
|
|
283
|
+
printf ' 1) %s doctor\n' "$TEAM_CLI"
|
|
284
|
+
printf ' 2) 编辑 %s/.pi/team/config.sh(名册 TEAM_AGENTS、门禁 TEAM_GATES、模型)\n' "$project"
|
|
285
|
+
printf ' 3) %s task T1.1 --title "第一个任务" --agent dev\n' "$TEAM_CLI"
|
|
286
|
+
printf ' 4) %s dispatch dev T1.1 %s/tasks/T1.1-*.md\n' "$TEAM_CLI" "$docs"
|
|
287
|
+
printf ' 5) %s digest # PM 看板\n' "$TEAM_CLI"
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
# ---------------------------------------------------------------- doctor
|
|
291
|
+
# M7.1:这个项目要不要读迁移指南?两个判据都来自可查的真实状态,不猜:
|
|
292
|
+
# ① AGENTS.md 里还是旧名标记 <!-- pi-team:begin -->(init/bootstrap 会就地改写;改写后不再触发)
|
|
293
|
+
# ② 本会话加载的 skill 比磁盘旧(mark-loaded 记的版本/指纹与磁盘不一致)—— 与 version --check 同口径
|
|
294
|
+
# 干净项目上保持静默(doctor 不该多刷一行);返回原因字符串,没有原因则返回空。
|
|
295
|
+
team_migration_reasons() {
|
|
296
|
+
local reasons="" f="$TEAM_MAIN_ROOT/AGENTS.md" loaded
|
|
297
|
+
if [ -f "$f" ] && grep -qF '<!-- pi-team:begin -->' "$f"; then
|
|
298
|
+
reasons="AGENTS.md 还是旧名标记"
|
|
299
|
+
fi
|
|
300
|
+
loaded="$(team_loaded_version 2>/dev/null || true)"
|
|
301
|
+
if [ -n "$loaded" ] \
|
|
302
|
+
&& { [ "$loaded" != "$TEAM_VERSION" ] || [ "$(team_loaded_hash 2>/dev/null || true)" != "$(team_skill_hash 2>/dev/null || true)" ]; }; then
|
|
303
|
+
reasons="${reasons:+$reasons;}本会话加载 $loaded、磁盘 $TEAM_VERSION"
|
|
304
|
+
fi
|
|
305
|
+
[ -n "$reasons" ] && printf '%s' "$reasons"
|
|
306
|
+
return 0
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
# ---------------------------------------------------------------- PM 窗口名漂移(M11)
|
|
310
|
+
# 「配置里的 PM 窗口名」与「现场窗口」不符时,医生必须把这句人话说出来:
|
|
311
|
+
# 事故(本项目实测):bootstrap 把当时窗口碰巧的名字写进配置(写成 pi),窗口后来被改回 pm、配置不改 ——
|
|
312
|
+
# 面板报「PM 窗口缺失」而 PM 明明活着;更糟的是照着「→ team up」会照配置另开一个窗口(两个 PM)。
|
|
313
|
+
# 判据与 team_pm_state 的「人工启动的 PM」同一标准(argv 命中配置的 PM CLI + cwd 在本项目里),
|
|
314
|
+
# 再排掉名册 / 巡检 / 草稿窗口(它们跑的是同一个 agent 可执行文件)。认不出来就返回空 ——
|
|
315
|
+
# 这条检查宁可沉默,也不许猜一个窗口名字出来。
|
|
316
|
+
team_is_agentish_window() { # <窗口名> → 0 = 名册 / 巡检 / 草稿窗口(不能当成 PM 现场)
|
|
317
|
+
local w="${1:-}" a
|
|
318
|
+
[ -n "$w" ] || return 1
|
|
319
|
+
[ "$w" = "$(team_pulse_window)" ] && return 0
|
|
320
|
+
case "$w" in pulse|watchdog|draft) return 0 ;; esac
|
|
321
|
+
for a in $(team_agents); do
|
|
322
|
+
[ "$w" = "$a" ] && return 0
|
|
323
|
+
[ "$w" = "$(team_state_get "$a" window "$a")" ] && return 0
|
|
324
|
+
done
|
|
325
|
+
return 1
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
team_pm_window_drift() { # → 现场像 PM 的窗口名(空格分隔,可能多个);没有则空
|
|
329
|
+
local w pid cwd out=""
|
|
330
|
+
team_have_cmd tmux || return 0
|
|
331
|
+
team_tmux_has_session "$TEAM_SESSION" || return 0
|
|
332
|
+
while IFS= read -r w; do
|
|
333
|
+
[ -n "$w" ] || continue
|
|
334
|
+
[ "$w" = "$TEAM_PM_WINDOW" ] && continue
|
|
335
|
+
team_is_agentish_window "$w" && continue
|
|
336
|
+
pid="$(team_pm_pane_agent_pid "$TEAM_SESSION:$w" 2>/dev/null || true)"
|
|
337
|
+
[ -n "$pid" ] || continue
|
|
338
|
+
cwd="$(team_proc_cwd "$pid" 2>/dev/null || true)"
|
|
339
|
+
[ -n "$cwd" ] || continue
|
|
340
|
+
team_cwd_in_project "$cwd" || continue
|
|
341
|
+
out="${out:+$out }$w"
|
|
342
|
+
done < <(team_tmux_windows "$TEAM_SESSION")
|
|
343
|
+
[ -n "$out" ] && printf '%s\n' "$out"
|
|
344
|
+
return 0
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
team_cmd_doctor() {
|
|
348
|
+
local fails=0 warns=0
|
|
349
|
+
check() { printf ' %-24s ' "$1"; }
|
|
350
|
+
pass() { printf '%s✓%s %s\n' "$C_GRN" "$C_RESET" "${1:-}"; }
|
|
351
|
+
warn() { printf '%s!%s %s\n' "$C_YEL" "$C_RESET" "$1"; warns=$((warns + 1)); }
|
|
352
|
+
fail() { printf '%s✗%s %s\n' "$C_RED" "$C_RESET" "$1"; fails=$((fails + 1)); }
|
|
353
|
+
|
|
354
|
+
team_hdr "teamsmith doctor · $TEAM_PROJECT"
|
|
355
|
+
printf '%s\n' " skill: $TEAM_SKILL_DIR ($TEAM_VERSION) main: $TEAM_MAIN_ROOT"
|
|
356
|
+
|
|
357
|
+
check "config"; if [ -n "$TEAM_CONFIG" ]; then pass "$TEAM_CONFIG"; else warn "未找到 .pi/team/config.sh(先跑 $TEAM_CLI init)"; fi
|
|
358
|
+
check "docs 骨架"; if [ -d "$TEAM_DOCS_ABS" ]; then pass "$TEAM_DOCS_DIR"; else fail "缺 $TEAM_DOCS_DIR/(先跑 $TEAM_CLI init)"; fi
|
|
359
|
+
# M48:同一 ID 多行(历史遗留的共用 ID)—— 面板焦点/状态/报告都按 ID 指行,重复必须看得见。
|
|
360
|
+
# 警告不是失败:旧看板本来就可能是这个形状,doctor 只要求它能被看见(处置见 troubleshooting)。
|
|
361
|
+
check "BOARD 重复 ID"; local bdups; bdups="$(team_board_duplicate_ids || true)"
|
|
362
|
+
if [ -z "$bdups" ]; then pass "无"
|
|
363
|
+
else warn "$(printf '%s' "$bdups" | awk 'NR>1{printf "、"} {printf "%s", $0}') (同 ID 多行:焦点按行身份走,但状态/报告按 ID 指行;$TEAM_CLI board ls)"; fi
|
|
364
|
+
check "bash"; if [ "${BASH_VERSINFO[0]}" -ge 5 ]; then pass "${BASH_VERSION%%(*}"; else fail "需要 bash >= 5(实测 4.0 下 help/init 退出 2)"; fi
|
|
365
|
+
check "git"; if team_have_cmd git; then pass "$(git --version | awk '{print $3}')"; else fail "缺 git"; fi
|
|
366
|
+
|
|
367
|
+
check "tmux"; if team_have_cmd tmux; then
|
|
368
|
+
if team_tmux_has_session "$TEAM_SESSION"; then pass "session $TEAM_SESSION 在运行"
|
|
369
|
+
else warn "tmux 在,但 session '$TEAM_SESSION' 不存在(dispatch 会创建;PM 需要在 <session>:<pm-window> 里跑)"; fi
|
|
370
|
+
else warn "无 tmux:agent 无法交互旁观,仅支持 -p 非交互(不建议)"; fi
|
|
371
|
+
|
|
372
|
+
# M67 · 退役键的 server 残留(只读探测,不建 server):跑着的 tmux server 全局环境里还带着
|
|
373
|
+
# TEAM_ALLOW_DESTRUCTIVE_TMUX 时提示一行 —— 它**不再授权任何操作**(闸门按目标判定),残留只是
|
|
374
|
+
# 旧 server 启动环境的化石;重启该 server 后消失(重启会结束它上面所有会话,时机由人定)。
|
|
375
|
+
if team_have_cmd tmux; then
|
|
376
|
+
local retired_residue=""
|
|
377
|
+
retired_residue="$(tmux show-environment -g TEAM_ALLOW_DESTRUCTIVE_TMUX 2>/dev/null | head -1 || true)"
|
|
378
|
+
if [ -n "$retired_residue" ]; then
|
|
379
|
+
check "tmux 闸门退役键"
|
|
380
|
+
warn "运行的 tmux server 全局环境里还有 $retired_residue(M67 退役):它不再授权任何操作(判定按目标);重启该 server 后残留消失"
|
|
381
|
+
fi
|
|
382
|
+
else
|
|
383
|
+
check "tmux 闸门退役键"; printf '%s\n' "SKIP:没有 tmux,无法探测 server 全局环境"
|
|
384
|
+
fi
|
|
385
|
+
|
|
386
|
+
check "pi"; if [ -n "${TEAM_AGENT_CMD:-}" ]; then
|
|
387
|
+
pass "本项目用自定义 agent adapter:不需要 pi"
|
|
388
|
+
elif team_have_cmd pi; then
|
|
389
|
+
local pv; pv="$(pi --version 2>/dev/null | head -1 || true)"
|
|
390
|
+
if pi --help 2>&1 | grep -q -- '--session-id'; then pass "${pv:-present}"; else fail "pi 版本过旧:缺 --session-id"; fi
|
|
391
|
+
else fail "缺 pi(PATH 里没有)"; fi
|
|
392
|
+
|
|
393
|
+
# agent adapter:空 TEAM_AGENT_CMD = 内置 Pi(默认);配了就用任意 TUI agent 的命令模板。
|
|
394
|
+
# 判定口径:只有「配了但可执行文件根本解析不到」才算 fail;默认路径仍然由上面那条 pi 检查负责。
|
|
395
|
+
check "agent adapter"
|
|
396
|
+
local adapt_bin; adapt_bin="$(team_agent_bin_path)"
|
|
397
|
+
if [ -z "${TEAM_AGENT_CMD:-}${TEAM_AGENT_BIN:-}" ]; then pass "$(team_agent_adapter_label) → $adapt_bin"
|
|
398
|
+
elif command -v "$adapt_bin" >/dev/null 2>&1; then pass "$(team_agent_adapter_label) → $adapt_bin"
|
|
399
|
+
else fail "$(team_agent_adapter_label) → 解析不到可执行文件:$adapt_bin(看 TEAM_AGENT_BIN / TEAM_AGENT_CMD 首词)"; fi
|
|
400
|
+
|
|
401
|
+
check "agent notify"
|
|
402
|
+
if [ -z "${TEAM_AGENT_NOTIFY_CMD:-}" ]; then
|
|
403
|
+
if [ -n "${TEAM_AGENT_CMD:-}" ]; then warn "自定义 adapter 但没配 TEAM_AGENT_NOTIFY_CMD:worker 回合结束不会自动通知 PM"
|
|
404
|
+
else pass "Pi notify 扩展(内置)"; fi
|
|
405
|
+
else
|
|
406
|
+
local nre=""
|
|
407
|
+
if nre="$(team_agent_notify_check)"; then pass "$TEAM_AGENT_NOTIFY_CMD"
|
|
408
|
+
else warn "$TEAM_AGENT_NOTIFY_CMD($nre)"; fi
|
|
409
|
+
fi
|
|
410
|
+
|
|
411
|
+
# M26(E8 P1)建、M29(用户拍板)改写:harness 行保留(omp 会话自带后台,文案不同);
|
|
412
|
+
# 插件行只**告知已装什么** —— 永不推荐第三方功能包(推荐只限 teamsmith 必需/自带的东西)。
|
|
413
|
+
# 判定次序:配的 harness 就是 omp ≫ PATH 里有 omp(但本项目配的可能是 pi)≫ pi ≫ 都不在。
|
|
414
|
+
check "harness"
|
|
415
|
+
local h_bin h_name omp_on_path=0
|
|
416
|
+
h_bin="$(team_pi_bin_path)"
|
|
417
|
+
h_name="$(basename "$h_bin")"
|
|
418
|
+
if team_have_cmd omp; then omp_on_path=1; fi
|
|
419
|
+
if [ -n "${TEAM_AGENT_CMD:-}" ]; then
|
|
420
|
+
warn "自定义 adapter(TEAM_AGENT_CMD):后台任务能力取决于该 harness,无法探测"
|
|
421
|
+
elif [ "$h_name" = "omp" ] && command -v "$h_bin" >/dev/null 2>&1; then
|
|
422
|
+
warn "omp 自带后台任务(bash 后台派发 / hub wait·cancel / /jobs)"
|
|
423
|
+
elif [ "$omp_on_path" = "1" ]; then
|
|
424
|
+
warn "PATH 里有 omp(自带后台任务:bash 后台派发 / hub wait·cancel / /jobs);本项目配的是 $h_name(内置无后台 bash)"
|
|
425
|
+
elif team_have_cmd pi; then
|
|
426
|
+
pass "pi(内置无后台 bash:团队会话的长任务由自带的 team-bg 覆盖)"
|
|
427
|
+
else
|
|
428
|
+
warn "pi/omp 都不在 PATH:harness 无法判定(先看上面 pi 那一行)"
|
|
429
|
+
fi
|
|
430
|
+
|
|
431
|
+
# 已装插件(M29:信息行,只告知不推荐)。读两份设置文件(项目 + 用户),**不 spawn harness**:
|
|
432
|
+
# doctor 在巡检面板 health 块的等待路径上(panel/src/data.ts: ttl 600s / timeout 30s),
|
|
433
|
+
# spawn 在 TEAM_PI_BIN 不响应时会白等满超时 —— M26 实测过一次。
|
|
434
|
+
check "已装插件 packages"
|
|
435
|
+
local plug_all plug_shown plug_name plug_lvl plug_n=0
|
|
436
|
+
plug_all="$(team_plugin_list)"
|
|
437
|
+
if [ -z "$plug_all" ]; then
|
|
438
|
+
warn "未检测到插件(teamsmith 不依赖第三方插件;团队会话的后台任务由自带 team-bg 覆盖)"
|
|
439
|
+
else
|
|
440
|
+
plug_shown=""
|
|
441
|
+
while IFS=$'\t' read -r plug_name plug_lvl; do
|
|
442
|
+
[ -n "$plug_name" ] || continue
|
|
443
|
+
plug_n=$((plug_n + 1))
|
|
444
|
+
[ "$plug_n" -le 3 ] && plug_shown="$plug_shown${plug_shown:+、}$plug_name($plug_lvl)"
|
|
445
|
+
done <<< "$plug_all"
|
|
446
|
+
if [ "$plug_n" -gt 3 ]; then pass "$plug_shown 等 $plug_n 个"; else pass "$plug_shown"; fi
|
|
447
|
+
fi
|
|
448
|
+
|
|
449
|
+
check "门禁 TEAM_GATES"; if [ -n "$TEAM_GATES" ]; then pass "$TEAM_GATES"; else warn "未配置门禁命令:复验无法自动判定,只能靠人读 diff"; fi
|
|
450
|
+
# M58:性能套件在不在 —— 性能判定已从正确性门禁搬到它身上;缺了是「下一步」(更新 skill),不是硬失败。
|
|
451
|
+
check "perf suite"; if [ -f "$TEAM_SKILL_DIR/tests/perf.sh" ]; then
|
|
452
|
+
pass "存在($TEAM_CLI perf --container | $TEAM_CLI perf --host)"
|
|
453
|
+
else warn "缺 tests/perf.sh:性能判定没地方跑 → 重新安装/更新 skill(pi install 或换到含 M58 的版本)"; fi
|
|
454
|
+
# M29:名册为空不再是失败(PM-only 开局合法);真正拦住的是 dispatch(没有 agent 可用)。
|
|
455
|
+
check "名册 TEAM_AGENTS"
|
|
456
|
+
if [ -n "$(team_agents)" ]; then pass "$(team_agents | tr '\n' ' ')"
|
|
457
|
+
else warn "名册为空:可以 PM-only 开局;要派单先 $TEAM_CLI add-agent <name>"; fi
|
|
458
|
+
|
|
459
|
+
check "worktree 目录"; if [ -d "$TEAM_MAIN_ROOT/$TEAM_WORKTREES_DIR" ]; then
|
|
460
|
+
pass "$(ls -1 "$TEAM_MAIN_ROOT/$TEAM_WORKTREES_DIR" 2>/dev/null | wc -l) 个"
|
|
461
|
+
else warn "尚未创建 $TEAM_WORKTREES_DIR/(add-agent 时创建)"; fi
|
|
462
|
+
|
|
463
|
+
check "notify 扩展"; local ext="$TEAM_SKILL_DIR/extension/team-notify.ts"
|
|
464
|
+
if [ -f "$ext" ]; then
|
|
465
|
+
local tsrunner; tsrunner="$(team_ts_runner)"
|
|
466
|
+
if [ -n "$tsrunner" ] && $tsrunner -e "await import('$ext')" >/dev/null 2>&1; then
|
|
467
|
+
pass "可加载($tsrunner 预检通过;worktree 里需 -e 显式加载)"
|
|
468
|
+
elif [ -n "$tsrunner" ]; then
|
|
469
|
+
pass "存在($tsrunner 未能预检,pi 内部用打包器,通常仍可用)"
|
|
470
|
+
else
|
|
471
|
+
pass "存在(本机无 node/bun/tsx 可预检)"
|
|
472
|
+
fi
|
|
473
|
+
else fail "缺 $ext"; fi
|
|
474
|
+
|
|
475
|
+
# PM 记忆(必需依赖,D10):magic-context 是 Pi 侧扩展(npm 包),PM 靠它做跨会话记忆/检索。
|
|
476
|
+
# 只读 settings.json 与包自身的 package.json,不做任何安装/改动,也不读凭据文件。
|
|
477
|
+
check "PM 记忆 magic-context"
|
|
478
|
+
local mc_settings="$TEAM_PI_SETTINGS_FILE" mc_ver
|
|
479
|
+
mc_ver="$(team_magic_context_version)"
|
|
480
|
+
if [ -n "$mc_ver" ]; then
|
|
481
|
+
pass "magic-context $mc_ver(跨会话记忆可用:ctx_search / ctx_memory / ctx_note)"
|
|
482
|
+
elif [ "${TEAM_REQUIRE_MAGIC_CONTEXT:-1}" = "1" ]; then
|
|
483
|
+
fail "没检测到:装 pi 包 @cortexkit/pi-magic-context(settings 在别处时设 TEAM_PI_SETTINGS_FILE;环境特殊可 TEAM_REQUIRE_MAGIC_CONTEXT=0 降级)"
|
|
484
|
+
else
|
|
485
|
+
warn "没检测到(TEAM_REQUIRE_MAGIC_CONTEXT=0 已降级):PM 长会话只能靠 /compact + 落盘"
|
|
486
|
+
fi
|
|
487
|
+
|
|
488
|
+
# 规格层(必需依赖,D10):OpenSpec 管「为什么改/改成什么」;缺 CLI 或缺 spec 目录都算失败
|
|
489
|
+
check "OpenSpec CLI"
|
|
490
|
+
local os_bin os_ver
|
|
491
|
+
os_bin="$(team_openspec_bin_path)"
|
|
492
|
+
if command -v "$os_bin" >/dev/null 2>&1; then
|
|
493
|
+
os_ver="$("$os_bin" --version 2>/dev/null | head -1)"
|
|
494
|
+
pass "${os_ver:-已解析}($os_bin)"
|
|
495
|
+
elif [ "${TEAM_REQUIRE_OPENSPEC:-1}" = "1" ]; then
|
|
496
|
+
fail "找不到:$os_bin(装上 OpenSpec CLI 并确保在 PATH 里,或设 TEAM_OPENSPEC_BIN;临时可 TEAM_REQUIRE_OPENSPEC=0 降级)"
|
|
497
|
+
else
|
|
498
|
+
warn "找不到:$os_bin(TEAM_REQUIRE_OPENSPEC=0 已降级)"
|
|
499
|
+
fi
|
|
500
|
+
check "OpenSpec 规格目录"
|
|
501
|
+
if [ -d "$(team_spec_dir_abs)" ]; then
|
|
502
|
+
pass "$TEAM_SPEC_DIR"
|
|
503
|
+
elif [ "${TEAM_REQUIRE_OPENSPEC:-1}" = "1" ]; then
|
|
504
|
+
fail "缺 $TEAM_SPEC_DIR/:在项目里跑 openspec init --tools none"
|
|
505
|
+
else
|
|
506
|
+
warn "缺 $TEAM_SPEC_DIR/(TEAM_REQUIRE_OPENSPEC=0 已降级):跑 openspec init --tools none"
|
|
507
|
+
fi
|
|
508
|
+
|
|
509
|
+
# JS 运行时(必需依赖,D19):面板是提交进仓库的 Ink bundle(scripts/panel/panel.js),
|
|
510
|
+
# 跑它要 node/bun/tsx 之一。失败行必须点名解析到的东西(路径或版本),不能把「PATH 里没有」报成「没装」。
|
|
511
|
+
check "JS 运行时 node/bun"
|
|
512
|
+
local js_st js_path js_ver js_detail js_fix
|
|
513
|
+
IFS=$'\t' read -r js_st js_path js_ver js_detail <<< "$(team_js_check)"
|
|
514
|
+
js_fix="装 node ≥ ${TEAM_JS_MIN_NODE_MAJOR} 或 bun ≥ ${TEAM_JS_MIN_BUN_MINOR};已装但不在 PATH 就设 TEAM_JS_BIN 指向绝对路径;临时可 TEAM_REQUIRE_JS=0 降级 doctor 这一行(面板仍需运行时)"
|
|
515
|
+
case "$js_st" in
|
|
516
|
+
ok) pass "$js_path ($js_ver)" ;;
|
|
517
|
+
missing)
|
|
518
|
+
if [ "${TEAM_REQUIRE_JS:-1}" = "1" ]; then fail "解析不到 node/bun/tsx:$js_fix"
|
|
519
|
+
else warn "解析不到(TEAM_REQUIRE_JS=0 已降级):$js_fix"; fi ;;
|
|
520
|
+
bad)
|
|
521
|
+
if [ "${TEAM_REQUIRE_JS:-1}" = "1" ]; then fail "TEAM_JS_BIN=$js_path $js_detail:修好它,或改指向可执行的 node/bun"
|
|
522
|
+
else warn "TEAM_JS_BIN=$js_path $js_detail(TEAM_REQUIRE_JS=0 已降级)"; fi ;;
|
|
523
|
+
old)
|
|
524
|
+
if [ "${TEAM_REQUIRE_JS:-1}" = "1" ]; then fail "版本过低:$js_path $js_ver($js_detail)——升级 node 或 bun"
|
|
525
|
+
else warn "版本过低:$js_path $js_ver($js_detail;TEAM_REQUIRE_JS=0 已降级)"; fi ;;
|
|
526
|
+
*)
|
|
527
|
+
warn "找到了但版本判不出:${js_path:-?} ${js_ver:-}${js_detail:+($js_detail)}——确认它能跑 --version" ;;
|
|
528
|
+
esac
|
|
529
|
+
|
|
530
|
+
# M53 · wake 通道的 inotify 余量:额度 + **可证明**的占用 + 一次性注册探针。降级 ≠ 故障 ——
|
|
531
|
+
# 这是环境事实,只警告(fails 不动)并给修法;探针不是 ok 或已知余量低于底线才开口。
|
|
532
|
+
check "inotify 额度"
|
|
533
|
+
local ino_status ino_text
|
|
534
|
+
IFS=$'\t' read -r ino_status ino_text <<< "$(team_inotify_headroom_line)"
|
|
535
|
+
if [ "$ino_status" = "ok" ]; then pass "$ino_text"; else warn "$ino_text"; fi
|
|
536
|
+
|
|
537
|
+
# P53/P144 · 磁盘余量(与 inotify 同型的宿主资源行;只警告、不动 fails)—— 实现与读数在 cmd-status.sh:
|
|
538
|
+
# 临时根 + 工作树根,每个被判的文件系统一行(同一个文件系统只印一行)
|
|
539
|
+
team_disk_doctor_rows
|
|
540
|
+
|
|
541
|
+
check "容量 / swap 底线"; local avail swapfree swaptotal
|
|
542
|
+
read -r avail swapfree swaptotal <<< "$(team_mem_stats)"
|
|
543
|
+
if [ -n "$avail" ] && [ "${avail:-0}" -gt 0 ] 2>/dev/null; then
|
|
544
|
+
if [ "$TEAM_MIN_FREE_SWAP_MB" -gt 0 ] && [ "$swapfree" -lt "$TEAM_MIN_FREE_SWAP_MB" ]; then
|
|
545
|
+
warn "空闲 swap ${swapfree}MB < 底线 ${TEAM_MIN_FREE_SWAP_MB}MB:现在派单会被拒绝"
|
|
546
|
+
else
|
|
547
|
+
pass "$(team_capacity_line)"
|
|
548
|
+
fi
|
|
549
|
+
else warn "无法探测内存/swap(可设 TEAM_MEMINFO_FILE 指定 meminfo 文件)"; fi
|
|
550
|
+
|
|
551
|
+
# M11:PM 窗口名漂移(配置说 A、现场的 PM 在 B)。只在真看得见漂移时开口(干净项目不刷行,
|
|
552
|
+
# 与「迁移指引」同一风格),而且必须把话说到底:up 只认配置,会另开一个 A 窗口 → 两个 PM。
|
|
553
|
+
local pmwin_drift=""
|
|
554
|
+
if team_have_cmd tmux && team_tmux_has_session "$TEAM_SESSION" \
|
|
555
|
+
&& ! team_tmux_has_window "$TEAM_SESSION" "$TEAM_PM_WINDOW"; then
|
|
556
|
+
pmwin_drift="$(team_pm_window_drift)"
|
|
557
|
+
if [ -n "$pmwin_drift" ]; then
|
|
558
|
+
check "PM 窗口名"
|
|
559
|
+
warn "配置写的是 '$TEAM_PM_WINDOW',但 $TEAM_SESSION 里在跑 PM 的窗口叫 '$pmwin_drift'(改名漂移):先对齐名字再动手 —— $TEAM_CLI up 只认配置,会另开一个 '$TEAM_PM_WINDOW' 窗口(两个 PM)。二选一:tmux rename-window -t $TEAM_SESSION:${pmwin_drift%% *} $TEAM_PM_WINDOW / 把配置改成 TEAM_PM_WINDOW=\"${pmwin_drift%% *}\""
|
|
560
|
+
fi
|
|
561
|
+
fi
|
|
562
|
+
|
|
563
|
+
check "PM 存活"; local pmstate; pmstate="$(team_pm_state)"
|
|
564
|
+
case "$pmstate" in
|
|
565
|
+
running:*) pass "pi 在运行(${pmstate#running:})" ;;
|
|
566
|
+
idle:*) warn "窗口 $TEAM_SESSION:$TEAM_PM_WINDOW 停在 ${pmstate#idle:}:PM 没在跑 → team up" ;;
|
|
567
|
+
unknown:*) warn "窗口 $TEAM_SESSION:$TEAM_PM_WINDOW 里不是 PM(${pmstate#unknown:}):不算存活 → team up(会替换它)" ;;
|
|
568
|
+
foreign:*) warn "窗口 $TEAM_SESSION:$TEAM_PM_WINDOW 被别的项目的进程占着(cwd=$(team_pane_cwd "$(team_pm_target)" 2>/dev/null || echo '?')):不覆盖" ;;
|
|
569
|
+
*) if [ -n "$pmwin_drift" ]; then
|
|
570
|
+
warn "PM 窗口 $TEAM_SESSION:$TEAM_PM_WINDOW 不存在,但 '$pmwin_drift' 里跑着 PM(见上一条「PM 窗口名」)→ 先对齐名字,别直接 up"
|
|
571
|
+
else
|
|
572
|
+
warn "PM 窗口 $TEAM_SESSION:$TEAM_PM_WINDOW 不存在 → team up"
|
|
573
|
+
fi ;;
|
|
574
|
+
esac
|
|
575
|
+
|
|
576
|
+
# M46 · 投递通道:PM 没有 inbox-watch 注册时,通知会退回输入框粘贴慢路径 —— 这条降级必须看得见。
|
|
577
|
+
# 只在「内置 Pi 的 PM」这条 lane 上判(自定义 PM CLI 不吃这个扩展,绝不劝告);PM 没在跑且
|
|
578
|
+
# 没有活痕迹时不刷行(没有可降级的目标);注册在 → pass 一行,让人知道快路径真的连着。
|
|
579
|
+
if [ -z "${TEAM_PM_CMD:-}${TEAM_PM_BIN:-}" ]; then
|
|
580
|
+
local watch_dbg
|
|
581
|
+
watch_dbg="$(team_inbox_watch_degraded_line "$(team_pm_target)" "$pmstate" 2>/dev/null || true)"
|
|
582
|
+
if [ -n "$watch_dbg" ]; then
|
|
583
|
+
check "投递通道 inbox-watch"; warn "$watch_dbg"
|
|
584
|
+
elif [ "${pmstate#running:}" != "$pmstate" ]; then
|
|
585
|
+
check "投递通道 inbox-watch"; pass "PM 会话已注册(通知走收件箱唤醒,不碰输入框)"
|
|
586
|
+
fi
|
|
587
|
+
fi
|
|
588
|
+
|
|
589
|
+
check "巡检(pulse)"; local legacy_note; legacy_note="$(team_pulse_legacy_suffix)"
|
|
590
|
+
case "$(team_pulse_state)" in
|
|
591
|
+
off) warn "没在跑 → $TEAM_CLI pulse up(pulse 由 PM 配置)$legacy_note" ;;
|
|
592
|
+
*) pass "$(team_pulse_state_text)$legacy_note" ;;
|
|
593
|
+
esac
|
|
594
|
+
|
|
595
|
+
# forge:不探测、不假设(v1.12.0 起 skill 与 forge 完全解耦)
|
|
596
|
+
# PM 自己用 git / curl / gh / glab / 网页;这里只把项目登记的标签打出来,缺命令行工具不算问题。
|
|
597
|
+
check "forge"; case "$TEAM_VCS" in
|
|
598
|
+
local|"") pass "local(不依赖 forge;合并由 PM 用 git 完成)" ;;
|
|
599
|
+
*) pass "$TEAM_VCS(仅登记:PM 自己用 git/curl/任意 CLI 调 forge,skill 不参与)" ;;
|
|
600
|
+
esac
|
|
601
|
+
|
|
602
|
+
check "保护分支"; if team_git rev-parse --verify -q "$TEAM_PROTECTED_BRANCH" >/dev/null; then
|
|
603
|
+
pass "$TEAM_PROTECTED_BRANCH @ $(team_git rev-parse --short "$TEAM_PROTECTED_BRANCH")"
|
|
604
|
+
else warn "本地没有分支 $TEAM_PROTECTED_BRANCH(配置对吗?)"; fi
|
|
605
|
+
|
|
606
|
+
check "gitignore"; local missing=0 e
|
|
607
|
+
for e in ".pi/team/state/" "$TEAM_DOCS_DIR/inbox/" "${TEAM_WORKTREES_DIR}/"; do
|
|
608
|
+
grep -qxF "$e" "$TEAM_MAIN_ROOT/.gitignore" 2>/dev/null || missing=$((missing + 1))
|
|
609
|
+
done
|
|
610
|
+
if [ "$missing" -eq 0 ]; then pass "临时目录已忽略"; else warn "$missing 条未忽略(收件箱/worktree 会被误提交)"; fi
|
|
611
|
+
|
|
612
|
+
# R5(P40):项目本地 skill 安装(team init 装到 <main>/.pi/skills/)—— 没装**不刷行**(Pi 包安装、
|
|
613
|
+
# ~/.agents/skills 软链、settings 的 skills 条目都不该被唠叨);漂移(别源软链 / 旧副本 / 读不到
|
|
614
|
+
# SKILL.md)warn 并给一行修法,**永不 fail**(与「陈旧会话版本」同一条 warn-don't-fail 线)。
|
|
615
|
+
local skill_row; skill_row="$(team_project_skill_install_row)"
|
|
616
|
+
if [ -n "$skill_row" ]; then
|
|
617
|
+
check "项目 skill 安装"
|
|
618
|
+
case "$skill_row" in
|
|
619
|
+
pass\ *) pass "${skill_row#pass }" ;;
|
|
620
|
+
warn\ *) warn "${skill_row#warn }" ;;
|
|
621
|
+
esac
|
|
622
|
+
fi
|
|
623
|
+
|
|
624
|
+
check "陈旧 state"; local stale=0 a w
|
|
625
|
+
for a in $(team_agents); do
|
|
626
|
+
w="$(team_state_get "$a" window "$a")"
|
|
627
|
+
if [ -f "$TEAM_STATE_DIR/$a.env" ] && ! team_tmux_has_window "$TEAM_SESSION" "$w"; then stale=$((stale + 1)); fi
|
|
628
|
+
done
|
|
629
|
+
if [ "$stale" -eq 0 ]; then pass "干净"; else warn "$stale 个 agent 的 state 与 tmux 不一致(roster 会自动清理)"; fi
|
|
630
|
+
|
|
631
|
+
# 迁移/升级指引(M7.1):只在真的需要迁移时多打一行,指向 references/migration.md(不新增子命令)。
|
|
632
|
+
local mig; mig="$(team_migration_reasons)"
|
|
633
|
+
if [ -n "$mig" ]; then
|
|
634
|
+
check "迁移指引"; warn "$mig:读 $TEAM_SKILL_DIR/references/migration.md(重命名 / 已删命令 / 必需依赖 / 行为变更 / 升级配方 / 回滚)"
|
|
635
|
+
fi
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
printf '\n'
|
|
639
|
+
if [ "$fails" -gt 0 ]; then team_err "doctor: $fails 项失败 / $warns 项警告"; return 1; fi
|
|
640
|
+
if [ "$warns" -gt 0 ]; then team_warn "doctor: 0 项失败 / $warns 项警告(可继续)"; return 0; fi
|
|
641
|
+
team_ok "doctor: 全部通过"
|
|
642
|
+
}
|