teamsmith 0.4.6 → 0.4.7
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 +6 -6
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +24 -0
- package/skills/teamsmith/SKILL.md +32 -23
- package/skills/teamsmith/extension/team-bg.ts +5 -3
- package/skills/teamsmith/extension/team-inbox-watch.ts +14 -3
- package/skills/teamsmith/extension/team-notify.ts +20 -13
- package/skills/teamsmith/extension/team-remind.ts +189 -0
- package/skills/teamsmith/extension/team-reply.ts +4 -7
- package/skills/teamsmith/references/migration.md +101 -0
- package/skills/teamsmith/references/openspec.md +43 -27
- package/skills/teamsmith/references/protocol.md +26 -15
- package/skills/teamsmith/references/reminders.md +153 -161
- package/skills/teamsmith/references/troubleshooting.md +12 -7
- package/skills/teamsmith/references/workflows.md +84 -31
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +10 -4
- package/skills/teamsmith/scripts/lib/cmd-project.sh +88 -6
- package/skills/teamsmith/scripts/lib/cmd-remind.sh +88 -2
- package/skills/teamsmith/scripts/lib/cmd-review.sh +42 -4
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +48 -11
- package/skills/teamsmith/scripts/lib/common.sh +83 -13
- package/skills/teamsmith/scripts/panel/panel.js +179 -179
- package/skills/teamsmith/scripts/panel/src/data.ts +71 -15
- package/skills/teamsmith/scripts/panel/src/layout.ts +20 -8
- package/skills/teamsmith/scripts/panel/src/main.tsx +83 -21
- package/skills/teamsmith/scripts/remind-capability.mjs +261 -0
- package/skills/teamsmith/scripts/remind-store.mjs +55 -24
- package/skills/teamsmith/scripts/remind-tick.mjs +5 -2
- package/skills/teamsmith/scripts/reply-capture.mjs +8 -9
- package/skills/teamsmith/scripts/state-authority.mjs +72 -6
- package/skills/teamsmith/scripts/team +1 -0
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +11 -8
- package/skills/teamsmith/templates/DECISIONS.md.tmpl +2 -2
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +3 -3
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +19 -14
- package/skills/teamsmith/templates/memory-seed.md.tmpl +2 -2
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +31 -19
- package/skills/teamsmith/templates/report.md.tmpl +33 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +217 -33
- package/skills/teamsmith/tests/bg-ledger.sh +24 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +7 -6
- package/skills/teamsmith/tests/fixtures/remind-adversarial-delay.ts +27 -0
- package/skills/teamsmith/tests/fixtures/remind-tool-provider.ts +65 -0
- package/skills/teamsmith/tests/help-surface.sh +3 -5
- package/skills/teamsmith/tests/isolation-ledger.sh +6 -2
- package/skills/teamsmith/tests/key-replies-ui.sh +53 -0
- package/skills/teamsmith/tests/key-replies.sh +307 -106
- package/skills/teamsmith/tests/lib/routes-pages.sh +243 -0
- package/skills/teamsmith/tests/loop-inventory.tsv +1 -0
- package/skills/teamsmith/tests/panel-b3-stub.sh +9 -2
- package/skills/teamsmith/tests/remind-adversarial-faults.mjs +163 -0
- package/skills/teamsmith/tests/remind-adversarial-faults.sh +26 -0
- package/skills/teamsmith/tests/remind-adversarial-real.sh +27 -0
- package/skills/teamsmith/tests/remind-cli.sh +108 -3
- package/skills/teamsmith/tests/remind-delivery-node.mjs +13 -0
- package/skills/teamsmith/tests/remind-delivery.sh +123 -35
- package/skills/teamsmith/tests/remind-lifecycle.sh +197 -0
- package/skills/teamsmith/tests/remind-pulse.sh +199 -0
- package/skills/teamsmith/tests/remind-recovery-real.sh +5 -0
- package/skills/teamsmith/tests/remind-recovery-unit.sh +118 -0
- package/skills/teamsmith/tests/remind-tool-node.mjs +159 -0
- package/skills/teamsmith/tests/remind-tool-real.mjs +754 -0
- package/skills/teamsmith/tests/remind-tool-real.sh +5 -0
- package/skills/teamsmith/tests/reply-capture-real.mjs +93 -2
- package/skills/teamsmith/tests/routes.sh +213 -293
- package/skills/teamsmith/tests/section-paths.tsv +10 -8
- package/skills/teamsmith/tests/smoke.sh +484 -28
- package/skills/teamsmith/tests/state-authority.sh +152 -8
- package/skills/teamsmith-init/SKILL.md +5 -5
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
# (probes assert the EFFECT, never the exit code). The set of keys needing a probe is derived
|
|
17
17
|
# from the schema, so a note added without one is RED naming the key.
|
|
18
18
|
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
# the walk's own proof that it can fail.
|
|
19
|
+
# pages file-facing samples for the former column-zero, undeclared-usage and unread-level arms:
|
|
20
|
+
# two damaged/normal single-page renderer pairs plus menu/group/command file judgement.
|
|
21
|
+
# flips the remaining parser, schema-promise, cleanup and refusal mutations that MUST redden their
|
|
22
|
+
# guard, a control arm that must stay green, two landing-check red sides, and one unconditional
|
|
23
|
+
# non-FAST invocation of pages. They are the walk's own proof that it can fail.
|
|
24
24
|
# Every mutation must PROVE IT LANDED (target text 1→0 / new text 0→1, and the copy must
|
|
25
25
|
# differ from the pristine file byte-wise) BEFORE its verdict is judged: a silent no-op patch is
|
|
26
26
|
# reported as `变异没落地(夹具缺陷)`, never as `没有兑现` (M21). And every verdict reads the
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
# matched log as unmatched (grep -q exits first, printf takes SIGPIPE, the pipeline turns 141).
|
|
29
29
|
#
|
|
30
30
|
# Usage / knobs:
|
|
31
|
-
# bash skills/teamsmith/tests/routes.sh [walk] [control] [promises] [refusals] [flips]
|
|
31
|
+
# bash skills/teamsmith/tests/routes.sh [walk] [control] [promises] [refusals] [pages] [flips]
|
|
32
32
|
# TEAM_ROUTES_TREE=<tree> tree under test (default: this checkout; flips use scratch copies)
|
|
33
33
|
# TEAM_ROUTES_KEEP=1 keep the fixture root and print it
|
|
34
34
|
# TEAM_ROUTES_TIMEOUT=<s> per-probe timeout, default 15 (containment, never a verdict: a probe
|
|
@@ -97,13 +97,17 @@ ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; PASS=$((PASS + 1)); }
|
|
|
97
97
|
finding() { printf ' \033[31m✗\033[0m %s\n' "$1"; FIND=$((FIND + 1)); }
|
|
98
98
|
skip() { printf ' \033[33mSKIP\033[0m %s\n' "$1"; SKIP=$((SKIP + 1)); }
|
|
99
99
|
|
|
100
|
+
[ -f "$here/lib/routes-pages.sh" ] || { printf 'routes: 没有共享页面判定:%s\n' "$here/lib/routes-pages.sh" >&2; exit 3; }
|
|
101
|
+
# shellcheck source=tests/lib/routes-pages.sh
|
|
102
|
+
. "$here/lib/routes-pages.sh"
|
|
103
|
+
|
|
100
104
|
[ -f "$team" ] || { printf 'routes: 没有 CLI:%s\n' "$team" >&2; exit 3; }
|
|
101
105
|
[ -f "$perf_sh" ] || { printf 'routes: 没有 tests/perf.sh:%s\n' "$perf_sh" >&2; exit 3; }
|
|
102
106
|
TIMEOUT_BIN=""
|
|
103
107
|
command -v timeout >/dev/null 2>&1 && TIMEOUT_BIN=timeout
|
|
104
108
|
|
|
105
109
|
SECTIONS=("$@")
|
|
106
|
-
#
|
|
110
|
+
# 段集是**显式**的:给了段名就只跑给的段;不带段名跑真实走查与 flips(pages 由 flips 调用,也可显式运行)。
|
|
107
111
|
# 旧写法给任何不含 flips 的子集追加 flips —— flips 的每一臂都在 scratch 树上再跑一遍
|
|
108
112
|
# `routes.sh walk`,那个嵌套 run 又被追加 flips,于是自己生自己:实测进程链每 ~40 秒长一层、
|
|
109
113
|
# 跑 12 分钟不返回(08:08 → 08:20,32 个进程),只能人工杀。子集的边界由调用者给。
|
|
@@ -254,165 +258,6 @@ mr_known_tables() {
|
|
|
254
258
|
}
|
|
255
259
|
|
|
256
260
|
# ── Walk A: parse `team help` (awk), then probe every claim ─────────────────────────────────────────
|
|
257
|
-
mr_write_parser() {
|
|
258
|
-
cat > "$tmp/walk-a.awk" <<'AWK'
|
|
259
|
-
function fail(ln, msg) { printf "FAIL\t%d\t%s\n", ln, msg }
|
|
260
|
-
function tokenize(s, arr, offs, rest, tok, n, pos) {
|
|
261
|
-
n=0; rest=s; pos=1
|
|
262
|
-
while (match(rest, /\[[^]]*\]|[^ \t]+/)) {
|
|
263
|
-
tok=substr(rest, RSTART, RLENGTH)
|
|
264
|
-
n++; arr[n]=tok; offs[n]=pos+RSTART-1
|
|
265
|
-
pos += RSTART-1+RLENGTH; rest=substr(rest, RSTART+RLENGTH)
|
|
266
|
-
}
|
|
267
|
-
return n
|
|
268
|
-
}
|
|
269
|
-
function isph(t) {
|
|
270
|
-
if (t ~ /^<.*>$/) return 1
|
|
271
|
-
if (t ~ /^".*"$/ || t ~ /^'.*'$/) return 1
|
|
272
|
-
if (t=="..." || t=="…" || t=="ID" || t=="N" || t=="X") return 1
|
|
273
|
-
return 0
|
|
274
|
-
}
|
|
275
|
-
function addverb(w) { if (!(w in VERBW)) { VERBW[w]=1; NV++; VERBW_LIST[NV]=w } }
|
|
276
|
-
function lastwordpos(s, w, re, off, best) {
|
|
277
|
-
re = "(^|[ \t])" w "([^ \t]|$)"
|
|
278
|
-
off=0; best=0
|
|
279
|
-
while (off < length(s) && match(substr(s, off+1), re)) {
|
|
280
|
-
best = off + RSTART
|
|
281
|
-
off = best + RLENGTH - 2
|
|
282
|
-
if (RLENGTH <= 0) break
|
|
283
|
-
}
|
|
284
|
-
return best
|
|
285
|
-
}
|
|
286
|
-
function emit(ln, path, flag, key) {
|
|
287
|
-
key = path "\t" flag
|
|
288
|
-
if (key in EMITTED) return
|
|
289
|
-
EMITTED[key]=1
|
|
290
|
-
printf "CLAIM\t%d\t%s\t%s\n", ln, path, flag
|
|
291
|
-
}
|
|
292
|
-
function one_fragment(frag, ln, nt, toks, offs, i, t, core, j, k, na, alts, ok, usage_end, rest, base, fl, fpos, bind, best, w, p, nnp, newp, isbr) {
|
|
293
|
-
nt = tokenize(frag, toks, offs)
|
|
294
|
-
# `version / help` (and only that shape): a plain ` / ` splits into fragments when BOTH sides
|
|
295
|
-
# start with a command; `perf … (交互首帧 / 帧装配 / …)` is description text and must not split.
|
|
296
|
-
if (nt >= 1) {
|
|
297
|
-
# handled by the caller (expand_slash)
|
|
298
|
-
}
|
|
299
|
-
t = toks[1]; gsub(/^\[|\]$/, "", t)
|
|
300
|
-
if (!(t in TOP)) { fail(ln, "这一行无法归属到命令(首 token「" t "」不是 CLI 的命令):" frag); return }
|
|
301
|
-
NP=1; PATHS[1]=t; NV=0; delete VERBW; delete VERBW_LIST; delete EMITTED
|
|
302
|
-
usage_end = offs[1]+length(toks[1])-1
|
|
303
|
-
for (i=2; i<=nt; i++) {
|
|
304
|
-
t=toks[i]
|
|
305
|
-
isbr = (t ~ /^\[.*\]$/)
|
|
306
|
-
core=t; if (isbr) core=substr(t,2,length(t)-2)
|
|
307
|
-
if (isph(core) || core ~ /^-/) { usage_end = offs[i]+length(t)-1; continue }
|
|
308
|
-
if (index(core, "|") > 0) {
|
|
309
|
-
na=split(core, alts, "|"); ok=1
|
|
310
|
-
for (j=1;j<=NP;j++) for (kk=1;kk<=na;kk++) if (!(PATHS[j] " " alts[kk] in SUB)) ok=0
|
|
311
|
-
if (ok) {
|
|
312
|
-
nnp=0
|
|
313
|
-
for (j=1;j<=NP;j++) for (kk=1;kk<=na;kk++) { nnp++; newp[nnp]=PATHS[j] " " alts[kk] }
|
|
314
|
-
NP=nnp; for (j=1;j<=nnp;j++) PATHS[j]=newp[j]
|
|
315
|
-
for (kk=1;kk<=na;kk++) addverb(alts[kk])
|
|
316
|
-
usage_end = offs[i]+length(t)-1
|
|
317
|
-
continue
|
|
318
|
-
}
|
|
319
|
-
# 未解析的组:可选的([...])当参数——如 standby [on|off|status];不带的则是一句「这个命令有这些子命令」
|
|
320
|
-
# 的假活,必须红(不能静默降级成只有主命令)。
|
|
321
|
-
if (isbr) break
|
|
322
|
-
fail(ln, "这一行的命令组无法解析(" core "):" frag); return
|
|
323
|
-
}
|
|
324
|
-
ok=1
|
|
325
|
-
for (j=1;j<=NP;j++) if (!(PATHS[j] " " core in SUB)) ok=0
|
|
326
|
-
if (ok) {
|
|
327
|
-
for (j=1;j<=NP;j++) PATHS[j]=PATHS[j] " " core
|
|
328
|
-
addverb(core)
|
|
329
|
-
usage_end = offs[i]+length(t)-1
|
|
330
|
-
continue
|
|
331
|
-
}
|
|
332
|
-
break # 参数/描述文本:命令部分到此为止
|
|
333
|
-
}
|
|
334
|
-
# every --flag on the line, judged at its own offset
|
|
335
|
-
rest=frag; base=0
|
|
336
|
-
while (match(rest, /--[a-z0-9-]+/)) {
|
|
337
|
-
fl=substr(rest, RSTART, RLENGTH)
|
|
338
|
-
fpos=base+RSTART
|
|
339
|
-
base=base+RSTART+RLENGTH-1
|
|
340
|
-
rest=substr(rest, RSTART+RLENGTH)
|
|
341
|
-
if (fpos <= usage_end) {
|
|
342
|
-
for (j=1;j<=NP;j++) emit(ln, PATHS[j], fl)
|
|
343
|
-
continue
|
|
344
|
-
}
|
|
345
|
-
# description flag: the nearest preceding verb token of this fragment's own group, else the
|
|
346
|
-
# fragment's command(s) — `board …(add [--allow-dup] …)` binds to `board add`, `perf …;--host …`
|
|
347
|
-
# to `perf`.
|
|
348
|
-
best=0
|
|
349
|
-
for (kk=1;kk<=NV;kk++) { p=lastwordpos(substr(frag, 1, fpos-1), VERBW_LIST[kk]); if (p>best) best=p }
|
|
350
|
-
bind=0
|
|
351
|
-
if (best > 0) {
|
|
352
|
-
for (kk=1;kk<=NV;kk++) {
|
|
353
|
-
w=VERBW_LIST[kk]
|
|
354
|
-
if (lastwordpos(substr(frag, 1, fpos-1), w) != best) continue
|
|
355
|
-
for (j=1;j<=NP;j++) if (PATHS[j] ~ ("(^| )" w "$")) { emit(ln, PATHS[j], fl); bind=1 }
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (bind == 0) {
|
|
359
|
-
for (j=1;j<=NP;j++) emit(ln, PATHS[j], fl)
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
function expand_slash(frag, ln, np, parts, i, first, ok) {
|
|
364
|
-
np = split(frag, parts, / \/ /)
|
|
365
|
-
if (np > 1) {
|
|
366
|
-
ok=1
|
|
367
|
-
for (i=1;i<=np;i++) { first=parts[i]; sub(/^[ \t]+/,"",first); sub(/[ \t].*/,"",first); if (!(first in TOP)) ok=0 }
|
|
368
|
-
if (ok) { for (i=1;i<=np;i++) one_fragment(parts[i], ln); return }
|
|
369
|
-
}
|
|
370
|
-
one_fragment(frag, ln)
|
|
371
|
-
}
|
|
372
|
-
BEGIN {
|
|
373
|
-
n=split(tops, ta, " "); for (i=1;i<=n;i++) { gsub(/^[ \t]+|[ \t]+$/, "", ta[i]); if (ta[i]!="") TOP[ta[i]]=1 }
|
|
374
|
-
m=split(subs, sa, ";")
|
|
375
|
-
for (i=1;i<=m;i++) {
|
|
376
|
-
if (sa[i]=="") continue
|
|
377
|
-
if (split(sa[i], kv, ":") < 2) continue
|
|
378
|
-
p=kv[1]; gsub(/^[ \t]+|[ \t]+$/, "", p)
|
|
379
|
-
c=split(kv[2], sb, ",")
|
|
380
|
-
for (j=1;j<=c;j++) { gsub(/^[ \t]+|[ \t]+$/, "", sb[j]); if (sb[j]!="") SUB[p " " sb[j]]=1 }
|
|
381
|
-
}
|
|
382
|
-
inblock=0; lastindent=-1
|
|
383
|
-
}
|
|
384
|
-
{
|
|
385
|
-
line=$0
|
|
386
|
-
if (line ~ /^[ \t]*$/) next
|
|
387
|
-
if (line ~ /^[ \t]*──/) { inblock=1; lastindent=-1; next }
|
|
388
|
-
if (!inblock) next
|
|
389
|
-
m=match(line, /[^ \t]/); ind=m-1; rest=substr(line, m)
|
|
390
|
-
first=rest; sub(/[ \t].*/,"",first)
|
|
391
|
-
isentry = (first in TOP)
|
|
392
|
-
if (ind == 0) {
|
|
393
|
-
# 列 0 的行:命令块的正文一律缩进(对齐的续行更深)。
|
|
394
|
-
# · 打旗标的 → 无法归属(修复前的 board 形状:列 0 + [--allow-dup])→ 红;
|
|
395
|
-
# · 首 token 是命令的 → 未缩进的条目(形状约定是 2 空格)→ 红;
|
|
396
|
-
# · 其余(help 末尾的 配置:/协议: 页脚,不打印旗标)→ 块到此为止,忽略。
|
|
397
|
-
if (line ~ /--[a-z0-9-]+/) { fail(NR, "命令块里列 0 的行带着旗标(无法归属到任何条目):" rest) }
|
|
398
|
-
else if (isentry) { fail(NR, "命令块里的命令条目没有缩进(列 0):" rest) }
|
|
399
|
-
inblock=0; next
|
|
400
|
-
}
|
|
401
|
-
if (lastindent >= 0 && ind > lastindent) { next } # 缩进更深的行是上一条目的续行(哪怕它首 token 像个命令)
|
|
402
|
-
if (!isentry) {
|
|
403
|
-
fail(NR, "这一行既不是命令条目,也没有比上一条目缩进更深(无法归属):" rest)
|
|
404
|
-
next
|
|
405
|
-
}
|
|
406
|
-
lastindent=ind
|
|
407
|
-
printf "ENTRY\t%d\n", NR
|
|
408
|
-
# 全角分隔符在 bash 侧先换成 \x1f —— awk(mawk)按字节看字符类,直接写 [|/] 会在
|
|
409
|
-
# 任何中文 UTF-8 字节上乱切(实测把一行劈成单字碎片)。
|
|
410
|
-
nf = split($0, frags, "\037")
|
|
411
|
-
for (i=1;i<=nf;i++) expand_slash(frags[i], NR)
|
|
412
|
-
}
|
|
413
|
-
AWK
|
|
414
|
-
}
|
|
415
|
-
|
|
416
261
|
# mr_probe_mode <path> → `run`(默认)或 `source:<file>:<reason>`。
|
|
417
262
|
# `source` 只用于「这条命令只是 exec 另一个程序」的路径:跑它来验证一个旗标会真的把那个程序跑起来
|
|
418
263
|
# (perf = 性能套件)—— 那时读它自己的参数表。声明必须带文件与理由。
|
|
@@ -485,25 +330,6 @@ mr_pages() {
|
|
|
485
330
|
printf '%s\n' "${jobs[@]}"
|
|
486
331
|
}
|
|
487
332
|
|
|
488
|
-
# mr_page_usage <page-file> → the usage entries of a page, one per line (continuations joined)
|
|
489
|
-
mr_page_usage() {
|
|
490
|
-
awk '
|
|
491
|
-
function indent(l) { m=match(l, /[^ ]/); return m-1 }
|
|
492
|
-
{ l=$0
|
|
493
|
-
if (l ~ /^[ \t]*$/) next
|
|
494
|
-
ind=indent(l)
|
|
495
|
-
if (l ~ /^──/) { inblock=1; lastindent=-1; cur=""; next }
|
|
496
|
-
if (!inblock) next
|
|
497
|
-
if (ind == 0) { if (cur!="") { print cur; cur="" }; inblock=0; next }
|
|
498
|
-
if (lastindent >= 0 && ind > lastindent && ind < 6) { if (cur != "") cur = cur " " substr(l, ind+1); next }
|
|
499
|
-
if (lastindent >= 0 && ind > lastindent) { next } # the description block: not part of the usage line
|
|
500
|
-
if (cur != "") print cur
|
|
501
|
-
cur=substr(l, ind+1); lastindent=ind
|
|
502
|
-
}
|
|
503
|
-
END { if (cur != "") print cur }
|
|
504
|
-
' "$1"
|
|
505
|
-
}
|
|
506
|
-
|
|
507
333
|
# mr_manifest_claims → $tmp/walk-a.tsv: the manifest's usage lines, judged by the same parser.
|
|
508
334
|
# The walk and its non-vacuity control both take their working set from here, so neither can drift
|
|
509
335
|
# from the command manifest the renderer reads.
|
|
@@ -563,64 +389,15 @@ mr_walk_a() {
|
|
|
563
389
|
|
|
564
390
|
# ③ 逐级渲染:每一页都必须真的打印清单声明的那几行,且每一页都要能被同一个解析器读
|
|
565
391
|
local list; list="$(mr_pages)"
|
|
566
|
-
local spec kind label page n_pages=0 n_entries=0 n_claims=0
|
|
392
|
+
local spec kind label page n_pages=0 n_entries=0 n_claims=0
|
|
567
393
|
local -A LEVEL_OK=()
|
|
568
394
|
while IFS=':' read -r kind label; do
|
|
569
395
|
page="$tmp/pages/$kind--$label.txt"
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
if [ "$kind" = "command" ]; then
|
|
573
|
-
# the page's own usage header must be there (a deleted header is a defect, never a skip)
|
|
574
|
-
grep -qE '^── (Usage|用法)' "$page" || { finding "walk: $label 的页没有用法头部(Usage:/用法:)"; level_fail=1; }
|
|
575
|
-
local declared printed
|
|
576
|
-
declared="$(awk -F'\t' -v c="$label" '$1==c {print $2}' < <(mr_fragments) | sort)"
|
|
577
|
-
printed="$(mr_page_usage "$page" | sort)"
|
|
578
|
-
if [ "$declared" != "$printed" ]; then
|
|
579
|
-
local extra; extra="$(comm -13 <(printf '%s\n' "$declared") <(printf '%s\n' "$printed") | head -3 | paste -sd ' ' -)"
|
|
580
|
-
local gone; gone="$(comm -23 <(printf '%s\n' "$declared") <(printf '%s\n' "$printed") | head -3 | paste -sd ' ' -)"
|
|
581
|
-
finding "walk: $label 的页与清单不一致(页上多出:${extra:-无};页上缺少:${gone:-无})"
|
|
582
|
-
level_fail=1
|
|
583
|
-
fi
|
|
584
|
-
if printf '%s\n' "$printed" | grep -q -- '--ghost-probe\|--frobnicate-probe'; then
|
|
585
|
-
finding "walk: $label 的页打印了清单没有的旗标($(printf '%s\n' "$printed" | grep -- '--ghost-probe\|--frobnicate-probe' | head -1))"
|
|
586
|
-
level_fail=1
|
|
587
|
-
fi
|
|
588
|
-
LEVEL_OK[command]=1
|
|
589
|
-
elif [ "$kind" = "group" ]; then
|
|
590
|
-
local want got
|
|
591
|
-
want="$(awk -F'\t' -v g="$label" '$1=="cmd" && $3==g {n=split($4,f," ;; "); print f[1]}' "$manifest" | sort)"
|
|
592
|
-
got="$(mr_page_usage "$page" | sort)"
|
|
593
|
-
if [ "$want" != "$got" ]; then
|
|
594
|
-
finding "walk: 组页 $label 与清单不一致($(diff <(printf '%s\n' "$want") <(printf '%s\n' "$got") | grep '^[<>]' | head -2 | tr '\n' ' '))"
|
|
595
|
-
level_fail=1
|
|
596
|
-
fi
|
|
597
|
-
LEVEL_OK[group]=1
|
|
598
|
-
else
|
|
599
|
-
local want got
|
|
600
|
-
want="$(mr_begin | tr ' ' '\n' | grep -v '^$' | sort)"
|
|
601
|
-
got="$(mr_page_usage "$page" | awk '{print $1}' | sort)"
|
|
602
|
-
if [ "$want" != "$got" ]; then
|
|
603
|
-
finding "walk: 菜单的上手命令与清单的 begin 行不一致($(diff <(printf '%s\n' "$want") <(printf '%s\n' "$got") | grep '^[<>]' | head -2 | tr '\n' ' '))"
|
|
604
|
-
level_fail=1
|
|
605
|
-
fi
|
|
606
|
-
LEVEL_OK[menu]=1
|
|
607
|
-
fi
|
|
608
|
-
# the same parser reads every level (block rules unchanged)
|
|
609
|
-
awk -v tops="$MRI_TOPS" -v subs="$MRI_SUBS" -f "$tmp/walk-a.awk" "$page" > "$tmp/page-claims.tsv" 2>/dev/null
|
|
610
|
-
local ln rest
|
|
611
|
-
while IFS=$'\t' read -r _ ln rest; do
|
|
612
|
-
finding "walk: $kind $label 的第 $ln 行无法归属(解析器拒绝静默跳过):$rest"
|
|
613
|
-
level_fail=1
|
|
614
|
-
done < <(grep -a '^FAIL' "$tmp/page-claims.tsv")
|
|
615
|
-
n_entries=$((n_entries + $(grep -ac '^ENTRY' "$tmp/page-claims.tsv" || true)))
|
|
616
|
-
n_claims=$((n_claims + $(grep -ac '^CLAIM' "$tmp/page-claims.tsv" || true)))
|
|
617
|
-
ok "walk: $kind $label 判过($(grep -ac '^ENTRY' "$tmp/page-claims.tsv" || true) 条用法行,$(grep -ac '^CLAIM' "$tmp/page-claims.tsv" || true) 条断言)"
|
|
396
|
+
# Same shell: the shared operation owns ok/finding/FIND; this call site preserves failed=1.
|
|
397
|
+
mr_page_judge "$kind" "$label" "$page" || failed=1
|
|
618
398
|
done <<< "$list"
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
for lv in menu group command; do
|
|
622
|
-
[ -n "${LEVEL_OK[$lv]:-}" ] || { finding "walk: $lv 这一级一条都没被判到(静默漏读)"; failed=1; }
|
|
623
|
-
done
|
|
399
|
+
# Same shell: only pages actually read above can satisfy a level.
|
|
400
|
+
mr_level_finish || failed=1
|
|
624
401
|
|
|
625
402
|
# ④ 每条 (命令, 旗标) 断言喂真解析器;探针结果按 (命令,旗标) 去重
|
|
626
403
|
local fixture
|
|
@@ -1637,6 +1414,108 @@ mr_flip_require() {
|
|
|
1637
1414
|
return 1
|
|
1638
1415
|
}
|
|
1639
1416
|
|
|
1417
|
+
# ── pages: shared file judgement replacing exactly three complete walks ─────────────────────────────
|
|
1418
|
+
mr_pages_render() { # <tree> <label> <output>: one bounded real renderer call
|
|
1419
|
+
local root="$1" label="$2" out="$3" rc bytes
|
|
1420
|
+
MR_SAMPLE_WHY=""
|
|
1421
|
+
[ -n "$TIMEOUT_BIN" ] || { MR_SAMPLE_WHY="没有 timeout,不能执行有界渲染"; return 1; }
|
|
1422
|
+
mkdir -p "$(dirname "$out")"
|
|
1423
|
+
( cd "$tmp" && env -u TMUX -u TMUX_PANE "$TIMEOUT_BIN" "$timeout_sec" \
|
|
1424
|
+
bash "$root/skills/teamsmith/scripts/team" help "$label" >"$out" ) </dev/null 2>"$out.err"
|
|
1425
|
+
rc=$?; bytes="$(wc -c <"$out" 2>/dev/null || printf 0)"
|
|
1426
|
+
printf 'tree=%s command=team help %s rc=%s bytes=%s output=%s\n' \
|
|
1427
|
+
"$root" "$label" "$rc" "$bytes" "$out" >>"$tmp/pages-renders.log"
|
|
1428
|
+
if [ "$rc" -ne 0 ] || [ ! -s "$out" ]; then
|
|
1429
|
+
MR_SAMPLE_WHY="team help $label 渲染失败或为空(rc=$rc bytes=$bytes;$out.err)"; return 1
|
|
1430
|
+
fi
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
# Expected negatives have their own counters and cannot contaminate the sample's FIND.
|
|
1434
|
+
mr_pages_child() { # <log> <finish-levels:0|1> [<kind> <label> <file>]…
|
|
1435
|
+
local logf="$1" levels="$2"; shift 2
|
|
1436
|
+
(
|
|
1437
|
+
PASS=0; FIND=0; SKIP=0
|
|
1438
|
+
local n_pages=0 n_entries=0 n_claims=0 failed=0 kind label page
|
|
1439
|
+
local -A LEVEL_OK=()
|
|
1440
|
+
while [ "$#" -gt 0 ]; do
|
|
1441
|
+
kind="$1"; label="$2"; page="$3"; shift 3
|
|
1442
|
+
mr_page_judge "$kind" "$label" "$page" || failed=1
|
|
1443
|
+
done
|
|
1444
|
+
[ "$levels" != "1" ] || mr_level_finish || failed=1
|
|
1445
|
+
printf 'SAMPLE_STATE pages=%d menu=%s group=%s command=%s findings=%d failed=%d\n' \
|
|
1446
|
+
"$n_pages" "${LEVEL_OK[menu]:-0}" "${LEVEL_OK[group]:-0}" "${LEVEL_OK[command]:-0}" "$FIND" "$failed"
|
|
1447
|
+
[ "$FIND" -eq 0 ] && [ "$failed" -eq 0 ]
|
|
1448
|
+
) >"$logf" 2>&1
|
|
1449
|
+
MR_SAMPLE_RC=$?
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
mr_pages_log_has() { local f="$1" p; shift; for p in "$@"; do grep -qF -- "$p" "$f" || return 1; done; }
|
|
1453
|
+
mr_pages_log_clean() { ! grep -qF $'\033[31m✗' "$1"; }
|
|
1454
|
+
mr_pages_finding_count() { grep -cF $'\033[31m✗' "$1" 2>/dev/null || true; }
|
|
1455
|
+
|
|
1456
|
+
mr_sample_unattributable() {
|
|
1457
|
+
local s damaged normal bad_log good_log bad_rc good_rc
|
|
1458
|
+
MR_SAMPLE_WHY=""; s="$(mr_scratch_tree pages-unattributable)"
|
|
1459
|
+
python3 - "$s/skills/teamsmith/scripts/lib/cmd-help.sh" <<'MUT'
|
|
1460
|
+
import sys
|
|
1461
|
+
p = sys.argv[1]
|
|
1462
|
+
s = open(p, encoding='utf-8').read()
|
|
1463
|
+
old = ' local plain="${_TH_USAGE[$i]// ;; /;;;}"'
|
|
1464
|
+
new = old + '\n [ "$name" != "board" ] || team_help_flow 0 4 "board add <ID> [--allow-dup]"'
|
|
1465
|
+
assert s.count(old) == 1, 'the usage renderer must match exactly once'
|
|
1466
|
+
open(p, 'w', encoding='utf-8').write(s.replace(old, new, 1))
|
|
1467
|
+
MUT
|
|
1468
|
+
if ! mr_flip_require "替代④" "$s" scripts/lib/cmd-help.sh - 'team_help_flow 0 4 "board add <ID> [--allow-dup]"'; then
|
|
1469
|
+
MR_SAMPLE_WHY="$MR_FLIP_WHY"; return 1
|
|
1470
|
+
fi
|
|
1471
|
+
damaged="$tmp/page-samples/board-damaged.txt"; normal="$tmp/page-samples/board-normal.txt"
|
|
1472
|
+
mr_pages_render "$s" board "$damaged" || return 1
|
|
1473
|
+
mr_pages_render "$tree" board "$normal" || return 1
|
|
1474
|
+
bad_log="$tmp/page-samples/board-damaged.judge.log"; good_log="$tmp/page-samples/board-normal.judge.log"
|
|
1475
|
+
mr_pages_child "$bad_log" 0 command board "$damaged"; bad_rc="$MR_SAMPLE_RC"
|
|
1476
|
+
mr_pages_child "$good_log" 0 command board "$normal"; good_rc="$MR_SAMPLE_RC"
|
|
1477
|
+
if [ "$bad_rc" -ne 0 ] && mr_pages_log_has "$bad_log" '列 0 的行' '无法归属' 'board add <ID> [--allow-dup]' && \
|
|
1478
|
+
[ "$good_rc" -eq 0 ] && mr_pages_log_clean "$good_log"; then return 0; fi
|
|
1479
|
+
MR_SAMPLE_WHY="受损页 rc=$bad_rc,正常页 rc=$good_rc;需要列 0 归属诊断且正常页无 finding($bad_log;$good_log)"
|
|
1480
|
+
return 1
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
mr_sample_page_ghost() {
|
|
1484
|
+
local s damaged normal bad_log good_log bad_rc good_rc
|
|
1485
|
+
MR_SAMPLE_WHY=""; MR_SAMPLE_NORMAL_DISPATCH=""; s="$(mr_scratch_tree pages-ghost)"
|
|
1486
|
+
python3 - "$s/skills/teamsmith/scripts/lib/cmd-help.sh" <<'MUT'
|
|
1487
|
+
import sys
|
|
1488
|
+
p = sys.argv[1]
|
|
1489
|
+
s = open(p, encoding='utf-8').read()
|
|
1490
|
+
old = ' local plain="${_TH_USAGE[$i]// ;; /;;;}"'
|
|
1491
|
+
new = old + '\n [ "$name" != "dispatch" ] || team_help_flow 2 4 "dispatch --ghost-probe"'
|
|
1492
|
+
assert s.count(old) == 1, 'the usage renderer must match exactly once'
|
|
1493
|
+
open(p, 'w', encoding='utf-8').write(s.replace(old, new, 1))
|
|
1494
|
+
MUT
|
|
1495
|
+
if ! mr_flip_require "替代⑪" "$s" scripts/lib/cmd-help.sh - 'team_help_flow 2 4 "dispatch --ghost-probe"'; then
|
|
1496
|
+
MR_SAMPLE_WHY="$MR_FLIP_WHY"; return 1
|
|
1497
|
+
fi
|
|
1498
|
+
damaged="$tmp/page-samples/dispatch-damaged.txt"; normal="$tmp/page-samples/dispatch-normal.txt"
|
|
1499
|
+
mr_pages_render "$s" dispatch "$damaged" || return 1
|
|
1500
|
+
mr_pages_render "$tree" dispatch "$normal" || return 1
|
|
1501
|
+
MR_SAMPLE_NORMAL_DISPATCH="$normal"
|
|
1502
|
+
bad_log="$tmp/page-samples/dispatch-damaged.judge.log"; good_log="$tmp/page-samples/dispatch-normal.judge.log"
|
|
1503
|
+
mr_pages_child "$bad_log" 0 command dispatch "$damaged"; bad_rc="$MR_SAMPLE_RC"
|
|
1504
|
+
mr_pages_child "$good_log" 0 command dispatch "$normal"; good_rc="$MR_SAMPLE_RC"
|
|
1505
|
+
if [ "$bad_rc" -ne 0 ] && mr_pages_log_has "$bad_log" 'dispatch' '页与清单不一致' '页上多出' 'dispatch --ghost-probe' && \
|
|
1506
|
+
[ "$good_rc" -eq 0 ] && mr_pages_log_clean "$good_log"; then return 0; fi
|
|
1507
|
+
MR_SAMPLE_WHY="受损页 rc=$bad_rc,正常页 rc=$good_rc;需要集合差/页上多出诊断,特例字面量不算($bad_log;$good_log)"
|
|
1508
|
+
return 1
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
mr_sample_file_variant() { # <name> <file> <required-literal>…
|
|
1512
|
+
local name="$1" file="$2" logf; shift 2
|
|
1513
|
+
logf="$tmp/page-samples/$name.judge.log"
|
|
1514
|
+
mr_pages_child "$logf" 0 command dispatch "$file"
|
|
1515
|
+
if [ "$MR_SAMPLE_RC" -ne 0 ] && mr_pages_log_has "$logf" '页与清单不一致' "$@"; then return 0; fi
|
|
1516
|
+
MR_SAMPLE_WHY="$name 没有给出要求的集合差诊断(rc=$MR_SAMPLE_RC;$logf)"; return 1
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1640
1519
|
# 嵌套 run 的根:本轮台账里 kind=routes 且 pid 不是本进程的存活根,加上文件系统里新于本夹具根的
|
|
1641
1520
|
# owned 家族目录(兜住「不用助手、裸 mkdir」的形状)。台账是主来源(父/子共享 run 台账,每个嵌套
|
|
1642
1521
|
# 根都在册,与 mtime 无关);find 是次要来源(原始形状,保留不放松)。
|
|
@@ -1651,6 +1530,88 @@ mr_nested_leftovers() { # [<base>]
|
|
|
1651
1530
|
} | sed '/^$/d' | sort -u
|
|
1652
1531
|
}
|
|
1653
1532
|
|
|
1533
|
+
mr_sample_levels() {
|
|
1534
|
+
local group menu group_page command_page missing_log restored_log missing_rc restored_rc n frag
|
|
1535
|
+
MR_SAMPLE_WHY=""; command_page="${MR_SAMPLE_NORMAL_DISPATCH:-$tmp/page-samples/dispatch-normal.txt}"
|
|
1536
|
+
[ -s "$command_page" ] || { MR_SAMPLE_WHY="没有已渲染的正常 dispatch 文件输入"; return 1; }
|
|
1537
|
+
group="$(mr_groups | head -1)"; [ -n "$group" ] || { MR_SAMPLE_WHY="清单没有组"; return 1; }
|
|
1538
|
+
menu="$tmp/page-samples/menu-file.txt"; group_page="$tmp/page-samples/group-file.txt"
|
|
1539
|
+
{
|
|
1540
|
+
printf '── 用法 ──\n'
|
|
1541
|
+
for n in $(mr_begin); do frag="$(mr_field "$n" 4)"; printf ' %s\n' "${frag%% ;;*}"; done
|
|
1542
|
+
} >"$menu"
|
|
1543
|
+
{
|
|
1544
|
+
printf '── 用法 ──\n'
|
|
1545
|
+
awk -F'\t' -v g="$group" '$1=="cmd" && $3==g {n=split($4,f," ;; "); print " " f[1]}' "$(mr_manifest)"
|
|
1546
|
+
} >"$group_page"
|
|
1547
|
+
# Planned is not read: this existing group file is not supplied to the first child.
|
|
1548
|
+
missing_log="$tmp/page-samples/levels-missing-group.log"
|
|
1549
|
+
mr_pages_child "$missing_log" 1 menu "" "$menu" command dispatch "$command_page"; missing_rc="$MR_SAMPLE_RC"
|
|
1550
|
+
restored_log="$tmp/page-samples/levels-restored-group.log"
|
|
1551
|
+
mr_pages_child "$restored_log" 1 menu "" "$menu" group "$group" "$group_page" command dispatch "$command_page"; restored_rc="$MR_SAMPLE_RC"
|
|
1552
|
+
if [ "$missing_rc" -ne 0 ] && [ "$(mr_pages_finding_count "$missing_log")" -eq 1 ] && \
|
|
1553
|
+
mr_pages_log_has "$missing_log" 'group 这一级一条都没被判到' 'walk: menu' 'walk: command dispatch' \
|
|
1554
|
+
'SAMPLE_STATE pages=2 menu=1 group=0 command=1 findings=1 failed=1' && \
|
|
1555
|
+
[ "$restored_rc" -eq 0 ] && mr_pages_log_clean "$restored_log" && \
|
|
1556
|
+
mr_pages_log_has "$restored_log" 'SAMPLE_STATE pages=3 menu=1 group=1 command=1 findings=0 failed=0'; then return 0; fi
|
|
1557
|
+
MR_SAMPLE_WHY="缺组 rc=$missing_rc/findings=$(mr_pages_finding_count "$missing_log"),恢复 rc=$restored_rc;需要缺组为唯一 finding 且恢复全绿($missing_log;$restored_log)"
|
|
1558
|
+
return 1
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
mr_sample_empty_page() {
|
|
1562
|
+
local empty="$tmp/page-samples/dispatch-empty.txt" logf="$tmp/page-samples/dispatch-empty.judge.log"
|
|
1563
|
+
: >"$empty"; mr_pages_child "$logf" 0 command dispatch "$empty"
|
|
1564
|
+
if [ "$MR_SAMPLE_RC" -ne 0 ] && [ "$(mr_pages_finding_count "$logf")" -eq 1 ] && \
|
|
1565
|
+
mr_pages_log_has "$logf" '帮助面缺一页' 'SAMPLE_STATE pages=0 menu=0 group=0 command=0 findings=1 failed=1'; then return 0; fi
|
|
1566
|
+
MR_SAMPLE_WHY="空文件必须发原缺页 finding 且不得计作已读(rc=$MR_SAMPLE_RC;$logf)"; return 1
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
mr_page_samples() {
|
|
1570
|
+
section "pages · 文件判定样本(替代④ / 替代⑪ / 替代⑬)"
|
|
1571
|
+
mr_known_tables; mr_write_parser
|
|
1572
|
+
local named=0 usage continuation duplicate missing
|
|
1573
|
+
if mr_sample_unattributable; then
|
|
1574
|
+
ok "替代④:列 0 归属诊断 + 未变异 board 正常页(两次渲染均 rc=0 且非空)"; named=$((named + 1))
|
|
1575
|
+
else finding "替代④没有兑现:$MR_SAMPLE_WHY"; fi
|
|
1576
|
+
if mr_sample_page_ghost; then
|
|
1577
|
+
ok "替代⑪:集合差页上多出诊断 + 未变异 dispatch 正常页(两次渲染均 rc=0 且非空)"; named=$((named + 1))
|
|
1578
|
+
else finding "替代⑪没有兑现:$MR_SAMPLE_WHY"; fi
|
|
1579
|
+
|
|
1580
|
+
usage="$(mr_field dispatch 4)"; usage="${usage%% ;;*}"
|
|
1581
|
+
continuation="$tmp/page-samples/dispatch-continuation.txt"
|
|
1582
|
+
duplicate="$tmp/page-samples/dispatch-duplicate.txt"; missing="$tmp/page-samples/dispatch-missing.txt"
|
|
1583
|
+
if [ -n "$usage" ]; then
|
|
1584
|
+
python3 - "$usage" "$continuation" "$duplicate" "$missing" <<'PY'
|
|
1585
|
+
import pathlib, sys
|
|
1586
|
+
usage, continuation, duplicate, missing = sys.argv[1:]
|
|
1587
|
+
line = " " + usage
|
|
1588
|
+
assert " [--fresh]" in line, "continuation split anchor must exist"
|
|
1589
|
+
continued = line.replace(" [--fresh]", "\n [--fresh]", 1)
|
|
1590
|
+
pathlib.Path(continuation).write_text("── Usage ──\n" + continued + "\n")
|
|
1591
|
+
pathlib.Path(duplicate).write_text("── Usage ──\n" + line + "\n" + line + "\n")
|
|
1592
|
+
pathlib.Path(missing).write_text("── Usage ──\n")
|
|
1593
|
+
PY
|
|
1594
|
+
mr_pages_child "$tmp/page-samples/dispatch-continuation.judge.log" 0 command dispatch "$continuation"
|
|
1595
|
+
if [ "$MR_SAMPLE_RC" -eq 0 ] && mr_pages_log_clean "$tmp/page-samples/dispatch-continuation.judge.log"; then
|
|
1596
|
+
ok "文件判定:缩进续行拼回原用法,正常输入无 finding"
|
|
1597
|
+
else finding "文件判定:续行没有按原规则拼回($tmp/page-samples/dispatch-continuation.judge.log)"; fi
|
|
1598
|
+
if mr_sample_file_variant duplicate "$duplicate" '页上多出' "$usage"; then
|
|
1599
|
+
ok "文件判定:重复用法按 sort 多重集比较,不被 sort -u 吞掉"
|
|
1600
|
+
else finding "文件判定:重复用法没有兑现($MR_SAMPLE_WHY)"; fi
|
|
1601
|
+
if mr_sample_file_variant missing "$missing" '页上缺少' "$usage"; then
|
|
1602
|
+
ok "文件判定:缺失用法进入集合差并点名完整行"
|
|
1603
|
+
else finding "文件判定:缺失用法没有兑现($MR_SAMPLE_WHY)"; fi
|
|
1604
|
+
else
|
|
1605
|
+
finding "文件判定:没有正常 dispatch 文件,续行/重复/缺失用例不能跳过"
|
|
1606
|
+
fi
|
|
1607
|
+
if mr_sample_levels; then
|
|
1608
|
+
ok "替代⑬:菜单/命令文件通过,缺 group 是唯一 finding,恢复 group 后无 finding"; named=$((named + 1))
|
|
1609
|
+
else finding "替代⑬没有兑现:$MR_SAMPLE_WHY"; fi
|
|
1610
|
+
if mr_sample_empty_page; then ok "文件判定:空文件发原缺页 finding,且不计作已读"
|
|
1611
|
+
else finding "文件判定:空文件没有兑现($MR_SAMPLE_WHY)"; fi
|
|
1612
|
+
[ "$named" -ge 3 ] || finding "pages 样本缺少具名成功结果(替代④/⑪/⑬只有 $named/3)"
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1654
1615
|
mr_flips() {
|
|
1655
1616
|
section "flips · 把树改坏 → walk 必须红并点名(翻转证据)"
|
|
1656
1617
|
local s log out ev
|
|
@@ -1762,25 +1723,6 @@ MUT
|
|
|
1762
1723
|
finding "翻转③没有兑现(rc=$MR_FLIP_RC):$(mr_flip_evidence)"
|
|
1763
1724
|
fi
|
|
1764
1725
|
fi
|
|
1765
|
-
# ④ 无法归属的行:命令块里列 0 的行(把一条用法行渲染到列 0)
|
|
1766
|
-
s="$(mr_scratch_tree flip-unattributable)"
|
|
1767
|
-
python3 - "$s/skills/teamsmith/scripts/lib/cmd-help.sh" <<'MUT'
|
|
1768
|
-
import sys
|
|
1769
|
-
p = sys.argv[1]
|
|
1770
|
-
s = open(p, encoding='utf-8').read()
|
|
1771
|
-
old = ' local plain="${_TH_USAGE[$i]// ;; /;;;}"'
|
|
1772
|
-
new = old + '\n [ "$name" != "board" ] || team_help_flow 0 4 "board add <ID> [--allow-dup]"'
|
|
1773
|
-
assert s.count(old) == 1, 'the usage renderer must match exactly once'
|
|
1774
|
-
open(p, 'w', encoding='utf-8').write(s.replace(old, new, 1))
|
|
1775
|
-
MUT
|
|
1776
|
-
if mr_flip_require "翻转④" "$s" scripts/lib/cmd-help.sh - 'team_help_flow 0 4 "board add <ID> [--allow-dup]"'; then
|
|
1777
|
-
mr_flip_run "$s" walk
|
|
1778
|
-
if [ "$MR_FLIP_RC" != "0" ] && mr_flip_log_has '列 0 的行'; then
|
|
1779
|
-
ok "翻转④:命令块里的列 0 行 → walk 红并点名该行(修复前的 board 形状)"
|
|
1780
|
-
else
|
|
1781
|
-
finding "翻转④没有兑现(rc=$MR_FLIP_RC):$(mr_flip_evidence)"
|
|
1782
|
-
fi
|
|
1783
|
-
fi
|
|
1784
1726
|
# ⑤ schema 注释点名不存在的命令
|
|
1785
1727
|
s="$(mr_scratch_tree flip-schema-route)"
|
|
1786
1728
|
sed -i 's/TEAM_GATES|apply|cmd||plain||-|||workflow/TEAM_GATES|apply|cmd||plain||-|team frob off||workflow/' "$s/skills/teamsmith/scripts/lib/cmd-config.sh"
|
|
@@ -1906,43 +1848,18 @@ PY
|
|
|
1906
1848
|
finding "翻转⑩对照:修坏的树上 Walk A/控制臂不该变红(rc=$MR_FLIP_RC)"
|
|
1907
1849
|
fi
|
|
1908
1850
|
fi
|
|
1909
|
-
# ⑪ 第 2 级页面打印一条清单没有声明的用法行(旧走查看不到这里)
|
|
1910
|
-
s="$(mr_scratch_tree flip-page-ghost)"
|
|
1911
|
-
python3 - "$s/skills/teamsmith/scripts/lib/cmd-help.sh" <<'MUT'
|
|
1912
|
-
import sys
|
|
1913
|
-
p = sys.argv[1]
|
|
1914
|
-
s = open(p, encoding='utf-8').read()
|
|
1915
|
-
old = ' local plain="${_TH_USAGE[$i]// ;; /;;;}"'
|
|
1916
|
-
new = old + '\n [ "$name" != "dispatch" ] || team_help_flow 2 4 "dispatch --ghost-probe"'
|
|
1917
|
-
assert s.count(old) == 1, 'the usage renderer must match exactly once'
|
|
1918
|
-
open(p, 'w', encoding='utf-8').write(s.replace(old, new, 1))
|
|
1919
|
-
MUT
|
|
1920
|
-
if mr_flip_require "翻转⑪" "$s" scripts/lib/cmd-help.sh - 'team_help_flow 2 4 "dispatch --ghost-probe"'; then
|
|
1921
|
-
mr_flip_run "$s" walk
|
|
1922
|
-
if [ "$MR_FLIP_RC" != "0" ] && mr_flip_log_has 'dispatch' && mr_flip_log_has 'ghost-probe'; then
|
|
1923
|
-
ok "翻转⑪:第 2 级页面多出一条清单没有的用法行 → walk 红并点名该页与旗标"
|
|
1924
|
-
else
|
|
1925
|
-
finding "翻转⑪没有兑现(rc=$MR_FLIP_RC):$(mr_flip_evidence)"
|
|
1926
|
-
fi
|
|
1927
|
-
fi
|
|
1928
1851
|
# ⑫ 清单漏掉一个 CLI 仍然接受的命令 —— 与帮助面夹具的 coverage 红侧同形(那条更便宜),
|
|
1929
1852
|
# 这里不重复跑一遍 Walk A。
|
|
1930
|
-
#
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
mr_flip_run "$s" walk
|
|
1941
|
-
if [ "$MR_FLIP_RC" != "0" ] && mr_flip_log_has '这一级一条都没被判到'; then
|
|
1942
|
-
ok "翻转⑬:一级一条都没被判到 → walk 红并点名该级"
|
|
1943
|
-
else
|
|
1944
|
-
finding "翻转⑬没有兑现(rc=$MR_FLIP_RC):$(mr_flip_evidence)"
|
|
1945
|
-
fi
|
|
1853
|
+
# 旧④/⑪/⑬的完整 walk 已由同一脚本的 pages 样本替代;非 FAST 到这里无条件执行一次。
|
|
1854
|
+
mr_flip_run "$tree" pages
|
|
1855
|
+
local page_name page_missing=""
|
|
1856
|
+
for page_name in '替代④' '替代⑪' '替代⑬'; do
|
|
1857
|
+
grep -aF $'\033[32m✓\033[0m '"$page_name" "$MR_FLIP_LOGF" >/dev/null || page_missing="$page_missing $page_name"
|
|
1858
|
+
done
|
|
1859
|
+
if [ "$MR_FLIP_RC" = "0" ] && [ -z "$page_missing" ]; then
|
|
1860
|
+
ok "页面替代样本:pages rc=0,替代④/⑪/⑬三条具名成功结果齐全"
|
|
1861
|
+
else
|
|
1862
|
+
finding "页面替代样本没有兑现(rc=$MR_FLIP_RC;缺少具名成功结果:${page_missing:-无}):$(mr_flip_evidence)"
|
|
1946
1863
|
fi
|
|
1947
1864
|
# 收尾:flips 自己的 scratch 树与嵌套 run 的根都不留下。
|
|
1948
1865
|
# TEAM_TMP_KEEP=1(门禁的 --keep 让子进程都继承它)是**刻意的保留**,不是泄漏 —— 与 smoke §40
|
|
@@ -1981,6 +1898,9 @@ fi
|
|
|
1981
1898
|
if want refusals; then
|
|
1982
1899
|
if mr_refusals; then :; fi
|
|
1983
1900
|
fi
|
|
1901
|
+
if want pages; then
|
|
1902
|
+
if mr_page_samples; then :; fi
|
|
1903
|
+
fi
|
|
1984
1904
|
if want flips; then
|
|
1985
1905
|
if [ "${TEAM_ROUTES_NESTED:-0}" = "1" ]; then
|
|
1986
1906
|
skip "flips(嵌套 run:flips 自己在 scratch 树上跑 walk,不再往下递归)"
|