peaks-loop 4.1.24 → 4.1.25
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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +87 -1
- package/dist/cli/commands/gate-commands-enforce.d.ts +7 -16
- package/dist/cli/commands/gate-commands-enforce.js +26 -34
- package/dist/services/hooks/output.d.ts +2 -34
- package/dist/services/hooks/output.js +2 -37
- package/package.json +7 -6
- package/skills/bee/peaks-prd/test-prompts.json +0 -12
- package/skills/bee/peaks-qa/test-prompts.json +0 -12
- package/skills/bee/peaks-rd/test-prompts.json +0 -12
- package/skills/bee/peaks-txt/test-prompts.json +0 -12
- package/skills/bee/peaks-ui/test-prompts.json +0 -12
- package/skills/peaks-code/test-prompts.json +0 -12
- package/skills/peaks-doctor/test_prompts.json +0 -17
- package/skills/peaks-sop/test-prompts.json +0 -17
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metadata": {
|
|
3
3
|
"pluginRoot": ".",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.25"
|
|
5
5
|
},
|
|
6
6
|
"plugins": [
|
|
7
7
|
{
|
|
8
8
|
"name": "peaks-loop",
|
|
9
9
|
"description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
|
|
10
|
-
"version": "4.1.
|
|
10
|
+
"version": "4.1.25",
|
|
11
11
|
"author": {
|
|
12
12
|
"name": "SquabbyZ"
|
|
13
13
|
},
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.1.25 — 2026-10-29(授权与发布物)
|
|
4
|
+
|
|
5
|
+
**版本级别**:**patch**(沿用常设规则"默认版本新增采用最小的版本位")。本次**没有**改任何门禁的阈值或放行条件;
|
|
6
|
+
**没有**动事件 schema 的版本号(`schemaVersion` 仍是 `z.literal(1)`);**没有**改发布流程本身。
|
|
7
|
+
|
|
8
|
+
**一句话:这一版做两件事 —— 把一个每次 Bash 调用都在静默替你授权的钩子收回来,以及让**真正发布出去的包**不再夹带开发夹具。**
|
|
9
|
+
两件都是「机制声称的和实际做的不是一回事」:前者声称「只是放行」,实际是**授予权限**;后者声称「已排除」,实际**在发布的那条路径上没排除**。
|
|
10
|
+
|
|
11
|
+
### 1. 钩子不再替你授权
|
|
12
|
+
|
|
13
|
+
`peaks gate enforce --project "${CLAUDE_PROJECT_DIR}" --json` 是装在 `PreToolUse:Bash` 上的钩子,它此前在**每一次**调用上输出:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
"hookSpecificOutput": { "hookEventName": "PreToolUse", "permissionDecision": "allow" }
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
按 Claude Code 的钩子契约,`permissionDecision` 不是「允许」,是**真实授权**:宿主批准该调用并**跳过你自己的权限确认**(你显式 deny 的规则仍然优先)。
|
|
20
|
+
实测它在**每一条非空命令、且没有被任何门拦下的** Bash 调用上触发 —— 而那条 catch 是 fail-open 的,SOP 注册表读不出来时同样放行+授权。
|
|
21
|
+
|
|
22
|
+
**而这个授权从来就不需要。** 最初的报错是
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Hook JSON output validation failed — decision: Invalid option: expected one of "approve"|"block"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
根因是**根级** `decision` 键;门自己的判定早就挪进 `data`(宿主不读那个键)。宿主读不到根级 `decision` 时,
|
|
29
|
+
**一个不带 `hookSpecificOutput` 的文档它就满意** —— 另外两个兄弟钩子(`gate-step-08`、`auto-compact`)一直如此,在真实会话里逐次运行、零宿主校验错误。
|
|
30
|
+
|
|
31
|
+
于是三条允许路径(`emitAllowSkipped` / `emitAllowWorktree` / `emitSopAllow`)改为输出普通 CLI 信封,**不带 `hookSpecificOutput`**。
|
|
32
|
+
`buildAllowDocument` 与 `HOOK_ALLOW_DECISION` 被**删除**而不是留着不用 —— 一个只为发授权而存在的助手留在原地,就是下一切片的事故。
|
|
33
|
+
`data.decision` 仍是 `"allow"`:CLI 自己给下游工具的 `--json` 契约没有变。
|
|
34
|
+
|
|
35
|
+
**拒绝路径一字未动**:`emitBlock` 仍写 `permissionDecision: "deny"` + exit 2,而且拒绝**是因为判定而拒绝**(对照:同一 payload 给了授权后 exit 0 放行)。
|
|
36
|
+
|
|
37
|
+
代码是**降**的:三条允许路径共用一个 helper(`gate-commands-enforce.ts` 292 → 277、`output.ts` 204 → 164)。
|
|
38
|
+
|
|
39
|
+
### 2. 发布物不再夹带开发夹具
|
|
40
|
+
|
|
41
|
+
4.1.24 的 tarball 里带着 **8 个 `test-prompts.json`**,其中一个内嵌一位开发者的本地路径与内部流程细节。
|
|
42
|
+
**QA 是从 registry 把 tarball 拉下来 grep 出来的** —— 这是实测暴露,不是推断。
|
|
43
|
+
|
|
44
|
+
| 打包器 | 修复前 | 修复后 |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `npm pack --ignore-scripts` | 2959 文件 / **1** 个夹具 | 2958 / **0** |
|
|
47
|
+
| `pnpm pack`(**发布用的那个**) | 2966 文件 / **8** 个夹具 | 2958 / **0** |
|
|
48
|
+
|
|
49
|
+
**机制是 packlist 的版本差异。** `package.json#files` 写的是 `"skills/**"` 再用 `!skills/**/test-prompts.json` 减去。
|
|
50
|
+
npm 11 自己的 packlist 认这条 negation;**pnpm 10.11.0 内置的 npm-packlist 5.1.3 里,include 胜过 negation** ——
|
|
51
|
+
而 `scripts/release-pack.mjs` 用 pnpm 打包,所以这条规则**只在真正要紧的地方失效**。
|
|
52
|
+
而 negation **本来也盖不住第八个**:`skills/peaks-doctor/test_prompts.json` 是**下划线**命名,它在**每一种**清单里都发货。
|
|
53
|
+
|
|
54
|
+
修法是**正面点名该发什么**,而不是让两个打包器对 negation 的解释一致:`"skills/**/!(*test[-_]prompts*).*"`,
|
|
55
|
+
外加 `"!skills/**/test_prompts.json"`。原有的 negation **保留** —— QA 实测 `!skills/**/.DS_Store` 在 pnpm 下是**承重的**(npm 靠 `.npmignore`/`.gitignore` 也会丢它)。
|
|
56
|
+
|
|
57
|
+
**修完之后两个打包器产出字节一致的清单**,与 4.1.24 逐文件对比:**只少那 8 个夹具、零新增、零误删**;
|
|
58
|
+
`git ls-files skills/` 减去那 8 个,恰好等于 tarball 里的 `skills/`。
|
|
59
|
+
|
|
60
|
+
### 3. tarball 第一次有了验收测试
|
|
61
|
+
|
|
62
|
+
新测试断言的是**产物**而不是清单:它用**两个**打包器**真打** tarball 并读出条目,断言三件事 ——
|
|
63
|
+
任一 tarball 不含夹具;**每个受跟踪的非夹具 `skills/` 文件仍在**(防止排除吃掉别的);两个打包器**一致**。
|
|
64
|
+
|
|
65
|
+
**断言 `package.json` 里的字符串正是让这个缺陷溜过去的那种形状**:清单可以写着正确的话,而 tarball 仍然带着文件。
|
|
66
|
+
**只有 tarball 能谈论 tarball。** 而且**缺一个打包器算失败、不算跳过**(把 `tar` 从 `PATH` 拿掉 → `spawnSync tar ENOENT`,exit 1)——
|
|
67
|
+
一个因为什么都没跑而报「通过」的守卫,比没有守卫更糟。
|
|
68
|
+
|
|
69
|
+
### 4. 一条关于「数数」的教训
|
|
70
|
+
|
|
71
|
+
这个缺陷藏了这么久,是因为一个数把它盖住了:**「7」**。
|
|
72
|
+
两份清单做差集得到 7 —— 但**第八个在两边都有,差集永远看不见两边都有的文件**。
|
|
73
|
+
这和「门只对一份样本断言」是同一种盲区,只不过那次是别人做的,这次是我自己做的差集。
|
|
74
|
+
|
|
75
|
+
### 5. 这一版**没有**交付的东西(如实记录)
|
|
76
|
+
|
|
77
|
+
- **4.1.24 已经带着那 8 个夹具发上去了,npm 上的 tarball 不可变,撤不回。** 这一版能做的是「此后不再发」。
|
|
78
|
+
- **包含规则要求文件名带点**:将来一个**无扩展名**的 `skills/**` 文件会被**静默丢掉,且没有任何测试会红**(守卫断言的是受跟踪文件在位,而未跟踪的文件不在它的集合里)。已记入 backlog §23.20。
|
|
79
|
+
- `*test[-_]prompts*` 会连坐任何**含有**该记号的文件名(例如将来的 `test-prompts-extra.json`)。今天为 0。
|
|
80
|
+
- **变异覆盖不完整**:会话级的 `mut/mut-report.json` 是另一个切片的报告;本机 `peaks mut run` 两次 `MUT_FAILED / EPERM`(Stryker 的 Windows 沙箱去拷贝一个已死会话留下的 Unix 符号链接)。断言有效性那一半跑了(30 条断言,0 条弱),「测试能否抓到真变异」那一半是各切片**手工植入变异**验证的,不是门自动覆盖的。
|
|
81
|
+
- **第三方评审全部是 SKIP**:本机没有配置 reviewer provider(`configured: false`,0 个),单模型的自证盲区**没有被缓解**。
|
|
82
|
+
- **发布工具链在 Windows 上有一个同类缺陷,这一版没修。** `scripts/_release-shared.mjs` 的 `resolveNpmInvocation()`
|
|
83
|
+
探三个候选、找不到就**大声拒绝**;而 `resolvePnpmInvocation()` 只探一个、找不到就**静默退回裸名 `pnpm`** ——
|
|
84
|
+
而 `pnpm pack` 正是产出**发布 tarball** 的命令。corepack 管理的 pnpm(CI 的形态)没有那个文件,
|
|
85
|
+
所以在 Windows 上会退到 `pnpm.cmd` → ENOENT,失败形态是「发布根本没发生」而不是报错。
|
|
86
|
+
**CI 在 `ubuntu-latest` 上发布,所以 4.1.25 不受影响**;受影响的是**在 Windows 上发布的维护者**。
|
|
87
|
+
已记入 backlog §23.22。
|
|
88
|
+
|
|
3
89
|
## 4.1.24 — 2026-10-29(同一个 id,几个读法)
|
|
4
90
|
|
|
5
91
|
**版本级别**:**patch**(沿用常设规则"默认版本新增采用最小的版本位")。本次**没有**改任何门禁的阈值或放行条件;
|
|
@@ -42,7 +128,7 @@
|
|
|
42
128
|
|
|
43
129
|
| | |
|
|
44
130
|
|---|---|
|
|
45
|
-
| tarball 文件数 | 2955 → **
|
|
131
|
+
| tarball 文件数 | 2955 → **2966** —— 以**实际发布的 tarball** 为准(`npm pack peaks-loop@4.1.24` 后 `tar -tzf` 数出 2966)。本地 `npm pack --dry-run` 读的是 2959,两次构建差 7 个文件,**原因未查明**;本行此前写的 2955 / 2957 / 2959 都是不同时刻的读数,都不等于发布物。**同一个包在不同构建机上文件数不同,本身是个待查的问题。** |
|
|
46
132
|
| `skills/peaks-mut/SKILL.md`、`skills/peaks-maker/SKILL.md` | **在包里** |
|
|
47
133
|
| `src/skills/` 下的文件 | **0** |
|
|
48
134
|
| 安装器自己的枚举 | **25 个候选**,全部落在根 `skills/` 树内 |
|
|
@@ -55,22 +55,14 @@ export declare function handleWorktreeGate(io: ProgramIO, options: GateEnforceCl
|
|
|
55
55
|
/**
|
|
56
56
|
* Not a guarded surface — allow.
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* host parses it once and reads the decision out of `hookSpecificOutput`,
|
|
61
|
-
* while a downstream consumer still reads `JSON.parse(stdout).data.decision`.
|
|
62
|
-
*
|
|
63
|
-
* The envelope's own `data.decision` stays `allow` — it is nested under
|
|
64
|
-
* `data`, a key the host does not own, so the host reads no root `decision`
|
|
65
|
-
* at all. (The root `decision` key IS one the host owns, and it accepts only
|
|
66
|
-
* "approve" | "block" — a root `decision` of anything else is what produced
|
|
67
|
-
* the user's per-call "Invalid option" error.)
|
|
58
|
+
* The stdout document is the CLI envelope a downstream consumer reads
|
|
59
|
+
* (`JSON.parse(stdout).data.decision`), carrying no permission grant.
|
|
68
60
|
*/
|
|
69
61
|
export declare function emitAllowSkipped(io: ProgramIO, options: GateEnforceCliOptions): void;
|
|
70
62
|
/**
|
|
71
63
|
* Worktree gate allowed and this is not a Bash surface — allow without running
|
|
72
|
-
* the SOP gate. Same
|
|
73
|
-
* {@link emitAllowSkipped}
|
|
64
|
+
* the SOP gate. Same plain-envelope shape as the skipped path (see
|
|
65
|
+
* {@link emitAllowSkipped}).
|
|
74
66
|
*/
|
|
75
67
|
export declare function emitAllowWorktree(io: ProgramIO, options: GateEnforceCliOptions): void;
|
|
76
68
|
/**
|
|
@@ -85,10 +77,9 @@ export declare function emitSopWarnings(io: ProgramIO, decision: SopAllow): void
|
|
|
85
77
|
/**
|
|
86
78
|
* SOP gate allowed the command.
|
|
87
79
|
*
|
|
88
|
-
* `--json` mode emits the canonical envelope on stdout (the documented
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* {@link emitAllowSkipped} for the shape and the reason.
|
|
80
|
+
* `--json` mode emits the canonical envelope on stdout (the documented contract
|
|
81
|
+
* for downstream tooling): ONE JSON document, the gate's decision under `data`, and
|
|
82
|
+
* no permission grant — see {@link emitAllowSkipped} for the shape and the reason.
|
|
92
83
|
*/
|
|
93
84
|
export declare function emitSopAllow(io: ProgramIO, options: GateEnforceCliOptions, decision: SopAllow): void;
|
|
94
85
|
export {};
|
|
@@ -5,7 +5,7 @@ import { printResult } from '../cli-helpers.js';
|
|
|
5
5
|
import { detectIdeFromContext, pluckObject, pluckString } from '../../services/ide/hook-translator.js';
|
|
6
6
|
import { DISPATCH_PROVENANCE_ENV } from '../../services/worktree/dispatch-provenance.js';
|
|
7
7
|
import { getAdapter } from '../../services/ide/ide-registry.js';
|
|
8
|
-
import { emitBlock, emitDecision, emitHint
|
|
8
|
+
import { emitBlock, emitDecision, emitHint } from '../../services/hooks/output.js';
|
|
9
9
|
/**
|
|
10
10
|
* Parse the raw stdin payload, failing open to `null` on malformed JSON.
|
|
11
11
|
*/
|
|
@@ -135,27 +135,32 @@ export function handleWorktreeGate(io, options, toolKind, payload) {
|
|
|
135
135
|
return false;
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* In `--json` mode the stdout document is the CLI envelope with the Claude
|
|
141
|
-
* Code allow decision MERGED into it, so stdout stays ONE JSON document: the
|
|
142
|
-
* host parses it once and reads the decision out of `hookSpecificOutput`,
|
|
143
|
-
* while a downstream consumer still reads `JSON.parse(stdout).data.decision`.
|
|
138
|
+
* Emit an allow path: the plain CLI envelope on stdout, and nothing else.
|
|
144
139
|
*
|
|
145
|
-
* The
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* the
|
|
140
|
+
* The gate's own decision stays under `data`, a key the host does not own, so the
|
|
141
|
+
* host reads no root `decision` at all. The document carries NO `hookSpecificOutput`:
|
|
142
|
+
* an allow is a real permission GRANT — it approves the call and skips the user's own
|
|
143
|
+
* permission prompt — and a gate that passes a call through has no opinion to give.
|
|
144
|
+
* Exit 0 is the pass-through signal, and the call proceeds to the user's normal
|
|
145
|
+
* permission flow.
|
|
150
146
|
*/
|
|
151
|
-
|
|
147
|
+
function emitAllowEnvelope(io, options, data) {
|
|
152
148
|
if (options.json === true) {
|
|
153
|
-
printResult(io,
|
|
149
|
+
printResult(io, ok('gate.enforce', data), true);
|
|
154
150
|
}
|
|
155
151
|
else {
|
|
156
152
|
emitDecision(io, {});
|
|
157
153
|
}
|
|
158
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Not a guarded surface — allow.
|
|
157
|
+
*
|
|
158
|
+
* The stdout document is the CLI envelope a downstream consumer reads
|
|
159
|
+
* (`JSON.parse(stdout).data.decision`), carrying no permission grant.
|
|
160
|
+
*/
|
|
161
|
+
export function emitAllowSkipped(io, options) {
|
|
162
|
+
emitAllowEnvelope(io, options, { decision: 'allow', skipped: true });
|
|
163
|
+
}
|
|
159
164
|
/**
|
|
160
165
|
* Hard block: a worktree-mutating tool call without a current-task user grant. emitBlock writes
|
|
161
166
|
* the Claude Code permissionDecision:"deny" envelope and exits 2. The reason carries the
|
|
@@ -170,16 +175,11 @@ function emitWorktreeDeny(io, options, wtDecision) {
|
|
|
170
175
|
}
|
|
171
176
|
/**
|
|
172
177
|
* Worktree gate allowed and this is not a Bash surface — allow without running
|
|
173
|
-
* the SOP gate. Same
|
|
174
|
-
* {@link emitAllowSkipped}
|
|
178
|
+
* the SOP gate. Same plain-envelope shape as the skipped path (see
|
|
179
|
+
* {@link emitAllowSkipped}).
|
|
175
180
|
*/
|
|
176
181
|
export function emitAllowWorktree(io, options) {
|
|
177
|
-
|
|
178
|
-
printResult(io, buildAllowDocument(ok('gate.enforce', { decision: 'allow', layer: 'worktree-auth' })), true);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
emitDecision(io, {});
|
|
182
|
-
}
|
|
182
|
+
emitAllowEnvelope(io, options, { decision: 'allow', layer: 'worktree-auth' });
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* writes the Claude Code permissionDecision:"deny" JSON to stdout (the hook's decision signal),
|
|
@@ -204,18 +204,10 @@ export function emitSopWarnings(io, decision) {
|
|
|
204
204
|
/**
|
|
205
205
|
* SOP gate allowed the command.
|
|
206
206
|
*
|
|
207
|
-
* `--json` mode emits the canonical envelope on stdout (the documented
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* {@link emitAllowSkipped} for the shape and the reason.
|
|
207
|
+
* `--json` mode emits the canonical envelope on stdout (the documented contract
|
|
208
|
+
* for downstream tooling): ONE JSON document, the gate's decision under `data`, and
|
|
209
|
+
* no permission grant — see {@link emitAllowSkipped} for the shape and the reason.
|
|
211
210
|
*/
|
|
212
211
|
export function emitSopAllow(io, options, decision) {
|
|
213
|
-
|
|
214
|
-
printResult(io, buildAllowDocument(ok('gate.enforce', decision)), true);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
// allow: emit minimal JSON on stdout so Claude Code's PreToolUse hook
|
|
218
|
-
// validator accepts the response (see comment above).
|
|
219
|
-
emitDecision(io, {});
|
|
220
|
-
}
|
|
212
|
+
emitAllowEnvelope(io, options, decision);
|
|
221
213
|
}
|
|
@@ -99,38 +99,6 @@ export declare function emitBlock(io: ProgramIO, reason: string): EmitBlockResul
|
|
|
99
99
|
* be used for new code.
|
|
100
100
|
*/
|
|
101
101
|
export declare function emitDecision(io: ProgramIO, decision: DecisionShape | string): string;
|
|
102
|
-
/**
|
|
103
|
-
* The `hookSpecificOutput` block this repository ships on its allow paths.
|
|
104
|
-
*
|
|
105
|
-
* Why this shape: the Claude Code PreToolUse validator (measured against
|
|
106
|
-
* 2.1.312) accepts a stdout document whose root carries `hookSpecificOutput`
|
|
107
|
-
* with `permissionDecision` in {allow, deny, ask, defer}. It ALSO rejects a
|
|
108
|
-
* ROOT-level `decision` key whose value is outside {approve, block} — that is
|
|
109
|
-
* the exact error this slice fixes.
|
|
110
|
-
*
|
|
111
|
-
* `permissionDecision: "allow"` is the host's "this hook approves the call"
|
|
112
|
-
* signal. Measured: it makes the host approve the tool use, bypassing the
|
|
113
|
-
* user's own permission prompt, while an explicit user `deny` rule still
|
|
114
|
-
* overrides it. So this is a real permission grant, and the callers that use
|
|
115
|
-
* it must mean it.
|
|
116
|
-
*/
|
|
117
|
-
export declare const HOOK_ALLOW_DECISION: DecisionShape;
|
|
118
|
-
/**
|
|
119
|
-
* Merge a payload with the allow decision into ONE JSON document.
|
|
120
|
-
*
|
|
121
|
-
* The host parses stdout as a SINGLE JSON document, so the decision and the
|
|
122
|
-
* payload must travel together — two documents on stdout means the second one
|
|
123
|
-
* is unparseable and the whole hook output degrades to plain text.
|
|
124
|
-
*
|
|
125
|
-
* The payload's own fields are preserved verbatim, so a downstream consumer
|
|
126
|
-
* that reads `JSON.parse(stdout).data.decision` keeps reading exactly that.
|
|
127
|
-
* The return type keeps the payload's own type, so a caller that passes a
|
|
128
|
-
* `ResultEnvelope` still gets a `ResultEnvelope` and can hand it to
|
|
129
|
-
* `printResult` — the merge only ADDS a key, it does not erase the shape.
|
|
130
|
-
*/
|
|
131
|
-
export declare function buildAllowDocument<T extends object>(payload: T): T & {
|
|
132
|
-
hookSpecificOutput: DecisionShape;
|
|
133
|
-
};
|
|
134
102
|
/**
|
|
135
103
|
* Result document — a command's result envelope as ONE JSON document on
|
|
136
104
|
* stdout, with its action lines on stderr.
|
|
@@ -151,7 +119,7 @@ export declare function buildAllowDocument<T extends object>(payload: T): T & {
|
|
|
151
119
|
*
|
|
152
120
|
* It deliberately does NOT carry a `hookSpecificOutput` allow decision: an
|
|
153
121
|
* allow is a real permission GRANT that bypasses the user's own permission
|
|
154
|
-
* prompt
|
|
155
|
-
*
|
|
122
|
+
* prompt, and a gate that passes a call through has no opinion to give. Exit 0
|
|
123
|
+
* is the pass-through signal.
|
|
156
124
|
*/
|
|
157
125
|
export declare function emitResultDocument<T>(io: ProgramIO, envelope: ResultEnvelope<T>): void;
|
|
@@ -117,41 +117,6 @@ export function emitDecision(io, decision) {
|
|
|
117
117
|
io.stdout('\n');
|
|
118
118
|
return serialized;
|
|
119
119
|
}
|
|
120
|
-
/**
|
|
121
|
-
* The `hookSpecificOutput` block this repository ships on its allow paths.
|
|
122
|
-
*
|
|
123
|
-
* Why this shape: the Claude Code PreToolUse validator (measured against
|
|
124
|
-
* 2.1.312) accepts a stdout document whose root carries `hookSpecificOutput`
|
|
125
|
-
* with `permissionDecision` in {allow, deny, ask, defer}. It ALSO rejects a
|
|
126
|
-
* ROOT-level `decision` key whose value is outside {approve, block} — that is
|
|
127
|
-
* the exact error this slice fixes.
|
|
128
|
-
*
|
|
129
|
-
* `permissionDecision: "allow"` is the host's "this hook approves the call"
|
|
130
|
-
* signal. Measured: it makes the host approve the tool use, bypassing the
|
|
131
|
-
* user's own permission prompt, while an explicit user `deny` rule still
|
|
132
|
-
* overrides it. So this is a real permission grant, and the callers that use
|
|
133
|
-
* it must mean it.
|
|
134
|
-
*/
|
|
135
|
-
export const HOOK_ALLOW_DECISION = {
|
|
136
|
-
hookEventName: CLAUDE_CODE_HOOK_EVENT,
|
|
137
|
-
permissionDecision: 'allow'
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* Merge a payload with the allow decision into ONE JSON document.
|
|
141
|
-
*
|
|
142
|
-
* The host parses stdout as a SINGLE JSON document, so the decision and the
|
|
143
|
-
* payload must travel together — two documents on stdout means the second one
|
|
144
|
-
* is unparseable and the whole hook output degrades to plain text.
|
|
145
|
-
*
|
|
146
|
-
* The payload's own fields are preserved verbatim, so a downstream consumer
|
|
147
|
-
* that reads `JSON.parse(stdout).data.decision` keeps reading exactly that.
|
|
148
|
-
* The return type keeps the payload's own type, so a caller that passes a
|
|
149
|
-
* `ResultEnvelope` still gets a `ResultEnvelope` and can hand it to
|
|
150
|
-
* `printResult` — the merge only ADDS a key, it does not erase the shape.
|
|
151
|
-
*/
|
|
152
|
-
export function buildAllowDocument(payload) {
|
|
153
|
-
return { ...payload, hookSpecificOutput: HOOK_ALLOW_DECISION };
|
|
154
|
-
}
|
|
155
120
|
/**
|
|
156
121
|
* Result document — a command's result envelope as ONE JSON document on
|
|
157
122
|
* stdout, with its action lines on stderr.
|
|
@@ -172,8 +137,8 @@ export function buildAllowDocument(payload) {
|
|
|
172
137
|
*
|
|
173
138
|
* It deliberately does NOT carry a `hookSpecificOutput` allow decision: an
|
|
174
139
|
* allow is a real permission GRANT that bypasses the user's own permission
|
|
175
|
-
* prompt
|
|
176
|
-
*
|
|
140
|
+
* prompt, and a gate that passes a call through has no opinion to give. Exit 0
|
|
141
|
+
* is the pass-through signal.
|
|
177
142
|
*/
|
|
178
143
|
export function emitResultDocument(io, envelope) {
|
|
179
144
|
io.stdout(JSON.stringify(envelope, null, 2));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "peaks-loop",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.25",
|
|
4
4
|
"description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
|
|
5
5
|
"author": "SquabbyZ",
|
|
6
6
|
"keywords": [
|
|
@@ -90,8 +90,9 @@
|
|
|
90
90
|
"scripts/canonical-store-report.mjs",
|
|
91
91
|
"scripts/watch.mjs",
|
|
92
92
|
"scripts/watch-tree.mjs",
|
|
93
|
-
"skills
|
|
93
|
+
"skills/**/!(*test[-_]prompts*).*",
|
|
94
94
|
"!skills/**/test-prompts.json",
|
|
95
|
+
"!skills/**/test_prompts.json",
|
|
95
96
|
"!skills/**/.DS_Store",
|
|
96
97
|
"output-styles/**",
|
|
97
98
|
"agents/**",
|
|
@@ -132,10 +133,10 @@
|
|
|
132
133
|
"picomatch": "4.0.7",
|
|
133
134
|
"yaml": "^2.9.1",
|
|
134
135
|
"zod": "^4.6.7",
|
|
135
|
-
"peaks-loop-internal-runtime": "0.0.
|
|
136
|
-
"peaks-loop-
|
|
137
|
-
"peaks-loop-shared": "0.0.
|
|
138
|
-
"peaks-loop-
|
|
136
|
+
"peaks-loop-internal-runtime": "0.0.65",
|
|
137
|
+
"peaks-loop-shared-channel": "0.0.82",
|
|
138
|
+
"peaks-loop-shared": "0.0.114",
|
|
139
|
+
"peaks-loop-mut": "0.1.79"
|
|
139
140
|
},
|
|
140
141
|
"devDependencies": {
|
|
141
142
|
"@changesets/cli": "2.31.1",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": 1,
|
|
4
|
-
"prompt": "Feishu 文档 https://example.feishu.cn/wiki/PRODUCT_DOC_ID 是产品文档,需要登录。目标是 /Users/yuanyuan/Desktop/work/platform-rag-web 前端项目,请从文档提取可以交给 RD 实现、QA 复测的前端改动点。",
|
|
5
|
-
"expected": "先校验文档 URL 使用 https 且属于批准的 Feishu/Lark tenant 域名,再使用 headed gstack/browse/dist/browse 打开有头浏览器访问,遇到登录时等待用户完成并回复确认后再继续;登录后只提取产品实现逻辑、页面/路由/组件/状态/API contract/mock 假设/验收标准/联调问题,输出 .peaks/_runtime/<session-id>/prd/ 下的脱敏实现型 PRD handoff;不得保留登录 URL、cookie、headers、tokens、storage state、browser traces、raw browser/network state 或 PII/SSO/MFA 截图/日志。"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"id": 2,
|
|
9
|
-
"prompt": "产品文档业务背景很多,但用户明确只要落实到前端开发和 QA 验收,不要长篇业务叙述。当前没有 swagger.json,需要先 mock。",
|
|
10
|
-
"expected": "压缩业务背景,只输出待联调态 frontend delta、mock/API contract、后续 swagger 替换清单、QA 浏览器验收路径和阻塞问题。"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": 1,
|
|
4
|
-
"prompt": "验证 /Users/yuanyuan/Desktop/work/platform-rag-web 的前端需求实现。后端 swagger.json 不存在,当前实现使用 mock/API contract。",
|
|
5
|
-
"expected": "QA 运行相关测试/API 或 mock contract 验证,启动前端应用,用 headed gstack/browse/dist/browse 有头浏览器做强制 E2E,遇到登录时等待用户完成并回复确认后再继续,记录脱敏 route/actions、脱敏 console/network 失败、脱敏截图或观察;不得保留登录 URL、cookie、headers、tokens、storage state、browser traces、PII/SSO/MFA 材料;生成 .peaks/_runtime/<session-id>/qa/validation-report.md,并包含安全和性能检查结果。"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"id": 2,
|
|
9
|
-
"prompt": "浏览器 E2E 中如果页面白屏、console 报错、网络 mock 失败、UI 有明显回归怎么办?",
|
|
10
|
-
"expected": "QA 必须带证据退回 RD 修复,不能通过 QA;修复后重新浏览器验证。"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": 1,
|
|
4
|
-
"prompt": "根据 peaks-prd 产出的前端待联调 delta,在 /Users/yuanyuan/Desktop/work/platform-rag-web 中实现 UI/交互/API mock。项目没有后端 swagger.json,需要先用 mock/API contract 开发。",
|
|
5
|
-
"expected": "RD 先做 standards init/update dry-run 和项目扫描;非平凡变更检查 OpenSpec;按最小 slice 实现;新增/变更代码有单测或合理 focused coverage;前端/UI slice 自测必须用 headed gstack/browse/dist/browse 有头浏览器端到端验证并记录脱敏 route/actions、脱敏 console/network 观察和验收结果;完成 code review、安全 review、post-check dry-run 后才交给 QA;所有进入 .peaks/_runtime/<session-id>/rd/ 的浏览器证据必须脱敏,不得保留登录 URL、cookie、headers、tokens、storage state、browser traces、raw browser/network state 或 PII/SSO/MFA 截图/日志。"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"id": 2,
|
|
9
|
-
"prompt": "目标项目是存量前端项目,整体 UT 覆盖率可能不达标,但本次只要求新增和改动部分覆盖。",
|
|
10
|
-
"expected": "不能因历史低覆盖直接失败;必须要求新增/改动代码的 focused test/coverage 证据,缺失则阻塞 RD completion。"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": 1,
|
|
4
|
-
"prompt": "本次 peaks-code 实战发现了 Feishu 登录、前端 mock 联调、浏览器可见 E2E 和本地 .peaks 产物的使用习惯,需要沉淀给后续 session。",
|
|
5
|
-
"expected": "Peaks TXT 在 .peaks/_runtime/<session-id>/txt/skill-usage-lessons.md 和 context-capsule.md 中记录规则、原因、影响技能、未来应用方式和是否适合 memory extraction,不保存 secrets、登录态、PII 或原始浏览器数据。"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"id": 2,
|
|
9
|
-
"prompt": "流程被打断,需要下个 session 接着做。",
|
|
10
|
-
"expected": "输出紧凑 capsule:模式、已验证决策、artifact paths、标准变更、开放问题、下一步,不复述完整日志。"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": 1,
|
|
4
|
-
"prompt": "根据产品文档做前端页面迭代,要求全自动模式下设计不要模板化,要比普通 Tailwind/shadcn 默认页更好看。",
|
|
5
|
-
"expected": "Peaks UI 走 awesome-design-md + taste-skill/design-taste-frontend 的参考和品味链路,先定义风格方向、字体、色彩、动效、密度和交互状态,避免默认卡片栅格、居中 hero、AI 紫蓝渐变,并用浏览器可见检查迭代。"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"id": 2,
|
|
9
|
-
"prompt": "前端实现已经完成,但页面看起来像默认模板。",
|
|
10
|
-
"expected": "Peaks UI 产出 taste report,指出弱层级、模板感、交互状态缺失、响应式问题,并退回设计/RD 迭代后再 QA。"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": 1,
|
|
4
|
-
"prompt": "/peaks-code https://example.feishu.cn/wiki/PRODUCT_DOC_ID 是产品文档。请根据这份产品文档,对 /Users/yuanyuan/Desktop/work/platform-rag-web 这个前端项目进行迭代开发。目前只是前端项目,没有后端 swagger.json,可以先 mock,等后面有真实 swagger.json 数据时再联调替换。允许修改目标仓代码,这是实战测试。",
|
|
5
|
-
"expected": "peaks-code 选择 full-auto/实战路径,使用本仓 skills 目录下的 peaks-prd/rd/ui/qa/sc/txt,Feishu 走 headed gstack/browse/dist/browse 可见浏览器登录 handoff,先校验 https 和批准的 Feishu/Lark tenant 域名,生成 .peaks/_runtime/<session-id>/prd|rd|qa|txt 脱敏中间产物;RD 完成实现、单测、CR、安全检查、dry-run 后必须进入 QA;前端 RD 自测和 QA 验证都必须使用 headed gstack/browse/dist/browse 有头浏览器端到端验证并确认可见浏览器;QA 完成 API/mock 验证、浏览器 E2E、报告、安全和性能检查。若 QA 报告存在失败、阻塞、缺失或未验证项,必须回到 RD 修复并再次 QA,直到 QA 全部通过或生成 blocked handoff;full-auto 可用 Claude Code goal 维持 RD fixes until QA passes all acceptance items 的控制目标;不得保留登录 URL、cookie、headers、tokens、storage state、browser traces、raw browser/network state 或 PII/SSO/MFA 截图/日志。"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"id": 2,
|
|
9
|
-
"prompt": "/peaks-code 对 /Users/yuanyuan/Desktop/work/platform-rag-web 做前端需求迭代,需求来自需要登录的 Feishu 产品文档;如果浏览器登录没打开或文档仍不可读,需要阻塞并告诉我具体要做什么,不要用 unauthenticated fetch,也不要绕过 SSO/MFA。",
|
|
10
|
-
"expected": "流程必须验证可见浏览器 handoff,不能降级到 fetch;登录或访问失败时生成 blocked PRD/TXT 胶囊,只记录脱敏状态和下一步,不保存登录 URL、cookie、headers、tokens、storage state、浏览器 traces,或包含 PII/SSO/MFA 内容的截图和日志。"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": "doctor-baseline",
|
|
4
|
-
"prompt": "/peaks-doctor",
|
|
5
|
-
"expectedOutcome": "Runs peaks workspace init + peaks audit + peaks doctor; returns a triage of FAIL checks with hand-off suggestions."
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"id": "doctor-from-finding",
|
|
9
|
-
"prompt": "peaks doctor flagged L3:l3-memory-health. Generate an OpenSpec change record from it.",
|
|
10
|
-
"expectedOutcome": "Calls peaks openspec from-doctor --check-id L3:l3-memory-health; verifies the proposal.md was written; suggests next step (peaks-rd)."
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"id": "doctor-only-audit",
|
|
14
|
-
"prompt": "Run only the audit (not the full doctor).",
|
|
15
|
-
"expectedOutcome": "Calls peaks audit red-lines --project . --json; summarizes the enforcerFindings and the prose-only ratio."
|
|
16
|
-
}
|
|
17
|
-
]
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": 1,
|
|
4
|
-
"prompt": "我想要一个发布流程:先写好 CHANGELOG,再跑通测试,最后才能发布。帮我做成一个 SOP,我不想自己写 JSON。",
|
|
5
|
-
"expected": "peaks-sop 访谈出 phases(如 draft/review/ship)和门禁,调用 peaks sop init --apply 生成骨架,把门禁写进 sop.json(changelog 用 file-exists、tests 用 command 并提示需要 --allow-commands),跑 peaks sop lint 到 ok:true,用 peaks sop check 验证每个门禁,再 peaks sop register 注册。全程不让用户手写 JSON。"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"id": 2,
|
|
9
|
-
"prompt": "我的 SOP lint 报错说门禁绑定了未知阶段,帮我修。",
|
|
10
|
-
"expected": "peaks-sop 读 lint findings 定位违例门禁,在 sop.json 里把门禁的 phase 改成已声明的阶段(或补声明该阶段),重新 peaks sop lint 直到 ok:true,不直接 register 未通过 lint 的 SOP。"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"id": 3,
|
|
14
|
-
"prompt": "这个发布 SOP 真的能在测试没过时把我拦住吗?我想先确认再用。",
|
|
15
|
-
"expected": "peaks-sop 用 peaks sop check 在好/坏两种状态下验证门禁返回 pass/fail,再用 peaks sop advance --to ship --dry-run 干跑确认门禁未通过时阻断推进且不落盘,向用户展示阻断行为后再交付。"
|
|
16
|
-
}
|
|
17
|
-
]
|