teamsmith 0.3.1 → 0.3.3
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 +5 -4
- package/package.json +6 -2
- package/skills/handover/SKILL.md +117 -0
- package/skills/teamsmith/CHANGELOG.md +33 -0
- package/skills/teamsmith/SKILL.md +2 -1
- package/skills/teamsmith/scripts/lib/cmd-init.sh +85 -9
- package/skills/teamsmith/scripts/lib/common.sh +1 -1
- package/skills/teamsmith/scripts/strings/help.en.tsv +1 -1
- package/skills/teamsmith/scripts/strings/help.zh.tsv +1 -1
- package/skills/teamsmith/tests/checkout-shape-probe.sh +10 -2
- package/skills/teamsmith/tests/install-shape.sh +194 -15
- package/skills/teamsmith/tests/skill-load.mjs +6 -2
- package/skills/teamsmith/tests/smoke.sh +49 -16
- package/skills/teamsmith/tests/tmux-lint.pl +12 -2
- package/skills/teamsmith-init/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ Design rationale: [references/philosophy.md](skills/teamsmith/references/philoso
|
|
|
26
26
|
|---|---|
|
|
27
27
|
| [`teamsmith`](skills/teamsmith/SKILL.md) | See above. Former name: `pi-team` (the `skills/pi-team` compatibility symlink was removed — old absolute paths must be updated) |
|
|
28
28
|
| [`teamsmith-init`](skills/teamsmith-init/SKILL.md) | The new-project entry point: settles the setup questions with the user, then runs the one command that writes config, the `docs/team/` skeleton and the protocol section |
|
|
29
|
+
| [`handover`](skills/handover/SKILL.md) | Cutting a long session over to a fresh one: land the state on disk, write a pointer-only `docs/team/HANDOVER.md`, then stand the old session down. For when compaction keeps the size right but the session's *shape* degrades |
|
|
29
30
|
|
|
30
31
|
The maintainers build teamsmith *with* teamsmith, and their ledger — board, task briefs, reports, reviews, decisions —
|
|
31
32
|
lives in `docs/team/` of their own checkout. That ledger is deliberately **not** part of the distributed package: what
|
|
@@ -56,14 +57,14 @@ than replaced (`--force` replaces only an entry recognised as this skill).
|
|
|
56
57
|
### As a Pi package (no global CLI)
|
|
57
58
|
|
|
58
59
|
```bash
|
|
59
|
-
pi install git:git@github.com:Track07-cda/teamsmith@v0.3.
|
|
60
|
-
pi install -l git:git@github.com:Track07-cda/teamsmith@v0.3.
|
|
60
|
+
pi install git:git@github.com:Track07-cda/teamsmith@v0.3.3 # user level: every project
|
|
61
|
+
pi install -l git:git@github.com:Track07-cda/teamsmith@v0.3.3 # project level: recorded in .pi/settings.json
|
|
61
62
|
```
|
|
62
63
|
|
|
63
64
|
- **Pin a released tag**: `@v<version>`, the version `team version` prints. Latest tag:
|
|
64
65
|
`git tag --sort=-v:refname | head -1`.
|
|
65
|
-
- The `git@github.com:` form (or `ssh://git@github.com/Track07-cda/teamsmith@v0.3.
|
|
66
|
-
whether or not you have a token; the shorthand `git:github.com/Track07-cda/teamsmith@v0.3.
|
|
66
|
+
- The `git@github.com:` form (or `ssh://git@github.com/Track07-cda/teamsmith@v0.3.3`) uses your SSH key and works
|
|
67
|
+
whether or not you have a token; the shorthand `git:github.com/Track07-cda/teamsmith@v0.3.3` takes the HTTPS
|
|
67
68
|
route, so it works anonymously on the public repository and asks for credentials if your access is private.
|
|
68
69
|
- The clone lands in `~/.pi/agent/git/<host>/<path>` (user level) or `.pi/git/<host>/<path>` (project level); the
|
|
69
70
|
skill directory — the `<skill>` used in every command below — is `<clone>/skills/teamsmith`.
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "teamsmith",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Turn one agent session into a project owner: self-contained task briefs dispatched to worker agents in their own git worktrees, independent verification on a separate checkout, and an auditable ledger (BOARD / reviews / threads / DECISIONS). Runs on Pi today.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
7
|
-
"team": "./bin/team.mjs"
|
|
7
|
+
"team": "./bin/team.mjs",
|
|
8
|
+
"pkill": "./skills/teamsmith/scripts/shim/pkill",
|
|
9
|
+
"killall": "./skills/teamsmith/scripts/shim/killall",
|
|
10
|
+
"pgrep": "./skills/teamsmith/scripts/shim/pgrep",
|
|
11
|
+
"pidof": "./skills/teamsmith/scripts/shim/pidof"
|
|
8
12
|
},
|
|
9
13
|
"repository": {
|
|
10
14
|
"type": "git",
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: handover
|
|
3
|
+
description: Hand over a long-running session to a fresh one without losing the project — write a pointer-only HANDOVER.md (pointers, never copied specs), record the questions the user asked and never got answered and the side effects the agent caused, then stand the old session down so the document cannot go stale. Triggered by the user saying handover or 交接.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: "0.1.0"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# handover · cut over the session, do not copy it
|
|
10
|
+
|
|
11
|
+
The user decides when this happens; do not propose a handover on your own. When it does, the job is a
|
|
12
|
+
**cut-over, not a summary** — a new session is the only thing that gives a fresh shape, so the document must be
|
|
13
|
+
short, must point at what already exists on disk, and the old session must stop the moment it is written.
|
|
14
|
+
|
|
15
|
+
## Step 1 · Land the state (this is the gate)
|
|
16
|
+
|
|
17
|
+
Before writing anything, put everything that currently lives only in the conversation onto the disk:
|
|
18
|
+
|
|
19
|
+
- board statuses for anything started, finished, or blocked;
|
|
20
|
+
- a report or review record for every delivery that has none;
|
|
21
|
+
- instructions already given to worker seats (their threads), so the successor's instructions are continuous;
|
|
22
|
+
- open decisions → `docs/team/OPEN-ITEMS.md` (create it if absent);
|
|
23
|
+
- **every question the user asked that has not been answered, verbatim**, together with what was already verified.
|
|
24
|
+
|
|
25
|
+
If that state cannot be reconstructed from the disk, the handover will not work — fix the disk first.
|
|
26
|
+
|
|
27
|
+
## Step 2 · Write `docs/team/HANDOVER.md` from commands, never from memory
|
|
28
|
+
|
|
29
|
+
Fixed filename, overwritten, committed. Budget: **60 lines**. Template:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
# Handover · <date time Z>
|
|
33
|
+
> Trust the disk and your own re-derivation, not the previous session's prose.
|
|
34
|
+
> Every line says where it lives if it is not here.
|
|
35
|
+
|
|
36
|
+
Header: main tip / released version / session (model · id) / why this handover happened (the user's words)
|
|
37
|
+
|
|
38
|
+
## 1 State — 3..6 lines, each value followed by the command that re-derives it
|
|
39
|
+
## 2 In flight — ID · phase · branch@tip · what it is blocked on ; details → BOARD
|
|
40
|
+
## 3 Asked and unanswered ← the main course
|
|
41
|
+
user's words verbatim / what I verified (file:line) / what you must give me: a decision or information /
|
|
42
|
+
what I will do once answered / whether it is irreversible
|
|
43
|
+
## 4 Waiting on the user anyway — pointers → OPEN-ITEMS.md, three most blocking + the ordering rule
|
|
44
|
+
## 5 Side effects I caused — production values I changed, secrets I printed, uncommitted edits that
|
|
45
|
+
are not mine, artefacts I left on disk
|
|
46
|
+
## 6 Next three commands
|
|
47
|
+
## 7 What this session learned that no file contains ← the only free-text section
|
|
48
|
+
one line each, each ending with "belongs in: <file>"
|
|
49
|
+
## 8 Read: AGENTS.md → BOARD.md → OPEN-ITEMS.md → this file
|
|
50
|
+
Do not read: reports/ detail, threads/, previous handovers
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**The pointer test, applied to every line:** *if this line were not here, where does it live?*
|
|
54
|
+
If it lives in a spec, board, review, runbook, decision log or memory — write the pointer, not the content.
|
|
55
|
+
Only three kinds of content have no home elsewhere: unanswered user questions, side effects I caused, and the
|
|
56
|
+
next three commands.
|
|
57
|
+
|
|
58
|
+
Things that are therefore **not** allowed in the document: a list of what was delivered this session, a table of
|
|
59
|
+
deployment results, copied commands that already live in a runbook, credentials or passwords (write where they
|
|
60
|
+
live), a summary of the conversation, and any history of a defect that is already fixed.
|
|
61
|
+
|
|
62
|
+
## Step 3 · Self-check the three questions
|
|
63
|
+
|
|
64
|
+
A successor must be able to answer, from the document alone: what is in flight, what is waiting on the user, what
|
|
65
|
+
is the next command. If any of the three is missing, the document is defective — fix it before standing down.
|
|
66
|
+
|
|
67
|
+
## Step 4 · Stand down (do not skip this)
|
|
68
|
+
|
|
69
|
+
After step 3 the old session **stops**: no commits, no dispatches, no decisions, no replies unless the user asks a
|
|
70
|
+
direct question. Anything done after this point makes the document false within seconds. The last thing the old
|
|
71
|
+
session says is that a new session may be opened in the same directory.
|
|
72
|
+
|
|
73
|
+
## Step 5 · Take over (the successor's first move)
|
|
74
|
+
|
|
75
|
+
The successor reads `AGENTS.md`, then `HANDOVER.md`, then `OPEN-ITEMS.md`, then re-derives two or three numbers
|
|
76
|
+
itself (`git rev-parse`, version, board counts). It replies in three lines — in flight, waiting on the user, next
|
|
77
|
+
command — **plus any divergence between the document and the disk, naming both values**. The disk wins; never
|
|
78
|
+
quietly adopt the document's number.
|
|
79
|
+
|
|
80
|
+
Then it works. Anything it had to dig for that the handover should have told it goes into section 7 in one commit:
|
|
81
|
+
that is the only mechanism that makes the next handover better.
|
|
82
|
+
|
|
83
|
+
## What each side says (prompt text, used at handover time — not resident)
|
|
84
|
+
|
|
85
|
+
Old session, on the trigger:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
handover: land state, write docs/team/HANDOVER.md (≤60 lines, pointers only), self-check the three
|
|
89
|
+
questions, then stand down and tell the user to open a new session in this directory.
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Successor, at session start:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
Taking over. Read AGENTS.md, docs/team/HANDOVER.md, docs/team/OPEN-ITEMS.md. Re-derive two or three
|
|
96
|
+
numbers yourself; the disk wins over the document. Reply in three lines (in flight / waiting on the
|
|
97
|
+
user / next command) plus any divergence, then work.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Boundaries
|
|
101
|
+
|
|
102
|
+
- Workers are unaffected: their seats keep running, their deliveries land in the inbox, the successor picks them
|
|
103
|
+
up with `team digest`. The patrol keeps running.
|
|
104
|
+
- The handover never carries credentials, and never copies text out of `openspec/`, the board, reviews or runbooks.
|
|
105
|
+
- One file, overwritten each time. Dated handover files accumulate and become a second ledger — history belongs in
|
|
106
|
+
git.
|
|
107
|
+
- Language: the prompts are English; the document body follows the project's own ledger language (keep it in one
|
|
108
|
+
language with `AGENTS.md` so the successor reads one register, not two).
|
|
109
|
+
|
|
110
|
+
## Failure modes worth recognising
|
|
111
|
+
|
|
112
|
+
| Symptom | Cause |
|
|
113
|
+
|---|---|
|
|
114
|
+
| The successor asks questions the document should answer | pointer test skipped — content was summarised instead of located, or step 1 was skipped |
|
|
115
|
+
| The document is stale within a day | step 4 skipped: the old session kept working after writing it |
|
|
116
|
+
| Two different numbers for the same fact | content was copied instead of pointed at, and the original moved on |
|
|
117
|
+
| The successor trusts the document and gets it wrong | the successor re-derived nothing; step 5's divergence check is not optional |
|
|
@@ -5,6 +5,39 @@
|
|
|
5
5
|
> `SKILL.md`/`references/**`/`templates/**`/`extension/**` 在 Pi 里输入 `/reload`(或 `/pi-team-reload`)即生效;
|
|
6
6
|
> 判断自己是不是旧的:`team mark-loaded`(开局记一次)→ `team version --check`。
|
|
7
7
|
|
|
8
|
+
## v0.3.3(2026-10-22)
|
|
9
|
+
|
|
10
|
+
小版本:**新增一个技能**,已有项目跑一次 `team init`(或 `team bootstrap`)就会把它装进 `.pi/skills/`。
|
|
11
|
+
|
|
12
|
+
- **新技能 `handover`**:长会话的**形状**会退化(有的模型在长上下文里不再输出思考,开始照着对话的表面作答),
|
|
13
|
+
压上下文治不了,只能换新会话。这个技能规定怎么换:先把只存在于对话里的状态落到磁盘,再写一份 ≤60 行的
|
|
14
|
+
指针式 `docs/team/HANDOVER.md`(不复制规格、不总结对话),自检三个问题,然后旧会话**停手**;接手的会话先
|
|
15
|
+
重算几个数、磁盘优先,再开工。
|
|
16
|
+
- **`team init` 的技能安装改成「发现驱动 + 声明面」**:包内 `skills/` 下每个「真实目录 + `SKILL.md` 的
|
|
17
|
+
`name:` 与目录名一致」都是源,以后再加技能不用改代码;另有一份很小的声明面(`team_skill_declared`)专门
|
|
18
|
+
回答「少了谁」—— 源里少一个技能时安装**不会崩**,但会打出 `miss` 行点名它;源里有技能没登记时照装并打
|
|
19
|
+
`note`;源的 `name:` 与目录名不符时**判红并点名**(目录与错名字)。三个方向都有夹具的红侧
|
|
20
|
+
(`tests/install-shape.sh` 的 ⑩/⑪)。
|
|
21
|
+
- 夹具不再写死「两个技能」:`install-shape.sh` 与 `smoke.sh` 的数量、名字断言都改成与源清单比对
|
|
22
|
+
(`src_skill_names` / `skill_src_names`),`npm pack` 清单也逐个核对每个源的 `SKILL.md`。
|
|
23
|
+
- `tests/skill-load.mjs` 的路由判据从「命中 teamsmith 的固定关键词表」改成「description 里必须点名技能自己」
|
|
24
|
+
—— 固定词表会把兄弟技能判死,改名忘改描述仍会红。
|
|
25
|
+
|
|
26
|
+
## v0.3.2(2026-10-22)
|
|
27
|
+
|
|
28
|
+
**npm 安装的人必须升级(0.3.0 与 0.3.1 都受影响)。**
|
|
29
|
+
|
|
30
|
+
0.3.1 修好了「四个信号入口随包发布」这件事,但 `package.json` 的 `bin` 字段仍然只列了 `team`——
|
|
31
|
+
而 `npm install -g` 只给 `bin` 里列出的名字建链接。于是**装完之后 `pkill` / `killall` / `pgrep` / `pidof`
|
|
32
|
+
仍然解析到 `/usr/bin`,防误杀的信号闸门在 npm 路线上等于不存在**(包里的 shim 文件在,但没人指向它们)。
|
|
33
|
+
用 Git 检出安装或跑 `install.sh` 的人不受影响。
|
|
34
|
+
|
|
35
|
+
这一版把四个名字加进 `bin`(都指向包内的 shim),并在安装面夹具里补上那个缺失的证伪者:
|
|
36
|
+
`npm i -g --prefix …` 之后,`prefix/bin/{pkill,killall,pgrep,pidof}` 必须**解析到安装包内部**,
|
|
37
|
+
否则判红。这一条以前没有,所以两次独立复验都漏过去了——它们只检查了「包内文件在不在」。
|
|
38
|
+
|
|
39
|
+
除此之外与 0.3.1 完全相同。`0.3.1` 已在 npm 上标记为 deprecated。
|
|
40
|
+
|
|
8
41
|
## v0.3.1(2026-10-21)
|
|
9
42
|
|
|
10
43
|
补丁版:**没有破坏性变化、没有默认行为切换、没有新依赖**。这一版修的是 0.3.0 发出后才暴露的六件事。
|
|
@@ -3,7 +3,7 @@ name: teamsmith
|
|
|
3
3
|
description: teamsmith gives one agent real ownership of a project — it plans, writes self-contained task briefs, dispatches worker agents into their own tmux windows and git worktrees, verifies their work on an independent checkout, merges, and keeps an auditable ledger (BOARD/reviews/threads/DECISIONS). A pulse window (the periodic patrol) wakes the owner only when there is pending work, and the owner can deliberately stand down. Works with Pi; the launch/notify seam is an internal seam (frozen) reserved for a possible future non-Pi adapter, with no compatibility promise. Use when the user wants an agent to own a project end to end, dispatch tasks to worker agents, run agents in parallel in tmux with git worktree isolation, act as a PM/orchestrator over other agents, review an agent's work independently, run the patrol (`pulse`) as a tmux window, wake the PM only when there is pending work, or resume and coordinate a multi-agent project. To start a new project, use the teamsmith-init skill.
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: "0.3.
|
|
6
|
+
version: "0.3.3"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# teamsmith · one agent that actually owns the project
|
|
@@ -296,6 +296,7 @@ about them). They stay writable so the seam can be maintained and diagnosed; to
|
|
|
296
296
|
| `references/agent-adapters.md` | The internal seam (frozen) for launch and notify: the contract, placeholder tables, worked codex/opencode examples, a verification checklist |
|
|
297
297
|
| `references/meeting.md` | Cross-project meetings: boundaries, shared area, commands, knocking, guards |
|
|
298
298
|
| `teamsmith-init` skill | New project? `skills/teamsmith-init/SKILL.md` is the entry point: the questions to settle, `team bootstrap`, then the handoff back to this skill |
|
|
299
|
+
| `handover` skill | This session has run long and is losing shape (no reasoning, answers from the transcript's surface, facts re-derived that disk already holds)? `skills/handover/SKILL.md`: land the state, write `docs/team/HANDOVER.md` (pointers only, ≤60 lines), then stand this session down so the document cannot go stale |
|
|
299
300
|
| `references/migration.md` | The project was set up with an older version (or with the former name `pi-team`): renames, removed commands, new required dependencies, behaviour changes, the upgrade recipe and rollback |
|
|
300
301
|
| `references/workflows.md` | End-to-end runbook: bootstrap, dispatch, verify, merge, patrol/pulse, scaling, blockers |
|
|
301
302
|
| `references/openspec.md` | The OpenSpec pipeline: five phases, their owners, the gate before each next phase, and the PM's proposal-review checklist |
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
# 调用点:`team init` 的最后一步,以及 `team bootstrap`(同一实现,两个调用点;bootstrap 在
|
|
5
5
|
# config.sh 已存在时也要跑它 —— 这就是老项目的升级路径)。
|
|
6
6
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
7
|
+
# 源按**名字**解析到 `$TEAM_SKILL_DIR` 的兄弟目录(绝不扫描全局 skill 目录):teamsmith = 正在运行的 CLI
|
|
8
|
+
# 自己的 skill 目录,teamsmith-init / handover = 它的兄弟目录。复制布局里只带一部分就只装一部分,并**说出来**
|
|
9
|
+
# (P361:`missing` / `unregistered` / `broken` 三种可见性,见下面 team_skill_inventory 的注释)。
|
|
9
10
|
#
|
|
10
11
|
# 冲突表(与 openspec/changes/npm-cli-and-project-init/design.md §3 逐格一致;tests/install-shape.sh 走):
|
|
11
12
|
# dest 状态 默认(link) --force
|
|
@@ -32,10 +33,74 @@ team_project_extension_target() {
|
|
|
32
33
|
return 0
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
# ---------------------------------------------------------------- P361 · 技能源:解析 + 发现 + 声明面
|
|
37
|
+
# **谁是源**由发现回答:`$TEAM_SKILL_DIR` 的兄弟目录里,只有「真实目录(不是软链)+ 有 SKILL.md +
|
|
38
|
+
# frontmatter 的 name 与目录名一致」才算一个可安装的技能 —— 以后再加一个技能不用改代码。
|
|
39
|
+
# **少了谁**只能由声明回答:一个目录整个消失时,树上没有任何痕迹可供推导。所以另有一份声明面
|
|
40
|
+
# (team_skill_declared),只承担发现做不到的两件事,两个方向都由 tests/install-shape.sh 钉住(含红侧):
|
|
41
|
+
# ① 声明了、源不在 → 明说 `miss`(不是静默少装一个);
|
|
42
|
+
# ② 源在、没声明 → 明说 `note`(照装,但喊出来;声明面因此不会悄悄漂移)。
|
|
43
|
+
# 三处布局都要对:包内 skills/(检出 / npm 包)、~/.agents/skills(全局软链)、项目本地 .pi/skills(副本)。
|
|
44
|
+
# 软链布局下兄弟目录也是软链(install.sh 建的),所以「真实目录」只约束**发现**那一条,不约束名字解析。
|
|
45
|
+
team_skill_declared() { printf '%s\n' teamsmith teamsmith-init handover; return 0; }
|
|
46
|
+
|
|
47
|
+
team_skill_parent() { dirname "$TEAM_SKILL_DIR"; }
|
|
48
|
+
|
|
49
|
+
team_skill_real_parent() { # 运行目录可能是软链:技能源的真树在链接背后,兄弟目录要在那里对得上
|
|
50
|
+
dirname "$(readlink -f "$TEAM_SKILL_DIR" 2>/dev/null || printf '%s' "$TEAM_SKILL_DIR")"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# 只有「包自己的 skills/」里,兄弟目录才全是我们的技能:全局 ~/.agents/skills 下还躺着别的产品的 skill
|
|
54
|
+
# (archify、kimi-webbridge…),按兄弟目录发现会把它们一起装进别人的项目。判据 = 包根有 teamsmith 的 package.json。
|
|
55
|
+
team_skill_own_tree() {
|
|
56
|
+
local root; root="$(dirname "$(team_skill_parent)")"
|
|
57
|
+
[ -f "$root/package.json" ] || return 1
|
|
58
|
+
grep -qE '"name"[[:space:]]*:[[:space:]]*"teamsmith"' "$root/package.json"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
team_skill_src_for() { # <name> → 该技能的源目录(不存在就空):先看运行目录的兄弟,再看软链背后的真树
|
|
62
|
+
local name="$1" c
|
|
63
|
+
for c in "$(team_skill_parent)/$name" "$(team_skill_real_parent)/$name"; do
|
|
64
|
+
if [ -d "$c" ]; then printf '%s\n' "$c"; return 0; fi
|
|
65
|
+
done
|
|
66
|
+
return 0
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
team_skill_inventory() { # → 每行 "<kind>\t<name>\t<detail>";kind = ok | missing | broken | unregistered
|
|
70
|
+
local declared name src found d
|
|
71
|
+
declared="$(team_skill_declared)"
|
|
72
|
+
while IFS= read -r name; do
|
|
73
|
+
[ -n "$name" ] || continue
|
|
74
|
+
src="$(team_skill_src_for "$name")"
|
|
75
|
+
if [ -z "$src" ]; then printf 'missing\t%s\t%s\n' "$name" "$(team_skill_parent)/$name"; continue; fi
|
|
76
|
+
if [ ! -f "$src/SKILL.md" ]; then printf 'broken\t%s\t%s\n' "$name" "$src 没有 SKILL.md"; continue; fi
|
|
77
|
+
found="$(team_skill_md_name "$src")"
|
|
78
|
+
if [ "$found" != "$name" ]; then
|
|
79
|
+
printf 'broken\t%s\t%s\n' "$name" "$src 的 SKILL.md 里 name: 是 [${found:-<空>}]"
|
|
80
|
+
continue
|
|
81
|
+
fi
|
|
82
|
+
printf 'ok\t%s\t%s\n' "$name" "$src"
|
|
83
|
+
done <<< "$declared"
|
|
84
|
+
team_skill_own_tree || return 0
|
|
85
|
+
for d in "$(team_skill_parent)"/*/; do
|
|
86
|
+
[ -d "$d" ] || continue
|
|
87
|
+
[ -L "${d%/}" ] && continue # install.sh 的 M7.3:skills/ 下的软链是兼容别名,不是技能
|
|
88
|
+
name="$(basename "$d")"
|
|
89
|
+
printf '%s\n' "$declared" | grep -qxF -- "$name" && continue
|
|
90
|
+
if [ ! -f "$d/SKILL.md" ]; then printf 'broken\t%s\t%s\n' "$name" "${d%/} 没有 SKILL.md"; continue; fi
|
|
91
|
+
found="$(team_skill_md_name "$d")"
|
|
92
|
+
if [ "$found" != "$name" ]; then
|
|
93
|
+
printf 'broken\t%s\t%s\n' "$name" "${d%/} 的 SKILL.md 里 name: 是 [${found:-<空>}]"
|
|
94
|
+
continue
|
|
95
|
+
fi
|
|
96
|
+
printf 'ok\t%s\t%s\n' "$name" "${d%/}"
|
|
97
|
+
printf 'unregistered\t%s\t%s\n' "$name" "${d%/}"
|
|
98
|
+
done
|
|
99
|
+
return 0
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
team_skill_sources() { # → 每行 "<name>\t<src>",只列真实存在且合法的源
|
|
103
|
+
team_skill_inventory | awk -F'\t' '$1 == "ok" { printf "%s\t%s\n", $2, $3 }'
|
|
39
104
|
return 0
|
|
40
105
|
}
|
|
41
106
|
|
|
@@ -232,14 +297,25 @@ team_init_install_skills() { # [--copy|--link] [--no-skills] [--force] → 0 全
|
|
|
232
297
|
return 0
|
|
233
298
|
fi
|
|
234
299
|
|
|
235
|
-
|
|
300
|
+
# P361:三件发现做不到的事先说出来(都不静默):少了谁 / 谁是未登记的新技能 / 谁的源不合法。
|
|
301
|
+
local inventory kind vname detail bad=0
|
|
302
|
+
inventory="$(team_skill_inventory)"
|
|
303
|
+
while IFS=$'\t' read -r kind vname detail; do
|
|
304
|
+
case "$kind" in
|
|
305
|
+
missing) printf ' miss %s(源 %s 不在:随包发布的技能少装了一个)\n' "$vname" "$detail" ;;
|
|
306
|
+
unregistered) printf ' note %s 是 skills/ 下未登记的技能(%s):照装\n' "$vname" "$detail" ;;
|
|
307
|
+
broken) team_err "技能源不合法:$detail —— 目录名与 frontmatter 的 name 必须一致"; bad=1 ;;
|
|
308
|
+
esac
|
|
309
|
+
done <<< "$inventory"
|
|
310
|
+
|
|
311
|
+
local sources; sources="$(printf '%s\n' "$inventory" | awk -F'\t' '$1 == "ok" { printf "%s\t%s\n", $2, $3 }')"
|
|
236
312
|
if [ -z "$sources" ]; then
|
|
237
|
-
team_err "找不到可安装的 skill 源($TEAM_SKILL_DIR
|
|
313
|
+
team_err "找不到可安装的 skill 源($TEAM_SKILL_DIR 与它软链背后的 skills/ 里没有合格的技能目录)"
|
|
238
314
|
return 1
|
|
239
315
|
fi
|
|
240
316
|
|
|
241
317
|
mkdir -p "$target" || { team_err "建不了 $target"; return 1; }
|
|
242
|
-
local rc
|
|
318
|
+
local rc=$bad name src dest cur src_real found
|
|
243
319
|
while IFS=$'\t' read -r name src; do
|
|
244
320
|
[ -n "$name" ] || continue
|
|
245
321
|
dest="$target/$name"
|
|
@@ -106,7 +106,7 @@ cmd.bootstrap.arg.--task-models the category to model map; a fresh project has n
|
|
|
106
106
|
cmd.bootstrap.arg.--pm-model the model the PM itself runs on; the PM never borrows a worker model.
|
|
107
107
|
cmd.bootstrap.arg.--print diagnose and print the plan without writing anything.
|
|
108
108
|
cmd.init.title write the contract and the document skeleton
|
|
109
|
-
cmd.init.what Writes the project contract and the document skeleton, and copies the
|
|
109
|
+
cmd.init.what Writes the project contract and the document skeleton, and copies the skills into the project (under `.pi/skills`) so the project keeps working when the machine's skills are upgraded. It is the step of `team bootstrap` that does not touch worktrees or windows.
|
|
110
110
|
cmd.init.when Use it when you want a project that is initialised but has no seats running yet, or when you are repairing only the contract and the skeleton.
|
|
111
111
|
cmd.init.example team init --no-skills --agents "dev verify" --task-models "code=provider/model"
|
|
112
112
|
cmd.init.read the templates that ship with the skill
|
|
@@ -92,7 +92,7 @@ cmd.bootstrap.arg.--task-models 类别到模型的映射;新项目没有默认
|
|
|
92
92
|
cmd.bootstrap.arg.--pm-model PM 自己用的模型;PM 从不借用 worker 的模型。
|
|
93
93
|
cmd.bootstrap.arg.--print 只诊断并打印计划,什么都不写。
|
|
94
94
|
cmd.init.title 写契约与文档骨架
|
|
95
|
-
cmd.init.what
|
|
95
|
+
cmd.init.what 写项目契约和文档骨架,并把随包发布的 skill 都复制进项目(放在 `.pi/skills`),这样机器上的 skill 升级时项目照旧能用。它是 `team bootstrap` 里不碰工作树、不碰窗口的那一步。
|
|
96
96
|
cmd.init.when 当你想要一个已初始化、但还没有席位在跑的项目时用它;只修契约和骨架时也用它。
|
|
97
97
|
cmd.init.example team init --no-skills --agents "dev verify" --task-models "code=provider/model"
|
|
98
98
|
cmd.init.read 随 skill 一起发布的模板
|
|
@@ -99,8 +99,16 @@ scratch_tree() { # <名字> <product-only|internal|mixed>
|
|
|
99
99
|
cp -a "$x" "$d/$b"
|
|
100
100
|
done
|
|
101
101
|
cp -a "$REAL_ROOT/openspec/specs" "$d/openspec/specs"
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
# P361:拷贝集合从源派生 —— 真实目录 + SKILL.md 的 name 与目录名一致(与产品 team_skill_inventory、
|
|
103
|
+
# 夹具 skill_src_names 同一口径)。写死两个名字时,第三个技能缺席会让嵌套 run 的 §0b 判红(V93 实测
|
|
104
|
+
# ok126/bad21),而那并不是被检树的问题,是探针自己的形状不合规。以后加技能不必再改这里。
|
|
105
|
+
for x in "$REAL_ROOT"/skills/*/; do
|
|
106
|
+
[ -d "$x" ] || continue
|
|
107
|
+
[ -L "${x%/}" ] && continue
|
|
108
|
+
b="$(basename "$x")"
|
|
109
|
+
[ "$(sed -n 's/^name:[[:space:]]*//p' "$x/SKILL.md" 2>/dev/null | head -1)" = "$b" ] || continue
|
|
110
|
+
cp -a "$x" "$d/skills/$b"
|
|
111
|
+
done
|
|
104
112
|
if [ "$mode" = "internal" ] || [ "$mode" = "mixed" ]; then
|
|
105
113
|
# 公开导出树里没有 AGENTS.md / SCOPE.md / .pi / openspec/changes / docs/team/reports:有就拷,没有就
|
|
106
114
|
# 建最小骨架(内部/混合树的控制会自己判断这棵树里有没有可判的内部材料,没有就可见 skip)。
|
|
@@ -105,6 +105,15 @@ inbox_hash() { # <仓库>:真实仓库收件箱指纹(M7.2 的反向守卫
|
|
|
105
105
|
| while IFS= read -r f; do sha256sum "$f"; done | sha256sum | awk '{print $1}'
|
|
106
106
|
)
|
|
107
107
|
}
|
|
108
|
+
# P360 实测(2026-10-22):指纹比对在**活着的项目**上必然红 —— 收件箱由投递机制与巡检持续写入,
|
|
109
|
+
# 跟夹具一点关系都没有(那条红在我自己跑的三次里出现两次,另一次恰好在投递间隙)。判据的本意是
|
|
110
|
+
# 「夹具不许往真账本喂幻影待办」,所以判它自己留下的痕迹:本轮私有临时根路径出现在真实收件箱里。
|
|
111
|
+
inbox_fixture_leaks() { # <仓库> <本轮私有根>:真实收件箱里出现本轮夹具路径的行数
|
|
112
|
+
( cd "$1" 2>/dev/null || return 0
|
|
113
|
+
find docs/team/inbox -type f 2>/dev/null | sort \
|
|
114
|
+
| while IFS= read -r f; do grep -hF -- "${2:-/nonexistent}" "$f" 2>/dev/null; done | wc -l | tr -d ' '
|
|
115
|
+
)
|
|
116
|
+
}
|
|
108
117
|
|
|
109
118
|
# ── 版本锚点(P218):唯一来源 = 那棵树自己的 common.sh(TEAM_VERSION),本文件里不出现版本字面量 ──
|
|
110
119
|
# 现场(P214):这四处改坏副本的 sed 原来写死成当时的版本号(`1.42.0`);版本改成 0.1.0 后 sed 空转 → 副本没被改坏 →
|
|
@@ -153,6 +162,28 @@ drift_skill_copy() { # <tree> <repo> → DRIFT_VER = 漂移版本;自检不过
|
|
|
153
162
|
}
|
|
154
163
|
DRIFT_VER=""
|
|
155
164
|
|
|
165
|
+
# P361:技能名的真源 —— 源里有几个技能,而不是代码里写死的数字。口径与产品 team_skill_inventory 同一条:
|
|
166
|
+
# 真实目录(不是软链)+ 有 SKILL.md + frontmatter 的 name 与目录名一致。装上第四个技能时,下面所有「数了几个」
|
|
167
|
+
# 的断言跟着源清单走(写死的 2 会先红一次再被改掉 —— P361 就是这么暴的)。
|
|
168
|
+
skill_md_name_of() { # <skill 目录> → frontmatter 的 name(与产品 team_skill_md_name 同一读法)
|
|
169
|
+
awk '
|
|
170
|
+
/^---[[:space:]]*$/ { n++; if (n == 2) exit 0; next }
|
|
171
|
+
n == 1 && /^name:[[:space:]]*/ {
|
|
172
|
+
sub(/^name:[[:space:]]*/, ""); sub(/[[:space:]]+$/, ""); print; exit 0
|
|
173
|
+
}
|
|
174
|
+
' "$1/SKILL.md" 2>/dev/null
|
|
175
|
+
}
|
|
176
|
+
src_skill_names() { # <tree>:源里真实存在的技能名(一项一行,排序)
|
|
177
|
+
local t="$1" d n
|
|
178
|
+
for d in "$t"/skills/*/; do
|
|
179
|
+
[ -d "$d" ] || continue
|
|
180
|
+
[ -L "${d%/}" ] && continue
|
|
181
|
+
n="$(basename "$d")"
|
|
182
|
+
[ "$(skill_md_name_of "$d")" = "$n" ] || continue
|
|
183
|
+
printf '%s\n' "$n"
|
|
184
|
+
done | sort
|
|
185
|
+
}
|
|
186
|
+
|
|
156
187
|
# 假 pi:doctor 的其它行不该由宿主环境决定(本节只测 install 行)
|
|
157
188
|
FAKE_PI="$tmp/fake-pi"
|
|
158
189
|
mkdir -p "$FAKE_PI"
|
|
@@ -249,6 +280,67 @@ chk_unknown_survives() { # <tree> <已在 .pi/skills/teamsmith 放了未识别
|
|
|
249
280
|
return 0
|
|
250
281
|
}
|
|
251
282
|
|
|
283
|
+
# ── P361 · 技能源口径:**谁是源**由发现回答,**少了谁**只能由声明回答 ──
|
|
284
|
+
chk_skill_sources_ok() { # <tree> <repo>:源完整 → 全部装上、没有 miss、没有不合法裁决
|
|
285
|
+
local t="$1" p="$2" out rc want got
|
|
286
|
+
out="$(init_proj "$t" "$p")"; rc=$?
|
|
287
|
+
if [ "$rc" -ne 0 ]; then printf 'init rc=%s(完整的源不该有裁决)\n' "$rc"; return 1; fi
|
|
288
|
+
case "$out" in
|
|
289
|
+
*' miss '*) printf '源完整却报了 miss:[%s]\n' "$(printf '%s' "$out" | grep -F ' miss ' | head -1)"; return 1 ;;
|
|
290
|
+
*不合法*) printf '源完整却裁了「不合法」:[%s]\n' "$(printf '%s' "$out" | grep -F '不合法' | head -1)"; return 1 ;;
|
|
291
|
+
esac
|
|
292
|
+
want="$(src_skill_names "$t" | tr '\n' ' ')"; got="$(ls -1A "$p/.pi/skills" 2>/dev/null | sort | tr '\n' ' ')"
|
|
293
|
+
if [ "$got" != "$want" ]; then printf '.pi/skills/ 与源清单不一致:装成 [%s],源里 [%s]\n' "$got" "$want"; return 1; fi
|
|
294
|
+
printf '源里 %s 个技能全部装上(%s),没有 miss / 不合法\n' "$(printf '%s' "$want" | wc -w | tr -d ' ')" "$want"
|
|
295
|
+
return 0
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
chk_skill_bad_name_reported() { # <tree> <repo>:frontmatter 的 name 与目录名不符 → 非 0 并点名两个名字
|
|
299
|
+
local t="$1" p="$2" out rc
|
|
300
|
+
out="$(init_proj "$t" "$p")"; rc=$?
|
|
301
|
+
if [ "$rc" -eq 0 ]; then printf 'name 不符却 rc=0\n'; return 1; fi
|
|
302
|
+
case "$out" in *不合法*) ;; *) printf '没裁「不合法」:%s\n' "$(printf '%s' "$out" | tail -2 | tr '\n' ' ')"; return 1 ;; esac
|
|
303
|
+
case "$out" in *handover-x*) ;; *) printf '没点名 SKILL.md 里的错名字 handover-x\n'; return 1 ;; esac
|
|
304
|
+
case "$out" in *'/skills/handover '*) ;; *) printf '没点名源目录 skills/handover\n'; return 1 ;; esac
|
|
305
|
+
printf 'rc=%s,点名源目录 skills/handover 与错名字 handover-x\n' "$rc"
|
|
306
|
+
return 0
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
chk_skill_no_note() { # <tree> <repo>:声明面完整 → 全部装上且**没有** note 行(未登记分支不该被触发)
|
|
310
|
+
local t="$1" p="$2" out rc want got
|
|
311
|
+
out="$(init_proj "$t" "$p")"; rc=$?
|
|
312
|
+
if [ "$rc" -ne 0 ]; then printf 'init rc=%s(声明面完整不该有裁决)\n' "$rc"; return 1; fi
|
|
313
|
+
case "$out" in
|
|
314
|
+
*' note '*) printf '声明面完整却报了未登记:[%s]\n' "$(printf '%s' "$out" | grep -F ' note ' | head -1)"; return 1 ;;
|
|
315
|
+
esac
|
|
316
|
+
want="$(src_skill_names "$t" | tr '\n' ' ')"; got="$(ls -1A "$p/.pi/skills" 2>/dev/null | sort | tr '\n' ' ')"
|
|
317
|
+
if [ "$got" != "$want" ]; then printf '.pi/skills/ 与源清单不一致:装成 [%s],源里 [%s]\n' "$got" "$want"; return 1; fi
|
|
318
|
+
printf '没有 note 行,%s 个技能全部装上(%s)\n' "$(printf '%s' "$want" | wc -w | tr -d ' ')" "$want"
|
|
319
|
+
return 0
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
chk_skill_unregistered_reported() { # <tree> <repo>:源里有、声明里没有 → 照装(rc=0)并点名它是未登记
|
|
323
|
+
local t="$1" p="$2" out rc want got
|
|
324
|
+
out="$(init_proj "$t" "$p")"; rc=$?
|
|
325
|
+
if [ "$rc" -ne 0 ]; then printf '未登记只是「照装并喊一声」,不该 rc=%s\n' "$rc"; return 1; fi
|
|
326
|
+
case "$out" in *' note handover '*) ;; *) printf '没有可见地说 handover 未登记:%s\n' "$(printf '%s' "$out" | head -2 | tr '\n' ' ')"; return 1 ;; esac
|
|
327
|
+
want="$(src_skill_names "$t" | tr '\n' ' ')"; got="$(ls -1A "$p/.pi/skills" 2>/dev/null | sort | tr '\n' ' ')"
|
|
328
|
+
if [ "$got" != "$want" ]; then printf '未登记的技能没被装上:装成 [%s],源里 [%s]\n' "$got" "$want"; return 1; fi
|
|
329
|
+
printf 'rc=0,点名 note handover,%s 个技能全部照装(%s)\n' "$(printf '%s' "$want" | wc -w | tr -d ' ')" "$want"
|
|
330
|
+
return 0
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
chk_skill_missing_reported() { # <tree> <repo>:源里少一个技能 → 不崩(rc=0)且可见地点名少了谁
|
|
334
|
+
local t="$1" p="$2" out rc n_n m_n
|
|
335
|
+
out="$(init_proj "$t" "$p")"; rc=$?
|
|
336
|
+
if [ "$rc" -ne 0 ]; then printf '少一个技能源就 rc=%s(安装不该崩)\n' "$rc"; return 1; fi
|
|
337
|
+
case "$out" in *' miss handover(源 '*) ;; *) printf '没有可见地说少了 handover:%s\n' "$(printf '%s' "$out" | head -2 | tr '\n' ' ')"; return 1 ;; esac
|
|
338
|
+
n_n="$(src_skill_names "$t" | wc -l | tr -d ' ')"; m_n="$(ls -1A "$p/.pi/skills" 2>/dev/null | wc -l | tr -d ' ')"
|
|
339
|
+
if [ "$n_n" != "$m_n" ]; then printf '装了 %s 个,源里 %s 个\n' "$m_n" "$n_n"; return 1; fi
|
|
340
|
+
printf 'rc=0,点名 miss handover,其余 %s 个照装\n' "$m_n"
|
|
341
|
+
return 0
|
|
342
|
+
}
|
|
343
|
+
|
|
252
344
|
mk_unknown() { # <repo> <shape>:造一个不认识的条目(nodir=没有 SKILL.md / othername=name 不符 / file=普通文件)
|
|
253
345
|
local p="$1" shape="$2" dest
|
|
254
346
|
dest="$p/.pi/skills/teamsmith"
|
|
@@ -432,40 +524,51 @@ chk_init_docs_fact() { # <tree>
|
|
|
432
524
|
return 0
|
|
433
525
|
}
|
|
434
526
|
|
|
435
|
-
chk_pack_manifest() { # <tree>:声明面 ——
|
|
527
|
+
chk_pack_manifest() { # <tree>:声明面 —— team + 四个信号入口,files 带着 bin/
|
|
436
528
|
python3 - "$1/package.json" <<'PYMANI'
|
|
437
529
|
import json, sys
|
|
438
530
|
p = json.load(open(sys.argv[1]))
|
|
439
531
|
binmap = p.get("bin") or {}
|
|
440
532
|
files = p.get("files") or []
|
|
441
533
|
problems = []
|
|
442
|
-
|
|
443
|
-
|
|
534
|
+
# P360:0.3.1 的 bin 只有 team,`npm i -g` 因此不给 pkill/killall/pgrep/pidof 建链接,
|
|
535
|
+
# 用户敲这些名字落到 /usr/bin——闸门在 npm 路线上等于不存在。声明面必须含这四个名字。
|
|
536
|
+
want = ["team", "pkill", "killall", "pgrep", "pidof"]
|
|
537
|
+
if list(binmap.keys()) != want:
|
|
538
|
+
problems.append("bin 键不是 team + 四个信号入口:%r" % (list(binmap.keys()),))
|
|
444
539
|
elif binmap["team"].lstrip("./") != "bin/team.mjs":
|
|
445
540
|
problems.append("bin.team 指向 %r(要 bin/team.mjs)" % binmap["team"])
|
|
541
|
+
else:
|
|
542
|
+
for name in ("pkill", "killall", "pgrep", "pidof"):
|
|
543
|
+
want_t = "skills/teamsmith/scripts/shim/" + name
|
|
544
|
+
if binmap.get(name, "").lstrip("./") != want_t:
|
|
545
|
+
problems.append("bin.%s 指向 %r(要 %s)" % (name, binmap.get(name), want_t))
|
|
446
546
|
if "bin/" not in files:
|
|
447
547
|
problems.append("files 白名单里没有 bin/:%r" % (files,))
|
|
448
548
|
if problems:
|
|
449
549
|
print(";".join(problems)); sys.exit(1)
|
|
450
|
-
print("bin
|
|
550
|
+
print("bin 五项(team + 四个信号入口,均指向包内文件)+ files 带 bin/")
|
|
451
551
|
PYMANI
|
|
452
552
|
}
|
|
453
553
|
|
|
454
554
|
chk_pack_walk() { # <tree>:npm pack --dry-run 清单齐全且不含账本
|
|
455
555
|
local t="$1" json="$tmp/pack-walk.json"
|
|
456
556
|
( cd "$t" && npm pack --dry-run --json >"$json" 2>/dev/null ) || { printf 'npm pack --dry-run 失败\n'; return 1; }
|
|
457
|
-
python3 - "$json" <<'PYPACK'
|
|
557
|
+
python3 - "$json" "$(src_skill_names "$t" | tr '\n' ' ')" <<'PYPACK'
|
|
458
558
|
import json, sys
|
|
459
559
|
data = json.load(open(sys.argv[1]))
|
|
460
560
|
files = [f["path"] for f in data[0]["files"]]
|
|
461
|
-
|
|
561
|
+
names = sys.argv[2].split()
|
|
562
|
+
if not names:
|
|
563
|
+
print("源里一个技能都没找到"); sys.exit(1)
|
|
564
|
+
want = ["bin/team.mjs", "install.sh"] + ["skills/%s/SKILL.md" % n for n in names]
|
|
462
565
|
missing = [p for p in want if p not in files]
|
|
463
566
|
forbidden = [p for p in files if p.startswith(("docs/team/", ".pi/", "openspec/")) or "node_modules" in p]
|
|
464
567
|
if missing:
|
|
465
568
|
print("缺:" + "、".join(missing)); sys.exit(1)
|
|
466
569
|
if forbidden:
|
|
467
570
|
print("不该在包里:" + "、".join(forbidden[:3])); sys.exit(1)
|
|
468
|
-
print("清单齐全(%d
|
|
571
|
+
print("清单齐全(%d 项,含 %d 个技能的 SKILL.md)且不含账本/node_modules" % (len(files), len(names)))
|
|
469
572
|
PYPACK
|
|
470
573
|
}
|
|
471
574
|
|
|
@@ -493,7 +596,7 @@ chk_prefix_install() { # <tree>:npm 私有 prefix 安装后与 bash 入口一
|
|
|
493
596
|
}
|
|
494
597
|
|
|
495
598
|
chk_prefix_signal_entries() { # <prefix>:安装物的 pkill/killall/pgrep/pidof 在、解析到安装目录、判定生效
|
|
496
|
-
local prefix="$1" shim backends stub wlog log t form out rc line fargs missing=""
|
|
599
|
+
local prefix="$1" shim backends stub wlog log t form out rc line fargs missing="" link want resolved
|
|
497
600
|
shim="$prefix/lib/node_modules/teamsmith/skills/teamsmith/scripts/shim"
|
|
498
601
|
backends="$tmp/prefix-signal-backends"; rm -rf "$backends"; mkdir -p "$backends"
|
|
499
602
|
stub="$backends/.witness"
|
|
@@ -512,6 +615,28 @@ WITNESS
|
|
|
512
615
|
if [ -n "$missing" ]; then
|
|
513
616
|
printf '安装包没有携带信号闸门入口(npm 丢 120000 软链的历史形状):%s\n' "$missing"; return 1
|
|
514
617
|
fi
|
|
618
|
+
# P360(0.3.1 实测漏网):**包里带着**不等于**装上能用** —— `npm i -g` 只在 package.json 的 `bin`
|
|
619
|
+
# 里列了谁才在 prefix/bin 里建链接。0.3.1 的 bin 只有 team,于是用户 `pkill` 落到 /usr/bin,
|
|
620
|
+
# 闸门在 npm 路线上等于不存在;而上面两条断言只查了「包内文件在不在」,两次复验都没抓住。
|
|
621
|
+
# 这里补的正是那个缺失的证伪者:装完必须在 prefix/bin 里解析到**这个包的**那个 shim。
|
|
622
|
+
# 两类形状分开判、一起点名(P360 红侧实测:`readlink -f` 对不存在的最后一级会原样吐出路径而不是空,
|
|
623
|
+
# 所以「在不在」必须先自己判,否则「bin 字段没列它们」那条永远打不出来;判据是解析到**这个包的**那个 shim,
|
|
624
|
+
# 所以指向包外、指向包内别的文件、悬空软链都落进 foreign)。
|
|
625
|
+
local miss_bin="" foreign=""
|
|
626
|
+
for t in pkill killall pgrep pidof; do
|
|
627
|
+
link="$prefix/bin/$t"
|
|
628
|
+
want="$(readlink -f "$shim/$t" 2>/dev/null || true)"
|
|
629
|
+
if [ ! -e "$link" ] && [ ! -L "$link" ]; then miss_bin="${miss_bin:+$miss_bin }$t"; continue; fi
|
|
630
|
+
resolved="$(readlink -f "$link" 2>/dev/null || true)"
|
|
631
|
+
[ "$resolved" = "$want" ] && continue
|
|
632
|
+
foreign="${foreign:+$foreign }$t→[${resolved:-<解析不出>}](要 $want)"
|
|
633
|
+
done
|
|
634
|
+
if [ -n "$miss_bin" ]; then
|
|
635
|
+
printf '安装后 prefix/bin 里没有 %s —— npm 没为这些名字建链接(bin 字段没列它们,或列的目标不是包内文件);用户敲这些名字会落到 /usr/bin\n' "$miss_bin"; return 1
|
|
636
|
+
fi
|
|
637
|
+
if [ -n "$foreign" ]; then
|
|
638
|
+
printf '安装后 prefix/bin 的入口没有落在包内 shim:%s\n' "$foreign"; return 1
|
|
639
|
+
fi
|
|
515
640
|
for t in pkill killall pgrep pidof; do
|
|
516
641
|
line="$(PATH="$shim:$backends:/usr/bin:/bin" command -v "$t" 2>/dev/null)"
|
|
517
642
|
if [ "$line" != "$shim/$t" ]; then
|
|
@@ -635,9 +760,13 @@ if want install; then
|
|
|
635
760
|
p="$tmp/p-link"; git_new "$p"; assert_isolated "$tree" "$p"
|
|
636
761
|
out="$(init_proj "$tree" "$p")"; rc=$?
|
|
637
762
|
assert_eq "init 退出码 0" "$rc" "0"
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
763
|
+
n_src="$(src_skill_names "$tree" | wc -l | tr -d ' ')"
|
|
764
|
+
[ "$n_src" -ge 3 ] || fail_setup "源里只找到 $n_src 个技能(期望至少 teamsmith / teamsmith-init / handover 三个):$(src_skill_names "$tree" | tr '\n' ' ')"
|
|
765
|
+
assert_eq "输出逐 skill 一条 link 行(源里 $n_src 个技能:$(src_skill_names "$tree" | tr '\n' ' '))" \
|
|
766
|
+
"$(printf '%s' "$out" | grep -cE '^ link .*/\.pi/skills/[A-Za-z0-9._-]+ → ' || true)" "$n_src"
|
|
767
|
+
while IFS= read -r s_name; do
|
|
768
|
+
assert_link_to "$p/.pi/skills/$s_name" "$tree/skills/$s_name" ".pi/skills/$s_name 是指向源 $s_name 的软链"
|
|
769
|
+
done < <(src_skill_names "$tree")
|
|
641
770
|
# P59:装完打一行信任提示(.pi/skills/ 是 Pi 的信任资源 → 第一次跑 pi 会问;三条出路)
|
|
642
771
|
check_holds "P59 装完一行信任提示(触发资源 + 三条出路)" chk_trust_hint "$out"
|
|
643
772
|
case "$out" in *"link $p/.pi/skills/teamsmith → $tree/skills/teamsmith"*) ok "link 行是逐 skill 一行(含目标与源)" ;;
|
|
@@ -650,7 +779,8 @@ if want install; then
|
|
|
650
779
|
assert_eq "第二次 init 后目标不变" "$(readlink -f "$p/.pi/skills/teamsmith")" "$t1"
|
|
651
780
|
assert_eq "第二次 init 后兄弟目标不变" "$(readlink -f "$p/.pi/skills/teamsmith-init")" "$t2"
|
|
652
781
|
check_holds "P59 重跑(skip)仍然打那一行" chk_trust_hint "$out2"
|
|
653
|
-
assert_eq ".pi/skills/
|
|
782
|
+
assert_eq ".pi/skills/ 里的名字与源清单一致($n_src 个:$(src_skill_names "$tree" | tr '\n' ' '))" \
|
|
783
|
+
"$(ls -1A "$p/.pi/skills" | sort | tr '\n' ' ')" "$(src_skill_names "$tree" | tr '\n' ' ')"
|
|
654
784
|
out3="$(init_proj "$tree" "$p" --copy)"; rc3=$?
|
|
655
785
|
assert_eq "--copy 对着已有软链退出 0(skip,不是覆盖)" "$rc3" "0"
|
|
656
786
|
assert_eq "--copy 后仍是同一软链目标" "$(readlink -f "$p/.pi/skills/teamsmith")" "$t1"
|
|
@@ -677,6 +807,14 @@ if want install; then
|
|
|
677
807
|
assert_not_file "$p/.pi/skills/teamsmith/scripts/panel/node_modules" "--copy 排除了 node_modules/"
|
|
678
808
|
assert_not_file "$p/.pi/skills/teamsmith/.git" "--copy 排除了 .git/"
|
|
679
809
|
assert_not_file "$p/.pi/skills/teamsmith-init/scripts/panel/node_modules" "--copy 的兄弟条目也排除 node_modules/"
|
|
810
|
+
# P361:每个源技能都得是「真目录 + 逐字节 + 自己认得出自己」(判定入口是 SKILL.md 的 name:)
|
|
811
|
+
for s_name in $(src_skill_names "$tree"); do
|
|
812
|
+
[ -d "$p/.pi/skills/$s_name" ] && [ ! -L "$p/.pi/skills/$s_name" ] \
|
|
813
|
+
&& ok "--copy 的 $s_name 是真目录(不是软链)" || bad "--copy 的 $s_name 不是真目录"
|
|
814
|
+
assert_eq "--copy 的 $s_name/SKILL.md 与源逐字节相等" \
|
|
815
|
+
"$(cmp -s "$tree/skills/$s_name/SKILL.md" "$p/.pi/skills/$s_name/SKILL.md" && echo same || echo differ)" "same"
|
|
816
|
+
assert_eq "--copy 的 $s_name/SKILL.md 的 name: 等于目录名" "$(skill_md_name_of "$p/.pi/skills/$s_name")" "$s_name"
|
|
817
|
+
done
|
|
680
818
|
|
|
681
819
|
# ④ linked worktree:装到主工作树,不装到 worktree
|
|
682
820
|
p="$tmp/p-wt"; git_new "$p"; init_proj "$tree" "$p" --no-skills >/dev/null
|
|
@@ -762,8 +900,8 @@ if want pack; then
|
|
|
762
900
|
if ! command -v npm >/dev/null 2>&1; then
|
|
763
901
|
skip "本机没有 npm:打包清单与 prefix 安装都跳过(可见 SKIP,不是静默通过)"
|
|
764
902
|
else
|
|
765
|
-
check_holds "
|
|
766
|
-
check_holds "打包清单:bin/team.mjs +
|
|
903
|
+
check_holds "声明面:team + 四个信号入口都指向包内 shim + files 带 bin/" chk_pack_manifest "$tree"
|
|
904
|
+
check_holds "打包清单:bin/team.mjs + 每个源的 SKILL.md + install.sh,不含账本" chk_pack_walk "$tree"
|
|
767
905
|
check_holds "私有 prefix 安装:version/help 与四个信号入口都来自安装物" chk_prefix_install "$tree"
|
|
768
906
|
fi
|
|
769
907
|
fi
|
|
@@ -1058,13 +1196,54 @@ PYEXT
|
|
|
1058
1196
|
pf="$tmp/f-ext-doctor-red"; git_new "$pf"; init_proj "$ft" "$pf" >/dev/null 2>&1; rm -f "$pf/.pi/extensions/team.ts"
|
|
1059
1197
|
check_holds "⑧b 对照:真实树报扩展缺失" chk_ext_doctor_missing "$tree" "$pg"
|
|
1060
1198
|
check_breaks "⑧b 翻转:/team 的 doctor 行被静默" chk_ext_doctor_missing "$ft" "$pf"
|
|
1199
|
+
# ⑩ P361:源的 frontmatter name 与目录名不符 → 安装必须红并**点名**(读数 4 的红侧①)
|
|
1200
|
+
ft="$tmp/f-skill-name"; scratch_tree "$ft"
|
|
1201
|
+
python3 - "$ft/skills/handover/SKILL.md" <<'PYNAME'
|
|
1202
|
+
import sys
|
|
1203
|
+
p = sys.argv[1]
|
|
1204
|
+
s = open(p, encoding='utf-8').read()
|
|
1205
|
+
if "\nname: handover\n" not in s:
|
|
1206
|
+
print("handover/SKILL.md 里找不到 name: handover"); sys.exit(1)
|
|
1207
|
+
open(p, "w", encoding="utf-8").write(s.replace("\nname: handover\n", "\nname: handover-x\n", 1))
|
|
1208
|
+
PYNAME
|
|
1209
|
+
pg="$tmp/f-skill-name-green"; git_new "$pg"
|
|
1210
|
+
pf="$tmp/f-skill-name-red"; git_new "$pf"
|
|
1211
|
+
check_holds "⑩ 对照:真实树的源都合法、全部装上" chk_skill_sources_ok "$tree" "$pg"
|
|
1212
|
+
check_breaks "⑩ 翻转:handover 的 name: 改成 handover-x" chk_skill_sources_ok "$ft" "$pf"
|
|
1213
|
+
check_holds "⑩ 红侧点名:非 0 且点名源目录与错名字" chk_skill_bad_name_reported "$ft" "$pf"
|
|
1214
|
+
# ⑪ P361:源里整个少一个技能 → 不崩(rc=0),并且**可见地**说出少了一个(读数 4 的红侧②)
|
|
1215
|
+
ft="$tmp/f-skill-missing"; scratch_tree "$ft"; rm -rf "$ft/skills/handover"
|
|
1216
|
+
pg="$tmp/f-skill-missing-green"; git_new "$pg"
|
|
1217
|
+
pf="$tmp/f-skill-missing-red"; git_new "$pf"
|
|
1218
|
+
check_holds "⑪ 对照:真实树没有 miss 行" chk_skill_sources_ok "$tree" "$pg"
|
|
1219
|
+
check_breaks "⑪ 翻转:源里删掉 handover 整个目录" chk_skill_sources_ok "$ft" "$pf"
|
|
1220
|
+
check_holds "⑪ 红侧点名:rc=0 且可见地说少了 handover" chk_skill_missing_reported "$ft" "$pf"
|
|
1221
|
+
# ⑫ P361:声明面漏登记 → 源里的技能**照装**,但必须喊出来(未登记分支的抗体;V93 实测它原先没人钉)
|
|
1222
|
+
ft="$tmp/f-skill-unregistered"; scratch_tree "$ft"
|
|
1223
|
+
python3 - "$ft/skills/teamsmith/scripts/lib/cmd-init.sh" <<'PYDECL'
|
|
1224
|
+
import sys
|
|
1225
|
+
p = sys.argv[1]
|
|
1226
|
+
s = open(p, encoding='utf-8').read()
|
|
1227
|
+
old = "team_skill_declared() { printf '%s\\n' teamsmith teamsmith-init handover; return 0; }"
|
|
1228
|
+
if old not in s:
|
|
1229
|
+
print("声明面形状变了,夹具需要跟着改:" + repr([l for l in s.splitlines() if "team_skill_declared()" in l]))
|
|
1230
|
+
sys.exit(1)
|
|
1231
|
+
open(p, "w", encoding="utf-8").write(s.replace(old, old.replace(" handover;", ";"), 1))
|
|
1232
|
+
PYDECL
|
|
1233
|
+
pg="$tmp/f-skill-unregistered-green"; git_new "$pg"
|
|
1234
|
+
pf="$tmp/f-skill-unregistered-red"; git_new "$pf"
|
|
1235
|
+
check_holds "⑫ 对照:真实树声明面完整、没有 note 行" chk_skill_no_note "$tree" "$pg"
|
|
1236
|
+
check_breaks "⑫ 翻转:声明面删掉 handover(源里还有)" chk_skill_no_note "$ft" "$pf"
|
|
1237
|
+
check_holds "⑫ 红侧点名:rc=0 且可见地说 handover 未登记、照装" chk_skill_unregistered_reported "$ft" "$pf"
|
|
1061
1238
|
# ⑥ 真实树没被夹具动过:git status 指纹前后一致
|
|
1062
1239
|
porcelain_after="$(cd "$tree" && git status --porcelain | sha256sum)"
|
|
1063
1240
|
assert_eq "⑥ 夹具没碰真实树(git status 指纹不变)" "$porcelain_after" "$porcelain_before"
|
|
1064
1241
|
fi
|
|
1065
1242
|
|
|
1066
1243
|
# ---------------------------------------------------------------- 结果
|
|
1067
|
-
|
|
1244
|
+
# 判「夹具自己的痕迹」而不是「文件有没有被任何进程写过」:活着的项目里收件箱一直在长。
|
|
1245
|
+
assert_eq "反向守卫(M7.2):真实仓库收件箱里没有本轮夹具路径的痕迹" \
|
|
1246
|
+
"$(inbox_fixture_leaks "$tree" "$tmp")" "0"
|
|
1068
1247
|
printf '\n\033[1m== 结果 ==\033[0m ✓ %d ✗ %d SKIP %d\n' "$PASS" "$FAIL" "$SKIP"
|
|
1069
1248
|
[ "$FAIL" -eq 0 ] && exit 0
|
|
1070
1249
|
exit 1
|
|
@@ -11,7 +11,7 @@ import { fileURLToPath } from 'node:url'
|
|
|
11
11
|
|
|
12
12
|
const here = dirname(fileURLToPath(import.meta.url))
|
|
13
13
|
const skillDir = resolve(process.argv[2] ?? join(here, '..'))
|
|
14
|
-
// P16
|
|
14
|
+
// P16 拆分起,skills/ 下的每个 skill 共用这份加载器:期望的 name 就是目录名(teamsmith / teamsmith-init / handover)。
|
|
15
15
|
const expectedName = basename(skillDir)
|
|
16
16
|
|
|
17
17
|
const candidates = [
|
|
@@ -44,7 +44,11 @@ const skill = result.skills[0]
|
|
|
44
44
|
if (skill) {
|
|
45
45
|
if (skill.name !== expectedName) problems.push(`name 不是 ${expectedName}:${skill.name}`)
|
|
46
46
|
if (!skill.description || skill.description.length > 1024) problems.push(`description 长度非法或缺失`)
|
|
47
|
-
|
|
47
|
+
// P361:路由词汇必须先点名技能自己 —— 换成泛用关键词表(teamsmith|多 Agent|团队)会把 handover
|
|
48
|
+
// 这类兄弟 skill 判死;「描述里有自己的名字」对每个技能都成立,且改名忘改描述时会红。
|
|
49
|
+
if (!skill.description.includes(expectedName)) {
|
|
50
|
+
problems.push(`description 没有点名技能自己(${expectedName}):调用者靠这段描述路由`)
|
|
51
|
+
}
|
|
48
52
|
if (!skill.baseDir) problems.push('缺少 baseDir(相对路径无法解析)')
|
|
49
53
|
}
|
|
50
54
|
if (result.diagnostics.length) problems.push(...result.diagnostics.map(d => `诊断:${JSON.stringify(d)}`))
|
|
@@ -34,6 +34,26 @@ if [ "${SMOKE_SEL_CHILD:-0}" = "1" ] && [ -n "${SMOKE_SEL_SKILL_DIR:-}" ] \
|
|
|
34
34
|
fi
|
|
35
35
|
# P16:初始化指引是兄弟 skill(本仓库 skills/teamsmith-init;安装后 ~/.agents/skills/ 里并排的两条软链)。
|
|
36
36
|
SKILL_INIT_DIR="$(cd -P "$SKILL_DIR/.." && pwd)/teamsmith-init"
|
|
37
|
+
# P361:技能源清单的真源 —— 包内 skills/ 下每个**真实目录**,且 SKILL.md 的 name: 与目录名一致。
|
|
38
|
+
# 凡是要「遍历所有随包技能」的地方(0b 的解析器加载、14b 的文档扫描、装技能的计数断言)都走这里:
|
|
39
|
+
# 写死名字的代价实测了两次 —— 夹具数「两个」时第三个技能对两边都不可见;§0b 写死 `handover` 时,
|
|
40
|
+
# 只拷两个技能目录的检出形状(checkout-shape-probe 的 scratch 树)会红。**别再加名字,走清单。**
|
|
41
|
+
SKILL_SRC_PARENT="$(cd -P "$SKILL_DIR/.." && pwd)" # = <repo>/skills(P361:源清单就在这一层)
|
|
42
|
+
skill_src_names() {
|
|
43
|
+
local d n
|
|
44
|
+
for d in "$SKILL_SRC_PARENT"/*/; do
|
|
45
|
+
[ -d "$d" ] || continue
|
|
46
|
+
[ -L "${d%/}" ] && continue
|
|
47
|
+
n="$(basename "$d")"
|
|
48
|
+
[ "$(sed -n 's/^name:[[:space:]]*//p' "$d/SKILL.md" 2>/dev/null | head -1)" = "$n" ] && printf '%s\n' "$n"
|
|
49
|
+
done | sort
|
|
50
|
+
}
|
|
51
|
+
skill_src_dirs() { # → 每个源技能的绝对目录(一行一个,顺序同 skill_src_names)
|
|
52
|
+
local n
|
|
53
|
+
while IFS= read -r n; do
|
|
54
|
+
[ -n "$n" ] && printf '%s/%s\n' "$SKILL_SRC_PARENT" "$n"
|
|
55
|
+
done <<< "$(skill_src_names)"
|
|
56
|
+
}
|
|
37
57
|
TEAM="bash $SKILL_DIR/scripts/team"
|
|
38
58
|
# P235:新鲜项目的 init/bootstrap 必须给显式的类别映射 + 独立 PM 模型(工具不再猜席位/默认模型)。
|
|
39
59
|
# 夹具一律用这一对;断言要看真实值的用例自己覆盖。
|
|
@@ -1560,8 +1580,10 @@ assert_eq "M33 哨兵:后台哨兵活着,但不在作业表里(裸 wait
|
|
|
1560
1580
|
# ---------------------------------------------------------------- 0b. skill 合法性(pi 自己的解析器)
|
|
1561
1581
|
section "0b · skill 可被 pi 解析器加载"
|
|
1562
1582
|
if [ -n "$JS_RUNNER" ]; then
|
|
1563
|
-
# P16
|
|
1564
|
-
|
|
1583
|
+
# P16:每个 skill 都必须是合法可加载的(解析器期望的 name = 目录名)。
|
|
1584
|
+
# P361:清单从源派生(skill_src_dirs)—— 检出形状只带一部分技能时,扫的就是它带着的那几个。
|
|
1585
|
+
while IFS= read -r P16_SD; do
|
|
1586
|
+
[ -n "$P16_SD" ] || continue
|
|
1565
1587
|
P16_SL="$TMP/skill-load-$(basename "$P16_SD").log"
|
|
1566
1588
|
$JS_RUNNER "$SKILL_DIR/tests/skill-load.mjs" "$P16_SD" >"$P16_SL" 2>&1
|
|
1567
1589
|
P16_RC=$?
|
|
@@ -1574,7 +1596,7 @@ if [ -n "$JS_RUNNER" ]; then
|
|
|
1574
1596
|
else
|
|
1575
1597
|
bad "skill-load 失败($(basename "$P16_SD"))"; cat "$P16_SL"
|
|
1576
1598
|
fi
|
|
1577
|
-
done
|
|
1599
|
+
done <<< "$(skill_src_dirs)"
|
|
1578
1600
|
else
|
|
1579
1601
|
printf ' (跳过:没有可用的 JS 运行时)\n'
|
|
1580
1602
|
fi
|
|
@@ -2641,14 +2663,18 @@ assert_has "$REPO/docs/team/PROTOCOL.md" "references/openspec.md" "PROTOCOL.md
|
|
|
2641
2663
|
assert_file "$REPO/docs/team/threads/README.md" "写入 threads/README"
|
|
2642
2664
|
assert_has "$REPO/AGENTS.md" "<!-- teamsmith:begin -->" "AGENTS.md 注入协议段"
|
|
2643
2665
|
assert_has "$REPO/.gitignore" ".worktrees/" ".gitignore 忽略 worktree"
|
|
2644
|
-
# P40:init 的安装步 ——
|
|
2666
|
+
# P40:init 的安装步 —— 源里每个技能一条软链装进项目 .pi/skills/,.gitignore 跟着忽略它
|
|
2645
2667
|
# (本仓已跟踪的 .pi/skills/openspec-* 不受影响:忽略行不会 untrack 已跟踪文件)
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
"
|
|
2668
|
+
# P361:数量与名字跟着源清单走(skill_src_names),不再写死「两条」
|
|
2669
|
+
while IFS= read -r P40_S; do
|
|
2670
|
+
[ -n "$P40_S" ] || continue
|
|
2671
|
+
assert_eq "P40 init 装了项目 skill:.pi/skills/$P40_S → 源" \
|
|
2672
|
+
"$(readlink -f "$REPO/.pi/skills/$P40_S" 2>/dev/null || echo missing)" \
|
|
2673
|
+
"$(readlink -f "$SKILL_SRC_PARENT/$P40_S" 2>/dev/null || echo missing)"
|
|
2674
|
+
done <<< "$(skill_src_names)"
|
|
2650
2675
|
assert_has "$REPO/.gitignore" ".pi/skills/" "P40 .gitignore 忽略项目 skill 安装目录"
|
|
2651
|
-
assert_eq "P40 .pi/skills/
|
|
2676
|
+
assert_eq "P40 .pi/skills/ 里的名字与源清单一致($(skill_src_names | tr '\n' ' '))" \
|
|
2677
|
+
"$(ls -1A "$REPO/.pi/skills" | sort | tr '\n' ' ')" "$(skill_src_names | tr '\n' ' ')"
|
|
2652
2678
|
|
|
2653
2679
|
# 隔离自检(关键):team 必须把自己当成临时仓库 + 本测试 session
|
|
2654
2680
|
ISOLATE="$($TEAM paths 2>/dev/null || true)"
|
|
@@ -2709,10 +2735,11 @@ else ok "模板全部渲染(无 {{ 残留)"; fi
|
|
|
2709
2735
|
# 幂等:再 init 一次不应重复追加协议段
|
|
2710
2736
|
$TEAM init --session "$SESSION" --agents "dev verify" --vcs local --gates "true" --docs docs/team "${P235_MODELS[@]}" >"$TMP/init-again.log" 2>&1
|
|
2711
2737
|
assert_eq "AGENTS.md 协议段幂等(只出现一次)" "$(grep -cF '<!-- teamsmith:begin -->' "$REPO/AGENTS.md")" "1"
|
|
2712
|
-
# P40:第二次 init 不重装、不覆盖 ——
|
|
2713
|
-
assert_eq "P40 第二次 init
|
|
2714
|
-
"$(grep -cE '^ skip .*/\.pi/skills/
|
|
2715
|
-
assert_eq "P40 第二次 init 后 .pi/skills/
|
|
2738
|
+
# P40:第二次 init 不重装、不覆盖 —— 源里每个技能都报 skip(逐 skill 一行)
|
|
2739
|
+
assert_eq "P40 第二次 init 对每个技能都报 skip($(skill_src_names | wc -l | tr -d ' ') 条)" \
|
|
2740
|
+
"$(grep -cE '^ skip .*/\.pi/skills/[A-Za-z0-9._-]+(' "$TMP/init-again.log" || true)" "$(skill_src_names | wc -l | tr -d ' ')"
|
|
2741
|
+
assert_eq "P40 第二次 init 后 .pi/skills/ 仍与源清单一致" \
|
|
2742
|
+
"$(ls -1A "$REPO/.pi/skills" | sort | tr '\n' ' ')" "$(skill_src_names | tr '\n' ' ')"
|
|
2716
2743
|
|
|
2717
2744
|
# 必需依赖(D10)的确定性夹具:magic-context 用假 settings + 假包,OpenSpec 用假 CLI + 假 spec 目录。
|
|
2718
2745
|
# 都在 $TMP 下、用绝对路径 —— 本机装没装都不影响断言。
|
|
@@ -7212,8 +7239,12 @@ doc_stale_hits() { # <skill 目录>
|
|
|
7212
7239
|
done
|
|
7213
7240
|
}
|
|
7214
7241
|
|
|
7215
|
-
# P16
|
|
7216
|
-
REAL_HITS="
|
|
7242
|
+
# P16/P361:扫描范围是每个随包 skill 的读者面(清单从源派生:以后加技能自动进来)。
|
|
7243
|
+
REAL_HITS=""
|
|
7244
|
+
while IFS= read -r SC_SD; do
|
|
7245
|
+
[ -n "$SC_SD" ] || continue
|
|
7246
|
+
REAL_HITS="$REAL_HITS$(doc_stale_hits "$SC_SD")"
|
|
7247
|
+
done <<< "$(skill_src_dirs)"
|
|
7217
7248
|
if [ -n "$REAL_HITS" ]; then
|
|
7218
7249
|
bad "真树里有已删命令的用法:$(printf '%s' "$REAL_HITS" | head -1)"
|
|
7219
7250
|
else
|
|
@@ -9912,7 +9943,9 @@ real_skill_count() { # 仓库里**真实**(非软链)的 skill 目录数 —
|
|
|
9912
9943
|
done
|
|
9913
9944
|
printf '%s' "$n"
|
|
9914
9945
|
}
|
|
9915
|
-
|
|
9946
|
+
# P361:数量跟着源清单走(第三个技能是 handover);real_skill_count 与 skill_src_names 互为交叉核对
|
|
9947
|
+
assert_eq "仓库里真实(非软链)的 skill 目录数 = 源清单数($(skill_src_names | tr '\n' ' '))" \
|
|
9948
|
+
"$(real_skill_count)" "$(skill_src_names | wc -l | tr -d ' ')"
|
|
9916
9949
|
# M22:仓库不再自带软链别名(`skills/pi-team` 已 git rm)—— 安装器「跳过软链」的守卫改用
|
|
9917
9950
|
# 段末的 M22 夹具继续守,这里只钉住「仓库里没有旧入口」这个事实。
|
|
9918
9951
|
if [ -e "$SRC_ROOT/skills/pi-team" ] || [ -L "$SRC_ROOT/skills/pi-team" ]; then
|
|
@@ -39,7 +39,16 @@
|
|
|
39
39
|
# 按**全局选项**跳过 —— 变更调用照旧被识别(token 不能把调用藏起来),但 token **不是**隔离证据
|
|
40
40
|
# (带 token 没有 -L/-S/私有 TMPDIR 仍然红);带私有 `-L` 的一条照旧净。
|
|
41
41
|
#
|
|
42
|
-
# 扫描范围:skills/teamsmith/tests/** 与 docs/team/reports/*/pkg/** 的脚本类文件(日志/patch
|
|
42
|
+
# 扫描范围:skills/teamsmith/tests/** 与 docs/team/reports/*/pkg/** 的脚本类文件(日志/patch 不扫 ——
|
|
43
|
+
# `.log`/`.out` 本来就不在 @EXTS 里,靠**后缀**而不是靠目录名排除)。
|
|
44
|
+
#
|
|
45
|
+
# P359:排除只对**生成物目录**(`__pycache__` / `node_modules`)生效,`logs` / `snapshots` 两段**不再排除**。
|
|
46
|
+
# 按路径段排除的后果是「任何叫 logs 的目录下的脚本永远不会被这条纪律扫到,而且不打印任何跳过理由」——
|
|
47
|
+
# 正是「跳过被当成通过」:`tests/logs/probe.sh` 里写一条裸 `tmux kill-server`,改前判「干净(扫描 69 个脚本)」,
|
|
48
|
+
# 和没有这个文件时逐字节相同。量过真树:105 个候选脚本里被 `logs`/`snapshots` 两段排除的是 **0** 个
|
|
49
|
+
# (`tests/snapshots/` 只有 .txt 面板快照,`docs/team/reports/*/logs/` 里只有 .log/.out/.reds/.transcript,
|
|
50
|
+
# 两者都不在 @EXTS),所以去掉这两段对默认范围的 `--list` 是逐字节无变化的;将来有脚本落进这种目录,
|
|
51
|
+
# 它就该被扫、该被判,而不是被一个目录名静默吞掉。
|
|
43
52
|
#
|
|
44
53
|
# 用法:
|
|
45
54
|
# perl tests/tmux-lint.pl [--root DIR]… [--list] [--quiet] # 默认扫上面两个范围
|
|
@@ -108,7 +117,8 @@ for my $root (@ROOTS) {
|
|
|
108
117
|
wanted => sub {
|
|
109
118
|
my $p = $File::Find::name;
|
|
110
119
|
return if -d $p;
|
|
111
|
-
|
|
120
|
+
# P359:只排除生成物目录。目录名不是证据 —— `logs`/`snapshots` 曾在这里静默吞掉整个子树。
|
|
121
|
+
return if $p =~ m{/(__pycache__|node_modules)/};
|
|
112
122
|
my ($ext) = $p =~ /(\.[A-Za-z0-9]+)$/;
|
|
113
123
|
return unless defined $ext && $EXTS{lc $ext};
|
|
114
124
|
push @FILES, abs_path($p);
|
|
@@ -3,7 +3,7 @@ name: teamsmith-init
|
|
|
3
3
|
description: teamsmith-init is the new-project entry point of the teamsmith toolkit — organize multiple agents into a team, set up an agent collaboration protocol, and bootstrap this skill into a new project. It walks the questions to settle with the user first (dependencies, session and roster, the task-category mapping and the independent PM model, gates, VCS mode, install command, and the project's ROADMAP/OWNERSHIP/AGENTS.md red lines), then runs the one command that writes `.pi/team/config.sh` + the `docs/team/` skeleton + the `AGENTS.md` protocol section and starts the pulse, and finally hands day-to-day operation to the `teamsmith` skill. Use when the user wants to bootstrap teamsmith into a new repository, set up a brand-new team, organize multiple agents into a team, or set up an agent collaboration protocol where none exists yet.
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
|
-
version: "0.3.
|
|
6
|
+
version: "0.3.3"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# teamsmith-init · bring a new project to "ready to dispatch"
|