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.
Files changed (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +158 -2
  3. package/bin/team.mjs +59 -0
  4. package/install.sh +94 -0
  5. package/package.json +37 -4
  6. package/skills/teamsmith/CHANGELOG.md +763 -0
  7. package/skills/teamsmith/SKILL.md +312 -0
  8. package/skills/teamsmith/extension/team-bg.ts +435 -0
  9. package/skills/teamsmith/extension/team-inbox-watch.ts +1412 -0
  10. package/skills/teamsmith/extension/team-notify.ts +663 -0
  11. package/skills/teamsmith/references/agent-adapters.md +643 -0
  12. package/skills/teamsmith/references/config.md +477 -0
  13. package/skills/teamsmith/references/meeting.md +124 -0
  14. package/skills/teamsmith/references/memory.md +133 -0
  15. package/skills/teamsmith/references/migration.md +227 -0
  16. package/skills/teamsmith/references/openspec.md +222 -0
  17. package/skills/teamsmith/references/philosophy.md +95 -0
  18. package/skills/teamsmith/references/protocol.md +712 -0
  19. package/skills/teamsmith/references/troubleshooting.md +1384 -0
  20. package/skills/teamsmith/references/workflows.md +448 -0
  21. package/skills/teamsmith/scripts/lib/cmd-agents.sh +1709 -0
  22. package/skills/teamsmith/scripts/lib/cmd-bg.sh +284 -0
  23. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +311 -0
  24. package/skills/teamsmith/scripts/lib/cmd-config.sh +1156 -0
  25. package/skills/teamsmith/scripts/lib/cmd-death.sh +562 -0
  26. package/skills/teamsmith/scripts/lib/cmd-docs.sh +149 -0
  27. package/skills/teamsmith/scripts/lib/cmd-draft.sh +124 -0
  28. package/skills/teamsmith/scripts/lib/cmd-init.sh +212 -0
  29. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +904 -0
  30. package/skills/teamsmith/scripts/lib/cmd-outbox.sh +196 -0
  31. package/skills/teamsmith/scripts/lib/cmd-project.sh +642 -0
  32. package/skills/teamsmith/scripts/lib/cmd-review.sh +1393 -0
  33. package/skills/teamsmith/scripts/lib/cmd-status.sh +1399 -0
  34. package/skills/teamsmith/scripts/lib/cmd-update.sh +191 -0
  35. package/skills/teamsmith/scripts/lib/cmd-watch.sh +1681 -0
  36. package/skills/teamsmith/scripts/lib/common.sh +4964 -0
  37. package/skills/teamsmith/scripts/lib/draft-entry.sh +51 -0
  38. package/skills/teamsmith/scripts/lib/outbox.sh +2042 -0
  39. package/skills/teamsmith/scripts/lib/tmux-argv.sh +165 -0
  40. package/skills/teamsmith/scripts/monitor.mjs +616 -0
  41. package/skills/teamsmith/scripts/panel/README.md +192 -0
  42. package/skills/teamsmith/scripts/panel/build.sh +47 -0
  43. package/skills/teamsmith/scripts/panel/bun.lock +109 -0
  44. package/skills/teamsmith/scripts/panel/draft-send.sh +68 -0
  45. package/skills/teamsmith/scripts/panel/package.json +24 -0
  46. package/skills/teamsmith/scripts/panel/panel.js +388 -0
  47. package/skills/teamsmith/scripts/panel/src/App.tsx +2150 -0
  48. package/skills/teamsmith/scripts/panel/src/clipboard.ts +154 -0
  49. package/skills/teamsmith/scripts/panel/src/compose.ts +691 -0
  50. package/skills/teamsmith/scripts/panel/src/data.ts +555 -0
  51. package/skills/teamsmith/scripts/panel/src/format.ts +50 -0
  52. package/skills/teamsmith/scripts/panel/src/layout.ts +2562 -0
  53. package/skills/teamsmith/scripts/panel/src/main.tsx +894 -0
  54. package/skills/teamsmith/scripts/panel/src/markdown.ts +340 -0
  55. package/skills/teamsmith/scripts/panel/src/sanitize.ts +42 -0
  56. package/skills/teamsmith/scripts/panel/src/settings.ts +154 -0
  57. package/skills/teamsmith/scripts/panel/src/strings/en.ts +416 -0
  58. package/skills/teamsmith/scripts/panel/src/strings/index.ts +65 -0
  59. package/skills/teamsmith/scripts/panel/src/strings/types.ts +9 -0
  60. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +414 -0
  61. package/skills/teamsmith/scripts/panel/src/theme.ts +116 -0
  62. package/skills/teamsmith/scripts/panel/src/types.ts +652 -0
  63. package/skills/teamsmith/scripts/panel/src/width.ts +105 -0
  64. package/skills/teamsmith/scripts/panel/tsconfig.json +16 -0
  65. package/skills/teamsmith/scripts/shim/signal-gate +156 -0
  66. package/skills/teamsmith/scripts/shim/tmux +403 -0
  67. package/skills/teamsmith/scripts/team +143 -0
  68. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +147 -0
  69. package/skills/teamsmith/templates/BOARD.md.tmpl +18 -0
  70. package/skills/teamsmith/templates/DECISIONS.md.tmpl +22 -0
  71. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +25 -0
  72. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +84 -0
  73. package/skills/teamsmith/templates/ROADMAP.md.tmpl +29 -0
  74. package/skills/teamsmith/templates/config.sh.tmpl +106 -0
  75. package/skills/teamsmith/templates/memory-seed.md.tmpl +46 -0
  76. package/skills/teamsmith/templates/pm-prompt.md.tmpl +110 -0
  77. package/skills/teamsmith/templates/report.md.tmpl +36 -0
  78. package/skills/teamsmith/templates/task.md.tmpl +65 -0
  79. package/skills/teamsmith/templates/threads-README.md +17 -0
  80. package/skills/teamsmith/tests/bg-ledger-harness.mjs +682 -0
  81. package/skills/teamsmith/tests/bg-ledger.sh +307 -0
  82. package/skills/teamsmith/tests/checkout-shape-probe.sh +800 -0
  83. package/skills/teamsmith/tests/config-cli.sh +1562 -0
  84. package/skills/teamsmith/tests/container-tmux.sh +493 -0
  85. package/skills/teamsmith/tests/coverage-inventory.sh +173 -0
  86. package/skills/teamsmith/tests/death-cause.sh +564 -0
  87. package/skills/teamsmith/tests/delivery-truth.sh +1231 -0
  88. package/skills/teamsmith/tests/fake-tui.py +450 -0
  89. package/skills/teamsmith/tests/fixtures/delivery-truth-real/README.md +60 -0
  90. package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-second.py +139 -0
  91. package/skills/teamsmith/tests/fixtures/delivery-truth-real/mock-server.py +29 -0
  92. package/skills/teamsmith/tests/fixtures/delivery-truth-real/observe.ts +20 -0
  93. package/skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh +79 -0
  94. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +175 -0
  95. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +229 -0
  96. package/skills/teamsmith/tests/fixtures/p71-incident/README.md +22 -0
  97. package/skills/teamsmith/tests/fixtures/p71-incident/dev2.seen +8 -0
  98. package/skills/teamsmith/tests/fixtures/p71-incident/dev2.wake +9 -0
  99. package/skills/teamsmith/tests/fixtures/p71-incident/pm-nudges.wake +3 -0
  100. package/skills/teamsmith/tests/fixtures/signal-lint-cases.txt +40 -0
  101. package/skills/teamsmith/tests/flip-glue.sh +162 -0
  102. package/skills/teamsmith/tests/flip-m12-26c.sh +129 -0
  103. package/skills/teamsmith/tests/flip-m12.sh +185 -0
  104. package/skills/teamsmith/tests/flip-m16.sh +166 -0
  105. package/skills/teamsmith/tests/flip-m17.sh +204 -0
  106. package/skills/teamsmith/tests/flip-m33.sh +284 -0
  107. package/skills/teamsmith/tests/flip-m34.sh +96 -0
  108. package/skills/teamsmith/tests/flip-m37.sh +185 -0
  109. package/skills/teamsmith/tests/flip-m4.3.sh +375 -0
  110. package/skills/teamsmith/tests/flip-m43.sh +128 -0
  111. package/skills/teamsmith/tests/flip-m44.sh +262 -0
  112. package/skills/teamsmith/tests/flip-m45.sh +244 -0
  113. package/skills/teamsmith/tests/flip-m46.sh +238 -0
  114. package/skills/teamsmith/tests/flip-m48.sh +304 -0
  115. package/skills/teamsmith/tests/flip-m6.2.sh +205 -0
  116. package/skills/teamsmith/tests/flip-m6.3.sh +283 -0
  117. package/skills/teamsmith/tests/flip-m6.4.sh +267 -0
  118. package/skills/teamsmith/tests/flip-m6.5.sh +113 -0
  119. package/skills/teamsmith/tests/flip-m7.1.sh +135 -0
  120. package/skills/teamsmith/tests/flip-m7.2.sh +321 -0
  121. package/skills/teamsmith/tests/flip-p144.sh +112 -0
  122. package/skills/teamsmith/tests/flip-p156.sh +133 -0
  123. package/skills/teamsmith/tests/flip-p158.sh +301 -0
  124. package/skills/teamsmith/tests/flip-p160.sh +182 -0
  125. package/skills/teamsmith/tests/flip-p171.sh +249 -0
  126. package/skills/teamsmith/tests/flip-p18.1.sh +95 -0
  127. package/skills/teamsmith/tests/flip-p20.sh +286 -0
  128. package/skills/teamsmith/tests/flip-p201.sh +249 -0
  129. package/skills/teamsmith/tests/flip-p210.sh +239 -0
  130. package/skills/teamsmith/tests/flip-p211.sh +152 -0
  131. package/skills/teamsmith/tests/flip-p217.sh +288 -0
  132. package/skills/teamsmith/tests/flip-p22.sh +123 -0
  133. package/skills/teamsmith/tests/flip-p23.sh +239 -0
  134. package/skills/teamsmith/tests/flip-p25.sh +165 -0
  135. package/skills/teamsmith/tests/flip-p71.sh +184 -0
  136. package/skills/teamsmith/tests/flip-p72.sh +202 -0
  137. package/skills/teamsmith/tests/frames/README.md +176 -0
  138. package/skills/teamsmith/tests/frames/p78-conversation-rule-below-box.txt +6 -0
  139. package/skills/teamsmith/tests/frames/p78-cursor-mid-draft.txt +6 -0
  140. package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor-line.txt +6 -0
  141. package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor.txt +6 -0
  142. package/skills/teamsmith/tests/frames/p78-draft-rule-blank-region.txt +6 -0
  143. package/skills/teamsmith/tests/frames/p78-draft-rule-only.txt +5 -0
  144. package/skills/teamsmith/tests/frames/p78-spinner-row-below-cursor.txt +6 -0
  145. package/skills/teamsmith/tests/frames/p78-wider-rule-below-cursor.txt +6 -0
  146. package/skills/teamsmith/tests/frames/p86-f1-mixed-width-disjoint-box.txt +8 -0
  147. package/skills/teamsmith/tests/frames/p86-f1-narrower-width-disjoint-box.txt +8 -0
  148. package/skills/teamsmith/tests/frames/p86-f1-spinner-top-disjoint-box.txt +8 -0
  149. package/skills/teamsmith/tests/frames/pi-0.85.1-update-banner.txt +30 -0
  150. package/skills/teamsmith/tests/frames/pi-0.87.0-draft-half-sentence.txt +30 -0
  151. package/skills/teamsmith/tests/frames/pi-0.87.0-empty-box.txt +30 -0
  152. package/skills/teamsmith/tests/frames/pi-0.87.0-one-line-draft.txt +30 -0
  153. package/skills/teamsmith/tests/frames/pi-0.87.0-project-trust-prompt.txt +30 -0
  154. package/skills/teamsmith/tests/frames/pi-0.99.2-empty-editor.txt +32 -0
  155. package/skills/teamsmith/tests/frames/pi-0.99.2-human-draft.txt +32 -0
  156. package/skills/teamsmith/tests/frames/pi-1.0.0-git-error-in-box.txt +32 -0
  157. package/skills/teamsmith/tests/gate-guard.sh +112 -0
  158. package/skills/teamsmith/tests/guard-matrix.sh +233 -0
  159. package/skills/teamsmith/tests/install-shape.sh +731 -0
  160. package/skills/teamsmith/tests/ledger-ban.sh +612 -0
  161. package/skills/teamsmith/tests/lib/box-judge.sh +68 -0
  162. package/skills/teamsmith/tests/lib/checkout-shape.sh +129 -0
  163. package/skills/teamsmith/tests/lib/loop-scan.awk +114 -0
  164. package/skills/teamsmith/tests/lib/pty-wait.sh +676 -0
  165. package/skills/teamsmith/tests/lib/section-guard.sh +855 -0
  166. package/skills/teamsmith/tests/lib/shell-lex.pl +261 -0
  167. package/skills/teamsmith/tests/lib/tmp-root.sh +528 -0
  168. package/skills/teamsmith/tests/lib/tmux-cap.sh +35 -0
  169. package/skills/teamsmith/tests/lib/tmux-iso-call-probe.sh +81 -0
  170. package/skills/teamsmith/tests/lib/tmux-iso-probe.sh +46 -0
  171. package/skills/teamsmith/tests/lib/tmux-iso.sh +381 -0
  172. package/skills/teamsmith/tests/load-experiment.sh +290 -0
  173. package/skills/teamsmith/tests/loop-inventory.tsv +84 -0
  174. package/skills/teamsmith/tests/panel-b2-slow-stub.sh +19 -0
  175. package/skills/teamsmith/tests/panel-b2.sh +1183 -0
  176. package/skills/teamsmith/tests/panel-b3-pty-mouse.py +240 -0
  177. package/skills/teamsmith/tests/panel-b3-pty-tmux-mouse.py +138 -0
  178. package/skills/teamsmith/tests/panel-b3-stub.sh +279 -0
  179. package/skills/teamsmith/tests/panel-b3.sh +1301 -0
  180. package/skills/teamsmith/tests/panel-choices.sh +572 -0
  181. package/skills/teamsmith/tests/panel-clipboard-model.ts +187 -0
  182. package/skills/teamsmith/tests/panel-compose-model.ts +290 -0
  183. package/skills/teamsmith/tests/panel-contrast.mjs +81 -0
  184. package/skills/teamsmith/tests/panel-cpu-premise.sh +173 -0
  185. package/skills/teamsmith/tests/panel-cpu.sh +391 -0
  186. package/skills/teamsmith/tests/panel-flip-m54.sh +207 -0
  187. package/skills/teamsmith/tests/panel-flip-p123.sh +278 -0
  188. package/skills/teamsmith/tests/panel-flip-p125.sh +318 -0
  189. package/skills/teamsmith/tests/panel-flip-p128.sh +259 -0
  190. package/skills/teamsmith/tests/panel-keyprobe-pty.py +99 -0
  191. package/skills/teamsmith/tests/panel-keyprobe-stub.sh +41 -0
  192. package/skills/teamsmith/tests/panel-keyprobe.sh +82 -0
  193. package/skills/teamsmith/tests/panel-keyprobe.tsx +116 -0
  194. package/skills/teamsmith/tests/panel-knobs.sh +83 -0
  195. package/skills/teamsmith/tests/panel-p21.sh +2181 -0
  196. package/skills/teamsmith/tests/panel-snapshots.sh +802 -0
  197. package/skills/teamsmith/tests/panel-strings.mjs +195 -0
  198. package/skills/teamsmith/tests/perf.sh +740 -0
  199. package/skills/teamsmith/tests/pm-box-real.sh +350 -0
  200. package/skills/teamsmith/tests/pulse-nudge-key.sh +563 -0
  201. package/skills/teamsmith/tests/routes.sh +1652 -0
  202. package/skills/teamsmith/tests/section-budgets.tsv +150 -0
  203. package/skills/teamsmith/tests/section-guard.sh +231 -0
  204. package/skills/teamsmith/tests/section-needs-audit.sh +94 -0
  205. package/skills/teamsmith/tests/section-paths.tsv +142 -0
  206. package/skills/teamsmith/tests/section-select.sh +655 -0
  207. package/skills/teamsmith/tests/signal-gate.sh +366 -0
  208. package/skills/teamsmith/tests/signal-lint-legacy.txt +14 -0
  209. package/skills/teamsmith/tests/signal-lint.pl +416 -0
  210. package/skills/teamsmith/tests/skill-load.mjs +65 -0
  211. package/skills/teamsmith/tests/smoke.sh +19711 -0
  212. package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +32 -0
  213. package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +32 -0
  214. package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +32 -0
  215. package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +32 -0
  216. package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +32 -0
  217. package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +32 -0
  218. package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +32 -0
  219. package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +32 -0
  220. package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +32 -0
  221. package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +32 -0
  222. package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +32 -0
  223. package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +32 -0
  224. package/skills/teamsmith/tests/snapshots/zh-light-120.txt +32 -0
  225. package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +32 -0
  226. package/skills/teamsmith/tests/snapshots/zh-light-160.txt +32 -0
  227. package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +32 -0
  228. package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +32 -0
  229. package/skills/teamsmith/tests/snapshots/zh-light-59.txt +32 -0
  230. package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +32 -0
  231. package/skills/teamsmith/tests/snapshots/zh-light-99.txt +32 -0
  232. package/skills/teamsmith/tests/spec-ledger-refs.tsv +78 -0
  233. package/skills/teamsmith/tests/spec-refs.sh +826 -0
  234. package/skills/teamsmith/tests/task-header-model.sh +267 -0
  235. package/skills/teamsmith/tests/team-bg-flip.sh +239 -0
  236. package/skills/teamsmith/tests/team-bg-harness.mjs +392 -0
  237. package/skills/teamsmith/tests/team-bg-stop.sh +434 -0
  238. package/skills/teamsmith/tests/team-inbox-watch-flip.sh +191 -0
  239. package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +1559 -0
  240. package/skills/teamsmith/tests/tmp-hygiene.sh +1190 -0
  241. package/skills/teamsmith/tests/tmux-lint-legacy.txt +31 -0
  242. package/skills/teamsmith/tests/tmux-lint.pl +604 -0
  243. package/skills/teamsmith-init/SKILL.md +100 -0
  244. package/skills/teamsmith-init/references/bootstrap.md +74 -0
  245. package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +46 -0
@@ -0,0 +1,149 @@
1
+ #!/usr/bin/env bash
2
+ # teamsmith · 文档契约:task / board / thread / report / smoke
3
+
4
+ team_cmd_task() {
5
+ team_require_docs
6
+ local id="" title="" agent="" deps="-" issue="" slug=""
7
+ while [ $# -gt 0 ]; do
8
+ case "$1" in
9
+ --title) title="${2:?}"; shift 2 ;;
10
+ --agent) agent="${2:?}"; shift 2 ;;
11
+ --deps) deps="${2:?}"; shift 2 ;;
12
+ --issue) issue="${2:?}"; shift 2 ;;
13
+ --slug) slug="${2:?}"; shift 2 ;;
14
+ -*) team_usage_die "task: 未知参数 $1" ;;
15
+ *) id="$1"; shift ;;
16
+ esac
17
+ done
18
+ [ -n "$id" ] || team_usage_die "task <ID> --title \"...\" [--agent a] [--deps ...] [--issue N]"
19
+ [ -n "$title" ] || title="<未命名>"
20
+ agent="${agent:-$(team_agents | head -1)}"
21
+ slug="${slug:-$(team_slug "$title")}"
22
+ [ -n "$slug" ] || slug="task" # 非 ASCII 标题(中文)slug 会空 → 用 task 兜底,避免 "T1.1-.md"
23
+ local file="$TEAM_DOCS_ABS/tasks/$id-$slug.md"
24
+ [ -f "$file" ] && team_die "任务书已存在:$file"
25
+
26
+ # P140(dispatch-friction · R1):任务书自己带一条 `branch:` 行 —— 名字在 worktree 存在之前就可见,
27
+ # 标题后来改名也不动它(dispatch 的解析顺序:--branch > 这一行 > 由标题推导;推导只有一份)。
28
+ local branch_name
29
+ if team_branch_mode_is_task; then branch_name="$(team_task_branch_for_id "$id" "$title")"
30
+ else branch_name="$(team_agent_branch "$agent")"; fi
31
+ team_render "$(team_tmpl_dir)/task.md.tmpl" \
32
+ "ID=$id" "TITLE=$title" "AGENT=$agent" "DEPS=$deps" "ISSUE=$issue" "SLUG=$slug" \
33
+ "PROJECT=$TEAM_PROJECT" "DOCS_DIR=$TEAM_DOCS_DIR" "GATES=${TEAM_GATES:-<未配置:先跟 PM 约定验收命令>}" \
34
+ "DATE=$(date +%F)" \
35
+ | awk -v br="$branch_name" '
36
+ !done && /^agent:/ { print; print "branch: " br; done=1; next }
37
+ { print }' > "$file"
38
+ team_ok "write $file"
39
+ team_dim " 分支:$branch_name(dispatch 按它检查工作树;--branch 可显式覆盖)"
40
+
41
+ if [ -z "$(team_board_row "$id" 2>/dev/null || true)" ]; then
42
+ team_board_add "$id" "$title" "$agent" "-" "$deps"
43
+ team_ok "board add $id"
44
+ fi
45
+ team_dim " 下一步:编辑任务书(写清背景/交付物/边界/验收命令)→ $TEAM_CLI add-agent $agent → dispatch"
46
+ }
47
+
48
+ team_cmd_board() {
49
+ team_require_docs
50
+ local sub="${1:-ls}"; shift || true
51
+ case "$sub" in
52
+ ls)
53
+ grep -E '^\|' "$TEAM_DOCS_ABS/BOARD.md" 2>/dev/null || team_warn "BOARD.md 还没有行"
54
+ local warn; warn="$(team_board_layout_warning || true)"
55
+ [ -n "$warn" ] && team_dim " $warn"
56
+ # M48:同一 ID 多行必须看得见(面板焦点/状态/报告都按 ID 指行;重复只靠肉眼就太晚了)
57
+ local dups; dups="$(team_board_duplicate_line || true)"
58
+ [ -n "$dups" ] && team_warn " $dups(board set / assign 按 ID 寻址,同 ID 的多行一起改;board add 会拒绝新重复)"
59
+ local ign; ign="$(team_reports_ignored || true)"
60
+ [ -n "$ign" ] && team_dim " (reports/ 里按规则忽略的非任务报告:$(printf '%s' "$ign" | tr '\n' ' '))"
61
+ ;;
62
+ add)
63
+ # M48:--allow-dup 是显式逃生门(写进审计);位置参数仍是 <ID> <title> [agent] [deps]
64
+ local allow=0 args=() a
65
+ for a in "$@"; do
66
+ case "$a" in
67
+ --allow-dup) allow=1 ;;
68
+ -) args+=("-") ;; # deps 的「无」是裸连字符,不是选项
69
+ --*) team_usage_die "board add: 未知参数 $a(--allow-dup = 显式允许同 ID 多行)" ;;
70
+ *) args+=("$a") ;;
71
+ esac
72
+ done
73
+ local id="${args[0]:?usage: board add <ID> <title> [agent] [deps] [--allow-dup]}" title="${args[1]:?}" agent="${args[2]:-$(team_agents | head -1)}" deps="${args[3]:--}"
74
+ team_board_add "$id" "$title" "$agent" "-" "$deps" "$allow" || return 1
75
+ if [ "$allow" = "1" ]; then team_ok "board add $id(--allow-dup:同 ID 多行)"; else team_ok "board add $id"; fi ;;
76
+ assign)
77
+ # M48:给已有行指派 agent 的正门(只改 agent 列,行数不变)。以前只能再 add 一行 → 重复 ID。
78
+ [ -n "${1:-}" ] && [ -n "${2:-}" ] || team_usage_die "board: usage: board assign <ID> <agent>"
79
+ team_board_assign "$1" "$2" || team_die "BOARD.md 没有改动(未知 id)"
80
+ team_ok "board assign $1 → $2" ;;
81
+ set)
82
+ local id="${1:?usage: board set <ID> <status>}" st="${2:?}"
83
+ case "$st" in todo|wip|review|done|blocked|dropped) ;; *) team_die "状态非法:$st(todo|wip|review|done|blocked|dropped)" ;; esac
84
+ team_board_set "$id" "$st" || team_die "BOARD.md 更新失败"
85
+ team_ok "board $id → $st" ;;
86
+ row)
87
+ team_board_row "${1:?usage: board row <ID>}" ;;
88
+ *) team_usage_die "board: 未知子命令 $sub(ls|add|assign|set|row)" ;;
89
+ esac
90
+ }
91
+
92
+ team_cmd_thread() {
93
+ team_require_docs
94
+ local agent="" from="pm" re="-" body=""
95
+ while [ $# -gt 0 ]; do
96
+ case "$1" in
97
+ --from) from="${2:?}"; shift 2 ;;
98
+ --re) re="${2:?}"; shift 2 ;;
99
+ -*) team_usage_die "thread: 未知参数 $1" ;;
100
+ *) if [ -z "$agent" ]; then agent="$1"; else body="$1"; fi; shift ;;
101
+ esac
102
+ done
103
+ [ -n "$agent" ] || team_usage_die "thread <agent> [\"消息\"] [--from pm|agent:<a>] [--re <ID>]"
104
+ local f="$TEAM_DOCS_ABS/threads/$agent.md"
105
+ mkdir -p "$(dirname "$f")"
106
+ if [ -z "$body" ]; then
107
+ [ -f "$f" ] && cat "$f" || team_warn "往来记录还没有内容:$f"
108
+ return 0
109
+ fi
110
+ { [ -s "$f" ] && printf '\n'; printf '### %s · from: %s · re: %s\n%s\n' "$(team_timestamp)" "$from" "$re" "$body"; } >> "$f"
111
+ team_ok "thread $agent += 1 条(from $from)"
112
+ }
113
+
114
+ team_cmd_report() {
115
+ team_require_docs
116
+ local id="" agent="" force=0 status="DONE"
117
+ while [ $# -gt 0 ]; do
118
+ case "$1" in
119
+ --force) force=1; shift ;;
120
+ --status) status="${2:?}"; shift 2 ;;
121
+ -*) team_usage_die "report: 未知参数 $1" ;;
122
+ *) if [ -z "$id" ]; then id="$1"; else agent="$1"; fi; shift ;;
123
+ esac
124
+ done
125
+ [ -n "$id" ] && [ -n "$agent" ] || team_usage_die "report <ID> <agent> [--force] [--status DONE|PARTIAL|BLOCKED]"
126
+ local file="$TEAM_DOCS_ABS/reports/$id-$agent.md"
127
+ if [ -f "$file" ] && [ "$force" != "1" ]; then
128
+ team_dim "skip $file(已存在,--force 覆盖)"; return 0
129
+ fi
130
+ team_render "$(team_tmpl_dir)/report.md.tmpl" \
131
+ "ID=$id" "AGENT=$agent" "STATUS=$status" "DOCS_DIR=$TEAM_DOCS_DIR" \
132
+ "TIME=$(team_timestamp)" "BRANCH=$(git -C "$(team_agent_worktree "$agent")" rev-parse --abbrev-ref HEAD 2>/dev/null || echo '-')" \
133
+ > "$file"
134
+ team_ok "write $file"
135
+ }
136
+
137
+ team_cmd_smoke() {
138
+ local t="$TEAM_SKILL_DIR/tests/smoke.sh"
139
+ [ -f "$t" ] || team_die "缺 $t"
140
+ bash "$t" "$@"
141
+ }
142
+
143
+ # M58 · perf-suite-split:性能套件的前门(与 smoke 并列,但**不**属于正确性门禁)。
144
+ # 默认在参考环境(ci/Containerfile 的钉死镜像)里跑;--host = 宿主(明确标注非参考环境)。
145
+ team_cmd_perf() {
146
+ local t="$TEAM_SKILL_DIR/tests/perf.sh"
147
+ [ -f "$t" ] || team_die "缺 $t(性能套件)"
148
+ bash "$t" "$@"
149
+ }
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env bash
2
+ # teamsmith · `team draft`:人的草稿入口(delivery-guard 的 draft 部分)
3
+ #
4
+ # team draft [pm] 在团队 session 里开/复用一个 `draft` 窗口跑 $EDITOR,
5
+ # 编辑器保存退出后自动入队并在这个窗口里给回执
6
+ # team draft send [<file>] [--target T] [--now]
7
+ # 无头形式:把文件内容整段交给守卫路径(测试面)
8
+ #
9
+ # 为什么是「文件契约 + 窗口只是便利」:文件的读写可以无头复现(写文件 → draft send → 断言队列 →
10
+ # 清空输入框 → flush → 断言只投一次),窗口不需要成为投递通道的一部分。
11
+ # 硬规则:**任何 teamsmith 路径都不许往 draft 窗口打字**(它只写文件)。
12
+
13
+ team_draft_file() { # → 草稿文件路径(默认 pm 的那一份)
14
+ printf '%s\n' "$TEAM_STATE_DIR/${1:-draft-pm}.md"
15
+ }
16
+
17
+ team_draft_target() { printf '%s:%s\n' "$TEAM_SESSION" "$TEAM_PM_WINDOW"; }
18
+
19
+ team_draft_editor() {
20
+ local e="${EDITOR:-}"
21
+ [ -n "$e" ] || e="$(command -v nano || command -v vi || command -v vim || true)"
22
+ [ -n "$e" ] || team_die "draft:没有可用的编辑器(设 EDITOR)"
23
+ printf '%s\n' "$e"
24
+ }
25
+
26
+ team_draft_window_exists() { team_tmux_has_window "$TEAM_SESSION" draft; }
27
+
28
+ team_draft_open() { # [pm]
29
+ local who="${1:-pm}"
30
+ [ "$who" = "pm" ] || team_die "draft:目前只有 pm 这一份草稿(收到 $who)"
31
+ local file editor wrapper cli cmd
32
+ file="$(team_draft_file draft-pm)"
33
+ editor="$(team_draft_editor)"
34
+ wrapper="$TEAM_SKILL_DIR/scripts/lib/draft-entry.sh"
35
+ [ -f "$wrapper" ] || team_die "draft:缺 harness($wrapper)"
36
+ cli="$TEAM_SKILL_DIR/scripts/team"
37
+ mkdir -p "$TEAM_STATE_DIR"
38
+ [ -f "$file" ] || : > "$file"
39
+
40
+ if ! team_have_cmd tmux; then
41
+ team_warn "draft:本机没有 tmux,开不了草稿窗口 —— 直接写文件再跑 $TEAM_CLI draft send"
42
+ team_dim " 文件:$file"
43
+ return 0
44
+ fi
45
+ team_assert_own_session "draft 窗口" || return 1
46
+ # M40:草稿窗口也只带本命令推导出的身份(否则窗口里的 `team --root … draft send`
47
+ # 会看到继承的别的项目身份,投递闸门按「冲突」拒绝——事故②同族的坑)
48
+ cmd="$(printf '%scd %q && exec bash %q %q %q %q %q %q' \
49
+ "$(team_identity_env_prefix "$TEAM_MAIN_ROOT")" "$TEAM_MAIN_ROOT" "$wrapper" "$cli" "$TEAM_MAIN_ROOT" "$file" "$(team_draft_target)" "$editor")"
50
+ if team_draft_window_exists; then
51
+ # 复用一个已经退出的草稿窗口(remain-on-exit 让回执留在 pane 里)
52
+ if tmux respawn-pane -k -t "$TEAM_SESSION:draft" "$cmd" 2>/dev/null; then
53
+ team_ok "draft:复用 $TEAM_SESSION:draft($editor $file)"
54
+ return 0
55
+ fi
56
+ team_warn "draft:$TEAM_SESSION:draft 复用时失败,按现状保留"
57
+ return 0
58
+ fi
59
+ # 先用一个占位命令把窗口建出来,再开 remain-on-exit,最后才换成真 harness:
60
+ # 否则当编辑器秒退(脚本/CI)时 harness 会在 set-window-option 之前结束,窗口连同回执一起消失。
61
+ tmux new-window -d -t "$TEAM_SESSION" -n draft 'sleep 5' 2>/dev/null || team_die "draft:建窗口失败($TEAM_SESSION)"
62
+ tmux set-window-option -t "$TEAM_SESSION:draft" remain-on-exit on 2>/dev/null || true
63
+ tmux respawn-pane -k -t "$TEAM_SESSION:draft" "$cmd" 2>/dev/null || team_die "draft:pane 启动失败($TEAM_SESSION:draft)"
64
+ team_ok "draft:已开 $TEAM_SESSION:draft(不抢焦点;$editor $file)"
65
+ team_dim " 保存并退出编辑器 → 内容自动入队(回执打印在该窗口里);任何自动化消息都不会打进这个窗口"
66
+ return 0
67
+ }
68
+
69
+ team_draft_send() { # [<file>] [--target T] [--now]
70
+ local file="" target="" now=""
71
+ while [ $# -gt 0 ]; do
72
+ case "$1" in
73
+ --target) target="${2:?}"; shift 2 ;;
74
+ --now) now="--now"; shift ;;
75
+ -*) team_usage_die "draft send: 未知参数 $1" ;;
76
+ *) file="$1"; shift ;;
77
+ esac
78
+ done
79
+ [ -n "$file" ] || file="$(team_draft_file draft-pm)"
80
+ [ -n "$target" ] || target="$(team_draft_target)"
81
+ [ -f "$file" ] || team_die "draft send:文件不存在($file)"
82
+ local payload
83
+ payload="$(cat "$file")"
84
+ [ -n "$(printf '%s' "$payload" | tr -d '[:space:]')" ] || team_die "draft send:文件是空的($file)"
85
+
86
+ local args=()
87
+ [ -n "$now" ] && args+=("$now")
88
+ # 目标没在跑也排队(消息是人的,必须 durable;TTL/held 会把它显式暴露出来)
89
+ team_send_guarded "$target" "$payload" draft --from human --queue-offline ${args[@]+"${args[@]}"}
90
+ case "$TEAM_SEND_OUTCOME" in
91
+ delivered) team_ok "draft:已确认送达 $target($file)" ;;
92
+ queued) team_ok "queued for $target(输入框有草稿或目标没在跑;条目已入 state/outbox/,清空后自动投递)" ;;
93
+ held)
94
+ # delivery-truth D2:geometry-untrusted / queue-stalled —— 不打字、不承诺「清空后自动投递」,
95
+ # 报 held + 原因 + durable 条目与恢复命令并非零退出(草稿文件的 durable 副本已在收件箱)。
96
+ team_err "held for $target(reason=${TEAM_SEND_REASON:--}:几何/进展无法可信确认,没有写任何键;草稿文件仍是 $file)"
97
+ team_dim " 条目:$(basename "${TEAM_SEND_ENTRY:--}")|原因:$TEAM_CLI outbox list |恢复:$(team_outbox_recovery_hint "${TEAM_SEND_REASON:--}")"
98
+ return 1 ;;
99
+ forced) team_ok "draft:--now 已跳过守卫直投 $target(记入 outbox/forced.log)" ;;
100
+ unknown-sent) team_ok "draft:输入框形状未知,按旧行为投递 $target" ;;
101
+ duplicate) team_ok "duplicate:同一条草稿刚刚已经投过(没重复入队)" ;;
102
+ offline) team_err "draft:无法投递(目标 $target 不在跑,且入队失败)"; return 1 ;;
103
+ *) team_err "draft:投递未确认($target)"; return 1 ;;
104
+ esac
105
+ return 0
106
+ }
107
+
108
+ team_cmd_draft() {
109
+ local sub="${1:-pm}"
110
+ [ $# -gt 0 ] && shift
111
+ case "$sub" in
112
+ send) team_draft_send "$@" ;;
113
+ pm|open|"") team_draft_open "${sub:-pm}" ;;
114
+ -h|--help|help)
115
+ cat <<EOF
116
+ 用法:
117
+ $TEAM_CLI draft [pm] 开/复用草稿窗口(\$EDITOR 写 $TEAM_STATE_DIR/draft-pm.md,退出后自动入队)
118
+ $TEAM_CLI draft send [<文件>] [--target SESSION:WINDOW] [--now]
119
+ 无头形式:文件内容整段投递(守卫路径;--now 故意粘字)
120
+ EOF
121
+ ;;
122
+ *) team_die "draft:未知子命令 $sub(pm | send)" ;;
123
+ esac
124
+ }
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/env bash
2
+ # teamsmith · 项目本地 skill 安装:<main worktree>/.pi/skills/<name>
3
+ #
4
+ # 调用点:`team init` 的最后一步,以及 `team bootstrap`(同一实现,两个调用点;bootstrap 在
5
+ # config.sh 已存在时也要跑它 —— 这就是老项目的升级路径)。
6
+ #
7
+ # 源按**名字**取,绝不扫荡 skills/ 下的目录:teamsmith = 正在运行的 CLI 自己的 skill 目录
8
+ # ($TEAM_SKILL_DIR),teamsmith-init = 它的兄弟目录。复制布局里只带一个就只装一个,并说出来。
9
+ #
10
+ # 冲突表(与 openspec/changes/npm-cli-and-project-init/design.md §3 逐格一致;tests/install-shape.sh 走):
11
+ # dest 状态 默认(link) --force
12
+ # 不存在 安装 安装
13
+ # 软链 → 同一来源 skip(exit 0) skip
14
+ # 软链 → 别的来源 冲突(非 0,字节不动) 重新指向本来源
15
+ # 目录,SKILL.md 的 name 是本 skill 与源一致 → skip; 与源不同 → 替换
16
+ # 与源不同 → 冲突
17
+ # 其它(无 SKILL.md / name 不符 / 普通文件) 冲突(非 0,**连 --force 都不删**)
18
+ # 最后一行是红线:宁可拒绝,也不删一个我们不认识的目录。
19
+
20
+ team_project_skill_target() {
21
+ printf '%s/.pi/skills\n' "$TEAM_MAIN_ROOT"
22
+ return 0
23
+ }
24
+
25
+ team_skill_sources() { # → 每行 "<name>\t<src>",只列真实存在的源
26
+ local parent; parent="$(dirname "$TEAM_SKILL_DIR")"
27
+ if [ -d "$TEAM_SKILL_DIR" ]; then printf 'teamsmith\t%s\n' "$TEAM_SKILL_DIR"; fi
28
+ if [ -d "$parent/teamsmith-init" ]; then printf 'teamsmith-init\t%s\n' "$parent/teamsmith-init"; fi
29
+ return 0
30
+ }
31
+
32
+ team_skill_md_name() { # <skill 目录> → frontmatter 的 name: 值;读不到就空
33
+ local f="$1/SKILL.md"
34
+ [ -f "$f" ] || return 0
35
+ awk '
36
+ /^---[[:space:]]*$/ { n++; if (n == 2) exit 0; next }
37
+ n == 1 && /^name:[[:space:]]*/ {
38
+ sub(/^name:[[:space:]]*/, ""); sub(/[[:space:]]+$/, ""); print; exit 0
39
+ }
40
+ ' "$f"
41
+ return 0
42
+ }
43
+
44
+ team_skill_md_version() { # <skill 目录> → frontmatter 的 metadata.version(去引号);读不到就空
45
+ local f="$1/SKILL.md"
46
+ [ -f "$f" ] || return 0
47
+ awk '
48
+ /^---[[:space:]]*$/ { n++; if (n == 2) exit 0; next }
49
+ n == 1 && /^[[:space:]]+version:[[:space:]]*/ {
50
+ sub(/^[[:space:]]+version:[[:space:]]*/, ""); gsub(/"/, ""); sub(/[[:space:]]+$/, ""); print; exit 0
51
+ }
52
+ ' "$f"
53
+ return 0
54
+ }
55
+
56
+ team_skill_copy_tree() { # <src> <dest>:复制全部,只排除 .git/ 与 node_modules/(不做别的魔法清单)
57
+ local src="$1" dest="$2" tmp
58
+ tmp="$(dirname "$dest")/.$(basename "$dest").tmp.$$"
59
+ rm -rf "$tmp"
60
+ mkdir -p "$tmp" || return 1
61
+ if ! tar -C "$src" -cf - --exclude='./.git' --exclude='./node_modules' --exclude='*/node_modules' . 2>/dev/null \
62
+ | tar -C "$tmp" -xf - 2>/dev/null; then
63
+ rm -rf "$tmp"
64
+ return 1
65
+ fi
66
+ rm -rf "$dest"
67
+ mv -f "$tmp" "$dest"
68
+ return 0
69
+ }
70
+
71
+ team_skill_install_one() { # <link|copy> <src> <dest>
72
+ local mode="$1" src="$2" dest="$3"
73
+ if [ "$mode" = "copy" ]; then
74
+ if team_skill_copy_tree "$src" "$dest"; then
75
+ printf ' copy %s\n' "$dest"
76
+ return 0
77
+ fi
78
+ team_err "copy 失败:$src → $dest"
79
+ return 1
80
+ fi
81
+ if ln -s "$src" "$dest" 2>/dev/null; then
82
+ printf ' link %s → %s\n' "$dest" "$src"
83
+ return 0
84
+ fi
85
+ team_err "link 失败:$dest → $src"
86
+ return 1
87
+ }
88
+
89
+ team_skill_install_conflict() { # <dest> <发现了什么>:认得出是本 skill,但来源/内容不同
90
+ local dest="$1" found="$2"
91
+ team_err "冲突:$dest 已经存在,但不是本次安装的源($found)—— 字节没动"
92
+ team_dim " 三条出路:$TEAM_CLI init --force(换成当前源)|自己删掉它再跑 | $TEAM_CLI init --no-skills(跳过这一步)"
93
+ return 1
94
+ }
95
+
96
+ team_skill_install_refuse_unknown() { # <dest> <name>:根本不认识这个条目 —— 红线:--force 也不删
97
+ local dest="$1" name="$2"
98
+ team_err "冲突:$dest 不是 $name(没有 SKILL.md,或 frontmatter name 不符)—— 红线:不认识的条目连 --force 都不删"
99
+ team_dim " 出路:自己确认后删掉它再跑 | $TEAM_CLI init --no-skills(跳过这一步)"
100
+ return 1
101
+ }
102
+
103
+ team_init_install_skills() { # [--copy|--link] [--no-skills] [--force] → 0 全部就位(含 skip);1 有冲突
104
+ local mode="link" skip=0 force=0
105
+ while [ $# -gt 0 ]; do
106
+ case "$1" in
107
+ --copy) mode="copy"; shift ;;
108
+ --link) mode="link"; shift ;;
109
+ --no-skills) skip=1; shift ;;
110
+ --force) force=1; shift ;;
111
+ *) team_usage_die "init: 未知参数 $1" ;;
112
+ esac
113
+ done
114
+
115
+ local target; target="$(team_project_skill_target)"
116
+ if [ "$skip" = "1" ]; then
117
+ printf ' skip %s(--no-skills:只做配置/文档,没装项目本地 skill)\n' "$target"
118
+ return 0
119
+ fi
120
+
121
+ local sources; sources="$(team_skill_sources)"
122
+ if [ -z "$sources" ]; then
123
+ team_err "找不到可安装的 skill 源($TEAM_SKILL_DIR 和它的兄弟 teamsmith-init 都不在)"
124
+ return 1
125
+ fi
126
+
127
+ mkdir -p "$target" || { team_err "建不了 $target"; return 1; }
128
+ local rc=0 name src dest cur src_real found
129
+ while IFS=$'\t' read -r name src; do
130
+ [ -n "$name" ] || continue
131
+ dest="$target/$name"
132
+ # ① 不存在 → 安装
133
+ if [ ! -e "$dest" ] && [ ! -L "$dest" ]; then
134
+ team_skill_install_one "$mode" "$src" "$dest" || rc=1
135
+ continue
136
+ fi
137
+ # ② 软链:解析到同一来源 → skip;否则冲突(--force 重指)
138
+ if [ -L "$dest" ]; then
139
+ cur="$(readlink -f "$dest" 2>/dev/null || readlink "$dest" 2>/dev/null || true)"
140
+ src_real="$(readlink -f "$src" 2>/dev/null || printf '%s' "$src")"
141
+ if [ -n "$cur" ] && [ "$cur" = "$src_real" ]; then
142
+ printf ' skip %s(已经是指向同一来源的软链)\n' "$dest"
143
+ elif [ "$force" = "1" ]; then
144
+ rm -f "$dest"
145
+ team_skill_install_one "$mode" "$src" "$dest" || rc=1
146
+ else
147
+ team_skill_install_conflict "$dest" "软链 → ${cur:-<坏链接>},不是 $src"
148
+ rc=1
149
+ fi
150
+ continue
151
+ fi
152
+ # ③ 目录:只有认得出是本 skill(frontmatter name 相符)才碰
153
+ if [ -d "$dest" ]; then
154
+ found="$(team_skill_md_name "$dest")"
155
+ if [ "$found" != "$name" ]; then
156
+ team_skill_install_refuse_unknown "$dest" "$name"
157
+ rc=1
158
+ elif [ -f "$src/SKILL.md" ] && [ -f "$dest/SKILL.md" ] && cmp -s "$src/SKILL.md" "$dest/SKILL.md"; then
159
+ printf ' skip %s(内容与源一致)\n' "$dest"
160
+ elif [ "$force" = "1" ]; then
161
+ rm -rf "$dest"
162
+ team_skill_install_one "$mode" "$src" "$dest" || rc=1
163
+ else
164
+ team_skill_install_conflict "$dest" "目录($name 的副本,与源内容不同)"
165
+ rc=1
166
+ fi
167
+ continue
168
+ fi
169
+ # ④ 其它形状(普通文件等):不认识的条目,连 --force 都不删
170
+ team_skill_install_refuse_unknown "$dest" "$name"
171
+ rc=1
172
+ done <<< "$sources"
173
+
174
+ [ "$rc" -eq 0 ] || return 1
175
+ # 绝对软链不能提交(换机器就断),副本是可再生的 —— 装目录进 teamsmith 的忽略块(幂等)。
176
+ team_gitignore_add ".pi/skills/"
177
+ # P59:这一步在这个项目里留下了会让 pi 问「是否信任此项目」的资源(`skills` 在 Pi 的项目信任清单里)——
178
+ # 一行说清楚后果与三条出路。只在**装完/已就位**时打:`--no-skills` 在函数开头就返回,冲突/失败在上面
179
+ # return 1,两条路都不打;这一步的退出码一个字不改。
180
+ team_dim " 提示:.pi/skills/ 是 pi 的项目资源,本项目第一次跑 pi 会问「是否信任此项目」——回答:pi --approve(只信这一次)|pi 里 /trust(记住决定)|$TEAM_CLI init --no-skills(跳过安装)"
181
+ return 0
182
+ }
183
+
184
+ team_project_skill_install_row() { # → ""(没有安装)/ "pass <text>" / "warn <text>"(warn 不改 doctor 退出码)
185
+ local dest="$TEAM_MAIN_ROOT/.pi/skills/teamsmith"
186
+ if [ ! -e "$dest" ] && [ ! -L "$dest" ]; then return 0; fi
187
+ local cur src_real v
188
+ if [ -L "$dest" ]; then
189
+ cur="$(readlink -f "$dest" 2>/dev/null || readlink "$dest" 2>/dev/null || true)"
190
+ src_real="$(readlink -f "$TEAM_SKILL_DIR" 2>/dev/null || printf '%s' "$TEAM_SKILL_DIR")"
191
+ if [ -n "$cur" ] && [ "$cur" = "$src_real" ]; then
192
+ printf 'pass %s → %s(link,跟随磁盘)\n' "$dest" "$cur"
193
+ else
194
+ printf 'warn %s 指向 %s,不是正在运行的 %s:修法 %s init --force\n' \
195
+ "$dest" "${cur:-<坏链接>}" "$TEAM_SKILL_DIR" "$TEAM_CLI"
196
+ fi
197
+ return 0
198
+ fi
199
+ if [ -d "$dest" ]; then
200
+ v="$(team_skill_md_version "$dest")"
201
+ if [ -n "$v" ] && [ "$v" = "$TEAM_VERSION" ]; then
202
+ printf 'pass %s(copy %s,与运行版本一致)\n' "$dest" "$v"
203
+ elif [ -n "$v" ]; then
204
+ printf 'warn %s 是 copy 的 %s,运行版本 %s:修法 %s init --force\n' "$dest" "$v" "$TEAM_VERSION" "$TEAM_CLI"
205
+ else
206
+ printf 'warn %s 没有可读的 SKILL.md(版本判不出):修法 %s init --force\n' "$dest" "$TEAM_CLI"
207
+ fi
208
+ return 0
209
+ fi
210
+ printf 'warn %s 既不是软链也不是目录:修法 %s init --force\n' "$dest" "$TEAM_CLI"
211
+ return 0
212
+ }