teamsmith 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +69 -0
- package/skills/teamsmith/SKILL.md +20 -13
- package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
- package/skills/teamsmith/extension/team-notify.ts +37 -6
- package/skills/teamsmith/extension/team.ts +438 -0
- package/skills/teamsmith/references/config.md +39 -6
- package/skills/teamsmith/references/migration.md +197 -47
- package/skills/teamsmith/references/protocol.md +201 -30
- package/skills/teamsmith/references/troubleshooting.md +130 -10
- package/skills/teamsmith/references/workflows.md +36 -2
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
- package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
- package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
- package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
- package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
- package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
- package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
- package/skills/teamsmith/scripts/lib/cmd-review.sh +182 -32
- package/skills/teamsmith/scripts/lib/cmd-status.sh +234 -21
- package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
- package/skills/teamsmith/scripts/lib/common.sh +1004 -245
- package/skills/teamsmith/scripts/lib/gate-lock.sh +582 -0
- package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
- package/skills/teamsmith/scripts/panel/panel.js +211 -211
- package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +12 -5
- package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
- package/skills/teamsmith/scripts/panel/src/data.ts +51 -5
- package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
- package/skills/teamsmith/scripts/panel/src/main.tsx +37 -8
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
- package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
- package/skills/teamsmith/scripts/replies.mjs +4 -1
- package/skills/teamsmith/scripts/shim/killall +10 -0
- package/skills/teamsmith/scripts/shim/pgrep +10 -0
- package/skills/teamsmith/scripts/shim/pidof +10 -0
- package/skills/teamsmith/scripts/shim/pkill +10 -0
- package/skills/teamsmith/scripts/shim/signal-gate +108 -31
- package/skills/teamsmith/scripts/shim/tmux +18 -0
- package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
- package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
- package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
- package/skills/teamsmith/scripts/team +19 -6
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
- package/skills/teamsmith/templates/config.sh.tmpl +20 -1
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
- package/skills/teamsmith/tests/README.md +31 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
- package/skills/teamsmith/tests/bg-ledger.sh +168 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +83 -54
- package/skills/teamsmith/tests/config-cli.sh +184 -32
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
- package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
- package/skills/teamsmith/tests/flip-m33.sh +5 -3
- package/skills/teamsmith/tests/flip-p158.sh +2 -1
- package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
- package/skills/teamsmith/tests/flip-p310-lock.sh +210 -0
- package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
- package/skills/teamsmith/tests/gate-guard.sh +52 -79
- package/skills/teamsmith/tests/help-surface.sh +1664 -0
- package/skills/teamsmith/tests/install-shape.sh +359 -22
- package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
- package/skills/teamsmith/tests/key-replies-ui.sh +2 -8
- package/skills/teamsmith/tests/key-replies.sh +281 -28
- package/skills/teamsmith/tests/ledger-ban.sh +5 -4
- package/skills/teamsmith/tests/ledger-claim.sh +2 -1
- package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
- package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
- package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
- package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
- package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
- package/skills/teamsmith/tests/lib/section-guard.sh +316 -164
- package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
- package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
- package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
- package/skills/teamsmith/tests/loop-inventory.tsv +83 -77
- package/skills/teamsmith/tests/panel-b2.sh +430 -352
- package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
- package/skills/teamsmith/tests/panel-b3.sh +314 -62
- package/skills/teamsmith/tests/panel-choices.sh +11 -6
- package/skills/teamsmith/tests/panel-cpu.sh +43 -130
- package/skills/teamsmith/tests/panel-p21.sh +251 -265
- package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
- package/skills/teamsmith/tests/panel-strings.mjs +33 -18
- package/skills/teamsmith/tests/perf.sh +187 -396
- package/skills/teamsmith/tests/routes.sh +440 -117
- package/skills/teamsmith/tests/seat-interrupt.sh +1012 -0
- package/skills/teamsmith/tests/seat-visibility.sh +675 -0
- package/skills/teamsmith/tests/section-guard.sh +13 -102
- package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
- package/skills/teamsmith/tests/section-paths.tsv +32 -18
- package/skills/teamsmith/tests/section-select.sh +371 -19
- package/skills/teamsmith/tests/signal-gate.sh +249 -27
- package/skills/teamsmith/tests/signal-lint-legacy.txt +4 -1
- package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
- package/skills/teamsmith/tests/slash-team.sh +617 -0
- package/skills/teamsmith/tests/slice-coverage.sh +206 -0
- package/skills/teamsmith/tests/smoke.sh +3595 -788
- package/skills/teamsmith/tests/task-model-routing.sh +530 -15
- package/skills/teamsmith/tests/team-bg-stop.sh +18 -10
- package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
- package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
- package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
- package/skills/teamsmith/tests/workflow-entry.sh +207 -0
- package/skills/teamsmith-init/SKILL.md +12 -12
- package/skills/teamsmith-init/references/bootstrap.md +3 -3
- package/skills/teamsmith/tests/flip-glue.sh +0 -162
- package/skills/teamsmith/tests/flip-m12-26c.sh +0 -129
- package/skills/teamsmith/tests/flip-m12.sh +0 -185
- package/skills/teamsmith/tests/flip-m16.sh +0 -166
- package/skills/teamsmith/tests/flip-m17.sh +0 -204
- package/skills/teamsmith/tests/flip-m34.sh +0 -96
- package/skills/teamsmith/tests/flip-m37.sh +0 -185
- package/skills/teamsmith/tests/flip-m4.3.sh +0 -375
- package/skills/teamsmith/tests/flip-m43.sh +0 -128
- package/skills/teamsmith/tests/flip-m45.sh +0 -244
- package/skills/teamsmith/tests/flip-m46.sh +0 -238
- package/skills/teamsmith/tests/flip-m48.sh +0 -304
- package/skills/teamsmith/tests/flip-m6.2.sh +0 -205
- package/skills/teamsmith/tests/flip-m6.3.sh +0 -283
- package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
- package/skills/teamsmith/tests/flip-m6.5.sh +0 -113
- package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
- package/skills/teamsmith/tests/flip-m7.2.sh +0 -321
- package/skills/teamsmith/tests/flip-p144.sh +0 -112
- package/skills/teamsmith/tests/flip-p156.sh +0 -133
- package/skills/teamsmith/tests/flip-p160.sh +0 -182
- package/skills/teamsmith/tests/flip-p171.sh +0 -249
- package/skills/teamsmith/tests/flip-p18.1.sh +0 -95
- package/skills/teamsmith/tests/flip-p20.sh +0 -286
- package/skills/teamsmith/tests/flip-p201.sh +0 -249
- package/skills/teamsmith/tests/flip-p210.sh +0 -239
- package/skills/teamsmith/tests/flip-p211.sh +0 -152
- package/skills/teamsmith/tests/flip-p217.sh +0 -288
- package/skills/teamsmith/tests/flip-p22.sh +0 -123
- package/skills/teamsmith/tests/flip-p23.sh +0 -239
- package/skills/teamsmith/tests/flip-p25.sh +0 -165
- package/skills/teamsmith/tests/flip-p71.sh +0 -184
- package/skills/teamsmith/tests/flip-p72.sh +0 -202
- package/skills/teamsmith/tests/load-experiment.sh +0 -290
- package/skills/teamsmith/tests/panel-cpu-premise.sh +0 -173
- package/skills/teamsmith/tests/panel-flip-m54.sh +0 -207
- package/skills/teamsmith/tests/panel-flip-p123.sh +0 -278
- package/skills/teamsmith/tests/panel-flip-p125.sh +0 -318
- package/skills/teamsmith/tests/panel-flip-p128.sh +0 -259
- package/skills/teamsmith/tests/panel-keyprobe-stub.sh +0 -41
- package/skills/teamsmith/tests/panel-keyprobe.sh +0 -82
- package/skills/teamsmith/tests/panel-knobs.sh +0 -83
- package/skills/teamsmith/tests/section-budgets.tsv +0 -154
- package/skills/teamsmith/tests/team-bg-flip.sh +0 -239
- package/skills/teamsmith/tests/team-inbox-watch-flip.sh +0 -191
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# teamsmith · 信号闸门(P159 · safe-signal-discipline
|
|
3
|
-
# PATH
|
|
2
|
+
# teamsmith · 信号闸门(P159 · safe-signal-discipline;P167/P321 · 选择器入口)—— 被注入到 agent
|
|
3
|
+
# 会话(PM 与 worker 窗口)PATH 最前的包装:`pkill` / `killall` / `pgrep` / `pidof` 四个名字共用本实现。
|
|
4
|
+
#
|
|
5
|
+
# 入口形状(P321):同目录的四个名字是**普通文件**(各自几行的 wrapper),不是软链 —— npm 的 tarball
|
|
6
|
+
# 不携带 120000 软链,0.3.0 的包里四个入口全部缺失、装完落到 /usr/bin(docs/team/reviews/release-0.3.0.md)。
|
|
7
|
+
# wrapper 把自己的名字作为**第一个参数**交给本文件;本文件被软链直接调用(历史形状)时按 basename 认名字。
|
|
8
|
+
# 入口名只决定「哪个工具被拦」,不授予任何放行:四个名字走同一套判定、同一份记录。
|
|
4
9
|
#
|
|
5
10
|
# 为什么存在:三次同族事故都是「按名字/命令行模式选进程」——模式命中了别的项目、别的会话里的同名
|
|
6
11
|
# 进程,也命中了调用者自己的 shell(模式串就在那条命令行里):
|
|
@@ -10,37 +15,63 @@
|
|
|
10
15
|
# · D72 dev-bob 的 `pkill -f` 误杀了同期的门禁客户端。
|
|
11
16
|
# 名字/命令行模式不是身份。闸门管的正是窗口里的 ad-hoc 调用(静态那一半由 tests/signal-lint.pl 管)。
|
|
12
17
|
#
|
|
13
|
-
# 判定(D1/D2/D3,见 openspec/changes/safe-signal-discipline/design.md
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
+
# 判定(D1/D2/D3,见 openspec/changes/safe-signal-discipline/design.md;选择器语法 = 已归档的
|
|
19
|
+
# openspec/changes/2026-10-03-signal-gate-pgrep,`boundary#Signals go to a recorded pid …`):
|
|
20
|
+
# · **没有可证明的选择形式**:`pkill`/`killall` 的 `-f <模式>`、`-x <名字>`、`-P <pid>`、`-u <user>`、
|
|
21
|
+
# 裸名字;`pgrep` 的按名字/模式/所有者选择(裸名字、`-f` 出 PID、`-u`/`-U`/`-G`…)、`pidof` 的
|
|
22
|
+
# **一切选择形态** —— 一律拒绝(exit 64),不执行真身、不发任何信号、stdout 留空;
|
|
23
|
+
# · 放行的只有三类形态,**都不授予任何信号权限**:
|
|
24
|
+
# ① 帮助/版本:单个 `--help` / `-h` / `-V` / `--version`(四个工具都有)—— 不选择任何进程;
|
|
25
|
+
# ② 显式 group/parent 的 PID 查询:`pgrep -g N` / `-P N`(N 是显式正整数)—— 诊断查询,
|
|
26
|
+
# 输出 PID 列表;
|
|
27
|
+
# ③ 整命令模式计数:`pgrep -fc P` / `-f -c P` / `-c -f P`(P 非空且不以 `-` 开头)——
|
|
28
|
+
# **按完整命令行模式匹配、只输出个数**,不出 PID 列表;分类看的是**整个 argv**,
|
|
29
|
+
# 不是「成员里有没有某个旗标」;
|
|
30
|
+
# · 诊断不等于授权:`-g`/`-P` 交出的 PID 列表是**查询结果**,不是任何 spawner 记录过的身份;
|
|
31
|
+
# `-fc` 的计数连 PID 都不是。拿它去发信号与 `kill $(ps …)` 同类 —— 闸门不把它当许可:
|
|
32
|
+
# 放行只意味着「原样递给真身并记 act=pass」;
|
|
18
33
|
# · **没有带内放行 token**(tmux 闸门有 `--teamsmith-allow-destructive`,因为人在 argv 里能点名
|
|
19
34
|
# 对象;信号没有对象可点,那正是问题本身),也**不读任何环境变量当授权**
|
|
20
35
|
# (TEAM_ALLOW_PATTERN_KILL=1 之类的继承值不改变任何判定);
|
|
21
|
-
# · `kill` / `
|
|
36
|
+
# · `kill` / `ps` / `fuser` **不拦**:闸门是 PATH shim,exec 时只看到展开后的 argv,
|
|
22
37
|
# `kill $(pgrep -f x)` 与 `kill $(cat job.pid)` 在它看来同样四个词 —— 拦 `kill` 要么堵死安全
|
|
23
|
-
# 路线、要么放过不安全的那条。绝对路径(/usr/bin/pkill)与没有把闸门目录放
|
|
24
|
-
#
|
|
38
|
+
# 路线、要么放过不安全的那条。绝对路径(/usr/bin/pkill、/usr/bin/pgrep)与没有把闸门目录放
|
|
39
|
+
# PATH 最前的 shell、shell 函数、其它产 PID 列表的工具**同样是明说的边界**,由
|
|
40
|
+
# tests/signal-lint.pl 静态覆盖仓库脚本。
|
|
25
41
|
#
|
|
26
42
|
# 记录(D4,与 tmux 家族同形):每次调用追加一行到 $TEAM_SIGNAL_CALLS_LOG
|
|
27
|
-
# `<ISO> · act=<pass|refused> · tool=<pkill|killall> · argv=<…> · pid=<…> ppid=<…> cwd=<…>`
|
|
43
|
+
# `<ISO> · act=<pass|refused> · tool=<pkill|killall|pgrep|pidof> · argv=<…> · pid=<…> ppid=<…> cwd=<…>`
|
|
28
44
|
# 上限 2000 条**调用行**(超了留最新 1000 条;首行 `<ISO> · rotation · dropped=<N>` 轮转标记自述
|
|
29
45
|
# 被裁掉多少,N 读不出时从 0 重算)。`act=refused` 的行在写主日志**之前**先逐字节复制进
|
|
30
46
|
# `<log>.forensics` —— 拒绝记录熬得过主日志轮转;复制失败仍走原判定与退出码,只在本行末尾补
|
|
31
47
|
# `retention=failed` + stderr 一行 ✗ 点名路径(失败可见,绝不改判定,也绝不挂住调用)。
|
|
32
48
|
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
49
|
+
# 真身解析(只读形式才需要):`pkill`/`killall` 优先 TEAM_SIGNAL_REAL(fixture 钉桩用,与
|
|
50
|
+
# TEAM_TMUX_REAL 同形);`pgrep`/`pidof` **忽略**这个旧 pin(它通常钉在 pkill 上 —— 把放行的诊断
|
|
51
|
+
# 调用路由过去等于换个名字发信号),只按自己的名字在 PATH 里找第一个**闸门目录之外**的同名文件。
|
|
52
|
+
# 拒绝**不依赖**真身能不能解析出来。
|
|
35
53
|
set -u
|
|
36
54
|
|
|
37
|
-
# ──
|
|
55
|
+
# ── 我是谁:入口名 = 被拦截的工具(只应是 pkill / killall / pgrep / pidof)──────────────────
|
|
56
|
+
# 两种入口都认:① 同名软链/同名文件(basename 就是工具名);② 普通文件 wrapper —— npm 带不了软链,
|
|
57
|
+
# 所以 wrapper 把自己的名字作为**第一个参数**传进来,这里摘掉它,剩下的才是调用者的原始 argv
|
|
58
|
+
# (记录与透传都用摘掉之后的那份)。
|
|
38
59
|
_shim_self="$(readlink -f "$0" 2>/dev/null || printf '%s' "$0")"
|
|
39
|
-
|
|
60
|
+
_gate_dir="$(cd -P "$(dirname "$_shim_self")" 2>/dev/null && pwd -P)" || _gate_dir="$(dirname "$_shim_self")"
|
|
61
|
+
_argv0="$(basename "$0")"
|
|
62
|
+
case "$_argv0" in
|
|
63
|
+
pkill|killall|pgrep|pidof) _tool="$_argv0" ;;
|
|
64
|
+
signal-gate)
|
|
65
|
+
if [ "$#" -gt 0 ]; then _tool="$1"; shift; else _tool=""; fi ;;
|
|
66
|
+
*)
|
|
67
|
+
printf '✗ teamsmith 信号闸门:本文件只应以 pkill / killall / pgrep / pidof 的名字被调用(当前 %s)—— 同目录的同名入口是 wrapper\n' \
|
|
68
|
+
"${_argv0:-?}" >&2
|
|
69
|
+
exit 2 ;;
|
|
70
|
+
esac
|
|
40
71
|
case "$_tool" in
|
|
41
|
-
pkill|killall) ;;
|
|
72
|
+
pkill|killall|pgrep|pidof) ;;
|
|
42
73
|
*)
|
|
43
|
-
printf '✗ teamsmith 信号闸门:本文件只应以 pkill / killall 的名字被调用(当前 %s)——
|
|
74
|
+
printf '✗ teamsmith 信号闸门:本文件只应以 pkill / killall / pgrep / pidof 的名字被调用(当前 %s)—— 同目录的同名入口是 wrapper\n' \
|
|
44
75
|
"${_tool:-?}" >&2
|
|
45
76
|
exit 2 ;;
|
|
46
77
|
esac
|
|
@@ -51,15 +82,44 @@ _shim_argc=$#
|
|
|
51
82
|
_shim_cwd="$(pwd -P 2>/dev/null || printf '%s' "${PWD:-}")"
|
|
52
83
|
_argv="$(printf '%s' "$*" | tr '\r\n' ' ')"
|
|
53
84
|
|
|
54
|
-
# ──
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
85
|
+
# ── 判定:按**整个 argv** 分类(D2/D3)───────────────────────────────────────────────────────
|
|
86
|
+
# `_is_positive_int` 只认 [1-9][0-9]*:0 是「隐式调用者进程组/父进程」的简写、负数与前导 0 都是
|
|
87
|
+
# 非显式 ID,一律不算可证明的显式标量。`_is_info_token` 是四个工具共享的只读信息词。
|
|
88
|
+
_is_positive_int() { # <v> → 0 = 显式正整数
|
|
89
|
+
case "${1:-}" in
|
|
90
|
+
''|*[!0-9]*) return 1 ;;
|
|
91
|
+
0*) return 1 ;;
|
|
92
|
+
*) return 0 ;;
|
|
59
93
|
esac
|
|
60
|
-
|
|
94
|
+
}
|
|
95
|
+
_is_info_token() { case "${1:-}" in --help|-h|-V|--version) return 0 ;; *) return 1 ;; esac; }
|
|
96
|
+
|
|
61
97
|
_act="refused"
|
|
62
|
-
|
|
98
|
+
_pat=""
|
|
99
|
+
case "$_tool" in
|
|
100
|
+
pkill|killall)
|
|
101
|
+
[ "$_shim_argc" -eq 1 ] && _is_info_token "$1" && _act="pass"
|
|
102
|
+
;;
|
|
103
|
+
pgrep)
|
|
104
|
+
if [ "$_shim_argc" -eq 1 ]; then
|
|
105
|
+
_is_info_token "$1" && _act="pass"
|
|
106
|
+
elif [ "$_shim_argc" -eq 2 ]; then
|
|
107
|
+
case "$1" in
|
|
108
|
+
-g|-P) _is_positive_int "$2" && _act="pass" ;;
|
|
109
|
+
-fc) [ -n "$2" ] && [ "${2#-}" = "$2" ] && _act="pass" ;;
|
|
110
|
+
esac
|
|
111
|
+
elif [ "$_shim_argc" -eq 3 ]; then
|
|
112
|
+
case "$1" in
|
|
113
|
+
-f) [ "$2" = "-c" ] && _pat="$3" ;;
|
|
114
|
+
-c) [ "$2" = "-f" ] && _pat="$3" ;;
|
|
115
|
+
esac
|
|
116
|
+
[ -n "$_pat" ] && [ "${_pat#-}" = "$_pat" ] && _act="pass"
|
|
117
|
+
fi
|
|
118
|
+
;;
|
|
119
|
+
pidof)
|
|
120
|
+
[ "$_shim_argc" -eq 1 ] && _is_info_token "$1" && _act="pass"
|
|
121
|
+
;;
|
|
122
|
+
esac
|
|
63
123
|
|
|
64
124
|
# ── 有界追加(与 tmux 闸门逐字同源,P132/P77/P87):<file> ← $_line ─────────────────────────────
|
|
65
125
|
# 写不进去不挡路;FIFO 目标直接判失败(日志绝不能挂住调用);超 2000 条调用行留最新 1000 条,
|
|
@@ -122,6 +182,12 @@ if [ "$_act" = "refused" ]; then
|
|
|
122
182
|
printf '✗ teamsmith 信号闸门:已拒绝 %s —— 名字或命令行模式**不是身份**,无法证明这些进程归调用者\n' "$_tool" >&2
|
|
123
183
|
printf ' 调用参数:%s\n' "$_tool${_argv:+ $_argv}" >&2
|
|
124
184
|
printf ' 为什么:模式/名字会同时命中别的项目、别的会话里的同名进程,也会命中调用者自己的 shell(模式串就在这条命令行里)。\n' >&2
|
|
185
|
+
case "$_tool" in
|
|
186
|
+
pgrep)
|
|
187
|
+
printf ' pgrep 只放行三类形态,**都不授予信号权限**:\n · 帮助/版本:`--help` / `-h` / `-V` / `--version`(不选择任何进程);\n · 显式 group/parent 的 PID 查询:`-g <正整数>` / `-P <正整数>`(输出 PID 列表)——\n 结果是查询输出,不是任何记录过的身份;\n · 整命令模式计数:`-fc <命令>`(含 `-f -c` / `-c -f`)—— 按完整命令行模式匹配,\n 只出个数不出 PID 列表。\n' >&2 ;;
|
|
188
|
+
pidof)
|
|
189
|
+
printf ' pidof 按名字选择是它的定义:只放行单个 `--help`/`-h`/`-V`/`--version`。\n' >&2 ;;
|
|
190
|
+
esac
|
|
125
191
|
printf ' 安全路线(信号只发给**记录过的 pid**):\n' >&2
|
|
126
192
|
printf ' · team bg list 看本项目后台作业记录到的 pid\n' >&2
|
|
127
193
|
printf ' · team bg stop <id> 按记录停作业(先验 pid + 启动时间指纹)\n' >&2
|
|
@@ -129,11 +195,14 @@ if [ "$_act" = "refused" ]; then
|
|
|
129
195
|
exit 64
|
|
130
196
|
fi
|
|
131
197
|
|
|
132
|
-
# ── 放行:解析真身(
|
|
198
|
+
# ── 放行:解析真身(pkill/killall 认 TEAM_SIGNAL_REAL;选择器只认自己的名字、跳过闸门目录),透传 ──
|
|
133
199
|
_real=""
|
|
134
|
-
if [
|
|
135
|
-
|
|
136
|
-
|
|
200
|
+
if [ "$_tool" = "pkill" ] || [ "$_tool" = "killall" ]; then
|
|
201
|
+
if [ -n "${TEAM_SIGNAL_REAL:-}" ] && [ -x "${TEAM_SIGNAL_REAL:-}" ]; then
|
|
202
|
+
_c="$(readlink -f "$TEAM_SIGNAL_REAL" 2>/dev/null || printf '%s' "$TEAM_SIGNAL_REAL")"
|
|
203
|
+
_cd="$(cd -P "$(dirname "$_c")" 2>/dev/null && pwd -P)"
|
|
204
|
+
if [ "$_c" != "$_shim_self" ] && [ "$_cd" != "$_gate_dir" ]; then _real="$TEAM_SIGNAL_REAL"; fi
|
|
205
|
+
fi
|
|
137
206
|
fi
|
|
138
207
|
if [ -z "$_real" ]; then
|
|
139
208
|
_oldifs="$IFS"; IFS=':'
|
|
@@ -143,14 +212,22 @@ if [ -z "$_real" ]; then
|
|
|
143
212
|
_cand="$_d/$_tool"
|
|
144
213
|
[ -x "$_cand" ] || continue
|
|
145
214
|
_cc="$(readlink -f "$_cand" 2>/dev/null || printf '%s' "$_cand")"
|
|
146
|
-
[ "$_cc" = "$_shim_self" ]
|
|
215
|
+
if [ "$_cc" = "$_shim_self" ]; then continue; fi
|
|
216
|
+
_cd="$(cd -P "$(dirname "$_cc")" 2>/dev/null && pwd -P)"
|
|
217
|
+
[ "$_cd" = "$_gate_dir" ] && continue
|
|
147
218
|
_real="$_cand"; break
|
|
148
219
|
done
|
|
149
220
|
IFS="$_oldifs"
|
|
150
221
|
fi
|
|
151
222
|
if [ -z "$_real" ]; then
|
|
152
|
-
|
|
153
|
-
|
|
223
|
+
case "$_tool" in
|
|
224
|
+
pkill|killall)
|
|
225
|
+
printf '✗ teamsmith 信号闸门:PATH 里找不到真的 %s(只找到我自己)——把真身的目录加进 PATH,或设 TEAM_SIGNAL_REAL=<绝对路径>\n' \
|
|
226
|
+
"$_tool" >&2 ;;
|
|
227
|
+
*)
|
|
228
|
+
printf '✗ teamsmith 信号闸门:PATH 里找不到真的 %s(闸门目录之外)——把真身的目录加进 PATH(%s 不读 TEAM_SIGNAL_REAL)\n' \
|
|
229
|
+
"$_tool" "$_tool" >&2 ;;
|
|
230
|
+
esac
|
|
154
231
|
exit 127
|
|
155
232
|
fi
|
|
156
233
|
exec "$_real" ${_shim_argv[@]+"${_shim_argv[@]}"}
|
|
@@ -325,6 +325,24 @@ _bounded_append() { # <file>
|
|
|
325
325
|
return 0
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
# ── 日志目标解析(P274 · 裁定点 C/A1)─────────────────────────────────────────────────
|
|
329
|
+
# $TEAM_TMUX_CALLS_LOG 在 → 用它(逐字节不变)。缺席时(工具的建对象调用会摘掉整个 TEAM_*
|
|
330
|
+
# 命名空间,见 common.sh 的 team_tmux)按 **cwd 所属项目**解析:向上找 `.pi/team`,落它自己的
|
|
331
|
+
# state/tmux-calls.log —— 审计因此无洞,且共享 server 上**别的项目**的 pane 里的调用记到**它自己**
|
|
332
|
+
# 项目的日志,不再污染本项目的 forensics 文件。两边都解析不出来 → 不写(可见的例外,不是静默丢)。
|
|
333
|
+
# 只做几个 `[ -d ]` 测试,不启子进程(闸门在每次 tmux 调用的热路径上)。
|
|
334
|
+
_shim_resolve_log() { # <起始目录>
|
|
335
|
+
local d="${1:-}"
|
|
336
|
+
[ -n "$d" ] || return 1
|
|
337
|
+
while :; do
|
|
338
|
+
[ -d "$d/.pi/team" ] && { printf '%s/.pi/team/state/tmux-calls.log' "$d"; return 0; }
|
|
339
|
+
[ "$d" = "/" ] && return 1
|
|
340
|
+
d="${d%/*}"; [ -n "$d" ] || d="/"
|
|
341
|
+
done
|
|
342
|
+
}
|
|
343
|
+
if [ -z "${TEAM_TMUX_CALLS_LOG:-}" ]; then
|
|
344
|
+
TEAM_TMUX_CALLS_LOG="$(_shim_resolve_log "$_shim_cwd" || true)"
|
|
345
|
+
fi
|
|
328
346
|
if [ -n "${TEAM_TMUX_CALLS_LOG:-}" ] && [ ! -p "${TEAM_TMUX_CALLS_LOG}" ]; then
|
|
329
347
|
_log="${TEAM_TMUX_CALLS_LOG}"
|
|
330
348
|
_ld="$(dirname "$_log")"
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# teamsmith · command manifest — the language-neutral single source of the help surface.
|
|
2
|
+
#
|
|
3
|
+
# Read by scripts/lib/cmd-help.sh (the renderer), by tests/help-surface.sh (the surface's own checks)
|
|
4
|
+
# and by tests/routes.sh (Walk A's working set). One row per command the dispatcher accepts, plus the
|
|
5
|
+
# group table; the menu, the group pages and the command pages are all rendered from this file.
|
|
6
|
+
#
|
|
7
|
+
# Columns are tab-separated. `-` means "empty"; list fields are space separated.
|
|
8
|
+
#
|
|
9
|
+
# group <id>
|
|
10
|
+
# cmd <name> <group> <usage> <flags> <subs> <aliases> <terms> <faces> <effect> <auth> <undo> <claims> <probe> <example>
|
|
11
|
+
#
|
|
12
|
+
# name the token the dispatcher accepts (a `case "$CMD" in` label of scripts/team)
|
|
13
|
+
# group the group id this command is listed under (level 1: `team help <group>`)
|
|
14
|
+
# usage one or more usage fragments, separated by ` ;; ` — every one is printed on the page
|
|
15
|
+
# flags the flags the usage fragments print (`-` = none); each needs an `cmd.<name>.arg.<flag>` prose key
|
|
16
|
+
# subs subcommands the usage fragments print
|
|
17
|
+
# aliases other labels the dispatcher accepts for this command (documented on this page)
|
|
18
|
+
# terms concept ids this page uses; the page repeats their definitions verbatim
|
|
19
|
+
# faces the faces this command touches, from the closed list: state docs config worktree skills meetings
|
|
20
|
+
# effect read-only | writes-<face> | starts-process (the headline effect; `faces` carries the rest)
|
|
21
|
+
# auth none | needs-yes | needs-yes:<condition>
|
|
22
|
+
# undo idempotent | undo-by-<cmd> | not-reversible:<reason>
|
|
23
|
+
# claims extra declared facts `key=value` that prose may name (registry in tests/help-surface.sh)
|
|
24
|
+
# probe the probe recipe id that makes the declared effect happen in a scratch fixture
|
|
25
|
+
# example one example command line printed under `Example`
|
|
26
|
+
#
|
|
27
|
+
# The prose for every command lives in help.en.tsv (source) and help.zh.tsv (translation); a key the
|
|
28
|
+
# selected table lacks is printed with a marker naming it and falls back to the other table's value.
|
|
29
|
+
# Placeholders the values may carry — the closed set is declared in scripts/lib/cmd-help.sh
|
|
30
|
+
# (TEAM_HELP_PLACEHOLDERS); any other braced token fails the render: {project} {meeting_ttl}
|
|
31
|
+
# {token} {sub} {cmd} {undo_cmd}
|
|
32
|
+
group start
|
|
33
|
+
group observe
|
|
34
|
+
group ledger
|
|
35
|
+
group seats
|
|
36
|
+
group patrol
|
|
37
|
+
group peers
|
|
38
|
+
group finish
|
|
39
|
+
group versions
|
|
40
|
+
begin bootstrap status dispatch review
|
|
41
|
+
cmd help start help [<group>] [<command>] - group command - - - read-only none idempotent levels=3 help team help dispatch
|
|
42
|
+
cmd bootstrap start bootstrap [--agents <names>] [--task-models <map>] [--pm-model <model>] [--print] --agents --task-models --pm-model --print - - pm seat worktree brief change gate ledger pulse yes config docs skills starts-process none not-reversible:the skeleton, the skill copy and the worktrees it writes have no single undo - bootstrap team bootstrap --agents "dev verify" --task-models "code=provider/model"
|
|
43
|
+
cmd init start init [--copy] [--no-skills] [--force] [--agents <names>] [--task-models <map>] [--pm-model <model>] --copy --no-skills --force --agents --task-models --pm-model - - pm seat ledger gate config docs skills writes-config none not-reversible:the written contract and document skeleton have no undo - init team init --no-skills --agents "dev verify" --task-models "code=provider/model"
|
|
44
|
+
cmd doctor start doctor - - - gate - read-only none idempotent - doctor team doctor
|
|
45
|
+
cmd roster observe roster - - - seat worktree - read-only none idempotent - roster team roster
|
|
46
|
+
cmd status observe status [<ID>] - - - brief ledger state writes-state none idempotent - status team status
|
|
47
|
+
cmd ps observe ps - - - seat - read-only none idempotent - ps team ps
|
|
48
|
+
cmd bg observe bg list ;; bg stop <id> - list stop - - state writes-state none idempotent - bg team bg list
|
|
49
|
+
cmd reap observe reap --orphans [--yes] ;; reap <pid> [--yes] --orphans --yes - - seat state writes-state none not-reversible:the process is gone; the plan and --yes are the only guard - reap team reap --orphans --yes
|
|
50
|
+
cmd interrupt observe interrupt <seat> --reason <line> [--force] [--yes] --reason --force --yes - - seat state docs writes-state needs-yes not-reversible:this command does not put the ended turn back; the thread entry, the inbox line and the audit line are the record and `team resume --agent <seat>` is the way back - interrupt team interrupt dev --reason "18h without a commit"
|
|
51
|
+
cmd digest observe digest - - - ledger pulse state writes-state none idempotent - digest team digest
|
|
52
|
+
cmd inbox observe inbox [<agent>] - - - ledger - read-only none idempotent - inbox team inbox
|
|
53
|
+
cmd paths observe paths - - - ledger - read-only none idempotent - paths team paths
|
|
54
|
+
cmd config observe config list ;; config log ;; config set <key> <value> ;; config set-task-model <category> <model> ;; config upgrade-models [--task-models <map>] [--pm-model <model>] --task-models --pm-model list log set set-task-model upgrade-models help - pm seat change config state writes-config none not-reversible:the audit log keeps every write - config team config list
|
|
55
|
+
cmd task ledger task <ID> --title <title> --category <category> [--agent <a>] [--deps <ids>] [--issue <N>] --title --category --agent --deps --issue - - brief category change ledger docs writes-docs none not-reversible:no command removes a brief or its board row - task team task P1 --title "First task" --category code
|
|
56
|
+
cmd board ledger board add <ID> [--allow-dup] ;; board assign <ID> <agent> ;; board set <ID> <status> ;; board row <ID> ;; board ls --allow-dup add assign set row ls - ledger docs writes-docs none not-reversible:no command removes a board row - board team board ls
|
|
57
|
+
cmd change ledger change status <id> [--json] --json status - change spec ledger - read-only none idempotent - change team change status cli-help
|
|
58
|
+
cmd thread ledger thread <agent> [<message>] [--from <sender>] [--re <n>] --from --re - - ledger docs writes-docs none not-reversible:the thread is append-only - thread team thread dev "a decision with its reason"
|
|
59
|
+
cmd report ledger report <ID> <agent> [--force] --force - - ledger gate docs writes-docs none not-reversible:the report file stays - report team report P1 dev
|
|
60
|
+
cmd add-agent seats add-agent <a> [--register] [--create] [--no-install] [--print] --register --create --no-install --print - - seat worktree worktree writes-worktree none not-reversible:the branch and the worktree stay until you remove them - add-agent team add-agent dev
|
|
61
|
+
cmd dispatch seats dispatch <a> <ID> <task-file> [--model <model>] [--branch <name>] [--fresh] [--allow-overflow] [--print] --model --branch --fresh --allow-overflow --print - - seat brief worktree task-branch gate docs state starts-process none not-reversible:the seat's session and its branch are its own history - dispatch team dispatch dev P1 docs/team/tasks/P1-first-task.md --branch task/P1-first-task
|
|
62
|
+
cmd say seats say <a> <message> [--now] --now - - seat knock docs state writes-docs none not-reversible:the queue keeps what was already delivered - say team say dev "the gate is green, please open the PR"
|
|
63
|
+
cmd notify seats notify <a> <message> [--from <sender>] --from - - seat pulse docs state writes-docs none not-reversible:the inbox line stays - notify team notify pm "P1 delivered, please review"
|
|
64
|
+
cmd draft seats draft [pm] ;; draft send <file> [--now] --now send - seat state writes-state none not-reversible:the delivered text is in the queue - draft team draft send /tmp/note.md
|
|
65
|
+
cmd outbox seats outbox [list] ;; outbox flush [--now] ;; outbox drop <n|all> --now list flush drop - knock state writes-state none idempotent - outbox team outbox list
|
|
66
|
+
cmd reply seats reply list ;; reply show <slug> ;; reply post --from <sender> --title <title> [--stdin] --from --title --stdin list show post - ledger state writes-state none not-reversible:the reply body is kept - reply team reply post --from pm --title "decision"
|
|
67
|
+
cmd pulse patrol pulse up|down|restart|status|logs [--print] --print up down restart status logs watchdog watchdog-status install-watchdog uninstall-watchdog pm pulse knock - starts-process none not-reversible:the window that was started is gone once it stops - pulse team pulse status
|
|
68
|
+
cmd monitor patrol monitor [--once] [--print|--json] [--width <N>] [--height <N>] [--interval <N>] [--events <K>] [--no-pulse] --once --print --json --width --height --interval --events --no-pulse - - pulse state writes-state none not-reversible:every run appends its own bookkeeping line - monitor team monitor --print --once
|
|
69
|
+
cmd watch patrol watch [--once] [--interval <N>] [--ui] --once --interval --ui - - pulse state writes-state none not-reversible:every tick appends to the patrol log - watch team watch --once
|
|
70
|
+
cmd standby patrol standby on [--reason <text>] ;; standby off ;; standby status --reason on off status - pm pulse state writes-state none not-reversible:the state it writes is a record of when it was set - standby team standby on --reason "waiting for the user"
|
|
71
|
+
cmd up patrol up [--agents] [--fresh-pm] [--print] --agents --fresh-pm --print - - pm seat state starts-process none not-reversible:the PM session it starts keeps its own history - up team up
|
|
72
|
+
cmd resume patrol resume [--agent <a>] [--all] [--dry-run] --agent --all --dry-run - - seat pm state starts-process none not-reversible:a resumed seat continues in its own session - resume team resume --all
|
|
73
|
+
cmd meeting peers meeting open <slug> --with <peer> --topic <text> [--ttl <hours>] [--yes] ;; meeting say <slug> --intent <intent> <message> [--knock] ;; meeting read <slug> [--since <n>] [--peek] ;; meeting list [--all] ;; meeting inbox ;; meeting agree <slug> <option> [--note <text>] ;; meeting close <slug> --with --topic --ttl --yes --intent --knock --since --peek --all --note open say read list inbox agree close propose peer knock help - pm meetings writes-meetings needs-yes:TEAM_CONFIRM_WRITES not-reversible:the shared transcript is the record of what was said - meeting team meeting open rename --with other:pm --topic "rename the interface"
|
|
74
|
+
cmd review finish review <ID> --dir <checkout> [--no-gates] [--strong] [--allow-unresolved-branch] --dir --no-gates --strong --allow-unresolved-branch - - gate ledger worktree docs writes-docs none not-reversible:the review record stays - review team review P1 --dir /tmp/P1-checkout
|
|
75
|
+
cmd close finish close <ID> - - - ledger seat docs state writes-docs none not-reversible:the board row keeps the final status - close team close P1
|
|
76
|
+
cmd teardown finish teardown [--agent <a>] [--all] [--purge] [--force] [--register] --agent --all --purge --force --register - - seat worktree worktree writes-worktree none not-reversible:the worktree is gone; the branch stays - teardown team teardown --agent dev
|
|
77
|
+
cmd smoke finish smoke [--select <sections>] --select - test gate - read-only none idempotent - smoke team smoke --select 51
|
|
78
|
+
cmd perf finish perf [--host] --host - - gate - read-only none idempotent - perf team perf --host
|
|
79
|
+
cmd merge finish merge - - - ledger - read-only none idempotent - merge team merge
|
|
80
|
+
cmd pr finish pr - - - ledger - read-only none idempotent - pr team pr
|
|
81
|
+
cmd gh finish gh - - - ledger - read-only none idempotent - gh team gh
|
|
82
|
+
cmd gl finish gl - - - ledger - read-only none idempotent - gl team gl
|
|
83
|
+
cmd mark-loaded versions mark-loaded [--version <X>] --version - - gate state writes-state none idempotent - mark-loaded team mark-loaded --version 0.2.0
|
|
84
|
+
cmd version versions version [--check] --check - - gate - read-only none idempotent - version team version --check
|
|
85
|
+
cmd changelog versions changelog [--since <X>] --since - - - - read-only none idempotent - changelog team changelog
|
|
86
|
+
cmd reload versions reload [--done] --done - - gate state writes-state none not-reversible:every request leaves its own record - reload team reload
|