@quenty/studio-bridge 0.7.1 → 0.9.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 +14 -42
- 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 +119 -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 +40 -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 +171 -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 +59 -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,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI adapter — converts a `CommandDefinition` into a yargs `CommandModule`.
|
|
3
|
+
*
|
|
4
|
+
* Responsibilities:
|
|
5
|
+
* - Maps `ArgDefinition` records to yargs positionals/options
|
|
6
|
+
* - Injects universal args based on scope and safety
|
|
7
|
+
* - Wraps handler in connect → resolve → fn → disconnect lifecycle
|
|
8
|
+
* - Dispatches results to a `ResultReporter` (stdout / file / watch redraw)
|
|
9
|
+
* - Honors `--output` (file write), `--open`, `--watch`, `--interval`
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { Argv, CommandModule } from 'yargs';
|
|
13
|
+
import { OutputHelper } from '@quenty/cli-output-helpers';
|
|
14
|
+
import {
|
|
15
|
+
buildResultReporter,
|
|
16
|
+
type ResultReporter,
|
|
17
|
+
formatJson,
|
|
18
|
+
} from '@quenty/cli-output-helpers/reporting';
|
|
19
|
+
import { BridgeConnection } from '../../bridge/index.js';
|
|
20
|
+
import type { SessionContext } from '../../bridge/index.js';
|
|
21
|
+
import type { CommandDefinition } from '../../commands/framework/define-command.js';
|
|
22
|
+
import { toYargsOptions } from '../../commands/framework/arg-builder.js';
|
|
23
|
+
|
|
24
|
+
/** Args injected by the adapter (not defined on CommandDefinition). */
|
|
25
|
+
export interface AdapterArgs {
|
|
26
|
+
target?: string;
|
|
27
|
+
context?: string;
|
|
28
|
+
format?: string;
|
|
29
|
+
output?: string;
|
|
30
|
+
open?: boolean;
|
|
31
|
+
watch?: boolean;
|
|
32
|
+
interval?: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Optional lifecycle override for testing. When provided, the adapter
|
|
37
|
+
* calls these instead of `BridgeConnection.connectAsync`.
|
|
38
|
+
*/
|
|
39
|
+
export interface CliLifecycleProvider {
|
|
40
|
+
connectAsync(opts: {
|
|
41
|
+
timeoutMs?: number;
|
|
42
|
+
remoteHost?: string;
|
|
43
|
+
local?: boolean;
|
|
44
|
+
waitForSessions?: boolean;
|
|
45
|
+
}): Promise<BridgeConnection>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Extract only command-specific args from the full argv object. */
|
|
49
|
+
function extractCommandArgs(
|
|
50
|
+
argv: Record<string, unknown>,
|
|
51
|
+
def: CommandDefinition
|
|
52
|
+
): Record<string, unknown> {
|
|
53
|
+
const commandArgs: Record<string, unknown> = {};
|
|
54
|
+
for (const name of Object.keys(def.args)) {
|
|
55
|
+
if (name in argv) {
|
|
56
|
+
commandArgs[name] = argv[name];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return commandArgs;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Execute a command's handler with appropriate connection lifecycle. */
|
|
63
|
+
async function executeCommandAsync(
|
|
64
|
+
def: CommandDefinition,
|
|
65
|
+
commandArgs: Record<string, unknown>,
|
|
66
|
+
argv: Record<string, unknown>,
|
|
67
|
+
connect: CliLifecycleProvider['connectAsync'],
|
|
68
|
+
existingConnection?: BridgeConnection
|
|
69
|
+
): Promise<unknown> {
|
|
70
|
+
if (def.scope === 'standalone') {
|
|
71
|
+
return (def.handler as any)(commandArgs);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Reuse existing connection if provided (watch mode), otherwise connect fresh
|
|
75
|
+
const connection =
|
|
76
|
+
existingConnection ??
|
|
77
|
+
(await connect({
|
|
78
|
+
timeoutMs: argv.timeout as number | undefined,
|
|
79
|
+
remoteHost: argv.remote as string | undefined,
|
|
80
|
+
local: argv.local as boolean | undefined,
|
|
81
|
+
waitForSessions: def.scope === 'connection',
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
if (def.scope === 'session') {
|
|
86
|
+
const session = await connection.resolveSessionAsync(
|
|
87
|
+
argv.target as string | undefined,
|
|
88
|
+
argv.context as SessionContext | undefined
|
|
89
|
+
);
|
|
90
|
+
return await (def.handler as any)(session, commandArgs);
|
|
91
|
+
}
|
|
92
|
+
return await (def.handler as any)(connection, commandArgs);
|
|
93
|
+
} finally {
|
|
94
|
+
if (!existingConnection) {
|
|
95
|
+
await connection.disconnectAsync();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Inject version/diagnostic warnings into JSON result objects. */
|
|
101
|
+
function injectWarnings(result: unknown): unknown {
|
|
102
|
+
const warnings = (globalThis as any).__studioBridgeWarnings as
|
|
103
|
+
| string[]
|
|
104
|
+
| undefined;
|
|
105
|
+
if (!warnings || warnings.length === 0) return result;
|
|
106
|
+
if (typeof result === 'object' && result !== null && !Array.isArray(result)) {
|
|
107
|
+
return { ...result, _warnings: warnings };
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Render a command result for stdout/file output. `--format=json` (or any
|
|
114
|
+
* explicit non-text format) routes through the command's `json` override or
|
|
115
|
+
* falls back to `formatJson`. Anything else (default, `--format=text`)
|
|
116
|
+
* routes through the command's `format` callback, then `result.summary`,
|
|
117
|
+
* then JSON as a last resort.
|
|
118
|
+
*/
|
|
119
|
+
function renderResult(
|
|
120
|
+
def: CommandDefinition,
|
|
121
|
+
result: unknown,
|
|
122
|
+
explicitFormat: string | undefined
|
|
123
|
+
): string {
|
|
124
|
+
if (explicitFormat === 'json') {
|
|
125
|
+
if (def.cli?.json) return def.cli.json(result as any);
|
|
126
|
+
return formatJson(injectWarnings(result), { pretty: process.stdout.isTTY });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (def.cli?.format) return def.cli.format(result as any);
|
|
130
|
+
|
|
131
|
+
if (typeof result === 'object' && result !== null && 'summary' in result) {
|
|
132
|
+
return (result as any).summary;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return formatJson(result);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Extract a Buffer from the result's binary field, or undefined if no
|
|
140
|
+
* binary field is configured / extractable / requested. When `--format=json`
|
|
141
|
+
* is explicit the user wants JSON not raw bytes — return undefined so the
|
|
142
|
+
* file reporter falls back to text rendering.
|
|
143
|
+
*/
|
|
144
|
+
function extractBinaryBuffer(
|
|
145
|
+
def: CommandDefinition,
|
|
146
|
+
result: unknown,
|
|
147
|
+
format: string | undefined
|
|
148
|
+
): Buffer | undefined {
|
|
149
|
+
if (format === 'json') return undefined;
|
|
150
|
+
const binaryField = def.cli?.binaryField;
|
|
151
|
+
if (!binaryField) return undefined;
|
|
152
|
+
if (typeof result !== 'object' || result === null) return undefined;
|
|
153
|
+
const data = (result as Record<string, unknown>)[binaryField];
|
|
154
|
+
if (typeof data !== 'string') return undefined;
|
|
155
|
+
return Buffer.from(data, 'base64');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function buildYargsCommand(
|
|
159
|
+
def: CommandDefinition,
|
|
160
|
+
options?: { lifecycle?: CliLifecycleProvider }
|
|
161
|
+
): CommandModule {
|
|
162
|
+
const { positionals, options: yargsOptions } = toYargsOptions(def.args);
|
|
163
|
+
|
|
164
|
+
const positionalSuffix = positionals
|
|
165
|
+
.map((p) => (p.options.demandOption ? `<${p.name}>` : `[${p.name}]`))
|
|
166
|
+
.join(' ');
|
|
167
|
+
|
|
168
|
+
const command = positionalSuffix
|
|
169
|
+
? `${def.name} ${positionalSuffix}`
|
|
170
|
+
: def.name;
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
command,
|
|
174
|
+
describe: def.description,
|
|
175
|
+
builder: (yargs: Argv) => {
|
|
176
|
+
for (const pos of positionals) {
|
|
177
|
+
yargs.positional(pos.name, pos.options as any);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
for (const [name, opt] of Object.entries(yargsOptions)) {
|
|
181
|
+
yargs.option(name, opt as any);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (def.scope === 'session' || def.scope === 'connection') {
|
|
185
|
+
yargs.option('target', {
|
|
186
|
+
alias: 't',
|
|
187
|
+
type: 'string',
|
|
188
|
+
describe: 'Target session ID (or "all" for broadcast)',
|
|
189
|
+
});
|
|
190
|
+
yargs.option('context', {
|
|
191
|
+
type: 'string',
|
|
192
|
+
describe: 'Target context (edit, client, server)',
|
|
193
|
+
choices: ['edit', 'client', 'server'],
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
yargs.option('format', {
|
|
198
|
+
type: 'string',
|
|
199
|
+
choices: ['text', 'json'],
|
|
200
|
+
describe: 'Output format',
|
|
201
|
+
});
|
|
202
|
+
yargs.option('output', {
|
|
203
|
+
alias: 'o',
|
|
204
|
+
type: 'string',
|
|
205
|
+
describe: 'Write output to file',
|
|
206
|
+
});
|
|
207
|
+
yargs.option('open', {
|
|
208
|
+
type: 'boolean',
|
|
209
|
+
default: false,
|
|
210
|
+
describe: 'Open output file after writing',
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
if (def.safety === 'read') {
|
|
214
|
+
yargs.option('watch', {
|
|
215
|
+
alias: 'w',
|
|
216
|
+
type: 'boolean',
|
|
217
|
+
default: false,
|
|
218
|
+
describe: 'Watch for changes',
|
|
219
|
+
});
|
|
220
|
+
yargs.option('interval', {
|
|
221
|
+
type: 'number',
|
|
222
|
+
default: 1000,
|
|
223
|
+
describe: 'Watch interval in milliseconds',
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return yargs;
|
|
228
|
+
},
|
|
229
|
+
handler: async (argv: any) => {
|
|
230
|
+
const commandArgs = extractCommandArgs(argv, def);
|
|
231
|
+
const explicitFormat = argv.format as string | undefined;
|
|
232
|
+
const reporter = buildResultReporter<unknown>({
|
|
233
|
+
outputPath: argv.output as string | undefined,
|
|
234
|
+
watch: !!argv.watch && def.safety === 'read',
|
|
235
|
+
open: argv.open as boolean | undefined,
|
|
236
|
+
intervalMs: argv.interval as number | undefined,
|
|
237
|
+
render: (result) => renderResult(def, result, explicitFormat),
|
|
238
|
+
binary: (result) => extractBinaryBuffer(def, result, explicitFormat),
|
|
239
|
+
});
|
|
240
|
+
const connect =
|
|
241
|
+
options?.lifecycle?.connectAsync.bind(options.lifecycle) ??
|
|
242
|
+
BridgeConnection.connectAsync.bind(BridgeConnection);
|
|
243
|
+
|
|
244
|
+
try {
|
|
245
|
+
if (argv.watch && def.safety === 'read') {
|
|
246
|
+
await runWatchModeAsync(def, commandArgs, argv, reporter, connect);
|
|
247
|
+
} else {
|
|
248
|
+
await runOnceAsync(def, commandArgs, argv, reporter, connect);
|
|
249
|
+
}
|
|
250
|
+
} catch (err) {
|
|
251
|
+
OutputHelper.error(err instanceof Error ? err.message : String(err));
|
|
252
|
+
process.exit(1);
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
async function runOnceAsync(
|
|
259
|
+
def: CommandDefinition,
|
|
260
|
+
commandArgs: Record<string, unknown>,
|
|
261
|
+
argv: Record<string, unknown>,
|
|
262
|
+
reporter: ResultReporter<unknown>,
|
|
263
|
+
connect: CliLifecycleProvider['connectAsync']
|
|
264
|
+
): Promise<void> {
|
|
265
|
+
const result = await executeCommandAsync(def, commandArgs, argv, connect);
|
|
266
|
+
|
|
267
|
+
await reporter.startAsync();
|
|
268
|
+
reporter.onResult(result);
|
|
269
|
+
await reporter.stopAsync();
|
|
270
|
+
|
|
271
|
+
if (
|
|
272
|
+
typeof result === 'object' &&
|
|
273
|
+
result !== null &&
|
|
274
|
+
'success' in result &&
|
|
275
|
+
!(result as any).success
|
|
276
|
+
) {
|
|
277
|
+
process.exit(1);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
async function runWatchModeAsync(
|
|
282
|
+
def: CommandDefinition,
|
|
283
|
+
commandArgs: Record<string, unknown>,
|
|
284
|
+
argv: Record<string, unknown>,
|
|
285
|
+
reporter: ResultReporter<unknown>,
|
|
286
|
+
connect: CliLifecycleProvider['connectAsync']
|
|
287
|
+
): Promise<void> {
|
|
288
|
+
const intervalMs = (argv.interval as number | undefined) ?? 1000;
|
|
289
|
+
|
|
290
|
+
// Standalone commands run without a persistent connection
|
|
291
|
+
const connection: BridgeConnection | undefined =
|
|
292
|
+
def.scope === 'standalone'
|
|
293
|
+
? undefined
|
|
294
|
+
: await connect({
|
|
295
|
+
timeoutMs: argv.timeout as number | undefined,
|
|
296
|
+
remoteHost: argv.remote as string | undefined,
|
|
297
|
+
local: argv.local as boolean | undefined,
|
|
298
|
+
waitForSessions: def.scope === 'connection',
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
let stopped = false;
|
|
302
|
+
const cleanup = (): void => {
|
|
303
|
+
stopped = true;
|
|
304
|
+
};
|
|
305
|
+
process.on('SIGINT', cleanup);
|
|
306
|
+
process.on('SIGTERM', cleanup);
|
|
307
|
+
|
|
308
|
+
try {
|
|
309
|
+
await reporter.startAsync();
|
|
310
|
+
|
|
311
|
+
let result = await executeCommandAsync(
|
|
312
|
+
def,
|
|
313
|
+
commandArgs,
|
|
314
|
+
argv,
|
|
315
|
+
connect,
|
|
316
|
+
connection
|
|
317
|
+
);
|
|
318
|
+
reporter.onResult(result);
|
|
319
|
+
|
|
320
|
+
while (!stopped) {
|
|
321
|
+
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
322
|
+
if (stopped) break;
|
|
323
|
+
try {
|
|
324
|
+
result = await executeCommandAsync(
|
|
325
|
+
def,
|
|
326
|
+
commandArgs,
|
|
327
|
+
argv,
|
|
328
|
+
connect,
|
|
329
|
+
connection
|
|
330
|
+
);
|
|
331
|
+
reporter.onResult(result);
|
|
332
|
+
} catch {
|
|
333
|
+
// Swallow transient errors during polling
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
} finally {
|
|
337
|
+
await reporter.stopAsync();
|
|
338
|
+
if (connection) {
|
|
339
|
+
await connection.disconnectAsync();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the group builder.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
6
|
+
import { buildGroupCommands } from './group-builder.js';
|
|
7
|
+
import { CommandRegistry } from '../../commands/framework/command-registry.js';
|
|
8
|
+
import { defineCommand } from '../../commands/framework/define-command.js';
|
|
9
|
+
import { arg } from '../../commands/framework/arg-builder.js';
|
|
10
|
+
|
|
11
|
+
function makeRegistry(): CommandRegistry {
|
|
12
|
+
const registry = new CommandRegistry();
|
|
13
|
+
|
|
14
|
+
registry.register(
|
|
15
|
+
defineCommand({
|
|
16
|
+
group: 'console',
|
|
17
|
+
name: 'exec',
|
|
18
|
+
description: 'Execute code',
|
|
19
|
+
category: 'execution',
|
|
20
|
+
safety: 'mutate',
|
|
21
|
+
scope: 'session',
|
|
22
|
+
args: { code: arg.positional({ description: 'Code' }) },
|
|
23
|
+
handler: async () => ({}),
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
registry.register(
|
|
28
|
+
defineCommand({
|
|
29
|
+
group: 'console',
|
|
30
|
+
name: 'logs',
|
|
31
|
+
description: 'View logs',
|
|
32
|
+
category: 'execution',
|
|
33
|
+
safety: 'read',
|
|
34
|
+
scope: 'session',
|
|
35
|
+
args: {},
|
|
36
|
+
handler: async () => ({}),
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
registry.register(
|
|
41
|
+
defineCommand({
|
|
42
|
+
group: 'process',
|
|
43
|
+
name: 'list',
|
|
44
|
+
description: 'List sessions',
|
|
45
|
+
category: 'infrastructure',
|
|
46
|
+
safety: 'read',
|
|
47
|
+
scope: 'connection',
|
|
48
|
+
args: {},
|
|
49
|
+
handler: async () => ({}),
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
registry.register(
|
|
54
|
+
defineCommand({
|
|
55
|
+
group: null,
|
|
56
|
+
name: 'serve',
|
|
57
|
+
description: 'Start server',
|
|
58
|
+
category: 'infrastructure',
|
|
59
|
+
safety: 'none',
|
|
60
|
+
scope: 'standalone',
|
|
61
|
+
args: {},
|
|
62
|
+
handler: async () => ({}),
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
return registry;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function createMockYargs() {
|
|
70
|
+
const commands: any[] = [];
|
|
71
|
+
|
|
72
|
+
const mock: any = {
|
|
73
|
+
commands,
|
|
74
|
+
command: vi.fn((cmd: any) => {
|
|
75
|
+
commands.push(cmd);
|
|
76
|
+
return mock;
|
|
77
|
+
}),
|
|
78
|
+
demandCommand: vi.fn(() => mock),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return mock;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
describe('buildGroupCommands', () => {
|
|
85
|
+
it('creates a group command for each unique group', () => {
|
|
86
|
+
const registry = makeRegistry();
|
|
87
|
+
const result = buildGroupCommands(registry);
|
|
88
|
+
|
|
89
|
+
expect(result.groups).toHaveLength(2);
|
|
90
|
+
const groupNames = result.groups.map(
|
|
91
|
+
(g) => (g.command as string).split(' ')[0]
|
|
92
|
+
);
|
|
93
|
+
expect(groupNames).toContain('console');
|
|
94
|
+
expect(groupNames).toContain('process');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('creates top-level commands for null-group definitions', () => {
|
|
98
|
+
const registry = makeRegistry();
|
|
99
|
+
const result = buildGroupCommands(registry);
|
|
100
|
+
|
|
101
|
+
expect(result.topLevel).toHaveLength(1);
|
|
102
|
+
expect(result.topLevel[0].command).toBe('serve');
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('group commands use <command> suffix', () => {
|
|
106
|
+
const registry = makeRegistry();
|
|
107
|
+
const result = buildGroupCommands(registry);
|
|
108
|
+
|
|
109
|
+
const consoleMod = result.groups.find((g) =>
|
|
110
|
+
(g.command as string).startsWith('console')
|
|
111
|
+
);
|
|
112
|
+
expect(consoleMod!.command).toBe('console <command>');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('group commands have descriptions', () => {
|
|
116
|
+
const registry = makeRegistry();
|
|
117
|
+
const result = buildGroupCommands(registry);
|
|
118
|
+
|
|
119
|
+
const consoleMod = result.groups.find((g) =>
|
|
120
|
+
(g.command as string).startsWith('console')
|
|
121
|
+
);
|
|
122
|
+
expect(consoleMod!.describe).toBe('Execute code and view logs');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('group builder registers subcommands', () => {
|
|
126
|
+
const registry = makeRegistry();
|
|
127
|
+
const result = buildGroupCommands(registry);
|
|
128
|
+
|
|
129
|
+
const consoleMod = result.groups.find((g) =>
|
|
130
|
+
(g.command as string).startsWith('console')
|
|
131
|
+
);
|
|
132
|
+
const yargs = createMockYargs();
|
|
133
|
+
(consoleMod!.builder as any)(yargs);
|
|
134
|
+
|
|
135
|
+
// Should register 2 subcommands (exec, logs)
|
|
136
|
+
expect(yargs.commands).toHaveLength(2);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('returns empty arrays for empty registry', () => {
|
|
140
|
+
const registry = new CommandRegistry();
|
|
141
|
+
const result = buildGroupCommands(registry);
|
|
142
|
+
|
|
143
|
+
expect(result.groups).toEqual([]);
|
|
144
|
+
expect(result.topLevel).toEqual([]);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Group builder — converts a `CommandRegistry` into yargs `CommandModule`
|
|
3
|
+
* entries with grouped subcommands.
|
|
4
|
+
*
|
|
5
|
+
* Grouped commands become parent commands with subcommands:
|
|
6
|
+
* `console exec <code>` → `console` parent, `exec` subcommand
|
|
7
|
+
*
|
|
8
|
+
* Top-level commands (group = null) are returned as standalone modules:
|
|
9
|
+
* `serve`, `mcp`, `terminal`
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { CommandModule } from 'yargs';
|
|
13
|
+
import type { CommandRegistry } from '../../commands/framework/command-registry.js';
|
|
14
|
+
import type { CliLifecycleProvider } from './cli-command-adapter.js';
|
|
15
|
+
import { buildYargsCommand } from './cli-command-adapter.js';
|
|
16
|
+
|
|
17
|
+
const GROUP_DESCRIPTIONS: Record<string, string> = {
|
|
18
|
+
console: 'Execute code and view logs',
|
|
19
|
+
explorer: 'Query and modify the DataModel',
|
|
20
|
+
properties: 'Read and write instance properties',
|
|
21
|
+
viewport: 'Screenshots and camera control',
|
|
22
|
+
data: 'Load and save serialized data',
|
|
23
|
+
playtest: 'Control play test sessions',
|
|
24
|
+
process: 'Manage Studio processes',
|
|
25
|
+
plugin: 'Manage the bridge plugin',
|
|
26
|
+
action: 'Invoke a Studio action',
|
|
27
|
+
linux: 'Linux/Wine environment management',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export interface GroupBuilderOptions {
|
|
31
|
+
lifecycle?: CliLifecycleProvider;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface GroupBuilderResult {
|
|
35
|
+
/** Parent commands for each group (e.g. `console <command>`). */
|
|
36
|
+
groups: CommandModule[];
|
|
37
|
+
/** Top-level commands with no group (e.g. `serve`, `mcp`). */
|
|
38
|
+
topLevel: CommandModule[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Build yargs command modules from a registry. Returns grouped parent
|
|
43
|
+
* commands and top-level standalone commands separately so the caller
|
|
44
|
+
* can register them independently.
|
|
45
|
+
*/
|
|
46
|
+
export function buildGroupCommands(
|
|
47
|
+
registry: CommandRegistry,
|
|
48
|
+
options: GroupBuilderOptions = {}
|
|
49
|
+
): GroupBuilderResult {
|
|
50
|
+
const groups: CommandModule[] = [];
|
|
51
|
+
const topLevel: CommandModule[] = [];
|
|
52
|
+
|
|
53
|
+
// Grouped commands → parent module with subcommands
|
|
54
|
+
for (const groupName of registry.getGroups()) {
|
|
55
|
+
const commands = registry.getByGroup(groupName);
|
|
56
|
+
const description =
|
|
57
|
+
GROUP_DESCRIPTIONS[groupName] ?? `${groupName} commands`;
|
|
58
|
+
|
|
59
|
+
groups.push({
|
|
60
|
+
command: `${groupName} <command>`,
|
|
61
|
+
describe: description,
|
|
62
|
+
builder: (yargs) => {
|
|
63
|
+
for (const cmd of commands) {
|
|
64
|
+
yargs.command(buildYargsCommand(cmd, options) as any);
|
|
65
|
+
}
|
|
66
|
+
return yargs.demandCommand(
|
|
67
|
+
1,
|
|
68
|
+
`Run 'studio-bridge ${groupName} --help' for available commands`
|
|
69
|
+
);
|
|
70
|
+
},
|
|
71
|
+
handler: () => {},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Top-level commands (group = null) → standalone modules
|
|
76
|
+
for (const cmd of registry.getTopLevel()) {
|
|
77
|
+
topLevel.push(buildYargsCommand(cmd, options));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return { groups, topLevel };
|
|
81
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the help formatter.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { describe, it, expect } from 'vitest';
|
|
6
|
+
import { formatGroupedHelp } from './help-formatter.js';
|
|
7
|
+
import { CommandRegistry } from '../../commands/framework/command-registry.js';
|
|
8
|
+
import { defineCommand } from '../../commands/framework/define-command.js';
|
|
9
|
+
|
|
10
|
+
function makeRegistry(): CommandRegistry {
|
|
11
|
+
const registry = new CommandRegistry();
|
|
12
|
+
|
|
13
|
+
registry.register(
|
|
14
|
+
defineCommand({
|
|
15
|
+
group: 'console',
|
|
16
|
+
name: 'exec',
|
|
17
|
+
description: 'Execute code',
|
|
18
|
+
category: 'execution',
|
|
19
|
+
safety: 'mutate',
|
|
20
|
+
scope: 'session',
|
|
21
|
+
args: {},
|
|
22
|
+
handler: async () => ({}),
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
registry.register(
|
|
27
|
+
defineCommand({
|
|
28
|
+
group: 'process',
|
|
29
|
+
name: 'list',
|
|
30
|
+
description: 'List sessions',
|
|
31
|
+
category: 'infrastructure',
|
|
32
|
+
safety: 'read',
|
|
33
|
+
scope: 'connection',
|
|
34
|
+
args: {},
|
|
35
|
+
handler: async () => ({}),
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
registry.register(
|
|
40
|
+
defineCommand({
|
|
41
|
+
group: null,
|
|
42
|
+
name: 'serve',
|
|
43
|
+
description: 'Start the bridge server',
|
|
44
|
+
category: 'infrastructure',
|
|
45
|
+
safety: 'none',
|
|
46
|
+
scope: 'standalone',
|
|
47
|
+
args: {},
|
|
48
|
+
handler: async () => ({}),
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return registry;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe('formatGroupedHelp', () => {
|
|
56
|
+
it('includes Execution header', () => {
|
|
57
|
+
const help = formatGroupedHelp(makeRegistry());
|
|
58
|
+
expect(help).toContain('Execution:');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('includes Infrastructure header', () => {
|
|
62
|
+
const help = formatGroupedHelp(makeRegistry());
|
|
63
|
+
expect(help).toContain('Infrastructure:');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('lists execution groups under Execution', () => {
|
|
67
|
+
const help = formatGroupedHelp(makeRegistry());
|
|
68
|
+
const executionSection = help.split('Infrastructure:')[0];
|
|
69
|
+
expect(executionSection).toContain('console <command>');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('lists infrastructure groups under Infrastructure', () => {
|
|
73
|
+
const help = formatGroupedHelp(makeRegistry());
|
|
74
|
+
const infraSection = help.split('Infrastructure:')[1];
|
|
75
|
+
expect(infraSection).toContain('process <command>');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('lists top-level infrastructure commands', () => {
|
|
79
|
+
const help = formatGroupedHelp(makeRegistry());
|
|
80
|
+
const infraSection = help.split('Infrastructure:')[1];
|
|
81
|
+
expect(infraSection).toContain('serve');
|
|
82
|
+
expect(infraSection).toContain('Start the bridge server');
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('includes group descriptions', () => {
|
|
86
|
+
const help = formatGroupedHelp(makeRegistry());
|
|
87
|
+
expect(help).toContain('Execute code and view logs');
|
|
88
|
+
expect(help).toContain('Manage Studio processes');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('returns empty for empty registry', () => {
|
|
92
|
+
const help = formatGroupedHelp(new CommandRegistry());
|
|
93
|
+
expect(help).toContain('studio-bridge <command>');
|
|
94
|
+
expect(help).not.toContain('Execution:');
|
|
95
|
+
expect(help).not.toContain('Infrastructure:');
|
|
96
|
+
});
|
|
97
|
+
});
|