@quenty/studio-bridge 0.7.1 → 0.8.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/CHANGELOG.md +12 -44
- package/README.md +166 -115
- package/dist/src/bridge/bridge-connection-remote.test.d.ts +7 -0
- package/dist/src/bridge/bridge-connection-remote.test.d.ts.map +1 -0
- package/dist/src/bridge/bridge-connection-remote.test.js +144 -0
- package/dist/src/bridge/bridge-connection-remote.test.js.map +1 -0
- package/dist/src/bridge/bridge-connection.d.ts +112 -0
- package/dist/src/bridge/bridge-connection.d.ts.map +1 -0
- package/dist/src/bridge/bridge-connection.js +528 -0
- package/dist/src/bridge/bridge-connection.js.map +1 -0
- package/dist/src/bridge/bridge-connection.test.d.ts +6 -0
- package/dist/src/bridge/bridge-connection.test.d.ts.map +1 -0
- package/dist/src/bridge/bridge-connection.test.js +773 -0
- package/dist/src/bridge/bridge-connection.test.js.map +1 -0
- package/dist/src/bridge/bridge-session.d.ts +38 -0
- package/dist/src/bridge/bridge-session.d.ts.map +1 -0
- package/dist/src/bridge/bridge-session.js +259 -0
- package/dist/src/bridge/bridge-session.js.map +1 -0
- package/dist/src/bridge/bridge-session.test.d.ts +6 -0
- package/dist/src/bridge/bridge-session.test.d.ts.map +1 -0
- package/dist/src/bridge/bridge-session.test.js +264 -0
- package/dist/src/bridge/bridge-session.test.js.map +1 -0
- package/dist/src/bridge/index.d.ts +13 -0
- package/dist/src/bridge/index.d.ts.map +1 -0
- package/dist/src/bridge/index.js +13 -0
- package/dist/src/bridge/index.js.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-crash.test.d.ts +9 -0
- package/dist/src/bridge/internal/__tests__/failover-crash.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-crash.test.js +159 -0
- package/dist/src/bridge/internal/__tests__/failover-crash.test.js.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-graceful.test.d.ts +9 -0
- package/dist/src/bridge/internal/__tests__/failover-graceful.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-graceful.test.js +218 -0
- package/dist/src/bridge/internal/__tests__/failover-graceful.test.js.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-inflight.test.d.ts +9 -0
- package/dist/src/bridge/internal/__tests__/failover-inflight.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-inflight.test.js +246 -0
- package/dist/src/bridge/internal/__tests__/failover-inflight.test.js.map +1 -0
- package/dist/src/bridge/internal/__tests__/host-client-integration.test.d.ts +10 -0
- package/dist/src/bridge/internal/__tests__/host-client-integration.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/__tests__/host-client-integration.test.js +298 -0
- package/dist/src/bridge/internal/__tests__/host-client-integration.test.js.map +1 -0
- package/dist/src/bridge/internal/bridge-client.d.ts +70 -0
- package/dist/src/bridge/internal/bridge-client.d.ts.map +1 -0
- package/dist/src/bridge/internal/bridge-client.js +344 -0
- package/dist/src/bridge/internal/bridge-client.js.map +1 -0
- package/dist/src/bridge/internal/bridge-client.test.d.ts +7 -0
- package/dist/src/bridge/internal/bridge-client.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/bridge-client.test.js +301 -0
- package/dist/src/bridge/internal/bridge-client.test.js.map +1 -0
- package/dist/src/bridge/internal/bridge-host.d.ts +78 -0
- package/dist/src/bridge/internal/bridge-host.d.ts.map +1 -0
- package/dist/src/bridge/internal/bridge-host.js +383 -0
- package/dist/src/bridge/internal/bridge-host.js.map +1 -0
- package/dist/src/bridge/internal/bridge-host.test.d.ts +7 -0
- package/dist/src/bridge/internal/bridge-host.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/bridge-host.test.js +377 -0
- package/dist/src/bridge/internal/bridge-host.test.js.map +1 -0
- package/dist/src/bridge/internal/environment-detection.d.ts +44 -0
- package/dist/src/bridge/internal/environment-detection.d.ts.map +1 -0
- package/dist/src/bridge/internal/environment-detection.js +91 -0
- package/dist/src/bridge/internal/environment-detection.js.map +1 -0
- package/dist/src/bridge/internal/environment-detection.test.d.ts +7 -0
- package/dist/src/bridge/internal/environment-detection.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/environment-detection.test.js +150 -0
- package/dist/src/bridge/internal/environment-detection.test.js.map +1 -0
- package/dist/src/bridge/internal/hand-off.d.ts +69 -0
- package/dist/src/bridge/internal/hand-off.d.ts.map +1 -0
- package/dist/src/bridge/internal/hand-off.js +178 -0
- package/dist/src/bridge/internal/hand-off.js.map +1 -0
- package/dist/src/bridge/internal/hand-off.test.d.ts +7 -0
- package/dist/src/bridge/internal/hand-off.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/hand-off.test.js +325 -0
- package/dist/src/bridge/internal/hand-off.test.js.map +1 -0
- package/dist/src/bridge/internal/health-endpoint.d.ts +32 -0
- package/dist/src/bridge/internal/health-endpoint.d.ts.map +1 -0
- package/dist/src/bridge/internal/health-endpoint.js +73 -0
- package/dist/src/bridge/internal/health-endpoint.js.map +1 -0
- package/dist/src/bridge/internal/health-endpoint.test.d.ts +6 -0
- package/dist/src/bridge/internal/health-endpoint.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/health-endpoint.test.js +122 -0
- package/dist/src/bridge/internal/health-endpoint.test.js.map +1 -0
- package/dist/src/bridge/internal/host-protocol.d.ts +60 -0
- package/dist/src/bridge/internal/host-protocol.d.ts.map +1 -0
- package/dist/src/bridge/internal/host-protocol.js +184 -0
- package/dist/src/bridge/internal/host-protocol.js.map +1 -0
- package/dist/src/bridge/internal/host-protocol.test.d.ts +6 -0
- package/dist/src/bridge/internal/host-protocol.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/host-protocol.test.js +307 -0
- package/dist/src/bridge/internal/host-protocol.test.js.map +1 -0
- package/dist/src/bridge/internal/session-tracker.d.ts +67 -0
- package/dist/src/bridge/internal/session-tracker.d.ts.map +1 -0
- package/dist/src/bridge/internal/session-tracker.js +138 -0
- package/dist/src/bridge/internal/session-tracker.js.map +1 -0
- package/dist/src/bridge/internal/session-tracker.test.d.ts +6 -0
- package/dist/src/bridge/internal/session-tracker.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/session-tracker.test.js +342 -0
- package/dist/src/bridge/internal/session-tracker.test.js.map +1 -0
- package/dist/src/bridge/internal/transport-client.d.ts +43 -0
- package/dist/src/bridge/internal/transport-client.d.ts.map +1 -0
- package/dist/src/bridge/internal/transport-client.js +146 -0
- package/dist/src/bridge/internal/transport-client.js.map +1 -0
- package/dist/src/bridge/internal/transport-client.test.d.ts +6 -0
- package/dist/src/bridge/internal/transport-client.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/transport-client.test.js +176 -0
- package/dist/src/bridge/internal/transport-client.test.js.map +1 -0
- package/dist/src/bridge/internal/transport-server.d.ts +59 -0
- package/dist/src/bridge/internal/transport-server.d.ts.map +1 -0
- package/dist/src/bridge/internal/transport-server.js +189 -0
- package/dist/src/bridge/internal/transport-server.js.map +1 -0
- package/dist/src/bridge/internal/transport-server.test.d.ts +6 -0
- package/dist/src/bridge/internal/transport-server.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/transport-server.test.js +171 -0
- package/dist/src/bridge/internal/transport-server.test.js.map +1 -0
- package/dist/src/bridge/types.d.ts +117 -0
- package/dist/src/bridge/types.d.ts.map +1 -0
- package/dist/src/bridge/types.js +68 -0
- package/dist/src/bridge/types.js.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.d.ts +6 -0
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.js +260 -0
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.js.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter.d.ts +39 -0
- package/dist/src/cli/adapters/cli-command-adapter.d.ts.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter.js +241 -0
- package/dist/src/cli/adapters/cli-command-adapter.js.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter.test.d.ts +5 -0
- package/dist/src/cli/adapters/cli-command-adapter.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter.test.js +188 -0
- package/dist/src/cli/adapters/cli-command-adapter.test.js.map +1 -0
- package/dist/src/cli/adapters/group-builder.d.ts +29 -0
- package/dist/src/cli/adapters/group-builder.d.ts.map +1 -0
- package/dist/src/cli/adapters/group-builder.js +54 -0
- package/dist/src/cli/adapters/group-builder.js.map +1 -0
- package/dist/src/cli/adapters/group-builder.test.d.ts +5 -0
- package/dist/src/cli/adapters/group-builder.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/group-builder.test.js +108 -0
- package/dist/src/cli/adapters/group-builder.test.js.map +1 -0
- package/dist/src/cli/adapters/help-formatter.d.ts +11 -0
- package/dist/src/cli/adapters/help-formatter.d.ts.map +1 -0
- package/dist/src/cli/adapters/help-formatter.js +78 -0
- package/dist/src/cli/adapters/help-formatter.js.map +1 -0
- package/dist/src/cli/adapters/help-formatter.test.d.ts +5 -0
- package/dist/src/cli/adapters/help-formatter.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/help-formatter.test.js +79 -0
- package/dist/src/cli/adapters/help-formatter.test.js.map +1 -0
- package/dist/src/cli/adapters/target-resolver.d.ts +54 -0
- package/dist/src/cli/adapters/target-resolver.d.ts.map +1 -0
- package/dist/src/cli/adapters/target-resolver.js +90 -0
- package/dist/src/cli/adapters/target-resolver.js.map +1 -0
- package/dist/src/cli/adapters/target-resolver.test.d.ts +5 -0
- package/dist/src/cli/adapters/target-resolver.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/target-resolver.test.js +169 -0
- package/dist/src/cli/adapters/target-resolver.test.js.map +1 -0
- package/dist/src/cli/args/global-args.d.ts +2 -0
- package/dist/src/cli/args/global-args.d.ts.map +1 -1
- package/dist/src/cli/cli.d.ts +6 -3
- package/dist/src/cli/cli.d.ts.map +1 -1
- package/dist/src/cli/cli.js +82 -20
- package/dist/src/cli/cli.js.map +1 -1
- package/dist/src/cli/resolve-script-content.d.ts +19 -0
- package/dist/src/cli/resolve-script-content.d.ts.map +1 -0
- package/dist/src/cli/resolve-script-content.js +22 -0
- package/dist/src/cli/resolve-script-content.js.map +1 -0
- package/dist/src/cli/resolve-session.d.ts +21 -0
- package/dist/src/cli/resolve-session.d.ts.map +1 -0
- package/dist/src/cli/resolve-session.js +40 -0
- package/dist/src/cli/resolve-session.js.map +1 -0
- package/dist/src/cli/resolve-session.test.d.ts +5 -0
- package/dist/src/cli/resolve-session.test.d.ts.map +1 -0
- package/dist/src/cli/resolve-session.test.js +112 -0
- package/dist/src/cli/resolve-session.test.js.map +1 -0
- package/dist/src/cli/script-executor.d.ts +1 -0
- package/dist/src/cli/script-executor.d.ts.map +1 -1
- package/dist/src/cli/script-executor.js +7 -1
- package/dist/src/cli/script-executor.js.map +1 -1
- package/dist/src/cli/types.d.ts +11 -0
- package/dist/src/cli/types.d.ts.map +1 -0
- package/dist/src/cli/types.js +5 -0
- package/dist/src/cli/types.js.map +1 -0
- package/dist/src/commands/connect.d.ts +16 -0
- package/dist/src/commands/connect.d.ts.map +1 -0
- package/dist/src/commands/connect.js +15 -0
- package/dist/src/commands/connect.js.map +1 -0
- package/dist/src/commands/connect.test.d.ts +5 -0
- package/dist/src/commands/connect.test.d.ts.map +1 -0
- package/dist/src/commands/connect.test.js +46 -0
- package/dist/src/commands/connect.test.js.map +1 -0
- package/dist/src/commands/console/exec/exec.d.ts +43 -0
- package/dist/src/commands/console/exec/exec.d.ts.map +1 -0
- package/dist/src/commands/console/exec/exec.js +79 -0
- package/dist/src/commands/console/exec/exec.js.map +1 -0
- package/dist/src/commands/console/exec/exec.test.d.ts +5 -0
- package/dist/src/commands/console/exec/exec.test.d.ts.map +1 -0
- package/dist/src/commands/console/exec/exec.test.js +191 -0
- package/dist/src/commands/console/exec/exec.test.js.map +1 -0
- package/dist/src/commands/console/logs/logs.d.ts +23 -0
- package/dist/src/commands/console/logs/logs.d.ts.map +1 -0
- package/dist/src/commands/console/logs/logs.js +80 -0
- package/dist/src/commands/console/logs/logs.js.map +1 -0
- package/dist/src/commands/console/logs/logs.test.d.ts +5 -0
- package/dist/src/commands/console/logs/logs.test.d.ts.map +1 -0
- package/dist/src/commands/console/logs/logs.test.js +111 -0
- package/dist/src/commands/console/logs/logs.test.js.map +1 -0
- package/dist/src/commands/disconnect.d.ts +9 -0
- package/dist/src/commands/disconnect.d.ts.map +1 -0
- package/dist/src/commands/disconnect.js +8 -0
- package/dist/src/commands/disconnect.js.map +1 -0
- package/dist/src/commands/disconnect.test.d.ts +5 -0
- package/dist/src/commands/disconnect.test.d.ts.map +1 -0
- package/dist/src/commands/disconnect.test.js +17 -0
- package/dist/src/commands/disconnect.test.js.map +1 -0
- package/dist/src/commands/explorer/query/query.d.ts +31 -0
- package/dist/src/commands/explorer/query/query.d.ts.map +1 -0
- package/dist/src/commands/explorer/query/query.js +106 -0
- package/dist/src/commands/explorer/query/query.js.map +1 -0
- package/dist/src/commands/explorer/query/query.test.d.ts +5 -0
- package/dist/src/commands/explorer/query/query.test.d.ts.map +1 -0
- package/dist/src/commands/explorer/query/query.test.js +228 -0
- package/dist/src/commands/explorer/query/query.test.js.map +1 -0
- package/dist/src/commands/formatters.test.d.ts +6 -0
- package/dist/src/commands/formatters.test.d.ts.map +1 -0
- package/dist/src/commands/formatters.test.js +211 -0
- package/dist/src/commands/formatters.test.js.map +1 -0
- package/dist/src/commands/framework/action-loader.d.ts +25 -0
- package/dist/src/commands/framework/action-loader.d.ts.map +1 -0
- package/dist/src/commands/framework/action-loader.js +46 -0
- package/dist/src/commands/framework/action-loader.js.map +1 -0
- package/dist/src/commands/framework/action-loader.test.d.ts +5 -0
- package/dist/src/commands/framework/action-loader.test.d.ts.map +1 -0
- package/dist/src/commands/framework/action-loader.test.js +89 -0
- package/dist/src/commands/framework/action-loader.test.js.map +1 -0
- package/dist/src/commands/framework/arg-builder.d.ts +92 -0
- package/dist/src/commands/framework/arg-builder.d.ts.map +1 -0
- package/dist/src/commands/framework/arg-builder.js +137 -0
- package/dist/src/commands/framework/arg-builder.js.map +1 -0
- package/dist/src/commands/framework/arg-builder.test.d.ts +5 -0
- package/dist/src/commands/framework/arg-builder.test.d.ts.map +1 -0
- package/dist/src/commands/framework/arg-builder.test.js +246 -0
- package/dist/src/commands/framework/arg-builder.test.js.map +1 -0
- package/dist/src/commands/framework/command-registry.d.ts +23 -0
- package/dist/src/commands/framework/command-registry.d.ts.map +1 -0
- package/dist/src/commands/framework/command-registry.js +42 -0
- package/dist/src/commands/framework/command-registry.js.map +1 -0
- package/dist/src/commands/framework/command-registry.test.d.ts +5 -0
- package/dist/src/commands/framework/command-registry.test.d.ts.map +1 -0
- package/dist/src/commands/framework/command-registry.test.js +158 -0
- package/dist/src/commands/framework/command-registry.test.js.map +1 -0
- package/dist/src/commands/framework/define-command.d.ts +76 -0
- package/dist/src/commands/framework/define-command.d.ts.map +1 -0
- package/dist/src/commands/framework/define-command.js +28 -0
- package/dist/src/commands/framework/define-command.js.map +1 -0
- package/dist/src/commands/framework/define-command.test.d.ts +5 -0
- package/dist/src/commands/framework/define-command.test.d.ts.map +1 -0
- package/dist/src/commands/framework/define-command.test.js +135 -0
- package/dist/src/commands/framework/define-command.test.js.map +1 -0
- package/dist/src/commands/framework/index.d.ts +8 -0
- package/dist/src/commands/framework/index.d.ts.map +1 -0
- package/dist/src/commands/framework/index.js +8 -0
- package/dist/src/commands/framework/index.js.map +1 -0
- package/dist/src/commands/index.d.ts +20 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +20 -0
- package/dist/src/commands/index.js.map +1 -0
- package/dist/src/commands/linux/inject-credentials/inject-credentials.d.ts +15 -0
- package/dist/src/commands/linux/inject-credentials/inject-credentials.d.ts.map +1 -0
- package/dist/src/commands/linux/inject-credentials/inject-credentials.js +88 -0
- package/dist/src/commands/linux/inject-credentials/inject-credentials.js.map +1 -0
- package/dist/src/commands/linux/setup/setup.d.ts +19 -0
- package/dist/src/commands/linux/setup/setup.d.ts.map +1 -0
- package/dist/src/commands/linux/setup/setup.js +107 -0
- package/dist/src/commands/linux/setup/setup.js.map +1 -0
- package/dist/src/commands/linux/status/status.d.ts +34 -0
- package/dist/src/commands/linux/status/status.d.ts.map +1 -0
- package/dist/src/commands/linux/status/status.js +134 -0
- package/dist/src/commands/linux/status/status.js.map +1 -0
- package/dist/src/commands/plugin/install/install.d.ts +10 -0
- package/dist/src/commands/plugin/install/install.d.ts.map +1 -0
- package/dist/src/commands/plugin/install/install.js +23 -0
- package/dist/src/commands/plugin/install/install.js.map +1 -0
- package/dist/src/commands/plugin/uninstall/uninstall.d.ts +9 -0
- package/dist/src/commands/plugin/uninstall/uninstall.d.ts.map +1 -0
- package/dist/src/commands/plugin/uninstall/uninstall.js +41 -0
- package/dist/src/commands/plugin/uninstall/uninstall.js.map +1 -0
- package/dist/src/commands/process/close/close.d.ts +22 -0
- package/dist/src/commands/process/close/close.d.ts.map +1 -0
- package/dist/src/commands/process/close/close.js +34 -0
- package/dist/src/commands/process/close/close.js.map +1 -0
- package/dist/src/commands/process/format-state.d.ts +7 -0
- package/dist/src/commands/process/format-state.d.ts.map +1 -0
- package/dist/src/commands/process/format-state.js +19 -0
- package/dist/src/commands/process/format-state.js.map +1 -0
- package/dist/src/commands/process/info/info.d.ts +17 -0
- package/dist/src/commands/process/info/info.d.ts.map +1 -0
- package/dist/src/commands/process/info/info.js +38 -0
- package/dist/src/commands/process/info/info.js.map +1 -0
- package/dist/src/commands/process/info/info.test.d.ts +5 -0
- package/dist/src/commands/process/info/info.test.d.ts.map +1 -0
- package/dist/src/commands/process/info/info.test.js +58 -0
- package/dist/src/commands/process/info/info.test.js.map +1 -0
- package/dist/src/commands/process/launch/launch.d.ts +17 -0
- package/dist/src/commands/process/launch/launch.d.ts.map +1 -0
- package/dist/src/commands/process/launch/launch.js +26 -0
- package/dist/src/commands/process/launch/launch.js.map +1 -0
- package/dist/src/commands/process/launch/launch.test.d.ts +5 -0
- package/dist/src/commands/process/launch/launch.test.d.ts.map +1 -0
- package/dist/src/commands/process/launch/launch.test.js +49 -0
- package/dist/src/commands/process/launch/launch.test.js.map +1 -0
- package/dist/src/commands/process/list/list.d.ts +16 -0
- package/dist/src/commands/process/list/list.d.ts.map +1 -0
- package/dist/src/commands/process/list/list.js +56 -0
- package/dist/src/commands/process/list/list.js.map +1 -0
- package/dist/src/commands/process/list/list.test.d.ts +5 -0
- package/dist/src/commands/process/list/list.test.d.ts.map +1 -0
- package/dist/src/commands/process/list/list.test.js +71 -0
- package/dist/src/commands/process/list/list.test.js.map +1 -0
- package/dist/src/commands/process/run/run.d.ts +31 -0
- package/dist/src/commands/process/run/run.d.ts.map +1 -0
- package/dist/src/commands/process/run/run.js +63 -0
- package/dist/src/commands/process/run/run.js.map +1 -0
- package/dist/src/commands/rgba-to-png.d.ts +17 -0
- package/dist/src/commands/rgba-to-png.d.ts.map +1 -0
- package/dist/src/commands/rgba-to-png.js +85 -0
- package/dist/src/commands/rgba-to-png.js.map +1 -0
- package/dist/src/commands/serve/serve.d.ts +17 -0
- package/dist/src/commands/serve/serve.d.ts.map +1 -0
- package/dist/src/commands/serve/serve.js +128 -0
- package/dist/src/commands/serve/serve.js.map +1 -0
- package/dist/src/commands/serve/serve.test.d.ts +5 -0
- package/dist/src/commands/serve/serve.test.d.ts.map +1 -0
- package/dist/src/commands/serve/serve.test.js +100 -0
- package/dist/src/commands/serve/serve.test.js.map +1 -0
- package/dist/src/commands/viewport/screenshot/screenshot.d.ts +17 -0
- package/dist/src/commands/viewport/screenshot/screenshot.d.ts.map +1 -0
- package/dist/src/commands/viewport/screenshot/screenshot.js +45 -0
- package/dist/src/commands/viewport/screenshot/screenshot.js.map +1 -0
- package/dist/src/commands/viewport/screenshot/screenshot.test.d.ts +5 -0
- package/dist/src/commands/viewport/screenshot/screenshot.test.d.ts.map +1 -0
- package/dist/src/commands/viewport/screenshot/screenshot.test.js +143 -0
- package/dist/src/commands/viewport/screenshot/screenshot.test.js.map +1 -0
- package/dist/src/docker/docker-delegator.d.ts +30 -0
- package/dist/src/docker/docker-delegator.d.ts.map +1 -0
- package/dist/src/docker/docker-delegator.js +201 -0
- package/dist/src/docker/docker-delegator.js.map +1 -0
- package/dist/src/docker/docker-delegator.test.d.ts +2 -0
- package/dist/src/docker/docker-delegator.test.d.ts.map +1 -0
- package/dist/src/docker/docker-delegator.test.js +132 -0
- package/dist/src/docker/docker-delegator.test.js.map +1 -0
- package/dist/src/index.d.ts +9 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.test.d.ts +2 -0
- package/dist/src/index.test.d.ts.map +1 -0
- package/dist/src/index.test.js +51 -0
- package/dist/src/index.test.js.map +1 -0
- package/dist/src/linux/index.d.ts +12 -0
- package/dist/src/linux/index.d.ts.map +1 -0
- package/dist/src/linux/index.js +11 -0
- package/dist/src/linux/index.js.map +1 -0
- package/dist/src/linux/linux-config.d.ts +37 -0
- package/dist/src/linux/linux-config.d.ts.map +1 -0
- package/dist/src/linux/linux-config.js +70 -0
- package/dist/src/linux/linux-config.js.map +1 -0
- package/dist/src/linux/linux-config.test.d.ts +2 -0
- package/dist/src/linux/linux-config.test.d.ts.map +1 -0
- package/dist/src/linux/linux-config.test.js +54 -0
- package/dist/src/linux/linux-config.test.js.map +1 -0
- package/dist/src/linux/linux-credential-writer.d.ts +35 -0
- package/dist/src/linux/linux-credential-writer.d.ts.map +1 -0
- package/dist/src/linux/linux-credential-writer.js +300 -0
- package/dist/src/linux/linux-credential-writer.js.map +1 -0
- package/dist/src/linux/linux-display-manager.d.ts +24 -0
- package/dist/src/linux/linux-display-manager.d.ts.map +1 -0
- package/dist/src/linux/linux-display-manager.js +92 -0
- package/dist/src/linux/linux-display-manager.js.map +1 -0
- package/dist/src/linux/linux-env-guard.d.ts +13 -0
- package/dist/src/linux/linux-env-guard.d.ts.map +1 -0
- package/dist/src/linux/linux-env-guard.js +31 -0
- package/dist/src/linux/linux-env-guard.js.map +1 -0
- package/dist/src/linux/linux-env-guard.test.d.ts +2 -0
- package/dist/src/linux/linux-env-guard.test.d.ts.map +1 -0
- package/dist/src/linux/linux-env-guard.test.js +48 -0
- package/dist/src/linux/linux-env-guard.test.js.map +1 -0
- package/dist/src/linux/linux-fflags.d.ts +17 -0
- package/dist/src/linux/linux-fflags.d.ts.map +1 -0
- package/dist/src/linux/linux-fflags.js +33 -0
- package/dist/src/linux/linux-fflags.js.map +1 -0
- package/dist/src/linux/linux-fflags.test.d.ts +2 -0
- package/dist/src/linux/linux-fflags.test.d.ts.map +1 -0
- package/dist/src/linux/linux-fflags.test.js +55 -0
- package/dist/src/linux/linux-fflags.test.js.map +1 -0
- package/dist/src/linux/linux-prerequisites.d.ts +24 -0
- package/dist/src/linux/linux-prerequisites.d.ts.map +1 -0
- package/dist/src/linux/linux-prerequisites.js +118 -0
- package/dist/src/linux/linux-prerequisites.js.map +1 -0
- package/dist/src/linux/linux-shader-patcher.d.ts +17 -0
- package/dist/src/linux/linux-shader-patcher.d.ts.map +1 -0
- package/dist/src/linux/linux-shader-patcher.js +48 -0
- package/dist/src/linux/linux-shader-patcher.js.map +1 -0
- package/dist/src/linux/linux-shader-patcher.test.d.ts +2 -0
- package/dist/src/linux/linux-shader-patcher.test.d.ts.map +1 -0
- package/dist/src/linux/linux-shader-patcher.test.js +55 -0
- package/dist/src/linux/linux-shader-patcher.test.js.map +1 -0
- package/dist/src/linux/linux-studio-installer.d.ts +10 -0
- package/dist/src/linux/linux-studio-installer.d.ts.map +1 -0
- package/dist/src/linux/linux-studio-installer.js +79 -0
- package/dist/src/linux/linux-studio-installer.js.map +1 -0
- package/dist/src/linux/linux-studio-launcher.d.ts +10 -0
- package/dist/src/linux/linux-studio-launcher.d.ts.map +1 -0
- package/dist/src/linux/linux-studio-launcher.js +73 -0
- package/dist/src/linux/linux-studio-launcher.js.map +1 -0
- package/dist/src/linux/linux-version-resolver.d.ts +18 -0
- package/dist/src/linux/linux-version-resolver.d.ts.map +1 -0
- package/dist/src/linux/linux-version-resolver.js +49 -0
- package/dist/src/linux/linux-version-resolver.js.map +1 -0
- package/dist/src/linux/linux-wine-env.d.ts +11 -0
- package/dist/src/linux/linux-wine-env.d.ts.map +1 -0
- package/dist/src/linux/linux-wine-env.js +33 -0
- package/dist/src/linux/linux-wine-env.js.map +1 -0
- package/dist/src/linux/linux-wine-env.test.d.ts +2 -0
- package/dist/src/linux/linux-wine-env.test.d.ts.map +1 -0
- package/dist/src/linux/linux-wine-env.test.js +47 -0
- package/dist/src/linux/linux-wine-env.test.js.map +1 -0
- package/dist/src/plugin/persistent-plugin-installer.d.ts +21 -0
- package/dist/src/plugin/persistent-plugin-installer.d.ts.map +1 -0
- package/dist/src/plugin/persistent-plugin-installer.js +69 -0
- package/dist/src/plugin/persistent-plugin-installer.js.map +1 -0
- package/dist/src/plugin/persistent-plugin-installer.test.d.ts +5 -0
- package/dist/src/plugin/persistent-plugin-installer.test.d.ts.map +1 -0
- package/dist/src/plugin/persistent-plugin-installer.test.js +109 -0
- package/dist/src/plugin/persistent-plugin-installer.test.js.map +1 -0
- package/dist/src/plugin/plugin-discovery.d.ts +7 -0
- package/dist/src/plugin/plugin-discovery.d.ts.map +1 -0
- package/dist/src/plugin/plugin-discovery.js +18 -0
- package/dist/src/plugin/plugin-discovery.js.map +1 -0
- package/dist/src/plugin/plugin-discovery.test.d.ts +5 -0
- package/dist/src/plugin/plugin-discovery.test.d.ts.map +1 -0
- package/dist/src/plugin/plugin-discovery.test.js +55 -0
- package/dist/src/plugin/plugin-discovery.test.js.map +1 -0
- package/dist/src/plugin/plugin-injector.js +1 -1
- package/dist/src/plugin/plugin-injector.js.map +1 -1
- package/dist/src/process/studio-process-manager.d.ts +7 -3
- package/dist/src/process/studio-process-manager.d.ts.map +1 -1
- package/dist/src/process/studio-process-manager.js +38 -11
- package/dist/src/process/studio-process-manager.js.map +1 -1
- package/dist/src/process/studio-process-manager.test.js +18 -1
- package/dist/src/process/studio-process-manager.test.js.map +1 -1
- package/dist/src/server/action-dispatcher.d.ts +35 -0
- package/dist/src/server/action-dispatcher.d.ts.map +1 -0
- package/dist/src/server/action-dispatcher.js +67 -0
- package/dist/src/server/action-dispatcher.js.map +1 -0
- package/dist/src/server/action-dispatcher.test.d.ts +6 -0
- package/dist/src/server/action-dispatcher.test.d.ts.map +1 -0
- package/dist/src/server/action-dispatcher.test.js +173 -0
- package/dist/src/server/action-dispatcher.test.js.map +1 -0
- package/dist/src/server/index.d.ts +1 -1
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/pending-request-map.d.ts +33 -0
- package/dist/src/server/pending-request-map.d.ts.map +1 -0
- package/dist/src/server/pending-request-map.js +69 -0
- package/dist/src/server/pending-request-map.js.map +1 -0
- package/dist/src/server/pending-request-map.test.d.ts +2 -0
- package/dist/src/server/pending-request-map.test.d.ts.map +1 -0
- package/dist/src/server/pending-request-map.test.js +192 -0
- package/dist/src/server/pending-request-map.test.js.map +1 -0
- package/dist/src/server/plugin-detection.test.d.ts +7 -0
- package/dist/src/server/plugin-detection.test.d.ts.map +1 -0
- package/dist/src/server/plugin-detection.test.js +154 -0
- package/dist/src/server/plugin-detection.test.js.map +1 -0
- package/dist/src/server/studio-bridge-server.d.ts +44 -7
- package/dist/src/server/studio-bridge-server.d.ts.map +1 -1
- package/dist/src/server/studio-bridge-server.js +341 -91
- package/dist/src/server/studio-bridge-server.js.map +1 -1
- package/dist/src/server/studio-bridge-server.test.js +231 -207
- package/dist/src/server/studio-bridge-server.test.js.map +1 -1
- package/dist/src/server/web-socket-protocol-basic.test.d.ts +2 -0
- package/dist/src/server/web-socket-protocol-basic.test.d.ts.map +1 -0
- package/dist/src/server/web-socket-protocol-basic.test.js +98 -0
- package/dist/src/server/web-socket-protocol-basic.test.js.map +1 -0
- package/dist/src/server/web-socket-protocol.d.ts +218 -20
- package/dist/src/server/web-socket-protocol.d.ts.map +1 -1
- package/dist/src/server/web-socket-protocol.js +346 -20
- package/dist/src/server/web-socket-protocol.js.map +1 -1
- package/dist/src/server/web-socket-protocol.test.js +572 -146
- package/dist/src/server/web-socket-protocol.test.js.map +1 -1
- package/dist/src/test/e2e/hand-off.test.d.ts +9 -0
- package/dist/src/test/e2e/hand-off.test.d.ts.map +1 -0
- package/dist/src/test/e2e/hand-off.test.js +274 -0
- package/dist/src/test/e2e/hand-off.test.js.map +1 -0
- package/dist/src/test/e2e/persistent-session.test.d.ts +11 -0
- package/dist/src/test/e2e/persistent-session.test.d.ts.map +1 -0
- package/dist/src/test/e2e/persistent-session.test.js +367 -0
- package/dist/src/test/e2e/persistent-session.test.js.map +1 -0
- package/dist/src/test/e2e/split-server.test.d.ts +14 -0
- package/dist/src/test/e2e/split-server.test.d.ts.map +1 -0
- package/dist/src/test/e2e/split-server.test.js +230 -0
- package/dist/src/test/e2e/split-server.test.js.map +1 -0
- package/dist/src/test/helpers/mock-plugin-client.d.ts +69 -0
- package/dist/src/test/helpers/mock-plugin-client.d.ts.map +1 -0
- package/dist/src/test/helpers/mock-plugin-client.js +213 -0
- package/dist/src/test/helpers/mock-plugin-client.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docker/.dockerignore +2 -0
- package/docker/Dockerfile +113 -0
- package/docker/docker-compose.yml +20 -0
- package/docker/entrypoint.sh +19 -0
- package/package.json +8 -6
- package/src/bridge/bridge-connection-remote.test.ts +189 -0
- package/src/bridge/bridge-connection.test.ts +1076 -0
- package/src/bridge/bridge-connection.ts +718 -0
- package/src/bridge/bridge-session.test.ts +336 -0
- package/src/bridge/bridge-session.ts +365 -0
- package/src/bridge/index.ts +42 -0
- package/src/bridge/internal/__tests__/failover-crash.test.ts +191 -0
- package/src/bridge/internal/__tests__/failover-graceful.test.ts +268 -0
- package/src/bridge/internal/__tests__/failover-inflight.test.ts +329 -0
- package/src/bridge/internal/__tests__/host-client-integration.test.ts +387 -0
- package/src/bridge/internal/bridge-client.test.ts +399 -0
- package/src/bridge/internal/bridge-client.ts +434 -0
- package/src/bridge/internal/bridge-host.test.ts +501 -0
- package/src/bridge/internal/bridge-host.ts +531 -0
- package/src/bridge/internal/environment-detection.test.ts +180 -0
- package/src/bridge/internal/environment-detection.ts +119 -0
- package/src/bridge/internal/hand-off.test.ts +408 -0
- package/src/bridge/internal/hand-off.ts +275 -0
- package/src/bridge/internal/health-endpoint.test.ts +147 -0
- package/src/bridge/internal/health-endpoint.ts +100 -0
- package/src/bridge/internal/host-protocol.test.ts +415 -0
- package/src/bridge/internal/host-protocol.ts +255 -0
- package/src/bridge/internal/session-tracker.test.ts +535 -0
- package/src/bridge/internal/session-tracker.ts +198 -0
- package/src/bridge/internal/transport-client.test.ts +241 -0
- package/src/bridge/internal/transport-client.ts +194 -0
- package/src/bridge/internal/transport-server.test.ts +220 -0
- package/src/bridge/internal/transport-server.ts +242 -0
- package/src/bridge/types.ts +161 -0
- package/src/cli/adapters/cli-command-adapter-handler.test.ts +318 -0
- package/src/cli/adapters/cli-command-adapter.test.ts +221 -0
- package/src/cli/adapters/cli-command-adapter.ts +342 -0
- package/src/cli/adapters/group-builder.test.ts +146 -0
- package/src/cli/adapters/group-builder.ts +81 -0
- package/src/cli/adapters/help-formatter.test.ts +97 -0
- package/src/cli/adapters/help-formatter.ts +86 -0
- package/src/cli/adapters/target-resolver.test.ts +222 -0
- package/src/cli/adapters/target-resolver.ts +144 -0
- package/src/cli/args/global-args.ts +2 -0
- package/src/cli/cli.ts +100 -21
- package/src/cli/resolve-script-content.ts +36 -0
- package/src/cli/resolve-session.test.ts +141 -0
- package/src/cli/resolve-session.ts +66 -0
- package/src/cli/script-executor.ts +22 -4
- package/src/cli/types.ts +11 -0
- package/src/commands/connect.test.ts +61 -0
- package/src/commands/connect.ts +32 -0
- package/src/commands/console/exec/exec.test.ts +258 -0
- package/src/commands/console/exec/exec.ts +130 -0
- package/src/commands/console/exec/execute.luau +202 -0
- package/src/commands/console/logs/logs.test.ts +138 -0
- package/src/commands/console/logs/logs.ts +115 -0
- package/src/commands/console/logs/query-logs.luau +76 -0
- package/src/commands/disconnect.test.ts +21 -0
- package/src/commands/disconnect.ts +12 -0
- package/src/commands/explorer/query/query-data-model.luau +206 -0
- package/src/commands/explorer/query/query.test.ts +297 -0
- package/src/commands/explorer/query/query.ts +157 -0
- package/src/commands/formatters.test.ts +237 -0
- package/src/commands/framework/action-loader.test.ts +118 -0
- package/src/commands/framework/action-loader.ts +65 -0
- package/src/commands/framework/arg-builder.test.ts +298 -0
- package/src/commands/framework/arg-builder.ts +203 -0
- package/src/commands/framework/command-registry.test.ts +204 -0
- package/src/commands/framework/command-registry.ts +51 -0
- package/src/commands/framework/define-command.test.ts +161 -0
- package/src/commands/framework/define-command.ts +114 -0
- package/src/commands/framework/index.ts +33 -0
- package/src/commands/index.ts +72 -0
- package/src/commands/linux/inject-credentials/inject-credentials.ts +118 -0
- package/src/commands/linux/setup/setup.ts +145 -0
- package/src/commands/linux/status/status.ts +180 -0
- package/src/commands/plugin/install/install.ts +31 -0
- package/src/commands/plugin/uninstall/uninstall.ts +54 -0
- package/src/commands/process/close/close.ts +52 -0
- package/src/commands/process/format-state.ts +21 -0
- package/src/commands/process/info/info.test.ts +76 -0
- package/src/commands/process/info/info.ts +54 -0
- package/src/commands/process/info/query-state.luau +48 -0
- package/src/commands/process/launch/launch.test.ts +65 -0
- package/src/commands/process/launch/launch.ts +45 -0
- package/src/commands/process/list/list.test.ts +82 -0
- package/src/commands/process/list/list.ts +75 -0
- package/src/commands/process/run/run.ts +98 -0
- package/src/commands/rgba-to-png.ts +98 -0
- package/src/commands/serve/serve.test.ts +139 -0
- package/src/commands/serve/serve.ts +161 -0
- package/src/commands/viewport/screenshot/capture-screenshot.luau +247 -0
- package/src/commands/viewport/screenshot/screenshot.test.ts +181 -0
- package/src/commands/viewport/screenshot/screenshot.ts +71 -0
- package/src/docker/docker-delegator.test.ts +159 -0
- package/src/docker/docker-delegator.ts +240 -0
- package/src/index.test.ts +58 -0
- package/src/index.ts +104 -3
- package/src/linux/README.md +130 -0
- package/src/linux/index.ts +25 -0
- package/src/linux/linux-config.test.ts +66 -0
- package/src/linux/linux-config.ts +102 -0
- package/src/linux/linux-credential-writer.ts +421 -0
- package/src/linux/linux-display-manager.ts +106 -0
- package/src/linux/linux-env-guard.test.ts +62 -0
- package/src/linux/linux-env-guard.ts +38 -0
- package/src/linux/linux-fflags.test.ts +78 -0
- package/src/linux/linux-fflags.ts +48 -0
- package/src/linux/linux-prerequisites.ts +152 -0
- package/src/linux/linux-shader-patcher.test.ts +76 -0
- package/src/linux/linux-shader-patcher.ts +56 -0
- package/src/linux/linux-studio-installer.ts +113 -0
- package/src/linux/linux-studio-launcher.ts +90 -0
- package/src/linux/linux-version-resolver.ts +74 -0
- package/src/linux/linux-wine-env.test.ts +56 -0
- package/src/linux/linux-wine-env.ts +38 -0
- package/src/linux/write-cred.c +48 -0
- package/src/plugin/persistent-plugin-installer.test.ts +168 -0
- package/src/plugin/persistent-plugin-installer.ts +90 -0
- package/src/plugin/plugin-discovery.test.ts +70 -0
- package/src/plugin/plugin-discovery.ts +21 -0
- package/src/plugin/plugin-injector.ts +1 -1
- package/src/process/studio-process-manager.test.ts +22 -1
- package/src/process/studio-process-manager.ts +57 -18
- package/src/server/action-dispatcher.test.ts +240 -0
- package/src/server/action-dispatcher.ts +89 -0
- package/src/server/index.ts +0 -3
- package/src/server/pending-request-map.test.ts +261 -0
- package/src/server/pending-request-map.ts +87 -0
- package/src/server/plugin-detection.test.ts +195 -0
- package/src/server/studio-bridge-server.test.ts +321 -283
- package/src/server/studio-bridge-server.ts +469 -111
- package/src/server/web-socket-protocol-basic.test.ts +131 -0
- package/src/server/web-socket-protocol.test.ts +658 -159
- package/src/server/web-socket-protocol.ts +668 -58
- package/src/test/e2e/hand-off.test.ts +338 -0
- package/src/test/e2e/persistent-session.test.ts +442 -0
- package/src/test/e2e/split-server.test.ts +290 -0
- package/src/test/helpers/mock-plugin-client.ts +276 -0
- package/templates/studio-bridge-plugin/src/Shared/ActionRouter.luau +245 -0
- package/templates/studio-bridge-plugin/src/Shared/DiscoveryStateMachine.luau +203 -0
- package/templates/studio-bridge-plugin/src/Shared/MessageBuffer.luau +144 -0
- package/templates/studio-bridge-plugin/src/Shared/Protocol.luau +132 -0
- package/templates/studio-bridge-plugin/src/StudioBridgePlugin.server.lua +364 -133
- package/templates/studio-bridge-plugin/src/Vendor/png.luau +1247 -0
- package/templates/studio-bridge-plugin-test/test/actions.test.luau +580 -0
- package/templates/studio-bridge-plugin-test/test/discovery.test.luau +622 -0
- package/templates/studio-bridge-plugin-test/test/execute-handler.test.luau +406 -0
- package/templates/studio-bridge-plugin-test/test/hash-lifecycle.test.luau +814 -0
- package/templates/studio-bridge-plugin-test/test/integration.test.luau +1020 -0
- package/templates/studio-bridge-plugin-test/test/new-actions.test.luau +339 -0
- package/templates/studio-bridge-plugin-test/test/plugin-entry.test.luau +493 -0
- package/templates/studio-bridge-plugin-test/test/protocol.test.luau +506 -0
- package/templates/studio-bridge-plugin-test/test/roblox-mocks.luau +108 -0
- package/templates/studio-bridge-plugin-test/test/test-runner.luau +112 -0
- package/dist/src/cli/commands/exec-command.d.ts +0 -15
- package/dist/src/cli/commands/exec-command.d.ts.map +0 -1
- package/dist/src/cli/commands/exec-command.js +0 -35
- package/dist/src/cli/commands/exec-command.js.map +0 -1
- package/dist/src/cli/commands/run-command.d.ts +0 -15
- package/dist/src/cli/commands/run-command.d.ts.map +0 -1
- package/dist/src/cli/commands/run-command.js +0 -47
- package/dist/src/cli/commands/run-command.js.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-command.d.ts +0 -17
- package/dist/src/cli/commands/terminal/terminal-command.d.ts.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-command.js +0 -41
- package/dist/src/cli/commands/terminal/terminal-command.js.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-editor.d.ts +0 -43
- package/dist/src/cli/commands/terminal/terminal-editor.d.ts.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-editor.js +0 -430
- package/dist/src/cli/commands/terminal/terminal-editor.js.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-mode.d.ts +0 -13
- package/dist/src/cli/commands/terminal/terminal-mode.d.ts.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-mode.js +0 -141
- package/dist/src/cli/commands/terminal/terminal-mode.js.map +0 -1
- package/dist/src/server/web-socket-protocol.smoke.test.d.ts +0 -6
- package/dist/src/server/web-socket-protocol.smoke.test.d.ts.map +0 -1
- package/dist/src/server/web-socket-protocol.smoke.test.js +0 -196
- package/dist/src/server/web-socket-protocol.smoke.test.js.map +0 -1
- package/src/cli/commands/exec-command.ts +0 -48
- package/src/cli/commands/run-command.ts +0 -63
- package/src/cli/commands/terminal/terminal-command.ts +0 -54
- package/src/cli/commands/terminal/terminal-editor.ts +0 -500
- package/src/cli/commands/terminal/terminal-mode.ts +0 -184
- package/src/server/web-socket-protocol.smoke.test.ts +0 -255
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the arg builder DSL and schema converters.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { describe, it, expect } from 'vitest';
|
|
6
|
+
import { arg, toYargsOptions, toJsonSchema } from './arg-builder.js';
|
|
7
|
+
|
|
8
|
+
describe('arg.positional', () => {
|
|
9
|
+
it('creates a positional arg definition', () => {
|
|
10
|
+
const def = arg.positional({ description: 'Source code' });
|
|
11
|
+
expect(def.kind).toBe('positional');
|
|
12
|
+
expect(def.description).toBe('Source code');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('defaults to string type', () => {
|
|
16
|
+
const def = arg.positional({ description: 'test' });
|
|
17
|
+
expect(def.type).toBe('string');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('respects explicit number type', () => {
|
|
21
|
+
const def = arg.positional({ description: 'test', type: 'number' });
|
|
22
|
+
expect(def.type).toBe('number');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('defaults to required', () => {
|
|
26
|
+
const def = arg.positional({ description: 'test' });
|
|
27
|
+
expect(def.required).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('allows optional positionals', () => {
|
|
31
|
+
const def = arg.positional({ description: 'test', required: false });
|
|
32
|
+
expect(def.required).toBe(false);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('supports choices', () => {
|
|
36
|
+
const def = arg.positional({
|
|
37
|
+
description: 'Direction',
|
|
38
|
+
choices: ['head', 'tail'] as const,
|
|
39
|
+
});
|
|
40
|
+
expect(def.choices).toEqual(['head', 'tail']);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe('arg.option', () => {
|
|
45
|
+
it('creates an option arg definition', () => {
|
|
46
|
+
const def = arg.option({ description: 'Max count' });
|
|
47
|
+
expect(def.kind).toBe('option');
|
|
48
|
+
expect(def.description).toBe('Max count');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('defaults to string type', () => {
|
|
52
|
+
const def = arg.option({ description: 'test' });
|
|
53
|
+
expect(def.type).toBe('string');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('supports number type', () => {
|
|
57
|
+
const def = arg.option({ description: 'test', type: 'number' });
|
|
58
|
+
expect(def.type).toBe('number');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('supports alias', () => {
|
|
62
|
+
const def = arg.option({ description: 'test', alias: 'n' });
|
|
63
|
+
expect(def.alias).toBe('n');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('supports default value', () => {
|
|
67
|
+
const def = arg.option({
|
|
68
|
+
description: 'test',
|
|
69
|
+
type: 'number',
|
|
70
|
+
default: 50,
|
|
71
|
+
});
|
|
72
|
+
expect(def.default).toBe(50);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('supports required flag', () => {
|
|
76
|
+
const def = arg.option({ description: 'test', required: true });
|
|
77
|
+
expect(def.required).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('supports choices', () => {
|
|
81
|
+
const def = arg.option({
|
|
82
|
+
description: 'Mode',
|
|
83
|
+
choices: ['text', 'json'] as const,
|
|
84
|
+
});
|
|
85
|
+
expect(def.choices).toEqual(['text', 'json']);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('supports array flag', () => {
|
|
89
|
+
const def = arg.option({ description: 'Levels', array: true });
|
|
90
|
+
expect(def.array).toBe(true);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('arg.flag', () => {
|
|
95
|
+
it('creates a flag arg definition', () => {
|
|
96
|
+
const def = arg.flag({ description: 'Include children' });
|
|
97
|
+
expect(def.kind).toBe('flag');
|
|
98
|
+
expect(def.type).toBe('boolean');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('defaults to false', () => {
|
|
102
|
+
const def = arg.flag({ description: 'test' });
|
|
103
|
+
expect(def.default).toBe(false);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('allows default true', () => {
|
|
107
|
+
const def = arg.flag({ description: 'test', default: true });
|
|
108
|
+
expect(def.default).toBe(true);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('supports alias', () => {
|
|
112
|
+
const def = arg.flag({ description: 'test', alias: 'c' });
|
|
113
|
+
expect(def.alias).toBe('c');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('toYargsOptions', () => {
|
|
118
|
+
it('separates positionals from options', () => {
|
|
119
|
+
const result = toYargsOptions({
|
|
120
|
+
code: arg.positional({ description: 'Source' }),
|
|
121
|
+
count: arg.option({ description: 'Max', type: 'number' }),
|
|
122
|
+
verbose: arg.flag({ description: 'Verbose' }),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
expect(result.positionals).toHaveLength(1);
|
|
126
|
+
expect(result.positionals[0].name).toBe('code');
|
|
127
|
+
expect(Object.keys(result.options)).toEqual(['count', 'verbose']);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('converts positional fields', () => {
|
|
131
|
+
const result = toYargsOptions({
|
|
132
|
+
path: arg.positional({
|
|
133
|
+
description: 'DataModel path',
|
|
134
|
+
choices: ['Workspace', 'ServerStorage'] as const,
|
|
135
|
+
}),
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const pos = result.positionals[0];
|
|
139
|
+
expect(pos.options.describe).toBe('DataModel path');
|
|
140
|
+
expect(pos.options.type).toBe('string');
|
|
141
|
+
expect(pos.options.demandOption).toBe(true);
|
|
142
|
+
expect(pos.options.choices).toEqual(['Workspace', 'ServerStorage']);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('converts option fields', () => {
|
|
146
|
+
const result = toYargsOptions({
|
|
147
|
+
count: arg.option({
|
|
148
|
+
description: 'Number of entries',
|
|
149
|
+
type: 'number',
|
|
150
|
+
alias: 'n',
|
|
151
|
+
default: 50,
|
|
152
|
+
}),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const opt = result.options.count;
|
|
156
|
+
expect(opt.describe).toBe('Number of entries');
|
|
157
|
+
expect(opt.type).toBe('number');
|
|
158
|
+
expect(opt.alias).toBe('n');
|
|
159
|
+
expect(opt.default).toBe(50);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('converts flag fields', () => {
|
|
163
|
+
const result = toYargsOptions({
|
|
164
|
+
json: arg.flag({ description: 'Output JSON', alias: 'j' }),
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const opt = result.options.json;
|
|
168
|
+
expect(opt.describe).toBe('Output JSON');
|
|
169
|
+
expect(opt.type).toBe('boolean');
|
|
170
|
+
expect(opt.alias).toBe('j');
|
|
171
|
+
expect(opt.default).toBe(false);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it('omits undefined optional fields from options', () => {
|
|
175
|
+
const result = toYargsOptions({
|
|
176
|
+
name: arg.option({ description: 'Name' }),
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const opt = result.options.name;
|
|
180
|
+
expect(opt).not.toHaveProperty('alias');
|
|
181
|
+
expect(opt).not.toHaveProperty('default');
|
|
182
|
+
expect(opt).not.toHaveProperty('choices');
|
|
183
|
+
expect(opt).not.toHaveProperty('array');
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('returns empty arrays for no args', () => {
|
|
187
|
+
const result = toYargsOptions({});
|
|
188
|
+
expect(result.positionals).toEqual([]);
|
|
189
|
+
expect(result.options).toEqual({});
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
describe('toJsonSchema', () => {
|
|
194
|
+
it('generates a valid object schema', () => {
|
|
195
|
+
const schema = toJsonSchema({
|
|
196
|
+
code: arg.positional({ description: 'Source code' }),
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
expect(schema.type).toBe('object');
|
|
200
|
+
expect(schema.additionalProperties).toBe(false);
|
|
201
|
+
expect(schema.properties.code).toBeDefined();
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('includes required positionals in required array', () => {
|
|
205
|
+
const schema = toJsonSchema({
|
|
206
|
+
code: arg.positional({ description: 'Source code' }),
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
expect(schema.required).toEqual(['code']);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it('includes required options in required array', () => {
|
|
213
|
+
const schema = toJsonSchema({
|
|
214
|
+
target: arg.option({ description: 'Target', required: true }),
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
expect(schema.required).toEqual(['target']);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it('omits required array when no args are required', () => {
|
|
221
|
+
const schema = toJsonSchema({
|
|
222
|
+
count: arg.option({ description: 'Count', type: 'number' }),
|
|
223
|
+
verbose: arg.flag({ description: 'Verbose' }),
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
expect(schema).not.toHaveProperty('required');
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('maps string type', () => {
|
|
230
|
+
const schema = toJsonSchema({
|
|
231
|
+
name: arg.option({ description: 'Name' }),
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
expect(schema.properties.name.type).toBe('string');
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('maps number type', () => {
|
|
238
|
+
const schema = toJsonSchema({
|
|
239
|
+
count: arg.option({ description: 'Count', type: 'number' }),
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
expect(schema.properties.count.type).toBe('number');
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('maps boolean type for flags', () => {
|
|
246
|
+
const schema = toJsonSchema({
|
|
247
|
+
verbose: arg.flag({ description: 'Verbose' }),
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
expect(schema.properties.verbose.type).toBe('boolean');
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it('maps array options', () => {
|
|
254
|
+
const schema = toJsonSchema({
|
|
255
|
+
levels: arg.option({ description: 'Log levels', array: true }),
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
expect(schema.properties.levels.type).toBe('array');
|
|
259
|
+
expect(schema.properties.levels.items).toEqual({ type: 'string' });
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('maps choices to enum', () => {
|
|
263
|
+
const schema = toJsonSchema({
|
|
264
|
+
direction: arg.option({
|
|
265
|
+
description: 'Direction',
|
|
266
|
+
choices: ['head', 'tail'] as const,
|
|
267
|
+
}),
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
expect(schema.properties.direction.enum).toEqual(['head', 'tail']);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it('includes default values', () => {
|
|
274
|
+
const schema = toJsonSchema({
|
|
275
|
+
count: arg.option({ description: 'Count', type: 'number', default: 50 }),
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
expect(schema.properties.count.default).toBe(50);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('includes description on all properties', () => {
|
|
282
|
+
const schema = toJsonSchema({
|
|
283
|
+
code: arg.positional({ description: 'Source code' }),
|
|
284
|
+
count: arg.option({ description: 'Max entries', type: 'number' }),
|
|
285
|
+
json: arg.flag({ description: 'JSON output' }),
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
expect(schema.properties.code.description).toBe('Source code');
|
|
289
|
+
expect(schema.properties.count.description).toBe('Max entries');
|
|
290
|
+
expect(schema.properties.json.description).toBe('JSON output');
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
it('returns empty properties for no args', () => {
|
|
294
|
+
const schema = toJsonSchema({});
|
|
295
|
+
expect(schema.properties).toEqual({});
|
|
296
|
+
expect(schema).not.toHaveProperty('required');
|
|
297
|
+
});
|
|
298
|
+
});
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Argument definition DSL and schema converters.
|
|
3
|
+
*
|
|
4
|
+
* `arg.positional()`, `arg.option()`, and `arg.flag()` produce `ArgDefinition`
|
|
5
|
+
* objects that carry enough metadata to generate both yargs options and
|
|
6
|
+
* JSON Schema properties for MCP tools.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type ArgKind = 'positional' | 'option' | 'flag';
|
|
10
|
+
export type ArgType = 'string' | 'number' | 'boolean';
|
|
11
|
+
|
|
12
|
+
export interface ArgDefinition {
|
|
13
|
+
kind: ArgKind;
|
|
14
|
+
type: ArgType;
|
|
15
|
+
description: string;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
default?: unknown;
|
|
18
|
+
alias?: string;
|
|
19
|
+
choices?: readonly string[];
|
|
20
|
+
array?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const arg = {
|
|
24
|
+
/**
|
|
25
|
+
* Define a positional argument. Required by default.
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* args: { code: arg.positional({ description: 'Luau source code' }) }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
positional(config: {
|
|
32
|
+
description: string;
|
|
33
|
+
type?: 'string' | 'number';
|
|
34
|
+
required?: boolean;
|
|
35
|
+
choices?: readonly string[];
|
|
36
|
+
}): ArgDefinition {
|
|
37
|
+
return {
|
|
38
|
+
kind: 'positional',
|
|
39
|
+
type: config.type ?? 'string',
|
|
40
|
+
description: config.description,
|
|
41
|
+
required: config.required ?? true,
|
|
42
|
+
choices: config.choices,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Define a named option (`--name <value>`).
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* args: { count: arg.option({ description: 'Max entries', type: 'number' }) }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
option(config: {
|
|
54
|
+
description: string;
|
|
55
|
+
type?: 'string' | 'number';
|
|
56
|
+
alias?: string;
|
|
57
|
+
required?: boolean;
|
|
58
|
+
default?: string | number;
|
|
59
|
+
choices?: readonly string[];
|
|
60
|
+
array?: boolean;
|
|
61
|
+
}): ArgDefinition {
|
|
62
|
+
return {
|
|
63
|
+
kind: 'option',
|
|
64
|
+
type: config.type ?? 'string',
|
|
65
|
+
description: config.description,
|
|
66
|
+
alias: config.alias,
|
|
67
|
+
required: config.required,
|
|
68
|
+
default: config.default,
|
|
69
|
+
choices: config.choices,
|
|
70
|
+
array: config.array,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Define a boolean flag (`--verbose`, `--json`).
|
|
76
|
+
*
|
|
77
|
+
* ```ts
|
|
78
|
+
* args: { children: arg.flag({ description: 'Include children' }) }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
flag(config: {
|
|
82
|
+
description: string;
|
|
83
|
+
alias?: string;
|
|
84
|
+
default?: boolean;
|
|
85
|
+
}): ArgDefinition {
|
|
86
|
+
return {
|
|
87
|
+
kind: 'flag',
|
|
88
|
+
type: 'boolean',
|
|
89
|
+
description: config.description,
|
|
90
|
+
alias: config.alias,
|
|
91
|
+
default: config.default ?? false,
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export interface YargsPositional {
|
|
97
|
+
name: string;
|
|
98
|
+
options: {
|
|
99
|
+
describe: string;
|
|
100
|
+
type: 'string' | 'number';
|
|
101
|
+
demandOption?: boolean;
|
|
102
|
+
choices?: readonly string[];
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface YargsArgConfig {
|
|
107
|
+
positionals: YargsPositional[];
|
|
108
|
+
options: Record<string, Record<string, unknown>>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Convert an args record into yargs-compatible positional and option configs.
|
|
113
|
+
*/
|
|
114
|
+
export function toYargsOptions(
|
|
115
|
+
args: Record<string, ArgDefinition>
|
|
116
|
+
): YargsArgConfig {
|
|
117
|
+
const positionals: YargsPositional[] = [];
|
|
118
|
+
const options: Record<string, Record<string, unknown>> = {};
|
|
119
|
+
|
|
120
|
+
for (const [name, def] of Object.entries(args)) {
|
|
121
|
+
if (def.kind === 'positional') {
|
|
122
|
+
positionals.push({
|
|
123
|
+
name,
|
|
124
|
+
options: {
|
|
125
|
+
describe: def.description,
|
|
126
|
+
type: def.type as 'string' | 'number',
|
|
127
|
+
demandOption: def.required,
|
|
128
|
+
...(def.choices ? { choices: def.choices } : {}),
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
const opt: Record<string, unknown> = {
|
|
133
|
+
describe: def.description,
|
|
134
|
+
type: def.type,
|
|
135
|
+
};
|
|
136
|
+
if (def.alias) opt.alias = def.alias;
|
|
137
|
+
if (def.default !== undefined) opt.default = def.default;
|
|
138
|
+
if (def.choices) opt.choices = def.choices;
|
|
139
|
+
if (def.array) opt.array = def.array;
|
|
140
|
+
options[name] = opt;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return { positionals, options };
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface JsonSchemaOutput {
|
|
148
|
+
type: 'object';
|
|
149
|
+
properties: Record<string, Record<string, unknown>>;
|
|
150
|
+
required?: string[];
|
|
151
|
+
additionalProperties: false;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Convert an args record into a JSON Schema object suitable for MCP tool
|
|
156
|
+
* `inputSchema`. Positional args that are required become `required` in
|
|
157
|
+
* the schema. Options with `required: true` are also included.
|
|
158
|
+
*/
|
|
159
|
+
export function toJsonSchema(
|
|
160
|
+
args: Record<string, ArgDefinition>
|
|
161
|
+
): JsonSchemaOutput {
|
|
162
|
+
const properties: Record<string, Record<string, unknown>> = {};
|
|
163
|
+
const required: string[] = [];
|
|
164
|
+
|
|
165
|
+
for (const [name, def] of Object.entries(args)) {
|
|
166
|
+
const prop: Record<string, unknown> = {
|
|
167
|
+
description: def.description,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
if (def.array) {
|
|
171
|
+
prop.type = 'array';
|
|
172
|
+
prop.items = { type: def.type };
|
|
173
|
+
} else {
|
|
174
|
+
prop.type = def.type;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (def.choices) {
|
|
178
|
+
prop.enum = [...def.choices];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (def.default !== undefined) {
|
|
182
|
+
prop.default = def.default;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
properties[name] = prop;
|
|
186
|
+
|
|
187
|
+
if (def.required) {
|
|
188
|
+
required.push(name);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const schema: JsonSchemaOutput = {
|
|
193
|
+
type: 'object',
|
|
194
|
+
properties,
|
|
195
|
+
additionalProperties: false,
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
if (required.length > 0) {
|
|
199
|
+
schema.required = required;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return schema;
|
|
203
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the CommandRegistry.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { describe, it, expect } from 'vitest';
|
|
6
|
+
import { CommandRegistry } from './command-registry.js';
|
|
7
|
+
import { defineCommand } from './define-command.js';
|
|
8
|
+
|
|
9
|
+
function makeCommand(
|
|
10
|
+
overrides: Partial<{
|
|
11
|
+
group: string | null;
|
|
12
|
+
name: string;
|
|
13
|
+
category: 'execution' | 'infrastructure';
|
|
14
|
+
safety: 'read' | 'mutate' | 'none';
|
|
15
|
+
scope: 'session' | 'connection' | 'standalone';
|
|
16
|
+
}> = {}
|
|
17
|
+
) {
|
|
18
|
+
const scope = overrides.scope ?? 'session';
|
|
19
|
+
|
|
20
|
+
const base = {
|
|
21
|
+
group:
|
|
22
|
+
overrides.group === undefined
|
|
23
|
+
? ('console' as string | null)
|
|
24
|
+
: overrides.group,
|
|
25
|
+
name: overrides.name ?? 'exec',
|
|
26
|
+
description: 'Test command',
|
|
27
|
+
category: overrides.category ?? ('execution' as const),
|
|
28
|
+
safety: overrides.safety ?? ('mutate' as const),
|
|
29
|
+
args: {},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
if (scope === 'session') {
|
|
33
|
+
return defineCommand({
|
|
34
|
+
...base,
|
|
35
|
+
scope: 'session',
|
|
36
|
+
handler: async () => ({}),
|
|
37
|
+
});
|
|
38
|
+
} else if (scope === 'connection') {
|
|
39
|
+
return defineCommand({
|
|
40
|
+
...base,
|
|
41
|
+
scope: 'connection',
|
|
42
|
+
handler: async () => ({}),
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
return defineCommand({
|
|
46
|
+
...base,
|
|
47
|
+
scope: 'standalone',
|
|
48
|
+
handler: async () => ({}),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
describe('CommandRegistry', () => {
|
|
54
|
+
describe('register / getAll', () => {
|
|
55
|
+
it('registers and retrieves commands', () => {
|
|
56
|
+
const registry = new CommandRegistry();
|
|
57
|
+
const cmd = makeCommand();
|
|
58
|
+
registry.register(cmd);
|
|
59
|
+
|
|
60
|
+
expect(registry.getAll()).toHaveLength(1);
|
|
61
|
+
expect(registry.getAll()[0]).toBe(cmd);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('maintains insertion order', () => {
|
|
65
|
+
const registry = new CommandRegistry();
|
|
66
|
+
const a = makeCommand({ name: 'alpha' });
|
|
67
|
+
const b = makeCommand({ name: 'beta' });
|
|
68
|
+
const c = makeCommand({ name: 'charlie' });
|
|
69
|
+
|
|
70
|
+
registry.register(a);
|
|
71
|
+
registry.register(b);
|
|
72
|
+
registry.register(c);
|
|
73
|
+
|
|
74
|
+
const names = registry.getAll().map((d) => d.name);
|
|
75
|
+
expect(names).toEqual(['alpha', 'beta', 'charlie']);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('returns empty array when no commands registered', () => {
|
|
79
|
+
const registry = new CommandRegistry();
|
|
80
|
+
expect(registry.getAll()).toEqual([]);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('getByGroup', () => {
|
|
85
|
+
it('filters by group name', () => {
|
|
86
|
+
const registry = new CommandRegistry();
|
|
87
|
+
registry.register(makeCommand({ group: 'console', name: 'exec' }));
|
|
88
|
+
registry.register(makeCommand({ group: 'console', name: 'logs' }));
|
|
89
|
+
registry.register(makeCommand({ group: 'process', name: 'list' }));
|
|
90
|
+
|
|
91
|
+
const consoleCommands = registry.getByGroup('console');
|
|
92
|
+
expect(consoleCommands).toHaveLength(2);
|
|
93
|
+
expect(consoleCommands.map((c) => c.name)).toEqual(['exec', 'logs']);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('returns empty array for unknown group', () => {
|
|
97
|
+
const registry = new CommandRegistry();
|
|
98
|
+
registry.register(makeCommand({ group: 'console', name: 'exec' }));
|
|
99
|
+
|
|
100
|
+
expect(registry.getByGroup('nonexistent')).toEqual([]);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
describe('getGroups', () => {
|
|
105
|
+
it('returns unique group names', () => {
|
|
106
|
+
const registry = new CommandRegistry();
|
|
107
|
+
registry.register(makeCommand({ group: 'console', name: 'exec' }));
|
|
108
|
+
registry.register(makeCommand({ group: 'console', name: 'logs' }));
|
|
109
|
+
registry.register(makeCommand({ group: 'process', name: 'list' }));
|
|
110
|
+
|
|
111
|
+
const groups = registry.getGroups();
|
|
112
|
+
expect(groups).toEqual(['console', 'process']);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('excludes null group (top-level commands)', () => {
|
|
116
|
+
const registry = new CommandRegistry();
|
|
117
|
+
registry.register(
|
|
118
|
+
makeCommand({ group: null, name: 'serve', scope: 'standalone' })
|
|
119
|
+
);
|
|
120
|
+
registry.register(makeCommand({ group: 'console', name: 'exec' }));
|
|
121
|
+
|
|
122
|
+
const groups = registry.getGroups();
|
|
123
|
+
expect(groups).toEqual(['console']);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('returns empty array when no groups', () => {
|
|
127
|
+
const registry = new CommandRegistry();
|
|
128
|
+
expect(registry.getGroups()).toEqual([]);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
describe('getTopLevel', () => {
|
|
133
|
+
it('returns commands with null group', () => {
|
|
134
|
+
const registry = new CommandRegistry();
|
|
135
|
+
registry.register(
|
|
136
|
+
makeCommand({ group: null, name: 'serve', scope: 'standalone' })
|
|
137
|
+
);
|
|
138
|
+
registry.register(
|
|
139
|
+
makeCommand({ group: null, name: 'mcp', scope: 'standalone' })
|
|
140
|
+
);
|
|
141
|
+
registry.register(makeCommand({ group: 'console', name: 'exec' }));
|
|
142
|
+
|
|
143
|
+
const topLevel = registry.getTopLevel();
|
|
144
|
+
expect(topLevel).toHaveLength(2);
|
|
145
|
+
expect(topLevel.map((c) => c.name)).toEqual(['serve', 'mcp']);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('returns empty array when no top-level commands', () => {
|
|
149
|
+
const registry = new CommandRegistry();
|
|
150
|
+
registry.register(makeCommand({ group: 'console', name: 'exec' }));
|
|
151
|
+
|
|
152
|
+
expect(registry.getTopLevel()).toEqual([]);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
describe('getByCategory', () => {
|
|
157
|
+
it('filters by category', () => {
|
|
158
|
+
const registry = new CommandRegistry();
|
|
159
|
+
registry.register(makeCommand({ name: 'exec', category: 'execution' }));
|
|
160
|
+
registry.register(
|
|
161
|
+
makeCommand({ name: 'list', category: 'infrastructure' })
|
|
162
|
+
);
|
|
163
|
+
registry.register(makeCommand({ name: 'logs', category: 'execution' }));
|
|
164
|
+
|
|
165
|
+
const execution = registry.getByCategory('execution');
|
|
166
|
+
expect(execution).toHaveLength(2);
|
|
167
|
+
expect(execution.map((c) => c.name)).toEqual(['exec', 'logs']);
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
describe('get', () => {
|
|
172
|
+
it('finds by group and name', () => {
|
|
173
|
+
const registry = new CommandRegistry();
|
|
174
|
+
const cmd = makeCommand({ group: 'console', name: 'exec' });
|
|
175
|
+
registry.register(cmd);
|
|
176
|
+
|
|
177
|
+
expect(registry.get('console', 'exec')).toBe(cmd);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it('finds top-level commands with null group', () => {
|
|
181
|
+
const registry = new CommandRegistry();
|
|
182
|
+
const cmd = makeCommand({
|
|
183
|
+
group: null,
|
|
184
|
+
name: 'serve',
|
|
185
|
+
scope: 'standalone',
|
|
186
|
+
});
|
|
187
|
+
registry.register(cmd);
|
|
188
|
+
|
|
189
|
+
expect(registry.get(null, 'serve')).toBe(cmd);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it('returns undefined for missing command', () => {
|
|
193
|
+
const registry = new CommandRegistry();
|
|
194
|
+
expect(registry.get('console', 'nonexistent')).toBeUndefined();
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it('returns undefined when group matches but name does not', () => {
|
|
198
|
+
const registry = new CommandRegistry();
|
|
199
|
+
registry.register(makeCommand({ group: 'console', name: 'exec' }));
|
|
200
|
+
|
|
201
|
+
expect(registry.get('console', 'logs')).toBeUndefined();
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
});
|