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,288 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# P217 · 独立验证包:**pane_pid 自己就在跑那个 agent(argv[1] 就是它)算在跑** 的 red → green → 判据翻转(影子)
|
|
3
|
+
#
|
|
4
|
+
# bash skills/teamsmith/tests/flip-p217.sh
|
|
5
|
+
# TEAM_FLIP_PRE217=<sha> bash skills/teamsmith/tests/flip-p217.sh # 覆盖「P217 之前」的 revision
|
|
6
|
+
# KEEP=1 bash skills/teamsmith/tests/flip-p217.sh # 保留临时根排查
|
|
7
|
+
#
|
|
8
|
+
# 事故(P214 独立诊断的现场,2026-10-04):P210 的判据在「前台是裸 shell」那一支只认**直接子进程**
|
|
9
|
+
# (`team_agent_alive_in_pane` 的 children 扫描),于是把「脚本型 agent 被直接当 pane 命令起」的形状
|
|
10
|
+
# (`bash <agent>`,argv[1] 就是它)也一起判成 exited。同一个形状在 §41 的夹具里,读数是两条红:
|
|
11
|
+
# `roster 四态 ① running` 与机器面 `state=exited`。代价是**反方向**的假告警:判停 → `team resume` 的
|
|
12
|
+
# 下一步 respawn → 杀掉一个正在干活的 agent(比假活更贵)。
|
|
13
|
+
#
|
|
14
|
+
# 本包对**同一套真 tmux 夹具**跑三棵树(入口有库函数 team_agent_live 与 CLI resume --dry-run 两层):
|
|
15
|
+
# s1 `bash <agent>`(argv[1] 就是它、没有 agent 子进程)—— P217 修的那个形状:pre 树 stopped → green 树 alive
|
|
16
|
+
# s2 外层 `bash -lc <agent>`(bash 对 -c 的最后一条命令直接 exec → 与 s1 同形)—— 与 s1 同判
|
|
17
|
+
# s3 `bash -lc '<agent> & wait'`(agent 是**直接子进程**)—— M37 的承诺,两棵树都必须 alive
|
|
18
|
+
# s4 `bash -lc '<agent>; :'`(**生产 harness 的形状**:前后都有语句、末尾 exec bash)—— 两棵树都必须 alive
|
|
19
|
+
# s5 `bash --noprofile --norc -s <agent>`(P103 的假活形状:argv[1] 是选项,agent 只是参数)—— green 树必须 stopped
|
|
20
|
+
# s6 `bash -c 'sleep 600 && true'`(对照:命令行里根本没有 agent)—— 两棵树都必须 stopped
|
|
21
|
+
# 判据翻转(影子):绿树副本把 s1 的判据**放宽**成「命令行里提到 agent 就算在跑」(= P103 的旧口径)
|
|
22
|
+
# → s5 必须变 alive(绿树的 stopped 断言会红),s6 必须照旧 stopped(影子不是橡皮章)。
|
|
23
|
+
#
|
|
24
|
+
# 只写 /tmp 下的临时目录,只碰自己起的私有 tmux session(结束清理);离开前证明 socket 是私有的。
|
|
25
|
+
set -uo pipefail
|
|
26
|
+
|
|
27
|
+
SELF_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
28
|
+
SKILL_DIR="$(cd -P "$SELF_DIR/.." && pwd)"
|
|
29
|
+
# P53:临时根的唯一创建者(${TMPDIR:-/tmp} + owned 家族 + 回收)
|
|
30
|
+
. "$SELF_DIR/lib/tmp-root.sh"
|
|
31
|
+
# P162:破坏性调用(kill-server/kill-session/kill-window)动手前先证明私有 socket 生效
|
|
32
|
+
. "$SELF_DIR/lib/tmux-iso.sh"
|
|
33
|
+
REPO_ROOT="$(git -C "$SKILL_DIR" rev-parse --show-toplevel 2>/dev/null || true)"
|
|
34
|
+
[ -n "$REPO_ROOT" ] || { printf 'flip-p217: 找不到 git 仓库(本脚本需要 git archive 取 P217 之前的树)\n' >&2; exit 2; }
|
|
35
|
+
command -v tmux >/dev/null 2>&1 || { printf 'flip-p217: 需要 tmux(本复现是 tmux 现场的)\n' >&2; exit 2; }
|
|
36
|
+
|
|
37
|
+
PRE="${TEAM_FLIP_PRE217:-}"
|
|
38
|
+
if [ -z "$PRE" ]; then
|
|
39
|
+
# 默认**自己找**「判据被引入的那一次提交」的前一个(`git log -S` 按字符串出现次数变化找提交;
|
|
40
|
+
# 从古到今取最后一个 = 引入者)—— 这样即使 main 已经吃掉 P217(merge-base 只指到合并点),
|
|
41
|
+
# 这个包在复验 worktree 里也照旧能自己找到参照。找不到再退回 merge-base。
|
|
42
|
+
PRE_INTR="$(git -C "$REPO_ROOT" log --format=%H -S 'team_proc_executing_bin' -- \
|
|
43
|
+
skills/teamsmith/scripts/lib/common.sh 2>/dev/null | tail -1)"
|
|
44
|
+
if [ -n "$PRE_INTR" ]; then
|
|
45
|
+
PRE="$PRE_INTR^"
|
|
46
|
+
else
|
|
47
|
+
PRE="$(git -C "$REPO_ROOT" merge-base HEAD main 2>/dev/null || true)"
|
|
48
|
+
fi
|
|
49
|
+
fi
|
|
50
|
+
[ -n "$PRE" ] || { printf 'flip-p217: 解析不到 P217 之前的 revision,用 TEAM_FLIP_PRE217=<sha> 指定\n' >&2; exit 2; }
|
|
51
|
+
|
|
52
|
+
[ "${KEEP:-0}" = "1" ] && export TEAM_TMP_KEEP=1
|
|
53
|
+
TMP="$(tmp_root_create flip-p217)" || exit 3
|
|
54
|
+
SESS="teamsmith-flip-p217-$$"
|
|
55
|
+
|
|
56
|
+
# M28/#1250:夹具自己的 tmux 调用要有隔离证据(裸 tmux 按 $TMUX 打到调用者 server —— 事故形状)。
|
|
57
|
+
unset TMUX TMUX_PANE 2>/dev/null || true
|
|
58
|
+
TMUX_TMPDIR="$TMP/tmux"; mkdir -p "$TMUX_TMPDIR"; export TMUX_TMPDIR
|
|
59
|
+
cleanup() {
|
|
60
|
+
[ "${BASHPID:-$$}" = "$$" ] || return 0 # 管道/命令替换的子 shell 不要重复清场
|
|
61
|
+
# P162:收尾先证明私有 socket 生效(不成立就拒绝;cleanup 里不许 exit)
|
|
62
|
+
tmux_iso_guard_soft "flip-p217" "收尾:私有 session" --tmpdir "${TMUX_TMPDIR:-}" --own-root "$TMP" \
|
|
63
|
+
&& tmux kill-session -t "$SESS" 2>/dev/null || true
|
|
64
|
+
tmp_root_reap_all
|
|
65
|
+
}
|
|
66
|
+
trap cleanup EXIT
|
|
67
|
+
|
|
68
|
+
# ---- 三棵树:pre(P217 之前) / green(本 worktree) / mut(green + 判据放宽成 P103 的旧口径)--------
|
|
69
|
+
mkdir -p "$TMP/pre-skill" "$TMP/fake-bin" "$TMP/repo" "$TMP/mut-skill"
|
|
70
|
+
git -C "$REPO_ROOT" archive "$PRE" skills/teamsmith | tar -x -C "$TMP/pre-skill" || exit 2
|
|
71
|
+
PRE_SKILL="$TMP/pre-skill/skills/teamsmith"
|
|
72
|
+
# 守卫:传进来的 pre 必须真的还是「P217 之前」(否则这个包会报一个假的翻转)
|
|
73
|
+
if grep -q 'team_proc_executing_bin' "$PRE_SKILL/scripts/lib/common.sh" 2>/dev/null; then
|
|
74
|
+
printf 'flip-p217: $PRE(%s)已经包含 P217 的修复(不是修复前的树)——用 TEAM_FLIP_PRE217=<修复前的 sha> 指定\n' "$PRE" >&2
|
|
75
|
+
exit 2
|
|
76
|
+
fi
|
|
77
|
+
if ! grep -q 'team_proc_executing_bin' "$SKILL_DIR/scripts/lib/common.sh" 2>/dev/null; then
|
|
78
|
+
printf 'flip-p217: 本 worktree 里找不到 team_proc_executing_bin(P217 的修复不在树上)\n' >&2; exit 2
|
|
79
|
+
fi
|
|
80
|
+
cp -a "$SKILL_DIR/scripts" "$TMP/mut-skill/scripts"
|
|
81
|
+
cat >> "$TMP/mut-skill/scripts/lib/common.sh" <<'MUTEOF'
|
|
82
|
+
|
|
83
|
+
# ---- FLIP P217(只在变异树里):把判据**放宽**成「命令行里提到 agent 就算在跑」(P103 的旧口径)----
|
|
84
|
+
# 影子咬的就是 P217 的那条分界(argv[1] 逐词相等):放宽之后 `bash --noprofile --norc -s <agent>`
|
|
85
|
+
# 必须重新变 alive —— 绿树针对它的 stopped 断言会为此变红。
|
|
86
|
+
team_proc_executing_bin() { # <pid> <可执行文件路径或名字> [已读到的 args(可选)]
|
|
87
|
+
local pid="${1:-}" want="${2:-}" preraw="${3:-}" base args tok
|
|
88
|
+
[ -n "$pid" ] && [ -n "$want" ] || return 1
|
|
89
|
+
case "$want" in
|
|
90
|
+
/*) base="$(basename "$want")" ;;
|
|
91
|
+
*) base="$want" ;;
|
|
92
|
+
esac
|
|
93
|
+
[ -n "$base" ] || return 1
|
|
94
|
+
args="${preraw:-$(ps -o args= -p "$pid" 2>/dev/null | head -1)}"
|
|
95
|
+
[ -n "$args" ] || return 1
|
|
96
|
+
case "$args" in *pm.pid.spawn*|*dispatch-*.spawn*) return 1 ;; esac
|
|
97
|
+
for tok in $args; do
|
|
98
|
+
case "${tok##*/}" in
|
|
99
|
+
"$base") return 0 ;;
|
|
100
|
+
esac
|
|
101
|
+
done
|
|
102
|
+
return 1
|
|
103
|
+
}
|
|
104
|
+
MUTEOF
|
|
105
|
+
MUT_SKILL="$TMP/mut-skill"
|
|
106
|
+
if grep -q 'FLIP P217' "$MUT_SKILL/scripts/lib/common.sh"; then :; else
|
|
107
|
+
printf 'flip-p217: 变异树没打上补丁(判据翻转会空跑)\n' >&2; exit 2
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
# ---- 夹具仓库 + 假 agent ----------------------------------------------------
|
|
111
|
+
cat > "$TMP/fake-bin/p217-agent" <<'EOF'
|
|
112
|
+
#!/usr/bin/env bash
|
|
113
|
+
echo P217-MARK
|
|
114
|
+
sleep 600
|
|
115
|
+
EOF
|
|
116
|
+
chmod +x "$TMP/fake-bin/p217-agent"
|
|
117
|
+
AGENT="$TMP/fake-bin/p217-agent"
|
|
118
|
+
|
|
119
|
+
cd "$TMP/repo" || exit 2
|
|
120
|
+
git init -q .; git config user.email t@t; git config user.name t
|
|
121
|
+
echo hi > README.md; git add -A; git commit -qm init >/dev/null; git branch -m main
|
|
122
|
+
bash "$SKILL_DIR/scripts/team" init --session "$SESS" --yes >/dev/null 2>&1
|
|
123
|
+
mkdir -p .pi/team/state docs/team/reports
|
|
124
|
+
printf '# P217 夹具任务\n' > "$TMP/task.md"
|
|
125
|
+
for _w in p217s1 p217s2 p217s3 p217s4 p217fake p217ctl; do
|
|
126
|
+
printf 'task=T1.1\ntaskfile=%s\nwindow=%s\n' "$TMP/task.md" "$_w" > ".pi/team/state/$_w.env"
|
|
127
|
+
done
|
|
128
|
+
REPO="$TMP/repo"
|
|
129
|
+
|
|
130
|
+
# ---- 真 tmux 夹具(三棵树共用,绝不重建)------------------------------------
|
|
131
|
+
tmux new-session -d -s "$SESS" -n anchor -c "$REPO" "sleep 100000" 2>/dev/null || exit 2
|
|
132
|
+
# 隔离证明:真 tmux 报出来的 socket 就是私有目录里的那个
|
|
133
|
+
SOCK="$(tmux list-sessions -F '#{socket_path}' 2>/dev/null | head -1)"
|
|
134
|
+
if [ "$SOCK" != "$TMUX_TMPDIR/tmux-$(id -u)/default" ]; then
|
|
135
|
+
printf 'flip-p217: 私有 socket 没生效(报出 %s)——拒绝继续\n' "${SOCK:-?}" >&2; exit 2
|
|
136
|
+
fi
|
|
137
|
+
# s1 脚本型 agent 直接当 pane 命令(argv[1] 就是它;shebang 让它以 bash 身份跑)
|
|
138
|
+
tmux new-window -t "$SESS" -n p217s1 -d -c "$REPO" -- "$AGENT" 2>/dev/null || true
|
|
139
|
+
# s2 外面套一层 `bash -lc <agent>`:bash 对 -c 的最后一条命令直接 exec → 进程形状与 s1 逐项相同
|
|
140
|
+
tmux new-window -t "$SESS" -n p217s2 -d -c "$REPO" -- bash -lc "$AGENT" 2>/dev/null || true
|
|
141
|
+
# s3/s4 让 agent 当**直接子进程**(M37 / 生产 harness 的形状)
|
|
142
|
+
tmux new-window -t "$SESS" -n p217s3 -d -c "$REPO" -- bash -lc "$AGENT & wait" 2>/dev/null || true
|
|
143
|
+
tmux new-window -t "$SESS" -n p217s4 -d -c "$REPO" -- bash -lc "$AGENT; :" 2>/dev/null || true
|
|
144
|
+
# s5 P103 的假活形状:agent 只是 `-s` 的位置参数(argv[1] 是选项),没有任何东西在执行它
|
|
145
|
+
tmux new-window -t "$SESS" -n p217fake -d -c "$REPO" -- bash --noprofile --norc -s "$AGENT" 2>/dev/null || true
|
|
146
|
+
# s6 对照:命令行里根本没有 agent
|
|
147
|
+
tmux new-window -t "$SESS" -n p217ctl -d -c "$REPO" -- bash -c 'sleep 600 && true' 2>/dev/null || true
|
|
148
|
+
|
|
149
|
+
# 成型(M39:建窗后 pane_pid 先是还没 exec 完的壳,判据要等命令行长成这个形状再问)
|
|
150
|
+
p217_pane_args() { # <session:window> → pane_pid 的完整命令行(窗口/进程不在 → 空)
|
|
151
|
+
local p; p="$(tmux list-panes -t "$1" -F '#{pane_pid}' 2>/dev/null | head -1)"
|
|
152
|
+
[ -n "$p" ] || return 0
|
|
153
|
+
ps -o args= -ww -p "$p" 2>/dev/null | head -1
|
|
154
|
+
}
|
|
155
|
+
p217_marker() { # <窗口> → 命令行里必须出现的成型标记
|
|
156
|
+
case "$1" in
|
|
157
|
+
p217s1|p217s2) printf 'bash %s\n' "$AGENT" ;; # s2 的 exec 完成后 argv 与 s1 相同
|
|
158
|
+
p217s3) printf '%s\n' "$AGENT & wait" ;;
|
|
159
|
+
p217s4) printf '%s\n' "$AGENT; :" ;;
|
|
160
|
+
p217fake) printf '%s\n' "-s $AGENT" ;;
|
|
161
|
+
p217ctl) printf '%s\n' "sleep 600 && true" ;;
|
|
162
|
+
esac
|
|
163
|
+
}
|
|
164
|
+
p217_wait_shape() { # <窗口> [十分之一秒数] → 0=成型
|
|
165
|
+
local i=0 args
|
|
166
|
+
while [ "$i" -lt 40 ]; do
|
|
167
|
+
args="$(p217_pane_args "$SESS:$1")"
|
|
168
|
+
case "$args" in *"$(p217_marker "$1")"*) return 0 ;; esac
|
|
169
|
+
sleep 0.1; i=$((i + 1))
|
|
170
|
+
done
|
|
171
|
+
return 1
|
|
172
|
+
}
|
|
173
|
+
for _w in p217s1 p217s2 p217s3 p217s4 p217fake p217ctl; do
|
|
174
|
+
if p217_wait_shape "$_w"; then
|
|
175
|
+
printf ' 夹具 %-8s pane_pid=%s 命令行=[%s] 子进程=[%s]\n' "$_w" \
|
|
176
|
+
"$(tmux list-panes -t "$SESS:$_w" -F '#{pane_pid}' 2>/dev/null | head -1)" \
|
|
177
|
+
"$(p217_pane_args "$SESS:$_w")" \
|
|
178
|
+
"$(ps -o args= --ppid "$(tmux list-panes -t "$SESS:$_w" -F '#{pane_pid}' 2>/dev/null | head -1)" 2>/dev/null | tr '\n' ';')"
|
|
179
|
+
else
|
|
180
|
+
printf ' 夹具 %-8s ✗ 4s 内没成型(命令行=[%s])\n' "$_w" "$(p217_pane_args "$SESS:$_w")"
|
|
181
|
+
fi
|
|
182
|
+
done
|
|
183
|
+
|
|
184
|
+
# ---- 探针:库函数层(team_agent_live)与 CLI 层(resume --dry-run),只换树 -------------
|
|
185
|
+
p217_live() { # <skill-dir> <agent-window> → alive|stopped
|
|
186
|
+
local dir="$1" agent="$2"
|
|
187
|
+
( cd "$REPO" && env -u TEAM_ROOT -u TEAM_MAIN_ROOT -u TEAM_SKILL_DIR -u TEAM_PROJECT -u TEAM_SESSION \
|
|
188
|
+
TEAM_SESSION="$SESS" TEAM_PI_BIN="$AGENT" TEAM_AGENTS="p217s1 p217s2 p217s3 p217s4 p217fake p217ctl" \
|
|
189
|
+
bash -c '. "'"$dir"'/scripts/lib/common.sh"
|
|
190
|
+
for _f in "'"$dir"'"/scripts/lib/cmd-*.sh; do . "$_f" 2>/dev/null || true; done
|
|
191
|
+
team_load_config >/dev/null 2>&1
|
|
192
|
+
if team_agent_live "$1"; then printf "alive\n"; else printf "stopped\n"; fi' _ "$agent" )
|
|
193
|
+
}
|
|
194
|
+
p217_resume() { # <skill-dir> → resume --dry-run 的输出(同一夹具、同一入口)
|
|
195
|
+
local dir="$1"
|
|
196
|
+
( cd "$REPO" && env TEAM_AGENTS="p217s1 p217s2 p217s3 p217s4 p217fake p217ctl" TEAM_PI_BIN="$AGENT" \
|
|
197
|
+
TEAM_SESSION="$SESS" bash "$dir/scripts/team" resume --dry-run 2>&1 || true )
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
printf '\nP217 之前的 revision: %s(%s)\n修复后 skill: %s\n变异树: %s(判据放宽成「命令行里提到 agent 就算在跑」)\n' \
|
|
201
|
+
"$PRE" "$(git -C "$REPO_ROOT" log -1 --format=%s "$PRE")" "$SKILL_DIR" "$MUT_SKILL"
|
|
202
|
+
|
|
203
|
+
printf '\n同一夹具、三种树的判定(入口 team_agent_live):\n'
|
|
204
|
+
printf ' %-24s %-12s %-14s %-14s %-22s\n' "形状" "窗口" "pre(无 P217)" "green(P217)" "mut(放宽成「提到」)"
|
|
205
|
+
FAIL=0
|
|
206
|
+
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; }
|
|
207
|
+
bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL + 1)); }
|
|
208
|
+
declare -A V
|
|
209
|
+
p217_label() { case "$1" in
|
|
210
|
+
p217s1) printf '① pane 命令就是 agent' ;;
|
|
211
|
+
p217s2) printf '② 外层 bash -lc <agent>' ;;
|
|
212
|
+
p217s3) printf '③ <agent> & wait(子进程)' ;;
|
|
213
|
+
p217s4) printf '④ 生产 harness 形状' ;;
|
|
214
|
+
p217fake) printf '⑤ P103 假活(-s <agent>)' ;;
|
|
215
|
+
p217ctl) printf '⑥ 对照(无 agent)' ;;
|
|
216
|
+
esac; }
|
|
217
|
+
for _w in p217s1 p217s2 p217s3 p217s4 p217fake p217ctl; do
|
|
218
|
+
V["pre_$_w"]="$(p217_live "$PRE_SKILL" "$_w")"
|
|
219
|
+
V["green_$_w"]="$(p217_live "$SKILL_DIR" "$_w")"
|
|
220
|
+
V["mut_$_w"]="$(p217_live "$MUT_SKILL" "$_w")"
|
|
221
|
+
printf ' %-24s %-12s %-14s %-14s %-22s\n' "$(p217_label "$_w")" "$_w" \
|
|
222
|
+
"${V[pre_$_w]}" "${V[green_$_w]}" "${V[mut_$_w]}"
|
|
223
|
+
done
|
|
224
|
+
|
|
225
|
+
printf '\nCLI 层(team resume --dry-run,同一夹具):\n'
|
|
226
|
+
PRE_RESUME="$(p217_resume "$PRE_SKILL")"
|
|
227
|
+
GREEN_RESUME="$(p217_resume "$SKILL_DIR")"
|
|
228
|
+
printf ' pre :%s\n' "$(printf '%s' "$PRE_RESUME" | grep -E '可续跑|没有需要续跑' | tr '\n' ' ')"
|
|
229
|
+
printf ' green:%s\n' "$(printf '%s' "$GREEN_RESUME" | grep -E '可续跑|没有需要续跑' | tr '\n' ' ')"
|
|
230
|
+
|
|
231
|
+
printf '\n== 翻转断言 ==\n'
|
|
232
|
+
# ① 红侧:P217 之前的假阴性 —— `bash <agent>`(argv[1] 就是它)被判停
|
|
233
|
+
if [ "${V[pre_p217s1]}" = "stopped" ]; then
|
|
234
|
+
ok "修复前:pane 命令就是 agent 自己(bash <agent>,argv[1] 就是它、没有 agent 子进程)判 stopped —— 假阴性复现(P214 的 §41 两条红)"
|
|
235
|
+
else
|
|
236
|
+
bad "修复前:pane 命令就是 agent 自己(bash <agent>)竟然判 ${V[pre_p217s1]}(没有复现出假阴性,夹具或基线不对)"
|
|
237
|
+
fi
|
|
238
|
+
# ① 绿侧:四种形状各一条断言 —— 脚本型 agent 被直接当 pane 命令起,也是「在跑」
|
|
239
|
+
if [ "${V[green_p217s1]}" = "alive" ]; then ok "修复后:① bash <agent>(argv[1] 就是它)判 alive"
|
|
240
|
+
else bad "修复后:① bash <agent> 仍判 ${V[green_p217s1]}(修复没生效)"; fi
|
|
241
|
+
if [ "${V[green_p217s2]}" = "alive" ]; then ok "修复后:② 外层 bash -lc <agent>(exec 后同形)判 alive"
|
|
242
|
+
else bad "修复后:② 外层 bash -lc <agent> 判 ${V[green_p217s2]}(与 ① 形状相同,不该分叉)"; fi
|
|
243
|
+
if [ "${V[green_p217s3]}" = "alive" ]; then ok "修复后:③ bash -lc 的 '<agent> & wait'(agent 是直接子进程)判 alive"
|
|
244
|
+
else bad "修复后:③ 的席位被判 ${V[green_p217s3]}(M37 的承诺被放倒了)"; fi
|
|
245
|
+
if [ "${V[green_p217s4]}" = "alive" ]; then ok "修复后:④ 生产 harness 形状(bash -lc 的 '<agent>; :')判 alive"
|
|
246
|
+
else bad "修复后:④ 生产 harness 形状被判 ${V[green_p217s4]}(生产席位的读数会错)"; fi
|
|
247
|
+
# ④ 绿侧:假活形状必须照旧判停(P103 的洞不许放回来)
|
|
248
|
+
if [ "${V[green_p217fake]}" = "stopped" ]; then ok "修复后:⑤ P103 的假活形状(bash -s <agent>,argv[1] 是选项)照旧判 stopped —— 洞仍然堵着"
|
|
249
|
+
else bad "修复后:⑤ 假活形状判 ${V[green_p217fake]}(P103 的洞被 P217 放回来了)"; fi
|
|
250
|
+
if [ "${V[green_p217ctl]}" = "stopped" ] && [ "${V[pre_p217ctl]}" = "stopped" ]; then
|
|
251
|
+
ok "对照 ⑥:命令行里没有 agent → 两棵树都判 stopped"
|
|
252
|
+
else bad "对照 ⑥ 不成立:pre=${V[pre_p217ctl]} green=${V[green_p217ctl]}"; fi
|
|
253
|
+
# ② 改 P217 之前的形状在生产形状上的读数不许变(修的是假阴性,不是放宽整套判据)
|
|
254
|
+
if [ "${V[pre_p217s3]}" = "alive" ] && [ "${V[pre_p217s4]}" = "alive" ]; then
|
|
255
|
+
ok "修复前:③④(agent 是子进程)本来就是 alive —— 修的是 ①② 的假阴性,没有动它们"
|
|
256
|
+
else bad "修复前:③④ 的读数与 M37/生产口径不符(pre=${V[pre_p217s3]}/${V[pre_p217s4]})"; fi
|
|
257
|
+
# CLI 层:修复前 resume **列出**该席位(判停 = 可续跑),而下一步的 respawn 会杀掉在跑的 agent
|
|
258
|
+
if printf '%s' "$PRE_RESUME" | grep -q "p217s1 可续跑"; then
|
|
259
|
+
ok "修复前 CLI:resume --dry-run 把 ① 的席位列成可续跑(判停的下一个动作就是 respawn —— 假阴性会杀掉在跑的 agent)"
|
|
260
|
+
else
|
|
261
|
+
bad "修复前 CLI:resume 没把 ① 的席位列成可续跑(现场:$(printf '%s' "$PRE_RESUME" | grep -E '可续跑|没有需要续跑' | tr '\n' ' '))"
|
|
262
|
+
fi
|
|
263
|
+
if printf '%s' "$GREEN_RESUME" | grep -q "p217s1 可续跑"; then
|
|
264
|
+
bad "修复后 CLI:resume 仍把 ① 的席位列成可续跑(判活的证据没有传到 CLI 层)"
|
|
265
|
+
else
|
|
266
|
+
ok "修复后 CLI:resume --dry-run **不列** ① 的席位(判活 = 不会被 respawn;cli:$(printf '%s' "$GREEN_RESUME" | grep -cE '可续跑' ) 条可续跑)"
|
|
267
|
+
fi
|
|
268
|
+
# ③ 判据翻转(影子):把判据放宽成 P103 的旧口径 → ⑤ 必须变 alive,⑥ 必须照旧 stopped
|
|
269
|
+
if [ "${V[mut_p217fake]}" = "alive" ]; then
|
|
270
|
+
ok "判据翻转:变异树(放宽成「命令行里提到 agent 就算在跑」)把 ⑤ 判回 alive —— 绿树咬的就是 argv[1] 这条分界"
|
|
271
|
+
else
|
|
272
|
+
bad "判据翻转没红:变异树对 ⑤ 判 ${V[mut_p217fake]}(影子没盖住判据)"
|
|
273
|
+
fi
|
|
274
|
+
if [ "${V[mut_p217ctl]}" = "stopped" ]; then
|
|
275
|
+
ok "判据翻转不是橡皮章:变异树对 ⑥(命令行里没有 agent)照旧判 stopped"
|
|
276
|
+
else
|
|
277
|
+
bad "判据翻转的对照不成立:变异树对 ⑥ 判 ${V[mut_p217ctl]}"
|
|
278
|
+
fi
|
|
279
|
+
if [ "${V[mut_p217s1]}" = "alive" ]; then
|
|
280
|
+
ok "判据翻转:变异树对 ① 也是 alive(放宽不影响这一条)"
|
|
281
|
+
else
|
|
282
|
+
bad "判据翻转的现场不对:变异树对 ① 判 ${V[mut_p217s1]}"
|
|
283
|
+
fi
|
|
284
|
+
|
|
285
|
+
printf '\n'
|
|
286
|
+
[ "$FAIL" -eq 0 ] && { printf '\033[32mflip-p217:翻转已复现(①② 假阴性红 → 绿;判据放宽即 ⑤ 红)\033[0m\n'; exit 0; }
|
|
287
|
+
printf '\033[31mflip-p217:没有观察到预期的翻转(%d 条失败)\033[0m\n' "$FAIL"
|
|
288
|
+
exit 1
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# flip-p22.sh — the break/fix flips for the P22 console surface (B2 2.6, B3 3.4, B4 4.5).
|
|
3
|
+
#
|
|
4
|
+
# bash skills/teamsmith/tests/flip-p22.sh
|
|
5
|
+
#
|
|
6
|
+
# Each flip edits the panel sources, rebuilds the committed bundle, runs one `panel-p21.sh` scenario and
|
|
7
|
+
# asserts it goes red, then restores the sources, rebuilds and asserts green + the bundle byte-identical.
|
|
8
|
+
# The worked build needs `panel/node_modules` (bun); without it the flip reports SKIP for the rebuild.
|
|
9
|
+
# Exit: 0 every flip behaved, 1 at least one flip did not, 3 setup failure.
|
|
10
|
+
set -uo pipefail
|
|
11
|
+
|
|
12
|
+
here="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
13
|
+
# P53:临时根的唯一创建者(${TMPDIR:-/tmp} + owned 家族 + 回收)
|
|
14
|
+
. "$here/lib/tmp-root.sh"
|
|
15
|
+
tree="${TEAM_P21_TREE:-$(cd -P "$here/../../.." && pwd)}"
|
|
16
|
+
skill="$tree/skills/teamsmith"
|
|
17
|
+
src="$skill/scripts/panel/src"
|
|
18
|
+
bundle="$skill/scripts/panel/panel.js"
|
|
19
|
+
bun_bin="${BUN:-$(command -v bun || true)}"
|
|
20
|
+
[ -n "$bun_bin" ] || bun_bin="$HOME/.bun/bin/bun"
|
|
21
|
+
[ "${KEEP:-0}" = "1" ] && export TEAM_TMP_KEEP=1
|
|
22
|
+
tmp="$(tmp_root_create flip-p22)" || exit 3
|
|
23
|
+
PASS=0
|
|
24
|
+
FAIL=0
|
|
25
|
+
cleanup() { [ "${BASHPID:-$$}" = "$$" ] || return 0; tmp_root_reap_all; }
|
|
26
|
+
trap cleanup EXIT
|
|
27
|
+
|
|
28
|
+
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; PASS=$((PASS + 1)); }
|
|
29
|
+
bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL + 1)); }
|
|
30
|
+
|
|
31
|
+
[ -x "$bun_bin" ] || { printf 'flip-p22: bun is required (rebuilds the bundle)\n' >&2; exit 3; }
|
|
32
|
+
[ -d "$skill/scripts/panel/node_modules" ] || { printf 'flip-p22: run `bun install --frozen-lockfile` in scripts/panel first\n' >&2; exit 3; }
|
|
33
|
+
|
|
34
|
+
build() {
|
|
35
|
+
BUN="$bun_bin" bash "$skill/scripts/panel/build.sh" >"$tmp/build.log" 2>&1 || { tail -3 "$tmp/build.log" >&2; return 1; }
|
|
36
|
+
}
|
|
37
|
+
run_scn() { # <scenario> <logfile>
|
|
38
|
+
TEAM_P21_TREE="$tree" bash "$here/panel-p21.sh" "$1" >"$2" 2>&1
|
|
39
|
+
return $?
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
sha_before="$(sha256sum "$bundle" | cut -d' ' -f1)"
|
|
43
|
+
|
|
44
|
+
# flip <name> <file> <python edit script> <scenario> <red assertion fragment>
|
|
45
|
+
flip() {
|
|
46
|
+
local name="$1" file="$2" edit="$3" scn="$4" red_re="$5"
|
|
47
|
+
cp "$file" "$tmp/$(basename "$file").orig"
|
|
48
|
+
FLIP_EDIT="$edit" python3 - "$file" <<'PYEDIT'
|
|
49
|
+
import os, sys
|
|
50
|
+
exec(compile(os.environ["FLIP_EDIT"], "<flip>", "exec"))
|
|
51
|
+
PYEDIT
|
|
52
|
+
if ! build; then bad "$name: 改过的源码构建失败"; cp "$tmp/$(basename "$file").orig" "$file"; build >/dev/null 2>&1; return; fi
|
|
53
|
+
run_scn "$scn" "$tmp/$name-red.log"
|
|
54
|
+
local rc_red=$?
|
|
55
|
+
if [ "$rc_red" -ne 0 ] && grep -q '✗' "$tmp/$name-red.log"; then
|
|
56
|
+
ok "$name:断掉之后 $scn 变红(rc=$rc_red)"
|
|
57
|
+
else
|
|
58
|
+
bad "$name:断掉之后 $scn 居然还是绿的(翻转失效)"
|
|
59
|
+
fi
|
|
60
|
+
if { grep -E '✗' "$tmp/$name-red.log" || true; } | grep -q -- "$red_re"; then
|
|
61
|
+
ok "$name:红侧的失败点就是预期的那条($red_re)"
|
|
62
|
+
else
|
|
63
|
+
bad "$name:红侧没有点到预期的那条($red_re)"
|
|
64
|
+
fi
|
|
65
|
+
cp "$tmp/$(basename "$file").orig" "$file"
|
|
66
|
+
if ! build; then bad "$name: 恢复后构建失败"; return; fi
|
|
67
|
+
run_scn "$scn" "$tmp/$name-green.log"
|
|
68
|
+
local rc_green=$?
|
|
69
|
+
if [ "$rc_green" -eq 0 ]; then ok "$name:恢复之后 $scn 变绿"; else bad "$name:恢复之后 $scn 仍然红"; fi
|
|
70
|
+
if [ "$(sha256sum "$bundle" | cut -d' ' -f1)" = "$sha_before" ]; then
|
|
71
|
+
ok "$name:恢复后 bundle 与提交的逐字节一致"
|
|
72
|
+
else
|
|
73
|
+
bad "$name:恢复后 bundle 与提交的不一致"
|
|
74
|
+
fi
|
|
75
|
+
printf ' 红侧尾部:\n'
|
|
76
|
+
grep -E '✗' "$tmp/$name-red.log" | head -3 | sed 's/^/ /'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
printf '\033[1m== flip-p22 · 三处断点(B2 2.6 / B3 3.4 / B4 4.5) ==\033[0m\n'
|
|
80
|
+
|
|
81
|
+
# 2.6 · the rejected second key table: hardcode three classes inside the bundle.
|
|
82
|
+
flip "2.6 键表硬编码" "$src/layout.ts" '
|
|
83
|
+
import sys
|
|
84
|
+
p = sys.argv[1]
|
|
85
|
+
s = open(p, encoding="utf-8").read()
|
|
86
|
+
old = "export function settingsClassLabel(s: Strings, cls: string): string {"
|
|
87
|
+
new = """export function settingsClassLabel(s: Strings, cls: string): string {
|
|
88
|
+
// FLIP (rejected design): a second, hardcoded table inside the bundle.
|
|
89
|
+
return cls"""
|
|
90
|
+
assert old in s
|
|
91
|
+
s = s.replace(old, new, 1)
|
|
92
|
+
open(p, "w", encoding="utf-8").write(s)
|
|
93
|
+
' settings 'scratch CLI 改过的类跟着变'
|
|
94
|
+
|
|
95
|
+
# 3.4 · drop the fingerprint pinned at editor-open time.
|
|
96
|
+
flip "3.4 丢掉指纹" "$src/main.tsx" '
|
|
97
|
+
import sys
|
|
98
|
+
p = sys.argv[1]
|
|
99
|
+
s = open(p, encoding="utf-8").read()
|
|
100
|
+
old = " if (o.fingerprint) args.push(\u0027--fingerprint\u0027, o.fingerprint)\n if (o.allowDanger) args.push(\u0027--allow-danger\u0027)"
|
|
101
|
+
new = " if (o.allowDanger) args.push(\u0027--allow-danger\u0027)"
|
|
102
|
+
assert old in s
|
|
103
|
+
s = s.replace(old, new, 1)
|
|
104
|
+
open(p, "w", encoding="utf-8").write(s)
|
|
105
|
+
' conflict '回执点名指纹冲突'
|
|
106
|
+
|
|
107
|
+
# 4.5 · the rejected bare model name: print the model with no source badge.
|
|
108
|
+
flip "4.5 裸模型名" "$src/layout.ts" '
|
|
109
|
+
import sys
|
|
110
|
+
p = sys.argv[1]
|
|
111
|
+
s = open(p, encoding="utf-8").read()
|
|
112
|
+
old = " const policy = seat.override ? s.seatOverride : s.seatFallback"
|
|
113
|
+
new = " const policy = \u0027\u0027"
|
|
114
|
+
assert old in s
|
|
115
|
+
s = s.replace(old, new, 1)
|
|
116
|
+
s = s.replace("...settingsRight(ctx, `${model} · ${settingsSourceLabel(s, seat.source)} · ${policy}`, \u0027\u0027, \u0027dim\u0027, innerW).map((x) => x),",
|
|
117
|
+
"...settingsRight(ctx, `${model}`, \u0027\u0027, \u0027dim\u0027, innerW).map((x) => x),", 1)
|
|
118
|
+
open(p, "w", encoding="utf-8").write(s)
|
|
119
|
+
' seats '历史记录'
|
|
120
|
+
|
|
121
|
+
printf '\n\033[1m== 结果 ==\033[0m ✓ %d ✗ %d\n' "$PASS" "$FAIL"
|
|
122
|
+
[ "$FAIL" -eq 0 ] && exit 0
|
|
123
|
+
exit 1
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# flip-p23.sh — P24(change-centric-discipline)的翻转包(tasks.md §8.2)。
|
|
3
|
+
#
|
|
4
|
+
# bash skills/teamsmith/tests/flip-p23.sh
|
|
5
|
+
# bash skills/teamsmith/tests/flip-p23.sh --keep # 保留临时目录(排查)
|
|
6
|
+
#
|
|
7
|
+
# 十对「断掉 → 变红 → 还原 → 变绿」,每对都跑**对应段落的聚焦探针**(smoke 前导 + P24 夹具助手 + 那一段):
|
|
8
|
+
# 1.6 让就绪判据忽略未结束的兄弟 → 12e 变红
|
|
9
|
+
# 3.7a 严格读取器退回「取第一行」的旧行为 → 12g 的 two-id 用例变红
|
|
10
|
+
# 3.7b 锚守卫变成 no-op → 12g 的 change-less 用例变红
|
|
11
|
+
# 4.6a 缺失的 deltas: 行读成空集(而不是 unknown) → 12h 的缺声明用例变红
|
|
12
|
+
# 4.6b 交集只比 dispatched agent 自己的记录任务 → 12h 的跨 agent 用例变红
|
|
13
|
+
# 5.5a 作者集合只看 dispatched agent 的记录任务 → 12i 的跨 agent 拒绝变红
|
|
14
|
+
# 5.5b 缺作者信号静默通过 → 12i 的「缺信号很吵」变红
|
|
15
|
+
# 6.4 归档路线不再要求 change 就绪 → 12j 的阻塞/一致用例变红
|
|
16
|
+
# 7.5 删掉清单第 10 点 → 12k 的 7.2 断言变红
|
|
17
|
+
# P209 就绪不看 tasks.md 清单(P151/P175/P206 同族) → 12j 的清单用例变红
|
|
18
|
+
# §2.4(digest/面板归组)属 B2,本任务**明确不做**(M48/M49/M50 正在动那些文件),因此不在此包内。
|
|
19
|
+
#
|
|
20
|
+
# 变异只打在 /tmp 下的**技能树副本**上(真实工作树一个字节都不动);探针用 TEAM_SMOKE_FAST=1 跑纯逻辑,
|
|
21
|
+
# 不建 tmux、不起进程。退出码:0=十对全部成立;1=有反例;3=前置不满足。
|
|
22
|
+
set -uo pipefail
|
|
23
|
+
|
|
24
|
+
SELF_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
25
|
+
SKILL_DIR="$(cd -P "$SELF_DIR/.." && pwd)"
|
|
26
|
+
# P53:临时根的唯一创建者(${TMPDIR:-/tmp} + owned 家族 + 回收)
|
|
27
|
+
. "$SELF_DIR/lib/tmp-root.sh"
|
|
28
|
+
SMOKE="$SKILL_DIR/tests/smoke.sh"
|
|
29
|
+
REPO_ROOT="$(git -C "$SKILL_DIR" rev-parse --show-toplevel 2>/dev/null || true)"
|
|
30
|
+
|
|
31
|
+
KEEP=0
|
|
32
|
+
case "${1:-}" in
|
|
33
|
+
"") ;;
|
|
34
|
+
--keep) KEEP=1 ;;
|
|
35
|
+
-h|--help) sed -n '2,22p' "$0"; exit 0 ;;
|
|
36
|
+
*) printf 'flip-p23: 未知参数 %s\n' "$1" >&2; exit 2 ;;
|
|
37
|
+
esac
|
|
38
|
+
|
|
39
|
+
[ -s "$SMOKE" ] || { printf 'flip-p23: 缺 %s\n' "$SMOKE" >&2; exit 3; }
|
|
40
|
+
[ -n "$REPO_ROOT" ] || { printf 'flip-p23: %s 不在 git 工作树里\n' "$SKILL_DIR" >&2; exit 3; }
|
|
41
|
+
|
|
42
|
+
[ "${KEEP:-0}" = "1" ] && export TEAM_TMP_KEEP=1
|
|
43
|
+
TMP="$(tmp_root_create flip-p23)" || exit 3
|
|
44
|
+
cleanup() { [ "${BASHPID:-$$}" = "$$" ] || return 0; [ "$KEEP" = "1" ] || tmp_root_reap_all; return 0; }
|
|
45
|
+
trap cleanup EXIT
|
|
46
|
+
|
|
47
|
+
TREE="$TMP/tree"
|
|
48
|
+
mkdir -p "$TREE/skills"
|
|
49
|
+
cp -a "$SKILL_DIR" "$TREE/skills/teamsmith"
|
|
50
|
+
[ -d "$REPO_ROOT/skills/teamsmith-init" ] && cp -a "$REPO_ROOT/skills/teamsmith-init" "$TREE/skills/teamsmith-init"
|
|
51
|
+
cp -a "$REPO_ROOT/AGENTS.md" "$TREE/AGENTS.md"
|
|
52
|
+
MUT_SKILL="$TREE/skills/teamsmith"
|
|
53
|
+
|
|
54
|
+
PASS=0
|
|
55
|
+
FAIL=0
|
|
56
|
+
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; PASS=$((PASS + 1)); }
|
|
57
|
+
bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL + 1)); }
|
|
58
|
+
|
|
59
|
+
restore_skill() { rm -rf "$MUT_SKILL"; cp -a "$SKILL_DIR" "$MUT_SKILL"; }
|
|
60
|
+
|
|
61
|
+
# ── 聚焦探针:smoke 前导(身份清洗/夹具/判据)+ P24 助手 + 指定段落 + 结果行 ─────────────────────
|
|
62
|
+
build_probe() { # <段名前缀(12e|12g|...)>
|
|
63
|
+
local seg="$1" out
|
|
64
|
+
out="$TMP/probe-$seg.sh"
|
|
65
|
+
{
|
|
66
|
+
awk '/^# -+ 0\. 仓库/{exit} {print}' "$SMOKE"
|
|
67
|
+
awk '/^# 12e–12j · change/{f=1} f&&/^section "12e /{exit} f{print}' "$SMOKE"
|
|
68
|
+
awk -v seg="$seg" '
|
|
69
|
+
$0 ~ ("^section \"" seg " ") { f=1 }
|
|
70
|
+
f { if ($0 ~ /^section "/ && $0 !~ ("^section \"" seg " ")) exit; print }' "$SMOKE"
|
|
71
|
+
cat <<'EOS'
|
|
72
|
+
printf '\n== 结果 == ✓ %d ✗ %d\n' "$PASS" "$FAIL"
|
|
73
|
+
printf 'PROBE-12-END\n'
|
|
74
|
+
[ "$FAIL" -eq 0 ] && exit 0
|
|
75
|
+
exit 1
|
|
76
|
+
EOS
|
|
77
|
+
} | sed "s|^SKILL_DIR=.*|SKILL_DIR=\"$MUT_SKILL\"|" > "$out"
|
|
78
|
+
grep -q 'PROBE-12-END' "$out" || { printf 'flip-p23: 探针 %s 形状不对\n' "$seg" >&2; exit 3; }
|
|
79
|
+
grep -q '^p24_project()' "$out" || { printf 'flip-p23: 探针 %s 缺夹具助手\n' "$seg" >&2; exit 3; }
|
|
80
|
+
bash -n "$out" || { printf 'flip-p23: 探针 %s 语法错\n' "$seg" >&2; exit 3; }
|
|
81
|
+
}
|
|
82
|
+
for _seg in 12e 12g 12h 12i 12j 12k; do build_probe "$_seg"; done
|
|
83
|
+
|
|
84
|
+
run_probe() { # <段> <日志>
|
|
85
|
+
TEAM_SMOKE_FAST=1 TEAM_SMOKE_NO_LOCK=1 bash "$TMP/probe-$1.sh" >"$2" 2>&1
|
|
86
|
+
return $?
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
show_red() { sed 's/\x1b\[[0-9;]*m//g' "$1" | grep '✗' | head -4 | sed 's/^/ /'; }
|
|
90
|
+
|
|
91
|
+
flip() { # <名字> <段> <变异函数> <期望红断言正则...>
|
|
92
|
+
local name="$1" seg="$2" mutfn="$3"; shift 3
|
|
93
|
+
restore_skill
|
|
94
|
+
if ! "$mutfn"; then bad "$name:变异脚本失败(锚点文本动过?)"; return; fi
|
|
95
|
+
local rc
|
|
96
|
+
run_probe "$seg" "$TMP/$name-red.log"; rc=$?
|
|
97
|
+
if [ "$rc" -ne 0 ] && grep -q '✗' "$TMP/$name-red.log"; then
|
|
98
|
+
ok "$name:断掉之后 $seg 变红(rc=$rc)"
|
|
99
|
+
else
|
|
100
|
+
bad "$name:断掉之后 $seg 居然还是绿的(翻转失效)"
|
|
101
|
+
show_red "$TMP/$name-red.log"
|
|
102
|
+
fi
|
|
103
|
+
local miss="" pat
|
|
104
|
+
for pat in "$@"; do
|
|
105
|
+
{ grep -E '✗' "$TMP/$name-red.log" || true; } | grep -qE -- "$pat" || miss="$miss [$pat]"
|
|
106
|
+
done
|
|
107
|
+
if [ -z "$miss" ]; then ok "$name:红侧点在预期的断言上"
|
|
108
|
+
else bad "$name:红侧没点到预期断言$miss"; show_red "$TMP/$name-red.log"; fi
|
|
109
|
+
restore_skill
|
|
110
|
+
run_probe "$seg" "$TMP/$name-green.log"; rc=$?
|
|
111
|
+
if [ "$rc" -eq 0 ]; then ok "$name:还原之后 $seg 变绿(✓ $(grep -ac '✓' "$TMP/$name-green.log" 2>/dev/null || echo 0) 条)"
|
|
112
|
+
else bad "$name:还原之后 $seg 仍然红"; show_red "$TMP/$name-green.log"; fi
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# ── 变异(只动 $MUT_SKILL 里的文件) ───────────────────────────────────────────────────────────
|
|
116
|
+
m_16() { python3 - "$MUT_SKILL" <<'PY'
|
|
117
|
+
import sys, io
|
|
118
|
+
p = sys.argv[1] + "/scripts/lib/common.sh"
|
|
119
|
+
s = io.open(p, encoding="utf-8").read()
|
|
120
|
+
old = ' team_change_blockers "$id" "$skip" || rc=1\n'
|
|
121
|
+
assert s.count(old) == 1, "1.6 anchor not found"
|
|
122
|
+
s = s.replace(old, ' true # MUTATION 1.6: ignore unfinished siblings\n', 1)
|
|
123
|
+
io.open(p, "w", encoding="utf-8").write(s)
|
|
124
|
+
PY
|
|
125
|
+
}
|
|
126
|
+
m_37a() { python3 - "$MUT_SKILL" <<'PY'
|
|
127
|
+
import sys, io
|
|
128
|
+
p = sys.argv[1] + "/scripts/lib/common.sh"
|
|
129
|
+
s = io.open(p, encoding="utf-8").read()
|
|
130
|
+
old = ' vals="$(team_brief_field_raw "$f" change)"\n'
|
|
131
|
+
assert s.count(old) == 1, "3.7a anchor not found"
|
|
132
|
+
ins = (old +
|
|
133
|
+
' local _mut\n _mut="$(printf \'%s\\n\' "$vals" | head -1)"\n'
|
|
134
|
+
' if [ -z "$_mut" ]; then printf -- \'-\\n\'; return 0; fi\n'
|
|
135
|
+
' if [ "$_mut" != "-" ]; then printf \'%s\\n\' "$_mut"; return 0; fi # MUTATION 3.7a: old first-line behaviour\n')
|
|
136
|
+
s = s.replace(old, ins, 1)
|
|
137
|
+
io.open(p, "w", encoding="utf-8").write(s)
|
|
138
|
+
PY
|
|
139
|
+
}
|
|
140
|
+
m_37b() { python3 - "$MUT_SKILL" <<'PY'
|
|
141
|
+
import sys, io
|
|
142
|
+
p = sys.argv[1] + "/scripts/lib/cmd-agents.sh"
|
|
143
|
+
s = io.open(p, encoding="utf-8").read()
|
|
144
|
+
old = ' if out="$(team_task_anchor "$brief")"; then return 0; fi\n'
|
|
145
|
+
assert s.count(old) == 1, "3.7b anchor not found"
|
|
146
|
+
s = s.replace(old, ' return 0 # MUTATION 3.7b: anchor guard is a no-op\n', 1)
|
|
147
|
+
io.open(p, "w", encoding="utf-8").write(s)
|
|
148
|
+
PY
|
|
149
|
+
}
|
|
150
|
+
m_46a() { python3 - "$MUT_SKILL" <<'PY'
|
|
151
|
+
import sys, io
|
|
152
|
+
p = sys.argv[1] + "/scripts/lib/common.sh"
|
|
153
|
+
s = io.open(p, encoding="utf-8").read()
|
|
154
|
+
old = ' [ "${n:-0}" -eq 0 ] && { printf \'*\\n\'; return 0; }\n'
|
|
155
|
+
assert s.count(old) == 1, "4.6a anchor not found"
|
|
156
|
+
s = s.replace(old, ' [ "${n:-0}" -eq 0 ] && { return 0; } # MUTATION 4.6a: absent reads as empty\n', 1)
|
|
157
|
+
io.open(p, "w", encoding="utf-8").write(s)
|
|
158
|
+
PY
|
|
159
|
+
}
|
|
160
|
+
m_46b() { python3 - "$MUT_SKILL" <<'PY'
|
|
161
|
+
import sys, io
|
|
162
|
+
p = sys.argv[1] + "/scripts/lib/cmd-agents.sh"
|
|
163
|
+
s = io.open(p, encoding="utf-8").read()
|
|
164
|
+
old = ' [ "$sid" = "$id" ] && continue\n'
|
|
165
|
+
assert s.count(old) == 1, "4.6b anchor not found"
|
|
166
|
+
ins = old + ' [ "$(team_brief_field_raw "$sbrief" agent | head -1)" = "$agent" ] || continue # MUTATION 4.6b: agent-local only\n'
|
|
167
|
+
s = s.replace(old, ins, 1)
|
|
168
|
+
io.open(p, "w", encoding="utf-8").write(s)
|
|
169
|
+
PY
|
|
170
|
+
}
|
|
171
|
+
m_55a() { python3 - "$MUT_SKILL" <<'PY'
|
|
172
|
+
import sys, io
|
|
173
|
+
p = sys.argv[1] + "/scripts/lib/cmd-agents.sh"
|
|
174
|
+
s = io.open(p, encoding="utf-8").read()
|
|
175
|
+
old = ' agent) [ "$aauth" = "$agent" ] && authored="${authored:+$authored、}$aid" ;;\n'
|
|
176
|
+
assert s.count(old) == 1, "5.5a anchor not found"
|
|
177
|
+
new = ' agent) [ "$aid" = "$(team_state_get "$agent" task \'\')" ] && [ -n "$aid" ] && authored="${authored:+$authored、}$aid" ;; # MUTATION 5.5a\n'
|
|
178
|
+
s = s.replace(old, new, 1)
|
|
179
|
+
io.open(p, "w", encoding="utf-8").write(s)
|
|
180
|
+
PY
|
|
181
|
+
}
|
|
182
|
+
m_55b() { python3 - "$MUT_SKILL" <<'PY'
|
|
183
|
+
import sys, io
|
|
184
|
+
p = sys.argv[1] + "/scripts/lib/cmd-agents.sh"
|
|
185
|
+
s = io.open(p, encoding="utf-8").read()
|
|
186
|
+
old = ' [ -n "$missing" ] && team_df_warn " 作者信号缺失:$missing —— 判不出它们的作者,不当作干净(照常派单)"\n'
|
|
187
|
+
assert s.count(old) == 1, "5.5b anchor not found"
|
|
188
|
+
s = s.replace(old, ' true # MUTATION 5.5b: missing signal passes silently\n', 1)
|
|
189
|
+
io.open(p, "w", encoding="utf-8").write(s)
|
|
190
|
+
PY
|
|
191
|
+
}
|
|
192
|
+
m_64() { python3 - "$MUT_SKILL" <<'PY'
|
|
193
|
+
import sys, io
|
|
194
|
+
p = sys.argv[1] + "/scripts/lib/common.sh"
|
|
195
|
+
s = io.open(p, encoding="utf-8").read()
|
|
196
|
+
old = ' if [ -z "${TEAM_CHANGE_READY_GATE:-}" ]; then\n'
|
|
197
|
+
assert s.count(old) == 1, "6.4 anchor not found"
|
|
198
|
+
s = s.replace(old, ' if false; then # MUTATION 6.4: archive route drops the readiness requirement\n', 1)
|
|
199
|
+
io.open(p, "w", encoding="utf-8").write(s)
|
|
200
|
+
PY
|
|
201
|
+
}
|
|
202
|
+
m_p209() { python3 - "$MUT_SKILL" <<'PY'
|
|
203
|
+
import sys, io
|
|
204
|
+
p = sys.argv[1] + "/scripts/lib/common.sh"
|
|
205
|
+
s = io.open(p, encoding="utf-8").read()
|
|
206
|
+
old = ' team_change_checklist_blockers "$id" || rc=1\n'
|
|
207
|
+
assert s.count(old) == 1, "P209 anchor not found"
|
|
208
|
+
s = s.replace(old, ' true # MUTATION P209: the checklist is not a precondition\n', 1)
|
|
209
|
+
io.open(p, "w", encoding="utf-8").write(s)
|
|
210
|
+
PY
|
|
211
|
+
}
|
|
212
|
+
m_75() { python3 - "$MUT_SKILL" <<'PY'
|
|
213
|
+
import sys, io, re
|
|
214
|
+
p = sys.argv[1] + "/references/openspec.md"
|
|
215
|
+
s = io.open(p, encoding="utf-8").read()
|
|
216
|
+
m = re.search(r'\n10\. \*\*The anchor exists\*\*.*?(?=\n## 5\.)', s, re.S)
|
|
217
|
+
assert m, "7.5 anchor not found"
|
|
218
|
+
s = s[:m.start()] + "\n" + s[m.end():]
|
|
219
|
+
io.open(p, "w", encoding="utf-8").write(s)
|
|
220
|
+
PY
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
printf '\033[1m== flip-p23 · 十对断点(§1.6 / §3.7a-b / §4.6a-b / §5.5a-b / §6.4 / §7.5 / P209) ==\033[0m\n'
|
|
224
|
+
printf ' (§2.4 digest/面板归组属 B2,本任务不做 —— 不在包内,见报告)\n'
|
|
225
|
+
|
|
226
|
+
flip "1.6 就绪忽略未结束兄弟" 12e m_16 '12e 有未结束兄弟' '12e blocker' '12e --json 未就绪'
|
|
227
|
+
flip "3.7a 读取器退回第一行" 12g m_37a '12g G1 的拒绝来自规则 1' '12g G2 的拒绝来自规则 1' '12g G3 的拒绝来自规则 1'
|
|
228
|
+
flip "3.7b 锚守卫 no-op" 12g m_37b '12g N1 的拒绝来自锚守卫' '12g N2 的拒绝来自锚守卫' '12g N3 的拒绝来自锚守卫' '12g N4 的拒绝来自锚守卫'
|
|
229
|
+
flip "4.6a 缺失声明读成空集" 12h m_46a '12h 说明缺行被读作全量'
|
|
230
|
+
flip "4.6b 交集只比本 agent 记录" 12h m_46b '12h 拒绝来自 delta 单写者守卫' '12h --force 打印冲突'
|
|
231
|
+
flip "5.5a 作者集合只看记录任务" 12i m_55a '12i 拒绝来自作者守卫' '12i --force 打印自验'
|
|
232
|
+
flip "5.5b 缺信号静默通过" 12i m_55b '12i 缺信号很吵'
|
|
233
|
+
flip "6.4 归档不要求 change 就绪" 12j m_64 '12j 未结束兄弟' '12j 拒绝'
|
|
234
|
+
flip "7.5 删掉清单第 10 点" 12k m_75 '7.2 checklist gains point 10' '7.2 checklist now has exactly ten points'
|
|
235
|
+
flip "P209 清单不是归档前置" 12j m_p209 '12j P209 清单有未勾项' '12j P209 blocker 点名未勾条数' '12j P209 归档任务 done 也被清单拒绝' '12j P209 归档后的归档任务 done 被拒'
|
|
236
|
+
|
|
237
|
+
printf '\n== 结果 == ✓ %d ✗ %d\n' "$PASS" "$FAIL"
|
|
238
|
+
[ "$FAIL" -eq 0 ] || exit 1
|
|
239
|
+
exit 0
|