@intentius/chant 0.124.44 → 0.124.46

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 (249) hide show
  1. package/dist/capabilities/aws.paths +148 -0
  2. package/dist/capabilities/base-mappings.json +122 -0
  3. package/dist/capabilities/catalog.d.ts +89 -0
  4. package/dist/capabilities/catalog.d.ts.map +1 -0
  5. package/dist/capabilities/catalog.js +204 -0
  6. package/dist/capabilities/language.d.ts +103 -0
  7. package/dist/capabilities/language.d.ts.map +1 -0
  8. package/dist/capabilities/language.js +335 -0
  9. package/dist/capabilities/matcher.d.ts +65 -0
  10. package/dist/capabilities/matcher.d.ts.map +1 -0
  11. package/dist/capabilities/matcher.js +299 -0
  12. package/dist/capabilities/view.d.ts +207 -0
  13. package/dist/capabilities/view.d.ts.map +1 -0
  14. package/dist/capabilities/view.js +484 -0
  15. package/dist/ci-identity.d.ts +183 -12
  16. package/dist/ci-identity.d.ts.map +1 -1
  17. package/dist/ci-identity.js +362 -53
  18. package/dist/cli/commands/lint.d.ts.map +1 -1
  19. package/dist/cli/commands/lint.js +1 -0
  20. package/dist/cli/handlers/build.d.ts.map +1 -1
  21. package/dist/cli/handlers/build.js +17 -1
  22. package/dist/cli/handlers/declared-graph.d.ts +44 -0
  23. package/dist/cli/handlers/declared-graph.d.ts.map +1 -0
  24. package/dist/cli/handlers/declared-graph.js +87 -0
  25. package/dist/cli/handlers/graph.d.ts +25 -0
  26. package/dist/cli/handlers/graph.d.ts.map +1 -1
  27. package/dist/cli/handlers/graph.js +93 -87
  28. package/dist/cli/handlers/pr-env.d.ts +8 -2
  29. package/dist/cli/handlers/pr-env.d.ts.map +1 -1
  30. package/dist/cli/handlers/pr-env.js +127 -225
  31. package/dist/cli/handlers/pr.d.ts +3 -0
  32. package/dist/cli/handlers/pr.d.ts.map +1 -1
  33. package/dist/cli/handlers/pr.js +1 -0
  34. package/dist/cli/handlers/search-count.d.ts +89 -0
  35. package/dist/cli/handlers/search-count.d.ts.map +1 -0
  36. package/dist/cli/handlers/search-count.js +132 -0
  37. package/dist/cli/handlers/search.d.ts +358 -6
  38. package/dist/cli/handlers/search.d.ts.map +1 -1
  39. package/dist/cli/handlers/search.js +1065 -155
  40. package/dist/cli/main.d.ts.map +1 -1
  41. package/dist/cli/main.js +23 -3
  42. package/dist/cli/mcp/server.d.ts.map +1 -1
  43. package/dist/cli/mcp/server.js +3 -0
  44. package/dist/cli/mcp/tools/capabilities.d.ts +7 -0
  45. package/dist/cli/mcp/tools/capabilities.d.ts.map +1 -0
  46. package/dist/cli/mcp/tools/capabilities.js +27 -0
  47. package/dist/cli/mcp/workspace-tools.d.ts +3 -1
  48. package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
  49. package/dist/cli/mcp/workspace-tools.js +47 -2
  50. package/dist/cli/parse-args.d.ts.map +1 -1
  51. package/dist/cli/parse-args.js +64 -17
  52. package/dist/cli/registry.d.ts +22 -0
  53. package/dist/cli/registry.d.ts.map +1 -1
  54. package/dist/components/cli-support.d.ts +2 -0
  55. package/dist/components/cli-support.d.ts.map +1 -1
  56. package/dist/components/cli-support.js +4 -2
  57. package/dist/components/fan-out-support.d.ts +3 -0
  58. package/dist/components/fan-out-support.d.ts.map +1 -1
  59. package/dist/components/fan-out-support.js +1 -1
  60. package/dist/components/pr-env-ports.d.ts +29 -0
  61. package/dist/components/pr-env-ports.d.ts.map +1 -0
  62. package/dist/components/pr-env-ports.js +77 -0
  63. package/dist/components/pr-env-run.d.ts +254 -0
  64. package/dist/components/pr-env-run.d.ts.map +1 -0
  65. package/dist/components/pr-env-run.js +376 -0
  66. package/dist/components/pr-environment.d.ts +91 -15
  67. package/dist/components/pr-environment.d.ts.map +1 -1
  68. package/dist/components/pr-environment.js +95 -9
  69. package/dist/components/pr-pipeline.d.ts +10 -1
  70. package/dist/components/pr-pipeline.d.ts.map +1 -1
  71. package/dist/config-environments.d.ts +92 -0
  72. package/dist/config-environments.d.ts.map +1 -0
  73. package/dist/config-environments.js +102 -0
  74. package/dist/config.d.ts +24 -84
  75. package/dist/config.d.ts.map +1 -1
  76. package/dist/config.js +9 -96
  77. package/dist/graph-detail.d.ts.map +1 -1
  78. package/dist/graph-detail.js +15 -3
  79. package/dist/graph-effective.d.ts +33 -2
  80. package/dist/graph-effective.d.ts.map +1 -1
  81. package/dist/graph-effective.js +215 -68
  82. package/dist/graph-ir.d.ts +23 -0
  83. package/dist/graph-ir.d.ts.map +1 -1
  84. package/dist/graph-ir.js +130 -0
  85. package/dist/graph-sub-template.d.ts +11 -0
  86. package/dist/graph-sub-template.d.ts.map +1 -0
  87. package/dist/graph-sub-template.js +19 -0
  88. package/dist/lexicon.d.ts +9 -0
  89. package/dist/lexicon.d.ts.map +1 -1
  90. package/dist/lifecycle/observe.d.ts +28 -0
  91. package/dist/lifecycle/observe.d.ts.map +1 -1
  92. package/dist/lifecycle/observe.js +23 -1
  93. package/dist/lint/rule.d.ts +6 -0
  94. package/dist/lint/rule.d.ts.map +1 -1
  95. package/dist/live-endpoint.d.ts +1 -1
  96. package/dist/live-endpoint.d.ts.map +1 -1
  97. package/dist/live-endpoint.js +1 -1
  98. package/dist/observation.d.ts +48 -1
  99. package/dist/observation.d.ts.map +1 -1
  100. package/dist/observation.js +21 -5
  101. package/dist/op/activities/activity-contracts.d.ts +4 -4
  102. package/dist/op/op-waves.d.ts +17 -0
  103. package/dist/op/op-waves.d.ts.map +1 -1
  104. package/dist/op/op-waves.js +23 -1
  105. package/dist/pr-forge.d.ts +15 -1
  106. package/dist/pr-forge.d.ts.map +1 -1
  107. package/dist/pr-forge.js +28 -16
  108. package/dist/pr-requires.d.ts +5 -1
  109. package/dist/pr-requires.d.ts.map +1 -1
  110. package/dist/wave-runtime.mjs +251 -250
  111. package/dist/workspace/capabilities-contract.d.ts +66 -0
  112. package/dist/workspace/capabilities-contract.d.ts.map +1 -0
  113. package/dist/workspace/capabilities-contract.js +107 -0
  114. package/dist/workspace/capabilities.schema.json +229 -0
  115. package/dist/workspace/ci-cloud-identity.d.ts +3 -1
  116. package/dist/workspace/ci-cloud-identity.d.ts.map +1 -1
  117. package/dist/workspace/ci-cloud-identity.js +16 -1
  118. package/dist/workspace/ci-run.d.ts +35 -8
  119. package/dist/workspace/ci-run.d.ts.map +1 -1
  120. package/dist/workspace/ci-run.js +95 -21
  121. package/dist/workspace/ci-secrets.d.ts.map +1 -1
  122. package/dist/workspace/ci-secrets.js +4 -3
  123. package/dist/workspace/compose-graph.d.ts +9 -0
  124. package/dist/workspace/compose-graph.d.ts.map +1 -1
  125. package/dist/workspace/compose-graph.js +3 -1
  126. package/dist/workspace/conformance/index.d.ts +1 -1
  127. package/dist/workspace/conformance/index.d.ts.map +1 -1
  128. package/dist/workspace/conformance/index.js +39 -2
  129. package/dist/workspace/declaration.d.ts +10 -0
  130. package/dist/workspace/declaration.d.ts.map +1 -1
  131. package/dist/workspace/declaration.js +17 -1
  132. package/dist/workspace/declaration.schema.json +36 -1
  133. package/dist/workspace/graph-cache.d.ts +8 -0
  134. package/dist/workspace/graph-cache.d.ts.map +1 -1
  135. package/dist/workspace/graph-cache.js +27 -3
  136. package/dist/workspace/graph-cli.d.ts +39 -2
  137. package/dist/workspace/graph-cli.d.ts.map +1 -1
  138. package/dist/workspace/graph-cli.js +66 -24
  139. package/dist/workspace/graph.schema.json +148 -0
  140. package/dist/workspace/kind-readers.d.ts +3 -0
  141. package/dist/workspace/kind-readers.d.ts.map +1 -1
  142. package/dist/workspace/kind-readers.js +7 -1
  143. package/dist/workspace/member-commands.d.ts +10 -1
  144. package/dist/workspace/member-commands.d.ts.map +1 -1
  145. package/dist/workspace/member-commands.js +17 -1
  146. package/dist/workspace/nested-graph.d.ts +2 -0
  147. package/dist/workspace/nested-graph.d.ts.map +1 -1
  148. package/dist/workspace/nested-graph.js +32 -1
  149. package/dist/workspace/reason-codes.d.ts +10 -0
  150. package/dist/workspace/reason-codes.d.ts.map +1 -1
  151. package/dist/workspace/reason-codes.js +12 -0
  152. package/dist/workspace/search-cli.d.ts +204 -0
  153. package/dist/workspace/search-cli.d.ts.map +1 -0
  154. package/dist/workspace/search-cli.js +466 -0
  155. package/dist/workspace/search-contract.d.ts +56 -0
  156. package/dist/workspace/search-contract.d.ts.map +1 -0
  157. package/dist/workspace/search-contract.js +70 -0
  158. package/dist/workspace/search.schema.json +822 -0
  159. package/package.json +1 -1
  160. package/src/__snapshots__/okf.test.ts.snap +10 -0
  161. package/src/capabilities/aws.paths +148 -0
  162. package/src/capabilities/base-mappings.json +122 -0
  163. package/src/capabilities/catalog.ts +230 -0
  164. package/src/capabilities/language.test.ts +191 -0
  165. package/src/capabilities/language.ts +373 -0
  166. package/src/capabilities/matcher.ts +315 -0
  167. package/src/capabilities/view-compose.test.ts +76 -0
  168. package/src/capabilities/view.ts +631 -0
  169. package/src/ci-identity-targets.test.ts +275 -0
  170. package/src/ci-identity.ts +394 -61
  171. package/src/cli/commands/lint.ts +1 -0
  172. package/src/cli/handlers/build.ts +15 -1
  173. package/src/cli/handlers/declared-graph.ts +99 -0
  174. package/src/cli/handlers/graph.test.ts +94 -3
  175. package/src/cli/handlers/graph.ts +123 -96
  176. package/src/cli/handlers/pr-env.ts +135 -227
  177. package/src/cli/handlers/pr.ts +4 -0
  178. package/src/cli/handlers/search-build-roots.test.ts +144 -0
  179. package/src/cli/handlers/search-count.test.ts +191 -0
  180. package/src/cli/handlers/search-count.ts +165 -0
  181. package/src/cli/handlers/search-json.test.ts +333 -0
  182. package/src/cli/handlers/search-live.test.ts +387 -0
  183. package/src/cli/handlers/search-paths.test.ts +235 -0
  184. package/src/cli/handlers/search.ts +1312 -166
  185. package/src/cli/main.test.ts +28 -3
  186. package/src/cli/main.ts +23 -3
  187. package/src/cli/mcp/server.test.ts +3 -3
  188. package/src/cli/mcp/server.ts +3 -0
  189. package/src/cli/mcp/tools/capabilities.ts +32 -0
  190. package/src/cli/mcp/workspace-tools.e2e.test.ts +21 -1
  191. package/src/cli/mcp/workspace-tools.ts +47 -2
  192. package/src/cli/parse-args.ts +52 -13
  193. package/src/cli/registry.ts +22 -0
  194. package/src/components/cli-support.ts +6 -1
  195. package/src/components/fan-out-support.ts +4 -1
  196. package/src/components/pr-env-ports.ts +89 -0
  197. package/src/components/pr-env-run-bundle.test.ts +54 -0
  198. package/src/components/pr-env-run.test.ts +290 -0
  199. package/src/components/pr-env-run.ts +563 -0
  200. package/src/components/pr-environment.ts +161 -13
  201. package/src/components/pr-pipeline.ts +10 -1
  202. package/src/config-environments.ts +133 -0
  203. package/src/config.ts +37 -124
  204. package/src/graph-detail.ts +15 -3
  205. package/src/graph-effective.ts +226 -75
  206. package/src/graph-ir.test.ts +163 -0
  207. package/src/graph-ir.ts +147 -0
  208. package/src/graph-sub-template.ts +22 -0
  209. package/src/lexicon.ts +10 -0
  210. package/src/lifecycle/observe.test.ts +27 -1
  211. package/src/lifecycle/observe.ts +43 -1
  212. package/src/lint/rule.ts +6 -0
  213. package/src/live-endpoint.ts +1 -1
  214. package/src/observation.test.ts +25 -0
  215. package/src/observation.ts +69 -5
  216. package/src/op/op-waves.ts +38 -1
  217. package/src/pr-forge-bundle.test.ts +1 -1
  218. package/src/pr-forge.ts +44 -17
  219. package/src/pr-requires.test.ts +43 -6
  220. package/src/pr-requires.ts +5 -1
  221. package/src/workspace/capabilities-contract.test.ts +88 -0
  222. package/src/workspace/capabilities-contract.ts +132 -0
  223. package/src/workspace/capabilities.schema.json +229 -0
  224. package/src/workspace/ci-cloud-identity.test.ts +20 -0
  225. package/src/workspace/ci-cloud-identity.ts +14 -1
  226. package/src/workspace/ci-run.test.ts +74 -1
  227. package/src/workspace/ci-run.ts +122 -29
  228. package/src/workspace/ci-secrets.test.ts +1 -1
  229. package/src/workspace/ci-secrets.ts +4 -3
  230. package/src/workspace/compose-graph.ts +10 -1
  231. package/src/workspace/conformance/conformance.e2e.test.ts +14 -1
  232. package/src/workspace/conformance/index.ts +31 -2
  233. package/src/workspace/declaration.schema.json +36 -1
  234. package/src/workspace/declaration.test.ts +7 -0
  235. package/src/workspace/declaration.ts +24 -2
  236. package/src/workspace/graph-cache.ts +27 -3
  237. package/src/workspace/graph-cli.ts +96 -24
  238. package/src/workspace/graph.schema.json +148 -0
  239. package/src/workspace/kind-readers.e2e.test.ts +28 -0
  240. package/src/workspace/kind-readers.test.ts +1 -1
  241. package/src/workspace/kind-readers.ts +7 -1
  242. package/src/workspace/member-commands.ts +22 -1
  243. package/src/workspace/nested-graph.ts +32 -1
  244. package/src/workspace/reason-codes.test.ts +7 -0
  245. package/src/workspace/reason-codes.ts +12 -0
  246. package/src/workspace/search-cli.e2e.test.ts +305 -0
  247. package/src/workspace/search-cli.ts +591 -0
  248. package/src/workspace/search-contract.ts +95 -0
  249. package/src/workspace/search.schema.json +822 -0
