@kaptures/cli 0.0.1 → 0.0.2
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 +49 -11
- package/dist/dashboard/assets/{index-BZsjRjeC.js → index-NDgXncO0.js} +1 -1
- package/dist/dashboard/index.html +1 -1
- package/dist/index.js +322 -101
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -7,44 +7,82 @@ and can publish a SHA-bound review status to GitHub.
|
|
|
7
7
|
Node.js 24 or later is required.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npx -y @kaptures/cli@0.0.
|
|
11
|
-
npx -y @kaptures/cli@0.0.
|
|
10
|
+
npx -y @kaptures/cli@0.0.2 --help
|
|
11
|
+
npx -y @kaptures/cli@0.0.2 browser install
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Compare Storybooks
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
npx -y @kaptures/cli@0.0.
|
|
17
|
+
npx -y @kaptures/cli@0.0.2 test \
|
|
18
18
|
--base-dir .kapture/storybook/base \
|
|
19
19
|
--head-dir .kapture/storybook/head \
|
|
20
20
|
--base-revision "$BASE_SHA" \
|
|
21
21
|
--head-revision "$HEAD_SHA" \
|
|
22
22
|
--output .kapture
|
|
23
23
|
|
|
24
|
-
npx -y @kaptures/cli@0.0.
|
|
24
|
+
npx -y @kaptures/cli@0.0.2 validate \
|
|
25
25
|
--report .kapture/report/report.json
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
Visual changes are a review result, not an execution failure. Capture and
|
|
29
29
|
comparison errors exit with code 2.
|
|
30
30
|
|
|
31
|
+
## Optional hosted report
|
|
32
|
+
|
|
33
|
+
Kapture does not require a report deployment. The generated `index.html`
|
|
34
|
+
remains self-contained and can be opened through a `file://` URL after the
|
|
35
|
+
artifact is downloaded. To publish a browser URL from a privileged workflow,
|
|
36
|
+
rebuild the untrusted artifact with the dashboard embedded in the pinned CLI:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx -y @kaptures/cli@0.0.2 report build \
|
|
40
|
+
--input downloaded-kapture-report \
|
|
41
|
+
--output trusted-kapture-report
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Deploy only `trusted-kapture-report/` with the repository's existing static
|
|
45
|
+
hosting. The builder validates the strict report schema and referenced PNGs,
|
|
46
|
+
and never executes or copies artifact HTML, JavaScript, CSS, fonts, symlinks,
|
|
47
|
+
or unreferenced files.
|
|
48
|
+
|
|
31
49
|
## GitHub
|
|
32
50
|
|
|
33
|
-
Use
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
Use isolated jobs in the default branch's `workflow_run`. The base and head
|
|
52
|
+
jobs may run repository code, but must have no write permission or secrets.
|
|
53
|
+
The capture job does not check out the PR or run repository scripts; it runs
|
|
54
|
+
the pinned CLI against the two static Storybook builds without write
|
|
55
|
+
permission or secrets. Storybook JavaScript is evaluated only inside that
|
|
56
|
+
unprivileged browser boundary.
|
|
57
|
+
|
|
58
|
+
Before using deployment credentials, the report job performs a read-only
|
|
59
|
+
preflight. It must not check out PR code or execute artifact code. It rebuilds
|
|
60
|
+
the hosted report from strict JSON and validated PNGs with the pinned CLI, then
|
|
61
|
+
updates the PR. The `issue_comment` workflow similarly handles
|
|
62
|
+
`/kapture approve <full-head-sha> <report-digest>` without checking out PR
|
|
63
|
+
code.
|
|
37
64
|
|
|
38
65
|
```bash
|
|
39
|
-
npx -y @kaptures/cli@0.0.
|
|
40
|
-
--report .kapture/report/report.json
|
|
66
|
+
npx -y @kaptures/cli@0.0.2 github verify \
|
|
67
|
+
--report .kapture/report/report.json
|
|
68
|
+
|
|
69
|
+
npx -y @kaptures/cli@0.0.2 github report \
|
|
70
|
+
--report trusted-kapture-report/report.json \
|
|
41
71
|
--report-url "https://github.com/OWNER/REPO/actions/runs/RUN_ID"
|
|
42
72
|
|
|
43
|
-
npx -y @kaptures/cli@0.0.
|
|
73
|
+
npx -y @kaptures/cli@0.0.2 github approve
|
|
44
74
|
```
|
|
45
75
|
|
|
46
76
|
GitHub commands read authentication and event data only from `GITHUB_TOKEN`
|
|
47
77
|
and `GITHUB_EVENT_PATH`. Do not pass tokens as command-line arguments.
|
|
78
|
+
`github verify` validates the strict report and its full base/head SHAs against
|
|
79
|
+
the current pull request without writing a status or comment. Run it before
|
|
80
|
+
deployment. A privileged report job must pass the output of `report build`;
|
|
81
|
+
`github report` requires its image-bound `report.json` before writing. Approval
|
|
82
|
+
markers bind the base SHA, head SHA, full report
|
|
83
|
+
structure, and the actual bytes of every referenced PNG. The approval command
|
|
84
|
+
must contain that exact report digest, so a base-branch update, new head commit,
|
|
85
|
+
or changed report image requires a new comparison.
|
|
48
86
|
|
|
49
87
|
## License
|
|
50
88
|
|