mandrel 2.4.0 → 2.6.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.
Files changed (70) hide show
  1. package/.agents/audit-checklists/accessibility.md +29 -0
  2. package/.agents/audit-checklists/architecture.md +4 -5
  3. package/.agents/audit-checklists/clean-code.md +10 -0
  4. package/.agents/audit-checklists/data-model.md +22 -0
  5. package/.agents/audit-checklists/dependencies.md +11 -2
  6. package/.agents/audit-checklists/devops.md +4 -0
  7. package/.agents/audit-checklists/navigability.md +3 -0
  8. package/.agents/audit-checklists/performance.md +8 -11
  9. package/.agents/audit-checklists/privacy.md +3 -4
  10. package/.agents/audit-checklists/quality.md +2 -0
  11. package/.agents/audit-checklists/security.md +4 -5
  12. package/.agents/audit-checklists/seo.md +7 -1
  13. package/.agents/audit-checklists/sre.md +14 -12
  14. package/.agents/audit-checklists/ux-ui.md +4 -0
  15. package/.agents/docs/configuration.md +3 -0
  16. package/.agents/docs/workflows.md +4 -3
  17. package/.agents/schemas/agentrc.schema.json +17 -0
  18. package/.agents/schemas/audit-rules.json +134 -19
  19. package/.agents/schemas/audit-rules.schema.json +6 -2
  20. package/.agents/scripts/audit-labels-bootstrap.js +4 -4
  21. package/.agents/scripts/audit-to-stories.js +244 -19
  22. package/.agents/scripts/lib/audit-suite/checklist-threading.js +26 -3
  23. package/.agents/scripts/lib/audit-suite/dispatch-checklist.js +132 -0
  24. package/.agents/scripts/lib/audit-suite/index.js +1 -0
  25. package/.agents/scripts/lib/audit-suite/selector.js +290 -14
  26. package/.agents/scripts/lib/audit-to-stories/audit-lenses.js +2 -1
  27. package/.agents/scripts/lib/audit-to-stories/build-story-body.js +5 -1
  28. package/.agents/scripts/lib/audit-to-stories/dedupe-against-github.js +23 -3
  29. package/.agents/scripts/lib/audit-to-stories/finding-adapter.js +38 -0
  30. package/.agents/scripts/lib/audit-to-stories/ledger.js +256 -0
  31. package/.agents/scripts/lib/audit-to-stories/parse-audit-md.js +41 -7
  32. package/.agents/scripts/lib/audit-to-stories/seed-from-findings.js +20 -2
  33. package/.agents/scripts/lib/command-header.js +1 -1
  34. package/.agents/scripts/lib/config-settings-schema-delivery.js +21 -0
  35. package/.agents/scripts/lib/dynamic-workflow/performance-report-contract.js +5 -3
  36. package/.agents/scripts/lib/feedback-loop/audit-results-graduator.js +56 -0
  37. package/.agents/scripts/lib/findings/route-finding.js +108 -10
  38. package/.agents/scripts/lib/observability/runtime-friction.js +137 -6
  39. package/.agents/scripts/lib/orchestration/retro-proposals.js +0 -0
  40. package/.agents/scripts/lib/orchestration/run-epilogue.js +5 -19
  41. package/.agents/scripts/lib/orchestration/single-story-close/phases/post-land.js +11 -0
  42. package/.agents/scripts/lib/orchestration/story-close/phases/local-lens-review.js +81 -1
  43. package/.agents/scripts/lib/orchestration/story-close/phases/review-core.js +1 -0
  44. package/.agents/scripts/lib/orchestration/story-follow-ups.js +53 -13
  45. package/.agents/scripts/nav-registry-diff.js +449 -0
  46. package/.agents/workflows/audit-accessibility.md +243 -0
  47. package/.agents/workflows/audit-architecture.md +89 -71
  48. package/.agents/workflows/audit-clean-code.md +87 -53
  49. package/.agents/workflows/audit-data-model.md +198 -0
  50. package/.agents/workflows/audit-dependencies.md +143 -28
  51. package/.agents/workflows/audit-devops.md +109 -18
  52. package/.agents/workflows/audit-documentation.md +25 -53
  53. package/.agents/workflows/audit-navigability.md +78 -22
  54. package/.agents/workflows/audit-performance.md +207 -103
  55. package/.agents/workflows/audit-privacy.md +51 -13
  56. package/.agents/workflows/audit-quality.md +71 -61
  57. package/.agents/workflows/audit-security.md +94 -71
  58. package/.agents/workflows/audit-seo.md +80 -25
  59. package/.agents/workflows/audit-sre.md +99 -66
  60. package/.agents/workflows/audit-to-stories.md +44 -5
  61. package/.agents/workflows/audit-ux-ui.md +71 -17
  62. package/.agents/workflows/helpers/audit-dual-path.md +59 -0
  63. package/.agents/workflows/helpers/audit-self-check.md +70 -0
  64. package/.agents/workflows/helpers/audit-severity-scale.md +19 -0
  65. package/.agents/workflows/helpers/deliver-story.md +25 -0
  66. package/docs/CHANGELOG.md +23 -0
  67. package/package.json +1 -1
  68. package/.agents/audit-checklists/lighthouse.md +0 -15
  69. package/.agents/schemas/audit-results.schema.json +0 -69
  70. package/.agents/workflows/audit-lighthouse.md +0 -269