@@ -0,0 +1,132 @@
1
+ import { terraformType } from "../../graph-effective.js";
2
+ // The one reading of a terraform node's type lives with the folds that also
3
+ // select on it, so `--count-by kind` and `kind:` cannot disagree (#4366).
4
+ export { terraformType };
5
+ /** The group a node with no value for the grouped dimension is counted under. */
6
+ export const NONE_GROUP = "(none)";
7
+ /** The module group of a Terraform block declared in the root module itself. */
8
+ export const ROOT_MODULE_GROUP = "(root)";
9
+ /** Parse a `--count-by` value, or say what the accepted spellings are. */
10
+ export function parseCountBy(raw) {
11
+ const value = raw.trim();
12
+ if (value === "kind")
13
+ return { by: "kind" };
14
+ if (value === "module")
15
+ return { by: "module" };
16
+ const attr = /^attr:(.+)$/.exec(value);
17
+ if (attr && attr[1].trim())
18
+ return { by: "attr", name: attr[1].trim() };
19
+ return {
20
+ error: `--count-by "${raw}" is not a grouping`,
21
+ hint: "group by one of: --count-by kind, --count-by module, --count-by attr:<name>",
22
+ };
23
+ }
24
+ /** A Terraform node's root name, from its attrs or the first segment of its id. */
25
+ function terraformRoot(n) {
26
+ const attrs = (n.attrs ?? {});
27
+ if (typeof attrs.root === "string")
28
+ return attrs.root;
29
+ const slash = n.id.indexOf("/");
30
+ return slash === -1 ? "" : n.id.slice(0, slash);
31
+ }
32
+ /**
33
+ * The module a Terraform node sits in: its call chain as Terraform writes it
34
+ * (`module.cdn`, `module.cdn.module.bucket`), or `(root)` for a block of the
35
+ * root module itself. The chain is on `attrs.callers`; an entity key
36
+ * `<root>/module.cdn/<address>` carries the same chain when it is absent.
37
+ */
38
+ function terraformModule(n) {
39
+ const attrs = (n.attrs ?? {});
40
+ const callers = Array.isArray(attrs.callers)
41
+ ? attrs.callers.filter((c) => typeof c === "string")
42
+ : n.id.split("/").slice(1, -1);
43
+ return callers.length === 0 ? ROOT_MODULE_GROUP : callers.join(".");
44
+ }
45
+ /** An attribute's value as a group name, matched by exact name and then case-insensitively, as `--show` does. */
46
+ function attrGroup(n, name) {
47
+ const attrs = (n.attrs ?? {});
48
+ const key = name in attrs ? name : Object.keys(attrs).find((k) => k.toLowerCase() === name.toLowerCase());
49
+ const v = key === undefined ? undefined : attrs[key];
50
+ if (v === undefined || v === null || v === "")
51
+ return NONE_GROUP;
52
+ return typeof v === "object" ? JSON.stringify(v) : String(v);
53
+ }
54
+ /**
55
+ * The group one node belongs to.
56
+ *
57
+ * `module` on a Terraform node is its call chain. When the graph holds more
58
+ * than one Terraform root, the chain is prefixed with the root (`app/(root)`,
59
+ * `net/module.vpc`): `module.vpc` in two roots is two modules, applied
60
+ * separately, and counting them as one would add up resources that never sit
61
+ * in the same state. A node of another lexicon groups under the composite that
62
+ * expanded it, chant's own unit of reuse, or `(none)`.
63
+ */
64
+ export function groupOf(n, countBy, multiRoot = false) {
65
+ if (countBy.by === "kind")
66
+ return terraformType(n) ?? (n.kind || NONE_GROUP);
67
+ if (countBy.by === "attr")
68
+ return attrGroup(n, countBy.name);
69
+ if (n.lexicon === "terraform") {
70
+ const module = terraformModule(n);
71
+ return multiRoot ? `${terraformRoot(n) || NONE_GROUP}/${module}` : module;
72
+ }
73
+ return n.compositeParent || NONE_GROUP;
74
+ }
75
+ /** Whether the graph holds blocks from more than one Terraform root. */
76
+ export function hasManyTerraformRoots(ir) {
77
+ const roots = new Set();
78
+ for (const n of ir.nodes)
79
+ if (n.lexicon === "terraform")
80
+ roots.add(terraformRoot(n));
81
+ return roots.size > 1;
82
+ }
83
+ /** Count `matches` per group, sorted by count (highest first) and then by name. */
84
+ export function countGroups(matches, countBy, multiRoot = false) {
85
+ return groupMembers(matches, countBy, multiRoot).map(({ group, count }) => ({ group, count }));
86
+ }
87
+ /**
88
+ * The groups with the ids of the matches in each, in match order (#4382), in
89
+ * the order {@link countGroups} gives. `count` is always `ids.length`. A
90
+ * reader that draws the groups (behold#922) lights each group's nodes from
91
+ * `ids`, so it never has to read a node's group itself.
92
+ */
93
+ export function groupMembers(matches, countBy, multiRoot = false) {
94
+ const ids = new Map();
95
+ for (const n of matches) {
96
+ const g = groupOf(n, countBy, multiRoot);
97
+ const list = ids.get(g);
98
+ if (list)
99
+ list.push(n.id);
100
+ else
101
+ ids.set(g, [n.id]);
102
+ }
103
+ return [...ids]
104
+ .map(([group, members]) => ({ group, count: members.length, ids: members }))
105
+ .sort((a, b) => b.count - a.count || (a.group < b.group ? -1 : a.group > b.group ? 1 : 0));
106
+ }
107
+ export function countsJson(query, source, groups, countBy, liveFailures = []) {
108
+ return {
109
+ query,
110
+ source,
111
+ countBy: countByLabel(countBy),
112
+ groups,
113
+ total: groups.reduce((sum, g) => sum + g.count, 0),
114
+ ...(liveFailures.length > 0 ? { liveFailures } : {}),
115
+ };
116
+ }
117
+ /** The label a `--count-by` value is printed with on the total line. */
118
+ function countByLabel(countBy) {
119
+ return countBy.by === "attr" ? `attr:${countBy.name}` : countBy.by;
120
+ }
121
+ /**
122
+ * Render grouped counts: one `<count> <group>` line per group, counts right
123
+ * aligned, then the total. The total is the number of matches, which is the
124
+ * sum of the group counts by construction.
125
+ */
126
+ export function formatCounts(groups, countBy) {
127
+ const total = groups.reduce((sum, g) => sum + g.count, 0);
128
+ const width = String(groups[0]?.count ?? 0).length;
129
+ const lines = groups.map((g) => `${String(g.count).padStart(width)} ${g.group}`);
130
+ lines.push(`— ${total} total · ${groups.length} group${groups.length === 1 ? "" : "s"} by ${countByLabel(countBy)}`);
131
+ return lines;
132
+ }
@@ -1,9 +1,12 @@
1
1
  import { type GraphIR, type IRNode } from "../../graph-ir.js";
