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,107 @@
1
+ /**
2
+ * shared — the registrar context type used by every CLI-owned (host) command.
3
+ *
4
+ * Launch Phase 6 moved the host commands onto the declarative
5
+ * `CommandSpec` plane (`host-command-specs.ts` / `host-subcommand-groups.ts`),
6
+ * which sources `--cwd` / `--json` from the ADR-0021 common-flag registry
7
+ * directly (via `commonFlags: ['cwd', 'json']`). The former
8
+ * `CWD_OPTION_SPEC` / `JSON_DESC` re-export constants — used only by the
9
+ * deleted `register-*.ts` registrars — are gone; this module now carries just
10
+ * the shared context type.
11
+ */
12
+ import type { SpecLike } from './completion.js';
13
+ import type { SessionReplayRegistry } from '../session-replay-registry.js';
14
+ import type { CommandResult } from '@opensip-cli/contracts';
15
+ import type { PluginLayout, ScaffoldContext, ScaffoldFile } from '@opensip-cli/core';
16
+ /**
17
+ * One registered tool's `init`-scaffold contribution (ADR-0038): its structural
18
+ * `pluginLayout` (domain + userSubdirs the host `mkdir`s) plus the optional
19
+ * tool-owned example/config hooks. Derived from the tool registry by the host; the
20
+ * init command iterates these instead of hardcoding fit/sim.
21
+ */
22
+ export interface ToolScaffold {
23
+ readonly layout: PluginLayout;
24
+ readonly scaffoldExamples?: (ctx: ScaffoldContext) => readonly ScaffoldFile[];
25
+ readonly stableExampleIds?: () => readonly string[];
26
+ readonly scaffoldConfigBlock?: () => string;
27
+ }
28
+ /**
29
+ * Context the orchestrator (`registerCliCommands`) hands to every
30
+ * sub-registrar. The `setExitCode` write path mirrors `ToolCliContext`'s
31
+ * — exit-code mutations route through here, never through direct
32
+ * `process.exitCode` writes.
33
+ */
34
+ export interface CliCommandsContext {
35
+ readonly setExitCode: (code: number) => void;
36
+ readonly render: (result: CommandResult) => Promise<void>;
37
+ /**
38
+ * Success machine-output seam — wraps the value in a `CommandOutcome` via the
39
+ * single `renderOutcome` seam (launch, §5.5). Always supplied by the host
40
+ * (sourced from {@link ToolCliContext.emitJson}); required so raw-stream host
41
+ * commands (`sessions show`) never fall back to a direct `process.stdout.write`.
42
+ */
43
+ readonly emitJson: (value: unknown) => void;
44
+ /**
45
+ * RAW_STREAM machine-output seam — the host-command mirror of
46
+ * {@link ToolCliContext.emitRaw}. Emits the bare, unwrapped payload for a host
47
+ * command that declares `output:'raw-stream'` (`sessions show --raw`), so it
48
+ * never falls back to a direct `process.stdout.write`; the actual write lives
49
+ * in the single `renderRaw` seam.
50
+ */
51
+ readonly emitRaw: (value: unknown) => void;
52
+ /**
53
+ * Structured-error machine-output seam (launch, §5.5) — the host-command
54
+ * mirror of {@link ToolCliContext.emitError}. A failed `--json` host command
55
+ * (e.g. `sessions show`) emits its diagnosed failure through here so it rides
56
+ * the single `renderOutcome` seam as a `status:'error'` `CommandOutcome`,
57
+ * never a bare `emitJson({ error })`. Sourced from the same context closure as
58
+ * the tool seam, so exit code and reported outcome stay in agreement.
59
+ */
60
+ readonly emitError: (detail: {
61
+ readonly message: string;
62
+ readonly exitCode: number;
63
+ readonly suggestion?: string;
64
+ readonly code?: string;
65
+ }) => void;
66
+ /**
67
+ * Project-local plugin layouts contributed by the registered tools
68
+ * (each tool's `Tool.pluginLayout`). The `plugin` command reads these
69
+ * to know which domains support project-local plugins instead of
70
+ * hardcoding `['fit', 'sim']` — the kernel stays tool-agnostic and the
71
+ * tools remain the single source of truth (ADR-0009 corollary 1).
72
+ */
73
+ readonly pluginLayouts: readonly PluginLayout[];
74
+ /**
75
+ * Per-tool `init`-scaffold contributions (ADR-0038), derived from the tool
76
+ * registry. The `init` command iterates these — each tool's `pluginLayout` +
77
+ * `scaffoldExamples` — instead of hardcoding the fit/sim directories + example
78
+ * content. A tool with no `pluginLayout` contributes nothing (e.g. `graph`).
79
+ */
80
+ readonly toolScaffolds: readonly ToolScaffold[];
81
+ readonly sessionReplayRegistry?: SessionReplayRegistry;
82
+ /**
83
+ * The live tool command specs (each registered tool's `commandSpecs`),
84
+ * supplied by the composition root. The `completion` command derives its
85
+ * shell-completion subcommands + flags from these — the same source of truth
86
+ * the runtime mounts — so the emitted script can never drift from the real
87
+ * tool command surface. Typed structurally ({@link SpecLike}) to keep this
88
+ * module free of the full `CommandSpec` generic. Optional so test harnesses
89
+ * that don't exercise completion can omit it (completion then offers the host
90
+ * surface only).
91
+ */
92
+ readonly toolCommandSpecs?: readonly SpecLike[];
93
+ /**
94
+ * Persistence accessor (thunk). Calling this returns the project-local
95
+ * DataStore, opening it lazily on first access. Commands that don't read
96
+ * the datastore (dry-runs, list-style commands, completion) never trigger
97
+ * the SQLite open and therefore don't materialise `.runtime/`. Loosely
98
+ * typed `unknown` to keep this module free of `@opensip-cli/datastore`
99
+ * at the type level; consumers cast to `DataStore` at use time.
100
+ *
101
+ * Throws when called in a non-project context — CLI commands that need
102
+ * the datastore should already have errored on `project.scope === 'none'`
103
+ * before reaching this call.
104
+ */
105
+ readonly datastore: () => unknown;
106
+ }
107
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC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Aa,EAAE,SAAS,YAAY,EAAE,CAAC;IAChD,QAAQ,CAAC,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IACvD;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAChD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC;CACnC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * shared — the registrar context type used by every CLI-owned (host) command.
3
+ *
4
+ * Launch Phase 6 moved the host commands onto the declarative
5
+ * `CommandSpec` plane (`host-command-specs.ts` / `host-subcommand-groups.ts`),
6
+ * which sources `--cwd` / `--json` from the ADR-0021 common-flag registry
7
+ * directly (via `commonFlags: ['cwd', 'json']`). The former
8
+ * `CWD_OPTION_SPEC` / `JSON_DESC` re-export constants — used only by the
9
+ * deleted `register-*.ts` registrars — are gone; this module now carries just
10
+ * the shared context type.
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `tools data-purge <tool-id>` — per-tool project-data removal (ADR-0042).
3
+ *
4
+ * Rows, never tables: one tool's sessions (payload rows cascade via the
5
+ * schema FK), baseline entries + meta, and tool_state rows, all through
6
+ * repository APIs — no SQL in command code (`restrict-raw-db-access`).
7
+ * Project-scoped by nature (the datastore is per-project). Works for ANY
8
+ * tool id including bundled ones (purging fit history is legitimate).
9
+ *
10
+ * Surface note: the spec drafted `tools data purge` (a nested group); the
11
+ * host group machinery is deliberately one level deep (a nested action-less
12
+ * `data` shell would need its own parity-allowlist entry, completion
13
+ * inventory, and mounter recursion for one leaf), so this ships flattened as
14
+ * `data-purge`. Recorded as a plan deviation.
15
+ */
16
+ import { type DataStore } from '@opensip-cli/datastore';
17
+ import type { ToolsDataPurgeResult } from '@opensip-cli/contracts';
18
+ /** Purge one tool's rows from the project datastore; reports counts. */
19
+ export declare function toolsDataPurge(toolId: string, datastore: DataStore): ToolsDataPurgeResult;
20
+ //# sourceMappingURL=data-purge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-purge.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/data-purge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAgBnE,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,oBAAoB,CAwBzF"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * `tools data-purge <tool-id>` — per-tool project-data removal (ADR-0042).
3
+ *
4
+ * Rows, never tables: one tool's sessions (payload rows cascade via the
5
+ * schema FK), baseline entries + meta, and tool_state rows, all through
6
+ * repository APIs — no SQL in command code (`restrict-raw-db-access`).
7
+ * Project-scoped by nature (the datastore is per-project). Works for ANY
8
+ * tool id including bundled ones (purging fit history is legitimate).
9
+ *
10
+ * Surface note: the spec drafted `tools data purge` (a nested group); the
11
+ * host group machinery is deliberately one level deep (a nested action-less
12
+ * `data` shell would need its own parity-allowlist entry, completion
13
+ * inventory, and mounter recursion for one leaf), so this ships flattened as
14
+ * `data-purge`. Recorded as a plan deviation.
15
+ */
16
+ import { isToolLongId, isToolShortId, TOOL_LONG_TO_SHORT, TOOL_SHORT_TO_LONG, } from '@opensip-cli/core';
17
+ import { BaselineRepo, ToolStateRepo } from '@opensip-cli/datastore';
18
+ import { SessionRepo } from '@opensip-cli/session-store';
19
+ /**
20
+ * Every id form one user-supplied tool id may appear under across the stores.
21
+ * The stores key inconsistently for historical reasons (`core/tools/ids.ts`):
22
+ * sessions key the SHORT form (`fit`); the baseline plane keys the LONG form
23
+ * (`fitness`); tool-state keys whatever the tool passed. Purging clears every
24
+ * form — a per-store key namespace makes clearing an absent form a 0-count
25
+ * no-op, so this is robust rather than wasteful.
26
+ */
27
+ function idFormsFor(toolId) {
28
+ if (isToolLongId(toolId))
29
+ return [...new Set([toolId, TOOL_LONG_TO_SHORT[toolId]])];
30
+ if (isToolShortId(toolId))
31
+ return [...new Set([toolId, TOOL_SHORT_TO_LONG[toolId]])];
32
+ return [toolId];
33
+ }
34
+ /** Purge one tool's rows from the project datastore; reports counts. */
35
+ export function toolsDataPurge(toolId, datastore) {
36
+ const sessionRepo = new SessionRepo(datastore);
37
+ const baselineRepo = new BaselineRepo(datastore);
38
+ const stateRepo = new ToolStateRepo(datastore);
39
+ let sessions = 0;
40
+ let baselineEntries = 0;
41
+ let baselineMeta = false;
42
+ let stateRows = 0;
43
+ for (const form of idFormsFor(toolId)) {
44
+ sessions += sessionRepo.clearForTool(form);
45
+ const baseline = baselineRepo.clear(form);
46
+ baselineEntries += baseline.entries;
47
+ baselineMeta = baselineMeta || baseline.meta;
48
+ stateRows += stateRepo.clear(form);
49
+ }
50
+ return {
51
+ type: 'tools-data-purge',
52
+ toolId,
53
+ sessions,
54
+ baselineEntries,
55
+ baselineMeta,
56
+ stateRows,
57
+ };
58
+ }
59
+ //# sourceMappingURL=data-purge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-purge.js","sourceRoot":"","sources":["../../../src/commands/tools/data-purge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAkB,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzD;;;;;;;GAOG;AACH,SAAS,UAAU,CAAC,MAAc;IAChC,IAAI,YAAY,C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+ * tools — the customer-facing whole-tool management group (ADR-0041).
3
+ *
4
+ * Leaf {@link CommandSpec} builders for the `tools` subcommand group, mounted
5
+ * by `host-subcommand-groups.ts` exactly as the `sessions`/`plugin` groups
6
+ * are. Subcommands ONLY — no flag aliases, no `tool` singular (the parity
7
+ * snapshot pins this). Later phases append leaves here
8
+ * (validate/install/uninstall/data purge).
9
+ */
10
+ import { type CommandSpec } from '@opensip-cli/core';
11
+ import type { CliCommandsContext } from '../shared.js';
12
+ type HostSpec = CommandSpec<unknown, CliCommandsContext>;
13
+ /** Build the `tools` group's leaf specs (consumed by the group mounter). */
14
+ export declare function buildToolsGroupLeaves(ctx: CliCommandsContext): readonly HostSpec[];
15
+ export {};
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAGL,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGvD,KAAK,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AA8MzD,4EAA4E;AAC5E,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,kBAAkB,GAAG,SAAS,QAAQ,EAAE,CAQlF"}
@@ -0,0 +1,213 @@
1
+ /**
2
+ * tools — the customer-facing whole-tool management group (ADR-0041).
3
+ *
4
+ * Leaf {@link CommandSpec} builders for the `tools` subcommand group, mounted
5
+ * by `host-subcommand-groups.ts` exactly as the `sessions`/`plugin` groups
6
+ * are. Subcommands ONLY — no flag aliases, no `tool` singular (the parity
7
+ * snapshot pins this). Later phases append leaves here
8
+ * (validate/install/uninstall/data purge).
9
+ */
10
+ import { EXIT_CODES } from '@opensip-cli/contracts';
11
+ import { currentScope, defineCommand, } from '@opensip-cli/core';
12
+ import { toolsDataPurge } from './data-purge.js';
13
+ import { toolsInstall } from './install.js';
14
+ import { toolsList } from './list.js';
15
+ import { toolsUninstall } from './uninstall.js';
16
+ import { runToolValidation } from './validate.js';
17
+ const COMMAND_RESULT_OUTPUT = 'command-result';
18
+ /**
19
+ * Prefer the discovered project root; fall back to literal cwd; finally
20
+ * process.cwd(). (Local copy of the group module's `effectiveCwd` — importing
21
+ * it from `host-subcommand-groups.ts` would close a module cycle, since that
22
+ * module imports this group's leaves.)
23
+ */
24
+ function effectiveCwd(opts) {
25
+ return opts.projectContext?.projectRoot ?? opts.cwd ?? process.cwd();
26
+ }
27
+ function buildToolsListSpec() {
28
+ return defineCommand({
29
+ name: 'list',
30
+ description: 'List the effective tool set (bundled, global, and project-local)',
31
+ commonFlags: ['json'],
32
+ options: [
33
+ { flag: '--global', description: 'Only user-global installed tools', default: false },
34
+ { flag: '--project', description: 'Only project-local installed tools', default: false },
35
+ ],
36
+ // Listing must work outside a project too (global tools are still
37
+ // visible); the project host dir simply scans empty there.
38
+ scope: 'none',
39
+ output: COMMAND_RESULT_OUTPUT,
40
+ handler: (rawOpts) => {
41
+ const opts = rawOpts;
42
+ // The admitted-tool set is per-run state on the entered RunScope (stamped
43
+ // by the bootstrap), read here and passed into the pure `toolsList`.
44
+ const scope = currentScope();
45
+ return Promise.resolve(toolsList({
46
+ cwd: effectiveCwd(opts),
47
+ global: opts.global,
48
+ project: opts.project,
49
+ provenance: scope?.toolProvenance ?? [],
50
+ manifests: scope?.toolManifests ?? [],
51
+ }));
52
+ },
53
+ });
54
+ }
55
+ function buildToolsValidateSpec(ctx) {
56
+ return defineCommand({
57
+ name: 'validate',
58
+ description: 'Validate a tool package against the Tool contract (runs the package module — see docs)',
59
+ commonFlags: ['json'],
60
+ args: [{ name: 'spec', description: 'npm spec, tarball, or local directory path' }],
61
+ options: [
62
+ {
63
+ flag: '--install-deps',
64
+ description: 'For a local path: stage via npm install so the runtime sections can load',
65
+ default: false,
66
+ },
67
+ ],
68
+ scope: 'none',
69
+ output: COMMAND_RESULT_OUTPUT,
70
+ handler: async (rawOpts) => {
71
+ const opts = rawOpts;
72
+ const spec = opts._args[0] ?? '';
73
+ const { result } = await runToolValidation({
74
+ spec,
75
+ cwd: effectiveCwd(opts),
76
+ installDeps: opts.installDeps,
77
+ });
78
+ if (result.verdict !== 'passed')
79
+ ctx.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
80
+ return result;
81
+ },
82
+ });
83
+ }
84
+ function buildToolsInstallSpec(ctx) {
85
+ return defineCommand({
86
+ name: 'install',
87
+ description: 'Validate, then install a tool package (global by default; see tools validate)',
88
+ commonFlags: ['json'],
89
+ args: [{ name: 'spec', description: 'npm spec, tarball, or local directory path' }],
90
+ options: [
91
+ { flag: '--global', description: 'Install user-global (the default)', default: false },
92
+ {
93
+ flag: '--project',
94
+ description: 'Install into this project’s runtime tool host instead',
95
+ default: false,
96
+ },
97
+ ],
98
+ scope: 'none',
99
+ output: COMMAND_RESULT_OUTPUT,
100
+ handler: async (rawOpts) => {
101
+ const opts = rawOpts;
102
+ if (opts.global === true && opts.project === true) {
103
+ ctx.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
104
+ return {
105
+ type: 'tools-uninstall',
106
+ target: opts._args[0] ?? '',
107
+ success: false,
108
+ error: '--global and --project are mutually exclusive',
109
+ };
110
+ }
111
+ const result = await toolsInstall({
112
+ spec: opts._args[0] ?? '',
113
+ cwd: effectiveCwd(opts),
114
+ project: opts.project,
115
+ });
116
+ if (!result.success)
117
+ ctx.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
118
+ return result;
119
+ },
120
+ });
121
+ }
122
+ function buildToolsUninstallSpec(ctx) {
123
+ return defineCommand({
124
+ name: 'uninstall',
125
+ description: 'Uninstall a tool by id or package name (never deletes project SQLite data)',
126
+ commonFlags: ['json'],
127
+ args: [{ name: 'name-or-id', description: 'Tool id or npm package name' }],
128
+ options: [
129
+ { flag: '--global', description: 'Target the user-global install', default: false },
130
+ { flag: '--project', description: 'Target the project-local install', default: false },
131
+ {
132
+ flag: '--purge-data',
133
+ description: 'Also purge the tool’s project SQLite rows (project scope only)',
134
+ default: false,
135
+ },
136
+ ],
137
+ scope: 'none',
138
+ output: COMMAND_RESULT_OUTPUT,
139
+ // eslint-disable-next-line @typescript-eslint/require-await -- async keeps the CommandSpec handler signature; the bodies are synchronous SQLite + fs
140
+ handler: async (rawOpts) => {
141
+ const opts = rawOpts;
142
+ // --purge-data is project-local only: runtime data lives per project
143
+ // (the spec's explicit rejection for --global).
144
+ if (opts.purgeData === true && opts.global === true) {
145
+ ctx.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
146
+ return {
147
+ type: 'tools-uninstall',
148
+ target: opts._args[0] ?? '',
149
+ success: false,
150
+ error: '--purge-data is project-local only (runtime data lives per project); it cannot combine with --global',
151
+ };
152
+ }
153
+ const result = toolsUninstall({
154
+ target: opts._args[0] ?? '',
155
+ cwd: effectiveCwd(opts),
156
+ global: opts.global,
157
+ project: opts.project,
158
+ // Per-run admitted-tool provenance (bundled-id guard) from the scope.
159
+ provenance: currentScope()?.toolProvenance ?? [],
160
+ });
161
+ if (!result.success) {
162
+ ctx.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
163
+ return result;
164
+ }
165
+ if (opts.purgeData === true && result.removed?.scope === 'project') {
166
+ const datastore = ctx.datastore();
167
+ if (datastore !== undefined) {
168
+ // Purge AFTER a successful project uninstall; counts ride stderr so
169
+ // the uninstall result stays the command's one payload.
170
+ const purge = toolsDataPurge(result.removed.id, datastore);
171
+ process.stderr.write(`opensip: purged ${purge.sessions} session(s), ${purge.baselineEntries} baseline entr(ies), ` +
172
+ `${purge.stateRows} state row(s) for '${purge.toolId}'\n`);
173
+ }
174
+ }
175
+ return result;
176
+ },
177
+ });
178
+ }
179
+ function buildToolsDataPurgeSpec(ctx) {
180
+ return defineCommand({
181
+ name: 'data-purge',
182
+ description: 'Delete one tool’s project SQLite rows (sessions, baselines, state) — never tables',
183
+ commonFlags: ['json'],
184
+ args: [{ name: 'tool-id', description: 'The tool id whose rows to delete' }],
185
+ scope: 'project',
186
+ output: COMMAND_RESULT_OUTPUT,
187
+ handler: (rawOpts) => {
188
+ const opts = rawOpts;
189
+ const datastore = ctx.datastore();
190
+ if (datastore === undefined) {
191
+ ctx.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
192
+ return Promise.resolve({
193
+ type: 'tools-uninstall',
194
+ target: opts._args[0] ?? '',
195
+ success: false,
196
+ error: 'tools data-purge requires the project datastore (run inside a project)',
197
+ });
198
+ }
199
+ return Promise.resolve(toolsDataPurge(opts._args[0] ?? '', datastore));
200
+ },
201
+ });
202
+ }
203
+ /** Build the `tools` group's leaf specs (consumed by the group mounter). */
204
+ export function buildToolsGroupLeaves(ctx) {
205
+ return [
206
+ buildToolsListSpec(),
207
+ buildToolsValidateSpec(ctx),
208
+ buildToolsInstallSpec(ctx),
209
+ buildToolsUninstallSpec(ctx),
210
+ buildToolsDataPurgeSpec(ctx),
211
+ ];
212
+ }
213
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAsB,MAAM,wBAAwB,CAAC;AACxE,OAAO,EACL,YAAY,EACZ,aAAa,GAGd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAMlD,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAS/C;;;;;GAKG;AACH,SAAS,YAAY,CAAC,IAAqB;IACzC,OAAO,IAAI,CAAC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4E;AAC5E,MAAM,UAAU,qBAAqB,CAAC,GAAuB;IAC3D,OAAO;QACL,kBAAkB,EAAE;QACpB,sBAAsB,CAAC,GAAG,CAAC;QAC3B,qBAAqB,CAAC,GAAG,CAAC;QAC1B,uBAAuB,CAAC,GAAG,CAAC;QAC5B,uBAAuB,CAAC,GAAG,CAAC;KAC7B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `tools install` — atomic stage → validate → activate (ADR-0041).
3
+ *
4
+ * The candidate stages into a temp host (npm `--ignore-scripts`) and the FULL
5
+ * validation (`runToolValidation`, keepStaged) runs against the staged bytes.
6
+ * Only a `passed` verdict activates — and activation installs a tarball
7
+ * `npm pack`ed FROM THE STAGED DIR, never a re-resolve of the original spec
8
+ * (a registry re-resolve between validate and activate could deliver
9
+ * different bytes than the ones validated; and `npm install <dir>` would
10
+ * symlink the about-to-be-deleted temp host). A failed install leaves no
11
+ * discoverable tool behind: the temp host is removed in `finally` and the
12
+ * scope host is never touched.
13
+ */
14
+ import type { ToolsInstallResult } from '@opensip-cli/contracts';
15
+ /** Options for {@link toolsInstall}. */
16
+ export interface ToolsInstallOptions {
17
+ readonly spec: string;
18
+ readonly cwd: string;
19
+ /** Install into the project `.runtime` tool host instead of user-global. */
20
+ readonly project?: boolean;
21
+ }
22
+ /** Stage, validate, and (on a `passed` verdict only) activate one tool package. */
23
+ export declare function toolsInstall(opts: ToolsInstallOptions): Promise<ToolsInstallResult>;
24
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAaD,mFAAmF;AACnF,wBAAsB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA0DzF"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * `tools install` — atomic stage → validate → activate (ADR-0041).
3
+ *
4
+ * The candidate stages into a temp host (npm `--ignore-scripts`) and the FULL
5
+ * validation (`runToolValidation`, keepStaged) runs against the staged bytes.
6
+ * Only a `passed` verdict activates — and activation installs a tarball
7
+ * `npm pack`ed FROM THE STAGED DIR, never a re-resolve of the original spec
8
+ * (a registry re-resolve between validate and activate could deliver
9
+ * different bytes than the ones validated; and `npm install <dir>` would
10
+ * symlink the about-to-be-deleted temp host). A failed install leaves no
11
+ * discoverable tool behind: the temp host is removed in `finally` and the
12
+ * scope host is never touched.
13
+ */
14
+ import { execFileSync } from 'node:child_process';
15
+ import { admitToolPackage } from '../../bootstrap/admit-tool-package.js';
16
+ import { addToolPlugin } from '../plugin-host-ops.js';
17
+ import { runToolValidation } from './validate.js';
18
+ /** Pack the staged package dir into a tarball beside it; returns the tarball path. */
19
+ function packStagedDir(stagedPkgDir) {
20
+ const out = execFileSync('npm', ['pack', '--pack-destination', stagedPkgDir, '.'], {
21
+ cwd: stagedPkgDir,
22
+ encoding: 'utf8',
23
+ stdio: ['ignore', 'pipe', process.stderr],
24
+ });
25
+ const name = out.trim().split('\n').at(-1)?.trim() ?? '';
26
+ return `${stagedPkgDir}/${name}`;
27
+ }
28
+ /** Stage, validate, and (on a `passed` verdict only) activate one tool package. */
29
+ export async function toolsInstall(opts) {
30
+ const scope = opts.project === true ? 'project' : 'global';
31
+ const { result, stagedPkgDir, cleanup } = await runToolValidation({ spec: opts.spec, cwd: opts.cwd, installDeps: true }, { keepStaged: true });
32
+ try {
33
+ if (result.verdict !== 'passed') {
34
+ return { type: 'tools-install', spec: opts.spec, success: false, scope, validation: result };
35
+ }
36
+ /* v8 ignore next 9 -- defensive: a passed verdict from a keepStaged run always carries the staged dir */
37
+ if (stagedPkgDir === undefined) {
38
+ return {
39
+ type: 'tools-install',
40
+ spec: opts.spec,
41
+ success: false,
42
+ scope,
43
+ validation: result,
44
+ error: 'validation passed but no staged package dir was retained',
45
+ };
46
+ }
47
+ // Activate the VALIDATED bytes: pack the staged dir, install the tarball.
48
+ const tarball = packStagedDir(stagedPkgDir);
49
+ const activation = addToolPlugin(tarball, opts.cwd, opts.project === true);
50
+ if (activation.type !== 'plugin-add' || activation.success !== true) {
51
+ const error = 'error' in activation ? (activation.error ?? 'activation failed') : 'activation failed';
52
+ return {
53
+ type: 'tools-install',
54
+ spec: opts.spec,
55
+ success: false,
56
+ scope,
57
+ validation: result,
58
+ error,
59
+ };
60
+ }
61
+ // Inventory row from the ACTIVATED install (manifest file read — no import).
62
+ const report = await admitToolPackage({
63
+ dir: stagedPkgDir,
64
+ source: 'installed',
65
+ explicitlyRequested: true,
66
+ staticOnly: true,
67
+ });
68
+ return {
69
+ type: 'tools-install',
70
+ spec: opts.spec,
71
+ success: true,
72
+ scope,
73
+ validation: result,
74
+ ...(report.manifest === undefined
75
+ ? {}
76
+ : { toolId: report.manifest.id, version: report.manifest.version }),
77
+ };
78
+ }
79
+ finally {
80
+ cleanup();
81
+ }
82
+ }
83
+ //# sourceMappingURL=install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/tools/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAYlD,sFAAsF;AACtF,SAAS,aAAa,CAAC,YA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CAAC;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,41 @@
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 { type ToolPluginManifest, type ToolProvenance } from '@opensip-cli/core';
23
+ import type { ToolsListResult } from '@opensip-cli/contracts';
24
+ /** Options for {@link toolsList}. */
25
+ export interface ToolsListOptions {
26
+ readonly cwd: string;
27
+ /** Restrict to one install scope (mutually exclusive; neither = effective set). */
28
+ readonly global?: boolean;
29
+ readonly project?: boolean;
30
+ /**
31
+ * The admitted-tool provenance + manifests for this run (paired index-wise),
32
+ * read by the command handler from the entered RunScope and passed in so this
33
+ * function stays a pure function of its inputs. Default `[]` (no admitted set
34
+ * — e.g. an isolated unit test).
35
+ */
36
+ readonly provenance?: readonly ToolProvenance[];
37
+ readonly manifests?: readonly ToolPluginManifest[];
38
+ }
39
+ /** Build the effective tool inventory. Read-only; never imports a runtime. */
40
+ export declare function toolsList(opts: ToolsListOptions): ToolsListResult;
41
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/tools/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,wBAAwB,CAAC;AAK5E,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACpD;AAwBD,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,eAAe,CA2DjE"}