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,205 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# M6.2 控制实验:同一组用例分别跑在「修复前」和「修复后」两份 skill 上。
|
|
3
|
+
#
|
|
4
|
+
# bash skills/teamsmith/tests/flip-m6.2.sh # 自动找 M6.2 修复前那一版(分支历史还在时)
|
|
5
|
+
# BASE=<sha> bash skills/teamsmith/tests/flip-m6.2.sh # squash 合并后用显式钉住的 revision
|
|
6
|
+
#
|
|
7
|
+
# 为什么存在:smoke 只证明「现在的实现全绿」,证明不了「如果没有这些守卫,测试会红」。
|
|
8
|
+
# 这个脚本把 V4.0 报告里的 9 个 finding 写成可执行断言,对两份 skill 各跑一遍:
|
|
9
|
+
# BUG-REPRODUCED → 修复前的缺陷还在(red 侧必须全部是这一种)
|
|
10
|
+
# BUG-GONE → 现在的可观测行为已经是 M6.2 要求的(green 侧必须全部是这一种)
|
|
11
|
+
# 一切都在 /tmp 的临时仓库里,绝不碰当前项目;red 那版从 `git archive <BASE>` 取出,
|
|
12
|
+
# 与工作区无关。
|
|
13
|
+
set -uo pipefail
|
|
14
|
+
|
|
15
|
+
SELF_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
16
|
+
SKILL_DIR="$(cd -P "$SELF_DIR/.." && pwd)"
|
|
17
|
+
# P53:临时根的唯一创建者(${TMPDIR:-/tmp} + owned 家族 + 回收)
|
|
18
|
+
. "$SELF_DIR/lib/tmp-root.sh"
|
|
19
|
+
REPO_ROOT="$(git -C "$SKILL_DIR" rev-parse --show-toplevel 2>/dev/null || true)"
|
|
20
|
+
[ -n "$REPO_ROOT" ] || { printf '不在 git 仓库里:%s\n' "$SKILL_DIR" >&2; exit 2; }
|
|
21
|
+
|
|
22
|
+
BASE="${BASE:-}"
|
|
23
|
+
if [ -z "$BASE" ]; then
|
|
24
|
+
# 修复的那一版 = 第一个引入记录读取函数(team_review_record_verdict)的提交
|
|
25
|
+
FIRST_FIX="$(git -C "$REPO_ROOT" log --reverse --format=%H -S'team_review_record_verdict' \
|
|
26
|
+
-- skills/teamsmith/scripts/lib/cmd-review.sh 2>/dev/null | head -1 || true)"
|
|
27
|
+
[ -n "$FIRST_FIX" ] && BASE="$(git -C "$REPO_ROOT" rev-parse --verify --quiet "${FIRST_FIX}^" || true)"
|
|
28
|
+
fi
|
|
29
|
+
if [ -z "$BASE" ] || ! git -C "$REPO_ROOT" rev-parse --verify --quiet "${BASE}^{commit}" >/dev/null 2>&1; then
|
|
30
|
+
printf '找不到「修复前」的 revision:用 BASE=<sha> 指定(例如 BASE=914c334)\n' >&2
|
|
31
|
+
exit 2
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
[ "${KEEP:-0}" = "1" ] && export TEAM_TMP_KEEP=1
|
|
35
|
+
WORK="$(tmp_root_create flip-m6.2)" || exit 3
|
|
36
|
+
cleanup() {
|
|
37
|
+
[ "${BASHPID:-$$}" = "$$" ] || return 0
|
|
38
|
+
tmp_root_reap_all
|
|
39
|
+
}
|
|
40
|
+
trap cleanup EXIT
|
|
41
|
+
RED_ROOT="$WORK/red"
|
|
42
|
+
mkdir -p "$RED_ROOT"
|
|
43
|
+
git -C "$REPO_ROOT" archive "$BASE" skills/teamsmith | tar -x -C "$RED_ROOT"
|
|
44
|
+
printf '修复前 (red): %s ← skills/teamsmith @ %s\n' "$RED_ROOT/skills/teamsmith" "$(git -C "$REPO_ROOT" rev-parse --short "$BASE")"
|
|
45
|
+
printf '修复后 (green): %s\n' "$SKILL_DIR"
|
|
46
|
+
|
|
47
|
+
PASS=0; BUG=0
|
|
48
|
+
case_line() { # <finding> <label> <bug|fixed> <detail>
|
|
49
|
+
if [ "$3" = "bug" ]; then BUG=$((BUG+1)); printf ' %-5s %-6s BUG-REPRODUCED %s\n' "$1" "$2" "$4"
|
|
50
|
+
else PASS=$((PASS+1)); printf ' %-5s %-6s BUG-GONE %s\n' "$1" "$2" "$4"; fi
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
mkproj() { # <name> [gates] → repo path(一个全新的一次性项目)
|
|
54
|
+
local r="$WORK/$1"
|
|
55
|
+
mkdir -p "$r"
|
|
56
|
+
git -C "$r" init -q -b main
|
|
57
|
+
git -C "$r" config user.email flip@m62; git -C "$r" config user.name flip
|
|
58
|
+
printf '# %s\n' "$1" > "$r/README.md"
|
|
59
|
+
git -C "$r" add -A && git -C "$r" commit -qm init
|
|
60
|
+
( cd "$r" && bash "$CUR_SKILL/scripts/team" init --session "m62flip-$$" --agents dev --gates "${2:-true}" ) >/dev/null 2>&1
|
|
61
|
+
git -C "$r" add -A && git -C "$r" commit -qm "chore: teamsmith init"
|
|
62
|
+
printf '%s\n' "$r"
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
mktask() { # <repo> <id>:任务书 + BOARD 行 + 分支/worktree + 报告
|
|
66
|
+
local r="$1" id="$2" wt="$1/.worktrees/dev"
|
|
67
|
+
( cd "$r" && bash "$CUR_SKILL/scripts/team" task "$id" --title "flip $id" --agent dev ) >/dev/null 2>&1
|
|
68
|
+
git -C "$r" worktree add -q -b "task/$id-smoke" "$wt" main
|
|
69
|
+
mkdir -p "$wt/docs/team/reports"
|
|
70
|
+
printf '# %s · report\n\nagent: dev 状态: DONE\n' "$id" > "$wt/docs/team/reports/$id-dev.md"
|
|
71
|
+
printf 'code\n' > "$wt/code.txt"
|
|
72
|
+
git -C "$wt" add -A && git -C "$wt" commit -qm "feat($id): code + report"
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
review() { # <repo> <args...> → stdout+stderr;退出码在 $?(调用方自己接)
|
|
76
|
+
local r="$1"; shift
|
|
77
|
+
( cd "$r" && env -u TEAM_ROOT -u TEAM_MAIN_ROOT -u TEAM_SKILL_DIR bash "$CUR_SKILL/scripts/team" review "$@" ) 2>&1
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
verdict_of() { sed -n 's/.*判定: \*\*\([A-Z]*\)\*\*.*/\1/p' "$1/docs/team/reviews/$2.md" 2>/dev/null | head -1; }
|
|
81
|
+
|
|
82
|
+
run_all() { # <label> <skill dir>
|
|
83
|
+
local LABEL="$1" OUT
|
|
84
|
+
CUR_SKILL="$2"
|
|
85
|
+
|
|
86
|
+
# F7 —— --branch 解析不到:记录会不会盖章到一个不存在的 revision
|
|
87
|
+
local R D
|
|
88
|
+
R="$(mkproj f7-$LABEL)"; mktask "$R" P1
|
|
89
|
+
D="$WORK/f7-$LABEL-dir"; git -C "$R" worktree add -q --detach "$D" task/P1-smoke
|
|
90
|
+
OUT="$(review "$R" P1 --dir "$D" --branch no-such-branch)"; local rc=$?
|
|
91
|
+
if [ "$rc" = "0" ]; then case_line F7 "$LABEL" bug "rc=0:不存在的 --branch 也盖章(记录抬头写 no-such-branch)"
|
|
92
|
+
else case_line F7 "$LABEL" fixed "rc=$rc:$(printf '%s' "$OUT" | grep -m1 -o '分支解析不到.*' || echo '被拒')"; fi
|
|
93
|
+
|
|
94
|
+
# F8 —— ALLOW_DIRTY 覆盖下记录/输出还说不说“干净”
|
|
95
|
+
R="$(mkproj f8-$LABEL)"; mktask "$R" P1
|
|
96
|
+
D="$WORK/f8-$LABEL-dir"; git -C "$R" worktree add -q --detach "$D" task/P1-smoke
|
|
97
|
+
printf 'dirty\n' >> "$D/code.txt"
|
|
98
|
+
OUT="$(cd "$R" && env TEAM_REVIEW_ALLOW_DIRTY=1 bash "$CUR_SKILL/scripts/team" review P1 --dir "$D" 2>&1)"
|
|
99
|
+
if grep -q '干净' <(printf '%s\n%s' "$OUT" "$(cat "$R/docs/team/reviews/P1.md" 2>/dev/null)"); then
|
|
100
|
+
case_line F8 "$LABEL" bug "ALLOW_DIRTY 覆盖下仍打印/记录「干净」(记录里没有 dirty 字段)"
|
|
101
|
+
else
|
|
102
|
+
case_line F8 "$LABEL" fixed "$(grep -m1 -o 'checkout dirty: [0-9]* files (override[^)]*)' "$R/docs/team/reviews/P1.md" 2>/dev/null || echo '记录标注了脏树')"
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# F9 —— 被 .gitignore 忽略的产物(不在提交里)能不能让门禁 PASS
|
|
106
|
+
R="$(mkproj f9-$LABEL 'test -f build/marker')"; mktask "$R" P1
|
|
107
|
+
printf 'build/\n' > "$R/.worktrees/dev/.gitignore"
|
|
108
|
+
git -C "$R/.worktrees/dev" add -A && git -C "$R/.worktrees/dev" commit -qm "chore(P1): ignore build/"
|
|
109
|
+
D="$WORK/f9-$LABEL-dir"; git -C "$R" worktree add -q --detach "$D" task/P1-smoke
|
|
110
|
+
mkdir -p "$D/build" && printf 'not in the commit\n' > "$D/build/marker"
|
|
111
|
+
OUT="$(review "$R" P1 --dir "$D")"; local rc9=$?
|
|
112
|
+
if [ "$rc9" = "0" ]; then case_line F9 "$LABEL" bug "ignored 产物(status --porcelain 为空)让门禁 PASS 并盖章:$(verdict_of "$R" P1)"
|
|
113
|
+
else case_line F9 "$LABEL" fixed "rc=$rc9:$(printf '%s' "$OUT" | grep -m1 -o 'ignored[^)]*' || echo 'ignored 产物被拒')"; fi
|
|
114
|
+
|
|
115
|
+
# F10 —— 真挂死:记 TIMEOUT 还是 FAIL
|
|
116
|
+
R="$(mkproj "f10-$LABEL" 'echo start; sleep 30')"; mktask "$R" P1
|
|
117
|
+
D="$WORK/f10-$LABEL-dir"; git -C "$R" worktree add -q --detach "$D" task/P1-smoke
|
|
118
|
+
(cd "$R" && env TEAM_REVIEW_TIMEOUT=1 bash "$CUR_SKILL/scripts/team" review P1 --dir "$D") >/dev/null 2>&1
|
|
119
|
+
local v10; v10="$(verdict_of "$R" P1)"
|
|
120
|
+
if [ "$v10" = "TIMEOUT" ]; then case_line F10 "$LABEL" fixed "挂死门禁 → TIMEOUT(记录含「硬超时终止」×$(grep -c '硬超时终止' "$R/docs/team/reviews/P1.md" 2>/dev/null))"
|
|
121
|
+
else case_line F10 "$LABEL" bug "挂死门禁被记成 $v10(GNU timeout 默认不打字,grep 不到)"; fi
|
|
122
|
+
|
|
123
|
+
# F11 —— 门禁只是打印 'timeout' 字样 + 普通失败
|
|
124
|
+
R="$(mkproj "f11-$LABEL" 'echo "info: using timeout 5 for the probe"; exit 3')"; mktask "$R" P1
|
|
125
|
+
D="$WORK/f11-$LABEL-dir"; git -C "$R" worktree add -q --detach "$D" task/P1-smoke
|
|
126
|
+
(cd "$R" && bash "$CUR_SKILL/scripts/team" review P1 --dir "$D") >/dev/null 2>&1
|
|
127
|
+
local v11; v11="$(verdict_of "$R" P1)"
|
|
128
|
+
if [ "$v11" = "TIMEOUT" ]; then case_line F11 "$LABEL" bug "普通失败(日志里有 timeout 字样)被记成 TIMEOUT"
|
|
129
|
+
else case_line F11 "$LABEL" fixed "普通失败(2 秒)记成 $v11(只认 timeout 包装器退出码)"; fi
|
|
130
|
+
|
|
131
|
+
# F12 —— --no-gates 的记录与 PASS 是否可区分
|
|
132
|
+
R="$(mkproj f12-$LABEL)"; mktask "$R" P1
|
|
133
|
+
D="$WORK/f12-$LABEL-dir"; git -C "$R" worktree add -q --detach "$D" task/P1-smoke
|
|
134
|
+
(cd "$R" && bash "$CUR_SKILL/scripts/team" review P1 --dir "$D" --no-gates) >/dev/null 2>&1
|
|
135
|
+
local DIG STA
|
|
136
|
+
DIG="$(cd "$R" && bash "$CUR_SKILL/scripts/team" digest 2>&1)"
|
|
137
|
+
STA="$(cd "$R" && bash "$CUR_SKILL/scripts/team" status P1 2>&1)"
|
|
138
|
+
if grep -q 'gates: none' <<<"$DIG" && grep -q '判定: SKIPPED' <<<"$STA"; then
|
|
139
|
+
case_line F12 "$LABEL" fixed "digest 仍列为待复验(gates: none)|status 打印判定"
|
|
140
|
+
else
|
|
141
|
+
case_line F12 "$LABEL" bug "SKIPPED 与 PASS 不可区分(digest 里的待复验条目=$(grep -c 'P1-dev' <<<"$DIG"),status 里的判定=$(grep -c '判定' <<<"$STA"))"
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
# F13/F14 —— --strong 的证据判定
|
|
145
|
+
printf '# P1 · keyword only\n\nThere is no 翻转 evidence here and no 独立验证包: the words appear only in this sentence.\n' > "$WORK/f13-body.md"
|
|
146
|
+
printf '# P1 · genuine\n\n## Flip evidence\n\nRed before -> green after: I broke the implementation on purpose and the guard test failed, then I restored it.\n\nThe reproduction lives in an independent verification package (docs/team/reports/P1/pkg) written from scratch; it does not reuse the implementation fixtures.\n' > "$WORK/f14-body.md"
|
|
147
|
+
local name
|
|
148
|
+
for name in f13 f14; do
|
|
149
|
+
R="$(mkproj "s$name-$LABEL")"; mktask "$R" P1
|
|
150
|
+
cp "$WORK/$name-body.md" "$R/.worktrees/dev/docs/team/reports/P1-dev.md"
|
|
151
|
+
git -C "$R/.worktrees/dev" add -A && git -C "$R/.worktrees/dev" commit -qm "docs(P1): $name"
|
|
152
|
+
D="$WORK/s$name-$LABEL-dir"; git -C "$R" worktree add -q --detach "$D" task/P1-smoke
|
|
153
|
+
(cd "$R" && bash "$CUR_SKILL/scripts/team" review P1 --dir "$D" --strong) >/dev/null 2>&1
|
|
154
|
+
local v; v="$(grep -m1 -oE '满足强复验|不满足(不阻塞合并' "$R/docs/team/reviews/P1.md" 2>/dev/null || echo '?')"
|
|
155
|
+
if [ "$name" = "f13" ]; then
|
|
156
|
+
if [ "$v" = "满足强复验" ]; then case_line F13 "$LABEL" bug "只字面提到关键词 → 判成「$v」"
|
|
157
|
+
else case_line F13 "$LABEL" fixed "关键词蒙不过去 → 「$v」"; fi
|
|
158
|
+
else
|
|
159
|
+
if [ "$v" = "满足强复验" ]; then case_line F14 "$LABEL" fixed "英文-first 的真证据 → 「$v」"
|
|
160
|
+
else case_line F14 "$LABEL" bug "真证据被判成「$v」"; fi
|
|
161
|
+
fi
|
|
162
|
+
done
|
|
163
|
+
|
|
164
|
+
# F14b —— 报告不在 checkout 里(只在主工作树/agent worktree):PM 退回 M6.2 时复现的现场
|
|
165
|
+
R="$(mkproj f14b-$LABEL)"; mktask "$R" P1
|
|
166
|
+
git -C "$R/.worktrees/dev" rm -q "$R/.worktrees/dev/docs/team/reports/P1-dev.md"
|
|
167
|
+
git -C "$R/.worktrees/dev" commit -qm "chore(P1): report lives outside the checkout"
|
|
168
|
+
mkdir -p "$R/docs/team/reports/P1-dev/pkg"
|
|
169
|
+
{ printf '# P1 · report\n\n## Flip evidence\nRed before: guard test failed (see pkg/flip)\nGreen after: guard test passed\n\n'
|
|
170
|
+
printf '## Independent verification package\npkg/run.sh (written for this task, does not reuse the implementation fixtures)\n'; } > "$R/docs/team/reports/P1-dev.md"
|
|
171
|
+
printf '#!/usr/bin/env bash\necho red; echo green\n' > "$R/docs/team/reports/P1-dev/pkg/run.sh"
|
|
172
|
+
D="$WORK/f14b-$LABEL-dir"; git -C "$R" worktree add -q --detach "$D" task/P1-smoke
|
|
173
|
+
(cd "$R" && bash "$CUR_SKILL/scripts/team" review P1 --dir "$D" --strong --no-gates) >/dev/null 2>&1
|
|
174
|
+
local v14b; v14b="$(grep -m1 -oE '满足强复验|不满足(不阻塞合并' "$R/docs/team/reviews/P1.md" 2>/dev/null || echo '?')"
|
|
175
|
+
if [ "$v14b" = "满足强复验" ]; then case_line F14b "$LABEL" fixed "报告不在 checkout 里也认(采用主工作树那份,并注明不在 checkout)"
|
|
176
|
+
else case_line F14b "$LABEL" bug "报告不在 checkout 里 → 判成「$v14b」(只扫 checkout 的老毛病)"; fi
|
|
177
|
+
|
|
178
|
+
# F3 —— 记录绑定 revision:验完再交付一格,待复验信号回不回来
|
|
179
|
+
R="$(mkproj f3-$LABEL)"; mktask "$R" P1
|
|
180
|
+
D="$WORK/f3-$LABEL-dir"; git -C "$R" worktree add -q --detach "$D" task/P1-smoke
|
|
181
|
+
(cd "$R" && bash "$CUR_SKILL/scripts/team" review P1 --dir "$D") >/dev/null 2>&1
|
|
182
|
+
local A; A="$(sed -n 's/.*HEAD: `\([0-9a-f]*\)`.*/\1/p' "$R/docs/team/reviews/P1.md" | head -1)"
|
|
183
|
+
git -C "$R/.worktrees/dev" commit -q --allow-empty -m "feat(P1): delivered after verification"
|
|
184
|
+
DIG="$(cd "$R" && bash "$CUR_SKILL/scripts/team" digest 2>&1)"
|
|
185
|
+
if grep -q 'stale: verified' <<<"$DIG"; then
|
|
186
|
+
case_line F3 "$LABEL" fixed "digest 重新列出:$(grep -m1 -o 'stale: verified [0-9a-f]*, branch now [0-9a-f]*' <<<"$DIG")(记录 HEAD $A)"
|
|
187
|
+
else
|
|
188
|
+
case_line F3 "$LABEL" bug "记录 HEAD $A 之后分支又动了,digest 的待复验仍为空(记录永久压制待办)"
|
|
189
|
+
fi
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
printf '\n== red(修复前)==\n'
|
|
193
|
+
run_all RED "$RED_ROOT/skills/teamsmith"
|
|
194
|
+
RED_BUGS=$BUG; RED_FIXED=$PASS
|
|
195
|
+
PASS=0; BUG=0
|
|
196
|
+
printf '\n== green(修复后)==\n'
|
|
197
|
+
run_all GREEN "$SKILL_DIR"
|
|
198
|
+
GREEN_BUGS=$BUG; GREEN_FIXED=$PASS
|
|
199
|
+
|
|
200
|
+
printf '\n== 结果 ==\n red : BUG-REPRODUCED=%d BUG-GONE=%d (10 个 finding/子用例全部必须复现)\n' "$RED_BUGS" "$RED_FIXED"
|
|
201
|
+
printf ' green: BUG-GONE=%d BUG-REPRODUCED=%d (必须全部已修复)\n' "$GREEN_FIXED" "$GREEN_BUGS"
|
|
202
|
+
if [ "$RED_BUGS" = "10" ] && [ "$GREEN_BUGS" = "0" ]; then
|
|
203
|
+
printf ' ✓ 翻转成立:red 全复现 → green 全消失\n'; exit 0
|
|
204
|
+
fi
|
|
205
|
+
printf ' ✗ 翻转不成立(看上面的逐条输出)\n'; exit 1
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# M6.3 · 独立验证包:dispatch / 通知 / 边界的七个 finding,red → green 复现
|
|
3
|
+
#
|
|
4
|
+
# bash skills/teamsmith/tests/flip-m6.3.sh # 红树 = 与 main 的分叉点,绿树 = 本 worktree
|
|
5
|
+
# TEAM_FLIP_BASE=<sha> bash skills/teamsmith/tests/flip-m6.3.sh
|
|
6
|
+
#
|
|
7
|
+
# 覆盖(每个 finding 的「修复后该成立的性质」在两棵树上各断言一次):
|
|
8
|
+
# F16 (high) dispatch 拒绝「工作树停在别的任务的分支上」,并点名两个分支 + 给出 git switch
|
|
9
|
+
# F26 (high) worker 的 `notify pm`(PM 自己的收件箱)算待办 → watchdog 会叫醒/拉起 PM
|
|
10
|
+
# F15 (low) 项目外的任务书被拒(不再把绝对路径叫 repo-relative)
|
|
11
|
+
# F18 (low) 打错的收件人非零退出并点名名册(--any 可强制,留痕)
|
|
12
|
+
# F17 (low) 去重键能区分「开头 60 字符相同、后半不同」的简报;字节相同仍去重
|
|
13
|
+
# F27 (med) 空 tmux 目标在包装里被拒(探针不落地)
|
|
14
|
+
# F30 (med) wrapper agent(脚本 exec 掉自己)被报为已启动,证据是 spawn(活 pid + cwd 在项目内)
|
|
15
|
+
#
|
|
16
|
+
# 安全:所有 tmux 流量走**私有 socket**(PATH shim 给每条命令加 `-L <socket>`),
|
|
17
|
+
# 所以红树里那个危险的 `-t ""` 探针也只能打到本包的场地。只写 /tmp,不碰调用者的仓库/session。
|
|
18
|
+
set -uo pipefail
|
|
19
|
+
|
|
20
|
+
SELF_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
21
|
+
SKILL_DIR="$(cd -P "$SELF_DIR/.." && pwd)"
|
|
22
|
+
# P53:临时根的唯一创建者(${TMPDIR:-/tmp} + owned 家族 + 回收)
|
|
23
|
+
. "$SELF_DIR/lib/tmp-root.sh"
|
|
24
|
+
# P162:破坏性调用(kill-server/kill-session/kill-window)动手前先证明私有 socket 生效
|
|
25
|
+
. "$SELF_DIR/lib/tmux-iso.sh"
|
|
26
|
+
REPO_ROOT="$(git -C "$SKILL_DIR" rev-parse --show-toplevel 2>/dev/null || true)"
|
|
27
|
+
[ -n "$REPO_ROOT" ] || { printf 'flip-m6.3: 找不到 git 仓库(本脚本用 git archive 取修复前的树)\n' >&2; exit 2; }
|
|
28
|
+
command -v tmux >/dev/null 2>&1 || { printf 'flip-m6.3: 需要 tmux(本复现是 tmux 现场的)\n' >&2; exit 2; }
|
|
29
|
+
|
|
30
|
+
BASE="${TEAM_FLIP_BASE:-}"
|
|
31
|
+
[ -n "$BASE" ] || BASE="$(git -C "$REPO_ROOT" merge-base HEAD main 2>/dev/null || true)"
|
|
32
|
+
[ -n "$BASE" ] || { printf 'flip-m6.3: 解析不到红树的 revision,用 TEAM_FLIP_BASE=<sha> 指定\n' >&2; exit 2; }
|
|
33
|
+
|
|
34
|
+
[ "${KEEP:-0}" = "1" ] && export TEAM_TMP_KEEP=1
|
|
35
|
+
TMP="$(tmp_root_create flip-m6.3)" || exit 3
|
|
36
|
+
SOCK="m63flip-$$"
|
|
37
|
+
mkdir -p "$TMP/red" "$TMP/shim"
|
|
38
|
+
|
|
39
|
+
# M28:夹具自己的 tmux 调用要有隔离证据(裸 tmux 按 $TMUX 打到调用者 server —— M23 事故形状)。
|
|
40
|
+
# 下面仍旧保留 PATH shim(工具的调用走 -L);这里补的是**本脚本自己**的顶层白名单:
|
|
41
|
+
# unset TMUX + 私有 TMUX_TMPDIR,shim 洗掉也不会回落默认 socket。口径见 tests/tmux-lint.pl。
|
|
42
|
+
unset TMUX TMUX_PANE 2>/dev/null || true
|
|
43
|
+
TMUX_TMPDIR="$TMP/tmux"; mkdir -p "$TMUX_TMPDIR"; export TMUX_TMPDIR
|
|
44
|
+
git -C "$REPO_ROOT" archive "$BASE" skills/teamsmith | tar -x -C "$TMP/red" || exit 2
|
|
45
|
+
RED_SKILL="$TMP/red/skills/teamsmith"
|
|
46
|
+
GREEN_SKILL="$SKILL_DIR"
|
|
47
|
+
[ -f "$RED_SKILL/scripts/team" ] || { printf 'flip-m6.3: 红树里没取到 skills/teamsmith(base=%s)\n' "$BASE" >&2; exit 2; }
|
|
48
|
+
# 守卫:base 必须真的还是「修复前」,否则这个包会报一个假的翻转
|
|
49
|
+
if grep -q 'team_require_recipient' "$RED_SKILL/scripts/lib/cmd-agents.sh" 2>/dev/null; then
|
|
50
|
+
printf 'flip-m6.3: TEAM_FLIP_BASE=%s 已经含修复(红树不是红的)——用更早的 revision\n' "$BASE" >&2; exit 2
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
printf '#!/usr/bin/env bash\nexec /usr/bin/tmux -L %s "$@"\n' "$SOCK" > "$TMP/shim/tmux"
|
|
54
|
+
chmod +x "$TMP/shim/tmux"
|
|
55
|
+
PATH="$TMP/shim:$PATH"; export PATH
|
|
56
|
+
export TMUX="$SOCK,0,0" TMUX_PANE=""
|
|
57
|
+
cleanup() {
|
|
58
|
+
# P162:收尾先证明私有 socket 生效(不成立就拒绝;cleanup 里不许 exit)
|
|
59
|
+
if tmux_iso_guard_soft "flip-m6.3" "收尾:私有 server" --tmpdir "${TMUX_TMPDIR:-}" --sock-name "$SOCK" --own-root "$TMP"; then
|
|
60
|
+
tmux kill-server >/dev/null 2>&1 || true
|
|
61
|
+
fi
|
|
62
|
+
tmp_root_reap_all
|
|
63
|
+
}
|
|
64
|
+
trap cleanup EXIT
|
|
65
|
+
|
|
66
|
+
PASS=0; FAIL=0
|
|
67
|
+
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; PASS=$((PASS+1)); }
|
|
68
|
+
bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL+1)); }
|
|
69
|
+
hdr() { printf '\n\033[1m══ %s\033[0m\n' "$1"; }
|
|
70
|
+
|
|
71
|
+
# ---- 夹具 ----------------------------------------------------------------
|
|
72
|
+
STUB="$TMP/stub-agent"
|
|
73
|
+
cat > "$STUB" <<STUBEOF
|
|
74
|
+
#!/usr/bin/env bash
|
|
75
|
+
printf 'argv_count=%s\n' "\$#" >> "$TMP/stub-args.log"
|
|
76
|
+
sleep 300
|
|
77
|
+
STUBEOF
|
|
78
|
+
chmod +x "$STUB"
|
|
79
|
+
|
|
80
|
+
fixture() { # <skill> <name> [session] → repo 路径(已 init + 提交)
|
|
81
|
+
local skill="$1" name="$2" sess="${3:-$2}"
|
|
82
|
+
local r="$TMP/$name"
|
|
83
|
+
mkdir -p "$r"
|
|
84
|
+
git -C "$r" init -q -b main
|
|
85
|
+
git -C "$r" config user.email flip@m63
|
|
86
|
+
git -C "$r" config user.name flip
|
|
87
|
+
printf '# %s\n' "$name" > "$r/README.md"
|
|
88
|
+
git -C "$r" add -A && git -C "$r" commit -qm init
|
|
89
|
+
( cd "$r" && bash "$skill/scripts/team" init --session "$sess" --agents "dev verify" --gates "true" ) >/dev/null 2>&1
|
|
90
|
+
git -C "$r" add -A && git -C "$r" commit -qm "teamsmith init"
|
|
91
|
+
printf '%s\n' "$r"
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
runp() { # <repo> <skill> <args...>
|
|
95
|
+
local r="$1" skill="$2"; shift 2
|
|
96
|
+
( cd "$r" && env -u TEAM_ROOT -u TEAM_MAIN_ROOT -u TEAM_SKILL_DIR bash "$skill/scripts/team" "$@" ) 2>&1
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
engine() { # <repo> <skill> <bash 片段>:source 全库后在夹具里跑片段(白盒探针)
|
|
100
|
+
local r="$1" skill="$2" code="$3"
|
|
101
|
+
( cd "$r" && env -u TEAM_ROOT -u TEAM_MAIN_ROOT -u TEAM_SKILL_DIR TEAM_ROOT="$r" \
|
|
102
|
+
bash -c 'd="$1"; . "$d/scripts/lib/common.sh"; for f in "$d"/scripts/lib/cmd-*.sh; do . "$f" 2>/dev/null || true; done; team_load_config 2>/dev/null; '"$code" _ "$skill" ) 2>/dev/null
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
brief() { # <repo> <ID>
|
|
106
|
+
local r="$1" id="$2"
|
|
107
|
+
local f="$r/docs/team/tasks/$id-flip.md"
|
|
108
|
+
mkdir -p "$(dirname "$f")"
|
|
109
|
+
printf '# %s · flip fixture\n\n```\ntask: %s\nagent: dev\n```\n\nDo X.\n' "$id" "$id" > "$f"
|
|
110
|
+
printf '%s\n' "$f"
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
canon_branch() { engine "$1" "$2" "team_branch_for_agent dev '$3'"; }
|
|
114
|
+
|
|
115
|
+
# 真派单需要一个「能解析到的 agent 可执行文件」:把假 adapter 写进夹具配置
|
|
116
|
+
use_stub_adapter() { # <repo>
|
|
117
|
+
printf 'TEAM_AGENT_CMD="%s {prompt}"\nTEAM_AGENT_BIN="%s"\n' "$STUB" "$STUB" >> "$1/.pi/team/config.sh"
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
# assert_fix <修复后性质是否成立(1/0)> <标签>:红树要求 0,绿树要求 1
|
|
121
|
+
EXPECT_TREE=""
|
|
122
|
+
assert_fix() {
|
|
123
|
+
local got="$1" label="$2"
|
|
124
|
+
if [ "$EXPECT_TREE" = "green" ]; then
|
|
125
|
+
[ "$got" = "1" ] && ok "$label(green:成立)" || bad "$label(green:修复后仍不成立)"
|
|
126
|
+
else
|
|
127
|
+
[ "$got" = "0" ] && ok "$label(red:修复前不成立 ✓)" || bad "$label(red:修复前就成立 → 夹具/基点不对)"
|
|
128
|
+
fi
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
TSRUN=""
|
|
132
|
+
if command -v node >/dev/null 2>&1 && node -e 'process.exit(process.features.typescript?0:1)' >/dev/null 2>&1; then TSRUN="node"
|
|
133
|
+
elif command -v bun >/dev/null 2>&1 && bun -e '1' >/dev/null 2>&1; then TSRUN="bun"
|
|
134
|
+
elif [ -x "$HOME/.bun/bin/bun" ] && "$HOME/.bun/bin/bun" -e '1' >/dev/null 2>&1; then TSRUN="$HOME/.bun/bin/bun"
|
|
135
|
+
elif command -v tsx >/dev/null 2>&1; then TSRUN="tsx"; fi
|
|
136
|
+
|
|
137
|
+
# ---- F16:工作树停在别的任务的分支上 --------------------------------------
|
|
138
|
+
case_f16() { # <skill> <tag>
|
|
139
|
+
local skill="$1" tag="$2" r out rc br want sess fixed=0
|
|
140
|
+
sess="m63-$tag-f16"; r="$(fixture "$skill" "$tag-f16" "$sess")"
|
|
141
|
+
git -C "$r" worktree add -q --detach "$r/.worktrees/dev" main >/dev/null 2>&1
|
|
142
|
+
git -C "$r/.worktrees/dev" switch -q -c task/P2-smoke main >/dev/null 2>&1
|
|
143
|
+
use_stub_adapter "$r"
|
|
144
|
+
local b; b="$(brief "$r" P1)"
|
|
145
|
+
want="$(canon_branch "$r" "$skill" P1)"
|
|
146
|
+
out="$(runp "$r" "$skill" dispatch dev P1 "$b")"; rc=$?
|
|
147
|
+
br="$(engine "$r" "$skill" "team_state_get dev branch -")"
|
|
148
|
+
[ "$rc" != "0" ] && grep -q 'task/P2-smoke' <<<"$out" && grep -qF "$want" <<<"$out" && grep -q 'switch' <<<"$out" && fixed=1
|
|
149
|
+
assert_fix "$fixed" "F16 跨任务分支被拒 + 点名两分支 + 给出 switch(rc=$rc state分支=$br want=$want)"
|
|
150
|
+
# P162:破坏性调用前先证明私有 socket 生效(不成立 → 硬停)
|
|
151
|
+
tmux_iso_require "flip-m6.3" "收掉夹具 session" --tmpdir "${TMUX_TMPDIR:-}" --sock-name "$SOCK" --own-root "$TMP"
|
|
152
|
+
tmux kill-session -t "$sess" >/dev/null 2>&1 || true
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
# ---- F26:PM 自己的收件箱算待办 --------------------------------------------
|
|
156
|
+
case_f26() { # <skill> <tag>
|
|
157
|
+
local skill="$1" tag="$2" r out fixed=0
|
|
158
|
+
r="$(fixture "$skill" "$tag-f26" "m63-$tag-f26")"
|
|
159
|
+
printf 'worker summary for the PM\n' > "$TMP/$tag-f26-summary.txt"
|
|
160
|
+
runp "$r" "$skill" notify pm --from-file "$TMP/$tag-f26-summary.txt" >/dev/null 2>&1
|
|
161
|
+
out="$(runp "$r" "$skill" watch --once | head -1)"
|
|
162
|
+
grep -q '未读通知 1' <<<"$out" && fixed=1
|
|
163
|
+
assert_fix "$fixed" "F26 watchdog 把 inbox/pm.md 算作待办(${out#*watchdog: })"
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
# ---- F15:项目外的任务书 ---------------------------------------------------
|
|
167
|
+
case_f15() { # <skill> <tag>
|
|
168
|
+
local skill="$1" tag="$2" r out rc fixed=0
|
|
169
|
+
r="$(fixture "$skill" "$tag-f15" "m63-$tag-f15")"
|
|
170
|
+
git -C "$r" worktree add -q --detach "$r/.worktrees/dev" main >/dev/null 2>&1
|
|
171
|
+
git -C "$r/.worktrees/dev" switch -q -c "$(canon_branch "$r" "$skill" P1)" main >/dev/null 2>&1
|
|
172
|
+
printf '# P9 · outside\n\n```\ntask: P9\nagent: dev\n```\n' > "$TMP/$tag-f15-outside.md"
|
|
173
|
+
use_stub_adapter "$r"
|
|
174
|
+
out="$(runp "$r" "$skill" dispatch dev P1 "$TMP/$tag-f15-outside.md" --print)"; rc=$?
|
|
175
|
+
[ "$rc" != "0" ] && ! grep -q 'repo-relative' <<<"$out" && grep -qF "$r" <<<"$out" && fixed=1
|
|
176
|
+
assert_fix "$fixed" "F15 项目外任务书被拒 + 不再叫 repo-relative(rc=$rc)"
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
# ---- F18:打错的收件人 -----------------------------------------------------
|
|
180
|
+
case_f18() { # <skill> <tag>
|
|
181
|
+
local skill="$1" tag="$2" r out rc fixed=0 anyrc=0
|
|
182
|
+
r="$(fixture "$skill" "$tag-f18" "m63-$tag-f18")"
|
|
183
|
+
out="$(runp "$r" "$skill" say devv 'hello?')"; rc=$?
|
|
184
|
+
[ "$rc" != "0" ] && [ ! -f "$r/docs/team/inbox/devv.md" ] && grep -q 'dev' <<<"$out" && grep -q -- '--any' <<<"$out" && fixed=1
|
|
185
|
+
if [ "$fixed" = "1" ]; then
|
|
186
|
+
runp "$r" "$skill" say devv --any 'forced' >/dev/null 2>&1; anyrc=$?
|
|
187
|
+
{ [ "$anyrc" = "0" ] && grep -q 'forced' "$r/docs/team/inbox/devv.md" 2>/dev/null; } || fixed=0
|
|
188
|
+
fi
|
|
189
|
+
assert_fix "$fixed" "F18 未知收件人非零退出 + 点名名册 + --any 可强制(rc=$rc any=$anyrc)"
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
# ---- F17:去重键 -----------------------------------------------------------
|
|
193
|
+
driver_f17() {
|
|
194
|
+
cat > "$TMP/f17-drive.mjs" <<'DRV'
|
|
195
|
+
import { readFileSync } from 'node:fs'
|
|
196
|
+
const [extPath, root, cwd, textsFile] = process.argv.slice(2)
|
|
197
|
+
delete process.env.TMUX_PANE
|
|
198
|
+
const handlers = Object.create(null)
|
|
199
|
+
const pi = { on: (e, h) => { handlers[e] = h }, registerCommand() {}, registerTool() {}, sendMessage() {} }
|
|
200
|
+
const mod = await import(extPath)
|
|
201
|
+
mod.default(pi)
|
|
202
|
+
const settle = handlers.agent_settled
|
|
203
|
+
for (const text of readFileSync(textsFile, 'utf8').split('\n').filter(Boolean)) {
|
|
204
|
+
await settle({}, { cwd, sessionManager: { getEntries: () => [{ message: { role: 'assistant', content: [{ text }] } }] } })
|
|
205
|
+
}
|
|
206
|
+
DRV
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
case_f17() { # <skill> <tag>
|
|
210
|
+
local skill="$1" tag="$2" r inbox n=""
|
|
211
|
+
if [ -z "$TSRUN" ]; then printf ' (F17 跳过:没有 TS runner)\n'; return 0; fi
|
|
212
|
+
r="$(fixture "$skill" "$tag-f17" "m63-$tag-f17")"
|
|
213
|
+
git -C "$r" worktree add -q --detach "$r/.worktrees/dev" main >/dev/null 2>&1
|
|
214
|
+
git -C "$r/.worktrees/dev" switch -q -c "$(canon_branch "$r" "$skill" P1)" main >/dev/null 2>&1
|
|
215
|
+
inbox="$r/docs/team/inbox/dev.md"
|
|
216
|
+
driver_f17
|
|
217
|
+
local prefix='All gates are green. I delivered the parser fix; the remaining work on this branch is'
|
|
218
|
+
{ printf '%s the retry path.\n' "$prefix"; printf '%s the cache warm-up.\n' "$prefix"; printf '%s error mapping.\n' "$prefix"; } > "$TMP/$tag-f17.txt"
|
|
219
|
+
( cd "$r" && env TEAM_ROOT="$r" "$TSRUN" "$TMP/f17-drive.mjs" "$skill/extension/team-notify.ts" "$r" "$r/.worktrees/dev" "$TMP/$tag-f17.txt" ) >/dev/null 2>&1
|
|
220
|
+
n="$(wc -l < "$inbox" 2>/dev/null | tr -d ' ' || echo 0)"
|
|
221
|
+
local fixed=0
|
|
222
|
+
if [ "$n" = "3" ]; then
|
|
223
|
+
rm -f "$inbox" "$r/.pi/team/state/notify-dedup"
|
|
224
|
+
printf 'Identical settle message, twice.\nIdentical settle message, twice.\n' > "$TMP/$tag-f17b.txt"
|
|
225
|
+
( cd "$r" && env TEAM_ROOT="$r" "$TSRUN" "$TMP/f17-drive.mjs" "$skill/extension/team-notify.ts" "$r" "$r/.worktrees/dev" "$TMP/$tag-f17b.txt" ) >/dev/null 2>&1
|
|
226
|
+
local n2; n2="$(wc -l < "$inbox" 2>/dev/null | tr -d ' ' || echo 0)"
|
|
227
|
+
[ "$n2" = "1" ] && fixed=1
|
|
228
|
+
assert_fix "$fixed" "F17 三条前缀相同的简报都在($n 行)+ 重复同一条仍去重($n2 行)"
|
|
229
|
+
else
|
|
230
|
+
assert_fix 0 "F17 三条前缀相同的简报都在(实际 $n 行)"
|
|
231
|
+
fi
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
# ---- F27:空 tmux 目标 -----------------------------------------------------
|
|
235
|
+
case_f27() { # <skill> <tag>
|
|
236
|
+
local skill="$1" tag="$2" r out rc fixed=0 sess panes
|
|
237
|
+
sess="m63-$tag-f27"; r="$(fixture "$skill" "$tag-f27" "$sess")"
|
|
238
|
+
tmux new-session -d -s "$sess" -n pm >/dev/null 2>&1 || true
|
|
239
|
+
tmux send-keys -t "$sess:pm" 'clear' Enter >/dev/null 2>&1 || true
|
|
240
|
+
out="$(engine "$r" "$skill" "TEAM_SESSION='$sess' team_tmux_send_text '' 'EMPTY-TARGET-PROBE'; echo rc=\$?")"
|
|
241
|
+
rc="$(sed -n 's/^rc=//p' <<<"$out")"
|
|
242
|
+
panes="$(tmux capture-pane -p -t "$sess:pm" 2>/dev/null)"
|
|
243
|
+
[ "$rc" != "0" ] && ! grep -q 'EMPTY-TARGET-PROBE' <<<"$panes" && fixed=1
|
|
244
|
+
assert_fix "$fixed" "F27 空目标被拒且探针不落地(rc=${rc:-?})"
|
|
245
|
+
# P162:破坏性调用前先证明私有 socket 生效(不成立 → 硬停)
|
|
246
|
+
tmux_iso_require "flip-m6.3" "收掉夹具 session" --tmpdir "${TMUX_TMPDIR:-}" --sock-name "$SOCK" --own-root "$TMP"
|
|
247
|
+
tmux kill-session -t "$sess" >/dev/null 2>&1 || true
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
# ---- F30:wrapper agent 启动证据 -------------------------------------------
|
|
251
|
+
case_f30() { # <skill> <tag>
|
|
252
|
+
local skill="$1" tag="$2" r out fixed=0 wrap proof pid sess
|
|
253
|
+
sess="m63-$tag-f30"; r="$(fixture "$skill" "$tag-f30" "$sess")"
|
|
254
|
+
wrap="$TMP/$tag-f30-wrapper"
|
|
255
|
+
printf '#!/bin/sh\nexec sleep 300\n' > "$wrap"; chmod +x "$wrap"
|
|
256
|
+
printf 'TEAM_PI_BIN="%s"\n' "$wrap" >> "$r/.pi/team/config.sh"
|
|
257
|
+
out="$(runp "$r" "$skill" up)"
|
|
258
|
+
proof="$(cat "$r/.pi/team/state/pm.pid.proof" 2>/dev/null || true)"
|
|
259
|
+
pid=""
|
|
260
|
+
[ -f "$r/.pi/team/state/pm.pid" ] && pid="$(tr -dc '0-9' < "$r/.pi/team/state/pm.pid")"
|
|
261
|
+
if grep -q 'PM 已启动' <<<"$out" && grep -q 'proof=spawn' <<<"$out" \
|
|
262
|
+
&& [ "$proof" = "spawn" ] && [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null \
|
|
263
|
+
&& [ "$(readlink "/proc/$pid/cwd" 2>/dev/null)" = "$r" ]; then fixed=1; fi
|
|
264
|
+
assert_fix "$fixed" "F30 wrapper agent 报已启动 + proof=spawn + 活 pid 在项目内(proof=${proof:-无})"
|
|
265
|
+
# P162:破坏性调用前先证明私有 socket 生效(不成立 → 硬停)
|
|
266
|
+
tmux_iso_require "flip-m6.3" "收掉夹具 session" --tmpdir "${TMUX_TMPDIR:-}" --sock-name "$SOCK" --own-root "$TMP"
|
|
267
|
+
tmux kill-session -t "$sess" >/dev/null 2>&1 || true
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
run_tree() { # <red|green> <skill>
|
|
271
|
+
EXPECT_TREE="$1"
|
|
272
|
+
printf '\n\033[36m▸ %s tree:%s\033[0m\n' "$1" "$2"
|
|
273
|
+
case_f16 "$2" "$1"; case_f26 "$2" "$1"; case_f15 "$2" "$1"; case_f18 "$2" "$1"
|
|
274
|
+
case_f17 "$2" "$1"; case_f27 "$2" "$1"; case_f30 "$2" "$1"
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
hdr "M6.3 flip · red(base=$BASE) → green($GREEN_SKILL)"
|
|
278
|
+
run_tree red "$RED_SKILL"
|
|
279
|
+
run_tree green "$GREEN_SKILL"
|
|
280
|
+
printf '\n\033[1m== flip-m6.3 结果 ==\033[0m ✓ %d ✗ %d\n' "$PASS" "$FAIL"
|
|
281
|
+
[ "$FAIL" -eq 0 ] && { printf '\033[32mred 复现了全部 7 个 finding,green 全部修复\033[0m\n'; exit 0; }
|
|
282
|
+
printf '\033[31m有断言不成立(红/绿说明见上)\033[0m\n'
|
|
283
|
+
exit 1
|