2
+ import type { CapabilityPack, View } from "../../capabilities/view.js";
2
3
  import { type LiveDiffResult } from "../../lifecycle/live-diff.js";
3
4
  import type { LiveObservation } from "../../graph-ir.js";
4
5
  import type { ResourceMetadata } from "../../lexicon.js";
5
6
  import type { ObservationDepth } from "../../lifecycle/types.js";
7
+ import { type CountBy } from "./search-count.js";
6
8
  import type { CommandContext } from "../registry.js";
9
+ import { type SearchErrorCode, type SearchFailure } from "../../workspace/search-contract.js";
7
10
  /**
8
11
  * `chant search <query> [--live --env <name>]` — answer an estate question with
9
12
  * a COMPACT result instead of the whole graph. The point (measured on aws-bench,
@@ -12,11 +15,14 @@ import type { CommandContext } from "../registry.js";
12
15
  *
13
16
  * Query grammar (space-separated terms, all must match — AND):
14
17
  * bare word case-insensitive substring over id, kind, and attrs
15
- * kind:<substr> node kind contains <substr> (e.g. kind:EC2::Instance)
18
+ * kind:<substr> node kind contains <substr> (e.g. kind:EC2::Instance);
19
+ * on a terraform resource, its type (kind:aws_instance, kind:aws_iam_)
16
20
  * tag:<key>=<val> a Tags entry with Key=key and Value containing val
17
21
  * attr:<name>=<val> attribute <name> equals/contains <val>
18
22
  * ->kind:X / ->attr:.. this node has an edge TO a node matching the right side
19
23
  * <-kind:X / <-attr:.. this node has an edge FROM a node matching the right side
24
+ * ->*X, ->{n}X, ->{m,n}X the far end is any depth / n / m..n hops away (#4359)
25
+ * ->[via=a]X, ->[to=a]X only edges through consumer attr a / reading producer attr a
20
26
  *
21
27
  * The edge operators are the point of "edge-aware" search (#1139): a small
22
28
  * model shouldn't hand-join instance→subnet→public across many results — one
@@ -28,13 +34,96 @@ import type { CommandContext } from "../registry.js";
28
34
  * thousands.
29
35
  */
