@descryy/core 0.1.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 (366) hide show
  1. package/LICENSE +21 -0
  2. package/dist/capabilities/index.d.ts +3 -0
  3. package/dist/capabilities/index.d.ts.map +1 -0
  4. package/dist/capabilities/index.js +2 -0
  5. package/dist/capabilities/index.js.map +1 -0
  6. package/dist/capabilities/preconditions.d.ts +99 -0
  7. package/dist/capabilities/preconditions.d.ts.map +1 -0
  8. package/dist/capabilities/preconditions.js +94 -0
  9. package/dist/capabilities/preconditions.js.map +1 -0
  10. package/dist/contracts/engine.d.ts +90 -0
  11. package/dist/contracts/engine.d.ts.map +1 -0
  12. package/dist/contracts/engine.js +291 -0
  13. package/dist/contracts/engine.js.map +1 -0
  14. package/dist/contracts/index.d.ts +9 -0
  15. package/dist/contracts/index.d.ts.map +1 -0
  16. package/dist/contracts/index.js +5 -0
  17. package/dist/contracts/index.js.map +1 -0
  18. package/dist/contracts/orphans.d.ts +96 -0
  19. package/dist/contracts/orphans.d.ts.map +1 -0
  20. package/dist/contracts/orphans.js +241 -0
  21. package/dist/contracts/orphans.js.map +1 -0
  22. package/dist/contracts/paths.d.ts +132 -0
  23. package/dist/contracts/paths.d.ts.map +1 -0
  24. package/dist/contracts/paths.js +245 -0
  25. package/dist/contracts/paths.js.map +1 -0
  26. package/dist/contracts/shapes.d.ts +99 -0
  27. package/dist/contracts/shapes.d.ts.map +1 -0
  28. package/dist/contracts/shapes.js +196 -0
  29. package/dist/contracts/shapes.js.map +1 -0
  30. package/dist/governance/budget.d.ts +89 -0
  31. package/dist/governance/budget.d.ts.map +1 -0
  32. package/dist/governance/budget.js +101 -0
  33. package/dist/governance/budget.js.map +1 -0
  34. package/dist/governance/candidate-boundary.d.ts +49 -0
  35. package/dist/governance/candidate-boundary.d.ts.map +1 -0
  36. package/dist/governance/candidate-boundary.js +51 -0
  37. package/dist/governance/candidate-boundary.js.map +1 -0
  38. package/dist/governance/escalation.d.ts +63 -0
  39. package/dist/governance/escalation.d.ts.map +1 -0
  40. package/dist/governance/escalation.js +72 -0
  41. package/dist/governance/escalation.js.map +1 -0
  42. package/dist/governance/fact-boundary.d.ts +77 -0
  43. package/dist/governance/fact-boundary.d.ts.map +1 -0
  44. package/dist/governance/fact-boundary.js +91 -0
  45. package/dist/governance/fact-boundary.js.map +1 -0
  46. package/dist/governance/finding-funnel.d.ts +109 -0
  47. package/dist/governance/finding-funnel.d.ts.map +1 -0
  48. package/dist/governance/finding-funnel.js +137 -0
  49. package/dist/governance/finding-funnel.js.map +1 -0
  50. package/dist/governance/index.d.ts +11 -0
  51. package/dist/governance/index.d.ts.map +1 -0
  52. package/dist/governance/index.js +6 -0
  53. package/dist/governance/index.js.map +1 -0
  54. package/dist/graph/build.d.ts +127 -0
  55. package/dist/graph/build.d.ts.map +1 -0
  56. package/dist/graph/build.js +0 -0
  57. package/dist/graph/build.js.map +1 -0
  58. package/dist/graph/cross-language.d.ts +70 -0
  59. package/dist/graph/cross-language.d.ts.map +1 -0
  60. package/dist/graph/cross-language.js +104 -0
  61. package/dist/graph/cross-language.js.map +1 -0
  62. package/dist/graph/index.d.ts +11 -0
  63. package/dist/graph/index.d.ts.map +1 -0
  64. package/dist/graph/index.js +6 -0
  65. package/dist/graph/index.js.map +1 -0
  66. package/dist/graph/merge.d.ts +95 -0
  67. package/dist/graph/merge.d.ts.map +1 -0
  68. package/dist/graph/merge.js +131 -0
  69. package/dist/graph/merge.js.map +1 -0
  70. package/dist/graph/persist.d.ts +42 -0
  71. package/dist/graph/persist.d.ts.map +1 -0
  72. package/dist/graph/persist.js +52 -0
  73. package/dist/graph/persist.js.map +1 -0
  74. package/dist/graph/runtime-confirmation.d.ts +169 -0
  75. package/dist/graph/runtime-confirmation.d.ts.map +1 -0
  76. package/dist/graph/runtime-confirmation.js +318 -0
  77. package/dist/graph/runtime-confirmation.js.map +1 -0
  78. package/dist/index.d.ts +18 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +19 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/ledger/index.d.ts +5 -0
  83. package/dist/ledger/index.d.ts.map +1 -0
  84. package/dist/ledger/index.js +3 -0
  85. package/dist/ledger/index.js.map +1 -0
  86. package/dist/ledger/mint.d.ts +81 -0
  87. package/dist/ledger/mint.d.ts.map +1 -0
  88. package/dist/ledger/mint.js +138 -0
  89. package/dist/ledger/mint.js.map +1 -0
  90. package/dist/ledger/resolve.d.ts +124 -0
  91. package/dist/ledger/resolve.d.ts.map +1 -0
  92. package/dist/ledger/resolve.js +290 -0
  93. package/dist/ledger/resolve.js.map +1 -0
  94. package/dist/multipr/fingerprint.d.ts +56 -0
  95. package/dist/multipr/fingerprint.d.ts.map +1 -0
  96. package/dist/multipr/fingerprint.js +169 -0
  97. package/dist/multipr/fingerprint.js.map +1 -0
  98. package/dist/multipr/hidden-dependency.d.ts +120 -0
  99. package/dist/multipr/hidden-dependency.d.ts.map +1 -0
  100. package/dist/multipr/hidden-dependency.js +185 -0
  101. package/dist/multipr/hidden-dependency.js.map +1 -0
  102. package/dist/multipr/index.d.ts +14 -0
  103. package/dist/multipr/index.d.ts.map +1 -0
  104. package/dist/multipr/index.js +8 -0
  105. package/dist/multipr/index.js.map +1 -0
  106. package/dist/multipr/mechanical.d.ts +239 -0
  107. package/dist/multipr/mechanical.d.ts.map +1 -0
  108. package/dist/multipr/mechanical.js +333 -0
  109. package/dist/multipr/mechanical.js.map +1 -0
  110. package/dist/multipr/migration-heads.d.ts +160 -0
  111. package/dist/multipr/migration-heads.d.ts.map +1 -0
  112. package/dist/multipr/migration-heads.js +212 -0
  113. package/dist/multipr/migration-heads.js.map +1 -0
  114. package/dist/multipr/overlap.d.ts +186 -0
  115. package/dist/multipr/overlap.d.ts.map +1 -0
  116. package/dist/multipr/overlap.js +254 -0
  117. package/dist/multipr/overlap.js.map +1 -0
  118. package/dist/multipr/scope-store.d.ts +105 -0
  119. package/dist/multipr/scope-store.d.ts.map +1 -0
  120. package/dist/multipr/scope-store.js +182 -0
  121. package/dist/multipr/scope-store.js.map +1 -0
  122. package/dist/multipr/superseded.d.ts +133 -0
  123. package/dist/multipr/superseded.d.ts.map +1 -0
  124. package/dist/multipr/superseded.js +128 -0
  125. package/dist/multipr/superseded.js.map +1 -0
  126. package/dist/query/confirmed-facts.d.ts +56 -0
  127. package/dist/query/confirmed-facts.d.ts.map +1 -0
  128. package/dist/query/confirmed-facts.js +64 -0
  129. package/dist/query/confirmed-facts.js.map +1 -0
  130. package/dist/query/declared-value-closure.d.ts +126 -0
  131. package/dist/query/declared-value-closure.d.ts.map +1 -0
  132. package/dist/query/declared-value-closure.js +156 -0
  133. package/dist/query/declared-value-closure.js.map +1 -0
  134. package/dist/query/index.d.ts +28 -0
  135. package/dist/query/index.d.ts.map +1 -0
  136. package/dist/query/index.js +15 -0
  137. package/dist/query/index.js.map +1 -0
  138. package/dist/query/memory.d.ts +20 -0
  139. package/dist/query/memory.d.ts.map +1 -0
  140. package/dist/query/memory.js +55 -0
  141. package/dist/query/memory.js.map +1 -0
  142. package/dist/query/provider.d.ts +127 -0
  143. package/dist/query/provider.d.ts.map +1 -0
  144. package/dist/query/provider.js +54 -0
  145. package/dist/query/provider.js.map +1 -0
  146. package/dist/query/queries.d.ts +119 -0
  147. package/dist/query/queries.d.ts.map +1 -0
  148. package/dist/query/queries.js +267 -0
  149. package/dist/query/queries.js.map +1 -0
  150. package/dist/query/refusal-fetch.d.ts +114 -0
  151. package/dist/query/refusal-fetch.d.ts.map +1 -0
  152. package/dist/query/refusal-fetch.js +200 -0
  153. package/dist/query/refusal-fetch.js.map +1 -0
  154. package/dist/query/refusal-questions.d.ts +123 -0
  155. package/dist/query/refusal-questions.d.ts.map +1 -0
  156. package/dist/query/refusal-questions.js +122 -0
  157. package/dist/query/refusal-questions.js.map +1 -0
  158. package/dist/query/root-cause-score.d.ts +218 -0
  159. package/dist/query/root-cause-score.d.ts.map +1 -0
  160. package/dist/query/root-cause-score.js +251 -0
  161. package/dist/query/root-cause-score.js.map +1 -0
  162. package/dist/query/row-closure-picture.d.ts +108 -0
  163. package/dist/query/row-closure-picture.d.ts.map +1 -0
  164. package/dist/query/row-closure-picture.js +131 -0
  165. package/dist/query/row-closure-picture.js.map +1 -0
  166. package/dist/query/similar-incidents.d.ts +76 -0
  167. package/dist/query/similar-incidents.d.ts.map +1 -0
  168. package/dist/query/similar-incidents.js +169 -0
  169. package/dist/query/similar-incidents.js.map +1 -0
  170. package/dist/query/sqlite.d.ts +13 -0
  171. package/dist/query/sqlite.d.ts.map +1 -0
  172. package/dist/query/sqlite.js +54 -0
  173. package/dist/query/sqlite.js.map +1 -0
  174. package/dist/query/traverse.d.ts +110 -0
  175. package/dist/query/traverse.d.ts.map +1 -0
  176. package/dist/query/traverse.js +0 -0
  177. package/dist/query/traverse.js.map +1 -0
  178. package/dist/query/unresolved.d.ts +195 -0
  179. package/dist/query/unresolved.d.ts.map +1 -0
  180. package/dist/query/unresolved.js +225 -0
  181. package/dist/query/unresolved.js.map +1 -0
  182. package/dist/query/verification-status.d.ts +134 -0
  183. package/dist/query/verification-status.d.ts.map +1 -0
  184. package/dist/query/verification-status.js +163 -0
  185. package/dist/query/verification-status.js.map +1 -0
  186. package/dist/recording/index.d.ts +26 -0
  187. package/dist/recording/index.d.ts.map +1 -0
  188. package/dist/recording/index.js +30 -0
  189. package/dist/recording/index.js.map +1 -0
  190. package/dist/recording/migrate.d.ts +22 -0
  191. package/dist/recording/migrate.d.ts.map +1 -0
  192. package/dist/recording/migrate.js +51 -0
  193. package/dist/recording/migrate.js.map +1 -0
  194. package/dist/recording/reader.d.ts +27 -0
  195. package/dist/recording/reader.d.ts.map +1 -0
  196. package/dist/recording/reader.js +55 -0
  197. package/dist/recording/reader.js.map +1 -0
  198. package/dist/recording/redact.d.ts +63 -0
  199. package/dist/recording/redact.d.ts.map +1 -0
  200. package/dist/recording/redact.js +98 -0
  201. package/dist/recording/redact.js.map +1 -0
  202. package/dist/recording/schema.d.ts +41 -0
  203. package/dist/recording/schema.d.ts.map +1 -0
  204. package/dist/recording/schema.js +104 -0
  205. package/dist/recording/schema.js.map +1 -0
  206. package/dist/recording/writer.d.ts +120 -0
  207. package/dist/recording/writer.d.ts.map +1 -0
  208. package/dist/recording/writer.js +81 -0
  209. package/dist/recording/writer.js.map +1 -0
  210. package/dist/scoping/fanout.d.ts +86 -0
  211. package/dist/scoping/fanout.d.ts.map +1 -0
  212. package/dist/scoping/fanout.js +95 -0
  213. package/dist/scoping/fanout.js.map +1 -0
  214. package/dist/scoping/index.d.ts +10 -0
  215. package/dist/scoping/index.d.ts.map +1 -0
  216. package/dist/scoping/index.js +6 -0
  217. package/dist/scoping/index.js.map +1 -0
  218. package/dist/scoping/score.d.ts +83 -0
  219. package/dist/scoping/score.d.ts.map +1 -0
  220. package/dist/scoping/score.js +125 -0
  221. package/dist/scoping/score.js.map +1 -0
  222. package/dist/scoping/tiers.d.ts +32 -0
  223. package/dist/scoping/tiers.d.ts.map +1 -0
  224. package/dist/scoping/tiers.js +35 -0
  225. package/dist/scoping/tiers.js.map +1 -0
  226. package/dist/scoping/traverse.d.ts +60 -0
  227. package/dist/scoping/traverse.d.ts.map +1 -0
  228. package/dist/scoping/traverse.js +172 -0
  229. package/dist/scoping/traverse.js.map +1 -0
  230. package/dist/scoping/weights.d.ts +97 -0
  231. package/dist/scoping/weights.d.ts.map +1 -0
  232. package/dist/scoping/weights.js +167 -0
  233. package/dist/scoping/weights.js.map +1 -0
  234. package/dist/sources/git/diff.d.ts +53 -0
  235. package/dist/sources/git/diff.d.ts.map +1 -0
  236. package/dist/sources/git/diff.js +140 -0
  237. package/dist/sources/git/diff.js.map +1 -0
  238. package/dist/sources/git/env.d.ts +2 -0
  239. package/dist/sources/git/env.d.ts.map +1 -0
  240. package/dist/sources/git/env.js +21 -0
  241. package/dist/sources/git/env.js.map +1 -0
  242. package/dist/sources/git/history.d.ts +140 -0
  243. package/dist/sources/git/history.d.ts.map +1 -0
  244. package/dist/sources/git/history.js +314 -0
  245. package/dist/sources/git/history.js.map +1 -0
  246. package/dist/sources/git/index.d.ts +7 -0
  247. package/dist/sources/git/index.d.ts.map +1 -0
  248. package/dist/sources/git/index.js +4 -0
  249. package/dist/sources/git/index.js.map +1 -0
  250. package/dist/sources/git/source.d.ts +95 -0
  251. package/dist/sources/git/source.d.ts.map +1 -0
  252. package/dist/sources/git/source.js +0 -0
  253. package/dist/sources/git/source.js.map +1 -0
  254. package/dist/sources/migrations/dialects.d.ts +59 -0
  255. package/dist/sources/migrations/dialects.d.ts.map +1 -0
  256. package/dist/sources/migrations/dialects.js +84 -0
  257. package/dist/sources/migrations/dialects.js.map +1 -0
  258. package/dist/sources/migrations/index.d.ts +3 -0
  259. package/dist/sources/migrations/index.d.ts.map +1 -0
  260. package/dist/sources/migrations/index.js +2 -0
  261. package/dist/sources/migrations/index.js.map +1 -0
  262. package/dist/sources/migrations/read.d.ts +113 -0
  263. package/dist/sources/migrations/read.d.ts.map +1 -0
  264. package/dist/sources/migrations/read.js +270 -0
  265. package/dist/sources/migrations/read.js.map +1 -0
  266. package/dist/sources/workspace/index.d.ts +3 -0
  267. package/dist/sources/workspace/index.d.ts.map +1 -0
  268. package/dist/sources/workspace/index.js +2 -0
  269. package/dist/sources/workspace/index.js.map +1 -0
  270. package/dist/sources/workspace/workspace.d.ts +64 -0
  271. package/dist/sources/workspace/workspace.d.ts.map +1 -0
  272. package/dist/sources/workspace/workspace.js +294 -0
  273. package/dist/sources/workspace/workspace.js.map +1 -0
  274. package/dist/store/driver/driver.d.ts +82 -0
  275. package/dist/store/driver/driver.d.ts.map +1 -0
  276. package/dist/store/driver/driver.js +31 -0
  277. package/dist/store/driver/driver.js.map +1 -0
  278. package/dist/store/driver/node-sqlite.d.ts +28 -0
  279. package/dist/store/driver/node-sqlite.d.ts.map +1 -0
  280. package/dist/store/driver/node-sqlite.js +188 -0
  281. package/dist/store/driver/node-sqlite.js.map +1 -0
  282. package/dist/store/index.d.ts +33 -0
  283. package/dist/store/index.d.ts.map +1 -0
  284. package/dist/store/index.js +46 -0
  285. package/dist/store/index.js.map +1 -0
  286. package/dist/store/migrate.d.ts +68 -0
  287. package/dist/store/migrate.d.ts.map +1 -0
  288. package/dist/store/migrate.js +140 -0
  289. package/dist/store/migrate.js.map +1 -0
  290. package/dist/store/reader.d.ts +127 -0
  291. package/dist/store/reader.d.ts.map +1 -0
  292. package/dist/store/reader.js +269 -0
  293. package/dist/store/reader.js.map +1 -0
  294. package/dist/store/schema.d.ts +87 -0
  295. package/dist/store/schema.d.ts.map +1 -0
  296. package/dist/store/schema.js +322 -0
  297. package/dist/store/schema.js.map +1 -0
  298. package/dist/store/writer.d.ts +116 -0
  299. package/dist/store/writer.d.ts.map +1 -0
  300. package/dist/store/writer.js +279 -0
  301. package/dist/store/writer.js.map +1 -0
  302. package/dist/tiers/certify.d.ts +375 -0
  303. package/dist/tiers/certify.d.ts.map +1 -0
  304. package/dist/tiers/certify.js +434 -0
  305. package/dist/tiers/certify.js.map +1 -0
  306. package/dist/tiers/index.d.ts +5 -0
  307. package/dist/tiers/index.d.ts.map +1 -0
  308. package/dist/tiers/index.js +3 -0
  309. package/dist/tiers/index.js.map +1 -0
  310. package/dist/tiers/ladder.d.ts +73 -0
  311. package/dist/tiers/ladder.d.ts.map +1 -0
  312. package/dist/tiers/ladder.js +197 -0
  313. package/dist/tiers/ladder.js.map +1 -0
  314. package/dist/validation/config-graph.d.ts +104 -0
  315. package/dist/validation/config-graph.d.ts.map +1 -0
  316. package/dist/validation/config-graph.js +205 -0
  317. package/dist/validation/config-graph.js.map +1 -0
  318. package/dist/validation/env.d.ts +243 -0
  319. package/dist/validation/env.d.ts.map +1 -0
  320. package/dist/validation/env.js +447 -0
  321. package/dist/validation/env.js.map +1 -0
  322. package/dist/validation/index.d.ts +16 -0
  323. package/dist/validation/index.d.ts.map +1 -0
  324. package/dist/validation/index.js +9 -0
  325. package/dist/validation/index.js.map +1 -0
  326. package/dist/validation/join-substitution.d.ts +186 -0
  327. package/dist/validation/join-substitution.d.ts.map +1 -0
  328. package/dist/validation/join-substitution.js +191 -0
  329. package/dist/validation/join-substitution.js.map +1 -0
  330. package/dist/validation/migrations.d.ts +133 -0
  331. package/dist/validation/migrations.d.ts.map +1 -0
  332. package/dist/validation/migrations.js +315 -0
  333. package/dist/validation/migrations.js.map +1 -0
  334. package/dist/validation/nodes.d.ts +32 -0
  335. package/dist/validation/nodes.d.ts.map +1 -0
  336. package/dist/validation/nodes.js +45 -0
  337. package/dist/validation/nodes.js.map +1 -0
  338. package/dist/validation/rollback.d.ts +124 -0
  339. package/dist/validation/rollback.d.ts.map +1 -0
  340. package/dist/validation/rollback.js +302 -0
  341. package/dist/validation/rollback.js.map +1 -0
  342. package/dist/validation/route-drift.d.ts +108 -0
  343. package/dist/validation/route-drift.d.ts.map +1 -0
  344. package/dist/validation/route-drift.js +103 -0
  345. package/dist/validation/route-drift.js.map +1 -0
  346. package/dist/validation/sources.d.ts +153 -0
  347. package/dist/validation/sources.d.ts.map +1 -0
  348. package/dist/validation/sources.js +409 -0
  349. package/dist/validation/sources.js.map +1 -0
  350. package/dist/worker/index.d.ts +5 -0
  351. package/dist/worker/index.d.ts.map +1 -0
  352. package/dist/worker/index.js +3 -0
  353. package/dist/worker/index.js.map +1 -0
  354. package/dist/worker/pool.d.ts +73 -0
  355. package/dist/worker/pool.d.ts.map +1 -0
  356. package/dist/worker/pool.js +203 -0
  357. package/dist/worker/pool.js.map +1 -0
  358. package/dist/worker/protocol.d.ts +91 -0
  359. package/dist/worker/protocol.d.ts.map +1 -0
  360. package/dist/worker/protocol.js +19 -0
  361. package/dist/worker/protocol.js.map +1 -0
  362. package/dist/worker/traversal.worker.d.ts +25 -0
  363. package/dist/worker/traversal.worker.d.ts.map +1 -0
  364. package/dist/worker/traversal.worker.js +124 -0
  365. package/dist/worker/traversal.worker.js.map +1 -0
  366. package/package.json +29 -0
