@edjbarron/ux-guard 0.6.0 → 0.6.1

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 CHANGED
@@ -11,6 +11,32 @@ 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
+ [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
+
14
40
  ## Quickstart
15
41
 
16
42
  Requirements: Node.js 22 or newer, npm, and a TypeScript UI project with JSX or
@@ -31,26 +57,44 @@ ux-guard version.
31
57
  `setup` inspects non-test UI source and reports what it could establish:
32
58
 
33
59
  ```text
60
+ ux-guard setup
61
+
62
+ Inspected
63
+ 1 non-test UI source files across 1 source roots.
64
+ TypeScript projects: tsconfig.json.
65
+ Component libraries: (none observed).
66
+ Icon libraries: (none observed).
67
+ Signals: component use, control props, icons, styling, pattern debt.
68
+
34
69
  Good
70
+ - Inspected 1 non-test UI source files.
35
71
  - No inline styles were observed in the inspected files.
72
+ - No pixel literals were observed in the inspected files.
73
+ - No raw button elements were observed in the inspected files.
74
+ - No icon-library uses were observed in the inspected files.
36
75
 
37
76
  Needs attention
38
77
  - 3 hard-coded colors observed; review before deciding policy.
78
+ src/Page.tsx: 3
39
79
 
40
80
  Unknown
81
+ - Observed conventions have not been approved as policy.
41
82
  - No use-case catalog was inspected, so workflow coverage is unknown.
42
83
  - No trusted baseline was used, so regression from main is unknown.
43
-
44
- Setup proposal
45
- Saved ux-guard/setup-proposal.json.
46
- Status: unapproved.
84
+ - Enforcement is not enabled.
85
+
86
+ Next steps
87
+ 1. Define the important user workflows and use cases. Agent Skill prompt: "Help me define ux-guard use cases for this repo"
88
+ 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"
89
+ 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"
90
+ 4. After human approval and activation, run ux-guard check and ux-guard report; report will explain any remaining journey evidence gaps.
91
+ No policy, baseline, waiver, or enforcement was activated.
47
92
  ```
48
93
 
49
- The proposal records observations and missing decisions. Setup does not create
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.
94
+ The ordered next steps come from the findings: pattern review is omitted when
95
+ no pattern issues were observed, and catalog or baseline work appears only
96
+ when that evidence is missing. Setup does not activate policy, a baseline, a
97
+ waiver, or enforcement, and it never overwrites existing review work.
54
98
 
55
99
  If there is no executable UI evidence yet, setup says so, writes nothing, and
56
100
  gives the next safe action instead of reporting success.
@@ -94,23 +138,65 @@ configured UX quality, evidence gaps, target attainment, regression, supported
94
138
  scores, and recommendations. Report generation requires reviewed journey
95
139
  policy; until then, the CLI explains what is missing.
96
140
 
97
- ## What ux-guard inspects
141
+ ## Scoring and backslide protection
142
+
143
+ [Detailed scoring and backslide semantics](docs/scoring-and-backslide.md) ·
144
+ [CLI commands and exit behavior](docs/cli-reference.md#scoring-and-backslide-protection)
145
+
146
+ ### Where scoring appears
147
+
148
+ After reviewed policy is active, `npx ux-guard report` shows quality verdict,
149
+ target attainment, regression/backslide, and numerical scores as separate
150
+ outputs. `npx ux-guard report --base origin/main` shows the same outputs while
151
+ loading reviewed policy and baselines from `origin/main`. Markdown uses
152
+ separate sections; JSON uses separate `quality`, `targetAttainment`,
153
+ `regression`, and `scoring` fields.
154
+
155
+ ### How to get and interpret scores
156
+
157
+ A score exists only for an explicit, reviewed, product-owned `at-most` metric
158
+ target. A met target scores 100. A breach scores
159
+ `round(100 * target / actual)`; a breached zero target scores 0. For example,
160
+ a target of at most 3 edited fields with an actual value of 4 scores 75.
161
+ That 75 is target performance, not the quality verdict: quality can remain
162
+ acceptable while a product-owned target is breached.
163
+
164
+ A journey score is the weakest score among its scoreable configured metrics.
165
+ A use-case score is the minimum across its scored required journeys, so a
166
+ stronger workflow cannot hide a weaker one. Missing, unexecutable, or
167
+ unmeasured evidence is not scored and remains explicit as partial or
168
+ not-scored. ux-guard does not calculate a product-wide scalar score.
169
+
170
+ ### Whether and how ux-guard prevents backslide
171
+
172
+ Trusted-base mode loads reviewed main policy and baselines before evaluating
173
+ candidate source and evidence, so candidate code cannot redefine its judge. It
174
+ detects reviewed-tolerance metric increases, journey lifecycle degradation or
175
+ missing journeys, new findings and severity increases, hard-floor breaches,
176
+ static pattern-debt growth, and visual manifest, profile, hash, or dimension
177
+ drift.
178
+
179
+ Detection is advisory by default. A successfully rendered `report` exits 0
180
+ even when it describes a target breach or regression; it does not block a
181
+ merge. `check` exits 1 for enforceable catalog or static-pattern findings and
182
+ 2 for configuration, evidence, or execution failure. Journey, target,
183
+ regression, and visual results remain advisory unless the consumer adds a
184
+ trusted classifier or other reviewed enforcement decision. Merge prevention
185
+ occurs only when the consumer configures trusted ux-guard execution as a
186
+ required CI check; making `report` alone required does not turn advisory
187
+ signals into a failure.
188
+
189
+ Ask an Agent Skill:
98
190
 
99
- - Component libraries, control props, icon libraries, native controls, and
100
- styling signals.
101
- - Reviewed use-case coverage for navigation surfaces.
102
- - Deterministic journey completion and interaction evidence.
103
- - Product-owned requirements and interaction targets.
104
- - Reviewed current-state journey and visual comparisons.
191
+ > Show me where ux-guard scoring comes from and explain every score
105
192
 
106
- The repository owns its catalog, browser harness, policy, targets, baselines,
107
- artifact retention, and enforcement decisions. Candidate code cannot be made
108
- trustworthy merely by generating a favorable report, so trusted-base mode
109
- loads reviewed policy and comparison evidence from an explicit commit.
193
+ > Compare this branch with origin/main and explain every backslide signal; do
194
+ > not change policy or baselines
110
195
 
111
196
  ## Reference
112
197
 
113
198
  - [CLI reference and advanced maintainer commands](docs/cli-reference.md)
199
+ - [Scoring and backslide semantics](docs/scoring-and-backslide.md)
114
200
  - [111-test catalog](docs/test-suite.md)
115
201
  - [Contributing](CONTRIBUTING.md)
116
202
  - [Security policy](SECURITY.md)
@@ -132,7 +218,7 @@ The package exposes eleven explicit module subpaths:
132
218
  - `@edjbarron/ux-guard/verdicts`
133
219
 
134
220
  TypeScript `5.9.3` is an exact runtime dependency. The ux-guard tool version
135
- remains `0.6.0`, and existing public schema versions are unchanged.
221
+ is `0.6.1`, and existing public schema versions are unchanged.
136
222
 
137
223
  ## Development
138
224
 
@@ -1,5 +1,9 @@
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
@@ -9,7 +13,7 @@ ux-guard report
9
13
  ```
10
14
 
11
15
  Use `ux-guard --help` or command-specific `--help` for current options. Setup
12
- and proposal writes are repository-local, reject traversal and symbolic-link
16
+ supporting-file writes are repository-local, reject traversal and symbolic-link
13
17
  escapes, and never overwrite existing review work.
14
18
 
15
19
  ## Primary commands
@@ -17,18 +21,21 @@ escapes, and never overwrite existing review work.
17
21
  ### `setup`
18
22
 
19
23
  Inspects non-test JSX and TSX source, reports good observations, potential
20
- problems, and unknowns, then writes an unapproved setup proposal to
21
- `ux-guard/setup-proposal.json`.
24
+ problems, and unknowns, then ends with ordered next steps tailored to those
25
+ findings. The policy-and-baseline review step explains the supporting review
26
+ file, which records observed source roots, components, pattern counts, and
27
+ unresolved choices without approving them. The file also records observed icon
28
+ usage when present.
22
29
 
23
30
  Options:
24
31
 
25
- - `--proposal <path>` selects another repository-relative path.
32
+ - `--proposal <path>` selects the repository-relative supporting review file.
26
33
  - `--format json` emits one deterministic automation document.
27
34
  - `--typescript <path>` selects an explicit TypeScript package for unusual
28
35
  workspaces.
29
36
 
30
37
  Setup does not create `.uxguard.json`, a baseline, a waiver, or enforcement. An
31
- existing proposal or active policy is never overwritten.
38
+ existing supporting review file or active policy is never overwritten.
32
39
 
33
40
  ### `check`
34
41
 
@@ -57,6 +64,45 @@ stays visible as incomplete or unavailable.
57
64
  and baselines from the resolved commit while auditing current source and
58
65
  evidence. A missing or invalid base is an error, never a clean result.
59
66
 
67
+ ## Scoring and backslide protection
68
+
69
+ [Detailed formulas, comparison signals, and trust boundaries](scoring-and-backslide.md)
70
+
71
+ ### Where scoring appears and how to get it
72
+
73
+ After reviewed policy is active, `npx ux-guard report` and
74
+ `npx ux-guard report --base origin/main` render quality, target attainment,
75
+ regression/backslide, and numerical scores as separate outputs. The trusted
76
+ base form loads reviewed main policy and baselines, so candidate code cannot
77
+ redefine its judge.
78
+
79
+ A numerical score exists only when explicit, reviewed, product-owned metric
80
+ targets are configured. An `at-most` metric scores 100 when met and otherwise
81
+ scores `round(100 * target / actual)`; a breached zero target scores 0. Thus a
82
+ target of at most 3 edited fields with an actual value of 4 scores 75. Score 75
83
+ describes target performance, not the independent quality verdict.
84
+
85
+ A journey uses its weakest scoreable configured metric. A use case uses the
86
+ minimum across its scored required journeys. Missing, unexecutable, or
87
+ unmeasured evidence is not scored and stays partial or not-scored. ux-guard
88
+ does not emit a product-wide scalar.
89
+
90
+ ### How backslide is detected and enforced
91
+
92
+ Trusted comparisons detect reviewed-tolerance metric increases, lifecycle
93
+ degradation and missing journeys, new findings and severity increases,
94
+ hard-floor breaches, static pattern-debt growth, and visual manifest, profile,
95
+ hash, or dimension drift.
96
+
97
+ Detection is advisory by default. `report` returns 0 after a successful render
98
+ even when it reports regression or a target breach; it does not block a merge.
99
+ `check` returns 1 for enforceable catalog or static-pattern findings and 2 for
100
+ configuration, evidence, or execution failure. Journey, target, regression,
101
+ score, and visual results need a separate reviewed enforcement decision to
102
+ fail CI. Merge prevention occurs only when a consumer configures trusted
103
+ ux-guard execution as a required CI check; making `report` alone required does
104
+ not convert advisory signals into failures.
105
+
60
106
  ## Advanced policy lifecycle
61
107
 
62
108
  These commands support maintainers and agents that need to inspect or activate
@@ -66,8 +112,9 @@ reviewed policy. They are not required for first results.
66
112
  - `discover write-candidate --candidate <path>` preserves the original v0.6
67
113
  unapproved policy-artifact interface.
68
114
  - `discover promote --candidate <path>` accepts either that original artifact
69
- or a `setup` proposal. It requires recorded human review and creates policy
70
- plus a freshly generated pattern baseline without overwriting either.
115
+ or the supporting review file written by `setup`. It requires recorded human
116
+ review and creates policy plus a freshly generated pattern baseline without
117
+ overwriting either.
71
118
  - `patterns init`, `patterns scan`, and `patterns update` manage the pattern
72
119
  snapshot. Growth requires `--accept-growth`.
73
120
  - `baseline propose`, `baseline inspect`, `baseline diff`, and `baseline
@@ -0,0 +1,100 @@
1
+ # Scoring and backslide protection
2
+
3
+ This page defines what ux-guard scores, what it compares, and which results can
4
+ affect a command exit code. Quality, target attainment, regression, and
5
+ numerical scores are separate signals.
6
+
7
+ ## Where scoring appears
8
+
9
+ After reviewed policy and journey evidence are configured, run:
10
+
11
+ ```sh
12
+ npx ux-guard report
13
+ npx ux-guard report --base origin/main
14
+ ```
15
+
16
+ The Markdown report has separate **Quality verdict**, **Target attainment**,
17
+ **Regression and backslide**, and **Numerical scores** sections. JSON keeps the
18
+ same meanings in separate `quality`, `targetAttainment`, `regression`, and
19
+ `scoring` fields.
20
+
21
+ The trusted-base form loads reviewed policy, owner targets, and comparison
22
+ baselines from the resolved `origin/main` commit while evaluating candidate
23
+ source and evidence. A candidate cannot replace those reviewed inputs with
24
+ more favorable policy or baselines.
25
+
26
+ ## How scores are created
27
+
28
+ Numerical scores require explicit, reviewed, product-owned metric targets.
29
+ Historical baselines do not produce scores. Only an `at-most` target has an
30
+ approved numerical formula:
31
+
32
+ - If `actual <= target`, the metric score is 100.
33
+ - If `actual > target`, the score is
34
+ `round(100 * target / actual)`.
35
+ - If a zero target is breached, the score is 0.
36
+
37
+ For example, if a workflow should edit at most 3 fields and actually edits 4,
38
+ its metric score is `round(100 * 3 / 4)`, or 75. That score means the reviewed
39
+ interaction target was missed. It does not change or summarize the independent
40
+ quality verdict.
41
+
42
+ The aggregation is deliberately non-compensating:
43
+
44
+ - A journey score is the minimum of its scoreable configured metric scores.
45
+ - A use-case score is the minimum of its scored required journey scores.
46
+ - A missing, unexecutable, unsuccessful, or unmeasured journey is not scored.
47
+ - An `at-least` or `exactly` target is evaluated for attainment but is not
48
+ numerically scored.
49
+ - Partial score coverage stays `partially-scored`; absent coverage stays
50
+ `not-scored`.
51
+ - There is no product-wide scalar score.
52
+
53
+ ## What backslide detection compares
54
+
55
+ Reviewed comparison evidence can detect each signal independently:
56
+
57
+ - a metric increase beyond its explicitly reviewed tolerance;
58
+ - lifecycle degradation, missing required journeys, or reduced measured and
59
+ successful coverage;
60
+ - newly introduced findings or increased finding severity;
61
+ - breaches of reviewed hard floors for evidence, completion, failures, skips,
62
+ infrastructure errors, or critical findings;
63
+ - growth in static control values or pattern debt beyond the reviewed
64
+ non-growth baseline;
65
+ - visual manifest, browser profile, checkpoint, image hash, image dimension,
66
+ or related reviewed visual-contract drift.
67
+
68
+ Baseline equality means only that comparable evidence did not backslide. It
69
+ does not declare the UX good or make known defects acceptable.
70
+
71
+ ## Detection versus merge prevention
72
+
73
+ ux-guard defaults to detection and advisory reporting:
74
+
75
+ - `report` exits 0 whenever it renders successfully, including when it reports
76
+ a quality problem, target breach, regression, or unavailable comparison
77
+ evidence. Missing active journey policy and malformed or unsafe inputs exit
78
+ 2; missing or unexecutable run evidence remains visible in the report.
79
+ - `check` exits 0 when there is no enforceable catalog or static-pattern
80
+ finding, 1 when those findings exist, and 2 for configuration, evidence, or
81
+ execution failure.
82
+ - Journey, target, regression, score, and visual sections remain advisory
83
+ unless the consumer adopts a separate, reviewed enforcement decision.
84
+
85
+ A merge is prevented only when the consumer runs a pinned, trusted ux-guard
86
+ configuration in CI and makes that check required.
87
+ Requiring `report` alone does not block advisory backslide because a successful
88
+ report returns 0.
89
+ Consumers that choose to enforce advisory signals need a trusted classifier or
90
+ wrapper with an explicit reviewed failure policy.
91
+
92
+ Useful Agent Skill prompts:
93
+
94
+ > Show me where ux-guard scoring comes from and explain every score
95
+
96
+ > Compare this branch with origin/main and explain every backslide signal; do
97
+ > not change policy or baselines
98
+
99
+ See the [CLI reference](cli-reference.md#scoring-and-backslide-protection) for
100
+ commands and exit behavior.
@@ -114,10 +114,10 @@ application.
114
114
  ## `test/setup.test.mjs` (8 tests)
115
115
 
116
116
  - `setup explains insufficient evidence in an empty repository without writing files` — Proves setup reports unknown evidence honestly and leaves an empty repository unchanged.
117
- - `setup gives neutral projects human-readable first results and an unapproved proposal` — Proves the first-run terminal flow groups results clearly and writes only an unapproved review artifact.
117
+ - `setup tailors next steps and keeps the README transcript exact` — Proves the terminal flow omits irrelevant work, explains its supporting file, and stays byte-for-byte synchronized with the documented hard-coded-color example.
118
118
  - `setup JSON is deterministic, noninteractive, and keeps approval boundaries explicit` — Proves automation output is stable and cannot imply policy, baseline, waiver, or enforcement approval.
119
- - `setup never overwrites an existing proposal or active policy` — Proves setup preserves prior review work and refuses to replace active policy.
120
- - `setup proposal paths reject traversal and symlink escapes` — Proves proposal writes remain within real repository directories.
119
+ - `setup never overwrites an existing supporting review file or active policy` — Proves setup preserves prior review work and refuses to replace active policy.
120
+ - `setup supporting review paths reject traversal and symlink escapes` — Proves supporting review writes remain within real repository directories.
121
121
  - `primary help leads with setup, check, and report while advanced help preserves reference commands` — Proves everyday help stays outcome-focused while existing maintainer commands remain discoverable.
122
122
  - `check and report errors point unconfigured repositories to the safe first step` — Proves daily commands give actionable guidance without bypassing review.
123
123
  - `legacy discovery output and schema remain backward compatible` — Proves the additive setup flow leaves the original discovery artifact contract intact.
package/lib/cli.mjs CHANGED
@@ -86,11 +86,18 @@ import {
86
86
  import { ConfigError, parseYamlSubset } from './yaml.mjs';
87
87
 
88
88
  const DEFAULT_SETUP_PROPOSAL = 'ux-guard/setup-proposal.json';
89
+ const SETUP_SIGNAL_LABELS = {
90
+ 'inline-style': 'inline styles',
91
+ 'hard-coded-color': 'hard-coded colors',
92
+ 'px-literal': 'pixel literals',
93
+ 'raw-button': 'raw button elements',
94
+ 'icon-library': 'icon-library uses',
95
+ };
89
96
 
90
97
  const USAGE = `usage: ux-guard <command> [options]
91
98
 
92
99
  commands:
93
- setup inspect this repo and save an unapproved setup proposal
100
+ setup inspect this repo and suggest reviewed next steps
94
101
  check compare current UI code with reviewed UX policy
95
102
  report explain UX evidence, gaps, and recommendations
96
103
 
@@ -108,13 +115,15 @@ common options:
108
115
 
109
116
  const SETUP_HELP = `usage: ux-guard setup [options]
110
117
 
111
- Inspect UI source without approving it, then save a setup proposal for human
112
- review. Setup never creates active policy, a reviewed baseline, a waiver, or
113
- enforcement.
118
+ Inspect UI source without approving it, report good observations, potential
119
+ problems, and unknowns, then suggest tailored next steps. A supporting review
120
+ file records the observed source roots, components, pattern counts, and
121
+ unresolved choices. Setup never creates active policy, a reviewed baseline, a
122
+ waiver, or enforcement.
114
123
 
115
124
  options:
116
125
  --root <dir> repository root (default: current directory)
117
- --proposal <path> proposal path (default: ${DEFAULT_SETUP_PROPOSAL})
126
+ --proposal <path> repository-local supporting review file
118
127
  --format text|json human-readable or machine-readable output
119
128
  --typescript <path> advanced: explicit TypeScript package path
120
129
  `;
@@ -135,7 +144,8 @@ const REPORT_HELP = `usage: ux-guard report [options]
135
144
 
136
145
  Explain configured journey evidence, UX quality, target attainment, regression,
137
146
  and recommendations. Missing evidence stays unknown; it is never reported as
138
- success.
147
+ success. A successfully rendered report exits 0 even when advisory findings,
148
+ target breaches, or backslide need attention; report does not enforce merges.
139
149
 
140
150
  options:
141
151
  --root <dir> repository root (default: current directory)
@@ -256,19 +266,19 @@ function errorGuidance(command, message) {
256
266
  return 'Next: run ux-guard check. Setup will not replace the repository’s active policy.';
257
267
  }
258
268
  if (message.includes('already exists; refusing to overwrite')) {
259
- return 'Next: review the existing setup proposal, or deliberately choose a different repository-local proposal path.';
269
+ return 'Next: review the existing supporting setup file, which records observations and unresolved choices, or deliberately choose a different repository-local path.';
260
270
  }
261
- return 'Next: fix the reported input or choose a new proposal path, then run ux-guard setup again. Setup never overwrites files.';
271
+ return 'Next: fix the reported input or choose a new supporting review file path, then run ux-guard setup again. Setup never overwrites files.';
262
272
  }
263
273
  if (command === 'check') {
264
274
  if (message.includes(CONFIG_FILE)) {
265
- return 'Next: review and explicitly activate the setup proposal. If no proposal exists, run ux-guard setup to create one safely.';
275
+ return 'Next: run ux-guard setup, review its findings and supporting file, and activate policy only after explicit human approval.';
266
276
  }
267
277
  return 'Next: run ux-guard check --help, correct the reported input, and retry.';
268
278
  }
269
279
  if (command === 'report') {
270
280
  if (message.includes(CONFIG_FILE)) {
271
- return 'Next: review and activate a setup proposal, then configure reviewed journey evidence. If no proposal exists, run ux-guard setup. Reporting remains unavailable until those reviews are complete.';
281
+ return 'Next: run ux-guard setup, complete human review of policy and baseline decisions, then configure reviewed journey evidence. Reporting remains unavailable until those reviews are complete.';
272
282
  }
273
283
  if (message.includes('journey reporting is not configured')) {
274
284
  return 'Next: keep using ux-guard check, and configure reviewed journey evidence before asking for a report.';
@@ -516,7 +526,7 @@ function setupCommand(options, io) {
516
526
  }
517
527
 
518
528
  const proposal = setupProposalFromDiscovery(report);
519
- writeCandidate(options.root, options.proposal, proposal, 'setup proposal');
529
+ writeCandidate(options.root, options.proposal, proposal, 'setup review file');
520
530
  const result = setupResult(report, options.proposal);
521
531
  writeSetupResult(result, options.format, io);
522
532
  return 0;
@@ -555,9 +565,7 @@ function setupResult(report, proposalPath) {
555
565
  enforcementEnabled: false,
556
566
  filesWritten: [proposalPath],
557
567
  },
558
- nextAction:
559
- `Review ${proposalPath} with the people responsible for product, design, and engineering. ` +
560
- 'Choose the missing policy and catalog decisions, then require explicit human approval before activation.',
568
+ nextAction: setupNextAction(assessment, proposalPath),
561
569
  };
562
570
  }
563
571
 
@@ -598,19 +606,14 @@ function setupEvidenceGap(proposalPath, reason) {
598
606
  enforcementEnabled: false,
599
607
  filesWritten: [],
600
608
  },
601
- nextAction:
602
- 'Add or point ux-guard to a TypeScript UI project with non-test JSX or TSX source, then run ux-guard setup again.',
609
+ nextAction: [
610
+ '1. Add or point ux-guard to a TypeScript UI project with non-test JSX or TSX source, then run ux-guard setup again.',
611
+ 'No policy, baseline, waiver, or enforcement was activated.',
612
+ ].join('\n'),
603
613
  };
604
614
  }
605
615
 
606
616
  function assessSetup(report) {
607
- const labels = {
608
- 'inline-style': 'inline styles',
609
- 'hard-coded-color': 'hard-coded colors',
610
- 'px-literal': 'pixel literals',
611
- 'raw-button': 'raw button elements',
612
- 'icon-library': 'icon-library uses',
613
- };
614
617
  const good = [`Inspected ${report.observed.files} non-test UI source files.`];
615
618
  const needsAttention = [];
616
619
  for (const rule of DEBT_RULES) {
@@ -619,11 +622,11 @@ function assessSetup(report) {
619
622
  .sort((left, right) => left.path.localeCompare(right.path));
620
623
  const count = locations.reduce((sum, item) => sum + item.count, 0);
621
624
  if (count === 0) {
622
- good.push(`No ${labels[rule]} were observed in the inspected files.`);
625
+ good.push(`No ${SETUP_SIGNAL_LABELS[rule]} were observed in the inspected files.`);
623
626
  } else {
624
627
  needsAttention.push({
625
628
  signal: rule,
626
- summary: `${count} ${labels[rule]} observed; review before deciding policy.`,
629
+ summary: `${count} ${SETUP_SIGNAL_LABELS[rule]} observed; review before deciding policy.`,
627
630
  count,
628
631
  locations,
629
632
  });
@@ -641,6 +644,57 @@ function assessSetup(report) {
641
644
  return { good, needsAttention, unknown };
642
645
  }
643
646
 
647
+ function setupNextAction(assessment, reviewPath) {
648
+ const steps = [];
649
+ const missingCatalog = assessment.unknown.some((item) =>
650
+ item.startsWith('No use-case catalog was inspected'),
651
+ );
652
+ const missingBaseline = assessment.unknown.some((item) =>
653
+ item.startsWith('No trusted baseline was used'),
654
+ );
655
+ if (missingCatalog) {
656
+ steps.push(
657
+ 'Define the important user workflows and use cases. ' +
658
+ 'Agent Skill prompt: "Help me define ux-guard use cases for this repo"',
659
+ );
660
+ }
661
+ if (assessment.needsAttention.length > 0) {
662
+ const findings = plainList(
663
+ assessment.needsAttention.map(({ signal }) => SETUP_SIGNAL_LABELS[signal]),
664
+ );
665
+ steps.push(
666
+ `Review the observed styling and pattern issues (${findings}) and decide which are intentional conventions versus UX debt. ` +
667
+ `Agent Skill prompt: "Review ux-guard's observed ${findings} in this repo and help me decide which are intentional conventions versus UX debt; do not change policy or baselines"`,
668
+ );
669
+ }
670
+ const decision = missingBaseline
671
+ ? 'Decide what should become reviewed policy and prepare the initial baseline.'
672
+ : 'Decide what should become reviewed policy.';
673
+ const approval = missingBaseline
674
+ ? 'Do not activate policy or baseline until a human explicitly approves them.'
675
+ : 'Do not activate policy until a human explicitly approves it.';
676
+ const reviewPrompt = missingBaseline
677
+ ? `Help me review ${reviewPath}, decide what should become reviewed ux-guard policy, and prepare the initial baseline; do not activate anything until I explicitly approve it`
678
+ : `Help me review ${reviewPath} and decide what should become reviewed ux-guard policy; do not activate anything until I explicitly approve it`;
679
+ steps.push(
680
+ `${decision} Use ${reviewPath} as a supporting review file; it contains observed source roots, component and icon usage, pattern counts, and unresolved policy choices. ${approval} ` +
681
+ `Agent Skill prompt: "${reviewPrompt}"`,
682
+ );
683
+ steps.push(
684
+ 'After human approval and activation, run ux-guard check and ux-guard report; report will explain any remaining journey evidence gaps.',
685
+ );
686
+ return [
687
+ ...steps.map((step, index) => `${index + 1}. ${step}`),
688
+ 'No policy, baseline, waiver, or enforcement was activated.',
689
+ ].join('\n');
690
+ }
691
+
692
+ function plainList(items) {
693
+ if (items.length < 2) return items[0] ?? '';
694
+ if (items.length === 2) return `${items[0]} and ${items[1]}`;
695
+ return `${items.slice(0, -1).join(', ')}, and ${items.at(-1)}`;
696
+ }
697
+
644
698
  function writeSetupResult(result, format, io) {
645
699
  if (format === 'json') {
646
700
  io.out.write(`${JSON.stringify(result, null, 2)}\n`);
@@ -677,22 +731,10 @@ function writeSetupResult(result, format, io) {
677
731
  }
678
732
  lines.push('', 'Unknown');
679
733
  for (const item of result.results.unknown) lines.push(` - ${item}`);
680
- lines.push('', 'Setup proposal');
681
- if (result.proposal.written) {
682
- lines.push(
683
- ` Saved ${result.proposal.path}.`,
684
- ' Status: unapproved. It records observations and decisions still needing human review.',
685
- );
686
- } else {
687
- lines.push(` Not created at ${result.proposal.path}; there was not enough UI evidence.`);
688
- }
689
734
  lines.push(
690
735
  '',
691
- 'Safety',
692
- ' No active policy, reviewed baseline, waiver, or enforcement was created.',
693
- '',
694
- 'Next safe action',
695
- ` ${result.nextAction}`,
736
+ 'Next steps',
737
+ ...result.nextAction.split('\n').map((line) => ` ${line}`),
696
738
  );
697
739
  io.out.write(`${lines.join('\n')}\n`);
698
740
  }
@@ -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.0';
6
+ export const UX_GUARD_TOOL_VERSION = '0.6.1';
7
7
 
8
8
  const SHA256 = /^[a-f0-9]{64}$/;
9
9
  const COMMIT = /^[a-f0-9]{40}$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edjbarron/ux-guard",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "description": "Deterministic UX checks and advisory evidence, verdict, and recommendation reports.",
6
6
  "license": "Apache-2.0",
@@ -33,13 +33,20 @@ 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. Name the setup proposal path and state that it is unapproved.
37
- 5. Recommend the smallest safe review step needed to complete catalog and
38
- policy decisions.
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 a proposal already exists, preserve it
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.
43
50
 
44
51
  ## Audit and explain
45
52
 
@@ -64,6 +71,11 @@ or execution failed and must never be described as clean.
64
71
  Never describe baseline equality or `unchanged` as good UX. It means only that
65
72
  the measured state matches reviewed comparison evidence.
66
73
 
74
+ Offer these directly usable prompts when users want to explore those results:
75
+
76
+ - `Show me where ux-guard scoring comes from and explain every score`
77
+ - `Compare this branch with origin/main and explain every backslide signal; do not change policy or baselines`
78
+
67
79
  ## Compare with a trusted base
68
80
 
69
81
  For regression-from-main requests:
@@ -78,13 +90,13 @@ Do not substitute working-tree policy, targets, or baselines when a trusted
78
90
  base was requested. Do not report “no regression” when comparison evidence was
79
91
  unavailable.
80
92
 
81
- ## Prepare proposals
93
+ ## Prepare review work
82
94
 
83
- The agent may prepare an unapproved setup, policy, journey-baseline, or visual
84
- baseline proposal when asked. It may inspect and diff proposals, but it must
85
- stop before adoption or promotion and request explicit human approval.
95
+ The agent may prepare unapproved setup support, policy, journey-baseline, or
96
+ visual-baseline review work when asked. It may inspect and diff that work, but
97
+ it must stop before adoption or promotion and request explicit human approval.
86
98
 
87
- Approval must name the exact proposal and resulting files. It is one-time and
99
+ Approval must name the exact review artifact and resulting files. It is one-time and
88
100
  does not authorize:
89
101
 
90
102
  - future promotions;
@@ -115,7 +127,7 @@ Summarize:
115
127
  - good, needs-attention, and unknown results;
116
128
  - policy findings versus advisory findings;
117
129
  - trusted base and whether comparison evidence executed;
118
- - proposal paths and their unapproved status;
130
+ - supporting review paths and their unapproved status;
119
131
  - recommendations in priority order;
120
132
  - exact validations that ran and any missing or unexecutable evidence;
121
133
  - approvals still required before policy, promotion, waivers, baselines, or