30
36
  export declare function runSearch(ctx: CommandContext): Promise<number>;
37
+ /** A search's arguments refused before anything is read, or its parsed terms and grouping. */
38
+ export type SearchArgsCheck = {
39
+ error: {
40
+ code: SearchErrorCode;
41
+ message: string;
42
+ hint?: string;
43
+ };
44
+ } | {
45
+ terms: Term[];
46
+ countBy?: CountBy;
47
+ };
48
+ /**
49
+ * Check a search's query and flags before anything is read (#4374): the
50
+ * grammar, `--count-by`, and the flags that need or exclude each other. The
51
+ * rules `chant search` and `chant workspace search` share, so the workspace
52
+ * form refuses once, with the same code and message, instead of once per
53
+ * member. `snapshot` is the snapshot asked for and the flag that asked:
54
+ * `--snapshot`, or plain search's `--at`.
55
+ */
56
+ export declare function checkSearchArgs(args: {
57
+ countBy?: string;
58
+ checkLive?: boolean;
59
+ checkSnapshot?: boolean;
60
+ failOnDrift?: boolean;
61
+ live?: boolean;
62
+ env?: string;
63
+ }, query: string, snapshot: {
64
+ ref?: string;
65
+ flag: string;
66
+ }): SearchArgsCheck;
67
+ /**
68
+ * Print the capability catalog (#4375): the `capabilities` document under
69
+ * `--json`, a line per capability otherwise. It takes no query and no other
70
+ * search flag, since it answers nothing about the estate. Shared by `chant
71
+ * search` and `chant workspace search`, which differ only in the lexicons
72
+ * they report on.
73
+ */
74
+ export declare function printCapabilities(args: {
75
+ json?: boolean;
76
+ live?: boolean;
77
+ env?: string;
78
+ snapshot?: string;
79
+ at?: string;
80
+ countBy?: string;
81
+ explain?: boolean;
82
+ show?: string;
83
+ }, query: string, lexicons: string[]): Promise<number>;
84
+ /**
85
+ * Answer capability terms over a graph that is not this project's own (#4375):
86
+ * `chant workspace search` composes its members' graphs and views and asks
87
+ * here, so the rules run once over the whole of it. Given packs, the view is
88
+ * built here; given a view, it is the one the members' own chants mapped
89
+ * (#4378). Returns the rows
90
+ * as `--json` carries them, or the refusal for a capability the query names
91
+ * wrongly.
92
+ */
93
+ export declare function answerOverGraph(ir: GraphIR, terms: Term[], query: string, packsOrView: CapabilityPack[] | View): {
94
+ matches: SearchJson["matches"];
95
+ capabilities: NonNullable<SearchJson["capabilities"]>;
96
+ } | {
97
+ error: {
98
+ message: string;
99
+ hint?: string;
100
+ };
101
+ };
102
+ /** Whether a term, or the leaf under it, names a capability (#4375). */
103
+ export declare function usesCapability(t: Term): boolean;
104
+ /**
105
+ * Which read answered a live search's matches, when the lexicon reports it
106
+ * (#2267) and at least one answer came from the plan (#4384). Absent for a
107
+ * plain live or state answer, so those documents are unchanged.
108
+ */
109
+ export interface ReadDepth {
110
+ /** `plan` or `live+plan` when every read match came that way, else `mixed`. */
111
+ depth?: "plan" | "live+plan" | "mixed";
112
+ /** The distinct reads that answered the matches, sorted. */
113
+ reads?: string[];
114
+ /** The plan read was asked for and failed: the read that answered instead. */
115
+ planFellBackTo?: "state" | "live" | "declared";
116
+ }
31
117
  /** Where an answer's facts came from, for the provenance line (#1266). */
