teamsmith 0.4.6 → 0.4.8
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 +35 -0
- package/skills/teamsmith/SKILL.md +43 -30
- 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/config.md +11 -12
- 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 +61 -35
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +48 -11
- package/skills/teamsmith/scripts/lib/common.sh +83 -13
- package/skills/teamsmith/scripts/panel/README.md +35 -33
- package/skills/teamsmith/scripts/panel/panel.js +217 -199
- package/skills/teamsmith/scripts/panel/src/App.tsx +221 -66
- package/skills/teamsmith/scripts/panel/src/data.ts +71 -15
- package/skills/teamsmith/scripts/panel/src/layout.ts +159 -310
- package/skills/teamsmith/scripts/panel/src/main.tsx +83 -21
- package/skills/teamsmith/scripts/panel/src/project-settings.ts +46 -0
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +71 -205
- package/skills/teamsmith/scripts/panel/src/strings/index.ts +3 -5
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +72 -204
- package/skills/teamsmith/scripts/panel/src/types.ts +23 -4
- 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/strings/commands.tsv +1 -1
- package/skills/teamsmith/scripts/team +1 -0
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +18 -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 +41 -25
- 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 +78 -12
- package/skills/teamsmith/tests/install-shape.sh +7 -7
- package/skills/teamsmith/tests/isolation-ledger.sh +6 -2
- package/skills/teamsmith/tests/key-replies-ui.sh +64 -5
- package/skills/teamsmith/tests/key-replies.sh +307 -106
- package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +2 -0
- package/skills/teamsmith/tests/lib/model-routing-boundary.sh +255 -90
- package/skills/teamsmith/tests/lib/model-routing-expansion.sh +181 -61
- package/skills/teamsmith/tests/lib/model-routing-roles.sh +125 -67
- package/skills/teamsmith/tests/lib/reply-fixture.sh +14 -9
- package/skills/teamsmith/tests/lib/routes-pages.sh +243 -0
- package/skills/teamsmith/tests/lib/tmp-root.sh +1 -1
- package/skills/teamsmith/tests/loop-inventory.tsv +3 -0
- package/skills/teamsmith/tests/panel-b2.sh +91 -31
- package/skills/teamsmith/tests/panel-b3-stub.sh +9 -2
- package/skills/teamsmith/tests/panel-p21.sh +607 -1162
- package/skills/teamsmith/tests/panel-strings.mjs +21 -113
- package/skills/teamsmith/tests/remind-adversarial-faults.mjs +190 -0
- package/skills/teamsmith/tests/remind-adversarial-faults.sh +78 -0
- package/skills/teamsmith/tests/remind-adversarial-real.sh +28 -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 +801 -0
- package/skills/teamsmith/tests/remind-tool-real.sh +180 -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 +19 -17
- package/skills/teamsmith/tests/smoke.sh +583 -133
- package/skills/teamsmith/tests/state-authority.sh +152 -8
- package/skills/teamsmith/tests/task-model-routing.sh +57 -26
- package/skills/teamsmith/tests/tmp-hygiene.sh +1 -1
- package/skills/teamsmith-init/SKILL.md +5 -5
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# routes-pages.sh — shared help-page parsing and content judgement for routes.sh.
|
|
2
|
+
# Test-only code: the caller owns rendering, fixtures, scratch roots and cleanup.
|
|
3
|
+
|
|
4
|
+
# Write the command/usage parser shared by manifest claims and every rendered page.
|
|
5
|
+
mr_write_parser() {
|
|
6
|
+
cat > "$tmp/walk-a.awk" <<'AWK'
|
|
7
|
+
function fail(ln, msg) { printf "FAIL\t%d\t%s\n", ln, msg }
|
|
8
|
+
function tokenize(s, arr, offs, rest, tok, n, pos) {
|
|
9
|
+
n=0; rest=s; pos=1
|
|
10
|
+
while (match(rest, /\[[^]]*\]|[^ \t]+/)) {
|
|
11
|
+
tok=substr(rest, RSTART, RLENGTH)
|
|
12
|
+
n++; arr[n]=tok; offs[n]=pos+RSTART-1
|
|
13
|
+
pos += RSTART-1+RLENGTH; rest=substr(rest, RSTART+RLENGTH)
|
|
14
|
+
}
|
|
15
|
+
return n
|
|
16
|
+
}
|
|
17
|
+
function isph(t) {
|
|
18
|
+
if (t ~ /^<.*>$/) return 1
|
|
19
|
+
if (t ~ /^".*"$/ || t ~ /^'.*'$/) return 1
|
|
20
|
+
if (t=="..." || t=="…" || t=="ID" || t=="N" || t=="X") return 1
|
|
21
|
+
return 0
|
|
22
|
+
}
|
|
23
|
+
function addverb(w) { if (!(w in VERBW)) { VERBW[w]=1; NV++; VERBW_LIST[NV]=w } }
|
|
24
|
+
function lastwordpos(s, w, re, off, best) {
|
|
25
|
+
re = "(^|[ \t])" w "([^ \t]|$)"
|
|
26
|
+
off=0; best=0
|
|
27
|
+
while (off < length(s) && match(substr(s, off+1), re)) {
|
|
28
|
+
best = off + RSTART
|
|
29
|
+
off = best + RLENGTH - 2
|
|
30
|
+
if (RLENGTH <= 0) break
|
|
31
|
+
}
|
|
32
|
+
return best
|
|
33
|
+
}
|
|
34
|
+
function emit(ln, path, flag, key) {
|
|
35
|
+
key = path "\t" flag
|
|
36
|
+
if (key in EMITTED) return
|
|
37
|
+
EMITTED[key]=1
|
|
38
|
+
printf "CLAIM\t%d\t%s\t%s\n", ln, path, flag
|
|
39
|
+
}
|
|
40
|
+
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) {
|
|
41
|
+
nt = tokenize(frag, toks, offs)
|
|
42
|
+
# `version / help` (and only that shape): a plain ` / ` splits into fragments when BOTH sides
|
|
43
|
+
# start with a command; `perf … (交互首帧 / 帧装配 / …)` is description text and must not split.
|
|
44
|
+
if (nt >= 1) {
|
|
45
|
+
# handled by the caller (expand_slash)
|
|
46
|
+
}
|
|
47
|
+
t = toks[1]; gsub(/^\[|\]$/, "", t)
|
|
48
|
+
if (!(t in TOP)) { fail(ln, "这一行无法归属到命令(首 token「" t "」不是 CLI 的命令):" frag); return }
|
|
49
|
+
NP=1; PATHS[1]=t; NV=0; delete VERBW; delete VERBW_LIST; delete EMITTED
|
|
50
|
+
usage_end = offs[1]+length(toks[1])-1
|
|
51
|
+
for (i=2; i<=nt; i++) {
|
|
52
|
+
t=toks[i]
|
|
53
|
+
isbr = (t ~ /^\[.*\]$/)
|
|
54
|
+
core=t; if (isbr) core=substr(t,2,length(t)-2)
|
|
55
|
+
if (isph(core) || core ~ /^-/) { usage_end = offs[i]+length(t)-1; continue }
|
|
56
|
+
if (index(core, "|") > 0) {
|
|
57
|
+
na=split(core, alts, "|"); ok=1
|
|
58
|
+
for (j=1;j<=NP;j++) for (kk=1;kk<=na;kk++) if (!(PATHS[j] " " alts[kk] in SUB)) ok=0
|
|
59
|
+
if (ok) {
|
|
60
|
+
nnp=0
|
|
61
|
+
for (j=1;j<=NP;j++) for (kk=1;kk<=na;kk++) { nnp++; newp[nnp]=PATHS[j] " " alts[kk] }
|
|
62
|
+
NP=nnp; for (j=1;j<=nnp;j++) PATHS[j]=newp[j]
|
|
63
|
+
for (kk=1;kk<=na;kk++) addverb(alts[kk])
|
|
64
|
+
usage_end = offs[i]+length(t)-1
|
|
65
|
+
continue
|
|
66
|
+
}
|
|
67
|
+
# 未解析的组:可选的([...])当参数——如 standby [on|off|status];不带的则是一句「这个命令有这些子命令」
|
|
68
|
+
# 的假活,必须红(不能静默降级成只有主命令)。
|
|
69
|
+
if (isbr) break
|
|
70
|
+
fail(ln, "这一行的命令组无法解析(" core "):" frag); return
|
|
71
|
+
}
|
|
72
|
+
ok=1
|
|
73
|
+
for (j=1;j<=NP;j++) if (!(PATHS[j] " " core in SUB)) ok=0
|
|
74
|
+
if (ok) {
|
|
75
|
+
for (j=1;j<=NP;j++) PATHS[j]=PATHS[j] " " core
|
|
76
|
+
addverb(core)
|
|
77
|
+
usage_end = offs[i]+length(t)-1
|
|
78
|
+
continue
|
|
79
|
+
}
|
|
80
|
+
break # 参数/描述文本:命令部分到此为止
|
|
81
|
+
}
|
|
82
|
+
# every --flag on the line, judged at its own offset
|
|
83
|
+
rest=frag; base=0
|
|
84
|
+
while (match(rest, /--[a-z0-9-]+/)) {
|
|
85
|
+
fl=substr(rest, RSTART, RLENGTH)
|
|
86
|
+
fpos=base+RSTART
|
|
87
|
+
base=base+RSTART+RLENGTH-1
|
|
88
|
+
rest=substr(rest, RSTART+RLENGTH)
|
|
89
|
+
if (fpos <= usage_end) {
|
|
90
|
+
for (j=1;j<=NP;j++) emit(ln, PATHS[j], fl)
|
|
91
|
+
continue
|
|
92
|
+
}
|
|
93
|
+
# description flag: the nearest preceding verb token of this fragment's own group, else the
|
|
94
|
+
# fragment's command(s) — `board …(add [--allow-dup] …)` binds to `board add`, `perf …;--host …`
|
|
95
|
+
# to `perf`.
|
|
96
|
+
best=0
|
|
97
|
+
for (kk=1;kk<=NV;kk++) { p=lastwordpos(substr(frag, 1, fpos-1), VERBW_LIST[kk]); if (p>best) best=p }
|
|
98
|
+
bind=0
|
|
99
|
+
if (best > 0) {
|
|
100
|
+
for (kk=1;kk<=NV;kk++) {
|
|
101
|
+
w=VERBW_LIST[kk]
|
|
102
|
+
if (lastwordpos(substr(frag, 1, fpos-1), w) != best) continue
|
|
103
|
+
for (j=1;j<=NP;j++) if (PATHS[j] ~ ("(^| )" w "$")) { emit(ln, PATHS[j], fl); bind=1 }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (bind == 0) {
|
|
107
|
+
for (j=1;j<=NP;j++) emit(ln, PATHS[j], fl)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function expand_slash(frag, ln, np, parts, i, first, ok) {
|
|
112
|
+
np = split(frag, parts, / \/ /)
|
|
113
|
+
if (np > 1) {
|
|
114
|
+
ok=1
|
|
115
|
+
for (i=1;i<=np;i++) { first=parts[i]; sub(/^[ \t]+/,"",first); sub(/[ \t].*/,"",first); if (!(first in TOP)) ok=0 }
|
|
116
|
+
if (ok) { for (i=1;i<=np;i++) one_fragment(parts[i], ln); return }
|
|
117
|
+
}
|
|
118
|
+
one_fragment(frag, ln)
|
|
119
|
+
}
|
|
120
|
+
BEGIN {
|
|
121
|
+
n=split(tops, ta, " "); for (i=1;i<=n;i++) { gsub(/^[ \t]+|[ \t]+$/, "", ta[i]); if (ta[i]!="") TOP[ta[i]]=1 }
|
|
122
|
+
m=split(subs, sa, ";")
|
|
123
|
+
for (i=1;i<=m;i++) {
|
|
124
|
+
if (sa[i]=="") continue
|
|
125
|
+
if (split(sa[i], kv, ":") < 2) continue
|
|
126
|
+
p=kv[1]; gsub(/^[ \t]+|[ \t]+$/, "", p)
|
|
127
|
+
c=split(kv[2], sb, ",")
|
|
128
|
+
for (j=1;j<=c;j++) { gsub(/^[ \t]+|[ \t]+$/, "", sb[j]); if (sb[j]!="") SUB[p " " sb[j]]=1 }
|
|
129
|
+
}
|
|
130
|
+
inblock=0; lastindent=-1
|
|
131
|
+
}
|
|
132
|
+
{
|
|
133
|
+
line=$0
|
|
134
|
+
if (line ~ /^[ \t]*$/) next
|
|
135
|
+
if (line ~ /^[ \t]*──/) { inblock=1; lastindent=-1; next }
|
|
136
|
+
if (!inblock) next
|
|
137
|
+
m=match(line, /[^ \t]/); ind=m-1; rest=substr(line, m)
|
|
138
|
+
first=rest; sub(/[ \t].*/,"",first)
|
|
139
|
+
isentry = (first in TOP)
|
|
140
|
+
if (ind == 0) {
|
|
141
|
+
# 列 0 的行:命令块的正文一律缩进(对齐的续行更深)。
|
|
142
|
+
# · 打旗标的 → 无法归属(修复前的 board 形状:列 0 + [--allow-dup])→ 红;
|
|
143
|
+
# · 首 token 是命令的 → 未缩进的条目(形状约定是 2 空格)→ 红;
|
|
144
|
+
# · 其余(help 末尾的 配置:/协议: 页脚,不打印旗标)→ 块到此为止,忽略。
|
|
145
|
+
if (line ~ /--[a-z0-9-]+/) { fail(NR, "命令块里列 0 的行带着旗标(无法归属到任何条目):" rest) }
|
|
146
|
+
else if (isentry) { fail(NR, "命令块里的命令条目没有缩进(列 0):" rest) }
|
|
147
|
+
inblock=0; next
|
|
148
|
+
}
|
|
149
|
+
if (lastindent >= 0 && ind > lastindent) { next } # 缩进更深的行是上一条目的续行(哪怕它首 token 像个命令)
|
|
150
|
+
if (!isentry) {
|
|
151
|
+
fail(NR, "这一行既不是命令条目,也没有比上一条目缩进更深(无法归属):" rest)
|
|
152
|
+
next
|
|
153
|
+
}
|
|
154
|
+
lastindent=ind
|
|
155
|
+
printf "ENTRY\t%d\n", NR
|
|
156
|
+
# 全角分隔符在 bash 侧先换成 \x1f —— awk(mawk)按字节看字符类,直接写 [|/] 会在
|
|
157
|
+
# 任何中文 UTF-8 字节上乱切(实测把一行劈成单字碎片)。
|
|
158
|
+
nf = split($0, frags, "\037")
|
|
159
|
+
for (i=1;i<=nf;i++) expand_slash(frags[i], NR)
|
|
160
|
+
}
|
|
161
|
+
AWK
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
# mr_page_usage <page-file> → usage entries, one per line (continuations joined).
|
|
165
|
+
mr_page_usage() {
|
|
166
|
+
awk '
|
|
167
|
+
function indent(l) { m=match(l, /[^ ]/); return m-1 }
|
|
168
|
+
{ l=$0
|
|
169
|
+
if (l ~ /^[ \t]*$/) next
|
|
170
|
+
ind=indent(l)
|
|
171
|
+
if (l ~ /^──/) { inblock=1; lastindent=-1; cur=""; next }
|
|
172
|
+
if (!inblock) next
|
|
173
|
+
if (ind == 0) { if (cur!="") { print cur; cur="" }; inblock=0; next }
|
|
174
|
+
if (lastindent >= 0 && ind > lastindent && ind < 6) { if (cur != "") cur = cur " " substr(l, ind+1); next }
|
|
175
|
+
if (lastindent >= 0 && ind > lastindent) { next } # the description block: not part of the usage line
|
|
176
|
+
if (cur != "") print cur
|
|
177
|
+
cur=substr(l, ind+1); lastindent=ind
|
|
178
|
+
}
|
|
179
|
+
END { if (cur != "") print cur }
|
|
180
|
+
' "$1"
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
# mr_page_judge <kind> <label> <actual-page-file>
|
|
184
|
+
# The caller supplies n_pages/n_entries/n_claims and LEVEL_OK in its current shell.
|
|
185
|
+
# A nonempty page counts as read even when its contents have findings; an empty file does not.
|
|
186
|
+
mr_page_judge() {
|
|
187
|
+
local kind="$1" label="$2" page="$3"
|
|
188
|
+
local failed=0 declared printed want got extra gone ln rest
|
|
189
|
+
[ -s "$page" ] || { finding "walk: 帮助面缺一页($kind $label)"; return 1; }
|
|
190
|
+
n_pages=$((n_pages + 1))
|
|
191
|
+
if [ "$kind" = "command" ]; then
|
|
192
|
+
# The page's own usage header must be there (a deleted header is a defect, never a skip).
|
|
193
|
+
grep -qE '^── (Usage|用法)' "$page" || { finding "walk: $label 的页没有用法头部(Usage:/用法:)"; failed=1; }
|
|
194
|
+
declared="$(awk -F'\t' -v c="$label" '$1==c {print $2}' < <(mr_fragments) | sort)"
|
|
195
|
+
printed="$(mr_page_usage "$page" | sort)"
|
|
196
|
+
if [ "$declared" != "$printed" ]; then
|
|
197
|
+
extra="$(comm -13 <(printf '%s\n' "$declared") <(printf '%s\n' "$printed") | head -3 | paste -sd ' ' -)"
|
|
198
|
+
gone="$(comm -23 <(printf '%s\n' "$declared") <(printf '%s\n' "$printed") | head -3 | paste -sd ' ' -)"
|
|
199
|
+
finding "walk: $label 的页与清单不一致(页上多出:${extra:-无};页上缺少:${gone:-无})"
|
|
200
|
+
failed=1
|
|
201
|
+
fi
|
|
202
|
+
if printf '%s\n' "$printed" | grep -q -- '--ghost-probe\|--frobnicate-probe'; then
|
|
203
|
+
finding "walk: $label 的页打印了清单没有的旗标($(printf '%s\n' "$printed" | grep -- '--ghost-probe\|--frobnicate-probe' | head -1))"
|
|
204
|
+
failed=1
|
|
205
|
+
fi
|
|
206
|
+
LEVEL_OK[command]=1
|
|
207
|
+
elif [ "$kind" = "group" ]; then
|
|
208
|
+
want="$(awk -F'\t' -v g="$label" '$1=="cmd" && $3==g {n=split($4,f," ;; "); print f[1]}' "$(mr_manifest)" | sort)"
|
|
209
|
+
got="$(mr_page_usage "$page" | sort)"
|
|
210
|
+
if [ "$want" != "$got" ]; then
|
|
211
|
+
finding "walk: 组页 $label 与清单不一致($(diff <(printf '%s\n' "$want") <(printf '%s\n' "$got") | grep '^[<>]' | head -2 | tr '\n' ' '))"
|
|
212
|
+
failed=1
|
|
213
|
+
fi
|
|
214
|
+
LEVEL_OK[group]=1
|
|
215
|
+
else
|
|
216
|
+
want="$(mr_begin | tr ' ' '\n' | grep -v '^$' | sort)"
|
|
217
|
+
got="$(mr_page_usage "$page" | awk '{print $1}' | sort)"
|
|
218
|
+
if [ "$want" != "$got" ]; then
|
|
219
|
+
finding "walk: 菜单的上手命令与清单的 begin 行不一致($(diff <(printf '%s\n' "$want") <(printf '%s\n' "$got") | grep '^[<>]' | head -2 | tr '\n' ' '))"
|
|
220
|
+
failed=1
|
|
221
|
+
fi
|
|
222
|
+
LEVEL_OK[menu]=1
|
|
223
|
+
fi
|
|
224
|
+
# The same parser reads every level (block rules unchanged).
|
|
225
|
+
awk -v tops="$MRI_TOPS" -v subs="$MRI_SUBS" -f "$tmp/walk-a.awk" "$page" > "$tmp/page-claims.tsv" 2>/dev/null
|
|
226
|
+
while IFS=$'\t' read -r _ ln rest; do
|
|
227
|
+
finding "walk: $kind $label 的第 $ln 行无法归属(解析器拒绝静默跳过):$rest"
|
|
228
|
+
failed=1
|
|
229
|
+
done < <(grep -a '^FAIL' "$tmp/page-claims.tsv")
|
|
230
|
+
n_entries=$((n_entries + $(grep -ac '^ENTRY' "$tmp/page-claims.tsv" || true)))
|
|
231
|
+
n_claims=$((n_claims + $(grep -ac '^CLAIM' "$tmp/page-claims.tsv" || true)))
|
|
232
|
+
ok "walk: $kind $label 判过($(grep -ac '^ENTRY' "$tmp/page-claims.tsv" || true) 条用法行,$(grep -ac '^CLAIM' "$tmp/page-claims.tsv" || true) 条断言)"
|
|
233
|
+
[ "$failed" -eq 0 ]
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
# Finish level judgement over the nonempty pages actually opened by mr_page_judge.
|
|
237
|
+
mr_level_finish() {
|
|
238
|
+
local failed=0 lv
|
|
239
|
+
for lv in menu group command; do
|
|
240
|
+
[ -n "${LEVEL_OK[$lv]:-}" ] || { finding "walk: $lv 这一级一条都没被判到(静默漏读)"; failed=1; }
|
|
241
|
+
done
|
|
242
|
+
[ "$failed" -eq 0 ]
|
|
243
|
+
}
|
|
@@ -12,6 +12,9 @@ panel-b3.sh 173 cap="$i" -le "${B3_CAP_ITERS:-600}" while [ "$i" -le "${B3_CAP
|
|
|
12
12
|
panel-cpu.sh 248 bound=sub_end 计算出的截止时间(到点自己退出) while :; do
|
|
13
13
|
panel-p21.sh 1813 cap="$_i" -le 15 while [ "$_i" -le 15 ]; do
|
|
14
14
|
pm-box-real.sh 175 cap="$i" -lt "$READY_TRIES" while [ "$i" -lt "$READY_TRIES" ]; do
|
|
15
|
+
remind-pulse.sh 50 cap="$tries" -gt 0 while [ "$tries" -gt 0 ]; do
|
|
16
|
+
remind-tool-real.sh 37 bound=逐行消费调用时已固定的进程身份快照(done <<< "$1"),读到 EOF 结束;内层共用入口的 SECONDS + 10 截止时间,超时直接返回 while IFS=: read -r pid started; do
|
|
17
|
+
remind-tool-real.sh 39 cap=SECONDS >= deadline while [[ -d "/proc/$pid" ]]; do
|
|
15
18
|
smoke.sh 226 cap="$SNAP_W" -lt 50 SNAP_W=0; while kill -0 "$SNAP_CHILD" 2>/dev/null && [ "$SNAP_W" -lt 50 ]; do sleep 0.2; SNAP_W=$((SNAP_W + 1)); done
|
|
16
19
|
smoke.sh 503 bound=等待者的耐心上限 lock_cap(每轮跟着持有者心跳现算:活 4W / 停或没有 W;到点 break 进超限分支) while :; do
|
|
17
20
|
smoke.sh 1277 bound=停止位文件 SMOKE_TMP_STOP + 主 shell 寿命(M33 哨兵的文件握手) while [ ! -e "$SMOKE_TMP_STOP" ]; do
|
|
@@ -644,11 +644,12 @@ scenario_clipboard() {
|
|
|
644
644
|
cond_skip "B4 模型夹具" "本机没有 bun"
|
|
645
645
|
fi
|
|
646
646
|
|
|
647
|
-
# The fake tools
|
|
647
|
+
# The fake tools log every real call and read this fixture's current mode input each time.
|
|
648
648
|
cat > "$fx/fakebin/wl-paste" <<'EOWS'
|
|
649
649
|
#!/usr/bin/env bash
|
|
650
650
|
printf 'wl-paste %s\n' "$*" >> "$P20_CLIP_LOG"
|
|
651
|
-
|
|
651
|
+
IFS= read -r mode < "$P20_WL_MODE_FILE" || exit 1
|
|
652
|
+
case "$mode" in
|
|
652
653
|
image)
|
|
653
654
|
case "$1" in
|
|
654
655
|
--list-types) printf 'text/plain;charset=utf-8\nimage/png\n' ;;
|
|
@@ -668,29 +669,69 @@ EOWS
|
|
|
668
669
|
cat > "$fx/fakebin/xclip" <<'EOXC'
|
|
669
670
|
#!/usr/bin/env bash
|
|
670
671
|
printf 'xclip %s\n' "$*" >> "$P20_CLIP_LOG"
|
|
671
|
-
|
|
672
|
+
IFS= read -r mode < "$P20_X_MODE_FILE" || exit 1
|
|
673
|
+
case "$mode" in
|
|
672
674
|
image) case "$*" in *TARGETS*) printf 'image/png\n' ;; *) printf 'XCLIPDATA' ;; esac ;;
|
|
673
675
|
*) exit 1 ;;
|
|
674
676
|
esac
|
|
675
677
|
EOXC
|
|
676
678
|
chmod +x "$fx/fakebin/wl-paste" "$fx/fakebin/xclip"
|
|
677
679
|
|
|
678
|
-
|
|
679
|
-
printf '
|
|
680
|
-
|
|
680
|
+
clip_modes() { # <wl mode> <x mode>; change only after the preceding probe and edits finish
|
|
681
|
+
printf '%s\n' "$1" > "$fx/wl-mode"
|
|
682
|
+
printf '%s\n' "$2" > "$fx/x-mode"
|
|
683
|
+
}
|
|
684
|
+
clip_env() { # the same input paths for every retained panel start
|
|
685
|
+
printf 'PATH=%s:%s TMPDIR=%s P20_CLIP_LOG=%s P20_WL_MODE_FILE=%s P20_X_MODE_FILE=%s' \
|
|
686
|
+
"$fx/fakebin" "$PATH" "$fx/tmpdir" "$fx/calls.log" "$fx/wl-mode" "$fx/x-mode"
|
|
681
687
|
}
|
|
682
688
|
pasted_file() { ls "$fx/tmpdir"/teamsmith-paste-* 2>/dev/null | head -1; }
|
|
683
689
|
paste_count() { ls "$fx/tmpdir" 2>/dev/null | grep -c 'teamsmith-paste-' || true; }
|
|
684
690
|
reset_clip() { rm -f "$fx/tmpdir"/teamsmith-paste-*; : > "$fx/calls.log"; }
|
|
685
691
|
|
|
692
|
+
# 理由行里要有**整条**路径 —— 但路径比一行宽时产品会折行画出(P309 起临时根就比 120 列面板宽:夹具这条
|
|
693
|
+
# 156 列 > 可用的 116 列),逐行 grep 整条路径会把一条真的存在的事实判红。所以先把**理由框自己那几行**
|
|
694
|
+
# (标题行之后连续的 `│ ` 行,止于第一行别的东西)按画出的顺序拼回一行,再在这段文字里找整条路径:框外
|
|
695
|
+
# 的行不进这段文字,别处的路径顶替不了;路径为空时这条直接红,不会退化成 `grep -F ''` 的通真。
|
|
696
|
+
reason_text() { # <capture> → 待命原因框里被画的完整文本(拼成一行)
|
|
697
|
+
awk '/待命原因/{inbox=1; next}
|
|
698
|
+
inbox && /^│ /{sub(/^│ /,""); sub(/^> /,""); sub(/^ +/,""); out=out $0; next}
|
|
699
|
+
inbox{exit}
|
|
700
|
+
END{printf "%s", out}' "$1"
|
|
701
|
+
}
|
|
702
|
+
# 只在本次等待的子 shell 里绑定回调;原可见帧不变,ready 必须来自实际图片及相应正文。
|
|
703
|
+
# 引擎的 rc 直接回父调用方计失败,不指望子 shell 的 PTY_WAIT_FAILED 传回。
|
|
704
|
+
wait_clip_image() ( # <label> <PNG bytes> <draft|reason>
|
|
705
|
+
local label="$1" expected="$2" kind="$3"
|
|
706
|
+
pty_cap() {
|
|
707
|
+
local frame file ready=0
|
|
708
|
+
frame="$(cap_visible)"
|
|
709
|
+
printf '%s\n' "$frame"
|
|
710
|
+
file="$(pasted_file)"
|
|
711
|
+
if [ -n "$file" ] && [ -f "$file" ] && [ "$(cat "$file")" = "$expected" ]; then
|
|
712
|
+
case "$kind" in
|
|
713
|
+
draft) [ "$(draft)" = "a${file}d" ] && ready=1 ;;
|
|
714
|
+
reason)
|
|
715
|
+
[ "$(draft)" = 'half a thought' ] \
|
|
716
|
+
&& [ "$(reason_text <(printf '%s\n' "$frame"))" = "why${file}" ] && ready=1 ;;
|
|
717
|
+
esac
|
|
718
|
+
fi
|
|
719
|
+
[ "$ready" -eq 1 ] && printf '@@clipboard %s %s ready @@\n' "$expected" "$kind"
|
|
720
|
+
return 0
|
|
721
|
+
}
|
|
722
|
+
pty_wait_frame - "$label" "@@clipboard $expected $kind ready @@"
|
|
723
|
+
)
|
|
724
|
+
|
|
686
725
|
# ① 图片 → 临时文件路径,插在插入点;Wayland 优先且 xclip 不被调用
|
|
687
726
|
printf 'ad' > "$(draft_file)"
|
|
688
727
|
reset_clip
|
|
689
728
|
start_pm '' ''
|
|
690
|
-
|
|
729
|
+
clip_modes image image
|
|
730
|
+
start_panel "$(clip_env)"
|
|
691
731
|
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
692
732
|
keys Left
|
|
693
|
-
keys C-v
|
|
733
|
+
keys C-v
|
|
734
|
+
wait_clip_image "B4 图片落成临时文件路径" PNGDATA8 draft || bad "B4 图片落成临时文件路径:未等到 PNGDATA8 和 a<path>d"
|
|
694
735
|
cap_to image
|
|
695
736
|
local file
|
|
696
737
|
file="$(pasted_file)"
|
|
@@ -707,12 +748,19 @@ EOXC
|
|
|
707
748
|
|
|
708
749
|
# ② Wayland 失败 → X11:仍成图,调用日志里 wl-paste 在 xclip 之前
|
|
709
750
|
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
710
|
-
printf 'ad' > "$(draft_file)"
|
|
711
751
|
reset_clip
|
|
712
|
-
|
|
752
|
+
clip_modes fail image
|
|
713
753
|
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
754
|
+
keys C-e; keys C-u
|
|
755
|
+
type_text 'ad'
|
|
756
|
+
wait_draft "B4 X11 准备:完整草稿 ad" 'ad'
|
|
757
|
+
if [ "$PTY_WAIT_FAILED" -ne 0 ]; then
|
|
758
|
+
bad "B4 X11 准备:未等到完整草稿 ad"
|
|
759
|
+
return 1
|
|
760
|
+
fi
|
|
714
761
|
keys Left
|
|
715
|
-
keys C-v
|
|
762
|
+
keys C-v
|
|
763
|
+
wait_clip_image "B4 Wayland 失败后 X11 回退成图" XCLIPDATA draft || bad "B4 Wayland 失败后 X11 回退成图:未等到 XCLIPDATA 和 a<path>d"
|
|
716
764
|
cap_to x11
|
|
717
765
|
file="$(pasted_file)"
|
|
718
766
|
assert_eq "B4 X11 回退:文件内容 XCLIPDATA" "$(cat "$file" 2>/dev/null)" "XCLIPDATA"
|
|
@@ -728,10 +776,16 @@ EOXC
|
|
|
728
776
|
|
|
729
777
|
# ③ 无图片 → 文本回退,且不调用 xclip
|
|
730
778
|
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
731
|
-
printf 'ad' > "$(draft_file)"
|
|
732
779
|
reset_clip
|
|
733
|
-
|
|
780
|
+
clip_modes text image
|
|
734
781
|
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
782
|
+
keys C-e; keys C-u
|
|
783
|
+
type_text 'ad'
|
|
784
|
+
wait_draft "B4 文本回退准备:完整草稿 ad" 'ad'
|
|
785
|
+
if [ "$PTY_WAIT_FAILED" -ne 0 ]; then
|
|
786
|
+
bad "B4 文本回退准备:未等到完整草稿 ad"
|
|
787
|
+
return 1
|
|
788
|
+
fi
|
|
735
789
|
keys Left
|
|
736
790
|
keys C-v; wait_frame "B4 文本回退进草稿" '> afrom the clipboardd'
|
|
737
791
|
cap_to text-fallback
|
|
@@ -741,10 +795,16 @@ EOXC
|
|
|
741
795
|
|
|
742
796
|
# ④ 两个工具都不给东西:什么都不变;挂死的工具在界内被放弃
|
|
743
797
|
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
744
|
-
printf 'half a thought' > "$(draft_file)"
|
|
745
798
|
reset_clip
|
|
746
|
-
|
|
799
|
+
clip_modes fail fail
|
|
747
800
|
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
801
|
+
keys C-e; keys C-u
|
|
802
|
+
type_text 'half a thought'
|
|
803
|
+
wait_draft "B4 无工具准备:完整草稿 half a thought" 'half a thought'
|
|
804
|
+
if [ "$PTY_WAIT_FAILED" -ne 0 ]; then
|
|
805
|
+
bad "B4 无工具准备:未等到完整草稿 half a thought"
|
|
806
|
+
return 1
|
|
807
|
+
fi
|
|
748
808
|
keys C-v; wait_draft "B4 无工具:探测什么都不改" 'half a thought'
|
|
749
809
|
cap_to no-tool
|
|
750
810
|
assert_eq "B4 无工具:草稿不变" "$(draft)" "half a thought"
|
|
@@ -754,10 +814,16 @@ EOXC
|
|
|
754
814
|
assert_eq "B4 无工具后仍能打字" "$(draft)" "half a thoughtZ"
|
|
755
815
|
|
|
756
816
|
keys Escape; wait_frame "B4 写信收起" '!Enter 发送'
|
|
757
|
-
printf 'half a thought' > "$(draft_file)"
|
|
758
817
|
reset_clip
|
|
759
|
-
|
|
818
|
+
clip_modes hang fail
|
|
760
819
|
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
820
|
+
keys C-e; keys C-u
|
|
821
|
+
type_text 'half a thought'
|
|
822
|
+
wait_draft "B4 挂死工具准备:完整草稿 half a thought" 'half a thought'
|
|
823
|
+
if [ "$PTY_WAIT_FAILED" -ne 0 ]; then
|
|
824
|
+
bad "B4 挂死工具准备:未等到完整草稿 half a thought"
|
|
825
|
+
return 1
|
|
826
|
+
fi
|
|
761
827
|
# 保留(P336):挂死的工具下探测的结果是「什么都不发生」——没有回执行、没有文件、没有忙行,
|
|
762
828
|
# 它的“结束”无处可观测;而这条要证明的正是「工具企着的时候面板照旧可输入」,所以 Z 必须落在
|
|
763
829
|
# 工具还在挂的时候,这段空闲窗口不是等一个状态。
|
|
@@ -773,22 +839,14 @@ EOXC
|
|
|
773
839
|
# ⑤ 理由模式:路径进理由行,消息草稿不动
|
|
774
840
|
printf 'half a thought' > "$(draft_file)"
|
|
775
841
|
reset_clip
|
|
776
|
-
|
|
842
|
+
clip_modes image image
|
|
843
|
+
start_panel "$(clip_env)"
|
|
777
844
|
keys s; wait_frame "B4 待命理由输入行" 'Enter 进入待命'
|
|
778
845
|
type_text 'why'
|
|
779
|
-
keys C-v
|
|
846
|
+
keys C-v
|
|
847
|
+
wait_clip_image "B4 理由行里出现图片路径" PNGDATA8 reason || bad "B4 理由行里出现图片路径:未等到 why<path> 和原消息草稿"
|
|
780
848
|
cap_to reason
|
|
781
849
|
file="$(pasted_file)"
|
|
782
|
-
# 理由行里要有**整条**路径 —— 但路径比一行宽时产品会折行画出(P309 起临时根就比 120 列面板宽:夹具这条
|
|
783
|
-
# 156 列 > 可用的 116 列),逐行 grep 整条路径会把一条真的存在的事实判红。所以先把**理由框自己那几行**
|
|
784
|
-
# (标题行之后连续的 `│ ` 行,止于第一行别的东西)按画出的顺序拼回一行,再在这段文字里找整条路径:框外
|
|
785
|
-
# 的行不进这段文字,别处的路径顶替不了;路径为空时这条直接红,不会退化成 `grep -F ''` 的通真。
|
|
786
|
-
reason_text() { # <capture> → 待命原因框里被画的完整文本(拼成一行)
|
|
787
|
-
awk '/待命原因/{inbox=1; next}
|
|
788
|
-
inbox && /^│ /{sub(/^│ /,""); sub(/^> /,""); sub(/^ +/,""); out=out $0; next}
|
|
789
|
-
inbox{exit}
|
|
790
|
-
END{printf "%s", out}' "$1"
|
|
791
|
-
}
|
|
792
850
|
if [ -z "$file" ]; then
|
|
793
851
|
bad "B4 理由行里有图片路径(理由模式没有文件落地:路径为空)"
|
|
794
852
|
else
|
|
@@ -809,9 +867,10 @@ EOS
|
|
|
809
867
|
printf 'ad' > "$(draft_file)"
|
|
810
868
|
reset_clip
|
|
811
869
|
: > "$fx/team.log"
|
|
870
|
+
clip_modes image image
|
|
812
871
|
tmux -L "$sock" kill-window -t "$sess:panel" 2>/dev/null || true
|
|
813
872
|
tmux -L "$sock" new-window -d -t "$sess" -n panel -c "$ROOT" \
|
|
814
|
-
"TEAM_JS_BIN=$(printf '%q' "$js") $(clip_env
|
|
873
|
+
"TEAM_JS_BIN=$(printf '%q' "$js") $(clip_env) exec '$js' '$panel' --root '$ROOT' --team-cli '$fx/teamwrap.sh' --state-dir '$ROOT/.pi/team/state' --no-pulse --interval 1"
|
|
815
874
|
wait_panel
|
|
816
875
|
keys m; wait_frame "B4 写信托盘" 'Enter 发送'
|
|
817
876
|
keys Left
|
|
@@ -827,7 +886,8 @@ EOS
|
|
|
827
886
|
# 「窗口过去了」自己);两段 5s 就是被测的长度。
|
|
828
887
|
reset_clip
|
|
829
888
|
: > "$fx/calls.log"
|
|
830
|
-
|
|
889
|
+
clip_modes image image
|
|
890
|
+
start_panel "$(clip_env)"
|
|
831
891
|
sleep 5
|
|
832
892
|
local idle_idle idle_compose
|
|
833
893
|
idle_idle="$(wc -l < "$fx/calls.log" | tr -d ' ')"
|
|
@@ -349,8 +349,14 @@ closed" ;;
|
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
# pulse-key-replies 的固定回复块(stub 面;见上面的三条 case)。
|
|
352
|
+
# 时间默认不变;P436 用同一固定 UTC 输入切换 TZ,并可注入非法值或省略字段验证显示降级。
|
|
353
|
+
reply_at_json() {
|
|
354
|
+
[ "${B3_STUB_REPLY_AT_OMIT:-0}" = "1" ] && return 0
|
|
355
|
+
printf '"at": %s, ' "$(json_str "${B3_STUB_REPLY_AT:-2026-09-16T09:59:00Z}")"
|
|
356
|
+
}
|
|
352
357
|
reply_entry_json() {
|
|
353
|
-
printf '{"no": 1, "available": true, "title": "固定关键回复", "from": "dev2", "
|
|
358
|
+
printf '{"no": 1, "available": true, "title": "固定关键回复", "from": "dev2", %s"bytes": 24, "sha256": "%s"}' \
|
|
359
|
+
"$(reply_at_json)" "$(printf 'a%.0s' {1..64})"
|
|
354
360
|
}
|
|
355
361
|
reply_summary_json() {
|
|
356
362
|
case "${B3_STUB_REPLY:-empty}" in
|
|
@@ -367,7 +373,8 @@ reply_list_json() {
|
|
|
367
373
|
esac
|
|
368
374
|
}
|
|
369
375
|
reply_body_json() {
|
|
370
|
-
printf '
|
|
376
|
+
printf '{"no": 1, "available": true, "title": "固定关键回复", "from": "dev2", %s"bytes": 24, "sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "text_kind": "safe-display", "display_text": %s}\n' \
|
|
377
|
+
"$(reply_at_json)" "$(json_str_ml $'固定回复正文\n第二行\n')"
|
|
371
378
|
}
|
|
372
379
|
|
|
373
380
|
case "$block" in
|