loopwright 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/content/agents/implementer.md +1 -1
- package/content/agents/reviewer.md +1 -1
- package/content/hooks/guard-locked-tests.mjs +1 -1
- package/content/hooks/lib.mjs +76 -6
- package/content/hooks/lw.mjs +345 -54
- package/content/hooks/plain-questions.mjs +6 -10
- package/content/hooks/reinject-context.mjs +10 -3
- package/content/hooks/stop-gate.mjs +1 -2
- package/content/hooks/task-file.mjs +243 -0
- package/content/prompts/glossary.md +37 -0
- package/content/prompts/standards.md +1 -0
- package/content/prompts/user-messages.md +5 -24
- package/content/skills/loopwright-build/SKILL.md +7 -7
- package/content/skills/loopwright-done/SKILL.md +7 -6
- package/content/skills/loopwright-explore/SKILL.md +1 -1
- package/content/skills/loopwright-fix/SKILL.md +2 -2
- package/content/skills/loopwright-flow/SKILL.md +5 -5
- package/content/skills/loopwright-park/SKILL.md +10 -2
- package/content/skills/loopwright-plan/SKILL.md +71 -46
- package/content/skills/loopwright-review/SKILL.md +23 -22
- package/content/skills/loopwright-test/SKILL.md +9 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ Run a single stage, or the whole loop with `flow`. In Codex, use `$` instead of
|
|
|
91
91
|
|---|---|---|---|
|
|
92
92
|
| Skills install | Supported, tested | WIP: installed, not tested end-to-end | WIP: reads `.agents/skills` |
|
|
93
93
|
| Subagents (scout, tester, implementer, reviewer) | Supported, tested | WIP: installed, not tested end-to-end | WIP: `.junie/agents` |
|
|
94
|
-
| Hook enforcement (locked-test guard, stop gate, context
|
|
94
|
+
| Hook enforcement (locked-test guard, stop gate, context restore, plus compaction instructions and the question check on Claude Code only) | Supported, tested | WIP: installed, not tested end-to-end | Experimental (`--experimental junie-hooks`, Early Access) |
|
|
95
95
|
| Plain-words rules for messages to you | Supported | WIP: installed, not tested end-to-end | WIP: reads `.agents/skills` |
|
|
96
96
|
| Structured questions | `AskUserQuestion` | Plain-text fallback (numbered options) | Plain-text fallback |
|
|
97
97
|
| Cross-agent review (as the reviewer) | Supported, tested | WIP: untested | Not supported |
|
|
@@ -106,7 +106,7 @@ Codex and Junie CLI support is work in progress.
|
|
|
106
106
|
|
|
107
107
|
- [Installation](docs/installation.md): flags, files written, update, uninstall, worktrees.
|
|
108
108
|
- [Configuration](docs/configuration.md): models, fix rounds, cross-agent review, effort profiles (`lean`, `balanced`, `thorough`, `deep`; set with `--profile`), experimental features.
|
|
109
|
-
- [Workflow in detail](docs/workflow.md): the full flow with charts: slices, the Plan and Review
|
|
109
|
+
- [Workflow in detail](docs/workflow.md): the full flow with charts: slices, the Plan and Review stages, and where it waits for you.
|
|
110
110
|
- [Enforcement and its limits](docs/enforcement.md): what the hooks block, and what they cannot.
|
|
111
111
|
- [Dogfood checklist](docs/dogfood-checklist.md): a manual end-to-end test run.
|
|
112
112
|
|
|
@@ -9,7 +9,7 @@ You are the loopwright implementer. You make the smallest change that satisfies
|
|
|
9
9
|
|
|
10
10
|
The main thread gives you the task file path, and on a fix round the reviewer's Blocking findings. Read the task file fresh every time: goal, decisions (`D…`), acceptance criteria (`AC…`), check commands, locked tests. The task file wins over any summary in your prompt.
|
|
11
11
|
|
|
12
|
-
Approved
|
|
12
|
+
Approved Simplify cuts (the main thread lists them verbatim, each approved by the user): apply only those, in place of Step 3's implementing, and add no unit tests. They are exempt from "no unrelated cleanups"; behavior must stay identical. Steps 1, 2 and 4 still run; skip Step 5, your own simplify pass, which could cut what the user did not approve. Write no `Root cause:` line on that run, even on a fix task.
|
|
13
13
|
|
|
14
14
|
## Boundaries
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: loopwright-reviewer
|
|
3
|
-
description: Reads a change against its task file and standards under a procedure file the caller names (a review verdict by default, or a list of proposed
|
|
3
|
+
description: Reads a change against its task file and standards under a procedure file the caller names (a review verdict by default, or a list of proposed Simplify cuts) and returns that procedure's JSON output. Never edits code.
|
|
4
4
|
tools: Read, Grep, Glob, Bash
|
|
5
5
|
---
|
|
6
6
|
You are the loopwright reviewer, a context separate from the one that wrote the code.
|
|
@@ -68,7 +68,7 @@ try {
|
|
|
68
68
|
if (locked.size === 0) continue;
|
|
69
69
|
const rel = repoRelative(top, abs);
|
|
70
70
|
if (locked.has(rel))
|
|
71
|
-
deny('',
|
|
71
|
+
deny('PreToolUse', `loopwright: ${rel} is a locked acceptance test. Ask the user before changing it.`);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
allow();
|
package/content/hooks/lib.mjs
CHANGED
|
@@ -28,6 +28,59 @@ export const PROFILES = {
|
|
|
28
28
|
deep: { scout: 'xhigh', tester: 'xhigh', implementer: 'xhigh', reviewer: 'xhigh' },
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Icons in the task file: settings keys, section headings, tags, and progress marks. The plan skill's template uses
|
|
33
|
+
* the same ones (a test pins them equal); `lw.mjs` repairs a missing or wrong icon on the lines it knows.
|
|
34
|
+
* Some carry a variation selector (U+FE0F): compare exact code points.
|
|
35
|
+
*/
|
|
36
|
+
export const TASK_FILE_ICONS = {
|
|
37
|
+
settings: {
|
|
38
|
+
kind: '🏷️',
|
|
39
|
+
status: '🚦',
|
|
40
|
+
stage: '📍',
|
|
41
|
+
plan: '📋',
|
|
42
|
+
tier: '📐',
|
|
43
|
+
profile: '🎚️',
|
|
44
|
+
'two-pass': '👀',
|
|
45
|
+
'fix-round cap': '🔧',
|
|
46
|
+
checks: '🔬',
|
|
47
|
+
worktree: '🌿',
|
|
48
|
+
'base commit': '⚓',
|
|
49
|
+
'found while': '🔗',
|
|
50
|
+
blocks: '⛔',
|
|
51
|
+
},
|
|
52
|
+
headings: {
|
|
53
|
+
Goal: '🎯',
|
|
54
|
+
Decisions: '⚖️',
|
|
55
|
+
Assumptions: '🔎',
|
|
56
|
+
'Acceptance criteria': '🧪',
|
|
57
|
+
Slices: '🧩',
|
|
58
|
+
'Review log': '🔁',
|
|
59
|
+
'Open questions': '❓',
|
|
60
|
+
'Notes for Done': '🗒️',
|
|
61
|
+
'Follow-ups': '📌',
|
|
62
|
+
'Bug report': '🐞',
|
|
63
|
+
'Root cause': '🌱',
|
|
64
|
+
Evidence: '📎',
|
|
65
|
+
},
|
|
66
|
+
tags: {
|
|
67
|
+
asked: '🙋',
|
|
68
|
+
'batch-confirmed': '☑️',
|
|
69
|
+
overridden: '✏️',
|
|
70
|
+
confirmed: '☑️',
|
|
71
|
+
todo: '⬜',
|
|
72
|
+
tested: '🧪',
|
|
73
|
+
passed: '✅',
|
|
74
|
+
},
|
|
75
|
+
progress: { finished: '✅', failed: '❌', running: '▶️', paused: '⏸️', back: '↩️' },
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** Regex source for a leading icon (and its space) before a settings key, heading name or tag; the line may have none. */
|
|
79
|
+
export const ICON_PREFIX = '(?:[^\\x00-\\x7F]\\S*[ \\t]+)?';
|
|
80
|
+
|
|
81
|
+
/** The first word after `key:` on a settings line, with or without a leading icon; undefined when there is no such line. */
|
|
82
|
+
export const settingValue = (text, key) => new RegExp(`^${ICON_PREFIX}${key}:[ \\t]*(\\S+)`, 'm').exec(text)?.[1];
|
|
83
|
+
|
|
31
84
|
/** Hooks sit in `<loopwright home>/hooks`, the prompts beside them. */
|
|
32
85
|
export const USER_MESSAGES_RULES = fileURLToPath(new URL('../prompts/user-messages.md', import.meta.url));
|
|
33
86
|
|
|
@@ -96,11 +149,11 @@ export function readState(dir, id) {
|
|
|
96
149
|
}
|
|
97
150
|
}
|
|
98
151
|
|
|
99
|
-
|
|
100
|
-
|
|
152
|
+
/** Write `text` to `path` through a temp file and a rename, so a reader never sees half a file. */
|
|
153
|
+
export function writeFileAtomic(path, text) {
|
|
101
154
|
mkdirSync(dirname(path), { recursive: true });
|
|
102
155
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
103
|
-
writeFileSync(tmp,
|
|
156
|
+
writeFileSync(tmp, text);
|
|
104
157
|
// Windows: rename fails with EPERM/EBUSY/EACCES while another process briefly holds the target.
|
|
105
158
|
for (let attempt = 0; ; attempt++) {
|
|
106
159
|
try {
|
|
@@ -113,6 +166,9 @@ export function writeState(dir, id, state) {
|
|
|
113
166
|
}
|
|
114
167
|
}
|
|
115
168
|
|
|
169
|
+
export const writeState = (dir, id, state) =>
|
|
170
|
+
writeFileAtomic(statePath(dir, id), JSON.stringify(state, null, 2) + '\n');
|
|
171
|
+
|
|
116
172
|
export function sha256File(path) {
|
|
117
173
|
return createHash('sha256').update(readFileSync(path)).digest('hex');
|
|
118
174
|
}
|
|
@@ -206,10 +262,24 @@ export function allow() {
|
|
|
206
262
|
process.exit(0);
|
|
207
263
|
}
|
|
208
264
|
|
|
209
|
-
// Claude
|
|
210
|
-
//
|
|
211
|
-
|
|
265
|
+
// Claude Code blocks through JSON on stdout, which it shows without the hook's command path
|
|
266
|
+
// (https://code.claude.com/docs/en/hooks.md: PreToolUse permissionDecision, Stop decision control).
|
|
267
|
+
// Codex and Junie block via stderr reason + exit 2; Codex ignores exit 2 with empty stderr, so the reason is never empty.
|
|
268
|
+
export function deny(event, reason) {
|
|
212
269
|
const text = String(reason ?? '').trim() || 'loopwright: blocked';
|
|
270
|
+
const i = process.argv.indexOf('--tool');
|
|
271
|
+
if (i !== -1 && process.argv[i + 1] === 'claude') {
|
|
272
|
+
process.stdout.write(
|
|
273
|
+
JSON.stringify(
|
|
274
|
+
event === 'Stop'
|
|
275
|
+
? { decision: 'block', reason: text }
|
|
276
|
+
: {
|
|
277
|
+
hookSpecificOutput: { hookEventName: event, permissionDecision: 'deny', permissionDecisionReason: text },
|
|
278
|
+
},
|
|
279
|
+
) + '\n',
|
|
280
|
+
);
|
|
281
|
+
process.exit(0);
|
|
282
|
+
}
|
|
213
283
|
process.stderr.write(text + '\n');
|
|
214
284
|
process.exit(2);
|
|
215
285
|
}
|