@intentius/chant 0.124.10 → 0.124.12
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/gate-resume.d.ts +85 -10
- package/dist/cli/handlers/gate-resume.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/gate-resume-run.d.ts +87 -0
- package/dist/gate-resume-run.d.ts.map +1 -0
- package/dist/lifecycle/gate-applied.d.ts +44 -1
- package/dist/lifecycle/gate-applied.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +1 -1
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +30 -14
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/ledger-port.d.ts +18 -0
- package/dist/lifecycle/ledger-port.d.ts.map +1 -0
- package/dist/lifecycle/release-ledger.d.ts +10 -9
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-read.d.ts +23 -0
- package/dist/lifecycle/release-read.d.ts.map +1 -0
- package/dist/lifecycle/wave-plans.d.ts +51 -0
- package/dist/lifecycle/wave-plans.d.ts.map +1 -0
- package/dist/lint/typescript.d.ts +18 -0
- package/dist/lint/typescript.d.ts.map +1 -0
- package/dist/op/activities/activity-contracts.d.ts +4 -4
- package/dist/op/gate-resume-plan.d.ts +113 -0
- package/dist/op/gate-resume-plan.d.ts.map +1 -0
- package/dist/op/gate-resume.d.ts +8 -64
- package/dist/op/gate-resume.d.ts.map +1 -1
- package/dist/op/gate-review.d.ts +1 -20
- package/dist/op/gate-review.d.ts.map +1 -1
- package/dist/op/gate-run-locator.d.ts +1 -1
- package/dist/op/index.d.ts +2 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/point-decision.d.ts +11 -0
- package/dist/point-decision.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cli/handlers/gate-resume.test.ts +140 -2
- package/src/cli/handlers/gate-resume.ts +174 -65
- package/src/cli/main.ts +8 -3
- package/src/codegen/pinned-upgrade.test.ts +8 -1
- package/src/gate-decision-bundle.test.ts +1 -0
- package/src/gate-resume-run-bundle.test.ts +49 -0
- package/src/gate-resume-run.ts +171 -0
- package/src/lifecycle/gate-applied.ts +63 -1
- package/src/lifecycle/gate-ledger.test.ts +7 -1
- package/src/lifecycle/gate-ledger.ts +1 -1
- package/src/lifecycle/git.ts +61 -18
- package/src/lifecycle/ledger-port.ts +17 -0
- package/src/lifecycle/ledger-readers-bundle.test.ts +47 -0
- package/src/lifecycle/ledger-readers.test.ts +139 -0
- package/src/lifecycle/release-ledger.ts +15 -42
- package/src/lifecycle/release-read.ts +69 -0
- package/src/lifecycle/wave-plans.ts +93 -0
- package/src/lint/typescript.ts +18 -0
- package/src/meta/lexicon-typescript-import.test.ts +42 -0
- package/src/op/gate-resume-plan-bundle.test.ts +49 -0
- package/src/op/gate-resume-plan.test.ts +107 -0
- package/src/op/gate-resume-plan.ts +228 -0
- package/src/op/gate-resume.test.ts +18 -0
- package/src/op/gate-resume.ts +16 -150
- package/src/op/gate-review.ts +2 -16
- package/src/op/gate-run-locator.ts +1 -1
- package/src/op/gate.ts +1 -1
- package/src/op/index.ts +2 -0
- package/src/op/op-waves-point-mcp.e2e.test.ts +148 -0
- package/src/op/op-waves-point.test.ts +60 -2
- package/src/op/op-waves-run.ts +6 -10
- package/src/point-decision.ts +19 -2
|
@@ -10,22 +10,58 @@
|
|
|
10
10
|
* question has an answer that passes the gate (`pointGateResumable`, #3835),
|
|
11
11
|
* and `chant workspace points answer --resume` resumes the job right after
|
|
12
12
|
* the answer.
|
|
13
|
+
*
|
|
14
|
+
* What to resume is decided from the ledger by `planGateResumes`
|
|
15
|
+
* (`../../op/gate-resume-plan.ts`, #3858): an approval a wave already applied
|
|
16
|
+
* under is spent and resumes nothing, and an apply under an approval that
|
|
17
|
+
* stopped (an applied line with a run locator and no finished line) resumes
|
|
18
|
+
* once the forge says its run is gone.
|
|
13
19
|
*/
|
|
14
20
|
import { type GateResolutionRecord, type PendingGateRecord } from "../../lifecycle/gate-ledger.js";
|
|
21
|
+
import { type AppliedGateLine, type FinishedGateRecord } from "../../lifecycle/gate-applied.js";
|
|
15
22
|
import { type GateResumeOutcome } from "../../op/gate-resume.js";
|
|
16
|
-
import { type
|
|
23
|
+
import { type GateResumeCandidate, type GateResumeReason } from "../../op/gate-resume-plan.js";
|
|
24
|
+
import type { GateRunLocator } from "../../op/gate-run-locator.js";
|
|
25
|
+
import type { PointQuestionState } from "../../point-decision.js";
|
|
17
26
|
import type { ForgeFetch } from "../../pr-forge.js";
|
|
18
27
|
import type { CommandContext } from "../registry.js";
|
|
19
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* One gate a resume looked at and what it did. With `--json`, `chant run
|
|
30
|
+
* resume` prints these as `{ reports }`; under `--dry-run` it starts nothing,
|
|
31
|
+
* so a product that resumes in its own job reads `resumable` and `reason`
|
|
32
|
+
* (#3858).
|
|
33
|
+
*/
|
|
20
34
|
export interface GateResumeReport {
|
|
21
35
|
op: string;
|
|
22
36
|
gate: string;
|
|
23
37
|
environment?: string;
|
|
24
|
-
/**
|
|
25
|
-
|
|
38
|
+
/** A standing pending fact, or an apply under an approval that stopped (#3858). */
|
|
39
|
+
source: GateResumeCandidate["source"];
|
|
40
|
+
/**
|
|
41
|
+
* What happened. `resumed`, `skipped` and `would-resume` (`--dry-run`) come
|
|
42
|
+
* from the forge; the rest are decided before any call.
|
|
43
|
+
*/
|
|
44
|
+
status: GateResumeOutcome["status"] | "not-approved" | "spent" | "no-job" | "no-token" | "failed";
|
|
45
|
+
/** Why, from the ledger: `approved`, `answered`, `not-approved`, `spent` or `stopped`. */
|
|
46
|
+
reason: GateResumeReason;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the gate's job should start again: an approval or a passing
|
|
49
|
+
* answer stands and is not spent, or an apply stopped and the run that
|
|
50
|
+
* applied is gone. A product that applies in its own job acts on these.
|
|
51
|
+
*/
|
|
52
|
+
resumable: boolean;
|
|
26
53
|
message: string;
|
|
54
|
+
planDigest?: string;
|
|
27
55
|
approvedBy?: string;
|
|
56
|
+
approvedAt?: string;
|
|
28
57
|
url?: string;
|
|
58
|
+
/** The job a resume starts again. */
|
|
59
|
+
run?: GateRunLocator;
|
|
60
|
+
spent?: GateResumeCandidate["spent"];
|
|
61
|
+
/** `runGone` is what the forge said about the run that applied; absent when it was not asked. */
|
|
62
|
+
stopped?: GateResumeCandidate["stopped"] & {
|
|
63
|
+
runGone?: boolean;
|
|
64
|
+
};
|
|
29
65
|
}
|
|
30
66
|
export interface ResumeGateOptions {
|
|
31
67
|
env?: Record<string, string | undefined>;
|
|
@@ -38,12 +74,30 @@ export interface ResumeGateOptions {
|
|
|
38
74
|
* when a fact needs them and none are given.
|
|
39
75
|
*/
|
|
40
76
|
questions?: ReadonlyMap<string, PointQuestionState>;
|
|
77
|
+
/** The lines of `_gates/<op>/applied.jsonl` (#3858). Read from `chant/lifecycle` by {@link resumeOpGates} when not given. */
|
|
78
|
+
applied?: readonly AppliedGateLine[];
|
|
79
|
+
finished?: readonly FinishedGateRecord[];
|
|
41
80
|
}
|
|
42
81
|
/** Every question the workspace at `cwd` lists, by id, the lifecycle ledger's included. Empty when the workspace can't be read. */
|
|
43
82
|
export declare function workspaceQuestions(cwd: string): Promise<Map<string, PointQuestionState>>;
|
|
44
|
-
/** Resume the job behind one standing pending fact, when an approval answers it. */
|
|
83
|
+
/** Resume the job behind one standing pending fact, when an approval answers it and is not spent. */
|
|
45
84
|
export declare function resumeStanding(standing: PendingGateRecord, resolutions: readonly GateResolutionRecord[], opts?: ResumeGateOptions, pending?: readonly PendingGateRecord[]): Promise<GateResumeReport>;
|
|
46
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Act on one candidate {@link planGateResumes} decided: start its job again
|
|
87
|
+
* through the forge, or under `dryRun` ask the forge whether it would. A
|
|
88
|
+
* stopped apply is resumed only once the forge says its run is gone.
|
|
89
|
+
*/
|
|
90
|
+
export declare function resumeCandidate(c: GateResumeCandidate, opts?: ResumeGateOptions): Promise<GateResumeReport>;
|
|
91
|
+
/** The `applied` and `finished` lines of `_gates/<op>/applied.jsonl` on `chant/lifecycle`. */
|
|
92
|
+
export declare function readAppliedGateFile(op: string): Promise<{
|
|
93
|
+
applied: AppliedGateLine[];
|
|
94
|
+
finished: FinishedGateRecord[];
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* Resume every job waiting on `op`'s gates (or one gate) whose approval
|
|
98
|
+
* arrived and is not spent, and every apply under an approval that stopped
|
|
99
|
+
* once its run is gone (#3858).
|
|
100
|
+
*/
|
|
47
101
|
export declare function resumeOpGates(op: string, gate: string | undefined, opts?: ResumeGateOptions): Promise<GateResumeReport[]>;
|
|
48
102
|
/**
|
|
49
103
|
* What `chant approve --resume` runs once the approval is recorded and
|
|
@@ -65,11 +119,32 @@ export declare function resumeAfterAnswer(question: {
|
|
|
65
119
|
subject: string | null;
|
|
66
120
|
ledger: string | null;
|
|
67
121
|
}, cwd?: string): Promise<number>;
|
|
122
|
+
/** What {@link resumeWaitingGates} reads. */
|
|
123
|
+
export interface ResumeWaitingOptions extends ResumeGateOptions {
|
|
124
|
+
/** One op's gate ledger; absent, every gate ledger on `chant/lifecycle`. */
|
|
125
|
+
op?: string;
|
|
126
|
+
/** Only this gate's waiting job (#3854); absent, every gate's. */
|
|
127
|
+
gate?: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* What `chant run resume` does, callable in process: read the gate ledgers
|
|
131
|
+
* (`op`'s alone, when given) and start again each CI job that waits at a
|
|
132
|
+
* gate an approval now answers. With `gate`, only that gate's job is touched,
|
|
133
|
+
* so a caller that just approved one wave resumes that wave's job and no
|
|
134
|
+
* other (#3854). The lifecycle ledger has to be readable
|
|
135
|
+
* (`requireLifecycleLedger`).
|
|
136
|
+
*/
|
|
137
|
+
export declare function resumeWaitingGates(opts?: ResumeWaitingOptions): Promise<GateResumeReport[]>;
|
|
68
138
|
/**
|
|
69
|
-
* `chant run resume [--op <op>] [--dry-run] [--json]`: the
|
|
70
|
-
* Reads every gate ledger on `chant/lifecycle` (or `--op`'s),
|
|
71
|
-
* again each CI job that waits at a gate
|
|
72
|
-
* gate whose decision point now has an
|
|
139
|
+
* `chant run resume [--op <op>] [--gate <gate>] [--dry-run] [--json]`: the
|
|
140
|
+
* scheduled job. Reads every gate ledger on `chant/lifecycle` (or `--op`'s),
|
|
141
|
+
* and starts again each CI job that waits at a gate (or at `--gate` alone)
|
|
142
|
+
* an approval now answers, or at a gate whose decision point now has an
|
|
143
|
+
* answer that passes it (#3835), unless a wave already applied under that
|
|
144
|
+
* approval (#3858). It also starts again the run of an apply under an
|
|
145
|
+
* approval that stopped, once that run is gone. `--dry-run --json` starts
|
|
146
|
+
* nothing and says, per gate, whether it would resume and why, for a product
|
|
147
|
+
* that resumes in its own job.
|
|
73
148
|
*/
|
|
74
149
|
export declare function runResumeCommand(ctx: CommandContext): Promise<number>;
|
|
75
150
|
//# sourceMappingURL=gate-resume.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-resume.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/gate-resume.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gate-resume.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/gate-resume.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAyC,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGpI,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAmB,KAAK,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC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I;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CA2B7J;AAED,6CAA6C;AAC7C,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,4EAA4E;IAC5E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,GAAE,oBAAyB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAMrG;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB3E"}
|
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AA2G9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA4rBpD;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AA2G9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA4rBpD;AAm8BD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBzE;AAID;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,UAAU,EA2KvC,CAAC;AAqLF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5E"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resume the job that waits at a gate (#3683), bundle-safe (#3854).
|
|
3
|
+
*
|
|
4
|
+
* A CI job that reaches a gate nobody approved records a pending fact on
|
|
5
|
+
* `chant/lifecycle` and exits 3. Nothing re-runs it when the approval lands,
|
|
6
|
+
* because a push to the ledger branch starts no pipeline. This module closes
|
|
7
|
+
* that loop through the forge's API.
|
|
8
|
+
*
|
|
9
|
+
* When the job runs in CI, the pending fact it records carries a
|
|
10
|
+
* {@link GateRunLocator}, read from the job's environment by
|
|
11
|
+
* {@link resolveGateRunLocator}: which forge, the API base, the repository,
|
|
12
|
+
* the run, and what the forge needs to start it again. After an approval,
|
|
13
|
+
* {@link resumeGateRun} starts it again:
|
|
14
|
+
*
|
|
15
|
+
* | Forge | Call | Token |
|
|
16
|
+
* |---|---|---|
|
|
17
|
+
* | GitHub | `POST /repos/{repo}/actions/runs/{run}/rerun-failed-jobs` | `actions: write` (the job's `GITHUB_TOKEN` with that permission, or a fine-grained token with Actions read and write) |
|
|
18
|
+
* | GitLab | `POST /projects/{id}/jobs/{job}/retry` | a project or personal access token with the `api` scope and the Developer role; `CI_JOB_TOKEN` cannot retry jobs |
|
|
19
|
+
* | Forgejo | `POST /repos/{repo}/actions/workflows/{file}/dispatches` on the run's branch | a token with the `write:repository` scope; Forgejo has no API to re-run a run, so it starts a new run of the workflow |
|
|
20
|
+
*
|
|
21
|
+
* GitHub re-runs the failed job and the jobs that need it, at the same
|
|
22
|
+
* commit. GitLab retries the job, and the jobs it skipped run after it. A
|
|
23
|
+
* Forgejo dispatch runs the whole workflow again at the branch's head, so the
|
|
24
|
+
* jobs before the gate run again too; they must be safe to repeat (a wave
|
|
25
|
+
* whose runs already applied plans nothing and applies nothing new).
|
|
26
|
+
*
|
|
27
|
+
* Resuming approves nothing. The resumed job decides the gate again from the
|
|
28
|
+
* ledger, so resuming a run whose approval does not count only makes it wait
|
|
29
|
+
* again. {@link resumeGateRun} skips a run that is still going, that ended
|
|
30
|
+
* well, or that was already resumed (a later GitHub attempt, a newer GitLab
|
|
31
|
+
* job of the same name, a newer Forgejo run of the workflow), so a scheduled
|
|
32
|
+
* resume job can call it every few minutes without starting a run twice.
|
|
33
|
+
*
|
|
34
|
+
* This module imports no workspace, ledger, schema or git code, so a product
|
|
35
|
+
* that ships one bundled file (terragucci) can import it as
|
|
36
|
+
* `@intentius/chant/gate-resume-run` and resume a job in process. Which
|
|
37
|
+
* approval answers a pending fact is `./op/gate-resume.ts`'s
|
|
38
|
+
* `resolutionAnswering`, which reads the gate's quorum rules and does pull the
|
|
39
|
+
* workspace in; that module re-exports everything here.
|
|
40
|
+
*/
|
|
41
|
+
import { type ForgeFetch, type ForgeKind } from "./pr-forge.js";
|
|
42
|
+
import type { GateRunLocator } from "./op/gate-run-locator.js";
|
|
43
|
+
export { isGateRunLocator, resolveGateRunLocator, type GateRunLocator } from "./op/gate-run-locator.js";
|
|
44
|
+
/** What {@link resumeGateRun} did. */
|
|
45
|
+
export type GateResumeOutcome = {
|
|
46
|
+
status: "resumed";
|
|
47
|
+
forge: ForgeKind;
|
|
48
|
+
how: string;
|
|
49
|
+
url?: string;
|
|
50
|
+
} | {
|
|
51
|
+
status: "skipped";
|
|
52
|
+
forge: ForgeKind;
|
|
53
|
+
reason: string;
|
|
54
|
+
url?: string;
|
|
55
|
+
}
|
|
56
|
+
/** Under `dryRun` (#3858): the run is gone and would be started again; nothing was started. */
|
|
57
|
+
| {
|
|
58
|
+
status: "would-resume";
|
|
59
|
+
forge: ForgeKind;
|
|
60
|
+
how: string;
|
|
61
|
+
url?: string;
|
|
62
|
+
};
|
|
63
|
+
export interface ResumeGateRunOptions {
|
|
64
|
+
token: string;
|
|
65
|
+
/** The approval's time. A Forgejo run of the workflow created after it means the run was already resumed. */
|
|
66
|
+
since?: string;
|
|
67
|
+
fetch?: ForgeFetch;
|
|
68
|
+
/**
|
|
69
|
+
* Read the run as a resume would, and start nothing (#3858): say
|
|
70
|
+
* `would-resume` where it would start it. The calls are reads, so a token
|
|
71
|
+
* with read access to the forge's runs is enough.
|
|
72
|
+
*/
|
|
73
|
+
dryRun?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Start the job a pending fact's locator names again, or say why not. Throws
|
|
77
|
+
* {@link ForgeApiError} when the forge refuses a call, such as a token
|
|
78
|
+
* without the access the table in the module doc lists.
|
|
79
|
+
*/
|
|
80
|
+
export declare function resumeGateRun(loc: GateRunLocator, opts: ResumeGateRunOptions): Promise<GateResumeOutcome>;
|
|
81
|
+
/**
|
|
82
|
+
* The token a resume uses: `CHANT_FORGE_TOKEN`, else the forge's own
|
|
83
|
+
* (`GITHUB_TOKEN` or `GH_TOKEN` on GitHub and Forgejo, `GITLAB_TOKEN` on
|
|
84
|
+
* GitLab), the same order the pull-request loop reads (`../pr-forge.ts`).
|
|
85
|
+
*/
|
|
86
|
+
export declare function resumeTokenFromEnv(forge: ForgeKind, env?: Record<string, string | undefined>): string | undefined;
|
|
87
|
+
//# sourceMappingURL=gate-resume-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate-resume-run.d.ts","sourceRoot":"","sources":["../src/gate-resume-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAiB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAErG,sCAAsC;AACtC,MAAM,MAAM,iBAAiB,GACzB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAClE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE;AACvE,+FAA+F;GAC7F;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5E,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,6GAA6G;IAC7G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAyBD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAkE/G;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,MAAM,GAAG,SAAS,CAG9H"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* Pure: no git, no clock, no file. It bundles into `@intentius/chant/gate-decision`.
|
|
18
18
|
*/
|
|
19
19
|
import type { GateAuditApply } from "./gate-audit.js";
|
|
20
|
+
import type { GateRunLocator } from "../op/gate-run-locator.js";
|
|
20
21
|
/** One approval a wave applied under: the approval of `planDigest` made at `approvedAt` was used. */
|
|
21
22
|
export interface AppliedGateRecord {
|
|
22
23
|
version: 1;
|
|
@@ -41,6 +42,37 @@ export interface AppliedGateRecord {
|
|
|
41
42
|
};
|
|
42
43
|
runId?: string;
|
|
43
44
|
commit?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Where the run applying runs (#3858), as a pending fact's `resume` names
|
|
47
|
+
* it. A line that carries one and has no {@link FinishedGateRecord} is an
|
|
48
|
+
* apply that may have stopped: `chant run resume` starts that run again
|
|
49
|
+
* once it is gone, and the wave applies the rest under the same approval.
|
|
50
|
+
*/
|
|
51
|
+
resume?: GateRunLocator;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A line of `applied.jsonl` that a wave applying under an approval writes
|
|
55
|
+
* (#3858): chant's own `applied` line, or a product's `changes` line beside
|
|
56
|
+
* it (terragucci's, which names the changes the approved plans make). Both
|
|
57
|
+
* name the approval the apply ran under.
|
|
58
|
+
*/
|
|
59
|
+
export type AppliedGateLine = Omit<AppliedGateRecord, "kind"> & {
|
|
60
|
+
kind: "applied" | "changes";
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* How the apply an applied line names ended, in the same file (#3858). A
|
|
64
|
+
* product writes it when the apply finishes; an apply that was killed writes
|
|
65
|
+
* none. `applied` is that line's `timestamp`.
|
|
66
|
+
*/
|
|
67
|
+
export interface FinishedGateRecord {
|
|
68
|
+
version: 1;
|
|
69
|
+
kind: "finished";
|
|
70
|
+
op: string;
|
|
71
|
+
gate: string;
|
|
72
|
+
planDigest: string;
|
|
73
|
+
applied: string;
|
|
74
|
+
result: "applied" | "failed";
|
|
75
|
+
timestamp: string;
|
|
44
76
|
}
|
|
45
77
|
/** Where the applied lines of `op` live on `chant/lifecycle`: the directory and the file, as `writeBlobToPath` takes them. */
|
|
46
78
|
export declare function appliedGatePath(op: string): {
|
|
@@ -49,6 +81,17 @@ export declare function appliedGatePath(op: string): {
|
|
|
49
81
|
};
|
|
50
82
|
/** The applied lines of an `applied.jsonl` file, oldest first. A line that is not one is skipped. */
|
|
51
83
|
export declare function parseAppliedGateLines(text: string): AppliedGateRecord[];
|
|
84
|
+
/**
|
|
85
|
+
* Every line of an `applied.jsonl` file a resume reads (#3858): the
|
|
86
|
+
* `applied` and `changes` lines, and the `finished` lines that say how an
|
|
87
|
+
* apply ended. Oldest first; a line that is none of them is skipped.
|
|
88
|
+
*/
|
|
89
|
+
export declare function parseAppliedGateFile(text: string): {
|
|
90
|
+
applied: AppliedGateLine[];
|
|
91
|
+
finished: FinishedGateRecord[];
|
|
92
|
+
};
|
|
93
|
+
/** The finished line for the apply `line` names, or undefined while it has none. */
|
|
94
|
+
export declare function finishedApply(finished: readonly FinishedGateRecord[], line: Pick<AppliedGateLine, "gate" | "planDigest" | "timestamp">): FinishedGateRecord | undefined;
|
|
52
95
|
/**
|
|
53
96
|
* Whether an approval is spent: a wave applied under an approval of the same
|
|
54
97
|
* gate and digest made at or after it. One that names no digest is never
|
|
@@ -57,7 +100,7 @@ export declare function parseAppliedGateLines(text: string): AppliedGateRecord[]
|
|
|
57
100
|
* head, so the review cannot be recorded again to pass the digest twice. A
|
|
58
101
|
* review not yet recorded has no `timestamp`.
|
|
59
102
|
*/
|
|
60
|
-
export declare function isApprovalSpent(applied: readonly AppliedGateRecord[], approval: {
|
|
103
|
+
export declare function isApprovalSpent(applied: readonly Pick<AppliedGateRecord, "gate" | "planDigest" | "approvedAt" | "review">[], approval: {
|
|
61
104
|
gate: string;
|
|
62
105
|
planDigest?: string;
|
|
63
106
|
timestamp?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-applied.d.ts","sourceRoot":"","sources":["../../src/lifecycle/gate-applied.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"gate-applied.d.ts","sourceRoot":"","sources":["../../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|
2
2
|
import type { GateApprover, GatePolicyDecision, ResolvedGateApproval } from "../op/gate-approval.js";
|
|
3
|
-
import type { GateRunLocator } from "../op/gate-
|
|
3
|
+
import type { GateRunLocator } from "../op/gate-run-locator.js";
|
|
4
4
|
export { DEFAULT_GATE_EXPIRY, isApprovalUrl, resolveApprovalUrl } from "./gate-pending.js";
|
|
5
5
|
export { isPendingGateExpired, latestPendingGate, latestResolutionForPlan, latestResolutionSince, type PlanBoundResolution, } from "./gate-ledger-select.js";
|
|
6
6
|
/** The directory on the `chant/lifecycle` branch that holds gate ledgers, under a member's prefix when it has one. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/gate-ledger.ts"],"names":[],"mappings":"AA6CA,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"gate-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/gate-ledger.ts"],"names":[],"mappings":"AA6CA,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGxF,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAI9B,sHAAsH;AACtH,eAAO,MAAM,SAAS,WAAM,CAAC;AAI7B;;;;;;GAMG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EAAE,MAAM,EACV,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC;IAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAGjE"}
|
package/dist/lifecycle/git.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LedgerReadPort } from "./ledger-port.js";
|
|
1
2
|
/**
|
|
2
3
|
* The branch path of `dir` for the project at `cwd` (#2538): `dir` itself at
|
|
3
4
|
* level 0 and for the root member `.`, `_members/<member>/<dir>` for any
|
|
@@ -6,9 +7,19 @@
|
|
|
6
7
|
* build records) goes through here, so none of them names the prefix itself.
|
|
7
8
|
* See ./member-ledger.ts for who counts as a member.
|
|
8
9
|
*/
|
|
9
|
-
export declare function ledgerDir(dir: string, opts?:
|
|
10
|
+
export declare function ledgerDir(dir: string, opts?: LedgerLocation): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Where to read, when the caller is not standing in the member it reads
|
|
13
|
+
* (#3865): a reader such as behold's lists many members from one checkout. Both
|
|
14
|
+
* fields override what `cwd` resolves to; `ledgerPrefix` wins over `member`.
|
|
15
|
+
*/
|
|
16
|
+
export interface LedgerLocation {
|
|
10
17
|
cwd?: string;
|
|
11
|
-
|
|
18
|
+
/** A member's name, or its path of names in a nested workspace, outermost first. `"."` and `[]` name the flat layout. */
|
|
19
|
+
member?: string | readonly string[];
|
|
20
|
+
/** The prefix `resolveMemberLedger` returns: `""`, or `_members/<member>/` per level. */
|
|
21
|
+
ledgerPrefix?: string;
|
|
22
|
+
}
|
|
12
23
|
/**
|
|
13
24
|
* Write a blob to an arbitrary `<environment>/<filename>` path on the orphan
|
|
14
25
|
* branch, preserving every other env/file entry already on the branch.
|
|
@@ -73,9 +84,7 @@ export declare function writeLedgerFiles(files: LedgerFileWrite[], commitMessage
|
|
|
73
84
|
* `writeBlobToPath` is — ./build-ledger-store.ts (#609) reads manifests back
|
|
74
85
|
* from the `_builds` namespace through this identical helper.
|
|
75
86
|
*/
|
|
76
|
-
export declare function readBlobFromPath(environment: string, filename: string, opts?:
|
|
77
|
-
cwd?: string;
|
|
78
|
-
}): Promise<string | null>;
|
|
87
|
+
export declare function readBlobFromPath(environment: string, filename: string, opts?: LedgerLocation): Promise<string | null>;
|
|
79
88
|
/**
|
|
80
89
|
* Read the blob SHA stored at `<environment>/<filename>` on the orphan branch,
|
|
81
90
|
* or `null` if absent. Sibling of `readBlobFromPath` returning the
|
|
@@ -160,18 +169,20 @@ export declare function appendReleaseRecordLine(environment: string, recordJson:
|
|
|
160
169
|
* is a normal, expected state). ../release-ledger.ts's `readReleaseLedger`
|
|
161
170
|
* parses/validates these lines into typed `ReleaseRecord`s.
|
|
162
171
|
*/
|
|
163
|
-
export declare function readReleaseLedgerLines(environment: string, opts?:
|
|
164
|
-
cwd?: string;
|
|
165
|
-
}): Promise<string[]>;
|
|
172
|
+
export declare function readReleaseLedgerLines(environment: string, opts?: LedgerLocation): Promise<string[]>;
|
|
166
173
|
/**
|
|
167
174
|
* List every environment that has a release ledger on the orphan branch —
|
|
168
175
|
* the root-level directories under `chant/lifecycle` that carry a
|
|
169
176
|
* `releases.jsonl` entry. Used by `chant components status` (no env arg) to
|
|
170
177
|
* discover which environments to report on.
|
|
171
178
|
*/
|
|
172
|
-
export declare function listLedgerEnvironments(opts?:
|
|
173
|
-
|
|
174
|
-
|
|
179
|
+
export declare function listLedgerEnvironments(opts?: LedgerLocation): Promise<string[]>;
|
|
180
|
+
/**
|
|
181
|
+
* The directories directly under the ledger's base: the root for the flat
|
|
182
|
+
* layout, `_members/<member>/` for a member. `[]` when the branch, or the
|
|
183
|
+
* base, is absent.
|
|
184
|
+
*/
|
|
185
|
+
export declare function listLedgerTrees(opts?: LedgerLocation): Promise<string[]>;
|
|
175
186
|
/**
|
|
176
187
|
* List every filename directly under `<dir>/` on the orphan branch (no
|
|
177
188
|
* recursion), or `[]` when the branch/directory doesn't exist yet. Generic
|
|
@@ -180,9 +191,7 @@ export declare function listLedgerEnvironments(opts?: {
|
|
|
180
191
|
* manifest (`_builds/<digest>.json`) without duplicating this `git ls-tree
|
|
181
192
|
* --name-only` call.
|
|
182
193
|
*/
|
|
183
|
-
export declare function listFilesInDir(dir: string, opts?:
|
|
184
|
-
cwd?: string;
|
|
185
|
-
}): Promise<string[]>;
|
|
194
|
+
export declare function listFilesInDir(dir: string, opts?: LedgerLocation): Promise<string[]>;
|
|
186
195
|
/**
|
|
187
196
|
* Read all snapshots for an environment (all lexicons).
|
|
188
197
|
*/
|
|
@@ -569,4 +578,11 @@ export declare function fetchRef(ref: string, opts?: {
|
|
|
569
578
|
export declare function getHeadCommit(opts?: {
|
|
570
579
|
cwd?: string;
|
|
571
580
|
}): Promise<string>;
|
|
581
|
+
/**
|
|
582
|
+
* The branch's read side as a {@link LedgerReadPort} for the member `opts`
|
|
583
|
+
* names (#3865): what the bundle-safe readers (`./release-read.ts`,
|
|
584
|
+
* `./wave-plans.ts`) are handed. A product with its own way to read the
|
|
585
|
+
* branch passes its own port instead and never loads this module.
|
|
586
|
+
*/
|
|
587
|
+
export declare function gitLedgerReadPort(opts?: LedgerLocation): LedgerReadPort;
|
|
572
588
|
//# sourceMappingURL=git.d.ts.map
|
|
@@ -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":"AASA,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,EAA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
+
* (#3865). Paths are relative to one project's ledger: the flat root, or a
|
|
4
|
+
* workspace member's `_members/<member>/`. Which of those a port reads is the
|
|
5
|
+
* port's business; `gitLedgerReadPort` (`./git.ts`) takes a member or a
|
|
6
|
+
* prefix, and a product that reads the branch its own way supplies its own.
|
|
7
|
+
*
|
|
8
|
+
* Types only, so a bundle that imports a reader loads no git code.
|
|
9
|
+
*/
|
|
10
|
+
export interface LedgerReadPort {
|
|
11
|
+
/** The file at `<dir>/<file>`, or null when the branch, the directory or the file is absent. */
|
|
12
|
+
read(dir: string, file: string): Promise<string | null>;
|
|
13
|
+
/** The names directly under `<dir>/`, or `[]` when absent. */
|
|
14
|
+
list(dir: string): Promise<string[]>;
|
|
15
|
+
/** The directories directly under the ledger's root: every environment, and `_gates`, `_wave-plans` and the rest. */
|
|
16
|
+
trees(): Promise<string[]>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ledger-port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-port.d.ts","sourceRoot":"","sources":["../../src/lifecycle/ledger-port.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,gGAAgG;IAChG,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxD,8DAA8D;IAC9D,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACrC,qHAAqH;IACrH,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC5B"}
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
* CI logs.
|
|
29
29
|
*/
|
|
30
30
|
import { type LegacyDigestFlag } from "./legacy-digest.js";
|
|
31
|
+
import { type LedgerLocation } from "./git.js";
|
|
32
|
+
export { validateReleaseRecord, parseReleaseLedger, releaseLedgerLines, readReleaseRecords, listReleaseEnvironmentsOn } from "./release-read.js";
|
|
33
|
+
export type { LedgerReadPort } from "./ledger-port.js";
|
|
31
34
|
/**
|
|
32
35
|
* The id space a `ReleaseRecord.runId` lives in, and how to reach the run
|
|
33
36
|
* (#2045).
|
|
@@ -170,8 +173,6 @@ export declare class InvalidReleaseRecordError extends Error {
|
|
|
170
173
|
readonly missing: string[];
|
|
171
174
|
constructor(missing: string[]);
|
|
172
175
|
}
|
|
173
|
-
/** Validate that a release record carries every required field as a non-empty string. */
|
|
174
|
-
export declare function validateReleaseRecord(record: Partial<ReleaseRecord>): string[];
|
|
175
176
|
/** Input a caller supplies to record one deploy — `version` is filled in, everything else is required (see `ReleaseRecord`). */
|
|
176
177
|
export type ReleaseRecordInput = Omit<ReleaseRecord, "version" | "flags">;
|
|
177
178
|
/**
|
|
@@ -221,16 +222,16 @@ export declare function appendReleaseRecord(input: ReleaseRecordInput, opts?: {
|
|
|
221
222
|
* a status query should degrade gracefully rather than fail outright on one
|
|
222
223
|
* bad line — but each skip is reported so callers/tests can surface it.
|
|
223
224
|
*/
|
|
224
|
-
export declare function readReleaseLedger(environment: string, opts?: {
|
|
225
|
-
cwd?: string;
|
|
226
|
-
}): Promise<{
|
|
225
|
+
export declare function readReleaseLedger(environment: string, opts?: LedgerLocation): Promise<{
|
|
227
226
|
records: ReleaseRecord[];
|
|
228
227
|
malformed: number;
|
|
229
228
|
}>;
|
|
230
|
-
/**
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
/**
|
|
230
|
+
* List every environment that has release records on the orphan branch. With
|
|
231
|
+
* `member` or `ledgerPrefix` (#3865) it lists that workspace member's, from
|
|
232
|
+
* wherever `cwd` is; without either, the member `cwd` resolves to.
|
|
233
|
+
*/
|
|
234
|
+
export declare function listReleaseEnvironments(opts?: LedgerLocation): Promise<string[]>;
|
|
234
235
|
/**
|
|
235
236
|
* The latest release record per component in `records` — "what we recorded
|
|
236
237
|
* deploying" reduces to one row per component by taking the most recent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"release-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAyC,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAwG,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAIlJ,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC9I,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;OAMG;IACH,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC;IAC5C,gHAAgH;IAChH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,4FAA4F;IAC5F,OAAO,EAAE,CAAC,CAAC;IACX,6FAA6F;IAC7F,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD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AE,GACtB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC,CASpD;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAS1D;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEtF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CASvF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,CAE1F"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { LedgerReadPort } from "./ledger-port.js";
|
|
2
|
+
import type { ReleaseRecord } from "./release-ledger.js";
|
|
3
|
+
/** The required fields a release record lacks as non-empty strings. */
|
|
4
|
+
export declare function validateReleaseRecord(record: Partial<ReleaseRecord>): string[];
|
|
5
|
+
/** The lines of a `releases.jsonl` file: trimmed, blanks dropped. */
|
|
6
|
+
export declare function releaseLedgerLines(text: string | null): string[];
|
|
7
|
+
/**
|
|
8
|
+
* Parse release ledger lines, oldest first. A malformed line is counted and
|
|
9
|
+
* skipped; a digest recorded by the old 32-bit hash reads back flagged
|
|
10
|
+
* (#2514), never re-keyed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseReleaseLedger(lines: readonly string[]): {
|
|
13
|
+
records: ReleaseRecord[];
|
|
14
|
+
malformed: number;
|
|
15
|
+
};
|
|
16
|
+
/** Every release record of `environment` the port holds, oldest first. */
|
|
17
|
+
export declare function readReleaseRecords(port: LedgerReadPort, environment: string): Promise<{
|
|
18
|
+
records: ReleaseRecord[];
|
|
19
|
+
malformed: number;
|
|
20
|
+
}>;
|
|
21
|
+
/** The environments with a `releases.jsonl`, sorted: the port's root directories that hold one. */
|
|
22
|
+
export declare function listReleaseEnvironmentsOn(port: LedgerReadPort): Promise<string[]>;
|
|
23
|
+
//# sourceMappingURL=release-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-read.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-read.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,uEAAuE;AACvE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,MAAM,EAAE,CAO9E;AAED,qEAAqE;AACrE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,EAAE,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAgB5G;AAED,0EAA0E;AAC1E,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAE5I;AAED,mGAAmG;AACnG,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAMvF"}
|