@intentius/chant 0.124.14 → 0.124.16

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.
Files changed (178) hide show
  1. package/dist/build.d.ts +6 -0
  2. package/dist/build.d.ts.map +1 -1
  3. package/dist/build.js +1 -0
  4. package/dist/change-set.d.ts +24 -2
  5. package/dist/change-set.d.ts.map +1 -1
  6. package/dist/change-set.js +50 -1
  7. package/dist/ci-jobs.d.ts +227 -0
  8. package/dist/ci-jobs.d.ts.map +1 -0
  9. package/dist/ci-jobs.js +448 -0
  10. package/dist/cli/flush.d.ts +16 -0
  11. package/dist/cli/flush.d.ts.map +1 -0
  12. package/dist/cli/flush.js +42 -0
  13. package/dist/cli/handlers/approve.d.ts +98 -0
  14. package/dist/cli/handlers/approve.d.ts.map +1 -0
  15. package/dist/cli/handlers/approve.js +495 -0
  16. package/dist/cli/handlers/operator.d.ts +1 -95
  17. package/dist/cli/handlers/operator.d.ts.map +1 -1
  18. package/dist/cli/handlers/operator.js +4 -488
  19. package/dist/cli/handlers/override-approve.js +1 -1
  20. package/dist/cli/main.d.ts +4 -15
  21. package/dist/cli/main.d.ts.map +1 -1
  22. package/dist/cli/main.js +4 -1062
  23. package/dist/cli/parse-args.d.ts +6 -0
  24. package/dist/cli/parse-args.d.ts.map +1 -0
  25. package/dist/cli/parse-args.js +1028 -0
  26. package/dist/components/fan-out-record.d.ts +1 -1
  27. package/dist/components/fan-out-record.d.ts.map +1 -1
  28. package/dist/components/fan-out-record.js +3 -7
  29. package/dist/components/fan-out-run.d.ts +5 -3
  30. package/dist/components/fan-out-run.d.ts.map +1 -1
  31. package/dist/components/fan-out-run.js +7 -5
  32. package/dist/components/pr-pipeline.d.ts.map +1 -1
  33. package/dist/components/pr-pipeline.js +3 -2
  34. package/dist/composite.d.ts +10 -2
  35. package/dist/composite.d.ts.map +1 -1
  36. package/dist/composite.js +8 -0
  37. package/dist/discovery/collect.d.ts +2 -1
  38. package/dist/discovery/collect.d.ts.map +1 -1
  39. package/dist/discovery/collect.js +16 -1
  40. package/dist/discovery/fold-import.d.ts.map +1 -1
  41. package/dist/discovery/fold-import.js +2 -107
  42. package/dist/discovery/host-composite.d.ts +35 -0
  43. package/dist/discovery/host-composite.d.ts.map +1 -0
  44. package/dist/discovery/host-composite.js +93 -0
  45. package/dist/discovery/index.d.ts +9 -0
  46. package/dist/discovery/index.d.ts.map +1 -1
  47. package/dist/discovery/index.js +1 -1
  48. package/dist/gate-decision.d.ts +20 -9
  49. package/dist/gate-decision.d.ts.map +1 -1
  50. package/dist/gate-decision.js +72 -19
  51. package/dist/gated-waves.d.ts +25 -6
  52. package/dist/gated-waves.d.ts.map +1 -1
  53. package/dist/gated-waves.js +21 -6
  54. package/dist/lifecycle/gate-audit.d.ts +69 -2
  55. package/dist/lifecycle/gate-audit.d.ts.map +1 -1
  56. package/dist/lifecycle/gate-audit.js +76 -2
  57. package/dist/lifecycle/gate-ledger.d.ts +24 -0
  58. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  59. package/dist/lifecycle/gate-ledger.js +9 -1
  60. package/dist/op/activities/activity-contracts.d.ts +5 -5
  61. package/dist/op/activities/activity-contracts.js +1 -1
  62. package/dist/op/activities/change-set.d.ts +8 -3
  63. package/dist/op/activities/change-set.d.ts.map +1 -1
  64. package/dist/op/activities/change-set.js +5 -2
  65. package/dist/op/activities/reconcile.d.ts +28 -16
  66. package/dist/op/activities/reconcile.d.ts.map +1 -1
  67. package/dist/op/activities/reconcile.js +34 -20
  68. package/dist/op/builders.d.ts +1 -1
  69. package/dist/op/builders.d.ts.map +1 -1
  70. package/dist/op/builders.js +1 -1
  71. package/dist/op/op-waves-run.d.ts +2 -2
  72. package/dist/op/op-waves-run.d.ts.map +1 -1
  73. package/dist/op/op-waves-run.js +8 -9
  74. package/dist/op/op-waves.d.ts.map +1 -1
  75. package/dist/op/op-waves.js +4 -8
  76. package/dist/package-version.d.ts +2 -0
  77. package/dist/package-version.d.ts.map +1 -0
  78. package/dist/package-version.js +10 -0
  79. package/dist/wave-engine.d.ts +62 -0
  80. package/dist/wave-engine.d.ts.map +1 -0
  81. package/dist/wave-engine.js +59 -0
  82. package/dist/wave-layout.d.ts +29 -0
  83. package/dist/wave-layout.d.ts.map +1 -0
  84. package/dist/wave-layout.js +41 -0
  85. package/dist/wave-runtime.d.ts +29 -0
  86. package/dist/wave-runtime.d.ts.map +1 -0
  87. package/dist/wave-runtime.js +103 -0
  88. package/dist/wave-runtime.mjs +331 -0
  89. package/dist/workspace/__fixtures__/contract-repo.d.ts +7 -0
  90. package/dist/workspace/__fixtures__/contract-repo.d.ts.map +1 -1
  91. package/dist/workspace/__fixtures__/contract-repo.js +17 -1
  92. package/dist/workspace/__fixtures__/sessions.d.ts +1 -1
  93. package/dist/workspace/__fixtures__/sessions.d.ts.map +1 -1
  94. package/dist/workspace/__fixtures__/sessions.js +3 -3
  95. package/dist/workspace/ajv2020.d.ts +5 -0
  96. package/dist/workspace/ajv2020.d.ts.map +1 -0
  97. package/dist/workspace/ajv2020.js +14 -0
  98. package/dist/workspace/change-set.schema.json +5 -3
  99. package/dist/workspace/ci-green-workflow.d.ts +3 -1
  100. package/dist/workspace/ci-green-workflow.d.ts.map +1 -1
  101. package/dist/workspace/ci-green-workflow.js +5 -2
  102. package/dist/workspace/class-data.d.ts +84 -0
  103. package/dist/workspace/class-data.d.ts.map +1 -0
  104. package/dist/workspace/class-data.js +238 -0
  105. package/dist/workspace/declaration.d.ts.map +1 -1
  106. package/dist/workspace/declaration.js +4 -8
  107. package/dist/workspace/kinds.d.ts +3 -7
  108. package/dist/workspace/kinds.d.ts.map +1 -1
  109. package/dist/workspace/kinds.js +8 -45
  110. package/dist/workspace/points.d.ts.map +1 -1
  111. package/dist/workspace/points.js +2 -5
  112. package/dist/workspace/principal-classes.d.ts +4 -11
  113. package/dist/workspace/principal-classes.d.ts.map +1 -1
  114. package/dist/workspace/principal-classes.js +13 -99
  115. package/package.json +5 -3
  116. package/src/build.ts +8 -0
  117. package/src/change-set.test.ts +48 -0
  118. package/src/change-set.ts +52 -2
  119. package/src/ci-jobs.test.ts +49 -0
  120. package/src/ci-jobs.ts +515 -0
  121. package/src/cli/flush.ts +44 -0
  122. package/src/cli/handlers/approve.ts +618 -0
  123. package/src/cli/handlers/operator.ts +10 -608
  124. package/src/cli/handlers/override-approve.test.ts +1 -1
  125. package/src/cli/handlers/override-approve.ts +1 -1
  126. package/src/cli/main.ts +5 -816
  127. package/src/cli/parse-args.ts +781 -0
  128. package/src/components/fan-out-record.ts +3 -7
  129. package/src/components/fan-out-run.ts +7 -5
  130. package/src/components/pr-pipeline.ts +3 -2
  131. package/src/composite.ts +15 -3
  132. package/src/discovery/collect.ts +15 -1
  133. package/src/discovery/fold-build-parity.test.ts +71 -0
  134. package/src/discovery/fold-import.ts +2 -113
  135. package/src/discovery/fold-project-provenance.test.ts +21 -4
  136. package/src/discovery/host-composite.ts +101 -0
  137. package/src/discovery/index.ts +11 -1
  138. package/src/gate-decision-bundle.test.ts +6 -4
  139. package/src/gate-decision-identity.test.ts +59 -6
  140. package/src/gate-decision.ts +81 -21
  141. package/src/gated-waves.ts +28 -6
  142. package/src/lifecycle/gate-audit.test.ts +55 -1
  143. package/src/lifecycle/gate-audit.ts +116 -3
  144. package/src/lifecycle/gate-ledger.test.ts +20 -1
  145. package/src/lifecycle/gate-ledger.ts +33 -1
  146. package/src/op/activities/activity-contracts.ts +1 -1
  147. package/src/op/activities/change-set.ts +11 -3
  148. package/src/op/activities/lexicon-upgrade.test.ts +2 -0
  149. package/src/op/activities/reconcile.test.ts +62 -2
  150. package/src/op/activities/reconcile.ts +46 -22
  151. package/src/op/builders.ts +1 -1
  152. package/src/op/op-waves-run.ts +9 -9
  153. package/src/op/op-waves.test.ts +2 -0
  154. package/src/op/op-waves.ts +4 -8
  155. package/src/op/work-lease-run.test.ts +12 -4
  156. package/src/package-version.ts +11 -0
  157. package/src/wave-engine.test.ts +107 -0
  158. package/src/wave-engine.ts +98 -0
  159. package/src/wave-layout.ts +44 -0
  160. package/src/wave-runtime-bundle.test.ts +70 -0
  161. package/src/wave-runtime.e2e.test.ts +177 -0
  162. package/src/wave-runtime.ts +104 -0
  163. package/src/workspace/__fixtures__/contract-repo.ts +17 -1
  164. package/src/workspace/__fixtures__/sessions.ts +3 -3
  165. package/src/workspace/ajv2020.ts +17 -0
  166. package/src/workspace/change-set.schema.json +5 -3
  167. package/src/workspace/ci-green-workflow.test.ts +4 -4
  168. package/src/workspace/ci-green-workflow.ts +5 -2
  169. package/src/workspace/class-data.test.ts +64 -0
  170. package/src/workspace/class-data.ts +236 -0
  171. package/src/workspace/declaration.ts +4 -10
  172. package/src/workspace/kinds.ts +8 -40
  173. package/src/workspace/points.ts +2 -5
  174. package/src/workspace/principal-classes.ts +13 -99
  175. package/src/workspace/records-formats.test.ts +7 -2
  176. package/src/workspace/records-sessions-write.test.ts +3 -3
  177. package/src/workspace/status-contract.e2e.test.ts +37 -0
  178. package/src/workspace/status-contract.test.ts +23 -21
