@intentius/chant 0.52.1 → 0.53.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.
Files changed (149) hide show
  1. package/dist/agents/checks.d.ts +35 -0
  2. package/dist/agents/checks.d.ts.map +1 -0
  3. package/dist/agents/discover.d.ts +86 -0
  4. package/dist/agents/discover.d.ts.map +1 -0
  5. package/dist/agents/importer.d.ts +46 -0
  6. package/dist/agents/importer.d.ts.map +1 -0
  7. package/dist/agents/index.d.ts +14 -0
  8. package/dist/agents/index.d.ts.map +1 -0
  9. package/dist/agents/types.d.ts +196 -0
  10. package/dist/agents/types.d.ts.map +1 -0
  11. package/dist/audit/catalog.d.ts +4 -1
  12. package/dist/audit/catalog.d.ts.map +1 -1
  13. package/dist/audit/report.d.ts +8 -0
  14. package/dist/audit/report.d.ts.map +1 -1
  15. package/dist/audit/rules-doc.d.ts.map +1 -1
  16. package/dist/cdk/advise.d.ts +29 -0
  17. package/dist/cdk/advise.d.ts.map +1 -0
  18. package/dist/cdk/assembly.d.ts +38 -0
  19. package/dist/cdk/assembly.d.ts.map +1 -0
  20. package/dist/cdk/graph.d.ts +68 -0
  21. package/dist/cdk/graph.d.ts.map +1 -0
  22. package/dist/cdk/tier-map.d.ts +44 -0
  23. package/dist/cdk/tier-map.d.ts.map +1 -0
  24. package/dist/cdk/types.d.ts +114 -0
  25. package/dist/cdk/types.d.ts.map +1 -0
  26. package/dist/cli/commands/audit-agents.d.ts +83 -0
  27. package/dist/cli/commands/audit-agents.d.ts.map +1 -0
  28. package/dist/cli/commands/carve-apply.d.ts.map +1 -1
  29. package/dist/cli/commands/carve-bridge.d.ts.map +1 -1
  30. package/dist/cli/commands/carve-emit.d.ts.map +1 -1
  31. package/dist/cli/commands/carve.d.ts +48 -6
  32. package/dist/cli/commands/carve.d.ts.map +1 -1
  33. package/dist/cli/commands/import-agents.d.ts +64 -0
  34. package/dist/cli/commands/import-agents.d.ts.map +1 -0
  35. package/dist/cli/handlers/carve-emit.d.ts.map +1 -1
  36. package/dist/cli/handlers/carve.d.ts +5 -4
  37. package/dist/cli/handlers/carve.d.ts.map +1 -1
  38. package/dist/cli/handlers/lifecycle.d.ts +10 -0
  39. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  40. package/dist/cli/handlers/misc.d.ts.map +1 -1
  41. package/dist/cli/main.d.ts.map +1 -1
  42. package/dist/cli/registry.d.ts +15 -0
  43. package/dist/cli/registry.d.ts.map +1 -1
  44. package/dist/identity.d.ts +196 -0
  45. package/dist/identity.d.ts.map +1 -0
  46. package/dist/index.d.ts +1 -0
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/lexicon.d.ts +52 -0
  49. package/dist/lexicon.d.ts.map +1 -1
  50. package/dist/terraform/adopt-state.d.ts +17 -63
  51. package/dist/terraform/adopt-state.d.ts.map +1 -1
  52. package/dist/terraform/aws-resources.d.ts +1 -1
  53. package/dist/terraform/bridge.d.ts.map +1 -1
  54. package/dist/terraform/carve-provider.d.ts +142 -0
  55. package/dist/terraform/carve-provider.d.ts.map +1 -0
  56. package/dist/terraform/carve.d.ts +36 -3
  57. package/dist/terraform/carve.d.ts.map +1 -1
  58. package/dist/terraform/emit-source.d.ts +25 -0
  59. package/dist/terraform/emit-source.d.ts.map +1 -0
  60. package/dist/terraform/graduate.d.ts +11 -1
  61. package/dist/terraform/graduate.d.ts.map +1 -1
  62. package/dist/terraform/providers/aws.d.ts +19 -0
  63. package/dist/terraform/providers/aws.d.ts.map +1 -0
  64. package/dist/terraform/providers/gcp.d.ts +41 -0
  65. package/dist/terraform/providers/gcp.d.ts.map +1 -0
  66. package/dist/terraform/providers/index.d.ts +15 -0
  67. package/dist/terraform/providers/index.d.ts.map +1 -0
  68. package/dist/terraform/providers/kubernetes.d.ts +29 -0
  69. package/dist/terraform/providers/kubernetes.d.ts.map +1 -0
  70. package/dist/terraform/score.d.ts +70 -4
  71. package/dist/terraform/score.d.ts.map +1 -1
  72. package/dist/terraform/tier-map.d.ts +38 -26
  73. package/dist/terraform/tier-map.d.ts.map +1 -1
  74. package/dist/terraform/types.d.ts +6 -0
  75. package/dist/terraform/types.d.ts.map +1 -1
  76. package/dist/yaml.d.ts.map +1 -1
  77. package/package.json +6 -1
  78. package/src/agents/checks.test.ts +228 -0
  79. package/src/agents/checks.ts +429 -0
  80. package/src/agents/discover.test.ts +310 -0
  81. package/src/agents/discover.ts +939 -0
  82. package/src/agents/importer.ts +49 -0
  83. package/src/agents/index.ts +29 -0
  84. package/src/agents/types.ts +207 -0
  85. package/src/audit/catalog.ts +90 -1
  86. package/src/audit/report.ts +9 -1
  87. package/src/audit/rules-doc.ts +6 -0
  88. package/src/cdk/__fixtures__/cdk.out/AppStack.template.json +171 -0
  89. package/src/cdk/__fixtures__/cdk.out/DataStack.template.json +90 -0
  90. package/src/cdk/__fixtures__/cdk.out/cdk.out +1 -0
  91. package/src/cdk/__fixtures__/cdk.out/manifest.json +30 -0
  92. package/src/cdk/__fixtures__/cdk.out/tree.json +201 -0
  93. package/src/cdk/__fixtures__/cdk.out-dummy/LookupStack.template.json +29 -0
  94. package/src/cdk/__fixtures__/cdk.out-dummy/manifest.json +26 -0
  95. package/src/cdk/advise.test.ts +208 -0
  96. package/src/cdk/advise.ts +44 -0
  97. package/src/cdk/assembly.ts +133 -0
  98. package/src/cdk/graph.test.ts +206 -0
  99. package/src/cdk/graph.ts +525 -0
  100. package/src/cdk/tier-map.ts +71 -0
  101. package/src/cdk/types.ts +115 -0
  102. package/src/cli/commands/audit-agents.test.ts +260 -0
  103. package/src/cli/commands/audit-agents.ts +387 -0
  104. package/src/cli/commands/carve-apply.ts +20 -4
  105. package/src/cli/commands/carve-bridge.test.ts +30 -0
  106. package/src/cli/commands/carve-bridge.ts +24 -2
  107. package/src/cli/commands/carve-emit-k8s.test.ts +262 -0
  108. package/src/cli/commands/carve-emit-provider.test.ts +207 -0
  109. package/src/cli/commands/carve-emit.test.ts +72 -1
  110. package/src/cli/commands/carve-emit.ts +55 -28
  111. package/src/cli/commands/carve.ts +139 -36
  112. package/src/cli/commands/import-agents.test.ts +208 -0
  113. package/src/cli/commands/import-agents.ts +196 -0
  114. package/src/cli/handlers/carve-emit.ts +8 -1
  115. package/src/cli/handlers/carve.ts +8 -7
  116. package/src/cli/handlers/lifecycle.test.ts +187 -1
  117. package/src/cli/handlers/lifecycle.ts +125 -1
  118. package/src/cli/handlers/misc.ts +111 -0
  119. package/src/cli/main.ts +29 -5
  120. package/src/cli/registry.ts +15 -0
  121. package/src/identity.test.ts +199 -0
  122. package/src/identity.ts +346 -0
  123. package/src/index.ts +1 -0
  124. package/src/lexicon.ts +65 -0
  125. package/src/terraform/__fixtures__/gcp-estate/main.tf +60 -0
  126. package/src/terraform/adopt-state.test.ts +131 -0
  127. package/src/terraform/adopt-state.ts +22 -167
  128. package/src/terraform/aws-resources.test.ts +55 -16
  129. package/src/terraform/aws-resources.ts +1 -1
  130. package/src/terraform/bridge.test.ts +12 -0
  131. package/src/terraform/bridge.ts +4 -1
  132. package/src/terraform/carve-provider.test.ts +155 -0
  133. package/src/terraform/carve-provider.ts +237 -0
  134. package/src/terraform/carve.test.ts +55 -1
  135. package/src/terraform/carve.ts +0 -0
  136. package/src/terraform/emit-source.ts +39 -0
  137. package/src/terraform/graduate.test.ts +37 -0
  138. package/src/terraform/graduate.ts +55 -7
  139. package/src/terraform/graph.ts +3 -3
  140. package/src/terraform/providers/aws.ts +169 -0
  141. package/src/terraform/providers/gcp.test.ts +228 -0
  142. package/src/terraform/providers/gcp.ts +329 -0
  143. package/src/terraform/providers/index.ts +21 -0
  144. package/src/terraform/providers/kubernetes.ts +224 -0
  145. package/src/terraform/score.ts +111 -25
  146. package/src/terraform/tier-map.ts +55 -90
  147. package/src/terraform/types.ts +6 -0
  148. package/src/yaml.test.ts +54 -0
  149. package/src/yaml.ts +24 -3
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Checks over discovered agent configuration (the `AGT` rule family).
3
+ *
4
+ * The threat model these encode is specific, and worth stating because it is
5
+ * not the same as the CI threat model the rest of `chant audit` covers.
6
+ *
7
+ * An agent config is *executable surface that runs with the user's own
8
+ * credentials on the user's own machine, usually with no review step*. An MCP
9
+ * server entry is a command line that runs at session start; a skill is
10
+ * instructions the model will follow; a permission allowlist decides what runs
11
+ * without anyone being asked. All three are commonly installed with one
12
+ * command, are rarely re-read after the day they were added, and — for the
13
+ * remote-sourced ones — can change upstream without any local edit.
14
+ *
15
+ * So the checks concentrate on three questions:
16
+ * 1. **What executes, and is it pinned?** (AGT001, AGT004)
17
+ * 2. **What can read secrets or reach the network in the clear?** (AGT002, AGT003)
18
+ * 3. **What runs without asking, and over how many projects?** (AGT005, AGT006)
19
+ * Plus AGT007, which flags config that is silently shadowed — where what the
20
+ * user reads is not what the agent runs.
21
+ *
22
+ * Every check is read-only and pure over a scan result, so a caller can run
23
+ * them against a fixture tree with no machine access.
24
+ */
25
+ import type { AgentFinding, AgentScanResult } from "./types.js";
26
+ /** Rule ids in this family, in report order. Kept in sync with `audit/catalog.ts` by a drift test. */
27
+ export declare const AGENT_RULE_IDS: readonly ["AGT001", "AGT002", "AGT003", "AGT004", "AGT005", "AGT006", "AGT007", "AGT008"];
28
+ /**
29
+ * Run every agent-config check over a scan result.
30
+ *
31
+ * Findings are ordered by severity, then site, then rule — so the report leads
32
+ * with what executes unreviewed rather than with instruction-file hygiene.
33
+ */
34
+ export declare function checkAgentConfigs(scan: AgentScanResult): AgentFinding[];
35
+ //# sourceMappingURL=checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/agents/checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAmB,YAAY,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;AAE7F,sGAAsG;AACtG,eAAO,MAAM,cAAc,2FASjB,CAAC;AA8WX;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,YAAY,EAAE,CAmBvE"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Find every agent configuration on this machine and normalize it.
3
+ *
4
+ * The scan is location-driven, not walk-driven. Agent config does not hide in
5
+ * arbitrary places: each harness publishes a small, fixed set of paths it
6
+ * reads, so this module probes that list rather than crawling the filesystem.
7
+ * That keeps a full three-scope scan to a few dozen `stat` calls, and — more
8
+ * importantly — makes "we looked and it wasn't there" a fact the report can
9
+ * state (`AgentScanResult.probed`) instead of an absence of evidence.
10
+ *
11
+ * Two shapes recur across harnesses and are handled once here:
12
+ *
13
+ * - **A config is many files.** Claude Code merges `settings.json`,
14
+ * `settings.local.json`, `mcp.json`, and `~/.claude.json` into one
15
+ * effective configuration; codex puts the equivalent in one TOML file.
16
+ * Both land as a single {@link AgentConfigSite} with `sources` listing
17
+ * every file that contributed.
18
+ * - **MCP servers are declared in more than one place per scope.** Claude
19
+ * Code alone accepts them in `~/.claude/mcp.json`, `~/.claude.json`'s
20
+ * top-level `mcpServers`, and per-project entries under `~/.claude.json`'s
21
+ * `projects` map. `mergeMcp` collects all of them and keeps the *first*
22
+ * declaration of a name, matching the harness's own precedence.
23
+ *
24
+ * Nothing here judges what it finds — `checks.ts` owns that. Discovery's only
25
+ * editorial act is dropping sites with no content at all, so an empty
26
+ * `~/.gemini` directory doesn't become a resource.
27
+ */
28
+ import type { AgentRuntime, AgentScanResult, AgentScope, McpServerDecl } from "./types.js";
29
+ export interface ScanOptions {
30
+ /** Scopes to probe. Defaults to all three. */
31
+ scopes?: readonly AgentScope[];
32
+ /** Harnesses to probe. Defaults to all five. */
33
+ runtimes?: readonly AgentRuntime[];
34
+ /** Home directory. Injectable so tests can scan a fixture tree instead of the real machine. */
35
+ home?: string;
36
+ /** Platform, which decides where system-scope policy lives. Injectable for the same reason. */
37
+ platform?: NodeJS.Platform;
38
+ /** Directories to treat as project scope. Defaults to `[process.cwd()]`. */
39
+ projectRoots?: string[];
40
+ }
41
+ /**
42
+ * Machine-wide policy locations, by platform. Claude Code is the only harness
43
+ * of the five that defines a system scope today; the others are user-scoped
44
+ * only, which is itself worth reporting.
45
+ */
46
+ export declare function systemSettingsPaths(platform: NodeJS.Platform): string[];
47
+ /** Parse a markdown file's `---` YAML frontmatter. Returns `{}` when there is none. */
48
+ export declare function frontmatter(markdown: string): Record<string, unknown>;
49
+ /**
50
+ * Normalize one harness's `mcpServers` / `mcp_servers` map.
51
+ *
52
+ * Both dialects agree on the substance — a name mapping to either a `command`
53
+ * + `args` (stdio) or a `url` (http/sse) — so one normalizer serves Claude
54
+ * Code's JSON and codex's TOML. Keys this model names are lifted out; whatever
55
+ * remains is preserved in `extra` so a check can read a header or timeout
56
+ * without this function having to know about it.
57
+ */
58
+ export declare function normalizeMcpServers(raw: unknown, source: string): McpServerDecl[];
59
+ /**
60
+ * Scan the machine and return every agent configuration found.
61
+ *
62
+ * Sites are ordered system → user → project, matching the order the harnesses
63
+ * merge them, so a reader scanning the report sees broad policy before the
64
+ * narrow overrides that modify it.
65
+ */
66
+ export declare function scanAgentConfigs(opts?: ScanOptions): AgentScanResult;
67
+ /**
68
+ * Every project root the harness has registered on this machine, from
69
+ * `~/.claude.json`'s `projects` map.
70
+ *
71
+ * This is what makes `--all-projects` possible without crawling the disk: the
72
+ * harness already keeps the list of every project it has been opened in.
73
+ *
74
+ * Roots whose directory no longer exists are dropped. A deleted project is not
75
+ * something a user can act on, and counting it would make the "N projects not
76
+ * scanned" note overstate the gap — on a machine with 77 registered projects,
77
+ * 12 of them were stale.
78
+ */
79
+ export declare function registeredProjectRoots(home: string): string[];
80
+ /**
81
+ * Count registered project roots this scan did not visit. A user with dozens of
82
+ * registered projects should be told that a cwd-scoped scan saw one of them,
83
+ * rather than being left to assume it saw all.
84
+ */
85
+ export declare function unscannedProjectCount(home: string, scannedRoots: string[]): number;
86
+ //# sourceMappingURL=discover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/agents/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,OAAO,KAAK,EAEV,YAAY,EACZ,eAAe,EACf,UAAU,EAGV,aAAa,EAOd,MAAM,SAAS,CAAC;AAUjB,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,MAAM,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,gDAAgD;IAChD,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACnC,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,EAAE,CAIvE;AA6ID,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWrE;AAQD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,CAqCjF;AAmjBD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,WAAgB,GAAG,eAAe,CAsCxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAoB7D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAGlF"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The seam between neutral agent-config discovery and a lexicon's vocabulary.
3
+ *
4
+ * `discover.ts` deliberately knows nothing about chant resources — it reads
5
+ * five harnesses' config dialects and stops. Turning an {@link AgentConfigSite}
6
+ * into resources is a statement about a *target* (fountain's `Agent` and
7
+ * `Environment`, today), and that judgement belongs to the lexicon that owns
8
+ * those types, exactly as `templateParser()` puts CloudFormation's JSON
9
+ * vocabulary in the aws lexicon rather than in core.
10
+ *
11
+ * So a lexicon that can express local agent configuration implements
12
+ * {@link AgentConfigImporter} and returns it from
13
+ * `LexiconPlugin.agentConfigImporter()`. `chant import --agents` loads the
14
+ * plugin, hands it the scan, and pipes the resulting IR through the same
15
+ * `templateGenerator()` every other import path uses.
16
+ */
17
+ import type { TemplateIR } from "../import/parser.js";
18
+ import type { AgentConfigSite } from "./types.js";
19
+ /** A site the importer could not express, and why. */
20
+ export interface SkippedSite {
21
+ siteId: string;
22
+ reason: string;
23
+ }
24
+ /**
25
+ * The result of re-expressing a scan.
26
+ *
27
+ * The three report arrays exist because this conversion is lossy in ways the
28
+ * user must be told about: a site that couldn't be mapped, a required property
29
+ * that had to be defaulted, and a secret that was rewritten rather than copied
30
+ * are all things a reader would otherwise discover only by diffing the output
31
+ * against their own config.
32
+ */
33
+ export interface AgentImportOutcome {
34
+ ir: TemplateIR;
35
+ /** Sites that could not be re-expressed in this lexicon's vocabulary. */
36
+ skipped: SkippedSite[];
37
+ /** Site ids where a required property was filled with a default rather than a discovered value. */
38
+ unmappedModel: string[];
39
+ /** Site ids where a literal credential was replaced with an environment reference. */
40
+ redactedSecrets: string[];
41
+ }
42
+ /** Converts discovered agent configuration into a lexicon's resource IR. */
43
+ export interface AgentConfigImporter {
44
+ toTemplateIR(sites: AgentConfigSite[]): AgentImportOutcome;
45
+ }
46
+ //# sourceMappingURL=importer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../../src/agents/importer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,sDAAsD;AACtD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,UAAU,CAAC;IACf,yEAAyE;IACzE,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,mGAAmG;IACnG,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,sFAAsF;IACtF,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC;CAC5D"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Agent-configuration discovery and checks.
3
+ *
4
+ * Finds the agent configs on a machine (`discover.ts`), judges them
5
+ * (`checks.ts`), and normalizes both onto one vendor-neutral model
6
+ * (`types.ts`). The two consumers are `chant audit --agents`, which reports on
7
+ * what it finds, and `chant import --agents`, which re-expresses it as chant
8
+ * code via a lexicon's IR mapper.
9
+ */
10
+ export type { AgentConfigSite, AgentFinding, AgentRuntime, AgentScanResult, AgentScope, CommandDecl, InstructionFile, McpServerDecl, McpTransport, PermissionConfig, PluginDecl, SkillDecl, SkillOrigin, SubagentDecl, } from "./types.js";
11
+ export { AGENT_RUNTIMES, AGENT_SCOPES } from "./types.js";
12
+ export { scanAgentConfigs, normalizeMcpServers, frontmatter, systemSettingsPaths, unscannedProjectCount, type ScanOptions } from "./discover.js";
13
+ export { checkAgentConfigs, AGENT_RULE_IDS } from "./checks.js";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EACV,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,UAAU,EACV,WAAW,EACX,eAAe,EACf,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,WAAW,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9I,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,196 @@
1
+ /**
2
+ * The normalized model for an agent configuration found on a machine.
3
+ *
4
+ * Five harnesses (claude, codex, gemini, opencode, cursor) each spell the same
5
+ * four ideas differently — standing instructions, tool servers, reusable
6
+ * skills, and ambient settings. `discover.ts` reads each harness's own dialect
7
+ * and lands here; everything downstream (`checks.ts`, the report, the fountain
8
+ * IR mapping) reads only this shape and never a vendor file format again.
9
+ *
10
+ * The `AgentConfigSite` boundary is deliberately "one config that governs one
11
+ * root, for one runtime" rather than "one file". A single Claude Code site is
12
+ * assembled from `CLAUDE.md` + `settings.json` + `settings.local.json` +
13
+ * `mcp.json` + `~/.claude.json` + a `skills/` tree — six files that are only
14
+ * meaningful together, and that the agent itself experiences as one merged
15
+ * configuration. `sources` keeps the receipts so a finding can point at the
16
+ * actual file the reader has to edit.
17
+ */
18
+ /**
19
+ * Which agent harness a config belongs to. The first four are exactly
20
+ * fountain's `Agent.runtime` enum, so they re-express losslessly; `cursor` is
21
+ * discovered and reported but has no fountain runtime to map onto (see
22
+ * `MAPPABLE_RUNTIMES` in the fountain import mapper).
23
+ */
24
+ export type AgentRuntime = "claude" | "codex" | "gemini" | "opencode" | "cursor";
25
+ /**
26
+ * Blast radius of a config, in the order harnesses merge them (later wins).
27
+ *
28
+ * - `system` — machine-wide policy, typically administrator-installed and not
29
+ * user-editable (Claude Code's `managed-settings.json`).
30
+ * - `user` — the home directory. Applies to *every* project the user opens,
31
+ * which is what makes it the highest-leverage scope to audit.
32
+ * - `project` — checked into (or sitting beside) a repo. Narrowest scope, but
33
+ * the one most likely to arrive from someone else.
34
+ */
35
+ export type AgentScope = "system" | "user" | "project";
36
+ export declare const AGENT_SCOPES: readonly AgentScope[];
37
+ export declare const AGENT_RUNTIMES: readonly AgentRuntime[];
38
+ /** A standing-instructions file (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules). */
39
+ export interface InstructionFile {
40
+ /** Absolute path on disk. */
41
+ path: string;
42
+ /** File contents. Read in full — these become fountain's `Agent.system`. */
43
+ content: string;
44
+ bytes: number;
45
+ }
46
+ /** How an MCP server is reached. `unknown` when the declaration has neither a command nor a URL. */
47
+ export type McpTransport = "stdio" | "http" | "sse" | "unknown";
48
+ /** One MCP server declaration, normalized across the several files that can declare one. */
49
+ export interface McpServerDecl {
50
+ name: string;
51
+ transport: McpTransport;
52
+ /** The file this declaration was read from. */
53
+ source: string;
54
+ /** stdio: the executable. */
55
+ command?: string;
56
+ /** stdio: argv after the executable. */
57
+ args?: string[];
58
+ /** http/sse: the endpoint. */
59
+ url?: string;
60
+ /** Environment handed to the server process. Values are kept verbatim — `checks.ts` is what decides whether one looks like a literal credential. */
61
+ env?: Record<string, string>;
62
+ /** Extra keys the harness accepted that this model doesn't name (headers, timeouts, …). */
63
+ extra?: Record<string, unknown>;
64
+ }
65
+ /**
66
+ * Where a skill came from. This distinction is the whole point of the skill
67
+ * checks: a `local` skill is text the user can read in their own filesystem,
68
+ * while `plugin`/`marketplace` skills are fetched from a remote and can change
69
+ * under the user without any edit to their machine.
70
+ */
71
+ export type SkillOrigin = "local" | "plugin" | "marketplace";
72
+ /** One skill available to the agent. */
73
+ export interface SkillDecl {
74
+ name: string;
75
+ origin: SkillOrigin;
76
+ /** Absolute path to the skill directory or SKILL.md, when it exists on disk. */
77
+ path?: string;
78
+ /** Remote source (`owner/repo`, a URL) for plugin/marketplace skills. */
79
+ source?: string;
80
+ /** Version pin on `source`: a tag, branch, or sha. Absence is what AGT004 flags. */
81
+ ref?: string;
82
+ /** SKILL.md body, when read. Becomes fountain's inline `{name, content}` skill form. */
83
+ content?: string;
84
+ /** The skill's own frontmatter `description`, used for the fountain `description`. */
85
+ description?: string;
86
+ }
87
+ /** A subagent / custom agent definition (`.claude/agents/*.md`). */
88
+ export interface SubagentDecl {
89
+ name: string;
90
+ path: string;
91
+ description?: string;
92
+ /** Tool allowlist declared in frontmatter, if any. */
93
+ tools?: string;
94
+ model?: string;
95
+ }
96
+ /** A slash command definition (`.claude/commands/*.md`, `~/.codex/prompts`). */
97
+ export interface CommandDecl {
98
+ name: string;
99
+ path: string;
100
+ description?: string;
101
+ }
102
+ /** An installed plugin — a bundle that can inject skills, commands, and MCP servers at once. */
103
+ export interface PluginDecl {
104
+ name: string;
105
+ /** Marketplace or repo the plugin was installed from. */
106
+ marketplace?: string;
107
+ /** Version pin, when the install recorded one. */
108
+ ref?: string;
109
+ enabled: boolean;
110
+ /**
111
+ * True when the plugin tracks a remote the user does not control.
112
+ *
113
+ * The pinning checks turn on this: a plugin vendored from a local directory
114
+ * cannot change underneath the user, so "pin it" is not advice that applies.
115
+ * Harnesses ship bundled plugins from local paths (codex's
116
+ * `source_type = "local"`), and reporting those as unpinned supply chain is
117
+ * noise that trains the reader to skip the rule.
118
+ */
119
+ remote: boolean;
120
+ }
121
+ /** Tool-permission configuration, normalized from a harness's own settings shape. */
122
+ export interface PermissionConfig {
123
+ allow?: string[];
124
+ deny?: string[];
125
+ ask?: string[];
126
+ defaultMode?: string;
127
+ /** True when the config disables a confirmation prompt outright. */
128
+ bypassesPrompts?: boolean;
129
+ }
130
+ /**
131
+ * One complete agent configuration governing one root, for one runtime.
132
+ *
133
+ * Assembled from every file at that scope the harness would merge together —
134
+ * see the module docstring for why the file is not the unit.
135
+ */
136
+ export interface AgentConfigSite {
137
+ /** Stable slug, unique within a scan: `user-claude`, `project-claude-chant`. Becomes the fountain resource name. */
138
+ id: string;
139
+ scope: AgentScope;
140
+ runtime: AgentRuntime;
141
+ /** Directory this configuration governs. For `user` scope, the home directory. */
142
+ root: string;
143
+ /** Every file that contributed, absolute. A site with no sources is never emitted. */
144
+ sources: string[];
145
+ instructions: InstructionFile[];
146
+ mcpServers: McpServerDecl[];
147
+ skills: SkillDecl[];
148
+ subagents: SubagentDecl[];
149
+ commands: CommandDecl[];
150
+ plugins: PluginDecl[];
151
+ /** Environment variables the harness injects into every session. */
152
+ env: Record<string, string>;
153
+ permissions?: PermissionConfig;
154
+ /** Default model pinned by the config, when set. */
155
+ model?: string;
156
+ /**
157
+ * Raw merged settings, kept so a check can interrogate a key this model
158
+ * doesn't name without a schema change. Not used for codegen.
159
+ */
160
+ settings: Record<string, unknown>;
161
+ }
162
+ /** Everything one scan found, plus what it couldn't read. */
163
+ export interface AgentScanResult {
164
+ sites: AgentConfigSite[];
165
+ /** Locations probed and found absent — useful for "is it really not configured, or did I not look?" */
166
+ probed: string[];
167
+ /** Paths that existed but could not be read or parsed, with the reason. */
168
+ unreadable: Array<{
169
+ path: string;
170
+ reason: string;
171
+ }>;
172
+ /**
173
+ * Every MCP declaration each site saw, keyed by site id — including names
174
+ * that lost the first-wins merge and so do not appear in
175
+ * `AgentConfigSite.mcpServers`. Diagnostic data for the shadowing check
176
+ * (AGT007), kept beside the sites rather than on them because it describes
177
+ * the *discovery*, not the configuration being re-expressed.
178
+ */
179
+ declarations: Record<string, McpServerDecl[]>;
180
+ }
181
+ /** A finding raised by an agent-config check against a discovered site. */
182
+ export interface AgentFinding {
183
+ /** Catalog id, e.g. `AGT001`. */
184
+ checkId: string;
185
+ severity: "error" | "warning" | "info";
186
+ message: string;
187
+ /** The specific file a reader has to open to fix this. */
188
+ file: string;
189
+ /** The site the finding belongs to. */
190
+ siteId: string;
191
+ scope: AgentScope;
192
+ runtime: AgentRuntime;
193
+ /** The named thing within the site (an MCP server name, a skill name). */
194
+ entity?: string;
195
+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AO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -69,6 +69,8 @@ export declare const CF_SECRETS: Authority;
69
69
  export declare const CF_ROUTES: Authority;
70
70
  export declare const CF_ENVIRONMENTS: Authority;
71
71
  export declare const CF_STATIC_ASSETS: Authority;
72
+ export declare const CWE_HARDCODED_CREDS: Authority;
73
+ export declare const CWE_CLEARTEXT: Authority;
72
74
  /**
73
75
  * Finding category per rule (#415). Curated: security rules are those that
74
76
  * cite an authority or guard an exposure; correctness rules flag structural
@@ -81,7 +83,8 @@ export declare const RULE_CATEGORY: Record<string, Category>;
81
83
  * CloudFormation ids (COR/EXT) that aren't owned by a single lexicon. Every
82
84
  * per-provider block moved to its lexicon's `auditCatalog()` (#687): WAW→aws,
83
85
  * WGC→gcp, AZR→azure, DKRD→docker, WK8/ARGO→k8s, WHM→helm, GHA→github,
84
- * WGL→gitlab, WFJ→forgejo. `resolveAuditCatalog` merges those over this map.
86
+ * WGL→gitlab, WFJ→forgejo. `resolveAuditCatalog` merges those over this map,
87
+ * alongside the lexicon-independent SEC/WRG/AGT families core owns outright.
85
88
  */
86
89
  export declare const RULE_CATALOG: Record<string, RuleMeta>;
87
90
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/audit/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,MAAM,IAAI,GAAG,cAAc,GAAG,aAAa,CAAC;AAElD,wFAAwF;AACxF,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,UAAU,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAA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;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAkFjD,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,GACtD,QAAQ,CAGV;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAqB/F;AAED,yDAAyD;AACzD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAEzD;AAED,wEAAwE;AACxE,eAAO,MAAM,cAAc,mCAAmC,CAAC;AAE/D,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE7C"}
@@ -28,6 +28,14 @@ export interface RenderOptions {
28
28
  notes?: string[];
29
29
  /** Resolved audit catalog (core static + active lexicons' contributions, #687). Defaults to core's static catalog. */
30
30
  catalog?: Record<string, RuleMeta>;
31
+ /**
32
+ * Markdown heading text and level for the report's own title. `chant audit
33
+ * --agents` embeds this report under its inventory, so it renders as a
34
+ * level-2 "Findings" section rather than a second `# chant audit` H1 in a
35
+ * document that already has one.
36
+ */
37
+ title?: string;
38
+ headingLevel?: 1 | 2;
31
39
  }
32
40
  /** Render an audit report as Markdown. */
33
41
  export declare function renderMarkdown(findings: AuditFinding[], opts?: RenderOptions): string;
@@ -1 +1 @@
1
- {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/audit/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;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AAE,CAAC,CAAC;IACjD,iEAAiE;IACjE,UAAU,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IACxC,8EAA8E;IAC9E,aAAa,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC9C,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,sHAAsH;IACtH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACnC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;CACtB;AAoDD,0CAA0C;AAC1C,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAE,IAAI,GAAE,aAAkB,GAAG,MAAM,CAqCzF"}
@@ -1 +1 @@
1
- {"version":3,"file":"rules-doc.d.ts","sourceRoot":"","sources":["../../src/audit/rules-doc.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAqCH;;;;;;GAMG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAqB5D"}
1
+ {"version":3,"file":"rules-doc.d.ts","sourceRoot":"","sources":["../../src/audit/rules-doc.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2CH;;;;;;GAMG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAqB5D"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The CDK half of `chant carve advise` (#1056): read a cloud assembly, rank its
3
+ * constructs with the same model the Terraform advisor uses.
4
+ *
5
+ * Read-only, like the Terraform path — it emits nothing, patches nothing, and
6
+ * touches no live resource. `carve emit`, `carve bridge` and `carve apply` are
7
+ * deliberately Terraform-only: bridging a CDK carve means rewriting the
8
+ * surviving app's source, which does not generalize across jsii languages.
9
+ */
10
+ import type { CarveDialect } from "../terraform/carve.js";
11
+ import type { Peelability, ScoreOptions } from "../terraform/score.js";
12
+ import type { TfGraph } from "../terraform/types.js";
13
+ export interface CdkAdvice {
14
+ graph: TfGraph;
15
+ results: Peelability[];
16
+ /** The hooks that produced `results`, so the boundary pass agrees with it. */
17
+ scoreOptions: ScoreOptions;
18
+ diagnostics: string[];
19
+ }
20
+ /** The bridge vocabulary a CDK report's boundary edges are named in. */
21
+ export declare const CDK_DIALECT: CarveDialect;
22
+ /**
23
+ * Rank a cloud assembly. The scoring model, the bands and the report shape are
24
+ * the Terraform path's, verbatim; what changes is the tier lookup (already in
25
+ * CloudFormation type space, so no translation) and the signals only a CDK
26
+ * reader can see — assets, nested stacks, L3 subtrees, a dummy-value assembly.
27
+ */
28
+ export declare function adviseCloudAssembly(dir: string): CdkAdvice;
29
+ //# sourceMappingURL=advise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advise.d.ts","sourceRoot":"","sources":["../../src/cdk/advise.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,8EAA8E;IAC9E,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wEAAwE;AACxE,eAAO,MAAM,WAAW,EAAE,YAAoB,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAQ1D"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Read a CDK cloud assembly off disk (#1056).
3
+ *
4
+ * The only filesystem layer the CDK advisor needs. Detection is by content, not
5
+ * a flag: a directory holding `manifest.json` plus at least one
6
+ * `*.template.json` is a cloud assembly, so `chant carve advise --from ./cdk.out`
7
+ * routes itself.
8
+ *
9
+ * A malformed or truncated assembly degrades rather than throws — a stack whose
10
+ * template will not parse is dropped with a diagnostic, and the rest is still
11
+ * ranked. The advisor is read-only, so a partial read costs nothing but a
12
+ * shorter report.
13
+ */
14
+ import type { CdkTreeNode, CloudAssembly } from "./types.js";
15
+ /**
16
+ * Is `dir` a CDK cloud assembly? `manifest.json` plus at least one synthesized
17
+ * template. Both are required: `manifest.json` alone is far too common a
18
+ * filename to claim on sight.
19
+ */
20
+ export declare function isCloudAssembly(dir: string): boolean;
21
+ /**
22
+ * Why a Terraform-only carve phase refuses a cloud assembly (#1056).
23
+ *
24
+ * Advise is the only phase that reads CDK. Bridging a carve means rewriting the
25
+ * surviving app's source so it reimports what was taken, and CDK source is
26
+ * TypeScript, Python, Java or C# depending on who wrote it — nothing that
27
+ * generalizes the way patching HCL does. Better to say so than to parse the
28
+ * assembly's `.tf` files, find none, and report an empty estate.
29
+ */
30
+ export declare function cdkNotSupported(dir: string, phase: "emit" | "bridge" | "apply"): string;
31
+ /** Index `tree.json` by construct path, so a resource's path resolves in one lookup. */
32
+ export declare function indexTree(root: CdkTreeNode | undefined): Map<string, CdkTreeNode>;
33
+ /**
34
+ * Read the assembly at `dir`. Throws only when the directory is not an assembly
35
+ * at all — everything past that point is a diagnostic.
36
+ */
37
+ export declare function readCloudAssembly(dir: string): CloudAssembly;
38
+ //# sourceMappingURL=assembly.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assembly.d.ts","sourceRoot":"","sources":["../../src/cdk/assembly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAsC,WAAW,EAAe,aAAa,EAAE,MAAM,SAAS,CAAC;AAS3G;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAKvF;AAmBD,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAQjF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CA4C5D"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Turn a CDK cloud assembly into the same dependency graph the Terraform
3
+ * advisor scores (#1056).
4
+ *
5
+ * Two jobs, both exact rather than heuristic:
6
+ *
7
+ * **Grouping.** CloudFormation resources are the wrong unit to rank. One L2
8
+ * construct emits several of them — a `Function` emits a role, a policy and the
9
+ * function — and they carve together or not at all. Every resource carries its
10
+ * emitting construct in `Metadata["aws:cdk:path"]`, and `tree.json` says which
11
+ * ancestor of that path is the construct a person actually wrote. So resources
12
+ * fold up to the shallowest L2 (or L3) ancestor and that construct ranks once.
13
+ * This is the CDK analogue of Terraform sub-resources folding into their parent.
14
+ *
15
+ * **Edges.** `Ref`, `Fn::GetAtt` and `Fn::Sub` are intra-stack; `Fn::ImportValue`
16
+ * resolves through the exporting stack's `Outputs` to the construct that
17
+ * actually produces the value, so a cross-stack dependency lands as a real edge
18
+ * between two constructs in both directions rather than a dangling name. There
19
+ * is no expression AST to consult and no regex over HCL: the template is JSON,
20
+ * and an intrinsic is a JSON object with a known key.
21
+ *
22
+ * Pure — no filesystem, no CDK CLI. `assembly.ts` does the reading.
23
+ */
24
+ import type { CloudAssembly } from "./types.js";
25
+ import type { ScoreSignals } from "../terraform/score.js";
26
+ import type { TfGraph } from "../terraform/types.js";
27
+ /**
28
+ * What a construct is, from its jsii class name.
29
+ *
30
+ * - `l1` — a `Cfn*` class: one construct, one CloudFormation resource.
31
+ * - `l2` — a curated service construct (`aws-cdk-lib.aws_s3.Bucket`).
32
+ * - `l3` — a pattern or a hand-written grouping construct. A Composite
33
+ * candidate (#1000), ranked whole instead of leaf by leaf.
34
+ * - `nested` — a `NestedStack`: a template of its own.
35
+ * - `container` — App/Stage/Stack. Never a scoring unit; the ranking lives
36
+ * inside it.
37
+ * - `unknown` — no tree metadata to go on.
38
+ *
39
+ * A user's own construct class is not jsii-compiled, so tree metadata reports
40
+ * its nearest jsii ancestor: `constructs.Construct` for a grouping construct,
41
+ * `aws-cdk-lib.Stack` for a stack subclass. That is why stacks are recognized
42
+ * by their manifest artifact rather than by fqn — the fqn alone cannot tell a
43
+ * user's stack from a user's L3.
44
+ */
45
+ export type ConstructLevel = "l1" | "l2" | "l3" | "nested" | "container" | "unknown";
46
+ export declare function constructLevel(fqn: string | undefined): ConstructLevel;
47
+ /** The assembly's dependency graph, plus the signals only a CDK reader can see. */
48
+ export interface CdkCarveGraph {
49
+ graph: TfGraph;
50
+ /** Per-node scoring signals, keyed by construct path. */
51
+ signals: Map<string, ScoreSignals>;
52
+ diagnostics: string[];
53
+ }
54
+ /**
55
+ * Is the assembly a faithful picture of an account, or a guess? Either the
56
+ * manifest admits an unresolved context query, or a template still carries the
57
+ * placeholder that query would have replaced.
58
+ */
59
+ export declare function dummyAssemblyReason(assembly: CloudAssembly): string | undefined;
60
+ /**
61
+ * Build the graph and the per-construct signals from a read assembly.
62
+ *
63
+ * Every resource folds into a construct, every construct becomes one node, and
64
+ * every intrinsic becomes an edge between two nodes. Nothing is inferred: a
65
+ * reference with no resolvable target is dropped rather than drawn.
66
+ */
67
+ export declare function buildCdkGraph(assembly: CloudAssembly): CdkCarveGraph;
68
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/cdk/graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,KAAK,EAAsC,aAAa,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,KAAK,EAAmB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAU,OAAO,EAAU,MAAM,oBAAoB,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AAiBrF,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CAQtE;AAuLD,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,yDAAyD;IACzD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACnC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAQD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAqB/E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CA2NpE"}