@intentius/chant 0.106.4 → 0.108.0
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/commands/check-lexicon.d.ts +7 -0
- package/dist/cli/commands/check-lexicon.d.ts.map +1 -1
- package/dist/cli/handlers/generate.d.ts +17 -0
- package/dist/cli/handlers/generate.d.ts.map +1 -0
- package/dist/cli/handlers/operator.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/plugins.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +6 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/codegen/json-schema-to-ts.d.ts +61 -0
- package/dist/codegen/json-schema-to-ts.d.ts.map +1 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/lexicon.d.ts +13 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +29 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/op/activities/apply.d.ts +40 -6
- package/dist/op/activities/apply.d.ts.map +1 -1
- package/dist/op/builders.d.ts +7 -0
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/op/composites/apply-op.d.ts +21 -3
- package/dist/op/composites/apply-op.d.ts.map +1 -1
- package/dist/op/gate-approval.d.ts +10 -2
- package/dist/op/gate-approval.d.ts.map +1 -1
- package/dist/op/gate-plan-context.d.ts +101 -0
- package/dist/op/gate-plan-context.d.ts.map +1 -0
- package/dist/op/gate-point-run.d.ts +110 -0
- package/dist/op/gate-point-run.d.ts.map +1 -0
- package/dist/op/gate-point.d.ts +70 -0
- package/dist/op/gate-point.d.ts.map +1 -0
- package/dist/op/gate.d.ts +12 -1
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/index.d.ts +6 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/local-executor.d.ts +11 -3
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/op-ir.d.ts +2 -0
- package/dist/op/op-ir.d.ts.map +1 -1
- package/dist/op/types.d.ts +11 -0
- package/dist/op/types.d.ts.map +1 -1
- package/dist/project-codegen.d.ts +145 -0
- package/dist/project-codegen.d.ts.map +1 -0
- package/dist/workspace/ci-green-cli.d.ts +16 -0
- package/dist/workspace/ci-green-cli.d.ts.map +1 -0
- package/dist/workspace/ci-green-forge.d.ts +54 -0
- package/dist/workspace/ci-green-forge.d.ts.map +1 -0
- package/dist/workspace/ci-green-workflow.d.ts +82 -0
- package/dist/workspace/ci-green-workflow.d.ts.map +1 -0
- package/dist/workspace/ci-green.d.ts +185 -0
- package/dist/workspace/ci-green.d.ts.map +1 -0
- package/dist/workspace/declaration.d.ts +31 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.schema.json +102 -0
- package/dist/workspace/ls.d.ts +15 -0
- package/dist/workspace/ls.d.ts.map +1 -1
- package/dist/workspace/reason-codes.d.ts +2 -0
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/status-gates.d.ts +15 -1
- package/dist/workspace/status-gates.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/check-lexicon.test.ts +21 -5
- package/src/cli/commands/check-lexicon.ts +14 -3
- package/src/cli/handlers/generate.ts +90 -0
- package/src/cli/handlers/operator.ts +9 -0
- package/src/cli/main.ts +39 -0
- package/src/cli/plugins.ts +16 -2
- package/src/cli/registry.ts +6 -0
- package/src/codegen/json-schema-to-ts.test.ts +256 -0
- package/src/codegen/json-schema-to-ts.ts +373 -0
- package/src/config.ts +16 -0
- package/src/lexicon.ts +20 -0
- package/src/lifecycle/gate-ledger.ts +30 -0
- package/src/op/activities/apply.test.ts +43 -0
- package/src/op/activities/apply.ts +111 -6
- package/src/op/builders.ts +13 -1
- package/src/op/composites/apply-op.ts +24 -4
- package/src/op/gate-approval.ts +18 -2
- package/src/op/gate-plan-context.test.ts +186 -0
- package/src/op/gate-plan-context.ts +229 -0
- package/src/op/gate-point-run.ts +207 -0
- package/src/op/gate-point.e2e.test.ts +166 -0
- package/src/op/gate-point.test.ts +235 -0
- package/src/op/gate-point.ts +119 -0
- package/src/op/gate.ts +26 -1
- package/src/op/index.ts +8 -0
- package/src/op/local-executor.ts +96 -3
- package/src/op/op-ir.ts +4 -0
- package/src/op/types.ts +11 -0
- package/src/project-codegen.test.ts +208 -0
- package/src/project-codegen.ts +296 -0
- package/src/workspace/ci-green-cli.ts +101 -0
- package/src/workspace/ci-green-forge.test.ts +66 -0
- package/src/workspace/ci-green-forge.ts +111 -0
- package/src/workspace/ci-green-workflow.test.ts +198 -0
- package/src/workspace/ci-green-workflow.ts +215 -0
- package/src/workspace/ci-green.test.ts +375 -0
- package/src/workspace/ci-green.ts +408 -0
- package/src/workspace/ci-last-green.schema.json +158 -0
- package/src/workspace/declaration.schema.json +102 -0
- package/src/workspace/declaration.ts +64 -0
- package/src/workspace/ls.schema.json +34 -0
- package/src/workspace/ls.ts +22 -0
- package/src/workspace/read-contract.test.ts +2 -1
- package/src/workspace/reason-codes.test.ts +2 -0
- package/src/workspace/reason-codes.ts +3 -0
- package/src/workspace/status-gates.ts +13 -2
- package/src/workspace/status.schema.json +11 -1
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
import type { OpConfig, ActivityStep } from "./types.js";
|
|
22
22
|
import { type ActivityFn, type ActivityProfile } from "./activity-registry.js";
|
|
23
23
|
import { type GateLedgerPort } from "./gate.js";
|
|
24
|
-
import type
|
|
24
|
+
import { type GatePointAsker } from "./gate-point-run.js";
|
|
25
|
+
import type { GateAnswerRef, PendingGateRecord } from "../lifecycle/gate-ledger.js";
|
|
25
26
|
import { type WaitingPoint } from "./steward-points.js";
|
|
26
27
|
import type { OpRunRecord } from "./runtime.js";
|
|
27
28
|
import { type WorkLeaseRunResult } from "./work-lease-run.js";
|
|
@@ -58,10 +59,12 @@ export interface StepRecord {
|
|
|
58
59
|
resolvedBy: string;
|
|
59
60
|
timestamp: string;
|
|
60
61
|
url?: string;
|
|
61
|
-
/** On a gate with an `approval` block (#2508): whether a quorum or a policy permit passed it. */
|
|
62
|
-
via?: "quorum" | "policy";
|
|
62
|
+
/** On a gate with an `approval` block (#2508): whether a quorum or a policy permit passed it. `"point"` on a gate that asks a decision point (#3170). */
|
|
63
|
+
via?: "quorum" | "policy" | "point";
|
|
63
64
|
/** On a gate with a quorum (#2508): every approver who counted toward it. */
|
|
64
65
|
approvers?: string[];
|
|
66
|
+
/** On a gate that asks a decision point (#3170): the answer record that passed it, which the gate ledger's resolution cites too. */
|
|
67
|
+
answer?: GateAnswerRef;
|
|
65
68
|
};
|
|
66
69
|
/**
|
|
67
70
|
* Why a step declined to proceed on something that is not a failure
|
|
@@ -181,6 +184,11 @@ export interface RunOpOptions {
|
|
|
181
184
|
now?: string;
|
|
182
185
|
/** Identifies this run on any pending fact it records. */
|
|
183
186
|
runId?: string;
|
|
187
|
+
/**
|
|
188
|
+
* How a gate that names a decision point asks it (#3170). Defaults to the
|
|
189
|
+
* workspace holding `cwd` (`workspaceGatePointAsker`); a test passes a stub.
|
|
190
|
+
*/
|
|
191
|
+
points?: GatePointAsker;
|
|
184
192
|
/**
|
|
185
193
|
* The environment the run was started for (`--env`, #2522). The executor
|
|
186
194
|
* only hands it to activities through the run context (`./run-context.ts`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-executor.d.ts","sourceRoot":"","sources":["../../src/op/local-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAmB,YAAY,EAAwC,MAAM,SAAS,CAAC;AAC7G,OAAO,EAAmB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK7F,OAAO,EAAuF,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"local-executor.d.ts","sourceRoot":"","sources":["../../src/op/local-executor.ts"],"names":[],"mapp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B,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAuCtB"}
|
package/dist/op/op-ir.d.ts
CHANGED
|
@@ -131,6 +131,8 @@ export interface OpIRGateStep {
|
|
|
131
131
|
plan?: GateStep["plan"];
|
|
132
132
|
/** Quorum, roles and policy (#2508), carried as authored. Absent on a gate that passes on one approval. */
|
|
133
133
|
approval?: GateStep["approval"];
|
|
134
|
+
/** The decision point the gate asks (#3170), carried as authored. Absent on a gate that `chant approve` passes. */
|
|
135
|
+
point?: GateStep["point"];
|
|
134
136
|
}
|
|
135
137
|
export interface OpIREffectStep {
|
|
136
138
|
kind: "effect";
|
package/dist/op/op-ir.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"op-ir.d.ts","sourceRoot":"","sources":["../../src/op/op-ir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAGH,OAAO,KAAK,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,WAAW,EAIX,QAAQ,EAET,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG9E;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAI1C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,iGAAiG;IACjG,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,OAAO,CAAC,EAAE,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@@ -8,6 +8,7 @@ import type { EffectReceiptRef } from "./receipt-store.js";
|
|
|
8
8
|
import type { ActivityProfileName } from "./activity-profiles.js";
|
|
9
9
|
import type { StepOutputRef } from "./step-output-ref.js";
|
|
10
10
|
import type { GateApproval } from "./gate-approval.js";
|
|
11
|
+
import type { GatePoint } from "./gate-point.js";
|
|
11
12
|
export interface OpConfig {
|
|
12
13
|
/** Kebab-case identifier. Names the Op's output directory (`dist/ops/<name>/`), and is the name `chant run <name>` and another Op's `depends` refer to. */
|
|
13
14
|
name: string;
|
|
@@ -262,6 +263,16 @@ export interface GateStepBase {
|
|
|
262
263
|
* `./gate-approval.ts`.
|
|
263
264
|
*/
|
|
264
265
|
approval?: GateApproval;
|
|
266
|
+
/**
|
|
267
|
+
* A declared decision point this gate asks (#3170), by name or as a
|
|
268
|
+
* {@link GatePoint}. Reaching the gate asks the point: its deciders and
|
|
269
|
+
* quorum decide, the answer is an answer record, and `chant workspace
|
|
270
|
+
* points answer` answers an open question. The run passes the gate on an
|
|
271
|
+
* answer in `pass`, and the resolution it writes cites the record. A gate
|
|
272
|
+
* with a point takes no `approval`: the point's quorum is the gate's. See
|
|
273
|
+
* `./gate-point.ts`.
|
|
274
|
+
*/
|
|
275
|
+
point?: string | GatePoint;
|
|
265
276
|
}
|
|
266
277
|
/**
|
|
267
278
|
* A human approval decided against the gate ledger. The name lives on `gate`;
|
package/dist/op/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/op/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|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IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,4EAA4E;IAC5E,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,KAAK,EAAE,KAAK,CAAC,YAAY,GAAG,QAAQ,CAAC,CAAC;IACtC,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,GACjC,CACI;IACE,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,0FAA0F;IAC1F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACD;IACE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,0FAA0F;IAC1F,UAAU,EAAE,MAAM,CAAC;CACpB,CACJ,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project-local code generation: typed code a lexicon generates into the
|
|
3
|
+
* project from sources the project declares in `chant.config.ts` (a CRD file,
|
|
4
|
+
* a Helm chart), as opposed to the types a lexicon ships in its package.
|
|
5
|
+
*
|
|
6
|
+
* The split of work:
|
|
7
|
+
*
|
|
8
|
+
* - A lexicon implements {@link ProjectCodegen} (the plugin's
|
|
9
|
+
* `projectCodegen()` hook). It says what its declared inputs are
|
|
10
|
+
* ({@link ProjectCodegen.inputs}, offline), renders files from them
|
|
11
|
+
* ({@link ProjectCodegen.generate}, may fetch), and optionally reads its own
|
|
12
|
+
* committed output back when a build starts ({@link ProjectCodegen.load}).
|
|
13
|
+
* - Core owns the output directory, writes the files, and records a digest of
|
|
14
|
+
* the inputs beside them in {@link STAMP_FILE}. `chant generate` is the only
|
|
15
|
+
* writer.
|
|
16
|
+
* - Every build compares the inputs' digest with the recorded one before it
|
|
17
|
+
* serializes ({@link checkProjectCodegen}, wired in through the build-root
|
|
18
|
+
* contributors in ./cli/plugins.ts). A mismatch fails the build. The build
|
|
19
|
+
* never fetches and never regenerates, so it stays offline and the committed
|
|
20
|
+
* output is what a fresh clone typechecks against.
|
|
21
|
+
*
|
|
22
|
+
* Output lives in `<codegen.outDir>/<lexicon>/`, default `src/generated/<lexicon>/`,
|
|
23
|
+
* relative to the directory holding `chant.config.*`.
|
|
24
|
+
*/
|
|
25
|
+
/** Default output directory, relative to the project root. */
|
|
26
|
+
export declare const DEFAULT_CODEGEN_OUT_DIR = "src/generated";
|
|
27
|
+
/** The file core writes beside a lexicon's generated files: the inputs digest and the file list. */
|
|
28
|
+
export declare const STAMP_FILE = "chant-codegen.json";
|
|
29
|
+
/**
|
|
30
|
+
* Header for generated TypeScript. It carries discovery's generated-file
|
|
31
|
+
* marker (`./discovery/files.ts`), so the build and `chant lint` do not treat
|
|
32
|
+
* the generated module as authored source; project files still import it.
|
|
33
|
+
*/
|
|
34
|
+
export declare const GENERATED_TS_HEADER = "// Generated by chant \u2014 do not edit directly. Run `chant generate` to update.";
|
|
35
|
+
/** What a lexicon's project-codegen hooks receive. */
|
|
36
|
+
export interface ProjectCodegenContext {
|
|
37
|
+
/** The directory holding `chant.config.*`. Relative paths in the config resolve against it. */
|
|
38
|
+
projectRoot: string;
|
|
39
|
+
/** The resolved project configuration; a lexicon reads its own namespace. */
|
|
40
|
+
config: Record<string, unknown>;
|
|
41
|
+
/** Absolute directory this lexicon's files go in (`<codegen.outDir>/<lexicon>`). */
|
|
42
|
+
outDir: string;
|
|
43
|
+
}
|
|
44
|
+
/** Extra context for {@link ProjectCodegen.generate}. */
|
|
45
|
+
export interface ProjectCodegenGenerateContext extends ProjectCodegenContext {
|
|
46
|
+
/**
|
|
47
|
+
* The fetch remote sources go through. Absent means the global `fetch`.
|
|
48
|
+
* Tests pass a fake so no network is touched.
|
|
49
|
+
*/
|
|
50
|
+
fetch?: typeof fetch;
|
|
51
|
+
}
|
|
52
|
+
/** What {@link ProjectCodegen.generate} returns. */
|
|
53
|
+
export interface ProjectCodegenOutput {
|
|
54
|
+
/** File contents keyed by path relative to `outDir`, `/`-separated. */
|
|
55
|
+
files: Record<string, string>;
|
|
56
|
+
/** One line per generated item, printed by `chant generate`. */
|
|
57
|
+
summary?: string[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A lexicon's project-local code generation (the plugin's `projectCodegen()`
|
|
61
|
+
* hook).
|
|
62
|
+
*/
|
|
63
|
+
export interface ProjectCodegen {
|
|
64
|
+
/**
|
|
65
|
+
* The declared inputs, as a JSON value, or `undefined` when the project
|
|
66
|
+
* declares none. Must not touch the network: the build calls it on every
|
|
67
|
+
* run. A local file is described by a hash of its content, a remote source
|
|
68
|
+
* by its pin (a version, a sha256), so editing a local file or changing a
|
|
69
|
+
* pin changes the value. Core hashes the value; the lexicon never sees the
|
|
70
|
+
* digest.
|
|
71
|
+
*/
|
|
72
|
+
inputs(ctx: ProjectCodegenContext): Promise<unknown | undefined> | unknown | undefined;
|
|
73
|
+
/** Render the files from the declared inputs. May fetch, through `ctx.fetch`. */
|
|
74
|
+
generate(ctx: ProjectCodegenGenerateContext): Promise<ProjectCodegenOutput>;
|
|
75
|
+
/**
|
|
76
|
+
* Read the committed output back at the start of a build, once the inputs
|
|
77
|
+
* are known to match it. The k8s lexicon registers the generated kinds here
|
|
78
|
+
* so its serializer and the CRD spec checks know them even when discovery
|
|
79
|
+
* ran in a sandboxed child process.
|
|
80
|
+
*/
|
|
81
|
+
load?(ctx: ProjectCodegenContext): Promise<void> | void;
|
|
82
|
+
}
|
|
83
|
+
/** The recorded stamp. */
|
|
84
|
+
export interface ProjectCodegenStamp {
|
|
85
|
+
/** `sha256:<hex>` of the canonical JSON of {@link ProjectCodegen.inputs}. */
|
|
86
|
+
inputs: string;
|
|
87
|
+
/** The files written, relative to the lexicon's output directory. */
|
|
88
|
+
files: string[];
|
|
89
|
+
}
|
|
90
|
+
/** The minimal plugin shape these functions need. */
|
|
91
|
+
export interface ProjectCodegenPlugin {
|
|
92
|
+
readonly name: string;
|
|
93
|
+
projectCodegen?(): ProjectCodegen;
|
|
94
|
+
}
|
|
95
|
+
/** Resolve the output root (`codegen.outDir`, default {@link DEFAULT_CODEGEN_OUT_DIR}) against the project root. */
|
|
96
|
+
export declare function resolveCodegenRoot(projectRoot: string, config: Record<string, unknown>): string;
|
|
97
|
+
/** The context for one lexicon. */
|
|
98
|
+
export declare function projectCodegenContext(lexicon: string, projectRoot: string, config: Record<string, unknown>): ProjectCodegenContext;
|
|
99
|
+
/** `sha256:<hex>` of a JSON value's canonical form. */
|
|
100
|
+
export declare function digestInputs(inputs: unknown): string;
|
|
101
|
+
/** Read a lexicon's stamp, or `undefined` when it has none (or it does not parse). */
|
|
102
|
+
export declare function readStamp(outDir: string): ProjectCodegenStamp | undefined;
|
|
103
|
+
/** One lexicon's result from {@link generateProjectCode}. */
|
|
104
|
+
export interface ProjectCodegenResult {
|
|
105
|
+
lexicon: string;
|
|
106
|
+
/** The lexicon's output directory. */
|
|
107
|
+
outDir: string;
|
|
108
|
+
/** `written`: files (re)generated. `removed`: nothing declared, old output deleted. `none`: nothing declared, nothing there. */
|
|
109
|
+
status: "written" | "removed" | "none";
|
|
110
|
+
files: string[];
|
|
111
|
+
summary: string[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* `chant generate` for one lexicon: render its files, write them, delete
|
|
115
|
+
* files a previous run wrote that this one did not, and record the stamp.
|
|
116
|
+
* With nothing declared, a previous run's output is removed.
|
|
117
|
+
*/
|
|
118
|
+
export declare function generateProjectCode(plugin: ProjectCodegenPlugin, projectRoot: string, config: Record<string, unknown>, options?: {
|
|
119
|
+
fetch?: typeof fetch;
|
|
120
|
+
}): Promise<ProjectCodegenResult | undefined>;
|
|
121
|
+
/** The outcome of {@link checkProjectCodegen} for one lexicon. */
|
|
122
|
+
export type ProjectCodegenCheck = {
|
|
123
|
+
status: "current" | "none";
|
|
124
|
+
} | {
|
|
125
|
+
status: "missing" | "drift" | "orphan";
|
|
126
|
+
message: string;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Whether a lexicon's committed output matches its declared inputs. Offline.
|
|
130
|
+
*
|
|
131
|
+
* - `none`: nothing declared, nothing generated.
|
|
132
|
+
* - `current`: the recorded digest matches and every recorded file exists.
|
|
133
|
+
* - `missing`: sources are declared and there is no output (or a recorded file is gone).
|
|
134
|
+
* - `drift`: the declared sources changed since the output was generated.
|
|
135
|
+
* - `orphan`: nothing is declared any more, but generated output remains.
|
|
136
|
+
*/
|
|
137
|
+
export declare function checkProjectCodegen(plugin: ProjectCodegenPlugin, projectRoot: string, config: Record<string, unknown>): Promise<ProjectCodegenCheck>;
|
|
138
|
+
/**
|
|
139
|
+
* The build's side of project codegen for one plugin: check the committed
|
|
140
|
+
* output against the declared inputs, throw on any mismatch, and let the
|
|
141
|
+
* lexicon load its output when it is current. Called once per top-level
|
|
142
|
+
* build, before serialization.
|
|
143
|
+
*/
|
|
144
|
+
export declare function prepareProjectCodegen(plugin: ProjectCodegenPlugin, projectRoot: string, config: Record<string, unknown>): Promise<void>;
|
|
145
|
+
//# sourceMappingURL=project-codegen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-codegen.d.ts","sourceRoot":"","sources":["../src/project-codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAQH,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,kBA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;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,oBAAoB,EAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CAmC9B;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,oBAAoB,EAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant ci` (#3573, ws-103): which commits passed CI.
|
|
3
|
+
*
|
|
4
|
+
* ci last-green [--json] the newest commit on the branch with a green tag and no revoked tag
|
|
5
|
+
* ci tick [--dry-run] [--forge github] tag the commits that turned green, revoke the ones that turned red
|
|
6
|
+
* ci workflow [--workflow <name>]... [--output <file>] [--chant <command>] [--install <command>]
|
|
7
|
+
* write the root CI file that runs the tick
|
|
8
|
+
*
|
|
9
|
+
* `last-green --json` prints `ci-last-green.schema.json`. The tick and the
|
|
10
|
+
* workflow print text.
|
|
11
|
+
*/
|
|
12
|
+
import type { CommandContext } from "../cli/registry.js";
|
|
13
|
+
export declare function runCiLastGreen(ctx: CommandContext): Promise<number>;
|
|
14
|
+
export declare function runCiTick(ctx: CommandContext): Promise<number>;
|
|
15
|
+
export declare function runCiWorkflow(ctx: CommandContext): Promise<number>;
|
|
16
|
+
//# sourceMappingURL=ci-green-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-green-cli.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-green-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAWtD,wBAAsB,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBzE;AAID,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAUpE;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA0CxE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `chant ci tick` asks of a forge (#3573, ws-103): every check run on a
|
|
3
|
+
* commit, every attempt of each, so the tick can judge a phase by each run's
|
|
4
|
+
* latest attempt.
|
|
5
|
+
*
|
|
6
|
+
* The tags themselves are git's, pushed to the remote like any other ref, so
|
|
7
|
+
* the forge is asked for check runs and nothing else. GitHub is the one
|
|
8
|
+
* forge implemented. Forgejo reports commit statuses rather than check runs,
|
|
9
|
+
* and GitLab reports pipeline jobs; each can implement {@link CiForge} by
|
|
10
|
+
* mapping those to {@link CheckRun}s, and until one does `--forge` refuses
|
|
11
|
+
* them by name.
|
|
12
|
+
*
|
|
13
|
+
* The client takes a `fetch` like the pull-request loop's (`../pr-forge.ts`),
|
|
14
|
+
* so the tests drive it with a recording fake and no network.
|
|
15
|
+
*/
|
|
16
|
+
import { type ForgeFetch, type ForgeKind } from "../pr-forge.js";
|
|
17
|
+
/** One attempt of one check run on a commit. */
|
|
18
|
+
export interface CheckRun {
|
|
19
|
+
/** The forge's id. A later attempt of the same check has a larger one. */
|
|
20
|
+
id: number;
|
|
21
|
+
name: string;
|
|
22
|
+
/** `completed` once it has finished; `queued`, `in_progress`, `waiting`, `requested` or `pending` before. */
|
|
23
|
+
status: string;
|
|
24
|
+
/** Set once completed: `success`, `failure`, `skipped`, `cancelled`, `neutral`, `timed_out`, `action_required` or `stale`. */
|
|
25
|
+
conclusion: string | null;
|
|
26
|
+
completedAt: string | null;
|
|
27
|
+
url: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface CiForge {
|
|
30
|
+
kind: ForgeKind;
|
|
31
|
+
/** Every check run on `sha`, every attempt. */
|
|
32
|
+
checkRuns(sha: string): Promise<CheckRun[]>;
|
|
33
|
+
}
|
|
34
|
+
export interface GithubCiForgeOptions {
|
|
35
|
+
/** `$GITHUB_API_URL`: `https://api.github.com` or `<host>/api/v3`. */
|
|
36
|
+
apiBase: string;
|
|
37
|
+
/** `owner/name`. */
|
|
38
|
+
repo: string;
|
|
39
|
+
token: string;
|
|
40
|
+
fetch?: ForgeFetch;
|
|
41
|
+
}
|
|
42
|
+
/** A GitHub client (github.com or GitHub Enterprise Server) for check runs. The token needs `checks: read`. */
|
|
43
|
+
export declare function githubCiForge(opts: GithubCiForgeOptions): CiForge;
|
|
44
|
+
/** Thrown for a forge `chant ci tick` has no check-run client for yet. */
|
|
45
|
+
export declare class CiForgeUnsupportedError extends Error {
|
|
46
|
+
constructor(kind: string);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A check-run client for `kind` from the CI job's environment: the token is
|
|
50
|
+
* `CHANT_FORGE_TOKEN` when set, else `GITHUB_TOKEN` or `GH_TOKEN`, and the
|
|
51
|
+
* repository is `GITHUB_REPOSITORY`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function ciForgeFromEnv(kind?: string, env?: Record<string, string | undefined>, fetchImpl?: ForgeFetch): CiForge;
|
|
54
|
+
//# sourceMappingURL=ci-green-forge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-green-forge.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-green-forge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAwC,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAEpG,gDAAgD;AAChD,MAAM,WAAW,QAAQ;IACvB,0EAA0E;IAC1E,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,6GAA6G;IAC7G,MAAM,EAAE,MAAM,CAAC;IACf,8HAA8H;IAC9H,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,SAAS,CAAC;IAChB,+CAA+C;IAC/C,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAKD,+GAA+G;AAC/G,wBAAgB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAkCjE;AAED,0EAA0E;AAC1E,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,YAAY,IAAI,EAAE,MAAM,EAGvB;CACF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAiB,EAAE,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,OAAO,CAW9I"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The root CI file that runs `chant ci tick` (#3573, ws-103; ws-042 for its
|
|
3
|
+
* place at the repository root, #2524 D14 for its header and record).
|
|
4
|
+
*
|
|
5
|
+
* `chant ci workflow` writes `.github/workflows/chant-ci-green.yml`. It runs
|
|
6
|
+
* the tick when a workflow that holds a required check run completes on the
|
|
7
|
+
* branch, so a result or a re-run is acted on within seconds, and every 15
|
|
8
|
+
* minutes as a backstop for a dropped or late event. One concurrency group
|
|
9
|
+
* that never cancels keeps ticks one at a time.
|
|
10
|
+
*
|
|
11
|
+
* GitHub's `workflow_run` names workflows, and `ci.green` names check runs,
|
|
12
|
+
* so the generator reads the repository's other workflow files and keeps
|
|
13
|
+
* each workflow with a job whose check-run name meets one of a required
|
|
14
|
+
* phase's patterns. A job's check run is its `name`, or its id, with
|
|
15
|
+
* ` (<matrix values>)` after it for a matrix job and ` / <job>` after it for
|
|
16
|
+
* a job that calls a reusable workflow; a `${{ }}` expression stands for
|
|
17
|
+
* anything. `--workflow <name>` adds a workflow the scan can't see.
|
|
18
|
+
*
|
|
19
|
+
* The tick runs the published chant that wrote the file, through npx.
|
|
20
|
+
* `--chant <command>` runs another one instead, and `--install <command>`
|
|
21
|
+
* adds a step that installs it, with setup-node caching npm's downloads when
|
|
22
|
+
* the workspace root has a `package-lock.json`. chant's own repository uses
|
|
23
|
+
* both to run its source at the commit it checks out.
|
|
24
|
+
*
|
|
25
|
+
* Like a member's pipelines (./member-pipeline.ts), the file starts with the
|
|
26
|
+
* generated-file header naming the command, and the member whose directory
|
|
27
|
+
* the command runs in records it in its generated-file record, so `WSP081`
|
|
28
|
+
* allows one declarer.
|
|
29
|
+
*/
|
|
30
|
+
import type { CiGreen } from "./declaration.js";
|
|
31
|
+
/** Where the workflow goes, relative to the repository root. */
|
|
32
|
+
export declare const CI_GREEN_WORKFLOW_FILE = ".github/workflows/chant-ci-green.yml";
|
|
33
|
+
export declare const CI_GREEN_WORKFLOW_NAME = "chant-ci-green";
|
|
34
|
+
/** One workflow file as the scan reads it. */
|
|
35
|
+
export interface WorkflowSource {
|
|
36
|
+
/** Relative to the repository root, such as `.github/workflows/ci.yml`. */
|
|
37
|
+
path: string;
|
|
38
|
+
text: string;
|
|
39
|
+
}
|
|
40
|
+
/** The check-run names a workflow's jobs report, as patterns: `*` stands for what an expression or a matrix fills in. */
|
|
41
|
+
export declare function jobCheckRuns(doc: unknown): string[];
|
|
42
|
+
export interface WorkflowScan {
|
|
43
|
+
/** The workflows holding a required check run, sorted. */
|
|
44
|
+
workflows: string[];
|
|
45
|
+
/** Required patterns no job of any workflow meets. */
|
|
46
|
+
unmatched: {
|
|
47
|
+
phase: string;
|
|
48
|
+
pattern: string;
|
|
49
|
+
}[];
|
|
50
|
+
/** Workflow files that could not be parsed. */
|
|
51
|
+
unreadable: string[];
|
|
52
|
+
}
|
|
53
|
+
/** Find the workflows that hold the required phases' check runs. */
|
|
54
|
+
export declare function workflowsHolding(green: CiGreen, sources: readonly WorkflowSource[]): WorkflowScan;
|
|
55
|
+
/** The repository's GitHub workflow files, other than `skip`. */
|
|
56
|
+
export declare function readWorkflowSources(repoRoot: string, skip: string): WorkflowSource[];
|
|
57
|
+
export interface WorkflowInput {
|
|
58
|
+
green: CiGreen;
|
|
59
|
+
/** The workflows whose completion triggers a tick. */
|
|
60
|
+
workflows: readonly string[];
|
|
61
|
+
/** The chant the tick runs, `@intentius/chant` at this version. */
|
|
62
|
+
chantVersion: string;
|
|
63
|
+
/**
|
|
64
|
+
* The command that runs chant, with `ci tick` after it, in place of
|
|
65
|
+
* `npx --yes @intentius/chant@<chantVersion>`. chant's own repository runs
|
|
66
|
+
* its source this way, so the tick tests the commit it checks out.
|
|
67
|
+
*/
|
|
68
|
+
chant?: string;
|
|
69
|
+
/** A step before the tick that installs what `chant` needs, run where the tick runs. */
|
|
70
|
+
install?: string;
|
|
71
|
+
/** With `install`, the `package-lock.json` setup-node caches npm's downloads by, from the repository root. */
|
|
72
|
+
npmLock?: string;
|
|
73
|
+
/** The workspace root relative to the repository root, `.` for the root itself. */
|
|
74
|
+
workspaceRoot: string;
|
|
75
|
+
}
|
|
76
|
+
/** The workflow's YAML, without the generated-file header. Deterministic: the same input writes the same bytes. */
|
|
77
|
+
export declare function renderCiGreenWorkflow(input: WorkflowInput): string;
|
|
78
|
+
/** The header line naming the command that regenerates the file, and where to run it. */
|
|
79
|
+
export declare function ciGreenHeader(command: string, where: "member" | "root"): string;
|
|
80
|
+
/** Write the file, creating its directory. Returns the path relative to the current directory. */
|
|
81
|
+
export declare function writeWorkflowFile(target: string, text: string): string;
|
|
82
|
+
//# sourceMappingURL=ci-green-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-green-workflow.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-green-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,yCAAyC,CAAC;AAC7E,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AAEvD,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAKD,yHAAyH;AACzH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CAYnD;AAYD,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,sDAAsD;IACtD,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,+CAA+C;IAC/C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,cAAc,EAAE,GAAG,YAAY,CAyBjG;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE,CASpF;AAID,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,sDAAsD;IACtD,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8GAA8G;IAC9G,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,mHAAmH;AACnH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAsDlE;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAE/E;AAED,kGAAkG;AAClG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAItE"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which commits passed CI (#3573, ws-103).
|
|
3
|
+
*
|
|
4
|
+
* The declaration's `ci.green` names a branch, a window and phases, each
|
|
5
|
+
* phase a list of check-run name patterns. A phase passes when every check
|
|
6
|
+
* run its patterns match finished with success, judged by each run's latest
|
|
7
|
+
* attempt. A run that finished as skipped passes only in a phase declared
|
|
8
|
+
* `skipped: pass`. A run still going, or a pattern no run matches yet, leaves
|
|
9
|
+
* the phase undecided. A commit passes when every phase in `require` passes,
|
|
10
|
+
* and fails when one of them fails.
|
|
11
|
+
*
|
|
12
|
+
* What chant concluded is kept in git as two kinds of annotated tag, each
|
|
13
|
+
* made once and never moved or deleted by chant:
|
|
14
|
+
*
|
|
15
|
+
* ci/green/<sha> every required phase passed; the annotation gives the
|
|
16
|
+
* time and each phase's runs
|
|
17
|
+
* ci/revoked/<sha> a green commit later failed a required phase (a re-run
|
|
18
|
+
* that went red); the annotation gives the phase, the
|
|
19
|
+
* run and the time
|
|
20
|
+
*
|
|
21
|
+
* {@link ciTick} walks the branch's first-parent commits within the window,
|
|
22
|
+
* tags the ones that turned green and revokes the green ones that turned red.
|
|
23
|
+
* It is idempotent: a second tick over the same check runs changes nothing.
|
|
24
|
+
* A revoked commit is never looked at again, so it goes green again only
|
|
25
|
+
* when someone deletes its revoked tag by hand, which leaves its green tag
|
|
26
|
+
* standing. {@link lastGreen} reads the tags alone, with no forge.
|
|
27
|
+
*
|
|
28
|
+
* The forge is asked only for check runs (`./ci-green-forge.ts`). The tags
|
|
29
|
+
* are fetched from and pushed to the remote with git.
|
|
30
|
+
*/
|
|
31
|
+
import { type CiGreen, type CiPhase } from "./declaration.js";
|
|
32
|
+
import type { CheckRun, CiForge } from "./ci-green-forge.js";
|
|
33
|
+
export declare const CI_GREEN_TAG_PREFIX = "ci/green/";
|
|
34
|
+
export declare const CI_REVOKED_TAG_PREFIX = "ci/revoked/";
|
|
35
|
+
export declare const CI_LAST_GREEN_CONTRACT_VERSION = 1;
|
|
36
|
+
export declare const CI_LAST_GREEN_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/ci-last-green/v1/ci-last-green.schema.json";
|
|
37
|
+
/** Why `ci last-green` or `ci tick` could not start. Closed. */
|
|
38
|
+
export declare const CI_GREEN_ERROR_CODES: readonly ["declaration-missing", "declaration-ambiguous", "declaration-unparseable", "declaration-invalid", "placement-invalid", "reader-too-old", "root-chant-required", "not-a-git-repository", "revision-unknown", "ci-green-undeclared", "ci-branch-unknown"];
|
|
39
|
+
export type CiGreenErrorCode = (typeof CI_GREEN_ERROR_CODES)[number];
|
|
40
|
+
export declare class CiGreenError extends Error {
|
|
41
|
+
readonly code: CiGreenErrorCode;
|
|
42
|
+
constructor(code: CiGreenErrorCode, message: string);
|
|
43
|
+
}
|
|
44
|
+
export type Verdict = "pass" | "fail" | "pending";
|
|
45
|
+
/** Whether a check run's name matches a pattern: the whole name, `*` standing for any run of characters. */
|
|
46
|
+
export declare function matchesCheckRun(pattern: string, name: string): boolean;
|
|
47
|
+
/** Each check run's latest attempt, by name: the run with the largest id. */
|
|
48
|
+
export declare function latestAttempts(runs: readonly CheckRun[]): CheckRun[];
|
|
49
|
+
export interface RunVerdict {
|
|
50
|
+
name: string;
|
|
51
|
+
id: number;
|
|
52
|
+
status: string;
|
|
53
|
+
conclusion: string | null;
|
|
54
|
+
url: string | null;
|
|
55
|
+
verdict: Verdict;
|
|
56
|
+
}
|
|
57
|
+
export interface PhaseVerdict {
|
|
58
|
+
phase: string;
|
|
59
|
+
verdict: Verdict;
|
|
60
|
+
/** The latest attempt of every run the phase's patterns match, by name. */
|
|
61
|
+
runs: RunVerdict[];
|
|
62
|
+
/** Patterns no check run matches yet, which leave the phase undecided. */
|
|
63
|
+
unmatched: string[];
|
|
64
|
+
}
|
|
65
|
+
/** Judge one phase against a commit's latest attempts. */
|
|
66
|
+
export declare function evaluatePhase(phase: CiPhase, latest: readonly CheckRun[]): PhaseVerdict;
|
|
67
|
+
export interface CommitVerdict {
|
|
68
|
+
verdict: Verdict;
|
|
69
|
+
/** Each required phase, in `require` order. */
|
|
70
|
+
phases: PhaseVerdict[];
|
|
71
|
+
/** The first required phase that failed, and its first failed run, when the commit fails. */
|
|
72
|
+
failure: {
|
|
73
|
+
phase: string;
|
|
74
|
+
run: RunVerdict;
|
|
75
|
+
} | null;
|
|
76
|
+
}
|
|
77
|
+
/** Judge a commit: it fails when a required phase fails, and passes when every one passes. */
|
|
78
|
+
export declare function evaluateCommit(green: CiGreen, runs: readonly CheckRun[]): CommitVerdict;
|
|
79
|
+
/** A commit's tags before a tick: none, green, or green and revoked. A lone revoked tag counts as revoked. */
|
|
80
|
+
export type TagState = "none" | "green" | "revoked";
|
|
81
|
+
export interface TickCommit {
|
|
82
|
+
sha: string;
|
|
83
|
+
/** Committer time, ISO 8601. */
|
|
84
|
+
committed: string;
|
|
85
|
+
before: TagState;
|
|
86
|
+
/** Undefined for a revoked commit, which is not judged again. */
|
|
87
|
+
verdict?: CommitVerdict;
|
|
88
|
+
/** The tag the tick made, if any. */
|
|
89
|
+
made: {
|
|
90
|
+
tag: string;
|
|
91
|
+
message: string;
|
|
92
|
+
} | null;
|
|
93
|
+
}
|
|
94
|
+
export interface TickPlanInput {
|
|
95
|
+
green: CiGreen;
|
|
96
|
+
commits: readonly {
|
|
97
|
+
sha: string;
|
|
98
|
+
committed: string;
|
|
99
|
+
}[];
|
|
100
|
+
greenTags: ReadonlySet<string>;
|
|
101
|
+
revokedTags: ReadonlySet<string>;
|
|
102
|
+
checkRuns(sha: string): Promise<CheckRun[]>;
|
|
103
|
+
now: Date;
|
|
104
|
+
}
|
|
105
|
+
/** `window` (`90m`, `24h`, `7d`) in milliseconds. */
|
|
106
|
+
export declare function windowMs(window: string): number;
|
|
107
|
+
/** The annotation of a green tag: a subject line, then the record as JSON. */
|
|
108
|
+
export declare function greenAnnotation(green: CiGreen, sha: string, verdict: CommitVerdict, at: Date): string;
|
|
109
|
+
/** The annotation of a revoked tag: the phase and the run that failed, and the time. */
|
|
110
|
+
export declare function revokedAnnotation(green: CiGreen, sha: string, failure: NonNullable<CommitVerdict["failure"]>, at: Date): string;
|
|
111
|
+
/**
|
|
112
|
+
* Decide what a tick does, without touching git: a commit with no green tag
|
|
113
|
+
* whose required phases all passed gets one, and a green commit with no
|
|
114
|
+
* revoked tag that now fails a required phase gets revoked. A revoked commit
|
|
115
|
+
* is skipped without asking the forge.
|
|
116
|
+
*/
|
|
117
|
+
export declare function planTick(input: TickPlanInput): Promise<TickCommit[]>;
|
|
118
|
+
/** The ci tags in the repository: the commits with a green tag, and those with a revoked one. */
|
|
119
|
+
export declare function readCiTags(top: string): {
|
|
120
|
+
green: Map<string, string>;
|
|
121
|
+
revoked: Set<string>;
|
|
122
|
+
};
|
|
123
|
+
export interface TickRequest {
|
|
124
|
+
cwd: string;
|
|
125
|
+
forge: CiForge;
|
|
126
|
+
/** The git remote the branch and the tags are fetched from and pushed to. Default `origin`. */
|
|
127
|
+
remote?: string;
|
|
128
|
+
/** Decide and report, and make and push no tag. */
|
|
129
|
+
dryRun?: boolean;
|
|
130
|
+
now?: Date;
|
|
131
|
+
}
|
|
132
|
+
export interface TickResult {
|
|
133
|
+
branch: string;
|
|
134
|
+
window: string;
|
|
135
|
+
/** The ref the commits were read from. */
|
|
136
|
+
ref: string;
|
|
137
|
+
commits: TickCommit[];
|
|
138
|
+
/** The tags made and pushed, or that would be under `dryRun`. */
|
|
139
|
+
made: string[];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* One tick: fetch the branch and the ci tags from the remote (pruning a ci
|
|
143
|
+
* tag deleted there by hand), judge the first-parent commits within the
|
|
144
|
+
* window, make the tags that are due and push them, never forced.
|
|
145
|
+
*/
|
|
146
|
+
export declare function ciTick(req: TickRequest): Promise<TickResult>;
|
|
147
|
+
/** The text `chant ci tick` prints. */
|
|
148
|
+
export declare function formatTick(r: TickResult, dryRun?: boolean): string;
|
|
149
|
+
export type LastGreenDocument = {
|
|
150
|
+
$schema: string;
|
|
151
|
+
contract: number;
|
|
152
|
+
chant: string;
|
|
153
|
+
workspace: {
|
|
154
|
+
name: string;
|
|
155
|
+
root: string;
|
|
156
|
+
file: string;
|
|
157
|
+
};
|
|
158
|
+
branch: string;
|
|
159
|
+
/** The ref walked: the remote-tracking branch when there is one, else the local branch. */
|
|
160
|
+
ref: string;
|
|
161
|
+
commit: {
|
|
162
|
+
sha: string;
|
|
163
|
+
tag: string;
|
|
164
|
+
tagged: string | null;
|
|
165
|
+
committed: string;
|
|
166
|
+
} | null;
|
|
167
|
+
} | {
|
|
168
|
+
$schema: string;
|
|
169
|
+
contract: number;
|
|
170
|
+
chant: string;
|
|
171
|
+
error: {
|
|
172
|
+
code: CiGreenErrorCode;
|
|
173
|
+
message: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* `chant ci last-green`: the newest first-parent commit of the branch with a
|
|
178
|
+
* green tag and no revoked tag. It reads local refs and tags and never
|
|
179
|
+
* fetches, so a reader fetches first (`git fetch origin --tags`).
|
|
180
|
+
*/
|
|
181
|
+
export declare function lastGreen(req: {
|
|
182
|
+
cwd: string;
|
|
183
|
+
remote?: string;
|
|
184
|
+
}): LastGreenDocument;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