@cloverleaf/reference-impl 0.1.1 → 0.3.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/README.md +52 -24
- package/VERSION +1 -1
- package/config/affected-routes.json +12 -0
- package/config/qa-rules.json +19 -0
- package/config/ui-paths.json +3 -0
- package/dist/affected-routes.mjs +66 -0
- package/dist/cli.mjs +224 -0
- package/dist/events.mjs +80 -0
- package/dist/feedback.mjs +41 -0
- package/dist/ids.mjs +60 -0
- package/dist/index.mjs +6 -0
- package/dist/paths.mjs +26 -0
- package/dist/ports.mjs +19 -0
- package/dist/qa-rules.mjs +15 -0
- package/dist/state.mjs +97 -0
- package/dist/ui-paths.mjs +25 -0
- package/dist/validate.mjs +40 -0
- package/install.sh +10 -0
- package/lib/affected-routes.ts +80 -0
- package/lib/cli.ts +63 -2
- package/lib/feedback.ts +6 -2
- package/lib/ids.ts +3 -2
- package/lib/ports.ts +19 -0
- package/lib/qa-rules.ts +23 -0
- package/lib/state.ts +1 -1
- package/lib/ui-paths.ts +27 -0
- package/lib/validate.ts +3 -20
- package/package.json +12 -6
- package/prompts/documenter.md +72 -0
- package/prompts/qa.md +82 -0
- package/prompts/ui-reviewer.md +103 -0
- package/skills/cloverleaf-document.md +73 -0
- package/skills/cloverleaf-implement.md +20 -4
- package/skills/cloverleaf-merge.md +46 -18
- package/skills/cloverleaf-new-task.md +9 -1
- package/skills/cloverleaf-qa.md +64 -0
- package/skills/cloverleaf-run.md +72 -18
- package/skills/cloverleaf-ui-review.md +93 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cloverleaf-ui-review
|
|
3
|
+
description: Run the UI Reviewer agent on a task in the `ui-review` state (full pipeline only). Computes diff-affected routes via CLI; if empty, skips axe and advances ui-review → qa. Otherwise dispatches a subagent with Playwright + axe-core scoped to those routes. Usage — /cloverleaf-ui-review <TASK-ID>.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cloverleaf — ui-review
|
|
7
|
+
|
|
8
|
+
## Steps
|
|
9
|
+
|
|
10
|
+
0. Ensure you are on `main`. State is authoritative on main. Run:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
cd <repo_root>
|
|
14
|
+
current=$(git rev-parse --abbrev-ref HEAD)
|
|
15
|
+
if [ "$current" != "main" ]; then git checkout main; fi
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If main has uncommitted changes, stop and report.
|
|
19
|
+
|
|
20
|
+
1. Capture the TASK-ID argument.
|
|
21
|
+
|
|
22
|
+
2. Load the task:
|
|
23
|
+
```
|
|
24
|
+
~/.claude/plugins/cloverleaf/bin/cloverleaf-cli load-task <repo_root> <TASK-ID>
|
|
25
|
+
```
|
|
26
|
+
Verify `status === "ui-review"`. If not, report and stop.
|
|
27
|
+
|
|
28
|
+
3. Confirm feature branch exists: `git rev-parse --verify cloverleaf/<TASK-ID>`. If missing, report and stop.
|
|
29
|
+
|
|
30
|
+
4. Compute affected routes:
|
|
31
|
+
```bash
|
|
32
|
+
AFFECTED=$(~/.claude/plugins/cloverleaf/bin/cloverleaf-cli affected-routes <repo_root> <TASK-ID>)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
5. **Empty-set early-exit.** If `AFFECTED` is `[]`, skip the subagent entirely:
|
|
36
|
+
```bash
|
|
37
|
+
cloverleaf-cli advance-status <repo_root> <TASK-ID> qa agent '' full_pipeline
|
|
38
|
+
cd <repo_root>
|
|
39
|
+
git add .cloverleaf/
|
|
40
|
+
git commit -m "cloverleaf: <TASK-ID> ui-review skipped (no renderable routes) → qa"
|
|
41
|
+
```
|
|
42
|
+
Report: "✓ UI Review skipped (no renderable routes affected). State → qa. Next: `/cloverleaf-qa <TASK-ID>`."
|
|
43
|
+
Stop here.
|
|
44
|
+
|
|
45
|
+
6. Allocate a free preview port:
|
|
46
|
+
```bash
|
|
47
|
+
PREVIEW_PORT=$(node -e "const net=require('net');const s=net.createServer();s.listen(0,()=>{console.log(s.address().port);s.close()})")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
7. Compute diff:
|
|
51
|
+
```bash
|
|
52
|
+
git diff main..cloverleaf/<TASK-ID>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
8. **Browser cache env var.** Before the Task-tool dispatch, ensure `PLAYWRIGHT_BROWSERS_PATH=~/.cache/ms-playwright` is exported so the subagent inherits it. This keeps Playwright from re-downloading ~300 MB of browser binaries inside the worktree.
|
|
56
|
+
|
|
57
|
+
9. Dispatch the UI Reviewer subagent via the Task tool:
|
|
58
|
+
- `subagent_type`: `general-purpose`
|
|
59
|
+
- `model`: `sonnet`
|
|
60
|
+
- Prompt: contents of `~/.claude/plugins/cloverleaf/prompts/ui-reviewer.md` with substitutions:
|
|
61
|
+
- `{{task}}`, `{{diff}}`, `{{branch}}`, `{{base_branch}}`, `{{repo_root}}`, `{{preview_port}}`
|
|
62
|
+
- `{{affected_routes}}` → the value of `$AFFECTED` (verbatim — may be `"all"`, a JSON array, or `[]` but step 5 handled `[]` already)
|
|
63
|
+
|
|
64
|
+
10. Parse the subagent's response. Expect `{"verdict": "pass"|"bounce"|"escalate", "summary": "...", "findings": [...]}`.
|
|
65
|
+
|
|
66
|
+
11. Branch on verdict:
|
|
67
|
+
|
|
68
|
+
**Pass:**
|
|
69
|
+
```
|
|
70
|
+
cloverleaf-cli advance-status <repo_root> <TASK-ID> qa agent '' full_pipeline
|
|
71
|
+
```
|
|
72
|
+
Commit: `git add .cloverleaf/ && git commit -m "cloverleaf: <TASK-ID> ui-review passed → qa"`.
|
|
73
|
+
Report: "✓ UI Review passed. State → qa. Next: `/cloverleaf-qa <TASK-ID>`."
|
|
74
|
+
|
|
75
|
+
**Bounce:**
|
|
76
|
+
1. Write feedback: `echo '<envelope-json>' > /tmp/cloverleaf-fb-u.json`
|
|
77
|
+
2. `cloverleaf-cli write-feedback <repo_root> <TASK-ID> /tmp/cloverleaf-fb-u.json --prefix=u`
|
|
78
|
+
3. `cloverleaf-cli advance-status <repo_root> <TASK-ID> implementing agent '' full_pipeline`
|
|
79
|
+
4. Commit: `git add .cloverleaf/ && git commit -m "cloverleaf: <TASK-ID> ui-review bounced → implementing"`.
|
|
80
|
+
5. Report: "✗ UI Review bounced. Findings: <summary by severity>. State → implementing. Next: `/cloverleaf-implement <TASK-ID>`."
|
|
81
|
+
|
|
82
|
+
**Escalate:**
|
|
83
|
+
1. `cloverleaf-cli advance-status <repo_root> <TASK-ID> escalated agent`
|
|
84
|
+
2. Commit: `git add .cloverleaf/ && git commit -m "cloverleaf: <TASK-ID> ui-review escalated"`.
|
|
85
|
+
3. Report: "✗ UI Review escalated (infrastructure issue). Review and retry manually."
|
|
86
|
+
|
|
87
|
+
## Rules
|
|
88
|
+
|
|
89
|
+
- Never push.
|
|
90
|
+
- Do not modify source code — UI Reviewer is read-only.
|
|
91
|
+
- Always teardown preview server + worktree on error.
|
|
92
|
+
- Empty-set early-exit (step 5) skips the browser entirely — no Playwright invocation, no worktree.
|
|
93
|
+
- On illegal state transition, report and stop without partial commits.
|