@olegkoval/agent-skills 1.89.0 → 1.90.0
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/adapters/claude/olko-github-pr/skills/lekker-review/SKILL.md +73 -5
- package/adapters/claude/olko-github-pr/skills/lekker-review/references/output-format.md +20 -0
- package/adapters/claude/olko-github-pr/skills/lekker-review/references/traces.md +1 -1
- package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/lekker-progress.mjs +106 -0
- package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/run-log.mjs +27 -2
- package/package.json +1 -1
- package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-github-pr/skills/lekker-review/README.md +14 -0
- package/plugins/olko-github-pr/skills/lekker-review/SKILL.md +73 -5
- package/plugins/olko-github-pr/skills/lekker-review/references/output-format.md +20 -0
- package/plugins/olko-github-pr/skills/lekker-review/references/traces.md +1 -1
- package/plugins/olko-github-pr/skills/lekker-review/scripts/lekker-progress.mjs +106 -0
- package/plugins/olko-github-pr/skills/lekker-review/scripts/run-log.mjs +27 -2
- package/plugins/olko-github-pr/skills/lekker-review/workflow.js +28 -0
- package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
|
@@ -46,7 +46,7 @@ metadata:
|
|
|
46
46
|
- multi-agent
|
|
47
47
|
- workflow
|
|
48
48
|
- quality
|
|
49
|
-
argument-hint: "<github-pr-url | repo pr-number | repo pr-title | branch [ref]> [scan|medium|deep|deps] [--post] [--fix] [--base <ref>] [--risk routine|standard|elevated|critical]"
|
|
49
|
+
argument-hint: "<github-pr-url | repo pr-number | repo pr-title | branch [ref]> [scan|medium|deep|deps] [--post] [--fix] [--base <ref>] [--risk routine|standard|elevated|critical] [--quiet-decisions]"
|
|
50
50
|
---
|
|
51
51
|
<!-- Generated by scripts/build-adapters.sh. Do not edit directly. -->
|
|
52
52
|
|
|
@@ -349,6 +349,10 @@ under "Models and effort".
|
|
|
349
349
|
|
|
350
350
|
**`--post` flag:** parse and store as `POST_REVIEW=true`.
|
|
351
351
|
|
|
352
|
+
**`--quiet-decisions` flag:** parse and store as `QUIET_DECISIONS=true`: the
|
|
353
|
+
saved review omits the `## 🧭 Decisions` block. The run log still records every
|
|
354
|
+
decision.
|
|
355
|
+
|
|
352
356
|
**`--fix` flag:** parse and store as `FIX_MODE=true`. Fix mode needs a real
|
|
353
357
|
checkout, so `--fix` forces Track A (worktree setup) to run even when
|
|
354
358
|
depth=scan. If the user did NOT pass `--fix`, leave `FIX_MODE=false` for now -
|
|
@@ -449,6 +453,54 @@ at each step boundary: `context` (Step 1), `review` (Step 2), `synthesis`
|
|
|
449
453
|
(Step 3), `fix` (Step 4), `post` (Step 5). A marker is one line of JSON; never
|
|
450
454
|
skip the review because the log failed, just say `run log unavailable`.
|
|
451
455
|
|
|
456
|
+
**Record the first decisions.** Right after `start`, write the two decisions made
|
|
457
|
+
before the log existed, one call each (`what` is the value, `why` the rule that
|
|
458
|
+
picked it, a short phrase; `--why` is mandatory):
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
node "${CLAUDE_PLUGIN_ROOT}/skills/lekker-review/scripts/run-log.mjs" decide <RUN_ID> --kind depth --what <depth> --why "<AUTO-DEPTH rule | explicit>"
|
|
462
|
+
node "${CLAUDE_PLUGIN_ROOT}/skills/lekker-review/scripts/run-log.mjs" decide <RUN_ID> --kind tier --what <tier> --why "<auto: reason | --risk>"
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
`decide` accepts only the kinds `depth`, `tier`, `route`, `finding`, `fix` and
|
|
466
|
+
`post`, and rejects an empty `--what` or `--why`; a failed call is
|
|
467
|
+
`run log unavailable`, never a reason to stop.
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## Progress line
|
|
472
|
+
|
|
473
|
+
At each milestone below, run
|
|
474
|
+
`node "${CLAUDE_PLUGIN_ROOT}/skills/lekker-review/scripts/lekker-progress.mjs" --stage <stage> --message "<short fact>"`
|
|
475
|
+
(foreground, it returns in under a second; in Codex use the absolute path to
|
|
476
|
+
`scripts/lekker-progress.mjs` beside the selected `SKILL.md`). It prints one
|
|
477
|
+
status line (a boat drifting toward a lighthouse), animates only on a real
|
|
478
|
+
terminal, and always exits 0. It is decoration: run it after the milestone's own
|
|
479
|
+
output, never instead of it, and keep every count and reason in the report too.
|
|
480
|
+
Add `--ascii` on terminals that mis-measure emoji.
|
|
481
|
+
|
|
482
|
+
| Milestone | Stage | Message, e.g. |
|
|
483
|
+
| --- | --- | --- |
|
|
484
|
+
| Step 0 parsed the request | `start` | `owner/repo#42, medium, tier standard` |
|
|
485
|
+
| Step 1 context ready | `context` | `worktree ready, 4 sources` |
|
|
486
|
+
| Step 2 workflow started | `review` | `5 specialists + rules` |
|
|
487
|
+
| Step 2 verify began | `verify` | `verifying 6 findings` |
|
|
488
|
+
| Step 2 critic began (deep) | `critic` | `3 angles to re-examine` |
|
|
489
|
+
| Step 2 prove began | `prove` | `2 provers` |
|
|
490
|
+
| Step 3 review saved | `post` | `saved, 1 Critical, 2 Important` |
|
|
491
|
+
| Step 4 fixes applied | `fix` | `3 of 4 applied` |
|
|
492
|
+
| Step 5 posted | `post` | `5 inline comments, pending` |
|
|
493
|
+
| Run finished | `success` | `lgtm-with-changes, 1 Important` |
|
|
494
|
+
| Run failed or stopped | `failure` | `worktree setup failed` |
|
|
495
|
+
|
|
496
|
+
Every decision you write with `run-log.mjs decide` is also printed once, right
|
|
497
|
+
after it, with `--stage decision --message "<what>: <why>"`. That prints a
|
|
498
|
+
compass line without moving the boat, for example `verifier -> opus high:
|
|
499
|
+
elevated, migrations`, `dropped src/a.ts:12: not reachable from any caller`, or
|
|
500
|
+
`code smell kept as Idiomatic: duplicated tie-break, two copies disagree`. For
|
|
501
|
+
the workflow's bulk `decisions`, print the `route` entries as one line and each
|
|
502
|
+
`finding` entry on its own line.
|
|
503
|
+
|
|
452
504
|
---
|
|
453
505
|
|
|
454
506
|
## Depth gate
|
|
@@ -894,10 +946,20 @@ high. Only the synthesis in Step 3 runs on the session model. The workflow
|
|
|
894
946
|
returns the routes it used as `routing`; quote them in the Review Cost block.
|
|
895
947
|
|
|
896
948
|
Return value from the workflow:
|
|
897
|
-
`{engine, findings, droppedCount, downgradedCount, hardRuleCount, proveAttemptCount, provenCount, acCoverage, coverageVerdict, mutationSlip, mockSmells, agentCount, outputTokens, turnTokensTotal}`
|
|
949
|
+
`{engine, findings, decisions, droppedCount, downgradedCount, hardRuleCount, proveAttemptCount, provenCount, acCoverage, coverageVerdict, mutationSlip, mockSmells, agentCount, outputTokens, turnTokensTotal}`
|
|
898
950
|
`outputTokens` is this workflow's own output spend; `turnTokensTotal` is the
|
|
899
951
|
whole turn's shared pool (main loop included).
|
|
900
952
|
|
|
953
|
+
`decisions` is `[{kind, what, why}]`: one `route` entry per role and one
|
|
954
|
+
`finding` entry per Critical/Important the verifier ruled on (kept, downgraded
|
|
955
|
+
or dropped, with its one-line reason). The workflow also `log()`s each as it is
|
|
956
|
+
decided, but it cannot write files, so right after it returns write them to the
|
|
957
|
+
run log in one call (a missing `decisions` on a host that returns none is fine):
|
|
958
|
+
`node "${CLAUDE_PLUGIN_ROOT}/skills/lekker-review/scripts/run-log.mjs" decide <RUN_ID> --from-json <scratchpad>/decisions.json`,
|
|
959
|
+
with `decisions` saved to `<scratchpad>/decisions.json` first. The Codex and
|
|
960
|
+
revmux engines return no `decisions`; write only the `depth` and `tier`
|
|
961
|
+
entries for them.
|
|
962
|
+
|
|
901
963
|
Wait for the workflow to complete before proceeding to Step 3.
|
|
902
964
|
|
|
903
965
|
### ENGINE=revmux
|
|
@@ -1249,7 +1311,10 @@ the run (review and fix) and
|
|
|
1249
1311
|
`--artifact-url`: the newest row wins. A run that dies part-way still gets
|
|
1250
1312
|
`node "${CLAUDE_PLUGIN_ROOT}/skills/lekker-review/scripts/run-log.mjs" finish <RUN_ID> --status failed --note <why>`.
|
|
1251
1313
|
|
|
1252
|
-
Then print the full review as the response.
|
|
1314
|
+
Then print the full review as the response. Unless `QUIET_DECISIONS=true`, or
|
|
1315
|
+
the run log was unavailable, it carries the `## 🧭 Decisions` block from
|
|
1316
|
+
`references/output-format.md`, built only from the decisions written to the run
|
|
1317
|
+
log, and saved in the review file with it.
|
|
1253
1318
|
|
|
1254
1319
|
**Closer goes last.** The run's FINAL message (this one, or the later summary
|
|
1255
1320
|
after Step 4 / 4.6 / 5 when those run) ends with `CLOSER.md_terminal` as its
|
|
@@ -1378,7 +1443,9 @@ Read `references/fix-mode.md` and follow it. Shape of the run:
|
|
|
1378
1443
|
confirm it equals `$worktree_head_sha`. Then refresh the review marker for
|
|
1379
1444
|
the new sha (Step 3).
|
|
1380
1445
|
8. Print the per-finding status table and append `## 🔧 Fixes applied` to the
|
|
1381
|
-
saved review file.
|
|
1446
|
+
saved review file. Record each applied finding, and each one skipped, with
|
|
1447
|
+
`run-log.mjs decide <RUN_ID> --kind fix --what "<file:line title>" --why "<applied | skipped: reason>"`
|
|
1448
|
+
(or one `--from-json` call).
|
|
1382
1449
|
|
|
1383
1450
|
Fix-agent tokens are additional spend: add a `Fix agents:` line to the
|
|
1384
1451
|
`## 💰 Review Cost` block.
|
|
@@ -1470,7 +1537,8 @@ Follow `references/github-post.md`:
|
|
|
1470
1537
|
- POST via `gh api repos/<REPO_SLUG>/pulls/<PR_NUMBER>/reviews` with NO
|
|
1471
1538
|
`event` field (creates PENDING, visible only to you).
|
|
1472
1539
|
- Verify post-condition: fetch review list, confirm PENDING state exists.
|
|
1473
|
-
- Print count + link
|
|
1540
|
+
- Print count + link, and record it with
|
|
1541
|
+
`run-log.mjs decide <RUN_ID> --kind post --what "<N inline comments + body>" --why "<what was left out and why, or 'all Critical/Important posted'>"`.
|
|
1474
1542
|
- Observation and Idiomatic findings go in the review body, never inline.
|
|
1475
1543
|
- When `CLOSER` is set, its `md_github` is the last thing in the review body.
|
|
1476
1544
|
- Never submit the review programmatically.
|
|
@@ -230,6 +230,26 @@ section if empty.)*
|
|
|
230
230
|
|
|
231
231
|
---
|
|
232
232
|
|
|
233
|
+
## 🧭 Decisions
|
|
234
|
+
|
|
235
|
+
*(Why the run went the way it did. Built from the decisions written to the run
|
|
236
|
+
log; omit the whole section with `--quiet-decisions`, and when the run log is
|
|
237
|
+
unavailable.)*
|
|
238
|
+
|
|
239
|
+
- **Depth:** <depth>, <the AUTO-DEPTH rule or "explicit">
|
|
240
|
+
- **Tier:** <tier> (<auto: reason | --risk>)
|
|
241
|
+
- **Routes:** <role> <model> [<effort>] · <role> <model> [<effort>] · ... (<"risk tier routing" | "default model">)
|
|
242
|
+
- **Findings:** <K> kept · <D> downgraded · <X> dropped *(Critical/Important only, counted from the `finding` decisions)*
|
|
243
|
+
- <kept | downgraded | dropped> `<file:line>` <title>: <verifier's one-line reason>
|
|
244
|
+
|
|
245
|
+
Exact rules: one bullet per Critical/Important finding the verifier ruled on,
|
|
246
|
+
in the order they were decided, reason copied from the decision's `why` without
|
|
247
|
+
the leading outcome word. No bullets and `Findings: none verified` when no
|
|
248
|
+
`finding` decisions exist (for example `scan` with no Criticals, or the revmux
|
|
249
|
+
engine). Never add decisions that were not written to the run log.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
233
253
|
## 💰 Review Cost
|
|
234
254
|
|
|
235
255
|
```
|
|
@@ -6,7 +6,7 @@ points at, and copies the numbers out of, everything else.
|
|
|
6
6
|
| Trace | Path | Written by | Kept | What it answers |
|
|
7
7
|
|---|---|---|---|---|
|
|
8
8
|
| Run ledger | `~/.local/state/lekker-review/runs.jsonl` | `scripts/run-log.mjs finish`, `backfill` | forever (one line per run) | how long, how many tokens, findings, drops, proofs, verdict, per engine and depth |
|
|
9
|
-
| Run archive | `~/.local/state/lekker-review/runs/<runId>/` | `run-log.mjs start/mark/attach/finish` | 90 days (`prune`) | `run.json` with timeline, plus the run's `findings.json`, `worktree.json`, `preflight.json`, `context.json` |
|
|
9
|
+
| Run archive | `~/.local/state/lekker-review/runs/<runId>/` | `run-log.mjs start/mark/decide/attach/finish` | 90 days (`prune`) | `run.json` with timeline and decisions (also appended live to `timeline.jsonl`), plus the run's `findings.json`, `worktree.json`, `preflight.json`, `context.json` |
|
|
10
10
|
| Dependency ledger | `~/.local/state/lekker-review/deps.json` | `scripts/deps.mjs` | forever | which optional tools were installed or skipped, versions, last upstream check |
|
|
11
11
|
| Review report | `~/code-reviews/<date>-<target>-<repo>.md` | Step 3 | forever | the review as printed, including the `Review Cost` block |
|
|
12
12
|
| revmux archive | `~/code-reviews/revmux-tasks/<task>/<NN-run>/` | revmux, plus `revmux.stderr.log` from `scripts/revmux-engine.sh` | forever, never edit | `events.jsonl` (agent start, degraded, retried), `agents/*.jsonl` (per-agent cost and usage), `revmux.stderr.log` (why a round degraded; rounds before 2026-10-20 have none) |
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// One-line progress status for lekker-review: a boat drifts over a tide line toward a lighthouse.
|
|
3
|
+
//
|
|
4
|
+
// Usage: node lekker-progress.mjs --stage <stage> --message "<short fact>" [--ascii]
|
|
5
|
+
//
|
|
6
|
+
// Each call prints exactly one line and exits 0, even on bad arguments. On a TTY it first animates
|
|
7
|
+
// the drift on that line (at most 10 fps, under a second); anywhere else (captured tool output, a
|
|
8
|
+
// log) or with NO_COLOR or --ascii it prints the final frame only, with no escape codes.
|
|
9
|
+
// The `decision` stage prints a compass line and leaves the boat where it was.
|
|
10
|
+
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
12
|
+
|
|
13
|
+
export const SLOTS = 8;
|
|
14
|
+
export const MAX_WIDTH = 72;
|
|
15
|
+
const FRAME_MS = 100;
|
|
16
|
+
|
|
17
|
+
// stage -> [slot the boat reaches, mood, default message]
|
|
18
|
+
export const STAGES = {
|
|
19
|
+
start: [0, 'neutral', 'parsed the request'],
|
|
20
|
+
context: [1, 'neutral', 'context ready'],
|
|
21
|
+
review: [2, 'neutral', 'review agents started'],
|
|
22
|
+
verify: [3, 'neutral', 'verifying findings'],
|
|
23
|
+
critic: [4, 'neutral', 'completeness critic'],
|
|
24
|
+
prove: [5, 'neutral', 'proving bugs with tests'],
|
|
25
|
+
fix: [6, 'neutral', 'applying fixes'],
|
|
26
|
+
post: [7, 'neutral', 'posting the review'],
|
|
27
|
+
success: [SLOTS, 'happy', 'review saved'],
|
|
28
|
+
failure: [4, 'sad', 'review stopped'],
|
|
29
|
+
decision: [null, 'neutral', 'decision'],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const GLYPHS = {
|
|
33
|
+
false: { boat: '⛵', light: '🗼', tide: ' ~', compass: '🧭 ', neutral: '', happy: '😌', sad: '🌧️' },
|
|
34
|
+
true: { boat: '^', light: 'I', tide: '.', compass: '> ', neutral: '', happy: '(^o^)', sad: '(T.T)' },
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const WIDE = [[0x1100, 0x115f], [0x231a, 0x231b], [0x23e9, 0x23ec], [0x25fd, 0x25fe], [0x2614, 0x2615],
|
|
38
|
+
[0x2693, 0x2693], [0x26a1, 0x26a1], [0x26f5, 0x26f5], [0x2e80, 0xa4cf], [0xac00, 0xd7a3],
|
|
39
|
+
[0xf900, 0xfaff], [0xfe30, 0xfe6f], [0xff00, 0xff60], [0xffe0, 0xffe6], [0x1f000, 0x1ffff]];
|
|
40
|
+
|
|
41
|
+
function cellWidth(ch) {
|
|
42
|
+
const cp = ch.codePointAt(0);
|
|
43
|
+
if (/\p{M}/u.test(ch) || cp === 0x200d || cp === 0xfe0f) return 0;
|
|
44
|
+
return WIDE.some(([lo, hi]) => cp >= lo && cp <= hi) ? 2 : 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const width = (text) => [...text].reduce((n, ch) => n + cellWidth(ch), 0);
|
|
48
|
+
|
|
49
|
+
export function truncate(text, limit) {
|
|
50
|
+
const { out, done } = [...text].reduce((acc, ch) => {
|
|
51
|
+
if (acc.done) return acc;
|
|
52
|
+
const next = acc.used + cellWidth(ch);
|
|
53
|
+
return next > limit - 1 ? { ...acc, done: true } : { out: acc.out + ch, used: next, done: false };
|
|
54
|
+
}, { out: '', used: 0, done: false });
|
|
55
|
+
return done ? `${out}…` : out;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const oneLine = (text) => String(text ?? '').split(/\s+/).filter(Boolean).join(' ');
|
|
59
|
+
const fit = (line) => (width(line) <= MAX_WIDTH ? line : truncate(line, MAX_WIDTH));
|
|
60
|
+
|
|
61
|
+
function track(slot, glyphs) {
|
|
62
|
+
const cells = Array.from({ length: SLOTS + 1 }, (_, i) => (i === SLOTS ? glyphs.light : glyphs.tide));
|
|
63
|
+
return cells.map((cell, i) => (i === Math.min(slot, SLOTS) ? glyphs.boat : cell)).join('');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Pure: `tick` is the boat's slot. The mood face shows once the boat has arrived.
|
|
67
|
+
export function frame(stage, tick, { message, ascii = false } = {}) {
|
|
68
|
+
const spec = STAGES[stage];
|
|
69
|
+
const glyphs = GLYPHS[ascii === true];
|
|
70
|
+
const text = oneLine(message ?? spec?.[2] ?? '');
|
|
71
|
+
if (!spec) return fit(`lekker: ${text || stage || 'progress'}`);
|
|
72
|
+
const [target, mood] = spec;
|
|
73
|
+
if (target === null) return fit(`${glyphs.compass}${text || spec[2]}`);
|
|
74
|
+
const face = tick >= target ? glyphs[mood] : '';
|
|
75
|
+
return fit(`${`${track(tick, glyphs)} ${face}`.trimEnd()} ${stage}: ${text}`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const arg = (argv, name) => {
|
|
79
|
+
const i = argv.indexOf(`--${name}`);
|
|
80
|
+
return i === -1 ? undefined : argv[i + 1];
|
|
81
|
+
};
|
|
82
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
83
|
+
|
|
84
|
+
async function main(argv) {
|
|
85
|
+
const stage = arg(argv, 'stage') ?? '';
|
|
86
|
+
const message = arg(argv, 'message');
|
|
87
|
+
const ascii = argv.includes('--ascii') || Boolean(process.env.LEKKER_PROGRESS_ASCII);
|
|
88
|
+
const spec = STAGES[stage];
|
|
89
|
+
const animate = process.stdout.isTTY === true && !process.env.NO_COLOR && !ascii && Array.isArray(spec) && spec[0] !== null;
|
|
90
|
+
if (animate) {
|
|
91
|
+
const target = spec[0];
|
|
92
|
+
const slots = Array.from({ length: Math.min(3, target) }, (_, i) => target - 3 + i).filter((s) => s >= 0);
|
|
93
|
+
for (const slot of slots) {
|
|
94
|
+
process.stdout.write(`\r\x1b[2K${frame(stage, slot, { message, ascii })}`);
|
|
95
|
+
await sleep(FRAME_MS);
|
|
96
|
+
}
|
|
97
|
+
process.stdout.write('\r\x1b[2K');
|
|
98
|
+
}
|
|
99
|
+
const target = spec && spec[0] !== null ? spec[0] : 0;
|
|
100
|
+
process.stdout.write(`${frame(stage, target, { message, ascii })}\n`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
104
|
+
try { await main(process.argv.slice(2)); } catch { /* decoration must never fail a review */ }
|
|
105
|
+
process.exitCode = 0;
|
|
106
|
+
}
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
// node run-log.mjs start --repo <slug> --target <pr-N|branch-x> --mode pr|branch \
|
|
12
12
|
// --depth <d> --engine workflow|revmux [--fix] [--host claude]
|
|
13
13
|
// node run-log.mjs mark <runId> <phase> [--note <text>]
|
|
14
|
+
// node run-log.mjs decide <runId> --kind depth|tier|route|finding|fix|post --what <text> --why <text>
|
|
15
|
+
// node run-log.mjs decide <runId> --from-json <file> array of {kind, what, why}
|
|
14
16
|
// node run-log.mjs attach <runId> <file>...
|
|
15
17
|
// node run-log.mjs finish <runId> --status ok|failed|aborted [--verdict lgtm|lgtm-with-changes|needs-work]
|
|
16
18
|
// [--review-file <path>] [--artifact-url <url>] [--wf <wf_id>]... [--note <text>]
|
|
@@ -37,6 +39,7 @@ const LEDGER = join(STATE_DIR, 'runs.jsonl');
|
|
|
37
39
|
const PROJECTS_DIR = process.env.LEKKER_CLAUDE_PROJECTS || join(homedir(), '.claude', 'projects');
|
|
38
40
|
const REVMUX_TASKS = process.env.LEKKER_REVMUX_TASKS_DIR || join(homedir(), 'code-reviews', 'revmux-tasks');
|
|
39
41
|
|
|
42
|
+
const DECISION_KINDS = ['depth', 'tier', 'route', 'finding', 'fix', 'post'];
|
|
40
43
|
const argv = process.argv.slice(2);
|
|
41
44
|
const cmd = argv[0];
|
|
42
45
|
|
|
@@ -171,6 +174,25 @@ if (cmd === 'start') {
|
|
|
171
174
|
if (!existsSync(dir)) fail(`no run ${runId}`);
|
|
172
175
|
appendFileSync(join(dir, 'timeline.jsonl'), JSON.stringify({ phase, at: new Date().toISOString(), note: flag('note') ?? undefined }) + '\n');
|
|
173
176
|
console.log(JSON.stringify({ runId, phase }));
|
|
177
|
+
} else if (cmd === 'decide') {
|
|
178
|
+
const runId = argv[1];
|
|
179
|
+
const dir = runDir(runId);
|
|
180
|
+
if (!existsSync(dir)) fail(`no run ${runId}`);
|
|
181
|
+
const fromJson = flag('from-json');
|
|
182
|
+
const raw = fromJson ? readJson(fromJson) : [{ kind: flag('kind'), what: flag('what'), why: flag('why') }];
|
|
183
|
+
if (!Array.isArray(raw)) fail(`--from-json ${fromJson} must hold an array of {kind, what, why}`);
|
|
184
|
+
const text = (v) => (typeof v === 'string' ? v.replace(/\s+/g, ' ').trim() : '');
|
|
185
|
+
const rows = raw.map((d, i) => ({ kind: text(d?.kind), what: text(d?.what), why: text(d?.why), i }));
|
|
186
|
+
const bad = rows.find((r) => !DECISION_KINDS.includes(r.kind) || !r.what || !r.why);
|
|
187
|
+
if (bad) {
|
|
188
|
+
fail(!DECISION_KINDS.includes(bad.kind)
|
|
189
|
+
? `decision ${bad.i}: unknown kind "${bad.kind}" (use ${DECISION_KINDS.join('|')})`
|
|
190
|
+
: `decision ${bad.i}: --what and --why must be non-empty`);
|
|
191
|
+
}
|
|
192
|
+
const at = new Date().toISOString();
|
|
193
|
+
const lines = rows.map(({ kind, what, why }) => JSON.stringify({ at, kind, what, why }) + '\n').join('');
|
|
194
|
+
appendFileSync(join(dir, 'timeline.jsonl'), lines);
|
|
195
|
+
console.log(JSON.stringify({ runId, decisions: rows.length }));
|
|
174
196
|
} else if (cmd === 'attach') {
|
|
175
197
|
const runId = argv[1];
|
|
176
198
|
const dir = runDir(runId);
|
|
@@ -188,7 +210,10 @@ if (cmd === 'start') {
|
|
|
188
210
|
const meta = readJson(join(dir, 'run.json'));
|
|
189
211
|
if (!meta) fail(`no run ${runId}`);
|
|
190
212
|
const finishedAt = new Date().toISOString();
|
|
191
|
-
const
|
|
213
|
+
const rows = readJsonl(join(dir, 'timeline.jsonl'));
|
|
214
|
+
// Decision rows have no phase; keeping them out of the timeline keeps phaseDurations exact.
|
|
215
|
+
const timeline = [...rows.filter((r) => r.phase && r.phase !== 'finish'), { phase: 'finish', at: finishedAt }];
|
|
216
|
+
const decisions = rows.filter((r) => r.kind);
|
|
192
217
|
const workflows = flags('wf').map((id) => summariseWorkflow(findWorkflowRecord(id) || { runId: id }));
|
|
193
218
|
const reviewWf = workflows.find((w) => w.name === 'lekker-review-core') || null;
|
|
194
219
|
const row = {
|
|
@@ -206,7 +231,7 @@ if (cmd === 'start') {
|
|
|
206
231
|
artifactUrl: flag('artifact-url'),
|
|
207
232
|
note: flag('note', meta.note ?? null),
|
|
208
233
|
};
|
|
209
|
-
writeFileSync(join(dir, 'run.json'), JSON.stringify({ ...row, timeline }, null, 2) + '\n');
|
|
234
|
+
writeFileSync(join(dir, 'run.json'), JSON.stringify({ ...row, timeline, decisions }, null, 2) + '\n');
|
|
210
235
|
append(row);
|
|
211
236
|
const unresolved = workflows.filter((w) => w.durationS == null).map((w) => w.wfId);
|
|
212
237
|
console.log(JSON.stringify({ runId, ledger: LEDGER, wallS: row.wallS, tokensTotal: row.tokensTotal, unresolvedWorkflows: unresolved }));
|
package/package.json
CHANGED
|
@@ -106,6 +106,20 @@ Depth is auto-selected from the diff size when you do not name one: `scan` under
|
|
|
106
106
|
150 changed lines and 5 files, `deep` over 800 changed lines or 25 files or when
|
|
107
107
|
the diff touches migrations or `*.sql`, `medium` otherwise.
|
|
108
108
|
|
|
109
|
+
## Progress and decisions
|
|
110
|
+
|
|
111
|
+
Every run keeps a decision log: the depth and why, the risk tier and why, the
|
|
112
|
+
model each role got, and for each Critical or Important finding whether the
|
|
113
|
+
verifier kept, downgraded or dropped it, with its one-line reason. The same
|
|
114
|
+
lines end up in the saved review under `## 🧭 Decisions`; `--quiet-decisions`
|
|
115
|
+
leaves that block out (the log still records everything).
|
|
116
|
+
|
|
117
|
+
While it runs, the skill prints one status line per milestone with
|
|
118
|
+
`scripts/lekker-progress.mjs --stage <stage> --message "<fact>"`: a small boat
|
|
119
|
+
drifting over a tide line toward a lighthouse, and a `🧭` compass line for each
|
|
120
|
+
decision. It animates only on a real terminal; in captured output, with
|
|
121
|
+
`NO_COLOR`, or with `--ascii` it prints a single plain line with no escape codes.
|
|
122
|
+
|
|
109
123
|
## Regenerating the posters
|
|
110
124
|
|
|
111
125
|
The posters are self-contained HTML in `assets/`. Open either file in a browser
|
|
@@ -46,7 +46,7 @@ metadata:
|
|
|
46
46
|
- multi-agent
|
|
47
47
|
- workflow
|
|
48
48
|
- quality
|
|
49
|
-
argument-hint: "<github-pr-url | repo pr-number | repo pr-title | branch [ref]> [scan|medium|deep|deps] [--post] [--fix] [--base <ref>] [--risk routine|standard|elevated|critical]"
|
|
49
|
+
argument-hint: "<github-pr-url | repo pr-number | repo pr-title | branch [ref]> [scan|medium|deep|deps] [--post] [--fix] [--base <ref>] [--risk routine|standard|elevated|critical] [--quiet-decisions]"
|
|
50
50
|
---
|
|
51
51
|
|
|
52
52
|
# Lekker Review
|
|
@@ -348,6 +348,10 @@ under "Models and effort".
|
|
|
348
348
|
|
|
349
349
|
**`--post` flag:** parse and store as `POST_REVIEW=true`.
|
|
350
350
|
|
|
351
|
+
**`--quiet-decisions` flag:** parse and store as `QUIET_DECISIONS=true`: the
|
|
352
|
+
saved review omits the `## 🧭 Decisions` block. The run log still records every
|
|
353
|
+
decision.
|
|
354
|
+
|
|
351
355
|
**`--fix` flag:** parse and store as `FIX_MODE=true`. Fix mode needs a real
|
|
352
356
|
checkout, so `--fix` forces Track A (worktree setup) to run even when
|
|
353
357
|
depth=scan. If the user did NOT pass `--fix`, leave `FIX_MODE=false` for now -
|
|
@@ -448,6 +452,54 @@ at each step boundary: `context` (Step 1), `review` (Step 2), `synthesis`
|
|
|
448
452
|
(Step 3), `fix` (Step 4), `post` (Step 5). A marker is one line of JSON; never
|
|
449
453
|
skip the review because the log failed, just say `run log unavailable`.
|
|
450
454
|
|
|
455
|
+
**Record the first decisions.** Right after `start`, write the two decisions made
|
|
456
|
+
before the log existed, one call each (`what` is the value, `why` the rule that
|
|
457
|
+
picked it, a short phrase; `--why` is mandatory):
|
|
458
|
+
|
|
459
|
+
```bash
|
|
460
|
+
node "${CLAUDE_PLUGIN_ROOT}/skills/lekker-review/scripts/run-log.mjs" decide <RUN_ID> --kind depth --what <depth> --why "<AUTO-DEPTH rule | explicit>"
|
|
461
|
+
node "${CLAUDE_PLUGIN_ROOT}/skills/lekker-review/scripts/run-log.mjs" decide <RUN_ID> --kind tier --what <tier> --why "<auto: reason | --risk>"
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
`decide` accepts only the kinds `depth`, `tier`, `route`, `finding`, `fix` and
|
|
465
|
+
`post`, and rejects an empty `--what` or `--why`; a failed call is
|
|
466
|
+
`run log unavailable`, never a reason to stop.
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## Progress line
|
|
471
|
+
|
|
472
|
+
At each milestone below, run
|
|
473
|
+
`node "${CLAUDE_PLUGIN_ROOT}/skills/lekker-review/scripts/lekker-progress.mjs" --stage <stage> --message "<short fact>"`
|
|
474
|
+
(foreground, it returns in under a second; in Codex use the absolute path to
|
|
475
|
+
`scripts/lekker-progress.mjs` beside the selected `SKILL.md`). It prints one
|
|
476
|
+
status line (a boat drifting toward a lighthouse), animates only on a real
|
|
477
|
+
terminal, and always exits 0. It is decoration: run it after the milestone's own
|
|
478
|
+
output, never instead of it, and keep every count and reason in the report too.
|
|
479
|
+
Add `--ascii` on terminals that mis-measure emoji.
|
|
480
|
+
|
|
481
|
+
| Milestone | Stage | Message, e.g. |
|
|
482
|
+
| --- | --- | --- |
|
|
483
|
+
| Step 0 parsed the request | `start` | `owner/repo#42, medium, tier standard` |
|
|
484
|
+
| Step 1 context ready | `context` | `worktree ready, 4 sources` |
|
|
485
|
+
| Step 2 workflow started | `review` | `5 specialists + rules` |
|
|
486
|
+
| Step 2 verify began | `verify` | `verifying 6 findings` |
|
|
487
|
+
| Step 2 critic began (deep) | `critic` | `3 angles to re-examine` |
|
|
488
|
+
| Step 2 prove began | `prove` | `2 provers` |
|
|
489
|
+
| Step 3 review saved | `post` | `saved, 1 Critical, 2 Important` |
|
|
490
|
+
| Step 4 fixes applied | `fix` | `3 of 4 applied` |
|
|
491
|
+
| Step 5 posted | `post` | `5 inline comments, pending` |
|
|
492
|
+
| Run finished | `success` | `lgtm-with-changes, 1 Important` |
|
|
493
|
+
| Run failed or stopped | `failure` | `worktree setup failed` |
|
|
494
|
+
|
|
495
|
+
Every decision you write with `run-log.mjs decide` is also printed once, right
|
|
496
|
+
after it, with `--stage decision --message "<what>: <why>"`. That prints a
|
|
497
|
+
compass line without moving the boat, for example `verifier -> opus high:
|
|
498
|
+
elevated, migrations`, `dropped src/a.ts:12: not reachable from any caller`, or
|
|
499
|
+
`code smell kept as Idiomatic: duplicated tie-break, two copies disagree`. For
|
|
500
|
+
the workflow's bulk `decisions`, print the `route` entries as one line and each
|
|
501
|
+
`finding` entry on its own line.
|
|
502
|
+
|
|
451
503
|
---
|
|
452
504
|
|
|
453
505
|
## Depth gate
|
|
@@ -893,10 +945,20 @@ high. Only the synthesis in Step 3 runs on the session model. The workflow
|
|
|
893
945
|
returns the routes it used as `routing`; quote them in the Review Cost block.
|
|
894
946
|
|
|
895
947
|
Return value from the workflow:
|
|
896
|
-
`{engine, findings, droppedCount, downgradedCount, hardRuleCount, proveAttemptCount, provenCount, acCoverage, coverageVerdict, mutationSlip, mockSmells, agentCount, outputTokens, turnTokensTotal}`
|
|
948
|
+
`{engine, findings, decisions, droppedCount, downgradedCount, hardRuleCount, proveAttemptCount, provenCount, acCoverage, coverageVerdict, mutationSlip, mockSmells, agentCount, outputTokens, turnTokensTotal}`
|
|
897
949
|
`outputTokens` is this workflow's own output spend; `turnTokensTotal` is the
|
|
898
950
|
whole turn's shared pool (main loop included).
|
|
899
951
|
|
|
952
|
+
`decisions` is `[{kind, what, why}]`: one `route` entry per role and one
|
|
953
|
+
`finding` entry per Critical/Important the verifier ruled on (kept, downgraded
|
|
954
|
+
or dropped, with its one-line reason). The workflow also `log()`s each as it is
|
|
955
|
+
decided, but it cannot write files, so right after it returns write them to the
|
|
956
|
+
run log in one call (a missing `decisions` on a host that returns none is fine):
|
|
957
|
+
`node "${CLAUDE_PLUGIN_ROOT}/skills/lekker-review/scripts/run-log.mjs" decide <RUN_ID> --from-json <scratchpad>/decisions.json`,
|
|
958
|
+
with `decisions` saved to `<scratchpad>/decisions.json` first. The Codex and
|
|
959
|
+
revmux engines return no `decisions`; write only the `depth` and `tier`
|
|
960
|
+
entries for them.
|
|
961
|
+
|
|
900
962
|
Wait for the workflow to complete before proceeding to Step 3.
|
|
901
963
|
|
|
902
964
|
### ENGINE=revmux
|
|
@@ -1248,7 +1310,10 @@ the run (review and fix) and
|
|
|
1248
1310
|
`--artifact-url`: the newest row wins. A run that dies part-way still gets
|
|
1249
1311
|
`node "${CLAUDE_PLUGIN_ROOT}/skills/lekker-review/scripts/run-log.mjs" finish <RUN_ID> --status failed --note <why>`.
|
|
1250
1312
|
|
|
1251
|
-
Then print the full review as the response.
|
|
1313
|
+
Then print the full review as the response. Unless `QUIET_DECISIONS=true`, or
|
|
1314
|
+
the run log was unavailable, it carries the `## 🧭 Decisions` block from
|
|
1315
|
+
`references/output-format.md`, built only from the decisions written to the run
|
|
1316
|
+
log, and saved in the review file with it.
|
|
1252
1317
|
|
|
1253
1318
|
**Closer goes last.** The run's FINAL message (this one, or the later summary
|
|
1254
1319
|
after Step 4 / 4.6 / 5 when those run) ends with `CLOSER.md_terminal` as its
|
|
@@ -1377,7 +1442,9 @@ Read `references/fix-mode.md` and follow it. Shape of the run:
|
|
|
1377
1442
|
confirm it equals `$worktree_head_sha`. Then refresh the review marker for
|
|
1378
1443
|
the new sha (Step 3).
|
|
1379
1444
|
8. Print the per-finding status table and append `## 🔧 Fixes applied` to the
|
|
1380
|
-
saved review file.
|
|
1445
|
+
saved review file. Record each applied finding, and each one skipped, with
|
|
1446
|
+
`run-log.mjs decide <RUN_ID> --kind fix --what "<file:line title>" --why "<applied | skipped: reason>"`
|
|
1447
|
+
(or one `--from-json` call).
|
|
1381
1448
|
|
|
1382
1449
|
Fix-agent tokens are additional spend: add a `Fix agents:` line to the
|
|
1383
1450
|
`## 💰 Review Cost` block.
|
|
@@ -1469,7 +1536,8 @@ Follow `references/github-post.md`:
|
|
|
1469
1536
|
- POST via `gh api repos/<REPO_SLUG>/pulls/<PR_NUMBER>/reviews` with NO
|
|
1470
1537
|
`event` field (creates PENDING, visible only to you).
|
|
1471
1538
|
- Verify post-condition: fetch review list, confirm PENDING state exists.
|
|
1472
|
-
- Print count + link
|
|
1539
|
+
- Print count + link, and record it with
|
|
1540
|
+
`run-log.mjs decide <RUN_ID> --kind post --what "<N inline comments + body>" --why "<what was left out and why, or 'all Critical/Important posted'>"`.
|
|
1473
1541
|
- Observation and Idiomatic findings go in the review body, never inline.
|
|
1474
1542
|
- When `CLOSER` is set, its `md_github` is the last thing in the review body.
|
|
1475
1543
|
- Never submit the review programmatically.
|
|
@@ -230,6 +230,26 @@ section if empty.)*
|
|
|
230
230
|
|
|
231
231
|
---
|
|
232
232
|
|
|
233
|
+
## 🧭 Decisions
|
|
234
|
+
|
|
235
|
+
*(Why the run went the way it did. Built from the decisions written to the run
|
|
236
|
+
log; omit the whole section with `--quiet-decisions`, and when the run log is
|
|
237
|
+
unavailable.)*
|
|
238
|
+
|
|
239
|
+
- **Depth:** <depth>, <the AUTO-DEPTH rule or "explicit">
|
|
240
|
+
- **Tier:** <tier> (<auto: reason | --risk>)
|
|
241
|
+
- **Routes:** <role> <model> [<effort>] · <role> <model> [<effort>] · ... (<"risk tier routing" | "default model">)
|
|
242
|
+
- **Findings:** <K> kept · <D> downgraded · <X> dropped *(Critical/Important only, counted from the `finding` decisions)*
|
|
243
|
+
- <kept | downgraded | dropped> `<file:line>` <title>: <verifier's one-line reason>
|
|
244
|
+
|
|
245
|
+
Exact rules: one bullet per Critical/Important finding the verifier ruled on,
|
|
246
|
+
in the order they were decided, reason copied from the decision's `why` without
|
|
247
|
+
the leading outcome word. No bullets and `Findings: none verified` when no
|
|
248
|
+
`finding` decisions exist (for example `scan` with no Criticals, or the revmux
|
|
249
|
+
engine). Never add decisions that were not written to the run log.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
233
253
|
## 💰 Review Cost
|
|
234
254
|
|
|
235
255
|
```
|
|
@@ -6,7 +6,7 @@ points at, and copies the numbers out of, everything else.
|
|
|
6
6
|
| Trace | Path | Written by | Kept | What it answers |
|
|
7
7
|
|---|---|---|---|---|
|
|
8
8
|
| Run ledger | `~/.local/state/lekker-review/runs.jsonl` | `scripts/run-log.mjs finish`, `backfill` | forever (one line per run) | how long, how many tokens, findings, drops, proofs, verdict, per engine and depth |
|
|
9
|
-
| Run archive | `~/.local/state/lekker-review/runs/<runId>/` | `run-log.mjs start/mark/attach/finish` | 90 days (`prune`) | `run.json` with timeline, plus the run's `findings.json`, `worktree.json`, `preflight.json`, `context.json` |
|
|
9
|
+
| Run archive | `~/.local/state/lekker-review/runs/<runId>/` | `run-log.mjs start/mark/decide/attach/finish` | 90 days (`prune`) | `run.json` with timeline and decisions (also appended live to `timeline.jsonl`), plus the run's `findings.json`, `worktree.json`, `preflight.json`, `context.json` |
|
|
10
10
|
| Dependency ledger | `~/.local/state/lekker-review/deps.json` | `scripts/deps.mjs` | forever | which optional tools were installed or skipped, versions, last upstream check |
|
|
11
11
|
| Review report | `~/code-reviews/<date>-<target>-<repo>.md` | Step 3 | forever | the review as printed, including the `Review Cost` block |
|
|
12
12
|
| revmux archive | `~/code-reviews/revmux-tasks/<task>/<NN-run>/` | revmux, plus `revmux.stderr.log` from `scripts/revmux-engine.sh` | forever, never edit | `events.jsonl` (agent start, degraded, retried), `agents/*.jsonl` (per-agent cost and usage), `revmux.stderr.log` (why a round degraded; rounds before 2026-10-20 have none) |
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// One-line progress status for lekker-review: a boat drifts over a tide line toward a lighthouse.
|
|
3
|
+
//
|
|
4
|
+
// Usage: node lekker-progress.mjs --stage <stage> --message "<short fact>" [--ascii]
|
|
5
|
+
//
|
|
6
|
+
// Each call prints exactly one line and exits 0, even on bad arguments. On a TTY it first animates
|
|
7
|
+
// the drift on that line (at most 10 fps, under a second); anywhere else (captured tool output, a
|
|
8
|
+
// log) or with NO_COLOR or --ascii it prints the final frame only, with no escape codes.
|
|
9
|
+
// The `decision` stage prints a compass line and leaves the boat where it was.
|
|
10
|
+
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
12
|
+
|
|
13
|
+
export const SLOTS = 8;
|
|
14
|
+
export const MAX_WIDTH = 72;
|
|
15
|
+
const FRAME_MS = 100;
|
|
16
|
+
|
|
17
|
+
// stage -> [slot the boat reaches, mood, default message]
|
|
18
|
+
export const STAGES = {
|
|
19
|
+
start: [0, 'neutral', 'parsed the request'],
|
|
20
|
+
context: [1, 'neutral', 'context ready'],
|
|
21
|
+
review: [2, 'neutral', 'review agents started'],
|
|
22
|
+
verify: [3, 'neutral', 'verifying findings'],
|
|
23
|
+
critic: [4, 'neutral', 'completeness critic'],
|
|
24
|
+
prove: [5, 'neutral', 'proving bugs with tests'],
|
|
25
|
+
fix: [6, 'neutral', 'applying fixes'],
|
|
26
|
+
post: [7, 'neutral', 'posting the review'],
|
|
27
|
+
success: [SLOTS, 'happy', 'review saved'],
|
|
28
|
+
failure: [4, 'sad', 'review stopped'],
|
|
29
|
+
decision: [null, 'neutral', 'decision'],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const GLYPHS = {
|
|
33
|
+
false: { boat: '⛵', light: '🗼', tide: ' ~', compass: '🧭 ', neutral: '', happy: '😌', sad: '🌧️' },
|
|
34
|
+
true: { boat: '^', light: 'I', tide: '.', compass: '> ', neutral: '', happy: '(^o^)', sad: '(T.T)' },
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const WIDE = [[0x1100, 0x115f], [0x231a, 0x231b], [0x23e9, 0x23ec], [0x25fd, 0x25fe], [0x2614, 0x2615],
|
|
38
|
+
[0x2693, 0x2693], [0x26a1, 0x26a1], [0x26f5, 0x26f5], [0x2e80, 0xa4cf], [0xac00, 0xd7a3],
|
|
39
|
+
[0xf900, 0xfaff], [0xfe30, 0xfe6f], [0xff00, 0xff60], [0xffe0, 0xffe6], [0x1f000, 0x1ffff]];
|
|
40
|
+
|
|
41
|
+
function cellWidth(ch) {
|
|
42
|
+
const cp = ch.codePointAt(0);
|
|
43
|
+
if (/\p{M}/u.test(ch) || cp === 0x200d || cp === 0xfe0f) return 0;
|
|
44
|
+
return WIDE.some(([lo, hi]) => cp >= lo && cp <= hi) ? 2 : 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const width = (text) => [...text].reduce((n, ch) => n + cellWidth(ch), 0);
|
|
48
|
+
|
|
49
|
+
export function truncate(text, limit) {
|
|
50
|
+
const { out, done } = [...text].reduce((acc, ch) => {
|
|
51
|
+
if (acc.done) return acc;
|
|
52
|
+
const next = acc.used + cellWidth(ch);
|
|
53
|
+
return next > limit - 1 ? { ...acc, done: true } : { out: acc.out + ch, used: next, done: false };
|
|
54
|
+
}, { out: '', used: 0, done: false });
|
|
55
|
+
return done ? `${out}…` : out;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const oneLine = (text) => String(text ?? '').split(/\s+/).filter(Boolean).join(' ');
|
|
59
|
+
const fit = (line) => (width(line) <= MAX_WIDTH ? line : truncate(line, MAX_WIDTH));
|
|
60
|
+
|
|
61
|
+
function track(slot, glyphs) {
|
|
62
|
+
const cells = Array.from({ length: SLOTS + 1 }, (_, i) => (i === SLOTS ? glyphs.light : glyphs.tide));
|
|
63
|
+
return cells.map((cell, i) => (i === Math.min(slot, SLOTS) ? glyphs.boat : cell)).join('');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Pure: `tick` is the boat's slot. The mood face shows once the boat has arrived.
|
|
67
|
+
export function frame(stage, tick, { message, ascii = false } = {}) {
|
|
68
|
+
const spec = STAGES[stage];
|
|
69
|
+
const glyphs = GLYPHS[ascii === true];
|
|
70
|
+
const text = oneLine(message ?? spec?.[2] ?? '');
|
|
71
|
+
if (!spec) return fit(`lekker: ${text || stage || 'progress'}`);
|
|
72
|
+
const [target, mood] = spec;
|
|
73
|
+
if (target === null) return fit(`${glyphs.compass}${text || spec[2]}`);
|
|
74
|
+
const face = tick >= target ? glyphs[mood] : '';
|
|
75
|
+
return fit(`${`${track(tick, glyphs)} ${face}`.trimEnd()} ${stage}: ${text}`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const arg = (argv, name) => {
|
|
79
|
+
const i = argv.indexOf(`--${name}`);
|
|
80
|
+
return i === -1 ? undefined : argv[i + 1];
|
|
81
|
+
};
|
|
82
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
83
|
+
|
|
84
|
+
async function main(argv) {
|
|
85
|
+
const stage = arg(argv, 'stage') ?? '';
|
|
86
|
+
const message = arg(argv, 'message');
|
|
87
|
+
const ascii = argv.includes('--ascii') || Boolean(process.env.LEKKER_PROGRESS_ASCII);
|
|
88
|
+
const spec = STAGES[stage];
|
|
89
|
+
const animate = process.stdout.isTTY === true && !process.env.NO_COLOR && !ascii && Array.isArray(spec) && spec[0] !== null;
|
|
90
|
+
if (animate) {
|
|
91
|
+
const target = spec[0];
|
|
92
|
+
const slots = Array.from({ length: Math.min(3, target) }, (_, i) => target - 3 + i).filter((s) => s >= 0);
|
|
93
|
+
for (const slot of slots) {
|
|
94
|
+
process.stdout.write(`\r\x1b[2K${frame(stage, slot, { message, ascii })}`);
|
|
95
|
+
await sleep(FRAME_MS);
|
|
96
|
+
}
|
|
97
|
+
process.stdout.write('\r\x1b[2K');
|
|
98
|
+
}
|
|
99
|
+
const target = spec && spec[0] !== null ? spec[0] : 0;
|
|
100
|
+
process.stdout.write(`${frame(stage, target, { message, ascii })}\n`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
104
|
+
try { await main(process.argv.slice(2)); } catch { /* decoration must never fail a review */ }
|
|
105
|
+
process.exitCode = 0;
|
|
106
|
+
}
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
// node run-log.mjs start --repo <slug> --target <pr-N|branch-x> --mode pr|branch \
|
|
12
12
|
// --depth <d> --engine workflow|revmux [--fix] [--host claude]
|
|
13
13
|
// node run-log.mjs mark <runId> <phase> [--note <text>]
|
|
14
|
+
// node run-log.mjs decide <runId> --kind depth|tier|route|finding|fix|post --what <text> --why <text>
|
|
15
|
+
// node run-log.mjs decide <runId> --from-json <file> array of {kind, what, why}
|
|
14
16
|
// node run-log.mjs attach <runId> <file>...
|
|
15
17
|
// node run-log.mjs finish <runId> --status ok|failed|aborted [--verdict lgtm|lgtm-with-changes|needs-work]
|
|
16
18
|
// [--review-file <path>] [--artifact-url <url>] [--wf <wf_id>]... [--note <text>]
|
|
@@ -37,6 +39,7 @@ const LEDGER = join(STATE_DIR, 'runs.jsonl');
|
|
|
37
39
|
const PROJECTS_DIR = process.env.LEKKER_CLAUDE_PROJECTS || join(homedir(), '.claude', 'projects');
|
|
38
40
|
const REVMUX_TASKS = process.env.LEKKER_REVMUX_TASKS_DIR || join(homedir(), 'code-reviews', 'revmux-tasks');
|
|
39
41
|
|
|
42
|
+
const DECISION_KINDS = ['depth', 'tier', 'route', 'finding', 'fix', 'post'];
|
|
40
43
|
const argv = process.argv.slice(2);
|
|
41
44
|
const cmd = argv[0];
|
|
42
45
|
|
|
@@ -171,6 +174,25 @@ if (cmd === 'start') {
|
|
|
171
174
|
if (!existsSync(dir)) fail(`no run ${runId}`);
|
|
172
175
|
appendFileSync(join(dir, 'timeline.jsonl'), JSON.stringify({ phase, at: new Date().toISOString(), note: flag('note') ?? undefined }) + '\n');
|
|
173
176
|
console.log(JSON.stringify({ runId, phase }));
|
|
177
|
+
} else if (cmd === 'decide') {
|
|
178
|
+
const runId = argv[1];
|
|
179
|
+
const dir = runDir(runId);
|
|
180
|
+
if (!existsSync(dir)) fail(`no run ${runId}`);
|
|
181
|
+
const fromJson = flag('from-json');
|
|
182
|
+
const raw = fromJson ? readJson(fromJson) : [{ kind: flag('kind'), what: flag('what'), why: flag('why') }];
|
|
183
|
+
if (!Array.isArray(raw)) fail(`--from-json ${fromJson} must hold an array of {kind, what, why}`);
|
|
184
|
+
const text = (v) => (typeof v === 'string' ? v.replace(/\s+/g, ' ').trim() : '');
|
|
185
|
+
const rows = raw.map((d, i) => ({ kind: text(d?.kind), what: text(d?.what), why: text(d?.why), i }));
|
|
186
|
+
const bad = rows.find((r) => !DECISION_KINDS.includes(r.kind) || !r.what || !r.why);
|
|
187
|
+
if (bad) {
|
|
188
|
+
fail(!DECISION_KINDS.includes(bad.kind)
|
|
189
|
+
? `decision ${bad.i}: unknown kind "${bad.kind}" (use ${DECISION_KINDS.join('|')})`
|
|
190
|
+
: `decision ${bad.i}: --what and --why must be non-empty`);
|
|
191
|
+
}
|
|
192
|
+
const at = new Date().toISOString();
|
|
193
|
+
const lines = rows.map(({ kind, what, why }) => JSON.stringify({ at, kind, what, why }) + '\n').join('');
|
|
194
|
+
appendFileSync(join(dir, 'timeline.jsonl'), lines);
|
|
195
|
+
console.log(JSON.stringify({ runId, decisions: rows.length }));
|
|
174
196
|
} else if (cmd === 'attach') {
|
|
175
197
|
const runId = argv[1];
|
|
176
198
|
const dir = runDir(runId);
|
|
@@ -188,7 +210,10 @@ if (cmd === 'start') {
|
|
|
188
210
|
const meta = readJson(join(dir, 'run.json'));
|
|
189
211
|
if (!meta) fail(`no run ${runId}`);
|
|
190
212
|
const finishedAt = new Date().toISOString();
|
|
191
|
-
const
|
|
213
|
+
const rows = readJsonl(join(dir, 'timeline.jsonl'));
|
|
214
|
+
// Decision rows have no phase; keeping them out of the timeline keeps phaseDurations exact.
|
|
215
|
+
const timeline = [...rows.filter((r) => r.phase && r.phase !== 'finish'), { phase: 'finish', at: finishedAt }];
|
|
216
|
+
const decisions = rows.filter((r) => r.kind);
|
|
192
217
|
const workflows = flags('wf').map((id) => summariseWorkflow(findWorkflowRecord(id) || { runId: id }));
|
|
193
218
|
const reviewWf = workflows.find((w) => w.name === 'lekker-review-core') || null;
|
|
194
219
|
const row = {
|
|
@@ -206,7 +231,7 @@ if (cmd === 'start') {
|
|
|
206
231
|
artifactUrl: flag('artifact-url'),
|
|
207
232
|
note: flag('note', meta.note ?? null),
|
|
208
233
|
};
|
|
209
|
-
writeFileSync(join(dir, 'run.json'), JSON.stringify({ ...row, timeline }, null, 2) + '\n');
|
|
234
|
+
writeFileSync(join(dir, 'run.json'), JSON.stringify({ ...row, timeline, decisions }, null, 2) + '\n');
|
|
210
235
|
append(row);
|
|
211
236
|
const unresolved = workflows.filter((w) => w.durationS == null).map((w) => w.wfId);
|
|
212
237
|
console.log(JSON.stringify({ runId, ledger: LEDGER, wallS: row.wallS, tokensTotal: row.tokensTotal, unresolvedWorkflows: unresolved }));
|
|
@@ -437,6 +437,10 @@ function dimensionsFor(depth, ROUTE) {
|
|
|
437
437
|
]
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
+
function isBlockingSeverity(severity) {
|
|
441
|
+
return severity === 'critical' || severity === 'important'
|
|
442
|
+
}
|
|
443
|
+
|
|
440
444
|
// Model and effort for one role, from the `routing` arg that
|
|
441
445
|
// scripts/model-matrix.mjs builds from the PR's risk tier. An absent or
|
|
442
446
|
// malformed cell keeps the historical default, so an older caller runs exactly
|
|
@@ -675,11 +679,30 @@ const budgetAtStart = budget.spent()
|
|
|
675
679
|
let suppressedCount = 0
|
|
676
680
|
let proveAttemptCount = 0
|
|
677
681
|
|
|
682
|
+
// The harness has no filesystem, so decisions are logged as they happen and
|
|
683
|
+
// returned; the main loop writes them to the run timeline with run-log.mjs.
|
|
684
|
+
let decisions = []
|
|
685
|
+
const DECISION_WHY_MAX = 160
|
|
686
|
+
function decide(kind, what, why) {
|
|
687
|
+
const entry = { kind, what, why: String(why).replace(/\s+/g, ' ').trim().slice(0, DECISION_WHY_MAX) }
|
|
688
|
+
decisions = decisions.concat([entry])
|
|
689
|
+
log(`decision ${kind}: ${entry.what} (${entry.why})`)
|
|
690
|
+
}
|
|
691
|
+
// Only blocking-severity findings get a line; observations would drown the log.
|
|
692
|
+
function decideFinding(finding, outcome, reasoning) {
|
|
693
|
+
if (!isBlockingSeverity(finding.severity)) return
|
|
694
|
+
decide('finding', `${finding.file}:${finding.line} ${finding.title}`, `${outcome}: ${reasoning || 'no reason given'}`)
|
|
695
|
+
}
|
|
696
|
+
|
|
678
697
|
// -------------------------------------------------------------------------
|
|
679
698
|
// Dimensions by depth
|
|
680
699
|
// -------------------------------------------------------------------------
|
|
681
700
|
|
|
682
701
|
log(`routing: ${routing ? 'tiered' : 'defaults'} ${routeLabel}`)
|
|
702
|
+
Object.keys(ROUTE).forEach(function(role) {
|
|
703
|
+
decide('route', `${role} -> ${ROUTE[role].model}${ROUTE[role].effort ? ' ' + ROUTE[role].effort : ''}`,
|
|
704
|
+
routing ? 'risk tier routing' : 'default model')
|
|
705
|
+
})
|
|
683
706
|
const dimensions = dimensionsFor(depth, ROUTE)
|
|
684
707
|
|
|
685
708
|
const wtDisplay = worktreePath || 'null (scan mode: diff only)'
|
|
@@ -874,6 +897,7 @@ const budgetAtStart = budget.spent()
|
|
|
874
897
|
if (!verdict) {
|
|
875
898
|
// Missing verification cannot support a blocking finding.
|
|
876
899
|
downgradedCount++
|
|
900
|
+
decideFinding(finding, 'downgraded', 'verifier returned no usable result')
|
|
877
901
|
const kept = Object.assign({}, finding)
|
|
878
902
|
kept.severity = 'observation'
|
|
879
903
|
kept.verificationStatus = 'unavailable'
|
|
@@ -888,11 +912,13 @@ const budgetAtStart = budget.spent()
|
|
|
888
912
|
|
|
889
913
|
if (verdict.verdict === 'dropped') {
|
|
890
914
|
droppedCount++
|
|
915
|
+
decideFinding(finding, 'dropped', verdict.reasoning)
|
|
891
916
|
return null
|
|
892
917
|
}
|
|
893
918
|
|
|
894
919
|
if (verdict.verdict === 'downgraded') {
|
|
895
920
|
downgradedCount++
|
|
921
|
+
decideFinding(finding, 'downgraded', verdict.reasoning)
|
|
896
922
|
const downgraded = Object.assign({}, finding)
|
|
897
923
|
downgraded.severity = verdict.newSeverity || 'observation'
|
|
898
924
|
downgraded.verificationStatus = 'downgraded'
|
|
@@ -901,6 +927,7 @@ const budgetAtStart = budget.spent()
|
|
|
901
927
|
}
|
|
902
928
|
|
|
903
929
|
// confirmed
|
|
930
|
+
decideFinding(finding, 'kept', verdict.reasoning)
|
|
904
931
|
const confirmed = Object.assign({}, finding)
|
|
905
932
|
confirmed.severity = weakenedRuleSeverity(finding, confirmed.severity)
|
|
906
933
|
confirmed.verificationStatus = isHardRule(finding) ? 'hard-rule-confirmed' : 'confirmed'
|
|
@@ -1223,4 +1250,5 @@ const budgetAtStart = budget.spent()
|
|
|
1223
1250
|
outputTokens: budget.spent() - budgetAtStart,
|
|
1224
1251
|
turnTokensTotal: budget.spent(),
|
|
1225
1252
|
routing: ROUTE,
|
|
1253
|
+
decisions,
|
|
1226
1254
|
}, Object.assign({ engine: ENGINE }, revmuxPassthrough || {}))
|