teamsmith 0.3.0 → 0.3.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/README.md +4 -4
- package/package.json +6 -2
- package/skills/teamsmith/CHANGELOG.md +56 -0
- package/skills/teamsmith/SKILL.md +7 -7
- package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
- package/skills/teamsmith/references/protocol.md +33 -19
- package/skills/teamsmith/references/troubleshooting.md +6 -3
- package/skills/teamsmith/scripts/lib/cmd-review.sh +15 -10
- package/skills/teamsmith/scripts/lib/cmd-status.sh +8 -4
- package/skills/teamsmith/scripts/lib/common.sh +301 -267
- package/skills/teamsmith/scripts/lib/gate-lock.sh +66 -28
- package/skills/teamsmith/scripts/panel/panel.js +64 -64
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +2 -1
- package/skills/teamsmith/scripts/panel/src/data.ts +40 -2
- package/skills/teamsmith/scripts/panel/src/main.tsx +5 -1
- package/skills/teamsmith/scripts/shim/killall +10 -0
- package/skills/teamsmith/scripts/shim/pgrep +10 -0
- package/skills/teamsmith/scripts/shim/pidof +10 -0
- package/skills/teamsmith/scripts/shim/pkill +10 -0
- package/skills/teamsmith/scripts/shim/signal-gate +108 -31
- package/skills/teamsmith/tests/README.md +31 -0
- package/skills/teamsmith/tests/checkout-shape-probe.sh +80 -53
- package/skills/teamsmith/tests/config-cli.sh +28 -22
- package/skills/teamsmith/tests/flip-p310-lock.sh +3 -9
- package/skills/teamsmith/tests/gate-guard.sh +52 -79
- package/skills/teamsmith/tests/help-surface.sh +2 -2
- package/skills/teamsmith/tests/install-shape.sh +127 -8
- package/skills/teamsmith/tests/key-replies-ui.sh +2 -1
- package/skills/teamsmith/tests/key-replies.sh +41 -27
- package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
- package/skills/teamsmith/tests/lib/section-guard.sh +104 -197
- package/skills/teamsmith/tests/loop-inventory.tsv +83 -89
- package/skills/teamsmith/tests/panel-b2.sh +351 -376
- package/skills/teamsmith/tests/panel-b3.sh +139 -43
- package/skills/teamsmith/tests/panel-cpu.sh +41 -129
- package/skills/teamsmith/tests/panel-p21.sh +96 -193
- package/skills/teamsmith/tests/perf.sh +83 -383
- package/skills/teamsmith/tests/routes.sh +115 -26
- package/skills/teamsmith/tests/seat-interrupt.sh +20 -10
- package/skills/teamsmith/tests/seat-visibility.sh +1 -1
- package/skills/teamsmith/tests/section-guard.sh +7 -101
- package/skills/teamsmith/tests/section-paths.tsv +15 -7
- package/skills/teamsmith/tests/section-select.sh +363 -18
- package/skills/teamsmith/tests/signal-gate.sh +249 -27
- package/skills/teamsmith/tests/signal-lint-legacy.txt +4 -1
- package/skills/teamsmith/tests/slash-team-e2e.sh +4 -4
- package/skills/teamsmith/tests/slice-coverage.sh +206 -0
- package/skills/teamsmith/tests/smoke.sh +856 -581
- package/skills/teamsmith/tests/task-model-routing.sh +25 -7
- package/skills/teamsmith/tests/team-bg-stop.sh +18 -10
- package/skills/teamsmith/tests/workflow-entry.sh +207 -0
- package/skills/teamsmith-init/SKILL.md +1 -1
- package/skills/teamsmith/tests/flip-glue.sh +0 -162
- package/skills/teamsmith/tests/flip-m12-26c.sh +0 -129
- package/skills/teamsmith/tests/flip-m12.sh +0 -185
- package/skills/teamsmith/tests/flip-m16.sh +0 -166
- package/skills/teamsmith/tests/flip-m17.sh +0 -204
- package/skills/teamsmith/tests/flip-m34.sh +0 -96
- package/skills/teamsmith/tests/flip-m37.sh +0 -188
- package/skills/teamsmith/tests/flip-m4.3.sh +0 -378
- package/skills/teamsmith/tests/flip-m43.sh +0 -128
- package/skills/teamsmith/tests/flip-m45.sh +0 -244
- package/skills/teamsmith/tests/flip-m46.sh +0 -238
- package/skills/teamsmith/tests/flip-m48.sh +0 -304
- package/skills/teamsmith/tests/flip-m6.2.sh +0 -205
- package/skills/teamsmith/tests/flip-m6.3.sh +0 -286
- package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
- package/skills/teamsmith/tests/flip-m6.5.sh +0 -116
- package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
- package/skills/teamsmith/tests/flip-m7.2.sh +0 -324
- package/skills/teamsmith/tests/flip-p144.sh +0 -112
- package/skills/teamsmith/tests/flip-p156.sh +0 -133
- package/skills/teamsmith/tests/flip-p160.sh +0 -182
- package/skills/teamsmith/tests/flip-p171.sh +0 -249
- package/skills/teamsmith/tests/flip-p18.1.sh +0 -95
- package/skills/teamsmith/tests/flip-p20.sh +0 -286
- package/skills/teamsmith/tests/flip-p201.sh +0 -249
- package/skills/teamsmith/tests/flip-p210.sh +0 -242
- package/skills/teamsmith/tests/flip-p211.sh +0 -152
- package/skills/teamsmith/tests/flip-p217.sh +0 -291
- package/skills/teamsmith/tests/flip-p22.sh +0 -123
- package/skills/teamsmith/tests/flip-p23.sh +0 -239
- package/skills/teamsmith/tests/flip-p25.sh +0 -165
- package/skills/teamsmith/tests/flip-p287-lock.sh +0 -342
- package/skills/teamsmith/tests/flip-p287-name.sh +0 -279
- package/skills/teamsmith/tests/flip-p304-read-side.sh +0 -98
- package/skills/teamsmith/tests/flip-p309-p162-deep.sh +0 -122
- package/skills/teamsmith/tests/flip-p71.sh +0 -184
- package/skills/teamsmith/tests/flip-p72.sh +0 -202
- package/skills/teamsmith/tests/load-experiment.sh +0 -290
- package/skills/teamsmith/tests/panel-cpu-premise.sh +0 -173
- package/skills/teamsmith/tests/panel-flip-m54.sh +0 -207
- package/skills/teamsmith/tests/panel-flip-p123.sh +0 -278
- package/skills/teamsmith/tests/panel-flip-p125.sh +0 -318
- package/skills/teamsmith/tests/panel-flip-p128.sh +0 -259
- package/skills/teamsmith/tests/panel-keyprobe-stub.sh +0 -41
- package/skills/teamsmith/tests/panel-keyprobe.sh +0 -82
- package/skills/teamsmith/tests/panel-knobs.sh +0 -89
- package/skills/teamsmith/tests/section-budgets.tsv +0 -164
- package/skills/teamsmith/tests/team-bg-flip.sh +0 -239
- package/skills/teamsmith/tests/team-inbox-watch-flip.sh +0 -191
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# 定义一次)。契约文本在 `openspec/specs/verification/spec.md`:
|
|
6
6
|
# * The gate lock's holder record names its kind, its owner, its elapsed time and its bound
|
|
7
7
|
# * A nested run does not queue on the machine lock, and its work stays inside the section that spawned it
|
|
8
|
-
# * The hard timeout covers the gate run, not the queue
|
|
8
|
+
# * The hard timeout covers the gate run, not the queue(排队上限跟随持有者心跳)
|
|
9
9
|
#
|
|
10
10
|
# 两个位置、一个写者规则:
|
|
11
11
|
# `<lock>.holder` 只有**真的持有 flock 的那个进程**写它、也只有它删它(收尾时)。
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
#
|
|
24
24
|
# 读取:glob + pid/starttime 过滤。已死但没清掉的条目打印 `stale` 并**忽略**(等待者不去删别人的
|
|
25
25
|
# 文件:一处误判就可能删掉别人正在跑的东西)。席位/工作树按 `team notify` 发送者的同一条规则
|
|
26
|
-
#
|
|
26
|
+
# (运行时目录,名册拼写优先,**不取窗口名**;推导本体是 common.sh 的 team_seat_from_paths,只此
|
|
27
|
+
# 一份 —— 本库只供给 git 上下文);解析不出来就写 `?`——如实说不知道(记录必须写成功)。
|
|
27
28
|
#
|
|
28
29
|
# `/proc` 只用于 pid 复用安全与祖辈证明:没有 `/proc` → 证明不成立 → fail closed(一律按顶层)。
|
|
29
30
|
|
|
@@ -99,6 +100,11 @@ gate_lock_path_identity() {
|
|
|
99
100
|
stat -c '%d:%i' "$1" 2>/dev/null || stat -f '%d:%i' "$1" 2>/dev/null
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
# <路径> → mtime 的 epoch 秒(读不到 → 非 0)。同一个两平台写法:心跳是 mtime,内容不必解析。
|
|
104
|
+
gate_lock_path_mtime() {
|
|
105
|
+
stat -c '%Y' "$1" 2>/dev/null || stat -f '%m' "$1" 2>/dev/null
|
|
106
|
+
}
|
|
107
|
+
|
|
102
108
|
# <pid> <路径> → "<fd>\t<link>":该进程第一个指向 <路径>(或 "<路径> (deleted)")的描述符
|
|
103
109
|
gate_lock_fd_of_pid() {
|
|
104
110
|
local pid="${1:-}" p="$2" f l
|
|
@@ -389,12 +395,12 @@ gate_lock_describe_pair() {
|
|
|
389
395
|
gate_lock_describe "$src"
|
|
390
396
|
}
|
|
391
397
|
|
|
392
|
-
# <发布路径> <wait> →
|
|
393
|
-
|
|
398
|
+
# <发布路径> <wait> → gate_lock_patience 的同一行,但记录优先读伴生锁边上的那份(旧写入者的退回发布路径)
|
|
399
|
+
gate_lock_patience_pair() {
|
|
394
400
|
local pub="$1" src kind
|
|
395
401
|
IFS=$'\t' read -r src kind < <(gate_lock_record_source "$pub")
|
|
396
402
|
[ -n "$src" ] || src="$pub"
|
|
397
|
-
|
|
403
|
+
gate_lock_patience "$src" "$2"
|
|
398
404
|
}
|
|
399
405
|
|
|
400
406
|
gate_lock_describe() { # <lock> → 一行:活着的记录逐个列出;陈旧条目标 `stale` 并忽略
|
|
@@ -460,20 +466,55 @@ gate_lock_heartbeat_of_pid_pair() { # <发布路径> <祖辈 pid>
|
|
|
460
466
|
gate_lock_heartbeat_of_pid "$src" "$2"
|
|
461
467
|
}
|
|
462
468
|
|
|
463
|
-
# ----------------------------------------------------------------
|
|
464
|
-
#
|
|
465
|
-
#
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
469
|
+
# ---------------------------------------------------------------- 等待者的耐心(跟随心跳,不是预算投影)
|
|
470
|
+
# change: gate-waiter-patience(P338)。上限每轮**按现场重算**,判据只有等待者自己的已等时长:
|
|
471
|
+
# live 本锁某条活登记公布的心跳文件 < W 秒前还在动 → 上限 4 × W(硬顶,再久也不等)
|
|
472
|
+
# stalled 公布了,但已经 >= W 秒没动(边界归这一侧) → 上限 W(持有者按卡死处理)
|
|
473
|
+
# none 没有活登记公布心跳 / 公布的是 `-` / 路径上的文件不在 → 上限 W(旧记录:与今天一字不改)
|
|
474
|
+
# 心跳取**本锁所有活登记里最新的那一条**(`<lock>.holder` 与 `<lock>.runs/*.run`):顶层 smoke.sh 的
|
|
475
|
+
# 持有者记录公布的是取锁包装器的路径(那个文件没人写),真正在动的是子套件自己那条登记;`team review`
|
|
476
|
+
# 的持有者记录直接写 `heartbeat=-`,它跑的门禁只在子登记里公布心跳。只读 `.holder` 两种真实形状都
|
|
477
|
+
# 读不到,等于没改(design §3)。
|
|
478
|
+
# 读取**不校验**登记与当前持有者的祖先关系:一条遗留但仍活着的登记还能把上限顶到 4W —— 本 change
|
|
479
|
+
# 明写接受这条有界放宽(默认值下最坏 2 小时),不在实现里补认证。
|
|
480
|
+
gate_lock_heartbeat_newest() { # <lock> → "path<TAB>mtime"(没有可用心跳 → 非 0,无输出)
|
|
481
|
+
local lock="$1" f hb mt best_path="" best_mt=""
|
|
482
|
+
for f in "$(gate_lock_holder_file "$lock")" "$(gate_lock_runs_dir "$lock")"/*.run; do
|
|
483
|
+
[ -f "$f" ] || continue
|
|
484
|
+
gate_lock_record_live "$f" || continue
|
|
485
|
+
hb="$(gate_lock_record_get "$f" heartbeat)"
|
|
486
|
+
case "$hb" in ''|'-') continue ;; esac
|
|
487
|
+
mt="$(gate_lock_path_mtime "$hb")" || continue
|
|
488
|
+
[ -n "$mt" ] || continue
|
|
489
|
+
case "$mt" in *[!0-9]*) continue ;; esac
|
|
490
|
+
if [ -z "$best_mt" ] || [ "$mt" -gt "$best_mt" ]; then best_path="$hb"; best_mt="$mt"; fi
|
|
491
|
+
done
|
|
492
|
+
[ -n "$best_mt" ] || return 1
|
|
493
|
+
printf '%s\t%s\n' "$best_path" "$best_mt"
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
gate_lock_patience() { # <lock> <wait> → "ceiling<TAB>state<TAB>silent_for<TAB>heartbeat"
|
|
497
|
+
local lock="$1" wait="$2" newest hb mt now silent
|
|
498
|
+
# 唯一的时钟来源是既有的 gate_lock_now(测试可以在子 shell 里局部覆写它把时刻钉住)
|
|
499
|
+
newest="$(gate_lock_heartbeat_newest "$lock" 2>/dev/null || true)"
|
|
500
|
+
if [ -z "$newest" ]; then printf '%s\tnone\t-\t-\n' "$wait"; return 0; fi
|
|
501
|
+
hb="${newest%%$'\t'*}"; mt="${newest#*$'\t'}"
|
|
502
|
+
now="$(gate_lock_now)"
|
|
503
|
+
silent=$(( now - mt )); [ "$silent" -lt 0 ] && silent=0
|
|
504
|
+
if [ "$silent" -ge "$wait" ]; then
|
|
505
|
+
printf '%s\tstalled\t%s\t%s\n' "$wait" "$silent" "$hb"
|
|
506
|
+
else
|
|
507
|
+
printf '%s\tlive\t%s\t%s\n' "$(( wait * 4 ))" "$silent" "$hb"
|
|
508
|
+
fi
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
# <state> <silent_for> → 一句话说明上限来自哪里(排队行与失败行共用同一份措辞,只有这一处)
|
|
512
|
+
gate_lock_patience_note() {
|
|
513
|
+
case "$1" in
|
|
514
|
+
live) printf '心跳仍在动(%ss 前更新)\n' "$2" ;;
|
|
515
|
+
stalled) printf '心跳已停 %ss\n' "$2" ;;
|
|
516
|
+
*) printf '没有可用心跳\n' ;;
|
|
517
|
+
esac
|
|
477
518
|
}
|
|
478
519
|
|
|
479
520
|
# ---------------------------------------------------------------- 席位 / 工作树(team notify 同一条规则)
|
|
@@ -486,9 +527,12 @@ gate_lock_worktree_of_dir() { # <dir> → 绝对路径(解析不出 → `?`)
|
|
|
486
527
|
printf '%s\n' "$top"
|
|
487
528
|
}
|
|
488
529
|
|
|
489
|
-
gate_lock_seat_of_dir() { # <dir> [
|
|
530
|
+
gate_lock_seat_of_dir() { # <dir> [<名册>] [<worktrees 相对/绝对>] [<main root>] → 席位(`?` = 解析不出)
|
|
531
|
+
# 推导本体只有一份:common.sh 的 team_seat_from_paths(与 `team notify` 的发送者同一个函数)。
|
|
532
|
+
# 本函数只负责给它上下文(dir → git toplevel、主检出),并把「解析不出」收成 `?` —— 记录必须写
|
|
533
|
+
# 成功,它是诊断证据(P329)。
|
|
490
534
|
local dir="$1" roster="${2:-${TEAM_AGENTS:-}}" wtr="${3:-${TEAM_WORKTREES_DIR:-.worktrees}}" main="${4:-}"
|
|
491
|
-
local top common n
|
|
535
|
+
local top common n
|
|
492
536
|
top="$(cd "$dir" 2>/dev/null && git rev-parse --path-format=absolute --show-toplevel 2>/dev/null || true)"
|
|
493
537
|
[ -n "$top" ] || { printf '?\n'; return 0; }
|
|
494
538
|
if [ -z "$main" ]; then
|
|
@@ -498,14 +542,8 @@ gate_lock_seat_of_dir() { # <dir> [<roster>] [<worktrees 相对/绝对>] [<main
|
|
|
498
542
|
[ -n "$main" ] || { printf '?\n'; return 0; }
|
|
499
543
|
top="$(cd "$top" 2>/dev/null && pwd -P || printf '%s' "$top")"
|
|
500
544
|
main="$(cd "$main" 2>/dev/null && pwd -P || printf '%s' "$main")"
|
|
501
|
-
|
|
502
|
-
[ "$top" = "$main" ] && { printf 'pm\n'; return 0; }
|
|
503
|
-
case "$top" in
|
|
504
|
-
"$wtr"/*) n="${top#"$wtr"/}"; n="${n%%/*}" ;;
|
|
505
|
-
*) printf '?\n'; return 0 ;;
|
|
506
|
-
esac
|
|
545
|
+
n="$(team_seat_from_paths "$top" "$main" "$wtr" "$roster")"
|
|
507
546
|
[ -n "$n" ] || { printf '?\n'; return 0; }
|
|
508
|
-
for a in $roster; do [ "$n" = "$a" ] && { printf '%s\n' "$a"; return 0; }; done
|
|
509
547
|
printf '%s\n' "$n"
|
|
510
548
|
}
|
|
511
549
|
|