@kaptures/cli 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/README.md CHANGED
@@ -4,30 +4,36 @@ Kapture compares Storybook builds from an exact base commit and head commit in
4
4
  one explicit browser environment. It produces a self-contained visual report
5
5
  and can publish a SHA-bound review status to GitHub.
6
6
 
7
- Node.js 24 or later is required.
7
+ Node.js 24 or later is required. Both Storybook builds must register the
8
+ matching `@kaptures/storybook@0.0.4` preview adapter. Kapture does not fall back
9
+ to Storybook private globals, legacy decorators, or Chromatic parameters.
8
10
 
9
11
  ```bash
10
- npx -y @kaptures/cli@0.0.2 --help
11
- npx -y @kaptures/cli@0.0.2 browser install
12
+ npx -y @kaptures/cli@0.0.4 --help
13
+ npx -y @kaptures/cli@0.0.4 browser install
12
14
  ```
13
15
 
14
16
  ## Compare Storybooks
15
17
 
16
18
  ```bash
17
- npx -y @kaptures/cli@0.0.2 test \
19
+ npx -y @kaptures/cli@0.0.4 test \
18
20
  --base-dir .kapture/storybook/base \
19
21
  --head-dir .kapture/storybook/head \
20
22
  --base-revision "$BASE_SHA" \
21
23
  --head-revision "$HEAD_SHA" \
22
24
  --output .kapture
23
25
 
24
- npx -y @kaptures/cli@0.0.2 validate \
26
+ npx -y @kaptures/cli@0.0.4 validate \
25
27
  --report .kapture/report/report.json
26
28
  ```
27
29
 
28
30
  Visual changes are a review result, not an execution failure. Capture and
29
31
  comparison errors exit with code 2.
30
32
 
33
+ The default browser locale and time zone are `en-US` and `UTC`. Override them
34
+ explicitly with `--locale <bcp47>` and `--timezone <iana-zone>` when the
35
+ consumer Storybook requires another environment.
36
+
31
37
  ## Optional hosted report
32
38
 
33
39
  Kapture does not require a report deployment. The generated `index.html`
@@ -36,7 +42,7 @@ artifact is downloaded. To publish a browser URL from a privileged workflow,
36
42
  rebuild the untrusted artifact with the dashboard embedded in the pinned CLI:
37
43
 
38
44
  ```bash
39
- npx -y @kaptures/cli@0.0.2 report build \
45
+ npx -y @kaptures/cli@0.0.4 report build \
40
46
  --input downloaded-kapture-report \
41
47
  --output trusted-kapture-report
42
48
  ```
@@ -48,41 +54,62 @@ or unreferenced files.
48
54
 
49
55
  ## GitHub
50
56
 
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
57
+ Run every checkout, repository script, Storybook build, and browser capture in
58
+ the read-only `pull_request` workflow without secrets. Pass only an immutable
59
+ context artifact plus `report.json` and its referenced PNGs to the default
60
+ branch's `workflow_run`; intermediate Storybook artifacts stay inside the
61
+ read-only run.
62
+
63
+ The `workflow_run` resolves exact artifact IDs from the triggering run and
64
+ cross-checks their provenance, bounded archive size, full base/head SHAs, and
65
+ current open pull request. The actual PR head SHA comes from the immutable
66
+ context and live pull request; `workflow_run.head_sha` may be a synthetic merge
67
+ commit and is not treated as the PR head. SHA-pinned `download-artifact@v8`
68
+ fails closed on an archive digest mismatch, then validates entry paths and
69
+ uncompressed limits before extraction. A job without write permission runs
70
+ `github verify` and rebuilds the report from strict JSON and validated PNGs
71
+ with the pinned CLI. A separate write job publishes only that trusted output.
72
+ Neither job checks out PR code or executes artifact code. The `issue_comment`
73
+ workflow similarly handles
62
74
  `/kapture approve <full-head-sha> <report-digest>` without checking out PR
63
75
  code.
64
76
 
65
77
  ```bash
66
- npx -y @kaptures/cli@0.0.2 github verify \
78
+ npx -y @kaptures/cli@0.0.4 github verify \
67
79
  --report .kapture/report/report.json
68
80
 
69
- npx -y @kaptures/cli@0.0.2 github report \
81
+ npx -y @kaptures/cli@0.0.4 github report \
70
82
  --report trusted-kapture-report/report.json \
71
- --report-url "https://github.com/OWNER/REPO/actions/runs/RUN_ID"
83
+ --report-url "https://github.com/OWNER/REPO/actions/runs/RUN_ID/artifacts/ARTIFACT_ID"
72
84
 
73
- npx -y @kaptures/cli@0.0.2 github approve
85
+ npx -y @kaptures/cli@0.0.4 github approve
74
86
  ```
75
87
 
76
88
  GitHub commands read authentication and event data only from `GITHUB_TOKEN`
77
89
  and `GITHUB_EVENT_PATH`. Do not pass tokens as command-line arguments.
90
+ `github verify` and `github report` require the normalized
91
+ `kapture.schemaVersion: 1` event created by the trusted example workflow; do
92
+ not pass GitHub's raw `workflow_run` payload because its `head_sha` may be a
93
+ synthetic merge commit. `github approve` consumes the raw `issue_comment`
94
+ event.
78
95
  `github verify` validates the strict report and its full base/head SHAs against
79
96
  the current pull request without writing a status or comment. Run it before
80
97
  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.
98
+ `github report` requires its image-bound `report.json` before writing. Version
99
+ 3 approval markers bind the base SHA, head SHA, full report structure, actual
100
+ bytes of every referenced PNG, capture run ID and attempt, workflow ID, head
101
+ repository ID, head branch, and report URL. Approval rechecks that marker's run
102
+ is the latest successful capture run for the same PR head repository and branch.
103
+ The current status for the PR head must also be the final approval-ready
104
+ `pending` in the selected context and target the same report URL. The transient
105
+ publishing status is not approvable. Therefore, a base-branch update, new head
106
+ commit, changed report image, or failed rerun at the same SHA prevents an old
107
+ marker and digest from restoring success.
108
+
109
+ The default status context is `Kapture Visual Review`, and report and approval
110
+ comments default to English. Consumers can set `--status-context <name>` and
111
+ `--comment-language en|ko` on both `github report` and `github approve` without
112
+ changing the verification boundary.
86
113
 
87
114
  ## License
88
115