@intentius/chant 0.124.62 → 0.124.64
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/handlers/approve.d.ts +26 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +167 -18
- package/dist/cli/handlers/plan.d.ts +10 -0
- package/dist/cli/handlers/plan.d.ts.map +1 -0
- package/dist/cli/handlers/plan.js +71 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +2 -1
- package/dist/cli/handlers/release.d.ts +11 -7
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +93 -20
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +48 -7
- package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
- package/dist/cli/mcp/workspace-tools.js +2 -1
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +43 -0
- package/dist/cli/registry.d.ts +18 -2
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/config.d.ts +50 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/gate-decision.d.ts +1 -1
- package/dist/gate-decision.d.ts.map +1 -1
- package/dist/gate-decision.js +4 -2
- package/dist/gate-statement.schema.json +46 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +20 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts.map +1 -1
- package/dist/lifecycle/__fixtures__/publish-fakes.js +119 -3
- package/dist/lifecycle/gate-ledger.d.ts +28 -5
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +6 -0
- package/dist/lifecycle/gate-seal.d.ts +59 -7
- package/dist/lifecycle/gate-seal.d.ts.map +1 -1
- package/dist/lifecycle/gate-seal.js +68 -15
- package/dist/lifecycle/gate-statement.d.ts +95 -0
- package/dist/lifecycle/gate-statement.d.ts.map +1 -0
- package/dist/lifecycle/gate-statement.js +110 -0
- package/dist/lifecycle/gate-webauthn.d.ts +79 -0
- package/dist/lifecycle/gate-webauthn.d.ts.map +1 -0
- package/dist/lifecycle/gate-webauthn.js +105 -0
- package/dist/lifecycle/git.d.ts +1 -1
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +24 -19
- package/dist/lifecycle/ledger-remote.d.ts +37 -0
- package/dist/lifecycle/ledger-remote.d.ts.map +1 -0
- package/dist/lifecycle/ledger-remote.js +42 -0
- package/dist/lifecycle/plan-stale.d.ts +76 -0
- package/dist/lifecycle/plan-stale.d.ts.map +1 -0
- package/dist/lifecycle/plan-stale.js +120 -0
- package/dist/lifecycle/publish-credentials.d.ts +1 -1
- package/dist/lifecycle/publish-credentials.d.ts.map +1 -1
- package/dist/lifecycle/publish-credentials.js +2 -0
- package/dist/lifecycle/publish-declaration.d.ts +107 -0
- package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
- package/dist/lifecycle/publish-declaration.js +110 -1
- package/dist/lifecycle/publish-forge.d.ts +5 -1
- package/dist/lifecycle/publish-forge.d.ts.map +1 -1
- package/dist/lifecycle/publish-forge.js +13 -4
- package/dist/lifecycle/publish-git-ssh.d.ts +82 -0
- package/dist/lifecycle/publish-git-ssh.d.ts.map +1 -0
- package/dist/lifecycle/publish-git-ssh.js +180 -0
- package/dist/lifecycle/publish-github.d.ts +69 -0
- package/dist/lifecycle/publish-github.d.ts.map +1 -0
- package/dist/lifecycle/publish-github.js +153 -0
- package/dist/lifecycle/publish-homebrew.d.ts +77 -0
- package/dist/lifecycle/publish-homebrew.d.ts.map +1 -0
- package/dist/lifecycle/publish-homebrew.js +265 -0
- package/dist/lifecycle/publish-marketplace.d.ts +85 -0
- package/dist/lifecycle/publish-marketplace.d.ts.map +1 -0
- package/dist/lifecycle/publish-marketplace.js +398 -0
- package/dist/lifecycle/publish-targets.d.ts +6 -0
- package/dist/lifecycle/publish-targets.d.ts.map +1 -1
- package/dist/lifecycle/publish-targets.js +15 -0
- package/dist/lifecycle/publish-tauri.d.ts +61 -0
- package/dist/lifecycle/publish-tauri.d.ts.map +1 -0
- package/dist/lifecycle/publish-tauri.js +181 -0
- package/dist/lifecycle/release-cut.d.ts +51 -5
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +165 -16
- package/dist/lifecycle/release-publish.d.ts +18 -2
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- package/dist/lifecycle/release-publish.js +5 -0
- package/dist/lifecycle/release-revocation.d.ts +4 -3
- package/dist/lifecycle/release-revocation.d.ts.map +1 -1
- package/dist/lifecycle/release-revocation.js +5 -4
- package/dist/lifecycle/release-store.d.ts +32 -0
- package/dist/lifecycle/release-store.d.ts.map +1 -1
- package/dist/lifecycle/release-store.js +11 -0
- package/dist/lifecycle/snapshot-store.d.ts.map +1 -1
- package/dist/lifecycle/snapshot-store.js +17 -9
- package/dist/lifecycle/test-passkey.d.ts +25 -0
- package/dist/lifecycle/test-passkey.d.ts.map +1 -0
- package/dist/lifecycle/test-passkey.js +39 -0
- package/dist/notify.d.ts +23 -3
- package/dist/notify.d.ts.map +1 -1
- package/dist/notify.js +8 -2
- package/dist/notify.schema.json +12 -3
- package/dist/op/gate.d.ts +1 -1
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +2 -1
- package/dist/pr-forge.d.ts +20 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +87 -8
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/wave-runtime.mjs +333 -331
- package/dist/workspace/ci-builds.d.ts +21 -0
- package/dist/workspace/ci-builds.d.ts.map +1 -1
- package/dist/workspace/ci-builds.js +14 -0
- package/dist/workspace/ci-green.d.ts +45 -2
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +123 -5
- package/dist/workspace/ci-quarantine-report.d.ts +80 -0
- package/dist/workspace/ci-quarantine-report.d.ts.map +1 -0
- package/dist/workspace/ci-quarantine-report.js +204 -0
- package/dist/workspace/ci-quarantine.d.ts +73 -0
- package/dist/workspace/ci-quarantine.d.ts.map +1 -0
- package/dist/workspace/ci-quarantine.js +170 -0
- package/dist/workspace/ci-serve.d.ts.map +1 -1
- package/dist/workspace/ci-serve.js +7 -4
- package/dist/workspace/class-data.d.ts +3 -1
- package/dist/workspace/class-data.d.ts.map +1 -1
- package/dist/workspace/class-data.js +4 -1
- package/dist/workspace/declaration.d.ts +45 -2
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +45 -2
- package/dist/workspace/declaration.schema.json +51 -3
- package/dist/workspace/forge-work.d.ts +76 -0
- package/dist/workspace/forge-work.d.ts.map +1 -0
- package/dist/workspace/forge-work.js +160 -0
- package/dist/workspace/identity-gate-rule.d.ts +3 -2
- package/dist/workspace/identity-gate-rule.d.ts.map +1 -1
- package/dist/workspace/identity-gate-rule.js +5 -7
- package/dist/workspace/identity.d.ts +3 -2
- package/dist/workspace/identity.d.ts.map +1 -1
- package/dist/workspace/identity.js +6 -3
- package/dist/workspace/intent-cli.d.ts +3 -2
- package/dist/workspace/intent-cli.d.ts.map +1 -1
- package/dist/workspace/intent-cli.js +26 -5
- package/dist/workspace/intent-record.d.ts +3 -0
- package/dist/workspace/intent-record.d.ts.map +1 -1
- package/dist/workspace/intent-record.schema.json +32 -0
- package/dist/workspace/intent.d.ts +9 -0
- package/dist/workspace/intent.d.ts.map +1 -1
- package/dist/workspace/intent.js +2 -0
- package/dist/workspace/intent.schema.json +32 -0
- package/dist/workspace/kind-readers.d.ts.map +1 -1
- package/dist/workspace/kind-readers.js +2 -1
- package/dist/workspace/kinds.d.ts +6 -1
- package/dist/workspace/kinds.d.ts.map +1 -1
- package/dist/workspace/kinds.js +8 -3
- package/dist/workspace/plan-stale.schema.json +286 -0
- package/dist/workspace/release-candidates.d.ts +42 -7
- package/dist/workspace/release-candidates.d.ts.map +1 -1
- package/dist/workspace/release-candidates.js +64 -23
- package/dist/workspace/release-candidates.schema.json +55 -2
- package/dist/workspace/releases.schema.json +47 -0
- package/dist/workspace/trust/policy.d.ts +10 -0
- package/dist/workspace/trust/policy.d.ts.map +1 -1
- package/dist/workspace/trust/policy.js +19 -1
- package/dist/workspace/trust/run-commits.d.ts.map +1 -1
- package/dist/workspace/trust/run-commits.js +2 -1
- package/dist/workspace/trust/seal.d.ts.map +1 -1
- package/dist/workspace/trust/seal.js +34 -3
- package/dist/workspace/trust/trust-files.d.ts.map +1 -1
- package/dist/workspace/trust/trust-files.js +6 -1
- package/package.json +2 -1
- package/src/cli/handlers/approve-external-signature.test.ts +328 -0
- package/src/cli/handlers/approve.ts +206 -18
- package/src/cli/handlers/plan.ts +74 -0
- package/src/cli/handlers/pr.ts +2 -1
- package/src/cli/handlers/release.ts +84 -20
- package/src/cli/main.ts +48 -7
- package/src/cli/mcp/workspace-tools.ts +2 -1
- package/src/cli/parse-args.ts +33 -0
- package/src/cli/registry.ts +18 -2
- package/src/config.ts +8 -0
- package/src/gate-decision-bundle.test.ts +4 -2
- package/src/gate-decision.ts +11 -2
- package/src/gate-statement.schema.json +46 -0
- package/src/lifecycle/__fixtures__/publish-fakes.ts +125 -5
- package/src/lifecycle/gate-ledger.ts +34 -5
- package/src/lifecycle/gate-seal.ts +86 -15
- package/src/lifecycle/gate-statement.ts +144 -0
- package/src/lifecycle/gate-webauthn.test.ts +77 -0
- package/src/lifecycle/gate-webauthn.ts +133 -0
- package/src/lifecycle/git.ts +23 -19
- package/src/lifecycle/ledger-remote.test.ts +183 -0
- package/src/lifecycle/ledger-remote.ts +46 -0
- package/src/lifecycle/plan-stale.test.ts +149 -0
- package/src/lifecycle/plan-stale.ts +172 -0
- package/src/lifecycle/publish-credentials.ts +2 -0
- package/src/lifecycle/publish-declaration.ts +116 -1
- package/src/lifecycle/publish-forge.ts +14 -4
- package/src/lifecycle/publish-git-ssh.ts +202 -0
- package/src/lifecycle/publish-github.ts +174 -0
- package/src/lifecycle/publish-homebrew.test.ts +358 -0
- package/src/lifecycle/publish-homebrew.ts +283 -0
- package/src/lifecycle/publish-marketplace.test.ts +406 -0
- package/src/lifecycle/publish-marketplace.ts +421 -0
- package/src/lifecycle/publish-resume.test.ts +40 -0
- package/src/lifecycle/publish-target-context.test.ts +2 -2
- package/src/lifecycle/publish-targets.test.ts +23 -0
- package/src/lifecycle/publish-targets.ts +15 -0
- package/src/lifecycle/publish-tauri.test.ts +163 -0
- package/src/lifecycle/publish-tauri.ts +198 -0
- package/src/lifecycle/release-cut-lane.test.ts +177 -0
- package/src/lifecycle/release-cut-override.test.ts +213 -0
- package/src/lifecycle/release-cut.ts +198 -17
- package/src/lifecycle/release-publish.ts +23 -3
- package/src/lifecycle/release-revocation.ts +5 -4
- package/src/lifecycle/release-store.ts +44 -0
- package/src/lifecycle/snapshot-store.ts +16 -9
- package/src/lifecycle/test-passkey.ts +55 -0
- package/src/notify-bundle.test.ts +3 -1
- package/src/notify.schema.json +12 -3
- package/src/notify.ts +20 -3
- package/src/op/gate.ts +2 -1
- package/src/override-gate-bundle.test.ts +2 -0
- package/src/pr-forge-bundle.test.ts +2 -2
- package/src/pr-forge.test.ts +38 -0
- package/src/pr-forge.ts +93 -11
- package/src/pr-requires.test.ts +9 -0
- package/src/release-floors.ts +1 -1
- package/src/stage-hooks-bundle.test.ts +2 -0
- package/src/wave-runtime-bundle.test.ts +3 -2
- package/src/workspace/ci-builds.ts +27 -0
- package/src/workspace/ci-green-stale.test.ts +193 -0
- package/src/workspace/ci-green.ts +137 -6
- package/src/workspace/ci-quarantine-report.test.ts +145 -0
- package/src/workspace/ci-quarantine-report.ts +234 -0
- package/src/workspace/ci-quarantine.test.ts +160 -0
- package/src/workspace/ci-quarantine.ts +188 -0
- package/src/workspace/ci-serve.ts +7 -4
- package/src/workspace/class-data.ts +5 -1
- package/src/workspace/declaration.schema.json +51 -3
- package/src/workspace/declaration.test.ts +1 -0
- package/src/workspace/declaration.ts +88 -5
- package/src/workspace/forge-work.test.ts +143 -0
- package/src/workspace/forge-work.ts +195 -0
- package/src/workspace/identity-gate-rule.ts +6 -8
- package/src/workspace/identity.ts +6 -3
- package/src/workspace/intent-cli.ts +24 -5
- package/src/workspace/intent-record.schema.json +32 -0
- package/src/workspace/intent-record.ts +3 -0
- package/src/workspace/intent.schema.json +32 -0
- package/src/workspace/intent.ts +9 -0
- package/src/workspace/kind-readers.ts +2 -1
- package/src/workspace/kinds.test.ts +13 -0
- package/src/workspace/kinds.ts +12 -3
- package/src/workspace/plan-stale.schema.json +286 -0
- package/src/workspace/release-candidates.schema.json +55 -2
- package/src/workspace/release-candidates.test.ts +77 -4
- package/src/workspace/release-candidates.ts +80 -23
- package/src/workspace/releases.schema.json +47 -0
- package/src/workspace/trust/gate-seal.test.ts +44 -0
- package/src/workspace/trust/policy.ts +24 -1
- package/src/workspace/trust/run-commits.ts +2 -1
- package/src/workspace/trust/seal.ts +35 -3
- package/src/workspace/trust/trust-files.test.ts +5 -0
- package/src/workspace/trust/trust-files.ts +15 -1
package/src/cli/main.ts
CHANGED
|
@@ -326,6 +326,19 @@ CI:
|
|
|
326
326
|
one starts a bisect: a ci/build/<sha> tag the tick
|
|
327
327
|
starts the phase's workflow at. Each commit judged
|
|
328
328
|
gets a _ci/<sha>.json record on chant/lifecycle.
|
|
329
|
+
ci quarantine check Fail when an entry of ci.green.quarantine is past its
|
|
330
|
+
until, or its until is more than maxDays (14) out.
|
|
331
|
+
ci quarantine filter --phase <name> --runner nextest|playwright|list [--only] [--json]
|
|
332
|
+
What the phase's runner leaves out: a nextest
|
|
333
|
+
filterset for -E, a Playwright --grep-invert pattern,
|
|
334
|
+
or one test a line. Fails as check does for the
|
|
335
|
+
phase. --only selects the quarantined tests instead,
|
|
336
|
+
for the scheduled run, and doesn't fail on expiry.
|
|
337
|
+
ci quarantine report --phase <name> --junit <file>... [--commit <sha>] [--dry-run] [--json]
|
|
338
|
+
After the scheduled run of the quarantined tests:
|
|
339
|
+
each one's outcome from the run's JUnit XML, and
|
|
340
|
+
ci.quarantine-passed through ci.green.notify for each
|
|
341
|
+
that passed. Exits 0 whatever the tests did.
|
|
329
342
|
ci run plan|apply --env <env> --base <sha> [--pr <n>] [--commit <sha>]
|
|
330
343
|
[--forge github|gitlab|forgejo] [--gate <name>] [--wave-gate <name>]
|
|
331
344
|
[--branch <name>] [--events-json] [--report-url <url>] [--image <image>]
|
|
@@ -438,7 +451,8 @@ CI:
|
|
|
438
451
|
Releases:
|
|
439
452
|
release cut [<label>] [--at <sha>] [--yes] [--build <command>] [--param <k=v>]
|
|
440
453
|
[--params-file <file>] [--src <dir>] [-o <file>] [--lexicon <name>]
|
|
441
|
-
[--actor <name>] [--sign [<key file>]] [--channel <tag>]
|
|
454
|
+
[--actor <name>] [--sign [<key file>]] [--channel <tag>]
|
|
455
|
+
[--lane <name>] [--override-green] [--json]
|
|
442
456
|
A dry run of a cut of this member from HEAD, which
|
|
443
457
|
must be clean, on trunk and pushed, and carry a
|
|
444
458
|
ci/green tag: compile every environment in the
|
|
@@ -462,7 +476,13 @@ Releases:
|
|
|
462
476
|
A green commit of a pushed chant/compose/<name>
|
|
463
477
|
branch is cut too, recording its base and sources.
|
|
464
478
|
--channel <tag> records the tag a publish moves in
|
|
465
|
-
place of latest.
|
|
479
|
+
place of latest. --lane <name> (or release.lane in
|
|
480
|
+
chant.config.ts) checks a ci.green lane's tag,
|
|
481
|
+
ci/green-<lane>/<sha>, in place of ci/green.
|
|
482
|
+
--override-green cuts a commit that is not green
|
|
483
|
+
under a person's override, recorded with chant
|
|
484
|
+
approve policy-override release-<sha12>; the cut
|
|
485
|
+
spends it and records who and why.
|
|
466
486
|
release compose <name> [--base <label|sha>] (--pr <n> | --work <id>)...
|
|
467
487
|
[--yes] [--json]
|
|
468
488
|
Cherry-pick the chosen trunk changes, in trunk order,
|
|
@@ -471,11 +491,14 @@ Releases:
|
|
|
471
491
|
that exists; stops on a conflict, naming the change
|
|
472
492
|
and files, and writes nothing. A dry run unless --yes,
|
|
473
493
|
which moves the branch and pushes it.
|
|
474
|
-
release candidates [--env <env>] [--json]
|
|
494
|
+
release candidates [--env <env>] [--lane <name>] [--forge-issues] [--json]
|
|
475
495
|
The green commits of trunk a release can be cut from,
|
|
476
496
|
newest first, each with the commits, work items, pull
|
|
477
497
|
requests and flags it would ship, and what each
|
|
478
|
-
environment runs.
|
|
498
|
+
environment runs. --lane reads a lane's green tags,
|
|
499
|
+
as release cut --lane checks them. --forge-issues asks
|
|
500
|
+
the forge which issues each pull request closes, once
|
|
501
|
+
per pull request
|
|
479
502
|
release publish <label|digest> [--yes] [--allow-unsigned]
|
|
480
503
|
[--require-provenance] [--json]
|
|
481
504
|
Publish a cut release to the targets release.publish
|
|
@@ -516,6 +539,10 @@ Change sets:
|
|
|
516
539
|
[--member <name>] [--json] bound, stored on
|
|
517
540
|
chant/lifecycle under its digest, each
|
|
518
541
|
entry with its graph node. Read-only.
|
|
542
|
+
plan stale <digest> Whether anything applied to the plan's op or
|
|
543
|
+
[--member <name>] [--json] environment after the
|
|
544
|
+
plan was recorded, and which applies.
|
|
545
|
+
Exit 2 when stale. Read-only.
|
|
519
546
|
|
|
520
547
|
Ops:
|
|
521
548
|
run <name> Run an Op on the resolved runtime (--on; local by default)
|
|
@@ -645,6 +672,15 @@ Ops:
|
|
|
645
672
|
file at base lists for --actor. --relayed-by
|
|
646
673
|
<principal> records who carried the approval to chant
|
|
647
674
|
for --actor (a follower, a bot); --sign covers it.
|
|
675
|
+
--statement prints the bytes an approval signs, at a
|
|
676
|
+
time it fixes, and records nothing; --signature
|
|
677
|
+
<file|-> --at <time> then records a signature made
|
|
678
|
+
elsewhere over them (an ssh signature, or a passkey's
|
|
679
|
+
WebAuthn assertion checked against .chant/trust.json's
|
|
680
|
+
passkeys), which counts as --sign does (#4646).
|
|
681
|
+
--binding <text> adds a line the relay sets (a deploy
|
|
682
|
+
id and an expiry, say) that the signature covers too;
|
|
683
|
+
pass the same on --statement and --signature (#4697)
|
|
648
684
|
--resume then starts the CI job that waits at the
|
|
649
685
|
gate again (GitHub re-run, GitLab retry, Forgejo
|
|
650
686
|
dispatch) with CHANT_FORGE_TOKEN
|
|
@@ -1112,14 +1148,16 @@ Workspace (level 1, #2524):
|
|
|
1112
1148
|
Each composite instance the members declare, with the
|
|
1113
1149
|
components whose contract can deploy it; an instance
|
|
1114
1150
|
with none lists an empty set
|
|
1115
|
-
workspace graph --intent <path[:start-end]|path#symbol|member/node|sha> [--at <rev>] [--kind <kind file>...] [--follow-squash] [--json]
|
|
1151
|
+
workspace graph --intent <path[:start-end]|path#symbol|member/node|sha> [--at <rev>] [--kind <kind file>...] [--follow-squash] [--forge-issues] [--json]
|
|
1116
1152
|
The intent graph over one region: the commits that
|
|
1117
1153
|
touched it, the decisions whose constrains cover it,
|
|
1118
1154
|
the artifacts they pin, and findings with closed codes.
|
|
1119
1155
|
Without --kind, every record kind the declaration names.
|
|
1120
1156
|
--follow-squash follows a squash merge to its pull
|
|
1121
|
-
request's commits, fetching a missing ref from origin
|
|
1122
|
-
|
|
1157
|
+
request's commits, fetching a missing ref from origin.
|
|
1158
|
+
--forge-issues asks the forge which issues each
|
|
1159
|
+
commit's pull request closes
|
|
1160
|
+
workspace graph --intent --record <id> [--at <rev>] [--kind <kind file>...] [--follow-squash] [--forge-issues] [--json]
|
|
1123
1161
|
One decision's intent walk over every path: and member:
|
|
1124
1162
|
entry it constrains: the commits in its window, each
|
|
1125
1163
|
own, worked, within-other or unexplained, with counts
|
|
@@ -1808,6 +1846,7 @@ export const commandRegistry: CommandDef[] = [
|
|
|
1808
1846
|
// #4098: the run index at the report URL.
|
|
1809
1847
|
// #4147: a provisioner's signed word that it started a runner for one job, signed and checked.
|
|
1810
1848
|
{ name: "ci runner-start", runsNoConfig: true, handler: async (ctx) => (await import("../workspace/ci-runner-start")).runCiRunnerStart(ctx) },
|
|
1849
|
+
{ name: "ci quarantine", runsNoConfig: true, handler: async (ctx) => (await import("../workspace/ci-quarantine")).runCiQuarantine(ctx) },
|
|
1811
1850
|
{ name: "ci runs", runsNoConfig: true, handler: async (ctx) => (await import("../workspace/ci-run-index")).runCiRuns(ctx) },
|
|
1812
1851
|
{ name: "ci serve", runsNoConfig: true, handler: async (ctx) => (await import("../workspace/ci-serve")).runCiServe(ctx) },
|
|
1813
1852
|
// #4026: the release cut from a green commit (ws-104). Imported on first use.
|
|
@@ -1827,6 +1866,8 @@ export const commandRegistry: CommandDef[] = [
|
|
|
1827
1866
|
{ name: "change-set summary", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/change-set")).runChangeSetSummary(ctx) },
|
|
1828
1867
|
// #4022: the change set a gate bound, read from chant/lifecycle by its digest.
|
|
1829
1868
|
{ name: "change-set show", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/change-set")).runChangeSetShow(ctx) },
|
|
1869
|
+
// #4648: whether anything applied to a plan's targets after it was recorded. Read-only, imported on first use.
|
|
1870
|
+
{ name: "plan stale", runsNoConfig: true, handler: async (ctx) => (await import("./handlers/plan")).runPlanStale(ctx) },
|
|
1830
1871
|
{ name: "init", handler: runInit, runsNoConfig: true },
|
|
1831
1872
|
{ name: "init lexicon", handler: runInitLexicon },
|
|
1832
1873
|
{ name: "update", handler: runUpdate },
|
|
@@ -118,6 +118,7 @@ export const workspaceReadTools: ToolDefinition[] = [
|
|
|
118
118
|
},
|
|
119
119
|
intent: { type: "string", description: "The region for the intent graph: a workspace path, path:line, path:start-end, or path#symbol for a TypeScript or JavaScript declaration such as src/server.ts#createApp (--intent). The document's why answers why the region is like this." },
|
|
120
120
|
followSquash: { type: "boolean", description: "With intent: follow squash merges to their pull requests' original commits (--follow-squash, #3035), fetching a pull request ref the clone lacks from origin. Off by default, so a read never reaches the network." },
|
|
121
|
+
forgeIssues: { type: "boolean", description: "With intent: ask the forge which issues each commit's pull request closes (--forge-issues, #4649), once per pull request. Off by default." },
|
|
121
122
|
composites: { type: "boolean", description: "The composites document instead (--composites). Takes no kind or intent." },
|
|
122
123
|
at: atProp,
|
|
123
124
|
},
|
|
@@ -419,7 +420,7 @@ export function readArgv(tool: string, params: Record<string, unknown>): string[
|
|
|
419
420
|
const composites = bool(params, "composites");
|
|
420
421
|
const kindArgs = kinds(params).flatMap((k) => ["--kind", k]);
|
|
421
422
|
if (composites) return ["workspace", "graph", "--composites", ...kindArgs, ...(intent !== undefined ? ["--intent", intent] : []), ...atArgs, "--json"];
|
|
422
|
-
if (intent !== undefined) return ["workspace", "graph", "--intent", intent, ...kindArgs, ...atArgs, ...(bool(params, "followSquash") ? ["--follow-squash"] : []), "--json"];
|
|
423
|
+
if (intent !== undefined) return ["workspace", "graph", "--intent", intent, ...kindArgs, ...atArgs, ...(bool(params, "followSquash") ? ["--follow-squash"] : []), ...(bool(params, "forgeIssues") ? ["--forge-issues"] : []), "--json"];
|
|
423
424
|
return ["workspace", "graph", ...kindArgs, ...atArgs, "--json"];
|
|
424
425
|
}
|
|
425
426
|
case "workspace-changes": {
|
package/src/cli/parse-args.ts
CHANGED
|
@@ -93,6 +93,7 @@ const BOOLEAN_FLAGS = new Set([
|
|
|
93
93
|
"--allow-code",
|
|
94
94
|
"--allow-skip",
|
|
95
95
|
"--allow-unsigned",
|
|
96
|
+
"--override-green",
|
|
96
97
|
"--require-provenance",
|
|
97
98
|
"--root-only",
|
|
98
99
|
"--generated",
|
|
@@ -103,6 +104,7 @@ const BOOLEAN_FLAGS = new Set([
|
|
|
103
104
|
"--loopback",
|
|
104
105
|
"--artifacts",
|
|
105
106
|
"--push",
|
|
107
|
+
"--only",
|
|
106
108
|
]);
|
|
107
109
|
|
|
108
110
|
/**
|
|
@@ -563,6 +565,9 @@ export function parseArgs(args: string[]): ParsedArgs {
|
|
|
563
565
|
// `chant ci run|serve --status-url <template>` (#4097): the link a job's status carries, in place of an https --report-url.
|
|
564
566
|
result.statusUrl = args[++i];
|
|
565
567
|
if (!result.statusUrl || result.statusUrl.startsWith("-")) throw new Error("--status-url needs a URL template: --status-url https://host/reports/{key}");
|
|
568
|
+
} else if (arg === "--override-green") {
|
|
569
|
+
// `chant release cut --override-green` (#4693): cut a commit that is not green under a person's override.
|
|
570
|
+
result.overrideGreen = true;
|
|
566
571
|
} else if (arg === "--allow-unsigned") {
|
|
567
572
|
// `chant release publish --allow-unsigned` (#4049).
|
|
568
573
|
result.allowUnsigned = true;
|
|
@@ -717,6 +722,9 @@ export function parseArgs(args: string[]): ParsedArgs {
|
|
|
717
722
|
} else if (arg === "--follow-squash") {
|
|
718
723
|
// `chant workspace graph --intent ... --follow-squash` and `chant workspace runs --follow-squash` (#3035)
|
|
719
724
|
result.followSquash = true;
|
|
725
|
+
} else if (arg === "--forge-issues") {
|
|
726
|
+
// `chant release candidates --forge-issues` and `chant workspace graph --intent ... --forge-issues` (#4649)
|
|
727
|
+
result.forgeIssues = true;
|
|
720
728
|
} else if (arg === "--record") {
|
|
721
729
|
// `chant workspace graph --intent --record <id>`
|
|
722
730
|
result.record = args[++i];
|
|
@@ -962,6 +970,19 @@ export function parseArgs(args: string[]): ParsedArgs {
|
|
|
962
970
|
result.actor = args[++i];
|
|
963
971
|
} else if (arg === "--approver") {
|
|
964
972
|
result.approver = args[++i];
|
|
973
|
+
} else if (arg === "--statement") {
|
|
974
|
+
// `chant approve <op> <gate> --statement` (#4646): print the bytes an approval signs, for a signature made elsewhere.
|
|
975
|
+
result.statement = true;
|
|
976
|
+
} else if (arg === "--signature") {
|
|
977
|
+
// `chant approve <op> <gate> --signature <file|-> --at <timestamp>` (#4646): an approval signed elsewhere.
|
|
978
|
+
result.signature = args[++i];
|
|
979
|
+
if (!result.signature || (result.signature.startsWith("-") && result.signature !== "-")) {
|
|
980
|
+
throw new Error("--signature needs a file holding the signature, or - for stdin: --signature <file|->");
|
|
981
|
+
}
|
|
982
|
+
} else if (arg === "--binding") {
|
|
983
|
+
// `chant approve <op> <gate> --statement|--signature|--sign --binding <text>` (#4697): a line the relay sets for the signature to cover.
|
|
984
|
+
result.binding = args[++i];
|
|
985
|
+
if (!result.binding || result.binding.startsWith("-")) throw new Error("--binding needs the line the signature binds, which does not start with -: --binding <text>");
|
|
965
986
|
} else if (arg === "--relayed-by") {
|
|
966
987
|
// `chant approve <op> <gate> --relayed-by <principal>` and `workspace points answer <id> --relayed-by <principal>` (#3402):
|
|
967
988
|
// who carried the approval or answer to chant for the person it names.
|
|
@@ -1200,7 +1221,19 @@ export function parseArgs(args: string[]): ParsedArgs {
|
|
|
1200
1221
|
result.ciWait = true;
|
|
1201
1222
|
} else if (arg === "--lane") {
|
|
1202
1223
|
// `chant ci last-green --lane <name>` and `chant ci base --lane <name>` (#4662): a green lane's tags and phases.
|
|
1224
|
+
// `chant release cut|candidates --lane <name>` (#4692): a cut from that lane's green tag.
|
|
1203
1225
|
result.lane = args[++i];
|
|
1226
|
+
} else if (arg === "--runner") {
|
|
1227
|
+
// `chant ci quarantine filter --runner nextest|playwright|list` (#4677): the runner the filter is for.
|
|
1228
|
+
result.quarantineRunner = args[++i];
|
|
1229
|
+
} else if (arg === "--junit") {
|
|
1230
|
+
// `chant ci quarantine report --junit <file>`, repeatable (#4677): the scheduled run's JUnit XML.
|
|
1231
|
+
const value = args[++i];
|
|
1232
|
+
if (!value || value.startsWith("-")) throw new Error("--junit needs the JUnit XML file the run wrote: --junit <file>");
|
|
1233
|
+
(result.quarantineJunit ??= []).push(value);
|
|
1234
|
+
} else if (arg === "--only") {
|
|
1235
|
+
// `chant ci quarantine filter --only` (#4677): select the quarantined tests, for the scheduled run.
|
|
1236
|
+
result.quarantineOnly = true;
|
|
1204
1237
|
} else if (arg === "--phase") {
|
|
1205
1238
|
// `chant ci base --phase <name>` (#4643): the ci.green phase whose base to find.
|
|
1206
1239
|
result.phase = args[++i];
|
package/src/cli/registry.ts
CHANGED
|
@@ -377,6 +377,8 @@ export interface ParsedArgs {
|
|
|
377
377
|
prs?: number[];
|
|
378
378
|
/** `chant release cut --channel <tag>` (#4168 4.3): the tag a publish of the release moves in place of `latest`. */
|
|
379
379
|
channel?: string;
|
|
380
|
+
/** `chant release cut --override-green` (#4693): cut a commit that is not green under a person's override on the override ledger. */
|
|
381
|
+
overrideGreen?: boolean;
|
|
380
382
|
/**
|
|
381
383
|
* `chant components pr-plan|pr-apply --forge github|gitlab|forgejo` (#3183)
|
|
382
384
|
* — post the note and the commit status on this forge, with the client
|
|
@@ -595,6 +597,8 @@ export interface ParsedArgs {
|
|
|
595
597
|
intent?: string;
|
|
596
598
|
/** `chant workspace graph --intent` and `chant workspace runs` (#3035): follow squash merges to their pull requests' original commits, fetching missing pull request refs. */
|
|
597
599
|
followSquash?: boolean;
|
|
600
|
+
/** `chant release candidates --forge-issues` and `chant workspace graph --intent --forge-issues` (#4649): ask the forge which issues each squash-merged pull request closes, once per pull request. */
|
|
601
|
+
forgeIssues?: boolean;
|
|
598
602
|
/** `chant workspace graph --intent --record <id>`: walk one decision record over every entry its constrains lists. */
|
|
599
603
|
record?: string;
|
|
600
604
|
/** `chant workspace patch <range> --path <p>`: only these paths, from the workspace root. Repeatable. */
|
|
@@ -701,6 +705,12 @@ export interface ParsedArgs {
|
|
|
701
705
|
* On `chant approve` and `chant run approve`, the key that seals the gate approval (#3163).
|
|
702
706
|
*/
|
|
703
707
|
sign?: string | true;
|
|
708
|
+
/** `chant approve <op> <gate> --statement` (#4646): print the statement an approval signs, and record nothing. */
|
|
709
|
+
statement?: boolean;
|
|
710
|
+
/** `chant approve <op> <gate> --signature <file|->` (#4646): a signature made elsewhere over the statement. */
|
|
711
|
+
signature?: string;
|
|
712
|
+
/** `chant approve <op> <gate> --binding <text>` (#4697): a line the relay sets, signed last with the statement. */
|
|
713
|
+
binding?: string;
|
|
704
714
|
/**
|
|
705
715
|
* `chant approve <op> <gate> --relayed-by <principal>` and `chant workspace
|
|
706
716
|
* points answer <id> --relayed-by <principal>` (#3402): the principal that
|
|
@@ -919,10 +929,16 @@ export interface ParsedArgs {
|
|
|
919
929
|
since?: string;
|
|
920
930
|
/** `chant ci verdict --wait` (#4644) — read again until no required phase is pending. */
|
|
921
931
|
ciWait?: boolean;
|
|
922
|
-
/** `chant ci last-green --lane <name>` and `chant ci base --lane <name>` (#4662) — a ci.green lane. */
|
|
932
|
+
/** `chant ci last-green --lane <name>` and `chant ci base --lane <name>` (#4662) — a ci.green lane. `chant release cut --lane <name>` and `chant release candidates --lane <name>` (#4692) — check that lane's green tags. */
|
|
923
933
|
lane?: string;
|
|
924
|
-
/** `chant ci base --phase <name>` (#4643) — the ci.green phase whose base to find. */
|
|
934
|
+
/** `chant ci base --phase <name>` (#4643) — the ci.green phase whose base to find. `chant ci quarantine filter --phase <name>` (#4677) — the phase whose runner takes the filter. */
|
|
925
935
|
phase?: string;
|
|
936
|
+
/** `chant ci quarantine filter --runner nextest|playwright|list` (#4677). */
|
|
937
|
+
quarantineRunner?: string;
|
|
938
|
+
/** `chant ci quarantine filter --only` (#4677) — select the quarantined tests in place of leaving them out. */
|
|
939
|
+
quarantineOnly?: boolean;
|
|
940
|
+
/** `chant ci quarantine report --junit <file>`, repeatable (#4677) — the scheduled run's JUnit XML. */
|
|
941
|
+
quarantineJunit?: string[];
|
|
926
942
|
/** `chant audit-log attribute|unrecorded --audit-log aws[:<region>]` (#4632): the cloud audit log to read. */
|
|
927
943
|
auditLog?: string;
|
|
928
944
|
/** `chant ledger`, `chant workspace records` and `chant workspace runs --where <field><op><value>` (#4363): typed filters, repeatable, all of which have to hold. */
|
package/src/config.ts
CHANGED
|
@@ -109,6 +109,7 @@ export const ChantConfigSchema = z.object({
|
|
|
109
109
|
release: z.object({
|
|
110
110
|
autoRecord: z.boolean().optional(),
|
|
111
111
|
publish: z.array(PublishDeclarationSchema).optional(),
|
|
112
|
+
lane: z.string().regex(/^[a-z0-9][a-z0-9-]*$/, "a ci.green lane name: lowercase letters, digits and dashes").optional(),
|
|
112
113
|
}).optional(),
|
|
113
114
|
// Strict: a misspelt key here would leave Ops on the local runtime with
|
|
114
115
|
// nothing said (#2523).
|
|
@@ -371,6 +372,13 @@ export interface ChantConfig {
|
|
|
371
372
|
* the order given. See ./lifecycle/publish-declaration.ts.
|
|
372
373
|
*/
|
|
373
374
|
publish?: PublishDeclaration[];
|
|
375
|
+
/**
|
|
376
|
+
* The green lane `chant release cut` and `chant release candidates` check
|
|
377
|
+
* when `--lane` is not given (#4692): one `ci.green.lanes` declares in
|
|
378
|
+
* chant.workspace.json. The commit must then carry `ci/green-<lane>/<sha>`
|
|
379
|
+
* rather than `ci/green/<sha>`.
|
|
380
|
+
*/
|
|
381
|
+
lane?: string;
|
|
374
382
|
};
|
|
375
383
|
|
|
376
384
|
/** Defaults for `chant run` and its subcommands (#2523). */
|
|
@@ -46,6 +46,8 @@ describe("the gate-decision bundle", () => {
|
|
|
46
46
|
"packages/core/src/lifecycle/gate-applied.ts",
|
|
47
47
|
"packages/core/src/lifecycle/gate-ledger-select.ts",
|
|
48
48
|
"packages/core/src/lifecycle/gate-seal.ts",
|
|
49
|
+
// A passkey's seal (#4646), checked with node:crypto.
|
|
50
|
+
"packages/core/src/lifecycle/gate-webauthn.ts",
|
|
49
51
|
// The gated-request digest (#4551) and its sorted-key replacer.
|
|
50
52
|
"packages/core/src/lifecycle/gated-request-digest.ts",
|
|
51
53
|
"packages/core/src/lifecycle/plan-digest.ts",
|
|
@@ -68,8 +70,8 @@ describe("the gate-decision bundle", () => {
|
|
|
68
70
|
"packages/core/src/workspace/jsonc.ts",
|
|
69
71
|
"packages/core/src/workspace/trust/trust-files.ts",
|
|
70
72
|
]);
|
|
71
|
-
// About 49 KB unminified today: 7 KB of it the pinned classes read as data (#3888), 6 KB the approval rules (#4290), and the base approval checks (#4404) bring it to about 55 KB.
|
|
73
|
+
// About 49 KB unminified today: 7 KB of it the pinned classes read as data (#3888), 6 KB the approval rules (#4290), and the base approval checks (#4404) bring it to about 55 KB, and the passkey seal check (#4646) to about 63 KB.
|
|
72
74
|
const bytes = result.outputFiles.reduce((n, f) => n + f.contents.byteLength, 0);
|
|
73
|
-
expect(bytes).toBeLessThan(
|
|
75
|
+
expect(bytes).toBeLessThan(66 * 1024);
|
|
74
76
|
});
|
|
75
77
|
});
|
package/src/gate-decision.ts
CHANGED
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
} from "./lifecycle/gate-ledger-select";
|
|
55
55
|
import { samePlanDigest } from "./lifecycle/plan-digest";
|
|
56
56
|
import { isApprovalSpent, type AppliedGateRecord } from "./lifecycle/gate-applied";
|
|
57
|
-
import { gateSealRefusal, type GateSigners, type SealedGateApproval } from "./lifecycle/gate-seal";
|
|
57
|
+
import { gateSealRefusal, type GateSigners, type PasskeySigner, type SealedGateApproval } from "./lifecycle/gate-seal";
|
|
58
58
|
import {
|
|
59
59
|
DEFAULT_SIGNERS_PATH,
|
|
60
60
|
TRUST_CONFIG_PATH,
|
|
@@ -87,9 +87,16 @@ export {
|
|
|
87
87
|
sealedFieldsOf,
|
|
88
88
|
sshKeyFingerprint,
|
|
89
89
|
verifySshSignatureWith,
|
|
90
|
+
checkGateSignature,
|
|
91
|
+
verifyWebAuthnAssertion,
|
|
92
|
+
webAuthnChallenge,
|
|
93
|
+
WEBAUTHN_SEAL_KIND,
|
|
94
|
+
type GateSignatureCheck,
|
|
90
95
|
type GateSigners,
|
|
96
|
+
type PasskeySigner,
|
|
91
97
|
type SealedGateApproval,
|
|
92
98
|
type SshSignatureCheck,
|
|
99
|
+
type WebAuthnAssertion,
|
|
93
100
|
} from "./lifecycle/gate-seal";
|
|
94
101
|
export {
|
|
95
102
|
DEFAULT_SIGNERS_PATH,
|
|
@@ -186,6 +193,7 @@ function trustAt(repo: string, base: string): { signers: GateSigners; roles: Rec
|
|
|
186
193
|
const configText = showAt(repo, base, TRUST_CONFIG_PATH);
|
|
187
194
|
let signersPath = DEFAULT_SIGNERS_PATH;
|
|
188
195
|
let roles: Record<string, string[]> = {};
|
|
196
|
+
let passkeys: PasskeySigner[] = [];
|
|
189
197
|
if (configText !== undefined) {
|
|
190
198
|
let raw: unknown;
|
|
191
199
|
try {
|
|
@@ -197,9 +205,10 @@ function trustAt(repo: string, base: string): { signers: GateSigners; roles: Rec
|
|
|
197
205
|
if (problems.length > 0) return off([`${TRUST_CONFIG_PATH} is invalid: ${problems.join("; ")}`]);
|
|
198
206
|
signersPath = (raw as { signers?: string }).signers ?? DEFAULT_SIGNERS_PATH;
|
|
199
207
|
roles = (raw as { roles?: Record<string, string[]> }).roles ?? {};
|
|
208
|
+
passkeys = (raw as { passkeys?: PasskeySigner[] }).passkeys ?? [];
|
|
200
209
|
}
|
|
201
210
|
const text = showAt(repo, base, signersPath);
|
|
202
|
-
return { signers: { base, signersPath, active: text !== undefined, signers: text === undefined ? [] : parseAllowedSigners(text).signers, problems: [] }, roles };
|
|
211
|
+
return { signers: { base, signersPath, active: text !== undefined, signers: text === undefined ? [] : parseAllowedSigners(text).signers, passkeys, problems: [] }, roles };
|
|
203
212
|
}
|
|
204
213
|
|
|
205
214
|
/**
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://intentius.io/chant/schemas/gate-statement/v1/gate-statement.schema.json",
|
|
4
|
+
"title": "chant-gate-statement/v1",
|
|
5
|
+
"description": "What `chant approve <op> <gate> --statement` prints (#4646): the exact bytes an approval of the gate signs, for a signature made outside chant. Sign `statement` (the bytes of `text`) with an ssh key in the `chant-gate` namespace, or with a passkey whose WebAuthn challenge is `challenge`, then record it with `chant approve <op> <gate> --actor <resolvedBy> --at <timestamp> --signature <file>`, passing the same `--relayed-by`, `--plan`, `--env` and `--binding`. Written by chant 0.124.63 and newer. Readers ignore fields they do not know; a field is only ever added within a version.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"schema",
|
|
9
|
+
"chantVersion",
|
|
10
|
+
"op",
|
|
11
|
+
"gate",
|
|
12
|
+
"environment",
|
|
13
|
+
"planDigest",
|
|
14
|
+
"resolvedBy",
|
|
15
|
+
"relayedBy",
|
|
16
|
+
"timestamp",
|
|
17
|
+
"checkpointDigest",
|
|
18
|
+
"binding",
|
|
19
|
+
"sealVersion",
|
|
20
|
+
"namespace",
|
|
21
|
+
"text",
|
|
22
|
+
"statement",
|
|
23
|
+
"digest",
|
|
24
|
+
"challenge"
|
|
25
|
+
],
|
|
26
|
+
"properties": {
|
|
27
|
+
"schema": { "const": "chant-gate-statement/v1" },
|
|
28
|
+
"chantVersion": { "type": "string", "description": "The chant that printed the statement." },
|
|
29
|
+
"op": { "type": "string", "description": "The Op, or the component or command name the gate is recorded under. The statement's first line." },
|
|
30
|
+
"gate": { "type": "string", "description": "The gate. The second line." },
|
|
31
|
+
"environment": { "type": ["string", "null"], "description": "The environment the approval answers; null signs an empty third line." },
|
|
32
|
+
"planDigest": { "type": ["string", "null"], "description": "The plan the approval is for; null signs an empty fourth line." },
|
|
33
|
+
"resolvedBy": { "type": "string", "description": "The approver, as --actor names them: the principal the signature must be listed for at base. The fifth line." },
|
|
34
|
+
"relayedBy": { "type": ["string", "null"], "description": "Who relays the approval (--relayed-by). When not null the statement has a `relayed-by <principal>` line after the time." },
|
|
35
|
+
"timestamp": { "type": "string", "description": "The approval's time, ISO 8601 UTC with milliseconds. The sixth line. Pass it as --at when recording the signature." },
|
|
36
|
+
"checkpointDigest": { "type": ["string", "null"], "description": "The checkpoint a resumed run carries its outputs from. When not null the statement ends with a `checkpoint <digest>` line." },
|
|
37
|
+
"binding": { "type": ["string", "null"], "maxLength": 512, "description": "A line the relay set with --binding (#4697) for the signature to cover as well, such as its deploy id and an expiry: one line of printable text, at most 512 UTF-8 bytes, which chant records with the approval and does not interpret. When not null the statement ends with a `binding <text>` line, after any checkpoint line." },
|
|
38
|
+
"sealVersion": { "enum": [1, 2, 3], "description": "3 when the statement signs a binding, else 2 when it signs a checkpoint digest, else 1." },
|
|
39
|
+
"namespace": { "const": "chant-gate", "description": "The ssh signature namespace (`ssh-keygen -Y sign -n chant-gate`)." },
|
|
40
|
+
"text": { "type": "string", "description": "The statement as UTF-8 text: the lines joined by LF, no final newline." },
|
|
41
|
+
"statement": { "type": "string", "contentEncoding": "base64", "description": "The same bytes, base64. These are what is signed." },
|
|
42
|
+
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$", "description": "SHA-256 of the bytes." },
|
|
43
|
+
"challenge": { "type": "string", "pattern": "^[A-Za-z0-9_-]{43}$", "description": "The WebAuthn challenge a passkey signs: base64url of the bytes' SHA-256, with no padding." }
|
|
44
|
+
},
|
|
45
|
+
"additionalProperties": true
|
|
46
|
+
}
|
|
@@ -251,6 +251,9 @@ export interface FakeForgeRelease {
|
|
|
251
251
|
draft: boolean;
|
|
252
252
|
target: string;
|
|
253
253
|
assets: Array<{ name: string; digest: string | null; bytes: string }>;
|
|
254
|
+
name?: string;
|
|
255
|
+
/** GitHub: the `make_latest` the release was published with. */
|
|
256
|
+
make_latest?: string;
|
|
254
257
|
}
|
|
255
258
|
|
|
256
259
|
/** A forge fake answering through `fetch`: GitHub or Forgejo with draft releases, or GitLab with releases, links and a generic package registry. */
|
|
@@ -264,11 +267,14 @@ export interface FakeForge {
|
|
|
264
267
|
visible(): Array<{ tag: string; assets: string[] }>;
|
|
265
268
|
/** Make the next request whose `METHOD url` starts with `prefix` answer 500. */
|
|
266
269
|
failOnce(prefix: string): void;
|
|
270
|
+
/** GitHub and Forgejo: the repository's tags, each the commit it names. Publishing a release makes its tag at its target when there is none. */
|
|
271
|
+
tags: Map<string, string>;
|
|
267
272
|
}
|
|
268
273
|
|
|
269
274
|
/** A forge fake at `api` for `repo`, which holds `releases` to begin with. */
|
|
270
275
|
export function startFakeForge(forge: "github" | "forgejo" | "gitlab", api: string, repo: string, releases: FakeForgeRelease[] = []): FakeForge {
|
|
271
276
|
const calls: FakeForge["calls"] = [];
|
|
277
|
+
const tags = new Map<string, string>(releases.filter((r) => !r.draft).map((r) => [r.tag_name, r.target]));
|
|
272
278
|
const packages = new Map<string, string>();
|
|
273
279
|
const failures: string[] = [];
|
|
274
280
|
let nextId = 100 + releases.length;
|
|
@@ -278,7 +284,7 @@ export function startFakeForge(forge: "github" | "forgejo" | "gitlab", api: stri
|
|
|
278
284
|
const view = (r: FakeForgeRelease) =>
|
|
279
285
|
forge === "gitlab"
|
|
280
286
|
? { tag_name: r.tag_name, assets: { links: r.assets.map((a) => ({ name: a.name })) } }
|
|
281
|
-
: { id: r.id, tag_name: r.tag_name, draft: r.draft, upload_url: `${uploads}/repos/${repo}/releases/${r.id}/assets{?name,label}`, assets: r.assets.map((a) => ({ name: a.name, ...(forge === "github" ? { digest: a.digest } : {}) })) };
|
|
287
|
+
: { id: r.id, tag_name: r.tag_name, name: r.name ?? r.tag_name, draft: r.draft, upload_url: `${uploads}/repos/${repo}/releases/${r.id}/assets{?name,label}`, assets: r.assets.map((a) => ({ name: a.name, ...(forge === "github" ? { digest: a.digest } : {}) })) };
|
|
282
288
|
const text = (b: Uint8Array | string | undefined) => (b === undefined ? "" : typeof b === "string" ? b : Buffer.from(b).toString("utf-8"));
|
|
283
289
|
const fetch: FakeForge["fetch"] = async (url, init) => {
|
|
284
290
|
calls.push({ method: init.method, url, headers: init.headers, ...(init.body !== undefined ? { body: init.body } : {}) });
|
|
@@ -316,8 +322,8 @@ export function startFakeForge(forge: "github" | "forgejo" | "gitlab", api: stri
|
|
|
316
322
|
}
|
|
317
323
|
if (init.method === "GET" && path === `${root}/releases`) return json(200, releases.map(view));
|
|
318
324
|
if (init.method === "POST" && path === `${root}/releases`) {
|
|
319
|
-
const b = JSON.parse(text(init.body)) as { tag_name: string; target_commitish: string; draft?: boolean };
|
|
320
|
-
const r: FakeForgeRelease = { id: nextId++, tag_name: b.tag_name, draft: b.draft === true, target: b.target_commitish, assets: [] };
|
|
325
|
+
const b = JSON.parse(text(init.body)) as { tag_name: string; target_commitish: string; draft?: boolean; name?: string };
|
|
326
|
+
const r: FakeForgeRelease = { id: nextId++, tag_name: b.tag_name, draft: b.draft === true, target: b.target_commitish, assets: [], ...(b.name ? { name: b.name } : {}) };
|
|
321
327
|
releases.push(r);
|
|
322
328
|
return json(201, view(r));
|
|
323
329
|
}
|
|
@@ -336,10 +342,27 @@ export function startFakeForge(forge: "github" | "forgejo" | "gitlab", api: stri
|
|
|
336
342
|
if (init.method === "PATCH" && edit) {
|
|
337
343
|
const r = releases.find((x) => x.id === Number(edit[1]));
|
|
338
344
|
if (!r) return json(404, { message: "Not Found" });
|
|
339
|
-
const b = JSON.parse(text(init.body)) as { draft?: boolean };
|
|
340
|
-
if (b.draft === false
|
|
345
|
+
const b = JSON.parse(text(init.body)) as { draft?: boolean; make_latest?: string };
|
|
346
|
+
if (b.draft === false && r.draft) {
|
|
347
|
+
if (releases.some((x) => x !== r && !x.draft && x.tag_name === r.tag_name)) return json(422, { message: "Validation Failed", errors: [{ code: "already_exists", field: "tag_name" }] });
|
|
348
|
+
r.draft = false;
|
|
349
|
+
if (!tags.has(r.tag_name)) tags.set(r.tag_name, r.target);
|
|
350
|
+
if (b.make_latest !== undefined) r.make_latest = b.make_latest;
|
|
351
|
+
}
|
|
341
352
|
return json(200, view(r));
|
|
342
353
|
}
|
|
354
|
+
if (init.method === "DELETE" && edit) {
|
|
355
|
+
const i = releases.findIndex((x) => x.id === Number(edit[1]));
|
|
356
|
+
if (i < 0) return json(404, { message: "Not Found" });
|
|
357
|
+
releases.splice(i, 1);
|
|
358
|
+
return json(204, undefined);
|
|
359
|
+
}
|
|
360
|
+
const tagRef = path.startsWith(`${root}/git/refs/tags/`) ? decodeURIComponent(path.slice(`${root}/git/refs/tags/`.length)) : null;
|
|
361
|
+
if (init.method === "DELETE" && tagRef !== null) {
|
|
362
|
+
if (!tags.has(tagRef)) return json(422, { message: "Reference does not exist" });
|
|
363
|
+
tags.delete(tagRef);
|
|
364
|
+
return json(204, undefined);
|
|
365
|
+
}
|
|
343
366
|
return json(404, { message: "Not Found" });
|
|
344
367
|
};
|
|
345
368
|
return {
|
|
@@ -349,6 +372,7 @@ export function startFakeForge(forge: "github" | "forgejo" | "gitlab", api: stri
|
|
|
349
372
|
packages,
|
|
350
373
|
visible: () => releases.filter((r) => !r.draft).map((r) => ({ tag: r.tag_name, assets: r.assets.map((a) => a.name) })),
|
|
351
374
|
failOnce: (prefix) => void failures.push(prefix),
|
|
375
|
+
tags,
|
|
352
376
|
};
|
|
353
377
|
}
|
|
354
378
|
|
|
@@ -372,3 +396,99 @@ export function writeLockfile(dir: string): void {
|
|
|
372
396
|
JSON.stringify({ name: "acme", lockfileVersion: 3, packages: { "": { name: "acme" }, "node_modules/left-pad": { version: "1.3.0" } } }, null, 2),
|
|
373
397
|
);
|
|
374
398
|
}
|
|
399
|
+
|
|
400
|
+
/** A GitHub repository fake answering through `fetch` (#4676): branches, commits of whole files, and the contents and refs APIs. */
|
|
401
|
+
export interface FakeGitHubRepo {
|
|
402
|
+
fetch: FakeForge["fetch"];
|
|
403
|
+
calls: FakeForge["calls"];
|
|
404
|
+
/** The branches, each the sha of its commit. */
|
|
405
|
+
branches: Map<string, string>;
|
|
406
|
+
/** The file `path` on `branch`, or undefined. */
|
|
407
|
+
read(branch: string, path: string): string | undefined;
|
|
408
|
+
/** Commit `files` onto `branch` as someone else would, moving it. */
|
|
409
|
+
push(branch: string, files: Record<string, string>): void;
|
|
410
|
+
/** Each commit's message, oldest first, on `branch`'s history. */
|
|
411
|
+
log(branch: string): string[];
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/** A repository fake at `api` for `repo` whose `branch` holds `files`. */
|
|
415
|
+
export function startFakeGitHubRepo(api: string, repo: string, branch: string, files: Record<string, string>): FakeGitHubRepo {
|
|
416
|
+
const calls: FakeGitHubRepo["calls"] = [];
|
|
417
|
+
const commits = new Map<string, { parent: string | null; message: string; files: Map<string, string> }>();
|
|
418
|
+
const branches = new Map<string, string>();
|
|
419
|
+
let n = 0;
|
|
420
|
+
const commit = (parent: string | null, message: string, change: Record<string, string>) => {
|
|
421
|
+
const base = parent ? commits.get(parent)!.files : new Map<string, string>();
|
|
422
|
+
const sha = createHash("sha1").update(`commit ${n++}`).digest("hex");
|
|
423
|
+
commits.set(sha, { parent, message, files: new Map([...base, ...Object.entries(change)]) });
|
|
424
|
+
return sha;
|
|
425
|
+
};
|
|
426
|
+
branches.set(branch, commit(null, "init", files));
|
|
427
|
+
const blob = (text: string) => createHash("sha1").update(`blob ${text}`).digest("hex");
|
|
428
|
+
const ancestor = (a: string, b: string) => {
|
|
429
|
+
for (let c: string | null = b; c; c = commits.get(c)?.parent ?? null) if (c === a) return true;
|
|
430
|
+
return false;
|
|
431
|
+
};
|
|
432
|
+
const json = (status: number, body?: unknown) => ({ ok: status < 300, status, headers: { get: () => null }, text: async () => (body === undefined ? "" : JSON.stringify(body)) });
|
|
433
|
+
const root = `${api}/repos/${repo}`;
|
|
434
|
+
const fetch: FakeGitHubRepo["fetch"] = async (url, init) => {
|
|
435
|
+
calls.push({ method: init.method, url, headers: init.headers, ...(init.body !== undefined ? { body: init.body } : {}) });
|
|
436
|
+
const u = new URL(url);
|
|
437
|
+
const path = url.split("?")[0]!;
|
|
438
|
+
const body = typeof init.body === "string" ? (JSON.parse(init.body) as Record<string, unknown>) : {};
|
|
439
|
+
if (init.method === "GET" && path === root) return json(200, { default_branch: branch });
|
|
440
|
+
const ref = path.match(/\/git\/refs?\/heads\/(.+)$/);
|
|
441
|
+
if (ref && path.startsWith(root)) {
|
|
442
|
+
const name = decodeURIComponent(ref[1]!);
|
|
443
|
+
const at = branches.get(name);
|
|
444
|
+
if (init.method === "GET") return at ? json(200, { ref: `refs/heads/${name}`, object: { sha: at } }) : json(404, { message: "Not Found" });
|
|
445
|
+
if (!at) return json(422, { message: "Reference does not exist" });
|
|
446
|
+
if (init.method === "DELETE") return void branches.delete(name), json(204);
|
|
447
|
+
if (init.method === "PATCH") {
|
|
448
|
+
const to = String(body.sha);
|
|
449
|
+
if (!commits.has(to)) return json(422, { message: "Object does not exist" });
|
|
450
|
+
if (body.force !== true && !ancestor(at, to)) return json(422, { message: "Update is not a fast forward" });
|
|
451
|
+
branches.set(name, to);
|
|
452
|
+
return json(200, { object: { sha: to } });
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (init.method === "POST" && path === `${root}/git/refs`) {
|
|
456
|
+
const name = String(body.ref).replace(/^refs\/heads\//, "");
|
|
457
|
+
if (branches.has(name)) return json(422, { message: "Reference already exists" });
|
|
458
|
+
branches.set(name, String(body.sha));
|
|
459
|
+
return json(201, { ref: body.ref, object: { sha: body.sha } });
|
|
460
|
+
}
|
|
461
|
+
const contents = path.startsWith(`${root}/contents/`) ? path.slice(`${root}/contents/`.length).split("/").map(decodeURIComponent).join("/") : null;
|
|
462
|
+
if (contents !== null && init.method === "GET") {
|
|
463
|
+
const at = branches.get(u.searchParams.get("ref") ?? branch);
|
|
464
|
+
const text = at ? commits.get(at)!.files.get(contents) : undefined;
|
|
465
|
+
return text === undefined ? json(404, { message: "Not Found" }) : json(200, { sha: blob(text), encoding: "base64", content: Buffer.from(text).toString("base64") });
|
|
466
|
+
}
|
|
467
|
+
if (contents !== null && init.method === "PUT") {
|
|
468
|
+
const on = String(body.branch);
|
|
469
|
+
const at = branches.get(on);
|
|
470
|
+
if (!at) return json(404, { message: "Branch not found" });
|
|
471
|
+
const current = commits.get(at)!.files.get(contents);
|
|
472
|
+
if ((current === undefined ? undefined : blob(current)) !== body.sha) return json(409, { message: "sha does not match" });
|
|
473
|
+
const sha = commit(at, String(body.message), { [contents]: Buffer.from(String(body.content), "base64").toString("utf-8") });
|
|
474
|
+
branches.set(on, sha);
|
|
475
|
+
return json(current === undefined ? 201 : 200, { content: { sha: blob(contents) }, commit: { sha } });
|
|
476
|
+
}
|
|
477
|
+
return json(404, { message: "Not Found" });
|
|
478
|
+
};
|
|
479
|
+
return {
|
|
480
|
+
fetch,
|
|
481
|
+
calls,
|
|
482
|
+
branches,
|
|
483
|
+
read: (b, p) => {
|
|
484
|
+
const at = branches.get(b);
|
|
485
|
+
return at ? commits.get(at)!.files.get(p) : undefined;
|
|
486
|
+
},
|
|
487
|
+
push: (b, change) => void branches.set(b, commit(branches.get(b)!, "someone else", change)),
|
|
488
|
+
log: (b) => {
|
|
489
|
+
const out: string[] = [];
|
|
490
|
+
for (let c: string | null = branches.get(b) ?? null; c; c = commits.get(c)!.parent) out.unshift(commits.get(c)!.message);
|
|
491
|
+
return out;
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
}
|