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,331 @@
1
+ /**
2
+ * host-command-specs — the CLI-owned (host) commands expressed as declarative
3
+ * {@link CommandSpec}s, mounted through the SAME `mountCommandSpec` plane the
4
+ * tools use (launch Phase 6).
5
+ *
6
+ * Host commands (`init` / `configure` / `sessions` / `plugin` / `report` /
7
+ * `completion` / `uninstall`) are NOT tool plugins — they don't ride on a
8
+ * `Tool.commandSpecs` and aren't discovered. But making them mount via the same
9
+ * `mountCommandSpec` means the Phase 7 `command-surface-parity` guardrail sees
10
+ * ONE uniform command surface: there is no second, more-privileged
11
+ * raw-Commander path for "blessed" CLI-owned commands.
12
+ *
13
+ * Each spec's handler closes over the per-invocation {@link CliCommandsContext}
14
+ * (render / setExitCode / datastore thunk / pluginLayouts) — the same data the
15
+ * former `register-*.ts` registrars threaded in. The handler signature's `TCtx`
16
+ * is `CliCommandsContext`; the mount layer only reaches for `render` /
17
+ * `setExitCode` (the `command-result` + thrown-`ToolError` arms) — the
18
+ * `signal-envelope` / `live-view` arms are never exercised by a host command, so
19
+ * `CliCommandsContext` is a valid (leaner) `CommandMountContext`.
20
+ *
21
+ * The two action-less subcommand GROUPS (`sessions`, `plugin`) and their leaf
22
+ * specs live in `host-subcommand-groups.ts` (a leaf module that lets
23
+ * `completion.ts` source its sub-subcommand names without a module cycle). This
24
+ * module assembles the TOP-LEVEL specs and mounts the whole surface.
25
+ *
26
+ * Specs are built per-invocation (inside the builders below, not at module
27
+ * load) so the `--cwd` defaults that resolve to `process.cwd()` are evaluated
28
+ * fresh each run — byte-identical to the former
29
+ * `.option(spec, desc, process.cwd())` registrars.
30
+ */
31
+ import { EXIT_CODES } from '@opensip-cli/contracts';
32
+ import { ConfigurationError, defineCommand } from '@opensip-cli/core';
33
+ import { composeAndWriteReport } from '../report-compose.js';
34
+ import { executeAgentCatalog } from './agent-catalog.js';
35
+ import { assembleCompletionInventory, printCompletionScript, } from './completion.js';
36
+ import { executeConfigure } from './configure.js';
37
+ import { buildHostSubcommandGroups } from './host-subcommand-groups.js';
38
+ import { executeInit } from './init.js';
39
+ import { mountCommandSpec } from './mount-command-spec.js';
40
+ import { executeUninstall } from './uninstall.js';
41
+ /** Shared `output` mode for the host commands that return a renderable result. */
42
+ const COMMAND_RESULT = 'command-result';
43
+ function buildInitSpec(ctx) {
44
+ return defineCommand({
45
+ name: 'init',
46
+ description: 'Scaffold opensip-cli.config.yml + example checks/scenarios for your project',
47
+ // `--cwd` here matches the registry text ("Target directory"); `--json` /
48
+ // `--debug` match the registry too, so they ride the common-flag path.
49
+ commonFlags: ['cwd', 'json', 'debug'],
50
+ options: [
51
+ {
52
+ flag: '--language',
53
+ value: '<list>',
54
+ description: 'Language list (typescript|rust|python|go|java|cpp), repeatable or comma-separated. Default: detect from filesystem markers.',
55
+ arrayDefault: [],
56
+ parse: (val, prev) => [...prev, val],
57
+ },
58
+ {
59
+ flag: '--keep',
60
+ description: 'Re-scaffold example files. Preserve any custom files in opensip-cli/.',
61
+ default: false,
62
+ },
63
+ {
64
+ flag: '--remove',
65
+ description: 'Delete opensip-cli/ entirely, then scaffold fresh.',
66
+ default: false,
67
+ },
68
+ ],
69
+ scope: 'project',
70
+ output: COMMAND_RESULT,
71
+ handler: (rawOpts) => {
72
+ const opts = rawOpts;
73
+ // `cwdExplicit` is stashed on opts by the pre-action hook (the single
74
+ // source for "was --cwd typed on the CLI?"); the former register-init
75
+ // recomputed `cmd.getOptionValueSource('cwd') === 'cli'` on its own
76
+ // Commander command — identical, since the hook's actionCommand IS init.
77
+ const result = executeInit({
78
+ ...opts,
79
+ cwdExplicit: opts.cwdExplicit === true,
80
+ toolScaffolds: ctx.toolScaffolds,
81
+ });
82
+ // Exit 2 for any non-success path the user can act on: ambiguous-language
83
+ // detection, partial-state refusal, mutex flag error, inside-existing-
84
+ // project refusal.
85
+ if (result.ambiguousLanguageError ||
86
+ result.partialStateError ||
87
+ result.insideExistingProject) {
88
+ ctx.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
89
+ }
90
+ return result;
91
+ },
92
+ });
93
+ }
94
+ // ---------------------------------------------------------------------------
95
+ // configure
96
+ // ---------------------------------------------------------------------------
97
+ function buildConfigureSpec() {
98
+ return defineCommand({
99
+ name: 'configure',
100
+ description: 'Set up OpenSIP Cloud API key',
101
+ commonFlags: ['json', 'debug'],
102
+ scope: 'none',
103
+ output: COMMAND_RESULT,
104
+ handler: () => executeConfigure(),
105
+ });
106
+ }
107
+ // ---------------------------------------------------------------------------
108
+ // report (CLI-owned composition root)
109
+ // ---------------------------------------------------------------------------
110
+ function buildReportSpec() {
111
+ return defineCommand({
112
+ name: 'report',
113
+ description: 'Generate the cross-tool HTML report and open it in your browser',
114
+ commonFlags: ['json'],
115
+ options: [
116
+ {
117
+ flag: '--no-open',
118
+ description: 'Write the report but do not launch a browser',
119
+ negatable: true,
120
+ },
121
+ ],
122
+ scope: 'project',
123
+ output: COMMAND_RESULT,
124
+ handler: (rawOpts) => {
125
+ const opts = rawOpts;
126
+ // Commander stores `--no-open` as `opts.open === false`; default true.
127
+ // In `--json` mode we never launch a browser (machine-output contract).
128
+ return composeAndWriteReport({ open: opts.open && !opts.json });
129
+ },
130
+ });
131
+ }
132
+ // ---------------------------------------------------------------------------
133
+ // completion
134
+ // ---------------------------------------------------------------------------
135
+ function buildCompletionSpec(ctx) {
136
+ return defineCommand({
137
+ name: 'completion',
138
+ description: 'Print a shell-completion script (bash | zsh | fish)',
139
+ commonFlags: [],
140
+ // Empty description: the former `.command('completion <shell>')` declared
141
+ // the positional inline with no help text — no "Arguments:" block. Keeping
142
+ // it empty preserves the byte-identical --help.
143
+ args: [{ name: 'shell', description: '' }],
144
+ scope: 'none',
145
+ // The handler writes the completion script straight to stdout (no Ink) and
146
+ // owns its own exit-code decision — the documented raw-stream exception.
147
+ output: 'raw-stream',
148
+ rawStreamReason: 'completion-script',
149
+ handler: (rawOpts) => {
150
+ const opts = rawOpts;
151
+ const shell = opts._args[0];
152
+ const normalized = shell.toLowerCase();
153
+ if (normalized !== 'bash' && normalized !== 'zsh' && normalized !== 'fish') {
154
+ process.stderr.write(`Unsupported shell: ${shell}. Expected one of: bash, zsh, fish.\n`);
155
+ ctx.setExitCode(EXIT_CODES.CONFIGURATION_ERROR);
156
+ return;
157
+ }
158
+ // Derive the completion surface from the live specs: the tool commands
159
+ // (supplied by the composition root via `ctx.toolCommandSpecs`), the
160
+ // top-level host commands, and the action-less groups. Single source of
161
+ // truth — the emitted script tracks the real command surface.
162
+ //
163
+ // The host surface is read via {@link buildHostCompletionSurface}, NOT
164
+ // `buildTopLevelHostSpecs`: that assembly includes `buildCompletionSpec`,
165
+ // so calling it from this handler would form a `buildCompletionSpec →
166
+ // buildTopLevelHostSpecs → buildCompletionSpec` call cycle. The surface
167
+ // helper derives the same `SpecLike` views WITHOUT rebuilding the
168
+ // completion spec (it contributes a static, options-free descriptor for
169
+ // itself), keeping the dependency one-directional.
170
+ const host = buildHostCompletionSurface(ctx);
171
+ const inventory = assembleCompletionInventory({
172
+ toolSpecs: ctx.toolCommandSpecs ?? [],
173
+ hostSpecs: host.specs,
174
+ groups: host.groups,
175
+ });
176
+ printCompletionScript(normalized, inventory);
177
+ },
178
+ });
179
+ }
180
+ function buildUninstallSpec() {
181
+ return defineCommand({
182
+ name: 'uninstall',
183
+ description: 'Remove user-level config at ~/.opensip-cli/ (cloud API key, defaults). Use --project to remove project-local state instead.',
184
+ commonFlags: [],
185
+ options: [
186
+ { flag: '-y, --yes', description: 'Skip confirmation prompt', default: false },
187
+ {
188
+ flag: '--dry-run',
189
+ description: 'Print what would be removed; take no action',
190
+ default: false,
191
+ },
192
+ {
193
+ flag: '--user',
194
+ description: 'Remove user-level config at ~/.opensip-cli/ (default mode)',
195
+ default: false,
196
+ },
197
+ {
198
+ flag: '--project',
199
+ value: '[path]',
200
+ description: 'Remove project-local runtime state at [path] (defaults to cwd). User content + config preserved unless --purge.',
201
+ },
202
+ {
203
+ flag: '--purge',
204
+ description: 'With --project, also remove user-authored content and opensip-cli.config.yml (DESTRUCTIVE)',
205
+ default: false,
206
+ },
207
+ { flag: '--json', description: 'Output structured JSON', default: false },
208
+ ],
209
+ scope: 'project',
210
+ output: COMMAND_RESULT,
211
+ handler: (rawOpts) => {
212
+ const opts = rawOpts;
213
+ if (opts.user === true && opts.project !== undefined) {
214
+ throw new ConfigurationError('uninstall: --user and --project are mutually exclusive.');
215
+ }
216
+ // Commander passes `true` when the flag is present without a value, a
217
+ // string when given a value, or undefined when omitted.
218
+ let project;
219
+ if (opts.project === true)
220
+ project = true;
221
+ else if (typeof opts.project === 'string')
222
+ project = opts.project;
223
+ return executeUninstall({
224
+ yes: opts.yes,
225
+ dryRun: opts.dryRun,
226
+ project,
227
+ purge: opts.purge,
228
+ projectContext: opts.projectContext,
229
+ });
230
+ },
231
+ });
232
+ }
233
+ // ---------------------------------------------------------------------------
234
+ // agent-catalog (agent-first discovery surface)
235
+ // ---------------------------------------------------------------------------
236
+ function buildAgentCatalogSpec() {
237
+ return defineCommand({
238
+ name: 'agent-catalog',
239
+ description: 'Structured catalog of agent-friendly commands, patterns, and output shapes (JSON preferred). ' +
240
+ 'Primary surface for AI agents to bootstrap usage of sessions, filtering, and historical results.',
241
+ commonFlags: ['json'],
242
+ scope: 'none',
243
+ output: COMMAND_RESULT,
244
+ handler: (rawOpts) => {
245
+ const opts = rawOpts;
246
+ return executeAgentCatalog({ json: opts.json });
247
+ },
248
+ });
249
+ }
250
+ // ---------------------------------------------------------------------------
251
+ // Assembly + mount
252
+ // ---------------------------------------------------------------------------
253
+ /**
254
+ * The `completion` command's own completion surface — a static, options-free
255
+ * `SpecLike`. The command declares `commonFlags: []` and no options (only a
256
+ * positional `<shell>` arg, which is not a flag), so this descriptor is an
257
+ * exact, drift-free stand-in for it in the inventory. Hand-declaring it here
258
+ * (rather than calling `buildCompletionSpec`) is what keeps the completion
259
+ * handler from depending back on its own builder — breaking the
260
+ * `buildCompletionSpec → buildTopLevelHostSpecs → buildCompletionSpec` cycle at
261
+ * the root rather than suppressing it.
262
+ */
263
+ const COMPLETION_SELF_SPEC = { name: 'completion', commonFlags: [] };
264
+ /**
265
+ * The top-level host specs EXCEPT `completion`. The shared leaf both
266
+ * {@link buildTopLevelHostSpecs} (which splices the completion spec back in at
267
+ * its canonical position) and {@link buildHostCompletionSurface} depend on. It
268
+ * calls neither {@link buildCompletionSpec} nor `buildTopLevelHostSpecs`, so
269
+ * neither caller can form a call cycle back through the completion handler.
270
+ */
271
+ function buildNonCompletionHostSpecs(ctx) {
272
+ return [
273
+ buildInitSpec(ctx),
274
+ buildReportSpec(),
275
+ buildConfigureSpec(),
276
+ buildAgentCatalogSpec(),
277
+ buildUninstallSpec(),
278
+ ];
279
+ }
280
+ /**
281
+ * The host portion of the completion inventory: the `SpecLike` views of every
282
+ * top-level host command and the action-less groups. The completion command's
283
+ * own surface is the static {@link COMPLETION_SELF_SPEC} stand-in; every OTHER
284
+ * host command is read from its live spec (so its flags can't drift). Consumed
285
+ * by the `completion` handler INSTEAD of {@link buildTopLevelHostSpecs}, so the
286
+ * handler never depends back on {@link buildCompletionSpec}.
287
+ *
288
+ * Order is irrelevant here — the inventory subcommand list is sorted — so the
289
+ * static completion descriptor is simply appended.
290
+ */
291
+ function buildHostCompletionSurface(ctx) {
292
+ return {
293
+ specs: [...buildNonCompletionHostSpecs(ctx), COMPLETION_SELF_SPEC],
294
+ groups: buildHostSubcommandGroups(ctx),
295
+ };
296
+ }
297
+ /**
298
+ * Build the top-level (non-grouped) host command specs. Exported so tests can
299
+ * inspect the host command surface that the host mounts (single source). The
300
+ * `completion` spec keeps its canonical position (after `configure`, before
301
+ * `uninstall`) so the mounted command order — and thus `--help` ordering — is
302
+ * byte-identical to before the cycle-breaking split.
303
+ */
304
+ export function buildTopLevelHostSpecs(ctx) {
305
+ return [
306
+ buildInitSpec(ctx),
307
+ buildReportSpec(),
308
+ buildConfigureSpec(),
309
+ buildAgentCatalogSpec(),
310
+ buildCompletionSpec(ctx),
311
+ buildUninstallSpec(),
312
+ ];
313
+ }
314
+ /**
315
+ * Mount every host command onto `program` through the shared `mountCommandSpec`
316
+ * plane. Top-level specs mount directly; each subcommand group becomes a raw
317
+ * action-less parent (the documented exception) onto which its leaf specs mount
318
+ * via the same `mountCommandSpec`.
319
+ */
320
+ export function mountHostCommands(program, ctx) {
321
+ for (const spec of buildTopLevelHostSpecs(ctx)) {
322
+ mountCommandSpec(program, spec, ctx);
323
+ }
324
+ for (const group of buildHostSubcommandGroups(ctx)) {
325
+ const parent = program.command(group.name).description(group.description);
326
+ for (const leaf of group.leaves) {
327
+ mountCommandSpec(parent, leaf, ctx);
328
+ }
329
+ }
330
+ }
331
+ //# sourceMappingURL=host-command-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-command-specs.js","sourceRoot":"","sources":["../../src/commands/host-command-specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAuB,MAAM,mBAAmB,CAAC;AAE3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,C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IzD,OAAO;QACL,KAAK,EAAE,CAAC,GAAG,2BAA2B,CAAC,GAAG,CAAC,EAAE,oBAAoB,CAAC;QAClE,MAAM,EAAE,yBAAyB,CAAC,GAAG,CAAC;KACvC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAuB;IAC5D,OAAO;QACL,aAAa,CAAC,GAAG,CAAC;QAClB,eAAe,EAAE;QACjB,kBAAkB,EAAE;QACpB,qBAAqB,EAAE;QACvB,mBAAmB,CAAC,GAAG,CAAC;QACxB,kBAAkB,EAAE;KACrB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAmB,EAAE,GAAuB;IAC5E,KAAK,MAAM,IAAI,IAAI,sBAAsB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,yBAAyB,CAAC,GAAG,CAAC,EAAE,CAAC;QACnD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC1E,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAChC,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * host-subcommand-groups — the action-less Commander subcommand GROUPS
3
+ * (`sessions`, `plugin`) and their leaf {@link CommandSpec}s (launch
4
+ * Phase 6).
5
+ *
6
+ * Split out of `host-command-specs.ts` for ONE reason: to break a module cycle.
7
+ * The completion-script generator (`completion.ts`) sources its `plugin` /
8
+ * `sessions` sub-subcommand NAME lists from the live leaf specs (single source —
9
+ * Phase 6 Task 6.2), so it must import the group inventory. The
10
+ * `host-command-specs.ts` module, in turn, imports `printCompletionScript` from
11
+ * `completion.ts` for the `completion` command's handler. Housing the GROUP
12
+ * leaves + inventory here (a module that imports NEITHER `completion.ts` nor
13
+ * `host-command-specs.ts`) lets both depend on this leaf module without a cycle.
14
+ *
15
+ * The two parents are action-less GROUPS — a parent with no action body is not
16
+ * a single mountable `CommandSpec`, so it stays a raw `program.command(name)`
17
+ * shell (the FINITE, NAMED documented exceptions for the Phase 7
18
+ * `command-surface-parity` guardrail's allow-list, see {@link HOST_SUBCOMMAND_GROUPS}).
19
+ * Their LEAVES (`sessions list|purge`, `plugin list|add|remove|sync`) ARE specs.
20
+ */
21
+ import { type CommandSpec, type ProjectContext } from '@opensip-cli/core';
22
+ import type { CliCommandsContext } from './shared.js';
23
+ /** A host command spec — handler receives the {@link CliCommandsContext}. */
24
+ export type HostSpec = CommandSpec<unknown, CliCommandsContext>;
25
+ /** Prefer the discovered project root; fall back to literal cwd; finally process.cwd(). */
26
+ export declare function effectiveCwd(opts: {
27
+ cwd?: string;
28
+ projectContext?: ProjectContext;
29
+ }): string;
30
+ /** One subcommand-group parent: a raw action-less `program.command(name)`
31
+ * shell + the leaf specs that mount onto it. */
32
+ export interface HostSubcommandGroup {
33
+ readonly name: string;
34
+ readonly description: string;
35
+ readonly leaves: readonly HostSpec[];
36
+ }
37
+ /**
38
+ * The action-less Commander subcommand GROUPS that legitimately cannot be a
39
+ * single {@link CommandSpec} — they have no action body, only sub-subcommands.
40
+ * This is the FINITE, NAMED set the Phase 7 `command-surface-parity` guardrail
41
+ * allow-lists as documented host exceptions. Every other host command IS a spec.
42
+ */
43
+ export declare const HOST_SUBCOMMAND_GROUPS: readonly string[];
44
+ /**
45
+ * Build the subcommand-group parents with their leaf specs. The mounter turns
46
+ * each into a raw parent `program.command(name)` plus `mountCommandSpec(parent,
47
+ * leaf)` for each leaf.
48
+ */
49
+ export declare function buildHostSubcommandGroups(ctx: CliCommandsContext): readonly HostSubcommandGroup[];
50
+ /**
51
+ * The host subcommand-group NAME inventory derived from the live leaf specs —
52
+ * the single source the shell-completion script (`completion.ts`) reads for the
53
+ * `plugin` / `sessions` sub-subcommand names instead of a second hand-maintained
54
+ * list (Phase 6 Task 6.2).
55
+ *
56
+ * NOTE: only the NAME lists are sourced here — the curated per-command flag
57
+ * subsets the completion script offers stay in `completion.ts`, since
58
+ * exhaustively deriving every declared flag would change the emitted script. The
59
+ * common flags themselves already derive from the shared ADR-0021 registry (the
60
+ * same registry the specs' `commonFlags` resolve through), so that half is
61
+ * already single-sourced.
62
+ */
63
+ export interface HostCommandInventory {
64
+ /** Sub-subcommand names per group (`{ sessions: ['list','purge'], plugin: [...] }`). */
65
+ readonly groupSubcommands: Readonly<Record<string, readonly string[]>>;
66
+ }
67
+ /** Build the host subcommand-group name inventory (single source for completion). */
68
+ export declare function buildHostCommandInventory(): HostCommandInventory;
69
+ //# sourceMappingURL=host-subcommand-groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-subcommand-groups.d.ts","sourceRoot":"","sources":["../../src/commands/host-subcommand-groups.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,cAAc,EAEpB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,6EAA6E;AAC7E,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;AAWhE,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,cAAc,CAAA;CAAE,GAAG,MAAM,CAE5F;AAuTD;iDACiD;AACjD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC;CACtC;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAA6C,CAAC;AAElG;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,kBAAkB,GAAG,SAAS,mBAAmB,EAAE,CAuBjG;AA4BD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAoB;IACnC,wFAAwF;IACxF,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;CACxE;AAED,qFAAqF;AACrF,wBAAgB,yBAAyB,IAAI,oBAAoB,CAMhE"}