@intentius/chant 0.49.0 → 0.50.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/audit/catalog.d.ts +13 -3
- package/dist/audit/catalog.d.ts.map +1 -1
- package/dist/audit/core.d.ts +9 -0
- package/dist/audit/core.d.ts.map +1 -1
- package/dist/audit/discover.d.ts +6 -0
- package/dist/audit/discover.d.ts.map +1 -1
- package/dist/audit/fetch.d.ts.map +1 -1
- package/dist/audit/report-html.d.ts.map +1 -1
- package/dist/audit/report-model.d.ts +6 -0
- package/dist/audit/report-model.d.ts.map +1 -1
- package/dist/audit/report.d.ts.map +1 -1
- package/dist/audit/rules-doc.d.ts.map +1 -1
- package/dist/audit/secrets.d.ts +95 -0
- package/dist/audit/secrets.d.ts.map +1 -0
- package/dist/audit/wrangler.d.ts +33 -0
- package/dist/audit/wrangler.d.ts.map +1 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/cli/commands/audit.d.ts +7 -0
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/build.d.ts +23 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/components.d.ts +31 -0
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.d.ts +11 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/operator.d.ts +32 -0
- package/dist/cli/handlers/operator.d.ts.map +1 -0
- package/dist/cli/handlers/scenario.d.ts +39 -0
- package/dist/cli/handlers/scenario.d.ts.map +1 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/mcp/server.d.ts +35 -2
- package/dist/cli/mcp/server.d.ts.map +1 -1
- package/dist/cli/mcp/types.d.ts +29 -1
- package/dist/cli/mcp/types.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +14 -2
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/codegen/docs-rule-scanning.d.ts.map +1 -1
- package/dist/components/capability.d.ts +17 -2
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +7 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/component.d.ts +15 -0
- package/dist/components/component.d.ts.map +1 -1
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/verbs/index.d.ts +6 -1
- package/dist/components/verbs/index.d.ts.map +1 -1
- package/dist/components/verbs/run-agent.d.ts +499 -0
- package/dist/components/verbs/run-agent.d.ts.map +1 -0
- package/dist/components/verbs/sign.d.ts +30 -0
- package/dist/components/verbs/sign.d.ts.map +1 -1
- package/dist/composite.d.ts +6 -1
- package/dist/composite.d.ts.map +1 -1
- package/dist/discovery/collect.d.ts.map +1 -1
- package/dist/discovery/fold-import.d.ts +15 -1
- package/dist/discovery/fold-import.d.ts.map +1 -1
- package/dist/discovery/fold-rank.d.ts +66 -0
- package/dist/discovery/fold-rank.d.ts.map +1 -0
- package/dist/discovery/index.d.ts +15 -0
- package/dist/discovery/index.d.ts.map +1 -1
- package/dist/discovery/param-deps.d.ts +17 -0
- package/dist/discovery/param-deps.d.ts.map +1 -0
- package/dist/fold/fold.d.ts +55 -2
- package/dist/fold/fold.d.ts.map +1 -1
- package/dist/fold/subset.d.ts +21 -14
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/lexicon-schema.d.ts +2 -0
- package/dist/lexicon-schema.d.ts.map +1 -1
- package/dist/lexicon.d.ts +93 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/converge-ledger.d.ts +90 -0
- package/dist/lifecycle/converge-ledger.d.ts.map +1 -0
- package/dist/lifecycle/deep-diff.d.ts +18 -0
- package/dist/lifecycle/deep-diff.d.ts.map +1 -1
- package/dist/lifecycle/deep-observe.d.ts +9 -1
- package/dist/lifecycle/deep-observe.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +33 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -0
- package/dist/lifecycle/git.d.ts +145 -21
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/index.d.ts +4 -0
- package/dist/lifecycle/index.d.ts.map +1 -1
- package/dist/lifecycle/lease.d.ts +113 -0
- package/dist/lifecycle/lease.d.ts.map +1 -0
- package/dist/lifecycle/scenario-eval.d.ts +42 -0
- package/dist/lifecycle/scenario-eval.d.ts.map +1 -0
- package/dist/lifecycle/scenario.d.ts +163 -0
- package/dist/lifecycle/scenario.d.ts.map +1 -0
- package/dist/lifecycle/symptoms.d.ts +63 -0
- package/dist/lifecycle/symptoms.d.ts.map +1 -0
- package/dist/lint/output-docs.d.ts +94 -0
- package/dist/lint/output-docs.d.ts.map +1 -0
- package/dist/lint/post-synth.d.ts +29 -0
- package/dist/lint/post-synth.d.ts.map +1 -1
- package/dist/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.d.ts +11 -0
- package/dist/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.d.ts.map +1 -0
- package/dist/lsp/lexicon-providers.d.ts +7 -0
- package/dist/lsp/lexicon-providers.d.ts.map +1 -1
- package/dist/op/activity-contract.d.ts +139 -0
- package/dist/op/activity-contract.d.ts.map +1 -0
- package/dist/op/builders.d.ts +42 -2
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/op/converge-rule.d.ts +161 -0
- package/dist/op/converge-rule.d.ts.map +1 -0
- package/dist/op/generate-pipeline.d.ts +39 -0
- package/dist/op/generate-pipeline.d.ts.map +1 -0
- package/dist/op/index.d.ts +14 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/op-verb-class.d.ts +42 -0
- package/dist/op/op-verb-class.d.ts.map +1 -0
- package/dist/op/operator.d.ts +128 -0
- package/dist/op/operator.d.ts.map +1 -0
- package/dist/op/step-output-ref.d.ts +187 -0
- package/dist/op/step-output-ref.d.ts.map +1 -0
- package/dist/op/types.d.ts +18 -1
- package/dist/op/types.d.ts.map +1 -1
- package/dist/provenance.d.ts +73 -3
- package/dist/provenance.d.ts.map +1 -1
- package/dist/runtime-adapter.d.ts +7 -1
- package/dist/runtime-adapter.d.ts.map +1 -1
- package/dist/serializer.d.ts +18 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/toml.d.ts +40 -5
- package/dist/toml.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/audit/catalog.test.ts +1 -1
- package/src/audit/catalog.ts +75 -3
- package/src/audit/core.ts +9 -0
- package/src/audit/discover.ts +29 -2
- package/src/audit/fetch.test.ts +216 -3
- package/src/audit/fetch.ts +270 -59
- package/src/audit/report-html.ts +5 -2
- package/src/audit/report-model.ts +9 -0
- package/src/audit/report.test.ts +22 -0
- package/src/audit/report.ts +3 -2
- package/src/audit/rules-doc.ts +2 -0
- package/src/audit/secrets.test.ts +303 -0
- package/src/audit/secrets.ts +406 -0
- package/src/audit/wrangler.test.ts +230 -0
- package/src/audit/wrangler.ts +290 -0
- package/src/build.ts +8 -3
- package/src/cli/command-group.ts +1 -1
- package/src/cli/commands/__fixtures__/schemas/sarif-2.1.0.schema.json +2882 -0
- package/src/cli/commands/audit.test.ts +215 -1
- package/src/cli/commands/audit.ts +86 -17
- package/src/cli/commands/build.test.ts +167 -2
- package/src/cli/commands/build.ts +114 -23
- package/src/cli/handlers/build.ts +2 -0
- package/src/cli/handlers/components.test.ts +199 -1
- package/src/cli/handlers/components.ts +160 -3
- package/src/cli/handlers/graph.test.ts +20 -0
- package/src/cli/handlers/graph.ts +10 -1
- package/src/cli/handlers/lifecycle.ts +12 -4
- package/src/cli/handlers/operator.test.ts +255 -0
- package/src/cli/handlers/operator.ts +240 -0
- package/src/cli/handlers/scenario.test.ts +456 -0
- package/src/cli/handlers/scenario.ts +330 -0
- package/src/cli/main.test.ts +23 -0
- package/src/cli/main.ts +72 -1
- package/src/cli/mcp/server.test.ts +265 -2
- package/src/cli/mcp/server.ts +84 -7
- package/src/cli/mcp/types.ts +27 -1
- package/src/cli/registry.ts +14 -2
- package/src/codegen/docs-rule-scanning.test.ts +42 -0
- package/src/codegen/docs-rule-scanning.ts +25 -2
- package/src/components/README.md +7 -0
- package/src/components/capability.ts +17 -2
- package/src/components/cli-support.test.ts +17 -0
- package/src/components/cli-support.ts +13 -1
- package/src/components/component-schema.test.ts +32 -0
- package/src/components/component.schema.json +6 -0
- package/src/components/component.test.ts +21 -0
- package/src/components/component.ts +15 -0
- package/src/components/driver.ts +12 -4
- package/src/components/verbs/index.ts +6 -1
- package/src/components/verbs/run-agent.test.ts +683 -0
- package/src/components/verbs/run-agent.ts +786 -0
- package/src/components/verbs/sign.test.ts +19 -0
- package/src/components/verbs/sign.ts +34 -2
- package/src/composite.ts +31 -2
- package/src/discovery/collect.ts +11 -2
- package/src/discovery/fold-import.test.ts +54 -0
- package/src/discovery/fold-import.ts +178 -38
- package/src/discovery/fold-rank.test.ts +197 -0
- package/src/discovery/fold-rank.ts +346 -0
- package/src/discovery/index.ts +16 -1
- package/src/discovery/param-deps.test.ts +118 -0
- package/src/discovery/param-deps.ts +170 -0
- package/src/fold/fold.test.ts +6 -2
- package/src/fold/fold.ts +184 -3
- package/src/fold/subset.test.ts +82 -19
- package/src/fold/subset.ts +79 -41
- package/src/lexicon-schema.ts +3 -0
- package/src/lexicon.ts +103 -2
- package/src/lifecycle/converge-ledger.test.ts +199 -0
- package/src/lifecycle/converge-ledger.ts +179 -0
- package/src/lifecycle/deep-diff.test.ts +79 -1
- package/src/lifecycle/deep-diff.ts +23 -0
- package/src/lifecycle/deep-observe.ts +13 -2
- package/src/lifecycle/gate-ledger.test.ts +103 -0
- package/src/lifecycle/gate-ledger.ts +140 -0
- package/src/lifecycle/git.test.ts +430 -0
- package/src/lifecycle/git.ts +446 -84
- package/src/lifecycle/index.ts +4 -0
- package/src/lifecycle/lease.test.ts +343 -0
- package/src/lifecycle/lease.ts +270 -0
- package/src/lifecycle/scenario-eval.test.ts +199 -0
- package/src/lifecycle/scenario-eval.ts +158 -0
- package/src/lifecycle/scenario.test.ts +195 -0
- package/src/lifecycle/scenario.ts +321 -0
- package/src/lifecycle/symptoms.test.ts +116 -0
- package/src/lifecycle/symptoms.ts +126 -0
- package/src/lint/output-docs.test.ts +220 -0
- package/src/lint/output-docs.ts +204 -0
- package/src/lint/post-synth.test.ts +97 -0
- package/src/lint/post-synth.ts +45 -0
- package/src/lint/rules/__fixtures__/comp/comp003/pass/agent-turn.component.ts +26 -0
- package/src/lint/rules/comp/comp.test.ts +49 -1
- package/src/lint/rules/evl001-non-literal-expression.test.ts +8 -3
- package/src/lint/rules/evl001-non-literal-expression.ts +6 -6
- package/src/lsp/lexicon-providers.test.ts +44 -0
- package/src/lsp/lexicon-providers.ts +11 -1
- package/src/op/activity-contract.test.ts +180 -0
- package/src/op/activity-contract.ts +278 -0
- package/src/op/builders-exports.test.ts +17 -1
- package/src/op/builders.ts +59 -5
- package/src/op/converge-rule.test.ts +179 -0
- package/src/op/converge-rule.ts +311 -0
- package/src/op/generate-pipeline.test.ts +53 -0
- package/src/op/generate-pipeline.ts +99 -0
- package/src/op/index.ts +30 -0
- package/src/op/local-executor.test.ts +92 -0
- package/src/op/local-executor.ts +45 -9
- package/src/op/op-verb-class.test.ts +126 -0
- package/src/op/op-verb-class.ts +115 -0
- package/src/op/operator.test.ts +346 -0
- package/src/op/operator.ts +213 -0
- package/src/op/step-output-ref.test.ts +334 -0
- package/src/op/step-output-ref.ts +453 -0
- package/src/op/types.ts +18 -1
- package/src/provenance.test.ts +151 -4
- package/src/provenance.ts +118 -4
- package/src/runtime-adapter.ts +31 -10
- package/src/serializer.ts +18 -0
- package/src/toml.test.ts +157 -384
- package/src/toml.ts +371 -5
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Step-output references — chant #1290 ("A step cannot reference a prior
|
|
3
|
+
* step's output, so values leave an Op only as search attributes").
|
|
4
|
+
*
|
|
5
|
+
* An Op's steps run in a fixed sequence chant already knows: phases in
|
|
6
|
+
* order, and (within a non-parallel phase) steps in order. Today the only
|
|
7
|
+
* way a value escapes a step is `outcomeAttribute`, which stringifies it
|
|
8
|
+
* into a Temporal search attribute — a UI filter, not something a later
|
|
9
|
+
* step can consume. `StepOutputRef` is the mechanism that lets a later
|
|
10
|
+
* step's `args` hold a *reference* to an earlier step's declared return
|
|
11
|
+
* value instead.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately a reference, not an expression: `diff.out.driftedStacks` is
|
|
14
|
+
* a value placeholder the build resolves and the serializer compiles into a
|
|
15
|
+
* real local variable in the generated workflow — never `diff.out.count >
|
|
16
|
+
* 0` or a `.map()` over a reference. That property (an Op is data you can
|
|
17
|
+
* read and know what it does, not a program) is exactly what makes it safe
|
|
18
|
+
* to add this without Ops becoming programs; see the issue's "line not to
|
|
19
|
+
* cross".
|
|
20
|
+
*
|
|
21
|
+
* Scope, kept deliberately tight (see the issue's "Open questions"):
|
|
22
|
+
* - same-Op only — no cross-Op plumbing (that needs a durable place to put
|
|
23
|
+
* the value, which #1290 explicitly defers).
|
|
24
|
+
* - main `phases` only — a step inside `onFailure` or nested inside an
|
|
25
|
+
* `EffectStep` can neither produce nor consume a step-output reference.
|
|
26
|
+
* `onFailure` compensation runs only when something upstream already
|
|
27
|
+
* failed, so a main-phase step's captured result isn't reliably
|
|
28
|
+
* available there; an effect step's nested steps run only when the
|
|
29
|
+
* receipt comparison mismatches, so a value it produces isn't reliably
|
|
30
|
+
* available to anything outside it either. Both are conditional
|
|
31
|
+
* execution paths, which is exactly the class of thing #1290 keeps out
|
|
32
|
+
* of an Op's inert-data model.
|
|
33
|
+
* - producer must run to completion before the consumer starts: an earlier
|
|
34
|
+
* phase, or an earlier step within the same non-parallel phase. Two
|
|
35
|
+
* steps in the same parallel phase run concurrently (`Promise.all`) with
|
|
36
|
+
* no ordering guarantee, so neither may reference the other.
|
|
37
|
+
* - the producer needs a registered `ActivityContract` with a `returns`
|
|
38
|
+
* schema — without one there is nothing to validate the reference
|
|
39
|
+
* against, and it degrades into the same stringly path `outcomeAttribute`
|
|
40
|
+
* already had (chant #1288 comment on this issue).
|
|
41
|
+
*
|
|
42
|
+
* Cross-contract type compatibility (chant #1950 pre-merge review, finding
|
|
43
|
+
* 3): `validateStepOutputRefs` checks the producer side (a registered
|
|
44
|
+
* contract with a `returns` schema, and — when `path` is set — that the path
|
|
45
|
+
* resolves on it) and, separately, `validateActivitySteps`/TMP012 checks a
|
|
46
|
+
* step's `args` against its own contract's `args` schema — but a
|
|
47
|
+
* {@link StepOutputRef} sitting in `args` is a placeholder object at build
|
|
48
|
+
* time, not the value it resolves to, so TMP012 skips it (see
|
|
49
|
+
* `activity-contract.ts`'s `isStepOutputRefValue` guard) rather than
|
|
50
|
+
* false-positive on it. Nothing before this compared the *consumer's*
|
|
51
|
+
* declared type at that position against the *producer's* declared type at
|
|
52
|
+
* `path` — a string-returning path could feed a number-typed arg and both
|
|
53
|
+
* checks would pass. `validateStepOutputRefs` now adds one more check for
|
|
54
|
+
* exactly this: when `path` is set, and both the producer's and the
|
|
55
|
+
* consumer's contracts are registered, it compares the zod schema at the
|
|
56
|
+
* producer's `path` against the zod schema at the consumer's arg position by
|
|
57
|
+
* primitive shape (`string`/`number`/`boolean`/`object`/`array` — see
|
|
58
|
+
* `activity-contract.ts`'s `primitiveKindOf`) and flags a mismatch. This is
|
|
59
|
+
* deliberately shallow, the same "hard stop rather than guess" posture
|
|
60
|
+
* `pathExistsInSchema`'s doc above takes for a record/array root: a union, an
|
|
61
|
+
* enum, a literal, `z.any()`/`z.unknown()`, a transform, or a ref sitting
|
|
62
|
+
* inside an array in `args` (no stable position to look up an arg schema
|
|
63
|
+
* against) all bail silently — no issue raised, not a false negative
|
|
64
|
+
* reported as clean, just genuinely out of this check's reach. A more
|
|
65
|
+
* complete version (real zod-schema subtyping/union-aware comparison) is
|
|
66
|
+
* exactly the kind of thing #1288 Stage 2 (typed step builders, deriving
|
|
67
|
+
* from contracts instead of restating them) would need anyway; deferred
|
|
68
|
+
* there rather than grown ad hoc here. A whole-value reference (no `path`)
|
|
69
|
+
* is skipped by this check for the same reason it's skipped by the
|
|
70
|
+
* path-existence check: there's no single field to compare.
|
|
71
|
+
*
|
|
72
|
+
* References only, no expressions: the issue asks for this to be "enforced
|
|
73
|
+
* by a lint rule rather than left as a convention." What's here instead is
|
|
74
|
+
* a runtime-on-load guard — `diff.out.count > 0` or a template literal over
|
|
75
|
+
* a reference coerces it to a primitive, and the reference throws when that
|
|
76
|
+
* happens, at the moment chant loads the `.op.ts` module to build the
|
|
77
|
+
* entity graph (i.e. still before anything runs). A real static lint rule
|
|
78
|
+
* would need to parse-inspect the author's TypeScript for expression syntax
|
|
79
|
+
* around a reference — a genuine ESLint-rule-shaped feature, and a bigger
|
|
80
|
+
* one than this issue's scope. The coercion guard catches the same misuse
|
|
81
|
+
* (arithmetic, comparisons, template literals, `String(...)`) without it;
|
|
82
|
+
* a `.map()`-style structural misuse already throws on its own (`StepOutputRef`
|
|
83
|
+
* has no array methods).
|
|
84
|
+
*/
|
|
85
|
+
import type { ActivityStep, OpConfig } from "./types.js";
|
|
86
|
+
import { type ActivityContract, type ActivityContractIssue } from "./activity-contract.js";
|
|
87
|
+
declare const STEP_OUTPUT_REF_BRAND: unique symbol;
|
|
88
|
+
/**
|
|
89
|
+
* A typed reference to a prior step's declared return value. Inert by
|
|
90
|
+
* construction — it carries a producer step id and an optional dot-path
|
|
91
|
+
* into that producer's return schema, resolved by `chant build`
|
|
92
|
+
* (`validateStepOutputRefs`) and compiled by the temporal serializer into a
|
|
93
|
+
* local variable holding the awaited activity result.
|
|
94
|
+
*/
|
|
95
|
+
export interface StepOutputRef {
|
|
96
|
+
readonly [STEP_OUTPUT_REF_BRAND]: true;
|
|
97
|
+
readonly kind: "step-output-ref";
|
|
98
|
+
/** `ActivityStep.id` of the producing step. */
|
|
99
|
+
readonly step: string;
|
|
100
|
+
/**
|
|
101
|
+
* Dot-path into the producer's declared return value (e.g.
|
|
102
|
+
* `"driftedStacks"`, `"result.healthy"`). Omitted references the whole
|
|
103
|
+
* return value.
|
|
104
|
+
*/
|
|
105
|
+
readonly path?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* `T` with every own property additionally accepting a {@link StepOutputRef}
|
|
109
|
+
* in its place (chant #1288 Stage 2) — the authoring-time counterpart of
|
|
110
|
+
* `args` accepting a reference anywhere in the structure (#1290): a typed
|
|
111
|
+
* step-builder wrapper whose opts type is `WithStepRefs<SomeActivityArgs>`
|
|
112
|
+
* lets an author pass `diff.out.driftedStacks` for any field without an
|
|
113
|
+
* `as` cast, while runtime validation of the reference itself is still
|
|
114
|
+
* `validateStepOutputRefs`' job, not this type's.
|
|
115
|
+
*/
|
|
116
|
+
export type WithStepRefs<T> = {
|
|
117
|
+
[K in keyof T]: T[K] | StepOutputRef;
|
|
118
|
+
};
|
|
119
|
+
/** Structural guard for a value produced by {@link stepOutput} (or `activity()`'s `.out`). */
|
|
120
|
+
export declare function isStepOutputRef(value: unknown): value is StepOutputRef;
|
|
121
|
+
/**
|
|
122
|
+
* Reference a named step's output from a later step's `args`. Works with
|
|
123
|
+
* any step that has an `id` — an `activity()` builder result (which also
|
|
124
|
+
* gets the `.out` proxy sugar below) or a plain `{ kind: "activity", ...,
|
|
125
|
+
* id: "..." }` object literal, the shape composites author directly.
|
|
126
|
+
*
|
|
127
|
+
* `stepOutput(diff, "driftedStacks")` and `diff.out.driftedStacks` produce
|
|
128
|
+
* an identical reference; `stepOutput` is the explicit form for authors who
|
|
129
|
+
* build steps as object literals, or whose return schema has a top-level
|
|
130
|
+
* field literally named `step`, `path`, or `kind` (the `.out` proxy
|
|
131
|
+
* reserves those three property names for its own introspection).
|
|
132
|
+
*/
|
|
133
|
+
export declare function stepOutput(step: string | Pick<ActivityStep, "id">, path?: string): StepOutputRef;
|
|
134
|
+
/**
|
|
135
|
+
* `.out` proxy attached to `activity()`'s result: `diff.out.driftedStacks`
|
|
136
|
+
* builds a {@link StepOutputRef} without the explicit `stepOutput()` call.
|
|
137
|
+
*
|
|
138
|
+
* A single property-access level, matching `outcomeAttribute.from`'s
|
|
139
|
+
* existing convention — the property name IS the dot-path, so a nested
|
|
140
|
+
* field is `diff.out["result.healthy"]`, not `diff.out.result.healthy`.
|
|
141
|
+
* `kind`, `step`, and `path` are reserved (the ref's own introspection
|
|
142
|
+
* fields); a return schema with a top-level field by one of those names
|
|
143
|
+
* needs `stepOutput(diff, "step")` instead.
|
|
144
|
+
*/
|
|
145
|
+
export declare function makeOutProxy(stepId: string): Record<string, StepOutputRef>;
|
|
146
|
+
/** Every {@link StepOutputRef} found anywhere inside `value` (recursing through plain objects and arrays). */
|
|
147
|
+
export declare function collectStepOutputRefs(value: unknown): StepOutputRef[];
|
|
148
|
+
/**
|
|
149
|
+
* Validate every step-output reference in an Op against scope and ordering
|
|
150
|
+
* alone — no contract needed. This is the subset of {@link
|
|
151
|
+
* validateStepOutputRefs}'s checks that don't depend on a contract map, kept
|
|
152
|
+
* as its own export so a caller with no contracts on hand (or that wants to
|
|
153
|
+
* defend against exactly this class of bug regardless of what contracts are
|
|
154
|
+
* registered) can still refuse a scope-invalid reference. The temporal
|
|
155
|
+
* lexicon's serializer (`serializeOps`) is exactly this caller: TMP013 (which
|
|
156
|
+
* calls the fuller {@link validateStepOutputRefs}) protects `chant build`,
|
|
157
|
+
* but `serializeOps` is a public export a caller can invoke directly,
|
|
158
|
+
* bypassing that lint pass — this is its own defense-in-depth.
|
|
159
|
+
*
|
|
160
|
+
* Flags:
|
|
161
|
+
* - a reference authored inside `onFailure`, or inside an `EffectStep`'s
|
|
162
|
+
* nested steps — out of scope by design (see the module doc); flagged
|
|
163
|
+
* explicitly here rather than left to fall through as "unknown producer",
|
|
164
|
+
* - a reference to an unregistered step id (no step in scope declares it),
|
|
165
|
+
* - a duplicate step id (ambiguous producer),
|
|
166
|
+
* - a reference to a step that does not precede the referencing step
|
|
167
|
+
* (a later phase, a later step in the same phase, itself, or a step in
|
|
168
|
+
* the same parallel phase).
|
|
169
|
+
*/
|
|
170
|
+
export declare function validateStepOutputRefScope(config: Pick<OpConfig, "name" | "phases" | "onFailure">): ActivityContractIssue[];
|
|
171
|
+
/**
|
|
172
|
+
* Validate every step-output reference in an Op's main phases against a
|
|
173
|
+
* contract map and the Op's own step ordering. Scope: `config.phases` only
|
|
174
|
+
* (never `onFailure`, never a step nested inside an `EffectStep` — see the
|
|
175
|
+
* module doc). Layers contract-based checks on top of {@link
|
|
176
|
+
* validateStepOutputRefScope}'s scope/ordering checks.
|
|
177
|
+
*
|
|
178
|
+
* Flags everything {@link validateStepOutputRefScope} does, plus:
|
|
179
|
+
* - a reference into a step whose `fn` has no registered
|
|
180
|
+
* {@link ActivityContract}, or whose contract declares no `returns`
|
|
181
|
+
* schema — nothing to validate the reference against,
|
|
182
|
+
* - a `path` that does not resolve on the producer's declared return
|
|
183
|
+
* schema (an empty `path` — the whole return value — is always valid).
|
|
184
|
+
*/
|
|
185
|
+
export declare function validateStepOutputRefs(config: Pick<OpConfig, "name" | "phases" | "onFailure">, contracts: ReadonlyMap<string, ActivityContract>): ActivityContractIssue[];
|
|
186
|
+
export {};
|
|
187
|
+
//# sourceMappingURL=step-output-ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-output-ref.d.ts","sourceRoot":"","sources":["../../src/op/step-output-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAmB,MAAM,SAAS,CAAC;AACvE,OAAO,EAAqD,KAAK,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE3I,QAAA,MAAM,qBAAqB,eAAuC,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,CAAC,qBAAqB,CAAC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seDefinition {
|
|
|
34
34
|
export type StepDefinition = ActivityStep | GateStep | EffectStep;
|
|
35
35
|
export interface ActivityStep {
|
|
36
36
|
kind: "activity";
|
|
37
|
+
/**
|
|
38
|
+
* Identifies this step so a later step can reference its output (#1290)
|
|
39
|
+
* via `stepOutput(id, path?)` or, when built with `activity()`, the
|
|
40
|
+
* `.out` proxy sugar. Only steps in an Op's main `phases` — not
|
|
41
|
+
* `onFailure`, not one nested inside an `EffectStep` — can be referenced.
|
|
42
|
+
*/
|
|
43
|
+
id?: string;
|
|
37
44
|
/** Name of the exported activity function in the pre-built activity library. */
|
|
38
45
|
fn: string;
|
|
39
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Arguments passed to the activity function. A value may be a
|
|
48
|
+
* {@link StepOutputRef} (anywhere in the structure, including nested
|
|
49
|
+
* inside a plain object or array) — a reference to an earlier step's
|
|
50
|
+
* declared return value, resolved at build time and compiled by the
|
|
51
|
+
* serializer into a local variable holding that step's result. Never an
|
|
52
|
+
* expression over one: `diff.out.count > 0` or a template literal
|
|
53
|
+
* coerces the reference to a primitive, which throws (see
|
|
54
|
+
* `step-output-ref.ts`'s module doc for why this is a runtime-on-load
|
|
55
|
+
* guard, not a static lint rule).
|
|
56
|
+
*/
|
|
40
57
|
args?: Record<string, unknown>;
|
|
41
58
|
/**
|
|
42
59
|
* Key from TEMPORAL_ACTIVITY_PROFILES controlling timeout + retry.
|
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;AAExD,MAAM,WAAW,QAAQ;IACvB,uGAAuG;IACvG,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,M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AM,CAAC;IACjB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/dist/provenance.d.ts
CHANGED
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* entity object, so it never serializes into the emitted YAML/JSON — it is build
|
|
6
6
|
* metadata, not declared configuration. Read it back with {@link getProvenance}.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Entity-level provenance (which file declared it, and which composite expanded
|
|
9
|
+
* it) answers "where did this resource come from?", which is the question an
|
|
10
|
+
* agent asks before changing it. {@link PathOrigin} (chant #1443) answers the
|
|
11
|
+
* follow-up — "what set THIS field" — for the paths a build can attribute
|
|
12
|
+
* without guessing. Neither is a YAML-line source map.
|
|
11
13
|
*
|
|
12
14
|
* {@link BuildParamProvenance} (chant #1064) is the other half: not "where did
|
|
13
15
|
* this ENTITY come from" but "what INPUTS was this whole BUILD invoked with" —
|
|
@@ -27,7 +29,55 @@ export interface EntityProvenance {
|
|
|
27
29
|
* collapse a composite to a single node at coarse diagram detail levels (#494).
|
|
28
30
|
*/
|
|
29
31
|
compositeInstance?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Per-path origins within the entity's `props` (chant #1443). Read with
|
|
34
|
+
* {@link originOfPath}, which does the prefix resolution these keys are
|
|
35
|
+
* written for.
|
|
36
|
+
*
|
|
37
|
+
* Keys are dotted property paths only — `spec.template.spec.containers` —
|
|
38
|
+
* with `""` for the whole entity. They never carry an array segment, because
|
|
39
|
+
* a producing mechanism attributes a whole array at once: the coarsest path
|
|
40
|
+
* it actually determines is the honest one to record, and a positional key
|
|
41
|
+
* would go stale the moment an element moved.
|
|
42
|
+
*
|
|
43
|
+
* Query paths come from #1441's diff addressing and may carry `[#key]` for an
|
|
44
|
+
* element of an associative list or `[n]` for a positional one. Resolution is
|
|
45
|
+
* longest segment-boundary prefix, so `spec.containers[#app].image` finds a
|
|
46
|
+
* key recorded at `spec.containers`, and a key recorded at
|
|
47
|
+
* `spec.containers.image` never matches it. The two grammars agree without
|
|
48
|
+
* the recorder needing the lexicon's ordering hook, which it has no access to.
|
|
49
|
+
*
|
|
50
|
+
* Absent means this build could not record path origins, not that nothing
|
|
51
|
+
* governs the entity's fields — the run path executes modules and has no
|
|
52
|
+
* expression to inspect, and a sandboxed child's provenance does not survive
|
|
53
|
+
* the wire (`discovery/entity-wire-codec.ts` drops build metadata).
|
|
54
|
+
*/
|
|
55
|
+
paths?: Record<string, PathOrigin>;
|
|
30
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* What produced one path inside an entity's props.
|
|
59
|
+
*
|
|
60
|
+
* - `authored` — written in the source file that declared the entity.
|
|
61
|
+
* - `composite` — the entity was expanded by a composite, or the path was
|
|
62
|
+
* supplied by `propagate()`'s shared props at the instance.
|
|
63
|
+
* - `build-param` — the build parameters the authored expression for this path
|
|
64
|
+
* *reads*, which is a syntactic dependency, not a value taint. For
|
|
65
|
+
* `replicas: params.tier === "prod" ? 5 : 1` a taint says the value came from
|
|
66
|
+
* the literal `5`, which is true and useless; the dependency says the field
|
|
67
|
+
* is governed by `tier`, which is what an editor needs to know. Under-reports
|
|
68
|
+
* (a shape the collector does not follow drops a dependency) and never
|
|
69
|
+
* over-reports a parameter the expression does not mention.
|
|
70
|
+
*/
|
|
71
|
+
export type PathOrigin = {
|
|
72
|
+
kind: "authored";
|
|
73
|
+
} | {
|
|
74
|
+
kind: "composite";
|
|
75
|
+
composite: string;
|
|
76
|
+
instance: string;
|
|
77
|
+
} | {
|
|
78
|
+
kind: "build-param";
|
|
79
|
+
params: string[];
|
|
80
|
+
};
|
|
31
81
|
/**
|
|
32
82
|
* Merge provenance onto an entity. Non-enumerable so it is invisible to
|
|
33
83
|
* serializers and spreads. Existing fields win (`??=`), so the first/most
|
|
@@ -36,6 +86,26 @@ export interface EntityProvenance {
|
|
|
36
86
|
export declare function setProvenance(entity: object, prov: EntityProvenance): void;
|
|
37
87
|
/** Read an entity's build provenance, if any was stamped. */
|
|
38
88
|
export declare function getProvenance(entity: object): EntityProvenance | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Record one path's origin, first writer wins — the same rule
|
|
91
|
+
* {@link setProvenance} applies to entity-level fields, and for the same
|
|
92
|
+
* reason: expansion runs innermost-composite-first, so the earliest writer is
|
|
93
|
+
* the most specific one.
|
|
94
|
+
*/
|
|
95
|
+
export declare function setPathProvenance(entity: object, path: string, origin: PathOrigin): void;
|
|
96
|
+
/**
|
|
97
|
+
* An entity's recorded path origins in sorted key order, or `undefined` when
|
|
98
|
+
* none were recorded. Sorted because a build's outputs are compared byte for
|
|
99
|
+
* byte and object key order is not something insertion should decide.
|
|
100
|
+
*/
|
|
101
|
+
export declare function getPathProvenance(entity: object): Record<string, PathOrigin> | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* The origin governing `path` — the longest recorded key that addresses it or
|
|
104
|
+
* one of its ancestors. See {@link PROVENANCE_PATH_GRAMMAR}.
|
|
105
|
+
*/
|
|
106
|
+
export declare function originOfPath(paths: Readonly<Record<string, PathOrigin>> | undefined, path: string): PathOrigin | undefined;
|
|
107
|
+
/** One-line rendering of an origin, for diff output. */
|
|
108
|
+
export declare function describePathOrigin(origin: PathOrigin): string;
|
|
39
109
|
/**
|
|
40
110
|
* One resolved build-time parameter (chant #1064, see ../build-params.ts): its
|
|
41
111
|
* final value and which source won it, so a build's parameter inputs are
|
package/dist/provenance.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../src/provenance.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../src/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,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CAAC;IACb,yFAAyF;IACzF,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC,sCAAsC;IACtC,MAAM,EAAE,KAAK,GAAG,aAAa,GAAG,KAAK,GAAG,SAAS,CAAC;CACnD"}
|
|
@@ -19,9 +19,15 @@ export interface RuntimeAdapter {
|
|
|
19
19
|
readonly hashAlgorithm: string;
|
|
20
20
|
/** Test whether filePath matches a glob pattern */
|
|
21
21
|
globMatch(pattern: string, filePath: string): boolean;
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Spawn a child process and collect output. When `opts.stdin` is set, it is
|
|
24
|
+
* written to the child's stdin and the stream is closed — the caller never
|
|
25
|
+
* needs to round-trip content through a shell (`sh -c "echo … | cmd"`) just
|
|
26
|
+
* to feed a command that reads from stdin (e.g. `git hash-object --stdin`).
|
|
27
|
+
*/
|
|
23
28
|
spawn(cmd: string[], opts?: {
|
|
24
29
|
cwd?: string;
|
|
30
|
+
stdin?: string;
|
|
25
31
|
}): Promise<SpawnResult>;
|
|
26
32
|
/** Commands to use when spawning package manager / executor */
|
|
27
33
|
readonly commands: RuntimeCommands;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-adapter.d.ts","sourceRoot":"","sources":["../src/runtime-adapter.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,IAAI,CAAC,OAAO,EAAE,MAAM,GAA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SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
package/dist/serializer.d.ts
CHANGED
|
@@ -38,6 +38,24 @@ export interface SerializerResult {
|
|
|
38
38
|
primary: string;
|
|
39
39
|
/** Additional files keyed by filename (e.g. "network.template.json" → content) */
|
|
40
40
|
files?: Record<string, string>;
|
|
41
|
+
/**
|
|
42
|
+
* Basenames from `files` that must reach disk byte-for-byte — never
|
|
43
|
+
* `JSON.parse`d, key-sorted, or reformatted to YAML by the build's
|
|
44
|
+
* additional-file writer (chant#1937).
|
|
45
|
+
*
|
|
46
|
+
* A separate field rather than a per-file flag on `files` (e.g. widening
|
|
47
|
+
* its value to `string | { content: string; verbatim: boolean }`) so every
|
|
48
|
+
* existing lexicon serializer that returns `files: Record<string, string>`
|
|
49
|
+
* keeps compiling and behaving unchanged: this list defaults to empty, and
|
|
50
|
+
* only a serializer that actually carries opaque/pre-formatted bytes
|
|
51
|
+
* (committed ciphertext, a vendored file) needs to populate it.
|
|
52
|
+
*
|
|
53
|
+
* Before this field existed, "JSON.parse fails on this content" was the
|
|
54
|
+
* only way to opt out of round-tripping — true for YAML that happens not to
|
|
55
|
+
* parse as JSON, but never a structural guarantee (YAML is a JSON
|
|
56
|
+
* superset).
|
|
57
|
+
*/
|
|
58
|
+
verbatimFiles?: string[];
|
|
41
59
|
/**
|
|
42
60
|
* Non-fatal diagnostics produced during serialization (e.g. a dialect
|
|
43
61
|
* dropping keys the target platform ignores). The build pipeline collects
|
package/dist/serializer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,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AC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;OAaG;IACH,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEtC;;;;;OAKG;IACH,SAAS,CACP,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACjC,OAAO,CAAC,EAAE,aAAa,EAAE,EACzB,OAAO,CAAC,EAAE,gBAAgB,GACzB,MAAM,GAAG,gBAAgB,CAAC;IAE7B;;;;;OAKG;IACH,iBAAiB,CAAC,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC;CACpD"}
|
package/dist/toml.d.ts
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TOML
|
|
2
|
+
* Lightweight TOML parser (#446).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Written for the audit engine's spike: is there a pure, dependency-free way
|
|
5
|
+
* to parse a config format the engine can't read today? TOML fits — it is a
|
|
6
|
+
* fully-specified, static (no macros/interpolation/imports) grammar, so a
|
|
7
|
+
* hand-rolled tokenizer + recursive-descent parser covers it without any
|
|
8
|
+
* runtime surface a Workers sandbox would reject (no `eval`, no native
|
|
9
|
+
* modules, no filesystem/network).
|
|
10
|
+
*
|
|
11
|
+
* Covers the subset of TOML v1.0 that real-world deploy configs
|
|
12
|
+
* (`wrangler.toml`, `Cargo.toml`, `pyproject.toml`, `netlify.toml`) actually
|
|
13
|
+
* use: basic/literal strings (single-line), integers, floats, booleans,
|
|
14
|
+
* arrays (including multi-line), inline tables, dotted keys, standard tables
|
|
15
|
+
* (`[a.b]`), and arrays of tables (`[[a.b]]`).
|
|
16
|
+
*
|
|
17
|
+
* Deliberately NOT a full spec implementation:
|
|
18
|
+
* - Multi-line strings (`"""..."""`, `'''...'''`) are read as a single
|
|
19
|
+
* opaque string body (no line-ending backslash trimming); good enough to
|
|
20
|
+
* not crash, not spec-perfect for continuation whitespace.
|
|
21
|
+
* - Dates/times are returned as their raw source text (a string), not a
|
|
22
|
+
* `Date` — none of the checks built on this parser need calendar math.
|
|
23
|
+
* - A dotted-key path element must be a bare word or a plain quoted string;
|
|
24
|
+
* mixing exotic key shapes mid-path is not supported.
|
|
25
|
+
* These gaps only matter for exotic TOML; they don't affect the shapes the
|
|
26
|
+
* audit checks read (`[vars]`, `[[kv_namespaces]]`, `[env.NAME]`, …).
|
|
27
|
+
*/
|
|
28
|
+
export declare class TomlParseError extends Error {
|
|
29
|
+
}
|
|
30
|
+
type TomlValue = string | number | boolean | TomlValue[] | {
|
|
31
|
+
[k: string]: TomlValue;
|
|
32
|
+
};
|
|
33
|
+
type TomlTable = {
|
|
34
|
+
[k: string]: TomlValue;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Parse a TOML document into a plain nested object. Throws {@link TomlParseError}
|
|
38
|
+
* on malformed input — callers that scan arbitrary repo files should wrap the
|
|
39
|
+
* call in a try/catch (matching the rest of the audit engine's tolerance for
|
|
40
|
+
* unparseable content).
|
|
6
41
|
*/
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
42
|
+
export declare function parseTOML(input: string): TomlTable;
|
|
43
|
+
export {};
|
|
9
44
|
//# sourceMappingURL=toml.d.ts.map
|
package/dist/toml.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toml.d.ts","sourceRoot":"","sources":["../src/toml.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"toml.d.ts","sourceRoot":"","sources":["../src/toml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,qBAAa,cAAe,SAAQ,KAAK;CAAG;AAqK5C,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AACtF,KAAK,SAAS,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAgJ5C;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CA8BlD"}
|
package/package.json
CHANGED
|
@@ -91,7 +91,7 @@ describe("RULE_CATALOG (aggregated: core static + lexicon-contributed, #687)", (
|
|
|
91
91
|
expect(m.remediation.length, `${id} has remediation`).toBeGreaterThan(0);
|
|
92
92
|
expect(["merge-worthy", "report-only"]).toContain(m.tier);
|
|
93
93
|
expect(["deterministic", "guidance"]).toContain(m.fixKind);
|
|
94
|
-
expect(["security", "correctness", "best-practice"], `${id} has a valid category`).toContain(m.category);
|
|
94
|
+
expect(["security", "correctness", "best-practice", "efficiency"], `${id} has a valid category`).toContain(m.category);
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
|
package/src/audit/catalog.ts
CHANGED
|
@@ -26,10 +26,13 @@ export type FixKind = "deterministic" | "guidance";
|
|
|
26
26
|
* What kind of finding this is — orthogonal to `tier` (fix confidence). Lets the
|
|
27
27
|
* report say "N security, M best-practice, K correctness" instead of branding
|
|
28
28
|
* everything "security." `security` = exposure/vuln/supply-chain; `correctness`
|
|
29
|
-
* = a structural bug (broken reference, invalid schema, never-runs);
|
|
30
|
-
*
|
|
29
|
+
* = a structural bug (broken reference, invalid schema, never-runs); `efficiency`
|
|
30
|
+
* (#444) = waste — redundant work, an oversized execution environment,
|
|
31
|
+
* unintended fan-out, unbounded retention — never a safety/correctness issue,
|
|
32
|
+
* so it is excluded from the security and correctness tallies; everything else
|
|
33
|
+
* is `best-practice` (hygiene/style/deprecation/reliability).
|
|
31
34
|
*/
|
|
32
|
-
export type Category = "security" | "correctness" | "best-practice";
|
|
35
|
+
export type Category = "security" | "correctness" | "best-practice" | "efficiency";
|
|
33
36
|
|
|
34
37
|
export interface Authority {
|
|
35
38
|
name: string;
|
|
@@ -96,6 +99,34 @@ export const K8S_SECRETS: Authority = {
|
|
|
96
99
|
name: "Kubernetes — Good practices for Secrets",
|
|
97
100
|
url: "https://kubernetes.io/docs/concepts/security/secrets-good-practices/",
|
|
98
101
|
};
|
|
102
|
+
export const GH_SECRET_SCANNING: Authority = {
|
|
103
|
+
name: "GitHub — About secret scanning",
|
|
104
|
+
url: "https://docs.github.com/en/code-security/secret-scanning/introduction/about-secret-scanning",
|
|
105
|
+
};
|
|
106
|
+
export const SCORECARD_VULN: Authority = {
|
|
107
|
+
name: "OSSF Scorecard — Vulnerabilities",
|
|
108
|
+
url: "https://github.com/ossf/scorecard/blob/main/docs/checks.md#vulnerabilities",
|
|
109
|
+
};
|
|
110
|
+
export const CF_WORKERS_DEV: Authority = {
|
|
111
|
+
name: "Cloudflare Workers — workers.dev",
|
|
112
|
+
url: "https://developers.cloudflare.com/workers/configuration/routing/workers-dev/",
|
|
113
|
+
};
|
|
114
|
+
export const CF_SECRETS: Authority = {
|
|
115
|
+
name: "Cloudflare Workers — Secrets",
|
|
116
|
+
url: "https://developers.cloudflare.com/workers/configuration/secrets/",
|
|
117
|
+
};
|
|
118
|
+
export const CF_ROUTES: Authority = {
|
|
119
|
+
name: "Cloudflare Workers — Routes",
|
|
120
|
+
url: "https://developers.cloudflare.com/workers/configuration/routing/routes/",
|
|
121
|
+
};
|
|
122
|
+
export const CF_ENVIRONMENTS: Authority = {
|
|
123
|
+
name: "Cloudflare Workers — Wrangler environments",
|
|
124
|
+
url: "https://developers.cloudflare.com/workers/wrangler/configuration/#environments",
|
|
125
|
+
};
|
|
126
|
+
export const CF_STATIC_ASSETS: Authority = {
|
|
127
|
+
name: "Cloudflare Workers — Static assets",
|
|
128
|
+
url: "https://developers.cloudflare.com/workers/static-assets/",
|
|
129
|
+
};
|
|
99
130
|
|
|
100
131
|
function meta(
|
|
101
132
|
id: string,
|
|
@@ -127,6 +158,22 @@ const G = "guidance" as const;
|
|
|
127
158
|
export const RULE_CATEGORY: Record<string, Category> = {
|
|
128
159
|
COR020: "correctness",
|
|
129
160
|
EXT001: "correctness",
|
|
161
|
+
SEC001: "security",
|
|
162
|
+
SEC002: "security",
|
|
163
|
+
SEC003: "security",
|
|
164
|
+
SEC004: "security",
|
|
165
|
+
SEC005: "security",
|
|
166
|
+
SEC006: "security",
|
|
167
|
+
SEC007: "security",
|
|
168
|
+
SEC008: "security",
|
|
169
|
+
SEC009: "security",
|
|
170
|
+
SEC010: "security",
|
|
171
|
+
WRG001: "security",
|
|
172
|
+
WRG002: "security",
|
|
173
|
+
WRG003: "best-practice",
|
|
174
|
+
WRG004: "security",
|
|
175
|
+
WRG005: "security",
|
|
176
|
+
WRG006: "security",
|
|
130
177
|
};
|
|
131
178
|
|
|
132
179
|
/**
|
|
@@ -139,6 +186,31 @@ export const RULE_CATEGORY: Record<string, Category> = {
|
|
|
139
186
|
export const RULE_CATALOG: Record<string, RuleMeta> = {
|
|
140
187
|
COR020: meta("COR020", M, G, "Circular resource dependency", "Break the dependency cycle between resources."),
|
|
141
188
|
EXT001: meta("EXT001", M, G, "Extension constraint violation", "Fix the cross-property constraint flagged by the cfn-lint extension schema."),
|
|
189
|
+
|
|
190
|
+
// Secrets & credentials (#443) — lexicon-independent: `secrets.ts` scans the
|
|
191
|
+
// raw text of every candidate file, so these ids apply regardless of which
|
|
192
|
+
// (if any) audit lexicons are installed. `fixKind` is `guidance`: removing
|
|
193
|
+
// a hardcoded credential and rotating it needs a human, never an auto-fix.
|
|
194
|
+
SEC001: meta("SEC001", M, G, "AWS access key ID found", "Remove the key from source, rotate it in IAM, and load it from a secret store or environment variable instead.", [GH_SECRET_SCANNING]),
|
|
195
|
+
SEC002: meta("SEC002", M, G, "AWS secret access key found", "Remove the key from source, rotate it in IAM, and load it from a secret store or environment variable instead.", [GH_SECRET_SCANNING]),
|
|
196
|
+
SEC003: meta("SEC003", M, G, "GitHub token found", "Remove the token from source and revoke it at github.com/settings/tokens; use a GitHub Actions secret instead.", [GH_SECRET_SCANNING]),
|
|
197
|
+
SEC004: meta("SEC004", M, G, "Slack token found", "Remove the token from source and revoke it in the Slack app's OAuth settings.", [GH_SECRET_SCANNING]),
|
|
198
|
+
SEC005: meta("SEC005", M, G, "Google API key found", "Remove the key from source and regenerate it in the Google Cloud Console credentials page.", [GH_SECRET_SCANNING]),
|
|
199
|
+
SEC006: meta("SEC006", M, G, "Stripe live secret key found", "Remove the key from source and roll it in the Stripe dashboard immediately — this is a live-mode key.", [GH_SECRET_SCANNING]),
|
|
200
|
+
SEC007: meta("SEC007", M, G, "Private key block found", "Remove the private key from source, rotate the keypair, and load the key from a secret store instead.", [GH_SECRET_SCANNING]),
|
|
201
|
+
SEC008: meta("SEC008", M, G, "Bearer/authorization token found", "Remove the token from source; if it's long-lived, revoke and reissue it via the issuing service.", [GH_SECRET_SCANNING]),
|
|
202
|
+
SEC009: meta("SEC009", M, G, "Credentials embedded in a connection string", "Move the username/password out of the URI into a secret store, and rotate the credential.", [GH_SECRET_SCANNING]),
|
|
203
|
+
SEC010: meta("SEC010", M, G, "High-entropy string — possible secret", "Confirm whether this is a live credential; if so, remove it from source and rotate it. If it's a false positive, suppress with a `chant-audit-ignore` comment or an allowlist entry.", [GH_SECRET_SCANNING]),
|
|
204
|
+
|
|
205
|
+
// Wrangler config audit (#446) — lexicon-independent, same shape as the SEC
|
|
206
|
+
// family above: `wrangler.ts` scans every `wrangler.toml` it finds
|
|
207
|
+
// regardless of which (if any) audit lexicons are installed.
|
|
208
|
+
WRG001: meta("WRG001", M, G, "Production environment exposed on *.workers.dev", "Remove workers_dev (or set it to false) for this environment and rely on its custom domain/route instead of the shared public subdomain.", [CF_WORKERS_DEV]),
|
|
209
|
+
WRG002: meta("WRG002", M, G, "Credential-shaped key stored in [vars]", "Move the value out of [vars] and into `wrangler secret put <name>` so it isn't committed to source or visible in `wrangler dev`/the dashboard.", [CF_SECRETS]),
|
|
210
|
+
WRG003: meta("WRG003", R, G, "Observability explicitly disabled", "Set observability.enabled = true (or remove the override) so Workers Logs are recorded for this deployment."),
|
|
211
|
+
WRG004: meta("WRG004", M, G, "Unscoped wildcard route", "Scope the route pattern to the intended zone (e.g. \"example.com/*\") instead of a bare \"*\" or \"*/*\" that matches every zone on the account.", [CF_ROUTES]),
|
|
212
|
+
WRG005: meta("WRG005", M, G, "Non-production environment shares a data store with production", "Give the non-production environment its own KV namespace/R2 bucket/D1 database id instead of reusing production's.", [CF_ENVIRONMENTS]),
|
|
213
|
+
WRG006: meta("WRG006", M, G, "Static assets served from the project root", "Point [site].bucket / [assets].directory at a dedicated public output folder, not the project root, so non-public files (config, source maps, .git) aren't served.", [CF_STATIC_ASSETS]),
|
|
142
214
|
};
|
|
143
215
|
|
|
144
216
|
/**
|
package/src/audit/core.ts
CHANGED
|
@@ -73,6 +73,15 @@ export interface AuditFinding {
|
|
|
73
73
|
lexicon: string;
|
|
74
74
|
/** Optional entity (e.g. job name) the check attached. */
|
|
75
75
|
entity?: string;
|
|
76
|
+
/** 1-based line number within `file`, when the check can pin one (e.g. secrets detection, #443). */
|
|
77
|
+
line?: number;
|
|
78
|
+
/**
|
|
79
|
+
* A redaction-safe fingerprint of the flagged value (see
|
|
80
|
+
* `secrets.ts`'s `fingerprintSecret`), so a finding can be referenced —
|
|
81
|
+
* for an allowlist entry, for dedup — without ever carrying the value
|
|
82
|
+
* itself.
|
|
83
|
+
*/
|
|
84
|
+
fingerprint?: string;
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
/**
|