reflection-check 0.0.2 → 0.0.4
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/dist/cli.js +11 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/doctor.d.ts +2 -1
- package/dist/commands/doctor.js +109 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.js +59 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/run.js +1 -2
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/update.js +5 -0
- package/dist/commands/update.js.map +1 -1
- package/dist/contracts/browser/browser-contract.d.ts +2 -1
- package/dist/contracts/browser/browser-contract.js +2 -1
- package/dist/contracts/browser/browser-contract.js.map +1 -1
- package/dist/contracts/browser/route-runner.d.ts +6 -0
- package/dist/contracts/browser/route-runner.js +42 -1
- package/dist/contracts/browser/route-runner.js.map +1 -1
- package/dist/contracts/component/component-visual-contract.d.ts +9 -0
- package/dist/contracts/component/component-visual-contract.js +49 -3
- package/dist/contracts/component/component-visual-contract.js.map +1 -1
- package/dist/core/config.d.ts +21 -0
- package/dist/core/config.js +23 -2
- package/dist/core/config.js.map +1 -1
- package/dist/core/report-schema.d.ts +11 -10
- package/dist/core/report-schema.js +47 -1
- package/dist/core/report-schema.js.map +1 -1
- package/dist/core/target-ir.d.ts +5 -0
- package/dist/core/target-ir.js +2 -0
- package/dist/core/target-ir.js.map +1 -1
- package/dist/integrations/playwright/context-factory.d.ts +3 -2
- package/dist/integrations/playwright/context-factory.js +6 -3
- package/dist/integrations/playwright/context-factory.js.map +1 -1
- package/docs/agent-workflows.md +13 -5
- package/docs/browser-contract.md +31 -0
- package/docs/ci.md +11 -1
- package/docs/configuration.md +47 -0
- package/docs/getting-started.md +17 -3
- package/docs/plans/reflection-dogfood-feedback-implementation-guide.md +100 -86
- package/docs/target-ir-and-adapters.md +2 -2
- package/docs/validation-process.md +16 -7
- package/docs/visual-contract.md +16 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ Reflection is meant to be a validation protocol that humans, agents, and CI can
|
|
|
5
5
|
The command split is intentional:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
reflection doctor #
|
|
8
|
+
reflection doctor # runtime check; pass --config for project preflight
|
|
9
9
|
reflection run # produce evidence and report.json; pass --config for project contracts
|
|
10
10
|
reflection review # summarize the latest evidence for humans/agents
|
|
11
11
|
reflection update # accept intentional visual changes; never automatic
|
|
@@ -16,7 +16,7 @@ reflection update # accept intentional visual changes; never automatic
|
|
|
16
16
|
Use this loop before claiming frontend work is complete:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
reflection doctor
|
|
19
|
+
reflection doctor --config reflection.config.ts
|
|
20
20
|
reflection run --config reflection.config.ts --mode smoke
|
|
21
21
|
reflection review --json
|
|
22
22
|
```
|
|
@@ -25,7 +25,7 @@ If Reflection is being run from this repository during development, build first
|
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
pnpm build
|
|
28
|
-
node dist/cli.js doctor
|
|
28
|
+
node dist/cli.js doctor --config examples/basic-react/reflection.config.ts
|
|
29
29
|
node dist/cli.js run --config examples/basic-react/reflection.config.ts --mode smoke
|
|
30
30
|
node dist/cli.js review --json
|
|
31
31
|
```
|
|
@@ -38,13 +38,22 @@ Interpret the review result as the contract:
|
|
|
38
38
|
|
|
39
39
|
Always include the `reportPath`, blocking failures, review items, and artifact paths when reporting results to a human.
|
|
40
40
|
|
|
41
|
+
## Suggested next steps
|
|
42
|
+
|
|
43
|
+
Reports include derived next steps based on the run result:
|
|
44
|
+
|
|
45
|
+
- Blocking failures: fix the named blocking checks before considering visual baseline updates.
|
|
46
|
+
- Missing baselines: inspect the actual screenshots, then use `reflection update --dry-run --case <caseId> --from-run latest` for intentional first baselines.
|
|
47
|
+
- Review-only visual diffs: inspect expected, actual, and diff artifacts before proposing a targeted dry-run update.
|
|
48
|
+
- Passing runs: no action is required; expand route or visual coverage only when useful.
|
|
49
|
+
|
|
41
50
|
## Agent instructions
|
|
42
51
|
|
|
43
52
|
Agents should treat Reflection as an evidence gate, not as a self-healing tool.
|
|
44
53
|
|
|
45
54
|
Required agent behavior:
|
|
46
55
|
|
|
47
|
-
1. Run `reflection doctor` before the validation flow when setup may be uncertain. It
|
|
56
|
+
1. Run `reflection doctor --config reflection.config.ts` before the validation flow when setup may be uncertain. It validates config loading/schema, summarizes configured contracts, checks runtime readiness, and remains read-only.
|
|
48
57
|
2. Run `reflection run --config reflection.config.ts --mode smoke` to generate current evidence.
|
|
49
58
|
3. Run `reflection review --json` to get the machine-readable summary.
|
|
50
59
|
4. Fix blocking failures before finishing the task.
|
|
@@ -78,7 +87,7 @@ CI should generate and publish evidence, but must never update baselines.
|
|
|
78
87
|
Recommended CI command shape:
|
|
79
88
|
|
|
80
89
|
```bash
|
|
81
|
-
reflection doctor
|
|
90
|
+
reflection doctor --config reflection.config.ts
|
|
82
91
|
reflection run --ci --config reflection.config.ts --mode smoke
|
|
83
92
|
reflection review --report-dir artifacts/reflection --json
|
|
84
93
|
```
|
|
@@ -90,7 +99,7 @@ For this repository's built CLI:
|
|
|
90
99
|
```bash
|
|
91
100
|
pnpm install --frozen-lockfile
|
|
92
101
|
pnpm build
|
|
93
|
-
node dist/cli.js doctor
|
|
102
|
+
node dist/cli.js doctor --config examples/basic-react/reflection.config.ts
|
|
94
103
|
node dist/cli.js run --ci --config examples/basic-react/reflection.config.ts --mode smoke
|
|
95
104
|
node dist/cli.js review --report-dir artifacts/reflection --json
|
|
96
105
|
```
|
|
@@ -139,7 +148,7 @@ Use Reflection as the UI evidence gate before claiming frontend work is complete
|
|
|
139
148
|
Run:
|
|
140
149
|
|
|
141
150
|
```bash
|
|
142
|
-
reflection doctor
|
|
151
|
+
reflection doctor --config reflection.config.ts
|
|
143
152
|
reflection run --config reflection.config.ts --mode smoke
|
|
144
153
|
reflection review --json
|
|
145
154
|
```
|
package/docs/visual-contract.md
CHANGED
|
@@ -96,7 +96,13 @@ component: {
|
|
|
96
96
|
{
|
|
97
97
|
id: 'button-primary',
|
|
98
98
|
storyId: 'atoms-button--primary',
|
|
99
|
-
viewport: '
|
|
99
|
+
viewport: 'button-default',
|
|
100
|
+
viewportSize: { width: 390, height: 220 },
|
|
101
|
+
framing: {
|
|
102
|
+
background: '#ffffff',
|
|
103
|
+
align: 'center',
|
|
104
|
+
padding: 0
|
|
105
|
+
},
|
|
100
106
|
baselineRoot: 'tests/fixtures/baselines',
|
|
101
107
|
baseline: 'components/button/primary.chromium-linux.light.png',
|
|
102
108
|
threshold: { maxDiffPixelRatio: 0.005 }
|
|
@@ -105,6 +111,15 @@ component: {
|
|
|
105
111
|
}
|
|
106
112
|
```
|
|
107
113
|
|
|
114
|
+
For component baselines exported from a design tool, treat `viewportSize` and `framing` as part of the visual contract. The exported PNG width/height and the runtime Storybook screenshot width/height must be identical. `viewport` may be a built-in preset such as `component` or a semantic custom label such as `button-default`; when `viewportSize` is present, the explicit dimensions win.
|
|
115
|
+
|
|
116
|
+
`framing` is optional and only affects the screenshot when configured. It applies fixed canvas styles before capture so a Storybook story can match a Figma frame:
|
|
117
|
+
|
|
118
|
+
- `rootSelector`: story root to frame; defaults to `#storybook-root`.
|
|
119
|
+
- `background`: CSS background matching the Figma frame fill.
|
|
120
|
+
- `align`: `center` or `start`; `center` places the component in the middle of the frame.
|
|
121
|
+
- `padding`: integer pixel padding inside the frame.
|
|
122
|
+
|
|
108
123
|
### Pseudo states
|
|
109
124
|
|
|
110
125
|
Prefer story-controlled states. A story named `Button/Hover` or `Button/Focused` is usually more deterministic than moving the mouse in the browser.
|