teamsmith 0.2.0 → 0.3.0
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/README.md +4 -4
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +28 -0
- package/skills/teamsmith/SKILL.md +14 -7
- package/skills/teamsmith/extension/team-notify.ts +37 -6
- package/skills/teamsmith/extension/team.ts +438 -0
- package/skills/teamsmith/references/config.md +39 -6
- package/skills/teamsmith/references/migration.md +197 -47
- package/skills/teamsmith/references/protocol.md +176 -19
- package/skills/teamsmith/references/troubleshooting.md +124 -7
- package/skills/teamsmith/references/workflows.md +36 -2
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
- package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
- package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
- package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
- package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
- package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
- package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
- package/skills/teamsmith/scripts/lib/cmd-review.sh +175 -30
- package/skills/teamsmith/scripts/lib/cmd-status.sh +226 -17
- package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
- package/skills/teamsmith/scripts/lib/common.sh +773 -48
- package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
- package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
- package/skills/teamsmith/scripts/panel/panel.js +207 -207
- package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
- package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
- package/skills/teamsmith/scripts/panel/src/data.ts +11 -3
- package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
- package/skills/teamsmith/scripts/panel/src/main.tsx +33 -8
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
- package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
- package/skills/teamsmith/scripts/replies.mjs +4 -1
- package/skills/teamsmith/scripts/shim/tmux +18 -0
- package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
- package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
- package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
- package/skills/teamsmith/scripts/team +19 -6
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
- package/skills/teamsmith/templates/config.sh.tmpl +20 -1
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
- package/skills/teamsmith/tests/bg-ledger.sh +168 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
- package/skills/teamsmith/tests/config-cli.sh +160 -14
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
- package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
- package/skills/teamsmith/tests/flip-m33.sh +5 -3
- package/skills/teamsmith/tests/flip-m37.sh +4 -1
- package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
- package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
- package/skills/teamsmith/tests/flip-p158.sh +2 -1
- package/skills/teamsmith/tests/flip-p210.sh +4 -1
- package/skills/teamsmith/tests/flip-p217.sh +4 -1
- package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
- package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
- package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
- package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
- package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
- package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
- package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
- package/skills/teamsmith/tests/help-surface.sh +1664 -0
- package/skills/teamsmith/tests/install-shape.sh +279 -20
- package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
- package/skills/teamsmith/tests/key-replies-ui.sh +0 -7
- package/skills/teamsmith/tests/key-replies.sh +240 -1
- package/skills/teamsmith/tests/ledger-ban.sh +5 -4
- package/skills/teamsmith/tests/ledger-claim.sh +2 -1
- package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
- package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
- package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
- package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
- package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
- package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
- package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
- package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
- package/skills/teamsmith/tests/loop-inventory.tsv +59 -47
- package/skills/teamsmith/tests/panel-b2.sh +106 -3
- package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
- package/skills/teamsmith/tests/panel-b3.sh +175 -19
- package/skills/teamsmith/tests/panel-choices.sh +11 -6
- package/skills/teamsmith/tests/panel-cpu.sh +2 -1
- package/skills/teamsmith/tests/panel-knobs.sh +7 -1
- package/skills/teamsmith/tests/panel-p21.sh +156 -73
- package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
- package/skills/teamsmith/tests/panel-strings.mjs +33 -18
- package/skills/teamsmith/tests/perf.sh +121 -30
- package/skills/teamsmith/tests/routes.sh +327 -93
- package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
- package/skills/teamsmith/tests/seat-visibility.sh +675 -0
- package/skills/teamsmith/tests/section-budgets.tsv +20 -10
- package/skills/teamsmith/tests/section-guard.sh +6 -1
- package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
- package/skills/teamsmith/tests/section-paths.tsv +19 -13
- package/skills/teamsmith/tests/section-select.sh +8 -1
- package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
- package/skills/teamsmith/tests/slash-team.sh +617 -0
- package/skills/teamsmith/tests/smoke.sh +2972 -440
- package/skills/teamsmith/tests/task-model-routing.sh +507 -10
- package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
- package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
- package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
- package/skills/teamsmith-init/SKILL.md +12 -12
- package/skills/teamsmith-init/references/bootstrap.md +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# P230 · long-job-suspend · A 刀夹具(独立入口:extension 侧的合同,不碰 smoke.sh)
|
|
3
3
|
#
|
|
4
|
-
# bash skills/teamsmith/tests/bg-ledger.sh --select wording,ledger,suspend-shape,owner-scope,flip
|
|
5
|
-
# bash skills/teamsmith/tests/bg-ledger.sh #
|
|
4
|
+
# bash skills/teamsmith/tests/bg-ledger.sh --select wording,ledger,suspend-shape,owner-scope,merge,detail,wake,flip
|
|
5
|
+
# bash skills/teamsmith/tests/bg-ledger.sh # 默认八组全跑
|
|
6
6
|
# bash skills/teamsmith/tests/bg-ledger.sh --select flip --evidence <dir> # 把每组原始日志拷进证据目录
|
|
7
7
|
# bash skills/teamsmith/tests/bg-ledger.sh --keep # 保留临时根排查
|
|
8
8
|
#
|
|
@@ -20,9 +20,17 @@
|
|
|
20
20
|
# cwd 必须解析到本会话自己的工作树/cwd 才算「我的作业」;多席位各有作业时各自只认自己的
|
|
21
21
|
# id;空席位(dev2 与 dev3 两个非拥有者)不被别人的作业打成挂起;缺 cwd / 相对 cwd /
|
|
22
22
|
# 解析不出来的畸形记录不判挂起(fail-closed);软链与尾斜杠按真实路径归一。
|
|
23
|
+
# merge turn-notice-merge 的写入面(P251):合并键四分量(席位/任务/状态类/awaiting 集合)、
|
|
24
|
+
# 汇总行的形状(最后一条事件的行 + ×N first= last=)与最后一条的值、尾行锚、跨类/跨任务/
|
|
25
|
+
# 跨 awaiting 不合并、去重窗口语义、行计数读者(未读 + --ack)与陈旧判据。
|
|
26
|
+
# detail 明细文件(state/notify.log):一行一事件、先明细后合并(×N 与记录数一致)、
|
|
27
|
+
# TEAM_NOTIFY_DETAIL_MAX 上界与一代轮转(轮转头 + 扩展日志)、`team inbox --detail`
|
|
28
|
+
# 的读面(缺文件/被轮转出去要点名 state/notify.log.1 并非零退出、只读不 ack)。
|
|
29
|
+
# wake P251 的叫醒判据(无限私有 tmux shim):只有**写新行且行可行动**才入队 knock(行身份去重)、
|
|
30
|
+
# 交付/中断敲门、**挂起只记录不敲门**(行与明细都在、合并也不敲)、合并的 settle 零条目
|
|
31
|
+
# (计数抖动不叫醒)、文本逐字相同的两条不同行不互吞、写盘失败不叫醒。
|
|
23
32
|
# flip 对 scratch 源码做真实破坏必须变红(措辞回退 / 删 start 行 / waited_s 记作业年龄 /
|
|
24
|
-
# 去掉身份验证 / 改成读 notify 自己的 root /
|
|
25
|
-
# 树上必须 PASS。
|
|
33
|
+
# 去掉身份验证 / 改成读 notify 自己的 root / 删掉归属判据;P251 的十二个写入面红侧)。
|
|
26
34
|
#
|
|
27
35
|
# 纪律(§13c):清掉继承的 TEAM_*/SMOKE_*/TMUX*;写盘前断言 `team paths` 指向夹具仓库;跑后扫描真项目
|
|
28
36
|
# state/ 与 inbox 的夹具标记(+ 前后快照)。夹具只写 ${TMPDIR:-/tmp} 下的 owned 根;不碰调用者仓库。
|
|
@@ -34,7 +42,7 @@ REPO_ROOT="$(cd -P "$SKILL_DIR/../.." && pwd)"
|
|
|
34
42
|
# shellcheck source=lib/tmp-root.sh
|
|
35
43
|
. "$SELF_DIR/lib/tmp-root.sh"
|
|
36
44
|
|
|
37
|
-
SELECT="wording,ledger,suspend-shape,owner-scope,flip"
|
|
45
|
+
SELECT="wording,ledger,suspend-shape,owner-scope,merge,detail,wake,flip"
|
|
38
46
|
KEEP=0
|
|
39
47
|
EVIDENCE=""
|
|
40
48
|
while [ $# -gt 0 ]; do
|
|
@@ -50,7 +58,7 @@ while [ $# -gt 0 ]; do
|
|
|
50
58
|
done
|
|
51
59
|
IFS=',' read -r -a SEL_GROUPS <<<"$SELECT"
|
|
52
60
|
for _g in "${SEL_GROUPS[@]}"; do
|
|
53
|
-
case "$_g" in wording|ledger|suspend-shape|owner-scope|flip) ;; *) printf 'bg-ledger: 未知组 %s(wording|ledger|suspend-shape|owner-scope|flip)\n' "$_g" >&2; exit 2 ;; esac
|
|
61
|
+
case "$_g" in wording|ledger|suspend-shape|owner-scope|merge|detail|wake|flip) ;; *) printf 'bg-ledger: 未知组 %s(wording|ledger|suspend-shape|owner-scope|merge|detail|wake|flip)\n' "$_g" >&2; exit 2 ;; esac
|
|
54
62
|
done
|
|
55
63
|
selects() { case ",$SELECT," in *",$1,"*) return 0 ;; esac; return 1; }
|
|
56
64
|
|
|
@@ -100,7 +108,7 @@ cat > "$FIX/.pi/team/config.sh" <<EOF
|
|
|
100
108
|
TEAM_PROJECT="bg-ledger-fixture"
|
|
101
109
|
TEAM_AGENTS="dev"
|
|
102
110
|
TEAM_WORKTREES_DIR=".worktrees"
|
|
103
|
-
TEAM_NOTIFY_LOG="$FIX/.pi/team/state/notify.log"
|
|
111
|
+
TEAM_NOTIFY_LOG="$FIX/.pi/team/state/notify-ext.log"
|
|
104
112
|
EOF
|
|
105
113
|
printf '# bg-ledger fixture\n' > "$FIX/README.md"
|
|
106
114
|
( cd "$FIX" && git init -q -b main && git add README.md \
|
|
@@ -114,6 +122,21 @@ esac
|
|
|
114
122
|
|
|
115
123
|
MAIN_ROOT="$(git -C "$REPO_ROOT" rev-parse --path-format=absolute --git-common-dir 2>/dev/null | xargs -r dirname)"
|
|
116
124
|
[ -n "$MAIN_ROOT" ] || MAIN_ROOT="$REPO_ROOT"
|
|
125
|
+
|
|
126
|
+
# ── 私有 tmux shim(p251 的 wake 组):假 PM 窗口(window=dev / session=team / 在跑 pi),只会在
|
|
127
|
+
# 启动 runner 前以 PATH 前缀的形式给带 wake 的组(bun 启动时缓存 PATH,运行中改无效)。只写自己的 tmp 根。
|
|
128
|
+
KNOCK_SHIM="$TMP/knock-shim"
|
|
129
|
+
mkdir -p "$KNOCK_SHIM"
|
|
130
|
+
cat > "$KNOCK_SHIM/tmux" <<'EOF'
|
|
131
|
+
#!/usr/bin/env bash
|
|
132
|
+
case "$*" in
|
|
133
|
+
*'#{window_name}'*) printf 'dev\n' ;;
|
|
134
|
+
*'#{session_name}'*) printf 'team\n' ;;
|
|
135
|
+
*'#{pane_current_command}'*) printf 'pi\n' ;;
|
|
136
|
+
esac
|
|
137
|
+
exit 0
|
|
138
|
+
EOF
|
|
139
|
+
chmod +x "$KNOCK_SHIM/tmux"
|
|
117
140
|
real_snapshot() {
|
|
118
141
|
{ for d in "$MAIN_ROOT/.pi/team/state" "$MAIN_ROOT/docs/team/inbox"; do
|
|
119
142
|
if [ -d "$d" ]; then
|
|
@@ -142,8 +165,11 @@ real_marker_hits() { # 真项目里含夹具标记的文件。**排除本入口
|
|
|
142
165
|
REAL_BEFORE="$(real_snapshot)"
|
|
143
166
|
|
|
144
167
|
run_harness() { # <tag> <groups> [<bg> <notify>] → rc;stdout+stderr 落 $TMP/h-<tag>.log
|
|
145
|
-
|
|
146
|
-
|
|
168
|
+
# P251:带 wake 的组要「有 PM 窗口」的形状 —— 假 tmux 必须在 runner **启动前**进 PATH(bun 缓存在
|
|
169
|
+
# 启动时读的 PATH,运行中改 process.env.PATH 对子进程查找无效;实测)。只加给带 wake 的组。
|
|
170
|
+
local tag="$1" groups="$2" bg="${3:-$BG_EXT}" notify="${4:-$NOTIFY_EXT}" path_pre="$PATH"
|
|
171
|
+
case ",$groups," in *,wake,*) path_pre="$KNOCK_SHIM:$PATH" ;; esac
|
|
172
|
+
env PATH="$path_pre" "$RUNNER" "$HARNESS" --bg "$bg" --notify "$notify" --root "$FIX" --groups "$groups" --marker "$MARKER" \
|
|
147
173
|
>"$TMP/h-$tag.log" 2>&1
|
|
148
174
|
}
|
|
149
175
|
report_group() { # <tag>
|
|
@@ -184,7 +210,7 @@ printf '[bg-ledger-run] %s\n' "$MARKER" # 本入口自己的输出指纹(反
|
|
|
184
210
|
|
|
185
211
|
# ── wording / ledger / suspend-shape ────────────────────────────────────────────────────
|
|
186
212
|
SELECTED_GROUPS=""
|
|
187
|
-
for _g in wording ledger suspend-shape owner-scope; do
|
|
213
|
+
for _g in wording ledger suspend-shape owner-scope merge detail wake; do
|
|
188
214
|
if selects "$_g"; then SELECTED_GROUPS="${SELECTED_GROUPS:+$SELECTED_GROUPS,}$_g"; fi
|
|
189
215
|
done
|
|
190
216
|
if [ -n "$SELECTED_GROUPS" ]; then
|
|
@@ -198,6 +224,9 @@ if selects flip; then
|
|
|
198
224
|
section "flip · pristine 树基线(同一批用例必须全绿)"
|
|
199
225
|
run_harness flip-green "wording,ledger,suspend-shape,owner-scope"
|
|
200
226
|
report_group flip-green
|
|
227
|
+
section "flip · P251 写入面的 pristine 基线(merge/detail/wake 必须全绿)"
|
|
228
|
+
run_harness flip-green-notify "merge,detail,wake"
|
|
229
|
+
report_group flip-green-notify
|
|
201
230
|
|
|
202
231
|
MUT="$TMP/mut"; mkdir -p "$MUT"
|
|
203
232
|
flip_mut() { # <tag> <src> <sed 表达式>
|
|
@@ -264,10 +293,139 @@ if selects flip; then
|
|
|
264
293
|
expect_red flip-owner-scope "owner-scope: a live record with a missing, relative or unresolvable cwd does not suspend (fail-closed)" "$TMP/h-flip-green.log"
|
|
265
294
|
expect_red flip-owner-scope "owner-scope: a job started from the main worktree does not suspend a seat" "$TMP/h-flip-green.log"
|
|
266
295
|
|
|
296
|
+
# ── P251 · turn-notice-merge 的写入面红侧(merge/detail/wake)────────────────────────────
|
|
297
|
+
# 扩展的 skillDir() = 它自己目录的父目录 → CLI 侧的合并/明细代码与扩展侧的叫醒代码必须在**同一棵
|
|
298
|
+
# scratch 树**里破坏($MUT/<tag>/{extension,scripts}),否则扩展找不到 scripts/team,knock 断言是假红。
|
|
299
|
+
TREE_BASE="$TMP/tree-base"
|
|
300
|
+
rm -rf "$TREE_BASE"; mkdir -p "$TREE_BASE/extension"
|
|
301
|
+
cp -a "$SKILL_DIR/scripts" "$TREE_BASE/scripts"
|
|
302
|
+
cp "$NOTIFY_EXT" "$TREE_BASE/extension/team-notify.ts"
|
|
303
|
+
flip_tree() { # <tag> → 建一棵 scratch 树并打印树里的 team-notify.ts
|
|
304
|
+
# 注意:`local a="$1" b="$MUT/$a"` 在 bash 5.3 + set -u 下会把 $a 判成 unbound(实测)—— 分开写。
|
|
305
|
+
local tag="$1"
|
|
306
|
+
local dst="$MUT/$tag"
|
|
307
|
+
rm -rf "$dst"; mkdir -p "$dst"
|
|
308
|
+
cp -a "$TREE_BASE/." "$dst/"
|
|
309
|
+
printf '%s\n' "$dst/extension/team-notify.ts"
|
|
310
|
+
}
|
|
311
|
+
flip_tree_sed() { # <tag> <树内相对路径> <sed 表达式> → 打印变异后的文件
|
|
312
|
+
local tag="$1" rel="$2" expr="$3"
|
|
313
|
+
local f="$MUT/$tag/$rel"
|
|
314
|
+
sed -i "$expr" "$f"
|
|
315
|
+
printf '%s\n' "$f"
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
# ⑦ 去掉键比较(任何非空键都并进尾行)→ 跨类/跨 awaiting 不再新起一行
|
|
319
|
+
M7="$(flip_tree merge-nokey)"
|
|
320
|
+
F7="$(flip_tree_sed merge-nokey scripts/lib/cmd-agents.sh 's#$(team_notify_line_key "$tail_line" 2>/dev/null || true)#$key#')"
|
|
321
|
+
flip_premise merge-nokey "$F7" '&& [ "$key" = "$key" ]; then' has
|
|
322
|
+
run_harness flip-merge-nokey merge "$BG_EXT" "$M7"
|
|
323
|
+
expect_red flip-merge-nokey "merge: a state-class change starts a new line" "$TMP/h-flip-green-notify.log"
|
|
324
|
+
expect_red flip-merge-nokey "merge: a different task or awaiting set starts a new line" "$TMP/h-flip-green-notify.log"
|
|
325
|
+
|
|
326
|
+
# ⑧ 跨类合并(键里的状态类固定成 delivered)→ 只有类变、awaiting 相同的两条不再新起一行
|
|
327
|
+
# (用例「同类不同 awaiting」对类分量不敏感:那个用例里 awaiting 也在变,所以只钉住这一类用例)
|
|
328
|
+
M8="$(flip_tree merge-crossclass)"
|
|
329
|
+
F8="$(flip_tree_sed merge-crossclass scripts/lib/cmd-agents.sh 's#"$seat" "$class" "$t" "$nrm"#"$seat" delivered "$t" "$nrm"#')"
|
|
330
|
+
flip_premise merge-crossclass "$F8" '"$seat" delivered "$t" "$nrm"' has
|
|
331
|
+
run_harness flip-merge-crossclass merge "$BG_EXT" "$M8"
|
|
332
|
+
expect_red flip-merge-crossclass "merge: a class change with the same awaiting set starts a new line" "$TMP/h-flip-green-notify.log"
|
|
333
|
+
|
|
334
|
+
# ⑨ 取第一条的值(汇总行拿旧尾行而不是新事件)→ 最后一条的 uncommitted/tip/last 全错
|
|
335
|
+
M9="$(flip_tree merge-first)"
|
|
336
|
+
F9="$(flip_tree_sed merge-first scripts/lib/cmd-agents.sh 's#team_notify_line_merge "$newcontent"#team_notify_line_merge "$tail_line"#')"
|
|
337
|
+
flip_premise merge-first "$F9" 'team_notify_line_merge "$tail_line"' has
|
|
338
|
+
run_harness flip-merge-first merge "$BG_EXT" "$M9"
|
|
339
|
+
expect_red flip-merge-first "merge: the merged line carries the last event’s values" "$TMP/h-flip-green-notify.log"
|
|
340
|
+
|
|
341
|
+
# ⑩ 穿行重写(锚不再只认尾行,改成文件里最后一条 auto 行)→ 夹在中间的手工通知被吞掉
|
|
342
|
+
M10="$(flip_tree merge-scan)"
|
|
343
|
+
F10="$(flip_tree_sed merge-scan scripts/lib/cmd-agents.sh 's#tail_line="$(tail -n 1 "$file")"#tail_line="$(grep '\''^- .*auto'\'' "$file" | tail -n 1)"#')"
|
|
344
|
+
flip_premise merge-scan "$F10" 'grep '\''^- .*auto'\'' "$file" | tail -n 1' has
|
|
345
|
+
run_harness flip-merge-scan merge "$BG_EXT" "$M10"
|
|
346
|
+
expect_red flip-merge-scan "merge: a notice appended between two events ends the run untouched" "$TMP/h-flip-green-notify.log"
|
|
347
|
+
|
|
348
|
+
# ⑪ 删明细落盘(事件不再进 state/notify.log)→ ×N 与记录数不一致
|
|
349
|
+
M11="$(flip_tree detail-nowrite)"
|
|
350
|
+
F11="$(flip_tree_sed detail-nowrite scripts/lib/cmd-agents.sh 's#if ! team_notify_detail_append "$content" "$detail"; then#if ! true; then#')"
|
|
351
|
+
flip_premise detail-nowrite "$F11" 'if ! true; then' has
|
|
352
|
+
run_harness flip-detail-nowrite detail "$BG_EXT" "$M11"
|
|
353
|
+
expect_red flip-detail-nowrite "detail: a run’s count and its records agree" "$TMP/h-flip-green-notify.log"
|
|
354
|
+
|
|
355
|
+
# ⑫ 越界不轮转 → 轮转头/上一代不再出现,上界断言失败
|
|
356
|
+
M12="$(flip_tree detail-norotate)"
|
|
357
|
+
F12="$(flip_tree_sed detail-norotate scripts/lib/cmd-agents.sh 's#\[ "$count" -ge "$max" \]#[ 1 -eq 0 ]#')"
|
|
358
|
+
flip_premise detail-norotate "$F12" '[ 1 -eq 0 ]' has
|
|
359
|
+
run_harness flip-detail-norotate detail "$BG_EXT" "$M12"
|
|
360
|
+
expect_red flip-detail-norotate "detail: a rotated generation names where the older events went" "$TMP/h-flip-green-notify.log"
|
|
361
|
+
|
|
362
|
+
# ⑬ `--detail` 静默空输出(读了但不打印、永远退出 0)→ 缺口不再点名
|
|
363
|
+
# ⚠ sed 的**替换串**里 `&` = 整个匹配 —— 这个破坏要写 `2>\&1`,否则替换出来的行变成
|
|
364
|
+
# `2>team_inbox_detail "$a"`(把工作树里凭空写一个同名空文件、还改了 rc 语义),P251 实测过。
|
|
365
|
+
M13="$(flip_tree detail-silent)"
|
|
366
|
+
F13="$(flip_tree_sed detail-silent scripts/lib/cmd-status.sh 's#team_inbox_detail "$a" || rc=1#team_inbox_detail "$a" >/dev/null 2>\&1 || true#')"
|
|
367
|
+
flip_premise detail-silent "$F13" 'team_inbox_detail "$a" >/dev/null 2>&1 || true' has
|
|
368
|
+
run_harness flip-detail-silent detail "$BG_EXT" "$M13"
|
|
369
|
+
expect_red flip-detail-silent "detail: a missing record is named, not silent" "$TMP/h-flip-green-notify.log"
|
|
370
|
+
|
|
371
|
+
# ⑭ `--detail` 会 ack(读面变成写面)→ 未读数被默默清掉
|
|
372
|
+
M14="$(flip_tree detail-acks)"
|
|
373
|
+
F14="$(flip_tree_sed detail-acks scripts/lib/cmd-status.sh 's#team_inbox_detail "$a" || rc=1#team_inbox_ack_set "$a" "$(team_inbox_total "$a")"; team_inbox_detail "$a" || rc=1#')"
|
|
374
|
+
flip_premise detail-acks "$F14" 'team_inbox_ack_set "$a" "$(team_inbox_total "$a")"; team_inbox_detail' has
|
|
375
|
+
run_harness flip-detail-acks detail "$BG_EXT" "$M14"
|
|
376
|
+
expect_red flip-detail-acks "detail: detail reading does not acknowledge" "$TMP/h-flip-green-notify.log"
|
|
377
|
+
|
|
378
|
+
# ⑮ 每 settle 都入队 knock(扩展既有 run 也叫醒)→ 计数抖动不再安静
|
|
379
|
+
# 钉住它的是「each new line wakes exactly once」(k 在两次合并后必须仍是 1),不是后面的 churn 用例
|
|
380
|
+
# —— harness 在首个失败用例就退出,后面的用例不会出现。
|
|
381
|
+
M15="$(flip_tree wake-persettle)"
|
|
382
|
+
F15="$(flip_tree_sed wake-persettle extension/team-notify.ts 's#if (writeState !== '\''new'\'') {#if (false) {#')"
|
|
383
|
+
flip_premise wake-persettle "$F15" 'if (false) {' has
|
|
384
|
+
run_harness flip-wake-persettle wake "$BG_EXT" "$M15"
|
|
385
|
+
expect_red flip-wake-persettle "wake: a merged settle does not wake again" "$TMP/h-flip-green-notify.log"
|
|
386
|
+
|
|
387
|
+
# ⑯ 用摘要文本当 knock 去重键 → 文本逐字相同的两条不同行互吞
|
|
388
|
+
M16="$(flip_tree wake-summarykey)"
|
|
389
|
+
F16="$(flip_tree_sed wake-summarykey extension/team-notify.ts 's#const lineIdentity = .*#const lineIdentity = `line|${agent}|${summary}`#')"
|
|
390
|
+
flip_premise wake-summarykey "$F16" 'const lineIdentity = `line|${agent}|${summary}`' has
|
|
391
|
+
run_harness flip-wake-summarykey wake "$BG_EXT" "$M16"
|
|
392
|
+
expect_red flip-wake-summarykey "wake: two text-identical lines are not conflated" "$TMP/h-flip-green-notify.log"
|
|
393
|
+
|
|
394
|
+
# ⑰ 写失败仍叫醒(catch 里伪装成成功)→ 敲门声称有一行、行却不在
|
|
395
|
+
M17="$(flip_tree wake-writefail)"
|
|
396
|
+
F17="$(flip_tree_sed wake-writefail extension/team-notify.ts 's#^ writeOut = ..$# writeOut = "state=new\\nfirst=-\\nkey=-\\n"#')"
|
|
397
|
+
flip_premise wake-writefail "$F17" 'writeOut = "state=new\nfirst=-\nkey=-\n"' has
|
|
398
|
+
run_harness flip-wake-writefail wake "$BG_EXT" "$M17"
|
|
399
|
+
expect_red flip-wake-writefail "wake: a failed inbox write does not wake" "$TMP/h-flip-green-notify.log"
|
|
400
|
+
|
|
401
|
+
# ⑱ 把「挂起也敲门」加回去(去掉挂起守卫)→ 挂起不再安静(用户裁定 2026-10-14)
|
|
402
|
+
# 注意:sed 替换串里的 `&&` 要写成 `\&\&`(裸 `&` 会展开成整个匹配,实测踩过)。
|
|
403
|
+
M18="$(flip_tree wake-suspended)"
|
|
404
|
+
F18="$(flip_tree_sed wake-suspended extension/team-notify.ts 's#if (suspended) {#if (suspended \&\& false) {#')"
|
|
405
|
+
flip_premise wake-suspended "$F18" 'if (suspended && false) {' has
|
|
406
|
+
run_harness flip-wake-suspended wake "$BG_EXT" "$M18"
|
|
407
|
+
expect_red flip-wake-suspended "wake: a suspended line never wakes" "$TMP/h-flip-green-notify.log"
|
|
408
|
+
|
|
267
409
|
# 还原后绿:pristine 树重跑一遍(上面所有破坏都只写 scratch 副本)
|
|
268
410
|
section "flip · 还原后绿(pristine 树重跑)"
|
|
269
411
|
run_harness flip-restored wording
|
|
270
412
|
report_group flip-restored
|
|
413
|
+
# P251:写入面也要有一个**破坏轮之后**的 pristine 重跑 —— 只有这样才能说「破坏 → 红 → 还原 → 绿」
|
|
414
|
+
# 四步完整(前面的 flip-green-notify 是破坏**前**的基线,不能替它)。
|
|
415
|
+
run_harness flip-restored-notify merge,detail,wake
|
|
416
|
+
report_group flip-restored-notify
|
|
417
|
+
# 破坏只写 scratch 副本:真实工作树在整轮破坏之后必须仍然干净(误伤源码会在这里现形)。
|
|
418
|
+
FLIP_REPO_ROOT="$(git -C "$SKILL_DIR/../.." rev-parse --show-toplevel 2>/dev/null || true)"
|
|
419
|
+
if [ -z "$FLIP_REPO_ROOT" ]; then
|
|
420
|
+
note "flip · 真实工作树检查跳过:$SKILL_DIR 不在 git 工作树里(安装形态)"
|
|
421
|
+
else
|
|
422
|
+
FLIP_TREE_DIRTY="$(git -C "$FLIP_REPO_ROOT" status --porcelain --untracked-files=all 2>/dev/null || echo '?')"
|
|
423
|
+
if [ -z "$FLIP_TREE_DIRTY" ]; then
|
|
424
|
+
ok "flip · 破坏轮之后真实工作树仍然干净($FLIP_REPO_ROOT:git status --porcelain -uall 为空)"
|
|
425
|
+
else
|
|
426
|
+
bad "flip · 破坏轮把真实工作树弄脏了:$(printf '%s' "$FLIP_TREE_DIRTY" | head -3 | tr '\n' ' ')"
|
|
427
|
+
fi
|
|
428
|
+
fi
|
|
271
429
|
fi
|
|
272
430
|
|
|
273
431
|
# ── 反向守卫:真项目 state/inbox 未动 ────────────────────────────────────────────────────
|
|
@@ -35,8 +35,10 @@ SEL="$SKILL_DIR/tests/section-select.sh"
|
|
|
35
35
|
CINV="$SKILL_DIR/tests/coverage-inventory.sh"
|
|
36
36
|
# shellcheck source=tests/lib/checkout-shape.sh
|
|
37
37
|
. "$SKILL_DIR/tests/lib/checkout-shape.sh"
|
|
38
|
+
# P309:临时根走 product 的解析器(唯一实现),不自己写 ${TMPDIR:-/tmp}
|
|
39
|
+
. "$SKILL_DIR/tests/lib/tmp-root.sh"
|
|
38
40
|
|
|
39
|
-
T="$
|
|
41
|
+
T="$(team_tmp_root)/.teamsmith-p148-shape-probe.$$"
|
|
40
42
|
rm -rf "$T"; mkdir -p "$T"
|
|
41
43
|
trap '[ "${P148_SHAPE_KEEP:-0}" = "1" ] || rm -rf "$T"' EXIT
|
|
42
44
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# TEAM_CONFIG_KEEP=1 bash ... # keep the fixture directory
|
|
7
7
|
# TEAM_CONFIG_TREE=<tree> bash ... # run against another checkout (used by flip)
|
|
8
8
|
#
|
|
9
|
-
# Sections: list groups writer inject cas validate audit models shape flip-shape model-window flip-model-window seats completeness docs callers flip groups-flip json
|
|
9
|
+
# Sections: list groups writer inject cas validate seam audit models shape flip-shape model-window flip-model-window seats completeness docs callers flip groups-flip json
|
|
10
10
|
# Exit: 0 every selected section green, 1 at least one assertion failed, 3 setup failure.
|
|
11
11
|
#
|
|
12
12
|
# Nothing here touches the caller's project: every fixture is a fresh git repo under $TMPDIR, the
|
|
@@ -109,7 +109,7 @@ need_python() { command -v python3 >/dev/null 2>&1; }
|
|
|
109
109
|
need_python || { printf 'config-cli: 需要 python3(JSON 断言)\n' >&2; exit 3; }
|
|
110
110
|
|
|
111
111
|
SECTIONS=("$@")
|
|
112
|
-
[ "${#SECTIONS[@]}" -gt 0 ] || SECTIONS=(list groups writer inject cas validate audit roster models shape flip-shape model-window flip-model-window seats completeness docs callers flip groups-flip json)
|
|
112
|
+
[ "${#SECTIONS[@]}" -gt 0 ] || SECTIONS=(list groups writer inject cas validate seam audit roster models shape flip-shape model-window flip-model-window seats completeness docs callers flip groups-flip json)
|
|
113
113
|
want() { local s; for s in "${SECTIONS[@]}"; do [ "$s" = "$1" ] && return 0; done; return 1; }
|
|
114
114
|
|
|
115
115
|
# ---------------------------------------------------------------- list
|
|
@@ -363,8 +363,14 @@ if want validate; then
|
|
|
363
363
|
assert_eq "所有被拒的尝试都没改契约" "$(sha_of "$cfg")" "$sha_b"
|
|
364
364
|
err="$(run_in "$p" config set TEAM_MONITOR_UI colour --yes)"
|
|
365
365
|
case "$err" in *auto*tui*text*) ok "枚举报错点名接受域(auto|tui|text)" ;; *) bad "枚举报错没点名接受域($err)" ;; esac
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
# P278/O7:拒绝语是行为合同(退出码 + 文件路线 + 契约不动),不是「只读键」这类行话
|
|
367
|
+
err="$(run_in "$p" config set TEAM_PROJECT x --yes)"; rc=$?
|
|
368
|
+
assert_eq "refuse:TEAM_PROJECT 的退出码是 5" "$rc" "5"
|
|
369
|
+
case "$err" in *".pi/team/config.sh"*) ok "refuse 的报错点名项目配置文件 .pi/team/config.sh" ;;
|
|
370
|
+
*) bad "refuse 的报错没给文件路线($err)" ;; esac
|
|
371
|
+
case "$err" in *"只读"*|*"控制台"*) bad "refuse 的报错还在用行话($err)" ;;
|
|
372
|
+
*) ok "refuse 的报错不含「只读/控制台」行话" ;; esac
|
|
373
|
+
assert_eq "refuse 被拒之后契约逐字节未变" "$(sha_of "$cfg")" "$sha_b"
|
|
368
374
|
# danger 的显式旗标真的能写
|
|
369
375
|
run_in "$p" config set TEAM_MIN_FREE_SWAP_MB 0 --yes --allow-danger >/dev/null; rc=$?
|
|
370
376
|
assert_eq "danger + --allow-danger → 0 并写入" "$rc" "0"
|
|
@@ -383,6 +389,141 @@ if want validate; then
|
|
|
383
389
|
out="$(run_in "$none" config set TEAM_GATES x --yes)"; rc=$?
|
|
384
390
|
[ "$rc" -ne 0 ] && ok "无契约时 set 非 0(rc=$rc)" || bad "无契约时 set 居然成功"
|
|
385
391
|
case "$out" in *"team init"*) ok "无契约时 set 的报错点名 team init" ;; *) bad "报错没点名 team init($out)" ;; esac
|
|
392
|
+
# P278/O7 红侧:scratch 树里把 refuse 分支改成放行 → validate 段红并点名 TEAM_PROJECT;还原 → 绿
|
|
393
|
+
if [ -n "$_tree_arg" ]; then
|
|
394
|
+
skip "P278 红侧:本次已是 scratch 树再入运行(TEAM_CONFIG_TREE 已设),不重复嵌套"
|
|
395
|
+
else
|
|
396
|
+
rtree="$tmp/refuse-tree"; mkdir -p "$rtree/skills/teamsmith"
|
|
397
|
+
cp -a "$skill/scripts" "$skill/templates" "$skill/references" "$rtree/skills/teamsmith/"
|
|
398
|
+
rcc="$rtree/skills/teamsmith/scripts/lib/cmd-config.sh"
|
|
399
|
+
set +e
|
|
400
|
+
TEAM_CONFIG_TREE="$rtree" bash "$here/config-cli.sh" validate > "$tmp/refuse-flip-green0.log" 2>&1
|
|
401
|
+
r_rc0=$?
|
|
402
|
+
[ "$r_rc0" -eq 0 ] && ok "P278 红侧前置:scratch 树原状 validate 段绿(rc=0)" \
|
|
403
|
+
|| { bad "P278 红侧前置:scratch 树原状就红了(rc=$r_rc0,翻转无效)"; grep -a '✗' "$tmp/refuse-flip-green0.log" | head -3 | sed 's/^/ /'; }
|
|
404
|
+
python3 - "$rcc" <<'MUTPY'
|
|
405
|
+
import sys
|
|
406
|
+
p = sys.argv[1]
|
|
407
|
+
s = open(p, encoding="utf-8").read()
|
|
408
|
+
old = """ if [ "$class" = "refuse" ]; then
|
|
409
|
+
team_err "$key 不能由命令改"
|
|
410
|
+
team_dim " $(team_config_field "$row" 8)" >&2
|
|
411
|
+
[ "$dry" = "1" ] || team_config_audit_write refused "$actor" "$key" "$old" "$val" || true
|
|
412
|
+
return "$TEAM_CONFIG_EXIT_REFUSE"
|
|
413
|
+
fi"""
|
|
414
|
+
assert old in s, "the refuse branch was not found"
|
|
415
|
+
open(p, "w", encoding="utf-8").write(s.replace(old, " # MUTANT: the refuse class is let through", 1))
|
|
416
|
+
MUTPY
|
|
417
|
+
if grep -q 'MUTANT: the refuse class is let through' "$rcc"; then
|
|
418
|
+
ok "P278 mutant:refuse 分支被删掉(放行)"
|
|
419
|
+
else
|
|
420
|
+
bad "P278 mutant 没打中(refuse 分支还在)"
|
|
421
|
+
fi
|
|
422
|
+
TEAM_CONFIG_TREE="$rtree" bash "$here/config-cli.sh" validate > "$tmp/refuse-flip-red.log" 2>&1
|
|
423
|
+
r_rc_red=$?
|
|
424
|
+
if [ "$r_rc_red" -ne 0 ] && grep -q '✗.*TEAM_PROJECT' "$tmp/refuse-flip-red.log"; then
|
|
425
|
+
ok "P278 红侧:refuse 放行 → validate 段非 0(rc=$r_rc_red)并点名 TEAM_PROJECT"
|
|
426
|
+
else
|
|
427
|
+
bad "P278 红侧:放行后没有点名 TEAM_PROJECT(rc=$r_rc_red)"
|
|
428
|
+
grep -a '✗' "$tmp/refuse-flip-red.log" | head -3 | sed 's/^/ /'
|
|
429
|
+
fi
|
|
430
|
+
printf ' --- P278 红侧尾部 ---\n'
|
|
431
|
+
{ grep -aE '✗.*TEAM_PROJECT|== 结果' "$tmp/refuse-flip-red.log" || true; } | tail -4 | sed 's/^/ /'
|
|
432
|
+
cp -a "$cmd_config" "$rcc"
|
|
433
|
+
TEAM_CONFIG_TREE="$rtree" bash "$here/config-cli.sh" validate > "$tmp/refuse-flip-restored.log" 2>&1
|
|
434
|
+
r_rc_rest=$?
|
|
435
|
+
[ "$r_rc_rest" -eq 0 ] && ok "P278 还原:refuse 分支回来 → validate 段重新绿(rc=0)" \
|
|
436
|
+
|| { bad "还原后没有变绿(rc=$r_rc_rest)"; grep -a '✗' "$tmp/refuse-flip-restored.log" | head -3 | sed 's/^/ /'; }
|
|
437
|
+
set +e
|
|
438
|
+
fi
|
|
439
|
+
fi
|
|
440
|
+
|
|
441
|
+
# ---------------------------------------------------------------- seam(P266 · panel-plain-language)
|
|
442
|
+
# 两个由 schema 自由文本列携带的**声明**(判的是标记在不在,属逻辑;D170):
|
|
443
|
+
# ① 只给夹具用的四个键以 `fixture-only: ` 开头 —— 读面照旧报告,面板据此隐藏那一行(panel 夹具对照)。
|
|
444
|
+
# ② 四个 agent 适配器键(内部预留接缝)的备注非空 —— 面板把它画在行下,位置就是这一列。
|
|
445
|
+
# 红侧:scratch 树里把 TEAM_AGENT_CMD 的备注拿掉(标记丢了)→ 本段非 0 并点名该键;还原 → 绿。
|
|
446
|
+
if want seam; then
|
|
447
|
+
section "seam · fixture-only 声明标记 / 适配器备注的位置(P266)"
|
|
448
|
+
p="$(new_proj seam)" || exit 3
|
|
449
|
+
cfg="$p/.pi/team/config.sh"
|
|
450
|
+
json="$(run_in "$p" config list --json)"
|
|
451
|
+
# ① 声明标记:四条记录的 route 原样带前缀,class 不变(kind/default 不在标记的范围内动)
|
|
452
|
+
missing="$(printf '%s' "$json" | python3 -c '
|
|
453
|
+
import json, sys
|
|
454
|
+
d = json.load(sys.stdin)
|
|
455
|
+
by = {k["name"]: k for k in d["keys"]}
|
|
456
|
+
need = [n for n in ("TEAM_DISK_STATS_FILE", "TEAM_SMOKE_FAST", "TEAM_INBOX_WATCH_FORCE_FAIL", "TEAM_IW_REQUIRE_WATCH") if not str(by.get(n, {}).get("route", "")).startswith("fixture-only: ") or by.get(n, {}).get("class") != "refuse"]
|
|
457
|
+
print(",".join(need))
|
|
458
|
+
')"
|
|
459
|
+
[ -z "$missing" ] && ok "四个夹具键都是 refuse 且 route 以 fixture-only: 开头(声明标记是数据)" \
|
|
460
|
+
|| bad "P266:夹具键丢了声明标记或改了类:[ $missing ]"
|
|
461
|
+
# ② 适配器键的备注位置:仍是 apply、备注非空
|
|
462
|
+
missing="$(printf '%s' "$json" | python3 -c '
|
|
463
|
+
import json, sys
|
|
464
|
+
d = json.load(sys.stdin)
|
|
465
|
+
by = {k["name"]: k for k in d["keys"]}
|
|
466
|
+
need = [n for n in ("TEAM_AGENT_CMD", "TEAM_AGENT_NOTIFY_CMD", "TEAM_AGENT_LOG_GLOB", "TEAM_AGENT_BIN") if by.get(n, {}).get("class") != "apply" or not str(by.get(n, {}).get("route", "")).strip()]
|
|
467
|
+
print(",".join(need))
|
|
468
|
+
')"
|
|
469
|
+
[ -z "$missing" ] && ok "四个适配器键仍是 apply 且备注非空(标记住在自由文本列里)" \
|
|
470
|
+
|| bad "P266:适配器键的标记丢了:[ $missing ]"
|
|
471
|
+
# 读面 / 人读表 / 写面一字不变(加法不碰这三处)
|
|
472
|
+
human="$(run_in "$p" config list)"
|
|
473
|
+
case "$human" in *"KEY"*"CLASS"*"KIND"*"VALUE"*) ok "人读表表头仍是 KEY CLASS KIND VALUE" ;; *) bad "人读表表头变了" ;; esac
|
|
474
|
+
case "$human" in *TEAM_DISK_STATS_FILE*) ok "人读表仍列出夹具键" ;; *) bad "人读表漏了夹具键" ;; esac
|
|
475
|
+
case "$human" in *TEAM_AGENT_CMD*) ok "人读表仍列出适配器键" ;; *) bad "人读表漏了适配器键" ;; esac
|
|
476
|
+
sha0="$(sha_of "$cfg")"
|
|
477
|
+
run_in "$p" config set TEAM_DISK_STATS_FILE /tmp/x --yes >/dev/null 2>&1; rc=$?
|
|
478
|
+
assert_eq "夹具键仍是 refuse(exit 5)" "$rc" "5"
|
|
479
|
+
assert_eq "refuse 写不动契约" "$(sha_of "$cfg")" "$sha0"
|
|
480
|
+
run_in "$p" config set TEAM_AGENT_CMD 'myagent {prompt}' --yes >/dev/null 2>&1; rc=$?
|
|
481
|
+
assert_eq "适配器键仍可写(exit 0,类没有变成 refuse)" "$rc" "0"
|
|
482
|
+
# 红侧:scratch 树里把 TEAM_AGENT_CMD 的备注拿掉(标记丢了)→ 段红并点名;还原 → 绿
|
|
483
|
+
if [ -n "$_tree_arg" ]; then
|
|
484
|
+
skip "P266 红侧:本次已是 scratch 树再入运行(TEAM_CONFIG_TREE 已设),不重复嵌套"
|
|
485
|
+
else
|
|
486
|
+
stree="$tmp/seam-tree"; mkdir -p "$stree/skills/teamsmith"
|
|
487
|
+
cp -a "$skill/scripts" "$skill/templates" "$skill/references" "$stree/skills/teamsmith/"
|
|
488
|
+
scc="$stree/skills/teamsmith/scripts/lib/cmd-config.sh"
|
|
489
|
+
set +e
|
|
490
|
+
TEAM_CONFIG_TREE="$stree" bash "$here/config-cli.sh" seam > "$tmp/seam-flip-green0.log" 2>&1
|
|
491
|
+
s_rc0=$?
|
|
492
|
+
[ "$s_rc0" -eq 0 ] && ok "P266 红侧前置:scratch 树原状 seam 段绿(rc=0,红不是因为缺文件)" \
|
|
493
|
+
|| { bad "P266 红侧前置:scratch 树原状就红了(rc=$s_rc0,翻转无效)"; grep -a '✗' "$tmp/seam-flip-green0.log" | head -3 | sed 's/^/ /'; }
|
|
494
|
+
python3 - "$scc" <<'PY'
|
|
495
|
+
import sys
|
|
496
|
+
p = sys.argv[1]
|
|
497
|
+
s = open(p, encoding='utf-8').read()
|
|
498
|
+
rows = [l for l in s.split('\n') if l.startswith('TEAM_AGENT_CMD|')]
|
|
499
|
+
assert len(rows) == 1, 'TEAM_AGENT_CMD schema row not found'
|
|
500
|
+
note = '|预留:为以后可能更换的 agent 适配器保留,不是受支持的扩展方式,也不承诺兼容;新项目初始化时不问'
|
|
501
|
+
assert note in rows[0], 'TEAM_AGENT_CMD row carries no reservation note'
|
|
502
|
+
s = s.replace(rows[0], rows[0].replace(note, '|'), 1)
|
|
503
|
+
open(p, 'w', encoding='utf-8').write(s)
|
|
504
|
+
PY
|
|
505
|
+
if grep -q '^TEAM_AGENT_CMD|apply|tpl|launch|plain||-|||roster$' "$scc"; then
|
|
506
|
+
ok "P266 mutant:TEAM_AGENT_CMD 的预留说明被拿掉(标记丢了)"
|
|
507
|
+
else
|
|
508
|
+
bad "P266 mutant 没打中(备注原样)"
|
|
509
|
+
fi
|
|
510
|
+
TEAM_CONFIG_TREE="$stree" bash "$here/config-cli.sh" seam > "$tmp/seam-flip-red.log" 2>&1
|
|
511
|
+
s_rc_red=$?
|
|
512
|
+
if [ "$s_rc_red" -ne 0 ] && grep -q '✗.*TEAM_AGENT_CMD' "$tmp/seam-flip-red.log"; then
|
|
513
|
+
ok "P266 红侧:丢掉标记 → seam 段非 0(rc=$s_rc_red)并点名 TEAM_AGENT_CMD"
|
|
514
|
+
else
|
|
515
|
+
bad "P266 红侧:丢掉标记后没有点名 TEAM_AGENT_CMD(rc=$s_rc_red)"
|
|
516
|
+
grep -a '✗' "$tmp/seam-flip-red.log" | head -3 | sed 's/^/ /'
|
|
517
|
+
fi
|
|
518
|
+
printf ' --- P266 红侧尾部 ---\n'
|
|
519
|
+
{ grep -aE '✗.*TEAM_AGENT_CMD|== 结果' "$tmp/seam-flip-red.log" || true; } | tail -4 | sed 's/^/ /'
|
|
520
|
+
cp -a "$cmd_config" "$scc"
|
|
521
|
+
TEAM_CONFIG_TREE="$stree" bash "$here/config-cli.sh" seam > "$tmp/seam-flip-restored.log" 2>&1
|
|
522
|
+
s_rc_rest=$?
|
|
523
|
+
[ "$s_rc_rest" -eq 0 ] && ok "P266 还原:标记加回 → seam 段重新绿(rc=0)" \
|
|
524
|
+
|| { bad "还原后没有变绿(rc=$s_rc_rest)"; grep -a '✗' "$tmp/seam-flip-restored.log" | head -3 | sed 's/^/ /'; }
|
|
525
|
+
set +e
|
|
526
|
+
fi
|
|
386
527
|
fi
|
|
387
528
|
|
|
388
529
|
# ---------------------------------------------------------------- audit
|
|
@@ -481,17 +622,22 @@ if want roster; then
|
|
|
481
622
|
|| bad "③ 工作树步骤不一致(register=[$w1] flagless=[$w2])"
|
|
482
623
|
sha_r="$(sha_of "$cfg")"; n_r="$(grep -c 'result=' "$log" || true)"
|
|
483
624
|
|
|
484
|
-
# help 的两行(R2 的打印面):--register 必须出现在 add-agent/teardown
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
625
|
+
# help 的两行(R2 的打印面):--register 必须出现在 add-agent/teardown 的用法行上。
|
|
626
|
+
# 帮助面自 P260 起分三级(入口菜单只列新手上手的几条):这两行去各自的命令页读,判定的是
|
|
627
|
+
# 「该命令的用法行上有这些旗标」,与占位符写法(`<a>` / `a`)无关。
|
|
628
|
+
help_add="$(run_in "$p" help add-agent)"
|
|
629
|
+
help_td="$(run_in "$p" help teardown)"
|
|
630
|
+
line_add="$(printf '%s\n' "$help_add" | grep -m1 '^ add-agent ' || true)"
|
|
631
|
+
line_td="$(printf '%s\n' "$help_td" | grep -m1 '^ teardown ' || true)"
|
|
632
|
+
case "$line_add" in
|
|
633
|
+
*'--register'*'--create'*'--no-install'*'--print'*)
|
|
634
|
+
ok "③ help add-agent 页的用法行打印 --register/--create/--no-install/--print(--model 已退休)" ;;
|
|
635
|
+
*) bad "③ help add-agent 页的用法行没打印齐旗标($line_add)" ;;
|
|
490
636
|
esac
|
|
491
|
-
case "$
|
|
492
|
-
*'teardown
|
|
493
|
-
ok "③ help
|
|
494
|
-
*) bad "③ help
|
|
637
|
+
case "$line_td" in
|
|
638
|
+
*'teardown'*'--register'*)
|
|
639
|
+
ok "③ help teardown 页的用法行打印 --register" ;;
|
|
640
|
+
*) bad "③ help teardown 页的用法行没打印 --register($line_td)" ;;
|
|
495
641
|
esac
|
|
496
642
|
|
|
497
643
|
# ④ 已在名册 + --register:可见 no-op(0、不写、不审计)
|
|
@@ -27,7 +27,13 @@ printf '%s\n' "$MARK" > "$L/dev-events.jsonl"
|
|
|
27
27
|
printf '%s\n' "$MARK" > "$L/pm-events.jsonl"
|
|
28
28
|
printf '%s\n' "$MARK" > "$L/requests.jsonl"
|
|
29
29
|
printf 'P163 case=%s run=%s mode=%s runtime=%s\n' "$CASE" "$RUN_ID" "${P163_MODE:-unknown}" "${P163_PI_VERSION:-unknown}" > "$L/run-start.txt"
|
|
30
|
-
|
|
30
|
+
P138_SKILL_DIR="${P138_SKILL:-/src/skills/teamsmith}"
|
|
31
|
+
# P287:ns(临时根名字里的项目命名空间)的唯一实现在被测树的 scripts/lib/common.sh
|
|
32
|
+
if ! declare -F team_project_ns >/dev/null 2>&1; then
|
|
33
|
+
[ -f "$P138_SKILL_DIR/scripts/lib/common.sh" ] && . "$P138_SKILL_DIR/scripts/lib/common.sh"
|
|
34
|
+
fi
|
|
35
|
+
team_tmp_root_prepare >/dev/null 2>&1 || true
|
|
36
|
+
R=$(mktemp -d "$(team_tmp_root)/teamsmith-p163-real-$(team_project_ns 2>/dev/null || printf 'nosig-00000000').XXXXXX"); mkdir -p "$R/sock" "$R/home" "$R/agentdir" "$R/bin"
|
|
31
37
|
export HOME="$R/home" PI_CODING_AGENT_DIR="$R/agentdir" TMUX_TMPDIR="$R/sock" TERM=xterm-256color
|
|
32
38
|
unset TMUX TMUX_PANE
|
|
33
39
|
for k in ${!TEAM_@}; do unset "$k"; done
|
|
@@ -26,7 +26,8 @@ line_red() { note " ✗ $*"; }
|
|
|
26
26
|
|
|
27
27
|
# M28 隔离(lint 规则 D 的诚实满足,与 smoke.sh:241 同款):本文件的全部 tmux 调用都打私有
|
|
28
28
|
# socket 目录 —— 顶层 unset TMUX/TMUX_PANE + 顶层把 TMUX_TMPDIR 指到本进程私有目录(已建);此后不导回 TMUX。
|
|
29
|
-
|
|
29
|
+
team_tmp_root_prepare >/dev/null 2>&1 || true
|
|
30
|
+
FLIP_SOCK="$(mktemp -d "$(team_tmp_root)/teamsmith-p55-flip-sock-$(team_project_ns).XXXXXX")"
|
|
30
31
|
TMUX_TMPDIR="$FLIP_SOCK"; export TMUX_TMPDIR
|
|
31
32
|
unset TMUX TMUX_PANE
|
|
32
33
|
# P162:破坏性调用(kill-session)动手前先证明私有 socket 生效;skill 树不全(缺库)就响亮失败,
|
|
@@ -34,12 +35,19 @@ unset TMUX TMUX_PANE
|
|
|
34
35
|
# shellcheck source=../../lib/tmux-iso.sh
|
|
35
36
|
. "$FLIP_SKILL/tests/lib/tmux-iso.sh" 2>/dev/null \
|
|
36
37
|
|| { note "P162:找不到 $FLIP_SKILL/tests/lib/tmux-iso.sh(skill 树不全)"; exit 2; }
|
|
38
|
+
# P287:ns(临时根名字里的项目命名空间)的唯一实现在被测树的 scripts/lib/common.sh
|
|
39
|
+
if ! declare -F team_project_ns >/dev/null 2>&1; then
|
|
40
|
+
# shellcheck source=../../../../scripts/lib/common.sh
|
|
41
|
+
. "$FLIP_SKILL/scripts/lib/common.sh" 2>/dev/null \
|
|
42
|
+
|| { note "P287:找不到 $FLIP_SKILL/scripts/lib/common.sh(skill 树不全)"; exit 2; }
|
|
43
|
+
fi
|
|
37
44
|
|
|
38
45
|
# ---------------------------------------------------------------- 单腿:建夹具 + 跑核心断言
|
|
39
46
|
# 用法:p55_leg <leg名> <skill_dir>;结果写入 $LEG_RESULTS("OK|RED <id> <desc>" 一行一条)
|
|
40
47
|
p55_leg() { # <leg> <skill_dir>
|
|
41
48
|
local leg="$1" SK="$2"
|
|
42
|
-
|
|
49
|
+
team_tmp_root_prepare >/dev/null 2>&1 || true
|
|
50
|
+
LEG_ROOT="$(mktemp -d "$(team_tmp_root)/teamsmith-p55-flip-$(team_project_ns).XXXXXX")"
|
|
43
51
|
local T="$LEG_ROOT" REPO SESS
|
|
44
52
|
REPO="$T/repo"; SESS="p55flip-$leg-$$"
|
|
45
53
|
# 隔离:私有 socket 目录(已 mkdir;不写 TMUX_TMPDIR 指向不存在的目录 —— 那两个回退陷阱的教训)、
|
|
@@ -177,7 +185,8 @@ PY
|
|
|
177
185
|
}
|
|
178
186
|
|
|
179
187
|
# ---------------------------------------------------------------- 四条腿
|
|
180
|
-
|
|
188
|
+
team_tmp_root_prepare >/dev/null 2>&1 || true
|
|
189
|
+
OUT="$(mktemp -d "$(team_tmp_root)/teamsmith-p55-flip-out-$(team_project_ns).XXXXXX")"
|
|
181
190
|
note "P55 flip-p49(§40 翻转夹具)· 输出目录 $OUT"
|
|
182
191
|
note "被测 skill:$FLIP_SKILL"
|
|
183
192
|
|
|
@@ -199,7 +208,8 @@ else line_red "leg0:未改就有 $green_red 条红 —— 夹具或实现有
|
|
|
199
208
|
cp "$LEG_RESULTS" "$OUT/leg0-green.results"; [ "$KEEP" = "1" ] || rm -rf "$LEG_ROOT"
|
|
200
209
|
|
|
201
210
|
note "== leg1 变异:删掉留存(建窗回到旧一行)→ 期望 B1 红 =="
|
|
202
|
-
|
|
211
|
+
team_tmp_root_prepare >/dev/null 2>&1 || true
|
|
212
|
+
MUT="$(mktemp -d "$(team_tmp_root)/teamsmith-p55-flip-mut-$(team_project_ns).XXXXXX")"; cp -a "$FLIP_SKILL" "$MUT/skill"
|
|
203
213
|
mut_no_retain "$MUT/skill"
|
|
204
214
|
p55_leg no-retain "$MUT/skill"
|
|
205
215
|
if judge no-retain B1 "$LEG_RESULTS"; then line_ok "leg1:锚点 B1 如预期转红(kill 后窗口消失,遗体断言抓到)"
|
|
@@ -207,7 +217,8 @@ else line_red "leg1:锚点 B1 没有红 —— §40 的留存断言拦不住
|
|
|
207
217
|
cp "$LEG_RESULTS" "$OUT/leg1-no-retain.results"; [ "$KEEP" = "1" ] || { rm -rf "$LEG_ROOT"; rm -rf "$MUT"; }
|
|
208
218
|
|
|
209
219
|
note "== leg2 变异:say 对死 pane 按键(删掉换道分支)→ 期望 C2 红 =="
|
|
210
|
-
|
|
220
|
+
team_tmp_root_prepare >/dev/null 2>&1 || true
|
|
221
|
+
MUT="$(mktemp -d "$(team_tmp_root)/teamsmith-p55-flip-mut-$(team_project_ns).XXXXXX")"; cp -a "$FLIP_SKILL" "$MUT/skill"
|
|
211
222
|
mut_say_dead "$MUT/skill"
|
|
212
223
|
p55_leg say-dead "$MUT/skill"
|
|
213
224
|
if judge say-dead C2 "$LEG_RESULTS"; then line_ok "leg2:锚点 C2 如预期转红(输出不再点名座位已死)"
|
|
@@ -215,7 +226,8 @@ else line_red "leg2:锚点 C2 没有红 —— §40 的投递断言拦不住
|
|
|
215
226
|
cp "$LEG_RESULTS" "$OUT/leg2-say-dead.results"; [ "$KEEP" = "1" ] || { rm -rf "$LEG_ROOT"; rm -rf "$MUT"; }
|
|
216
227
|
|
|
217
228
|
note "== leg3 变异:roster 把遗体显示成「在跑」→ 期望 E1 红 =="
|
|
218
|
-
|
|
229
|
+
team_tmp_root_prepare >/dev/null 2>&1 || true
|
|
230
|
+
MUT="$(mktemp -d "$(team_tmp_root)/teamsmith-p55-flip-mut-$(team_project_ns).XXXXXX")"; cp -a "$FLIP_SKILL" "$MUT/skill"
|
|
219
231
|
mut_roster_run "$MUT/skill"
|
|
220
232
|
p55_leg roster-run "$MUT/skill"
|
|
221
233
|
if judge roster-run E1 "$LEG_RESULTS"; then line_ok "leg3:锚点 E1 如预期转红(roster 死 pane 行没了 ▲+证据)"
|
|
@@ -124,8 +124,10 @@ pre_detect() {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
# ── 外部收割机:等本轮新场景 + 26-i 锚点 → 删/移走 $TMP(bg6 的形状)────────────────────────────
|
|
127
|
-
#
|
|
128
|
-
|
|
127
|
+
# 只在「本轮的场景根」里认「开始前一秒不存在、之后出现」的那一个(并发别的 smoke 不误伤)。
|
|
128
|
+
# P287:根名从平铺 `teamsmith-smoke.<rand>` 变成 `teamsmith-smoke-<ns>.<rand>` —— 两种形状都要认
|
|
129
|
+
# (`--pre-skill` 那侧跑的是改动前的树,根仍是平铺名)。
|
|
130
|
+
scene_snapshot() { printf ' %s ' "$(ls -d /tmp/teamsmith-smoke[.-]* 2>/dev/null | tr '\n' ' ')"; }
|
|
129
131
|
reap_once() { # <场景目录> <第几次>
|
|
130
132
|
case "$REAP_VIA" in
|
|
131
133
|
mv)
|
|
@@ -139,7 +141,7 @@ reap_once() { # <场景目录> <第几次>
|
|
|
139
141
|
reaper() { # <log> <smoke-pid>;失败时把原因写进 <log> 并返回 1
|
|
140
142
|
local log="$1" pid="$2" d="" i c n=0
|
|
141
143
|
for i in $(seq 1 2400); do # ≤120s 等新场景出现
|
|
142
|
-
for c in /tmp/teamsmith-smoke
|
|
144
|
+
for c in /tmp/teamsmith-smoke[.-]*; do
|
|
143
145
|
[ -d "$c" ] || continue
|
|
144
146
|
case "$BEFORE_DIRS" in *" $c "*) continue ;; esac
|
|
145
147
|
d="$c"; break
|
|
@@ -41,7 +41,10 @@ SESS="teamsmith-flip-m37-$$"
|
|
|
41
41
|
|
|
42
42
|
# M28/#1250:夹具自己的 tmux 调用要有隔离证据(裸 tmux 按 $TMUX 打到调用者 server —— 事故形状)。
|
|
43
43
|
unset TMUX TMUX_PANE 2>/dev/null || true
|
|
44
|
-
|
|
44
|
+
# P309:socket 目录不挂临时根下(临时根名带项目 ns 后,<run>/tmux/tmux-<uid>/... 会越过 AF_UNIX 的
|
|
45
|
+
# 107 字节,隔离前置直接硬停)。基址取短的:先试解析出的临时根,放不下退平台默认(tmp-root.sh 一处实现)。
|
|
46
|
+
TMUX_TMPDIR="$(tmp_root_socket_dir tmux "tmux-$(id -u)/default")" || TMUX_TMPDIR="$TMP/tmux"
|
|
47
|
+
mkdir -p "$TMUX_TMPDIR"; export TMUX_TMPDIR
|
|
45
48
|
cleanup() {
|
|
46
49
|
[ "${BASHPID:-$$}" = "$$" ] || return 0 # 管道/命令替换的子 shell 不要重复清场
|
|
47
50
|
# P162:收尾先证明私有 socket 生效(不成立就拒绝;cleanup 里不许 exit)
|