@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/README.md
CHANGED
|
@@ -11,7 +11,33 @@ It separates four questions that are often blurred together:
|
|
|
11
11
|
- Are product-owned UX targets being met?
|
|
12
12
|
- What evidence is missing or unexecutable?
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
[Quickstart](#quickstart) · [Daily use](#daily-use) ·
|
|
15
|
+
[Scoring and backslide protection](#scoring-and-backslide-protection) ·
|
|
16
|
+
[CLI reference](docs/cli-reference.md)
|
|
17
|
+
|
|
18
|
+
## What it does
|
|
19
|
+
|
|
20
|
+
- Keeps component, control-prop, icon, and styling patterns aligned with the
|
|
21
|
+
conventions a team reviewed.
|
|
22
|
+
- Detects UX workflow backslide without treating a historical baseline as a
|
|
23
|
+
declaration that the old experience was good.
|
|
24
|
+
- Measures interaction cost, including clicks, typing, route changes, modal
|
|
25
|
+
depth, and policy-selected observations.
|
|
26
|
+
- Gives human-facing quality verdicts and actionable recommendations while
|
|
27
|
+
preserving the underlying evidence.
|
|
28
|
+
- Protects reviewed visual evidence with strict profiles, checkpoint policy,
|
|
29
|
+
hashes, dimensions, masks, repository boundaries, and no-overwrite
|
|
30
|
+
promotion.
|
|
31
|
+
- Keeps baseline, target, and policy changes explicit so candidate code cannot
|
|
32
|
+
silently redefine what it is judged against.
|
|
33
|
+
- Separates UX quality, target attainment, regression, and numerical scores so
|
|
34
|
+
one signal cannot impersonate another.
|
|
35
|
+
|
|
36
|
+
ux-guard is consumer-neutral: your repository owns its use-case catalog,
|
|
37
|
+
policy, browser harness, reviewed baselines, targets, artifact locations, and
|
|
38
|
+
CI enforcement decision.
|
|
39
|
+
|
|
40
|
+
## Getting started
|
|
15
41
|
|
|
16
42
|
Requirements: Node.js 22 or newer, npm, and a TypeScript UI project with JSX or
|
|
17
43
|
TSX source.
|
|
@@ -25,93 +51,313 @@ Or ask your agent:
|
|
|
25
51
|
|
|
26
52
|
> Set up ux-guard in this repo.
|
|
27
53
|
|
|
28
|
-
`npx`
|
|
29
|
-
|
|
54
|
+
`npx` uses the version installed in your project. Setup inspects non-test UI
|
|
55
|
+
source and writes an unapproved supporting review file when it finds usable
|
|
56
|
+
source. It does not know whether observed patterns are intentional, and it does
|
|
57
|
+
not inspect or invent your important workflows.
|
|
30
58
|
|
|
31
|
-
|
|
59
|
+
Work through these four review stages to get a useful first result.
|
|
32
60
|
|
|
33
|
-
|
|
34
|
-
Good
|
|
35
|
-
- No inline styles were observed in the inspected files.
|
|
61
|
+
### 1. Define the user outcomes that matter
|
|
36
62
|
|
|
37
|
-
|
|
38
|
-
|
|
63
|
+
Start with workflows, not routes or components. Identify who is trying to do
|
|
64
|
+
what and what success means. Entry points are optional implementation bindings,
|
|
65
|
+
so an important use case can be defined before its route or prompt is known.
|
|
66
|
+
Known bindings may be mapped navigation surfaces, direct application routes
|
|
67
|
+
such as `/login`, or assistant prompts. Discovery records only bindings backed
|
|
68
|
+
by repository routes, workflows, or tests; it does not invent them.
|
|
69
|
+
Approval provenance is recorded separately when the catalog is adopted.
|
|
39
70
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
> Help me define and review ux-guard use cases for this repo. Identify the
|
|
72
|
+
> important user workflows, personas, goals, success outcomes, priority tiers,
|
|
73
|
+
> and effects. Record known entry points as optional bindings and leave unknown
|
|
74
|
+
> bindings visible. Prepare the use-case catalog for review, but do not approve
|
|
75
|
+
> or activate it.
|
|
43
76
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Status: unapproved.
|
|
47
|
-
```
|
|
77
|
+
A product owner should confirm that the catalog covers the workflows whose
|
|
78
|
+
quality and backslide actually matter.
|
|
48
79
|
|
|
49
|
-
|
|
50
|
-
active policy, a reviewed baseline, a waiver, or enforcement, and it never
|
|
51
|
-
overwrites an existing proposal. Review the proposed source roots, component
|
|
52
|
-
and icon conventions, catalog paths, and baseline destination with the people
|
|
53
|
-
responsible for product, design, and engineering before approving activation.
|
|
80
|
+
### 2. Decide which UI patterns are allowed
|
|
54
81
|
|
|
55
|
-
|
|
56
|
-
|
|
82
|
+
Review what setup observed: buttons and other controls, their props, component
|
|
83
|
+
and icon libraries, styling, and repeated pattern debt. Frequency is evidence
|
|
84
|
+
of current usage, not proof that a pattern is good.
|
|
85
|
+
|
|
86
|
+
> Inspect ux-guard's setup findings and `ux-guard/setup-proposal.json`. Show me
|
|
87
|
+
> the observed controls, control props, components, icons, and styling patterns.
|
|
88
|
+
> Help me classify each as an approved convention, tolerated existing debt to
|
|
89
|
+
> record in the baseline, or a non-approved pattern to fix. Do not change policy
|
|
90
|
+
> or baselines.
|
|
57
91
|
|
|
58
|
-
|
|
92
|
+
The product or design owner makes those classifications. Approved conventions
|
|
93
|
+
become policy. Tolerated debt can be recorded so new debt is visible.
|
|
94
|
+
Non-approved patterns should not be legitimized by a baseline.
|
|
59
95
|
|
|
60
|
-
|
|
61
|
-
introduces `Button size="xl"`:
|
|
96
|
+
### 3. Prepare reviewed comparison evidence
|
|
62
97
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- If no trusted workflow baseline was available, regression remains unknown.
|
|
67
|
-
- If the baseline contains the same value, `unchanged` means only “equal to
|
|
68
|
-
reviewed comparison evidence.” It does not mean the UX is good.
|
|
98
|
+
A baseline records what happened; it does not declare the experience good.
|
|
99
|
+
Collect only evidence that really executed. If a browser journey cannot run,
|
|
100
|
+
leave it unknown instead of creating substitute data.
|
|
69
101
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
102
|
+
> Prepare ux-guard's baseline review work for the approved use cases and UI
|
|
103
|
+
> conventions. Use only real repository evidence: the setup proposal for static
|
|
104
|
+
> patterns and the existing browser harness for configured journeys or visuals.
|
|
105
|
+
> Show what each proposed baseline would tolerate, keep every artifact
|
|
106
|
+
> unapproved, and stop before promotion.
|
|
107
|
+
|
|
108
|
+
Review pattern, journey, and visual evidence separately. The owner should reject
|
|
109
|
+
unexpected controls, failed workflows, unstable screenshots, or incomplete
|
|
110
|
+
coverage instead of accepting them just to make a check pass.
|
|
111
|
+
|
|
112
|
+
### 4. Run the first meaningful check
|
|
113
|
+
|
|
114
|
+
Approval must name the exact review artifacts and the files they may create.
|
|
115
|
+
After that one-time approval, ask the agent to activate only those artifacts and
|
|
116
|
+
run the checks:
|
|
117
|
+
|
|
118
|
+
> These exact ux-guard review artifacts and resulting files are approved:
|
|
119
|
+
> [list paths]. Activate only those approvals. Run ux-guard check and, if
|
|
120
|
+
> journey reporting is configured, ux-guard report. Explain the first result as
|
|
121
|
+
> good, needs attention, and unknown. Separate enforceable policy findings from
|
|
122
|
+
> advisory UX findings. Do not add waivers or change policy or baselines.
|
|
123
|
+
|
|
124
|
+
You now have a result tied to product-owned workflows, reviewed UI conventions,
|
|
125
|
+
and actual evidence. Missing or unexecutable evidence remains visible rather
|
|
126
|
+
than being reported as success.
|
|
73
127
|
|
|
74
128
|
## Daily use
|
|
75
129
|
|
|
76
|
-
|
|
130
|
+
### Check current work
|
|
131
|
+
|
|
132
|
+
> Check my current work with ux-guard. Run the installed local check and, when
|
|
133
|
+
> configured, report. Summarize good, needs attention, and unknown evidence. Do
|
|
134
|
+
> not change policy, baselines, waivers, or enforcement.
|
|
135
|
+
|
|
136
|
+
### Compare a change with `main`
|
|
137
|
+
|
|
138
|
+
> Compare this change with `origin/main` using ux-guard's trusted-base mode.
|
|
139
|
+
> Explain every policy finding and advisory backslide signal, including missing
|
|
140
|
+
> evidence. Do not change policy or baselines.
|
|
141
|
+
|
|
142
|
+
### Explain and fix findings
|
|
143
|
+
|
|
144
|
+
> Explain the ux-guard findings in this branch, then fix the actionable UI
|
|
145
|
+
> issues without weakening policy, adding waivers, or updating baselines just
|
|
146
|
+
> to make the result green. Explain the intended user outcome before editing
|
|
147
|
+
> production UI, and rerun the same ux-guard checks afterward.
|
|
148
|
+
|
|
149
|
+
CLI and CI equivalents:
|
|
77
150
|
|
|
78
151
|
```sh
|
|
152
|
+
# Current working tree
|
|
79
153
|
npx ux-guard check
|
|
80
154
|
npx ux-guard report
|
|
155
|
+
|
|
156
|
+
# Current code against reviewed policy and baselines from main
|
|
157
|
+
npx ux-guard check --base origin/main
|
|
158
|
+
npx ux-guard report --base origin/main
|
|
81
159
|
```
|
|
82
160
|
|
|
83
|
-
|
|
84
|
-
|
|
161
|
+
`check` validates the use-case catalog and source patterns. Configured journey
|
|
162
|
+
and visual evidence appears in advisory sections. `report` explains journey
|
|
163
|
+
quality, evidence gaps, targets, regression, supported scores, and
|
|
164
|
+
recommendations. `report` requires reviewed journey policy and a configured
|
|
165
|
+
journey report path; until those exist, use `check` and complete the missing
|
|
166
|
+
setup.
|
|
167
|
+
|
|
168
|
+
A saved partial use-case review can be assessed before adoption without
|
|
169
|
+
changing active policy:
|
|
85
170
|
|
|
86
171
|
```sh
|
|
87
|
-
npx ux-guard
|
|
88
|
-
|
|
172
|
+
npx ux-guard review audit \
|
|
173
|
+
--base origin/main \
|
|
174
|
+
--candidate ux-guard/use-case-candidate.json \
|
|
175
|
+
--review ux-guard/use-case-review.json \
|
|
176
|
+
--preview ux-guard/use-case-catalog.preview.yml \
|
|
177
|
+
--format markdown
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
`review audit` requires the on-disk preview to match the saved review exactly.
|
|
181
|
+
It labels active policy and the preview separately, scans candidate source
|
|
182
|
+
against trusted catalog/control policy, and reports review readiness, mapping,
|
|
183
|
+
journey evidence, quality, targets, regression, and score-or-not-scored per use
|
|
184
|
+
case. `--journey-report <path>` can select a versioned current evidence file
|
|
185
|
+
without changing configuration. Visual comparison is not reused implicitly;
|
|
186
|
+
pass `--visual-candidate <path>` only for an explicitly current visual
|
|
187
|
+
manifest. Missing, old-version, or invalid evidence is reported as unknown and
|
|
188
|
+
produces a fail-closed guard recommendation; the audit command itself remains
|
|
189
|
+
read-only and advisory. Compatible local measurements can support diagnostic
|
|
190
|
+
quality and scores, but their guard recommendation remains unknown until a
|
|
191
|
+
pinned-base authoritative runner regenerates them as trusted execution.
|
|
192
|
+
|
|
193
|
+
## Review use cases
|
|
194
|
+
|
|
195
|
+
The use-case catalog says which user workflows matter. To build or extend it,
|
|
196
|
+
ask your agent:
|
|
197
|
+
|
|
198
|
+
> Help me discover and review the important use cases in this repository.
|
|
199
|
+
> Populate every required definition field that repository evidence supports.
|
|
200
|
+
> If a field cannot be supported, mark the item as an incomplete draft, add a
|
|
201
|
+
> focused unresolved question, and never invent a goal. Open ux-guard’s local
|
|
202
|
+
> review experience, explain the proposals and drafts in plain language, and
|
|
203
|
+
> do not activate policy without my explicit approval.
|
|
204
|
+
|
|
205
|
+
Record only evidence-backed navigation, direct-route, or assistant entry
|
|
206
|
+
points. Unknown bindings stay absent and visible as unknown coverage.
|
|
207
|
+
|
|
208
|
+
The agent drafts an assessment, `ux-guard review prepare` stamps it with
|
|
209
|
+
repository identity, and `ux-guard review` opens a local app:
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
npx ux-guard review
|
|
89
213
|
```
|
|
90
214
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
215
|
+
Discovery distinguishes a complete **proposal** from an incomplete **draft**.
|
|
216
|
+
A proposal has every definition field needed for direct acceptance: id/title,
|
|
217
|
+
persona, goal, success outcome, tier, and effect. A draft is missing at least
|
|
218
|
+
one of those fields because repository evidence could not support it; it carries
|
|
219
|
+
a focused unresolved question instead of invented content. Owner metadata and
|
|
220
|
+
entry-point bindings do not affect this distinction.
|
|
221
|
+
|
|
222
|
+
In the app, a complete proposal offers one **Approve this use case** decision.
|
|
223
|
+
It accepts the complete definition currently shown, including edits. Reset to
|
|
224
|
+
the assessment proposal first when that is the definition you want to approve.
|
|
225
|
+
Incomplete drafts lead with **Complete this draft** and field-specific
|
|
226
|
+
guidance; after completion, their distinct action is **Accept completed use
|
|
227
|
+
case**. Reject, merge, and split remain available, and merge uses an explicit
|
|
228
|
+
searchable target picker with a movement preview. Saving records only an
|
|
229
|
+
unapproved review. Use cases without entry-point bindings remain in the preview
|
|
230
|
+
with implementation coverage marked unknown.
|
|
231
|
+
|
|
232
|
+
Later, resume with:
|
|
233
|
+
|
|
234
|
+
> Continue my ux-guard use-case review.
|
|
235
|
+
|
|
236
|
+
> Open the ux-guard review app for this repository.
|
|
237
|
+
|
|
238
|
+
> Help me resolve the remaining unmapped workflows and exclusions. Do not
|
|
239
|
+
> approve or activate anything.
|
|
240
|
+
|
|
241
|
+
Changing the active catalog is a separate owner command, `ux-guard review
|
|
242
|
+
adopt`, which requires a saved, current, conflict-free review and prints who
|
|
243
|
+
approved it. Checking in the catalog and enforcement remain separate
|
|
244
|
+
decisions. The app binds only to `127.0.0.1`, loads no external assets, and
|
|
245
|
+
sends no telemetry. See [use-case review](docs/use-case-review.md) and its
|
|
246
|
+
[design](docs/use-case-review-design.md).
|
|
247
|
+
|
|
248
|
+
## Reading a result
|
|
249
|
+
|
|
250
|
+
- **Policy finding:** current code conflicts with a reviewed catalog or static
|
|
251
|
+
pattern decision.
|
|
252
|
+
- **Advisory finding:** journey, target, regression, score, or visual evidence
|
|
253
|
+
needs attention but is not enforced by `report`.
|
|
254
|
+
- **Unknown:** evidence was missing, incompatible, or could not execute. Unknown
|
|
255
|
+
never means clean.
|
|
256
|
+
- **Unchanged:** current evidence matches the reviewed comparison evidence. It
|
|
257
|
+
does not mean the UX is good.
|
|
258
|
+
|
|
259
|
+
For example, if a reviewed pattern baseline contains `Button size="sm"` and a
|
|
260
|
+
change introduces `Button size="xl"`, `check` reports a new control value. A
|
|
261
|
+
journey can still receive an acceptable advisory verdict; that does not erase
|
|
262
|
+
the policy finding.
|
|
263
|
+
|
|
264
|
+
## Safety and approval
|
|
265
|
+
|
|
266
|
+
- `setup` never activates policy, a baseline, a waiver, or enforcement.
|
|
267
|
+
- Setup supporting files and baseline promotions never silently overwrite
|
|
268
|
+
existing review work.
|
|
269
|
+
- If setup finds no executable UI source evidence, it writes nothing and
|
|
270
|
+
explains the next safe action.
|
|
271
|
+
- Observed usage is inventory, not approval. A human must approve policy,
|
|
272
|
+
tolerated debt, targets, and comparison evidence.
|
|
273
|
+
- A baseline can preserve known defects for comparison without declaring them
|
|
274
|
+
acceptable.
|
|
275
|
+
- `report` is advisory. A rendered report can describe a regression or target
|
|
276
|
+
breach and still exit successfully.
|
|
277
|
+
- Merge prevention exists only when the repository adopts a reviewed
|
|
278
|
+
enforcement decision and configures the relevant trusted check as required
|
|
279
|
+
in CI.
|
|
280
|
+
|
|
281
|
+
### Exit codes
|
|
282
|
+
|
|
283
|
+
- `check` exits `0` when no enforceable catalog or static-pattern finding is
|
|
284
|
+
present, `1` when one is present, and `2` when configuration, evidence, or
|
|
285
|
+
execution failed.
|
|
286
|
+
- `report` exits `0` when it renders successfully, even with advisory findings.
|
|
287
|
+
Missing active journey policy and malformed or unsafe inputs exit `2`.
|
|
288
|
+
|
|
289
|
+
Never interpret exit `0` as a blanket UX approval or exit `2` as clean.
|
|
290
|
+
|
|
291
|
+
## Scoring and backslide protection
|
|
292
|
+
|
|
293
|
+
Scores exist only for explicit, reviewed, product-owned metric targets. A score
|
|
294
|
+
describes target performance, not overall quality, and ux-guard does not create
|
|
295
|
+
a product-wide score. Trusted-base mode loads policy and baselines from the
|
|
296
|
+
resolved base commit so the change under review cannot redefine its judge.
|
|
297
|
+
|
|
298
|
+
See [scoring and backslide semantics](docs/scoring-and-backslide.md) for the
|
|
299
|
+
formulas, comparison signals, and enforcement boundaries.
|
|
300
|
+
|
|
301
|
+
Useful Agent Skill prompts:
|
|
302
|
+
|
|
303
|
+
> Show me where ux-guard scoring comes from and explain every score.
|
|
304
|
+
|
|
305
|
+
> Compare this branch with origin/main and explain every backslide signal; do
|
|
306
|
+
> not change policy or baselines.
|
|
307
|
+
|
|
308
|
+
## Setup output reference
|
|
309
|
+
|
|
310
|
+
Setup tailors its next steps to the observations it found. Pattern review is
|
|
311
|
+
omitted when no potential pattern problems were observed. Catalog or baseline
|
|
312
|
+
work appears only when that evidence is missing.
|
|
313
|
+
|
|
314
|
+
`setup` inspects non-test UI source and reports what it could establish:
|
|
315
|
+
|
|
316
|
+
```text
|
|
317
|
+
ux-guard setup
|
|
318
|
+
|
|
319
|
+
Inspected
|
|
320
|
+
1 non-test UI source files across 1 source roots.
|
|
321
|
+
TypeScript projects: tsconfig.json.
|
|
322
|
+
Component libraries: (none observed).
|
|
323
|
+
Icon libraries: (none observed).
|
|
324
|
+
Signals: component use, control props, icons, styling, pattern debt.
|
|
325
|
+
|
|
326
|
+
Good
|
|
327
|
+
- Inspected 1 non-test UI source files.
|
|
328
|
+
- No inline styles were observed in the inspected files.
|
|
329
|
+
- No pixel literals were observed in the inspected files.
|
|
330
|
+
- No raw button elements were observed in the inspected files.
|
|
331
|
+
- No icon-library uses were observed in the inspected files.
|
|
96
332
|
|
|
97
|
-
|
|
333
|
+
Needs attention
|
|
334
|
+
- 3 hard-coded colors observed; review before deciding policy.
|
|
335
|
+
src/Page.tsx: 3
|
|
98
336
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
|
|
337
|
+
Unknown
|
|
338
|
+
- Observed conventions have not been approved as policy.
|
|
339
|
+
- No use-case catalog was inspected, so workflow coverage is unknown.
|
|
340
|
+
- No trusted baseline was used, so regression from main is unknown.
|
|
341
|
+
- Enforcement is not enabled.
|
|
342
|
+
|
|
343
|
+
Next steps
|
|
344
|
+
1. Define the important user workflows and use cases. Agent Skill prompt: "Help me define ux-guard use cases for this repo"
|
|
345
|
+
2. Review the observed styling and pattern issues (hard-coded colors) and decide which are intentional conventions versus UX debt. Agent Skill prompt: "Review ux-guard's observed hard-coded colors in this repo and help me decide which are intentional conventions versus UX debt; do not change policy or baselines"
|
|
346
|
+
3. Decide what should become reviewed policy and prepare the initial baseline. Use ux-guard/setup-proposal.json as a supporting review file; it contains observed source roots, component and icon usage, pattern counts, and unresolved policy choices. Do not activate policy or baseline until a human explicitly approves them. Agent Skill prompt: "Help me review ux-guard/setup-proposal.json, decide what should become reviewed ux-guard policy, and prepare the initial baseline; do not activate anything until I explicitly approve it"
|
|
347
|
+
4. After human approval and activation, run ux-guard check. Run ux-guard report after reviewed journey policy and a journey report path are configured.
|
|
348
|
+
No policy, baseline, waiver, or enforcement was activated.
|
|
349
|
+
```
|
|
105
350
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
trustworthy merely by generating a favorable report, so trusted-base mode
|
|
109
|
-
loads reviewed policy and comparison evidence from an explicit commit.
|
|
351
|
+
If no executable UI source evidence is available, setup writes nothing and
|
|
352
|
+
gives the next safe action instead of reporting success.
|
|
110
353
|
|
|
111
354
|
## Reference
|
|
112
355
|
|
|
113
356
|
- [CLI reference and advanced maintainer commands](docs/cli-reference.md)
|
|
114
|
-
- [
|
|
357
|
+
- [Use-case review](docs/use-case-review.md)
|
|
358
|
+
- [Use-case review design](docs/use-case-review-design.md)
|
|
359
|
+
- [Scoring and backslide semantics](docs/scoring-and-backslide.md)
|
|
360
|
+
- [Enumerated 160-test catalog and verification commands](docs/test-suite.md)
|
|
115
361
|
- [Contributing](CONTRIBUTING.md)
|
|
116
362
|
- [Security policy](SECURITY.md)
|
|
117
363
|
- [Source provenance](PROVENANCE.md)
|
|
@@ -132,7 +378,7 @@ The package exposes eleven explicit module subpaths:
|
|
|
132
378
|
- `@edjbarron/ux-guard/verdicts`
|
|
133
379
|
|
|
134
380
|
TypeScript `5.9.3` is an exact runtime dependency. The ux-guard tool version
|
|
135
|
-
|
|
381
|
+
is `0.7.0`, and existing public schema versions are unchanged.
|
|
136
382
|
|
|
137
383
|
## Development
|
|
138
384
|
|
package/docs/cli-reference.md
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
# ux-guard CLI reference
|
|
2
2
|
|
|
3
|
+
[Primary commands](#primary-commands) ·
|
|
4
|
+
[Scoring and backslide protection](#scoring-and-backslide-protection) ·
|
|
5
|
+
[Advanced policy lifecycle](#advanced-policy-lifecycle)
|
|
6
|
+
|
|
3
7
|
The primary workflow is:
|
|
4
8
|
|
|
5
9
|
```sh
|
|
6
10
|
ux-guard setup
|
|
11
|
+
ux-guard review
|
|
7
12
|
ux-guard check
|
|
8
13
|
ux-guard report
|
|
9
14
|
```
|
|
10
15
|
|
|
11
16
|
Use `ux-guard --help` or command-specific `--help` for current options. Setup
|
|
12
|
-
|
|
17
|
+
supporting-file writes are repository-local, reject traversal and symbolic-link
|
|
13
18
|
escapes, and never overwrite existing review work.
|
|
14
19
|
|
|
15
20
|
## Primary commands
|
|
@@ -17,18 +22,21 @@ escapes, and never overwrite existing review work.
|
|
|
17
22
|
### `setup`
|
|
18
23
|
|
|
19
24
|
Inspects non-test JSX and TSX source, reports good observations, potential
|
|
20
|
-
problems, and unknowns, then
|
|
21
|
-
|
|
25
|
+
problems, and unknowns, then ends with ordered next steps tailored to those
|
|
26
|
+
findings. The policy-and-baseline review step explains the supporting review
|
|
27
|
+
file, which records observed source roots, components, pattern counts, and
|
|
28
|
+
unresolved choices without approving them. The file also records observed icon
|
|
29
|
+
usage when present.
|
|
22
30
|
|
|
23
31
|
Options:
|
|
24
32
|
|
|
25
|
-
- `--proposal <path>` selects
|
|
33
|
+
- `--proposal <path>` selects the repository-relative supporting review file.
|
|
26
34
|
- `--format json` emits one deterministic automation document.
|
|
27
35
|
- `--typescript <path>` selects an explicit TypeScript package for unusual
|
|
28
36
|
workspaces.
|
|
29
37
|
|
|
30
38
|
Setup does not create `.uxguard.json`, a baseline, a waiver, or enforcement. An
|
|
31
|
-
existing
|
|
39
|
+
existing supporting review file or active policy is never overwritten.
|
|
32
40
|
|
|
33
41
|
### `check`
|
|
34
42
|
|
|
@@ -51,12 +59,88 @@ markdown` for a review document or `--format json` for another renderer.
|
|
|
51
59
|
`report` requires configured journey policy. Missing or unexecutable evidence
|
|
52
60
|
stays visible as incomplete or unavailable.
|
|
53
61
|
|
|
62
|
+
### `review`
|
|
63
|
+
|
|
64
|
+
Opens a local app for reviewing proposed use cases. See
|
|
65
|
+
[use-case review](use-case-review.md) for the workflow, draft format, and
|
|
66
|
+
safety model.
|
|
67
|
+
|
|
68
|
+
- `review` starts the app on `127.0.0.1`. Without a candidate, it explains
|
|
69
|
+
what is missing, prints an agent prompt, and writes nothing.
|
|
70
|
+
- `review --format json` reports review status without starting the app.
|
|
71
|
+
- `review prepare` validates `ux-guard/use-case-draft.json` and writes an
|
|
72
|
+
unapproved, identity-stamped candidate without overwriting.
|
|
73
|
+
- `review audit --base <ref> --format json|markdown` evaluates the exact saved
|
|
74
|
+
preview against trusted policy without adopting it. `--journey-report
|
|
75
|
+
<path>` selects versioned current evidence while leaving configuration
|
|
76
|
+
unchanged. `--visual-candidate <path>` opts into an explicitly current visual
|
|
77
|
+
manifest; historical configured visual candidates are not reused implicitly.
|
|
78
|
+
The output separates active and preview state, readiness,
|
|
79
|
+
source/control findings, evidence compatibility, quality, targets,
|
|
80
|
+
regression, and per-use-case score-or-not-scored.
|
|
81
|
+
- `review adopt` writes the active catalog after explicit owner approval. It
|
|
82
|
+
requires `--reviewer`, `--reviewed-at`, `--rationale`, a saved, current,
|
|
83
|
+
conflict-free review, and `--replace-catalog-sha256` when a catalog exists.
|
|
84
|
+
|
|
85
|
+
Saving in the app writes only `ux-guard/use-case-review.json` and
|
|
86
|
+
`ux-guard/use-case-catalog.preview.yml`, both unapproved. No review command
|
|
87
|
+
changes configuration, baselines, targets, waivers, inventory, or
|
|
88
|
+
enforcement.
|
|
89
|
+
|
|
90
|
+
`review audit` exits 0 when it renders successfully. Findings and missing or
|
|
91
|
+
incompatible evidence appear in `guard.recommendedExit` as 1 or 2; applying
|
|
92
|
+
that recommendation in CI requires a separate reviewed enforcement decision.
|
|
93
|
+
Malformed trusted policy, unsafe inputs, a missing base, or a stale preview
|
|
94
|
+
match exit 2.
|
|
95
|
+
Compatible local journey evidence remains candidate-untrusted: it can render
|
|
96
|
+
diagnostic quality and scores, but its check-in recommendation stays at exit 2
|
|
97
|
+
until pinned-base authoritative regeneration establishes trusted execution.
|
|
98
|
+
|
|
54
99
|
### Trusted-base comparisons
|
|
55
100
|
|
|
56
101
|
`check --base <ref>` and `report --base <ref>` load reviewed policy, targets,
|
|
57
102
|
and baselines from the resolved commit while auditing current source and
|
|
58
103
|
evidence. A missing or invalid base is an error, never a clean result.
|
|
59
104
|
|
|
105
|
+
## Scoring and backslide protection
|
|
106
|
+
|
|
107
|
+
[Detailed formulas, comparison signals, and trust boundaries](scoring-and-backslide.md)
|
|
108
|
+
|
|
109
|
+
### Where scoring appears and how to get it
|
|
110
|
+
|
|
111
|
+
After reviewed policy is active, `npx ux-guard report` and
|
|
112
|
+
`npx ux-guard report --base origin/main` render quality, target attainment,
|
|
113
|
+
regression/backslide, and numerical scores as separate outputs. The trusted
|
|
114
|
+
base form loads reviewed main policy and baselines, so candidate code cannot
|
|
115
|
+
redefine its judge.
|
|
116
|
+
|
|
117
|
+
A numerical score exists only when explicit, reviewed, product-owned metric
|
|
118
|
+
targets are configured. An `at-most` metric scores 100 when met and otherwise
|
|
119
|
+
scores `round(100 * target / actual)`; a breached zero target scores 0. Thus a
|
|
120
|
+
target of at most 3 edited fields with an actual value of 4 scores 75. Score 75
|
|
121
|
+
describes target performance, not the independent quality verdict.
|
|
122
|
+
|
|
123
|
+
A journey uses its weakest scoreable configured metric. A use case uses the
|
|
124
|
+
minimum across its scored required journeys. Missing, unexecutable, or
|
|
125
|
+
unmeasured evidence is not scored and stays partial or not-scored. ux-guard
|
|
126
|
+
does not emit a product-wide scalar.
|
|
127
|
+
|
|
128
|
+
### How backslide is detected and enforced
|
|
129
|
+
|
|
130
|
+
Trusted comparisons detect reviewed-tolerance metric increases, lifecycle
|
|
131
|
+
degradation and missing journeys, new findings and severity increases,
|
|
132
|
+
hard-floor breaches, static pattern-debt growth, and visual manifest, profile,
|
|
133
|
+
hash, or dimension drift.
|
|
134
|
+
|
|
135
|
+
Detection is advisory by default. `report` returns 0 after a successful render
|
|
136
|
+
even when it reports regression or a target breach; it does not block a merge.
|
|
137
|
+
`check` returns 1 for enforceable catalog or static-pattern findings and 2 for
|
|
138
|
+
configuration, evidence, or execution failure. Journey, target, regression,
|
|
139
|
+
score, and visual results need a separate reviewed enforcement decision to
|
|
140
|
+
fail CI. Merge prevention occurs only when a consumer configures trusted
|
|
141
|
+
ux-guard execution as a required CI check; making `report` alone required does
|
|
142
|
+
not convert advisory signals into failures.
|
|
143
|
+
|
|
60
144
|
## Advanced policy lifecycle
|
|
61
145
|
|
|
62
146
|
These commands support maintainers and agents that need to inspect or activate
|
|
@@ -66,8 +150,9 @@ reviewed policy. They are not required for first results.
|
|
|
66
150
|
- `discover write-candidate --candidate <path>` preserves the original v0.6
|
|
67
151
|
unapproved policy-artifact interface.
|
|
68
152
|
- `discover promote --candidate <path>` accepts either that original artifact
|
|
69
|
-
or
|
|
70
|
-
plus a freshly generated pattern baseline without
|
|
153
|
+
or the supporting review file written by `setup`. It requires recorded human
|
|
154
|
+
review and creates policy plus a freshly generated pattern baseline without
|
|
155
|
+
overwriting either.
|
|
71
156
|
- `patterns init`, `patterns scan`, and `patterns update` manage the pattern
|
|
72
157
|
snapshot. Growth requires `--accept-growth`.
|
|
73
158
|
- `baseline propose`, `baseline inspect`, `baseline diff`, and `baseline
|