@@ -12,7 +12,7 @@
12
12
  import { cpSync, readFileSync, writeFileSync } from "node:fs";
13
13
  import { join } from "node:path";
14
14
  import { afterAll, describe, expect, test } from "vitest";
15
- import { cleanScratch, commitAll, contract, git, REPO, scratchDir } from "./__fixtures__/contract-repo";
15
+ import { cleanScratch, commitAll, contract, git, REPO, repoFixture, scratchDir } from "./__fixtures__/contract-repo";
16
16
  import { declareSessions, DECISIONS_KIND, newSessionFields, sessionsRepo, SESSIONS_KIND } from "./__fixtures__/sessions";
17
17
  import { sessionSeal } from "./record-sessions";
18
18
  import { parseFrontMatter, recordTextDigest } from "./records";
@@ -36,12 +36,12 @@ const code = (doc: object) => ("error" in doc ? (doc as { error: { code: string
36
36
  const HEX = /^[0-9a-f]{40}$/;
37
37
 
38
38
  /** The reference fixture with a declaration, committed. */
39
- function declared(): string {
39
+ const declared = repoFixture(() => {
40
40
  const root = sessionsRepo();
41
41
  declareSessions(root);
42
42
  commitAll(root, "declare");
43
43
  return root;
44
- }
44
+ });
45
45
 
46
46
  function front(root: string, path: string): Record<string, unknown> {
47
47
  const fm = parseFrontMatter(readFileSync(join(root, path), "utf-8"));
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The chant repo's own workspace declaration reads through
3
+ * `chant workspace status` and validates against the output schema (#2557).
4
+ * It reads the real checkout, 28 members and a git call or more for each,
5
+ * which is 5 to 9 s: split from status-contract.test.ts so the unit budget
6
+ * keeps to fixtures built here (#3880).
7
+ */
8
+
9
+ import { join } from "node:path";
10
+ import Ajv2020 from "ajv/dist/2020";
11
+ import { describe, expect, test } from "vitest";
12
+ import { listWorkspace } from "./ls";
13
+ import { workspaceStatus, type StatusDocument } from "./status";
14
+ import schema from "./status.schema.json";
15
+
16
+ const REPO = join(import.meta.dirname, "..", "..", "..", "..");
17
+ const validate = new Ajv2020({ strict: true, allErrors: true }).compile(schema);
18
+
19
+ function expectValid(doc: StatusDocument): void {
20
+ expect(validate(doc), JSON.stringify(validate.errors, null, 2)).toBe(true);
21
+ }
22
+
23
+ function result(doc: StatusDocument): Extract<StatusDocument, { members: unknown }> {
24
+ if ("error" in doc) throw new Error(`${doc.error.code}: ${doc.error.message}`);
25
+ return doc;
26
+ }
27
+
28
+ describe("the chant repo's own declaration", () => {
29
+ test("validates and lists every declared member", async () => {
30
+ const doc = result(await workspaceStatus({ cwd: join(REPO, "packages", "core"), env: "prod", compareTo: "staging" }));
31
+ expectValid(doc);
32
+ expect(doc.workspace).toMatchObject({ name: "chant", root: ".", file: "chant.workspace.json" });
33
+ const ls = listWorkspace({ cwd: REPO });
34
+ if ("error" in ls) throw new Error(ls.error.message);
35
+ expect(doc.members.map((m) => m.name)).toEqual(ls.members.map((m) => m.name));
36
+ });
37
+ });
@@ -7,13 +7,12 @@
7
7
  */
8
8
 
9
9
  import { execFileSync } from "node:child_process";
10
- import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
10
+ import { cpSync, mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
11
11
  import { tmpdir } from "node:os";
12
12
  import { dirname, join } from "node:path";
13
13
  import Ajv2020 from "ajv/dist/2020";
14
14
  import { afterAll, describe, expect, test, vi } from "vitest";
15
15
  import type { CommandContext } from "../cli/registry";
16
- import { listWorkspace } from "./ls";
17
16
  import {
18
17
  formatStatus,
19
18
  runWorkspaceStatus,
@@ -35,8 +34,6 @@ import { runOpLocally } from "../op/local-executor";
35
34
  import { shellCmd } from "../op/activities/shell";
36
35
  import type { OpConfig } from "../op/types";
37
36
 
38
- const REPO = join(import.meta.dirname, "..", "..", "..", "..");
39
-
40
37
  const ajv = new Ajv2020({ strict: true, allErrors: true });
41
38
  const validate = ajv.compile(schema);
42
39
 
@@ -98,6 +95,22 @@ function lifecycle(root: string, files: Record<string, string>): string {
98
95
  return commit;
99
96
  }
100
97
 
98
+ /**
99
+ * Build a fixture repository once and hand each caller its own copy. A repo
100
+ * costs a dozen git processes; a file copy costs none, and a test may write
101
+ * to its copy without touching the next test's.
102
+ */
103
+ function fixture(build: () => string): () => string {
104
+ let template: string | undefined;
105
+ return () => {
106
+ template ??= build();
107
+ const root = realpathSync(mkdtempSync(join(tmpdir(), "chant-status-")));
108
+ scratch.push(root);
109
+ cpSync(template, root, { recursive: true });
110
+ return root;
111
+ };
112
+ }
113
+
101
114
  let n = 0;
102
115
  /** One ledger line. */
103
116
  function release(component: string, env: string, digest: string, gitSha: string, extra: Record<string, string> = {}): string {
@@ -121,7 +134,7 @@ const D = (c: string) => `sha256:${c.repeat(64)}`;
121
134
  const declaration = (members: unknown[]) => JSON.stringify({ name: "acme", schema: 1, members }, null, 2);
122
135
 
123
136
  /** web has moved to _members/ (#2538); api and the root member still read the flat ledger. */
124
- function twoLayouts(): string {
137
+ const twoLayouts = fixture(() => {
125
138
  const root = repo({
126
139
  "chant.workspace.json": declaration([
127
140
  { name: "site", dir: ".", kind: "other", because: "the root project" },
@@ -142,7 +155,7 @@ function twoLayouts(): string {
142
155
  "prod/releases.jsonl": jsonl(release("api", "prod", D("c"), "c".repeat(40))),
143
156
  });
144
157
  return root;
145
- }
158
+ });
146
159
 
147
160
  describe("status output schema", () => {
148
161
  test("is a valid draft 2020-12 document with the published $id", () => {
@@ -412,7 +425,7 @@ const NOW = "2026-09-24T00:00:00.000Z";
412
425
  * Each gate is in one state: approved, pending with part of a quorum,
413
426
  * expired, superseded, and an Op gate that records no environment.
414
427
  */
415
- function gated(): string {
428
+ const gated = fixture(() => {
416
429
  const root = twoLayouts();
417
430
  lifecycle(root, {
418
431
  "_members/web/staging/releases.jsonl": jsonl(release("web", "staging", D("a"), "a".repeat(40))),
@@ -437,7 +450,7 @@ function gated(): string {
437
450
  "_gates/nightly.jsonl": jsonl(pending("nightly", "confirm", "2026-09-23T00:00:00.000Z"), approval("nightly", "confirm", "dave", "2026-09-23T01:00:00.000Z")),
438
451
  });
439
452
  return root;
440
- }
453
+ });
441
454
 
442
455
  describe("gate state in chant workspace status --json (#2674)", () => {
443
456
  test("each member lists its gates with state, approvals, quorum and the approve line", async () => {
@@ -570,7 +583,7 @@ describe("stewards in chant workspace status --json (#2731)", () => {
570
583
  });
571
584
 
572
585
  /** A box member declaring one steward, local by default and fountain on fountain-k3d. */
573
- function stewarded(): string {
586
+ const stewarded = fixture(() => {
574
587
  const steward = {
575
588
  kind: "Chant::Steward",
576
589
  name: "box-steward",
@@ -594,7 +607,7 @@ describe("stewards in chant workspace status --json (#2731)", () => {
594
607
  });
595
608
  lifecycle(root, { "README": "ledger\n" });
596
609
  return root;
597
- }
610
+ });
598
611
 
599
612
  test("names the steward, its form in the environment asked for, its Ops, schedules, last runs and lease", async () => {
600
613
  const root = stewarded();
@@ -754,14 +767,3 @@ describe("stewards in chant workspace status --json (#2731)", () => {
754
767
  expect(doc.members[0].stewardReasons.map((r) => r.code)).toEqual(["stewards-unreadable"]);
755
768
  });
756
769
  });
757
-
758
- describe("chant workspace status on the chant repo (#2557)", () => {
759
- test("validates and lists every declared member", async () => {
760
- const doc = result(await workspaceStatus({ cwd: join(REPO, "packages", "core"), env: "prod", compareTo: "staging" }));
761
- expectValid(doc);
762
- expect(doc.workspace).toMatchObject({ name: "chant", root: ".", file: "chant.workspace.json" });
763
- const ls = listWorkspace({ cwd: REPO });
764
- if ("error" in ls) throw new Error(ls.error.message);
765
- expect(doc.members.map((m) => m.name)).toEqual(ls.members.map((m) => m.name));
766
- });
767
- });