@intentius/chant 0.124.30 → 0.124.32
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/bin/chant +7 -2
- package/dist/cli/commands/check-lexicon-plugin.d.ts +7 -4
- package/dist/cli/commands/check-lexicon-plugin.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon-plugin.js +10 -7
- package/dist/cli/commands/check-lexicon.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon.js +18 -12
- package/dist/cli/commands/import.d.ts +10 -0
- package/dist/cli/commands/import.d.ts.map +1 -1
- package/dist/cli/commands/import.js +37 -0
- package/dist/cli/commands/init-lexicon/templates/project.d.ts.map +1 -1
- package/dist/cli/commands/init-lexicon/templates/project.js +4 -3
- package/dist/cli/commands/onboard.d.ts.map +1 -1
- package/dist/cli/commands/onboard.js +8 -4
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +2 -1
- package/dist/cli/dependencies.d.ts +18 -0
- package/dist/cli/dependencies.d.ts.map +1 -0
- package/dist/cli/dependencies.js +120 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +23 -4
- package/dist/cli/handlers/fan-out.d.ts.map +1 -1
- package/dist/cli/handlers/fan-out.js +12 -4
- package/dist/cli/handlers/graph.d.ts.map +1 -1
- package/dist/cli/handlers/graph.js +16 -6
- package/dist/cli/handlers/lint.d.ts.map +1 -1
- package/dist/cli/handlers/lint.js +6 -0
- package/dist/cli/handlers/operator.d.ts +2 -2
- package/dist/cli/handlers/operator.js +3 -3
- package/dist/cli/handlers/pr.d.ts +14 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +488 -32
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +3 -1
- package/dist/cli/handlers/run.d.ts +13 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +38 -15
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +74 -12
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +65 -0
- package/dist/cli/registry.d.ts +29 -2
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cli/registry.js +6 -2
- package/dist/codegen/generate-post-synth-barrel.js +2 -2
- package/dist/codegen/lexicon-regen.d.ts +4 -0
- package/dist/codegen/lexicon-regen.d.ts.map +1 -1
- package/dist/codegen/lexicon-regen.js +1 -1
- package/dist/codegen/pinned-upgrade.js +2 -2
- package/dist/components/capability.d.ts +44 -3
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +21 -0
- package/dist/components/changed-files.d.ts +7 -1
- package/dist/components/changed-files.d.ts.map +1 -1
- package/dist/components/changed-files.js +9 -1
- package/dist/components/driver.d.ts +38 -0
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +47 -6
- package/dist/components/fan-out-record.d.ts +6 -1
- package/dist/components/fan-out-record.d.ts.map +1 -1
- package/dist/components/fan-out-record.js +24 -0
- package/dist/components/fan-out-run.d.ts +20 -0
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +21 -1
- package/dist/components/pr-pipeline.d.ts +65 -2
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +107 -15
- package/dist/components/pr-run.d.ts +127 -29
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +290 -70
- package/dist/components/wave-plan.d.ts +5 -2
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +12 -1
- package/dist/discovery/fold-import.d.ts.map +1 -1
- package/dist/discovery/fold-import.js +16 -6
- package/dist/discovery/sandbox/bundle.d.ts.map +1 -1
- package/dist/discovery/sandbox/bundle.js +6 -0
- package/dist/discovery/specifier-resolve.d.ts.map +1 -1
- package/dist/discovery/specifier-resolve.js +8 -2
- package/dist/fold/fold.d.ts.map +1 -1
- package/dist/fold/fold.js +68 -1
- package/dist/fold/subset.d.ts +37 -0
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/fold/subset.js +88 -0
- package/dist/lexicon-module.d.ts +10 -0
- package/dist/lexicon-module.d.ts.map +1 -1
- package/dist/lexicon-module.js +53 -8
- package/dist/lexicon-plugin-helpers.d.ts.map +1 -1
- package/dist/lexicon-plugin-helpers.js +6 -4
- package/dist/lexicon.d.ts +2 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/affected.d.ts.map +1 -1
- package/dist/lifecycle/affected.js +7 -1
- package/dist/lifecycle/release-ledger.d.ts +21 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +24 -0
- package/dist/lifecycle/work-dir.d.ts +45 -0
- package/dist/lifecycle/work-dir.d.ts.map +1 -0
- package/dist/lifecycle/work-dir.js +78 -0
- package/dist/lint/discover.d.ts +17 -9
- package/dist/lint/discover.d.ts.map +1 -1
- package/dist/lint/discover.js +62 -54
- package/dist/module-source.d.ts +57 -0
- package/dist/module-source.d.ts.map +1 -0
- package/dist/module-source.js +104 -0
- package/dist/op/activities/factory.js +1 -1
- package/dist/op/discover.d.ts.map +1 -1
- package/dist/op/discover.js +13 -3
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +3 -0
- package/dist/op/local-executor.d.ts +12 -0
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +22 -3
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +20 -5
- package/dist/op/operator.d.ts +2 -2
- package/dist/op/operator.js +2 -2
- package/dist/op/redact.d.ts +34 -0
- package/dist/op/redact.d.ts.map +1 -0
- package/dist/op/redact.js +94 -0
- package/dist/op/step-console.d.ts +2 -0
- package/dist/op/step-console.d.ts.map +1 -1
- package/dist/op/step-console.js +5 -2
- package/dist/op/steward.d.ts +6 -4
- package/dist/op/steward.d.ts.map +1 -1
- package/dist/op/steward.js +5 -3
- package/dist/op/work-lease-run.d.ts +20 -7
- package/dist/op/work-lease-run.d.ts.map +1 -1
- package/dist/op/work-lease-run.js +56 -12
- package/dist/pr-forge.d.ts +27 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +51 -6
- package/dist/pr-loop.d.ts +141 -4
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +122 -6
- package/dist/pr-report-url.d.ts +10 -2
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +52 -6
- package/dist/ts-loader.d.ts +38 -4
- package/dist/ts-loader.d.ts.map +1 -1
- package/dist/ts-loader.js +190 -16
- package/dist/wave-runtime.mjs +208 -208
- package/dist/workspace/chant-migrations/fountain-retired-kinds.d.ts +34 -0
- package/dist/workspace/chant-migrations/fountain-retired-kinds.d.ts.map +1 -0
- package/dist/workspace/chant-migrations/fountain-retired-kinds.js +176 -0
- package/dist/workspace/chant-migrations.d.ts.map +1 -1
- package/dist/workspace/chant-migrations.js +2 -0
- package/dist/workspace/checks/boxes.d.ts +6 -6
- package/dist/workspace/checks/boxes.js +9 -9
- package/dist/workspace/ci-green-forge.d.ts +6 -4
- package/dist/workspace/ci-green-forge.d.ts.map +1 -1
- package/dist/workspace/ci-green.d.ts +28 -12
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +49 -21
- package/dist/workspace/ci-list.schema.json +12 -6
- package/dist/workspace/ci-report-url.d.ts +18 -0
- package/dist/workspace/ci-report-url.d.ts.map +1 -0
- package/dist/workspace/ci-report-url.js +33 -0
- package/dist/workspace/ci-run-index.d.ts +108 -0
- package/dist/workspace/ci-run-index.d.ts.map +1 -0
- package/dist/workspace/ci-run-index.js +164 -0
- package/dist/workspace/ci-run-index.schema.json +52 -0
- package/dist/workspace/ci-run.d.ts +159 -9
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +419 -50
- package/dist/workspace/ci-runner-key.d.ts +133 -0
- package/dist/workspace/ci-runner-key.d.ts.map +1 -0
- package/dist/workspace/ci-runner-key.js +237 -0
- package/dist/workspace/ci-secrets.d.ts +65 -0
- package/dist/workspace/ci-secrets.d.ts.map +1 -0
- package/dist/workspace/ci-secrets.js +211 -0
- package/dist/workspace/ci-serve.d.ts +67 -4
- package/dist/workspace/ci-serve.d.ts.map +1 -1
- package/dist/workspace/ci-serve.js +240 -35
- package/dist/workspace/declaration.d.ts +8 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +11 -2
- package/dist/workspace/declaration.schema.json +7 -2
- package/dist/workspace/export.d.ts +1 -1
- package/dist/workspace/export.d.ts.map +1 -1
- package/dist/workspace/export.js +7 -3
- package/dist/workspace/ls.d.ts +6 -1
- package/dist/workspace/ls.d.ts.map +1 -1
- package/dist/workspace/ls.js +1 -0
- package/dist/workspace/ls.schema.json +7 -1
- package/dist/workspace/pin-integrity.d.ts.map +1 -1
- package/dist/workspace/pin-integrity.js +3 -2
- package/dist/workspace/pr-report.schema.json +74 -7
- package/dist/workspace/reason-codes.d.ts +7 -3
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +9 -4
- package/dist/workspace/run-event.schema.json +3 -1
- package/dist/workspace/status.schema.json +3 -1
- package/dist/workspace/trust/trust-write.d.ts +109 -0
- package/dist/workspace/trust/trust-write.d.ts.map +1 -0
- package/dist/workspace/trust/trust-write.js +320 -0
- package/dist/workspace/trust-write.schema.json +265 -0
- package/dist/workspace/write-scope.d.ts +9 -0
- package/dist/workspace/write-scope.d.ts.map +1 -1
- package/dist/workspace/write-scope.js +11 -1
- package/package.json +1 -1
- package/src/__fixtures__/pr-loop/pr-apply-wave-waiting.note.golden.md +48 -0
- package/src/cli/commands/__fixtures__/init-lexicon-output/package.json +3 -3
- package/src/cli/commands/audit.test.ts +2 -2
- package/src/cli/commands/check-lexicon-plugin.test.ts +9 -0
- package/src/cli/commands/check-lexicon-plugin.ts +11 -8
- package/src/cli/commands/check-lexicon.test.ts +1 -1
- package/src/cli/commands/check-lexicon.ts +16 -11
- package/src/cli/commands/import.ts +40 -0
- package/src/cli/commands/init-lexicon/templates/project.ts +4 -3
- package/src/cli/commands/init-lexicon.test.ts +8 -5
- package/src/cli/commands/onboard.test.ts +45 -0
- package/src/cli/commands/onboard.ts +8 -4
- package/src/cli/commands/update.test.ts +6 -0
- package/src/cli/commands/update.ts +4 -1
- package/src/cli/compiled-cli.e2e.test.ts +76 -11
- package/src/cli/dependencies.e2e.test.ts +101 -0
- package/src/cli/dependencies.test.ts +93 -0
- package/src/cli/dependencies.ts +122 -0
- package/src/cli/handlers/build.test.ts +69 -0
- package/src/cli/handlers/build.ts +20 -4
- package/src/cli/handlers/fan-out.test.ts +73 -0
- package/src/cli/handlers/fan-out.ts +11 -4
- package/src/cli/handlers/graph.test.ts +76 -0
- package/src/cli/handlers/graph.ts +19 -12
- package/src/cli/handlers/lint.test.ts +42 -0
- package/src/cli/handlers/lint.ts +6 -0
- package/src/cli/handlers/operator.ts +3 -3
- package/src/cli/handlers/pr-waves.test.ts +449 -0
- package/src/cli/handlers/pr.test.ts +134 -0
- package/src/cli/handlers/pr.ts +523 -31
- package/src/cli/handlers/promote.test.ts +26 -1
- package/src/cli/handlers/promote.ts +3 -2
- package/src/cli/handlers/run-components-exit.test.ts +99 -0
- package/src/cli/handlers/run-signer.test.ts +79 -0
- package/src/cli/handlers/run.ts +34 -16
- package/src/cli/main.test.ts +19 -0
- package/src/cli/main.ts +73 -12
- package/src/cli/parse-args.ts +48 -0
- package/src/cli/registry.ts +35 -4
- package/src/codegen/generate-post-synth-barrel.ts +2 -2
- package/src/codegen/lexicon-regen.ts +1 -1
- package/src/codegen/pinned-upgrade.ts +2 -2
- package/src/codegen/post-synth-barrel-guards.test.ts +6 -11
- package/src/components/capability.ts +51 -3
- package/src/components/changed-files.test.ts +16 -1
- package/src/components/changed-files.ts +9 -1
- package/src/components/driver.test.ts +36 -1
- package/src/components/driver.ts +76 -4
- package/src/components/fan-out-record.ts +29 -1
- package/src/components/fan-out-run.test.ts +35 -0
- package/src/components/fan-out-run.ts +40 -1
- package/src/components/pr-pipeline.test.ts +100 -0
- package/src/components/pr-pipeline.ts +132 -17
- package/src/components/pr-run.test.ts +323 -18
- package/src/components/pr-run.ts +354 -75
- package/src/components/wave-plan.ts +16 -4
- package/src/discovery/fold-host-method.test.ts +87 -0
- package/src/discovery/fold-import.ts +15 -5
- package/src/discovery/fold-package-composite.test.ts +27 -0
- package/src/discovery/fold-specifiers.test.ts +8 -0
- package/src/discovery/sandbox/bundle.ts +6 -0
- package/src/discovery/specifier-resolve.ts +8 -2
- package/src/fold/fold.test.ts +72 -0
- package/src/fold/fold.ts +71 -0
- package/src/fold/subset.test.ts +31 -0
- package/src/fold/subset.ts +99 -0
- package/src/lexicon-dist.e2e.test.ts +254 -0
- package/src/lexicon-module.test.ts +47 -0
- package/src/lexicon-module.ts +49 -7
- package/src/lexicon-plugin-helpers.ts +6 -4
- package/src/lexicon.ts +2 -0
- package/src/lifecycle/affected.test.ts +7 -0
- package/src/lifecycle/affected.ts +6 -1
- package/src/lifecycle/release-ledger.ts +34 -0
- package/src/lifecycle/work-dir.test.ts +77 -0
- package/src/lifecycle/work-dir.ts +82 -0
- package/src/lint/discover.test.ts +46 -2
- package/src/lint/discover.ts +55 -49
- package/src/module-source.test.ts +85 -0
- package/src/module-source.ts +112 -0
- package/src/op/activities/factory.ts +1 -1
- package/src/op/discover-root.test.ts +31 -2
- package/src/op/discover.ts +14 -4
- package/src/op/gate.test.ts +30 -0
- package/src/op/gate.ts +3 -0
- package/src/op/local-executor.ts +31 -3
- package/src/op/op-waves-run.ts +20 -5
- package/src/op/op-waves.test.ts +49 -0
- package/src/op/operator.ts +2 -2
- package/src/op/redact.ts +93 -0
- package/src/op/step-console.ts +7 -2
- package/src/op/steward.ts +6 -4
- package/src/op/work-lease-run.test.ts +88 -2
- package/src/op/work-lease-run.ts +52 -12
- package/src/pr-forge-bundle.test.ts +2 -2
- package/src/pr-forge.test.ts +71 -0
- package/src/pr-forge.ts +70 -6
- package/src/pr-loop-bundle.test.ts +2 -1
- package/src/pr-loop.test.ts +117 -1
- package/src/pr-loop.ts +252 -10
- package/src/pr-report-url.ts +58 -6
- package/src/terraform/__fixtures__/advise.test.ts +21 -2
- package/src/ts-loader.test.ts +89 -1
- package/src/ts-loader.ts +180 -13
- package/src/workspace/changes.test.ts +1 -1
- package/src/workspace/chant-migrations/fountain-retired-kinds.test.ts +33 -0
- package/src/workspace/chant-migrations/fountain-retired-kinds.ts +190 -0
- package/src/workspace/chant-migrations.e2e.test.ts +5 -0
- package/src/workspace/chant-migrations.ts +2 -0
- package/src/workspace/checks/boxes.ts +9 -9
- package/src/workspace/ci-green-forge.ts +6 -4
- package/src/workspace/ci-green-runs.test.ts +53 -11
- package/src/workspace/ci-green.test.ts +1 -1
- package/src/workspace/ci-green.ts +50 -22
- package/src/workspace/ci-list.schema.json +12 -6
- package/src/workspace/ci-report-url.test.ts +220 -0
- package/src/workspace/ci-report-url.ts +33 -0
- package/src/workspace/ci-run-index.schema.json +52 -0
- package/src/workspace/ci-run-index.test.ts +392 -0
- package/src/workspace/ci-run-index.ts +206 -0
- package/src/workspace/ci-run.test.ts +520 -42
- package/src/workspace/ci-run.ts +483 -51
- package/src/workspace/ci-runner-key.test.ts +204 -0
- package/src/workspace/ci-runner-key.ts +275 -0
- package/src/workspace/ci-secrets.test.ts +106 -0
- package/src/workspace/ci-secrets.ts +213 -0
- package/src/workspace/ci-serve.test.ts +282 -39
- package/src/workspace/ci-serve.ts +231 -34
- package/src/workspace/declaration.schema.json +7 -2
- package/src/workspace/declaration.test.ts +23 -0
- package/src/workspace/declaration.ts +19 -3
- package/src/workspace/export.ts +6 -3
- package/src/workspace/ls.schema.json +7 -1
- package/src/workspace/ls.ts +7 -2
- package/src/workspace/pin-integrity.test.ts +5 -0
- package/src/workspace/pin-integrity.ts +3 -2
- package/src/workspace/pr-report.schema.json +74 -7
- package/src/workspace/reason-codes.test.ts +2 -0
- package/src/workspace/reason-codes.ts +9 -4
- package/src/workspace/run-event.schema.json +3 -1
- package/src/workspace/status.schema.json +3 -1
- package/src/workspace/trust/trust-write.test.ts +179 -0
- package/src/workspace/trust/trust-write.ts +377 -0
- package/src/workspace/trust-write.schema.json +265 -0
- package/src/workspace/write-scope.test.ts +29 -1
- package/src/workspace/write-scope.ts +12 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fountain-retired-kinds` (#3987, managoat/managoat#2793): take a project's
|
|
3
|
+
* fountain declarations off the kinds Managoat v0.29.0 removed.
|
|
4
|
+
*
|
|
5
|
+
* Managoat dropped the team, its schedules, webhooks and persistent
|
|
6
|
+
* sandboxes. Since #3987 the fountain lexicon keeps `Teammate`, `Schedule`
|
|
7
|
+
* and `Webhook` only as stubs, and FTN025 fails a build that declares one, or
|
|
8
|
+
* an Agent with `sandbox_mode: "persistent"`. chud's template (and the studio
|
|
9
|
+
* kit's copy of it) declares a Teammate and a Schedule for its night shift
|
|
10
|
+
* and its factory, and gives the dispatcher a persistent sandbox, so a repo
|
|
11
|
+
* migrated off chud stopped building with chant 0.124.32.
|
|
12
|
+
*
|
|
13
|
+
* In each `chant` member, every `.ts` file that imports the fountain lexicon
|
|
14
|
+
* loses its `new Teammate(...)`, `new Schedule(...)` and `new Webhook(...)`
|
|
15
|
+
* declarations, those names from the import, any one-line constant only they
|
|
16
|
+
* used, and `sandbox_mode: "persistent"`. Each removed Schedule is listed as
|
|
17
|
+
* not moved: its clock now lives outside Managoat. A removed declaration whose
|
|
18
|
+
* name the file still uses elsewhere is a conflict, as is a file that still
|
|
19
|
+
* names a retired kind after the edits.
|
|
20
|
+
*
|
|
21
|
+
* The plan is empty once no fountain file declares a retired kind.
|
|
22
|
+
*/
|
|
23
|
+
import type { ChantMigration, NotMoved } from "../chant-migrations.js";
|
|
24
|
+
export declare const FOUNTAIN_RETIRED_KINDS = "fountain-retired-kinds";
|
|
25
|
+
interface Rewrite {
|
|
26
|
+
text: string;
|
|
27
|
+
notMoved: NotMoved[];
|
|
28
|
+
conflict?: string;
|
|
29
|
+
}
|
|
30
|
+
/** The file without its retired declarations, or null when it has none. */
|
|
31
|
+
export declare function rewriteFountainFile(path: string, original: string): Rewrite | null;
|
|
32
|
+
export declare const fountainRetiredKinds: ChantMigration;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=fountain-retired-kinds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fountain-retired-kinds.d.ts","sourceRoot":"","sources":["../../../src/workspace/chant-migrations/fountain-retired-kinds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAA6C,QAAQ,EAA+B,MAAM,qBAAqB,CAAC;AAG5I,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AA2D/D,UAAU,OAAO;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CA8ClF;AA6CD,eAAO,MAAM,oBAAoB,EAAE,cAIlC,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fountain-retired-kinds` (#3987, managoat/managoat#2793): take a project's
|
|
3
|
+
* fountain declarations off the kinds Managoat v0.29.0 removed.
|
|
4
|
+
*
|
|
5
|
+
* Managoat dropped the team, its schedules, webhooks and persistent
|
|
6
|
+
* sandboxes. Since #3987 the fountain lexicon keeps `Teammate`, `Schedule`
|
|
7
|
+
* and `Webhook` only as stubs, and FTN025 fails a build that declares one, or
|
|
8
|
+
* an Agent with `sandbox_mode: "persistent"`. chud's template (and the studio
|
|
9
|
+
* kit's copy of it) declares a Teammate and a Schedule for its night shift
|
|
10
|
+
* and its factory, and gives the dispatcher a persistent sandbox, so a repo
|
|
11
|
+
* migrated off chud stopped building with chant 0.124.32.
|
|
12
|
+
*
|
|
13
|
+
* In each `chant` member, every `.ts` file that imports the fountain lexicon
|
|
14
|
+
* loses its `new Teammate(...)`, `new Schedule(...)` and `new Webhook(...)`
|
|
15
|
+
* declarations, those names from the import, any one-line constant only they
|
|
16
|
+
* used, and `sandbox_mode: "persistent"`. Each removed Schedule is listed as
|
|
17
|
+
* not moved: its clock now lives outside Managoat. A removed declaration whose
|
|
18
|
+
* name the file still uses elsewhere is a conflict, as is a file that still
|
|
19
|
+
* names a retired kind after the edits.
|
|
20
|
+
*
|
|
21
|
+
* The plan is empty once no fountain file declares a retired kind.
|
|
22
|
+
*/
|
|
23
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
24
|
+
import { join, posix } from "node:path";
|
|
25
|
+
import { applyEdits, readText } from "./chud-lexicon-exit.js";
|
|
26
|
+
export const FOUNTAIN_RETIRED_KINDS = "fountain-retired-kinds";
|
|
27
|
+
const DESCRIPTION = "drop the fountain kinds Managoat removed: Teammate, Schedule, Webhook and persistent sandboxes (#3987)";
|
|
28
|
+
const FOUNTAIN = "@intentius/chant-lexicon-fountain";
|
|
29
|
+
const RETIRED = ["Teammate", "Schedule", "Webhook"];
|
|
30
|
+
const IMPORT = /import\s*\{([^}]*)\}\s*from\s*"@intentius\/chant-lexicon-fountain";/;
|
|
31
|
+
/** A top-level declaration of a retired kind, with the doc comment just above it. */
|
|
32
|
+
const DECLARATION = /(?:\/\*\*(?:(?!\*\/)[\s\S])*\*\/\n)?export const (\w+) = new (Teammate|Schedule|Webhook)\(\{\n[\s\S]*?\n\}\);\n(?:\n)?/g;
|
|
33
|
+
const PERSISTENT = /^[ \t]*sandbox_mode:\s*"persistent",?[ \t]*\n/gm;
|
|
34
|
+
/** The template's prose about what the edits remove. */
|
|
35
|
+
const TEMPLATE_PROSE = [
|
|
36
|
+
{
|
|
37
|
+
find: " * build by this name (CHUD_FOUNTAIN_VAULT overrides it), and the two\n * Teammates below run with it.\n",
|
|
38
|
+
replace: " * build by this name (CHUD_FOUNTAIN_VAULT overrides it).\n",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
find: " * Steward does: a persistent sandbox (its checkout survives a turn) and no\n" +
|
|
42
|
+
" * permission prompts (nobody is at the keyboard; chant's own gates still need\n" +
|
|
43
|
+
" * a person). Its Teammate gives it one thread, so two schedule fires never\n" +
|
|
44
|
+
" * run two dispatchers on one checkout, and the Schedule is what triggers it.\n",
|
|
45
|
+
replace: " * Steward does, with no permission prompts (nobody is at the keyboard;\n" +
|
|
46
|
+
" * chant's own gates still need a person). Managoat has no team or scheduler\n" +
|
|
47
|
+
" * any more: a clock outside it runs `chant run dispatch --on fountain`.\n",
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
/** The README row `chud-lexicon-exit` wrote, which names the factory's Schedule. */
|
|
51
|
+
const README_EDITS = [
|
|
52
|
+
{ find: " (the agents that build the app, as fountain specs; its factory Schedule still calls the kit's dispatch Op)", replace: " (the agents that build the app, as fountain specs)" },
|
|
53
|
+
];
|
|
54
|
+
function tsFiles(dir, rel = "", out = []) {
|
|
55
|
+
let entries;
|
|
56
|
+
try {
|
|
57
|
+
entries = readdirSync(join(dir, rel), { withFileTypes: true });
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
for (const e of entries) {
|
|
63
|
+
const path = rel ? posix.join(rel, e.name) : e.name;
|
|
64
|
+
if (e.isDirectory()) {
|
|
65
|
+
if (e.name === "node_modules" || e.name === "dist" || e.name.startsWith("."))
|
|
66
|
+
continue;
|
|
67
|
+
tsFiles(dir, path, out);
|
|
68
|
+
}
|
|
69
|
+
else if (e.name.endsWith(".ts") && !e.name.endsWith(".d.ts")) {
|
|
70
|
+
out.push(path);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
/** The text with its comments and string contents blanked, so prose naming a kind is not a use of it. */
|
|
76
|
+
const code = (text) => text.replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`/g, '""');
|
|
77
|
+
const uses = (text, name) => new RegExp(`(?<![\\w$.])${name}(?![\\w$])`).test(code(text));
|
|
78
|
+
/** The file without its retired declarations, or null when it has none. */
|
|
79
|
+
export function rewriteFountainFile(path, original) {
|
|
80
|
+
const imported = original.match(IMPORT);
|
|
81
|
+
if (!imported)
|
|
82
|
+
return null;
|
|
83
|
+
const declared = [...original.matchAll(DECLARATION)];
|
|
84
|
+
const persistent = PERSISTENT.test(original);
|
|
85
|
+
PERSISTENT.lastIndex = 0;
|
|
86
|
+
if (declared.length === 0 && !persistent)
|
|
87
|
+
return null;
|
|
88
|
+
const notMoved = [];
|
|
89
|
+
let text = original;
|
|
90
|
+
const removed = [];
|
|
91
|
+
const referenced = new Set();
|
|
92
|
+
for (const [block, name, kind] of declared) {
|
|
93
|
+
text = text.replace(block, "");
|
|
94
|
+
removed.push(name);
|
|
95
|
+
const body = block.slice(block.indexOf("new "));
|
|
96
|
+
for (const id of body.match(/\b[a-zA-Z_$][\w$]*\b/g) ?? [])
|
|
97
|
+
referenced.add(id);
|
|
98
|
+
if (kind === "Schedule") {
|
|
99
|
+
const cron = body.match(/cron:\s*"([^"]+)"/)?.[1];
|
|
100
|
+
notMoved.push({
|
|
101
|
+
what: `the Schedule ${name}${cron ? ` (cron "${cron}")` : ""} in ${path}`,
|
|
102
|
+
where: "a clock outside Managoat, which has no scheduler: a CI schedule or a CronJob running `chant run <op> --on fountain`, or `chant operator --steward`",
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else if (kind === "Webhook") {
|
|
106
|
+
notMoved.push({ what: `the Webhook ${name} in ${path}`, where: "nothing: read a run's outcome from `chant run status` or `log`, or the conversation's event stream" });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
text = text.replace(PERSISTENT, "");
|
|
110
|
+
// A one-line constant only the removed declarations used (the template's `nightlyMeta`).
|
|
111
|
+
for (const id of referenced) {
|
|
112
|
+
const line = new RegExp(`^export const ${id} = [^\\n]*;\\n\\n?`, "m");
|
|
113
|
+
const hit = text.match(line);
|
|
114
|
+
if (hit && !uses(text.replace(hit[0], ""), id))
|
|
115
|
+
text = text.replace(hit[0], "");
|
|
116
|
+
}
|
|
117
|
+
const names = imported[1].split(",").map((n) => n.trim()).filter(Boolean);
|
|
118
|
+
const kept = names.filter((n) => !RETIRED.includes(n) || uses(text.replace(IMPORT, ""), n));
|
|
119
|
+
if (kept.length !== names.length)
|
|
120
|
+
text = text.replace(IMPORT, `import { ${kept.join(", ")} } from "${FOUNTAIN}";`);
|
|
121
|
+
text = applyEdits(text, TEMPLATE_PROSE).text.replace(/\n{3,}/g, "\n\n").replace(/\n+$/, "\n");
|
|
122
|
+
const dangling = removed.filter((n) => uses(text, n));
|
|
123
|
+
if (dangling.length > 0)
|
|
124
|
+
return { text, notMoved, conflict: `${dangling.join(", ")} ${dangling.length === 1 ? "is" : "are"} still used after the retired declarations go. Remove ${dangling.length === 1 ? "that use" : "those uses"} by hand, then run the upgrade again` };
|
|
125
|
+
const still = RETIRED.filter((k) => new RegExp(`\\bnew ${k}\\(`).test(text));
|
|
126
|
+
if (still.length > 0)
|
|
127
|
+
return { text, notMoved, conflict: `a ${still.join(", ")} declaration this migration cannot read. Remove it by hand, then run the upgrade again` };
|
|
128
|
+
return { text, notMoved };
|
|
129
|
+
}
|
|
130
|
+
function planRetiredKinds(ctx) {
|
|
131
|
+
const { dir } = ctx;
|
|
132
|
+
let decl = null;
|
|
133
|
+
try {
|
|
134
|
+
decl = JSON.parse(readText(dir, "chant.workspace.json") ?? "null");
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
decl = null;
|
|
138
|
+
}
|
|
139
|
+
const members = (decl?.members ?? []).filter((m) => m.kind === "chant" && m.dir).map((m) => posix.normalize(m.dir));
|
|
140
|
+
if (members.length === 0 && existsSync(join(dir, "chant.config.ts")))
|
|
141
|
+
members.push(".");
|
|
142
|
+
const changes = [];
|
|
143
|
+
const notMoved = [];
|
|
144
|
+
const conflicts = [];
|
|
145
|
+
for (const member of members) {
|
|
146
|
+
for (const rel of tsFiles(join(dir, member))) {
|
|
147
|
+
const path = posix.join(member, rel);
|
|
148
|
+
const text = readText(dir, path);
|
|
149
|
+
if (text === undefined || !text.includes(FOUNTAIN))
|
|
150
|
+
continue;
|
|
151
|
+
const rewrite = rewriteFountainFile(path, text);
|
|
152
|
+
if (!rewrite)
|
|
153
|
+
continue;
|
|
154
|
+
if (rewrite.conflict) {
|
|
155
|
+
conflicts.push({ path, reason: rewrite.conflict });
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
changes.push({ path, action: "write", why: "no Teammate, Schedule, Webhook or persistent sandbox, which Managoat removed and FTN025 fails", data: Buffer.from(rewrite.text) });
|
|
159
|
+
notMoved.push(...rewrite.notMoved);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (changes.length === 0 && conflicts.length === 0)
|
|
163
|
+
return null;
|
|
164
|
+
const readme = readText(dir, "README.md");
|
|
165
|
+
if (readme !== undefined && conflicts.length === 0) {
|
|
166
|
+
const edited = applyEdits(readme, README_EDITS).text;
|
|
167
|
+
if (edited !== readme)
|
|
168
|
+
changes.push({ path: "README.md", action: "write", why: "the agents no longer declare a factory Schedule", data: Buffer.from(edited) });
|
|
169
|
+
}
|
|
170
|
+
return { id: FOUNTAIN_RETIRED_KINDS, description: DESCRIPTION, changes, notMoved, conflicts };
|
|
171
|
+
}
|
|
172
|
+
export const fountainRetiredKinds = {
|
|
173
|
+
id: FOUNTAIN_RETIRED_KINDS,
|
|
174
|
+
description: DESCRIPTION,
|
|
175
|
+
plan: planRetiredKinds,
|
|
176
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chant-migrations.d.ts","sourceRoot":"","sources":["../../src/workspace/chant-migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"chant-migrations.d.ts","sourceRoot":"","sources":["../../src/workspace/chant-migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAS9C,gEAAgE;AAChE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC3B,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qGAAqG;IACrG,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,qEAAqE;AACrE,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,kEAA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Policy } from "./chant-migrations/chud-lexicon-exit-ship-policy.js";
|
|
41
41
|
import { chudLexiconExitFlySite } from "./chant-migrations/chud-lexicon-exit-fly-site.js";
|
|
42
42
|
import { chudLexiconExitLiveNames } from "./chant-migrations/chud-lexicon-exit-live-names.js";
|
|
43
|
+
import { fountainRetiredKinds } from "./chant-migrations/fountain-retired-kinds.js";
|
|
43
44
|
/** Every migration chant ships, in the order they are planned. */
|
|
44
45
|
export const CHANT_MIGRATIONS = [
|
|
45
46
|
chudLexiconExit,
|
|
@@ -48,6 +49,7 @@ export const CHANT_MIGRATIONS = [
|
|
|
48
49
|
chudLexiconExitShipPolicy,
|
|
49
50
|
chudLexiconExitFlySite,
|
|
50
51
|
chudLexiconExitLiveNames,
|
|
52
|
+
fountainRetiredKinds,
|
|
51
53
|
];
|
|
52
54
|
/** The plans for a scope: each migration not yet in the lineage that finds something to move. */
|
|
53
55
|
export function planChantMigrations(ctx, migrations = CHANT_MIGRATIONS) {
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
* listed here after these two.
|
|
29
29
|
*
|
|
30
30
|
* WSP125 (`box-fountain-callback-undeclared`, #2780) is the one credential a
|
|
31
|
-
* box gets without asking. fountain
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* has to say so: the capability `fountain-callback`, brokered by `fountain`,
|
|
31
|
+
* box gets without asking. fountain gives every sandbox a callback token
|
|
32
|
+
* scoped to its owner (`FOUNTAIN_TOKEN`, `sandbox_api_access: owner`) unless
|
|
33
|
+
* its conversation asks for none, and a fountain `Box` runs with it, so its
|
|
34
|
+
* member's block has to say so: the capability `fountain-callback`, brokered by `fountain`,
|
|
35
35
|
* with scope `owner`. It is named apart from `fountain`, the API access a
|
|
36
36
|
* lobby may broker for the same box. A member builds a Box when one of its TypeScript or JavaScript files
|
|
37
37
|
* imports `Box` from `@intentius/chant-lexicon-fountain` and calls it, read as
|
|
38
|
-
* syntax and never run. Upstream, managoat/fountain#2497
|
|
39
|
-
* a
|
|
38
|
+
* syntax and never run. Upstream, managoat/fountain#2497 asked for a way to run
|
|
39
|
+
* a box's agent with no callback token.
|
|
40
40
|
*
|
|
41
41
|
* WSP126 (`box-intent-unknown`) and WSP127 (`box-intent-unconstrained`), #2850,
|
|
42
42
|
* read the decision record a box block names as its intent (`box-intent.ts`).
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
* listed here after these two.
|
|
29
29
|
*
|
|
30
30
|
* WSP125 (`box-fountain-callback-undeclared`, #2780) is the one credential a
|
|
31
|
-
* box gets without asking. fountain
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* has to say so: the capability `fountain-callback`, brokered by `fountain`,
|
|
31
|
+
* box gets without asking. fountain gives every sandbox a callback token
|
|
32
|
+
* scoped to its owner (`FOUNTAIN_TOKEN`, `sandbox_api_access: owner`) unless
|
|
33
|
+
* its conversation asks for none, and a fountain `Box` runs with it, so its
|
|
34
|
+
* member's block has to say so: the capability `fountain-callback`, brokered by `fountain`,
|
|
35
35
|
* with scope `owner`. It is named apart from `fountain`, the API access a
|
|
36
36
|
* lobby may broker for the same box. A member builds a Box when one of its TypeScript or JavaScript files
|
|
37
37
|
* imports `Box` from `@intentius/chant-lexicon-fountain` and calls it, read as
|
|
38
|
-
* syntax and never run. Upstream, managoat/fountain#2497
|
|
39
|
-
* a
|
|
38
|
+
* syntax and never run. Upstream, managoat/fountain#2497 asked for a way to run
|
|
39
|
+
* a box's agent with no callback token.
|
|
40
40
|
*
|
|
41
41
|
* WSP126 (`box-intent-unknown`) and WSP127 (`box-intent-unconstrained`), #2850,
|
|
42
42
|
* read the decision record a box block names as its intent (`box-intent.ts`).
|
|
@@ -68,7 +68,7 @@ export const WSP_BOX_UNBROKERED = "WSP122";
|
|
|
68
68
|
export const WSP_BOX_FOUNTAIN_CALLBACK = "WSP125";
|
|
69
69
|
export const WSP_BOX_INTENT_UNKNOWN = "WSP126";
|
|
70
70
|
export const WSP_BOX_INTENT_UNCONSTRAINED = "WSP127";
|
|
71
|
-
/** The fountain lexicon's package, whose `Box` composite
|
|
71
|
+
/** The fountain lexicon's package, whose `Box` composite declares a box's agent. */
|
|
72
72
|
const FOUNTAIN_LEXICON = "@intentius/chant-lexicon-fountain";
|
|
73
73
|
/**
|
|
74
74
|
* The capability a box block declares for fountain's callback token (#2780).
|
|
@@ -379,7 +379,7 @@ export const BOX_CHECKS = [
|
|
|
379
379
|
{
|
|
380
380
|
id: WSP_BOX_FOUNTAIN_CALLBACK,
|
|
381
381
|
name: "box-fountain-callback-undeclared",
|
|
382
|
-
description: "A box member that builds a fountain Box declares the callback token fountain gives its
|
|
382
|
+
description: "A box member that builds a fountain Box declares the callback token fountain gives its sandbox: the fountain-callback capability, brokered by fountain, with scope owner.",
|
|
383
383
|
severity: "error",
|
|
384
384
|
configurable: true,
|
|
385
385
|
check(ctx) {
|
|
@@ -424,7 +424,7 @@ export const BOX_CHECKS = [
|
|
|
424
424
|
checkId: this.id,
|
|
425
425
|
severity: this.severity,
|
|
426
426
|
code: "box-fountain-callback-undeclared",
|
|
427
|
-
message: `box-fountain-callback-undeclared: member ${m.name} builds a fountain Box (${at.path}), and fountain
|
|
427
|
+
message: `box-fountain-callback-undeclared: member ${m.name} builds a fountain Box (${at.path}), and fountain gives a box's sandbox ` +
|
|
428
428
|
`a callback token scoped to its owner (FOUNTAIN_TOKEN); ${why}. Declare ${expected} in the box block ` +
|
|
429
429
|
`(managoat/fountain#2497 tracks running without it)`,
|
|
430
430
|
entity: m.name,
|
|
@@ -30,8 +30,8 @@ export interface CheckRun {
|
|
|
30
30
|
url: string | null;
|
|
31
31
|
/**
|
|
32
32
|
* Set when the "check run" is a chant Op run (#4044, `ci.green.source:
|
|
33
|
-
* "runs"`): the run's id and env, the runner whose statement it
|
|
34
|
-
*
|
|
33
|
+
* "runs"`): the run's id and env, and the runner whose statement it
|
|
34
|
+
* carries with that statement, or a null signer for an unsigned run. `name` is then the Op's name and `id` the run's end
|
|
35
35
|
* time in milliseconds, which orders a re-run after the run it replaced.
|
|
36
36
|
*/
|
|
37
37
|
opRun?: OpRunRef;
|
|
@@ -42,8 +42,10 @@ export interface CheckRun {
|
|
|
42
42
|
export interface OpRunRef {
|
|
43
43
|
id: string;
|
|
44
44
|
env: string;
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
/** The runner whose statement the run carries, or null for an unsigned run, which counts unless `ci.green.signedSince` asks for one (#4156). */
|
|
46
|
+
signer: string | null;
|
|
47
|
+
/** The run's statement, when it has one. */
|
|
48
|
+
statement?: NonNullable<OpRunRecord["statement"]>;
|
|
47
49
|
}
|
|
48
50
|
export interface CiForge {
|
|
49
51
|
kind: ForgeKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-green-forge.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-green-forge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAwC,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,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;IACnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,6GAA6G;IAC7G,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wDAAwD;AACxD,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
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,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,EAKvB;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"}
|
|
@@ -41,12 +41,16 @@
|
|
|
41
41
|
* pipelines run as chant Ops, such as one on GitLab or Forgejo, gets green
|
|
42
42
|
* and revoked tags with no forge check runs. A phase's patterns then match
|
|
43
43
|
* Op names, a run counts for the commit its record names as `gitSha`, and
|
|
44
|
-
* the latest run of each Op decides, by its end time.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
44
|
+
* the latest run of each Op decides, by its end time. Signing is opt-in
|
|
45
|
+
* (#4156): an unsigned run counts, with no signer, and a run whose statement
|
|
46
|
+
* a runner key holding the `runner` role at base signed counts with that
|
|
47
|
+
* signer (`./trust/op-run-statement.ts`). A run whose statement is there and
|
|
48
|
+
* does not verify is ignored and reported, so it neither greens nor revokes
|
|
49
|
+
* a commit. With `ci.green.signedSince`, an unsigned run counts only on a
|
|
50
|
+
* strict first-parent ancestor of that commit, as an unsigned tag does. A
|
|
51
|
+
* tick given a runner key signs the tags it makes, and each run in the
|
|
52
|
+
* tag's record names the Op run's id and carries its statement when it has
|
|
53
|
+
* one.
|
|
50
54
|
*/
|
|
51
55
|
import { type CommitLink } from "./commit-links.js";
|
|
52
56
|
import { type CiGreen, type CiPhase, type CiSource } from "./declaration.js";
|
|
@@ -206,6 +210,14 @@ export declare function unsignedHistory(top: string, signedSince: string): Set<s
|
|
|
206
210
|
* `declaration-invalid` when `signedSince` names no commit here.
|
|
207
211
|
*/
|
|
208
212
|
export declare function readCiTags(top: string, green?: CiGreen | null, base?: string | null): CiTags;
|
|
213
|
+
/**
|
|
214
|
+
* Whether the workspace at `cwd` requires signed runs (#4156): its
|
|
215
|
+
* `ci.green.signedSince`, or null when it sets none, declares no
|
|
216
|
+
* `ci.green`, or has no declaration chant can read. Signing is opt-in, so
|
|
217
|
+
* only this makes `ci serve` refuse to start without a trusted runner key
|
|
218
|
+
* and `ci run` and `chant run` warn about a run they leave unsigned.
|
|
219
|
+
*/
|
|
220
|
+
export declare function signedRunsRequired(cwd: string): string | null;
|
|
209
221
|
export interface TickRequest {
|
|
210
222
|
cwd: string;
|
|
211
223
|
/**
|
|
@@ -256,7 +268,7 @@ export declare function ciTagSigner(top: string, base: string, pem: string, what
|
|
|
256
268
|
export declare function ciTick(req: TickRequest): Promise<TickResult>;
|
|
257
269
|
/** The Op runs on the ledger, judged, as check runs by commit. */
|
|
258
270
|
export interface OpRunSource {
|
|
259
|
-
/** The
|
|
271
|
+
/** The runs on `sha` that count, each as a check run named for its Op. */
|
|
260
272
|
checkRuns(sha: string): CheckRun[];
|
|
261
273
|
/** The runs on each commit that do not count, by commit. */
|
|
262
274
|
ignored: Map<string, IgnoredOpRun[]>;
|
|
@@ -267,14 +279,18 @@ export interface OpRunSource {
|
|
|
267
279
|
* going. The id is the run's end time in milliseconds, so the latest run of
|
|
268
280
|
* an Op is its latest attempt.
|
|
269
281
|
*/
|
|
270
|
-
export declare function opRunCheckRun(record: OpRunRecord, signer: string): CheckRun;
|
|
282
|
+
export declare function opRunCheckRun(record: OpRunRecord, signer: string | null): CheckRun;
|
|
271
283
|
/**
|
|
272
284
|
* Judge every Op run record that names a commit against `.chant/trust.json`
|
|
273
285
|
* at `base` (#4044), from the run ledger the project at `cwd` writes to. A
|
|
274
|
-
* record with a valid statement becomes a check run on its `gitSha
|
|
275
|
-
*
|
|
286
|
+
* record with a valid statement becomes a check run on its `gitSha` with
|
|
287
|
+
* its signer, and an unsigned one becomes a check run with signer null
|
|
288
|
+
* (#4156). A record whose statement does not verify is kept as an ignored
|
|
289
|
+
* run. With `signedSince` (`ci.green.signedSince`) an unsigned record counts
|
|
290
|
+
* only on a strict first-parent ancestor of that commit, and is ignored
|
|
291
|
+
* elsewhere. Reads local refs only.
|
|
276
292
|
*/
|
|
277
|
-
export declare function readOpRunSource(cwd: string, top: string, base: string): Promise<OpRunSource>;
|
|
293
|
+
export declare function readOpRunSource(cwd: string, top: string, base: string, signedSince?: string | null): Promise<OpRunSource>;
|
|
278
294
|
/**
|
|
279
295
|
* What `chant run <op> --key` signs a run's record with (#4044): the runner
|
|
280
296
|
* key `.chant/trust.json` at the checkout's `HEAD` lists for a principal
|
|
@@ -351,7 +367,7 @@ export interface CiListRun {
|
|
|
351
367
|
opRun?: {
|
|
352
368
|
id: string;
|
|
353
369
|
env: string;
|
|
354
|
-
signer: string;
|
|
370
|
+
signer: string | null;
|
|
355
371
|
};
|
|
356
372
|
}
|
|
357
373
|
export interface CiListPhase {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-green.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-green.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ci-green.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-green.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAA6C,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5F,OAAO,EAA6E,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrJ,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAUjD,OAAO,EAA6D,KAAK,YA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AY,CAAC,SAAS,CAAC,CAAC,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,YAAY,GAAG,cAAc,CAE3E;AAYD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iGAAiG;IACjG,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CA4DtE;AAED,4DAA4D;AAC5D,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,CAUnF"}
|
|
@@ -41,12 +41,16 @@
|
|
|
41
41
|
* pipelines run as chant Ops, such as one on GitLab or Forgejo, gets green
|
|
42
42
|
* and revoked tags with no forge check runs. A phase's patterns then match
|
|
43
43
|
* Op names, a run counts for the commit its record names as `gitSha`, and
|
|
44
|
-
* the latest run of each Op decides, by its end time.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
44
|
+
* the latest run of each Op decides, by its end time. Signing is opt-in
|
|
45
|
+
* (#4156): an unsigned run counts, with no signer, and a run whose statement
|
|
46
|
+
* a runner key holding the `runner` role at base signed counts with that
|
|
47
|
+
* signer (`./trust/op-run-statement.ts`). A run whose statement is there and
|
|
48
|
+
* does not verify is ignored and reported, so it neither greens nor revokes
|
|
49
|
+
* a commit. With `ci.green.signedSince`, an unsigned run counts only on a
|
|
50
|
+
* strict first-parent ancestor of that commit, as an unsigned tag does. A
|
|
51
|
+
* tick given a runner key signs the tags it makes, and each run in the
|
|
52
|
+
* tag's record names the Op run's id and carries its statement when it has
|
|
53
|
+
* one.
|
|
50
54
|
*/
|
|
51
55
|
import { judgeCommits, mergeCommits, readWorkIndex } from "./commit-links.js";
|
|
52
56
|
import { execFileSync } from "node:child_process";
|
|
@@ -143,7 +147,7 @@ export function windowMs(window) {
|
|
|
143
147
|
* names the Op run's id, env and signer, and carries the run's statement.
|
|
144
148
|
*/
|
|
145
149
|
const runRecord = (r) => r.opRun
|
|
146
|
-
? { name: r.name, id: null, conclusion: r.conclusion, url: r.url, opRun: { id: r.opRun.id, env: r.opRun.env, signer: r.opRun.signer, statement: r.opRun.statement } }
|
|
150
|
+
? { name: r.name, id: null, conclusion: r.conclusion, url: r.url, opRun: { id: r.opRun.id, env: r.opRun.env, signer: r.opRun.signer, ...(r.opRun.statement ? { statement: r.opRun.statement } : {}) } }
|
|
147
151
|
: { name: r.name, id: r.id, conclusion: r.conclusion, url: r.url };
|
|
148
152
|
/** `source: "runs"` on a record made from chant runs (#4044); nothing for check runs, so their records read as before. */
|
|
149
153
|
const sourceField = (green) => (green.source === "runs" ? { source: "runs" } : {});
|
|
@@ -303,6 +307,21 @@ export function readCiTags(top, green = null, base = null) {
|
|
|
303
307
|
}
|
|
304
308
|
return out;
|
|
305
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Whether the workspace at `cwd` requires signed runs (#4156): its
|
|
312
|
+
* `ci.green.signedSince`, or null when it sets none, declares no
|
|
313
|
+
* `ci.green`, or has no declaration chant can read. Signing is opt-in, so
|
|
314
|
+
* only this makes `ci serve` refuse to start without a trusted runner key
|
|
315
|
+
* and `ci run` and `chant run` warn about a run they leave unsigned.
|
|
316
|
+
*/
|
|
317
|
+
export function signedRunsRequired(cwd) {
|
|
318
|
+
try {
|
|
319
|
+
return readDeclaration(locateWorkspace(cwd).tree).ci?.green?.signedSince ?? null;
|
|
320
|
+
}
|
|
321
|
+
catch {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
306
325
|
/** The declaration's `ci.green`, read where `cwd` is, and the git top. */
|
|
307
326
|
function readGreen(cwd) {
|
|
308
327
|
const located = locateWorkspace(cwd);
|
|
@@ -376,9 +395,6 @@ export async function ciTick(req) {
|
|
|
376
395
|
if (green.signedSince && req.runnerKey === undefined && !req.dryRun) {
|
|
377
396
|
throw new Error(`ci.green.signedSince is ${green.signedSince}, so every tag the tick makes needs a statement signed by a runner key, and none was given: pass --key <runner key.pem> or set CHANT_RUNNER_KEY`);
|
|
378
397
|
}
|
|
379
|
-
if (green.source === "runs" && req.runnerKey === undefined && !req.dryRun) {
|
|
380
|
-
throw new Error("the tick reads chant runs (source runs), and every tag it makes from them is signed by a runner key, and none was given: pass --key <runner key.pem> or set CHANT_RUNNER_KEY");
|
|
381
|
-
}
|
|
382
398
|
const signer = req.runnerKey !== undefined ? ciTagSigner(top, base, req.runnerKey) : undefined;
|
|
383
399
|
const links = await commitLinks(req.cwd, top, tracking, commits.map((c) => c.sha));
|
|
384
400
|
const tags = readCiTags(top, green, base);
|
|
@@ -389,7 +405,7 @@ export async function ciTick(req) {
|
|
|
389
405
|
if (fetched.status === "diverged" || fetched.status === "unreachable") {
|
|
390
406
|
throw new Error(`could not fetch chant/lifecycle, where the Op runs are recorded, from ${fetched.remote}: ${fetched.status === "diverged" ? "the local branch and the remote's have diverged" : fetched.stderr}`);
|
|
391
407
|
}
|
|
392
|
-
runs = await readOpRunSource(req.cwd, top, base);
|
|
408
|
+
runs = await readOpRunSource(req.cwd, top, base, green.signedSince);
|
|
393
409
|
}
|
|
394
410
|
const planned = await planTick({
|
|
395
411
|
green,
|
|
@@ -445,18 +461,23 @@ export function opRunCheckRun(record, signer) {
|
|
|
445
461
|
conclusion: settled ? (record.status === "ok" ? "success" : "failure") : null,
|
|
446
462
|
completedAt: settled ? record.ended : null,
|
|
447
463
|
url: record.runOrigin?.url ?? null,
|
|
448
|
-
opRun: { id: record.id, env: record.env, signer, statement: record.statement },
|
|
464
|
+
opRun: { id: record.id, env: record.env, signer, ...(signer !== null && record.statement ? { statement: record.statement } : {}) },
|
|
449
465
|
...(record.status === "fail" && record.failure ? { failureCode: record.failure.code } : {}),
|
|
450
466
|
};
|
|
451
467
|
}
|
|
452
468
|
/**
|
|
453
469
|
* Judge every Op run record that names a commit against `.chant/trust.json`
|
|
454
470
|
* at `base` (#4044), from the run ledger the project at `cwd` writes to. A
|
|
455
|
-
* record with a valid statement becomes a check run on its `gitSha
|
|
456
|
-
*
|
|
471
|
+
* record with a valid statement becomes a check run on its `gitSha` with
|
|
472
|
+
* its signer, and an unsigned one becomes a check run with signer null
|
|
473
|
+
* (#4156). A record whose statement does not verify is kept as an ignored
|
|
474
|
+
* run. With `signedSince` (`ci.green.signedSince`) an unsigned record counts
|
|
475
|
+
* only on a strict first-parent ancestor of that commit, and is ignored
|
|
476
|
+
* elsewhere. Reads local refs only.
|
|
457
477
|
*/
|
|
458
|
-
export async function readOpRunSource(cwd, top, base) {
|
|
478
|
+
export async function readOpRunSource(cwd, top, base, signedSince = null) {
|
|
459
479
|
const policy = readTrustPolicy(gitRevisionSource(top, base), base);
|
|
480
|
+
const before = signedSince ? unsignedHistory(top, signedSince) : null;
|
|
460
481
|
const byCommit = new Map();
|
|
461
482
|
const ignored = new Map();
|
|
462
483
|
for (const env of await listLedgerTrees({ cwd })) {
|
|
@@ -468,11 +489,17 @@ export async function readOpRunSource(cwd, top, base) {
|
|
|
468
489
|
for (const record of records) {
|
|
469
490
|
if (!record.gitSha)
|
|
470
491
|
continue;
|
|
492
|
+
// #4161: a job `ci run --local` ran stays on the machine that ran it, and is never CI's verdict.
|
|
493
|
+
if (record.runOrigin?.forge === "local")
|
|
494
|
+
continue;
|
|
471
495
|
const v = verifyOpRunStatement(record, policy.runners, policy.roles);
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
496
|
+
const counts = v.status === "signed" || (v.status === "unsigned" && (before === null || before.has(record.gitSha)));
|
|
497
|
+
if (counts)
|
|
498
|
+
byCommit.set(record.gitSha, [...(byCommit.get(record.gitSha) ?? []), opRunCheckRun(record, v.status === "signed" ? v.signer : null)]);
|
|
499
|
+
else {
|
|
500
|
+
const reason = v.status === "unsigned" ? `${v.reason}; ci.green.signedSince is ${signedSince}, so a run on a commit that is not a strict first-parent ancestor of it needs one` : v.reason;
|
|
501
|
+
ignored.set(record.gitSha, [...(ignored.get(record.gitSha) ?? []), { run: record.id, op: record.op, env: record.env, status: v.status, reason }]);
|
|
502
|
+
}
|
|
476
503
|
}
|
|
477
504
|
}
|
|
478
505
|
}
|
|
@@ -637,7 +664,8 @@ const asRun = (r) => {
|
|
|
637
664
|
if (typeof o.name !== "string")
|
|
638
665
|
return null;
|
|
639
666
|
const op = o.opRun;
|
|
640
|
-
const
|
|
667
|
+
const signer = op && typeof op === "object" ? (typeof op.signer === "string" ? op.signer : op.signer === null ? null : undefined) : undefined;
|
|
668
|
+
const opRun = op && typeof op === "object" && typeof op.id === "string" && typeof op.env === "string" && signer !== undefined ? { opRun: { id: op.id, env: op.env, signer } } : {};
|
|
641
669
|
return { name: o.name, id: typeof o.id === "number" ? o.id : null, conclusion: typeof o.conclusion === "string" ? o.conclusion : null, url: typeof o.url === "string" ? o.url : null, ...opRun };
|
|
642
670
|
};
|
|
643
671
|
/**
|
|
@@ -693,7 +721,7 @@ export async function ciList(req) {
|
|
|
693
721
|
const source = req.source ?? green.source;
|
|
694
722
|
if (source === "runs" && req.forge)
|
|
695
723
|
throw new Error("--forge reads check runs, and the source is chant runs (ci.green.source or --source runs); drop one");
|
|
696
|
-
const runs = source === "runs" ? await readOpRunSource(req.cwd, top, base) : undefined;
|
|
724
|
+
const runs = source === "runs" ? await readOpRunSource(req.cwd, top, base, green.signedSince) : undefined;
|
|
697
725
|
const out = [];
|
|
698
726
|
for (const c of commits) {
|
|
699
727
|
const g = tags.green.get(c.sha);
|