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