@jeiemgi/cckit 0.5.0 → 0.7.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 (144) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +34 -3
  3. package/README.md +95 -6
  4. package/bin/cckit +90 -3
  5. package/cckit.config.json +7 -2
  6. package/kit.config.schema.json +26 -1
  7. package/package.json +1 -1
  8. package/profiles/automation.json +2 -1
  9. package/profiles/content.json +2 -1
  10. package/profiles/minimal.json +2 -1
  11. package/profiles/research.json +2 -1
  12. package/profiles/software.json +2 -1
  13. package/scripts/benchmark/benchmark-test.sh +83 -0
  14. package/scripts/benchmark/gate.sh +55 -0
  15. package/scripts/benchmark/lib/bench-common.sh +70 -0
  16. package/scripts/benchmark/lib/model.sh +116 -0
  17. package/scripts/benchmark/report.sh +105 -0
  18. package/scripts/benchmark/run-quality.sh +102 -0
  19. package/scripts/benchmark/run.sh +166 -0
  20. package/scripts/benchmark/stop-check.sh +83 -0
  21. package/scripts/commitlint-test.sh +58 -0
  22. package/scripts/init.sh +57 -1
  23. package/scripts/kit-self-update.sh +55 -0
  24. package/scripts/lib/board-view-test.sh +1 -0
  25. package/scripts/lib/board-view.sh +1 -0
  26. package/scripts/lib/captain-test.sh +62 -0
  27. package/scripts/lib/captain.sh +105 -17
  28. package/scripts/lib/cckit-output.sh +1 -0
  29. package/scripts/lib/commitlint.sh +54 -0
  30. package/scripts/lib/config-path-test.sh +1 -0
  31. package/scripts/lib/config-path.sh +1 -0
  32. package/scripts/lib/copilot-test.sh +1 -0
  33. package/scripts/lib/copilot.sh +1 -0
  34. package/scripts/lib/effort-dispatch-test.sh +10 -0
  35. package/scripts/lib/effort-flows-test.sh +1 -0
  36. package/scripts/lib/effort-metrics-test.sh +1 -0
  37. package/scripts/lib/effort-metrics.sh +1 -0
  38. package/scripts/lib/effort-ops-test.sh +360 -0
  39. package/scripts/lib/effort-ops.sh +372 -16
  40. package/scripts/lib/effort-parity-test.sh +1 -0
  41. package/scripts/lib/effort-plan.sh +1 -0
  42. package/scripts/lib/effort-slug-test.sh +32 -0
  43. package/scripts/lib/effort-slug.sh +72 -8
  44. package/scripts/lib/effort.sh +1 -0
  45. package/scripts/lib/engine-adapter.sh +1 -0
  46. package/scripts/lib/errors-header-test.sh +86 -0
  47. package/scripts/lib/gh-log.sh +1 -0
  48. package/scripts/lib/gh-project-test.sh +1 -0
  49. package/scripts/lib/gh-project.sh +1 -0
  50. package/scripts/lib/git-remote-test.sh +1 -0
  51. package/scripts/lib/git-remote.sh +1 -0
  52. package/scripts/lib/handoff.sh +23 -2
  53. package/scripts/lib/kit-brief-test.sh +292 -0
  54. package/scripts/lib/kit-brief.sh +376 -0
  55. package/scripts/lib/kit-cli-test.sh +1 -0
  56. package/scripts/lib/kit-cli.sh +1 -0
  57. package/scripts/lib/kit-config-resolve.sh +1 -0
  58. package/scripts/lib/kit-config-test.sh +14 -0
  59. package/scripts/lib/kit-config.sh +7 -0
  60. package/scripts/lib/kit-engine-test.sh +1 -0
  61. package/scripts/lib/kit-events.sh +1 -0
  62. package/scripts/lib/kit-gc-test.sh +125 -0
  63. package/scripts/lib/kit-gc.sh +193 -5
  64. package/scripts/lib/kit-interview-test.sh +1 -0
  65. package/scripts/lib/kit-interview.sh +1 -0
  66. package/scripts/lib/kit-lib-test.sh +226 -0
  67. package/scripts/lib/kit-lib.sh +308 -0
  68. package/scripts/lib/kit-local.sh +1 -0
  69. package/scripts/lib/kit-manifest.sh +1 -0
  70. package/scripts/lib/kit-mode-test.sh +1 -0
  71. package/scripts/lib/kit-mode.sh +1 -0
  72. package/scripts/lib/kit-msg-test.sh +1 -0
  73. package/scripts/lib/kit-msg.sh +1 -0
  74. package/scripts/lib/kit-operate.sh +1 -0
  75. package/scripts/lib/kit-profile-test.sh +1 -0
  76. package/scripts/lib/kit-profile.sh +1 -0
  77. package/scripts/lib/kit-state-test.sh +89 -0
  78. package/scripts/lib/kit-state.sh +61 -0
  79. package/scripts/lib/kit-status-test.sh +233 -0
  80. package/scripts/lib/kit-status.sh +415 -0
  81. package/scripts/lib/kit-task-ops-test.sh +22 -0
  82. package/scripts/lib/kit-task-ops.sh +51 -2
  83. package/scripts/lib/next.sh +1 -0
  84. package/scripts/lib/plan-machine-test.sh +54 -0
  85. package/scripts/lib/plan-machine.sh +86 -25
  86. package/scripts/lib/plan-next-test.sh +1 -0
  87. package/scripts/lib/plan-next.sh +1 -0
  88. package/scripts/lib/pr-evidence-test.sh +259 -0
  89. package/scripts/lib/pr-evidence.sh +220 -35
  90. package/scripts/lib/project-scan.sh +1 -0
  91. package/scripts/lib/react-detect.sh +1 -0
  92. package/scripts/lib/render-test.sh +1 -0
  93. package/scripts/lib/render.sh +1 -0
  94. package/scripts/lib/role-identity.sh +1 -0
  95. package/scripts/lib/secret-guard.sh +21 -1
  96. package/scripts/lib/toon.sh +1 -0
  97. package/scripts/lib/ui.sh +1 -0
  98. package/scripts/lib/version-bump-test.sh +1 -0
  99. package/scripts/lib/version-bump.sh +1 -0
  100. package/scripts/lib/worktree-bootstrap-test.sh +220 -0
  101. package/scripts/lib/worktree-issue-test.sh +15 -1
  102. package/scripts/lib/worktree-issue.sh +23 -8
  103. package/scripts/lib/worktree-start.sh +191 -7
  104. package/scripts/lib/zsh-safety-test.sh +10 -0
  105. package/scripts/orchestrate.sh +8 -1
  106. package/scripts/portable-test.sh +13 -2
  107. package/scripts/self-install-test.sh +282 -0
  108. package/scripts/setup-labels.sh +1 -0
  109. package/scripts/status.sh +68 -40
  110. package/scripts/task-sync.sh +13 -0
  111. package/scripts/ux-a11y-scan.sh +96 -0
  112. package/scripts/ux-ds-audit.sh +146 -0
  113. package/scripts/ux-graph-scan.sh +188 -0
  114. package/skills/kit-autopilot/SKILL.md +6 -1
  115. package/skills/kit-cleanup/SKILL.md +83 -0
  116. package/skills/kit-effort-close/SKILL.md +3 -0
  117. package/skills/kit-effort-new/SKILL.md +7 -0
  118. package/skills/kit-effort-start/SKILL.md +39 -4
  119. package/skills/kit-gc/SKILL.md +19 -0
  120. package/skills/kit-next/SKILL.md +5 -0
  121. package/skills/kit-status/SKILL.md +92 -0
  122. package/skills/kit-task-start/SKILL.md +7 -1
  123. package/skills/kit-ux-audit/SKILL.md +241 -0
  124. package/skills/kit-ux-audit/references/a11y.md +79 -0
  125. package/skills/kit-ux-audit/references/consistency.md +106 -0
  126. package/skills/kit-ux-audit/references/graph-model.md +92 -0
  127. package/skills/kit-ux-audit/references/heuristics.md +157 -0
  128. package/skills/kit-ux-audit/references/report.md +172 -0
  129. package/templates/agents/ux.md +89 -0
  130. package/templates/benchmarks/SCHEMA.md +75 -0
  131. package/templates/benchmarks/abstain.jsonl +8 -0
  132. package/templates/benchmarks/adversarial.jsonl +8 -0
  133. package/templates/benchmarks/benchmark.config.json +14 -0
  134. package/templates/benchmarks/quality.jsonl +8 -0
  135. package/templates/benchmarks/retrieval.jsonl +7 -0
  136. package/templates/rules/branch-naming.md +20 -1
  137. package/templates/rules/communication-style.md +8 -0
  138. package/templates/rules/delegation-brief.md +38 -4
  139. package/templates/rules/effort-model.md +47 -4
  140. package/templates/rules/naming-and-ids.md +199 -0
  141. package/templates/rules/task-management.md +1 -1
  142. package/templates/settings/settings.json.tmpl +9 -0
  143. package/templates/skills/concrete/SKILL.md +117 -0
  144. package/templates/skills/karpathy-guidelines/SKILL.md +1 -0
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: kit-status
3
+ description: Answer "where are we?" in three buckets — local undone work (dirty worktrees, commits on no remote, effort subs not merged in), open PRs waiting on a human (no approval, no AI-reviewer pass, unresolved threads, red checks, conflicts), and cleanup available local + remote. Read-only, so it is always safe to run first.
4
+ when_to_use: |
5
+ Whenever the owner asks, in ANY wording, how things stand overall — this is the default answer to
6
+ an open status question, and it fires on the phrasing people actually use, not one canonical form:
7
+
8
+ - "where are we" · "where we at" · "where are we at" · "where do we stand" · "where did we leave off"
9
+ - "status" · "what's the status" · "give me a status" · "sitrep" · "state of play"
10
+ - "what's the current state" · "current state" · "what's the state of things"
11
+ - "how are we doing" · "how's it going" · "how are things" · "how're we looking" · "are we good"
12
+ - "what's left" · "what's outstanding" · "what's still open" · "anything pending"
13
+ - "what needs my attention" · "anything waiting on me" · "anything I need to look at"
14
+ - "anything to clean up" · "is the repo tidy"
15
+ - "catch me up" · "recap" · "bring me up to speed" · "what did we do" · "update me"
16
+ - at the start of a session, to pick up where the last one stopped
17
+ - the same question in whatever language the project speaks (`project.language` in the config) —
18
+ in Spanish: "cómo vamos" · "en qué estamos" · "qué falta" · "estado" · "dónde quedamos"
19
+
20
+ The list is illustrative, not exhaustive. Any open-ended question about overall progress belongs
21
+ here, including phrasings not written above.
22
+
23
+ SKIP it when the question has a specific subject — "how's the login bug doing", "what's the status
24
+ of PR 41", "where are we on the migration". Those are about one thing; answer them directly. This
25
+ skill is for the unqualified question, where the owner wants the whole picture.
26
+
27
+ For the board alone use `/kit-task-sync`; for what to pick up next use `/kit-next`; to act on the
28
+ cleanup this reports use `/kit-cleanup`.
29
+ ---
30
+
31
+ # kit-status — where are we?
32
+
33
+ Plugin-direct skill — a thin caller over `cckit status`. The bucket logic lives in
34
+ `${CLAUDE_PLUGIN_ROOT}/scripts/lib/kit-status.sh` (kit-engine-boundary: the verb logic has one
35
+ home, never inline in a skill).
36
+
37
+ **Run this before answering any "where are we" question with `git` output.** Plain `git status` and
38
+ `git branch -vv` answer a different question — they describe refs, not work — and they cannot see
39
+ which PRs are waiting on a person or which branches are safe to delete. That substitution is the
40
+ mistake this skill exists to prevent.
41
+
42
+ ## Execution
43
+
44
+ ```bash
45
+ cckit status # the three buckets as markdown
46
+ cckit status --llm # the same verdicts as JSON, for an agent
47
+ ```
48
+
49
+ Read-only. It writes nothing, deletes nothing, and pushes nothing.
50
+
51
+ ## The three buckets, in this order
52
+
53
+ | # | Bucket | What it answers |
54
+ | --- | --- | --- |
55
+ | 1 | **Local undone work** | What exists only on this machine: worktrees with uncommitted changes, branches holding commits reachable from **no** remote ref, and effort subs not yet merged into their effort branch. Plus the worktree inventory — a clean worktree on an issue branch is still work in progress. |
56
+ | 2 | **PRs waiting on a human** | Every open PR with the ONE thing it needs: `conflict`, `checks`, `draft`, `wait`, `threads`, `ai-review`, `review`, or `ready`. |
57
+ | 3 | **Cleanup available** | Branches and worktrees that can go — **local and remote** — plus what is deliberately kept (orphan work, open-issue branches). |
58
+
59
+ ## Reading bucket 2
60
+
61
+ The verdict is the single next action, most-blocking first, because the later signals cannot be
62
+ acted on until the earlier ones clear:
63
+
64
+ | Verdict | Means |
65
+ | --- | --- |
66
+ | `conflict` | Merge state is `CONFLICTING`. Rebase onto the base; nothing else about the PR can be judged until then. |
67
+ | `checks` | A required check is failing. A review would be premature. |
68
+ | `draft` | Still a draft — the author has not asked for anything yet. |
69
+ | `wait` | Checks are still running. Nothing to do but wait. |
70
+ | `threads` | Unresolved review threads. The reviewer already spoke, so this outranks a missing approval. |
71
+ | `ai-review` | No AI-reviewer pass yet. Only reported when the repo evidently uses one (a reviewer config, or an AI review on another open PR) — never in a repo that has none. |
72
+ | `review` | Green, no human approval yet. This is the one that needs the owner. |
73
+ | `ready` | Green and approved. Mergeable. |
74
+
75
+ **A superseded check run never counts.** Re-running a check — or retitling a PR, which re-fires a
76
+ title gate — leaves the old run in GitHub's rollup. Counting every context there reports a PR as
77
+ failing a check that has since passed, so the fetcher keeps only the latest run per check name.
78
+
79
+ ## Rules
80
+
81
+ - **Never answer a status question from `git` output alone.** Run this first; drop to raw `git` or
82
+ `gh` only for something the buckets genuinely do not cover, and say what that was.
83
+ - **Match on intent, not on wording.** "how are we doing", "catch me up", "cómo vamos" and "where
84
+ we at" are the same question. Do not wait for the phrase "where are we" — an unqualified question
85
+ about overall progress is this skill, whatever words or language it arrives in.
86
+ - **Present all three buckets, in order, even when one is empty.** Each bucket names its own
87
+ emptiness ("nothing local-only", "no open PRs"). A silently missing bucket is indistinguishable
88
+ from a clean one, and this report is read to decide what to do next.
89
+ - **Report, do not act.** This skill deletes nothing and merges nothing. Bucket 3 is a pointer to
90
+ `/kit-cleanup`; bucket 2 is a pointer to a review or a merge. Ask before acting on either.
91
+ - **Do not restate the raw table.** Lead with what needs the owner's attention — usually the PRs
92
+ with `review` or `threads` — then the rest.
@@ -16,7 +16,13 @@ here (kit-engine-boundary #1/#2 — same single-implementation principle as the
16
16
  - the isolated worktree at `.claude/worktrees/<kind>+<N>-<slug>` (reused if it already exists;
17
17
  the dir name encodes issue #N so `kit-gc` won't wipe it while the issue is open)
18
18
  - **bootstrap** (`wt_bootstrap`): copies gitignored `.env.local*` + project ids into the worktree,
19
- assigns a per-worktree dev PORT, installs deps (`KIT_WT_INSTALL=0` opts out)
19
+ assigns a per-worktree dev PORT, installs deps **at the selected targets**, in
20
+ this precedence: **`worktree.installPaths` if set** — those dirs only, installed whether or not
21
+ each declares dependencies, `[]` means nothing, and the
22
+ checks below are skipped; **else** the root *only when* its manifest declares dependencies or it is a
23
+ workspace root *with at least one member*; **else nothing**. A dependency-free root is skipped so
24
+ pnpm can't plant an empty `pnpm-lock.yaml` the captain then holds the PR on. `installPaths`
25
+ entries that point outside the worktree are refused. `KIT_WT_INSTALL=0` opts out entirely
20
26
  - the **claim precheck** (#124): warns when the issue is already In Progress on the board —
21
27
  another session may own it
22
28
  - the live-session **collision guard**: never disturbs a worktree a live session is sitting in
@@ -0,0 +1,241 @@
1
+ ---
2
+ name: kit-ux-audit
3
+ description: Expert UX/UI audit of a front-end app, driven by a component/screen graph instead of a screen-by-screen walkthrough. Three lanes over one graph and one report — flows (routes ↔ screens ↔ containers ↔ components ↔ data entities ↔ forms; a UX agent runs 12 heuristics to surface confusing or erratic flows: the same data editable from many screens, deep paths to frequent actions, orphan/dead-end screens, heavy forms, structurally inconsistent patterns, overloaded screens, unguarded deletes, nav-away data loss), consistency (deterministic design-system pass: hand-rolled UI, className overrides on shared primitives, sibling-screen layout drift, variants-in-disguise, dead CSS — the model only classifies), and a11y (semantic-HTML + accessibility: non-semantic interactive elements, missing text alternatives, unlabeled controls, heading/landmark gaps, focus and keyboard problems). Emits a self-contained, accessible HTML report. Use AUTOMATICALLY when the user asks for a UX audit / UX review, to analyze app flows or navigation, to find where a piece of data can be edited, to check form usability, to review information architecture, to find confusing / hard-to-fill screens, for a design-system consistency pass / DS audit / "is this page consistent" / "what should be a variant" / "find hand-rolled solutions", OR for an accessibility / semantic-HTML review / "is this markup accessible" / "find non-semantic divs". Optional graphify integration; falls back to a dependency-free deterministic scan. Visual verification (Playwright / Chrome screenshots) is opt-in via --visual.
4
+ when_to_use: Before a redesign, after a feature that added screens or forms, when users report "I can't find where to change X" or "there are too many places to edit this", before scoping a UI refactor effort, or on demand for an IA / flow / consistency / accessibility health check. Targets component front-ends (Next.js, React Router v7, Vite React, Vue). For a purely visual per-screen critique of a running app, use a visual design-critique skill instead — this one reasons over structure. The a11y lane is a source-level check, not a substitute for axe / Lighthouse against the running app.
5
+ argument-hint: "[--lane flows|consistency|a11y|all] [--path <dir>] [--app <name>] [--visual] [--rebuild-graph] [--primitives <index.ts>] [--css <theme.css>] [--css-prefix <p>] [--dry-run]"
6
+ allowed-tools: Bash, Read, Write, Glob, Grep, AskUserQuestion, Task, Skill
7
+ ---
8
+
9
+ # kit-ux-audit — graph-driven UX/UI audit
10
+
11
+ Analyze how a front-end app's **flows, data-editing surfaces, forms, and design-system usage** hang
12
+ together by reasoning over a **graph** of the app — not by opening screen after screen. Two lanes,
13
+ one graph, one HTML report. Detection is deterministic (a script / the graph); judgment is the
14
+ model. Never eyeball a codebase for something a script already finds — run it, read it, then think.
15
+
16
+ | Lane | What it does | Detector | Judge | Heuristics |
17
+ | --- | --- | --- | --- | --- |
18
+ | `flows` (default) | Confusing / erratic flows, IA, edit surfaces, forms | graph (graphify or fallback scan) | **ux** agent | `references/heuristics.md` (H1–H12) |
19
+ | `consistency` | Design-system consistency: hand-rolled UI, primitive className drift, sibling-screen drift, variants-in-disguise, dead CSS | `scripts/ux-ds-audit.sh` | **ux** agent → routes decisions to designer/frontend | `references/consistency.md` (C1–C6) |
20
+ | `a11y` | Semantic HTML + accessibility: non-semantic interactives, missing text alternatives, unlabeled controls, heading/landmark gaps, focus/keyboard | `scripts/ux-a11y-scan.sh` | **ux** agent | `references/a11y.md` (A1–A5) |
21
+ | `all` | All three lanes, merged into one report | all | | all |
22
+
23
+ Kit lives at `${CLAUDE_PLUGIN_ROOT}`. Engines:
24
+ - `scripts/ux-graph-scan.sh` — `--apps <root>` (enumerate app-like packages) · `--scan <dir>`
25
+ (deterministic, dependency-free flows graph: routes, renders, nav, data reads/writes, forms).
26
+ No LLM, no API key. Sources `scripts/lib/react-detect.sh`.
27
+ - `scripts/ux-ds-audit.sh` — deterministic design-system occurrence lists (grep/perl, macOS-safe).
28
+ Parameterized: `--primitives <ui-barrel>` `--css <theme.css>` `--css-prefix <p>` — so it runs
29
+ against any design system, nothing hardcoded.
30
+ - `scripts/ux-a11y-scan.sh` — deterministic semantic-HTML / accessibility smell lists (grep/perl,
31
+ macOS-safe). No parameters beyond `--exclude`.
32
+
33
+ There is **no report renderer**. The report is written by hand from `findings.json` following the
34
+ `kit-docs-writer` skill — see `references/report.md`.
35
+
36
+ References — load only when you reach the step that needs one:
37
+ - `references/graph-model.md` — normalized node/edge model; how graphify `graph.json` and the
38
+ fallback scan both map onto it; how to derive click-depth / god-nodes / community bridges /
39
+ edit-surface map.
40
+ - `references/heuristics.md` — the 12 `flows` heuristics: graph signal, default severity, whether
41
+ the finding needs visual confirmation. **This is the flows audit.**
42
+ - `references/consistency.md` — the `consistency` lane: the `ux-ds-audit.sh` sections, the
43
+ LAYOUT / VISUAL / BEHAVIOR classification, sibling-screen comparison, variant proposals.
44
+ - `references/a11y.md` — the `a11y` lane: the `ux-a11y-scan.sh` groups, DEFECT / OK / NEEDS_VISUAL
45
+ triage, and the fix each smell maps to.
46
+ - `references/report.md` — how to **write** the report: the `findings.json` schema, the section
47
+ order (it is `kit-docs-writer`'s page template, filled for an audit), the voice, and the visual
48
+ identity (Datatype display + Open Sans body + IBM Plex Mono for evidence, semantic + accessible HTML).
49
+
50
+ ## 0. Orient, pick lane & target
51
+
52
+ 1. Read `./.claude/kit.config.json` if present (for `apps`, repo root). Not required.
53
+ 2. **Lane:** honor `--lane`. No flag: request about consistency / variants / hand-rolled UI →
54
+ `consistency`; request about accessibility / semantic HTML / ARIA / keyboard → `a11y`;
55
+ otherwise `flows`. If ambiguous, `AskUserQuestion` (flows / consistency / a11y / all).
56
+ 3. **Target app:**
57
+ - `--path <dir>` → that directory. Skip enumeration.
58
+ - Else `bash "${CLAUDE_PLUGIN_ROOT}/scripts/ux-graph-scan.sh" --apps <root>` — lists every
59
+ app-like package (has `react`/`next`/`vue` + a `dev` script) with framework + router.
60
+ 0 → stop ("No component front-end found under <root>."). 1 → use it, say which. 2+ →
61
+ `AskUserQuestion` which to audit (honor `--app <name>`).
62
+ 4. **Consistency-lane inputs:** resolve `--primitives` (the shared UI barrel, e.g.
63
+ `packages/ui/src/index.ts`), `--css` (the app theme/token file, repeatable), `--css-prefix`
64
+ (the project's custom-class prefix, if it has one — no default; the section-8 hunt is skipped
65
+ without it). If the project ships a rules file naming these (`.claude/rules/*ui-convention*`),
66
+ read it first. Missing barrel → run anyway, note the gap.
67
+ 5. Record for the report: lane, target path, framework, router, monorepo yes/no.
68
+ 6. `--dry-run` → print the resolved lane, target, graph source, and the checks that will run, then
69
+ stop. Touch nothing.
70
+
71
+ ## 1. Get the graph (`flows` / `all`)
72
+
73
+ Target dir = `$T`. Prefer an existing rich graph; never rebuild silently.
74
+
75
+ 1. `$T/graphify-out/graph.json` **or** `./graphify-out/graph.json` exists and **no**
76
+ `--rebuild-graph` → use it. Report "graph source: graphify".
77
+ 2. Else `bash "${CLAUDE_PLUGIN_ROOT}/scripts/ux-graph-scan.sh" --scan "$T"` → writes
78
+ `$T/graphify-out/.ux_graph.json` (normalized model). Report "graph source: deterministic scan
79
+ (approximate)".
80
+ 3. Say **once**, without blocking: "For a richer semantic graph, run `/graphify $T` first, then
81
+ re-run." Never wait, never prompt for an API key — the fallback is enough.
82
+ 4. `--rebuild-graph` + graphify installed → you MAY run `/graphify "$T" --directed` first (best
83
+ graph for this skill). Only on the explicit flag.
84
+
85
+ Normalize to `references/graph-model.md`, persist to `$T/graphify-out/.ux_model.json`, and derive:
86
+ click-depth per screen from each entry route, god-nodes, community bridges, the edit-surface map.
87
+ Keep it compact — you hand slices to the agent, not the whole graph.
88
+
89
+ ## 2. Run the checks
90
+
91
+ ### Lane `flows`
92
+
93
+ Spawn the **ux** agent (`templates/agents/ux.md`; in an onboarded project
94
+ `.claude/agents/ux/AGENT.md`). Give it **only** these slices as compact JSON — never source files:
95
+ routes/screens with click-depth · god-nodes (id, fan-in, rendering screens) · community bridges ·
96
+ per `data-entity` its `reads`/`writes`/`mutates` edges + source screen · per `form` its field
97
+ count, required count, multi-step?, host screen(s), any `duplicates` edge.
98
+
99
+ Ask it to apply **every** heuristic in `references/heuristics.md` and return findings in the
100
+ `findings.json` schema (`references/report.md`). Agent rule: **never invent an edge** — if a
101
+ verdict needs something the graph doesn't show, set `needs_visual: true` and say what to check.
102
+
103
+ For a large app, fan classification out to read-only `Explore` sub-agents (one per heuristic
104
+ group), each briefed with `references/heuristics.md`.
105
+
106
+ ### Lane `consistency`
107
+
108
+ ```bash
109
+ bash "${CLAUDE_PLUGIN_ROOT}/scripts/ux-ds-audit.sh" "$T/src" \
110
+ [--exclude <re>] --primitives "<ui-barrel>" --css "<theme.css>" [--css-prefix <p>] \
111
+ > "$T/graphify-out/.ux_ds_audit.txt"
112
+ ```
113
+
114
+ Then follow `references/consistency.md`: classify every primitive-with-className row into
115
+ LAYOUT / VISUAL / BEHAVIOR, run the sibling-screen comparison for a page scope, map hand-rolled
116
+ recipes to the primitive that should own them, judge custom CSS (variant-in-disguise vs layout vs
117
+ dead). Emit the same `findings.json` schema (heuristic ids `C1`…`C6`). Fan out to `Explore`
118
+ sub-agents by section group for a large scope.
119
+
120
+ ### Lane `a11y`
121
+
122
+ ```bash
123
+ bash "${CLAUDE_PLUGIN_ROOT}/scripts/ux-a11y-scan.sh" "$T/src" [--exclude <re>] \
124
+ > "$T/graphify-out/.ux_a11y_scan.txt"
125
+ ```
126
+
127
+ Then follow `references/a11y.md`: triage every row DEFECT / OK / NEEDS_VISUAL, map each DEFECT to
128
+ its fix (the native element, the text alternative, the label wiring, the heading/landmark
129
+ structure, the focus/keyboard fix), and cite the project's own `.claude/rules/*` slug where one
130
+ applies. Emit the same `findings.json` schema (heuristic ids `A1`…`A5`). Fan out to `Explore`
131
+ sub-agents by group for a large scope. This is a source check — say in the report that a
132
+ rendered-app axe / Lighthouse run still belongs on the list.
133
+
134
+ ## 3. Optional visual verification (`--visual` only)
135
+
136
+ Without `--visual`: skip. The report still lists every `needs_visual` finding under "Candidates for
137
+ visual review" (screen + what to look at), ranked by severity.
138
+
139
+ With `--visual`:
140
+ 1. Find a base URL: a `dev`/`start` script + conventional port, or ask the user. No server → skip
141
+ captures, keep the candidate list, say so in the report.
142
+ 2. For each `needs_visual` finding of severity `crit`/`p1`, up to a cap (default 8): navigate with
143
+ Playwright or the Chrome MCP, screenshot the screen, save under
144
+ `$T/graphify-out/ux-audit/shots/`. **Never trigger a native browser dialog.**
145
+ 3. Record each shot's filename on its finding (`"shot": "<id>.png"`) so it renders inline.
146
+
147
+ ## 4. Write the report
148
+
149
+ There is **no renderer**. Load the **`kit-docs-writer`** skill and write
150
+ `$T/UX_FLOW_REPORT.html` from `findings.json`, following `references/report.md`:
151
+
152
+ - the section order there **is** `kit-docs-writer`'s page template, filled for an audit (title →
153
+ one-line description → run facts → one diagram if it earns its place → findings grouped by
154
+ severity → flow map → edit-surface table → still-to-check → what to do next);
155
+ - its voice rules apply — zero analogies, define each heuristic term once, front-load, lists over
156
+ prose, callouts sparingly;
157
+ - the visual identity is fixed: **Datatype** (Google Fonts) as the protagonist display face for
158
+ the title, headings, finding lead lines and severity counts; **Open Sans** for body;
159
+ **IBM Plex Mono** for evidence/ids/paths; antialiased; one embedded `<style>`, screenshots as
160
+ `data:` URIs;
161
+ - the HTML is a full, semantic, accessible, theme-aware document (landmarks, one `<h1>`, ordered
162
+ headings, `<dl>`/`<table>`/`<ul>` for the right content, skip link, `:focus-visible`), readable
163
+ with no JavaScript.
164
+
165
+ **Not an artifact.** It is a file in the target repo. Do not publish it with the Artifact tool.
166
+ Run the `kit-docs-writer` checklist and the accessibility list in `references/report.md` before
167
+ calling it done.
168
+
169
+ ## 5. Open the report, then report back (TOON, terse)
170
+
171
+ **Open the report and hand the user a direct link to it — this is the last action, always.**
172
+
173
+ ```bash
174
+ REPORT="$T/UX_FLOW_REPORT.html"
175
+ case "$(uname)" in
176
+ Darwin) open "$REPORT" 2>/dev/null || true ;;
177
+ Linux) xdg-open "$REPORT" >/dev/null 2>&1 || true ;;
178
+ esac
179
+ printf 'Report: file://%s\n' "$(cd "$(dirname "$REPORT")" && pwd)/$(basename "$REPORT")"
180
+ ```
181
+
182
+ Print that **bare `file://` URL as the final line of the reply** (no markdown link — terminals
183
+ don't render OSC 8). If `open`/`xdg-open` is unavailable or headless, still print the URL and say
184
+ the file is ready to open.
185
+
186
+ Then print the top findings by severity as a small TOON table (heuristic · entity/scope · screens ·
187
+ severity). Then offer one trace:
188
+
189
+ > "The most tangled flow this graph shows: **<entity>** is edited from <n> screens (<list>). Want me
190
+ > to trace how they diverge?"
191
+
192
+ Yes + graphify source → `/graphify path "<screenA>" "<entity>"`. Otherwise walk the `writes`/
193
+ `mutates` edges for that entity from the graph JSON and show where the forms differ.
194
+
195
+ Then `AskUserQuestion` for every open call (effort split, which of two competing treatments wins,
196
+ widths/paddings, anything with a visual value). Label assumed vs decided.
197
+
198
+ ## 6. Route + hand off
199
+
200
+ - Findings are analysis, not tickets — this skill does not file GitHub issues. Whole app / many
201
+ files → `/kit-effort-new` (in the consistency lane: a foundation sub first, sweeps parallel, a
202
+ variant-adoption sweep last). One screen/component → the quick lane, still in a worktree.
203
+ - **Consistency lane:** design DECISIONS (a new visual value, which of two treatments wins, a new
204
+ variant's look) → the **designer** agent. IMPLEMENTATION with existing tokens → the **frontend**
205
+ agent. Every new shared primitive/variant lands with its inventory row in the project's UI
206
+ conventions rule + its barrel export in the same PR.
207
+ - **Verification of a consistency pass** = re-run `ux-ds-audit.sh` on the same scope and
208
+ re-classify: none may classify VISUAL; hand-rolled recipe sections are zero outside the UI
209
+ package.
210
+
211
+ ## Rules
212
+
213
+ - **Graph / script first, files last.** Never read component source screen-by-screen. Open a file
214
+ only to confirm a specific flagged finding, capped at 12 files, and report the count.
215
+ - **Never rebuild graphify implicitly.** `--rebuild-graph` is the only regenerating path.
216
+ - **No API key, ever.** The fallback scan is deterministic.
217
+ - **`--visual` is the only image-token cost and it is opt-in.** Default runs are text-only.
218
+ - **The agent never invents an edge.** Ambiguous → `needs_visual: true`, not an assertion.
219
+ - **The report is written, not rendered, and never an artifact.** Author it from `findings.json`
220
+ via `kit-docs-writer` per `references/report.md` — one self-contained HTML file in the target
221
+ repo. Datatype is the protagonist face; Open Sans is the body; IBM Plex Mono is the evidence.
222
+ The document itself must pass the same
223
+ bar the `a11y` lane checks for: full doctype + `lang`, landmarks, one `<h1>`, ordered headings,
224
+ `<dl>`/`<table>`/`<ul>` for the right content, a skip link, `:focus-visible`, readable with no
225
+ JavaScript.
226
+ - **Lane boundary:** `flows` H8/H9 flag *structural* pattern divergence and shared-component
227
+ overload only; the *visual/token* judgment (className diff, variant proposals) is the
228
+ `consistency` lane; *semantic-element and accessibility* defects are the `a11y` lane. Don't
229
+ double-report the same node in more than one lane — cross-link instead.
230
+ - **Project-agnostic.** This skill hardcodes no framework token names, no primitive library, no
231
+ path conventions beyond the common ones it probes for. Everything project-specific arrives as a
232
+ flag or is read from the project's own `.claude/` rules at run time.
233
+
234
+ ## Optional: seed a graphify graph at install time
235
+
236
+ Seeding the graph once makes every later run richer and cheaper. Opt-in, outside the default flow:
237
+ 1. `graphify detect` on the app → report corpus size + a token estimate.
238
+ 2. Recommend by cost: `--directed` always (this skill wants edge direction); `--mode deep` only if
239
+ the app carries many docs/specs; `--no-viz` if > 5000 nodes; `--neo4j-push` only if the project
240
+ already runs Neo4j. Default otherwise.
241
+ 3. Build only on explicit confirmation. Never as a side effect of onboarding.
@@ -0,0 +1,79 @@
1
+ # kit-ux-audit — a11y lane
2
+
3
+ Semantic-HTML and accessibility pass over a chosen scope. **Detection is `scripts/ux-a11y-scan.sh`**
4
+ (grep/perl, `$0`, macOS-safe) — **judgment is the model** (confirm the smell is a real defect,
5
+ map it to the correct element/pattern, prioritize). The scan flags *candidates* from static regex;
6
+ many need a one-line look at the file to confirm.
7
+
8
+ This is not a substitute for an axe / Lighthouse run against the rendered app — it catches the
9
+ structural mistakes that live in the source (wrong element, missing name, broken focus) before the
10
+ app is even running, which is exactly where they are cheapest to fix.
11
+
12
+ ## 1 · Scope
13
+
14
+ Same options as the other lanes (whole app · route group · page · component · dir). Pass
15
+ `--exclude <regex>` to skip a second surface. For a page scope, include sibling screens so
16
+ heading-order and landmark checks compare like with like.
17
+
18
+ ## 2 · Detect
19
+
20
+ ```bash
21
+ scripts/ux-a11y-scan.sh <path> [--exclude <re>] > /tmp/ux-a11y.txt
22
+ ```
23
+
24
+ Five groups, each `(N hits)` + `file:line` rows:
25
+
26
+ | § | Group | Looks for |
27
+ | --- | --- | --- |
28
+ | A1 | NON_SEMANTIC_INTERACTIVE | `onClick`/key handlers on `<div>`/`<span>`/`<li>`/`<tr>`; `role="button\|link\|tab…"` on a non-native element; redundant `role` on a native one |
29
+ | A2 | MISSING_TEXT_ALT | `<img>` with no `alt`; `<img alt="">` to confirm as decorative; icon-only `<svg>` with no name and no `aria-hidden` |
30
+ | A3 | UNLABELED_CONTROL | `<input>`/`<select>`/`<textarea>` with no `id` / `aria-label` / `aria-labelledby`; `<label>` with no `htmlFor`; icon-only `<button>` with no accessible name |
31
+ | A4 | HEADING_LANDMARK | `<h3+>` with no `<h1>`/`<h2>` in the file; multiple `<main>`; a landmark built as a styled `<div>`; `<section>`/`<article>` with no accessible name |
32
+ | A5 | FOCUS_KEYBOARD | positive `tabIndex`; `onMouseOver` with no `onFocus` twin; focus outline removed with no `:focus-visible`; `aria-hidden="true"` on something focusable; `autoFocus` |
33
+
34
+ For a large scope, fan classification out to read-only `Explore` sub-agents (one per group), each
35
+ briefed with this file.
36
+
37
+ ## 3 · Judge
38
+
39
+ For each row decide: **DEFECT** (fix), **OK** (a false positive — say why in one clause), or
40
+ **NEEDS_VISUAL** (can't tell from source — e.g. is that `<div onClick>` also reachable another
41
+ way?). Map every DEFECT to the fix:
42
+
43
+ - **A1** → the native element. A thing that navigates is an `<a href>`; a thing that acts in place
44
+ is a `<button type="button">`. A custom widget that must stay a `<div>` needs `role` **and**
45
+ `tabIndex={0}` **and** an `onKeyDown` for Enter/Space **and** a visible focus style — all four,
46
+ or it's a defect. Redundant `role` on a native element → delete the `role`.
47
+ - **A2** → `<img alt="…">` describing purpose, not appearance; truly decorative → `alt=""` **and**
48
+ confirm it carries no information. Icon-only `<svg>` that conveys meaning → `role="img"` +
49
+ `aria-label`; purely decorative → `aria-hidden="true"` and let the adjacent text carry it.
50
+ - **A3** → a programmatically associated `<label htmlFor={id}>` (visible label preferred over
51
+ `aria-label`). Icon-only control → `aria-label` naming the action ("Delete row", not "trash").
52
+ - **A4** → one `<h1>` per page, no skipped levels (an `<h2>` may not jump to `<h4>`); real
53
+ landmark elements (`<nav>`, `<header>`, `<main>` once, `<footer>`, `<aside>`); every `<section>`
54
+ used as a region gets an `aria-labelledby` pointing at its heading (or an `aria-label`).
55
+ - **A5** → remove positive `tabIndex` (use `0` or `-1` and DOM order); pair pointer handlers with
56
+ keyboard equivalents (`onFocus`/`onBlur`, `onKeyDown`); never suppress the focus ring without a
57
+ `:focus-visible` replacement; `aria-hidden` never wraps a focusable node; drop `autoFocus`
58
+ unless the screen exists only to take that one input.
59
+
60
+ **Cross-check the project's own rules** (`.claude/rules/*`) if present — many projects already
61
+ mandate "4 states", `focus-visible`, semantic landmarks, an icon set with `aria-hidden`. Cite the
62
+ slug in the finding when one applies.
63
+
64
+ ## 4 · Findings
65
+
66
+ Emit the `findings.json` schema (`report.md`) with these heuristic ids:
67
+
68
+ | id | finding |
69
+ | --- | --- |
70
+ | `A1` | Non-semantic interactive element — what it is now → the element it should be |
71
+ | `A2` | Missing / wrong text alternative — element · what's missing |
72
+ | `A3` | Unlabeled form control or icon-only button — control · proposed label wiring |
73
+ | `A4` | Heading-order or landmark gap — file · the jump / the div-landmark / the unnamed region |
74
+ | `A5` | Focus / keyboard problem — the specific smell + the fix |
75
+
76
+ `severity`: `crit` a core action is keyboard-unreachable or a form control has no name ·
77
+ `p1` non-semantic interactive on a common path, missing `alt` on meaningful images, focus ring
78
+ removed · `p2` landmark/heading structure, decorative-alt confirmations · `p3` single-site polish.
79
+ `needs_visual: true` whenever the row can't be confirmed a defect from source alone.
@@ -0,0 +1,106 @@
1
+ # kit-ux-audit — consistency lane
2
+
3
+ Design-system consistency pass over a chosen scope (an app, a route group, a page, a component, a
4
+ directory). **Detection is `scripts/ux-ds-audit.sh`** (grep/perl, `$0`, macOS-safe) — **judgment
5
+ is the model** (classify, compare siblings, propose variants, route decisions). Never eyeball code
6
+ for a pattern the script already finds.
7
+
8
+ Nothing here is project-specific: the shared-UI barrel, the custom-class prefix and the theme file
9
+ are all parameters (`--primitives` / `--css-prefix` / `--css`). Read the project's own
10
+ `.claude/rules/*ui-convention*` (if any) at run time for the values and the rule-slugs findings
11
+ should cite.
12
+
13
+ ## 1 · Pick the scope (ask, don't guess)
14
+
15
+ `AskUserQuestion` with these options unless the request already names one:
16
+
17
+ | Scope | `<path>` example | Extra |
18
+ | --- | --- | --- |
19
+ | whole app | `apps/web/src` | `--exclude '<regex>'` when a second surface lives in the app |
20
+ | route group / page | `apps/web/src/app/sign-in` | also pass its **sibling** screens for §3 |
21
+ | component | `src/components/course-card.tsx` | plus every file that renders it |
22
+ | package | `packages/ui/src/components` | flips the question: are the variants the apps need present? |
23
+
24
+ Always pass `--css <theme.css>` for the app's token/theme file, and `--css-prefix <p>` if the
25
+ project uses a prefix for its custom classes (without it, section 8's TSX custom-class hunt is
26
+ skipped).
27
+
28
+ ## 2 · Detect (deterministic)
29
+
30
+ ```bash
31
+ scripts/ux-ds-audit.sh <path> [--exclude <re>] --primitives <ui-barrel> --css <theme.css> [--css-prefix <p>] > /tmp/ux-ds.txt
32
+ ```
33
+
34
+ Ten sections, each `(N hits)` + `file:line` rows:
35
+
36
+ 1. **PRIMITIVE_CLASSNAME** — shared-UI primitives rendered with a `className` (the variant-candidate pool)
37
+ 2. **HEADINGS** — `<h1-3>` carrying a display/`type-*` role outside a heading primitive
38
+ 3. **CARD_SURFACES** — `rounded` + border + surface bg typed by hand on a non-Card element
39
+ 4. **SKELETONS** — `animate-pulse` outside the UI package + fill-token drift
40
+ 5. **STATUS_LINES** — `role=status|alert` / `aria-live` typed by hand
41
+ 6. **RAW_CONTROLS** — raw `<button|input|select|textarea>` + underline-link recipes
42
+ 7. **CARD_GRIDS** — `grid grid-cols-*` recipes (page ↔ `loading.tsx` drift shows here)
43
+ 8. **CUSTOM_CSS** — `<prefix>-*` classes + `data-*` styling hooks in TSX; dead classes; rules that
44
+ reach into a primitive's `data-slot`
45
+ 9. **ICON_PROPS** — repeated `<XxxIcon size={N} strokeWidth={S}>` tuples
46
+ 10. **REPEATED_CLASSNAMES** — identical multi-utility `className` literals appearing 3+ times
47
+
48
+ For a large scope, fan classification out to read-only `Explore` sub-agents (one per section
49
+ group), each briefed with this file.
50
+
51
+ ## 3 · Judge (the model's half)
52
+
53
+ **Classify every §1 row** into exactly one bucket:
54
+
55
+ - **LAYOUT** — placement only (`mt-*`, `w-full`, `mx-auto`, `max-w-*`, `shrink-0`, `self-*`, grid/
56
+ flex placement). Fine. No action.
57
+ - **VISUAL** — color, bg, border, radius, shadow, font/`type-*`, size (`h-*`, `p-*`, `px-*`),
58
+ `rounded-*`, hover/active state, or a custom CSS class on the primitive. **Variant candidate.**
59
+ Group by (component, override string); 2+ hits or a clear re-skin → propose
60
+ `variant`/`size`/`shape`/`tone` on the primitive's variant map. Explicit variants, never
61
+ booleans.
62
+ - **BEHAVIOR** — `hidden md:flex`, `print:hidden`, `sr-only`, `data-*` hooks. Legitimate call-site
63
+ concern. Keep.
64
+
65
+ **Sibling-screen comparison** (page scope): diff the screens that should look the same (sign-in vs
66
+ register vs verify; list pages under one route group; page vs its `loading.tsx`). One row per
67
+ property, one column per screen: width, padding, header shape, back-link treatment, card nesting (a
68
+ Card inside a Card is a bug), icon variant, skeleton shape.
69
+
70
+ **Hand-rolled → foundation** (§2–§7, §9, §10): map each recipe to the primitive that should own it
71
+ (a heading/PageHeader, Card, Skeleton, StatusText, CardGrid, EmptyState, Button, TextLink …).
72
+ Missing primitive → check the component registry the project uses (e.g.
73
+ `npx shadcn@latest search <term>`), record "used <x>" or "no fit because …".
74
+
75
+ **Custom CSS** (§8): a theme rule restyling `[data-slot='…']` / `[role='…']` from outside is a
76
+ **variant in disguise** → propose the prop, delete the rule. One-off page decoration (covers,
77
+ parallax, art direction) stays. Zero-reference classes are dead → delete.
78
+
79
+ ## 4 · Findings
80
+
81
+ Emit the `findings.json` schema (`report.md`) with heuristic ids `C1`…`C6`:
82
+
83
+ | id | finding |
84
+ | --- | --- |
85
+ | `C1` | Variant candidate — component · override string · hits · proposed prop |
86
+ | `C2` | Hand-rolled recipe → primitive that should own it (+ registry check) |
87
+ | `C3` | Sibling-screen drift — property · per-screen values · diagnosis |
88
+ | `C4` | Custom CSS verdict — variant-in-disguise / layout-keep / dead-delete |
89
+ | `C5` | Repeated className literal → component or variant, with locations |
90
+ | `C6` | Card-in-Card / structural nesting bug |
91
+
92
+ `severity`: `crit` never (consistency is not a blocker) · `p1` core component or ≥ 2 screens
93
+ diverge · `p2` localized · `p3` single-site polish. `needs_visual: true` when the verdict depends
94
+ on how it *looks* rendered (re-skin vs coincidence).
95
+
96
+ ## 5 · Route
97
+
98
+ - Design DECISIONS (a new visual value, which of two treatments wins) → **designer** agent.
99
+ IMPLEMENTATION with existing tokens → **frontend** agent.
100
+ - Whole app → `/kit-effort-new`: a foundation sub first, sweeps parallel, a variant-adoption sweep
101
+ last. One component/page → the quick lane, still in a worktree.
102
+ - Every new shared primitive/variant lands with its inventory row in the project's UI-conventions
103
+ rule + its barrel export, same PR.
104
+ - **Verification** = re-run `ux-ds-audit.sh` on the same scope and re-classify the refreshed §1
105
+ rows: none may classify VISUAL; §4/§7 are zero outside the UI package; §8 shows no rule reaching
106
+ into a `data-slot`.
@@ -0,0 +1,92 @@
1
+ # kit-ux-audit — normalized graph model
2
+
3
+ Both graph sources (graphify `graph.json`, and the fallback `ux-graph-scan.sh`) are read into one
4
+ model before the heuristics run. Keep it as compact JSON; you hand **slices** to the agent, never
5
+ the whole graph and never source files.
6
+
7
+ ## Nodes
8
+
9
+ ```
10
+ { "id": "screen:OrderDetail",
11
+ "kind": "screen", // route | screen | container | component | data-entity | form | field | mutation | store
12
+ "label": "Order detail",
13
+ "file": "app/orders/[id]/page.tsx", // best-effort; may be absent from a semantic graph
14
+ "meta": { "entry": false, "frequent": false, "steps": 1 } }
15
+ ```
16
+
17
+ - `route` — a URL a user can land on. `meta.entry: true` for app entry points (`/`, `/dashboard`,
18
+ post-login landing, anything with no inbound app nav).
19
+ - `screen` — the view a route renders. A route and its screen are often 1:1; keep both when the
20
+ same screen backs several routes (H5).
21
+ - `container` — layout/nav wrapper that renders screens (root layout, route-group layout, tab
22
+ shell). Carries the back/nav affordance for H4/H12.
23
+ - `component` — reusable UI unit. Fan-in matters (H9).
24
+ - `data-entity` — a domain object the UI reads or writes (`Order`, `Customer`, `Plan`). From a
25
+ semantic graph, these exist directly; from the scan, they're inferred from query/mutation
26
+ identifiers and table names.
27
+ - `form` — a form instance on a screen. `meta`: `fields`, `required`, `steps`, `hasDraft`,
28
+ `hasStepper`.
29
+ - `field` — optional; only model individually when a cross-field rule (H6) or a create/edit diff
30
+ (H7) needs it.
31
+ - `mutation` — a write operation (`createOrder`, `deleteCustomer`, server action, `useMutation`).
32
+ `meta.verb`: `create|update|delete|archive|other`; `meta.guarded`: has a confirm step.
33
+ - `store` — shared client state (context/zustand/redux slice) when it's an editing surface.
34
+
35
+ ## Edges
36
+
37
+ ```
38
+ { "from": "screen:Orders", "to": "data-entity:Order", "type": "writes",
39
+ "meta": { "via": "form:OrderQuickEdit" } }
40
+ ```
41
+
42
+ | type | meaning | main heuristics |
43
+ | --- | --- | --- |
44
+ | `imports` | module A imports module B | graph plumbing |
45
+ | `renders` | screen/container renders component/screen/form | H4, H5, H9, H10 |
46
+ | `navigates-to` | code path that changes route (`<Link>`, `router.push`, `redirect`, `navigate`, `<a href>` internal) | H3, H4, H5, H12 |
47
+ | `reads` | screen/component reads an entity (query, loader, `useX`, `select`) | H2, H10 |
48
+ | `writes` | screen/form persists an entity (non-destructive) | H1, H2, H10 |
49
+ | `mutates` | destructive write (delete/archive) | H1, H11 |
50
+ | `validates` | form ↔ field / field ↔ field validation rule | H6, H7 |
51
+ | `duplicates` | two forms / two routes judged equivalent (same entity + overlapping fields, or same screen under two parents) | H5, H7 |
52
+
53
+ `duplicates` from the scan is heuristic (name + entity + field-overlap ≥ 0.6). From graphify, use
54
+ `INFERRED` edges plus community co-membership.
55
+
56
+ ## Derived metrics (compute before slicing)
57
+
58
+ - **click-depth**: BFS over `navigates-to` from every `meta.entry` route to each screen; store the
59
+ minimum. Screens unreachable by `navigates-to` → depth `∞` → orphan candidates (H4).
60
+ - **god-nodes**: `component` (and `screen`) nodes ranked by inbound `renders` count. Top decile or
61
+ fan-in ≥ 10 → H9 pool.
62
+ - **community bridges**: if the graph carries communities (graphify does; for the scan, run a quick
63
+ label-propagation on the `renders`+`navigates-to` subgraph), collect edges whose endpoints are in
64
+ different communities. These cross-feature edges are where "confusing" flows concentrate — feed
65
+ them to the agent verbatim.
66
+ - **edit-surface map**: per `data-entity`, the set of `screen`s with a `writes`/`mutates` edge
67
+ (directly or `via` a form). This is the H1 input and a report section on its own.
68
+
69
+ ## Mapping graphify `graph.json` → this model
70
+
71
+ graphify nodes carry `type`/`kind` and `source_location`; edges carry a `relation` and an
72
+ `EXTRACTED|INFERRED|AMBIGUOUS` provenance.
73
+
74
+ - node `kind`: map `file`/`module` whose path matches a route convention (`app/**/page.*`,
75
+ `pages/**`, `src/pages/**`, `src/routes/**`, a `*.route.*`) → `route`+`screen`; `layout.*` /
76
+ `*Layout` → `container`; a component export rendered by screens → `component`; a symbol matching
77
+ `/^use[A-Z]/` returning data or a Prisma/SQL/`.from(` call → fold into a `data-entity` +
78
+ `reads`/`writes`; a `*Form`/`useForm` symbol → `form`.
79
+ - edges: graphify `imports`/`calls`/`renders` → `imports`/`renders`; a call into a router API →
80
+ `navigates-to`; a call into a data client → `reads`/`writes`/`mutates` by verb.
81
+ - keep graphify `community` / `community_name` on nodes — reuse directly for bridges.
82
+ - provenance: treat `AMBIGUOUS` edges as `needs_visual` fuel, never as hard evidence.
83
+
84
+ Do the mapping in memory (or a tiny throwaway script). Persist the normalized graph to
85
+ `<target>/graphify-out/.ux_model.json` so a re-run can reuse it.
86
+
87
+ ## Mapping the fallback scan → this model
88
+
89
+ `ux-graph-scan.sh --scan <dir>` already emits this shape at
90
+ `<dir>/graphify-out/.ux_graph.json` (`{ "nodes": [...], "edges": [...], "meta": {...} }`). It is
91
+ **approximate** — regex over TSX/Vue, not an AST. Mark the report "graph source: deterministic
92
+ scan" so findings are read with that caveat, and lean harder on `needs_visual`.