@@ -1,269 +0,0 @@
1
- ---
2
- description: Run a Lighthouse audit (Performance / Accessibility / Best Practices / SEO) and produce a structured findings report
3
- command: false
4
- ---
5
-
6
- # Lighthouse Audit & Analysis
7
-
8
- ## Applicability
9
-
10
- **Web targets only.** Registered with `target: "web"` in
11
- [`audit-rules.json`](../schemas/audit-rules.json): the selector skips this lens
12
- on a project with no web surface, since there is no page to launch Lighthouse
13
- against. See the `target` key's schema description for how applicability is
14
- probed from the consumer's checkout.
15
-
16
- ## Role
17
-
18
- Senior Web Performance & Quality Engineer. You operate Lighthouse end-to-end:
19
- launch the run, parse the JSON, surface the highest-leverage findings across
20
- all four categories, and produce a structured report the operator can act on.
21
-
22
- ## Context & Objective
23
-
24
- This is a **read-only** audit. Your job is to run Lighthouse, **parse and
25
- analyze the full result set** (scores, opportunities, diagnostics, per-audit
26
- failures), and emit a meaningful Markdown report at
27
- `{{auditOutputDir}}/audit-lighthouse-results.md`. Do not modify application
28
- code. The report's recommendations should be specific enough that a follow-up
29
- implementation pass (or the `/audit-performance` workflow) can act on them
30
- without re-running Lighthouse.
31
-
32
- **Target URL:** `[TARGET_URL]` — replace with the URL of a running build
33
- (e.g. `http://localhost:3000`, a preview deploy, or production). The dev
34
- server should be running in production mode where possible — dev-mode bundles
35
- inflate Performance scores misleadingly.
36
-
37
- **Form factor:** Run **Desktop** by default. If the project is mobile-first
38
- (check `viewport` meta, responsive CSS, or operator instruction), run
39
- **Mobile** instead and note the choice in the report.
40
-
41
- ## Scope (Story / plan-run mode)
42
-
43
- When this lens is invoked from `/deliver` close lenses (or a plan-run audit), the
44
- following block is populated with the Story (or plan-run) change-set file list.
45
- Otherwise — for any manual `/audit-<dimension>` invocation — the block
46
- renders the literal substitution token and you MUST treat it as **no
47
- scope filter — run the lens codebase-wide** exactly as you would have
48
- before this section existed.
49
-
50
- ```text
51
- {{changedFiles}}
52
- ```
53
-
54
- - If the block above contains a newline-delimited list of file paths,
55
- restrict your analysis to those files (and their direct dependencies
56
- when the lens explicitly calls for cross-file reasoning).
57
- - If the block above renders as the literal string `{{changedFiles}}`
58
- (i.e. no substitution was supplied), ignore this section entirely and
59
- proceed with the full codebase-wide scan defined in the remaining
60
- steps.
61
-
62
- ## Step 1: Pre-flight
63
-
64
- > Apply [`helpers/parallel-tooling.md`](helpers/parallel-tooling.md) when batching the scan below — independent reads belong in one turn, long shells run via `run_in_background` + `Monitor`.
65
-
66
- 1. Confirm the target URL is reachable (HTTP 200) before invoking Lighthouse.
67
- If the server is not running, stop and ask the operator to start it — do
68
- not attempt to start arbitrary dev servers yourself.
69
- 2. Confirm `{{auditOutputDir}}` exists. Create it if missing.
70
- 3. Note the run context in the report header: URL, form factor, timestamp,
71
- build mode (dev / prod / preview).
72
-
73
- ## Step 2: Run Lighthouse
74
-
75
- Use the `mcp__chrome-devtools__lighthouse_audit` tool (available via the
76
- chrome-devtools MCP server) against `[TARGET_URL]`. Capture **all four
77
- categories**: Performance, Accessibility, Best Practices, SEO.
78
-
79
- If the chrome-devtools MCP server is unavailable, fall back to the
80
- `lighthouse` CLI:
81
-
82
- ```bash
83
- npx lighthouse [TARGET_URL] \
84
- --output=json --output=html \
85
- --output-path={{auditOutputDir}}/lighthouse-raw \
86
- --preset=desktop \
87
- --chrome-flags="--headless --no-sandbox"
88
- ```
89
-
90
- Save the raw JSON alongside the report so future runs can diff against it.
91
-
92
- If Lighthouse fails to launch (Chromium not found, port in use, target
93
- unreachable), stop and report the environmental issue. Do not silently
94
- continue with partial data.
95
-
96
- ## Step 3: Parse & Analyze
97
-
98
- Extract and reason about the following from the JSON result:
99
-
100
- ### 3a. Category scores
101
-
102
- | Category | Score (0-100) |
103
- | --- | --- |
104
- | Performance | — |
105
- | Accessibility | — |
106
- | Best Practices | — |
107
- | SEO | — |
108
-
109
- ### 3b. Core Web Vitals & key metrics (Performance)
110
-
111
- Pull from `audits` and `categories.performance.auditRefs`:
112
-
113
- | Metric | Value | Score | Threshold (good / needs-improvement / poor) |
114
- | --- | --- | --- | --- |
115
- | Largest Contentful Paint (LCP) | — | — | ≤2.5s / ≤4.0s / >4.0s |
116
- | First Contentful Paint (FCP) | — | — | ≤1.8s / ≤3.0s / >3.0s |
117
- | Total Blocking Time (TBT) | — | — | ≤200ms / ≤600ms / >600ms |
118
- | Cumulative Layout Shift (CLS) | — | — | ≤0.1 / ≤0.25 / >0.25 |
119
- | Speed Index | — | — | ≤3.4s / ≤5.8s / >5.8s |
120
- | Time to Interactive (TTI) | — | — | ≤3.8s / ≤7.3s / >7.3s |
121
- | Interaction to Next Paint (INP, if present) | — | — | ≤200ms / ≤500ms / >500ms |
122
-
123
- ### 3c. Failed audits & opportunities
124
-
125
- For each category, enumerate every audit where `score < 1` (or
126
- `score === null` with a non-pass `scoreDisplayMode`). Group into:
127
-
128
- - **Opportunities** (Performance only): items with measurable
129
- `details.overallSavingsMs` or `overallSavingsBytes`. Rank by
130
- `overallSavingsMs` desc.
131
- - **Diagnostics**: informational findings without estimated savings.
132
- - **Failed audits** (Accessibility / Best Practices / SEO): every audit
133
- with `score < 1`. Include the affected nodes / URLs from `details.items`
134
- where present (cap at 5 examples per finding to keep the report
135
- readable).
136
-
137
- ### 3d. Cross-cutting observations
138
-
139
- After enumerating, look for **patterns across audits** — not just per-audit
140
- failures. Examples:
141
-
142
- - Same third-party origin showing up in `third-party-summary`,
143
- `render-blocking-resources`, and `network-rtt` → flag as a single
144
- systemic issue, not three separate ones.
145
- - Multiple Accessibility failures all rooted in one shared component
146
- (e.g. a design-system `<Button>` missing `aria-label`) → call that out
147
- explicitly so the fix is one place, not twenty.
148
- - LCP element is an image with no `width`/`height` and a low priority hint
149
- → connects LCP, CLS, and `unsized-images` into one fix.
150
-
151
- ## Step 4: Generate the Report
152
-
153
- Write `{{auditOutputDir}}/audit-lighthouse-results.md` using the template
154
- below. The report MUST include all sections, even if empty (write
155
- "_No findings._" rather than omitting). Include the absolute path to the raw
156
- JSON / HTML so the operator can drill in.
157
-
158
- ```markdown
159
- # Lighthouse Audit Report
160
-
161
- ## Run Context
162
-
163
- - **URL:** [TARGET_URL]
164
- - **Form factor:** Desktop | Mobile
165
- - **Build mode:** prod | dev | preview
166
- - **Timestamp:** YYYY-MM-DDTHH:MM:SSZ
167
- - **Lighthouse version:** [from JSON `lighthouseVersion`]
168
- - **Raw artifacts:** `{{auditOutputDir}}/lighthouse-raw.report.json`,
169
- `{{auditOutputDir}}/lighthouse-raw.report.html`
170
-
171
- ## Category Scores
172
-
173
- | Category | Score | Verdict |
174
- | --- | --- | --- |
175
- | Performance | — / 100 | good (≥90) / needs-improvement (50-89) / poor (<50) |
176
- | Accessibility | — / 100 | … |
177
- | Best Practices | — / 100 | … |
178
- | SEO | — / 100 | … |
179
-
180
- ## Core Web Vitals
181
-
182
- [Table from Step 3b, with verdict colour-word per row.]
183
-
184
- ## Top Findings
185
-
186
- > Prioritized across all four categories by estimated impact. List the top
187
- > 5–10 here so the operator has a clear "fix these first" list. Each entry
188
- > must be specific enough to act on without re-opening Lighthouse.
189
-
190
- ### 1. [Short title]
191
-
192
- - **Category:** Performance | Accessibility | Best Practices | SEO
193
- - **Audit ID:** [e.g. `unused-javascript`, `color-contrast`]
194
- - **Impact:** High | Medium | Low
195
- - **Estimated savings:** [e.g. "1.4s LCP / 320 KB transfer"] — omit for
196
- non-Performance findings.
197
- - **Evidence:** [Specific files / selectors / nodes from `details.items`,
198
- capped at 5 examples.]
199
- - **Recommendation:** [Concrete next step — file to edit, attribute to add,
200
- config to change. No vague "consider optimizing".]
201
-
202
- [Repeat for each top finding.]
203
-
204
- ## Performance — Full Breakdown
205
-
206
- ### Opportunities (ranked by overallSavingsMs)
207
-
208
- | Audit | Savings | Bytes | Notes |
209
- | --- | --- | --- | --- |
210
- | … | … | … | … |
211
-
212
- ### Diagnostics
213
-
214
- | Audit | Description | Notes |
215
- | --- | --- | --- |
216
- | … | … | … |
217
-
218
- ## Accessibility — Failed Audits
219
-
220
- | Audit | Severity | Affected nodes (count) | Example |
221
- | --- | --- | --- | --- |
222
- | … | … | … | … |
223
-
224
- ## Best Practices — Failed Audits
225
-
226
- [Same structure as Accessibility.]
227
-
228
- ## SEO — Failed Audits
229
-
230
- [Same structure as Accessibility.]
231
-
232
- ## Cross-Cutting Observations
233
-
234
- [From Step 3d. Patterns that span multiple audits / a single root cause
235
- showing up as several Lighthouse findings.]
236
-
237
- ## Suggested Next Steps
238
-
239
- - [3–5 bullet points the operator can hand to a follow-up workflow
240
- (`/audit-performance` for backend bottlenecks, manual fix passes for
241
- per-component a11y violations, etc.) Each bullet should map to a finding
242
- above by ID.]
243
- ```
244
-
245
- ## Step 5: Sanity-check the Report
246
-
247
- Before returning, re-read the generated report and verify:
248
-
249
- - Every category in Step 3a has a score (no dashes left as placeholders).
250
- - Every "Top Findings" entry has a concrete `Recommendation` — not a
251
- generic "improve performance".
252
- - The raw artifact paths exist on disk.
253
- - Section "Cross-Cutting Observations" is non-empty if and only if the
254
- result set actually contains overlapping findings (don't fabricate
255
- patterns to fill the section — write "_No cross-cutting patterns
256
- detected._" if there genuinely aren't any).
257
-
258
- ## Constraints
259
-
260
- - **Read-only.** Do not modify application code, dependencies, or
261
- configuration as part of this workflow. Surfacing fix recommendations is
262
- the deliverable; applying them is a separate workflow.
263
- - **Single run.** One Lighthouse invocation per run of this workflow. Do
264
- not loop — variance between runs is expected and a single snapshot is
265
- sufficient for the report. If the operator wants a stability profile,
266
- that's a different workflow (`/audit-performance`).
267
- - **No fabrication.** Every score, metric, and audit ID in the report must
268
- trace back to the raw JSON. If a value is missing from the run (e.g.
269
- INP often is), say so — don't invent it.