peaks-loop 4.1.9 → 4.1.11
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 +72 -0
- package/dist/cli/commands/_register.js +2 -0
- package/dist/cli/commands/code-review-commands.d.ts +1 -1
- package/dist/cli/commands/code-review-commands.js +23 -37
- package/dist/cli/commands/code-review-ocr-delegate-record.d.ts +3 -0
- package/dist/cli/commands/code-review-ocr-delegate-record.js +73 -0
- package/dist/cli/commands/code-review-ocr-delegate.d.ts +12 -0
- package/dist/cli/commands/code-review-ocr-delegate.js +140 -0
- package/dist/cli/commands/code-review-run-ocr-18.d.ts +11 -0
- package/dist/cli/commands/code-review-run-ocr-18.js +127 -0
- package/dist/cli/commands/strat-tact-command-helpers.d.ts +16 -0
- package/dist/cli/commands/strat-tact-command-helpers.js +162 -0
- package/dist/cli/commands/strat-tact-commands.d.ts +3 -0
- package/dist/cli/commands/strat-tact-commands.js +176 -0
- package/dist/services/lint/detect-ocr-18.js +1 -1
- package/dist/services/lint/ocr-18-acquire.d.ts +1 -1
- package/dist/services/lint/ocr-18-acquire.js +2 -2
- package/dist/services/lint/ocr-18-allowlist.d.ts +30 -0
- package/dist/services/lint/ocr-18-allowlist.js +165 -0
- package/dist/services/lint/ocr-18-delegate-packet.d.ts +84 -0
- package/dist/services/lint/ocr-18-delegate-packet.js +175 -0
- package/dist/services/lint/ocr-18-delegate-payload.d.ts +67 -0
- package/dist/services/lint/ocr-18-delegate-payload.js +208 -0
- package/dist/services/lint/ocr-18-delegate-record.d.ts +42 -0
- package/dist/services/lint/ocr-18-delegate-record.js +223 -0
- package/dist/services/lint/ocr-18-language-routing.d.ts +96 -0
- package/dist/services/lint/ocr-18-language-routing.js +148 -0
- package/dist/services/lint/ocr-18-multi.d.ts +54 -0
- package/dist/services/lint/ocr-18-multi.js +184 -0
- package/dist/services/lint/ocr-multilang-adapter.d.ts +45 -7
- package/dist/services/lint/ocr-multilang-adapter.js +133 -94
- package/dist/services/rd/ast-gate.d.ts +19 -12
- package/dist/services/rd/ast-gate.js +10 -0
- package/dist/services/rd/canonical-hash.d.ts +1 -0
- package/dist/services/rd/canonical-hash.js +38 -0
- package/dist/services/rd/impl.js +2 -8
- package/dist/services/rd/strategy.js +2 -8
- package/dist/services/rd/types.d.ts +10 -10
- package/dist/services/rd/types.js +21 -10
- package/package.json +10 -10
- package/skills/bee/peaks-rd/SKILL.md +57 -3
- package/skills/bee/peaks-rd/references/ocr-multilang-1.8.md +314 -111
|
@@ -5,15 +5,9 @@
|
|
|
5
5
|
* H8 (audit trail hashable): sig field embedded in strategy.md is the
|
|
6
6
|
* sha256 of all OTHER content (chicken-and-egg avoided).
|
|
7
7
|
*/
|
|
8
|
-
import { createHash } from 'node:crypto';
|
|
9
8
|
import { writeFile, rename, unlink } from 'node:fs/promises';
|
|
9
|
+
import { canonicalSha256 } from './canonical-hash.js';
|
|
10
10
|
import { StrategyOutputSchema } from './types.js';
|
|
11
|
-
function sha256Of(content) {
|
|
12
|
-
const { sha256: _omit, ...rest } = content;
|
|
13
|
-
void _omit;
|
|
14
|
-
const canonical = JSON.stringify(rest, Object.keys(rest).sort());
|
|
15
|
-
return createHash('sha256').update(canonical).digest('hex');
|
|
16
|
-
}
|
|
17
11
|
export async function writeStrategy(input) {
|
|
18
12
|
const partial = {
|
|
19
13
|
version: '1.0',
|
|
@@ -25,7 +19,7 @@ export async function writeStrategy(input) {
|
|
|
25
19
|
designRationale: input.designRationale,
|
|
26
20
|
...(input.askUserQuestion ? { askUserQuestion: input.askUserQuestion } : {})
|
|
27
21
|
};
|
|
28
|
-
const sha256 =
|
|
22
|
+
const sha256 = canonicalSha256(partial);
|
|
29
23
|
const final = { ...partial, sha256 };
|
|
30
24
|
StrategyOutputSchema.parse(final);
|
|
31
25
|
const body = [
|
|
@@ -16,8 +16,8 @@ export declare const StrategyOutputSchema: z.ZodObject<{
|
|
|
16
16
|
askUserQuestion: z.ZodOptional<z.ZodObject<{
|
|
17
17
|
question: z.ZodString;
|
|
18
18
|
options: z.ZodArray<z.ZodString>;
|
|
19
|
-
}, z.core.$
|
|
20
|
-
}, z.core.$
|
|
19
|
+
}, z.core.$strict>>;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
21
|
export type StrategyOutput = z.infer<typeof StrategyOutputSchema>;
|
|
22
22
|
export declare const AstViolationSchema: z.ZodObject<{
|
|
23
23
|
file: z.ZodString;
|
|
@@ -29,7 +29,7 @@ export declare const AstViolationSchema: z.ZodObject<{
|
|
|
29
29
|
error: "error";
|
|
30
30
|
warning: "warning";
|
|
31
31
|
}>;
|
|
32
|
-
}, z.core.$
|
|
32
|
+
}, z.core.$strict>;
|
|
33
33
|
export declare const AstGateResultSchema: z.ZodObject<{
|
|
34
34
|
passed: z.ZodBoolean;
|
|
35
35
|
violations: z.ZodArray<z.ZodObject<{
|
|
@@ -42,14 +42,14 @@ export declare const AstGateResultSchema: z.ZodObject<{
|
|
|
42
42
|
error: "error";
|
|
43
43
|
warning: "warning";
|
|
44
44
|
}>;
|
|
45
|
-
}, z.core.$
|
|
46
|
-
}, z.core.$
|
|
45
|
+
}, z.core.$strict>>;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
47
|
export declare const ExternalApiCallSchema: z.ZodObject<{
|
|
48
48
|
file: z.ZodString;
|
|
49
49
|
line: z.ZodNumber;
|
|
50
50
|
api: z.ZodString;
|
|
51
51
|
version: z.ZodString;
|
|
52
|
-
}, z.core.$
|
|
52
|
+
}, z.core.$strict>;
|
|
53
53
|
export declare const ImplOutputSchema: z.ZodObject<{
|
|
54
54
|
version: z.ZodLiteral<"1.0">;
|
|
55
55
|
sha256: z.ZodString;
|
|
@@ -61,7 +61,7 @@ export declare const ImplOutputSchema: z.ZodObject<{
|
|
|
61
61
|
line: z.ZodNumber;
|
|
62
62
|
api: z.ZodString;
|
|
63
63
|
version: z.ZodString;
|
|
64
|
-
}, z.core.$
|
|
64
|
+
}, z.core.$strict>>;
|
|
65
65
|
astGateResult: z.ZodObject<{
|
|
66
66
|
passed: z.ZodBoolean;
|
|
67
67
|
violations: z.ZodArray<z.ZodObject<{
|
|
@@ -74,9 +74,9 @@ export declare const ImplOutputSchema: z.ZodObject<{
|
|
|
74
74
|
error: "error";
|
|
75
75
|
warning: "warning";
|
|
76
76
|
}>;
|
|
77
|
-
}, z.core.$
|
|
78
|
-
}, z.core.$
|
|
79
|
-
}, z.core.$
|
|
77
|
+
}, z.core.$strict>>;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
80
|
export type ImplOutput = z.infer<typeof ImplOutputSchema>;
|
|
81
81
|
export type AstViolation = z.infer<typeof AstViolationSchema>;
|
|
82
82
|
export type AstGateResult = z.infer<typeof AstGateResultSchema>;
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* TACT.sig inputSig chain must reference STRAT.sig.
|
|
6
6
|
*/
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
export const StrategyOutputSchema = z
|
|
8
|
+
export const StrategyOutputSchema = z
|
|
9
|
+
.object({
|
|
9
10
|
version: z.literal('1.0'),
|
|
10
11
|
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
11
12
|
generatedAt: z.string().datetime(),
|
|
@@ -18,27 +19,36 @@ export const StrategyOutputSchema = z.object({
|
|
|
18
19
|
question: z.string(),
|
|
19
20
|
options: z.array(z.string())
|
|
20
21
|
})
|
|
22
|
+
.strict()
|
|
21
23
|
.optional()
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
26
|
+
export const AstViolationSchema = z
|
|
27
|
+
.object({
|
|
24
28
|
file: z.string(),
|
|
25
29
|
line: z.number().int(),
|
|
26
30
|
api: z.string(),
|
|
27
31
|
expectedVersion: z.string(),
|
|
28
32
|
actualVersion: z.string(),
|
|
29
33
|
severity: z.enum(['error', 'warning'])
|
|
30
|
-
})
|
|
31
|
-
|
|
34
|
+
})
|
|
35
|
+
.strict();
|
|
36
|
+
export const AstGateResultSchema = z
|
|
37
|
+
.object({
|
|
32
38
|
passed: z.boolean(),
|
|
33
39
|
violations: z.array(AstViolationSchema)
|
|
34
|
-
})
|
|
35
|
-
|
|
40
|
+
})
|
|
41
|
+
.strict();
|
|
42
|
+
export const ExternalApiCallSchema = z
|
|
43
|
+
.object({
|
|
36
44
|
file: z.string(),
|
|
37
45
|
line: z.number().int(),
|
|
38
46
|
api: z.string(),
|
|
39
47
|
version: z.string()
|
|
40
|
-
})
|
|
41
|
-
|
|
48
|
+
})
|
|
49
|
+
.strict();
|
|
50
|
+
export const ImplOutputSchema = z
|
|
51
|
+
.object({
|
|
42
52
|
version: z.literal('1.0'),
|
|
43
53
|
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
44
54
|
generatedAt: z.string().datetime(),
|
|
@@ -46,4 +56,5 @@ export const ImplOutputSchema = z.object({
|
|
|
46
56
|
changedFiles: z.array(z.string()),
|
|
47
57
|
externalApiCalls: z.array(ExternalApiCallSchema),
|
|
48
58
|
astGateResult: AstGateResultSchema
|
|
49
|
-
})
|
|
59
|
+
})
|
|
60
|
+
.strict();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "peaks-loop",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.11",
|
|
4
4
|
"description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
|
|
5
5
|
"author": "SquabbyZ",
|
|
6
6
|
"keywords": [
|
|
@@ -121,18 +121,18 @@
|
|
|
121
121
|
"node": ">=24.0.0"
|
|
122
122
|
},
|
|
123
123
|
"dependencies": {
|
|
124
|
-
"@alibaba-group/open-code-review": "^1.
|
|
124
|
+
"@alibaba-group/open-code-review": "^1.13.1",
|
|
125
125
|
"@colbymchenry/codegraph": "1.6.2",
|
|
126
|
-
"@upstash/context7-mcp": "^4.
|
|
126
|
+
"@upstash/context7-mcp": "^4.4.4",
|
|
127
127
|
"commander": "^12.1.0",
|
|
128
128
|
"fzf": "^0.5.2",
|
|
129
|
-
"picomatch": "4.0.
|
|
130
|
-
"yaml": "^2.9.
|
|
131
|
-
"zod": "^4.
|
|
132
|
-
"peaks-loop-internal-runtime": "0.0.
|
|
133
|
-
"peaks-loop-
|
|
134
|
-
"peaks-loop-
|
|
135
|
-
"peaks-loop-shared-channel": "0.0.
|
|
129
|
+
"picomatch": "4.0.7",
|
|
130
|
+
"yaml": "^2.9.1",
|
|
131
|
+
"zod": "^4.6.7",
|
|
132
|
+
"peaks-loop-internal-runtime": "0.0.51",
|
|
133
|
+
"peaks-loop-shared": "0.0.100",
|
|
134
|
+
"peaks-loop-mut": "0.1.65",
|
|
135
|
+
"peaks-loop-shared-channel": "0.0.68"
|
|
136
136
|
},
|
|
137
137
|
"devDependencies": {
|
|
138
138
|
"@changesets/cli": "2.31.1",
|
|
@@ -187,6 +187,38 @@ Both audit skills consume the immutable peaks-prd handoff (`prd/handoff.md`) and
|
|
|
187
187
|
|
|
188
188
|
Full dispatch contract (when-to-fan-out rules, dispatch template, prereq gates) lives in **`references/parallel-review-fanout.md`**. Read that file before issuing any 3-way fan-out.
|
|
189
189
|
|
|
190
|
+
### Gate B3 — OCR 1.x supplementary pass (wired 2026-10-20)
|
|
191
|
+
|
|
192
|
+
When the diff touches any language the OCR bridge routes, run it as part of code review and record the outcome in the RD code-review artifact. There are **two paths**, and delegation is the default one when no provider is configured.
|
|
193
|
+
|
|
194
|
+
**Delegated path — no API key, no provider config.** The packet → host review → record cycle:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
peaks code-review run-ocr-18 --delegate --rid <rid> --from <base> --to HEAD --json
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
writes `.peaks/_runtime/<sid>/rd/ocr-delegate/<rid>-packet.json` and returns it. The packet carries OCR's deterministic selection (each file with the pattern that selected it), the excluded files, the resolved rule text per group, the git range and the cost surface — nothing is LLM-generated. **You** then review the selected files against those rules with the model you are already running on, write a findings envelope to a file, and record it:
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
peaks code-review ocr-delegate-record --packet <packet-path> --envelope <path> --json
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
- Recorded findings keep the `Ocr18Finding` shape and carry `attribution: ocr-delegate`, so a host-model finding is never read as an OCR finding.
|
|
207
|
+
- A packet with no recorded envelope is **not executed** — never clean. The packet's `findings` is `null`; a recorded clean review has `findings: []`.
|
|
208
|
+
- The record verb refuses a malformed envelope (missing `path`/`content`, non-numeric line, unknown severity) and an envelope naming a different packet. Do not hand-edit its output.
|
|
209
|
+
- This path consumes your own context, not an API budget. Use the packet's cost surface to decide one pass or several.
|
|
210
|
+
|
|
211
|
+
**API path — a provider is configured.** Reviews once over the range with OCR's own agent:
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
peaks code-review run-ocr-18 --languages auto --from <base> --to HEAD --json
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
- `--languages auto` detects from the range and reviews **once**. A range with no routed language skips the invocation and says so — do not spawn OCR to discover there is nothing to review.
|
|
218
|
+
- Record four outcomes separately in `rd/code-review-<rid>.md`: languages with findings; languages detected with **zero** findings; files whose format is not reviewed as a routed language; and `OCR unavailable` with the `detect-ocr-18` state when it could not run. A missing run must never read as a clean review.
|
|
219
|
+
- TypeScript/JavaScript are **dual-track**: ESLint (`peaks lint check`, Gate B5) stays the primary gate, the OCR pass is supplementary. Attribute every finding to the tool that produced it, so a defect flagged twice is not counted twice.
|
|
220
|
+
- Real CLI surface, post-review scoping model, auto-detection, the four outcomes, both paths and the envelope: `references/ocr-multilang-1.8.md` §10 (rewritten for OCR 1.x; the old 1.8 content was wrong about `--filter-language`).
|
|
221
|
+
|
|
190
222
|
## Reviewer fan-out detached mode (Phase C, slice 2026-08-10)
|
|
191
223
|
|
|
192
224
|
Reviewer fan-out may run in detached mode for any of the 3-way fan-out roles (`code-reviewer`, `qa-test-cases-writer`, `karpathy-reviewer`). Detached mode spawns a real OS process via `peaks sub-agent dispatch --mode detached --vendor <vendor>`, isolated from the orchestrator session. Use detached mode when the reviewer's expected runtime exceeds 60s OR processes ≥ 20 source files. Pass `--mode detached` explicitly per reviewer role; the default remains `in-process` (backward compat). The karpathy-reviewer's `<peaks-auto-compact>` marker is honored automatically when `--mode detached` is used. Note what that marker does and does not do (corrected 2026-09-13, rid `2026-09-13-defects-e`): it asks the child to persist durable state to `.peaks/_runtime/<sid>/detached/<rid>/compact/<n>.json` before its own harness compacts the session — the child cannot compact itself, and nothing is spliced back into its prompt. See `../../peaks-code/references/sub-agent-dispatch.md` §"Detached Mode" for the full contract.
|
|
@@ -297,12 +329,34 @@ peaks-rd runs in two sub-stages:
|
|
|
297
329
|
Hard constraint: TACT.sig cannot be written when the AST gate has violations.
|
|
298
330
|
The LLM auto-fixes and retries (peaks-qa's 3-cycle repair cap).
|
|
299
331
|
|
|
332
|
+
Registered CLI surface (one-axis: `--session-id` required, every `--out` under
|
|
333
|
+
`.peaks/_runtime/<sid>/`):
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
peaks strat write --project <repo> --session-id <sid> \
|
|
337
|
+
--out .peaks/_runtime/<sid>/rd/strategy.md \
|
|
338
|
+
--goal <text> --root-cause <text> --impact <paths...> --design <text> --json
|
|
339
|
+
# writes strategy.md + its JSON sibling (.peaks/_runtime/<sid>/rd/strategy.md.json)
|
|
340
|
+
|
|
341
|
+
peaks tact write --project <repo> --session-id <sid> \
|
|
342
|
+
--strategy .peaks/_runtime/<sid>/rd/strategy.md.json \
|
|
343
|
+
--out .peaks/_runtime/<sid>/rd/impl.json \
|
|
344
|
+
--changed-files <paths...> [--ast-context '<json>'] --json
|
|
345
|
+
|
|
346
|
+
peaks tact read --artifact .peaks/_runtime/<sid>/rd/impl.json --project <repo> --json
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
`tact write` never accepts a raw `--input-sig`: it re-verifies the strategy
|
|
350
|
+
JSON's recomputed sha256 and refuses a tampered artifact. `tact read` does the
|
|
351
|
+
same for `impl.json` and prints `{ sha256, inputSig, changedFiles, astGateResult }`.
|
|
352
|
+
|
|
300
353
|
Karpathy guidelines remain injected in both sub-stages.
|
|
301
354
|
|
|
302
|
-
Public entry points (from `src/services/rd/rd-service.ts`)
|
|
355
|
+
Public entry points (from `src/services/rd/rd-service.ts`) are unchanged; the
|
|
356
|
+
commands above are thin wrappers over them:
|
|
303
357
|
|
|
304
|
-
- `runStrategic(input: RunStrategicInput): Promise<StrategyOutput>` — strategy writer
|
|
305
|
-
- `runTactical(input: RunTacticalInput): Promise<ImplOutput>` — runs AST gate then writes impl.json + TACT.sig chained to inputSig
|
|
358
|
+
- `runStrategic(input: RunStrategicInput): Promise<StrategyOutput>` — strategy writer (`peaks strat write`)
|
|
359
|
+
- `runTactical(input: RunTacticalInput): Promise<ImplOutput>` — runs AST gate then writes impl.json + TACT.sig chained to inputSig (`peaks tact write`)
|
|
306
360
|
|
|
307
361
|
## References
|
|
308
362
|
|