@@ -0,0 +1,153 @@
1
+ /**
2
+ * The declaration side of §15's env/config check — read from the repository, not
3
+ * from the graph.
4
+ *
5
+ * ## Why this is not an adapter, and why it is legal here
6
+ *
7
+ * §15.3's own wording is *"cross-check against declared variables **or the
8
+ * deploy target's actual state**"*. The deploy target's state is not in the graph
9
+ * and never will be. What holds it is `.env`, a container manifest, a CI
10
+ * workflow, an image build file — **formats, not languages.** Reading
11
+ * `KEY=value` and an indented `env:` block names no language, so it does not
12
+ * cross the Canonical IR boundary; it is legal above it for the same reason
13
+ * reading a commit log is (`sources/git`).
14
+ *
15
+ * That is what lets the check produce findings with no adapter change at all.
16
+ * See DEC-120.
17
+ *
18
+ * ## Precision over recall, three times, because a misparse here is a wrong finding
19
+ *
20
+ * A name invented by a sloppy scan becomes a confident sentence about somebody's
21
+ * configuration. So:
22
+ *
23
+ * 1. **Two different name rules, on purpose.** In a dotenv file `KEY=` is
24
+ * unambiguous, so any identifier shape is taken. Inside a structured document
25
+ * an `env:` block is indistinguishable from any other mapping once the scan
26
+ * loses its place, so only `UPPER_SNAKE` is accepted. The cost is a lowercase
27
+ * variable in a manifest, which is rare; the alternative is turning a stray
28
+ * key into a declaration.
29
+ * 2. **A block ends at the first line indented no deeper than its header.** No
30
+ * document model, no continuation handling, no anchors. A construct this scan
31
+ * cannot follow ends the block early, which *loses* names — a disclosed gap
32
+ * rather than a wrong one.
33
+ * 3. **A commented-out declaration counts, and is marked.** `# STRIPE_KEY=` in a
34
+ * sample file documents that the variable exists, which is exactly the
35
+ * question being asked. Treating it as absent would report every well
36
+ * documented optional setting as undeclared.
37
+ *
38
+ * ## The example/supply distinction
39
+ *
40
+ * `.env.example` **documents**; `.env.development` and a container manifest
41
+ * **supply**. Both are declarations for the purpose of "does this repository know
42
+ * this variable exists", and they are not interchangeable for anything else, so
43
+ * the distinction is carried on the surface rather than flattened.
44
+ */
45
+ /** What a surface is evidence *of*. */
46
+ export type SurfaceRole =
47
+ /** The repository's own statement that a variable exists. */
48
+ "declaration"
49
+ /** Something that actually sets a value on a path to production. */
50
+ | "deployTarget";
51
+ export type SurfaceFormat = "dotenv" | "structured" | "imageBuild" | "wranglerVars";
52
+ export interface EnvDeclaration {
53
+ readonly name: string;
54
+ /** 1-indexed, so a finding can cite it. */
55
+ readonly line: number;
56
+ /** Documented but not active — a commented-out assignment. */
57
+ readonly commented: boolean;
58
+ }
59
+ export interface ConfigSurface {
60
+ /** Repo-relative, with forward slashes. */
61
+ readonly file: string;
62
+ readonly format: SurfaceFormat;
63
+ readonly role: SurfaceRole;
64
+ /** True for `.env.example` / `.sample` / `.template` — documents, does not supply. */
65
+ readonly example: boolean;
66
+ readonly declarations: readonly EnvDeclaration[];
67
+ }
68
+ export interface SurfaceScan {
69
+ readonly surfaces: readonly ConfigSurface[];
70
+ /** Paths that looked like a surface and could not be read. Never silent. */
71
+ readonly unreadable: readonly string[];
72
+ /** True when the walk hit its file budget before finishing. */
73
+ readonly truncated: boolean;
74
+ /**
75
+ * The noise directories this walk actually used, echoed back.
76
+ *
77
+ * Empty means no adapter declared any, and the walk therefore descended into
78
+ * whatever vendored trees the repository holds. Reporting it is what keeps an
79
+ * undeclared scan from reading like a complete one (rule 7) — the caller can
80
+ * see that the surface count is inflated rather than inferring it from a number
81
+ * that looks fine.
82
+ */
83
+ readonly noiseDirectories: readonly string[];
84
+ }
85
+ export interface ScanOptions {
86
+ /** Directory budget depth. Beyond it the walk stops and says so. */
87
+ readonly maxDepth?: number;
88
+ /** Total files a walk may consider. */
89
+ readonly maxFiles?: number;
90
+ /**
91
+ * Directories this repository's ecosystems install dependencies or build output
92
+ * into — `node_modules`, `vendor`, `target`. **Supplied by the caller from the
93
+ * active adapters' `CapabilityMatrix.noiseDirectories`, never known here**
94
+ * (DEC-110). Undeclared, they are walked, and `SurfaceScan` says so.
95
+ */
96
+ readonly noiseDirectories?: readonly string[];
97
+ }
98
+ /**
99
+ * Shared with the migration scan, so the two walks cannot disagree about what
100
+ * counts as vendored. A second copy of this rule is a second place to forget the
101
+ * next ecosystem.
102
+ */
103
+ export declare function skipDirectory(name: string, noiseDirectories?: readonly string[]): boolean;
104
+ /**
105
+ * Read every configuration surface a repository exposes.
106
+ *
107
+ * Structured documents are only opened when their path says they are a manifest
108
+ * or a workflow. Opening every YAML file in a repository would pull in test
109
+ * data, schema definitions and dependency lockfiles, and an `env:` key inside a
110
+ * schema definition is a description of a variable rather than a declaration of
111
+ * one.
112
+ */
113
+ export declare function scanConfigSurfaces(root: string, options?: ScanOptions): SurfaceScan;
114
+ /** `KEY=value`, and `# KEY=value`, which documents the same variable. */
115
+ export declare function readDotenv(text: string): readonly EnvDeclaration[];
116
+ /** `ENV K=V`, the legacy `ENV K V`, and `ARG K`. */
117
+ export declare function readImageBuild(text: string): readonly EnvDeclaration[];
118
+ /**
119
+ * `env:` / `environment:` blocks in an indented document, in both forms.
120
+ *
121
+ * Mapping — `KEY: value` — and sequence — `- KEY=value` or a bare `- KEY`. The
122
+ * bare sequence form declares a pass-through from the host, which is still the
123
+ * document stating that the variable exists.
124
+ */
125
+ export declare function readStructured(text: string): readonly EnvDeclaration[];
126
+ /** One `KEY = "value"` line inside a `wrangler.toml` `[vars]` or `[env.<name>.vars]` table. */
127
+ export interface WranglerVarsEntry {
128
+ /** `"default"` for the top-level `[vars]` table — the same tag `resolve.ts`'s `environmentOf` gives a bare `.env` file. */
129
+ readonly environment: string;
130
+ readonly name: string;
131
+ /** `null` for a commented-out line — documented, not active, same rule `readDotenv` applies. */
132
+ readonly value: string | null;
133
+ readonly line: number;
134
+ readonly commented: boolean;
135
+ }
136
+ /**
137
+ * Walk a `wrangler.toml`'s `[vars]` and `[env.<name>.vars]` tables only.
138
+ *
139
+ * Every other table — `[[kv_namespaces]]`, `[assets]`, `[env.<name>]` itself
140
+ * (the deploy target's own settings, not its vars) — is out of scope by
141
+ * construction rather than by exclusion list: entering *any* table this
142
+ * function does not recognise as a vars table resets tracking to "outside",
143
+ * so a line that merely looks like `KEY = value` inside `[[kv_namespaces]]`
144
+ * (e.g. `binding = "HOSTNAMES"`) is never mistaken for a declared variable.
145
+ * `[[...]]` array-of-tables headers are matched and reset scope the same way,
146
+ * rather than silently falling through as an unrecognised line — an
147
+ * `[[env.staging.kv_namespaces]]` line right after `[env.staging.vars]` must
148
+ * end that table, not extend it.
149
+ */
150
+ export declare function readWranglerVarsEntries(text: string): readonly WranglerVarsEntry[];
151
+ /** The declaration-only projection `scanConfigSurfaces` uses. See `readWranglerVarsEntries` for the value-carrying form `resolve.ts` reads. */
152
+ export declare function readWranglerVars(text: string): readonly EnvDeclaration[];
153
+ //# sourceMappingURL=sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../src/validation/sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAKH,uCAAuC;AACvC,MAAM,MAAM,WAAW;AACrB,6DAA6D;AAC3D,aAAa;AACf,oEAAoE;GAClE,cAAc,CAAC;AAEnB,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,GAAG,cAAc,CAAC;AAEpF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,sFAAsF;IACtF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,SAAS,cAAc,EAAE,CAAC;CAClD;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,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AC;IACtB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAWD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,iBAAiB,EAAE,CAoClF;AAED,+IAA+I;AAC/I,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,cAAc,EAAE,CAGxE"}
@@ -0,0 +1,409 @@
1
+ /**
2
+ * The declaration side of §15's env/config check — read from the repository, not
3
+ * from the graph.
4
+ *
5
+ * ## Why this is not an adapter, and why it is legal here
6
+ *
7
+ * §15.3's own wording is *"cross-check against declared variables **or the
8
+ * deploy target's actual state**"*. The deploy target's state is not in the graph
9
+ * and never will be. What holds it is `.env`, a container manifest, a CI
10
+ * workflow, an image build file — **formats, not languages.** Reading
11
+ * `KEY=value` and an indented `env:` block names no language, so it does not
12
+ * cross the Canonical IR boundary; it is legal above it for the same reason
13
+ * reading a commit log is (`sources/git`).
14
+ *
15
+ * That is what lets the check produce findings with no adapter change at all.
16
+ * See DEC-120.
17
+ *
18
+ * ## Precision over recall, three times, because a misparse here is a wrong finding
19
+ *
20
+ * A name invented by a sloppy scan becomes a confident sentence about somebody's
21
+ * configuration. So:
22
+ *
23
+ * 1. **Two different name rules, on purpose.** In a dotenv file `KEY=` is
24
+ * unambiguous, so any identifier shape is taken. Inside a structured document
25
+ * an `env:` block is indistinguishable from any other mapping once the scan
26
+ * loses its place, so only `UPPER_SNAKE` is accepted. The cost is a lowercase
27
+ * variable in a manifest, which is rare; the alternative is turning a stray
28
+ * key into a declaration.
29
+ * 2. **A block ends at the first line indented no deeper than its header.** No
30
+ * document model, no continuation handling, no anchors. A construct this scan
31
+ * cannot follow ends the block early, which *loses* names — a disclosed gap
32
+ * rather than a wrong one.
33
+ * 3. **A commented-out declaration counts, and is marked.** `# STRIPE_KEY=` in a
34
+ * sample file documents that the variable exists, which is exactly the
35
+ * question being asked. Treating it as absent would report every well
36
+ * documented optional setting as undeclared.
37
+ *
38
+ * ## The example/supply distinction
39
+ *
40
+ * `.env.example` **documents**; `.env.development` and a container manifest
41
+ * **supply**. Both are declarations for the purpose of "does this repository know
42
+ * this variable exists", and they are not interchangeable for anything else, so
43
+ * the distinction is carried on the surface rather than flattened.
44
+ */
45
+ import { readFileSync, readdirSync, statSync } from "node:fs";
46
+ import { join, relative, sep } from "node:path";
47
+ const DEFAULT_MAX_DEPTH = 5;
48
+ const DEFAULT_MAX_FILES = 20_000;
49
+ /**
50
+ * Directories a configuration scan must not descend into.
51
+ *
52
+ * Vendored code carries its own `.env.example` files, and a dependency's sample
53
+ * configuration is not this repository's declaration of anything. Including one
54
+ * would put another project's variable names into the denominator of the
55
+ * coverage guard, which is the number that decides whether anything is reported
56
+ * at all.
57
+ *
58
+ * **The rule is structural, not a list of ecosystems' cache directories.** The
59
+ * first version of this was such a list and the boundary lint rejected it, which
60
+ * was the correct call: engine code that knows one ecosystem's build cache by
61
+ * name is engine code that will be missing the next one's. Every dotted directory
62
+ * is skipped apart from the ones that hold pipeline definitions.
63
+ *
64
+ * **`node_modules`, `vendor`, `target`, `dist`, `build`, `out` and `coverage`
65
+ * used to sit here too**, and DEC-110 recorded them as the unfinished half of its
66
+ * own ruling — *"three ecosystems' names in the skip list"* — while naming the end
67
+ * state: `noiseDirectories` on `CapabilityMatrix`, declared per adapter. They are
68
+ * gone from the engine now and arrive through `ScanOptions.noiseDirectories`
69
+ * instead. **The knowledge moved to the layer that has it; a second list was not
70
+ * created** — DEC-110's *"what must not happen is a third list."*
71
+ *
72
+ * The cost is real and disclosed rather than hidden: with nothing declared, a
73
+ * dependency tree in an undotted directory is walked and a sample inside it is
74
+ * read. `SurfaceScan.noiseDirectories` reports the set actually used, so an empty
75
+ * declaration cannot pass for a complete one (rule 7), and
76
+ * `bench/env-precision.mjs` still reports the surface count per repository.
77
+ */
78
+ /**
79
+ * Dotted directories that are walked anyway, because **configuration lives in
80
+ * them**.
81
+ *
82
+ * The list started as pipelines only and that was too narrow — found by the
83
+ * decisions denominator, not by reasoning. `dispatch` keeps a real
84
+ * `.devcontainer/.env.example` documenting five variables; skipping it made the
85
+ * declaration surface incomplete, which moved the coverage guard *and* made
86
+ * three variables look undocumented when the repository documents all three. A
87
+ * missing declaration source does not fail loudly here: it silently turns
88
+ * correct suppressions into findings.
89
+ *
90
+ * These are directories a human authors configuration in, as opposed to ones a
91
+ * tool writes state into — which is the distinction the dotted-skip rule is
92
+ * reaching for and cannot express structurally. DEC-110 records the end state:
93
+ * the adapter declares its own noise directories and this list goes away.
94
+ */
95
+ const CONFIG_DIRECTORIES = new Set([
96
+ ".github",
97
+ ".circleci",
98
+ ".buildkite",
99
+ ".devcontainer",
100
+ ".config",
101
+ ]);
102
+ /**
103
+ * Shared with the migration scan, so the two walks cannot disagree about what
104
+ * counts as vendored. A second copy of this rule is a second place to forget the
105
+ * next ecosystem.
106
+ */
107
+ export function skipDirectory(name, noiseDirectories = []) {
108
+ // The structural rule is checked first, and deliberately: a declaration cannot
109
+ // re-admit a dotted state directory, and cannot exclude `.github`. The adapter
110
+ // declares what its ecosystem installs, not what the engine's own rule means.
111
+ if (name.startsWith("."))
112
+ return !CONFIG_DIRECTORIES.has(name);
113
+ return noiseDirectories.includes(name);
114
+ }
115
+ /** `.env`, `.env.local`, `.env.test` — but not `.env.d.ts` or `.envrc`. */
116
+ const DOTENV = /^\.env(\.[A-Za-z0-9_.-]+)?$/;
117
+ const EXAMPLE_SUFFIX = /\.(example|sample|template|dist|defaults?)$/i;
118
+ const CONTAINER_MANIFEST = /^(docker-)?compose([.-][A-Za-z0-9_.-]+)?\.ya?ml$/i;
119
+ const IMAGE_BUILD = /^(Containerfile|Dockerfile)([.-][A-Za-z0-9_.-]+)?$/i;
120
+ const STRUCTURED = /\.ya?ml$/i;
121
+ /** Cloudflare Workers' own config file — the exact filename, not a general TOML reader. */
122
+ const WRANGLER_TOML = /^wrangler\.toml$/;
123
+ /** POSIX-conventional variable name. Deliberately strict — see the header. */
124
+ const UPPER_SNAKE = /^[A-Z][A-Z0-9_]*$/;
125
+ /** Any identifier shape, for the unambiguous `KEY=` form. */
126
+ const ANY_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
127
+ /**
128
+ * Read every configuration surface a repository exposes.
129
+ *
130
+ * Structured documents are only opened when their path says they are a manifest
131
+ * or a workflow. Opening every YAML file in a repository would pull in test
132
+ * data, schema definitions and dependency lockfiles, and an `env:` key inside a
133
+ * schema definition is a description of a variable rather than a declaration of
134
+ * one.
135
+ */
136
+ export function scanConfigSurfaces(root, options = {}) {
137
+ const maxDepth = options.maxDepth ?? DEFAULT_MAX_DEPTH;
138
+ const maxFiles = options.maxFiles ?? DEFAULT_MAX_FILES;
139
+ const noiseDirectories = options.noiseDirectories ?? [];
140
+ const surfaces = [];
141
+ const unreadable = [];
142
+ let seen = 0;
143
+ let truncated = false;
144
+ const walk = (dir, depth) => {
145
+ if (truncated || depth > maxDepth)
146
+ return;
147
+ let entries;
148
+ try {
149
+ entries = readdirSync(dir).sort();
150
+ }
151
+ catch {
152
+ unreadable.push(rel(root, dir));
153
+ return;
154
+ }
155
+ for (const entry of entries) {
156
+ if (truncated)
157
+ return;
158
+ const full = join(dir, entry);
159
+ let directory = false;
160
+ try {
161
+ directory = statSync(full).isDirectory();
162
+ }
163
+ catch {
164
+ continue;
165
+ }
166
+ if (directory) {
167
+ if (skipDirectory(entry, noiseDirectories))
168
+ continue;
169
+ walk(full, depth + 1);
170
+ continue;
171
+ }
172
+ if (++seen > maxFiles) {
173
+ truncated = true;
174
+ return;
175
+ }
176
+ const surface = classify(root, dir, entry);
177
+ if (surface === null)
178
+ continue;
179
+ const parsed = read(root, full, surface);
180
+ if (parsed === null)
181
+ unreadable.push(rel(root, full));
182
+ else if (parsed.declarations.length > 0)
183
+ surfaces.push(parsed);
184
+ }
185
+ };
186
+ walk(root, 0);
187
+ surfaces.sort((a, b) => a.file.localeCompare(b.file));
188
+ return { surfaces, unreadable, truncated, noiseDirectories };
189
+ }
190
+ function classify(root, dir, entry) {
191
+ if (DOTENV.test(entry)) {
192
+ const example = EXAMPLE_SUFFIX.test(entry) || entry === ".env.example";
193
+ // An example file states what exists; a concrete one states what is set.
194
+ // Neither is on a path to production by itself, so both are declarations —
195
+ // the deploy target is the manifest that mounts them.
196
+ return { format: "dotenv", role: "declaration", example };
197
+ }
198
+ if (WRANGLER_TOML.test(entry)) {
199
+ // Same status `.env.development` holds: the repository's own statement of
200
+ // what it runs with, not a deploy pipeline's manifest of it. `[vars]` and
201
+ // `.env.development` are read the same way for the same reason.
202
+ return { format: "wranglerVars", role: "declaration", example: false };
203
+ }
204
+ if (IMAGE_BUILD.test(entry)) {
205
+ return { format: "imageBuild", role: "deployTarget", example: false };
206
+ }
207
+ if (CONTAINER_MANIFEST.test(entry)) {
208
+ return { format: "structured", role: "deployTarget", example: false };
209
+ }
210
+ if (STRUCTURED.test(entry) && isPipelineDirectory(rel(root, dir))) {
211
+ return { format: "structured", role: "deployTarget", example: false };
212
+ }
213
+ return null;
214
+ }
215
+ /**
216
+ * Only structured documents whose *path* declares them a pipeline are opened.
217
+ *
218
+ * Named rather than pattern-matched on content: a document that happens to
219
+ * contain an `env:` key is not necessarily setting one, and guessing from
220
+ * content is how a schema fragment becomes a declaration.
221
+ */
222
+ function isPipelineDirectory(dir) {
223
+ const parts = dir.split("/");
224
+ return (parts.includes("workflows") ||
225
+ parts.includes(".circleci") ||
226
+ parts.includes(".buildkite") ||
227
+ parts.includes("pipelines"));
228
+ }
229
+ function read(root, full, kind) {
230
+ let text;
231
+ try {
232
+ text = readFileSync(full, "utf8");
233
+ }
234
+ catch {
235
+ return null;
236
+ }
237
+ const declarations = kind.format === "dotenv"
238
+ ? readDotenv(text)
239
+ : kind.format === "imageBuild"
240
+ ? readImageBuild(text)
241
+ : kind.format === "wranglerVars"
242
+ ? readWranglerVars(text)
243
+ : readStructured(text);
244
+ return { file: rel(root, full), ...kind, declarations };
245
+ }
246
+ /** `KEY=value`, and `# KEY=value`, which documents the same variable. */
247
+ export function readDotenv(text) {
248
+ const out = [];
249
+ const lines = text.split(/\r?\n/);
250
+ for (let i = 0; i < lines.length; i += 1) {
251
+ const raw = lines[i] ?? "";
252
+ const commented = /^\s*#/.test(raw);
253
+ // `export KEY=value` is the shell-sourceable form of the same file and is
254
+ // common in deployment scripts.
255
+ const match = /^\s*(?:#\s*)?(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/.exec(raw);
256
+ if (match === null)
257
+ continue;
258
+ const name = match[1];
259
+ if (name === undefined || !ANY_NAME.test(name))
260
+ continue;
261
+ out.push({ name, line: i + 1, commented });
262
+ }
263
+ return dedupe(out);
264
+ }
265
+ /** `ENV K=V`, the legacy `ENV K V`, and `ARG K`. */
266
+ export function readImageBuild(text) {
267
+ const out = [];
268
+ const lines = text.split(/\r?\n/);
269
+ for (let i = 0; i < lines.length; i += 1) {
270
+ const raw = lines[i] ?? "";
271
+ const directive = /^\s*(ENV|ARG)\s+(.*)$/i.exec(raw);
272
+ if (directive === null)
273
+ continue;
274
+ const rest = (directive[2] ?? "").trim();
275
+ if (rest === "")
276
+ continue;
277
+ if (rest.includes("=")) {
278
+ // `ENV A=1 B=2` — take every assignment on the line.
279
+ for (const m of rest.matchAll(/(?:^|\s)([A-Z][A-Z0-9_]*)=/g)) {
280
+ const name = m[1];
281
+ if (name !== undefined)
282
+ out.push({ name, line: i + 1, commented: false });
283
+ }
284
+ continue;
285
+ }
286
+ // `ENV KEY value` / `ARG KEY`.
287
+ const name = /^([A-Z][A-Z0-9_]*)(\s|$)/.exec(rest)?.[1];
288
+ if (name !== undefined)
289
+ out.push({ name, line: i + 1, commented: false });
290
+ }
291
+ return dedupe(out);
292
+ }
293
+ /**
294
+ * `env:` / `environment:` blocks in an indented document, in both forms.
295
+ *
296
+ * Mapping — `KEY: value` — and sequence — `- KEY=value` or a bare `- KEY`. The
297
+ * bare sequence form declares a pass-through from the host, which is still the
298
+ * document stating that the variable exists.
299
+ */
300
+ export function readStructured(text) {
301
+ const out = [];
302
+ const lines = text.split(/\r?\n/);
303
+ for (let i = 0; i < lines.length; i += 1) {
304
+ const header = /^(\s*)(env|environment):\s*(#.*)?$/.exec(lines[i] ?? "");
305
+ if (header === null)
306
+ continue;
307
+ const headerIndent = (header[1] ?? "").length;
308
+ for (let j = i + 1; j < lines.length; j += 1) {
309
+ const line = lines[j] ?? "";
310
+ if (line.trim() === "" || /^\s*#/.test(line))
311
+ continue;
312
+ const indent = line.length - line.trimStart().length;
313
+ // The block ends at the first line that is not deeper than its header.
314
+ if (indent <= headerIndent)
315
+ break;
316
+ const mapping = /^\s*([A-Z][A-Z0-9_]*)\s*:/.exec(line);
317
+ if (mapping?.[1] !== undefined && UPPER_SNAKE.test(mapping[1])) {
318
+ out.push({ name: mapping[1], line: j + 1, commented: false });
319
+ continue;
320
+ }
321
+ const sequence = /^\s*-\s*"?([A-Z][A-Z0-9_]*)"?\s*(=|$)/.exec(line);
322
+ if (sequence?.[1] !== undefined && UPPER_SNAKE.test(sequence[1])) {
323
+ out.push({ name: sequence[1], line: j + 1, commented: false });
324
+ }
325
+ }
326
+ }
327
+ return dedupe(out);
328
+ }
329
+ const WRANGLER_ENV_VARS_TABLE = /^env\.([A-Za-z0-9_-]+)\.vars$/;
330
+ /** `null` for every table that is not itself a vars table — `[env.staging]` names an environment but is not scoped to it. */
331
+ function wranglerTableEnvironment(table) {
332
+ const trimmed = table.trim();
333
+ if (trimmed === "vars")
334
+ return "default";
335
+ return WRANGLER_ENV_VARS_TABLE.exec(trimmed)?.[1] ?? null;
336
+ }
337
+ /**
338
+ * Walk a `wrangler.toml`'s `[vars]` and `[env.<name>.vars]` tables only.
339
+ *
340
+ * Every other table — `[[kv_namespaces]]`, `[assets]`, `[env.<name>]` itself
341
+ * (the deploy target's own settings, not its vars) — is out of scope by
342
+ * construction rather than by exclusion list: entering *any* table this
343
+ * function does not recognise as a vars table resets tracking to "outside",
344
+ * so a line that merely looks like `KEY = value` inside `[[kv_namespaces]]`
345
+ * (e.g. `binding = "HOSTNAMES"`) is never mistaken for a declared variable.
346
+ * `[[...]]` array-of-tables headers are matched and reset scope the same way,
347
+ * rather than silently falling through as an unrecognised line — an
348
+ * `[[env.staging.kv_namespaces]]` line right after `[env.staging.vars]` must
349
+ * end that table, not extend it.
350
+ */
351
+ export function readWranglerVarsEntries(text) {
352
+ const out = [];
353
+ const lines = text.split(/\r?\n/);
354
+ let currentEnvironment = null;
355
+ for (let i = 0; i < lines.length; i += 1) {
356
+ const trimmed = (lines[i] ?? "").trim();
357
+ if (trimmed === "")
358
+ continue;
359
+ if (/^\[\[[^[\]]+\]\]/.test(trimmed)) {
360
+ currentEnvironment = null;
361
+ continue;
362
+ }
363
+ const table = /^\[([^[\]]+)\]/.exec(trimmed);
364
+ if (table !== null) {
365
+ currentEnvironment = wranglerTableEnvironment(table[1] ?? "");
366
+ continue;
367
+ }
368
+ if (currentEnvironment === null)
369
+ continue;
370
+ const commented = trimmed.startsWith("#");
371
+ const body = commented ? trimmed.slice(1).trim() : trimmed;
372
+ const assignment = /^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/.exec(body);
373
+ const name = assignment?.[1];
374
+ if (name === undefined || !ANY_NAME.test(name))
375
+ continue;
376
+ if (commented) {
377
+ out.push({ environment: currentEnvironment, name, value: null, line: i + 1, commented: true });
378
+ continue;
379
+ }
380
+ const rawValue = (assignment?.[2] ?? "").trim();
381
+ const quoted = /^"([^"]*)"/.exec(rawValue) ?? /^'([^']*)'/.exec(rawValue);
382
+ const value = quoted?.[1] ?? rawValue.replace(/\s*#.*$/, "").trim();
383
+ out.push({ environment: currentEnvironment, name, value, line: i + 1, commented: false });
384
+ }
385
+ return out;
386
+ }
387
+ /** The declaration-only projection `scanConfigSurfaces` uses. See `readWranglerVarsEntries` for the value-carrying form `resolve.ts` reads. */
388
+ export function readWranglerVars(text) {
389
+ const declarations = readWranglerVarsEntries(text).map((e) => ({ name: e.name, line: e.line, commented: e.commented }));
390
+ return dedupe(declarations);
391
+ }
392
+ /** First occurrence wins, so a finding cites the line a reader would look at. */
393
+ function dedupe(declarations) {
394
+ const seen = new Map();
395
+ for (const declaration of declarations) {
396
+ const existing = seen.get(declaration.name);
397
+ // An active assignment outranks a commented one even if it comes later:
398
+ // "set here" is a stronger fact than "documented here".
399
+ if (existing === undefined || (existing.commented && !declaration.commented)) {
400
+ seen.set(declaration.name, declaration);
401
+ }
402
+ }
403
+ return [...seen.values()].sort((a, b) => a.line - b.line || a.name.localeCompare(b.name));
404
+ }
405
+ function rel(root, full) {
406
+ const r = relative(root, full);
407
+ return r === "" ? "." : r.split(sep).join("/");
408
+ }
409
+ //# sourceMappingURL=sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/validation/sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AA6DhD,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,SAAS;IACT,WAAW;IACX,YAAY;IACZ,eAAe;IACf,SAAS;CACV,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,mBAAsC,EAAE;IAExC,+EAA+E;IAC/E,+EAA+E;IAC/E,8EAA8E;IAC9E,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/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TraversalPool, workerEntryUrl } from "./pool.ts";
2
+ export type { TraversalPool, TraversalPoolOptions, PoolTraversalResult } from "./pool.ts";
3
+ export { weightFromTable } from "./protocol.ts";
4
+ export type { EdgeWeightTable, TraversalRequest, ReachedWire, WorkerMessage, MainMessage, } from "./protocol.ts";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/worker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createTraversalPool, workerEntryUrl } from "./pool.js";
2
+ export { weightFromTable } from "./protocol.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/worker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}