opensip-cli 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 (348) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +51 -0
  4. package/dist/api.d.ts +17 -0
  5. package/dist/api.d.ts.map +1 -0
  6. package/dist/api.js +16 -0
  7. package/dist/api.js.map +1 -0
  8. package/dist/bootstrap/admit-tool-package.d.ts +117 -0
  9. package/dist/bootstrap/admit-tool-package.d.ts.map +1 -0
  10. package/dist/bootstrap/admit-tool-package.js +170 -0
  11. package/dist/bootstrap/admit-tool-package.js.map +1 -0
  12. package/dist/bootstrap/baseline-seams.d.ts +30 -0
  13. package/dist/bootstrap/baseline-seams.d.ts.map +1 -0
  14. package/dist/bootstrap/baseline-seams.js +156 -0
  15. package/dist/bootstrap/baseline-seams.js.map +1 -0
  16. package/dist/bootstrap/bootstrap-error.d.ts +41 -0
  17. package/dist/bootstrap/bootstrap-error.d.ts.map +1 -0
  18. package/dist/bootstrap/bootstrap-error.js +33 -0
  19. package/dist/bootstrap/bootstrap-error.js.map +1 -0
  20. package/dist/bootstrap/build-command-registration-input.d.ts +34 -0
  21. package/dist/bootstrap/build-command-registration-input.d.ts.map +1 -0
  22. package/dist/bootstrap/build-command-registration-input.js +73 -0
  23. package/dist/bootstrap/build-command-registration-input.js.map +1 -0
  24. package/dist/bootstrap/build-per-run-scope.d.ts +62 -0
  25. package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -0
  26. package/dist/bootstrap/build-per-run-scope.js +152 -0
  27. package/dist/bootstrap/build-per-run-scope.js.map +1 -0
  28. package/dist/bootstrap/build-targets.d.ts +42 -0
  29. package/dist/bootstrap/build-targets.d.ts.map +1 -0
  30. package/dist/bootstrap/build-targets.js +117 -0
  31. package/dist/bootstrap/build-targets.js.map +1 -0
  32. package/dist/bootstrap/cli-defaults.d.ts +35 -0
  33. package/dist/bootstrap/cli-defaults.d.ts.map +1 -0
  34. package/dist/bootstrap/cli-defaults.js +65 -0
  35. package/dist/bootstrap/cli-defaults.js.map +1 -0
  36. package/dist/bootstrap/config-and-capabilities.d.ts +74 -0
  37. package/dist/bootstrap/config-and-capabilities.d.ts.map +1 -0
  38. package/dist/bootstrap/config-and-capabilities.js +224 -0
  39. package/dist/bootstrap/config-and-capabilities.js.map +1 -0
  40. package/dist/bootstrap/deliver-envelope.d.ts +80 -0
  41. package/dist/bootstrap/deliver-envelope.d.ts.map +1 -0
  42. package/dist/bootstrap/deliver-envelope.js +195 -0
  43. package/dist/bootstrap/deliver-envelope.js.map +1 -0
  44. package/dist/bootstrap/egress-plane.d.ts +22 -0
  45. package/dist/bootstrap/egress-plane.d.ts.map +1 -0
  46. package/dist/bootstrap/egress-plane.js +37 -0
  47. package/dist/bootstrap/egress-plane.js.map +1 -0
  48. package/dist/bootstrap/host-planes.d.ts +28 -0
  49. package/dist/bootstrap/host-planes.d.ts.map +1 -0
  50. package/dist/bootstrap/host-planes.js +152 -0
  51. package/dist/bootstrap/host-planes.js.map +1 -0
  52. package/dist/bootstrap/index.d.ts +76 -0
  53. package/dist/bootstrap/index.d.ts.map +1 -0
  54. package/dist/bootstrap/index.js +109 -0
  55. package/dist/bootstrap/index.js.map +1 -0
  56. package/dist/bootstrap/live-plane.d.ts +51 -0
  57. package/dist/bootstrap/live-plane.d.ts.map +1 -0
  58. package/dist/bootstrap/live-plane.js +72 -0
  59. package/dist/bootstrap/live-plane.js.map +1 -0
  60. package/dist/bootstrap/load-tool-capabilities.d.ts +42 -0
  61. package/dist/bootstrap/load-tool-capabilities.d.ts.map +1 -0
  62. package/dist/bootstrap/load-tool-capabilities.js +76 -0
  63. package/dist/bootstrap/load-tool-capabilities.js.map +1 -0
  64. package/dist/bootstrap/output-plane.d.ts +37 -0
  65. package/dist/bootstrap/output-plane.d.ts.map +1 -0
  66. package/dist/bootstrap/output-plane.js +114 -0
  67. package/dist/bootstrap/output-plane.js.map +1 -0
  68. package/dist/bootstrap/owning-tool-init.d.ts +32 -0
  69. package/dist/bootstrap/owning-tool-init.d.ts.map +1 -0
  70. package/dist/bootstrap/owning-tool-init.js +69 -0
  71. package/dist/bootstrap/owning-tool-init.js.map +1 -0
  72. package/dist/bootstrap/pre-action-guards.d.ts +44 -0
  73. package/dist/bootstrap/pre-action-guards.d.ts.map +1 -0
  74. package/dist/bootstrap/pre-action-guards.js +136 -0
  75. package/dist/bootstrap/pre-action-guards.js.map +1 -0
  76. package/dist/bootstrap/pre-action-hook.d.ts +68 -0
  77. package/dist/bootstrap/pre-action-hook.d.ts.map +1 -0
  78. package/dist/bootstrap/pre-action-hook.js +289 -0
  79. package/dist/bootstrap/pre-action-hook.js.map +1 -0
  80. package/dist/bootstrap/pre-action-messages.d.ts +32 -0
  81. package/dist/bootstrap/pre-action-messages.d.ts.map +1 -0
  82. package/dist/bootstrap/pre-action-messages.js +49 -0
  83. package/dist/bootstrap/pre-action-messages.js.map +1 -0
  84. package/dist/bootstrap/process-idempotency.d.ts +17 -0
  85. package/dist/bootstrap/process-idempotency.d.ts.map +1 -0
  86. package/dist/bootstrap/process-idempotency.js +20 -0
  87. package/dist/bootstrap/process-idempotency.js.map +1 -0
  88. package/dist/bootstrap/register-language-adapters.d.ts +23 -0
  89. package/dist/bootstrap/register-language-adapters.d.ts.map +1 -0
  90. package/dist/bootstrap/register-language-adapters.js +35 -0
  91. package/dist/bootstrap/register-language-adapters.js.map +1 -0
  92. package/dist/bootstrap/register-tools.d.ts +228 -0
  93. package/dist/bootstrap/register-tools.d.ts.map +1 -0
  94. package/dist/bootstrap/register-tools.js +696 -0
  95. package/dist/bootstrap/register-tools.js.map +1 -0
  96. package/dist/bootstrap/render.d.ts +27 -0
  97. package/dist/bootstrap/render.d.ts.map +1 -0
  98. package/dist/bootstrap/render.js +53 -0
  99. package/dist/bootstrap/render.js.map +1 -0
  100. package/dist/bootstrap/report.d.ts +34 -0
  101. package/dist/bootstrap/report.d.ts.map +1 -0
  102. package/dist/bootstrap/report.js +47 -0
  103. package/dist/bootstrap/report.js.map +1 -0
  104. package/dist/bootstrap/run-plane.d.ts +105 -0
  105. package/dist/bootstrap/run-plane.d.ts.map +1 -0
  106. package/dist/bootstrap/run-plane.js +190 -0
  107. package/dist/bootstrap/run-plane.js.map +1 -0
  108. package/dist/bootstrap/scope-access.d.ts +68 -0
  109. package/dist/bootstrap/scope-access.d.ts.map +1 -0
  110. package/dist/bootstrap/scope-access.js +115 -0
  111. package/dist/bootstrap/scope-access.js.map +1 -0
  112. package/dist/bootstrap/state-seams.d.ts +14 -0
  113. package/dist/bootstrap/state-seams.d.ts.map +1 -0
  114. package/dist/bootstrap/state-seams.js +26 -0
  115. package/dist/bootstrap/state-seams.js.map +1 -0
  116. package/dist/bootstrap/tool-lifecycle.d.ts +102 -0
  117. package/dist/bootstrap/tool-lifecycle.d.ts.map +1 -0
  118. package/dist/bootstrap/tool-lifecycle.js +103 -0
  119. package/dist/bootstrap/tool-lifecycle.js.map +1 -0
  120. package/dist/bootstrap/tool-trust.d.ts +49 -0
  121. package/dist/bootstrap/tool-trust.d.ts.map +1 -0
  122. package/dist/bootstrap/tool-trust.js +65 -0
  123. package/dist/bootstrap/tool-trust.js.map +1 -0
  124. package/dist/bootstrap/validate-tool.d.ts +22 -0
  125. package/dist/bootstrap/validate-tool.d.ts.map +1 -0
  126. package/dist/bootstrap/validate-tool.js +38 -0
  127. package/dist/bootstrap/validate-tool.js.map +1 -0
  128. package/dist/cli-context.d.ts +38 -0
  129. package/dist/cli-context.d.ts.map +1 -0
  130. package/dist/cli-context.js +134 -0
  131. package/dist/cli-context.js.map +1 -0
  132. package/dist/commands/agent-catalog.d.ts +45 -0
  133. package/dist/commands/agent-catalog.d.ts.map +1 -0
  134. package/dist/commands/agent-catalog.js +115 -0
  135. package/dist/commands/agent-catalog.js.map +1 -0
  136. package/dist/commands/assemble-outcome.d.ts +69 -0
  137. package/dist/commands/assemble-outcome.d.ts.map +1 -0
  138. package/dist/commands/assemble-outcome.js +121 -0
  139. package/dist/commands/assemble-outcome.js.map +1 -0
  140. package/dist/commands/clear.d.ts +32 -0
  141. package/dist/commands/clear.d.ts.map +1 -0
  142. package/dist/commands/clear.js +73 -0
  143. package/dist/commands/clear.js.map +1 -0
  144. package/dist/commands/completion.d.ts +90 -0
  145. package/dist/commands/completion.d.ts.map +1 -0
  146. package/dist/commands/completion.js +233 -0
  147. package/dist/commands/completion.js.map +1 -0
  148. package/dist/commands/configure.d.ts +32 -0
  149. package/dist/commands/configure.d.ts.map +1 -0
  150. package/dist/commands/configure.js +94 -0
  151. package/dist/commands/configure.js.map +1 -0
  152. package/dist/commands/history.d.ts +18 -0
  153. package/dist/commands/history.d.ts.map +1 -0
  154. package/dist/commands/history.js +48 -0
  155. package/dist/commands/history.js.map +1 -0
  156. package/dist/commands/host-command-specs.d.ts +49 -0
  157. package/dist/commands/host-command-specs.d.ts.map +1 -0
  158. package/dist/commands/host-command-specs.js +331 -0
  159. package/dist/commands/host-command-specs.js.map +1 -0
  160. package/dist/commands/host-subcommand-groups.d.ts +69 -0
  161. package/dist/commands/host-subcommand-groups.d.ts.map +1 -0
  162. package/dist/commands/host-subcommand-groups.js +374 -0
  163. package/dist/commands/host-subcommand-groups.js.map +1 -0
  164. package/dist/commands/index.d.ts +36 -0
  165. package/dist/commands/index.d.ts.map +1 -0
  166. package/dist/commands/index.js +36 -0
  167. package/dist/commands/index.js.map +1 -0
  168. package/dist/commands/init/config-templates.d.ts +16 -0
  169. package/dist/commands/init/config-templates.d.ts.map +1 -0
  170. package/dist/commands/init/config-templates.js +108 -0
  171. package/dist/commands/init/config-templates.js.map +1 -0
  172. package/dist/commands/init/file-classifier.d.ts +40 -0
  173. package/dist/commands/init/file-classifier.d.ts.map +1 -0
  174. package/dist/commands/init/file-classifier.js +155 -0
  175. package/dist/commands/init/file-classifier.js.map +1 -0
  176. package/dist/commands/init/language-detection.d.ts +44 -0
  177. package/dist/commands/init/language-detection.d.ts.map +1 -0
  178. package/dist/commands/init/language-detection.js +124 -0
  179. package/dist/commands/init/language-detection.js.map +1 -0
  180. package/dist/commands/init/scaffold-writer.d.ts +26 -0
  181. package/dist/commands/init/scaffold-writer.d.ts.map +1 -0
  182. package/dist/commands/init/scaffold-writer.js +102 -0
  183. package/dist/commands/init/scaffold-writer.js.map +1 -0
  184. package/dist/commands/init/state-machine.d.ts +32 -0
  185. package/dist/commands/init/state-machine.d.ts.map +1 -0
  186. package/dist/commands/init/state-machine.js +105 -0
  187. package/dist/commands/init/state-machine.js.map +1 -0
  188. package/dist/commands/init.d.ts +95 -0
  189. package/dist/commands/init.d.ts.map +1 -0
  190. package/dist/commands/init.js +209 -0
  191. package/dist/commands/init.js.map +1 -0
  192. package/dist/commands/mount-command-spec.d.ts +106 -0
  193. package/dist/commands/mount-command-spec.d.ts.map +1 -0
  194. package/dist/commands/mount-command-spec.js +313 -0
  195. package/dist/commands/mount-command-spec.js.map +1 -0
  196. package/dist/commands/mount-result-command.d.ts +71 -0
  197. package/dist/commands/mount-result-command.d.ts.map +1 -0
  198. package/dist/commands/mount-result-command.js +76 -0
  199. package/dist/commands/mount-result-command.js.map +1 -0
  200. package/dist/commands/plugin/config-edit.d.ts +20 -0
  201. package/dist/commands/plugin/config-edit.d.ts.map +1 -0
  202. package/dist/commands/plugin/config-edit.js +102 -0
  203. package/dist/commands/plugin/config-edit.js.map +1 -0
  204. package/dist/commands/plugin/domain-resolution.d.ts +38 -0
  205. package/dist/commands/plugin/domain-resolution.d.ts.map +1 -0
  206. package/dist/commands/plugin/domain-resolution.js +98 -0
  207. package/dist/commands/plugin/domain-resolution.js.map +1 -0
  208. package/dist/commands/plugin/host-dir.d.ts +42 -0
  209. package/dist/commands/plugin/host-dir.d.ts.map +1 -0
  210. package/dist/commands/plugin/host-dir.js +168 -0
  211. package/dist/commands/plugin/host-dir.js.map +1 -0
  212. package/dist/commands/plugin-host-ops.d.ts +41 -0
  213. package/dist/commands/plugin-host-ops.d.ts.map +1 -0
  214. package/dist/commands/plugin-host-ops.js +114 -0
  215. package/dist/commands/plugin-host-ops.js.map +1 -0
  216. package/dist/commands/plugin.d.ts +81 -0
  217. package/dist/commands/plugin.d.ts.map +1 -0
  218. package/dist/commands/plugin.js +287 -0
  219. package/dist/commands/plugin.js.map +1 -0
  220. package/dist/commands/render-outcome.d.ts +52 -0
  221. package/dist/commands/render-outcome.d.ts.map +1 -0
  222. package/dist/commands/render-outcome.js +55 -0
  223. package/dist/commands/render-outcome.js.map +1 -0
  224. package/dist/commands/session-show.d.ts +27 -0
  225. package/dist/commands/session-show.d.ts.map +1 -0
  226. package/dist/commands/session-show.js +166 -0
  227. package/dist/commands/session-show.js.map +1 -0
  228. package/dist/commands/shared.d.ts +107 -0
  229. package/dist/commands/shared.d.ts.map +1 -0
  230. package/dist/commands/shared.js +13 -0
  231. package/dist/commands/shared.js.map +1 -0
  232. package/dist/commands/tools/data-purge.d.ts +20 -0
  233. package/dist/commands/tools/data-purge.d.ts.map +1 -0
  234. package/dist/commands/tools/data-purge.js +59 -0
  235. package/dist/commands/tools/data-purge.js.map +1 -0
  236. package/dist/commands/tools/index.d.ts +16 -0
  237. package/dist/commands/tools/index.d.ts.map +1 -0
  238. package/dist/commands/tools/index.js +213 -0
  239. package/dist/commands/tools/index.js.map +1 -0
  240. package/dist/commands/tools/install.d.ts +24 -0
  241. package/dist/commands/tools/install.d.ts.map +1 -0
  242. package/dist/commands/tools/install.js +83 -0
  243. package/dist/commands/tools/install.js.map +1 -0
  244. package/dist/commands/tools/list.d.ts +41 -0
  245. package/dist/commands/tools/list.d.ts.map +1 -0
  246. package/dist/commands/tools/list.js +103 -0
  247. package/dist/commands/tools/list.js.map +1 -0
  248. package/dist/commands/tools/runtime-probe-entry.d.ts +14 -0
  249. package/dist/commands/tools/runtime-probe-entry.d.ts.map +1 -0
  250. package/dist/commands/tools/runtime-probe-entry.js +36 -0
  251. package/dist/commands/tools/runtime-probe-entry.js.map +1 -0
  252. package/dist/commands/tools/runtime-probe.d.ts +29 -0
  253. package/dist/commands/tools/runtime-probe.d.ts.map +1 -0
  254. package/dist/commands/tools/runtime-probe.js +66 -0
  255. package/dist/commands/tools/runtime-probe.js.map +1 -0
  256. package/dist/commands/tools/storage-contract-checks.d.ts +37 -0
  257. package/dist/commands/tools/storage-contract-checks.d.ts.map +1 -0
  258. package/dist/commands/tools/storage-contract-checks.js +91 -0
  259. package/dist/commands/tools/storage-contract-checks.js.map +1 -0
  260. package/dist/commands/tools/uninstall.d.ts +29 -0
  261. package/dist/commands/tools/uninstall.d.ts.map +1 -0
  262. package/dist/commands/tools/uninstall.js +77 -0
  263. package/dist/commands/tools/uninstall.js.map +1 -0
  264. package/dist/commands/tools/validate.d.ts +44 -0
  265. package/dist/commands/tools/validate.d.ts.map +1 -0
  266. package/dist/commands/tools/validate.js +202 -0
  267. package/dist/commands/tools/validate.js.map +1 -0
  268. package/dist/commands/uninstall/targets.d.ts +53 -0
  269. package/dist/commands/uninstall/targets.d.ts.map +1 -0
  270. package/dist/commands/uninstall/targets.js +205 -0
  271. package/dist/commands/uninstall/targets.js.map +1 -0
  272. package/dist/commands/uninstall.d.ts +88 -0
  273. package/dist/commands/uninstall.d.ts.map +1 -0
  274. package/dist/commands/uninstall.js +184 -0
  275. package/dist/commands/uninstall.js.map +1 -0
  276. package/dist/env/host-env-specs.d.ts +52 -0
  277. package/dist/env/host-env-specs.d.ts.map +1 -0
  278. package/dist/env/host-env-specs.js +129 -0
  279. package/dist/env/host-env-specs.js.map +1 -0
  280. package/dist/error-handler.d.ts +64 -0
  281. package/dist/error-handler.d.ts.map +1 -0
  282. package/dist/error-handler.js +180 -0
  283. package/dist/error-handler.js.map +1 -0
  284. package/dist/index.d.ts +21 -0
  285. package/dist/index.d.ts.map +1 -0
  286. package/dist/index.js +154 -0
  287. package/dist/index.js.map +1 -0
  288. package/dist/open-report.d.ts +40 -0
  289. package/dist/open-report.d.ts.map +1 -0
  290. package/dist/open-report.js +54 -0
  291. package/dist/open-report.js.map +1 -0
  292. package/dist/report-compose.d.ts +35 -0
  293. package/dist/report-compose.d.ts.map +1 -0
  294. package/dist/report-compose.js +103 -0
  295. package/dist/report-compose.js.map +1 -0
  296. package/dist/session-replay-registry.d.ts +20 -0
  297. package/dist/session-replay-registry.d.ts.map +1 -0
  298. package/dist/session-replay-registry.js +38 -0
  299. package/dist/session-replay-registry.js.map +1 -0
  300. package/dist/telemetry/profiling.d.ts +42 -0
  301. package/dist/telemetry/profiling.d.ts.map +1 -0
  302. package/dist/telemetry/profiling.js +160 -0
  303. package/dist/telemetry/profiling.js.map +1 -0
  304. package/dist/telemetry/sdk-init.d.ts +87 -0
  305. package/dist/telemetry/sdk-init.d.ts.map +1 -0
  306. package/dist/telemetry/sdk-init.js +235 -0
  307. package/dist/telemetry/sdk-init.js.map +1 -0
  308. package/dist/ui/App.d.ts +32 -0
  309. package/dist/ui/App.d.ts.map +1 -0
  310. package/dist/ui/App.js +35 -0
  311. package/dist/ui/App.js.map +1 -0
  312. package/dist/ui/render.d.ts +15 -0
  313. package/dist/ui/render.d.ts.map +1 -0
  314. package/dist/ui/render.js +21 -0
  315. package/dist/ui/render.js.map +1 -0
  316. package/dist/ui/result-to-view.d.ts +40 -0
  317. package/dist/ui/result-to-view.d.ts.map +1 -0
  318. package/dist/ui/result-to-view.js +389 -0
  319. package/dist/ui/result-to-view.js.map +1 -0
  320. package/dist/ui/views/init-view.d.ts +9 -0
  321. package/dist/ui/views/init-view.d.ts.map +1 -0
  322. package/dist/ui/views/init-view.js +119 -0
  323. package/dist/ui/views/init-view.js.map +1 -0
  324. package/dist/ui/views/misc-views.d.ts +18 -0
  325. package/dist/ui/views/misc-views.d.ts.map +1 -0
  326. package/dist/ui/views/misc-views.js +244 -0
  327. package/dist/ui/views/misc-views.js.map +1 -0
  328. package/dist/ui/views/plugin-view.d.ts +8 -0
  329. package/dist/ui/views/plugin-view.d.ts.map +1 -0
  330. package/dist/ui/views/plugin-view.js +135 -0
  331. package/dist/ui/views/plugin-view.js.map +1 -0
  332. package/dist/ui/views/tools-views.d.ts +12 -0
  333. package/dist/ui/views/tools-views.d.ts.map +1 -0
  334. package/dist/ui/views/tools-views.js +152 -0
  335. package/dist/ui/views/tools-views.js.map +1 -0
  336. package/dist/update-notifier.d.ts +108 -0
  337. package/dist/update-notifier.d.ts.map +1 -0
  338. package/dist/update-notifier.js +188 -0
  339. package/dist/update-notifier.js.map +1 -0
  340. package/dist/update-state.d.ts +40 -0
  341. package/dist/update-state.d.ts.map +1 -0
  342. package/dist/update-state.js +81 -0
  343. package/dist/update-state.js.map +1 -0
  344. package/dist/welcome.d.ts +53 -0
  345. package/dist/welcome.d.ts.map +1 -0
  346. package/dist/welcome.js +89 -0
  347. package/dist/welcome.js.map +1 -0
  348. package/package.json +100 -0
