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,90 @@
1
+ /**
2
+ * @fileoverview Shell-completion script generator.
3
+ *
4
+ * Emits a sourceable completion script for bash, zsh, or fish that the
5
+ * user drops into their shell init (or pipes directly into their
6
+ * current shell to try it out).
7
+ *
8
+ * Usage:
9
+ * opensip completion bash >> ~/.bashrc
10
+ * opensip completion zsh >> ~/.zshrc
11
+ * opensip completion fish > ~/.config/fish/completions/opensip.fish
12
+ *
13
+ * The emitted scripts are static — the user's shell sources them once, so
14
+ * they complete fixed subcommand / flag names rather than querying the CLI
15
+ * per keystroke (fast, portable, no version skew). What is NOT static is
16
+ * how those names are produced: the subcommand list and each command's
17
+ * flags are DERIVED from the live `CommandSpec`s at generation time (see
18
+ * {@link CompletionInventory} / the `completion` command handler), so the
19
+ * script can never drift from the real command surface the way a
20
+ * hand-maintained flag list does. If dynamic value completion (e.g.
21
+ * matching existing check slugs) is ever needed, that's an additive change
22
+ * that can query `opensip fit --list` at completion time.
23
+ */
24
+ import { type CommonFlagKey } from '@opensip-cli/contracts';
25
+ export type Shell = 'bash' | 'zsh' | 'fish';
26
+ /**
27
+ * Internal/machine-facing command names never offered in shell completion.
28
+ * These are spawned by the host (sharded build, off-process engine workers,
29
+ * machine exports), never typed by a user. Single source for both the
30
+ * inventory builder and the drift test.
31
+ */
32
+ export declare const INTERNAL_COMMANDS: ReadonlySet<string>;
33
+ /**
34
+ * The derived completion surface, assembled from the live `CommandSpec`s by
35
+ * {@link assembleCompletionInventory}. Everything the emitted script needs to
36
+ * know about the command surface lives here — there are no hand-maintained
37
+ * flag lists anymore.
38
+ */
39
+ export interface CompletionInventory {
40
+ /** User-facing top-level command names (incl. aliases + `help`). */
41
+ readonly subcommands: readonly string[];
42
+ /** Per-command long-flag list, keyed by command name (and alias). */
43
+ readonly commandFlags: Readonly<Record<string, readonly string[]>>;
44
+ /** Sub-subcommand names for the action-less groups (`plugin`, `sessions`). */
45
+ readonly groupSubcommands: Readonly<Record<string, readonly string[]>>;
46
+ }
47
+ /** Minimal structural view of a `CommandSpec` this module needs to read. */
48
+ export interface SpecLike {
49
+ readonly name: string;
50
+ readonly aliases?: readonly string[];
51
+ readonly commonFlags: readonly CommonFlagKey[];
52
+ readonly options?: readonly {
53
+ readonly flag: string;
54
+ }[];
55
+ }
56
+ /** One action-less group (`plugin` / `sessions`) and its leaf command names. */
57
+ export interface GroupLike {
58
+ readonly name: string;
59
+ readonly leaves: readonly {
60
+ readonly name: string;
61
+ }[];
62
+ }
63
+ /**
64
+ * Extract the canonical long `--flag` from a Commander flag string —
65
+ * `'-y, --yes'` → `'--yes'`, `'--no-cache'` → `'--no-cache'`,
66
+ * `'--resolution'` → `'--resolution'`. Returns `undefined` for a short-only
67
+ * flag (none exist in the current surface, but the caller filters defensively).
68
+ */
69
+ export declare function extractLongFlag(flags: string): string | undefined;
70
+ /**
71
+ * The long flags a single command exposes: its resolved {@link CommonFlagKey}
72
+ * common flags + its option long forms + Commander's built-in `--help`. Pure —
73
+ * the single place a spec's flag surface is turned into completion candidates.
74
+ */
75
+ export declare function specLongFlags(spec: SpecLike): readonly string[];
76
+ /**
77
+ * Assemble the completion inventory from the live specs. Pure: callers pass
78
+ * the tool command specs (from the populated `ToolRegistry`), the top-level
79
+ * host specs, and the action-less groups; this turns them into the flag /
80
+ * subcommand maps the script builders consume. Internal worker commands are
81
+ * filtered out ({@link INTERNAL_COMMANDS}).
82
+ */
83
+ export declare function assembleCompletionInventory(input: {
84
+ readonly toolSpecs: readonly SpecLike[];
85
+ readonly hostSpecs: readonly SpecLike[];
86
+ readonly groups: readonly GroupLike[];
87
+ }): CompletionInventory;
88
+ export declare function buildCompletionScript(shell: Shell, inventory: CompletionInventory): string;
89
+ export declare function printCompletionScript(shell: Shell, inventory: CompletionInventory, write?: (s: string) => void): void;
90
+ //# sourceMappingURL=completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEzE,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAOhD,CAAC;AAEH;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,qEAAqE;IACrE,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IACnE,8EAA8E;IAC9E,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;CACxE;AAED,4EAA4E;AAC5E,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACzD;AAED,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACvD;AA0BD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGjE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,MAAM,EAAE,CAQ/D;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;CACvC,GAAG,mBAAmB,CA2BtB;AA6GD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,mBAAmB,GAAG,MAAM,CAY1F;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,mBAAmB,EAC9B,KAAK,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAqC,GAC1D,IAAI,CAEN"}
@@ -0,0 +1,233 @@
1
+ /**
2
+ * @fileoverview Shell-completion script generator.
3
+ *
4
+ * Emits a sourceable completion script for bash, zsh, or fish that the
5
+ * user drops into their shell init (or pipes directly into their
6
+ * current shell to try it out).
7
+ *
8
+ * Usage:
9
+ * opensip completion bash >> ~/.bashrc
10
+ * opensip completion zsh >> ~/.zshrc
11
+ * opensip completion fish > ~/.config/fish/completions/opensip.fish
12
+ *
13
+ * The emitted scripts are static — the user's shell sources them once, so
14
+ * they complete fixed subcommand / flag names rather than querying the CLI
15
+ * per keystroke (fast, portable, no version skew). What is NOT static is
16
+ * how those names are produced: the subcommand list and each command's
17
+ * flags are DERIVED from the live `CommandSpec`s at generation time (see
18
+ * {@link CompletionInventory} / the `completion` command handler), so the
19
+ * script can never drift from the real command surface the way a
20
+ * hand-maintained flag list does. If dynamic value completion (e.g.
21
+ * matching existing check slugs) is ever needed, that's an additive change
22
+ * that can query `opensip fit --list` at completion time.
23
+ */
24
+ // @fitness-ignore-file only-documented-toolcli-seams -- the `completion <shell>` command's whole purpose is to write a sourceable shell-completion script to stdout for the user to pipe/redirect; that script IS its output, not run findings through a ToolCliContext seam (mirrors the ESLint exemption for this file). See architecture review finding 5 (interactive host commands legitimately need a narrow TTY/script seam outside the run data path).
25
+ import { commonFlags } from '@opensip-cli/contracts';
26
+ /**
27
+ * Internal/machine-facing command names never offered in shell completion.
28
+ * These are spawned by the host (sharded build, off-process engine workers,
29
+ * machine exports), never typed by a user. Single source for both the
30
+ * inventory builder and the drift test.
31
+ */
32
+ export const INTERNAL_COMMANDS = new Set([
33
+ 'graph-shard-worker',
34
+ 'catalog-export',
35
+ 'sarif-export',
36
+ 'fit-run-worker',
37
+ 'sim-run-worker',
38
+ 'graph-run-worker',
39
+ ]);
40
+ /** Long `--flag` form of each registry spec (short alias + arg placeholder
41
+ * stripped). Precomputed by mapping the registry entries, so completion's
42
+ * common-flag list derives from the one ADR-0021 registry rather than
43
+ * re-listing flag names that can drift. Dot-access stays null-safe. */
44
+ const LONG_FLAGS = Object.fromEntries(Object.entries(commonFlags).map(([key, spec]) => {
45
+ const match = /--[a-z][a-z-]*/.exec(spec.flags);
46
+ return [key, match ? match[0] : spec.flags];
47
+ }));
48
+ /** Flags every command implicitly carries — the `*)` fallback when a typed
49
+ * subcommand has no derived entry. Derived from the ADR-0021 registry (plus
50
+ * Commander's built-in `--help`/`--version`) so it can't drift. */
51
+ const COMMON_FLAGS = [
52
+ LONG_FLAGS.cwd,
53
+ LONG_FLAGS.json,
54
+ LONG_FLAGS.verbose,
55
+ LONG_FLAGS.quiet,
56
+ LONG_FLAGS.debug,
57
+ '--help',
58
+ '--version',
59
+ ];
60
+ /**
61
+ * Extract the canonical long `--flag` from a Commander flag string —
62
+ * `'-y, --yes'` → `'--yes'`, `'--no-cache'` → `'--no-cache'`,
63
+ * `'--resolution'` → `'--resolution'`. Returns `undefined` for a short-only
64
+ * flag (none exist in the current surface, but the caller filters defensively).
65
+ */
66
+ export function extractLongFlag(flags) {
67
+ const match = /--[a-z][a-z-]*/.exec(flags);
68
+ return match ? match[0] : undefined;
69
+ }
70
+ /**
71
+ * The long flags a single command exposes: its resolved {@link CommonFlagKey}
72
+ * common flags + its option long forms + Commander's built-in `--help`. Pure —
73
+ * the single place a spec's flag surface is turned into completion candidates.
74
+ */
75
+ export function specLongFlags(spec) {
76
+ // LONG_FLAGS is a total `Record<CommonFlagKey, string>`, so the common-flag
77
+ // lookup never yields undefined; only the option extraction can.
78
+ const common = spec.commonFlags.map((k) => LONG_FLAGS[k]);
79
+ const opts = (spec.options ?? [])
80
+ .map((o) => extractLongFlag(o.flag))
81
+ .filter((f) => f !== undefined);
82
+ return [...new Set([...common, ...opts, '--help'])];
83
+ }
84
+ /**
85
+ * Assemble the completion inventory from the live specs. Pure: callers pass
86
+ * the tool command specs (from the populated `ToolRegistry`), the top-level
87
+ * host specs, and the action-less groups; this turns them into the flag /
88
+ * subcommand maps the script builders consume. Internal worker commands are
89
+ * filtered out ({@link INTERNAL_COMMANDS}).
90
+ */
91
+ export function assembleCompletionInventory(input) {
92
+ const commandFlags = {};
93
+ const subcommands = [];
94
+ for (const spec of [...input.toolSpecs, ...input.hostSpecs]) {
95
+ if (INTERNAL_COMMANDS.has(spec.name))
96
+ continue;
97
+ const flags = specLongFlags(spec);
98
+ for (const name of [spec.name, ...(spec.aliases ?? [])]) {
99
+ subcommands.push(name);
100
+ commandFlags[name] = flags;
101
+ }
102
+ }
103
+ const groupSubcommands = {};
104
+ for (const group of input.groups) {
105
+ subcommands.push(group.name);
106
+ groupSubcommands[group.name] = group.leaves.map((l) => l.name);
107
+ }
108
+ // `help` is a Commander built-in the script also surfaces.
109
+ subcommands.push('help');
110
+ return {
111
+ subcommands: [...new Set(subcommands)].sort(),
112
+ commandFlags,
113
+ groupSubcommands,
114
+ };
115
+ }
116
+ // ---------------------------------------------------------------------------
117
+ // bash
118
+ // ---------------------------------------------------------------------------
119
+ function bashScript(inv) {
120
+ const subs = inv.subcommands.join(' ');
121
+ const commonFlagList = COMMON_FLAGS.join(' ');
122
+ const arms = [];
123
+ for (const [name, subsList] of Object.entries(inv.groupSubcommands)) {
124
+ arms.push(` ${name}) COMPREPLY=($(compgen -W "${subsList.join(' ')}" -- "\${cur}")) ;;`);
125
+ }
126
+ for (const [name, flags] of Object.entries(inv.commandFlags)) {
127
+ if (name in inv.groupSubcommands)
128
+ continue;
129
+ arms.push(` ${name}) COMPREPLY=($(compgen -W "${flags.join(' ')}" -- "\${cur}")) ;;`);
130
+ }
131
+ arms.push(` *) COMPREPLY=($(compgen -W "${commonFlagList}" -- "\${cur}")) ;;`);
132
+ return `# bash completion for opensip
133
+ # Source this file from ~/.bashrc or /etc/bash_completion.d/
134
+
135
+ _opensip() {
136
+ local cur prev words cword
137
+ COMPREPLY=()
138
+ cur="\${COMP_WORDS[COMP_CWORD]}"
139
+ prev="\${COMP_WORDS[COMP_CWORD-1]}"
140
+
141
+ # First word: subcommand
142
+ if [ "\${COMP_CWORD}" -eq 1 ]; then
143
+ COMPREPLY=($(compgen -W "${subs}" -- "\${cur}"))
144
+ return 0
145
+ fi
146
+
147
+ # Subcommand-specific flags (derived from the live command specs)
148
+ case "\${COMP_WORDS[1]}" in
149
+ ${arms.join('\n')}
150
+ esac
151
+ return 0
152
+ }
153
+
154
+ complete -F _opensip opensip
155
+ `;
156
+ }
157
+ // ---------------------------------------------------------------------------
158
+ // zsh
159
+ // ---------------------------------------------------------------------------
160
+ function zshScript(inv) {
161
+ const subs = inv.subcommands.join(' ');
162
+ const commonFlagList = COMMON_FLAGS.join(' ');
163
+ const arms = [];
164
+ for (const [name, subsList] of Object.entries(inv.groupSubcommands)) {
165
+ arms.push(` ${name}) _values '${name} subcommand' ${subsList.join(' ')} ;;`);
166
+ }
167
+ for (const [name, flags] of Object.entries(inv.commandFlags)) {
168
+ if (name in inv.groupSubcommands)
169
+ continue;
170
+ arms.push(` ${name}) _values 'flag' ${flags.join(' ')} ;;`);
171
+ }
172
+ arms.push(` *) _values 'flag' ${commonFlagList} ;;`);
173
+ return `#compdef opensip
174
+ # zsh completion for opensip
175
+ # Source this file from your fpath (e.g. ~/.zsh/completions/_opensip).
176
+
177
+ _opensip() {
178
+ local -a subcommands
179
+ subcommands=(${subs})
180
+
181
+ if (( CURRENT == 2 )); then
182
+ _describe 'subcommand' subcommands
183
+ return
184
+ fi
185
+
186
+ case "\${words[2]}" in
187
+ ${arms.join('\n')}
188
+ esac
189
+ }
190
+
191
+ compdef _opensip opensip
192
+ `;
193
+ }
194
+ // ---------------------------------------------------------------------------
195
+ // fish
196
+ // ---------------------------------------------------------------------------
197
+ function fishScript(inv) {
198
+ const subs = inv.subcommands.join(' ');
199
+ const lines = [
200
+ '# fish completion for opensip',
201
+ '# Drop this at ~/.config/fish/completions/opensip.fish',
202
+ '',
203
+ `complete -c opensip -f -n "__fish_use_subcommand" -a "${subs}" -d "opensip subcommand"`,
204
+ ];
205
+ for (const [name, flags] of Object.entries(inv.commandFlags)) {
206
+ if (name in inv.groupSubcommands)
207
+ continue;
208
+ for (const flag of flags) {
209
+ lines.push(`complete -c opensip -n "__fish_seen_subcommand_from ${name}" -l "${flag.replace(/^--/, '')}"`);
210
+ }
211
+ }
212
+ return lines.join('\n') + '\n';
213
+ }
214
+ // ---------------------------------------------------------------------------
215
+ // Public API
216
+ // ---------------------------------------------------------------------------
217
+ export function buildCompletionScript(shell, inventory) {
218
+ switch (shell) {
219
+ case 'bash': {
220
+ return bashScript(inventory);
221
+ }
222
+ case 'zsh': {
223
+ return zshScript(inventory);
224
+ }
225
+ case 'fish': {
226
+ return fishScript(inventory);
227
+ }
228
+ }
229
+ }
230
+ export function printCompletionScript(shell, inventory, write = (s) => process.stdout.write(s)) {
231
+ write(buildCompletionScript(shell, inventory));
232
+ }
233
+ //# sourceMappingURL=completion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,+bAA+b;AAE/b,OAAO,EAAE,WAAW,EAAsB,MAAM,wBAAwB,CAAC;AAIzE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC;IAC5D,oBAAoB;IACpB,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;CACnB,CAAC,CAAC;AA+BH;;;wEAGwE;AACxE,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;IAC9C,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAC,CAC8B,CAAC;AAEnC;;oEAEoE;AACpE,MAAM,YAAY,GAAsB;IACtC,UAAU,CAAC,GAAG;IACd,UAAU,CAAC,IAAI;IACf,UAAU,CAAC,OAAO;IAClB,UAAU,CAAC,KAAK;IAChB,UAAU,CAAC,KAAK;IAChB,QAAQ;IACR,WAAW;CACZ,CAAC;AA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CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAY,EACZ,SAA8B,EAC9B,QAA6B,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAE3D,KAAK,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * configure command — set up OpenSIP Cloud API key.
3
+ *
4
+ * Prompts via `readline` (Ink can't own a prompt loop without raw mode);
5
+ * banners and result lines route through Ink via the `configure-done`
6
+ * `CommandResult`. No `console.log` and no raw ANSI escapes here.
7
+ *
8
+ * The actual config I/O (read/write `~/.opensip-cli/config.yml`,
9
+ * resolve the API key from flag → env → config) lives in
10
+ * `@opensip-cli/config` (relocated there in ADR-0023) so the
11
+ * pre-action hook and this command both read it through the config
12
+ * layer. This file is the prompt+UX wrapper around those primitives.
13
+ * Audit 2026-05-23 M3.
14
+ */
15
+ import type { ConfigureDoneResult } from '@opensip-cli/contracts';
16
+ export { resolveApiKey } from '@opensip-cli/config';
17
+ /**
18
+ * Test a freshly-entered key against the cloud entitlement endpoint — the
19
+ * configure flow's documented "test the key" step (audit P2-2). Prints the
20
+ * outcome; best-effort, never throws (checkEntitlement returns `entitled:
21
+ * false` on an invalid key, an unreachable endpoint, or a non-entitled plan).
22
+ * The key is saved regardless, so offline setup still works. Returns whether
23
+ * the key verified as entitled.
24
+ */
25
+ export declare function verifyConfiguredKey(key: string): Promise<boolean>;
26
+ /**
27
+ * Run the interactive configure flow. Returns a `ConfigureDoneResult`;
28
+ * the caller renders it through Ink, including any "current key" hint
29
+ * the user saw at the prompt.
30
+ */
31
+ export declare function executeConfigure(): Promise<ConfigureDoneResult>;
32
+ //# sourceMappingURL=configure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/commands/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAIlE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAqBpD;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAevE;AAMD;;;;GAIG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CA2BrE"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * configure command — set up OpenSIP Cloud API key.
3
+ *
4
+ * Prompts via `readline` (Ink can't own a prompt loop without raw mode);
5
+ * banners and result lines route through Ink via the `configure-done`
6
+ * `CommandResult`. No `console.log` and no raw ANSI escapes here.
7
+ *
8
+ * The actual config I/O (read/write `~/.opensip-cli/config.yml`,
9
+ * resolve the API key from flag → env → config) lives in
10
+ * `@opensip-cli/config` (relocated there in ADR-0023) so the
11
+ * pre-action hook and this command both read it through the config
12
+ * layer. This file is the prompt+UX wrapper around those primitives.
13
+ * Audit 2026-05-23 M3.
14
+ */
15
+ // @fitness-ignore-file only-documented-toolcli-seams -- interactive TTY prompts: readline prompt text + masked-key verification UX, not machine run output through a ToolCliContext seam (mirrors the ESLint exemption for this file). Result lines route through the Ink `configure-done` CommandResult. (Architecture review finding 5: host UX commands have a narrow sanctioned exemption.)
16
+ import { join } from 'node:path';
17
+ import { createInterface } from 'node:readline';
18
+ import { GLOBAL_CONFIG_PATH, readGlobalConfig, writeGlobalConfig } from '@opensip-cli/config';
19
+ import { resolveUserPaths } from '@opensip-cli/core';
20
+ import { checkEntitlement, DEFAULT_CLOUD_ENDPOINT } from '@opensip-cli/output';
21
+ // Re-export `resolveApiKey` from the config layer so existing command-side
22
+ // imports (and tests) can continue to consume it through the same name.
23
+ export { resolveApiKey } from '@opensip-cli/config';
24
+ // ---------------------------------------------------------------------------
25
+ // Interactive prompt
26
+ // ---------------------------------------------------------------------------
27
+ function prompt(question) {
28
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
29
+ return new Promise((resolve) => {
30
+ rl.question(question, (answer) => {
31
+ rl.close();
32
+ resolve(answer.trim());
33
+ });
34
+ });
35
+ }
36
+ function maskKey(key) {
37
+ if (key.length <= 8)
38
+ return key;
39
+ return `${key.slice(0, 4)}...${key.slice(-4)}`;
40
+ }
41
+ /**
42
+ * Test a freshly-entered key against the cloud entitlement endpoint — the
43
+ * configure flow's documented "test the key" step (audit P2-2). Prints the
44
+ * outcome; best-effort, never throws (checkEntitlement returns `entitled:
45
+ * false` on an invalid key, an unreachable endpoint, or a non-entitled plan).
46
+ * The key is saved regardless, so offline setup still works. Returns whether
47
+ * the key verified as entitled.
48
+ */
49
+ export async function verifyConfiguredKey(key) {
50
+ process.stdout.write('Verifying key with OpenSIP Cloud...\n');
51
+ const { entitled } = await checkEntitlement({
52
+ apiKey: key,
53
+ endpoint: DEFAULT_CLOUD_ENDPOINT,
54
+ now: Date.now(),
55
+ cacheDir: join(resolveUserPaths().userHomeDir, 'cache'),
56
+ });
57
+ process.stdout.write(entitled
58
+ ? '✓ API key verified — entitled to OpenSIP Cloud storage.\n'
59
+ : '⚠ Could not verify the key (invalid, not entitled, or cloud unreachable).\n' +
60
+ ' Saved anyway; cloud sync will retry on your next run.\n');
61
+ return entitled;
62
+ }
63
+ // ---------------------------------------------------------------------------
64
+ // executeConfigure
65
+ // ---------------------------------------------------------------------------
66
+ /**
67
+ * Run the interactive configure flow. Returns a `ConfigureDoneResult`;
68
+ * the caller renders it through Ink, including any "current key" hint
69
+ * the user saw at the prompt.
70
+ */
71
+ export async function executeConfigure() {
72
+ const existing = readGlobalConfig();
73
+ if (existing.apiKey) {
74
+ // Pre-prompt informational line. Plain text only — Ink renders the
75
+ // outcome line. We emit this here because the prompt and the
76
+ // current-key hint share the same readline session UX.
77
+ process.stdout.write(`Current API key: ${maskKey(existing.apiKey)}\n`);
78
+ }
79
+ const key = await prompt('Enter your OpenSIP Cloud API key: ');
80
+ if (!key) {
81
+ return { type: 'configure-done', action: 'cancelled', configPath: GLOBAL_CONFIG_PATH };
82
+ }
83
+ existing.apiKey = key;
84
+ writeGlobalConfig(existing);
85
+ // Test the key against the cloud entitlement endpoint (documented step 4).
86
+ await verifyConfiguredKey(key);
87
+ return {
88
+ type: 'configure-done',
89
+ action: 'saved',
90
+ configPath: GLOBAL_CONFIG_PATH,
91
+ maskedKey: maskKey(key),
92
+ };
93
+ }
94
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/commands/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,gYAAgY;AAEhY,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAI/E,2EAA2E;AAC3E,wEAAwE;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E,SAAS,MAAM,CAAC,QAAgB;IAC9B,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;YAC/B,EAAE,CAAC,KAAK,EAAE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ACzE,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,oCAAoC,CAAC,CAAC;IAC/D,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACzF,CAAC;IAED,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC;IACtB,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAE5B,2EAA2E;IAC3E,MAAM,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAE/B,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,OAAO;QACf,UAAU,EAAE,kBAAkB;QAC9B,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC;KACxB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * history command — show run history.
3
+ *
4
+ * Backed by SessionRepo over the project-local SQLite DataStore.
5
+ * The CLI bootstrap opens the DataStore in `preAction`; this command
6
+ * receives the constructed repo from its caller.
7
+ */
8
+ import type { HistoryResult } from '@opensip-cli/contracts';
9
+ import type { ToolShortId } from '@opensip-cli/core';
10
+ import type { DataStore } from '@opensip-cli/datastore';
11
+ export interface ShowHistoryOptions {
12
+ readonly tool?: ToolShortId;
13
+ readonly limit?: number;
14
+ /** Agent ergonomics: drop the heavy per-session payload (keep showCommand + lightweight summary). */
15
+ readonly summaryOnly?: boolean;
16
+ }
17
+ export declare function showHistory(datastore: DataStore, opts?: ShowHistoryOptions): HistoryResult;
18
+ //# sourceMappingURL=history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,wBAAwB,CAAC;AAC3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qGAAqG;IACrG,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,GAAE,kBAAuB,GAAG,aAAa,CAO9F"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * history command — show run history.
3
+ *
4
+ * Backed by SessionRepo over the project-local SQLite DataStore.
5
+ * The CLI bootstrap opens the DataStore in `preAction`; this command
6
+ * receives the constructed repo from its caller.
7
+ */
8
+ import { SessionRepo } from '@opensip-cli/session-store';
9
+ export function showHistory(datastore, opts = {}) {
10
+ const repo = new SessionRepo(datastore);
11
+ const sessions = repo.list(opts).map((s) => toHistorySession(s, opts.summaryOnly));
12
+ return {
13
+ type: 'history',
14
+ sessions,
15
+ };
16
+ }
17
+ function toHistorySession(session, summaryOnly = false) {
18
+ const summary = sessionSummary(session.payload);
19
+ // In summary-only mode, drop the (potentially large) tool-owned payload for
20
+ // agent "menu" use cases — the lightweight summary (if present) + showCommand
21
+ // remain. `payload` is `readonly?`, so we omit it by spreading `rest` (without
22
+ // payload) and adding `payload` back only when NOT summary-only — no mutation /
23
+ // delete (which would need an `any` cast to bypass readonly).
24
+ const { payload, ...rest } = session;
25
+ return {
26
+ ...rest,
27
+ ...(summaryOnly ? {} : { payload }),
28
+ ...(summary === undefined ? {} : { summary }),
29
+ showCommand: `opensip sessions show ${session.id} --json`,
30
+ };
31
+ }
32
+ function sessionSummary(payload) {
33
+ if (payload === null || typeof payload !== 'object')
34
+ return undefined;
35
+ const summary = payload.summary;
36
+ if (summary === null || typeof summary !== 'object')
37
+ return undefined;
38
+ const { total, passed, failed, errors, warnings } = summary;
39
+ if (typeof total !== 'number' ||
40
+ typeof passed !== 'number' ||
41
+ typeof failed !== 'number' ||
42
+ typeof errors !== 'number' ||
43
+ typeof warnings !== 'number') {
44
+ return undefined;
45
+ }
46
+ return { total, passed, failed, errors, warnings };
47
+ }
48
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAazD,MAAM,UAAU,WAAW,CAAC,SAAoB,EAAE,OAA2B,EAAE;IAC7E,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACnF,OAAO;QACL,IAAI,EAAE,SAAS;QACf,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAsB,EAAE,WAAW,GAAG,KAAK;IACnE,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,4EAA4E;IAC5E,8EAA8E;IAC9E,+EAA+E;IAC/E,gFAAgF;IAChF,8DAA8D;IAC9D,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACrC,OAAO;QACL,GAAG,IAAI;QACP,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;QACnC,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;QAC7C,WAAW,EAAE,yBAAyB,OAAO,CAAC,EAAE,SAAS;KAC1D,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,OAAgB;IACtC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACtE,MAAM,OAAO,GAAI,OAAiC,CAAC,OAAO,CAAC;IAC3D,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACtE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAkC,CAAC;IACvF,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,QAAQ,KAAK,QAAQ,EAC5B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACrD,CAAC"}
@@ -0,0 +1,49 @@
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 { type HostSpec } from './host-subcommand-groups.js';
32
+ import type { CliCommandsContext } from './shared.js';
33
+ import type { CliProgram } from '@opensip-cli/contracts';
34
+ /**
35
+ * Build the top-level (non-grouped) host command specs. Exported so tests can
36
+ * inspect the host command surface that the host mounts (single source). The
37
+ * `completion` spec keeps its canonical position (after `configure`, before
38
+ * `uninstall`) so the mounted command order — and thus `--help` ordering — is
39
+ * byte-identical to before the cycle-breaking split.
40
+ */
41
+ export declare function buildTopLevelHostSpecs(ctx: CliCommandsContext): readonly HostSpec[];
42
+ /**
43
+ * Mount every host command onto `program` through the shared `mountCommandSpec`
44
+ * plane. Top-level specs mount directly; each subcommand group becomes a raw
45
+ * action-less parent (the documented exception) onto which its leaf specs mount
46
+ * via the same `mountCommandSpec`.
47
+ */
48
+ export declare function mountHostCommands(program: CliProgram, ctx: CliCommandsContext): void;
49
+ //# sourceMappingURL=host-command-specs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-command-specs.d.ts","sourceRoot":"","sources":["../../src/commands/host-command-specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAgBH,OAAO,EAA6B,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,wBAAwB,CAAC;AAiTtE;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,kBAAkB,GAAG,SAAS,QAAQ,EAAE,CASnF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,kBAAkB,GAAG,IAAI,CAUpF"}