@endora-commerce/cli 0.100.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 (356) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/dist/bin/endora.d.ts +28 -0
  4. package/dist/bin/endora.d.ts.map +1 -0
  5. package/dist/bin/endora.js +926 -0
  6. package/dist/bin/endora.js.map +1 -0
  7. package/dist/check/estate.d.ts +189 -0
  8. package/dist/check/estate.d.ts.map +1 -0
  9. package/dist/check/estate.js +1037 -0
  10. package/dist/check/estate.js.map +1 -0
  11. package/dist/check/hosts.d.ts +25 -0
  12. package/dist/check/hosts.d.ts.map +1 -0
  13. package/dist/check/hosts.js +1347 -0
  14. package/dist/check/hosts.js.map +1 -0
  15. package/dist/check/index.d.ts +60 -0
  16. package/dist/check/index.d.ts.map +1 -0
  17. package/dist/check/index.js +111 -0
  18. package/dist/check/index.js.map +1 -0
  19. package/dist/check/layout.d.ts +136 -0
  20. package/dist/check/layout.d.ts.map +1 -0
  21. package/dist/check/layout.js +262 -0
  22. package/dist/check/layout.js.map +1 -0
  23. package/dist/check/ledger.d.ts +98 -0
  24. package/dist/check/ledger.d.ts.map +1 -0
  25. package/dist/check/ledger.js +173 -0
  26. package/dist/check/ledger.js.map +1 -0
  27. package/dist/check/peer-owners.d.ts +116 -0
  28. package/dist/check/peer-owners.d.ts.map +1 -0
  29. package/dist/check/peer-owners.js +225 -0
  30. package/dist/check/peer-owners.js.map +1 -0
  31. package/dist/check/report.d.ts +33 -0
  32. package/dist/check/report.d.ts.map +1 -0
  33. package/dist/check/report.js +107 -0
  34. package/dist/check/report.js.map +1 -0
  35. package/dist/check/run.d.ts +147 -0
  36. package/dist/check/run.d.ts.map +1 -0
  37. package/dist/check/run.js +111 -0
  38. package/dist/check/run.js.map +1 -0
  39. package/dist/checks.d.ts +17 -0
  40. package/dist/checks.d.ts.map +1 -0
  41. package/dist/checks.js +17 -0
  42. package/dist/checks.js.map +1 -0
  43. package/dist/dev/index.d.ts +83 -0
  44. package/dist/dev/index.d.ts.map +1 -0
  45. package/dist/dev/index.js +298 -0
  46. package/dist/dev/index.js.map +1 -0
  47. package/dist/generate/divergence.d.ts +38 -0
  48. package/dist/generate/divergence.d.ts.map +1 -0
  49. package/dist/generate/divergence.js +237 -0
  50. package/dist/generate/divergence.js.map +1 -0
  51. package/dist/generate/index.d.ts +90 -0
  52. package/dist/generate/index.d.ts.map +1 -0
  53. package/dist/generate/index.js +369 -0
  54. package/dist/generate/index.js.map +1 -0
  55. package/dist/index.d.ts +23 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +35 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/inputs/declaration.d.ts +18 -0
  60. package/dist/inputs/declaration.d.ts.map +1 -0
  61. package/dist/inputs/declaration.js +64 -0
  62. package/dist/inputs/declaration.js.map +1 -0
  63. package/dist/inputs/env-file.d.ts +73 -0
  64. package/dist/inputs/env-file.d.ts.map +1 -0
  65. package/dist/inputs/env-file.js +134 -0
  66. package/dist/inputs/env-file.js.map +1 -0
  67. package/dist/inputs/prompt.d.ts +21 -0
  68. package/dist/inputs/prompt.d.ts.map +1 -0
  69. package/dist/inputs/prompt.js +59 -0
  70. package/dist/inputs/prompt.js.map +1 -0
  71. package/dist/inputs/resolve.d.ts +163 -0
  72. package/dist/inputs/resolve.d.ts.map +1 -0
  73. package/dist/inputs/resolve.js +290 -0
  74. package/dist/inputs/resolve.js.map +1 -0
  75. package/dist/install/host.d.ts +27 -0
  76. package/dist/install/host.d.ts.map +1 -0
  77. package/dist/install/host.js +90 -0
  78. package/dist/install/host.js.map +1 -0
  79. package/dist/install/index.d.ts +173 -0
  80. package/dist/install/index.d.ts.map +1 -0
  81. package/dist/install/index.js +793 -0
  82. package/dist/install/index.js.map +1 -0
  83. package/dist/install/wizard.d.ts +144 -0
  84. package/dist/install/wizard.d.ts.map +1 -0
  85. package/dist/install/wizard.js +362 -0
  86. package/dist/install/wizard.js.map +1 -0
  87. package/dist/lib/admin-artefacts.d.ts +70 -0
  88. package/dist/lib/admin-artefacts.d.ts.map +1 -0
  89. package/dist/lib/admin-artefacts.js +354 -0
  90. package/dist/lib/admin-artefacts.js.map +1 -0
  91. package/dist/lib/admin-surfaces.d.ts +298 -0
  92. package/dist/lib/admin-surfaces.d.ts.map +1 -0
  93. package/dist/lib/admin-surfaces.js +669 -0
  94. package/dist/lib/admin-surfaces.js.map +1 -0
  95. package/dist/lib/delegated-composer.d.ts +85 -0
  96. package/dist/lib/delegated-composer.d.ts.map +1 -0
  97. package/dist/lib/delegated-composer.js +241 -0
  98. package/dist/lib/delegated-composer.js.map +1 -0
  99. package/dist/lib/divergence-artefacts.d.ts +305 -0
  100. package/dist/lib/divergence-artefacts.d.ts.map +1 -0
  101. package/dist/lib/divergence-artefacts.js +828 -0
  102. package/dist/lib/divergence-artefacts.js.map +1 -0
  103. package/dist/lib/divergence.d.ts +337 -0
  104. package/dist/lib/divergence.d.ts.map +1 -0
  105. package/dist/lib/divergence.js +1005 -0
  106. package/dist/lib/divergence.js.map +1 -0
  107. package/dist/lib/docs-artefacts.d.ts +395 -0
  108. package/dist/lib/docs-artefacts.d.ts.map +1 -0
  109. package/dist/lib/docs-artefacts.js +781 -0
  110. package/dist/lib/docs-artefacts.js.map +1 -0
  111. package/dist/lib/emitted-exports.d.ts +21 -0
  112. package/dist/lib/emitted-exports.d.ts.map +1 -0
  113. package/dist/lib/emitted-exports.js +96 -0
  114. package/dist/lib/emitted-exports.js.map +1 -0
  115. package/dist/lib/emitted-freshness.d.ts +112 -0
  116. package/dist/lib/emitted-freshness.d.ts.map +1 -0
  117. package/dist/lib/emitted-freshness.js +288 -0
  118. package/dist/lib/emitted-freshness.js.map +1 -0
  119. package/dist/lib/entity-index-artefact.d.ts +95 -0
  120. package/dist/lib/entity-index-artefact.d.ts.map +1 -0
  121. package/dist/lib/entity-index-artefact.js +210 -0
  122. package/dist/lib/entity-index-artefact.js.map +1 -0
  123. package/dist/lib/instance-build-inputs.d.ts +108 -0
  124. package/dist/lib/instance-build-inputs.d.ts.map +1 -0
  125. package/dist/lib/instance-build-inputs.js +165 -0
  126. package/dist/lib/instance-build-inputs.js.map +1 -0
  127. package/dist/lib/module-docs.d.ts +473 -0
  128. package/dist/lib/module-docs.d.ts.map +1 -0
  129. package/dist/lib/module-docs.js +711 -0
  130. package/dist/lib/module-docs.js.map +1 -0
  131. package/dist/lib/module-package-subpaths.d.ts +56 -0
  132. package/dist/lib/module-package-subpaths.d.ts.map +1 -0
  133. package/dist/lib/module-package-subpaths.js +223 -0
  134. package/dist/lib/module-package-subpaths.js.map +1 -0
  135. package/dist/lib/module-packages.d.ts +200 -0
  136. package/dist/lib/module-packages.d.ts.map +1 -0
  137. package/dist/lib/module-packages.js +580 -0
  138. package/dist/lib/module-packages.js.map +1 -0
  139. package/dist/lib/module-population.d.ts +129 -0
  140. package/dist/lib/module-population.d.ts.map +1 -0
  141. package/dist/lib/module-population.js +172 -0
  142. package/dist/lib/module-population.js.map +1 -0
  143. package/dist/lib/module-roots.d.ts +337 -0
  144. package/dist/lib/module-roots.d.ts.map +1 -0
  145. package/dist/lib/module-roots.js +586 -0
  146. package/dist/lib/module-roots.js.map +1 -0
  147. package/dist/lib/nested-checkouts.d.ts +33 -0
  148. package/dist/lib/nested-checkouts.d.ts.map +1 -0
  149. package/dist/lib/nested-checkouts.js +160 -0
  150. package/dist/lib/nested-checkouts.js.map +1 -0
  151. package/dist/lib/platform-root.d.ts +43 -0
  152. package/dist/lib/platform-root.d.ts.map +1 -0
  153. package/dist/lib/platform-root.js +134 -0
  154. package/dist/lib/platform-root.js.map +1 -0
  155. package/dist/lib/platform-surface.d.ts +235 -0
  156. package/dist/lib/platform-surface.d.ts.map +1 -0
  157. package/dist/lib/platform-surface.js +393 -0
  158. package/dist/lib/platform-surface.js.map +1 -0
  159. package/dist/lib/port-registrations.d.ts +223 -0
  160. package/dist/lib/port-registrations.d.ts.map +1 -0
  161. package/dist/lib/port-registrations.js +532 -0
  162. package/dist/lib/port-registrations.js.map +1 -0
  163. package/dist/lib/read-size.d.ts +154 -0
  164. package/dist/lib/read-size.d.ts.map +1 -0
  165. package/dist/lib/read-size.js +182 -0
  166. package/dist/lib/read-size.js.map +1 -0
  167. package/dist/lib/registration-owners.d.ts +79 -0
  168. package/dist/lib/registration-owners.d.ts.map +1 -0
  169. package/dist/lib/registration-owners.js +77 -0
  170. package/dist/lib/registration-owners.js.map +1 -0
  171. package/dist/lib/release-index.d.ts +53 -0
  172. package/dist/lib/release-index.d.ts.map +1 -0
  173. package/dist/lib/release-index.js +162 -0
  174. package/dist/lib/release-index.js.map +1 -0
  175. package/dist/lib/repeating-timers.d.ts +79 -0
  176. package/dist/lib/repeating-timers.d.ts.map +1 -0
  177. package/dist/lib/repeating-timers.js +189 -0
  178. package/dist/lib/repeating-timers.js.map +1 -0
  179. package/dist/lib/source-text.d.ts +34 -0
  180. package/dist/lib/source-text.d.ts.map +1 -0
  181. package/dist/lib/source-text.js +80 -0
  182. package/dist/lib/source-text.js.map +1 -0
  183. package/dist/lib/specifiers.d.ts +20 -0
  184. package/dist/lib/specifiers.d.ts.map +1 -0
  185. package/dist/lib/specifiers.js +130 -0
  186. package/dist/lib/specifiers.js.map +1 -0
  187. package/dist/lib/sql-tables.d.ts +166 -0
  188. package/dist/lib/sql-tables.d.ts.map +1 -0
  189. package/dist/lib/sql-tables.js +464 -0
  190. package/dist/lib/sql-tables.js.map +1 -0
  191. package/dist/lib/switchable-modules.d.ts +54 -0
  192. package/dist/lib/switchable-modules.d.ts.map +1 -0
  193. package/dist/lib/switchable-modules.js +104 -0
  194. package/dist/lib/switchable-modules.js.map +1 -0
  195. package/dist/lib/tailwind-sources.d.ts +136 -0
  196. package/dist/lib/tailwind-sources.d.ts.map +1 -0
  197. package/dist/lib/tailwind-sources.js +307 -0
  198. package/dist/lib/tailwind-sources.js.map +1 -0
  199. package/dist/lib/ui-layer.d.ts +54 -0
  200. package/dist/lib/ui-layer.d.ts.map +1 -0
  201. package/dist/lib/ui-layer.js +57 -0
  202. package/dist/lib/ui-layer.js.map +1 -0
  203. package/dist/lib/workspace-packages.d.ts +186 -0
  204. package/dist/lib/workspace-packages.d.ts.map +1 -0
  205. package/dist/lib/workspace-packages.js +351 -0
  206. package/dist/lib/workspace-packages.js.map +1 -0
  207. package/dist/new-instance/deploy.d.ts +211 -0
  208. package/dist/new-instance/deploy.d.ts.map +1 -0
  209. package/dist/new-instance/deploy.js +1381 -0
  210. package/dist/new-instance/deploy.js.map +1 -0
  211. package/dist/new-instance/docs-toolchain.d.ts +66 -0
  212. package/dist/new-instance/docs-toolchain.d.ts.map +1 -0
  213. package/dist/new-instance/docs-toolchain.js +69 -0
  214. package/dist/new-instance/docs-toolchain.js.map +1 -0
  215. package/dist/new-instance/host.d.ts +124 -0
  216. package/dist/new-instance/host.d.ts.map +1 -0
  217. package/dist/new-instance/host.js +276 -0
  218. package/dist/new-instance/host.js.map +1 -0
  219. package/dist/new-instance/index.d.ts +118 -0
  220. package/dist/new-instance/index.d.ts.map +1 -0
  221. package/dist/new-instance/index.js +567 -0
  222. package/dist/new-instance/index.js.map +1 -0
  223. package/dist/new-instance/modules.d.ts +188 -0
  224. package/dist/new-instance/modules.d.ts.map +1 -0
  225. package/dist/new-instance/modules.js +392 -0
  226. package/dist/new-instance/modules.js.map +1 -0
  227. package/dist/new-instance/template.d.ts +505 -0
  228. package/dist/new-instance/template.d.ts.map +1 -0
  229. package/dist/new-instance/template.js +1886 -0
  230. package/dist/new-instance/template.js.map +1 -0
  231. package/dist/new-module/emit.d.ts +67 -0
  232. package/dist/new-module/emit.d.ts.map +1 -0
  233. package/dist/new-module/emit.js +1393 -0
  234. package/dist/new-module/emit.js.map +1 -0
  235. package/dist/new-module/host.d.ts +67 -0
  236. package/dist/new-module/host.d.ts.map +1 -0
  237. package/dist/new-module/host.js +224 -0
  238. package/dist/new-module/host.js.map +1 -0
  239. package/dist/new-module/index.d.ts +32 -0
  240. package/dist/new-module/index.d.ts.map +1 -0
  241. package/dist/new-module/index.js +193 -0
  242. package/dist/new-module/index.js.map +1 -0
  243. package/dist/new-module/spec.d.ts +188 -0
  244. package/dist/new-module/spec.d.ts.map +1 -0
  245. package/dist/new-module/spec.js +404 -0
  246. package/dist/new-module/spec.js.map +1 -0
  247. package/dist/new-module/text.d.ts +15 -0
  248. package/dist/new-module/text.d.ts.map +1 -0
  249. package/dist/new-module/text.js +22 -0
  250. package/dist/new-module/text.js.map +1 -0
  251. package/dist/new-storefront/dockerfile.d.ts +20 -0
  252. package/dist/new-storefront/dockerfile.d.ts.map +1 -0
  253. package/dist/new-storefront/dockerfile.js +131 -0
  254. package/dist/new-storefront/dockerfile.js.map +1 -0
  255. package/dist/new-storefront/gitignore.d.ts +23 -0
  256. package/dist/new-storefront/gitignore.d.ts.map +1 -0
  257. package/dist/new-storefront/gitignore.js +39 -0
  258. package/dist/new-storefront/gitignore.js.map +1 -0
  259. package/dist/new-storefront/index.d.ts +93 -0
  260. package/dist/new-storefront/index.d.ts.map +1 -0
  261. package/dist/new-storefront/index.js +329 -0
  262. package/dist/new-storefront/index.js.map +1 -0
  263. package/dist/new-storefront/npmrc.d.ts +98 -0
  264. package/dist/new-storefront/npmrc.d.ts.map +1 -0
  265. package/dist/new-storefront/npmrc.js +217 -0
  266. package/dist/new-storefront/npmrc.js.map +1 -0
  267. package/dist/new-storefront/reference.d.ts +189 -0
  268. package/dist/new-storefront/reference.d.ts.map +1 -0
  269. package/dist/new-storefront/reference.js +430 -0
  270. package/dist/new-storefront/reference.js.map +1 -0
  271. package/dist/new-storefront/rewrite.d.ts +171 -0
  272. package/dist/new-storefront/rewrite.d.ts.map +1 -0
  273. package/dist/new-storefront/rewrite.js +701 -0
  274. package/dist/new-storefront/rewrite.js.map +1 -0
  275. package/dist/release-index.json +284 -0
  276. package/dist/rules/action-route-permissions.d.ts +141 -0
  277. package/dist/rules/action-route-permissions.d.ts.map +1 -0
  278. package/dist/rules/action-route-permissions.js +556 -0
  279. package/dist/rules/action-route-permissions.js.map +1 -0
  280. package/dist/rules/bundle-pairing.d.ts +74 -0
  281. package/dist/rules/bundle-pairing.d.ts.map +1 -0
  282. package/dist/rules/bundle-pairing.js +281 -0
  283. package/dist/rules/bundle-pairing.js.map +1 -0
  284. package/dist/rules/channel-resolution.d.ts +17 -0
  285. package/dist/rules/channel-resolution.d.ts.map +1 -0
  286. package/dist/rules/channel-resolution.js +382 -0
  287. package/dist/rules/channel-resolution.js.map +1 -0
  288. package/dist/rules/command-coverage.d.ts +210 -0
  289. package/dist/rules/command-coverage.d.ts.map +1 -0
  290. package/dist/rules/command-coverage.js +714 -0
  291. package/dist/rules/command-coverage.js.map +1 -0
  292. package/dist/rules/container-imports.d.ts +60 -0
  293. package/dist/rules/container-imports.d.ts.map +1 -0
  294. package/dist/rules/container-imports.js +158 -0
  295. package/dist/rules/container-imports.js.map +1 -0
  296. package/dist/rules/default-language-prose.d.ts +212 -0
  297. package/dist/rules/default-language-prose.d.ts.map +1 -0
  298. package/dist/rules/default-language-prose.js +710 -0
  299. package/dist/rules/default-language-prose.js.map +1 -0
  300. package/dist/rules/diacritic-folds.d.ts +238 -0
  301. package/dist/rules/diacritic-folds.d.ts.map +1 -0
  302. package/dist/rules/diacritic-folds.js +681 -0
  303. package/dist/rules/diacritic-folds.js.map +1 -0
  304. package/dist/rules/entity-tenant-classification.d.ts +171 -0
  305. package/dist/rules/entity-tenant-classification.d.ts.map +1 -0
  306. package/dist/rules/entity-tenant-classification.js +323 -0
  307. package/dist/rules/entity-tenant-classification.js.map +1 -0
  308. package/dist/rules/entry-presence.d.ts +142 -0
  309. package/dist/rules/entry-presence.d.ts.map +1 -0
  310. package/dist/rules/entry-presence.js +339 -0
  311. package/dist/rules/entry-presence.js.map +1 -0
  312. package/dist/rules/entry-scope.d.ts +91 -0
  313. package/dist/rules/entry-scope.d.ts.map +1 -0
  314. package/dist/rules/entry-scope.js +404 -0
  315. package/dist/rules/entry-scope.js.map +1 -0
  316. package/dist/rules/env-inputs.d.ts +222 -0
  317. package/dist/rules/env-inputs.d.ts.map +1 -0
  318. package/dist/rules/env-inputs.js +951 -0
  319. package/dist/rules/env-inputs.js.map +1 -0
  320. package/dist/rules/kernel-boundary.d.ts +37 -0
  321. package/dist/rules/kernel-boundary.d.ts.map +1 -0
  322. package/dist/rules/kernel-boundary.js +195 -0
  323. package/dist/rules/kernel-boundary.js.map +1 -0
  324. package/dist/rules/nul-bytes.d.ts +233 -0
  325. package/dist/rules/nul-bytes.d.ts.map +1 -0
  326. package/dist/rules/nul-bytes.js +332 -0
  327. package/dist/rules/nul-bytes.js.map +1 -0
  328. package/dist/rules/platform-surface.d.ts +479 -0
  329. package/dist/rules/platform-surface.d.ts.map +1 -0
  330. package/dist/rules/platform-surface.js +749 -0
  331. package/dist/rules/platform-surface.js.map +1 -0
  332. package/dist/rules/port-catches.d.ts +225 -0
  333. package/dist/rules/port-catches.d.ts.map +1 -0
  334. package/dist/rules/port-catches.js +1374 -0
  335. package/dist/rules/port-catches.js.map +1 -0
  336. package/dist/rules/port-shape.d.ts +213 -0
  337. package/dist/rules/port-shape.d.ts.map +1 -0
  338. package/dist/rules/port-shape.js +670 -0
  339. package/dist/rules/port-shape.js.map +1 -0
  340. package/dist/rules/queue-names.d.ts +108 -0
  341. package/dist/rules/queue-names.d.ts.map +1 -0
  342. package/dist/rules/queue-names.js +395 -0
  343. package/dist/rules/queue-names.js.map +1 -0
  344. package/dist/rules/singleton-identity.d.ts +205 -0
  345. package/dist/rules/singleton-identity.d.ts.map +1 -0
  346. package/dist/rules/singleton-identity.js +830 -0
  347. package/dist/rules/singleton-identity.js.map +1 -0
  348. package/dist/rules/subscribe-seam.d.ts +121 -0
  349. package/dist/rules/subscribe-seam.d.ts.map +1 -0
  350. package/dist/rules/subscribe-seam.js +594 -0
  351. package/dist/rules/subscribe-seam.js.map +1 -0
  352. package/dist/rules/transaction-context.d.ts +40 -0
  353. package/dist/rules/transaction-context.d.ts.map +1 -0
  354. package/dist/rules/transaction-context.js +294 -0
  355. package/dist/rules/transaction-context.js.map +1 -0
  356. package/package.json +59 -0