32
- type AnswerSource = {
118
+ export type AnswerSource = {
33
119
  kind: "declared";
34
- } | {
120
+ } | ({
35
121
  kind: "live";
36
- } | {
122
+ } & ReadDepth)
123
+ /** `snapshot` is the ref asked for (`latest`), `commit` the snapshot commit it named (#4374). */
124
+ | {
37
125
  kind: "snapshot";
126
+ snapshot?: string;
38
127
  commit: string;
39
128
  timestamp: string;
40
129
  };
@@ -96,7 +185,9 @@ declare function ambientHint(matches: IRNode[], ambientKinds: string[], asked: b
96
185
  * already done. That is a fact about the query, printed for every query, and it
97
186
  * encodes no expected answer.
98
187
  */
99
- declare function provenance(matches: IRNode[], source: AnswerSource, recorded?: string, liveFailures?: string[]): void;
188
+ declare function provenanceLine(matches: IRNode[], source: AnswerSource, recorded?: string, liveFailures?: string[], derived?: string[]): string;
189
+ /** Print {@link provenanceLine}: the text footer. */
190
+ declare function provenance(matches: IRNode[], source: AnswerSource, recorded?: string, liveFailures?: string[], derived?: string[]): void;
100
191
  /** Union `LiveObservation.resources` across lexicons into one name-keyed map. */
101
192
  declare function mergeResources(observations: LiveObservation[]): Record<string, ResourceMetadata>;
102
193
  /** Restrict a name-keyed map to the matched ids — the whole of "query-scoped". */
@@ -112,6 +203,40 @@ declare function pickResources<T>(map: Record<string, T>, ids: Set<string>): Rec
112
203
  * look — stays distinct from both, the same #1089 tri-state everywhere else.
113
204
  */
114
205
  declare function renderDrift(diff: LiveDiffResult, checked: number, direction: "live" | "snapshot", depth?: ObservationDepth): number;
206
+ /** The query-scoped drift check as `--json` carries it (#4367). See {@link SearchJson}. */
207
+ export interface SearchDriftJson {
208
+ against: "live" | "snapshot";
209
+ /** Matched rows checked. */
210
+ checked?: number;
211
+ /** Rows that drifted: missing + orphan + disappeared + drifted, as the text summary counts. */
212
+ count?: number;
213
+ missing?: string[];
214
+ orphan?: string[];
215
+ disappeared?: string[];
216
+ drifted?: {
217
+ id: string;
218
+ path: string;
219
+ old?: unknown;
220
+ new?: unknown;
221
+ }[];
222
+ newlyObserved?: string[];
223
+ runtimeChildren?: {
224
+ id: string;
225
+ type: string;
226
+ owner: string;
227
+ }[];
228
+ unobserved?: {
229
+ id: string;
230
+ type?: string;
231
+ reason: string;
232
+ detail?: string;
233
+ }[];
234
+ /** The snapshot was recorded deeper than the identity-level comparison made here. */
235
+ depth?: ObservationDepth;
236
+ /** --check-snapshot found no snapshot to check against: the reason, and no other field. */
237
+ unavailable?: string;
238
+ }
239
+ declare function searchDriftJson(diff: LiveDiffResult, checked: number, against: "live" | "snapshot", depth?: ObservationDepth): SearchDriftJson;
115
240
  /**
116
241
  * Name the facts chant computed for the kinds in this result that the query did not use.
117
242
  *
@@ -135,6 +260,29 @@ declare function derivedSurface(terms: Term[], matches: IRNode[], ir: GraphIR, b
135
260
  * any expected answer, so it stays a fair, question-agnostic capability.
136
261
  */
137
262
  declare function explain(terms: Term[], matches: IRNode[], ir: GraphIR, byId: Map<string, IRNode>, query: string): void;
263
+ /**
264
+ * The facts behind the `--explain` footer, shared by the text and `--json`
265
+ * (#4367). The universe is every node of the matched kinds (every node when
266
+ * nothing matched); a near-miss is a node of that universe the query
267
+ * excluded, with the first term it fails.
268
+ */
269
+ declare function explainData(terms: Term[], matches: IRNode[], ir: GraphIR, byId: Map<string, IRNode>): {
270
+ universe: {
271
+ matched: number;
272
+ of: number;
273
+ kinds: string[];
274
+ };
275
+ evidence: {
276
+ id: string;
277
+ attr: string;
278
+ via: string;
279
+ }[];
280
+ nearMisses: {
281
+ id: string;
282
+ term?: Term;
283
+ }[];
284
+ moreExcluded: number;
285
+ };
138
286
  /**
139
287
  * On a miss, name the attributes the queried kind actually carries. A graph knows
140
288
  * its own schema, so a caller who guessed an attribute name — or did not know a
@@ -145,8 +293,129 @@ declare function explain(terms: Term[], matches: IRNode[], ir: GraphIR, byId: Ma
145
293
  */
146
294
  declare function availableAttrs(terms: Term[], ir: GraphIR): void;
147
295
  declare function describeTerm(t: Term): string;
296
+ /**
297
+ * `chant search --json` (#4359, #4367): the whole answer as one document on
298
+ * stdout, read by behold (behold#913). Warnings and errors still go to stderr;
299
+ * the exit code is the text path's. It is the `search` document of the read
300
+ * contract (#4374, `workspace/search.schema.json`): every document opens with
301
+ * `$schema`, `contract` and `chant`, then `workspace` when the project belongs
302
+ * to one, and `at: null`, since plain search reads the working tree.
303
+ *
304
+ * {
305
+ * "$schema": "https://intentius.io/chant/schemas/workspace/search/v1/search.schema.json",
306
+ * "contract": 1, "chant": "0.124.46", "workspace"?: { "name", "root" }, "at": null,
307
+ * "query": "kind:aws_instance ->*kind:aws_vpc",
308
+ * "source": { "kind": "declared" | "live" | "snapshot", "env"?, "snapshot"?, "commit"?, "timestamp"? },
309
+ * "matches": [
310
+ * { "id": "east::web", "displayId": "web", "kind": "Terraform::Resource", "physicalId"?: "i-1",
311
+ * "unobserved"?: "read-failed", "show"?: { "InstanceType": "t3.micro" },
312
+ * "paths": [ { "term": "->*kind:aws_vpc", "dir": "out",
313
+ * "hops": [ { "from": "web", "fromAttr": "subnet_id", "to": "a", "toAttr": "id" },
314
+ * { "from": "a", "fromAttr": "vpc_id", "to": "main", "toAttr": "id" } ] } ] }
315
+ * ],
316
+ * "provenance": "observed live · bound 2/2",
317
+ * "liveFailures"?: ["aws: ..."],
318
+ * "explain"?: { "universe": { "matched": 2, "of": 6, "kinds": ["aws_instance"] },
319
+ * "evidence": [ { "id": "web", "attr": "internetFacing", "via": "..." } ],
320
+ * "nearMisses": [ { "id": "db", "fails": "attr:internetFacing=true" } ],
321
+ * "moreExcluded": 0 },
322
+ * "drift"?: { "against": "live" | "snapshot", ... see SearchDriftJson }
323
+ * }
324
+ *
325
+ * A refused query or invocation prints the head, `query` and
326
+ * `error: { code, message, hint? }` instead, and exits 1. The code is from the
327
+ * read contract's closed list (`SEARCH_ERROR_CODES`).
328
+ *
329
+ * `kind` is the IR kind, so a Terraform block's is `Terraform::Resource`;
330
+ * `kind:aws_instance` matches it by its resource type (#4366).
331
+ *
332
+ * `id` is the graph's full id, stack-qualified (`stack::name`) where the graph
333
+ * qualifies it; `displayId` is the bare name the text row prints. `hops` is in
334
+ * walk order from the match; each hop keeps the edge's own direction (see
335
+ * {@link PathHop}). `paths` is empty when the query has no positive edge
336
+ * term. `show` is present when `--show` was given, holding the requested
337
+ * attributes a row carries, under the name the graph spells them with.
338
+ * `explain` is present with `--explain`; `drift` with `--check-live` or
339
+ * `--check-snapshot`.
340
+ */
341
+ export interface SearchJson {
342
+ query: string;
343
+ source: AnswerSource & {
344
+ env?: string;
345
+ };
346
+ matches: {
347
+ id: string;
348
+ displayId: string;
349
+ kind?: string;
350
+ physicalId?: string;
351
+ unobserved?: string;
352
+ show?: Record<string, unknown>;
353
+ paths: {
354
+ term: string;
355
+ dir: "out" | "in";
356
+ hops: PathHop[];
357
+ because?: {
358
+ capability: string;
359
+ id: string;
360
+ hops: PathHop[];
361
+ }[];
362
+ }[];
363
+ }[];
364
+ provenance?: string;
365
+ /** Present when every match is a planned create (#4372): how many. See the schema. */
366
+ plannedCreates?: number;
367
+ liveFailures?: string[];
368
+ explain?: {
369
+ universe: {
370
+ matched: number;
371
+ of: number;
372
+ kinds: string[];
373
+ };
374
+ evidence: {
375
+ id: string;
376
+ attr: string;
377
+ via: string;
378
+ }[];
379
+ nearMisses: {
380
+ id: string;
381
+ fails?: string;
382
+ }[];
383
+ moreExcluded: number;
384
+ };
385
+ drift?: SearchDriftJson;
386
+ /**
387
+ * Present when the query names a capability (#4375): each one, the
388
+ * observation its facts were derived from, and what it does not evaluate.
389
+ */
390
+ capabilities?: {
391
+ name: string;
392
+ source: AnswerSource["kind"];
393
+ notEvaluated: string[];
394
+ }[];
395
+ }
396
+ /**
397
+ * A refusal under `--json` (#4367): the same message and hint stderr carries,
398
+ * with its code from the read contract's closed list (#4374).
399
+ */
400
+ export type SearchErrorJson = SearchFailure;
401
+ declare function searchErrorJson(query: string, error: {
402
+ code: SearchErrorCode;
403
+ message: string;
404
+ hint?: string;
405
+ }): SearchErrorJson;
406
+ declare function searchJson(query: string, source: AnswerSource, matches: IRNode[], terms: Term[], ir: GraphIR, byId: Map<string, IRNode>, liveFailures?: string[], extra?: {
407
+ env?: string;
408
+ show?: string[];
409
+ provenance?: string;
410
+ plannedCreates?: number;
411
+ capabilities?: SearchJson["capabilities"];
412
+ explain?: ReturnType<typeof explainData>;
413
+ drift?: SearchDriftJson;
414
+ }): SearchJson;
415
+ /** A term as the query grammar spells it, `!` and ASCII arrows included (#4367). */
416
+ declare function termText(t: Term): string;
148
417
  export interface Term {
149
- kind: "word" | "kind" | "tag" | "attr" | "edge";
418
+ kind: "word" | "kind" | "tag" | "attr" | "edge" | "cap";
150
419
  /** `!term` — the node must NOT satisfy this (#1280). */
151
420
  negated?: boolean;
152
421
  a: string;
@@ -154,12 +423,36 @@ export interface Term {
154
423
  /** For edge terms: the direction and the sub-predicate matched at the far end. */
155
424
  dir?: "out" | "in";
156
425
  sub?: Term;
426
+ /**
427
+ * For edge terms (#4359): how many hops the far end may be away. Absent on a
428
+ * plain `->`/`<-`, which is exactly one hop. `max` is `Infinity` for `*`.
429
+ */
430
+ depth?: {
431
+ min: number;
432
+ max: number;
433
+ };
434
+ /** For edge terms (#4359): every edge on the path goes through this consumer attribute (`IREdge.viaAttr`). */
435
+ viaAttr?: string;
436
+ /** For edge terms (#4359): every edge on the path reads this producer attribute (`IREdge.toAttr`). */
437
+ toAttr?: string;
438
+ /**
439
+ * For edge terms (#4375): walk this edge capability (`reaches`,
440
+ * `grants(s3:GetObject)`) instead of the graph's own edges. A `cap:` leaf
441
+ * keeps its call in `a`.
442
+ */
443
+ capability?: string;
157
444
  /**
158
445
  * For kind terms: the kinds this term actually means, resolved against the
159
446
  * graph (see {@link resolveKindTerms}). Absent when nothing resolved it, in
160
447
  * which case the substring rule applies unchanged.
161
448
  */
162
449
  kinds?: Set<string>;
450
+ /**
451
+ * For kind terms (#4366): the terraform resource types this term means,
452
+ * resolved against the graph. A terraform resource matches the term when its
453
+ * type is in here, whatever `kinds` says.
454
+ */
455
+ tfTypes?: Set<string>;
163
456
  }
164
457
  /**
165
458
  * Decide which kinds a `kind:` term means, given what is in the graph.
@@ -182,15 +475,72 @@ export interface Term {
182
475
  * Substring is kept as the fallback, so `kind:Gateway` still finds both
183
476
  * `InternetGateway` and `VPCGatewayAttachment` — a genuine substring search
184
477
  * that no segment rule would serve. Most specific wins; nothing else changes.
478
+ *
479
+ * A terraform resource is `Terraform::Resource` whatever it is, so the term is
480
+ * also read against each resource's type (#4366), with the same boundary rule
481
+ * on `_`: `kind:aws_iam_role` means that type exactly and never
482
+ * `aws_iam_role_policy`, and a term ending in `_` (`kind:aws_iam_`) or a bare
483
+ * provider name (`kind:aws`) means every type it begins. A data source's type
484
+ * keeps its `data.` prefix (`kind:data.aws_ami`), the same type `--count-by kind`
485
+ * groups it under, so `kind:aws_ami` is not a data source. A term that names a
486
+ * type turns off the substring fallback for the IR kind, so `kind:aws_instance`
487
+ * is the instances and nothing found by accident.
185
488
  */
186
489
  export declare function resolveKindTerms(terms: Term[], nodes: IRNode[]): void;
187
490
  declare function parseQuery(query: string): Term[];
188
491
  declare function matchTerm(n: IRNode, t: Term, ir?: GraphIR, byId?: Map<string, IRNode>): boolean;
492
+ /**
493
+ * One edge on the path a match was reached by (#4359), in walk order from the
494
+ * match outward. `from` and `to` keep the edge's own direction (`from` holds
495
+ * the reference, `to` is what it names), whichever way the term walked, so a
496
+ * reader can find the edge in the graph by its endpoints. Node ids are the
497
+ * graph's full ids, stack qualification included.
498
+ */
499
+ export interface PathHop {
500
+ from: string;
501
+ /** The consumer attribute the reference flows through (`IREdge.viaAttr`), when known. */
502
+ fromAttr?: string;
503
+ to: string;
504
+ /** The producer attribute read (`IREdge.toAttr`), when known. */
505
+ toAttr?: string;
506
+ /**
507
+ * On a capability's path (#4375): the name the capability rules give this
508
+ * edge (`subnet`, `statement`, `resource`). Its `from` may be a node inside
509
+ * another (a policy statement, `<holder>#policy[0].Statement[1]`).
510
+ */
511
+ edge?: string;
512
+ }
513
+ /**
514
+ * The shortest path by which an edge term reaches `n` (#4359), or null.
515
+ *
516
+ * Breadth-first over the edges in the term's direction, keeping only edges
517
+ * whose attributes satisfy its qualifier, and accepting a node that satisfies
518
+ * the target leaf (any node when the term has none) at a depth inside the
519
+ * term's range. A plain `->`/`<-` is the range 1..1.
520
+ *
521
+ * Termination on a cycle: a state is (node, depth capped at the range's
522
+ * minimum). Past the minimum, arriving at a node again by a longer walk can
523
+ * reach nothing the first arrival could not, so it is not queued twice. The
524
+ * state space is finite and the walk always ends.
525
+ */
526
+ declare function findPath(n: IRNode, t: Term, ir: GraphIR, byId: Map<string, IRNode>): PathHop[] | null;
527
+ /**
528
+ * A path as one line of `id.attr` steps, read from the match outward (#4359).
529
+ * Walking `->`, each hop reads `consumer.via -> producer.attr`; walking `<-`,
530
+ * `producer.attr <- consumer.via`. Hops are joined with `; `.
531
+ */
532
+ declare function formatPath(hops: PathHop[], dir: "out" | "in"): string;
189
533
  declare function formatRow(n: IRNode, show: string[]): string;
190
534
  /** Internals exposed for unit tests. */
191
535
  export declare const __searchInternals: {
192
536
  parseQuery: typeof parseQuery;
193
537
  matchTerm: typeof matchTerm;
538
+ findPath: typeof findPath;
539
+ formatPath: typeof formatPath;
540
+ searchJson: typeof searchJson;
541
+ searchErrorJson: typeof searchErrorJson;
542
+ explainData: typeof explainData;
543
+ termText: typeof termText;
194
544
  formatRow: typeof formatRow;
195
545
  explain: typeof explain;
196
546
  describeTerm: typeof describeTerm;
@@ -200,7 +550,9 @@ export declare const __searchInternals: {
200
550
  regionSpread: typeof regionSpread;
201
551
  showMiss: typeof showMiss;
202
552
  provenance: typeof provenance;
553
+ provenanceLine: typeof provenanceLine;
203
554
  renderDrift: typeof renderDrift;
555
+ searchDriftJson: typeof searchDriftJson;
204
556
  mergeResources: typeof mergeResources;
205
557
  pickResources: typeof pickResources;
206
558
  };
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/search.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0E,KAAK,OAAO,EAAE,KAAK,MAAM,EAAe,MAAM,gBAAgB,CAAC;AAQhJ,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAK9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA+VpE;AAGD,0EAA0E;AAC1E,KAAK,YAAY,GACb;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAK5D;;;;;;;;GAQG;AACH,iBAAS,QAAQ,CAAC,OAAO,EAAE,MA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