@edjbarron/ux-guard 0.0.0-stage → 0.6.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/LICENSE +201 -0
- package/NOTICE +2 -0
- package/README.md +153 -2
- package/bin/ux-guard.mjs +4 -0
- package/docs/cli-reference.md +98 -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 +1938 -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 +122 -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,154 @@
|
|
|
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
|
|
15
|
+
|
|
16
|
+
Requirements: Node.js 22 or newer, npm, and a TypeScript UI project with JSX or
|
|
17
|
+
TSX source.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm install --save-dev @edjbarron/ux-guard
|
|
21
|
+
npx ux-guard setup
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or ask your agent:
|
|
25
|
+
|
|
26
|
+
> Set up ux-guard in this repo.
|
|
27
|
+
|
|
28
|
+
`npx` executes the installed local package, so the project controls the
|
|
29
|
+
ux-guard version.
|
|
30
|
+
|
|
31
|
+
`setup` inspects non-test UI source and reports what it could establish:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
Good
|
|
35
|
+
- No inline styles were observed in the inspected files.
|
|
36
|
+
|
|
37
|
+
Needs attention
|
|
38
|
+
- 3 hard-coded colors observed; review before deciding policy.
|
|
39
|
+
|
|
40
|
+
Unknown
|
|
41
|
+
- No use-case catalog was inspected, so workflow coverage is unknown.
|
|
42
|
+
- 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.
|
|
47
|
+
```
|
|
48
|
+
|
|
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.
|
|
54
|
+
|
|
55
|
+
If there is no executable UI evidence yet, setup says so, writes nothing, and
|
|
56
|
+
gives the next safe action instead of reporting success.
|
|
57
|
+
|
|
58
|
+
## Understand results
|
|
59
|
+
|
|
60
|
+
Suppose a reviewed pattern baseline contains `Button size="sm"` and a change
|
|
61
|
+
introduces `Button size="xl"`:
|
|
62
|
+
|
|
63
|
+
- `check` reports a new control value and exits `1`.
|
|
64
|
+
- A journey report may still say that a tested workflow is acceptable. That
|
|
65
|
+
advisory UX verdict does not erase the policy finding.
|
|
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.
|
|
69
|
+
|
|
70
|
+
Exit `0` means no enforceable catalog or pattern finding. Exit `1` means those
|
|
71
|
+
findings are present. Exit `2` means configuration, evidence, or execution
|
|
72
|
+
failed; it must not be interpreted as clean.
|
|
73
|
+
|
|
74
|
+
## Daily use
|
|
75
|
+
|
|
76
|
+
After reviewed policy is active:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
npx ux-guard check
|
|
80
|
+
npx ux-guard report
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Use a trusted base when reviewing a change against policy and baselines from
|
|
84
|
+
main:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
npx ux-guard check --base origin/main
|
|
88
|
+
npx ux-guard report --base origin/main
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`check` validates the use-case catalog and source patterns, then includes
|
|
92
|
+
configured journey and visual evidence as advisory sections. `report` explains
|
|
93
|
+
configured UX quality, evidence gaps, target attainment, regression, supported
|
|
94
|
+
scores, and recommendations. Report generation requires reviewed journey
|
|
95
|
+
policy; until then, the CLI explains what is missing.
|
|
96
|
+
|
|
97
|
+
## What ux-guard inspects
|
|
98
|
+
|
|
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.
|
|
105
|
+
|
|
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.
|
|
110
|
+
|
|
111
|
+
## Reference
|
|
112
|
+
|
|
113
|
+
- [CLI reference and advanced maintainer commands](docs/cli-reference.md)
|
|
114
|
+
- [111-test catalog](docs/test-suite.md)
|
|
115
|
+
- [Contributing](CONTRIBUTING.md)
|
|
116
|
+
- [Security policy](SECURITY.md)
|
|
117
|
+
- [Source provenance](PROVENANCE.md)
|
|
118
|
+
- [Changelog](CHANGELOG.md)
|
|
119
|
+
|
|
120
|
+
The package exposes eleven explicit module subpaths:
|
|
121
|
+
|
|
122
|
+
- `@edjbarron/ux-guard/authoritative`
|
|
123
|
+
- `@edjbarron/ux-guard/baselines`
|
|
124
|
+
- `@edjbarron/ux-guard/journey-policy`
|
|
125
|
+
- `@edjbarron/ux-guard/journeys`
|
|
126
|
+
- `@edjbarron/ux-guard/observations`
|
|
127
|
+
- `@edjbarron/ux-guard/playwright`
|
|
128
|
+
- `@edjbarron/ux-guard/run-contract`
|
|
129
|
+
- `@edjbarron/ux-guard/shards`
|
|
130
|
+
- `@edjbarron/ux-guard/targets`
|
|
131
|
+
- `@edjbarron/ux-guard/visuals`
|
|
132
|
+
- `@edjbarron/ux-guard/verdicts`
|
|
133
|
+
|
|
134
|
+
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.
|
|
136
|
+
|
|
137
|
+
## Development
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
npm ci --ignore-scripts
|
|
141
|
+
npm run check:hygiene
|
|
142
|
+
npm run check:test-catalog
|
|
143
|
+
npm run check:package
|
|
144
|
+
npm test
|
|
145
|
+
npm pack --dry-run --ignore-scripts
|
|
146
|
+
npm run test:install
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The synchronized [test catalog](docs/test-suite.md) must be updated whenever a
|
|
150
|
+
test file or test name changes.
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
Apache License 2.0. See `LICENSE` and `NOTICE`.
|
package/bin/ux-guard.mjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# ux-guard CLI reference
|
|
2
|
+
|
|
3
|
+
The primary workflow is:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
ux-guard setup
|
|
7
|
+
ux-guard check
|
|
8
|
+
ux-guard report
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Use `ux-guard --help` or command-specific `--help` for current options. Setup
|
|
12
|
+
and proposal writes are repository-local, reject traversal and symbolic-link
|
|
13
|
+
escapes, and never overwrite existing review work.
|
|
14
|
+
|
|
15
|
+
## Primary commands
|
|
16
|
+
|
|
17
|
+
### `setup`
|
|
18
|
+
|
|
19
|
+
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`.
|
|
22
|
+
|
|
23
|
+
Options:
|
|
24
|
+
|
|
25
|
+
- `--proposal <path>` selects another repository-relative path.
|
|
26
|
+
- `--format json` emits one deterministic automation document.
|
|
27
|
+
- `--typescript <path>` selects an explicit TypeScript package for unusual
|
|
28
|
+
workspaces.
|
|
29
|
+
|
|
30
|
+
Setup does not create `.uxguard.json`, a baseline, a waiver, or enforcement. An
|
|
31
|
+
existing proposal or active policy is never overwritten.
|
|
32
|
+
|
|
33
|
+
### `check`
|
|
34
|
+
|
|
35
|
+
Validates the configured use-case catalog and compares current source patterns
|
|
36
|
+
with reviewed policy.
|
|
37
|
+
|
|
38
|
+
- Exit `0`: no enforceable catalog or pattern finding.
|
|
39
|
+
- Exit `1`: enforceable findings are present.
|
|
40
|
+
- Exit `2`: configuration, evidence, or execution failed.
|
|
41
|
+
|
|
42
|
+
Journey and visual sections remain advisory unless the repository adopts a
|
|
43
|
+
separate reviewed enforcement decision.
|
|
44
|
+
|
|
45
|
+
### `report`
|
|
46
|
+
|
|
47
|
+
Renders configured journey quality, evidence gaps, target attainment,
|
|
48
|
+
regression, scores where supported, and recommendations. Use `--format
|
|
49
|
+
markdown` for a review document or `--format json` for another renderer.
|
|
50
|
+
|
|
51
|
+
`report` requires configured journey policy. Missing or unexecutable evidence
|
|
52
|
+
stays visible as incomplete or unavailable.
|
|
53
|
+
|
|
54
|
+
### Trusted-base comparisons
|
|
55
|
+
|
|
56
|
+
`check --base <ref>` and `report --base <ref>` load reviewed policy, targets,
|
|
57
|
+
and baselines from the resolved commit while auditing current source and
|
|
58
|
+
evidence. A missing or invalid base is an error, never a clean result.
|
|
59
|
+
|
|
60
|
+
## Advanced policy lifecycle
|
|
61
|
+
|
|
62
|
+
These commands support maintainers and agents that need to inspect or activate
|
|
63
|
+
reviewed policy. They are not required for first results.
|
|
64
|
+
|
|
65
|
+
- `discover` performs read-only convention discovery.
|
|
66
|
+
- `discover write-candidate --candidate <path>` preserves the original v0.6
|
|
67
|
+
unapproved policy-artifact interface.
|
|
68
|
+
- `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.
|
|
71
|
+
- `patterns init`, `patterns scan`, and `patterns update` manage the pattern
|
|
72
|
+
snapshot. Growth requires `--accept-growth`.
|
|
73
|
+
- `baseline propose`, `baseline inspect`, `baseline diff`, and `baseline
|
|
74
|
+
promote` manage reviewed journey comparison evidence.
|
|
75
|
+
- `visual inspect`, `visual diff`, and `visual promote` manage reviewed visual
|
|
76
|
+
evidence.
|
|
77
|
+
- `authoritative --format json` regenerates trusted advisory output from raw
|
|
78
|
+
shards and trusted policy. Candidate-authored verdicts are not accepted.
|
|
79
|
+
|
|
80
|
+
Promotion is not proof that current UX is good. It records an explicit human
|
|
81
|
+
decision about policy or comparison evidence.
|
|
82
|
+
|
|
83
|
+
## Contributor canaries
|
|
84
|
+
|
|
85
|
+
The following commands test ux-guard's own failure detection. They do not audit
|
|
86
|
+
the consumer repository:
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
ux-guard patterns canary
|
|
90
|
+
ux-guard baseline canary
|
|
91
|
+
ux-guard visual canary
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Other options
|
|
95
|
+
|
|
96
|
+
Run `ux-guard help advanced` for the complete advanced option list, including
|
|
97
|
+
trusted aggregation identity, browser profile, review metadata, and explicit
|
|
98
|
+
artifact paths.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Test suite catalog
|
|
2
|
+
|
|
3
|
+
ux-guard has exactly 111 generic tests. This catalog was built from the test
|
|
4
|
+
names discovered by Node's test runner, not from a feature checklist. Run
|
|
5
|
+
`npm test` to execute them and `npm run check:test-catalog` to verify that this
|
|
6
|
+
page still matches the test files and names.
|
|
7
|
+
|
|
8
|
+
The tests use synthetic, consumer-neutral fixtures. A passing test suite proves
|
|
9
|
+
the behaviors below; it does not certify the UX quality of a consumer
|
|
10
|
+
application.
|
|
11
|
+
|
|
12
|
+
## `test/authoritative.test.mjs` (1 test)
|
|
13
|
+
|
|
14
|
+
- `trusted authoritative regeneration owns aggregation, policy, and verdicts` — Proves trusted regeneration derives the final advisory bundle from trusted policy and raw shards instead of accepting a candidate-authored verdict.
|
|
15
|
+
|
|
16
|
+
## `test/baselines.test.mjs` (7 tests)
|
|
17
|
+
|
|
18
|
+
- `baseline v1 is canonical, strict, hash-bound, and separates candidate from review` — Proves baseline serialization is deterministic, validates its schema and hashes, and keeps an unreviewed candidate distinct from approval.
|
|
19
|
+
- `baseline validation rejects unsafe paths, duplicate artifacts, and malformed approval` — Proves malformed provenance, repeated artifacts, unsafe paths, and invalid review metadata fail closed.
|
|
20
|
+
- `synthetic metric changes require reviewed per-metric tolerances` — Proves each interaction metric is compared only with its explicitly reviewed tolerance.
|
|
21
|
+
- `coverage, lifecycle, new findings, and severity cannot be offset by improvements` — Proves an improvement in one area cannot hide missing coverage, lifecycle failures, new findings, or worse severity elsewhere.
|
|
22
|
+
- `a known-bad baseline preserves defects as evidence without declaring them acceptable` — Proves recording current defects does not convert those defects into acceptable UX.
|
|
23
|
+
- `policy, schema, browser, and approval incompatibilities never become comparisons` — Proves incompatible evidence is reported as unavailable instead of being treated as a valid regression comparison.
|
|
24
|
+
- `owner target v2 validates desired requirements and metric policy separately from baseline tolerances` — Proves desired targets remain a distinct reviewed contract from current-state regression tolerances.
|
|
25
|
+
|
|
26
|
+
## `test/catalog.test.mjs` (4 tests)
|
|
27
|
+
|
|
28
|
+
- `reads navigation surfaces from nested object literals` — Proves catalog discovery recognizes navigation entries nested in source object literals.
|
|
29
|
+
- `reports navigation surfaces that no use case covers` — Proves a route missing from the use-case catalog is surfaced as unmapped.
|
|
30
|
+
- `accepts assistant starts and deep routes under a surface` — Proves assistant entry points and deeper routes can satisfy a catalogued surface mapping.
|
|
31
|
+
- `rejects malformed use cases` — Proves invalid catalog records fail validation instead of being partially accepted.
|
|
32
|
+
|
|
33
|
+
## `test/cli.test.mjs` (16 tests)
|
|
34
|
+
|
|
35
|
+
- `init, clean scan, canary, and check pass on a fresh repository` — Proves the pattern lifecycle initializes cleanly and the primary check works on a minimal configured repository.
|
|
36
|
+
- `growth fails the scan and update refuses it without explicit acceptance` — Proves new pattern values fail policy checks and cannot enter the baseline accidentally.
|
|
37
|
+
- `check JSON is one deterministic document with explicit result and exit semantics` — Proves machine output is stable and states both its finding status and process exit meaning.
|
|
38
|
+
- `check reports configured journey lifecycle and advisory verdicts in one JSON document` — Proves policy checks include journey coverage and advisory quality results without conflating them with enforcement.
|
|
39
|
+
- `missing journey measurements stay advisory and malformed reports fail closed` — Proves absent evidence is reported without a hard policy failure while invalid evidence is rejected.
|
|
40
|
+
- `advisory journey findings render JSON and Markdown without changing exit status` — Proves human and machine reports expose UX findings while preserving advisory exit behavior.
|
|
41
|
+
- `journey baseline lifecycle is unapproved, inspectable, no-overwrite, and explicitly promoted` — Proves a journey snapshot requires review, can be inspected, and cannot silently replace a reviewed baseline.
|
|
42
|
+
- `journey baseline lifecycle rejects traversal, symlinks, and malformed candidates` — Proves candidate baseline paths and contents cannot escape or bypass repository trust boundaries.
|
|
43
|
+
- `update removes stale entries without needing acceptance` — Proves obsolete pattern debt can be removed without authorizing new debt.
|
|
44
|
+
- `a complete inventory with an unmapped surface fails, and strict mode fails a partial one` — Proves catalog completeness and strict-mode mapping requirements produce enforceable findings.
|
|
45
|
+
- `missing policy, missing baseline, bad options, and unknown commands are errors` — Proves configuration and invocation mistakes return explicit CLI errors.
|
|
46
|
+
- `--base trusts committed policy while auditing working-tree source inputs` — Proves a check can use reviewed policy from a commit while evaluating candidate source from the working tree.
|
|
47
|
+
- `--base audits candidate catalogs and navigation without allowing policy downgrades` — Proves candidate mappings are evaluated while trusted catalog completeness cannot be weakened.
|
|
48
|
+
- `--base uses only the reviewed baseline from the trusted commit` — Proves working-tree edits cannot substitute candidate baselines or targets for reviewed ones.
|
|
49
|
+
- `policy paths cannot escape the repository` — Proves configured policy paths are constrained to repository-relative locations.
|
|
50
|
+
- `working-tree input symlinks cannot escape the repository` — Proves source scanning rejects symlinks that resolve outside the repository.
|
|
51
|
+
|
|
52
|
+
## `test/discovery.test.mjs` (5 tests)
|
|
53
|
+
|
|
54
|
+
- `discover audits a project without policy and emits review-only JSON candidates` — Proves first-run discovery inventories a project without requiring or installing policy.
|
|
55
|
+
- `discover text names the approval boundary and writes nothing` — Proves human output says observed usage is not approval and leaves the working tree unchanged.
|
|
56
|
+
- `discover rejects trusted-revision mode` — Proves discovery is explicitly a working-tree audit rather than a trusted-baseline operation.
|
|
57
|
+
- `candidate writing is explicit, unapproved, repository-local, and never overwrites` — Proves creating a review candidate is opt-in, local, visibly unapproved, and no-overwrite.
|
|
58
|
+
- `promotion requires recorded human review and regenerates the approved baseline` — Proves policy promotion requires approval metadata and rebuilds the baseline from reviewed configuration and current source.
|
|
59
|
+
|
|
60
|
+
## `test/hygiene.test.mjs` (1 test)
|
|
61
|
+
|
|
62
|
+
- `public-source hygiene rejects consumer and framework assumptions` — Proves the public package remains generic and excludes consumer-specific identifiers, private links, and fixed framework assumptions.
|
|
63
|
+
|
|
64
|
+
## `test/journey-policy.test.mjs` (7 tests)
|
|
65
|
+
|
|
66
|
+
- `readiness requires every reviewed required variant, not only the canonical journey` — Proves readiness includes all required variants instead of relying on one happy path.
|
|
67
|
+
- `all required variants must be approved, bound, measured, and successful` — Proves enforcement readiness requires complete ownership, automation, measurement, and successful execution.
|
|
68
|
+
- `complete successful required coverage is enforcement-ready and round-trips` — Proves a fully reviewed policy serializes deterministically and can reach ready state.
|
|
69
|
+
- `failed, skipped, unexecutable, and infrastructure-error required variants differ` — Proves distinct completion failures retain their separate operational meanings.
|
|
70
|
+
- `unknown rule types and malformed lifecycle declarations fail closed` — Proves unsupported rules and invalid lifecycle data cannot enter policy.
|
|
71
|
+
- `old policy versions produce explicit migration errors` — Proves obsolete policy schemas receive an actionable version error.
|
|
72
|
+
- `policy serialization is deterministic and records typed rules` — Proves reviewed journey policy has stable output with explicit rule types.
|
|
73
|
+
|
|
74
|
+
## `test/journeys.test.mjs` (11 tests)
|
|
75
|
+
|
|
76
|
+
- `records deterministic metrics and typed observations with an injected clock` — Proves journey recording is reproducible and observations retain their declared types.
|
|
77
|
+
- `standard measurements are always present and explicit metrics stay opt-in` — Proves core interaction counts are universal while optional measurements require policy selection.
|
|
78
|
+
- `wall-clock elapsed data is explicitly non-deterministic report-only metadata` — Proves elapsed time cannot masquerade as deterministic policy evidence.
|
|
79
|
+
- `normalizes findings and evidence once and uses references from journeys` — Proves shared evidence is stored once and linked instead of copied inconsistently.
|
|
80
|
+
- `serializes deterministically and round-trips the explicit v5 schema` — Proves journey reports have stable serialization and strict current-schema parsing.
|
|
81
|
+
- `rejects old report versions with an actionable migration error` — Proves stale report contracts are rejected with upgrade guidance.
|
|
82
|
+
- `failed assertion, skipped, unavailable-path, and infrastructure statuses stay distinct` — Proves product failures, omissions, unavailable workflows, and runner failures are not collapsed together.
|
|
83
|
+
- `bindings cannot inject findings, verdicts, severity, or recommendations` — Proves measurement adapters cannot author the human-facing judgment they are meant to inform.
|
|
84
|
+
- `unknown observations and malformed normalized references fail closed` — Proves unsupported evidence and broken references are rejected.
|
|
85
|
+
- `aggregates metrics and compares data without manufacturing a regression verdict` — Proves numerical aggregation remains separate from regression classification.
|
|
86
|
+
- `report tampering cannot change completion counts or measured aggregates` — Proves derived completion and metric summaries are recalculated rather than trusted from input.
|
|
87
|
+
|
|
88
|
+
## `test/patterns.test.mjs` (4 tests)
|
|
89
|
+
|
|
90
|
+
- `records control values only for configured components from the configured module` — Proves pattern inventory ignores lookalike controls outside the reviewed component source.
|
|
91
|
+
- `counts each debt rule` — Proves inline styles, hard-coded colors, pixel literals, native controls, and icon-library use are counted independently.
|
|
92
|
+
- `compare blocks new control values and per-file debt growth, and reports stale entries` — Proves policy comparison catches new variation and debt while identifying removable baseline entries.
|
|
93
|
+
- `baselines are deterministic and malformed baselines fail closed` — Proves pattern snapshots serialize stably and invalid snapshots are rejected.
|
|
94
|
+
|
|
95
|
+
## `test/playwright.test.mjs` (8 tests)
|
|
96
|
+
|
|
97
|
+
- `optional Playwright adapter flushes independent browser counts into a step` — Proves browser-observed interaction counts are captured separately and committed to the active journey step.
|
|
98
|
+
- `adapter ignores child frames, stops route capture on dispose, and rejects bad events` — Proves frame noise, post-disposal events, and malformed browser messages cannot contaminate measurements.
|
|
99
|
+
- `adapter retries a flush that races with main-frame navigation` — Proves navigation timing does not silently lose pending interaction counts.
|
|
100
|
+
- `adapter requires a Page-compatible object and a safe binding name` — Proves invalid browser objects and unsafe exposed-function names are rejected.
|
|
101
|
+
- `visual capture derives generic font readiness from the reviewed profile` — Proves screenshot readiness uses fonts declared by the reviewed visual profile.
|
|
102
|
+
- `visual capture rejects an unreviewed viewport` — Proves screenshots cannot be accepted under dimensions outside the reviewed profile.
|
|
103
|
+
- `visual capture rejects an unreviewed browser version` — Proves browser identity must match the reviewed visual profile.
|
|
104
|
+
- `visual capture requires every reviewed mask to match` — Proves visual masks are valid only when every reviewed selector resolves.
|
|
105
|
+
|
|
106
|
+
## `test/run-contract.test.mjs` (5 tests)
|
|
107
|
+
|
|
108
|
+
- `policy digests use canonicalized content and Node cryptographic hashes` — Proves equivalent policy content has a stable cryptographic identity.
|
|
109
|
+
- `run envelope records provenance, versions, profile, completion, errors, and hashes` — Proves every evidence run carries the context needed for later trust decisions.
|
|
110
|
+
- `unexecutable product paths are completion evidence, not infrastructure errors` — Proves an unavailable user workflow is distinguished from runner failure.
|
|
111
|
+
- `tampered completion, traversal artifacts, and bad digests fail closed` — Proves altered summaries, unsafe artifact paths, and invalid hashes are rejected.
|
|
112
|
+
- `completion result is derived rather than journey-authored` — Proves the final run result is computed from evidence rather than accepted from a producer.
|
|
113
|
+
|
|
114
|
+
## `test/setup.test.mjs` (8 tests)
|
|
115
|
+
|
|
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.
|
|
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.
|
|
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
|
+
- `check and report errors point unconfigured repositories to the safe first step` — Proves daily commands give actionable guidance without bypassing review.
|
|
123
|
+
- `legacy discovery output and schema remain backward compatible` — Proves the additive setup flow leaves the original discovery artifact contract intact.
|
|
124
|
+
|
|
125
|
+
## `test/shards.test.mjs` (8 tests)
|
|
126
|
+
|
|
127
|
+
- `immutable per-test shards aggregate deterministically independent of file order` — Proves parallel evidence fragments produce one stable aggregate regardless of directory order.
|
|
128
|
+
- `aggregation records a consumer-neutral default artifact path` — Proves aggregate provenance uses a generic default location rather than a product-specific path.
|
|
129
|
+
- `parallel shard paths are safe and collision-resistant from policy ids` — Proves policy identifiers become repository-safe shard names without collisions.
|
|
130
|
+
- `immutable writes reject duplicate expected shard output` — Proves a test cannot silently overwrite another evidence fragment.
|
|
131
|
+
- `aggregation fails closed on missing, malformed, and unstable shards` — Proves incomplete, invalid, or changing evidence directories are rejected.
|
|
132
|
+
- `aggregation rejects symlinks and filename/content mismatches` — Proves shard identity cannot be redirected or mislabeled through filesystem tricks.
|
|
133
|
+
- `corruption canary detects a duplicate shard id under another path` — Proves duplicate logical evidence is detected even when stored under a different filename.
|
|
134
|
+
- `aggregation distinguishes forged run identity from a tool or policy upgrade` — Proves tampering is reported separately from a legitimate contract-version mismatch.
|
|
135
|
+
|
|
136
|
+
## `test/skill.test.mjs` (3 tests)
|
|
137
|
+
|
|
138
|
+
- `ux-guard skill metadata is concise, valid, and trigger-rich` — Proves the distributable skill follows metadata conventions and advertises the requested user intents.
|
|
139
|
+
- `ux-guard skill preserves approval, evidence, and production-UI guardrails` — Proves agent guidance cannot hide missing evidence, silently approve artifacts, or modify UI merely to pass.
|
|
140
|
+
- `ux-guard skill is included by the npm package allowlist` — Proves the project skill is selected for distribution with the package.
|
|
141
|
+
|
|
142
|
+
## `test/targets.test.mjs` (6 tests)
|
|
143
|
+
|
|
144
|
+
- `target attainment evaluates hard floors and strict at-most metrics` — Proves owner requirements and interaction ceilings are evaluated with their declared strictness.
|
|
145
|
+
- `at-most score is 100 when met, proportional when breached, and zero for a breached zero target` — Proves score arithmetic handles success, proportional overage, and zero-limit breaches deterministically.
|
|
146
|
+
- `journey and use-case scores use non-compensating minimum aggregation` — Proves a strong metric cannot hide a weaker one in rolled-up scores.
|
|
147
|
+
- `partial and absent target coverage remain explicit without a global score` — Proves incomplete target definitions do not produce a misleading overall number.
|
|
148
|
+
- `unexecutable and unmeasured target journeys are not scored` — Proves missing evidence does not become a fabricated low or high score.
|
|
149
|
+
- `target breaches render independently with actionable recommendations` — Proves target failures remain separate from quality findings and receive specific remediation text.
|
|
150
|
+
|
|
151
|
+
## `test/verdicts.test.mjs` (9 tests)
|
|
152
|
+
|
|
153
|
+
- `policy-evaluated observations change verdicts and emit one recommendation` — Proves reviewed rules, not raw adapters, determine quality verdicts and recommendations.
|
|
154
|
+
- `shared cross-variant findings render once with per-variant evidence` — Proves repeated issues are deduplicated while preserving each affected journey variant.
|
|
155
|
+
- `missing and unexecutable required variants stay incomplete, not unmeasured success` — Proves absent required workflows cannot be interpreted as a clean UX result.
|
|
156
|
+
- `normalized output uses references rather than repeated findings` — Proves report structure links normalized evidence consistently.
|
|
157
|
+
- `Markdown orders run errors, incomplete, needs improvement, then acceptable` — Proves human reports prioritize the most urgent and least complete results.
|
|
158
|
+
- `JSON and Markdown preserve no-score and advisory semantics` — Proves both formats avoid implying enforcement or a score when neither exists.
|
|
159
|
+
- `pattern growth is regression evidence without changing the quality verdict` — Proves code-pattern backslide is reported independently from human UX quality judgment.
|
|
160
|
+
- `human wording separates quality, unknown evidence, and recommendations` — Proves report language distinguishes observed quality, evidence gaps, and proposed action.
|
|
161
|
+
- `unknown references and old report versions fail closed` — Proves broken links and obsolete report contracts cannot render as trusted advice.
|
|
162
|
+
|
|
163
|
+
## `test/visuals.test.mjs` (5 tests)
|
|
164
|
+
|
|
165
|
+
- `strict visual profiles and checkpoint policies are canonical and versioned` — Proves visual capture settings and checkpoint rules are explicit, stable contracts.
|
|
166
|
+
- `manifest validation fails closed for missing checkpoints and profile mismatch` — Proves incomplete evidence and captures from the wrong profile are rejected.
|
|
167
|
+
- `image path, symlink, hash, and dimensions are validated` — Proves screenshot files are repository-local regular files with expected content and geometry.
|
|
168
|
+
- `candidate write and owner promotion never overwrite artifacts` — Proves visual evidence promotion preserves review history and refuses silent replacement.
|
|
169
|
+
- `comparison reports individual changes without aggregate masking` — Proves each checkpoint change remains visible instead of disappearing into one aggregate number.
|
|
170
|
+
|
|
171
|
+
## `test/yaml.test.mjs` (3 tests)
|
|
172
|
+
|
|
173
|
+
- `parses mappings, nested list mappings, and quoted text` — Proves the supported catalog YAML subset handles its required structural forms.
|
|
174
|
+
- `ignores comments outside quotes and keeps hashes inside quotes` — Proves comment parsing does not corrupt quoted values containing hash characters.
|
|
175
|
+
- `rejects input outside the supported subset` — Proves unsupported YAML constructs fail explicitly instead of being misread.
|