@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
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A gate approval signed with a passkey (#4646): a WebAuthn assertion over
|
|
3
|
+
* the gate's statement, checked with node:crypto.
|
|
4
|
+
*
|
|
5
|
+
* A platform that collects an approval on a phone asks the browser for an
|
|
6
|
+
* assertion (`navigator.credentials.get`) whose challenge is the statement's
|
|
7
|
+
* digest, `base64url(SHA-256(statement))` with no padding, where the
|
|
8
|
+
* statement is `gateSealPayload`'s bytes (`chant approve --statement` prints
|
|
9
|
+
* them). The assertion is relayed to `chant approve --signature`, checked
|
|
10
|
+
* against a passkey `.chant/trust.json` lists at base for the approver, and
|
|
11
|
+
* kept on the approval's seal, so anyone can check it again offline.
|
|
12
|
+
*
|
|
13
|
+
* The check follows WebAuthn level 2, section 7.2, for what can be checked
|
|
14
|
+
* without the relying party's state: the client data's type is
|
|
15
|
+
* `webauthn.get`, its challenge is the statement's, its origin is one the
|
|
16
|
+
* passkey lists and it is not cross-origin; the authenticator data's rpIdHash
|
|
17
|
+
* is SHA-256 of the passkey's rpId and both the user-present and
|
|
18
|
+
* user-verified flags are set; and the signature over authenticatorData ||
|
|
19
|
+
* SHA-256(clientDataJSON) verifies with the passkey's public key. The
|
|
20
|
+
* signature counter is not checked: a ledger line can't know the
|
|
21
|
+
* authenticator's last count.
|
|
22
|
+
*
|
|
23
|
+
* Like `./gate-seal.ts`, this imports node:crypto and nothing else, so a
|
|
24
|
+
* bundled gate decision carries it.
|
|
25
|
+
*/
|
|
26
|
+
import { createHash, createPublicKey, verify } from "node:crypto";
|
|
27
|
+
const B64URL = /^[A-Za-z0-9_-]+={0,2}$/;
|
|
28
|
+
/** Whether `raw` has the shape of a {@link WebAuthnAssertion}. */
|
|
29
|
+
export function isWebAuthnAssertion(raw) {
|
|
30
|
+
const a = raw;
|
|
31
|
+
return (!!a && typeof a === "object" && !Array.isArray(a) &&
|
|
32
|
+
["id", "clientDataJSON", "authenticatorData", "signature"].every((k) => typeof a[k] === "string" && B64URL.test(a[k])));
|
|
33
|
+
}
|
|
34
|
+
/** The challenge a passkey signs for `statement`: base64url of its SHA-256, no padding. */
|
|
35
|
+
export function webAuthnChallenge(statement) {
|
|
36
|
+
return createHash("sha256").update(statement).digest("base64url");
|
|
37
|
+
}
|
|
38
|
+
/** The passkey's key and the algorithm its signature is checked with, or why it can't be read. */
|
|
39
|
+
export function passkeyPublicKey(publicKey) {
|
|
40
|
+
let key;
|
|
41
|
+
try {
|
|
42
|
+
key = createPublicKey({ key: Buffer.from(publicKey, "base64url"), format: "der", type: "spki" });
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
return { problem: `the public key is not a DER SubjectPublicKeyInfo: ${err instanceof Error ? err.message : String(err)}` };
|
|
46
|
+
}
|
|
47
|
+
if (key.asymmetricKeyType === "ed25519")
|
|
48
|
+
return { key, alg: "EdDSA" };
|
|
49
|
+
if (key.asymmetricKeyType === "ec" && key.asymmetricKeyDetails?.namedCurve === "prime256v1")
|
|
50
|
+
return { key, alg: "ES256" };
|
|
51
|
+
if (key.asymmetricKeyType === "rsa")
|
|
52
|
+
return { key, alg: "RS256" };
|
|
53
|
+
return { problem: `a ${key.asymmetricKeyType}${key.asymmetricKeyDetails?.namedCurve ? ` ${key.asymmetricKeyDetails.namedCurve}` : ""} key; a passkey is Ed25519, P-256 or RSA` };
|
|
54
|
+
}
|
|
55
|
+
const sameId = (a, b) => a.replace(/=+$/, "") === b.replace(/=+$/, "");
|
|
56
|
+
/**
|
|
57
|
+
* Whether `assertion` signs `statement` with one of `passkeys`, chosen by
|
|
58
|
+
* credential id. Never throws.
|
|
59
|
+
*/
|
|
60
|
+
export function verifyWebAuthnAssertion(assertion, statement, passkeys) {
|
|
61
|
+
try {
|
|
62
|
+
const pk = passkeys.find((p) => sameId(p.id, assertion.id));
|
|
63
|
+
if (!pk)
|
|
64
|
+
return { ok: false, reason: `signed by passkey ${assertion.id}, which the policy at base does not list for the approver` };
|
|
65
|
+
const clientData = Buffer.from(assertion.clientDataJSON, "base64url");
|
|
66
|
+
let cd;
|
|
67
|
+
try {
|
|
68
|
+
cd = JSON.parse(clientData.toString("utf-8"));
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return { ok: false, reason: "its clientDataJSON is not JSON" };
|
|
72
|
+
}
|
|
73
|
+
if (cd.type !== "webauthn.get")
|
|
74
|
+
return { ok: false, reason: `its client data is a ${JSON.stringify(cd.type)} ceremony, not webauthn.get` };
|
|
75
|
+
if (cd.challenge !== webAuthnChallenge(statement))
|
|
76
|
+
return { ok: false, reason: "its challenge is not this approval's statement digest" };
|
|
77
|
+
if (typeof cd.origin !== "string" || !pk.origins.includes(cd.origin)) {
|
|
78
|
+
return { ok: false, reason: `it comes from origin ${JSON.stringify(cd.origin)}, and the passkey allows ${pk.origins.join(", ")}` };
|
|
79
|
+
}
|
|
80
|
+
if (cd.crossOrigin === true)
|
|
81
|
+
return { ok: false, reason: "it was made in a cross-origin frame" };
|
|
82
|
+
const authData = Buffer.from(assertion.authenticatorData, "base64url");
|
|
83
|
+
if (authData.length < 37)
|
|
84
|
+
return { ok: false, reason: "its authenticatorData is shorter than 37 bytes" };
|
|
85
|
+
if (!authData.subarray(0, 32).equals(createHash("sha256").update(pk.rpId, "utf-8").digest())) {
|
|
86
|
+
return { ok: false, reason: `its rpIdHash is not SHA-256 of ${pk.rpId}` };
|
|
87
|
+
}
|
|
88
|
+
const flags = authData[32];
|
|
89
|
+
if (!(flags & 0x01))
|
|
90
|
+
return { ok: false, reason: "the user-present flag is unset" };
|
|
91
|
+
if (!(flags & 0x04))
|
|
92
|
+
return { ok: false, reason: "the user-verified flag is unset" };
|
|
93
|
+
const key = passkeyPublicKey(pk.publicKey);
|
|
94
|
+
if ("problem" in key)
|
|
95
|
+
return { ok: false, reason: `passkey ${pk.id}: ${key.problem}` };
|
|
96
|
+
const signed = Buffer.concat([authData, createHash("sha256").update(clientData).digest()]);
|
|
97
|
+
const signature = Buffer.from(assertion.signature, "base64url");
|
|
98
|
+
// ES256 signatures are ASN.1 DER, node's default for an EC key.
|
|
99
|
+
const ok = verify(key.alg === "EdDSA" ? null : "sha256", signed, key.key, signature);
|
|
100
|
+
return ok ? { ok: true, key: pk.id } : { ok: false, reason: "the signature does not match the signed fields" };
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
return { ok: false, reason: err instanceof Error ? err.message : String(err) };
|
|
104
|
+
}
|
|
105
|
+
}
|
package/dist/lifecycle/git.d.ts
CHANGED
|
@@ -300,7 +300,7 @@ export declare function pushLifecycleStatus(opts?: {
|
|
|
300
300
|
* Returns false (without throwing) when no remote is configured, or when git
|
|
301
301
|
* refused the push for a reason other than a stale lease.
|
|
302
302
|
*
|
|
303
|
-
* The remote is the ledger's ({@link ledgerRemote}: `
|
|
303
|
+
* The remote is the ledger's ({@link ledgerRemote}: the one `CHANT_LIFECYCLE_REMOTE` names, else `origin`),
|
|
304
304
|
* the same one {@link fetchLifecycleStatus} reads, and a push that lands
|
|
305
305
|
* records the tip it pushed as the remote-tracking ref, so the next push's
|
|
306
306
|
* lease is right in a single-branch clone too (#3391).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/lifecycle/git.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/lifecycle/git.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIpD;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAEnF;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yHAAyH;IACzH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IACpC,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAmFD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,cAAc,GAAG;IAAE,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC7D,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,0GAA0G;IAC1G,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,IAA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AE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAO5E;AAyBD;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGlE;AA0DD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,cAAc,CAMvE"}
|
package/dist/lifecycle/git.js
CHANGED
|
@@ -10,6 +10,7 @@ import { getRuntime } from "../runtime-adapter.js";
|
|
|
10
10
|
import { memberLedgerPrefix, resolveMemberLedger } from "./member-ledger.js";
|
|
11
11
|
import { LIFECYCLE_LOCAL_NOTE } from "./local-note.js";
|
|
12
12
|
import { ledgerRecordingOff, NO_RECORD_PUSH_NOTE, overlayTip, setOverlayTip } from "./no-record.js";
|
|
13
|
+
import { chooseLedgerRemote, lifecycleRemoteOverride } from "./ledger-remote.js";
|
|
13
14
|
const STATE_BRANCH = "chant/lifecycle";
|
|
14
15
|
/**
|
|
15
16
|
* The branch path of `dir` for the project at `cwd` (#2538): `dir` itself at
|
|
@@ -655,7 +656,7 @@ export async function pushLifecycleStatus(opts) {
|
|
|
655
656
|
if (found === null)
|
|
656
657
|
return { status: "no-remote" };
|
|
657
658
|
if ("failed" in found)
|
|
658
|
-
return { status: "failed", remote: "(unknown)", stderr: found.stderr };
|
|
659
|
+
return { status: "failed", remote: found.named ?? "(unknown)", stderr: found.stderr };
|
|
659
660
|
const { remote } = found;
|
|
660
661
|
// Capture the lease SHA — if null, the remote ref doesn't exist yet
|
|
661
662
|
// (first-time push) and we send `--force-with-lease=ref:` (empty SHA),
|
|
@@ -687,7 +688,7 @@ export async function pushLifecycleStatus(opts) {
|
|
|
687
688
|
* Returns false (without throwing) when no remote is configured, or when git
|
|
688
689
|
* refused the push for a reason other than a stale lease.
|
|
689
690
|
*
|
|
690
|
-
* The remote is the ledger's ({@link ledgerRemote}: `
|
|
691
|
+
* The remote is the ledger's ({@link ledgerRemote}: the one `CHANT_LIFECYCLE_REMOTE` names, else `origin`),
|
|
691
692
|
* the same one {@link fetchLifecycleStatus} reads, and a push that lands
|
|
692
693
|
* records the tip it pushed as the remote-tracking ref, so the next push's
|
|
693
694
|
* lease is right in a single-branch clone too (#3391).
|
|
@@ -965,23 +966,22 @@ const NON_FAST_FORWARD_RE = /non-fast-forward|rejected/i;
|
|
|
965
966
|
*/
|
|
966
967
|
const C_LOCALE_ENV = { LC_ALL: "C", LANGUAGE: "" };
|
|
967
968
|
/**
|
|
968
|
-
* The remote the ledger lives on.
|
|
969
|
+
* The remote the ledger lives on ({@link chooseLedgerRemote}).
|
|
969
970
|
*
|
|
970
|
-
* `
|
|
971
|
-
*
|
|
972
|
-
*
|
|
973
|
-
*
|
|
974
|
-
*
|
|
971
|
+
* The one `CHANT_LIFECYCLE_REMOTE` names (#4647), else `origin` when it
|
|
972
|
+
* exists, rather than whichever name sorts first — a repo with a `backup`
|
|
973
|
+
* remote alongside `origin` would otherwise fetch the ledger from `backup`.
|
|
974
|
+
* A non-zero exit is *not* read as "no remote": a git that failed to answer
|
|
975
|
+
* is not evidence that a project is single-machine, and treating it as one is
|
|
976
|
+
* what lets an unreadable ledger look empty. Nor is a named remote the
|
|
977
|
+
* repository lacks.
|
|
975
978
|
*/
|
|
976
979
|
async function ledgerRemote(cwd) {
|
|
977
980
|
const rt = getRuntime();
|
|
978
981
|
const result = await rt.spawn(["git", "remote"], { cwd, env: C_LOCALE_ENV });
|
|
979
982
|
if (result.exitCode !== 0)
|
|
980
983
|
return { failed: true, stderr: (result.stderr ?? "").trim() };
|
|
981
|
-
|
|
982
|
-
if (names.length === 0)
|
|
983
|
-
return null;
|
|
984
|
-
return { remote: names.includes("origin") ? "origin" : names[0] };
|
|
984
|
+
return chooseLedgerRemote(result.stdout.trim().split("\n").map((n) => n.trim()).filter(Boolean));
|
|
985
985
|
}
|
|
986
986
|
/** A scratch ref this module owns, used to resolve the remote tip without touching the ledger branch. */
|
|
987
987
|
const PROBE_REF = "refs/chant/lifecycle-probe";
|
|
@@ -1009,7 +1009,7 @@ export async function fetchLifecycleStatus(opts) {
|
|
|
1009
1009
|
if (found === null)
|
|
1010
1010
|
return { status: "no-remote" };
|
|
1011
1011
|
if ("failed" in found) {
|
|
1012
|
-
return { status: "unreachable", remote: "(unknown)", stderr: found.stderr };
|
|
1012
|
+
return { status: "unreachable", remote: found.named ?? "(unknown)", stderr: found.stderr };
|
|
1013
1013
|
}
|
|
1014
1014
|
const { remote } = found;
|
|
1015
1015
|
const fetchResult = await rt.spawn(["git", "fetch", remote, `${STATE_BRANCH}:${STATE_BRANCH}`], { cwd, env: C_LOCALE_ENV });
|
|
@@ -1308,10 +1308,13 @@ export async function pushRefStatus(ref, opts) {
|
|
|
1308
1308
|
if (ledgerRecordingOff())
|
|
1309
1309
|
return "no-remote";
|
|
1310
1310
|
const rt = getRuntime();
|
|
1311
|
-
|
|
1312
|
-
|
|
1311
|
+
// #4647: the ledger's remote, so a lease ref goes where the branch does.
|
|
1312
|
+
const found = await ledgerRemote(opts?.cwd);
|
|
1313
|
+
if (found === null)
|
|
1313
1314
|
return "no-remote";
|
|
1314
|
-
|
|
1315
|
+
if ("failed" in found)
|
|
1316
|
+
return lifecycleRemoteOverride() === undefined ? "no-remote" : "rejected";
|
|
1317
|
+
const { remote } = found;
|
|
1315
1318
|
let expected;
|
|
1316
1319
|
if (opts?.expect !== undefined) {
|
|
1317
1320
|
expected = opts.expect;
|
|
@@ -1351,10 +1354,12 @@ export async function fetchRefInto(remoteRef, localRef, opts) {
|
|
|
1351
1354
|
*/
|
|
1352
1355
|
export async function fetchRefIntoStatus(remoteRef, localRef, opts) {
|
|
1353
1356
|
const rt = getRuntime();
|
|
1354
|
-
const
|
|
1355
|
-
if (
|
|
1357
|
+
const found = await ledgerRemote(opts?.cwd);
|
|
1358
|
+
if (found === null)
|
|
1356
1359
|
return "no-remote";
|
|
1357
|
-
|
|
1360
|
+
if ("failed" in found)
|
|
1361
|
+
return lifecycleRemoteOverride() === undefined ? "no-remote" : "failed";
|
|
1362
|
+
const { remote } = found;
|
|
1358
1363
|
const fetchResult = await rt.spawn(["git", "fetch", remote, `+${remoteRef}:${localRef}`], { cwd: opts?.cwd, env: C_LOCALE_ENV });
|
|
1359
1364
|
if (fetchResult.exitCode === 0)
|
|
1360
1365
|
return "fetched";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which remote `chant/lifecycle` is fetched from and pushed to (#4647).
|
|
3
|
+
*
|
|
4
|
+
* By default the ledger lives on `origin`, or on the first remote when there
|
|
5
|
+
* is no `origin`. `CHANT_LIFECYCLE_REMOTE=<name>` names another one, for a
|
|
6
|
+
* checkout whose `origin` is not where the ledger belongs (a deploy box that
|
|
7
|
+
* clones from a mirror, say). Every read and write of the ledger goes through
|
|
8
|
+
* here: the fetch, the push and its lease, the remote-tracking ref
|
|
9
|
+
* `refs/remotes/<remote>/chant/lifecycle`, and the lease and lock refs pushed
|
|
10
|
+
* beside the branch.
|
|
11
|
+
*
|
|
12
|
+
* A name the repository has no remote by is an error, never a fallback to
|
|
13
|
+
* `origin`: a ledger pushed to the wrong remote is what the setting exists to
|
|
14
|
+
* prevent.
|
|
15
|
+
*
|
|
16
|
+
* Kept free of git and the runtime adapter, so the synchronous readers (the
|
|
17
|
+
* trust checks, `ci base`, ci-serve) can use it too.
|
|
18
|
+
*/
|
|
19
|
+
/** The environment variable that names the ledger's remote. */
|
|
20
|
+
export declare const LIFECYCLE_REMOTE_ENV = "CHANT_LIFECYCLE_REMOTE";
|
|
21
|
+
/** The remote `CHANT_LIFECYCLE_REMOTE` names, or undefined when it is unset or empty. */
|
|
22
|
+
export declare function lifecycleRemoteOverride(env?: NodeJS.ProcessEnv): string | undefined;
|
|
23
|
+
/** What {@link chooseLedgerRemote} found: a remote, no remote at all, or a setting that names none of them. */
|
|
24
|
+
export type LedgerRemoteChoice = {
|
|
25
|
+
remote: string;
|
|
26
|
+
} | {
|
|
27
|
+
failed: true;
|
|
28
|
+
stderr: string;
|
|
29
|
+
named?: string;
|
|
30
|
+
} | null;
|
|
31
|
+
/**
|
|
32
|
+
* The ledger's remote among `names`, the output of `git remote`: the one
|
|
33
|
+
* `CHANT_LIFECYCLE_REMOTE` names, else `origin`, else the first. Null when
|
|
34
|
+
* there is no remote and nothing is named.
|
|
35
|
+
*/
|
|
36
|
+
export declare function chooseLedgerRemote(names: readonly string[], env?: NodeJS.ProcessEnv): LedgerRemoteChoice;
|
|
37
|
+
//# sourceMappingURL=ledger-remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-remote.d.ts","sourceRoot":"","sources":["../../src/lifecycle/ledger-remote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,yFAAyF;AACzF,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAGhG;AAED,+GAA+G;AAC/G,MAAM,MAAM,kBAAkB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC;AAE9G;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,kBAAkB,CASrH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which remote `chant/lifecycle` is fetched from and pushed to (#4647).
|
|
3
|
+
*
|
|
4
|
+
* By default the ledger lives on `origin`, or on the first remote when there
|
|
5
|
+
* is no `origin`. `CHANT_LIFECYCLE_REMOTE=<name>` names another one, for a
|
|
6
|
+
* checkout whose `origin` is not where the ledger belongs (a deploy box that
|
|
7
|
+
* clones from a mirror, say). Every read and write of the ledger goes through
|
|
8
|
+
* here: the fetch, the push and its lease, the remote-tracking ref
|
|
9
|
+
* `refs/remotes/<remote>/chant/lifecycle`, and the lease and lock refs pushed
|
|
10
|
+
* beside the branch.
|
|
11
|
+
*
|
|
12
|
+
* A name the repository has no remote by is an error, never a fallback to
|
|
13
|
+
* `origin`: a ledger pushed to the wrong remote is what the setting exists to
|
|
14
|
+
* prevent.
|
|
15
|
+
*
|
|
16
|
+
* Kept free of git and the runtime adapter, so the synchronous readers (the
|
|
17
|
+
* trust checks, `ci base`, ci-serve) can use it too.
|
|
18
|
+
*/
|
|
19
|
+
/** The environment variable that names the ledger's remote. */
|
|
20
|
+
export const LIFECYCLE_REMOTE_ENV = "CHANT_LIFECYCLE_REMOTE";
|
|
21
|
+
/** The remote `CHANT_LIFECYCLE_REMOTE` names, or undefined when it is unset or empty. */
|
|
22
|
+
export function lifecycleRemoteOverride(env = process.env) {
|
|
23
|
+
const value = env[LIFECYCLE_REMOTE_ENV]?.trim();
|
|
24
|
+
return value ? value : undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The ledger's remote among `names`, the output of `git remote`: the one
|
|
28
|
+
* `CHANT_LIFECYCLE_REMOTE` names, else `origin`, else the first. Null when
|
|
29
|
+
* there is no remote and nothing is named.
|
|
30
|
+
*/
|
|
31
|
+
export function chooseLedgerRemote(names, env = process.env) {
|
|
32
|
+
const named = lifecycleRemoteOverride(env);
|
|
33
|
+
if (named !== undefined) {
|
|
34
|
+
if (names.includes(named))
|
|
35
|
+
return { remote: named };
|
|
36
|
+
const have = names.length === 0 ? "this repository has no remotes" : `this repository's remotes are ${names.join(", ")}`;
|
|
37
|
+
return { failed: true, stderr: `${LIFECYCLE_REMOTE_ENV} names the remote "${named}", and ${have}`, named };
|
|
38
|
+
}
|
|
39
|
+
if (names.length === 0)
|
|
40
|
+
return null;
|
|
41
|
+
return { remote: names.includes("origin") ? "origin" : names[0] };
|
|
42
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { QueryData } from "./query.js";
|
|
2
|
+
/** The version of the `plan-stale` document this chant writes. */
|
|
3
|
+
export declare const PLAN_STALE_CONTRACT_VERSION = 1;
|
|
4
|
+
/** `$id` of the JSON Schema for `chant plan stale --json`. */
|
|
5
|
+
export declare const PLAN_STALE_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/plan-stale/v1/plan-stale.schema.json";
|
|
6
|
+
/** The first chant that answers `chant plan stale` (#4648). */
|
|
7
|
+
export declare const PLAN_STALE_FLOOR = "0.124.63";
|
|
8
|
+
/** Why the read stopped. Closed; each code is in `../workspace/reason-codes.ts`. */
|
|
9
|
+
export declare const PLAN_STALE_ERROR_CODES: readonly ["not-a-git-repository", "ledger-unreadable"];
|
|
10
|
+
/** One gate the plan waits at, and what it covers. */
|
|
11
|
+
export interface PlanStaleTarget {
|
|
12
|
+
member: string | null;
|
|
13
|
+
op: string;
|
|
14
|
+
gate: string;
|
|
15
|
+
/** The environment the plan is for, or null when neither the fact nor its run names one. */
|
|
16
|
+
environment: string | null;
|
|
17
|
+
}
|
|
18
|
+
/** One apply that touched a target after the plan was recorded. */
|
|
19
|
+
export interface PlanStaleApply {
|
|
20
|
+
/** Where it was read: `applies` for an apply under an approval, `deploys` for a deploy record. */
|
|
21
|
+
source: "applies" | "deploys";
|
|
22
|
+
member: string | null;
|
|
23
|
+
/** The op it applied under; null for a deploy record. */
|
|
24
|
+
op: string | null;
|
|
25
|
+
gate: string | null;
|
|
26
|
+
/** The environment; null for an apply under an approval, whose line names none. */
|
|
27
|
+
environment: string | null;
|
|
28
|
+
/** The component a deploy record deployed; null for an apply under an approval. */
|
|
29
|
+
component: string | null;
|
|
30
|
+
/** The plan it applied; null for a deploy record. */
|
|
31
|
+
planDigest: string | null;
|
|
32
|
+
/** When it was recorded. */
|
|
33
|
+
at: string;
|
|
34
|
+
/** Who ran it: a deploy record's `actor`; null for an apply under an approval, which names only its approver. */
|
|
35
|
+
actor: string | null;
|
|
36
|
+
approvedBy: string | null;
|
|
37
|
+
runId: string | null;
|
|
38
|
+
runUrl: string | null;
|
|
39
|
+
gitSha: string | null;
|
|
40
|
+
/** How an apply under an approval ended: `applied`, `failed`, or null while it has no finished line. Null for a deploy record. */
|
|
41
|
+
result: string | null;
|
|
42
|
+
}
|
|
43
|
+
export type PlanStaleDocument = {
|
|
44
|
+
$schema: string;
|
|
45
|
+
contract: number;
|
|
46
|
+
chant: string;
|
|
47
|
+
digest: string;
|
|
48
|
+
/** The plan, or null when no pending gate fact records the digest. */
|
|
49
|
+
plan: {
|
|
50
|
+
recordedAt: string;
|
|
51
|
+
runId: string | null;
|
|
52
|
+
gitSha: string | null;
|
|
53
|
+
targets: PlanStaleTarget[];
|
|
54
|
+
} | null;
|
|
55
|
+
/** Whether any apply touched a target after the plan was recorded; null when there is no plan. */
|
|
56
|
+
stale: boolean | null;
|
|
57
|
+
/** Those applies, oldest first. */
|
|
58
|
+
applies: PlanStaleApply[];
|
|
59
|
+
} | {
|
|
60
|
+
$schema: string;
|
|
61
|
+
contract: number;
|
|
62
|
+
chant: string;
|
|
63
|
+
error: {
|
|
64
|
+
code: (typeof PLAN_STALE_ERROR_CODES)[number];
|
|
65
|
+
message: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/** The document's head: `$schema`, `contract` and `chant`. */
|
|
69
|
+
export declare function planStaleHead(chant: string): {
|
|
70
|
+
$schema: string;
|
|
71
|
+
contract: number;
|
|
72
|
+
chant: string;
|
|
73
|
+
};
|
|
74
|
+
/** Whether `digest`'s plan is stale, read from the rows of the `gates`, `runs`, `applies` and `deploys` tables. */
|
|
75
|
+
export declare function planStaleness(data: Pick<QueryData, "gates" | "runs" | "applies" | "deploys">, digest: string, chant: string): PlanStaleDocument;
|
|
76
|
+
//# sourceMappingURL=plan-stale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|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|
2
|
+
* `chant plan stale <digest> --json` (#4648): whether anything applied to a
|
|
3
|
+
* plan's targets after the plan was recorded, so a platform can ask before it
|
|
4
|
+
* puts the plan in front of a person to approve. chant checks the digest
|
|
5
|
+
* again when the approved run applies; this read answers the same question
|
|
6
|
+
* earlier, and names the applies.
|
|
7
|
+
*
|
|
8
|
+
* The plan is the pending gate facts that record `digest` (`_gates/<op>.jsonl`).
|
|
9
|
+
* It was recorded at the earliest of them. Its targets are each fact's
|
|
10
|
+
* member, op and environment: the fact's own `environment` (a component
|
|
11
|
+
* gate's), else the `env` of the run that reached the gate.
|
|
12
|
+
*
|
|
13
|
+
* An apply touches a target when it was recorded after the plan and:
|
|
14
|
+
*
|
|
15
|
+
* - it is an apply under an approval (`_gates/<op>/applied.jsonl`, the
|
|
16
|
+
* `applies` table) of the same member and op, for another plan; or
|
|
17
|
+
* - it is a deploy record (`<env>/releases.jsonl`, the `deploys` table) of
|
|
18
|
+
* the same member and environment, of any component.
|
|
19
|
+
*
|
|
20
|
+
* An apply of this same plan doesn't make it stale. Neither does anything in
|
|
21
|
+
* another member or environment.
|
|
22
|
+
*
|
|
23
|
+
* Pure over the rows `chant query` loads (`./query.ts` {@link loadQueryData}):
|
|
24
|
+
* the caller reads the ledgers, and this reads no git and writes nothing.
|
|
25
|
+
*/
|
|
26
|
+
import { samePlanDigest } from "./plan-digest.js";
|
|
27
|
+
/** The version of the `plan-stale` document this chant writes. */
|
|
28
|
+
export const PLAN_STALE_CONTRACT_VERSION = 1;
|
|
29
|
+
/** `$id` of the JSON Schema for `chant plan stale --json`. */
|
|
30
|
+
export const PLAN_STALE_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/plan-stale/v1/plan-stale.schema.json";
|
|
31
|
+
/** The first chant that answers `chant plan stale` (#4648). */
|
|
32
|
+
export const PLAN_STALE_FLOOR = "0.124.63";
|
|
33
|
+
/** Why the read stopped. Closed; each code is in `../workspace/reason-codes.ts`. */
|
|
34
|
+
export const PLAN_STALE_ERROR_CODES = ["not-a-git-repository", "ledger-unreadable"];
|
|
35
|
+
const text = (v) => (typeof v === "string" ? v : null);
|
|
36
|
+
const time = (iso) => new Date(iso).getTime();
|
|
37
|
+
/** The document's head: `$schema`, `contract` and `chant`. */
|
|
38
|
+
export function planStaleHead(chant) {
|
|
39
|
+
return { $schema: PLAN_STALE_SCHEMA_ID, contract: PLAN_STALE_CONTRACT_VERSION, chant };
|
|
40
|
+
}
|
|
41
|
+
/** Whether `digest`'s plan is stale, read from the rows of the `gates`, `runs`, `applies` and `deploys` tables. */
|
|
42
|
+
export function planStaleness(data, digest, chant) {
|
|
43
|
+
const head = planStaleHead(chant);
|
|
44
|
+
const facts = data.gates.filter((g) => g.kind === "pending" && samePlanDigest(text(g.plan_digest) ?? undefined, digest) && typeof g.timestamp === "string");
|
|
45
|
+
if (facts.length === 0)
|
|
46
|
+
return { ...head, digest, plan: null, stale: null, applies: [] };
|
|
47
|
+
const first = facts.reduce((a, b) => (time(String(b.timestamp)) < time(String(a.timestamp)) ? b : a));
|
|
48
|
+
const recordedAt = String(first.timestamp);
|
|
49
|
+
const since = time(recordedAt);
|
|
50
|
+
const runEnv = (member, runId) => {
|
|
51
|
+
if (runId === null)
|
|
52
|
+
return null;
|
|
53
|
+
const run = data.runs.find((r) => r.member === member && r.id === runId);
|
|
54
|
+
return run ? text(run.env) : null;
|
|
55
|
+
};
|
|
56
|
+
const targets = [];
|
|
57
|
+
for (const f of facts) {
|
|
58
|
+
const member = text(f.member);
|
|
59
|
+
const target = { member, op: String(f.op), gate: String(f.gate), environment: text(f.environment) ?? runEnv(member, text(f.run_id)) };
|
|
60
|
+
if (!targets.some((t) => t.member === target.member && t.op === target.op && t.gate === target.gate && t.environment === target.environment))
|
|
61
|
+
targets.push(target);
|
|
62
|
+
}
|
|
63
|
+
const applies = [];
|
|
64
|
+
for (const a of data.applies) {
|
|
65
|
+
const at = text(a.timestamp);
|
|
66
|
+
if (at === null || !(time(at) > since))
|
|
67
|
+
continue;
|
|
68
|
+
if (samePlanDigest(text(a.plan_digest) ?? undefined, digest))
|
|
69
|
+
continue;
|
|
70
|
+
if (!targets.some((t) => t.member === text(a.member) && t.op === a.op))
|
|
71
|
+
continue;
|
|
72
|
+
applies.push({
|
|
73
|
+
source: "applies",
|
|
74
|
+
member: text(a.member),
|
|
75
|
+
op: text(a.op),
|
|
76
|
+
gate: text(a.gate),
|
|
77
|
+
environment: null,
|
|
78
|
+
component: null,
|
|
79
|
+
planDigest: text(a.plan_digest),
|
|
80
|
+
at,
|
|
81
|
+
actor: null,
|
|
82
|
+
approvedBy: text(a.approved_by),
|
|
83
|
+
runId: text(a.run_id),
|
|
84
|
+
runUrl: null,
|
|
85
|
+
gitSha: text(a.git_sha),
|
|
86
|
+
result: text(a.result),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
for (const d of data.deploys) {
|
|
90
|
+
const at = text(d.timestamp);
|
|
91
|
+
if (at === null || !(time(at) > since))
|
|
92
|
+
continue;
|
|
93
|
+
if (!targets.some((t) => t.environment !== null && t.member === text(d.member) && t.environment === d.env))
|
|
94
|
+
continue;
|
|
95
|
+
applies.push({
|
|
96
|
+
source: "deploys",
|
|
97
|
+
member: text(d.member),
|
|
98
|
+
op: null,
|
|
99
|
+
gate: null,
|
|
100
|
+
environment: text(d.env),
|
|
101
|
+
component: text(d.component),
|
|
102
|
+
planDigest: null,
|
|
103
|
+
at,
|
|
104
|
+
actor: text(d.actor),
|
|
105
|
+
approvedBy: text(d.approver),
|
|
106
|
+
runId: text(d.run_id),
|
|
107
|
+
runUrl: text(d.run_url),
|
|
108
|
+
gitSha: text(d.git_sha),
|
|
109
|
+
result: null,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
applies.sort((x, y) => time(x.at) - time(y.at));
|
|
113
|
+
return {
|
|
114
|
+
...head,
|
|
115
|
+
digest,
|
|
116
|
+
plan: { recordedAt, runId: text(first.run_id), gitSha: text(first.git_sha), targets },
|
|
117
|
+
stale: applies.length > 0,
|
|
118
|
+
applies,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* (`_authToken=...`, `Authorization: Bearer ...`).
|
|
16
16
|
*/
|
|
17
17
|
/** Environment variables that hold a token in CI or for a registry. Their values are masked in all publish output. */
|
|
18
|
-
export declare const TOKEN_ENV_VARS: readonly ["NODE_AUTH_TOKEN", "NPM_TOKEN", "NPM_ID_TOKEN", "SIGSTORE_ID_TOKEN", "ACTIONS_ID_TOKEN_REQUEST_TOKEN", "ACTIONS_RUNTIME_TOKEN", "GITHUB_TOKEN", "GH_TOKEN", "GITLAB_TOKEN", "CI_JOB_TOKEN", "FORGEJO_TOKEN", "GITEA_TOKEN", "OCI_PASSWORD", "DOCKER_PASSWORD"];
|
|
18
|
+
export declare const TOKEN_ENV_VARS: readonly ["NODE_AUTH_TOKEN", "NPM_TOKEN", "NPM_ID_TOKEN", "SIGSTORE_ID_TOKEN", "ACTIONS_ID_TOKEN_REQUEST_TOKEN", "ACTIONS_RUNTIME_TOKEN", "GITHUB_TOKEN", "GH_TOKEN", "GITLAB_TOKEN", "CI_JOB_TOKEN", "FORGEJO_TOKEN", "GITEA_TOKEN", "OCI_PASSWORD", "DOCKER_PASSWORD", "VSCE_PAT", "OVSX_PAT"];
|
|
19
19
|
/** What a masked value is replaced with. */
|
|
20
20
|
export declare const REDACTED = "[redacted]";
|
|
21
21
|
/** Masks credentials in text a publish prints. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-credentials.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,sHAAsH;AACtH,eAAO,MAAM,cAAc,YACzB,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,gCAAgC,EAChC,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,iBAAiB,
|
|
1
|
+
{"version":3,"file":"publish-credentials.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,sHAAsH;AACtH,eAAO,MAAM,cAAc,YACzB,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,gCAAgC,EAChC,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,UAAU,CACF,CAAC;AAEX,4CAA4C;AAC5C,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,kDAAkD;AAClD,MAAM,WAAW,QAAQ;IACvB,iHAAiH;IACjH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;IAC5C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,UAAe,EAAE,KAAK,GAAE,SAAS,MAAM,EAAO,GAAG,QAAQ,CAkBnG;AAED,6FAA6F;AAC7F,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAC;CACd;AAED,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,IAAI,CAStH"}
|