@@ -0,0 +1,160 @@
1
+ /**
2
+ * "Is this path part of *this* checkout?" — one derivation for the TypeScript
3
+ * half of the estate (D-168 follow-up; the same question `scripts/lib/module-root.sh`
4
+ * answers for the shell half).
5
+ *
6
+ * ## The problem it exists for
7
+ *
8
+ * Agents in this project work in `git worktree`s created **under** the
9
+ * repository directory, and each one is a complete copy of the tree. So any
10
+ * walk rooted at the repository — as opposed to one bounded by the workspace
11
+ * globs or by a named source directory — finds every file of this repository
12
+ * once per worktree, plus its own. Fifty-one of them stood on the machine this
13
+ * was written for.
14
+ *
15
+ * Every consequence of that is a wrong answer about *this* commit. A rule that
16
+ * counts finds a population that swells with housekeeping nobody performed
17
+ * deliberately. A rule that reconciles a scan against a declaration finds
18
+ * entries it cannot account for and reports them as defects, when what it has
19
+ * actually done is read another branch's tree and file the verdict under ours.
20
+ * That is what happened to the D-168 module-package guard an hour after it
21
+ * merged: red on every developer machine, green in CI, and CI right only
22
+ * because it has no nested worktrees.
23
+ *
24
+ * ## The discriminator is the `.git` entry, not a path name
25
+ *
26
+ * `scripts/lib/module-root.sh` ruled this and the ruling holds here unchanged;
27
+ * its header carries the long form. In brief: a rule keyed on
28
+ * `.claude/worktrees` would be a derived fact written down (D-100) and would
29
+ * miss the first worktree somebody puts elsewhere — a nested clone under
30
+ * `vendor/`, a submodule, a second checkout parked wherever it was convenient.
31
+ * `git worktree list --porcelain` was the alternative and was rejected there for
32
+ * three reasons that apply here too: the walk sees *files*, and the `.git`
33
+ * marker travels with them while git's registry can disagree with the
34
+ * filesystem in both directions; the registry knows only worktrees, so a nested
35
+ * clone or a submodule would still be walked; and it needs `git` on `PATH`.
36
+ *
37
+ * Both markers git writes count, because both occur here: `git worktree add`
38
+ * leaves a `.git` **file** (a gitfile naming the administrative directory), and
39
+ * a clone or a submodule leaves a `.git` **directory**. A rule that saw one of
40
+ * them would prune half the nested checkouts on this machine and go on reading
41
+ * the rest.
42
+ *
43
+ * **What it cannot see**, stated rather than discovered later: a checkout whose
44
+ * marker is somewhere else — `GIT_DIR` in the environment, a
45
+ * `--separate-git-dir` whose gitfile has been removed, a tree exported without
46
+ * its `.git` — reads as ordinary source and is walked. That is the direction to
47
+ * be wrong in: such a tree is indistinguishable from a copied directory, and
48
+ * walking it costs reads rather than coverage.
49
+ *
50
+ * ## Two functions, because the two halves are different kinds of question
51
+ *
52
+ * {@link nestedCheckoutRoots} asks the filesystem and answers with a list of
53
+ * repo-relative roots. {@link isInsideNestedCheckout} is a **pure predicate**
54
+ * over that list. The shell twin is split the same way
55
+ * (`module_root_scan_nested_checkouts` / `module_root_drop_nested_checkouts`),
56
+ * and the split is what lets a caller whose own exclusion rule must stay
57
+ * decidable from a synthetic path — `check-nul-bytes`' `isScannablePath` is the
58
+ * standing example — take the roots once at the top of its run and keep its
59
+ * predicate pure.
60
+ *
61
+ * ## Why there are still two implementations, and which third is retiring
62
+ *
63
+ * `scripts/lib/module-root.sh` is **not** merged into this file and cannot be:
64
+ * `quality:static` runs with bash, grep, perl and POSIX awk and no `pnpm
65
+ * install`, so a shell check cannot call a TypeScript library. The two are a
66
+ * deliberate twin pair, as `lib/read-size.sh` and `lib/read-size.ts` are, and
67
+ * the ruling they implement is written once — in the shell file's header, which
68
+ * this one cites rather than restates.
69
+ *
70
+ * `check-nul-bytes.ts` is the third answer and it should become a caller of
71
+ * this one. Its `SKIPPED_PATH_PREFIXES` names `.claude/worktrees` as a literal,
72
+ * which is the derived fact D-100 refuses and which misses a nested clone or a
73
+ * worktree parked anywhere else. The reason its own comment gives — that
74
+ * `.claude/` holds tracked source, so the exclusion cannot be name-anchored —
75
+ * argues against `SKIPPED_DIRECTORIES` and not against this discriminator. What
76
+ * it does have is a real constraint: `isScannablePath` is deliberately decidable
77
+ * from a synthetic path, so that the walk's prune and the rule's exclusion are
78
+ * one function and its red proofs can enter at the top. That is why this file
79
+ * splits into a filesystem half and a pure half — the conversion is to resolve
80
+ * the roots once in `main()` and pass them into the predicate, so the predicate
81
+ * stays pure and the literal becomes derived. It is not done here, because the
82
+ * conversion re-measures a green check's read size and its inventory entry, and
83
+ * a bug fix is the wrong place to move a passing check's population.
84
+ */
85
+ import { readdirSync, statSync } from 'node:fs';
86
+ import { join } from 'node:path';
87
+ import { PRUNED_DIRECTORIES } from './module-roots.js';
88
+ /**
89
+ * The entry whose presence makes a directory the root of a checkout.
90
+ *
91
+ * A constant rather than a literal in three places, because the whole rule
92
+ * rests on this one name and a reader has to be able to find every use of it.
93
+ */
94
+ export const CHECKOUT_MARKER = '.git';
95
+ /** How deep {@link nestedCheckoutRoots} descends before giving up. */
96
+ const MAX_DEPTH = 12;
97
+ function isDirectory(path) {
98
+ const stat = statSync(path, { throwIfNoEntry: false });
99
+ return stat !== undefined && stat.isDirectory();
100
+ }
101
+ function exists(path) {
102
+ return statSync(path, { throwIfNoEntry: false }) !== undefined;
103
+ }
104
+ /**
105
+ * The root of every checkout nested inside `repoRoot`, repo-relative, sorted.
106
+ *
107
+ * The checkout's **own** marker is stepped over by name: the walk starts at the
108
+ * repository root, so the marker there says nothing about a nested tree. A rule
109
+ * that pruned any directory carrying a `.git` would prune the repository and
110
+ * answer "nothing here", which is the vacuous pass in its purest form — the
111
+ * fixture in `test/unit/scripts/nested-checkouts.test.ts` carries an outer
112
+ * marker for exactly that reason.
113
+ *
114
+ * The walk does not descend into a nested checkout: everything under it belongs
115
+ * to that checkout, and a worktree of this repository holds a full copy of
116
+ * `node_modules`-free source that would otherwise be walked in its entirety.
117
+ */
118
+ export function nestedCheckoutRoots(repoRoot) {
119
+ const roots = [];
120
+ const visit = (directory, relative, depth) => {
121
+ if (depth > MAX_DEPTH)
122
+ return;
123
+ let entries;
124
+ try {
125
+ entries = readdirSync(directory);
126
+ }
127
+ catch {
128
+ return;
129
+ }
130
+ for (const entry of entries) {
131
+ if (PRUNED_DIRECTORIES.includes(entry))
132
+ continue;
133
+ const full = join(directory, entry);
134
+ if (!isDirectory(full))
135
+ continue;
136
+ const key = relative === '' ? entry : `${relative}/${entry}`;
137
+ if (exists(join(full, CHECKOUT_MARKER))) {
138
+ roots.push(key);
139
+ continue;
140
+ }
141
+ visit(full, key, depth + 1);
142
+ }
143
+ };
144
+ visit(repoRoot, '', 0);
145
+ return roots.sort();
146
+ }
147
+ /**
148
+ * Whether a repo-relative path names a nested checkout or something inside one.
149
+ *
150
+ * The roots are literal paths, so the comparison is a literal prefix test with
151
+ * the separator appended — that is what makes `vendor/fork` not match
152
+ * `vendor/fork-of-ours`, and it is why the shell twin uses `index(…) == 1`
153
+ * rather than a regex built from a path holding unescaped dots. The root itself
154
+ * matches: a listing that names the directory is naming another checkout.
155
+ */
156
+ export function isInsideNestedCheckout(relativePath, roots) {
157
+ const path = relativePath.split('\\').join('/');
158
+ return roots.some((root) => path === root || path.startsWith(`${root}/`));
159
+ }
160
+ //# sourceMappingURL=nested-checkouts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nested-checkouts.js","sourceRoot":"","sources":["../../src/lib/nested-checkouts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC,sEAAsE;AACtE,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,SAAS,WAAW,CAAC,IAAY;IAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;IACvD,OAAO,IAAI,KAAK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AO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CACpC,YAAoB,EACpB,KAAwB;IAExB,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { type WorkspaceFs, type WorkspaceMember } from './workspace-packages.js';
2
+ /** Raised when the platform cannot be located; a caller turns it into exit 2. */
3
+ export declare class PlatformRootUnresolvableError extends Error {
4
+ readonly name = "PlatformRootUnresolvableError";
5
+ }
6
+ /**
7
+ * The platform's source directory among a set of workspace members, or `null`.
8
+ *
9
+ * `null` and not a throw, because the fixture workspaces the layout tests build
10
+ * legitimately have no platform. A caller for which the platform *is* the
11
+ * population — `check:platform-surface`, `check:kernel-boundary` — refuses on
12
+ * `null` itself, which is the only place that refusal means anything.
13
+ */
14
+ export declare function platformSourceRootOf(members: readonly WorkspaceMember[]): string | null;
15
+ /**
16
+ * The npm name the platform publishes under, or `null` when this workspace has
17
+ * no platform member (feature 080, T060).
18
+ *
19
+ * The name is what a packaged module *writes* — `@endora-commerce/platform/kernel`
20
+ * — so a check that judges a bare specifier needs it, and needs it derived: the
21
+ * scope was `@b2b/` until D-161 and a literal in a check is a rename away from a
22
+ * walk that silently sees nothing. It is read from the same manifest
23
+ * {@link platformSourceRootOf} and {@link platformSubpathsOf} read, so the three
24
+ * cannot come to disagree about which member is the platform.
25
+ */
26
+ export declare function platformPackageNameOf(members: readonly WorkspaceMember[]): string | null;
27
+ /** The same, reading the workspace at `repoRoot`. */
28
+ export declare function platformSourceRootAt(repoRoot: string, fs?: WorkspaceFs): string | null;
29
+ /**
30
+ * The subpaths the platform publishes, read off its own `exports` map.
31
+ *
32
+ * D-160.7 rules five enumerated subpaths, one per platform directory, and that
33
+ * map is where the ruling is authored. Reading it is what
34
+ * `lib/platform-surface.ts` said it would do "the day the host `package.json`
35
+ * exists": it does now, and `backend` depends on it, so a sixth published
36
+ * directory arrives in every walk at once instead of in whichever list somebody
37
+ * remembers. `./package.json` is filtered out — it is an `exports` entry and not
38
+ * a platform directory.
39
+ */
40
+ export declare function platformSubpathsOf(members: readonly WorkspaceMember[]): readonly string[];
41
+ /** The same, reading the workspace at `repoRoot`. */
42
+ export declare function platformSubpathsAt(repoRoot: string, fs?: WorkspaceFs): readonly string[];
43
+ //# sourceMappingURL=platform-root.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-root.d.ts","sourceRoot":"","sources":["../../src/lib/platform-root.ts"],"names":[],"mappings":"AAqCA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAEjC,iFAAiF;AACjF,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,SAAkB,IAAI,mCAAmC;CAC1D;AASD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,GAAG,IAAI,CAmBvF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,GAAG,IAAI,CAWxF;AAED,qDAAqD;AACrD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,EAAE,GAAE,WAA+B,GAClC,MAAM,GAAG,IAAI,CAEf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,MAAM,EAAE,CAuBzF;AAED,qDAAqD;AACrD,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,EAAE,GAAE,WAA+B,GAClC,SAAS,MAAM,EAAE,CAEnB"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * "Where does the platform's source live?" — derived, never spelled (feature
3
+ * 080, the platform relocation).
4
+ *
5
+ * The five platform directories — `kernel`, `http`, `tenancy`, `commands`,
6
+ * `events` — moved out of `backend/src` and into `@endora-commerce/platform`,
7
+ * so that the application and an installed extension package resolve **one**
8
+ * copy of them. A dozen tools read that tree: `check:platform-surface`,
9
+ * `check:kernel-boundary`, every check that walks
10
+ * {@link ModuleTreeLayout.sourceRoots}, and the composer generator, whose entity
11
+ * registry would otherwise lose `sales_channels`, `settings`, `audit_logs` and
12
+ * `module_registrations`.
13
+ *
14
+ * Every one of them used to write `join(BACKEND_ROOT, 'src', 'kernel')`, which
15
+ * is the shape `scripts/lib/module-root.sh` was written to end for the module
16
+ * tree and for the same reason (feature 080, T012): a path written into a tool
17
+ * is a derived fact recorded by hand (D-100), and a layout move takes the tool
18
+ * with it — the walk iterates nothing, the check reports on what is left, and
19
+ * the run prints a green tick. Issue #215 is that defect one directory over.
20
+ *
21
+ * ## The discriminator is a declaration, not a name
22
+ *
23
+ * The platform is the workspace member whose manifest declares
24
+ * `"endora": { "type": "platform" }` — the same authored block `lib/module-roots.ts`
25
+ * and `lib/module-packages.ts` already read to find a *module* package, and the
26
+ * shape D-142 makes authoritative for a package's identity. Keying on the
27
+ * package name would work until the scope rename D-161 is finished; keying on
28
+ * `packages/platform/` would work until somebody moves it, which is the move
29
+ * this file exists because of.
30
+ *
31
+ * Two members declaring it is an error rather than a first-one-wins, for the
32
+ * reason `scripts/lib/module-root.sh` refuses two manifest indexes: the walk
33
+ * would silently narrow to whichever sorted first.
34
+ */
35
+ import { existsSync } from 'node:fs';
36
+ import { join } from 'node:path';
37
+ import { nodeWorkspaceFs, workspaceMembers, } from './workspace-packages.js';
38
+ /** Raised when the platform cannot be located; a caller turns it into exit 2. */
39
+ export class PlatformRootUnresolvableError extends Error {
40
+ name = 'PlatformRootUnresolvableError';
41
+ }
42
+ /** The `endora` block a member declares about itself, if it is the platform's. */
43
+ function declaresPlatform(member) {
44
+ const endora = member.manifest['endora'];
45
+ if (typeof endora !== 'object' || endora === null || Array.isArray(endora))
46
+ return false;
47
+ return endora['type'] === 'platform';
48
+ }
49
+ /**
50
+ * The platform's source directory among a set of workspace members, or `null`.
51
+ *
52
+ * `null` and not a throw, because the fixture workspaces the layout tests build
53
+ * legitimately have no platform. A caller for which the platform *is* the
54
+ * population — `check:platform-surface`, `check:kernel-boundary` — refuses on
55
+ * `null` itself, which is the only place that refusal means anything.
56
+ */
57
+ export function platformSourceRootOf(members) {
58
+ const declared = members.filter(declaresPlatform);
59
+ if (declared.length === 0)
60
+ return null;
61
+ if (declared.length > 1) {
62
+ throw new PlatformRootUnresolvableError(`${declared.length} workspace members declare \`endora.type: "platform"\` ` +
63
+ `(${declared.map((member) => member.dir).join(', ')}). A walk would narrow to ` +
64
+ 'whichever sorted first and report on it as if it were the platform.');
65
+ }
66
+ const root = join(declared[0].dir, 'src');
67
+ if (!existsSync(root)) {
68
+ throw new PlatformRootUnresolvableError(`${root} does not exist — ${declared[0].name} declares itself the platform and its ` +
69
+ 'sources are not there. A walk of it would come back empty, which is ' +
70
+ 'indistinguishable from a clean platform (issue #113).');
71
+ }
72
+ return root;
73
+ }
74
+ /**
75
+ * The npm name the platform publishes under, or `null` when this workspace has
76
+ * no platform member (feature 080, T060).
77
+ *
78
+ * The name is what a packaged module *writes* — `@endora-commerce/platform/kernel`
79
+ * — so a check that judges a bare specifier needs it, and needs it derived: the
80
+ * scope was `@b2b/` until D-161 and a literal in a check is a rename away from a
81
+ * walk that silently sees nothing. It is read from the same manifest
82
+ * {@link platformSourceRootOf} and {@link platformSubpathsOf} read, so the three
83
+ * cannot come to disagree about which member is the platform.
84
+ */
85
+ export function platformPackageNameOf(members) {
86
+ const declared = members.filter(declaresPlatform);
87
+ if (declared.length === 0)
88
+ return null;
89
+ if (declared.length > 1) {
90
+ throw new PlatformRootUnresolvableError(`${declared.length} workspace members declare \`endora.type: "platform"\` ` +
91
+ `(${declared.map((member) => member.name).join(', ')}). A consumer's bare specifier ` +
92
+ 'would be judged against whichever sorted first.');
93
+ }
94
+ return declared[0].name;
95
+ }
96
+ /** The same, reading the workspace at `repoRoot`. */
97
+ export function platformSourceRootAt(repoRoot, fs = nodeWorkspaceFs()) {
98
+ return platformSourceRootOf(workspaceMembers(repoRoot, fs));
99
+ }
100
+ /**
101
+ * The subpaths the platform publishes, read off its own `exports` map.
102
+ *
103
+ * D-160.7 rules five enumerated subpaths, one per platform directory, and that
104
+ * map is where the ruling is authored. Reading it is what
105
+ * `lib/platform-surface.ts` said it would do "the day the host `package.json`
106
+ * exists": it does now, and `backend` depends on it, so a sixth published
107
+ * directory arrives in every walk at once instead of in whichever list somebody
108
+ * remembers. `./package.json` is filtered out — it is an `exports` entry and not
109
+ * a platform directory.
110
+ */
111
+ export function platformSubpathsOf(members) {
112
+ const declared = members.filter(declaresPlatform);
113
+ if (declared.length !== 1) {
114
+ throw new PlatformRootUnresolvableError(`${declared.length} workspace members declare \`endora.type: "platform"\` — the ` +
115
+ 'published subpaths are read off exactly one manifest');
116
+ }
117
+ const exportsBlock = declared[0].manifest['exports'];
118
+ const subpaths = typeof exportsBlock === 'object' && exportsBlock !== null && !Array.isArray(exportsBlock)
119
+ ? Object.keys(exportsBlock)
120
+ .filter((key) => key.startsWith('./') && key !== './package.json')
121
+ .map((key) => key.slice(2))
122
+ .sort()
123
+ : [];
124
+ if (subpaths.length === 0) {
125
+ throw new PlatformRootUnresolvableError(`${declared[0].name} publishes no subpath. Every consumer of this list would walk ` +
126
+ 'nothing and report a clean result over an empty population.');
127
+ }
128
+ return subpaths;
129
+ }
130
+ /** The same, reading the workspace at `repoRoot`. */
131
+ export function platformSubpathsAt(repoRoot, fs = nodeWorkspaceFs()) {
132
+ return platformSubpathsOf(workspaceMembers(repoRoot, fs));
133
+ }
134
+ //# sourceMappingURL=platform-root.js.map
@@ -0,0 +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C,GAAG,QAAQ,CAAC,MAAM,+DAA+D;YAC/E,sDAAsD,CACzD,CAAC;IACJ,CAAC;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACtD,MAAM,QAAQ,GACZ,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;QACvF,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;aACtB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,gBAAgB,CAAC;aACjE,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aAC1B,IAAI,EAAE;QACX,CAAC,CAAC,EAAE,CAAC;IACT,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,6BAA6B,CACrC,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC,IAAI,gEAAgE;YAClF,6DAA6D,CAChE,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,KAAkB,eAAe,EAAE;IAEnC,OAAO,kBAAkB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,235 @@
1
+ /**
2
+ * The platform directories the host publishes, in the order §2.1 lists them.
3
+ *
4
+ * A ruling (D-160.7), not a measurement — see the header. `db`, `overlay` and
5
+ * `packages` are absent on purpose and `db`'s absence is the whole of §1.4f: a
6
+ * reach into it is not public API. All three are now **declared and
7
+ * host-internal** (`specs/110-instance-repository/` T113, T114 and T116): the
8
+ * code moved into the package, so the application needed an address for it, and
9
+ * the answer to "may a module name it" is still no — see
10
+ * {@link HOST_INTERNAL_SUBPATHS}, which is where that judgement is recorded.
11
+ */
12
+ export declare const PUBLISHED_SUBPATHS: readonly string[];
13
+ /**
14
+ * The subpaths the `exports` map declares and **no published barrel carries**
15
+ * (D-160.14), each with the reason it is on this side of the line.
16
+ *
17
+ * A subpath here is declared, so `node` and `tsc` resolve it for the host, the
18
+ * test kit and the composition root — and it is not public API, so
19
+ * {@link resolveHostSpecifier} answers a module's reach into one with
20
+ * `host-internal-subpath` rather than with a pass. **The reason is the member**:
21
+ * a set of bare names is a list somebody grows, and this whole class is a
22
+ * judgement about who may name a surface, which no name records.
23
+ *
24
+ * It is kept apart from {@link PUBLISHED_SUBPATHS} rather than appended to it
25
+ * because the two answer different questions, and `host-package.md` §2.7.5(a) is
26
+ * that merging them is the mistake: the published list is what a **symbol** is
27
+ * judged against, and an entry there would publish `composeModules` out of
28
+ * `kernel/compose.ts` for every reach at that file — a module's relative one
29
+ * included — while changing nothing `check:platform-surface` prints.
30
+ *
31
+ * It lives here rather than in a test because by the time it had two members it
32
+ * had two copies, in two test files, neither carrying a per-member reason. Two
33
+ * independently written answers to "which subpaths are host-internal" are two
34
+ * answers waiting to disagree, in the estate whose own rule that is (D-100).
35
+ */
36
+ export declare const HOST_INTERNAL_SUBPATHS: Readonly<Record<string, string>>;
37
+ /** The file a published directory's surface is written in. */
38
+ export declare function barrelKeyOf(subpath: string): string;
39
+ /** One name a barrel publishes, and the file it publishes it out of. */
40
+ export interface PublishedSymbol {
41
+ /** The exported name, after any `as` rename. */
42
+ readonly name: string;
43
+ /**
44
+ * The file it comes from, keyed relative to the source root with POSIX
45
+ * separators — `http/error-envelope.ts`. A name the barrel *declares* itself
46
+ * is attributed to the barrel.
47
+ */
48
+ readonly target: string;
49
+ }
50
+ /** Why a barrel could not be read in full — never a reason to report a pass. */
51
+ export interface BarrelUnreadable {
52
+ /** The barrel, keyed relative to the source root. */
53
+ readonly barrel: string;
54
+ readonly line: number;
55
+ readonly reason: string;
56
+ }
57
+ export interface BarrelParse {
58
+ readonly barrel: string;
59
+ readonly published: readonly PublishedSymbol[];
60
+ readonly unreadable: readonly BarrelUnreadable[];
61
+ }
62
+ /**
63
+ * How a barrel's re-export specifier becomes a file key.
64
+ *
65
+ * Injected because the answer needs the walk's file list — `./ports` is a
66
+ * directory in one tree and a file in another — while {@link parseBarrel} must
67
+ * stay pure over source text so both consumers' fixtures enter at the top.
68
+ * {@link firstCandidate} is the answer for a caller that has no file list: the
69
+ * `.js` → `.ts` rewrite every specifier in this tree's barrels is written as.
70
+ */
71
+ export type TargetResolver = (fromKey: string, specifier: string) => string | null;
72
+ /** The `.js` → `.ts` rewrite, with no filesystem behind it. */
73
+ export declare const firstCandidate: TargetResolver;
74
+ /**
75
+ * Everything one barrel publishes, and everything about it this parse could not
76
+ * read.
77
+ *
78
+ * Pure over the source text, so both consumers — and every fixture — enter
79
+ * where a real run enters.
80
+ *
81
+ * The three shapes it refuses to guess at are the three that would make the
82
+ * published set come back **short**, which is the direction that turns a
83
+ * correct reach into a finding and, worse, lets an author "repair" it by
84
+ * widening the barrel:
85
+ *
86
+ * * `export * from './x.js'` — the names are in another file;
87
+ * * `export * as ns from './x.js'` — a namespace object, whose members no
88
+ * `exports` map can enumerate;
89
+ * * `export { X }` with no `from` — a re-export of a local binding whose own
90
+ * origin this parse does not follow.
91
+ *
92
+ * None of the three occurs in the five barrels today. Each is reported rather
93
+ * than skipped, because a barrel this file reads *partially* is exactly the
94
+ * "green while not looking" shape issue #113 is about.
95
+ */
96
+ export declare function parseBarrel(source: string, barrel: string, resolve?: TargetResolver): BarrelParse;
97
+ /**
98
+ * A relative specifier from `fromKey`, as a key relative to the same root.
99
+ *
100
+ * The `.js` an ESM specifier carries is rewritten to `.ts`, an extensionless
101
+ * specifier gains one, and a directory specifier gains `/index.ts` — the three
102
+ * shapes this tree writes. `null` for a specifier that is not relative, or that
103
+ * climbs out of the root.
104
+ */
105
+ export declare function resolveRelative(fromKey: string, specifier: string): string | null;
106
+ /**
107
+ * The host package as a consumer names it (feature 080, T060).
108
+ *
109
+ * A module that has become a workspace package stops writing
110
+ * `../../kernel/index.js` and writes `@endora-commerce/platform/kernel`. Both
111
+ * are the same reach at the same barrel, and until T060 only the first was in
112
+ * the check's population — so a module's platform reaches left the walk the day
113
+ * the module left the tree, 216 of them by the first batch.
114
+ *
115
+ * Neither field is written down anywhere. {@link HostPackage.name} is the name
116
+ * in the manifest of the member declaring `endora.type: "platform"`, and
117
+ * {@link HostPackage.subpathTargets} is that manifest's own `exports` map read
118
+ * back as file keys — so the D-161 scope rename, a sixth published directory
119
+ * and a renamed host all arrive here by being authored once.
120
+ */
121
+ export interface HostPackage {
122
+ /** The npm name the host publishes under. */
123
+ readonly name: string;
124
+ /**
125
+ * **Published** subpath (`kernel`) → the barrel's file key, in the caller's
126
+ * own namespace. This is {@link PUBLISHED_SUBPATHS}' population, not the
127
+ * `exports` map's: a subpath the map declares and no barrel carries is in
128
+ * {@link HostPackage.declaredSubpaths} and not here.
129
+ */
130
+ readonly subpathTargets: ReadonlyMap<string, string>;
131
+ /**
132
+ * Every subpath the host's own `exports` map declares, `./package.json`
133
+ * aside — read off the manifest, never written down (`lib/platform-root.ts`'s
134
+ * `platformSubpathsOf`).
135
+ *
136
+ * It exists because the two lists legitimately differ (D-160.14, feature 109;
137
+ * `host-package.md` §2.7.5a). `./composition` carries the 27 composition
138
+ * symbols the host's own root and the test kit need: **declared** by the map,
139
+ * so `node` and `tsc` resolve it, and **published** by no barrel, so no module
140
+ * may name it. Without both lists a reach into it is indistinguishable from a
141
+ * reach into a subpath that does not exist, and the remedy a consumer is
142
+ * handed — *"the map refuses this at resolution time"* — is false.
143
+ *
144
+ * It must not be folded into {@link PUBLISHED_SUBPATHS} either, which was
145
+ * measured: {@link PlatformSurface.published} is keyed by **target file** with
146
+ * no subpath dimension, so a sixth entry there publishes `composeModules` out
147
+ * of `kernel/compose.ts` for every reach at that file, a module's *relative*
148
+ * one included — and because this check reports `violations=0`, the widening
149
+ * would change nothing it prints. A blindness that arrives green.
150
+ */
151
+ readonly declaredSubpaths: ReadonlySet<string>;
152
+ }
153
+ /** What a bare specifier into the host package names, or nothing. */
154
+ export type HostReach = {
155
+ readonly kind: 'published-subpath';
156
+ readonly subpath: string;
157
+ readonly target: string;
158
+ }
159
+ /**
160
+ * Declared by the `exports` map, carried by no barrel — host composition
161
+ * surface. It resolves for `node` and `tsc`, which is exactly why a module
162
+ * naming it needs a finding of its own: nothing else would stop it.
163
+ */
164
+ | {
165
+ readonly kind: 'host-internal-subpath';
166
+ readonly subpath: string;
167
+ } | {
168
+ readonly kind: 'undeclared-subpath';
169
+ readonly subpath: string;
170
+ };
171
+ /**
172
+ * The host file a bare specifier names, or `null` when it does not name the
173
+ * host at all.
174
+ *
175
+ * The match is on a **segment boundary**, which is the same care
176
+ * `check-module-boundary`'s `resolveModulePackage` takes and for the same
177
+ * reason: `@endora-commerce/platform-extras` is a different package, and a bare
178
+ * `startsWith` reads it as this one.
179
+ *
180
+ * `null` for a relative specifier, for a third party's, and for every specifier
181
+ * at all when the workspace declares no platform — a fixture workspace
182
+ * legitimately has none, and "no host reach" is the only honest answer there.
183
+ *
184
+ * **Three answers, not two** (D-160.14). A subpath the `exports` map declares
185
+ * and no barrel carries is `host-internal-subpath`, between the published one
186
+ * and the one that does not exist. Collapsing it into either is wrong in a
187
+ * different way: as *published* it would license the reach, and as *undeclared*
188
+ * it would tell the author their specifier does not resolve, which it does.
189
+ */
190
+ export declare function resolveHostSpecifier(specifier: string, host: HostPackage | null): HostReach | null;
191
+ /**
192
+ * Every candidate file a relative specifier could name, most specific first.
193
+ *
194
+ * `.tsx` is here beside `.ts` because a module's sources are no longer only
195
+ * Node code: a module package's `./admin` layer (feature 091) is React
196
+ * components, and a `./pages/Screen.js` specifier inside one resolves to a
197
+ * `.tsx` file or to nothing. Nothing is the fail-closed answer this check gives
198
+ * an unresolvable reach — correct as a default, and wrong here, where the file
199
+ * is there and the candidate list had never heard of its extension.
200
+ */
201
+ export declare function resolutionCandidates(joined: string): readonly string[];
202
+ /** The platform's published surface, as both consumers read it. */
203
+ export interface PlatformSurface {
204
+ /** `<target file>` → the names the barrels publish out of it. */
205
+ readonly published: ReadonlyMap<string, ReadonlySet<string>>;
206
+ /**
207
+ * `<target file>` → the barrels that publish it — {@link PlatformSurface.published}'s
208
+ * provenance, which the merge above otherwise drops.
209
+ *
210
+ * It exists for one question {@link PlatformSurface.published} cannot answer:
211
+ * *which subpath carries this file*. A caller holding the `exports` map knows
212
+ * subpath → barrel, so barrel → target closes the chain and a remedy can name
213
+ * the address a reach should have used. Deriving it here rather than in the
214
+ * caller keeps it the same parse the verdict rests on: a second walk of the
215
+ * barrels would be a second answer to "what does this barrel re-export", which
216
+ * is the duplication this file's own header exists to refuse.
217
+ */
218
+ readonly publishedBy: ReadonlyMap<string, ReadonlySet<string>>;
219
+ /** The barrel files themselves — reaching one is reaching the published surface. */
220
+ readonly barrels: ReadonlySet<string>;
221
+ /** Everything the parse could not read. A caller turns a non-empty list into exit 2. */
222
+ readonly unreadable: readonly BarrelUnreadable[];
223
+ /** Barrels that parsed to at least one published name — the `sources=` numerator. */
224
+ readonly barrelsWithExports: number;
225
+ }
226
+ /**
227
+ * The surface, from the barrel sources.
228
+ *
229
+ * `barrels` is keyed by the barrel's own path relative to the source root, so a
230
+ * caller that hands in fewer than {@link PUBLISHED_SUBPATHS} gets a surface that
231
+ * says so through {@link PlatformSurface.barrelsWithExports} rather than a
232
+ * quietly narrower answer.
233
+ */
234
+ export declare function publishedSurface(barrels: ReadonlyMap<string, string>, resolve?: TargetResolver): PlatformSurface;
235
+ //# sourceMappingURL=platform-surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-surface.d.ts","sourceRoot":"","sources":["../../src/lib/platform-surface.ts"],"names":[],"mappings":"AAiEA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAM/C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