@edjbarron/ux-guard 0.6.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.
- package/README.md +304 -58
- package/docs/cli-reference.md +92 -7
- package/docs/scoring-and-backslide.md +140 -0
- package/docs/test-suite.md +72 -5
- package/docs/use-case-review-design.md +284 -0
- package/docs/use-case-review.md +368 -0
- package/lib/catalog.mjs +46 -7
- package/lib/cli.mjs +368 -84
- package/lib/config.mjs +36 -1
- package/lib/review-app/app.css +697 -0
- package/lib/review-app/app.js +1899 -0
- package/lib/review-app/index.html +44 -0
- package/lib/review-audit.mjs +514 -0
- package/lib/review-command.mjs +409 -0
- package/lib/review-server.mjs +233 -0
- package/lib/review-store.mjs +554 -0
- package/lib/review.mjs +1385 -0
- package/lib/run-contract.mjs +1 -1
- package/package.json +1 -1
- package/skills/ux-guard/SKILL.md +154 -12
package/lib/run-contract.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { createHash } from 'node:crypto';
|
|
|
3
3
|
|
|
4
4
|
export const RUN_ENVELOPE_KIND = 'ux-guard-run-envelope';
|
|
5
5
|
export const RUN_ENVELOPE_VERSION = 1;
|
|
6
|
-
export const UX_GUARD_TOOL_VERSION = '0.
|
|
6
|
+
export const UX_GUARD_TOOL_VERSION = '0.7.0';
|
|
7
7
|
|
|
8
8
|
const SHA256 = /^[a-f0-9]{64}$/;
|
|
9
9
|
const COMMIT = /^[a-f0-9]{40}$/;
|
package/package.json
CHANGED
package/skills/ux-guard/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ux-guard
|
|
3
|
-
description: Uses ux-guard when users ask to set up ux-guard, audit UX, explain ux-guard results, detect UX regression from main, recommend UX improvements,
|
|
3
|
+
description: Uses ux-guard when users ask to set up ux-guard, audit UX, explain ux-guard results, detect UX regression from main, recommend UX improvements, prepare a reviewed policy or baseline, or discover and review use cases, continue a use-case review, open the ux-guard review app, or resolve unmapped workflows and exclusions.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# ux-guard
|
|
@@ -33,13 +33,124 @@ that ux-guard ran when the local executable could not be found or executed.
|
|
|
33
33
|
- good observations;
|
|
34
34
|
- items needing attention;
|
|
35
35
|
- unknown or missing evidence.
|
|
36
|
-
4.
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
4. Present ordered, plain-English next steps generated from those findings:
|
|
37
|
+
- include use-case catalog work only when catalog evidence is missing;
|
|
38
|
+
- include pattern review only when pattern findings exist;
|
|
39
|
+
- include initial-baseline work only when baseline evidence is missing;
|
|
40
|
+
- include directly usable Agent Skill prompts for use-case and pattern work.
|
|
41
|
+
5. Mention the setup supporting file only in the policy-and-baseline review
|
|
42
|
+
step. Explain that it records observed source roots, component and icon
|
|
43
|
+
usage, pattern counts, and unresolved policy choices and is not approval.
|
|
44
|
+
6. End by stating that no policy, baseline, waiver, or enforcement was
|
|
45
|
+
activated.
|
|
39
46
|
|
|
40
47
|
Setup must not create active policy, approve observed defects, adopt a baseline,
|
|
41
|
-
add a waiver, or enable enforcement. If
|
|
42
|
-
and report the no-overwrite failure.
|
|
48
|
+
add a waiver, or enable enforcement. If supporting review work already exists,
|
|
49
|
+
preserve it and report the no-overwrite failure.
|
|
50
|
+
|
|
51
|
+
## Guide initial adoption
|
|
52
|
+
|
|
53
|
+
Good results require repository-owned use cases and reviewed UI conventions.
|
|
54
|
+
Discovery can show what exists, but it cannot decide what matters or what is
|
|
55
|
+
good. Keep these decisions with the human product or design owner.
|
|
56
|
+
|
|
57
|
+
When the user continues after setup:
|
|
58
|
+
|
|
59
|
+
1. Define and review the use-case catalog. Inspect product documentation,
|
|
60
|
+
navigation, and existing tests, then propose the important workflows with a
|
|
61
|
+
persona, goal, success outcome, priority tier, and effect. Populate every
|
|
62
|
+
required field that this evidence supports. Mark a complete definition
|
|
63
|
+
`"definitionStatus": "proposal"`. If evidence cannot support any required
|
|
64
|
+
field, mark it `"definitionStatus": "draft"` and add a focused question
|
|
65
|
+
naming that use case and its missing fields; never invent a goal or success
|
|
66
|
+
outcome to make a proposal directly approvable. Record known navigation,
|
|
67
|
+
direct-route, or assistant entry points as optional bindings. A direct route
|
|
68
|
+
uses `{ "entry": "route", "route": "/path" }`; include it only when
|
|
69
|
+
repository routes, workflows, or tests show that it is a true user start.
|
|
70
|
+
Do not turn action labels or incidental URLs into starts, invent bindings,
|
|
71
|
+
or invalidate a use case when bindings are unknown. Keep the catalog partial or
|
|
72
|
+
unapproved until a reviewer confirms its coverage. Approval provenance is
|
|
73
|
+
recorded separately from the use-case definition.
|
|
74
|
+
2. Review observed controls and patterns. Use setup findings and the supporting
|
|
75
|
+
review file to show controls, props, components, icons, styling, and pattern
|
|
76
|
+
debt. Ask the owner to classify each item as an approved convention,
|
|
77
|
+
tolerated existing debt to record in the baseline, or a non-approved pattern
|
|
78
|
+
to fix. Never infer approval from frequency.
|
|
79
|
+
3. Prepare comparison evidence. Use only evidence produced by the repository's
|
|
80
|
+
real browser harness and configured journeys or visuals. Prepare unapproved
|
|
81
|
+
pattern, journey, or visual baseline review work as applicable, explain what
|
|
82
|
+
each baseline would tolerate, and stop before promotion. If evidence cannot
|
|
83
|
+
execute, leave it unknown; never fabricate a replacement.
|
|
84
|
+
4. After explicit approval names the exact review artifacts and resulting
|
|
85
|
+
files, activate only that one-time approval. Run `check` and, when journey
|
|
86
|
+
reporting is configured, `report`. Explain good, needs-attention, and unknown
|
|
87
|
+
results while separating enforceable policy findings from advisory findings.
|
|
88
|
+
|
|
89
|
+
Offer these directly usable onboarding prompts:
|
|
90
|
+
|
|
91
|
+
- `Help me define and review ux-guard use cases for this repo. Identify the important user workflows, personas, goals, success outcomes, priority tiers, and effects. Record known entry points as optional bindings and leave unknown bindings visible. Prepare the use-case catalog for review, but do not approve or activate it.`
|
|
92
|
+
- `Inspect ux-guard's setup findings and ux-guard/setup-proposal.json. Show me the observed controls, control props, components, icons, and styling patterns. Help me classify each as an approved convention, tolerated existing debt to record in the baseline, or a non-approved pattern to fix. Do not change policy or baselines.`
|
|
93
|
+
- `Prepare ux-guard's baseline review work for the approved use cases and UI conventions. Use only real repository evidence: the setup proposal for static patterns and the existing browser harness for configured journeys or visuals. Show what each proposed baseline would tolerate, keep every artifact unapproved, and stop before promotion.`
|
|
94
|
+
- `These exact ux-guard review artifacts and resulting files are approved: [list paths]. Activate only those approvals. Run ux-guard check and, if journey reporting is configured, ux-guard report. Explain the first result as good, needs attention, and unknown. Separate enforceable policy findings from advisory UX findings. Do not add waivers or change policy or baselines.`
|
|
95
|
+
|
|
96
|
+
## Review use cases
|
|
97
|
+
|
|
98
|
+
Use this flow when the user asks to discover or review use cases, continue a
|
|
99
|
+
use-case review, open the review app, or resolve unmapped workflows and
|
|
100
|
+
exclusions. The package's `docs/use-case-review.md` defines the draft format.
|
|
101
|
+
|
|
102
|
+
1. Run the local `review` command in JSON mode to learn the current state.
|
|
103
|
+
It writes nothing.
|
|
104
|
+
2. If it reports `no-candidate` and no draft exists, assess the repository:
|
|
105
|
+
read the navigation sources and UI workflows, then write
|
|
106
|
+
`ux-guard/use-case-draft.json` with surfaces, workflows, proposed use cases
|
|
107
|
+
grouped by user outcome, and a proposed mapping or exclusion for each item.
|
|
108
|
+
Define each use case with an id/title, persona, goal, success outcome, tier,
|
|
109
|
+
and effect. Set `definitionStatus` to `proposal` only when all of those
|
|
110
|
+
fields are evidence-supported. Otherwise set it to `draft` and add a
|
|
111
|
+
question with `useCaseId` and `missingFields` that asks only for the missing
|
|
112
|
+
content. Add `starts` only for known implementation bindings. Use
|
|
113
|
+
`{ "nav_id", "route" }` for a mapped navigation surface,
|
|
114
|
+
`{ "entry": "route", "route": "/path" }` for an evidence-backed direct
|
|
115
|
+
application route, and `{ "entry": "assistant", "prompt": "..." }` for an
|
|
116
|
+
assistant start. Treat a workflow action as a start only when evidence shows
|
|
117
|
+
it is an actual entry into the use case. Never invent a navigation id for a
|
|
118
|
+
direct route. Missing
|
|
119
|
+
bindings must remain visible as unknown coverage rather than blocking or
|
|
120
|
+
hiding the use case. Mark anything with unclear scope as `unresolved` and
|
|
121
|
+
record open questions; never guess to make coverage look complete. Never
|
|
122
|
+
write repository identity or hashes yourself.
|
|
123
|
+
Normally provide every required definition field supported by evidence so
|
|
124
|
+
proposals arrive directly approvable: id/title, persona, goal, success
|
|
125
|
+
outcome, tier, and effect. Never invent a goal or success statement to make
|
|
126
|
+
a proposal complete; emit an incomplete draft and its focused unresolved
|
|
127
|
+
question instead. If every definition is incomplete, call that out before
|
|
128
|
+
opening the app rather than presenting the assessment as proposal-ready.
|
|
129
|
+
3. Run the local `review prepare`. It refuses to overwrite an existing
|
|
130
|
+
candidate; report that instead of choosing another path silently.
|
|
131
|
+
4. If the candidate is stale, explain which assessed files changed and ask
|
|
132
|
+
before refreshing the draft and preparing a new candidate.
|
|
133
|
+
5. Start the local `review` command (for example `npx ux-guard review`) and
|
|
134
|
+
give the user the printed local address. Keep it running while they review.
|
|
135
|
+
6. Explain the proposals in plain language: what each use case lets a person
|
|
136
|
+
do, why it was proposed, which surfaces and workflows it covers, and what
|
|
137
|
+
remains unresolved or blocked. Present choices; let the user decide.
|
|
138
|
+
Explain that a complete proposal has one approval choice for the definition
|
|
139
|
+
currently shown, including edits; Reset to assessment proposal restores the
|
|
140
|
+
source definition before using that same choice. A completed discovery draft
|
|
141
|
+
retains its distinct explicit acceptance. For merge, explain the selected
|
|
142
|
+
target and the movement preview; never choose a target on the user's behalf.
|
|
143
|
+
|
|
144
|
+
The user makes every decision in the app. Do not edit
|
|
145
|
+
`ux-guard/use-case-review.json` or the preview to approve, map, or exclude on
|
|
146
|
+
the user's behalf. When asked to resolve unmapped workflows, explain each
|
|
147
|
+
option and its consequence, and leave unknowns unresolved rather than
|
|
148
|
+
inventing exclusions.
|
|
149
|
+
|
|
150
|
+
The agent must stop before adoption or promotion. Never run `review adopt`,
|
|
151
|
+
check in the catalog, change inventory, or enable enforcement without
|
|
152
|
+
explicit human approval naming the exact command. Saving in the app is not
|
|
153
|
+
approval. Adoption, check-in, and enforcement are separate decisions.
|
|
43
154
|
|
|
44
155
|
## Audit and explain
|
|
45
156
|
|
|
@@ -47,6 +158,20 @@ Run `check` in JSON mode for reviewed code-policy alignment. Run `report` in
|
|
|
47
158
|
JSON mode when journey reporting is configured and the user wants UX verdicts
|
|
48
159
|
or recommendations.
|
|
49
160
|
|
|
161
|
+
When a saved use-case review is still partial and the user wants later-phase
|
|
162
|
+
results without adoption, run `review audit` with the exact candidate, review,
|
|
163
|
+
and preview paths, an explicit trusted base such as `origin/main`, and JSON
|
|
164
|
+
format. Use `--journey-report` only for a repository-local versioned current
|
|
165
|
+
evidence artifact, and `--visual-candidate` only for an explicitly current
|
|
166
|
+
visual manifest. Confirm the preview exactly matches the saved review before
|
|
167
|
+
interpreting output. Keep active reviewed policy and the unapproved preview
|
|
168
|
+
visibly separate; never copy, adopt, or activate the preview as part of audit.
|
|
169
|
+
If evidence is missing, malformed, or from another ux-guard version, report
|
|
170
|
+
the stated unknown/incompatible result and fail-closed guard recommendation,
|
|
171
|
+
not a pass. Treat compatible local measurements as candidate diagnostics until
|
|
172
|
+
a pinned-base authoritative runner establishes trusted execution; do not turn
|
|
173
|
+
their diagnostic scores into a check-in pass.
|
|
174
|
+
|
|
50
175
|
Report:
|
|
51
176
|
|
|
52
177
|
- every audited source scope, or grouped paths without dropping any;
|
|
@@ -61,9 +186,26 @@ An exit code of `0` can still contain advisory UX findings. Exit `1` means an
|
|
|
61
186
|
enforceable catalog or pattern finding. Exit `2` means configuration, evidence,
|
|
62
187
|
or execution failed and must never be described as clean.
|
|
63
188
|
|
|
189
|
+
`review audit` is also advisory and exits 0 after rendering. Its
|
|
190
|
+
`guard.recommendedExit` is a proposed trusted-check result, not enforcement.
|
|
191
|
+
Do not wire or require that result without separate human approval. A trusted
|
|
192
|
+
check-in classifier must use immutable-base implementation and policy, report
|
|
193
|
+
candidate policy diffs separately, and offer both remediation paths: fix
|
|
194
|
+
candidate product/source code, or prepare a visible policy/catalog/workflow,
|
|
195
|
+
target, or baseline candidate for separate review. Never update the judge from
|
|
196
|
+
the same candidate being judged.
|
|
197
|
+
|
|
64
198
|
Never describe baseline equality or `unchanged` as good UX. It means only that
|
|
65
199
|
the measured state matches reviewed comparison evidence.
|
|
66
200
|
|
|
201
|
+
Offer these directly usable prompts when users want to explore those results:
|
|
202
|
+
|
|
203
|
+
- `Check my current work with ux-guard. Run the installed local check and, when configured, report. Summarize good, needs attention, and unknown evidence. Do not change policy, baselines, waivers, or enforcement.`
|
|
204
|
+
- `Compare this change with origin/main using ux-guard's trusted-base mode. Explain every policy finding and advisory backslide signal, including missing evidence. Do not change policy or baselines.`
|
|
205
|
+
- `Explain the ux-guard findings in this branch, then fix the actionable UI issues without weakening policy, adding waivers, or updating baselines just to make the result green. Explain the intended user outcome before editing production UI, and rerun the same ux-guard checks afterward.`
|
|
206
|
+
- `Show me where ux-guard scoring comes from and explain every score`
|
|
207
|
+
- `Compare this branch with origin/main and explain every backslide signal; do not change policy or baselines`
|
|
208
|
+
|
|
67
209
|
## Compare with a trusted base
|
|
68
210
|
|
|
69
211
|
For regression-from-main requests:
|
|
@@ -78,13 +220,13 @@ Do not substitute working-tree policy, targets, or baselines when a trusted
|
|
|
78
220
|
base was requested. Do not report “no regression” when comparison evidence was
|
|
79
221
|
unavailable.
|
|
80
222
|
|
|
81
|
-
## Prepare
|
|
223
|
+
## Prepare review work
|
|
82
224
|
|
|
83
|
-
The agent may prepare
|
|
84
|
-
baseline
|
|
85
|
-
stop before adoption or promotion and request explicit human approval.
|
|
225
|
+
The agent may prepare unapproved setup support, policy, journey-baseline, or
|
|
226
|
+
visual-baseline review work when asked. It may inspect and diff that work, but
|
|
227
|
+
it must stop before adoption or promotion and request explicit human approval.
|
|
86
228
|
|
|
87
|
-
Approval must name the exact
|
|
229
|
+
Approval must name the exact review artifact and resulting files. It is one-time and
|
|
88
230
|
does not authorize:
|
|
89
231
|
|
|
90
232
|
- future promotions;
|
|
@@ -115,7 +257,7 @@ Summarize:
|
|
|
115
257
|
- good, needs-attention, and unknown results;
|
|
116
258
|
- policy findings versus advisory findings;
|
|
117
259
|
- trusted base and whether comparison evidence executed;
|
|
118
|
-
-
|
|
260
|
+
- supporting review paths and their unapproved status;
|
|
119
261
|
- recommendations in priority order;
|
|
120
262
|
- exact validations that ran and any missing or unexecutable evidence;
|
|
121
263
|
- approvals still required before policy, promotion, waivers, baselines, or
|