loopwright 0.1.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/LICENSE +21 -0
- package/README.md +174 -0
- package/content/.gitkeep +0 -0
- package/content/agents/implementer.md +41 -0
- package/content/agents/reviewer.md +15 -0
- package/content/agents/scout.md +36 -0
- package/content/agents/tester.md +39 -0
- package/content/hooks/default-config.json +23 -0
- package/content/hooks/guard-locked-tests.mjs +35 -0
- package/content/hooks/lib.mjs +147 -0
- package/content/hooks/lw.mjs +215 -0
- package/content/hooks/reinject-context.mjs +66 -0
- package/content/hooks/stop-gate.mjs +37 -0
- package/content/prompts/reviewer.md +66 -0
- package/content/schemas/verdict.json +26 -0
- package/content/skills/loopwright-build/SKILL.md +35 -0
- package/content/skills/loopwright-done/SKILL.md +40 -0
- package/content/skills/loopwright-flow/SKILL.md +40 -0
- package/content/skills/loopwright-plan/SKILL.md +106 -0
- package/content/skills/loopwright-review/SKILL.md +49 -0
- package/content/skills/loopwright-test/SKILL.md +33 -0
- package/dist/cli.js +1013 -0
- package/package.json +44 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: loopwright-review
|
|
3
|
+
description: Use after a loopwright Build, to have a separate reviewer judge the change against the task file, locked tests and standards, run the fix loop, and record the verdict.
|
|
4
|
+
---
|
|
5
|
+
# loopwright review
|
|
6
|
+
|
|
7
|
+
Reviewers judge in their own context. This thread dispatches them, merges their verdicts, asks the user about undecided findings, and records the result. Do not fix code here.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
1. Run every loopwright command from the worktree root: `cd "$(git rev-parse --show-toplevel)"`.
|
|
12
|
+
2. `node "{{LW_HOME}}/hooks/lw.mjs" dir` → `<lw>` (`null` inside a git repo → no task has started here yet; `lw.mjs start` creates `.loopwright/` with the first task, so continue and the next step reports "no active task". Not a git repo → tell the user loopwright must run inside a git repo, stop).
|
|
13
|
+
3. `node "{{LW_HOME}}/hooks/lw.mjs" status` → `task` (relative to `<lw>`) and `baseCommit`. "no active task" → point the user to `/loopwright-flow`, stop.
|
|
14
|
+
4. Read the task file header (`tier`, `two-pass`, `fix-round cap`) and `<lw>/config.json` (`crossModelReview`, `models.crossModelReviewer`; missing → `off`).
|
|
15
|
+
5. Scope: small/standard → the task. Large → the first `S<n> [tested]` slice, or `whole` once every slice is `[passed]`.
|
|
16
|
+
6. Round `n` = number of `- R` lines in `## Review log` for this scope + 1.
|
|
17
|
+
|
|
18
|
+
## Passes
|
|
19
|
+
|
|
20
|
+
1. `node "{{LW_HOME}}/hooks/lw.mjs" stage review`, and set `stage: review` in the header.
|
|
21
|
+
2. **Blind pass.** Now spawn the `loopwright-reviewer` subagent and wait for its result. Give it only: the absolute task file path, the base commit, and "Follow `{{LW_HOME}}/prompts/reviewer.md`. Blind pass." Large tier: add "Scope: slice S<n> (its ACs; earlier slices passed)" or "Scope: whole-branch review of all slices". Never include the implementer report, chat history or your opinion.
|
|
22
|
+
3. **Second pass** (only if `two-pass: on`). Now spawn the `loopwright-reviewer` subagent and wait for its result, with the task file path, the base commit, "Follow `{{LW_HOME}}/prompts/reviewer.md`. Second pass.", and then "Verify the claims in this implementer report:" with the report verbatim. Report no longer available → skip and note it in the log line.
|
|
23
|
+
4. **Cross-model pass** (only if `crossModelReview` is not `off`). `command -v <claude|codex>` fails → skip, note it. Otherwise, from the worktree root, set `PROMPT="Follow {{LW_HOME}}/prompts/reviewer.md. Task file: <abs path>. Base commit: <sha>. Blind pass."` and run (`LOOPWRIGHT_HOOKS=off` keeps loopwright's own hooks, such as the stop gate, out of the headless reviewer session):
|
|
24
|
+
- claude (omit `--model` when the model is `inherit`; add one `"Bash(<cmd>:*)"` per check command in the task header; the `lw.mjs` entries allow only the read-only `status`, `check-locks` and `fingerprint`, in the quoted form the reviewer prompt uses and unquoted; the prompt must come after `--` because the tool flags take several values):
|
|
25
|
+
`LOOPWRIGHT_HOOKS=off claude -p --model <crossModelReviewer.claude> --output-format json --json-schema "$(cat "{{LW_HOME}}/schemas/verdict.json")" --allowedTools "Read" "Grep" "Glob" "Bash(git diff:*)" "Bash(git status:*)" "Bash(git log:*)" 'Bash(node "{{LW_HOME}}/hooks/lw.mjs" status)' 'Bash(node "{{LW_HOME}}/hooks/lw.mjs" check-locks)' 'Bash(node "{{LW_HOME}}/hooks/lw.mjs" fingerprint)' "Bash(node {{LW_HOME}}/hooks/lw.mjs status)" "Bash(node {{LW_HOME}}/hooks/lw.mjs check-locks)" "Bash(node {{LW_HOME}}/hooks/lw.mjs fingerprint)" "Bash(<check command>:*)" --disallowedTools "Edit" "Write" "MultiEdit" "NotebookEdit" -- "$PROMPT"`
|
|
26
|
+
The verdict is the top-level `structured_output` field.
|
|
27
|
+
- codex (best effort, untested; omit `-m` when the model is `inherit`): `OUT="$(mktemp)"; LOOPWRIGHT_HOOKS=off codex exec --sandbox read-only --output-schema "{{LW_HOME}}/schemas/verdict.json" -o "$OUT" -m <crossModelReviewer.codex> "$PROMPT"`, then read the verdict from `$OUT`.
|
|
28
|
+
Any error, timeout or unparseable output → skip and note it. This pass never blocks on its own failure. A check-command failure reported only by this pass that looks sandbox-caused (permission denied, read-only filesystem) is noted in the log, not counted as blocking.
|
|
29
|
+
5. A subagent reply that is not one JSON verdict → dispatch it once more asking for only the JSON; still invalid → stop and show the user.
|
|
30
|
+
|
|
31
|
+
## Outcome
|
|
32
|
+
|
|
33
|
+
Human gates: before you ask the user anything in this stage (an undecided finding, the fix-round cap, an invalid verdict; `AskUserQuestion` or a turn-ending question), run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "<what you are waiting for>"`, so the stop gate lets you end the turn. After the user answers, run `node "{{LW_HOME}}/hooks/lw.mjs" resume`. (`stage` and `verdict` also clear it.)
|
|
34
|
+
|
|
35
|
+
Merge all passes: union of `blocking`, union of `undecided` (drop exact duplicates by location and expectation), sum of `droppedCount`. Decide from the arrays, not from the `pass` fields.
|
|
36
|
+
|
|
37
|
+
- **Blocking** present → `node "{{LW_HOME}}/hooks/lw.mjs" verdict fail --round <n>`. Fix rounds used = n − 1. If that equals the `fix-round cap`, stop: show every open finding and let the user decide (raise the cap, fix by hand, or accept). Otherwise show the findings briefly and run `/loopwright-build` with the Blocking findings verbatim; then review again (round n + 1). Undecided findings of this round are only counted; the next round re-checks them.
|
|
38
|
+
- Only **Undecided** → present each to the user, one at a time (Claude: `AskUserQuestion`; Codex: numbered text), with its location, expectation and proof; options: fix or dismiss. Record each answer under the round's log line: ` - U<k> <location>: fix|dismissed — <user's reason>`. Any "fix" → `verdict fail --round <n>` and Build with those findings, same cap rule. All dismissed → pass.
|
|
39
|
+
- Nothing open → `node "{{LW_HOME}}/hooks/lw.mjs" verdict pass --round <n>`.
|
|
40
|
+
|
|
41
|
+
Once the outcome is known (after the user's undecided answers) and before the verdict command, append one line to `## Review log`, followed by its `U<k>` lines if any:
|
|
42
|
+
`- R<n>: <pass|fail> — <k> blocking, <m> undecided, <d> dropped — <key finding one-liners>; <skipped-pass notes>`
|
|
43
|
+
Large tier: `- R<n> S<k>: …` for a slice, `- R<n> whole: …` for the whole-branch review.
|
|
44
|
+
|
|
45
|
+
## After a pass
|
|
46
|
+
|
|
47
|
+
- small/standard → `/loopwright-done`.
|
|
48
|
+
- large → mark the slice `S<n> [passed]`; next `[todo]` slice → `/loopwright-test`. When the last slice passes, run this skill again with scope `whole` (the diff against the base commit, all ACs); its fixes go through Build without new tests. Whole-branch pass → `/loopwright-done`.
|
|
49
|
+
- Any code edit after a pass makes the verdict stale; review again.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: loopwright-test
|
|
3
|
+
description: Use after a standard or large loopwright task is planned and confirmed, to have a separate tester write and lock the acceptance tests before any implementation exists.
|
|
4
|
+
---
|
|
5
|
+
# loopwright test
|
|
6
|
+
|
|
7
|
+
The tester writes acceptance tests from the confirmed ACs and locks them. This thread only dispatches and verifies; do not write or edit tests or code here.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
1. Run every loopwright command from the worktree root: `cd "$(git rev-parse --show-toplevel)"`.
|
|
12
|
+
2. `node "{{LW_HOME}}/hooks/lw.mjs" dir` → `<lw>` (`null` inside a git repo → no task has started here yet; `lw.mjs start` creates `.loopwright/` with the first task, so continue and the next step reports "no active task". Not a git repo → tell the user loopwright must run inside a git repo, stop).
|
|
13
|
+
3. `node "{{LW_HOME}}/hooks/lw.mjs" status` → `task` (path relative to `<lw>`). "no active task" → stop and point the user to `/loopwright-plan` or `/loopwright-flow`.
|
|
14
|
+
4. Read the task file header.
|
|
15
|
+
- `tier: small` → there is no Test stage; say so and go to `/loopwright-build`.
|
|
16
|
+
- Header not `plan: confirmed` (or no ACs, or ACs without an interface) → stop; point the user to `/loopwright-plan`.
|
|
17
|
+
- `tier: large` → the current slice is the first `S<n> [todo]` line; test only its ACs.
|
|
18
|
+
|
|
19
|
+
## Steps
|
|
20
|
+
|
|
21
|
+
1. `node "{{LW_HOME}}/hooks/lw.mjs" stage test`, and set `stage: test` in the task file header.
|
|
22
|
+
2. Now spawn the `loopwright-tester` subagent and wait for its result. Give it only the absolute task file path (`<lw>/<task>`) and, for large tier, "Write tests only for slice S<n>: AC…". No chat history, no implementation hints.
|
|
23
|
+
3. Verify the report:
|
|
24
|
+
- `node "{{LW_HOME}}/hooks/lw.mjs" status` → `lockedTests` must contain every test file and fixture the report lists. A reported file missing from the locks → run `node "{{LW_HOME}}/hooks/lw.mjs" lock <file>` yourself.
|
|
25
|
+
- Every in-scope AC has a test, and each failure excerpt shows the expected reason (missing behavior, missing module/export at the named path), not a syntax or setup error. Otherwise spawn the `loopwright-tester` subagent and wait for its result again, naming the problem.
|
|
26
|
+
- `Uncovered` or `Needs` not empty → show those items to the user, one at a time. The answer may change an AC or a decision: write it to the task file (`[asked]`), then dispatch the tester again.
|
|
27
|
+
4. Write the test file next to each AC line (`— test: <file>`). Large tier: change the slice to `S<n> [tested]`.
|
|
28
|
+
5. Tell the user in a few lines: test files, ACs covered, locked paths. Then the next stage is `/loopwright-build`.
|
|
29
|
+
|
|
30
|
+
## Rules
|
|
31
|
+
|
|
32
|
+
- Lock only in this stage, and only the tests for this stage's scope (the task, or the current slice). Never re-lock an existing locked test; if one is wrong, tell the user and let them decide.
|
|
33
|
+
- Do not read the implementation to judge the tests; the ACs are the contract.
|