@intentius/chant 0.124.104 → 0.124.105
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/capabilities/templates.d.ts +66 -3
- package/dist/capabilities/templates.js +220 -81
- package/dist/cli/handlers/release-doctor.js +8 -3
- package/dist/cli/handlers/release-init.js +7 -4
- package/dist/cli/handlers/search.d.ts +1 -1
- package/dist/cli/handlers/search.js +24 -2
- package/dist/cli/parse-args.js +2 -2
- package/dist/cli/release-commands/doctor.js +5 -2
- package/dist/cloud-lister/aws.d.ts +9 -0
- package/dist/cloud-lister/aws.js +20 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +2 -0
- package/dist/floor-table.data.js +1 -0
- package/dist/graph-refs.d.ts +13 -0
- package/dist/graph-refs.js +11 -4
- package/dist/lifecycle/derive-edges.d.ts +1 -1
- package/dist/lifecycle/derive-edges.js +5 -3
- package/dist/lifecycle/index-import.d.ts +12 -5
- package/dist/lifecycle/index-import.js +38 -9
- package/dist/lifecycle/release-artifacts.js +3 -1
- package/dist/lifecycle/release-at.d.ts +5 -1
- package/dist/lifecycle/release-at.js +69 -4
- package/dist/lifecycle/release-doctor.d.ts +10 -0
- package/dist/lifecycle/release-doctor.js +84 -14
- package/dist/lifecycle/release-green.d.ts +5 -2
- package/dist/lifecycle/release-green.js +40 -8
- package/dist/lifecycle/release-images.d.ts +7 -1
- package/dist/lifecycle/release-images.js +14 -5
- package/dist/lifecycle/release-init.d.ts +16 -7
- package/dist/lifecycle/release-init.js +212 -45
- package/dist/lifecycle/release-next.d.ts +1 -1
- package/dist/lifecycle/release-next.js +9 -4
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/wave-runtime.mjs +38 -38
- package/dist/workspace/capabilities-contract.d.ts +15 -5
- package/dist/workspace/capabilities-contract.js +7 -4
- package/dist/workspace/capabilities.schema.json +45 -1
- package/dist/workspace/release-changed.d.ts +2 -0
- package/dist/workspace/release-changed.js +7 -2
- package/dist/workspace/release-steps/doctor.js +2 -1
- package/dist/workspace/train-cut.js +2 -2
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* runs, unchanged.
|
|
14
14
|
*/
|
|
15
15
|
import type { CapabilityEntry } from "../capabilities/catalog.js";
|
|
16
|
-
import type {
|
|
16
|
+
import type { CatalogTemplate, RefusedTemplate } from "../capabilities/templates.js";
|
|
17
17
|
/** The version of the `capabilities` document this chant writes. */
|
|
18
18
|
export declare const CAPABILITIES_CONTRACT_VERSION = 1;
|
|
19
19
|
/** `$id` of the JSON Schema for the document, shipped beside this file. */
|
|
@@ -38,9 +38,17 @@ export interface CapabilitiesResult extends CapabilitiesHead {
|
|
|
38
38
|
/**
|
|
39
39
|
* The investigation templates (#4531), the catalog's second kind of entry.
|
|
40
40
|
* Added within contract 1; a document from a chant older than
|
|
41
|
-
* CAPABILITY_TEMPLATES_FLOOR lacks it.
|
|
41
|
+
* CAPABILITY_TEMPLATES_FLOOR lacks it. From PROJECT_TEMPLATES_FLOOR it
|
|
42
|
+
* holds chant's templates and then the project's own from
|
|
43
|
+
* `.chant/templates.json` (behold#1142), each with its `origin`.
|
|
42
44
|
*/
|
|
43
|
-
templates:
|
|
45
|
+
templates: CatalogTemplate[];
|
|
46
|
+
/**
|
|
47
|
+
* The project's template entries left out of `templates`, each naming the
|
|
48
|
+
* file and field at fault (behold#1142). Added within contract 1 at
|
|
49
|
+
* PROJECT_TEMPLATES_FLOOR.
|
|
50
|
+
*/
|
|
51
|
+
refused: RefusedTemplate[];
|
|
44
52
|
}
|
|
45
53
|
export interface CapabilitiesFailure extends CapabilitiesHead {
|
|
46
54
|
error: {
|
|
@@ -53,13 +61,15 @@ export type CapabilitiesDocument = CapabilitiesResult | CapabilitiesFailure;
|
|
|
53
61
|
/**
|
|
54
62
|
* The catalog, with a support statement for each lexicon named. Each is
|
|
55
63
|
* loaded on its own, so one that isn't installed is said to be, and the rest
|
|
56
|
-
* still read.
|
|
64
|
+
* still read. The templates are the catalog for the project at `dir`:
|
|
65
|
+
* chant's, and the ones `.chant/templates.json` at its workspace or project
|
|
66
|
+
* root declares (behold#1142).
|
|
57
67
|
*/
|
|
58
68
|
export declare function capabilitiesDocument(lexicons: string[], load?: (name: string) => Promise<{
|
|
59
69
|
capabilityPack?: {
|
|
60
70
|
mapping: unknown;
|
|
61
71
|
};
|
|
62
|
-
}
|
|
72
|
+
}>, dir?: string): Promise<CapabilitiesResult>;
|
|
63
73
|
export declare function capabilitiesFailure(error: CapabilitiesFailure["error"]): Promise<CapabilitiesFailure>;
|
|
64
74
|
/**
|
|
65
75
|
* The lexicons the members of the workspace at `cwd` load, for its catalog:
|
|
@@ -28,9 +28,11 @@ async function head() {
|
|
|
28
28
|
/**
|
|
29
29
|
* The catalog, with a support statement for each lexicon named. Each is
|
|
30
30
|
* loaded on its own, so one that isn't installed is said to be, and the rest
|
|
31
|
-
* still read.
|
|
31
|
+
* still read. The templates are the catalog for the project at `dir`:
|
|
32
|
+
* chant's, and the ones `.chant/templates.json` at its workspace or project
|
|
33
|
+
* root declares (behold#1142).
|
|
32
34
|
*/
|
|
33
|
-
export async function capabilitiesDocument(lexicons, load) {
|
|
35
|
+
export async function capabilitiesDocument(lexicons, load, dir = process.cwd()) {
|
|
34
36
|
const loadPlugin = load ?? (await import("../cli/plugins.js")).loadPlugin;
|
|
35
37
|
const { capabilityCatalog } = await import("../capabilities/catalog.js");
|
|
36
38
|
const mappings = {};
|
|
@@ -44,14 +46,15 @@ export async function capabilitiesDocument(lexicons, load) {
|
|
|
44
46
|
mappings[name] = undefined;
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
|
-
const {
|
|
49
|
+
const { templateCatalog } = await import("../capabilities/templates.js");
|
|
48
50
|
const catalog = capabilityCatalog(mappings);
|
|
49
51
|
for (const c of catalog.capabilities) {
|
|
50
52
|
for (const name of notLoaded) {
|
|
51
53
|
c.lexicons[name] = { code: "lexicon-not-loaded", message: `the ${name} lexicon isn't installed where this chant runs, so its mapping wasn't read` };
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
|
-
|
|
56
|
+
const { templates, refused } = templateCatalog(dir);
|
|
57
|
+
return { ...(await head()), ...catalog, templates, refused };
|
|
55
58
|
}
|
|
56
59
|
export async function capabilitiesFailure(error) {
|
|
57
60
|
return { ...(await head()), error };
|
|
@@ -61,10 +61,39 @@
|
|
|
61
61
|
},
|
|
62
62
|
"templates": {
|
|
63
63
|
"type": "array",
|
|
64
|
-
"description": "The investigation templates (#4531), the catalog's second kind of entry: each a fixed query about one resource, as a chant search path pattern or as Cypher for behold's graph pane. Added within contract 1 by #4531, written by chant 0.124.54 and newer; a document without it is from an older chant.",
|
|
64
|
+
"description": "The investigation templates (#4531), the catalog's second kind of entry: each a fixed query about one resource, as a chant search path pattern or as Cypher for behold's graph pane. Added within contract 1 by #4531, written by chant 0.124.54 and newer; a document without it is from an older chant. chant's own come first, then the project's own from .chant/templates.json at the workspace root, or at the project root with no workspace.",
|
|
65
65
|
"items": {
|
|
66
66
|
"$ref": "#/$defs/template"
|
|
67
67
|
}
|
|
68
|
+
},
|
|
69
|
+
"refused": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"description": "The project's template entries left out of templates: one that does not hold to the entry kind, or whose id is one of chant's, or the whole file as one entry when it is not a templates file. The others still load. Added within contract 1 by behold#1142, written by chant 0.124.105 and newer.",
|
|
72
|
+
"items": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"required": [
|
|
75
|
+
"file",
|
|
76
|
+
"message"
|
|
77
|
+
],
|
|
78
|
+
"properties": {
|
|
79
|
+
"id": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"description": "The entry's id, when it has a usable one."
|
|
82
|
+
},
|
|
83
|
+
"file": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"description": "The file the entry was read from, relative to the workspace or project root, such as .chant/templates.json."
|
|
86
|
+
},
|
|
87
|
+
"field": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"description": "The field at fault, such as templates[2].query.text; absent when the file cannot be read as JSON."
|
|
90
|
+
},
|
|
91
|
+
"message": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"description": "What is wrong, naming the file and the field."
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
68
97
|
}
|
|
69
98
|
}
|
|
70
99
|
},
|
|
@@ -220,6 +249,21 @@
|
|
|
220
249
|
"type": "string"
|
|
221
250
|
}
|
|
222
251
|
},
|
|
252
|
+
"kinds": {
|
|
253
|
+
"type": "array",
|
|
254
|
+
"minItems": 1,
|
|
255
|
+
"description": "The node kinds it applies to, as the graph holds them, such as aws_s3_bucket or AWS::S3::Bucket; absent means every kind. Added within contract 1 by behold#1142, written by chant 0.124.105 and newer.",
|
|
256
|
+
"items": {
|
|
257
|
+
"type": "string"
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
"origin": {
|
|
261
|
+
"enum": [
|
|
262
|
+
"chant",
|
|
263
|
+
"project"
|
|
264
|
+
],
|
|
265
|
+
"description": "Where it was declared: chant's own templates.json, or the project's .chant/templates.json. Added within contract 1 by behold#1142, written by chant 0.124.105 and newer."
|
|
266
|
+
},
|
|
223
267
|
"inputs": {
|
|
224
268
|
"type": "array",
|
|
225
269
|
"description": "What it is filled with. The first is the resource, the only one of kind resource. A path pattern fills {{<name>}}; a Cypher query binds the resource as $key and each other input as $<name>. A scope input says where the query is read and appears in neither.",
|
|
@@ -153,6 +153,7 @@ export declare function tagHistoryRelease(top: string, shapes: readonly VersionT
|
|
|
153
153
|
export declare function releaseSettingsAt(dir: string): Promise<{
|
|
154
154
|
legacyTags: string[];
|
|
155
155
|
breakingOnZero?: "minor" | "major";
|
|
156
|
+
sources?: string[];
|
|
156
157
|
}>;
|
|
157
158
|
/**
|
|
158
159
|
* The settings for the member at `memberDir` (#5200, #5191): its own
|
|
@@ -166,6 +167,7 @@ export declare function memberReleaseSettings(memberDir: string, root?: {
|
|
|
166
167
|
}): Promise<{
|
|
167
168
|
legacyTags: string[];
|
|
168
169
|
breakingOnZero: "minor" | "major";
|
|
170
|
+
sources: string[];
|
|
169
171
|
}>;
|
|
170
172
|
/**
|
|
171
173
|
* The bump a commit gives on the version `label` (#5191): on 0.x, unless
|
|
@@ -348,7 +348,7 @@ export async function releaseSettingsAt(dir) {
|
|
|
348
348
|
try {
|
|
349
349
|
const { loadChantConfig } = await import("../config.js");
|
|
350
350
|
const release = (await loadChantConfig(dir)).config.release;
|
|
351
|
-
return { legacyTags: [...(release?.legacyTags ?? [])], ...(release?.breakingOnZero ? { breakingOnZero: release.breakingOnZero } : {}) };
|
|
351
|
+
return { legacyTags: [...(release?.legacyTags ?? [])], ...(release?.breakingOnZero ? { breakingOnZero: release.breakingOnZero } : {}), ...(release?.sources ? { sources: [...release.sources] } : {}) };
|
|
352
352
|
}
|
|
353
353
|
catch {
|
|
354
354
|
return { legacyTags: [] };
|
|
@@ -373,6 +373,8 @@ export async function memberReleaseSettings(memberDir, root) {
|
|
|
373
373
|
return {
|
|
374
374
|
legacyTags: [...new Set([...own.legacyTags, ...rootSettings.legacyTags])],
|
|
375
375
|
breakingOnZero: own.breakingOnZero ?? rootSettings.breakingOnZero ?? "minor",
|
|
376
|
+
// #5271: the member's own; a root's sources are not its members'.
|
|
377
|
+
sources: own.sources ?? [],
|
|
376
378
|
};
|
|
377
379
|
}
|
|
378
380
|
function realpathOr(p) {
|
|
@@ -486,6 +488,9 @@ async function read(query) {
|
|
|
486
488
|
const settings = await memberReleaseSettings(memberDir, { dir: rootDir, settings: rootSettings });
|
|
487
489
|
const last = ledger.last ?? (settings.legacyTags.length > rootSettings.legacyTags.length ? legacyRelease(top, settings.legacyTags) : legacyLast);
|
|
488
490
|
let paths = [];
|
|
491
|
+
// #5271: release.sources, as paths from the outermost root; "" is the whole of it.
|
|
492
|
+
const sources = settings.sources.map((s) => posix(relative(outerDir, resolve(memberDir, s)))).filter((s) => s !== ".." && !s.startsWith("../")).map((s) => (s === "." ? "" : s));
|
|
493
|
+
const fromSources = (path) => sources.some((s) => s === "" || path === s || path.startsWith(`${s}/`));
|
|
489
494
|
if (last) {
|
|
490
495
|
if (tryGit(top, ["cat-file", "-e", `${last.commit}^{commit}`]) === null)
|
|
491
496
|
throw new ReadFailure("ledger-unreadable", `the last release of ${m.name} is at ${last.commit.slice(0, 12)}, which this clone does not have`);
|
|
@@ -494,7 +499,7 @@ async function read(query) {
|
|
|
494
499
|
const path = outerFromTop === "." || outerFromTop === "" ? file : file.startsWith(`${outerFromTop}/`) ? file.slice(outerFromTop.length + 1) : null;
|
|
495
500
|
if (path === null)
|
|
496
501
|
continue;
|
|
497
|
-
if (memberHolding(path, outer.members) !== m.name && !(outerMemberOf(m.name) === undefined && memberHolding(path, declaration.members) === m.name))
|
|
502
|
+
if (memberHolding(path, outer.members) !== m.name && !(outerMemberOf(m.name) === undefined && memberHolding(path, declaration.members) === m.name) && !fromSources(path))
|
|
498
503
|
continue;
|
|
499
504
|
if (ignore.some((match) => match(path)))
|
|
500
505
|
continue;
|
|
@@ -3,7 +3,8 @@ export const doctorFeature = {
|
|
|
3
3
|
steps: (c) => {
|
|
4
4
|
if (!c.doctor)
|
|
5
5
|
return [];
|
|
6
|
-
|
|
6
|
+
// The cut job runs without id-token: write, which only the publish job holds, so the doctor there is told where it is.
|
|
7
|
+
const items = [`${c.chant} release doctor${c.shape === "dispatch" && c.job === "cut" ? " --from cut" : ""}`];
|
|
7
8
|
if (c.shape !== "dispatch")
|
|
8
9
|
return c.job === "publish" ? [{ slot: "prepare", order: 10, items }] : [];
|
|
9
10
|
if (c.job !== "cut")
|
|
@@ -354,10 +354,10 @@ export const spawnMemberCut = async (m, commit, o) => {
|
|
|
354
354
|
};
|
|
355
355
|
// A check's stdout goes to stderr: under --json, stdout is the cut's JSON document alone.
|
|
356
356
|
const defaultCheck = (line, o) => runToStderr(line, o);
|
|
357
|
-
/** This chant's `release doctor` in a member's directory, its stdout sent to stderr. */
|
|
357
|
+
/** This chant's `release doctor` in a member's directory, its stdout sent to stderr. In CI it is the train's cut job, which has no OIDC token (`--from cut`). */
|
|
358
358
|
const defaultDoctor = (dir) => {
|
|
359
359
|
const [bin, ...pre] = ownChant();
|
|
360
|
-
return spawnSync(bin, [...pre, "release", "doctor"], { cwd: dir, stdio: ["ignore", 2, 2] }).status ?? 1;
|
|
360
|
+
return spawnSync(bin, [...pre, "release", "doctor", ...(process.env.CI ? ["--from", "cut"] : [])], { cwd: dir, stdio: ["ignore", 2, 2] }).status ?? 1;
|
|
361
361
|
};
|
|
362
362
|
/**
|
|
363
363
|
* Parse `--planned` (#5237): `<member>=<label>` words separated by spaces or
|
package/package.json
CHANGED