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.
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +51 -0
- package/dist/api.d.ts +17 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +16 -0
- package/dist/api.js.map +1 -0
- package/dist/bootstrap/admit-tool-package.d.ts +117 -0
- package/dist/bootstrap/admit-tool-package.d.ts.map +1 -0
- package/dist/bootstrap/admit-tool-package.js +170 -0
- package/dist/bootstrap/admit-tool-package.js.map +1 -0
- package/dist/bootstrap/baseline-seams.d.ts +30 -0
- package/dist/bootstrap/baseline-seams.d.ts.map +1 -0
- package/dist/bootstrap/baseline-seams.js +156 -0
- package/dist/bootstrap/baseline-seams.js.map +1 -0
- package/dist/bootstrap/bootstrap-error.d.ts +41 -0
- package/dist/bootstrap/bootstrap-error.d.ts.map +1 -0
- package/dist/bootstrap/bootstrap-error.js +33 -0
- package/dist/bootstrap/bootstrap-error.js.map +1 -0
- package/dist/bootstrap/build-command-registration-input.d.ts +34 -0
- package/dist/bootstrap/build-command-registration-input.d.ts.map +1 -0
- package/dist/bootstrap/build-command-registration-input.js +73 -0
- package/dist/bootstrap/build-command-registration-input.js.map +1 -0
- package/dist/bootstrap/build-per-run-scope.d.ts +62 -0
- package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -0
- package/dist/bootstrap/build-per-run-scope.js +152 -0
- package/dist/bootstrap/build-per-run-scope.js.map +1 -0
- package/dist/bootstrap/build-targets.d.ts +42 -0
- package/dist/bootstrap/build-targets.d.ts.map +1 -0
- package/dist/bootstrap/build-targets.js +117 -0
- package/dist/bootstrap/build-targets.js.map +1 -0
- package/dist/bootstrap/cli-defaults.d.ts +35 -0
- package/dist/bootstrap/cli-defaults.d.ts.map +1 -0
- package/dist/bootstrap/cli-defaults.js +65 -0
- package/dist/bootstrap/cli-defaults.js.map +1 -0
- package/dist/bootstrap/config-and-capabilities.d.ts +74 -0
- package/dist/bootstrap/config-and-capabilities.d.ts.map +1 -0
- package/dist/bootstrap/config-and-capabilities.js +224 -0
- package/dist/bootstrap/config-and-capabilities.js.map +1 -0
- package/dist/bootstrap/deliver-envelope.d.ts +80 -0
- package/dist/bootstrap/deliver-envelope.d.ts.map +1 -0
- package/dist/bootstrap/deliver-envelope.js +195 -0
- package/dist/bootstrap/deliver-envelope.js.map +1 -0
- package/dist/bootstrap/egress-plane.d.ts +22 -0
- package/dist/bootstrap/egress-plane.d.ts.map +1 -0
- package/dist/bootstrap/egress-plane.js +37 -0
- package/dist/bootstrap/egress-plane.js.map +1 -0
- package/dist/bootstrap/host-planes.d.ts +28 -0
- package/dist/bootstrap/host-planes.d.ts.map +1 -0
- package/dist/bootstrap/host-planes.js +152 -0
- package/dist/bootstrap/host-planes.js.map +1 -0
- package/dist/bootstrap/index.d.ts +76 -0
- package/dist/bootstrap/index.d.ts.map +1 -0
- package/dist/bootstrap/index.js +109 -0
- package/dist/bootstrap/index.js.map +1 -0
- package/dist/bootstrap/live-plane.d.ts +51 -0
- package/dist/bootstrap/live-plane.d.ts.map +1 -0
- package/dist/bootstrap/live-plane.js +72 -0
- package/dist/bootstrap/live-plane.js.map +1 -0
- package/dist/bootstrap/load-tool-capabilities.d.ts +42 -0
- package/dist/bootstrap/load-tool-capabilities.d.ts.map +1 -0
- package/dist/bootstrap/load-tool-capabilities.js +76 -0
- package/dist/bootstrap/load-tool-capabilities.js.map +1 -0
- package/dist/bootstrap/output-plane.d.ts +37 -0
- package/dist/bootstrap/output-plane.d.ts.map +1 -0
- package/dist/bootstrap/output-plane.js +114 -0
- package/dist/bootstrap/output-plane.js.map +1 -0
- package/dist/bootstrap/owning-tool-init.d.ts +32 -0
- package/dist/bootstrap/owning-tool-init.d.ts.map +1 -0
- package/dist/bootstrap/owning-tool-init.js +69 -0
- package/dist/bootstrap/owning-tool-init.js.map +1 -0
- package/dist/bootstrap/pre-action-guards.d.ts +44 -0
- package/dist/bootstrap/pre-action-guards.d.ts.map +1 -0
- package/dist/bootstrap/pre-action-guards.js +136 -0
- package/dist/bootstrap/pre-action-guards.js.map +1 -0
- package/dist/bootstrap/pre-action-hook.d.ts +68 -0
- package/dist/bootstrap/pre-action-hook.d.ts.map +1 -0
- package/dist/bootstrap/pre-action-hook.js +289 -0
- package/dist/bootstrap/pre-action-hook.js.map +1 -0
- package/dist/bootstrap/pre-action-messages.d.ts +32 -0
- package/dist/bootstrap/pre-action-messages.d.ts.map +1 -0
- package/dist/bootstrap/pre-action-messages.js +49 -0
- package/dist/bootstrap/pre-action-messages.js.map +1 -0
- package/dist/bootstrap/process-idempotency.d.ts +17 -0
- package/dist/bootstrap/process-idempotency.d.ts.map +1 -0
- package/dist/bootstrap/process-idempotency.js +20 -0
- package/dist/bootstrap/process-idempotency.js.map +1 -0
- package/dist/bootstrap/register-language-adapters.d.ts +23 -0
- package/dist/bootstrap/register-language-adapters.d.ts.map +1 -0
- package/dist/bootstrap/register-language-adapters.js +35 -0
- package/dist/bootstrap/register-language-adapters.js.map +1 -0
- package/dist/bootstrap/register-tools.d.ts +228 -0
- package/dist/bootstrap/register-tools.d.ts.map +1 -0
- package/dist/bootstrap/register-tools.js +696 -0
- package/dist/bootstrap/register-tools.js.map +1 -0
- package/dist/bootstrap/render.d.ts +27 -0
- package/dist/bootstrap/render.d.ts.map +1 -0
- package/dist/bootstrap/render.js +53 -0
- package/dist/bootstrap/render.js.map +1 -0
- package/dist/bootstrap/report.d.ts +34 -0
- package/dist/bootstrap/report.d.ts.map +1 -0
- package/dist/bootstrap/report.js +47 -0
- package/dist/bootstrap/report.js.map +1 -0
- package/dist/bootstrap/run-plane.d.ts +105 -0
- package/dist/bootstrap/run-plane.d.ts.map +1 -0
- package/dist/bootstrap/run-plane.js +190 -0
- package/dist/bootstrap/run-plane.js.map +1 -0
- package/dist/bootstrap/scope-access.d.ts +68 -0
- package/dist/bootstrap/scope-access.d.ts.map +1 -0
- package/dist/bootstrap/scope-access.js +115 -0
- package/dist/bootstrap/scope-access.js.map +1 -0
- package/dist/bootstrap/state-seams.d.ts +14 -0
- package/dist/bootstrap/state-seams.d.ts.map +1 -0
- package/dist/bootstrap/state-seams.js +26 -0
- package/dist/bootstrap/state-seams.js.map +1 -0
- package/dist/bootstrap/tool-lifecycle.d.ts +102 -0
- package/dist/bootstrap/tool-lifecycle.d.ts.map +1 -0
- package/dist/bootstrap/tool-lifecycle.js +103 -0
- package/dist/bootstrap/tool-lifecycle.js.map +1 -0
- package/dist/bootstrap/tool-trust.d.ts +49 -0
- package/dist/bootstrap/tool-trust.d.ts.map +1 -0
- package/dist/bootstrap/tool-trust.js +65 -0
- package/dist/bootstrap/tool-trust.js.map +1 -0
- package/dist/bootstrap/validate-tool.d.ts +22 -0
- package/dist/bootstrap/validate-tool.d.ts.map +1 -0
- package/dist/bootstrap/validate-tool.js +38 -0
- package/dist/bootstrap/validate-tool.js.map +1 -0
- package/dist/cli-context.d.ts +38 -0
- package/dist/cli-context.d.ts.map +1 -0
- package/dist/cli-context.js +134 -0
- package/dist/cli-context.js.map +1 -0
- package/dist/commands/agent-catalog.d.ts +45 -0
- package/dist/commands/agent-catalog.d.ts.map +1 -0
- package/dist/commands/agent-catalog.js +115 -0
- package/dist/commands/agent-catalog.js.map +1 -0
- package/dist/commands/assemble-outcome.d.ts +69 -0
- package/dist/commands/assemble-outcome.d.ts.map +1 -0
- package/dist/commands/assemble-outcome.js +121 -0
- package/dist/commands/assemble-outcome.js.map +1 -0
- package/dist/commands/clear.d.ts +32 -0
- package/dist/commands/clear.d.ts.map +1 -0
- package/dist/commands/clear.js +73 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/completion.d.ts +90 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +233 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/configure.d.ts +32 -0
- package/dist/commands/configure.d.ts.map +1 -0
- package/dist/commands/configure.js +94 -0
- package/dist/commands/configure.js.map +1 -0
- package/dist/commands/history.d.ts +18 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +48 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/host-command-specs.d.ts +49 -0
- package/dist/commands/host-command-specs.d.ts.map +1 -0
- package/dist/commands/host-command-specs.js +331 -0
- package/dist/commands/host-command-specs.js.map +1 -0
- package/dist/commands/host-subcommand-groups.d.ts +69 -0
- package/dist/commands/host-subcommand-groups.d.ts.map +1 -0
- package/dist/commands/host-subcommand-groups.js +374 -0
- package/dist/commands/host-subcommand-groups.js.map +1 -0
- package/dist/commands/index.d.ts +36 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +36 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init/config-templates.d.ts +16 -0
- package/dist/commands/init/config-templates.d.ts.map +1 -0
- package/dist/commands/init/config-templates.js +108 -0
- package/dist/commands/init/config-templates.js.map +1 -0
- package/dist/commands/init/file-classifier.d.ts +40 -0
- package/dist/commands/init/file-classifier.d.ts.map +1 -0
- package/dist/commands/init/file-classifier.js +155 -0
- package/dist/commands/init/file-classifier.js.map +1 -0
- package/dist/commands/init/language-detection.d.ts +44 -0
- package/dist/commands/init/language-detection.d.ts.map +1 -0
- package/dist/commands/init/language-detection.js +124 -0
- package/dist/commands/init/language-detection.js.map +1 -0
- package/dist/commands/init/scaffold-writer.d.ts +26 -0
- package/dist/commands/init/scaffold-writer.d.ts.map +1 -0
- package/dist/commands/init/scaffold-writer.js +102 -0
- package/dist/commands/init/scaffold-writer.js.map +1 -0
- package/dist/commands/init/state-machine.d.ts +32 -0
- package/dist/commands/init/state-machine.d.ts.map +1 -0
- package/dist/commands/init/state-machine.js +105 -0
- package/dist/commands/init/state-machine.js.map +1 -0
- package/dist/commands/init.d.ts +95 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +209 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mount-command-spec.d.ts +106 -0
- package/dist/commands/mount-command-spec.d.ts.map +1 -0
- package/dist/commands/mount-command-spec.js +313 -0
- package/dist/commands/mount-command-spec.js.map +1 -0
- package/dist/commands/mount-result-command.d.ts +71 -0
- package/dist/commands/mount-result-command.d.ts.map +1 -0
- package/dist/commands/mount-result-command.js +76 -0
- package/dist/commands/mount-result-command.js.map +1 -0
- package/dist/commands/plugin/config-edit.d.ts +20 -0
- package/dist/commands/plugin/config-edit.d.ts.map +1 -0
- package/dist/commands/plugin/config-edit.js +102 -0
- package/dist/commands/plugin/config-edit.js.map +1 -0
- package/dist/commands/plugin/domain-resolution.d.ts +38 -0
- package/dist/commands/plugin/domain-resolution.d.ts.map +1 -0
- package/dist/commands/plugin/domain-resolution.js +98 -0
- package/dist/commands/plugin/domain-resolution.js.map +1 -0
- package/dist/commands/plugin/host-dir.d.ts +42 -0
- package/dist/commands/plugin/host-dir.d.ts.map +1 -0
- package/dist/commands/plugin/host-dir.js +168 -0
- package/dist/commands/plugin/host-dir.js.map +1 -0
- package/dist/commands/plugin-host-ops.d.ts +41 -0
- package/dist/commands/plugin-host-ops.d.ts.map +1 -0
- package/dist/commands/plugin-host-ops.js +114 -0
- package/dist/commands/plugin-host-ops.js.map +1 -0
- package/dist/commands/plugin.d.ts +81 -0
- package/dist/commands/plugin.d.ts.map +1 -0
- package/dist/commands/plugin.js +287 -0
- package/dist/commands/plugin.js.map +1 -0
- package/dist/commands/render-outcome.d.ts +52 -0
- package/dist/commands/render-outcome.d.ts.map +1 -0
- package/dist/commands/render-outcome.js +55 -0
- package/dist/commands/render-outcome.js.map +1 -0
- package/dist/commands/session-show.d.ts +27 -0
- package/dist/commands/session-show.d.ts.map +1 -0
- package/dist/commands/session-show.js +166 -0
- package/dist/commands/session-show.js.map +1 -0
- package/dist/commands/shared.d.ts +107 -0
- package/dist/commands/shared.d.ts.map +1 -0
- package/dist/commands/shared.js +13 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/commands/tools/data-purge.d.ts +20 -0
- package/dist/commands/tools/data-purge.d.ts.map +1 -0
- package/dist/commands/tools/data-purge.js +59 -0
- package/dist/commands/tools/data-purge.js.map +1 -0
- package/dist/commands/tools/index.d.ts +16 -0
- package/dist/commands/tools/index.d.ts.map +1 -0
- package/dist/commands/tools/index.js +213 -0
- package/dist/commands/tools/index.js.map +1 -0
- package/dist/commands/tools/install.d.ts +24 -0
- package/dist/commands/tools/install.d.ts.map +1 -0
- package/dist/commands/tools/install.js +83 -0
- package/dist/commands/tools/install.js.map +1 -0
- package/dist/commands/tools/list.d.ts +41 -0
- package/dist/commands/tools/list.d.ts.map +1 -0
- package/dist/commands/tools/list.js +103 -0
- package/dist/commands/tools/list.js.map +1 -0
- package/dist/commands/tools/runtime-probe-entry.d.ts +14 -0
- package/dist/commands/tools/runtime-probe-entry.d.ts.map +1 -0
- package/dist/commands/tools/runtime-probe-entry.js +36 -0
- package/dist/commands/tools/runtime-probe-entry.js.map +1 -0
- package/dist/commands/tools/runtime-probe.d.ts +29 -0
- package/dist/commands/tools/runtime-probe.d.ts.map +1 -0
- package/dist/commands/tools/runtime-probe.js +66 -0
- package/dist/commands/tools/runtime-probe.js.map +1 -0
- package/dist/commands/tools/storage-contract-checks.d.ts +37 -0
- package/dist/commands/tools/storage-contract-checks.d.ts.map +1 -0
- package/dist/commands/tools/storage-contract-checks.js +91 -0
- package/dist/commands/tools/storage-contract-checks.js.map +1 -0
- package/dist/commands/tools/uninstall.d.ts +29 -0
- package/dist/commands/tools/uninstall.d.ts.map +1 -0
- package/dist/commands/tools/uninstall.js +77 -0
- package/dist/commands/tools/uninstall.js.map +1 -0
- package/dist/commands/tools/validate.d.ts +44 -0
- package/dist/commands/tools/validate.d.ts.map +1 -0
- package/dist/commands/tools/validate.js +202 -0
- package/dist/commands/tools/validate.js.map +1 -0
- package/dist/commands/uninstall/targets.d.ts +53 -0
- package/dist/commands/uninstall/targets.d.ts.map +1 -0
- package/dist/commands/uninstall/targets.js +205 -0
- package/dist/commands/uninstall/targets.js.map +1 -0
- package/dist/commands/uninstall.d.ts +88 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +184 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/env/host-env-specs.d.ts +52 -0
- package/dist/env/host-env-specs.d.ts.map +1 -0
- package/dist/env/host-env-specs.js +129 -0
- package/dist/env/host-env-specs.js.map +1 -0
- package/dist/error-handler.d.ts +64 -0
- package/dist/error-handler.d.ts.map +1 -0
- package/dist/error-handler.js +180 -0
- package/dist/error-handler.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +154 -0
- package/dist/index.js.map +1 -0
- package/dist/open-report.d.ts +40 -0
- package/dist/open-report.d.ts.map +1 -0
- package/dist/open-report.js +54 -0
- package/dist/open-report.js.map +1 -0
- package/dist/report-compose.d.ts +35 -0
- package/dist/report-compose.d.ts.map +1 -0
- package/dist/report-compose.js +103 -0
- package/dist/report-compose.js.map +1 -0
- package/dist/session-replay-registry.d.ts +20 -0
- package/dist/session-replay-registry.d.ts.map +1 -0
- package/dist/session-replay-registry.js +38 -0
- package/dist/session-replay-registry.js.map +1 -0
- package/dist/telemetry/profiling.d.ts +42 -0
- package/dist/telemetry/profiling.d.ts.map +1 -0
- package/dist/telemetry/profiling.js +160 -0
- package/dist/telemetry/profiling.js.map +1 -0
- package/dist/telemetry/sdk-init.d.ts +87 -0
- package/dist/telemetry/sdk-init.d.ts.map +1 -0
- package/dist/telemetry/sdk-init.js +235 -0
- package/dist/telemetry/sdk-init.js.map +1 -0
- package/dist/ui/App.d.ts +32 -0
- package/dist/ui/App.d.ts.map +1 -0
- package/dist/ui/App.js +35 -0
- package/dist/ui/App.js.map +1 -0
- package/dist/ui/render.d.ts +15 -0
- package/dist/ui/render.d.ts.map +1 -0
- package/dist/ui/render.js +21 -0
- package/dist/ui/render.js.map +1 -0
- package/dist/ui/result-to-view.d.ts +40 -0
- package/dist/ui/result-to-view.d.ts.map +1 -0
- package/dist/ui/result-to-view.js +389 -0
- package/dist/ui/result-to-view.js.map +1 -0
- package/dist/ui/views/init-view.d.ts +9 -0
- package/dist/ui/views/init-view.d.ts.map +1 -0
- package/dist/ui/views/init-view.js +119 -0
- package/dist/ui/views/init-view.js.map +1 -0
- package/dist/ui/views/misc-views.d.ts +18 -0
- package/dist/ui/views/misc-views.d.ts.map +1 -0
- package/dist/ui/views/misc-views.js +244 -0
- package/dist/ui/views/misc-views.js.map +1 -0
- package/dist/ui/views/plugin-view.d.ts +8 -0
- package/dist/ui/views/plugin-view.d.ts.map +1 -0
- package/dist/ui/views/plugin-view.js +135 -0
- package/dist/ui/views/plugin-view.js.map +1 -0
- package/dist/ui/views/tools-views.d.ts +12 -0
- package/dist/ui/views/tools-views.d.ts.map +1 -0
- package/dist/ui/views/tools-views.js +152 -0
- package/dist/ui/views/tools-views.js.map +1 -0
- package/dist/update-notifier.d.ts +108 -0
- package/dist/update-notifier.d.ts.map +1 -0
- package/dist/update-notifier.js +188 -0
- package/dist/update-notifier.js.map +1 -0
- package/dist/update-state.d.ts +40 -0
- package/dist/update-state.d.ts.map +1 -0
- package/dist/update-state.js +81 -0
- package/dist/update-state.js.map +1 -0
- package/dist/welcome.d.ts +53 -0
- package/dist/welcome.d.ts.map +1 -0
- package/dist/welcome.js +89 -0
- package/dist/welcome.js.map +1 -0
- package/package.json +100 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
// @fitness-ignore-file file-length-limit -- deliberate single cycle-free leaf module: it houses BOTH host subcommand groups' leaf specs (sessions + plugin) AND the completion inventory together specifically because it must import neither completion.ts nor host-command-specs.ts (see header — splitting would reintroduce the module cycle this file exists to break). Cohesive by design; grew past the 400-line soft limit with the per-leaf CommandSpec builders.
|
|
2
|
+
/**
|
|
3
|
+
* host-subcommand-groups — the action-less Commander subcommand GROUPS
|
|
4
|
+
* (`sessions`, `plugin`) and their leaf {@link CommandSpec}s (launch
|
|
5
|
+
* Phase 6).
|
|
6
|
+
*
|
|
7
|
+
* Split out of `host-command-specs.ts` for ONE reason: to break a module cycle.
|
|
8
|
+
* The completion-script generator (`completion.ts`) sources its `plugin` /
|
|
9
|
+
* `sessions` sub-subcommand NAME lists from the live leaf specs (single source —
|
|
10
|
+
* Phase 6 Task 6.2), so it must import the group inventory. The
|
|
11
|
+
* `host-command-specs.ts` module, in turn, imports `printCompletionScript` from
|
|
12
|
+
* `completion.ts` for the `completion` command's handler. Housing the GROUP
|
|
13
|
+
* leaves + inventory here (a module that imports NEITHER `completion.ts` nor
|
|
14
|
+
* `host-command-specs.ts`) lets both depend on this leaf module without a cycle.
|
|
15
|
+
*
|
|
16
|
+
* The two parents are action-less GROUPS — a parent with no action body is not
|
|
17
|
+
* a single mountable `CommandSpec`, so it stays a raw `program.command(name)`
|
|
18
|
+
* shell (the FINITE, NAMED documented exceptions for the Phase 7
|
|
19
|
+
* `command-surface-parity` guardrail's allow-list, see {@link HOST_SUBCOMMAND_GROUPS}).
|
|
20
|
+
* Their LEAVES (`sessions list|purge`, `plugin list|add|remove|sync`) ARE specs.
|
|
21
|
+
*/
|
|
22
|
+
import { currentScope, defineCommand, } from '@opensip-cli/core';
|
|
23
|
+
import { executeClear } from './clear.js';
|
|
24
|
+
import { showHistory } from './history.js';
|
|
25
|
+
import { pluginAdd, pluginList, pluginRemove, pluginSync } from './plugin.js';
|
|
26
|
+
import { executeSessionShow } from './session-show.js';
|
|
27
|
+
import { buildToolsGroupLeaves } from './tools/index.js';
|
|
28
|
+
/** Every grouped leaf needs the entered project scope (datastore / project
|
|
29
|
+
* context). Named once so the discriminant isn't restated per spec. */
|
|
30
|
+
const PROJECT_SCOPE = 'project';
|
|
31
|
+
/** The `command-result` output mode, named once (the leaves all share it). */
|
|
32
|
+
const COMMAND_RESULT = 'command-result';
|
|
33
|
+
const RAW_STREAM = 'raw-stream';
|
|
34
|
+
/** Prefer the discovered project root; fall back to literal cwd; finally process.cwd(). */
|
|
35
|
+
export function effectiveCwd(opts) {
|
|
36
|
+
return opts.projectContext?.projectRoot ?? opts.cwd ?? process.cwd();
|
|
37
|
+
}
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// sessions list / purge
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
function buildSessionsListSpec(ctx) {
|
|
42
|
+
return defineCommand({
|
|
43
|
+
name: 'list',
|
|
44
|
+
description: 'List stored sessions',
|
|
45
|
+
commonFlags: ['json'],
|
|
46
|
+
options: [
|
|
47
|
+
{
|
|
48
|
+
flag: '--tool',
|
|
49
|
+
value: '<name>',
|
|
50
|
+
description: 'Filter to one tool',
|
|
51
|
+
choices: ['fit', 'graph', 'sim'],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
flag: '--limit',
|
|
55
|
+
value: '<n>',
|
|
56
|
+
description: 'Maximum sessions to return',
|
|
57
|
+
parse: parsePositiveInt,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
flag: '--summary-only',
|
|
61
|
+
description: 'Omit heavy per-session payloads (agent friendly; showCommand and lightweight summary remain). ' +
|
|
62
|
+
'Pairs well with --json for lean "menu" of historical results.',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
scope: PROJECT_SCOPE,
|
|
66
|
+
output: COMMAND_RESULT,
|
|
67
|
+
handler: (rawOpts) => {
|
|
68
|
+
const opts = rawOpts;
|
|
69
|
+
return showHistory(ctx.datastore(), {
|
|
70
|
+
tool: opts.tool,
|
|
71
|
+
limit: opts.limit,
|
|
72
|
+
summaryOnly: !!opts.summaryOnly,
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function buildSessionsShowSpec(ctx) {
|
|
78
|
+
return defineCommand({
|
|
79
|
+
name: 'show',
|
|
80
|
+
description: 'Display a stored session result',
|
|
81
|
+
commonFlags: ['json'],
|
|
82
|
+
args: [{ name: 'ref', description: 'Session id, or latest with --tool' }],
|
|
83
|
+
options: [
|
|
84
|
+
{
|
|
85
|
+
flag: '--tool',
|
|
86
|
+
value: '<name>',
|
|
87
|
+
description: 'Tool for latest, or an optional id sanity check',
|
|
88
|
+
choices: ['fit', 'graph', 'sim'],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
flag: '--filter',
|
|
92
|
+
value: '<type>',
|
|
93
|
+
description: 'Filter replayed signals (repeatable): errors-only | warnings-only | top:<n>. ' +
|
|
94
|
+
'Composable, e.g. --filter errors-only --filter top:20. Agent ergonomics for historical results.',
|
|
95
|
+
arrayDefault: [],
|
|
96
|
+
parse: (val, prev) => [...prev, val],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
flag: '--raw',
|
|
100
|
+
description: 'With --json: emit the inner payload (session + envelope + metadata) without the outer CommandResult wrapper. ' +
|
|
101
|
+
'Ideal for agents that want the smallest possible response.',
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
scope: PROJECT_SCOPE,
|
|
105
|
+
output: RAW_STREAM,
|
|
106
|
+
rawStreamReason: 'session-replay',
|
|
107
|
+
handler: async (rawOpts) => {
|
|
108
|
+
const opts = rawOpts;
|
|
109
|
+
const ref = opts._args[0];
|
|
110
|
+
const filters = normalizeFilterOption(opts.filter);
|
|
111
|
+
await executeSessionShow({
|
|
112
|
+
replayRegistry: ctx.sessionReplayRegistry,
|
|
113
|
+
ref,
|
|
114
|
+
tool: opts.tool,
|
|
115
|
+
json: opts.json,
|
|
116
|
+
filters,
|
|
117
|
+
raw: opts.raw,
|
|
118
|
+
render: ctx.render,
|
|
119
|
+
emitJson: ctx.emitJson,
|
|
120
|
+
emitRaw: ctx.emitRaw,
|
|
121
|
+
emitError: ctx.emitError,
|
|
122
|
+
setExitCode: ctx.setExitCode,
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Normalize the repeatable `--filter` option (Commander yields a string for one
|
|
129
|
+
* occurrence, a string[] for many, undefined for none) into a uniform
|
|
130
|
+
* `string[] | undefined` for `executeSessionShow`.
|
|
131
|
+
*/
|
|
132
|
+
function normalizeFilterOption(filter) {
|
|
133
|
+
if (Array.isArray(filter))
|
|
134
|
+
return filter;
|
|
135
|
+
if (filter)
|
|
136
|
+
return [filter];
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Validating coercion for `sessions list --limit <n>`.
|
|
141
|
+
*
|
|
142
|
+
* @throws {Error} When the raw value is not a positive integer.
|
|
143
|
+
*/
|
|
144
|
+
function parsePositiveInt(raw) {
|
|
145
|
+
const n = Number.parseInt(raw, 10);
|
|
146
|
+
if (Number.isNaN(n) || n <= 0) {
|
|
147
|
+
throw new Error(`Invalid --limit value: '${raw}'. Must be a positive integer.`);
|
|
148
|
+
}
|
|
149
|
+
return n;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Validating coercion for `sessions purge --older-than <days>` — identical to
|
|
153
|
+
* the former inline argParser. A named declaration (not an inline lambda) so the
|
|
154
|
+
* `@throws` contract below is documented.
|
|
155
|
+
*
|
|
156
|
+
* @throws {Error} When the raw value is not a non-negative integer.
|
|
157
|
+
*/
|
|
158
|
+
function parseOlderThanDays(raw) {
|
|
159
|
+
const n = Number.parseInt(raw, 10);
|
|
160
|
+
if (Number.isNaN(n) || n < 0) {
|
|
161
|
+
throw new Error(`Invalid --older-than value: '${raw}'. Must be a non-negative integer.`);
|
|
162
|
+
}
|
|
163
|
+
return n;
|
|
164
|
+
}
|
|
165
|
+
function buildSessionsPurgeSpec(ctx) {
|
|
166
|
+
return defineCommand({
|
|
167
|
+
name: 'purge',
|
|
168
|
+
description: 'Delete session rows from the project-local SQLite store (opensip-cli/.runtime/datastore.sqlite)',
|
|
169
|
+
commonFlags: ['json'],
|
|
170
|
+
options: [
|
|
171
|
+
{
|
|
172
|
+
flag: '--older-than',
|
|
173
|
+
value: '<days>',
|
|
174
|
+
description: 'Only delete sessions older than N days',
|
|
175
|
+
// Pure validating coercion — identical to the former inline argParser.
|
|
176
|
+
parse: parseOlderThanDays,
|
|
177
|
+
},
|
|
178
|
+
{ flag: '-y, --yes', description: 'Skip confirmation prompt', default: false },
|
|
179
|
+
],
|
|
180
|
+
scope: PROJECT_SCOPE,
|
|
181
|
+
output: COMMAND_RESULT,
|
|
182
|
+
handler: (rawOpts) => {
|
|
183
|
+
const opts = rawOpts;
|
|
184
|
+
return executeClear({
|
|
185
|
+
olderThan: opts.olderThan,
|
|
186
|
+
yes: opts.yes,
|
|
187
|
+
datastore: ctx.datastore(),
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
// plugin list / add / remove / sync
|
|
194
|
+
// ---------------------------------------------------------------------------
|
|
195
|
+
/** The shared `--cwd <path>` option for the plugin leaves. Its description is
|
|
196
|
+
* "Project root" (NOT the registry's "Target directory"), so it is declared as
|
|
197
|
+
* a per-command OptionSpec rather than the `cwd` common flag — preserving the
|
|
198
|
+
* byte-identical help text. The default resolves per-invocation (the builders
|
|
199
|
+
* run on each `registerCliCommands` call). */
|
|
200
|
+
function pluginCwdOption() {
|
|
201
|
+
return {
|
|
202
|
+
flag: '--cwd',
|
|
203
|
+
value: '<path>',
|
|
204
|
+
description: 'Project root',
|
|
205
|
+
default: process.cwd(),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function buildPluginListSpec(ctx) {
|
|
209
|
+
return defineCommand({
|
|
210
|
+
name: 'list',
|
|
211
|
+
description: 'List installed plugins',
|
|
212
|
+
commonFlags: ['json'],
|
|
213
|
+
options: [pluginCwdOption()],
|
|
214
|
+
scope: PROJECT_SCOPE,
|
|
215
|
+
output: COMMAND_RESULT,
|
|
216
|
+
handler: (rawOpts) => {
|
|
217
|
+
const opts = rawOpts;
|
|
218
|
+
// Per-run admitted-tool provenance is on the entered RunScope (stamped by
|
|
219
|
+
// the bootstrap); read it here and pass it into the pure `pluginList`.
|
|
220
|
+
return pluginList(effectiveCwd(opts), ctx.pluginLayouts, currentScope()?.toolProvenance ?? []);
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function buildPluginAddSpec(ctx) {
|
|
225
|
+
return defineCommand({
|
|
226
|
+
name: 'add',
|
|
227
|
+
description: 'Install a plugin (fit/sim pack → project config; tool → user-global by default)',
|
|
228
|
+
commonFlags: ['json'],
|
|
229
|
+
options: [
|
|
230
|
+
{
|
|
231
|
+
flag: '--domain',
|
|
232
|
+
value: '<fit|sim|tool>',
|
|
233
|
+
description: 'Target domain (default: inferred; tool plugins auto-detected by marker)',
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
flag: '--project',
|
|
237
|
+
description: 'For a tool plugin, install project-local (.runtime/) instead of user-global',
|
|
238
|
+
default: false,
|
|
239
|
+
},
|
|
240
|
+
pluginCwdOption(),
|
|
241
|
+
],
|
|
242
|
+
// Empty description: the former `.command('add <package>')` declared the
|
|
243
|
+
// positional inline with no help text, so Commander rendered no "Arguments:"
|
|
244
|
+
// block. Keeping it empty preserves the byte-identical --help.
|
|
245
|
+
args: [{ name: 'package', description: '' }],
|
|
246
|
+
scope: PROJECT_SCOPE,
|
|
247
|
+
output: COMMAND_RESULT,
|
|
248
|
+
handler: (rawOpts) => {
|
|
249
|
+
const opts = rawOpts;
|
|
250
|
+
const packageName = opts._args[0];
|
|
251
|
+
return pluginAdd(packageName, effectiveCwd(opts), opts.domain, ctx.pluginLayouts, {
|
|
252
|
+
project: opts.project,
|
|
253
|
+
});
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function buildPluginRemoveSpec(ctx) {
|
|
258
|
+
return defineCommand({
|
|
259
|
+
name: 'remove',
|
|
260
|
+
description: 'Uninstall a plugin (and remove from opensip-cli.config.yml for fit/sim packs)',
|
|
261
|
+
commonFlags: ['json'],
|
|
262
|
+
options: [
|
|
263
|
+
{
|
|
264
|
+
flag: '--domain',
|
|
265
|
+
value: '<fit|sim|tool>',
|
|
266
|
+
description: 'Target domain (default: inferred from package name)',
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
flag: '--project',
|
|
270
|
+
description: 'For a tool plugin, target the project-local install instead of user-global',
|
|
271
|
+
default: false,
|
|
272
|
+
},
|
|
273
|
+
pluginCwdOption(),
|
|
274
|
+
],
|
|
275
|
+
// Empty description — see the plugin-add note above (byte-identical --help).
|
|
276
|
+
args: [{ name: 'package', description: '' }],
|
|
277
|
+
scope: PROJECT_SCOPE,
|
|
278
|
+
output: COMMAND_RESULT,
|
|
279
|
+
handler: (rawOpts) => {
|
|
280
|
+
const opts = rawOpts;
|
|
281
|
+
const packageName = opts._args[0];
|
|
282
|
+
return pluginRemove(packageName, effectiveCwd(opts), opts.domain, ctx.pluginLayouts, {
|
|
283
|
+
project: opts.project,
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function buildPluginSyncSpec(ctx) {
|
|
289
|
+
return defineCommand({
|
|
290
|
+
name: 'sync',
|
|
291
|
+
description: 'Install every plugin declared in opensip-cli.config.yml (post-clone bootstrap)',
|
|
292
|
+
commonFlags: ['json'],
|
|
293
|
+
options: [
|
|
294
|
+
{ flag: '--domain', value: '<fit|sim>', description: 'Sync only one domain' },
|
|
295
|
+
pluginCwdOption(),
|
|
296
|
+
],
|
|
297
|
+
scope: PROJECT_SCOPE,
|
|
298
|
+
output: COMMAND_RESULT,
|
|
299
|
+
handler: (rawOpts) => {
|
|
300
|
+
const opts = rawOpts;
|
|
301
|
+
return pluginSync(effectiveCwd(opts), opts.domain, ctx.pluginLayouts);
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* The action-less Commander subcommand GROUPS that legitimately cannot be a
|
|
307
|
+
* single {@link CommandSpec} — they have no action body, only sub-subcommands.
|
|
308
|
+
* This is the FINITE, NAMED set the Phase 7 `command-surface-parity` guardrail
|
|
309
|
+
* allow-lists as documented host exceptions. Every other host command IS a spec.
|
|
310
|
+
*/
|
|
311
|
+
export const HOST_SUBCOMMAND_GROUPS = ['sessions', 'plugin', 'tools'];
|
|
312
|
+
/**
|
|
313
|
+
* Build the subcommand-group parents with their leaf specs. The mounter turns
|
|
314
|
+
* each into a raw parent `program.command(name)` plus `mountCommandSpec(parent,
|
|
315
|
+
* leaf)` for each leaf.
|
|
316
|
+
*/
|
|
317
|
+
export function buildHostSubcommandGroups(ctx) {
|
|
318
|
+
return [
|
|
319
|
+
{
|
|
320
|
+
name: 'sessions',
|
|
321
|
+
description: 'Manage session data',
|
|
322
|
+
leaves: [buildSessionsListSpec(ctx), buildSessionsShowSpec(ctx), buildSessionsPurgeSpec(ctx)],
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: 'plugin',
|
|
326
|
+
description: 'Manage project-local plugins (add, list, remove, sync)',
|
|
327
|
+
leaves: [
|
|
328
|
+
buildPluginListSpec(ctx),
|
|
329
|
+
buildPluginAddSpec(ctx),
|
|
330
|
+
buildPluginRemoveSpec(ctx),
|
|
331
|
+
buildPluginSyncSpec(ctx),
|
|
332
|
+
],
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: 'tools',
|
|
336
|
+
description: 'Manage whole Tool plugins (list, validate, install, uninstall)',
|
|
337
|
+
leaves: buildToolsGroupLeaves(ctx),
|
|
338
|
+
},
|
|
339
|
+
];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* A no-op {@link CliCommandsContext} used purely to BUILD the group leaf specs
|
|
343
|
+
* so their `name` can be read for the completion-script sub-subcommand
|
|
344
|
+
* inventory. The handlers are never invoked here — we only inspect the static
|
|
345
|
+
* declarations — so the render/datastore/exit members are inert stubs.
|
|
346
|
+
*/
|
|
347
|
+
const INVENTORY_CTX = {
|
|
348
|
+
setExitCode: () => {
|
|
349
|
+
/* inert — inventory builds never dispatch a handler */
|
|
350
|
+
},
|
|
351
|
+
render: () => Promise.resolve(),
|
|
352
|
+
emitJson: () => {
|
|
353
|
+
/* inert — inventory builds never dispatch a handler */
|
|
354
|
+
},
|
|
355
|
+
emitRaw: () => {
|
|
356
|
+
/* inert — inventory builds never dispatch a handler */
|
|
357
|
+
},
|
|
358
|
+
emitError: () => {
|
|
359
|
+
/* inert — inventory builds never dispatch a handler */
|
|
360
|
+
},
|
|
361
|
+
pluginLayouts: [],
|
|
362
|
+
toolScaffolds: [],
|
|
363
|
+
// eslint-disable-next-line unicorn/no-useless-undefined -- explicit no-store sentinel matching the `datastore` thunk contract (returns `unknown`; consumers cast to `DataStore | undefined`).
|
|
364
|
+
datastore: () => undefined,
|
|
365
|
+
};
|
|
366
|
+
/** Build the host subcommand-group name inventory (single source for completion). */
|
|
367
|
+
export function buildHostCommandInventory() {
|
|
368
|
+
const groupSubcommands = {};
|
|
369
|
+
for (const group of buildHostSubcommandGroups(INVENTORY_CTX)) {
|
|
370
|
+
groupSubcommands[group.name] = group.leaves.map((l) => l.name);
|
|
371
|
+
}
|
|
372
|
+
return { groupSubcommands };
|
|
373
|
+
}
|
|
374
|
+
//# sourceMappingURL=host-subcommand-groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-subcommand-groups.js","sourceRoot":"","sources":["../../src/commands/host-subcommand-groups.ts"],"names":[],"mappings":"AAAA,2cAA2c;AAC3c;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,GAKd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAQ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CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commands — orchestrator for the CLI-owned (host) subcommands.
|
|
3
|
+
*
|
|
4
|
+
* Cross-tool housekeeping that doesn't belong to any single tool:
|
|
5
|
+
*
|
|
6
|
+
* - `init` — scaffold opensip-cli.config.yml + example tree
|
|
7
|
+
* - `report` — compose + open the cross-tool HTML report
|
|
8
|
+
* - `sessions` — `list` / `purge`
|
|
9
|
+
* - `configure` — set up the OpenSIP Cloud API key
|
|
10
|
+
* - `plugin` — `list` / `add` / `remove` / `sync`
|
|
11
|
+
* - `completion` — print a shell-completion script
|
|
12
|
+
* - `uninstall` — remove user-level / project-local state
|
|
13
|
+
*
|
|
14
|
+
* Launch Phase 6: every host command is now a declarative
|
|
15
|
+
* `CommandSpec` mounted through the SAME `mountCommandSpec` plane the tools
|
|
16
|
+
* use (`host-command-specs.ts`). The former per-command `register-*.ts`
|
|
17
|
+
* registrars (hand-rolled `.command().option().action()` bodies) are gone —
|
|
18
|
+
* host and tool commands share ONE mounting path, so the Phase 7
|
|
19
|
+
* `command-surface-parity` guardrail sees a single uniform surface with no
|
|
20
|
+
* two-tier privilege.
|
|
21
|
+
*
|
|
22
|
+
* Tool-owned subcommands (`fit`, `sim`, `graph`, …) are mounted separately by
|
|
23
|
+
* walking the CLI-managed tool registry (`mountToolCommands`), which mounts
|
|
24
|
+
* each tool's `commandSpecs` via the same `mountCommandSpec`.
|
|
25
|
+
*/
|
|
26
|
+
import type { CliCommandsContext } from './shared.js';
|
|
27
|
+
import type { Command } from 'commander';
|
|
28
|
+
export type { CliCommandsContext } from './shared.js';
|
|
29
|
+
/**
|
|
30
|
+
* Mount the CLI-owned host commands onto the supplied Commander program.
|
|
31
|
+
* Pure function — no module-level side effects, no closure over globals — so
|
|
32
|
+
* tests can register commands against a fresh `Command` instance and inspect
|
|
33
|
+
* the resulting subcommand tree.
|
|
34
|
+
*/
|
|
35
|
+
export declare function registerCliCommands(program: Command, ctx: CliCommandsContext): void;
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,kBAAkB,GAAG,IAAI,CAEnF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commands — orchestrator for the CLI-owned (host) subcommands.
|
|
3
|
+
*
|
|
4
|
+
* Cross-tool housekeeping that doesn't belong to any single tool:
|
|
5
|
+
*
|
|
6
|
+
* - `init` — scaffold opensip-cli.config.yml + example tree
|
|
7
|
+
* - `report` — compose + open the cross-tool HTML report
|
|
8
|
+
* - `sessions` — `list` / `purge`
|
|
9
|
+
* - `configure` — set up the OpenSIP Cloud API key
|
|
10
|
+
* - `plugin` — `list` / `add` / `remove` / `sync`
|
|
11
|
+
* - `completion` — print a shell-completion script
|
|
12
|
+
* - `uninstall` — remove user-level / project-local state
|
|
13
|
+
*
|
|
14
|
+
* Launch Phase 6: every host command is now a declarative
|
|
15
|
+
* `CommandSpec` mounted through the SAME `mountCommandSpec` plane the tools
|
|
16
|
+
* use (`host-command-specs.ts`). The former per-command `register-*.ts`
|
|
17
|
+
* registrars (hand-rolled `.command().option().action()` bodies) are gone —
|
|
18
|
+
* host and tool commands share ONE mounting path, so the Phase 7
|
|
19
|
+
* `command-surface-parity` guardrail sees a single uniform surface with no
|
|
20
|
+
* two-tier privilege.
|
|
21
|
+
*
|
|
22
|
+
* Tool-owned subcommands (`fit`, `sim`, `graph`, …) are mounted separately by
|
|
23
|
+
* walking the CLI-managed tool registry (`mountToolCommands`), which mounts
|
|
24
|
+
* each tool's `commandSpecs` via the same `mountCommandSpec`.
|
|
25
|
+
*/
|
|
26
|
+
import { mountHostCommands } from './host-command-specs.js';
|
|
27
|
+
/**
|
|
28
|
+
* Mount the CLI-owned host commands onto the supplied Commander program.
|
|
29
|
+
* Pure function — no module-level side effects, no closure over globals — so
|
|
30
|
+
* tests can register commands against a fresh `Command` instance and inspect
|
|
31
|
+
* the resulting subcommand tree.
|
|
32
|
+
*/
|
|
33
|
+
export function registerCliCommands(program, ctx) {
|
|
34
|
+
mountHostCommands(program, ctx);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAO5D;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgB,EAAE,GAAuB;IAC3E,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-owned document skeleton for the `opensip init` config.
|
|
3
|
+
*
|
|
4
|
+
* Owns ONLY the document-level bytes: the YAML header, `schemaVersion`,
|
|
5
|
+
* `globalExcludes`, and the per-language `targets:` blocks. Each tool's
|
|
6
|
+
* own config block (e.g. `fitness:`) is contributed by the tool via
|
|
7
|
+
* `Tool.scaffoldConfigBlock()` (ADR-0038 Decision 2) and appended here —
|
|
8
|
+
* the host never hard-codes a tool's namespace. The example check / recipe
|
|
9
|
+
* / scenario `.mjs` bytes and the pinned check-id universe likewise live in
|
|
10
|
+
* the owning tool's `scaffold/` (relocated out of this file in ADR-0038
|
|
11
|
+
* Phases 1–2).
|
|
12
|
+
*/
|
|
13
|
+
import type { SupportedLanguage } from './language-detection.js';
|
|
14
|
+
import type { ToolScaffold } from '../shared.js';
|
|
15
|
+
export declare function generateConfig(languages: readonly SupportedLanguage[], toolScaffolds: readonly ToolScaffold[]): string;
|
|
16
|
+
//# sourceMappingURL=config-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-templates.d.ts","sourceRoot":"","sources":["../../../src/commands/init/config-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAiFjD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,iBAAiB,EAAE,EACvC,aAAa,EAAE,SAAS,YAAY,EAAE,GACrC,MAAM,CAkBR"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-owned document skeleton for the `opensip init` config.
|
|
3
|
+
*
|
|
4
|
+
* Owns ONLY the document-level bytes: the YAML header, `schemaVersion`,
|
|
5
|
+
* `globalExcludes`, and the per-language `targets:` blocks. Each tool's
|
|
6
|
+
* own config block (e.g. `fitness:`) is contributed by the tool via
|
|
7
|
+
* `Tool.scaffoldConfigBlock()` (ADR-0038 Decision 2) and appended here —
|
|
8
|
+
* the host never hard-codes a tool's namespace. The example check / recipe
|
|
9
|
+
* / scenario `.mjs` bytes and the pinned check-id universe likewise live in
|
|
10
|
+
* the owning tool's `scaffold/` (relocated out of this file in ADR-0038
|
|
11
|
+
* Phases 1–2).
|
|
12
|
+
*/
|
|
13
|
+
import { renderDocumentHeader } from '@opensip-cli/config';
|
|
14
|
+
import { CLI_SUPPORTED_SCHEMA_VERSION } from '@opensip-cli/core';
|
|
15
|
+
function targetTemplate(lang) {
|
|
16
|
+
switch (lang) {
|
|
17
|
+
case 'typescript': {
|
|
18
|
+
return {
|
|
19
|
+
name: 'typescript-source',
|
|
20
|
+
description: 'TypeScript / TSX source code',
|
|
21
|
+
languages: ['typescript'],
|
|
22
|
+
include: [
|
|
23
|
+
'src/**/*.ts',
|
|
24
|
+
'src/**/*.tsx',
|
|
25
|
+
'packages/*/src/**/*.ts',
|
|
26
|
+
'packages/*/src/**/*.tsx',
|
|
27
|
+
],
|
|
28
|
+
exclude: [
|
|
29
|
+
'**/*.test.ts',
|
|
30
|
+
'**/*.test.tsx',
|
|
31
|
+
'**/__tests__/**',
|
|
32
|
+
'**/node_modules/**',
|
|
33
|
+
'**/dist/**',
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
case 'rust': {
|
|
38
|
+
return {
|
|
39
|
+
name: 'rust-source',
|
|
40
|
+
description: 'Rust source code',
|
|
41
|
+
languages: ['rust'],
|
|
42
|
+
include: ['src/**/*.rs', 'crates/**/*.rs', 'services/**/*.rs'],
|
|
43
|
+
exclude: ['**/target/**'],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
case 'python': {
|
|
47
|
+
return {
|
|
48
|
+
name: 'python-source',
|
|
49
|
+
description: 'Python source code',
|
|
50
|
+
languages: ['python'],
|
|
51
|
+
include: ['src/**/*.py', '**/*.py'],
|
|
52
|
+
exclude: [
|
|
53
|
+
'**/__pycache__/**',
|
|
54
|
+
'**/.venv/**',
|
|
55
|
+
'**/venv/**',
|
|
56
|
+
'**/dist/**',
|
|
57
|
+
'**/build/**',
|
|
58
|
+
'**/*.egg-info/**',
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
case 'go': {
|
|
63
|
+
return {
|
|
64
|
+
name: 'go-source',
|
|
65
|
+
description: 'Go source code',
|
|
66
|
+
languages: ['go'],
|
|
67
|
+
include: ['**/*.go'],
|
|
68
|
+
exclude: ['**/vendor/**', '**/_test.go'],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
case 'java': {
|
|
72
|
+
return {
|
|
73
|
+
name: 'java-source',
|
|
74
|
+
description: 'Java source code',
|
|
75
|
+
languages: ['java'],
|
|
76
|
+
include: ['src/main/java/**/*.java', 'src/**/*.java'],
|
|
77
|
+
exclude: ['**/target/**', '**/build/**', '**/*Test.java'],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
case 'cpp': {
|
|
81
|
+
return {
|
|
82
|
+
name: 'cpp-source',
|
|
83
|
+
description: 'C/C++ source code',
|
|
84
|
+
languages: ['cpp'],
|
|
85
|
+
include: ['src/**/*.{c,cpp,cc,h,hpp}', '**/*.{c,cpp,cc,h,hpp}'],
|
|
86
|
+
exclude: ['**/build/**', '**/cmake-build-*/**'],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export function generateConfig(languages, toolScaffolds) {
|
|
92
|
+
// The document-level skeleton (header, schemaVersion, globalExcludes, targets)
|
|
93
|
+
// is rendered by @opensip-cli/config — the package that also OWNS + validates
|
|
94
|
+
// those blocks (ADR-0023), so the scaffold cannot drift from what the
|
|
95
|
+
// composed schema accepts (asserted by a round-trip test). The CLI supplies the
|
|
96
|
+
// per-language target content; each registered tool contributes its own config
|
|
97
|
+
// block (ADR-0038 Decision 2 — fitness owns `fitness:`, sim contributes none).
|
|
98
|
+
const header = renderDocumentHeader({
|
|
99
|
+
schemaVersion: CLI_SUPPORTED_SCHEMA_VERSION,
|
|
100
|
+
targets: languages.map(targetTemplate),
|
|
101
|
+
});
|
|
102
|
+
const toolBlocks = toolScaffolds
|
|
103
|
+
.map((ts) => ts.scaffoldConfigBlock?.())
|
|
104
|
+
.filter((block) => block !== undefined)
|
|
105
|
+
.join('');
|
|
106
|
+
return `${header}\n${toolBlocks}`;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=config-templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-templates.js","sourceRoot":"","sources":["../../../src/commands/init/config-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,oBAAoB,EAA4B,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAOjE,SAAS,cAAc,CAAC,IAAuB;IAC7C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,YAAY,CAAC,CAAC,CAAC;YAClB,OAAO;gBACL,IAAI,EAAE,mBAAmB;gBACzB,WAAW,EAAE,8BAA8B;gBAC3C,SAAS,EAAE,CAAC,YAAY,CAAC;gBACzB,OAAO,EAAE;oBACP,aAAa;oBACb,cAAc;oBACd,wBAAwB;oBACxB,yBAAyB;iBAC1B;gBACD,OAAO,EAAE;oBACP,cAAc;oBACd,eAAe;oBACf,iBAAiB;oBACjB,oBAAoB;oBACpB,YAAY;iBACb;aACF,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO;gBACL,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,kBAAkB;gBAC/B,SAAS,EAAE,CAAC,MAAM,CAAC;gBACnB,OAAO,EAAE,CAAC,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,CAAC;gBAC9D,OAAO,EAAE,CAAC,cAAc,CAAC;aAC1B,CAAC;QACJ,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,OAAO;gBACL,IAAI,EAAE,eAAe;gBACrB,WAAW,EAAE,oBAAoB;gBACjC,SAAS,EAAE,CAAC,QAAQ,CAAC;gBACrB,OAAO,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC;gBACnC,OAAO,EAAE;oBACP,mBAAmB;oBACnB,aAA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EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,mBAAmB,EAAE,EAAE,CAAC;SACvC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC;SACvD,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO,GAAG,MAAM,KAAK,UAAU,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-existing file classification for `opensip init`.
|
|
3
|
+
*
|
|
4
|
+
* Walks `opensip-cli/` (skipping `.runtime/`) and tags each file as
|
|
5
|
+
* 'scaffolded', 'stale-scaffolded', or 'custom' so `--keep` / `--remove`
|
|
6
|
+
* can decide what to overwrite and what to preserve.
|
|
7
|
+
*/
|
|
8
|
+
import type { SupportedLanguage } from './language-detection.js';
|
|
9
|
+
import type { ToolScaffold } from '../shared.js';
|
|
10
|
+
import type { PreExistingFile } from '@opensip-cli/contracts';
|
|
11
|
+
import type { ProjectPaths } from '@opensip-cli/core';
|
|
12
|
+
/**
|
|
13
|
+
* Walk every file under `opensip-cli/` (excluding `.runtime/`, which
|
|
14
|
+
* is gitignored runtime state and not user-authored) and tag each one.
|
|
15
|
+
*
|
|
16
|
+
* Classification rules:
|
|
17
|
+
*
|
|
18
|
+
* - 'scaffolded' — content matches a current-template byte-for-byte.
|
|
19
|
+
* - 'stale-scaffolded' — file shape matches a previous-language scaffold:
|
|
20
|
+
* filename `example-check-<lang>.mjs` for <lang>
|
|
21
|
+
* NOT in the current detection set, OR the file
|
|
22
|
+
* carries a pinned EXAMPLE_CHECK_IDS UUID for a
|
|
23
|
+
* language not in the current set.
|
|
24
|
+
* - 'custom' — anything else (user-authored).
|
|
25
|
+
*
|
|
26
|
+
* The walk is bounded to the `opensip-cli/` subtree (kilobytes in
|
|
27
|
+
* practice). The `.runtime/` subdir is skipped so caches/logs/sessions
|
|
28
|
+
* don't pollute the file list.
|
|
29
|
+
*
|
|
30
|
+
* Note on hash-based scaffolded detection: a scaffolded file that has
|
|
31
|
+
* been line-ending normalized (CRLF↔LF) or stripped of a trailing
|
|
32
|
+
* newline by an editor will not byte-for-byte match the template. In
|
|
33
|
+
* that case it falls back to 'custom' or 'stale-scaffolded' (when the
|
|
34
|
+
* UUID still matches but content drifted). The UUID-based fallback
|
|
35
|
+
* catches the common "stale language" case; cosmetic drift on a
|
|
36
|
+
* current-language file is treated as custom — which is the safer
|
|
37
|
+
* outcome (won't silently overwrite).
|
|
38
|
+
*/
|
|
39
|
+
export declare function classifyFiles(paths: ProjectPaths, currentLanguages: readonly SupportedLanguage[], toolScaffolds: readonly ToolScaffold[]): PreExistingFile[];
|
|
40
|
+
//# sourceMappingURL=file-classifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-classifier.d.ts","sourceRoot":"","sources":["../../../src/commands/init/file-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA8BtD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,YAAY,EACnB,gBAAgB,EAAE,SAAS,iBAAiB,EAAE,EAC9C,aAAa,EAAE,SAAS,YAAY,EAAE,GACrC,eAAe,EAAE,CA0DnB"}
|