teamsmith 0.0.0-stage → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +158 -2
- package/bin/team.mjs +59 -0
- package/install.sh +94 -0
- package/package.json +37 -4
- package/skills/teamsmith/CHANGELOG.md +763 -0
- package/skills/teamsmith/SKILL.md +312 -0
- package/skills/teamsmith/extension/team-bg.ts +435 -0
- package/skills/teamsmith/extension/team-inbox-watch.ts +1412 -0
- package/skills/teamsmith/extension/team-notify.ts +663 -0
- package/skills/teamsmith/references/agent-adapters.md +643 -0
- package/skills/teamsmith/references/config.md +477 -0
- package/skills/teamsmith/references/meeting.md +124 -0
- package/skills/teamsmith/references/memory.md +133 -0
- package/skills/teamsmith/references/migration.md +227 -0
- package/skills/teamsmith/references/openspec.md +222 -0
- package/skills/teamsmith/references/philosophy.md +95 -0
- package/skills/teamsmith/references/protocol.md +712 -0
- package/skills/teamsmith/references/troubleshooting.md +1384 -0
- package/skills/teamsmith/references/workflows.md +448 -0
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +1709 -0
- package/skills/teamsmith/scripts/lib/cmd-bg.sh +284 -0
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +311 -0
- package/skills/teamsmith/scripts/lib/cmd-config.sh +1156 -0
- package/skills/teamsmith/scripts/lib/cmd-death.sh +562 -0
- package/skills/teamsmith/scripts/lib/cmd-docs.sh +149 -0
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +124 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +212 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +904 -0
- package/skills/teamsmith/scripts/lib/cmd-outbox.sh +196 -0
- package/skills/teamsmith/scripts/lib/cmd-project.sh +642 -0
- package/skills/teamsmith/scripts/lib/cmd-review.sh +1393 -0
- package/skills/teamsmith/scripts/lib/cmd-status.sh +1399 -0
- package/skills/teamsmith/scripts/lib/cmd-update.sh +191 -0
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +1681 -0
- package/skills/teamsmith/scripts/lib/common.sh +4964 -0
- package/skills/teamsmith/scripts/lib/draft-entry.sh +51 -0
- package/skills/teamsmith/scripts/lib/outbox.sh +2042 -0
- package/skills/teamsmith/scripts/lib/tmux-argv.sh +165 -0
- package/skills/teamsmith/scripts/monitor.mjs +616 -0
- package/skills/teamsmith/scripts/panel/README.md +192 -0
- package/skills/teamsmith/scripts/panel/build.sh +47 -0
- package/skills/teamsmith/scripts/panel/bun.lock +109 -0
- package/skills/teamsmith/scripts/panel/draft-send.sh +68 -0
- package/skills/teamsmith/scripts/panel/package.json +24 -0
- package/skills/teamsmith/scripts/panel/panel.js +388 -0
- package/skills/teamsmith/scripts/panel/src/App.tsx +2150 -0
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +154 -0
- package/skills/teamsmith/scripts/panel/src/compose.ts +691 -0
- package/skills/teamsmith/scripts/panel/src/data.ts +555 -0
- package/skills/teamsmith/scripts/panel/src/format.ts +50 -0
- package/skills/teamsmith/scripts/panel/src/layout.ts +2562 -0
- package/skills/teamsmith/scripts/panel/src/main.tsx +894 -0
- package/skills/teamsmith/scripts/panel/src/markdown.ts +340 -0
- package/skills/teamsmith/scripts/panel/src/sanitize.ts +42 -0
- package/skills/teamsmith/scripts/panel/src/settings.ts +154 -0
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +416 -0
- package/skills/teamsmith/scripts/panel/src/strings/index.ts +65 -0
- package/skills/teamsmith/scripts/panel/src/strings/types.ts +9 -0
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +414 -0
- package/skills/teamsmith/scripts/panel/src/theme.ts +116 -0
- package/skills/teamsmith/scripts/panel/src/types.ts +652 -0
- package/skills/teamsmith/scripts/panel/src/width.ts +105 -0
- package/skills/teamsmith/scripts/panel/tsconfig.json +16 -0
- package/skills/teamsmith/scripts/shim/signal-gate +156 -0
- package/skills/teamsmith/scripts/shim/tmux +403 -0
- package/skills/teamsmith/scripts/team +143 -0
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +147 -0
- package/skills/teamsmith/templates/BOARD.md.tmpl +18 -0
- package/skills/teamsmith/templates/DECISIONS.md.tmpl +22 -0
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +25 -0
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +84 -0
- package/skills/teamsmith/templates/ROADMAP.md.tmpl +29 -0
- package/skills/teamsmith/templates/config.sh.tmpl +106 -0
- package/skills/teamsmith/templates/memory-seed.md.tmpl +46 -0
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +110 -0
- package/skills/teamsmith/templates/report.md.tmpl +36 -0
- package/skills/teamsmith/templates/task.md.tmpl +65 -0
- package/skills/teamsmith/templates/threads-README.md +17 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +682 -0
- package/skills/teamsmith/tests/bg-ledger.sh +307 -0
- package/skills/teamsmith/tests/checkout-shape-probe.sh +800 -0
- package/skills/teamsmith/tests/config-cli.sh +1562 -0
- package/skills/teamsmith/tests/container-tmux.sh +493 -0
- package/skills/teamsmith/tests/coverage-inventory.sh +173 -0
- package/skills/teamsmith/tests/death-cause.sh +564 -0
- package/skills/teamsmith/tests/delivery-truth.sh +1231 -0
- package/skills/teamsmith/tests/fake-tui.py +450 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/README.md +60 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-second.py +139 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/mock-server.py +29 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/observe.ts +20 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh +79 -0
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +175 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +229 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/README.md +22 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/dev2.seen +8 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/dev2.wake +9 -0
- package/skills/teamsmith/tests/fixtures/p71-incident/pm-nudges.wake +3 -0
- package/skills/teamsmith/tests/fixtures/signal-lint-cases.txt +40 -0
- package/skills/teamsmith/tests/flip-glue.sh +162 -0
- package/skills/teamsmith/tests/flip-m12-26c.sh +129 -0
- package/skills/teamsmith/tests/flip-m12.sh +185 -0
- package/skills/teamsmith/tests/flip-m16.sh +166 -0
- package/skills/teamsmith/tests/flip-m17.sh +204 -0
- package/skills/teamsmith/tests/flip-m33.sh +284 -0
- package/skills/teamsmith/tests/flip-m34.sh +96 -0
- package/skills/teamsmith/tests/flip-m37.sh +185 -0
- package/skills/teamsmith/tests/flip-m4.3.sh +375 -0
- package/skills/teamsmith/tests/flip-m43.sh +128 -0
- package/skills/teamsmith/tests/flip-m44.sh +262 -0
- package/skills/teamsmith/tests/flip-m45.sh +244 -0
- package/skills/teamsmith/tests/flip-m46.sh +238 -0
- package/skills/teamsmith/tests/flip-m48.sh +304 -0
- package/skills/teamsmith/tests/flip-m6.2.sh +205 -0
- package/skills/teamsmith/tests/flip-m6.3.sh +283 -0
- package/skills/teamsmith/tests/flip-m6.4.sh +267 -0
- package/skills/teamsmith/tests/flip-m6.5.sh +113 -0
- package/skills/teamsmith/tests/flip-m7.1.sh +135 -0
- package/skills/teamsmith/tests/flip-m7.2.sh +321 -0
- package/skills/teamsmith/tests/flip-p144.sh +112 -0
- package/skills/teamsmith/tests/flip-p156.sh +133 -0
- package/skills/teamsmith/tests/flip-p158.sh +301 -0
- package/skills/teamsmith/tests/flip-p160.sh +182 -0
- package/skills/teamsmith/tests/flip-p171.sh +249 -0
- package/skills/teamsmith/tests/flip-p18.1.sh +95 -0
- package/skills/teamsmith/tests/flip-p20.sh +286 -0
- package/skills/teamsmith/tests/flip-p201.sh +249 -0
- package/skills/teamsmith/tests/flip-p210.sh +239 -0
- package/skills/teamsmith/tests/flip-p211.sh +152 -0
- package/skills/teamsmith/tests/flip-p217.sh +288 -0
- package/skills/teamsmith/tests/flip-p22.sh +123 -0
- package/skills/teamsmith/tests/flip-p23.sh +239 -0
- package/skills/teamsmith/tests/flip-p25.sh +165 -0
- package/skills/teamsmith/tests/flip-p71.sh +184 -0
- package/skills/teamsmith/tests/flip-p72.sh +202 -0
- package/skills/teamsmith/tests/frames/README.md +176 -0
- package/skills/teamsmith/tests/frames/p78-conversation-rule-below-box.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-cursor-mid-draft.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor-line.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-blank-region.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-draft-rule-only.txt +5 -0
- package/skills/teamsmith/tests/frames/p78-spinner-row-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p78-wider-rule-below-cursor.txt +6 -0
- package/skills/teamsmith/tests/frames/p86-f1-mixed-width-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/p86-f1-narrower-width-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/p86-f1-spinner-top-disjoint-box.txt +8 -0
- package/skills/teamsmith/tests/frames/pi-0.85.1-update-banner.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-draft-half-sentence.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-empty-box.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-one-line-draft.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.87.0-project-trust-prompt.txt +30 -0
- package/skills/teamsmith/tests/frames/pi-0.99.2-empty-editor.txt +32 -0
- package/skills/teamsmith/tests/frames/pi-0.99.2-human-draft.txt +32 -0
- package/skills/teamsmith/tests/frames/pi-1.0.0-git-error-in-box.txt +32 -0
- package/skills/teamsmith/tests/gate-guard.sh +112 -0
- package/skills/teamsmith/tests/guard-matrix.sh +233 -0
- package/skills/teamsmith/tests/install-shape.sh +731 -0
- package/skills/teamsmith/tests/ledger-ban.sh +612 -0
- package/skills/teamsmith/tests/lib/box-judge.sh +68 -0
- package/skills/teamsmith/tests/lib/checkout-shape.sh +129 -0
- package/skills/teamsmith/tests/lib/loop-scan.awk +114 -0
- package/skills/teamsmith/tests/lib/pty-wait.sh +676 -0
- package/skills/teamsmith/tests/lib/section-guard.sh +855 -0
- package/skills/teamsmith/tests/lib/shell-lex.pl +261 -0
- package/skills/teamsmith/tests/lib/tmp-root.sh +528 -0
- package/skills/teamsmith/tests/lib/tmux-cap.sh +35 -0
- package/skills/teamsmith/tests/lib/tmux-iso-call-probe.sh +81 -0
- package/skills/teamsmith/tests/lib/tmux-iso-probe.sh +46 -0
- package/skills/teamsmith/tests/lib/tmux-iso.sh +381 -0
- package/skills/teamsmith/tests/load-experiment.sh +290 -0
- package/skills/teamsmith/tests/loop-inventory.tsv +84 -0
- package/skills/teamsmith/tests/panel-b2-slow-stub.sh +19 -0
- package/skills/teamsmith/tests/panel-b2.sh +1183 -0
- package/skills/teamsmith/tests/panel-b3-pty-mouse.py +240 -0
- package/skills/teamsmith/tests/panel-b3-pty-tmux-mouse.py +138 -0
- package/skills/teamsmith/tests/panel-b3-stub.sh +279 -0
- package/skills/teamsmith/tests/panel-b3.sh +1301 -0
- package/skills/teamsmith/tests/panel-choices.sh +572 -0
- package/skills/teamsmith/tests/panel-clipboard-model.ts +187 -0
- package/skills/teamsmith/tests/panel-compose-model.ts +290 -0
- package/skills/teamsmith/tests/panel-contrast.mjs +81 -0
- package/skills/teamsmith/tests/panel-cpu-premise.sh +173 -0
- package/skills/teamsmith/tests/panel-cpu.sh +391 -0
- package/skills/teamsmith/tests/panel-flip-m54.sh +207 -0
- package/skills/teamsmith/tests/panel-flip-p123.sh +278 -0
- package/skills/teamsmith/tests/panel-flip-p125.sh +318 -0
- package/skills/teamsmith/tests/panel-flip-p128.sh +259 -0
- package/skills/teamsmith/tests/panel-keyprobe-pty.py +99 -0
- package/skills/teamsmith/tests/panel-keyprobe-stub.sh +41 -0
- package/skills/teamsmith/tests/panel-keyprobe.sh +82 -0
- package/skills/teamsmith/tests/panel-keyprobe.tsx +116 -0
- package/skills/teamsmith/tests/panel-knobs.sh +83 -0
- package/skills/teamsmith/tests/panel-p21.sh +2181 -0
- package/skills/teamsmith/tests/panel-snapshots.sh +802 -0
- package/skills/teamsmith/tests/panel-strings.mjs +195 -0
- package/skills/teamsmith/tests/perf.sh +740 -0
- package/skills/teamsmith/tests/pm-box-real.sh +350 -0
- package/skills/teamsmith/tests/pulse-nudge-key.sh +563 -0
- package/skills/teamsmith/tests/routes.sh +1652 -0
- package/skills/teamsmith/tests/section-budgets.tsv +150 -0
- package/skills/teamsmith/tests/section-guard.sh +231 -0
- package/skills/teamsmith/tests/section-needs-audit.sh +94 -0
- package/skills/teamsmith/tests/section-paths.tsv +142 -0
- package/skills/teamsmith/tests/section-select.sh +655 -0
- package/skills/teamsmith/tests/signal-gate.sh +366 -0
- package/skills/teamsmith/tests/signal-lint-legacy.txt +14 -0
- package/skills/teamsmith/tests/signal-lint.pl +416 -0
- package/skills/teamsmith/tests/skill-load.mjs +65 -0
- package/skills/teamsmith/tests/smoke.sh +19711 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-120.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-160.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-59.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +32 -0
- package/skills/teamsmith/tests/snapshots/zh-light-99.txt +32 -0
- package/skills/teamsmith/tests/spec-ledger-refs.tsv +78 -0
- package/skills/teamsmith/tests/spec-refs.sh +826 -0
- package/skills/teamsmith/tests/task-header-model.sh +267 -0
- package/skills/teamsmith/tests/team-bg-flip.sh +239 -0
- package/skills/teamsmith/tests/team-bg-harness.mjs +392 -0
- package/skills/teamsmith/tests/team-bg-stop.sh +434 -0
- package/skills/teamsmith/tests/team-inbox-watch-flip.sh +191 -0
- package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +1559 -0
- package/skills/teamsmith/tests/tmp-hygiene.sh +1190 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +31 -0
- package/skills/teamsmith/tests/tmux-lint.pl +604 -0
- package/skills/teamsmith-init/SKILL.md +100 -0
- package/skills/teamsmith-init/references/bootstrap.md +74 -0
- package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +46 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Snapshot suite for the console layout (pulse-console B3, tasks.md 5.3 / the spec's "The layout is
|
|
3
|
+
# a pure function of geometry with four width tiers").
|
|
4
|
+
#
|
|
5
|
+
# bash skills/teamsmith/tests/panel-snapshots.sh # compare against tests/snapshots/
|
|
6
|
+
# bash skills/teamsmith/tests/panel-snapshots.sh --update # re-pin the snapshots (maintainer)
|
|
7
|
+
#
|
|
8
|
+
# Four widths — 160 (two columns), 120 (compact two columns), 99 (one column) and 59 (the minimal
|
|
9
|
+
# form) — × both themes, each rendered through `panel.js --snapshot` against the deterministic block
|
|
10
|
+
# stub (fixed timestamp, fixed ages) and compared byte for byte. A themed frame carries its SGR
|
|
11
|
+
# bytes, so the two palettes are pinned too, not just the text.
|
|
12
|
+
#
|
|
13
|
+
# Exit: 0 every snapshot matches, 1 at least one mismatch, 3 setup failure.
|
|
14
|
+
set -uo pipefail
|
|
15
|
+
|
|
16
|
+
here="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
+
# P53:临时根的唯一创建者(${TMPDIR:-/tmp} + owned 家族 + 回收)
|
|
18
|
+
. "$here/lib/tmp-root.sh"
|
|
19
|
+
tree="${TEAM_SNAPSHOTS_TREE:-$(cd -P "$here/../../.." && pwd)}"
|
|
20
|
+
panel="${TEAM_SNAPSHOTS_PANEL:-$tree/skills/teamsmith/scripts/panel/panel.js}"
|
|
21
|
+
stub="$here/panel-b3-stub.sh"
|
|
22
|
+
snapdir="$here/snapshots"
|
|
23
|
+
js="${TEAM_SNAPSHOTS_JS:-$(command -v node || command -v bun || true)}"
|
|
24
|
+
tmp="$(tmp_root_create panel-snapshots)" || exit 3
|
|
25
|
+
update=0
|
|
26
|
+
[ "${1:-}" = "--update" ] && update=1
|
|
27
|
+
PASS=0
|
|
28
|
+
FAIL=0
|
|
29
|
+
cleanup() { tmp_root_reap_all; }
|
|
30
|
+
trap cleanup EXIT
|
|
31
|
+
|
|
32
|
+
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; PASS=$((PASS + 1)); }
|
|
33
|
+
bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL + 1)); }
|
|
34
|
+
|
|
35
|
+
[ -n "$js" ] || { printf 'panel-snapshots: no node/bun runtime\n' >&2; exit 3; }
|
|
36
|
+
[ -f "$panel" ] || { printf 'panel-snapshots: no bundle at %s\n' "$panel" >&2; exit 3; }
|
|
37
|
+
[ -f "$stub" ] || { printf 'panel-snapshots: no stub at %s\n' "$stub" >&2; exit 3; }
|
|
38
|
+
mkdir -p "$snapdir"
|
|
39
|
+
|
|
40
|
+
# M21 item 5: the two body columns must end on the same row in a bounded frame — the last row that
|
|
41
|
+
# closes a card closes both. Before the flush rule the short column's card ended earlier and
|
|
42
|
+
# everything below it was blank page.
|
|
43
|
+
flush_check() { # <frame> <label>
|
|
44
|
+
local frame="$1" label="$2" got
|
|
45
|
+
got="$(python3 - "$frame" <<'PY'
|
|
46
|
+
import re, sys
|
|
47
|
+
|
|
48
|
+
rows = [re.sub(r"\x1b\[[0-9;]*m", "", l.rstrip("\n")) for l in open(sys.argv[1], encoding="utf-8")]
|
|
49
|
+
last = next((r for r in reversed(rows) if "╰" in r), "")
|
|
50
|
+
n = last.count("╰")
|
|
51
|
+
print("ok" if n >= 2 else f"the last card-closing row closes {n} card(s): {last!r}")
|
|
52
|
+
PY
|
|
53
|
+
)"
|
|
54
|
+
if [ "$got" = "ok" ]; then
|
|
55
|
+
ok "$label:两列 body 底边齐平(最后一行同时收两个卡片)"
|
|
56
|
+
else
|
|
57
|
+
bad "$label:两列底边不齐($got)"
|
|
58
|
+
fi
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
printf '\033[1m== snapshots · 4 widths × 2 themes ==\033[0m\n'
|
|
62
|
+
for width in 160 120 99 59; do
|
|
63
|
+
for theme in dark light; do
|
|
64
|
+
name="zh-$theme-$width"
|
|
65
|
+
actual="$tmp/$name.txt"
|
|
66
|
+
"$js" "$panel" --snapshot --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
|
|
67
|
+
--width "$width" --height 32 --theme "$theme" --lang zh --page 1 >"$actual" 2>"$tmp/$name.err"
|
|
68
|
+
rc=$?
|
|
69
|
+
if [ "$rc" != "0" ] || [ ! -s "$actual" ]; then
|
|
70
|
+
bad "$name:--snapshot 失败(rc=$rc)"; tail -2 "$tmp/$name.err"; continue
|
|
71
|
+
fi
|
|
72
|
+
if [ "$update" = "1" ]; then
|
|
73
|
+
cp "$actual" "$snapdir/$name.txt"
|
|
74
|
+
ok "$name:已重新钉住($(wc -c < "$snapdir/$name.txt" | tr -d ' ') 字节)"
|
|
75
|
+
fi
|
|
76
|
+
if [ ! -f "$snapdir/$name.txt" ]; then
|
|
77
|
+
bad "$name:没有钉住的快照(先跑 --update)"; continue
|
|
78
|
+
fi
|
|
79
|
+
if [ "$update" != "1" ]; then
|
|
80
|
+
if cmp -s "$actual" "$snapdir/$name.txt"; then
|
|
81
|
+
ok "$name:与钉住的快照逐字节一致"
|
|
82
|
+
else
|
|
83
|
+
bad "$name:与钉住的快照不一致(首个差异如下)"
|
|
84
|
+
diff <(sed 's/\x1b\[[0-9;]*m//g' "$snapdir/$name.txt") <(sed 's/\x1b\[[0-9;]*m//g' "$actual") | head -4
|
|
85
|
+
fi
|
|
86
|
+
fi
|
|
87
|
+
# 追加 3/4:四档宽度下会话值完整;表头/数据同一份列计划(起点相等、单元格不跨列)。
|
|
88
|
+
colchk="$tmp/$name.cols"
|
|
89
|
+
if python3 - "$actual" <<'PY' >"$colchk" 2>&1
|
|
90
|
+
import re, sys
|
|
91
|
+
WIDE = [(0x1100, 0x115f), (0x2e80, 0x303e), (0x3041, 0x33ff), (0x3400, 0x4dbf), (0x4e00, 0x9fff),
|
|
92
|
+
(0xa000, 0xa4cf), (0xac00, 0xd7a3), (0xf900, 0xfaff), (0xfe10, 0xfe19), (0xfe30, 0xfe6f),
|
|
93
|
+
(0xff00, 0xff60), (0xffe0, 0xffe6), (0x1f300, 0x1f64f), (0x1f900, 0x1f9ff)]
|
|
94
|
+
|
|
95
|
+
def strip(s):
|
|
96
|
+
return re.sub(r"\x1b\[[0-9;]*m", "", s)
|
|
97
|
+
|
|
98
|
+
def dwidth(text):
|
|
99
|
+
total = 0
|
|
100
|
+
for ch in text:
|
|
101
|
+
cp = ord(ch)
|
|
102
|
+
if cp in (0x200d, 0xfe0f) or 0x0300 <= cp <= 0x036f:
|
|
103
|
+
continue
|
|
104
|
+
total += 2 if any(a <= cp <= b for a, b in WIDE) else 1
|
|
105
|
+
return total
|
|
106
|
+
|
|
107
|
+
def offset_of(line, needle):
|
|
108
|
+
idx = line.find(needle)
|
|
109
|
+
if idx < 0:
|
|
110
|
+
return -1
|
|
111
|
+
return dwidth(line[:idx])
|
|
112
|
+
|
|
113
|
+
rows = [strip(l.rstrip("\n")) for l in open(sys.argv[1], encoding="utf-8")]
|
|
114
|
+
joined = "\n".join(rows)
|
|
115
|
+
if "41k/272k" not in joined:
|
|
116
|
+
print("session value 41k/272k missing (truncated?)")
|
|
117
|
+
sys.exit(1)
|
|
118
|
+
header = next((r for r in rows if "会话" in r and "代理" in r), None)
|
|
119
|
+
data = next((r for r in rows if "41k/272k" in r and "dev" in r), None)
|
|
120
|
+
if not header:
|
|
121
|
+
print("agents header not found")
|
|
122
|
+
sys.exit(1)
|
|
123
|
+
if not data:
|
|
124
|
+
print("agents data row not found")
|
|
125
|
+
sys.exit(1)
|
|
126
|
+
hs = offset_of(header, "会话")
|
|
127
|
+
ds = offset_of(data, "41k/272k")
|
|
128
|
+
if hs != ds:
|
|
129
|
+
print(f"session column start header={hs} data={ds}")
|
|
130
|
+
sys.exit(1)
|
|
131
|
+
if "任务" in header:
|
|
132
|
+
ht = offset_of(header, "任务")
|
|
133
|
+
dt = offset_of(data, "P14")
|
|
134
|
+
if ht != dt:
|
|
135
|
+
print(f"task column start header={ht} data={dt}")
|
|
136
|
+
sys.exit(1)
|
|
137
|
+
nxt = [offset_of(header, n) for n in ("分支", "会话") if n in header]
|
|
138
|
+
nxt = [x for x in nxt if x > ht]
|
|
139
|
+
if nxt and dt + dwidth("P14") > min(nxt):
|
|
140
|
+
print("task cell crosses into the next column")
|
|
141
|
+
sys.exit(1)
|
|
142
|
+
if "分支" in header:
|
|
143
|
+
hb = offset_of(header, "分支")
|
|
144
|
+
# data branch starts after the task cell (or state if no task); the fixture branch is unique.
|
|
145
|
+
db = offset_of(data, "P14-apply-pulse-console-b3")
|
|
146
|
+
if db >= 0 and hb != db:
|
|
147
|
+
print(f"branch column start header={hb} data={db}")
|
|
148
|
+
sys.exit(1)
|
|
149
|
+
print("ok")
|
|
150
|
+
PY
|
|
151
|
+
then
|
|
152
|
+
ok "$name:会话列完整且表头/数据列起点对齐"
|
|
153
|
+
else
|
|
154
|
+
bad "$name:会话列或列对齐失败($(tr '\n' ' ' < "$colchk"))"
|
|
155
|
+
fi
|
|
156
|
+
# M21 item 5: in the two-column tiers the two bodies end on the same row (see flush_check).
|
|
157
|
+
if [ "$width" -ge 100 ]; then
|
|
158
|
+
flush_check "$actual" "$name"
|
|
159
|
+
fi
|
|
160
|
+
done
|
|
161
|
+
done
|
|
162
|
+
|
|
163
|
+
# The same rule on the other two pages, where the user saw it (board beside decisions, queue beside
|
|
164
|
+
# the right stack) — rendered on the fly, not pinned: the flush is the property under test, not the
|
|
165
|
+
# exact rows.
|
|
166
|
+
for page in 2 3; do
|
|
167
|
+
pageframe="$tmp/flush-page$page.txt"
|
|
168
|
+
"$js" "$panel" --snapshot --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
|
|
169
|
+
--width 160 --height 32 --theme dark --lang zh --page "$page" >"$pageframe" 2>/dev/null
|
|
170
|
+
flush_check "$pageframe" "page $page (160)"
|
|
171
|
+
done
|
|
172
|
+
|
|
173
|
+
# ---------------------------------------------------------------- P18.1: 两栏各记各的预算
|
|
174
|
+
# The user's live report (270x66 pane): the work page showed only the left column's board —
|
|
175
|
+
# changes/specs/decisions were not degraded to `—`, they were gone. The placement pass deducted
|
|
176
|
+
# from one shared budget (`used = max(columns[0].length, columns[1].length)`), and B1 grows the board
|
|
177
|
+
# to the whole body height, so every right-column card saw `remaining = 0` and `pickChrome` dropped
|
|
178
|
+
# it. V18's fixture had a small folded pool and could not starve; this one must (done = 95 → 91
|
|
179
|
+
# folded rows) and is checked at both geometries the user's report names.
|
|
180
|
+
printf '\n\033[1m== P18.1 · 大折叠池的 work 页:board 不许饿死右栏(270x66 / 120x40)==\033[0m\n'
|
|
181
|
+
p181_uncapped="$tmp/p181-uncapped.txt"
|
|
182
|
+
env B3_STUB_DONE=95 "$js" "$panel" --snapshot --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
|
|
183
|
+
--width 120 --theme dark --lang zh --page 2 >"$p181_uncapped" 2>/dev/null
|
|
184
|
+
for p181_spec in "270 66" "120 40"; do
|
|
185
|
+
set -- $p181_spec
|
|
186
|
+
p181_frame="$tmp/p181-$1x$2.txt"
|
|
187
|
+
env B3_STUB_DONE=95 "$js" "$panel" --snapshot --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
|
|
188
|
+
--width "$1" --height "$2" --theme dark --lang zh --page 2 >"$p181_frame" 2>"$tmp/p181-$1x$2.err"
|
|
189
|
+
p181_got="$(python3 - "$p181_frame" "$p181_uncapped" "$1" "$2" <<'PYB'
|
|
190
|
+
import re, sys
|
|
191
|
+
|
|
192
|
+
def strip(s):
|
|
193
|
+
return re.sub(r"\x1b\[[0-9;]*m", "", s)
|
|
194
|
+
|
|
195
|
+
frame = [strip(l.rstrip("\n")) for l in open(sys.argv[1], encoding="utf-8")]
|
|
196
|
+
uncapped = [strip(l.rstrip("\n")) for l in open(sys.argv[2], encoding="utf-8")]
|
|
197
|
+
height = int(sys.argv[4])
|
|
198
|
+
|
|
199
|
+
def folded(rows):
|
|
200
|
+
for r in rows:
|
|
201
|
+
m = re.search(r"其余 (\d+) 条 done/dropped", r)
|
|
202
|
+
if m:
|
|
203
|
+
return int(m.group(1))
|
|
204
|
+
return None
|
|
205
|
+
|
|
206
|
+
problems = []
|
|
207
|
+
if len(frame) != height:
|
|
208
|
+
problems.append(f"帧高 {len(frame)} != {height}")
|
|
209
|
+
body = frame[:-1]
|
|
210
|
+
if not body or "写信" not in frame[-1]:
|
|
211
|
+
problems.append("末行不是键位带")
|
|
212
|
+
if not any("╭─ 任务看板" in r for r in body):
|
|
213
|
+
problems.append("左栏没有 board 卡片")
|
|
214
|
+
for title in ("活动变更", "规格", "最近决策"):
|
|
215
|
+
if not any(f"╭─ {title}" in r for r in body):
|
|
216
|
+
problems.append(f"右栏缺「{title}」卡片")
|
|
217
|
+
last = body[-1] if body else ""
|
|
218
|
+
if not last.startswith("╰") or last.count("╰") != 2:
|
|
219
|
+
problems.append("最后一列身体行没有同时收下两栏的卡片底(board 没填满/两列不同底)")
|
|
220
|
+
grown, natural = folded(body), folded(uncapped)
|
|
221
|
+
if natural is None:
|
|
222
|
+
problems.append("未封顶夹具没有折叠行(夹具坏了)")
|
|
223
|
+
elif grown is None:
|
|
224
|
+
problems.append("board 没有折叠行")
|
|
225
|
+
elif grown >= natural:
|
|
226
|
+
problems.append(f"board 折叠数 {grown} 没小于自然值 {natural}(余高没花在历史上)")
|
|
227
|
+
print("ok" if not problems else ";".join(problems))
|
|
228
|
+
PYB
|
|
229
|
+
)"
|
|
230
|
+
if [ "$p181_got" = "ok" ]; then
|
|
231
|
+
ok "P18.1 $1x$2:右栏三卡都在 + board 仍填满左栏(两列同底)+ 帧高恰好 $2 行"
|
|
232
|
+
else
|
|
233
|
+
bad "P18.1 $1x$2:$p181_got"
|
|
234
|
+
fi
|
|
235
|
+
done
|
|
236
|
+
|
|
237
|
+
# B1 must not regress while the budget accounting changes: every page fills a bounded frame
|
|
238
|
+
# *exactly* (`height` rows, footer on the last one) and no row outruns the width, on the large-pool
|
|
239
|
+
# fixture (the worst case for the board's growth) at four geometries.
|
|
240
|
+
for p181_wh in "160 32" "120 40" "99 50" "60 8"; do
|
|
241
|
+
set -- $p181_wh
|
|
242
|
+
for p181_page in 1 2 3 4; do
|
|
243
|
+
env B3_STUB_DONE=95 "$js" "$panel" --snapshot --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
|
|
244
|
+
--width "$1" --height "$2" --page "$p181_page" --theme dark --lang zh \
|
|
245
|
+
>"$tmp/p181-sweep-$1x$2-p$p181_page.txt" 2>/dev/null
|
|
246
|
+
done
|
|
247
|
+
done
|
|
248
|
+
p181_sweep="$(python3 - "$tmp" <<'PYC'
|
|
249
|
+
import glob, os, re, sys
|
|
250
|
+
|
|
251
|
+
WIDE = [(0x1100, 0x115f), (0x2e80, 0x303e), (0x3041, 0x33ff), (0x3400, 0x4dbf), (0x4e00, 0x9fff),
|
|
252
|
+
(0xa000, 0xa4cf), (0xac00, 0xd7a3), (0xf900, 0xfaff), (0xfe10, 0xfe19), (0xfe30, 0xfe6f),
|
|
253
|
+
(0xff00, 0xff60), (0xffe0, 0xffe6)]
|
|
254
|
+
|
|
255
|
+
def strip(s):
|
|
256
|
+
return re.sub(r"\x1b\[[0-9;?]*[a-zA-Z]", "", s)
|
|
257
|
+
|
|
258
|
+
def dwidth(text):
|
|
259
|
+
total = 0
|
|
260
|
+
for ch in text:
|
|
261
|
+
cp = ord(ch)
|
|
262
|
+
if cp in (0x200d, 0xfe0f) or 0x0300 <= cp <= 0x036f:
|
|
263
|
+
continue
|
|
264
|
+
total += 2 if any(a <= cp <= b for a, b in WIDE) else 1
|
|
265
|
+
return total
|
|
266
|
+
|
|
267
|
+
problems = []
|
|
268
|
+
for path in sorted(glob.glob(os.path.join(sys.argv[1], "p181-sweep-*.txt"))):
|
|
269
|
+
m = re.search(r"p181-sweep-(\d+)x(\d+)-p(\d+)\.txt$", path)
|
|
270
|
+
width, height, page = int(m.group(1)), int(m.group(2)), m.group(3)
|
|
271
|
+
rows = [strip(l.rstrip("\n")) for l in open(path, encoding="utf-8")]
|
|
272
|
+
if not rows or "teamsmith pulse" not in rows[0]:
|
|
273
|
+
problems.append(f"{width}x{height} p{page}: 帧没渲染出来")
|
|
274
|
+
continue
|
|
275
|
+
if len(rows) != height:
|
|
276
|
+
problems.append(f"{width}x{height} p{page}: {len(rows)} 行 != {height}")
|
|
277
|
+
elif "写信" not in rows[-1]:
|
|
278
|
+
problems.append(f"{width}x{height} p{page}: 末行不是键位带")
|
|
279
|
+
over = [i + 1 for i, r in enumerate(rows) if dwidth(r) > width]
|
|
280
|
+
if over:
|
|
281
|
+
problems.append(f"{width}x{height} p{page}: 第 {over[0]} 行超宽")
|
|
282
|
+
print("ok" if not problems else ";".join(problems[:4]))
|
|
283
|
+
PYC
|
|
284
|
+
)"
|
|
285
|
+
if [ "$p181_sweep" = "ok" ]; then
|
|
286
|
+
ok "P18.1 B1 不回归:四页 × 四档几何(160x32/120x40/99x50/60x8)都恰好 height 行、末行键位带、不超宽"
|
|
287
|
+
else
|
|
288
|
+
bad "P18.1 B1 不回归:$p181_sweep"
|
|
289
|
+
fi
|
|
290
|
+
|
|
291
|
+
# ---------------------------------------------------------------- M34: 活跃态置顶(用户拍板)
|
|
292
|
+
# 用户实机看 work 页后拍板:活跃任务应当排在顶部。夹具的 BOARD.md 文件序故意把 8 条 done 放在前、
|
|
293
|
+
# 2 条活跃(wip + blocked)放在最后 —— 旧实现(行按文件序原样渲染)会把活跃行压到卡片最底,正是
|
|
294
|
+
# 用户看到的样子。窄档(120x14)里折叠还在(keep 5 + 其余 3),宽档(120x40)里余高把折叠放满
|
|
295
|
+
# (P18.1 的那条放宽规则):两档都要求活跃两行在最顶,keep 的 done 随后、显示序仍是文件序(老→新),
|
|
296
|
+
# 折叠计数与隐藏条数一致。计数行、keep 规则、kanban 页都不归这条断言管。
|
|
297
|
+
printf '\n\033[1m== M34 · work 页看板卡:活跃态置顶 ==\033[0m\n'
|
|
298
|
+
m34_board="$tmp/m34-board.json"
|
|
299
|
+
cat > "$m34_board" <<'JSON'
|
|
300
|
+
{"rows": [
|
|
301
|
+
{"id": "D01", "title": "历史条目 01", "agent": "dev2", "branch": "task/D01", "deps": "-", "state": "done"},
|
|
302
|
+
{"id": "D02", "title": "历史条目 02", "agent": "dev2", "branch": "task/D02", "deps": "-", "state": "done"},
|
|
303
|
+
{"id": "D03", "title": "历史条目 03", "agent": "dev2", "branch": "task/D03", "deps": "-", "state": "done"},
|
|
304
|
+
{"id": "D04", "title": "历史条目 04", "agent": "dev2", "branch": "task/D04", "deps": "-", "state": "done"},
|
|
305
|
+
{"id": "D05", "title": "历史条目 05", "agent": "dev2", "branch": "task/D05", "deps": "-", "state": "done"},
|
|
306
|
+
{"id": "D06", "title": "历史条目 06", "agent": "dev2", "branch": "task/D06", "deps": "-", "state": "done"},
|
|
307
|
+
{"id": "D07", "title": "历史条目 07", "agent": "dev2", "branch": "task/D07", "deps": "-", "state": "done"},
|
|
308
|
+
{"id": "D08", "title": "历史条目 08", "agent": "dev2", "branch": "task/D08", "deps": "-", "state": "done"},
|
|
309
|
+
{"id": "A1", "title": "活跃夹具一", "agent": "dev", "branch": "task/A1", "deps": "-", "state": "wip"},
|
|
310
|
+
{"id": "A2", "title": "活跃夹具二", "agent": "verify", "branch": "-", "deps": "A1", "state": "blocked"}
|
|
311
|
+
],
|
|
312
|
+
"counts": {"todo": 0, "wip": 1, "review": 0, "done": 8, "blocked": 1, "dropped": 0},
|
|
313
|
+
"total": 10,
|
|
314
|
+
"deliveries": [
|
|
315
|
+
{"id": "D08", "agent": "dev2", "at": "2026-09-16T09:30:00Z"}
|
|
316
|
+
]}
|
|
317
|
+
JSON
|
|
318
|
+
m34_check() { # <width> <height> <label>
|
|
319
|
+
local width="$1" height="$2" label="$3" frame="$tmp/m34-$1x$2.txt" got
|
|
320
|
+
env B3_STUB_BOARD_FILE="$m34_board" "$js" "$panel" --snapshot --root "$tmp" --state-dir "$tmp/state" \
|
|
321
|
+
--team-cli "$stub" --width "$width" --height "$height" --theme dark --lang zh --page 2 \
|
|
322
|
+
>"$frame" 2>"$tmp/m34-$1x$2.err"
|
|
323
|
+
if [ ! -s "$frame" ]; then
|
|
324
|
+
bad "M34 $label:没有渲染出帧"; tail -2 "$tmp/m34-$1x$2.err"; return
|
|
325
|
+
fi
|
|
326
|
+
got="$(python3 - "$frame" <<'PYM'
|
|
327
|
+
import re, sys
|
|
328
|
+
|
|
329
|
+
rows = [re.sub(r"\x1b\[[0-9;]*m", "", l.rstrip("\n")) for l in open(sys.argv[1], encoding="utf-8")]
|
|
330
|
+
ACTIVE = ["A1", "A2"] # 文件序里的两条活跃行(wip + blocked)
|
|
331
|
+
HISTORY = [f"D{i:02d}" for i in range(1, 9)] # 文件序里的 8 条 done(老→新)
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
def cell_row(cid): # the first row whose id cell renders this id (the id column is 10 cells wide)
|
|
335
|
+
pat = re.compile(re.escape(cid) + r"\s")
|
|
336
|
+
for i, r in enumerate(rows):
|
|
337
|
+
if pat.search(r):
|
|
338
|
+
return i
|
|
339
|
+
return -1
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
problems = []
|
|
343
|
+
if not any("任务看板" in r for r in rows):
|
|
344
|
+
problems.append("没有 board 卡片")
|
|
345
|
+
at = {c: cell_row(c) for c in ACTIVE}
|
|
346
|
+
short = [c for c, i in at.items() if i < 0]
|
|
347
|
+
if short:
|
|
348
|
+
problems.append("活跃行没渲染出来:" + "/".join(short))
|
|
349
|
+
ht = {c: cell_row(c) for c in HISTORY}
|
|
350
|
+
visible = [c for c in HISTORY if ht[c] >= 0] # rendered history rows, in file order
|
|
351
|
+
folded = None
|
|
352
|
+
for r in rows:
|
|
353
|
+
m = re.search(r"其余\s*(\d+)\s*条", r)
|
|
354
|
+
if m:
|
|
355
|
+
folded = int(m.group(1))
|
|
356
|
+
break
|
|
357
|
+
hidden = len(HISTORY) - len(visible)
|
|
358
|
+
if folded is None and hidden != 0:
|
|
359
|
+
problems.append(f"折叠行缺失(应有 {hidden} 条隐藏在卡片里)")
|
|
360
|
+
elif folded is not None and folded != hidden:
|
|
361
|
+
problems.append(f"折叠计数 {folded} != 实际隐藏的历史行 {hidden}")
|
|
362
|
+
if visible != HISTORY[len(HISTORY) - len(visible):]:
|
|
363
|
+
problems.append("keep 的 done 不是最新的连续后缀(老→新):" + "/".join(visible))
|
|
364
|
+
if [ht[c] for c in visible] != sorted(ht[c] for c in visible):
|
|
365
|
+
problems.append("keep 的 done 没有保持文件序(老→新):" + str([ht[c] for c in visible]))
|
|
366
|
+
if not short and visible and max(at.values()) > min(ht[c] for c in visible):
|
|
367
|
+
problems.append(
|
|
368
|
+
f"活跃行不在最顶:A1@{at['A1']} A2@{at['A2']},而 done 行在 {sorted(ht[c] for c in visible)}"
|
|
369
|
+
)
|
|
370
|
+
if not short and [at[c] for c in ACTIVE] != sorted(at[c] for c in ACTIVE):
|
|
371
|
+
problems.append(f"活跃行没有保持文件序(A1@{at['A1']} A2@{at['A2']})")
|
|
372
|
+
print("ok" if not problems else ";".join(problems))
|
|
373
|
+
PYM
|
|
374
|
+
)"
|
|
375
|
+
if [ "$got" = "ok" ]; then
|
|
376
|
+
ok "M34 $label:活跃行在最顶(A1→A2 文件序),keep 的 done 随后且保持文件序"
|
|
377
|
+
else
|
|
378
|
+
bad "M34 $label:$got"
|
|
379
|
+
fi
|
|
380
|
+
}
|
|
381
|
+
m34_check 120 14 "120x14(history 折叠:keep 5 + 其余 3)"
|
|
382
|
+
m34_check 120 40 "120x40(余高把折叠放满:8 条历史全在)"
|
|
383
|
+
|
|
384
|
+
# The settings overlay's column plan (V16 F-V16-4/5's layout half + the user's report of
|
|
385
|
+
# 2026-09-17): with `lang=en` the key column was a hardcoded 12 cells with no separator, so
|
|
386
|
+
# `default page` (exactly 12) glued its value (`default pageoverview`) and `activity column` was cut
|
|
387
|
+
# into the value (`activity co…on`). The plan now reserves the widest key of *either* language
|
|
388
|
+
# inside the card's chrome and writes a real gap between the two columns. Checked structurally —
|
|
389
|
+
# per width, zh and en must land on the same columns:
|
|
390
|
+
# full (160/120/99/59): the bilingual key column, every key and value complete, gap of two
|
|
391
|
+
# degraded (24, below the documented tiers): the key column gives first — cut with `…`, never
|
|
392
|
+
# touching the value — and at least one key is actually cut
|
|
393
|
+
printf '\n\033[1m== settings overlay · both languages × four widths ==\033[0m\n'
|
|
394
|
+
overlay_frame() { # <lang> <width>
|
|
395
|
+
local lang="$1" width="$2"
|
|
396
|
+
"$js" "$panel" --snapshot --overlay --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
|
|
397
|
+
--width "$width" --height 32 --theme dark --lang "$lang" --page 1 >"$tmp/ov-$lang-$width.txt" 2>"$tmp/ov-$lang-$width.err"
|
|
398
|
+
}
|
|
399
|
+
overlay_pair_check() { # <width> <full|degraded>
|
|
400
|
+
local width="$1" mode="$2" got
|
|
401
|
+
overlay_frame zh "$width"
|
|
402
|
+
overlay_frame en "$width"
|
|
403
|
+
if [ ! -s "$tmp/ov-zh-$width.txt" ] || [ ! -s "$tmp/ov-en-$width.txt" ]; then
|
|
404
|
+
bad "overlay $width:--snapshot --overlay 没有产出帧"; tail -2 "$tmp/ov-en-$width.err"; return
|
|
405
|
+
fi
|
|
406
|
+
got="$(python3 - "$tmp/ov-zh-$width.txt" "$tmp/ov-en-$width.txt" "$width" "$mode" <<'PY'
|
|
407
|
+
import re, sys
|
|
408
|
+
|
|
409
|
+
zh_path, en_path, width, mode = sys.argv[1], sys.argv[2], int(sys.argv[3]), sys.argv[4]
|
|
410
|
+
LABELS = {
|
|
411
|
+
"zh": ["语言", "默认页面", "活动列", "鼠标", "密度"],
|
|
412
|
+
"en": ["language", "default page", "activity column", "mouse", "density"],
|
|
413
|
+
}
|
|
414
|
+
TITLE = {"zh": "设置", "en": "settings"}
|
|
415
|
+
CURSOR_W, GAP_W, CHROME_W = 4, 2, 4 # cursor column, separator, and the card's border+padding
|
|
416
|
+
WIDE = [(0x1100, 0x115f), (0x2e80, 0x303e), (0x3041, 0x33ff), (0x3400, 0x4dbf), (0x4e00, 0x9fff),
|
|
417
|
+
(0xa000, 0xa4cf), (0xac00, 0xd7a3), (0xf900, 0xfaff), (0xfe10, 0xfe19), (0xfe30, 0xfe6f),
|
|
418
|
+
(0xff00, 0xff60), (0xffe0, 0xffe6), (0x1f300, 0x1f64f), (0x1f900, 0x1f9ff)]
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
def fail(msg):
|
|
422
|
+
print(msg)
|
|
423
|
+
sys.exit(1)
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def strip(s):
|
|
427
|
+
return re.sub(r"\x1b\[[0-9;]*m", "", s)
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
def dwidth(text):
|
|
431
|
+
total = 0
|
|
432
|
+
for ch in text:
|
|
433
|
+
cp = ord(ch)
|
|
434
|
+
if cp in (0x200d, 0xfe0f) or 0x0300 <= cp <= 0x036f:
|
|
435
|
+
continue
|
|
436
|
+
total += 2 if any(a <= cp <= b for a, b in WIDE) else 1
|
|
437
|
+
return total
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
def dslice(text, start, end): # display-column slice (CJK-aware)
|
|
441
|
+
out, col = "", 0
|
|
442
|
+
for ch in text:
|
|
443
|
+
w = dwidth(ch)
|
|
444
|
+
if col >= end:
|
|
445
|
+
break
|
|
446
|
+
if col >= start and col + w <= end:
|
|
447
|
+
out += ch
|
|
448
|
+
col += w
|
|
449
|
+
return out
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
def cell(text, w): # what the plan renders in the key cell: pad it, or cut it with …
|
|
453
|
+
if dwidth(text) > w:
|
|
454
|
+
out, used = "", 0
|
|
455
|
+
for ch in text:
|
|
456
|
+
cw = dwidth(ch)
|
|
457
|
+
if used + cw > w - 1:
|
|
458
|
+
break
|
|
459
|
+
out += ch
|
|
460
|
+
used += cw
|
|
461
|
+
return out + "…"
|
|
462
|
+
return text + " " * (w - dwidth(text))
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
plan_key = max(dwidth(x) for labels in LABELS.values() for x in labels)
|
|
466
|
+
geometry = {}
|
|
467
|
+
cuts = {}
|
|
468
|
+
for lang, path in (("zh", zh_path), ("en", en_path)):
|
|
469
|
+
rows = [strip(l.rstrip("\n")) for l in open(path, encoding="utf-8")]
|
|
470
|
+
if TITLE[lang] not in "\n".join(rows):
|
|
471
|
+
fail(f"{lang}: the overlay did not render (no title)")
|
|
472
|
+
# The plan under test, restated from the implementation: the key column holds the widest label
|
|
473
|
+
# of either language inside the chrome the card adds.
|
|
474
|
+
framed = any(r.startswith("╭") for r in rows)
|
|
475
|
+
avail = max(1, width - (CHROME_W if framed else 0))
|
|
476
|
+
keyw = max(1, min(plan_key, avail - CURSOR_W - GAP_W - 1))
|
|
477
|
+
if mode == "full" and keyw != plan_key:
|
|
478
|
+
fail(f"{lang}: width {width} cannot hold the bilingual key column ({keyw} < {plan_key})")
|
|
479
|
+
if mode == "degraded" and keyw >= plan_key:
|
|
480
|
+
fail(f"{lang}: width {width} did not reach the degraded key column ({keyw})")
|
|
481
|
+
cut = 0
|
|
482
|
+
key_x = value_x = None
|
|
483
|
+
for label in LABELS[lang]:
|
|
484
|
+
want = cell(label, keyw).rstrip()
|
|
485
|
+
hit = None
|
|
486
|
+
for line in rows:
|
|
487
|
+
i = line.find(want)
|
|
488
|
+
if i >= 0:
|
|
489
|
+
hit = (line, dwidth(line[:i]))
|
|
490
|
+
break
|
|
491
|
+
if hit is None:
|
|
492
|
+
shown = [r for r in rows if any(l[:2] in r for l in LABELS[lang])][:3]
|
|
493
|
+
fail(f"{lang}: no row carries the key {label!r} as {want!r} (key column {keyw}); rendered: {shown!r}")
|
|
494
|
+
line, x = hit
|
|
495
|
+
if key_x is None:
|
|
496
|
+
key_x, value_x = x, x + keyw + GAP_W
|
|
497
|
+
elif x != key_x:
|
|
498
|
+
fail(f"{lang}: {label!r} starts at column {x}, not {key_x} — the keys are not one column")
|
|
499
|
+
gap = dslice(line, x + keyw, x + keyw + GAP_W)
|
|
500
|
+
if gap != " " * GAP_W:
|
|
501
|
+
fail(
|
|
502
|
+
f"{lang}: {label!r}: no {GAP_W} blank columns after the {keyw}-column key cell "
|
|
503
|
+
f"(columns {x + keyw}..{x + keyw + GAP_W} read {gap!r}) — the value column is not "
|
|
504
|
+
f"clear of the key: {line.rstrip()!r}"
|
|
505
|
+
)
|
|
506
|
+
value = dslice(line, value_x, 10 ** 6).rstrip()
|
|
507
|
+
if not value:
|
|
508
|
+
fail(f"{lang}: {label!r} has an empty value column")
|
|
509
|
+
if dwidth(line) > width:
|
|
510
|
+
fail(f"{lang}: a row is {dwidth(line)} columns wide (limit {width})")
|
|
511
|
+
if mode == "full" and "…" in value:
|
|
512
|
+
fail(f"{lang}: {label!r} lost its value in the full plan ({value!r})")
|
|
513
|
+
if "…" in want:
|
|
514
|
+
cut += 1
|
|
515
|
+
geometry[lang] = (key_x, value_x, keyw)
|
|
516
|
+
cuts[lang] = cut
|
|
517
|
+
if geometry["zh"][:2] != geometry["en"][:2]:
|
|
518
|
+
fail(f"the plan is not bilingual at width {width}: zh {geometry['zh']}, en {geometry['en']}")
|
|
519
|
+
if mode == "degraded" and not any(cuts.values()):
|
|
520
|
+
# The plan is degraded because the column is narrower than the bilingual maximum; at least one
|
|
521
|
+
# of the two languages must therefore show a cut key (zh's labels are all shorter than the
|
|
522
|
+
# maximum, so a zero here would mean the tier never actually degraded).
|
|
523
|
+
fail(f"the degraded tier cut no key in either language (key column {geometry['zh'][2]})")
|
|
524
|
+
print("ok")
|
|
525
|
+
PY
|
|
526
|
+
)"
|
|
527
|
+
if [ "$got" = "ok" ]; then
|
|
528
|
+
ok "overlay $width(zh+en 同列):键值两列、间隔 2 列、$mode"
|
|
529
|
+
else
|
|
530
|
+
bad "overlay $width:列计划检查失败($got)"
|
|
531
|
+
fi
|
|
532
|
+
}
|
|
533
|
+
for width in 160 120 99 59; do
|
|
534
|
+
overlay_pair_check "$width" full
|
|
535
|
+
done
|
|
536
|
+
# One tier below the documented four: the key column itself has to give (cut with `…`, still
|
|
537
|
+
# separated from the value) — the shape a narrow pane hits.
|
|
538
|
+
overlay_pair_check 24 degraded
|
|
539
|
+
|
|
540
|
+
# ---------------------------------------------------------------- the board page (page 4, P18/B2)
|
|
541
|
+
# Four widths × both themes, pinned byte for byte like page 1; then the kanban's own invariants: the
|
|
542
|
+
# six lanes in BOARD.md legend order, an empty lane's dim marker, the phase token on a card, and
|
|
543
|
+
# exactly one focus cursor.
|
|
544
|
+
printf '\n\033[1m== board page (page 4) · 4 widths × 2 themes ==\033[0m\n'
|
|
545
|
+
for width in 160 120 99 59; do
|
|
546
|
+
for theme in dark light; do
|
|
547
|
+
name="zh-$theme-$width-p4"
|
|
548
|
+
actual="$tmp/$name.txt"
|
|
549
|
+
"$js" "$panel" --snapshot --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
|
|
550
|
+
--width "$width" --height 32 --theme "$theme" --lang zh --page 4 >"$actual" 2>"$tmp/$name.err"
|
|
551
|
+
rc=$?
|
|
552
|
+
if [ "$rc" != "0" ] || [ ! -s "$actual" ]; then
|
|
553
|
+
bad "$name:--snapshot 失败(rc=$rc)"; tail -2 "$tmp/$name.err"; continue
|
|
554
|
+
fi
|
|
555
|
+
if [ "$update" = "1" ]; then
|
|
556
|
+
cp "$actual" "$snapdir/$name.txt"
|
|
557
|
+
ok "$name:已重新钉住($(wc -c < "$snapdir/$name.txt" | tr -d ' ') 字节)"
|
|
558
|
+
continue
|
|
559
|
+
fi
|
|
560
|
+
if [ ! -f "$snapdir/$name.txt" ]; then
|
|
561
|
+
bad "$name:没有钉住的快照(先跑 --update)"; continue
|
|
562
|
+
fi
|
|
563
|
+
if cmp -s "$actual" "$snapdir/$name.txt"; then
|
|
564
|
+
ok "$name:与钉住的快照逐字节一致"
|
|
565
|
+
else
|
|
566
|
+
bad "$name:与钉住的快照不一致(首个差异如下)"
|
|
567
|
+
diff <(sed 's/\x1b\[[0-9;]*m//g' "$snapdir/$name.txt") <(sed 's/\x1b\[[0-9;]*m//g' "$actual") | head -4
|
|
568
|
+
fi
|
|
569
|
+
done
|
|
570
|
+
done
|
|
571
|
+
# The wide frame's invariants (the kanban's own order/marker/phase/focus rules).
|
|
572
|
+
p4="$tmp/zh-dark-160-p4.txt"
|
|
573
|
+
[ -f "$p4" ] && p4_check="$(python3 - "$p4" <<'PY4'
|
|
574
|
+
import re, sys
|
|
575
|
+
|
|
576
|
+
rows = [re.sub(r"\x1b\[[0-9;]*m", "", l.rstrip("\n")) for l in open(sys.argv[1], encoding="utf-8")]
|
|
577
|
+
lane_labels = ["待办", "进行", "待复验", "完成", "阻塞", "已放弃"]
|
|
578
|
+
head = next((r for r in rows if "待办" in r), "")
|
|
579
|
+
problems = []
|
|
580
|
+
if not head:
|
|
581
|
+
problems.append("没有车道行")
|
|
582
|
+
else:
|
|
583
|
+
# Every lane starts with its own `╭` (an unfolded box `╭─ ▾ …` or a folded three-column frame
|
|
584
|
+
# `╭─╮`); the legend order is the left-to-right order of those starts.
|
|
585
|
+
starts = len(re.findall("╭", head))
|
|
586
|
+
if starts != 6:
|
|
587
|
+
problems.append(f"六条车道没有全部渲染({starts} 个车道起点)")
|
|
588
|
+
pos = [head.find(l) for l in lane_labels]
|
|
589
|
+
present = [p for p in pos if p >= 0]
|
|
590
|
+
if present != sorted(present):
|
|
591
|
+
problems.append(f"车道标签顺序不对:{pos}")
|
|
592
|
+
# P125: the two empty lanes fold by default in the wide tier; each is the three-column frame
|
|
593
|
+
# (rounded corners, border/ellipsis/border) rather than an in-place one-line label.
|
|
594
|
+
frames = len(re.findall("╭─╮", head))
|
|
595
|
+
if frames != 2:
|
|
596
|
+
problems.append(f"宽档折叠车道不是两个三列小框:{head[:80]}")
|
|
597
|
+
# P123:卡片行只留序号+标题(agent/phase 不上卡片),键位带带焦点卡的对。
|
|
598
|
+
card_rows = [r for r in rows if re.search(r"[·▸◆✓✗—]\s+[PV]\d+\s", r)]
|
|
599
|
+
for r in card_rows:
|
|
600
|
+
if " apply " in r or " verify " in r or " dev " in r or " dev2 " in r:
|
|
601
|
+
problems.append(f"卡片行仍带 agent/phase:{r.strip()[:70]}")
|
|
602
|
+
if "verify · verify" not in rows[-1]:
|
|
603
|
+
problems.append("键位带没有焦点卡 V14 的 agent · phase 对")
|
|
604
|
+
cursors = sum(r.count("›") for r in rows)
|
|
605
|
+
if cursors != 1:
|
|
606
|
+
problems.append(f"焦点光标应当恰好一个,实际 {cursors}")
|
|
607
|
+
print("ok" if not problems else ";".join(problems))
|
|
608
|
+
PY4
|
|
609
|
+
)"
|
|
610
|
+
if [ "${p4_check:-}" = "ok" ]; then
|
|
611
|
+
ok "page4 160:六车道顺序 / 折叠车道是三列小框 / 卡片只留序号+标题 / 键位带带焦点卡的对 / 只有一个焦点光标"
|
|
612
|
+
else
|
|
613
|
+
bad "page4 160:${p4_check:-没有渲染出 page4 帧}"
|
|
614
|
+
fi
|
|
615
|
+
# The narrow tiers: the same lane order, a single column (no lane box side by side).
|
|
616
|
+
for w in 99 59; do
|
|
617
|
+
f="$tmp/zh-dark-$w-p4.txt"
|
|
618
|
+
[ -f "$f" ] || { bad "page4 $w:没有渲染出帧"; continue; }
|
|
619
|
+
p4n="$(python3 - "$f" <<'PY5'
|
|
620
|
+
import re, sys
|
|
621
|
+
|
|
622
|
+
rows = [re.sub(r"\x1b\[[0-9;]*m", "", l.rstrip("\n")) for l in open(sys.argv[1], encoding="utf-8")]
|
|
623
|
+
labels = ["待办", "进行", "待复验", "完成", "阻塞", "已放弃"]
|
|
624
|
+
# P123: a lane title now wears the state marker (`▾` unfolded / `▸ …(已折叠)` folded).
|
|
625
|
+
idx = [next((i for i, r in enumerate(rows) if re.search(rf"[▾▸]\s*{re.escape(l)}\s", r)), -1) for l in labels]
|
|
626
|
+
problems = []
|
|
627
|
+
if -1 in idx or idx != sorted(idx):
|
|
628
|
+
problems.append(f"车道标题顺序不对:{idx}")
|
|
629
|
+
# Every lane header renders; with the empty-lane default on, a lane whose count is 0 is folded to
|
|
630
|
+
# its one line (marker + count + folded token) and no dim empty marker follows. An explicitly
|
|
631
|
+
# unfolded empty lane (the `boardEmptyFold=0` fixture) still shows the dim marker on the next row.
|
|
632
|
+
for i, at in enumerate(idx):
|
|
633
|
+
if at < 0:
|
|
634
|
+
continue
|
|
635
|
+
head = rows[at]
|
|
636
|
+
m = re.search(r"\s(\d+)\s*$", head)
|
|
637
|
+
if not m or m.group(1) != "0":
|
|
638
|
+
continue
|
|
639
|
+
if "(已折叠)" in head:
|
|
640
|
+
continue
|
|
641
|
+
nxt = next((r for r in rows[at + 1 :] if r.strip()), "")
|
|
642
|
+
if "·" not in nxt:
|
|
643
|
+
problems.append(f"{labels[i]} 空车道既没折叠也没有空标记:{nxt!r}")
|
|
644
|
+
print("ok" if not problems else ";".join(problems))
|
|
645
|
+
PY5
|
|
646
|
+
)"
|
|
647
|
+
[ "$p4n" = "ok" ] && ok "page4 $w:单列按车道顺序分组、空车道默认折叠(显式展开才有空标记)" || bad "page4 $w:$p4n"
|
|
648
|
+
done
|
|
649
|
+
|
|
650
|
+
# The minimal tier must not overrun a tiny pane (the spec's "A tiny pane is not overrun"): rows are
|
|
651
|
+
# counted on the ANSI frame (one row per newline) and widths on the stripped text.
|
|
652
|
+
tiny="$tmp/tiny.txt"
|
|
653
|
+
"$js" "$panel" --snapshot --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
|
|
654
|
+
--width 60 --height 8 --theme dark --lang zh --page 1 >"$tiny" 2>/dev/null
|
|
655
|
+
rows="$(wc -l < "$tiny" | tr -d ' ')"
|
|
656
|
+
# Display width, not bytes: a CJK glyph occupies two columns (the layout's own unit).
|
|
657
|
+
overrun="$(python3 - "$tiny" <<'PY'
|
|
658
|
+
import re, sys
|
|
659
|
+
WIDE = [(0x1100, 0x115f), (0x2e80, 0x303e), (0x3041, 0x33ff), (0x3400, 0x4dbf), (0x4e00, 0x9fff),
|
|
660
|
+
(0xa000, 0xa4cf), (0xac00, 0xd7a3), (0xf900, 0xfaff), (0xfe10, 0xfe19), (0xfe30, 0xfe6f),
|
|
661
|
+
(0xff00, 0xff60), (0xffe0, 0xffe6), (0x1f300, 0x1f64f), (0x1f900, 0x1f9ff)]
|
|
662
|
+
|
|
663
|
+
def width(text):
|
|
664
|
+
total = 0
|
|
665
|
+
for ch in text:
|
|
666
|
+
cp = ord(ch)
|
|
667
|
+
if cp in (0x200d, 0xfe0f) or 0x0300 <= cp <= 0x036f:
|
|
668
|
+
continue
|
|
669
|
+
total += 2 if any(a <= cp <= b for a, b in WIDE) else 1
|
|
670
|
+
return total
|
|
671
|
+
|
|
672
|
+
bad = 0
|
|
673
|
+
for line in open(sys.argv[1], encoding="utf-8"):
|
|
674
|
+
line = re.sub(r"\x1b\[[0-9;?]*[a-zA-Z]", "", line.rstrip("\n"))
|
|
675
|
+
if width(line) > 60:
|
|
676
|
+
bad += 1
|
|
677
|
+
print(bad)
|
|
678
|
+
PY
|
|
679
|
+
)"
|
|
680
|
+
# P18/B1: the bounded-frame red line's smallest case — the key band is the last non-empty row, so a
|
|
681
|
+
# tiny pane never strands the footer mid-frame (the pre-fix frame ended on content and padded below).
|
|
682
|
+
tiny_tail="$(sed 's/\x1b\[[0-9;]*m//g' "$tiny" | awk 'NF' | tail -1)"
|
|
683
|
+
if [ "$rows" -le 8 ] && [ "$overrun" = "0" ]; then
|
|
684
|
+
ok "tiny:60x8 的快照 $rows 行、没有一行超过 60 列"
|
|
685
|
+
else
|
|
686
|
+
bad "tiny:60x8 的帧 $rows 行、$overrun 行超宽"
|
|
687
|
+
fi
|
|
688
|
+
case "$tiny_tail" in
|
|
689
|
+
*写信*) ok "tiny:60x8 的最后一个非空行是键位带(有界帧钉底)" ;;
|
|
690
|
+
*) bad "tiny:60x8 的最后非空行不是键位带($(printf '%s' "$tiny_tail" | cut -c1-40))" ;;
|
|
691
|
+
esac
|
|
692
|
+
|
|
693
|
+
# ---------------------------------------------------------------- the detail view (page 4, P18/B3)
|
|
694
|
+
# 9.5: one fixture document, two widths × both themes, pinned byte for byte; then the renderer's
|
|
695
|
+
# structural invariants (the tab row, the heading without its marker, the aligned table, and a
|
|
696
|
+
# narrow tier where the long paragraph wraps instead of overrunning).
|
|
697
|
+
printf '\n\033[1m== detail view (page 4 + --detail) · 2 widths × 2 themes ==\033[0m\n'
|
|
698
|
+
for width in 120 59; do
|
|
699
|
+
for theme in dark light; do
|
|
700
|
+
name="zh-$theme-$width-detail"
|
|
701
|
+
actual="$tmp/$name.txt"
|
|
702
|
+
"$js" "$panel" --snapshot --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
|
|
703
|
+
--width "$width" --height 32 --theme "$theme" --lang zh --page 4 --detail V14 >"$actual" 2>"$tmp/$name.err"
|
|
704
|
+
rc=$?
|
|
705
|
+
if [ "$rc" != "0" ] || [ ! -s "$actual" ]; then
|
|
706
|
+
bad "$name:--snapshot 失败(rc=$rc)"; tail -2 "$tmp/$name.err"; continue
|
|
707
|
+
fi
|
|
708
|
+
if [ "$update" = "1" ]; then
|
|
709
|
+
cp "$actual" "$snapdir/$name.txt"
|
|
710
|
+
ok "$name:已重新钉住($(wc -c < "$snapdir/$name.txt" | tr -d ' ') 字节)"
|
|
711
|
+
continue
|
|
712
|
+
fi
|
|
713
|
+
if [ ! -f "$snapdir/$name.txt" ]; then
|
|
714
|
+
bad "$name:没有钉住的快照(先跑 --update)"; continue
|
|
715
|
+
fi
|
|
716
|
+
if cmp -s "$actual" "$snapdir/$name.txt"; then
|
|
717
|
+
ok "$name:与钉住的快照逐字节一致"
|
|
718
|
+
else
|
|
719
|
+
bad "$name:与钉住的快照不一致(首个差异如下)"
|
|
720
|
+
diff <(sed 's/\x1b\[[0-9;]*m//g' "$snapdir/$name.txt") <(sed 's/\x1b\[[0-9;]*m//g' "$actual") | head -4
|
|
721
|
+
fi
|
|
722
|
+
done
|
|
723
|
+
done
|
|
724
|
+
# 8.1: the renderer's structural invariants on the wide pin — the subset's elements are *readable*:
|
|
725
|
+
# the tab row names the four discovered files in order with the first active, the ATX heading lost
|
|
726
|
+
# its `#`, the fence body is verbatim, and the pipe table's columns are display-width aligned (every
|
|
727
|
+
# `│` lands on one column for header, separator and body).
|
|
728
|
+
dv="$tmp/zh-dark-120-detail.txt"
|
|
729
|
+
dv_check="$(python3 - "$dv" <<'PYD'
|
|
730
|
+
import re, sys
|
|
731
|
+
|
|
732
|
+
rows = [re.sub(r"\x1b\[[0-9;]*m", "", l.rstrip("\n")) for l in open(sys.argv[1], encoding="utf-8")]
|
|
733
|
+
joined = "\n".join(rows)
|
|
734
|
+
problems = []
|
|
735
|
+
tab_row = next((r for r in rows if "brief" in r and "report:dev" in r), "")
|
|
736
|
+
order = [tab_row.find(t) for t in ("[brief]", "report:dev", "review", "review:done")]
|
|
737
|
+
if -1 in order or order != sorted(order):
|
|
738
|
+
problems.append(f"tab row order/active wrong: {order}")
|
|
739
|
+
if "# V14" in joined or "# P1" in joined:
|
|
740
|
+
problems.append("an ATX heading kept its # marker")
|
|
741
|
+
if "verbatim fence body" not in joined:
|
|
742
|
+
problems.append("the fence body is not verbatim")
|
|
743
|
+
if "fixture brief" not in joined:
|
|
744
|
+
problems.append("the document body is missing")
|
|
745
|
+
# Table columns: the separator row's `┼` columns must equal the header/body `│` columns.
|
|
746
|
+
header = next((r for r in rows if "id" in r and "state" in r and "note" in r), "")
|
|
747
|
+
sep = next((r for r in rows if "┼" in r), "")
|
|
748
|
+
body = next((r for r in rows if "P22" in r), "")
|
|
749
|
+
if not (header and sep and body):
|
|
750
|
+
problems.append("the pipe table did not render")
|
|
751
|
+
else:
|
|
752
|
+
def marks(row, chars):
|
|
753
|
+
return [i for i, ch in enumerate(row) if ch in chars]
|
|
754
|
+
# The frame's card border `│` sits at the row's first and last column; the table's own
|
|
755
|
+
# separators are the inner marks.
|
|
756
|
+
hx, sx, bx = marks(header, "│")[1:-1], marks(sep, "┼"), marks(body, "│")[1:-1]
|
|
757
|
+
if not (hx == sx == bx) or len(hx) != 2:
|
|
758
|
+
problems.append(f"table columns misaligned: header {hx}, separator {sx}, body {bx}")
|
|
759
|
+
print("ok" if not problems else ";".join(problems))
|
|
760
|
+
PYD
|
|
761
|
+
)"
|
|
762
|
+
[ "$dv_check" = "ok" ] && ok "detail 120:tab 次序 / 标题去标记 / 围栏原样 / 表格列对齐" \
|
|
763
|
+
|| bad "detail 120:${dv_check:-没有渲染出详情帧}"
|
|
764
|
+
# 59 columns: nothing may overrun the pane (the long paragraph wraps), and the tabs still render.
|
|
765
|
+
nd="$tmp/zh-dark-59-detail.txt"
|
|
766
|
+
nd_over="$(python3 - "$nd" <<'PY'
|
|
767
|
+
import re, sys
|
|
768
|
+
WIDE = [(0x1100, 0x115f), (0x2e80, 0x303e), (0x3041, 0x33ff), (0x3400, 0x4dbf), (0x4e00, 0x9fff),
|
|
769
|
+
(0xa000, 0xa4cf), (0xac00, 0xd7a3), (0xf900, 0xfaff), (0xfe10, 0xfe19), (0xfe30, 0xfe6f),
|
|
770
|
+
(0xff00, 0xff60), (0xffe0, 0xffe6)]
|
|
771
|
+
|
|
772
|
+
def width(text):
|
|
773
|
+
total = 0
|
|
774
|
+
for ch in text:
|
|
775
|
+
cp = ord(ch)
|
|
776
|
+
if cp in (0x200d, 0xfe0f) or 0x0300 <= cp <= 0x036f:
|
|
777
|
+
continue
|
|
778
|
+
total += 2 if any(a <= cp <= b for a, b in WIDE) else 1
|
|
779
|
+
return total
|
|
780
|
+
|
|
781
|
+
bad = 0
|
|
782
|
+
for line in open(sys.argv[1], encoding="utf-8"):
|
|
783
|
+
line = re.sub(r"\x1b\[[0-9;?]*[a-zA-Z]", "", line.rstrip("\n"))
|
|
784
|
+
if width(line) > 59:
|
|
785
|
+
bad += 1
|
|
786
|
+
print(bad)
|
|
787
|
+
PY
|
|
788
|
+
)"
|
|
789
|
+
if [ "$nd_over" = "0" ]; then
|
|
790
|
+
ok "detail 59:没有一行超过 59 列(长段落换行)"
|
|
791
|
+
else
|
|
792
|
+
bad "detail 59:$nd_over 行超过 59 列"
|
|
793
|
+
fi
|
|
794
|
+
if grep -qF '[brief]' "$nd"; then
|
|
795
|
+
ok "detail 59:tab 行仍渲染(首个 active)"
|
|
796
|
+
else
|
|
797
|
+
bad "detail 59:tab 行没有渲染"
|
|
798
|
+
fi
|
|
799
|
+
printf '\n\033[1m== 结果 ==\033[0m ✓ %d ✗ %d\n' "$PASS" "$FAIL"
|
|
800
|
+
[ "$FAIL" -eq 0 ] && { printf '\033[32mpanel-snapshots 全绿\033[0m\n'; exit 0; }
|
|
801
|
+
printf '\033[31mpanel-snapshots 有失败项\033[0m\n'
|
|
802
|
+
exit 1
|