@intentius/chant 0.46.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 +30 -3
- package/dist/audit/core.d.ts.map +1 -1
- package/dist/audit/discover.d.ts +9 -2
- 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 +3 -3
- 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/commands/lint.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 +12 -1
- 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/resource-handlers.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/tools/explain.d.ts +6 -0
- package/dist/cli/mcp/tools/explain.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/plugins.d.ts +1 -1
- package/dist/cli/plugins.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +14 -2
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cli/reporters/stylish.d.ts +15 -1
- package/dist/cli/reporters/stylish.d.ts.map +1 -1
- package/dist/codegen/docs-rule-scanning.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts +4 -0
- package/dist/components/auto-release.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/starter-plugin.d.ts +2 -0
- package/dist/components/starter-plugin.d.ts.map +1 -1
- package/dist/components/verbs/ensure-secret.d.ts +50 -0
- package/dist/components/verbs/ensure-secret.d.ts.map +1 -0
- package/dist/components/verbs/index.d.ts +13 -0
- package/dist/components/verbs/index.d.ts.map +1 -1
- package/dist/components/verbs/r2-sync.d.ts +76 -0
- package/dist/components/verbs/r2-sync.d.ts.map +1 -0
- 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/components/verbs/wrangler.d.ts +108 -0
- package/dist/components/verbs/wrangler.d.ts.map +1 -0
- package/dist/composite.d.ts +6 -1
- package/dist/composite.d.ts.map +1 -1
- package/dist/config.d.ts +26 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/deep-observation.d.ts +14 -0
- package/dist/deep-observation.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/effect-receipt.d.ts +177 -0
- package/dist/effect-receipt.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 +20 -0
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.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 +137 -3
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/change-set.d.ts +33 -5
- package/dist/lifecycle/change-set.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 +6 -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/observation-baseline.d.ts +21 -3
- package/dist/lifecycle/observation-baseline.d.ts.map +1 -1
- package/dist/lifecycle/receipt-plan.d.ts +62 -0
- package/dist/lifecycle/receipt-plan.d.ts.map +1 -0
- package/dist/lifecycle/release-ledger.d.ts +20 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- 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/lifecycle/teardown.d.ts +6 -4
- package/dist/lifecycle/teardown.d.ts.map +1 -1
- package/dist/lifecycle/unobserved-gate.d.ts +67 -0
- package/dist/lifecycle/unobserved-gate.d.ts.map +1 -0
- package/dist/lint/knowledge-checks.d.ts +48 -0
- package/dist/lint/knowledge-checks.d.ts.map +1 -0
- package/dist/lint/output-checks.d.ts +5 -0
- package/dist/lint/output-checks.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/pipeline-change-gate.d.ts +101 -0
- package/dist/lint/pipeline-change-gate.d.ts.map +1 -0
- package/dist/lint/post-synth.d.ts +41 -0
- package/dist/lint/post-synth.d.ts.map +1 -1
- package/dist/lint/receipt-checks.d.ts +9 -0
- package/dist/lint/receipt-checks.d.ts.map +1 -0
- 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/lint/rules/cor022-receipt-leaf.d.ts +13 -0
- package/dist/lint/rules/cor022-receipt-leaf.d.ts.map +1 -0
- package/dist/lint/rules/cor024-receipt-secret-pointer.d.ts +3 -0
- package/dist/lint/rules/cor024-receipt-secret-pointer.d.ts.map +1 -0
- package/dist/lint/rules/evl001-non-literal-expression.d.ts.map +1 -1
- package/dist/lint/rules/index.d.ts +3 -1
- package/dist/lint/rules/index.d.ts.map +1 -1
- package/dist/lsp/lexicon-providers.d.ts +7 -0
- package/dist/lsp/lexicon-providers.d.ts.map +1 -1
- package/dist/okf-read.d.ts +78 -0
- package/dist/okf-read.d.ts.map +1 -0
- 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 +140 -3
- 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 +18 -2
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/local-executor.d.ts +2 -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/receipt-store.d.ts +138 -0
- package/dist/op/receipt-store.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 +49 -2
- 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/secret-materialization.d.ts +138 -0
- package/dist/secret-materialization.d.ts.map +1 -0
- package/dist/secret-provenance.d.ts +218 -0
- package/dist/secret-provenance.d.ts.map +1 -0
- package/dist/serializer.d.ts +29 -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/dist/yaml.d.ts.map +1 -1
- package/package.json +4 -1
- package/src/audit/catalog.test.ts +1 -1
- package/src/audit/catalog.ts +75 -3
- package/src/audit/core.test.ts +57 -0
- package/src/audit/core.ts +0 -0
- package/src/audit/detect-bundle.test.ts +1 -1
- package/src/audit/discover.test.ts +24 -0
- package/src/audit/discover.ts +40 -4
- 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 +13 -1
- 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.test.ts +41 -0
- package/src/build.ts +39 -6
- package/src/cli/command-group.ts +1 -1
- package/src/cli/commands/__fixtures__/audit-fountain/agents/fleet.yaml +27 -0
- package/src/cli/commands/__fixtures__/audit-fountain/k8s/deploy.yaml +16 -0
- package/src/cli/commands/__fixtures__/audit-fountain-clean/fleet.yaml +20 -0
- package/src/cli/commands/__fixtures__/schemas/sarif-2.1.0.schema.json +2882 -0
- package/src/cli/commands/audit.test.ts +268 -1
- package/src/cli/commands/audit.ts +87 -18
- package/src/cli/commands/build.test.ts +245 -0
- package/src/cli/commands/build.ts +210 -21
- package/src/cli/commands/lint.ts +15 -3
- 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/explain.test.ts +70 -1
- package/src/cli/handlers/graph.test.ts +20 -0
- package/src/cli/handlers/graph.ts +12 -3
- package/src/cli/handlers/lifecycle.test.ts +115 -1
- package/src/cli/handlers/lifecycle.ts +96 -15
- 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/resource-handlers.ts +38 -1
- package/src/cli/mcp/server.test.ts +323 -3
- package/src/cli/mcp/server.ts +84 -7
- package/src/cli/mcp/tools/explain.ts +51 -2
- package/src/cli/mcp/types.ts +27 -1
- package/src/cli/plugins.ts +4 -2
- package/src/cli/registry.ts +14 -2
- package/src/cli/reporters/stylish.test.ts +154 -0
- package/src/cli/reporters/stylish.ts +154 -33
- 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/auto-release.ts +6 -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/registry.test.ts +7 -2
- package/src/components/starter-plugin.ts +17 -0
- package/src/components/verbs/ensure-secret.test.ts +130 -0
- package/src/components/verbs/ensure-secret.ts +79 -0
- package/src/components/verbs/index.ts +13 -0
- package/src/components/verbs/r2-sync.test.ts +107 -0
- package/src/components/verbs/r2-sync.ts +124 -0
- 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/components/verbs/wrangler.test.ts +170 -0
- package/src/components/verbs/wrangler.ts +241 -0
- package/src/composite.ts +31 -2
- package/src/config.test.ts +15 -0
- package/src/config.ts +30 -0
- package/src/deep-observation.test.ts +19 -0
- package/src/deep-observation.ts +17 -0
- 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/effect-receipt-exclusion.test.ts +190 -0
- package/src/effect-receipt.test.ts +419 -0
- package/src/effect-receipt.ts +412 -0
- package/src/fold/fold.test.ts +6 -2
- package/src/fold/fold.ts +184 -3
- package/src/fold/subset.test.ts +95 -6
- package/src/fold/subset.ts +66 -2
- package/src/index.ts +4 -0
- package/src/lexicon-schema.ts +3 -0
- package/src/lexicon.ts +151 -5
- package/src/lifecycle/change-set.ts +46 -7
- 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 +6 -0
- package/src/lifecycle/lease.test.ts +343 -0
- package/src/lifecycle/lease.ts +270 -0
- package/src/lifecycle/observation-baseline.test.ts +46 -0
- package/src/lifecycle/observation-baseline.ts +33 -1
- package/src/lifecycle/receipt-plan.test.ts +250 -0
- package/src/lifecycle/receipt-plan.ts +249 -0
- package/src/lifecycle/release-ledger.ts +20 -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/lifecycle/teardown.test.ts +31 -0
- package/src/lifecycle/teardown.ts +6 -4
- package/src/lifecycle/unobserved-gate.test.ts +109 -0
- package/src/lifecycle/unobserved-gate.ts +102 -0
- package/src/lint/knowledge-checks.test.ts +80 -0
- package/src/lint/knowledge-checks.ts +74 -0
- package/src/lint/output-checks.test.ts +85 -0
- package/src/lint/output-checks.ts +99 -0
- package/src/lint/output-docs.test.ts +220 -0
- package/src/lint/output-docs.ts +204 -0
- package/src/lint/pipeline-change-gate.test.ts +144 -0
- package/src/lint/pipeline-change-gate.ts +153 -0
- package/src/lint/post-synth.test.ts +97 -0
- package/src/lint/post-synth.ts +60 -0
- package/src/lint/receipt-checks.test.ts +101 -0
- package/src/lint/receipt-checks.ts +93 -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/cor022-receipt-leaf.test.ts +116 -0
- package/src/lint/rules/cor022-receipt-leaf.ts +130 -0
- package/src/lint/rules/cor024-receipt-secret-pointer.test.ts +121 -0
- package/src/lint/rules/cor024-receipt-secret-pointer.ts +218 -0
- package/src/lint/rules/evl001-non-literal-expression.test.ts +35 -3
- package/src/lint/rules/evl001-non-literal-expression.ts +7 -0
- package/src/lint/rules/index.ts +7 -1
- package/src/lsp/lexicon-providers.test.ts +44 -0
- package/src/lsp/lexicon-providers.ts +11 -1
- package/src/okf-read.test.ts +149 -0
- package/src/okf-read.ts +197 -0
- 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 +198 -6
- package/src/op/converge-rule.test.ts +179 -0
- package/src/op/converge-rule.ts +311 -0
- package/src/op/effect-step.test.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 +40 -3
- package/src/op/local-executor.test.ts +92 -0
- package/src/op/local-executor.ts +212 -29
- package/src/op/op-verb-class.test.ts +126 -0
- package/src/op/op-verb-class.ts +115 -0
- package/src/op/op.test.ts +25 -2
- package/src/op/operator.test.ts +346 -0
- package/src/op/operator.ts +213 -0
- package/src/op/receipt-store.ts +211 -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 +51 -2
- package/src/provenance.test.ts +151 -4
- package/src/provenance.ts +118 -4
- package/src/runtime-adapter.ts +31 -10
- package/src/secret-materialization.test.ts +199 -0
- package/src/secret-materialization.ts +235 -0
- package/src/secret-provenance.test.ts +388 -0
- package/src/secret-provenance.ts +475 -0
- package/src/serializer.ts +30 -0
- package/src/toml.test.ts +157 -384
- package/src/toml.ts +371 -5
- package/src/yaml.test.ts +88 -0
- package/src/yaml.ts +76 -6
package/src/toml.test.ts
CHANGED
|
@@ -1,388 +1,161 @@
|
|
|
1
1
|
import { describe, test, expect } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
expect(
|
|
23
|
-
expect(
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test("
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
expect(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
expect(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test("
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
expect(
|
|
79
|
-
expect(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
environments: {
|
|
155
|
-
dev: {
|
|
156
|
-
url: "jdbc:postgresql://localhost:5432/devdb",
|
|
157
|
-
user: "dev_user",
|
|
158
|
-
schemas: ["public"],
|
|
159
|
-
},
|
|
160
|
-
prod: {
|
|
161
|
-
url: "jdbc:postgresql://prod-host:5432/proddb",
|
|
162
|
-
user: "prod_user",
|
|
163
|
-
schemas: ["public", "audit"],
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
expect(result).toContain("[flyway]");
|
|
169
|
-
expect(result).toContain('[flyway.placeholders]');
|
|
170
|
-
expect(result).toContain("[environments.dev]");
|
|
171
|
-
expect(result).toContain("[environments.prod]");
|
|
172
|
-
expect(result).toContain('defaultSchema = "public"');
|
|
173
|
-
expect(result).toContain("validateMigrationNaming = true");
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
test("throws for non-object input", () => {
|
|
177
|
-
expect(() => emitTOML("string" as unknown)).toThrow();
|
|
178
|
-
expect(() => emitTOML([1, 2, 3] as unknown)).toThrow();
|
|
179
|
-
expect(() => emitTOML(42 as unknown)).toThrow();
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
describe("parseTOML", () => {
|
|
184
|
-
test("parses scalar values", () => {
|
|
185
|
-
const result = parseTOML(`
|
|
186
|
-
name = "my-project"
|
|
187
|
-
version = 42
|
|
188
|
-
enabled = true
|
|
189
|
-
ratio = 3.14
|
|
190
|
-
`);
|
|
191
|
-
expect(result.name).toBe("my-project");
|
|
192
|
-
expect(result.version).toBe(42);
|
|
193
|
-
expect(result.enabled).toBe(true);
|
|
194
|
-
expect(result.ratio).toBe(3.14);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
test("parses arrays", () => {
|
|
198
|
-
const result = parseTOML(`
|
|
199
|
-
schemas = ["public", "audit"]
|
|
200
|
-
ports = [8080, 9090]
|
|
201
|
-
`);
|
|
202
|
-
expect(result.schemas).toEqual(["public", "audit"]);
|
|
203
|
-
expect(result.ports).toEqual([8080, 9090]);
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { parseTOML, TomlParseError } from "./toml";
|
|
5
|
+
|
|
6
|
+
describe("parseTOML — spike-grade coverage of real-world TOML (#446)", () => {
|
|
7
|
+
test("scalars: strings, integers, floats, booleans", () => {
|
|
8
|
+
const doc = parseTOML(`
|
|
9
|
+
name = "my-worker"
|
|
10
|
+
count = 42
|
|
11
|
+
ratio = 3.14
|
|
12
|
+
negative = -7
|
|
13
|
+
enabled = true
|
|
14
|
+
disabled = false
|
|
15
|
+
literal = 'raw \\n text'
|
|
16
|
+
`);
|
|
17
|
+
expect(doc.name).toBe("my-worker");
|
|
18
|
+
expect(doc.count).toBe(42);
|
|
19
|
+
expect(doc.ratio).toBeCloseTo(3.14);
|
|
20
|
+
expect(doc.negative).toBe(-7);
|
|
21
|
+
expect(doc.enabled).toBe(true);
|
|
22
|
+
expect(doc.disabled).toBe(false);
|
|
23
|
+
expect(doc.literal).toBe("raw \\n text");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test("double-quoted string escapes", () => {
|
|
27
|
+
const doc = parseTOML(`s = "line1\\nline2\\ttabbed \\"quoted\\""`);
|
|
28
|
+
expect(doc.s).toBe('line1\nline2\ttabbed "quoted"');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("comments are ignored", () => {
|
|
32
|
+
const doc = parseTOML(`
|
|
33
|
+
# a top comment
|
|
34
|
+
a = 1 # trailing comment
|
|
35
|
+
# another
|
|
36
|
+
b = 2
|
|
37
|
+
`);
|
|
38
|
+
expect(doc).toEqual({ a: 1, b: 2 });
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("arrays: single-line and multi-line", () => {
|
|
42
|
+
const doc = parseTOML(`
|
|
43
|
+
inline = [1, 2, 3]
|
|
44
|
+
multi = [
|
|
45
|
+
"a",
|
|
46
|
+
"b",
|
|
47
|
+
"c",
|
|
48
|
+
]
|
|
49
|
+
`);
|
|
50
|
+
expect(doc.inline).toEqual([1, 2, 3]);
|
|
51
|
+
expect(doc.multi).toEqual(["a", "b", "c"]);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("inline tables", () => {
|
|
55
|
+
const doc = parseTOML(`route = { pattern = "api.example.com/*", zone_name = "example.com" }`);
|
|
56
|
+
expect(doc.route).toEqual({ pattern: "api.example.com/*", zone_name: "example.com" });
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("array of inline tables", () => {
|
|
60
|
+
const doc = parseTOML(`routes = [{ pattern = "a/*", zone_name = "a.com" }, { pattern = "b/*", zone_name = "b.com" }]`);
|
|
61
|
+
expect(doc.routes).toEqual([
|
|
62
|
+
{ pattern: "a/*", zone_name: "a.com" },
|
|
63
|
+
{ pattern: "b/*", zone_name: "b.com" },
|
|
64
|
+
]);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("standard tables, nested dotted tables", () => {
|
|
68
|
+
const doc = parseTOML(`
|
|
69
|
+
[observability]
|
|
70
|
+
enabled = false
|
|
71
|
+
|
|
72
|
+
[env.production]
|
|
73
|
+
workers_dev = false
|
|
74
|
+
|
|
75
|
+
[env.production.vars]
|
|
76
|
+
ENVIRONMENT = "production"
|
|
77
|
+
`);
|
|
78
|
+
expect(doc.observability).toEqual({ enabled: false });
|
|
79
|
+
expect(doc.env).toEqual({ production: { workers_dev: false, vars: { ENVIRONMENT: "production" } } });
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test("arrays of tables accumulate entries", () => {
|
|
83
|
+
const doc = parseTOML(`
|
|
84
|
+
[[kv_namespaces]]
|
|
85
|
+
binding = "MY_KV"
|
|
86
|
+
id = "abc123"
|
|
87
|
+
|
|
88
|
+
[[kv_namespaces]]
|
|
89
|
+
binding = "OTHER_KV"
|
|
90
|
+
id = "def456"
|
|
91
|
+
`);
|
|
92
|
+
expect(doc.kv_namespaces).toEqual([
|
|
93
|
+
{ binding: "MY_KV", id: "abc123" },
|
|
94
|
+
{ binding: "OTHER_KV", id: "def456" },
|
|
95
|
+
]);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("dotted keys create nested tables inline", () => {
|
|
99
|
+
const doc = parseTOML(`a.b.c = 1\na.b.d = 2`);
|
|
100
|
+
expect(doc.a).toEqual({ b: { c: 1, d: 2 } });
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("a full representative wrangler.toml", () => {
|
|
104
|
+
const src = `
|
|
105
|
+
name = "my-worker"
|
|
106
|
+
main = "src/index.ts"
|
|
107
|
+
compatibility_date = "2024-01-01"
|
|
108
|
+
workers_dev = true
|
|
109
|
+
|
|
110
|
+
[observability]
|
|
111
|
+
enabled = false
|
|
112
|
+
|
|
113
|
+
[vars]
|
|
114
|
+
ENVIRONMENT = "production"
|
|
115
|
+
|
|
116
|
+
[[kv_namespaces]]
|
|
117
|
+
binding = "MY_KV"
|
|
118
|
+
id = "abc123"
|
|
119
|
+
|
|
120
|
+
[[r2_buckets]]
|
|
121
|
+
binding = "MY_BUCKET"
|
|
122
|
+
bucket_name = "my-bucket"
|
|
123
|
+
|
|
124
|
+
[triggers]
|
|
125
|
+
crons = ["0 0 * * *"]
|
|
126
|
+
|
|
127
|
+
[[routes]]
|
|
128
|
+
pattern = "example.com/*"
|
|
129
|
+
zone_name = "example.com"
|
|
130
|
+
|
|
131
|
+
[env.production]
|
|
132
|
+
workers_dev = false
|
|
133
|
+
|
|
134
|
+
[env.production.vars]
|
|
135
|
+
ENVIRONMENT = "production"
|
|
136
|
+
`;
|
|
137
|
+
const doc = parseTOML(src);
|
|
138
|
+
expect(doc.name).toBe("my-worker");
|
|
139
|
+
expect(doc.workers_dev).toBe(true);
|
|
140
|
+
expect(doc.observability).toEqual({ enabled: false });
|
|
141
|
+
expect(doc.vars).toEqual({ ENVIRONMENT: "production" });
|
|
142
|
+
expect(doc.kv_namespaces).toEqual([{ binding: "MY_KV", id: "abc123" }]);
|
|
143
|
+
expect(doc.r2_buckets).toEqual([{ binding: "MY_BUCKET", bucket_name: "my-bucket" }]);
|
|
144
|
+
expect(doc.triggers).toEqual({ crons: ["0 0 * * *"] });
|
|
145
|
+
expect(doc.routes).toEqual([{ pattern: "example.com/*", zone_name: "example.com" }]);
|
|
146
|
+
expect(doc.env).toEqual({ production: { workers_dev: false, vars: { ENVIRONMENT: "production" } } });
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test("throws TomlParseError on malformed input, rather than a generic error", () => {
|
|
150
|
+
expect(() => parseTOML("a = ")).toThrow(TomlParseError);
|
|
151
|
+
expect(() => parseTOML("[unterminated")).toThrow(TomlParseError);
|
|
152
|
+
expect(() => parseTOML('a = "unterminated')).toThrow(TomlParseError);
|
|
204
153
|
});
|
|
205
|
-
|
|
206
|
-
test("
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
`);
|
|
212
|
-
const flyway = result.flyway as Record<string, unknown>;
|
|
213
|
-
expect(flyway.encoding).toBe("UTF-8");
|
|
214
|
-
expect(flyway.cleanDisabled).toBe(true);
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
test("parses dotted table paths", () => {
|
|
218
|
-
const result = parseTOML(`
|
|
219
|
-
[environments.dev]
|
|
220
|
-
url = "jdbc:postgresql://localhost:5432/devdb"
|
|
221
|
-
user = "dev_user"
|
|
222
|
-
`);
|
|
223
|
-
const envs = result.environments as Record<string, unknown>;
|
|
224
|
-
const dev = envs.dev as Record<string, unknown>;
|
|
225
|
-
expect(dev.url).toBe("jdbc:postgresql://localhost:5432/devdb");
|
|
226
|
-
expect(dev.user).toBe("dev_user");
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
test("parses array of tables", () => {
|
|
230
|
-
const result = parseTOML(`
|
|
231
|
-
[[servers]]
|
|
232
|
-
host = "alpha"
|
|
233
|
-
port = 5432
|
|
234
|
-
|
|
235
|
-
[[servers]]
|
|
236
|
-
host = "beta"
|
|
237
|
-
port = 5433
|
|
238
|
-
`);
|
|
239
|
-
const servers = result.servers as Record<string, unknown>[];
|
|
240
|
-
expect(servers).toHaveLength(2);
|
|
241
|
-
expect(servers[0].host).toBe("alpha");
|
|
242
|
-
expect(servers[0].port).toBe(5432);
|
|
243
|
-
expect(servers[1].host).toBe("beta");
|
|
244
|
-
expect(servers[1].port).toBe(5433);
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
test("ignores comments", () => {
|
|
248
|
-
const result = parseTOML(`
|
|
249
|
-
# This is a comment
|
|
250
|
-
name = "test" # inline comment
|
|
251
|
-
# Another comment
|
|
252
|
-
version = 1
|
|
253
|
-
`);
|
|
254
|
-
expect(result.name).toBe("test");
|
|
255
|
-
expect(result.version).toBe(1);
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
test("parses boolean values", () => {
|
|
259
|
-
const result = parseTOML(`
|
|
260
|
-
enabled = true
|
|
261
|
-
disabled = false
|
|
262
|
-
`);
|
|
263
|
-
expect(result.enabled).toBe(true);
|
|
264
|
-
expect(result.disabled).toBe(false);
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
test("parses inline tables", () => {
|
|
268
|
-
const result = parseTOML(`
|
|
269
|
-
point = { x = 1, y = 2 }
|
|
270
|
-
`);
|
|
271
|
-
const point = result.point as Record<string, unknown>;
|
|
272
|
-
expect(point.x).toBe(1);
|
|
273
|
-
expect(point.y).toBe(2);
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
test("parses literal strings (single quotes)", () => {
|
|
277
|
-
const result = parseTOML(`
|
|
278
|
-
path = 'C:\\Users\\admin'
|
|
279
|
-
`);
|
|
280
|
-
expect(result.path).toBe("C:\\Users\\admin");
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
test("parses escaped strings", () => {
|
|
284
|
-
const result = parseTOML(`
|
|
285
|
-
escaped = "line1\\nline2"
|
|
286
|
-
`);
|
|
287
|
-
expect(result.escaped).toBe("line1\nline2");
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
test("parses empty values", () => {
|
|
291
|
-
const result = parseTOML(`
|
|
292
|
-
empty_string = ""
|
|
293
|
-
empty_array = []
|
|
294
|
-
`);
|
|
295
|
-
expect(result.empty_string).toBe("");
|
|
296
|
-
expect(result.empty_array).toEqual([]);
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
test("parses Flyway-realistic config", () => {
|
|
300
|
-
const result = parseTOML(`
|
|
301
|
-
[flyway]
|
|
302
|
-
locations = ["filesystem:sql/migrations"]
|
|
303
|
-
defaultSchema = "public"
|
|
304
|
-
schemas = ["public", "audit"]
|
|
305
|
-
encoding = "UTF-8"
|
|
306
|
-
validateMigrationNaming = true
|
|
307
|
-
cleanDisabled = true
|
|
308
|
-
baselineVersion = "1"
|
|
309
|
-
table = "flyway_schema_history"
|
|
310
|
-
|
|
311
|
-
[flyway.placeholders]
|
|
312
|
-
defaultSchema = "public"
|
|
313
|
-
appName = "myapp"
|
|
314
|
-
|
|
315
|
-
[environments.dev]
|
|
316
|
-
url = "jdbc:postgresql://localhost:5432/devdb"
|
|
317
|
-
user = "dev_user"
|
|
318
|
-
schemas = ["public"]
|
|
319
|
-
|
|
320
|
-
[environments.prod]
|
|
321
|
-
url = "jdbc:postgresql://prod-host:5432/proddb"
|
|
322
|
-
user = "prod_user"
|
|
323
|
-
schemas = ["public", "audit"]
|
|
324
|
-
`);
|
|
325
|
-
|
|
326
|
-
const flyway = result.flyway as Record<string, unknown>;
|
|
327
|
-
expect(flyway.defaultSchema).toBe("public");
|
|
328
|
-
expect(flyway.validateMigrationNaming).toBe(true);
|
|
329
|
-
expect((flyway.placeholders as Record<string, unknown>).appName).toBe("myapp");
|
|
330
|
-
|
|
331
|
-
const envs = result.environments as Record<string, unknown>;
|
|
332
|
-
const dev = envs.dev as Record<string, unknown>;
|
|
333
|
-
expect(dev.url).toBe("jdbc:postgresql://localhost:5432/devdb");
|
|
334
|
-
|
|
335
|
-
const prod = envs.prod as Record<string, unknown>;
|
|
336
|
-
expect(prod.schemas).toEqual(["public", "audit"]);
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
describe("roundtrip", () => {
|
|
341
|
-
test("emit → parse → emit preserves structure", () => {
|
|
342
|
-
const original = {
|
|
343
|
-
name: "roundtrip-test",
|
|
344
|
-
flyway: {
|
|
345
|
-
locations: ["filesystem:sql"],
|
|
346
|
-
encoding: "UTF-8",
|
|
347
|
-
cleanDisabled: true,
|
|
348
|
-
baselineVersion: "1",
|
|
349
|
-
placeholders: {
|
|
350
|
-
schema: "public",
|
|
351
|
-
},
|
|
352
|
-
},
|
|
353
|
-
environments: {
|
|
354
|
-
dev: {
|
|
355
|
-
url: "jdbc:postgresql://localhost:5432/db",
|
|
356
|
-
user: "admin",
|
|
357
|
-
schemas: ["public"],
|
|
358
|
-
},
|
|
359
|
-
},
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
const toml = emitTOML(original);
|
|
363
|
-
const parsed = parseTOML(toml);
|
|
364
|
-
const toml2 = emitTOML(parsed);
|
|
365
|
-
|
|
366
|
-
expect(toml2).toBe(toml);
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
test("roundtrip with booleans and numbers", () => {
|
|
370
|
-
const original = {
|
|
371
|
-
settings: {
|
|
372
|
-
enabled: true,
|
|
373
|
-
disabled: false,
|
|
374
|
-
count: 42,
|
|
375
|
-
ratio: 3.14,
|
|
376
|
-
},
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
const toml = emitTOML(original);
|
|
380
|
-
const parsed = parseTOML(toml);
|
|
381
|
-
|
|
382
|
-
const settings = parsed.settings as Record<string, unknown>;
|
|
383
|
-
expect(settings.enabled).toBe(true);
|
|
384
|
-
expect(settings.disabled).toBe(false);
|
|
385
|
-
expect(settings.count).toBe(42);
|
|
386
|
-
expect(settings.ratio).toBe(3.14);
|
|
154
|
+
|
|
155
|
+
test("is pure: no fs/network globals referenced (Workers-safety smoke check)", () => {
|
|
156
|
+
const src = readFileSync(fileURLToPath(new URL("./toml.ts", import.meta.url)), "utf-8");
|
|
157
|
+
expect(src).not.toMatch(/\brequire\(/);
|
|
158
|
+
expect(src).not.toMatch(/\bfetch\(/);
|
|
159
|
+
expect(src).not.toMatch(/\bimport\.meta\.url\b/);
|
|
387
160
|
});
|
|
388
161
|
});
|