@@ -0,0 +1,103 @@
1
+ /**
2
+ * `tools list` — the read-only effective-tool inventory (ADR-0041).
3
+ *
4
+ * HARD RULE: this command performs ZERO dynamic imports of tool runtimes. A
5
+ * listing command that executes plugin code is both slow and a consent
6
+ * violation (the trust posture reserves code execution for validate/install).
7
+ * Every row derives from
8
+ *
9
+ * - the CURRENT RUN's admitted set — the provenance + manifest pairs the
10
+ * bootstrap recorded, passed in by the command handler from the entered
11
+ * RunScope (`currentScope().toolProvenance` / `?.toolManifests`),
12
+ * status `loaded`; and
13
+ * - marker scans of the two install hosts (user-global + project
14
+ * `.runtime`), `loadToolManifest` only (a file read), status
15
+ * `manifest-only` — covering installed-but-not-loaded packages (and, by
16
+ * construction, a package whose module top-level would throw).
17
+ *
18
+ * Shadow-marking: discovery is first-occurrence-wins (project before global in
19
+ * `buildToolDiscoverySources`), so when a project row and a global row share a
20
+ * tool id the GLOBAL row is marked shadowed.
21
+ */
22
+ import { join } from 'node:path';
23
+ import { discoverPackagesInNodeModules, loadToolManifest, resolveProjectPaths, resolveUserPaths, } from '@opensip-cli/core';
24
+ import { TOOL_DOMAIN } from '../plugin/domain-resolution.js';
25
+ /**
26
+ * Map a loaded tool's provenance to the user-facing source label. Installed
27
+ * tools resolve their scope by which host dir their package landed in
28
+ * (project `.runtime` wins ties — it precedes global in discovery order).
29
+ */
30
+ function sourceLabelFor(provenance, projectHostDir, globalHostDir) {
31
+ if (provenance.source === 'bundled')
32
+ return 'bundled';
33
+ if (provenance.source === 'project-local')
34
+ return 'project';
35
+ if (provenance.source === 'user-global')
36
+ return 'global';
37
+ const path = provenance.resolvedPath ?? '';
38
+ if (path.startsWith(projectHostDir))
39
+ return 'project';
40
+ if (path.startsWith(globalHostDir))
41
+ return 'global';
42
+ // An installed tool discovered via the cwd walk-up or the CLI install dir:
43
+ // it behaves project-wide for this run; label by where it sits relative to
44
+ // the project host, defaulting to global (the broader visibility claim).
45
+ return 'global';
46
+ }
47
+ /** Build the effective tool inventory. Read-only; never imports a runtime. */
48
+ export function toolsList(opts) {
49
+ const projectHostDir = resolveProjectPaths(opts.cwd).pluginsDir(TOOL_DOMAIN);
50
+ const globalHostDir = resolveUserPaths().pluginsDir(TOOL_DOMAIN);
51
+ const provenance = opts.provenance ?? [];
52
+ const manifests = opts.manifests ?? [];
53
+ const rows = [];
54
+ const loadedPackageNames = new Set();
55
+ // Loaded set — provenance and manifests are pushed pairwise at admission,
56
+ // so they index together.
57
+ for (const [i, prov] of provenance.entries()) {
58
+ const manifest = manifests[i];
59
+ if (prov.packageName !== undefined)
60
+ loadedPackageNames.add(prov.packageName);
61
+ rows.push({
62
+ id: prov.id,
63
+ ...(prov.packageName === undefined ? {} : { packageName: prov.packageName }),
64
+ version: prov.version,
65
+ source: sourceLabelFor(prov, projectHostDir, globalHostDir),
66
+ commands: manifest?.commands.map((c) => c.name) ?? [],
67
+ status: 'loaded',
68
+ });
69
+ }
70
+ // Installed-but-not-loaded set — marker scan + manifest file read per host.
71
+ const hosts = [
72
+ { dir: projectHostDir, source: 'project' },
73
+ { dir: globalHostDir, source: 'global' },
74
+ ];
75
+ for (const host of hosts) {
76
+ for (const pkg of discoverPackagesInNodeModules(join(host.dir, 'node_modules'), 'tool')) {
77
+ if (loadedPackageNames.has(pkg.name))
78
+ continue;
79
+ const manifest = loadToolManifest('installed', pkg.packageDir);
80
+ rows.push({
81
+ id: manifest?.id ?? pkg.name,
82
+ packageName: pkg.name,
83
+ version: manifest?.version ?? 'unknown',
84
+ source: host.source,
85
+ commands: manifest?.commands.map((c) => c.name) ?? [],
86
+ status: 'manifest-only',
87
+ });
88
+ }
89
+ }
90
+ // Shadow-marking: a project row shadows a global row with the same tool id
91
+ // (matches discovery's first-occurrence-wins ordering: project precedes
92
+ // global). Bundled rows are never shadow-marked — the registry's
93
+ // first-writer-wins already keeps a duplicate id from loading at all.
94
+ const projectIds = new Set(rows.filter((r) => r.source === 'project').map((r) => r.id));
95
+ const marked = rows.map((row) => row.source === 'global' && projectIds.has(row.id) ? { ...row, shadowed: true } : row);
96
+ let filtered = marked;
97
+ if (opts.global === true)
98
+ filtered = marked.filter((r) => r.source === 'global');
99
+ else if (opts.project === true)
100
+ filtered = marked.filter((r) => r.source === 'project');
101
+ return { type: 'tools-list', tools: filtered, totalCount: filtered.length };
102
+ }
103
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/tools/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAuB7D;;;;GAIG;AACH,SAAS,cAAc,CACrB,UAA0B,EAC1B,cAAsB,EACtB,aAAqB;IAErB,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACtD,IAAI,UAAU,CAAC,MAAM,KAAK,eAAe;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,UAAU,CAAC,MAAM,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AC3E,wEAAwE;IACxE,iEAAiE;IACjE,sEAAsE;IACtE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxF,MAAM,MAAM,GAAmB,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC9C,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CACrF,CAAC;IAEF,IAAI,QAAQ,GAAG,MAAM,CAAC;IACtB,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;QAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;SAC5E,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI;QAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;IAExF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * runtime-probe-entry — the child-process side of `tools validate`'s runtime
3
+ * sections (ADR-0041).
4
+ *
5
+ * Spawned as `node <dist>/commands/tools/runtime-probe-entry.js <packageDir>`.
6
+ * Runs the FULL admission pipeline (the runtime sections dynamic-import the
7
+ * candidate package — UNTRUSTED code executes here, which is exactly why this
8
+ * is a separate process: a crashing/hanging/env-mutating candidate cannot
9
+ * corrupt the parent CLI, and the parent imposes a hard timeout. NOT a
10
+ * security boundary — same user privileges) and prints a slim JSON report on
11
+ * stdout. Exit 0 ⇔ report.ok.
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=runtime-probe-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-probe-entry.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/runtime-probe-entry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,36 @@
1
+ // @fitness-ignore-file one-outcome-shape -- this stdout JSON line is the PRIVATE parent↔child probe wire (runtime-probe.ts parses it), not the CLI's user-facing --json surface; renderOutcome/CommandOutcome govern user machine output, and the probe is never invoked as a CLI command.
2
+ // @fitness-ignore-file only-documented-toolcli-seams -- same rationale: the stdout JSON is the private parent↔child probe IPC wire (parsed by runtime-probe.ts), not user-facing run output through a ToolCliContext seam.
3
+ /**
4
+ * runtime-probe-entry — the child-process side of `tools validate`'s runtime
5
+ * sections (ADR-0041).
6
+ *
7
+ * Spawned as `node <dist>/commands/tools/runtime-probe-entry.js <packageDir>`.
8
+ * Runs the FULL admission pipeline (the runtime sections dynamic-import the
9
+ * candidate package — UNTRUSTED code executes here, which is exactly why this
10
+ * is a separate process: a crashing/hanging/env-mutating candidate cannot
11
+ * corrupt the parent CLI, and the parent imposes a hard timeout. NOT a
12
+ * security boundary — same user privileges) and prints a slim JSON report on
13
+ * stdout. Exit 0 ⇔ report.ok.
14
+ */
15
+ import { admitToolPackage } from '../../bootstrap/admit-tool-package.js';
16
+ const dir = process.argv[2];
17
+ if (dir === undefined || dir.length === 0) {
18
+ process.stderr.write('runtime-probe-entry: missing package dir argument\n');
19
+ process.exitCode = 2;
20
+ }
21
+ else {
22
+ const report = await admitToolPackage({
23
+ dir,
24
+ source: 'installed',
25
+ explicitlyRequested: true,
26
+ });
27
+ const slim = {
28
+ ok: report.ok,
29
+ sections: report.sections,
30
+ toolConfigNamespace: report.tool?.config?.namespace ?? null,
31
+ toolId: report.tool?.metadata.name ?? report.tool?.metadata.id ?? null,
32
+ };
33
+ process.stdout.write(`${JSON.stringify(slim)}\n`);
34
+ process.exitCode = report.ok ? 0 : 1;
35
+ }
36
+ //# sourceMappingURL=runtime-probe-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-probe-entry.js","sourceRoot":"","sources":["../../../src/commands/tools/runtime-probe-entry.ts"],"names":[],"mappings":"AAAA,2RAA2R;AAC3R,2NAA2N;AAC3N;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAIzE,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC5B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;IAC5E,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC;KAAM,CAAC;IACN,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC;QACpC,GAAG;QACH,MAAM,EAAE,WAAW;QACnB,mBAAmB,EAAE,IAAI;KAC1B,CAAC,CAAC;IACH,MAAM,IAAI,GAAgB;QACxB,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,mBAAmB,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,IAAI,IAAI;QAC3D,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,IAAI,IAAI;KACvE,CAAC;IACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * runtime-probe — the parent-process side of `tools validate`'s runtime
3
+ * sections (ADR-0041).
4
+ *
5
+ * Spawns `runtime-probe-entry.js` (compiled sibling in dist) against a staged
6
+ * candidate dir with a hard timeout. The child dynamic-imports the candidate —
7
+ * the subprocess is a CRASH/CONTAMINATION boundary (a throwing module
8
+ * top-level, a hang, a process.env mutation cannot touch the parent), NOT a
9
+ * security boundary (same user privileges; ADR-0041's trust posture applies).
10
+ */
11
+ import type { AdmissionSectionResult } from '../../bootstrap/admit-tool-package.js';
12
+ /** The slim, JSON-serializable report the probe child prints. */
13
+ export interface ProbeReport {
14
+ readonly ok: boolean;
15
+ readonly sections: readonly AdmissionSectionResult[];
16
+ /** The runtime `Tool.config.namespace`; `null` = the tool declares no config. */
17
+ readonly toolConfigNamespace: string | null;
18
+ /** The runtime tool id, when the tool loaded. */
19
+ readonly toolId: string | null;
20
+ }
21
+ /** Hard ceiling on candidate module-load time (a hung import must not hang the CLI). */
22
+ export declare const PROBE_TIMEOUT_MS = 30000;
23
+ /**
24
+ * Run the runtime admission sections against `packageDir` in a child process.
25
+ * Never throws: a crash/timeout/unparseable child maps to a synthetic failed
26
+ * `runtime-load` section carrying the child's stderr as diagnostic.
27
+ */
28
+ export declare function runRuntimeProbe(packageDir: string): ProbeReport;
29
+ //# sourceMappingURL=runtime-probe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-probe.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/runtime-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAEpF,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACrD,iFAAiF;IACjF,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAevC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAoC/D"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * runtime-probe — the parent-process side of `tools validate`'s runtime
3
+ * sections (ADR-0041).
4
+ *
5
+ * Spawns `runtime-probe-entry.js` (compiled sibling in dist) against a staged
6
+ * candidate dir with a hard timeout. The child dynamic-imports the candidate —
7
+ * the subprocess is a CRASH/CONTAMINATION boundary (a throwing module
8
+ * top-level, a hang, a process.env mutation cannot touch the parent), NOT a
9
+ * security boundary (same user privileges; ADR-0041's trust posture applies).
10
+ */
11
+ import { spawnSync } from 'node:child_process';
12
+ import { existsSync } from 'node:fs';
13
+ import { fileURLToPath } from 'node:url';
14
+ /** Hard ceiling on candidate module-load time (a hung import must not hang the CLI). */
15
+ export const PROBE_TIMEOUT_MS = 30_000;
16
+ /**
17
+ * Resolved against THIS module's location, so it works from dist and when
18
+ * packed. Under vitest, `import.meta.url` points into `src/` where the
19
+ * compiled sibling does not exist — fall back to the built `dist/` twin (the
20
+ * test suites require a build, same as every dist-spawning e2e here).
21
+ */
22
+ function resolveProbeEntry() {
23
+ const sibling = fileURLToPath(new URL('runtime-probe-entry.js', import.meta.url));
24
+ if (existsSync(sibling))
25
+ return sibling;
26
+ return sibling.replace(`${'/src/'}`, '/dist/');
27
+ }
28
+ const PROBE_ENTRY = resolveProbeEntry();
29
+ /**
30
+ * Run the runtime admission sections against `packageDir` in a child process.
31
+ * Never throws: a crash/timeout/unparseable child maps to a synthetic failed
32
+ * `runtime-load` section carrying the child's stderr as diagnostic.
33
+ */
34
+ export function runRuntimeProbe(packageDir) {
35
+ const child = spawnSync(process.execPath, [PROBE_ENTRY, packageDir], {
36
+ encoding: 'utf8',
37
+ timeout: PROBE_TIMEOUT_MS,
38
+ stdio: ['ignore', 'pipe', 'pipe'],
39
+ });
40
+ const failed = (diagnostic) => ({
41
+ ok: false,
42
+ sections: [{ section: 'runtime-load', ok: false, diagnostic }],
43
+ toolConfigNamespace: null,
44
+ toolId: null,
45
+ });
46
+ if (child.error !== undefined) {
47
+ const timedOut = child.error.code === 'ETIMEDOUT';
48
+ return failed(timedOut
49
+ ? `runtime probe timed out after ${PROBE_TIMEOUT_MS}ms (the module load hung)`
50
+ : `runtime probe failed to spawn: ${child.error.message}`);
51
+ }
52
+ const stdout = (child.stdout ?? '').trim();
53
+ if (stdout.length === 0) {
54
+ const stderr = (child.stderr ?? '').trim();
55
+ return failed(stderr.length > 0
56
+ ? `runtime probe crashed: ${stderr.slice(0, 500)}`
57
+ : 'runtime probe produced no report');
58
+ }
59
+ try {
60
+ return JSON.parse(stdout.split('\n').at(-1) ?? '');
61
+ }
62
+ catch {
63
+ return failed(`runtime probe printed an unparseable report: ${stdout.slice(0, 200)}`);
64
+ }
65
+ }
66
+ //# sourceMappingURL=runtime-probe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-probe.js","sourceRoot":"","sources":["../../../src/commands/tools/runtime-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAczC,wFAAwF;AACxF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEvC;;;;;GAKG;AACH,SAAS,iBAAiB;IACxB,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,GAAG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QACxB,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC3C,OAAO,MAAM,CACX,MAAM,CAAC,MAAM,GAAG,CAAC;YACf,CAAC,CAAC,0BAA0B,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;YAClD,CAAC,CAAC,kCAAkC,CACvC,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAgB,CAAC;IACpE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,gDAAgD,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IACxF,CAAC;AACH,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Tier A storage-contract static checks (ADR-0042).
3
+ *
4
+ * The enforceable-now tier of the tool storage contract: a tool package must
5
+ * not carry schema-mutation capability against the host-owned SQLite store —
6
+ * no DDL, no migration runners, no direct datastore-file paths, no imports of
7
+ * the datastore package's private schema/migration modules. Scans the staged
8
+ * package's OWN source files (not its node_modules) with string patterns;
9
+ * a guardrail, not the only lock — the stronger guarantee is that the Tool
10
+ * runtime context never exposes raw schema-mutation capabilities.
11
+ *
12
+ * Pattern-family note: the DDL list deliberately mirrors the
13
+ * `restrict-raw-db-access` fitness check's vocabulary (checks-universal,
14
+ * `src/checks/architecture/restrict-raw-db-access.ts`). The two lists are kept
15
+ * from drifting by a parity test (`tools-validate.test.ts`), NOT by a cli →
16
+ * check-pack production import (which would couple the host to a tool's pack).
17
+ */
18
+ /** One Tier A violation: where, what matched, and which contract clause. */
19
+ export interface StorageFinding {
20
+ /** Path relative to the scanned package dir. */
21
+ readonly file: string;
22
+ /** 1-based line of the first match. */
23
+ readonly line: number;
24
+ readonly matched: string;
25
+ readonly clause: string;
26
+ }
27
+ /** The Tier A pattern families (exported for the drift-parity test). */
28
+ export declare const TIER_A_PATTERNS: readonly {
29
+ readonly pattern: RegExp;
30
+ readonly clause: string;
31
+ }[];
32
+ /**
33
+ * Scan one staged package dir for Tier A storage-contract violations.
34
+ * Returns findings (empty = section passes). Pure file reads; runs no code.
35
+ */
36
+ export declare function runStorageContractChecks(stagedDir: string): readonly StorageFinding[];
37
+ //# sourceMappingURL=storage-contract-checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-contract-checks.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/storage-contract-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,wEAAwE;AACxE,eAAO,MAAM,eAAe,EAAE,SAAS;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAyB3F,CAAC;AAsBF;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,cAAc,EAAE,CAiBrF"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Tier A storage-contract static checks (ADR-0042).
3
+ *
4
+ * The enforceable-now tier of the tool storage contract: a tool package must
5
+ * not carry schema-mutation capability against the host-owned SQLite store —
6
+ * no DDL, no migration runners, no direct datastore-file paths, no imports of
7
+ * the datastore package's private schema/migration modules. Scans the staged
8
+ * package's OWN source files (not its node_modules) with string patterns;
9
+ * a guardrail, not the only lock — the stronger guarantee is that the Tool
10
+ * runtime context never exposes raw schema-mutation capabilities.
11
+ *
12
+ * Pattern-family note: the DDL list deliberately mirrors the
13
+ * `restrict-raw-db-access` fitness check's vocabulary (checks-universal,
14
+ * `src/checks/architecture/restrict-raw-db-access.ts`). The two lists are kept
15
+ * from drifting by a parity test (`tools-validate.test.ts`), NOT by a cli →
16
+ * check-pack production import (which would couple the host to a tool's pack).
17
+ */
18
+ import { readdirSync, readFileSync, statSync } from 'node:fs';
19
+ import { join, relative } from 'node:path';
20
+ /** The Tier A pattern families (exported for the drift-parity test). */
21
+ export const TIER_A_PATTERNS = [
22
+ {
23
+ pattern: /\b(CREATE|ALTER|DROP)\s+TABLE\b/i,
24
+ clause: 'no DDL against the OpenSIP datastore (ADR-0042 Tier A)',
25
+ },
26
+ {
27
+ pattern: /\bCREATE\s+(UNIQUE\s+)?INDEX\b/i,
28
+ clause: 'no DDL against the OpenSIP datastore (ADR-0042 Tier A)',
29
+ },
30
+ {
31
+ pattern: /\bPRAGMA\s+writable_schema\b/i,
32
+ clause: 'no schema-mutation pragmas (ADR-0042 Tier A)',
33
+ },
34
+ {
35
+ pattern: /\.runtime\/datastore\.sqlite/,
36
+ clause: 'no direct datastore-file access (ADR-0042 Tier A)',
37
+ },
38
+ {
39
+ pattern: /@opensip-cli\/datastore\/(schema|migrations)\//,
40
+ clause: 'no datastore-private schema/migration imports (ADR-0042 Tier A)',
41
+ },
42
+ {
43
+ pattern: /drizzle-orm\/[\w/-]*migrator/,
44
+ clause: 'no migration runners against the OpenSIP datastore (ADR-0042 Tier A)',
45
+ },
46
+ ];
47
+ const SCANNED_EXTENSIONS = new Set(['.js', '.mjs', '.cjs', '.ts', '.mts', '.cts']);
48
+ function* walkSourceFiles(dir, root) {
49
+ for (const entry of readdirSync(dir)) {
50
+ // Skip deps and dotdirs; skip test trees + spec files — Tier A gates the
51
+ // SHIPPABLE surface (same production-only rationale as the dogfood rules;
52
+ // a DDL string inside a tool's own test fixture is not schema capability).
53
+ if (entry === 'node_modules' || entry === '__tests__' || entry.startsWith('.'))
54
+ continue;
55
+ const abs = join(dir, entry);
56
+ const stat = statSync(abs);
57
+ if (stat.isDirectory()) {
58
+ yield* walkSourceFiles(abs, root);
59
+ continue;
60
+ }
61
+ if (/\.test\.[cm]?[jt]s$/.test(entry))
62
+ continue;
63
+ const dot = entry.lastIndexOf('.');
64
+ if (dot !== -1 && SCANNED_EXTENSIONS.has(entry.slice(dot)))
65
+ yield abs;
66
+ }
67
+ }
68
+ /**
69
+ * Scan one staged package dir for Tier A storage-contract violations.
70
+ * Returns findings (empty = section passes). Pure file reads; runs no code.
71
+ */
72
+ export function runStorageContractChecks(stagedDir) {
73
+ const findings = [];
74
+ for (const file of walkSourceFiles(stagedDir, stagedDir)) {
75
+ const content = readFileSync(file, 'utf8');
76
+ const lines = content.split('\n');
77
+ for (const { pattern, clause } of TIER_A_PATTERNS) {
78
+ if (!pattern.test(content))
79
+ continue;
80
+ const lineIdx = lines.findIndex((l) => pattern.test(l));
81
+ findings.push({
82
+ file: relative(stagedDir, file),
83
+ line: lineIdx === -1 ? 1 : lineIdx + 1,
84
+ matched: pattern.source,
85
+ clause,
86
+ });
87
+ }
88
+ }
89
+ return findings;
90
+ }
91
+ //# sourceMappingURL=storage-contract-checks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-contract-checks.js","sourceRoot":"","sources":["../../../src/commands/tools/storage-contract-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAY3C,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAqE;IAC/F;QACE,OAAO,EAAE,kCAAkC;QAC3C,MAAM,EAAE,wDAAwD;KACjE;IACD;QACE,OAAO,EAAE,iCAAiC;QAC1C,MAAM,EAAE,wDAAwD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ED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,SAAiB;IACxD,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;QACzD,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,eAAe,EAAE,CAAC;YAClD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;gBAAE,SAAS;YACrC,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACxD,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;gBAC/B,IAAI,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC;gBACtC,OAAO,EAAE,OAAO,CAAC,MAAM;gBACvB,MAAM;aACP,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `tools uninstall` — scope-aware, identity-resolving removal (ADR-0041).
3
+ *
4
+ * Accepts a tool id OR a package name; resolves it against manifest scans of
5
+ * the two install hosts (file reads only — no runtime import), displays the
6
+ * resolved identity, and removes the package install state. Rules (spec):
7
+ * one uninstallable scope → plain uninstall works; both scopes → require
8
+ * `--global`/`--project`; bundled ids are rejected; SQLite data is never
9
+ * touched here (`tools data purge` owns that).
10
+ */
11
+ import { type ToolProvenance } from '@opensip-cli/core';
12
+ import type { ToolsUninstallResult } from '@opensip-cli/contracts';
13
+ /** Options for {@link toolsUninstall}. */
14
+ export interface ToolsUninstallOptions {
15
+ /** Tool id or npm package name. */
16
+ readonly target: string;
17
+ readonly cwd: string;
18
+ readonly global?: boolean;
19
+ readonly project?: boolean;
20
+ /**
21
+ * The admitted-tool provenance for this run, read by the command handler from
22
+ * the entered RunScope and passed in (keeps this function pure). Used only to
23
+ * reject uninstalling a bundled tool. Default `[]`.
24
+ */
25
+ readonly provenance?: readonly ToolProvenance[];
26
+ }
27
+ /** Resolve + remove one installed tool. Never touches the datastore. */
28
+ export declare function toolsUninstall(opts: ToolsUninstallOptions): ToolsUninstallResult;
29
+ //# sourceMappingURL=uninstall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/uninstall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CACjD;AA4BD,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,IAAI,EAAE,qBAAqB,GAAG,oBAAoB,CAyDhF"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * `tools uninstall` — scope-aware, identity-resolving removal (ADR-0041).
3
+ *
4
+ * Accepts a tool id OR a package name; resolves it against manifest scans of
5
+ * the two install hosts (file reads only — no runtime import), displays the
6
+ * resolved identity, and removes the package install state. Rules (spec):
7
+ * one uninstallable scope → plain uninstall works; both scopes → require
8
+ * `--global`/`--project`; bundled ids are rejected; SQLite data is never
9
+ * touched here (`tools data purge` owns that).
10
+ */
11
+ import { join } from 'node:path';
12
+ import { discoverPackagesInNodeModules, loadToolManifest, resolveProjectPaths, resolveUserPaths, } from '@opensip-cli/core';
13
+ import { TOOL_DOMAIN } from '../plugin/domain-resolution.js';
14
+ import { removeToolPlugin } from '../plugin-host-ops.js';
15
+ /** Manifest-scan both install hosts for removable candidates (no imports). */
16
+ function scanInstalledCandidates(cwd) {
17
+ const hosts = [
18
+ { dir: resolveProjectPaths(cwd).pluginsDir(TOOL_DOMAIN), scope: 'project' },
19
+ { dir: resolveUserPaths().pluginsDir(TOOL_DOMAIN), scope: 'global' },
20
+ ];
21
+ const candidates = [];
22
+ for (const host of hosts) {
23
+ for (const pkg of discoverPackagesInNodeModules(join(host.dir, 'node_modules'), 'tool')) {
24
+ const manifest = loadToolManifest('installed', pkg.packageDir);
25
+ candidates.push({ id: manifest?.id ?? pkg.name, packageName: pkg.name, scope: host.scope });
26
+ }
27
+ }
28
+ return candidates;
29
+ }
30
+ function failed(target, error) {
31
+ return { type: 'tools-uninstall', target, success: false, error };
32
+ }
33
+ /** Resolve + remove one installed tool. Never touches the datastore. */
34
+ export function toolsUninstall(opts) {
35
+ // Bundled tools are not uninstallable — resolve the bundled id set from the
36
+ // run's provenance (always present: bundled admission is fail-closed).
37
+ const bundledIds = new Set((opts.provenance ?? []).filter((p) => p.source === 'bundled').map((p) => p.id));
38
+ if (bundledIds.has(opts.target)) {
39
+ return failed(opts.target, `'${opts.target}' is a bundled tool — it ships with the CLI and cannot be uninstalled`);
40
+ }
41
+ const matches = scanInstalledCandidates(opts.cwd).filter((c) => c.id === opts.target || c.packageName === opts.target);
42
+ if (matches.length === 0) {
43
+ return failed(opts.target, `no installed tool matches '${opts.target}' (by id or package name)`);
44
+ }
45
+ const distinctIds = new Set(matches.map((c) => c.id));
46
+ if (distinctIds.size > 1) {
47
+ const listing = matches.map((c) => `${c.id} (${c.packageName}, ${c.scope})`).join('; ');
48
+ return failed(opts.target, `'${opts.target}' is ambiguous across different tools: ${listing}`);
49
+ }
50
+ const scopes = new Set(matches.map((c) => c.scope));
51
+ let chosen;
52
+ if (opts.global === true || opts.project === true) {
53
+ const want = opts.global === true ? 'global' : 'project';
54
+ chosen = matches.find((c) => c.scope === want);
55
+ if (chosen === undefined) {
56
+ return failed(opts.target, `'${opts.target}' is not installed in the ${want} scope`);
57
+ }
58
+ }
59
+ else if (scopes.size > 1) {
60
+ return failed(opts.target, `'${opts.target}' is installed in BOTH scopes — pass --global or --project to choose`);
61
+ }
62
+ else {
63
+ chosen = matches[0];
64
+ }
65
+ const removal = removeToolPlugin(chosen.packageName, opts.cwd, chosen.scope === 'project');
66
+ if (removal.type !== 'plugin-remove' || removal.success !== true) {
67
+ const error = 'error' in removal ? (removal.error ?? 'removal failed') : 'removal failed';
68
+ return failed(opts.target, error);
69
+ }
70
+ return {
71
+ type: 'tools-uninstall',
72
+ target: opts.target,
73
+ success: true,
74
+ removed: { id: chosen.id, packageName: chosen.packageName, scope: chosen.scope },
75
+ };
76
+ }
77
+ //# sourceMappingURL=uninstall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/tools/uninstall.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,GAEjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAyBzD,8EAA8E;AAC9E,SAAS,uBAAuB,CAAC,GAAW;IAC1C,MAAM,KAAK,GAAmE;QAC5E,E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EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE;KACjF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * `tools validate` — user-invocable tool conformance (ADR-0041).
3
+ *
4
+ * The SAME admission pipeline bootstrap runs (`admitToolPackage` — one
5
+ * validator, four consumers), rendered as a sectioned report, plus the
6
+ * Tier A storage-contract scan (ADR-0042) and the config-contract checks.
7
+ *
8
+ * EXECUTION MODEL (the trust posture, stated plainly): validating a package
9
+ * is trusting it to execute — the runtime sections import the candidate's
10
+ * module. Mitigations, not promises: staging installs run npm with
11
+ * `--ignore-scripts` (install-time hooks never fire), and the module import
12
+ * happens in a child-process probe with a hard timeout (a crash boundary,
13
+ * NOT a security boundary).
14
+ *
15
+ * Staging: an npm/tarball spec installs into a TEMP host dir (removed in
16
+ * `finally`); a local directory path validates IN PLACE by default, or via a
17
+ * temp-host install with `--install-deps` (which also resolves the package's
18
+ * dependencies so the runtime sections can load it).
19
+ */
20
+ import type { ToolsValidateResult } from '@opensip-cli/contracts';
21
+ /** The one-line execution notice printed before any candidate code can run. */
22
+ export declare const VALIDATE_EXECUTION_NOTICE: string;
23
+ /** Options for {@link runToolValidation}. */
24
+ export interface ToolValidationOptions {
25
+ /** Package spec: npm name/range/tarball/git spec, or a local directory path. */
26
+ readonly spec: string;
27
+ readonly cwd: string;
28
+ /** For LOCAL PATH specs: stage via temp-host npm install (resolves deps). */
29
+ readonly installDeps?: boolean;
30
+ }
31
+ /**
32
+ * Run every validation section against one candidate spec. Shared by
33
+ * `tools validate` (renders it) and `tools install` (gates activation on it).
34
+ * `keepStaged` hands ownership of the staged dir to the caller (install
35
+ * activates from the validated bytes — never a re-download).
36
+ */
37
+ export declare function runToolValidation(opts: ToolValidationOptions, { keepStaged }?: {
38
+ keepStaged?: boolean;
39
+ }): Promise<{
40
+ result: ToolsValidateResult;
41
+ stagedPkgDir?: string;
42
+ cleanup: () => void;
43
+ }>;
44
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAaH,OAAO,KAAK,EAAE,mBAAmB,EAAwB,MAAM,wBAAwB,CAAC;AAExF,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,QAG2B,CAAC;AAElE,6CAA6C;AAC7C,MAAM,WAAW,qBAAqB;IACpC,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAoKD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,qBAAqB,EAC3B,EAAE,UAAkB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACpD,OAAO,CAAC;IAAE,MAAM,EAAE,mBAAmB,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC,CAyDtF"}