teamsmith 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +69 -0
- package/skills/teamsmith/SKILL.md +20 -13
- package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
- package/skills/teamsmith/extension/team-notify.ts +37 -6
- package/skills/teamsmith/extension/team.ts +438 -0
- package/skills/teamsmith/references/config.md +39 -6
- package/skills/teamsmith/references/migration.md +197 -47
- package/skills/teamsmith/references/protocol.md +201 -30
- package/skills/teamsmith/references/troubleshooting.md +130 -10
- package/skills/teamsmith/references/workflows.md +36 -2
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
- package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
- package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
- package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
- package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
- package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
- package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
- package/skills/teamsmith/scripts/lib/cmd-review.sh +182 -32
- package/skills/teamsmith/scripts/lib/cmd-status.sh +234 -21
- package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
- package/skills/teamsmith/scripts/lib/common.sh +1004 -245
- package/skills/teamsmith/scripts/lib/gate-lock.sh +582 -0
- package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
- package/skills/teamsmith/scripts/panel/panel.js +211 -211
- package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +12 -5
- package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
- package/skills/teamsmith/scripts/panel/src/data.ts +51 -5
- package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
- package/skills/teamsmith/scripts/panel/src/main.tsx +37 -8
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
- package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
- package/skills/teamsmith/scripts/replies.mjs +4 -1
- package/skills/teamsmith/scripts/shim/killall +10 -0
- package/skills/teamsmith/scripts/shim/pgrep +10 -0
- package/skills/teamsmith/scripts/shim/pidof +10 -0
- package/skills/teamsmith/scripts/shim/pkill +10 -0
- package/skills/teamsmith/scripts/shim/signal-gate +108 -31
- package/skills/teamsmith/scripts/shim/tmux +18 -0
- package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
- package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
- package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
- package/skills/teamsmith/scripts/team +19 -6
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
- package/skills/teamsmith/templates/config.sh.tmpl +20 -1
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
- package/skills/teamsmith/tests/README.md +31 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
- package/skills/teamsmith/tests/bg-ledger.sh +168 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +83 -54
- package/skills/teamsmith/tests/config-cli.sh +184 -32
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
- package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
- package/skills/teamsmith/tests/flip-m33.sh +5 -3
- package/skills/teamsmith/tests/flip-p158.sh +2 -1
- package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
- package/skills/teamsmith/tests/flip-p310-lock.sh +210 -0
- package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
- package/skills/teamsmith/tests/gate-guard.sh +52 -79
- package/skills/teamsmith/tests/help-surface.sh +1664 -0
- package/skills/teamsmith/tests/install-shape.sh +359 -22
- package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
- package/skills/teamsmith/tests/key-replies-ui.sh +2 -8
- package/skills/teamsmith/tests/key-replies.sh +281 -28
- package/skills/teamsmith/tests/ledger-ban.sh +5 -4
- package/skills/teamsmith/tests/ledger-claim.sh +2 -1
- package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
- package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
- package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
- package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
- package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
- package/skills/teamsmith/tests/lib/section-guard.sh +316 -164
- package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
- package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
- package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
- package/skills/teamsmith/tests/loop-inventory.tsv +83 -77
- package/skills/teamsmith/tests/panel-b2.sh +430 -352
- package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
- package/skills/teamsmith/tests/panel-b3.sh +314 -62
- package/skills/teamsmith/tests/panel-choices.sh +11 -6
- package/skills/teamsmith/tests/panel-cpu.sh +43 -130
- package/skills/teamsmith/tests/panel-p21.sh +251 -265
- package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
- package/skills/teamsmith/tests/panel-strings.mjs +33 -18
- package/skills/teamsmith/tests/perf.sh +187 -396
- package/skills/teamsmith/tests/routes.sh +440 -117
- package/skills/teamsmith/tests/seat-interrupt.sh +1012 -0
- package/skills/teamsmith/tests/seat-visibility.sh +675 -0
- package/skills/teamsmith/tests/section-guard.sh +13 -102
- package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
- package/skills/teamsmith/tests/section-paths.tsv +32 -18
- package/skills/teamsmith/tests/section-select.sh +371 -19
- package/skills/teamsmith/tests/signal-gate.sh +249 -27
- package/skills/teamsmith/tests/signal-lint-legacy.txt +4 -1
- package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
- package/skills/teamsmith/tests/slash-team.sh +617 -0
- package/skills/teamsmith/tests/slice-coverage.sh +206 -0
- package/skills/teamsmith/tests/smoke.sh +3595 -788
- package/skills/teamsmith/tests/task-model-routing.sh +530 -15
- package/skills/teamsmith/tests/team-bg-stop.sh +18 -10
- package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
- package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
- package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
- package/skills/teamsmith/tests/workflow-entry.sh +207 -0
- package/skills/teamsmith-init/SKILL.md +12 -12
- package/skills/teamsmith-init/references/bootstrap.md +3 -3
- package/skills/teamsmith/tests/flip-glue.sh +0 -162
- package/skills/teamsmith/tests/flip-m12-26c.sh +0 -129
- package/skills/teamsmith/tests/flip-m12.sh +0 -185
- package/skills/teamsmith/tests/flip-m16.sh +0 -166
- package/skills/teamsmith/tests/flip-m17.sh +0 -204
- package/skills/teamsmith/tests/flip-m34.sh +0 -96
- package/skills/teamsmith/tests/flip-m37.sh +0 -185
- package/skills/teamsmith/tests/flip-m4.3.sh +0 -375
- package/skills/teamsmith/tests/flip-m43.sh +0 -128
- package/skills/teamsmith/tests/flip-m45.sh +0 -244
- package/skills/teamsmith/tests/flip-m46.sh +0 -238
- package/skills/teamsmith/tests/flip-m48.sh +0 -304
- package/skills/teamsmith/tests/flip-m6.2.sh +0 -205
- package/skills/teamsmith/tests/flip-m6.3.sh +0 -283
- package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
- package/skills/teamsmith/tests/flip-m6.5.sh +0 -113
- package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
- package/skills/teamsmith/tests/flip-m7.2.sh +0 -321
- package/skills/teamsmith/tests/flip-p144.sh +0 -112
- package/skills/teamsmith/tests/flip-p156.sh +0 -133
- package/skills/teamsmith/tests/flip-p160.sh +0 -182
- package/skills/teamsmith/tests/flip-p171.sh +0 -249
- package/skills/teamsmith/tests/flip-p18.1.sh +0 -95
- package/skills/teamsmith/tests/flip-p20.sh +0 -286
- package/skills/teamsmith/tests/flip-p201.sh +0 -249
- package/skills/teamsmith/tests/flip-p210.sh +0 -239
- package/skills/teamsmith/tests/flip-p211.sh +0 -152
- package/skills/teamsmith/tests/flip-p217.sh +0 -288
- package/skills/teamsmith/tests/flip-p22.sh +0 -123
- package/skills/teamsmith/tests/flip-p23.sh +0 -239
- package/skills/teamsmith/tests/flip-p25.sh +0 -165
- package/skills/teamsmith/tests/flip-p71.sh +0 -184
- package/skills/teamsmith/tests/flip-p72.sh +0 -202
- package/skills/teamsmith/tests/load-experiment.sh +0 -290
- package/skills/teamsmith/tests/panel-cpu-premise.sh +0 -173
- package/skills/teamsmith/tests/panel-flip-m54.sh +0 -207
- package/skills/teamsmith/tests/panel-flip-p123.sh +0 -278
- package/skills/teamsmith/tests/panel-flip-p125.sh +0 -318
- package/skills/teamsmith/tests/panel-flip-p128.sh +0 -259
- package/skills/teamsmith/tests/panel-keyprobe-stub.sh +0 -41
- package/skills/teamsmith/tests/panel-keyprobe.sh +0 -82
- package/skills/teamsmith/tests/panel-knobs.sh +0 -83
- package/skills/teamsmith/tests/section-budgets.tsv +0 -154
- package/skills/teamsmith/tests/team-bg-flip.sh +0 -239
- package/skills/teamsmith/tests/team-inbox-watch-flip.sh +0 -191
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# panel-flip-m54.sh — the break/fix flips for M55's console half (`settings-choice-editors`, panel delta).
|
|
3
|
-
#
|
|
4
|
-
# bash skills/teamsmith/tests/panel-flip-m54.sh # every flip
|
|
5
|
-
# bash skills/teamsmith/tests/panel-flip-m54.sh F-B A2-enum # selected flips
|
|
6
|
-
#
|
|
7
|
-
# Each flip edits the panel sources, rebuilds the committed bundle, runs one `panel-p21.sh` scenario
|
|
8
|
-
# and asserts it goes red, then restores the sources, rebuilds and asserts green plus the bundle
|
|
9
|
-
# byte-identical. The worked build needs `panel/scripts/node_modules` (bun); without it the flip
|
|
10
|
-
# reports the rebuild as a setup failure (exit 3), like flip-p22.sh.
|
|
11
|
-
#
|
|
12
|
-
# F-B — the bundle's `choices` reader is disabled (the console keeps its own option table) → the
|
|
13
|
-
# picker never opens → the choices scenario red.
|
|
14
|
-
# F-C — the machine's Pi model catalogue becomes an option (the retired `sub2api` provider) →
|
|
15
|
-
# the picker's model list carries a provider the project never configured → red.
|
|
16
|
-
# W-A — the rejected M65 shape: opening the picker awaits a fresh settings read again (the
|
|
17
|
-
# pre-rework open path, main.tsx's awaited API comes back for the flip) → the read-gap
|
|
18
|
-
# assertion reds by name; restored, the same bundle is green and byte-identical.
|
|
19
|
-
# W-B — the rejected M65 accept: every entry opens the compose editor again instead of writing
|
|
20
|
-
# on the accept → the direct-write regression reds; restored, green.
|
|
21
|
-
# A2-enum — a hardcoded key table names the enums it knows (`TEAM_ZZZ_MODE`, added only to a scratch
|
|
22
|
-
# CLI's schema, is not among them) → the zero-rebuild scenario red; restored, the very
|
|
23
|
-
# same committed bundle offers the new key's `constraints` and degrades visibly when they
|
|
24
|
-
# are removed.
|
|
25
|
-
#
|
|
26
|
-
# Exit: 0 every selected flip behaved, 1 at least one flip did not, 3 setup failure.
|
|
27
|
-
set -uo pipefail
|
|
28
|
-
|
|
29
|
-
here="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
30
|
-
# P53:临时根的唯一创建者(${TMPDIR:-/tmp} + owned 家族 + 回收)
|
|
31
|
-
. "$here/lib/tmp-root.sh"
|
|
32
|
-
tree="${TEAM_P21_TREE:-$(cd -P "$here/../../.." && pwd)}"
|
|
33
|
-
skill="$tree/skills/teamsmith"
|
|
34
|
-
src="$skill/scripts/panel/src"
|
|
35
|
-
bundle="$skill/scripts/panel/panel.js"
|
|
36
|
-
bun_bin="${BUN:-$(command -v bun || true)}"
|
|
37
|
-
[ -n "$bun_bin" ] || bun_bin="$HOME/.bun/bin/bun"
|
|
38
|
-
tmp="$(tmp_root_create panel-flip-m54)" || exit 3
|
|
39
|
-
PASS=0
|
|
40
|
-
FAIL=0
|
|
41
|
-
cleanup() { [ "${BASHPID:-$$}" = "$$" ] || return 0; tmp_root_reap_all; }
|
|
42
|
-
trap cleanup EXIT
|
|
43
|
-
|
|
44
|
-
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; PASS=$((PASS + 1)); }
|
|
45
|
-
bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL + 1)); }
|
|
46
|
-
|
|
47
|
-
SECTIONS=("$@")
|
|
48
|
-
[ "${#SECTIONS[@]}" -gt 0 ] || SECTIONS=(F-B F-C A2-enum)
|
|
49
|
-
want() { local s; for s in "${SECTIONS[@]}"; do [ "$s" = "$1" ] && return 0; done; return 1; }
|
|
50
|
-
|
|
51
|
-
[ -x "$bun_bin" ] || { printf 'panel-flip-m54: bun is required (rebuilds the bundle)\n' >&2; exit 3; }
|
|
52
|
-
[ -d "$skill/scripts/panel/node_modules" ] || { printf 'panel-flip-m54: run `bun install --frozen-lockfile` in scripts/panel first\n' >&2; exit 3; }
|
|
53
|
-
|
|
54
|
-
build() {
|
|
55
|
-
BUN="$bun_bin" bash "$skill/scripts/panel/build.sh" >"$tmp/build.log" 2>&1 || { tail -3 "$tmp/build.log" >&2; return 1; }
|
|
56
|
-
}
|
|
57
|
-
run_scn() { # <scenario> <logfile>
|
|
58
|
-
TEAM_P21_TREE="$tree" bash "$here/panel-p21.sh" "$1" >"$2" 2>&1
|
|
59
|
-
return $?
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
sha_before="$(sha256sum "$bundle" | cut -d' ' -f1)"
|
|
63
|
-
|
|
64
|
-
# flip <name> <file(s): space-separated> <python edit script> <scenario> <red assertion fragment>
|
|
65
|
-
# A multi-file flip snapshots and restores every file it names; the edit script still reads its first
|
|
66
|
-
# file from sys.argv[1] and can reach the others from there (or from the extra argv entries).
|
|
67
|
-
flip() {
|
|
68
|
-
local name="$1" files="$2" edit="$3" scn="$4" red_re="$5" f
|
|
69
|
-
for f in $files; do cp "$f" "$tmp/$(basename "$f").orig"; done
|
|
70
|
-
if ! FLIP_EDIT="$edit" python3 - $files <<'PYEDIT'
|
|
71
|
-
import os, sys
|
|
72
|
-
exec(compile(os.environ["FLIP_EDIT"], "<flip>", "exec"))
|
|
73
|
-
PYEDIT
|
|
74
|
-
then
|
|
75
|
-
bad "$name: 源码断点没打上(edit 脚本失败)"
|
|
76
|
-
for f in $files; do cp "$tmp/$(basename "$f").orig" "$f"; done
|
|
77
|
-
return
|
|
78
|
-
fi
|
|
79
|
-
if ! build; then
|
|
80
|
-
bad "$name: 改过的源码构建失败"
|
|
81
|
-
for f in $files; do cp "$tmp/$(basename "$f").orig" "$f"; done
|
|
82
|
-
build >/dev/null 2>&1
|
|
83
|
-
return
|
|
84
|
-
fi
|
|
85
|
-
run_scn "$scn" "$tmp/$name-red.log"
|
|
86
|
-
local rc_red=$?
|
|
87
|
-
if [ "$rc_red" -ne 0 ] && grep -q '✗' "$tmp/$name-red.log"; then
|
|
88
|
-
ok "$name:断掉之后 $scn 变红(rc=$rc_red)"
|
|
89
|
-
else
|
|
90
|
-
bad "$name:断掉之后 $scn 居然还是绿的(翻转失效)"
|
|
91
|
-
fi
|
|
92
|
-
# M59: `{ … || true; } | grep -q` — grep -q exits on the first match and grep(1) then dies on
|
|
93
|
-
# SIGPIPE; under `set -o pipefail` the pipeline would report 141 and a REAL match would read as
|
|
94
|
-
# a miss (exposed by the bigger red logs M59's failure scenes produce).
|
|
95
|
-
if { grep -E '✗' "$tmp/$name-red.log" || true; } | grep -q -- "$red_re"; then
|
|
96
|
-
ok "$name:红侧的失败点就是预期的那条($red_re)"
|
|
97
|
-
else
|
|
98
|
-
bad "$name:红侧没有点到预期的那条($red_re)"
|
|
99
|
-
fi
|
|
100
|
-
for f in $files; do cp "$tmp/$(basename "$f").orig" "$f"; done
|
|
101
|
-
if ! build; then bad "$name: 恢复后构建失败"; return; fi
|
|
102
|
-
run_scn "$scn" "$tmp/$name-green.log"
|
|
103
|
-
local rc_green=$?
|
|
104
|
-
if [ "$rc_green" -eq 0 ]; then ok "$name:恢复之后 $scn 变绿"; else bad "$name:恢复之后 $scn 仍然红"; fi
|
|
105
|
-
if [ "$(sha256sum "$bundle" | cut -d' ' -f1)" = "$sha_before" ]; then
|
|
106
|
-
ok "$name:恢复后 bundle 与提交的逐字节一致"
|
|
107
|
-
else
|
|
108
|
-
bad "$name:恢复后 bundle 与提交的不一致"
|
|
109
|
-
fi
|
|
110
|
-
printf ' 红侧尾部:\n'
|
|
111
|
-
{ grep -E '✗' "$tmp/$name-red.log" || true; } | head -3 | sed 's/^/ /'
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
printf '\033[1m== panel-flip-m54 · 控制台三处断点(F-B choices 读取 / F-C 机器目录 / A2 硬编码键表) ==\033[0m\n'
|
|
115
|
-
|
|
116
|
-
# F-B · the rejected design: the bundle ignores the command's `choices` object.
|
|
117
|
-
if want F-B; then
|
|
118
|
-
flip "F-B choices 读取被断掉" "$src/App.tsx" '
|
|
119
|
-
import sys
|
|
120
|
-
p = sys.argv[1]
|
|
121
|
-
s = open(p, encoding="utf-8").read()
|
|
122
|
-
old = " const ch = key.choices\n if (!ch || typeof ch !== \u0027object\u0027 || !Array.isArray(ch.values)) return false"
|
|
123
|
-
new = " const ch = key.choices\n if (true) return false // FLIP(F-B): the rejected design — the bundle keeps its own option table"
|
|
124
|
-
assert old in s, "找不到 choices 读取那一行"
|
|
125
|
-
s = s.replace(old, new, 1)
|
|
126
|
-
open(p, "w", encoding="utf-8").write(s)
|
|
127
|
-
' choices '保持未设'
|
|
128
|
-
fi
|
|
129
|
-
|
|
130
|
-
# F-C · the rejected source: the machine Pi catalogue becomes an option.
|
|
131
|
-
if want F-C; then
|
|
132
|
-
flip "F-C 机器目录泄漏进选择器" "$src/App.tsx" '
|
|
133
|
-
import sys
|
|
134
|
-
p = sys.argv[1]
|
|
135
|
-
s = open(p, encoding="utf-8").read()
|
|
136
|
-
old = " const base = key.set ? key.value : \u0027\u0027"
|
|
137
|
-
new = """ const base = key.set ? key.value : \u0027\u0027
|
|
138
|
-
if (kind === \u0027model\u0027) { out.push({ value: \u0027sub2api/gpt-5.6-luna\u0027, kind: \u0027value\u0027 }); seen.add(\u0027sub2api/gpt-5.6-luna\u0027) } // FLIP(F-C)"""
|
|
139
|
-
assert old in s, "找不到 buildChoiceEntries 的 base 行"
|
|
140
|
-
s = s.replace(old, new, 1)
|
|
141
|
-
open(p, "w", encoding="utf-8").write(s)
|
|
142
|
-
' choices 'sub2api'
|
|
143
|
-
fi
|
|
144
|
-
|
|
145
|
-
# A2-enum · the rejected design: a per-key option table inside the bundle (a new enum key gets none).
|
|
146
|
-
if want A2-enum; then
|
|
147
|
-
flip "A2 硬编码键表" "$src/App.tsx" '
|
|
148
|
-
import sys
|
|
149
|
-
p = sys.argv[1]
|
|
150
|
-
s = open(p, encoding="utf-8").read()
|
|
151
|
-
old = " const values = (Array.isArray(ch.values) ? ch.values : []).map((v) => String(v))"
|
|
152
|
-
new = """ const values = (Array.isArray(ch.values) ? ch.values : []).map((v) => String(v))
|
|
153
|
-
// FLIP(A2): the rejected design — a hardcoded key table inside the bundle
|
|
154
|
-
if (kind === \u0027enum\u0027 && ![\u0027TEAM_MONITOR_UI\u0027, \u0027TEAM_BRANCH_MODE\u0027, \u0027TEAM_VCS\u0027].includes(key.name)) return []"""
|
|
155
|
-
assert old in s, "找不到 values 行"
|
|
156
|
-
s = s.replace(old, new, 1)
|
|
157
|
-
open(p, "w", encoding="utf-8").write(s)
|
|
158
|
-
' choices-schema '新增 enum 键的选择器没有打开'
|
|
159
|
-
fi
|
|
160
|
-
|
|
161
|
-
# W-A · the rejected M65 open path: the picker waits on a fresh read again (needs the awaited
|
|
162
|
-
# API back in main.tsx — the flip restores both files).
|
|
163
|
-
if want W-A; then
|
|
164
|
-
flip "W-A 打开选择器前强制重读" "$src/App.tsx $src/main.tsx" '
|
|
165
|
-
import os, sys
|
|
166
|
-
app = sys.argv[1]
|
|
167
|
-
main = os.path.join(os.path.dirname(app), "main.tsx")
|
|
168
|
-
s = open(app, encoding="utf-8").read()
|
|
169
|
-
old_sig = " const openSettingsRow = useCallback(\n (index: number) => {"
|
|
170
|
-
new_sig = " const openSettingsRow = useCallback(\n async (index: number) => {"
|
|
171
|
-
assert old_sig in s, "找不到 openSettingsRow 的签名"
|
|
172
|
-
s = s.replace(old_sig, new_sig, 1)
|
|
173
|
-
old = " // M65/D11: the editor opens on the `settings` block already on screen"
|
|
174
|
-
new = " await (api as unknown as { refreshSettings: () => Promise<unknown> }).refreshSettings() // FLIP(W-A)\n" + old
|
|
175
|
-
assert old in s, "找不到 openSettingsRow 的 M65/D11 注释"
|
|
176
|
-
s = s.replace(old, new, 1)
|
|
177
|
-
open(app, "w", encoding="utf-8").write(s)
|
|
178
|
-
m = open(main, encoding="utf-8").read()
|
|
179
|
-
oldm = " function refreshSettingsSoon(): void {"
|
|
180
|
-
newm = " function refreshSettings(): Promise<unknown> {\n return cache.refresh({ force: true, only: [\u0027settings\u0027] }).then(adopt)\n }\n\n" + oldm
|
|
181
|
-
assert oldm in m, "找不到 refreshSettingsSoon"
|
|
182
|
-
m = m.replace(oldm, newm, 1)
|
|
183
|
-
old_api = " refreshSettingsSoon,"
|
|
184
|
-
new_api = " refreshSettings,\n refreshSettingsSoon,"
|
|
185
|
-
assert old_api in m, "找不到 api 对象里的 refreshSettingsSoon"
|
|
186
|
-
m = m.replace(old_api, new_api, 1)
|
|
187
|
-
open(main, "w", encoding="utf-8").write(m)
|
|
188
|
-
' choices '按键→帧之间零读取'
|
|
189
|
-
fi
|
|
190
|
-
|
|
191
|
-
# W-B · the rejected M65 accept: every entry opens the compose editor again (no write on the accept).
|
|
192
|
-
if want W-B; then
|
|
193
|
-
flip "W-B 条目改回开编辑器(不直写)" "$src/App.tsx" '
|
|
194
|
-
import sys
|
|
195
|
-
p = sys.argv[1]
|
|
196
|
-
s = open(p, encoding="utf-8").read()
|
|
197
|
-
old = " const target = choiceTarget(picker)\n settingRowRef.current = target\n if (entry.kind === \u0027free\u0027 || entry.seed !== undefined) {"
|
|
198
|
-
new = " const target = choiceTarget(picker)\n settingRowRef.current = target\n if (true) { // FLIP(W-B): the rejected pre-rework accept\n"
|
|
199
|
-
assert old in s, "找不到 accept 分支"
|
|
200
|
-
s = s.replace(old, new, 1)
|
|
201
|
-
open(p, "w", encoding="utf-8").write(s)
|
|
202
|
-
' choices 'bool 的直写回执没出现'
|
|
203
|
-
fi
|
|
204
|
-
|
|
205
|
-
printf '\n\033[1m== 结果 ==\033[0m ✓ %d ✗ %d\n' "$PASS" "$FAIL"
|
|
206
|
-
[ "$FAIL" -eq 0 ] && exit 0
|
|
207
|
-
exit 1
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# panel-flip-p123.sh — the break/fix flips for P123 (change panel-board-cards, panel delta).
|
|
3
|
-
#
|
|
4
|
-
# bash skills/teamsmith/tests/panel-flip-p123.sh # every flip
|
|
5
|
-
# bash skills/teamsmith/tests/panel-flip-p123.sh F-ORDER # selected flips
|
|
6
|
-
#
|
|
7
|
-
# Each flip copies `panel/src` to a scratch tree, patches it, builds a mutant bundle with the pinned
|
|
8
|
-
# bun, and runs the same P123 frame checks against the mutant (they must go red) and against the
|
|
9
|
-
# committed bundle (they must be green). The working tree's sources are never touched — the mutant
|
|
10
|
-
# lives in the scratch tree, and the committed `panel.js` is compared byte for byte at the end.
|
|
11
|
-
#
|
|
12
|
-
# Flips:
|
|
13
|
-
# F-ORDER the card line carries the agent again before the title (the pre-P123 line) → the
|
|
14
|
-
# card-line check reds.
|
|
15
|
-
# F-CARDS the fold branch falls through to the card loop (folded lanes render cards) → the
|
|
16
|
-
# folded-lane check reds.
|
|
17
|
-
# F-PERSIST the `c` toggle writes nothing to panel.conf → the b3 restart assertion reds.
|
|
18
|
-
# F-MACHINE the machine text frame reads panel.conf's fold keys → the two prints differ.
|
|
19
|
-
# F-EMPTY DEFAULT_SETTINGS.boardEmptyFold=false → the empty-lane default check reds.
|
|
20
|
-
# F-WIDTH the width algorithm ignores the fold (every lane keeps the even share) → the width
|
|
21
|
-
# re-share check reds.
|
|
22
|
-
#
|
|
23
|
-
# Exit: 0 every selected flip behaved, 1 at least one flip did not, 3 setup failure.
|
|
24
|
-
set -uo pipefail
|
|
25
|
-
|
|
26
|
-
here="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
27
|
-
# P53:临时根的唯一创建者(${TMPDIR:-/tmp} + owned 家族 + 回收)
|
|
28
|
-
. "$here/lib/tmp-root.sh"
|
|
29
|
-
tree="$(cd -P "$here/../../.." && pwd)"
|
|
30
|
-
skill="$tree/skills/teamsmith"
|
|
31
|
-
panel_dir="$skill/scripts/panel"
|
|
32
|
-
src="$panel_dir/src"
|
|
33
|
-
src_tree="$tree/skills/teamsmith/tests"
|
|
34
|
-
stub="$src_tree/panel-b3-stub.sh"
|
|
35
|
-
committed="$panel_dir/panel.js"
|
|
36
|
-
bun_bin="${BUN:-$(command -v bun || true)}"
|
|
37
|
-
[ -n "$bun_bin" ] || bun_bin="$HOME/.bun/bin/bun"
|
|
38
|
-
js="$(command -v node || command -v bun || true)"
|
|
39
|
-
tmp="$(tmp_root_create panel-flip-p123)" || exit 3
|
|
40
|
-
PASS=0
|
|
41
|
-
FAIL=0
|
|
42
|
-
cleanup() { [ "${BASHPID:-$$}" = "$$" ] || return 0; tmp_root_reap_all; }
|
|
43
|
-
trap cleanup EXIT
|
|
44
|
-
|
|
45
|
-
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; PASS=$((PASS + 1)); }
|
|
46
|
-
bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL + 1)); }
|
|
47
|
-
|
|
48
|
-
SECTIONS=("$@")
|
|
49
|
-
[ "${#SECTIONS[@]}" -gt 0 ] || SECTIONS=(F-ORDER F-CARDS F-PERSIST F-MACHINE F-EMPTY F-WIDTH)
|
|
50
|
-
want() { local s; for s in "${SECTIONS[@]}"; do [ "$s" = "$1" ] && return 0; done; return 1; }
|
|
51
|
-
|
|
52
|
-
[ -x "$bun_bin" ] || { printf 'panel-flip-p123: bun is required (rebuilds the mutant bundle)\n' >&2; exit 3; }
|
|
53
|
-
[ -n "$js" ] || { printf 'panel-flip-p123: node or bun is required (runs the frames)\n' >&2; exit 3; }
|
|
54
|
-
[ -d "$panel_dir/node_modules" ] || { printf 'panel-flip-p123: run `bun install --frozen-lockfile` in scripts/panel first\n' >&2; exit 3; }
|
|
55
|
-
[ -f "$stub" ] || { printf 'panel-flip-p123: missing %s\n' "$stub" >&2; exit 3; }
|
|
56
|
-
|
|
57
|
-
ink_pin="$(sed -n 's/.*"ink": *"\([^"]*\)".*/\1/p' "$panel_dir/package.json")"
|
|
58
|
-
react_pin="$(sed -n 's/.*"react": *"\([^"]*\)".*/\1/p' "$panel_dir/package.json")"
|
|
59
|
-
[ -n "$ink_pin" ] && [ -n "$react_pin" ] || { printf 'panel-flip-p123: cannot read the pins\n' >&2; exit 3; }
|
|
60
|
-
|
|
61
|
-
committed_sha_before="$(sha256sum "$committed" | cut -d' ' -f1)"
|
|
62
|
-
|
|
63
|
-
# ---------------------------------------------------------------- the P123 frame checks
|
|
64
|
-
# <panel.js> <workdir> → prints one ✓/✗ line per property; exit 1 when any property is red. The
|
|
65
|
-
# same function is the green side (committed bundle) and the red side (mutant), so a flip cannot
|
|
66
|
-
# pass by changing the yardstick.
|
|
67
|
-
frame_checks() { # <panel.js> <dir>
|
|
68
|
-
local p="$1" d="$2" rc=0
|
|
69
|
-
mkdir -p "$d/root/state"
|
|
70
|
-
render() { # <out> <w> <h> <conf...>
|
|
71
|
-
local out="$1" w="$2" h="$3"; shift 3
|
|
72
|
-
rm -f "$d/root/state/panel.conf"
|
|
73
|
-
[ $# -gt 0 ] && printf '%s\n' "$@" >"$d/root/state/panel.conf"
|
|
74
|
-
# Redirect + sed, never a pipe: the panel exits right after its write and a piped reader can
|
|
75
|
-
# lose the tail. The assertions read visible text, so the tone SGR bytes are stripped here.
|
|
76
|
-
( cd "$d" && env -u TEAM_ROOT -u TEAM_MAIN_ROOT -u TEAM_PROJECT -u TEAM_SESSION \
|
|
77
|
-
"$js" "$p" --snapshot --root "$d/root" --state-dir "$d/root/state" \
|
|
78
|
-
--team-cli "$stub" --lang zh --theme dark --width "$w" --height "$h" --page 4 ) >"$out.raw" 2>/dev/null
|
|
79
|
-
sed 's/\x1b\[[0-9;]*m//g' "$out.raw" >"$out"
|
|
80
|
-
}
|
|
81
|
-
machine() { # <out> <conf>
|
|
82
|
-
local out="$1"
|
|
83
|
-
printf '%s\n' "$2" >"$d/root/state/panel.conf"
|
|
84
|
-
( cd "$d" && env -u TEAM_ROOT -u TEAM_MAIN_ROOT -u TEAM_PROJECT -u TEAM_SESSION \
|
|
85
|
-
"$js" "$p" --print --page 4 --root "$d/root" --state-dir "$d/root/state" --team-cli "$stub" ) >"$out.raw" 2>/dev/null
|
|
86
|
-
sed -E 's/[0-9]{2}:[0-9]{2}:[0-9]{2}/TT/g' "$out.raw" >"$out"
|
|
87
|
-
}
|
|
88
|
-
local row band wip_before wip_after
|
|
89
|
-
# 1) the card line: no agent/phase field, the pair on the key band (the degradation order's head).
|
|
90
|
-
render "$d/default.txt" 160 32
|
|
91
|
-
row="$(grep -a 'V14' "$d/default.txt" | head -1)"
|
|
92
|
-
if printf '%s' "$row" | grep -qE ' (verify|apply) '; then
|
|
93
|
-
printf ' \033[31m✗\033[0m 卡片行仍带 agent/phase:%s\n' "$(printf '%s' "$row" | cut -c1-80)"; rc=1
|
|
94
|
-
elif grep -aqF 'verify · verify' "$d/default.txt"; then
|
|
95
|
-
printf ' \033[32m✓\033[0m 卡片只留序号+标题,焦点卡的对在键位带上\n'
|
|
96
|
-
else
|
|
97
|
-
printf ' \033[31m✗\033[0m 键位带没有焦点卡的 agent · phase 对\n'; rc=1
|
|
98
|
-
fi
|
|
99
|
-
# 2) folding builds no card rows; in the side-by-side tier the folded lane is the three-column
|
|
100
|
-
# frame (P125), so the check counts the frames and the absence of the lane's cards.
|
|
101
|
-
render "$d/folddone.txt" 160 32 "boardFold=done"
|
|
102
|
-
frames="$(grep -o '╭─╮' "$d/folddone.txt" | wc -l | tr -d ' ')"
|
|
103
|
-
if [ "$frames" = "3" ] && grep -aqF '│⋮│' "$d/folddone.txt" && ! grep -aqF 'P13' "$d/folddone.txt"; then
|
|
104
|
-
printf ' \033[32m✓\033[0m 折叠的 done 是三列小框(3 个、省略号列在)、没有建卡片行\n'
|
|
105
|
-
else
|
|
106
|
-
printf ' \033[31m✗\033[0m 折叠的 done 仍建了卡片行或没有三列小框(%s 个)\n' "$frames"; rc=1
|
|
107
|
-
fi
|
|
108
|
-
# 3) the width re-share: folding a lane widens the unfolded ones.
|
|
109
|
-
render "$d/width.txt" 160 32 "boardFold=done"
|
|
110
|
-
wip() { python3 - "$1" <<'PYW'
|
|
111
|
-
import re, sys
|
|
112
|
-
|
|
113
|
-
row = re.sub(r"\x1b\[[0-9;]*m", "", open(sys.argv[1], encoding="utf-8").read()).split("\n")[2]
|
|
114
|
-
i = row.find("▾ 进行")
|
|
115
|
-
left, right = row.rfind("╭", 0, i), row.find("╮", i)
|
|
116
|
-
print(right - left + 1 if i >= 0 and left >= 0 and right >= 0 else -1)
|
|
117
|
-
PYW
|
|
118
|
-
}
|
|
119
|
-
wip_before="$(wip "$d/default.txt")"; wip_after="$(wip "$d/width.txt")"
|
|
120
|
-
if [ "$wip_before" -gt 0 ] && [ "$wip_after" -gt "$wip_before" ]; then
|
|
121
|
-
printf ' \033[32m✓\033[0m 折叠让出宽度(wip 盒 %s → %s)\n' "$wip_before" "$wip_after"
|
|
122
|
-
else
|
|
123
|
-
printf ' \033[31m✗\033[0m 折叠没有让出宽度(wip 盒 %s → %s)\n' "$wip_before" "$wip_after"; rc=1
|
|
124
|
-
fi
|
|
125
|
-
# 4) empty lanes fold by default (in the wide tier as the three-column frame); 5) an explicit
|
|
126
|
-
# show keeps an empty lane unfolded (checked in the grouped tier, where the in-place line lives).
|
|
127
|
-
if grep -aqF '╭─╮' "$d/default.txt" && ! grep -aqF '▾ 待复验 0' "$d/default.txt"; then
|
|
128
|
-
printf ' \033[32m✓\033[0m 空车道默认折叠(三列小框)\n'
|
|
129
|
-
else
|
|
130
|
-
printf ' \033[31m✗\033[0m 空车道没有按默认折叠\n'; rc=1
|
|
131
|
-
fi
|
|
132
|
-
render "$d/show.txt" 99 40 "boardShow=review"
|
|
133
|
-
if grep -aqF '▾ 待复验 0' "$d/show.txt"; then
|
|
134
|
-
printf ' \033[32m✓\033[0m 显式展开的空车道保持展开\n'
|
|
135
|
-
else
|
|
136
|
-
printf ' \033[31m✗\033[0m 显式展开的空车道仍被折叠\n'; rc=1
|
|
137
|
-
fi
|
|
138
|
-
# 6) the machine frame never reads the fold keys (two confs print byte-identically).
|
|
139
|
-
machine "$d/machine-a.txt" "boardFold=done"
|
|
140
|
-
machine "$d/machine-b.txt" "lang=en"
|
|
141
|
-
if cmp -s "$d/machine-a.txt" "$d/machine-b.txt"; then
|
|
142
|
-
printf ' \033[32m✓\033[0m 机读帧忽略折叠键\n'
|
|
143
|
-
else
|
|
144
|
-
printf ' \033[31m✗\033[0m 机读帧读了面板 conf 的折叠键\n'; rc=1
|
|
145
|
-
fi
|
|
146
|
-
return $rc
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
# ---------------------------------------------------------------- the mutant build
|
|
150
|
-
build_mutant() { # <name> <edit script>
|
|
151
|
-
local name="$1" edit="$2" tree="$tmp/$1"
|
|
152
|
-
rm -rf "$tree"; mkdir -p "$tree"
|
|
153
|
-
cp -r "$src/." "$tree/"
|
|
154
|
-
ln -sfn "$panel_dir/node_modules" "$tree/node_modules"
|
|
155
|
-
if ! FLIP_EDIT="$edit" FLIP_TREE="$tree" python3 - <<'PYEDIT'
|
|
156
|
-
import os
|
|
157
|
-
tree = os.environ["FLIP_TREE"]
|
|
158
|
-
exec(compile(os.environ["FLIP_EDIT"], "<flip>", "exec"))
|
|
159
|
-
PYEDIT
|
|
160
|
-
then
|
|
161
|
-
printf ' \033[31m✗\033[0m %s:源码断点没打上\n' "$name"
|
|
162
|
-
return 1
|
|
163
|
-
fi
|
|
164
|
-
( cd "$panel_dir" && "$bun_bin" build "$tree/main.tsx" --target=node --format=esm --minify \
|
|
165
|
-
--define "__PIN_INK__=\"$ink_pin\"" --define "__PIN_REACT__=\"$react_pin\"" \
|
|
166
|
-
--outfile "$tmp/$1.js" ) >"$tmp/$1-build.log" 2>&1 || {
|
|
167
|
-
printf ' \033[31m✗\033[0m %s:突变的 bundle 构建失败\n' "$name"; tail -3 "$tmp/$1-build.log" >&2; return 1
|
|
168
|
-
}
|
|
169
|
-
return 0
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
# <name> <edit script> <run the red side> <red-side description>
|
|
173
|
-
flip() {
|
|
174
|
-
local name="$1" edit="$2" runner="$3" what="$4"
|
|
175
|
-
printf '\n\033[1m== %s:%s ==\033[0m\n' "$name" "$what"
|
|
176
|
-
build_mutant "$name" "$edit" || { FAIL=$((FAIL + 1)); return; }
|
|
177
|
-
local green="$tmp/$name-green.log" red="$tmp/$name-red.log"
|
|
178
|
-
frame_checks "$committed" "$tmp/$name-green-dir" >"$green" 2>&1; local green_rc=$?
|
|
179
|
-
frame_checks "$tmp/$name.js" "$tmp/$name-red-dir" >"$red" 2>&1; local red_rc=$?
|
|
180
|
-
if [ "$green_rc" -eq 0 ]; then
|
|
181
|
-
ok "$name:提交的 bundle 上同一组检查绿"
|
|
182
|
-
else
|
|
183
|
-
bad "$name:提交的 bundle 上基线就红了(检查本身坏了)"; sed 's/^/ /' "$green" | grep '✗' | head -3
|
|
184
|
-
fi
|
|
185
|
-
if [ -n "$runner" ]; then
|
|
186
|
-
# The interaction half: the mutant bundle runs the b3 fold scenario; the named assertion must
|
|
187
|
-
# fail there even though the frame checks are (by design) still green — a persistence flip is
|
|
188
|
-
# not observable on one frame.
|
|
189
|
-
TEAM_B3_PANEL="$tmp/$name.js" bash "$src_tree/panel-b3.sh" fold >"$tmp/$name-b3.log" 2>&1 || true
|
|
190
|
-
if { sed 's/\x1b\[[0-9;]*m//g' "$tmp/$name-b3.log" || true; } | grep -qF "✗ $runner"; then
|
|
191
|
-
ok "$name:b3 fold 场景点名红了「$runner」"
|
|
192
|
-
else
|
|
193
|
-
bad "$name:b3 fold 场景没有点名红「$runner」"; sed 's/\x1b\[[0-9;]*m//g' "$tmp/$name-b3.log" | grep '✗' | head -3
|
|
194
|
-
fi
|
|
195
|
-
elif [ "$red_rc" -ne 0 ] && grep -q '✗' "$red"; then
|
|
196
|
-
ok "$name:突变之后变红($(grep -c '✗' "$red") 条;$(grep '✗' "$red" | head -1 | sed 's/^ *✗ *//' | cut -c1-70))"
|
|
197
|
-
else
|
|
198
|
-
bad "$name:突变之后居然还是绿的(翻转失效)"; sed 's/^/ /' "$red"
|
|
199
|
-
fi
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
# ---------------------------------------------------------------- the flips
|
|
203
|
-
if want F-ORDER; then
|
|
204
|
-
flip F-ORDER 'p = f"{tree}/layout.ts"
|
|
205
|
-
s = open(p, encoding="utf-8").read()
|
|
206
|
-
old = " return truncLine(ln(seg(cursor, cursorTone), seg(`${glyph} `, tone), seg(`${card.id} `, idTone), seg(card.title)), width)"
|
|
207
|
-
new = " return truncLine(ln(seg(cursor, cursorTone), seg(`${glyph} `, tone), seg(`${card.id} `, idTone), seg(`${card.agent} `, \"dim\"), seg(card.title)), width) // FLIP P123"
|
|
208
|
-
assert s.count(old) == 1, "anchor"
|
|
209
|
-
open(p, "w", encoding="utf-8").write(s.replace(old, new))
|
|
210
|
-
' "" "把 agent 放回卡片行(降级序倒过来)"
|
|
211
|
-
fi
|
|
212
|
-
|
|
213
|
-
if want F-CARDS; then
|
|
214
|
-
flip F-CARDS 'p = f"{tree}/layout.ts"
|
|
215
|
-
s = open(p, encoding="utf-8").read()
|
|
216
|
-
old = "laneColumn(ctx, lane, widths.get(lane) ?? 8, slots, target, ordinals, windows, foldedLanes.includes(lane))"
|
|
217
|
-
new = "laneColumn(ctx, lane, widths.get(lane) ?? 8, slots, target, ordinals, windows, false /* FLIP P123: the fold branch never runs */)"
|
|
218
|
-
assert s.count(old) == 1, "anchor"
|
|
219
|
-
open(p, "w", encoding="utf-8").write(s.replace(old, new))
|
|
220
|
-
' "" "折叠分支不生效(折叠车道照旧建卡片行)"
|
|
221
|
-
fi
|
|
222
|
-
|
|
223
|
-
if want F-PERSIST; then
|
|
224
|
-
flip F-PERSIST 'p = f"{tree}/settings.ts"
|
|
225
|
-
s = open(p, encoding="utf-8").read()
|
|
226
|
-
old = """ `boardFold=${BOARD_LANES.filter((lane) => s.boardFold.includes(lane)).join(\u0027,\u0027)}`,
|
|
227
|
-
`boardShow=${BOARD_LANES.filter((lane) => s.boardShow.includes(lane)).join(\u0027,\u0027)}`,
|
|
228
|
-
"""
|
|
229
|
-
new = " // FLIP P123: the fold state is never written to the file\n"
|
|
230
|
-
assert s.count(old) == 1, "anchor"
|
|
231
|
-
open(p, "w", encoding="utf-8").write(s.replace(old, new))
|
|
232
|
-
' "重启后 todo 仍折叠(显式状态持久:展开头不出现)" "折叠状态不落盘(重启断言红)"
|
|
233
|
-
fi
|
|
234
|
-
|
|
235
|
-
if want F-MACHINE; then
|
|
236
|
-
flip F-MACHINE 'p = f"{tree}/main.tsx"
|
|
237
|
-
s = open(p, encoding="utf-8").read()
|
|
238
|
-
old = "view: defaultView(\u0027zh\u0027, machinePage) } as LayoutInput)\n out(\u0060${renderPlain(themed).join(\u0027\\n\u0027)}\\n\u0060)\n if (once) await runTickIfDue()"
|
|
239
|
-
new = "view: { ...defaultView(\u0027zh\u0027, machinePage), boardFold: readSettings(confFile).boardFold } } as LayoutInput) // FLIP P123\n out(\u0060${renderPlain(themed).join(\u0027\\n\u0027)}\\n\u0060)\n if (once) await runTickIfDue()"
|
|
240
|
-
assert s.count(old) == 1, "anchor"
|
|
241
|
-
open(p, "w", encoding="utf-8").write(s.replace(old, new))
|
|
242
|
-
' "" "机读帧读 panel.conf 的折叠键"
|
|
243
|
-
fi
|
|
244
|
-
|
|
245
|
-
if want F-EMPTY; then
|
|
246
|
-
flip F-EMPTY 'p = f"{tree}/settings.ts"
|
|
247
|
-
s = open(p, encoding="utf-8").read()
|
|
248
|
-
old = " boardEmptyFold: true,"
|
|
249
|
-
new = " boardEmptyFold: false, // FLIP P123"
|
|
250
|
-
assert s.count(old) == 1, "anchor"
|
|
251
|
-
open(p, "w", encoding="utf-8").write(s.replace(old, new))
|
|
252
|
-
' "" "空车道默认折叠关掉"
|
|
253
|
-
fi
|
|
254
|
-
|
|
255
|
-
if want F-WIDTH; then
|
|
256
|
-
flip F-WIDTH 'p = f"{tree}/layout.ts"
|
|
257
|
-
s = open(p, encoding="utf-8").read()
|
|
258
|
-
old = """ const widths = new Map<string, number>()
|
|
259
|
-
if (!foldedLanes.length) {"""
|
|
260
|
-
new = """ const widths = new Map<string, number>()
|
|
261
|
-
if (!foldedLanes.length || true) { // FLIP P123: every lane keeps the even share"""
|
|
262
|
-
assert s.count(old) == 1, "anchor"
|
|
263
|
-
open(p, "w", encoding="utf-8").write(s.replace(old, new))
|
|
264
|
-
' "" "宽度不随折叠再分配"
|
|
265
|
-
fi
|
|
266
|
-
|
|
267
|
-
# ---------------------------------------------------------------- the committed bundle must be untouched
|
|
268
|
-
committed_sha_after="$(sha256sum "$committed" | cut -d' ' -f1)"
|
|
269
|
-
if [ "$committed_sha_before" = "$committed_sha_after" ]; then
|
|
270
|
-
ok "翻转全程没有碰提交的 panel.js(sha256 不变)"
|
|
271
|
-
else
|
|
272
|
-
bad "翻转改动了提交的 panel.js($committed_sha_before → $committed_sha_after)"
|
|
273
|
-
fi
|
|
274
|
-
|
|
275
|
-
printf '\n\033[1m== 结果 ==\033[0m ✓ %d ✗ %d\n' "$PASS" "$FAIL"
|
|
276
|
-
[ "$FAIL" -eq 0 ] && { printf '\033[32mpanel-flip-p123 全绿\033[0m\n'; exit 0; }
|
|
277
|
-
printf '\033[31mpanel-flip-p123 有失败项\033[0m\n'
|
|
278
|
-
exit 1
|