@edjbarron/ux-guard 0.0.0-stage → 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/LICENSE +201 -0
- package/NOTICE +2 -0
- package/README.md +239 -2
- package/bin/ux-guard.mjs +4 -0
- package/docs/cli-reference.md +145 -0
- package/docs/scoring-and-backslide.md +100 -0
- package/docs/test-suite.md +175 -0
- package/lib/authoritative.mjs +463 -0
- package/lib/baselines.mjs +1840 -0
- package/lib/catalog.mjs +197 -0
- package/lib/cli.mjs +1980 -0
- package/lib/config.mjs +209 -0
- package/lib/discovery.mjs +581 -0
- package/lib/journey-policy.mjs +590 -0
- package/lib/journeys.mjs +900 -0
- package/lib/observations.mjs +268 -0
- package/lib/patterns.mjs +247 -0
- package/lib/playwright.mjs +344 -0
- package/lib/run-contract.mjs +413 -0
- package/lib/shards.mjs +445 -0
- package/lib/targets.mjs +764 -0
- package/lib/verdicts.mjs +1769 -0
- package/lib/visuals.mjs +1263 -0
- package/lib/yaml.mjs +140 -0
- package/package.json +56 -4
- package/skills/ux-guard/SKILL.md +134 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,240 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ux-guard
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ux-guard helps teams catch UI inconsistency and workflow backslide, explain the
|
|
4
|
+
evidence in human terms, and decide what to improve without declaring today's
|
|
5
|
+
defects acceptable.
|
|
6
|
+
|
|
7
|
+
It separates four questions that are often blurred together:
|
|
8
|
+
|
|
9
|
+
- Is the current UI aligned with reviewed repository policy?
|
|
10
|
+
- Did important user workflows get better or worse?
|
|
11
|
+
- Are product-owned UX targets being met?
|
|
12
|
+
- What evidence is missing or unexecutable?
|
|
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
|
+
|
|
40
|
+
## Quickstart
|
|
41
|
+
|
|
42
|
+
Requirements: Node.js 22 or newer, npm, and a TypeScript UI project with JSX or
|
|
43
|
+
TSX source.
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install --save-dev @edjbarron/ux-guard
|
|
47
|
+
npx ux-guard setup
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or ask your agent:
|
|
51
|
+
|
|
52
|
+
> Set up ux-guard in this repo.
|
|
53
|
+
|
|
54
|
+
`npx` executes the installed local package, so the project controls the
|
|
55
|
+
ux-guard version.
|
|
56
|
+
|
|
57
|
+
`setup` inspects non-test UI source and reports what it could establish:
|
|
58
|
+
|
|
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
|
+
|
|
69
|
+
Good
|
|
70
|
+
- Inspected 1 non-test UI source files.
|
|
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.
|
|
75
|
+
|
|
76
|
+
Needs attention
|
|
77
|
+
- 3 hard-coded colors observed; review before deciding policy.
|
|
78
|
+
src/Page.tsx: 3
|
|
79
|
+
|
|
80
|
+
Unknown
|
|
81
|
+
- Observed conventions have not been approved as policy.
|
|
82
|
+
- No use-case catalog was inspected, so workflow coverage is unknown.
|
|
83
|
+
- No trusted baseline was used, so regression from main is unknown.
|
|
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.
|
|
92
|
+
```
|
|
93
|
+
|
|
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.
|
|
98
|
+
|
|
99
|
+
If there is no executable UI evidence yet, setup says so, writes nothing, and
|
|
100
|
+
gives the next safe action instead of reporting success.
|
|
101
|
+
|
|
102
|
+
## Understand results
|
|
103
|
+
|
|
104
|
+
Suppose a reviewed pattern baseline contains `Button size="sm"` and a change
|
|
105
|
+
introduces `Button size="xl"`:
|
|
106
|
+
|
|
107
|
+
- `check` reports a new control value and exits `1`.
|
|
108
|
+
- A journey report may still say that a tested workflow is acceptable. That
|
|
109
|
+
advisory UX verdict does not erase the policy finding.
|
|
110
|
+
- If no trusted workflow baseline was available, regression remains unknown.
|
|
111
|
+
- If the baseline contains the same value, `unchanged` means only “equal to
|
|
112
|
+
reviewed comparison evidence.” It does not mean the UX is good.
|
|
113
|
+
|
|
114
|
+
Exit `0` means no enforceable catalog or pattern finding. Exit `1` means those
|
|
115
|
+
findings are present. Exit `2` means configuration, evidence, or execution
|
|
116
|
+
failed; it must not be interpreted as clean.
|
|
117
|
+
|
|
118
|
+
## Daily use
|
|
119
|
+
|
|
120
|
+
After reviewed policy is active:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
npx ux-guard check
|
|
124
|
+
npx ux-guard report
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Use a trusted base when reviewing a change against policy and baselines from
|
|
128
|
+
main:
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
npx ux-guard check --base origin/main
|
|
132
|
+
npx ux-guard report --base origin/main
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`check` validates the use-case catalog and source patterns, then includes
|
|
136
|
+
configured journey and visual evidence as advisory sections. `report` explains
|
|
137
|
+
configured UX quality, evidence gaps, target attainment, regression, supported
|
|
138
|
+
scores, and recommendations. Report generation requires reviewed journey
|
|
139
|
+
policy; until then, the CLI explains what is missing.
|
|
140
|
+
|
|
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:
|
|
190
|
+
|
|
191
|
+
> Show me where ux-guard scoring comes from and explain every score
|
|
192
|
+
|
|
193
|
+
> Compare this branch with origin/main and explain every backslide signal; do
|
|
194
|
+
> not change policy or baselines
|
|
195
|
+
|
|
196
|
+
## Reference
|
|
197
|
+
|
|
198
|
+
- [CLI reference and advanced maintainer commands](docs/cli-reference.md)
|
|
199
|
+
- [Scoring and backslide semantics](docs/scoring-and-backslide.md)
|
|
200
|
+
- [111-test catalog](docs/test-suite.md)
|
|
201
|
+
- [Contributing](CONTRIBUTING.md)
|
|
202
|
+
- [Security policy](SECURITY.md)
|
|
203
|
+
- [Source provenance](PROVENANCE.md)
|
|
204
|
+
- [Changelog](CHANGELOG.md)
|
|
205
|
+
|
|
206
|
+
The package exposes eleven explicit module subpaths:
|
|
207
|
+
|
|
208
|
+
- `@edjbarron/ux-guard/authoritative`
|
|
209
|
+
- `@edjbarron/ux-guard/baselines`
|
|
210
|
+
- `@edjbarron/ux-guard/journey-policy`
|
|
211
|
+
- `@edjbarron/ux-guard/journeys`
|
|
212
|
+
- `@edjbarron/ux-guard/observations`
|
|
213
|
+
- `@edjbarron/ux-guard/playwright`
|
|
214
|
+
- `@edjbarron/ux-guard/run-contract`
|
|
215
|
+
- `@edjbarron/ux-guard/shards`
|
|
216
|
+
- `@edjbarron/ux-guard/targets`
|
|
217
|
+
- `@edjbarron/ux-guard/visuals`
|
|
218
|
+
- `@edjbarron/ux-guard/verdicts`
|
|
219
|
+
|
|
220
|
+
TypeScript `5.9.3` is an exact runtime dependency. The ux-guard tool version
|
|
221
|
+
is `0.6.1`, and existing public schema versions are unchanged.
|
|
222
|
+
|
|
223
|
+
## Development
|
|
224
|
+
|
|
225
|
+
```sh
|
|
226
|
+
npm ci --ignore-scripts
|
|
227
|
+
npm run check:hygiene
|
|
228
|
+
npm run check:test-catalog
|
|
229
|
+
npm run check:package
|
|
230
|
+
npm test
|
|
231
|
+
npm pack --dry-run --ignore-scripts
|
|
232
|
+
npm run test:install
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
The synchronized [test catalog](docs/test-suite.md) must be updated whenever a
|
|
236
|
+
test file or test name changes.
|
|
237
|
+
|
|
238
|
+
## License
|
|
239
|
+
|
|
240
|
+
Apache License 2.0. See `LICENSE` and `NOTICE`.
|
package/bin/ux-guard.mjs
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# ux-guard CLI reference
|
|
2
|
+
|
|
3
|
+
[Primary commands](#primary-commands) ·
|
|
4
|
+
[Scoring and backslide protection](#scoring-and-backslide-protection) ·
|
|
5
|
+
[Advanced policy lifecycle](#advanced-policy-lifecycle)
|
|
6
|
+
|
|
7
|
+
The primary workflow is:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
ux-guard setup
|
|
11
|
+
ux-guard check
|
|
12
|
+
ux-guard report
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Use `ux-guard --help` or command-specific `--help` for current options. Setup
|
|
16
|
+
supporting-file writes are repository-local, reject traversal and symbolic-link
|
|
17
|
+
escapes, and never overwrite existing review work.
|
|
18
|
+
|
|
19
|
+
## Primary commands
|
|
20
|
+
|
|
21
|
+
### `setup`
|
|
22
|
+
|
|
23
|
+
Inspects non-test JSX and TSX source, reports good observations, potential
|
|
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.
|
|
29
|
+
|
|
30
|
+
Options:
|
|
31
|
+
|
|
32
|
+
- `--proposal <path>` selects the repository-relative supporting review file.
|
|
33
|
+
- `--format json` emits one deterministic automation document.
|
|
34
|
+
- `--typescript <path>` selects an explicit TypeScript package for unusual
|
|
35
|
+
workspaces.
|
|
36
|
+
|
|
37
|
+
Setup does not create `.uxguard.json`, a baseline, a waiver, or enforcement. An
|
|
38
|
+
existing supporting review file or active policy is never overwritten.
|
|
39
|
+
|
|
40
|
+
### `check`
|
|
41
|
+
|
|
42
|
+
Validates the configured use-case catalog and compares current source patterns
|
|
43
|
+
with reviewed policy.
|
|
44
|
+
|
|
45
|
+
- Exit `0`: no enforceable catalog or pattern finding.
|
|
46
|
+
- Exit `1`: enforceable findings are present.
|
|
47
|
+
- Exit `2`: configuration, evidence, or execution failed.
|
|
48
|
+
|
|
49
|
+
Journey and visual sections remain advisory unless the repository adopts a
|
|
50
|
+
separate reviewed enforcement decision.
|
|
51
|
+
|
|
52
|
+
### `report`
|
|
53
|
+
|
|
54
|
+
Renders configured journey quality, evidence gaps, target attainment,
|
|
55
|
+
regression, scores where supported, and recommendations. Use `--format
|
|
56
|
+
markdown` for a review document or `--format json` for another renderer.
|
|
57
|
+
|
|
58
|
+
`report` requires configured journey policy. Missing or unexecutable evidence
|
|
59
|
+
stays visible as incomplete or unavailable.
|
|
60
|
+
|
|
61
|
+
### Trusted-base comparisons
|
|
62
|
+
|
|
63
|
+
`check --base <ref>` and `report --base <ref>` load reviewed policy, targets,
|
|
64
|
+
and baselines from the resolved commit while auditing current source and
|
|
65
|
+
evidence. A missing or invalid base is an error, never a clean result.
|
|
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
|
+
|
|
106
|
+
## Advanced policy lifecycle
|
|
107
|
+
|
|
108
|
+
These commands support maintainers and agents that need to inspect or activate
|
|
109
|
+
reviewed policy. They are not required for first results.
|
|
110
|
+
|
|
111
|
+
- `discover` performs read-only convention discovery.
|
|
112
|
+
- `discover write-candidate --candidate <path>` preserves the original v0.6
|
|
113
|
+
unapproved policy-artifact interface.
|
|
114
|
+
- `discover promote --candidate <path>` accepts either that original artifact
|
|
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.
|
|
118
|
+
- `patterns init`, `patterns scan`, and `patterns update` manage the pattern
|
|
119
|
+
snapshot. Growth requires `--accept-growth`.
|
|
120
|
+
- `baseline propose`, `baseline inspect`, `baseline diff`, and `baseline
|
|
121
|
+
promote` manage reviewed journey comparison evidence.
|
|
122
|
+
- `visual inspect`, `visual diff`, and `visual promote` manage reviewed visual
|
|
123
|
+
evidence.
|
|
124
|
+
- `authoritative --format json` regenerates trusted advisory output from raw
|
|
125
|
+
shards and trusted policy. Candidate-authored verdicts are not accepted.
|
|
126
|
+
|
|
127
|
+
Promotion is not proof that current UX is good. It records an explicit human
|
|
128
|
+
decision about policy or comparison evidence.
|
|
129
|
+
|
|
130
|
+
## Contributor canaries
|
|
131
|
+
|
|
132
|
+
The following commands test ux-guard's own failure detection. They do not audit
|
|
133
|
+
the consumer repository:
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
ux-guard patterns canary
|
|
137
|
+
ux-guard baseline canary
|
|
138
|
+
ux-guard visual canary
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Other options
|
|
142
|
+
|
|
143
|
+
Run `ux-guard help advanced` for the complete advanced option list, including
|
|
144
|
+
trusted aggregation identity, browser profile, review metadata, and explicit
|
|
145
|
+
artifact paths.
|