skybridge 0.0.0-dev.f03017e → 0.0.0-dev.f0394fc
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/README.md +126 -124
- package/dist/cli/build-helpers.d.ts +11 -0
- package/dist/cli/build-helpers.js +113 -0
- package/dist/cli/build-helpers.js.map +1 -0
- package/dist/cli/build-helpers.test.js +143 -0
- package/dist/cli/build-helpers.test.js.map +1 -0
- package/dist/cli/build-steps.d.ts +2 -0
- package/dist/cli/build-steps.js +84 -0
- package/dist/cli/build-steps.js.map +1 -0
- package/dist/cli/build-steps.test.js +72 -0
- package/dist/cli/build-steps.test.js.map +1 -0
- package/dist/cli/detect-port.d.ts +2 -2
- package/dist/cli/detect-port.js +8 -20
- package/dist/cli/detect-port.js.map +1 -1
- package/dist/cli/header.d.ts +1 -1
- package/dist/cli/header.js.map +1 -1
- package/dist/cli/resolve-skybridge-config.d.ts +6 -0
- package/dist/cli/resolve-skybridge-config.js +28 -0
- package/dist/cli/resolve-skybridge-config.js.map +1 -0
- package/dist/cli/run-command.js.map +1 -1
- package/dist/cli/run-plain.d.ts +18 -0
- package/dist/cli/run-plain.js +90 -0
- package/dist/cli/run-plain.js.map +1 -0
- package/dist/cli/telemetry.js +2 -0
- package/dist/cli/telemetry.js.map +1 -1
- package/dist/cli/tunnel-control-server.d.ts +9 -0
- package/dist/cli/tunnel-control-server.js +31 -0
- package/dist/cli/tunnel-control-server.js.map +1 -0
- package/dist/cli/tunnel-control-server.test.js +39 -0
- package/dist/cli/tunnel-control-server.test.js.map +1 -0
- package/dist/cli/tunnel-handler.d.ts +3 -0
- package/dist/cli/tunnel-handler.js +48 -0
- package/dist/cli/tunnel-handler.js.map +1 -0
- package/dist/cli/tunnel-handler.test.js +105 -0
- package/dist/cli/tunnel-handler.test.js.map +1 -0
- package/dist/cli/tunnel.d.ts +57 -0
- package/dist/cli/tunnel.js +154 -0
- package/dist/cli/tunnel.js.map +1 -0
- package/dist/cli/tunnel.test.js +190 -0
- package/dist/cli/tunnel.test.js.map +1 -0
- package/dist/cli/types.js.map +1 -1
- package/dist/cli/use-execute-steps.d.ts +1 -1
- package/dist/cli/use-execute-steps.js.map +1 -1
- package/dist/cli/use-messages.js.map +1 -1
- package/dist/cli/use-nodemon.d.ts +25 -1
- package/dist/cli/use-nodemon.js +97 -55
- package/dist/cli/use-nodemon.js.map +1 -1
- package/dist/cli/use-open-browser.d.ts +1 -0
- package/dist/cli/use-open-browser.js +44 -0
- package/dist/cli/use-open-browser.js.map +1 -0
- package/dist/cli/use-tunnel.d.ts +1 -1
- package/dist/cli/use-tunnel.js +102 -68
- package/dist/cli/use-tunnel.js.map +1 -1
- package/dist/cli/use-typescript-check.d.ts +9 -2
- package/dist/cli/use-typescript-check.js +91 -51
- package/dist/cli/use-typescript-check.js.map +1 -1
- package/dist/commands/build.d.ts +0 -3
- package/dist/commands/build.js +2 -38
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.js +30 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dev.d.ts +2 -0
- package/dist/commands/dev.js +84 -5
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/start.js +7 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/telemetry/disable.js.map +1 -1
- package/dist/commands/telemetry/enable.js.map +1 -1
- package/dist/commands/telemetry/status.js.map +1 -1
- package/dist/context-warnings.d.ts +5 -0
- package/dist/context-warnings.js +31 -0
- package/dist/context-warnings.js.map +1 -0
- package/dist/context-warnings.test.js +28 -0
- package/dist/context-warnings.test.js.map +1 -0
- package/dist/server/app.d.ts +211 -0
- package/dist/server/app.js +277 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/app.test.d.ts +1 -0
- package/dist/server/app.test.js +178 -0
- package/dist/server/app.test.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.d.ts +1 -0
- package/dist/server/asset-base-url-transform-plugin.js +17 -2
- package/dist/server/asset-base-url-transform-plugin.js.map +1 -1
- package/dist/server/asset-base-url-transform-plugin.test.js +80 -1
- package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -1
- package/dist/server/auth/discovery.d.ts +33 -0
- package/dist/server/auth/discovery.js +56 -0
- package/dist/server/auth/discovery.js.map +1 -0
- package/dist/server/auth/discovery.test.d.ts +1 -0
- package/dist/server/auth/discovery.test.js +93 -0
- package/dist/server/auth/discovery.test.js.map +1 -0
- package/dist/server/auth/index.d.ts +48 -0
- package/dist/server/auth/index.js +2 -0
- package/dist/server/auth/index.js.map +1 -0
- package/dist/server/auth/providers/auth0.d.ts +40 -0
- package/dist/server/auth/providers/auth0.js +36 -0
- package/dist/server/auth/providers/auth0.js.map +1 -0
- package/dist/server/auth/providers/auth0.test.d.ts +1 -0
- package/dist/server/auth/providers/auth0.test.js +50 -0
- package/dist/server/auth/providers/auth0.test.js.map +1 -0
- package/dist/server/auth/providers/authplane.d.ts +49 -0
- package/dist/server/auth/providers/authplane.js +57 -0
- package/dist/server/auth/providers/authplane.js.map +1 -0
- package/dist/server/auth/providers/authplane.test.d.ts +1 -0
- package/dist/server/auth/providers/authplane.test.js +143 -0
- package/dist/server/auth/providers/authplane.test.js.map +1 -0
- package/dist/server/auth/providers/clerk.d.ts +51 -0
- package/dist/server/auth/providers/clerk.js +19 -0
- package/dist/server/auth/providers/clerk.js.map +1 -0
- package/dist/server/auth/providers/clerk.test.d.ts +1 -0
- package/dist/server/auth/providers/clerk.test.js +30 -0
- package/dist/server/auth/providers/clerk.test.js.map +1 -0
- package/dist/server/auth/providers/custom.d.ts +42 -0
- package/dist/server/auth/providers/custom.js +59 -0
- package/dist/server/auth/providers/custom.js.map +1 -0
- package/dist/server/auth/providers/custom.test.d.ts +1 -0
- package/dist/server/auth/providers/custom.test.js +161 -0
- package/dist/server/auth/providers/custom.test.js.map +1 -0
- package/dist/server/auth/providers/descope.d.ts +44 -0
- package/dist/server/auth/providers/descope.js +44 -0
- package/dist/server/auth/providers/descope.js.map +1 -0
- package/dist/server/auth/providers/descope.test.d.ts +1 -0
- package/dist/server/auth/providers/descope.test.js +62 -0
- package/dist/server/auth/providers/descope.test.js.map +1 -0
- package/dist/server/auth/providers/shared.d.ts +2 -0
- package/dist/server/auth/providers/shared.js +6 -0
- package/dist/server/auth/providers/shared.js.map +1 -0
- package/dist/server/auth/providers/shared.test.d.ts +1 -0
- package/dist/server/auth/providers/shared.test.js +10 -0
- package/dist/server/auth/providers/shared.test.js.map +1 -0
- package/dist/server/auth/providers/stytch.d.ts +25 -0
- package/dist/server/auth/providers/stytch.js +16 -0
- package/dist/server/auth/providers/stytch.js.map +1 -0
- package/dist/server/auth/providers/verify-spy.d.ts +12 -0
- package/dist/server/auth/providers/verify-spy.js +21 -0
- package/dist/server/auth/providers/verify-spy.js.map +1 -0
- package/dist/server/auth/providers/workos.d.ts +34 -0
- package/dist/server/auth/providers/workos.js +16 -0
- package/dist/server/auth/providers/workos.js.map +1 -0
- package/dist/server/auth/security-schemes.d.ts +23 -0
- package/dist/server/auth/security-schemes.js +64 -0
- package/dist/server/auth/security-schemes.js.map +1 -0
- package/dist/server/auth/security-schemes.test.d.ts +1 -0
- package/dist/server/auth/security-schemes.test.js +99 -0
- package/dist/server/auth/security-schemes.test.js.map +1 -0
- package/dist/server/auth/setup.d.ts +6 -0
- package/dist/server/auth/setup.js +91 -0
- package/dist/server/auth/setup.js.map +1 -0
- package/dist/server/auth/setup.test.d.ts +1 -0
- package/dist/server/auth/setup.test.js +514 -0
- package/dist/server/auth/setup.test.js.map +1 -0
- package/dist/server/auth/verify.d.ts +48 -0
- package/dist/server/auth/verify.js +62 -0
- package/dist/server/auth/verify.js.map +1 -0
- package/dist/server/auth/verify.test.d.ts +1 -0
- package/dist/server/auth/verify.test.js +165 -0
- package/dist/server/auth/verify.test.js.map +1 -0
- package/dist/server/auth-extra.test-d.d.ts +1 -0
- package/dist/server/auth-extra.test-d.js +130 -0
- package/dist/server/auth-extra.test-d.js.map +1 -0
- package/dist/server/auth.d.ts +57 -0
- package/dist/server/auth.js +27 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/build-manifest.test.d.ts +1 -0
- package/dist/server/build-manifest.test.js +28 -0
- package/dist/server/build-manifest.test.js.map +1 -0
- package/dist/server/content-helpers.d.ts +41 -1
- package/dist/server/content-helpers.js +33 -0
- package/dist/server/content-helpers.js.map +1 -1
- package/dist/server/content-helpers.test.js.map +1 -1
- package/dist/server/events.d.ts +113 -0
- package/dist/server/events.js +318 -0
- package/dist/server/events.js.map +1 -0
- package/dist/server/events.test.d.ts +1 -0
- package/dist/server/events.test.js +172 -0
- package/dist/server/events.test.js.map +1 -0
- package/dist/server/express.d.ts +24 -7
- package/dist/server/express.js +66 -30
- package/dist/server/express.js.map +1 -1
- package/dist/server/express.test.js +445 -81
- package/dist/server/express.test.js.map +1 -1
- package/dist/server/file-ref.d.ts +28 -0
- package/dist/server/file-ref.js +27 -0
- package/dist/server/file-ref.js.map +1 -0
- package/dist/server/form-input.d.ts +120 -0
- package/dist/server/form-input.js +89 -0
- package/dist/server/form-input.js.map +1 -0
- package/dist/server/host.d.ts +2 -0
- package/dist/server/host.js +11 -0
- package/dist/server/host.js.map +1 -0
- package/dist/server/host.test.d.ts +1 -0
- package/dist/server/host.test.js +13 -0
- package/dist/server/host.test.js.map +1 -0
- package/dist/server/index.d.ts +20 -2
- package/dist/server/index.js +17 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/inferUtilityTypes.d.ts +6 -6
- package/dist/server/inferUtilityTypes.js.map +1 -1
- package/dist/server/mcp-errors.test.d.ts +1 -0
- package/dist/server/mcp-errors.test.js +229 -0
- package/dist/server/mcp-errors.test.js.map +1 -0
- package/dist/server/metric.d.ts +5 -3
- package/dist/server/metric.js +5 -5
- package/dist/server/metric.js.map +1 -1
- package/dist/server/middleware.d.ts +51 -13
- package/dist/server/middleware.js +33 -0
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/middleware.test-d.js +1 -1
- package/dist/server/middleware.test-d.js.map +1 -1
- package/dist/server/middleware.test.js +242 -134
- package/dist/server/middleware.test.js.map +1 -1
- package/dist/server/register-tool.test.d.ts +1 -0
- package/dist/server/register-tool.test.js +230 -0
- package/dist/server/register-tool.test.js.map +1 -0
- package/dist/server/requestOrigin.d.ts +7 -0
- package/dist/server/requestOrigin.js +25 -0
- package/dist/server/requestOrigin.js.map +1 -0
- package/dist/server/server.d.ts +548 -56
- package/dist/server/server.js +685 -286
- package/dist/server/server.js.map +1 -1
- package/dist/server/skills-integration.test.d.ts +1 -0
- package/dist/server/skills-integration.test.js +86 -0
- package/dist/server/skills-integration.test.js.map +1 -0
- package/dist/server/skills.d.ts +27 -0
- package/dist/server/skills.js +188 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/skills.test.d.ts +1 -0
- package/dist/server/skills.test.js +243 -0
- package/dist/server/skills.test.js.map +1 -0
- package/dist/server/templateHelper.d.ts +0 -5
- package/dist/server/templateHelper.js +3 -22
- package/dist/server/templateHelper.js.map +1 -1
- package/dist/server/templates.generated.d.ts +4 -0
- package/dist/server/templates.generated.js +43 -0
- package/dist/server/templates.generated.js.map +1 -0
- package/dist/server/tool-extra.test.d.ts +1 -0
- package/dist/server/tool-extra.test.js +167 -0
- package/dist/server/tool-extra.test.js.map +1 -0
- package/dist/server/tunnel-proxy-router.d.ts +7 -0
- package/dist/server/tunnel-proxy-router.js +110 -0
- package/dist/server/tunnel-proxy-router.js.map +1 -0
- package/dist/server/tunnel-proxy-router.test.d.ts +1 -0
- package/dist/server/tunnel-proxy-router.test.js +229 -0
- package/dist/server/tunnel-proxy-router.test.js.map +1 -0
- package/dist/server/view-name.test-d.d.ts +1 -0
- package/dist/server/view-name.test-d.js +8 -0
- package/dist/server/view-name.test-d.js.map +1 -0
- package/dist/server/view-resource-resolution.test.d.ts +6 -0
- package/dist/server/view-resource-resolution.test.js +176 -0
- package/dist/server/view-resource-resolution.test.js.map +1 -0
- package/dist/server/viewsDevServer.js +4 -1
- package/dist/server/viewsDevServer.js.map +1 -1
- package/dist/test/utils.d.ts +9 -11
- package/dist/test/utils.js +220 -201
- package/dist/test/utils.js.map +1 -1
- package/dist/test/view.test.js +199 -113
- package/dist/test/view.test.js.map +1 -1
- package/dist/version.js +1 -3
- package/dist/version.js.map +1 -1
- package/dist/views/index.d.ts +10 -0
- package/dist/views/index.js +3 -0
- package/dist/views/index.js.map +1 -0
- package/dist/{web/plugin → views}/scan-views.d.ts +8 -0
- package/dist/{web/plugin → views}/scan-views.js +26 -8
- package/dist/views/scan-views.js.map +1 -0
- package/dist/views/scan-views.test.d.ts +1 -0
- package/dist/{web/plugin → views}/scan-views.test.js +33 -1
- package/dist/views/scan-views.test.js.map +1 -0
- package/dist/views/validate-view.d.ts +1 -0
- package/dist/{web/plugin → views}/validate-view.js +2 -2
- package/dist/views/validate-view.js.map +1 -0
- package/dist/views/validate-view.test.d.ts +1 -0
- package/dist/views/validate-view.test.js.map +1 -0
- package/dist/web/bridges/adaptor.d.ts +62 -0
- package/dist/web/bridges/adaptor.js +477 -0
- package/dist/web/bridges/adaptor.js.map +1 -0
- package/dist/web/bridges/adaptor.test.d.ts +1 -0
- package/dist/web/bridges/adaptor.test.js +281 -0
- package/dist/web/bridges/adaptor.test.js.map +1 -0
- package/dist/web/bridges/apps-sdk/bridge.d.ts +6 -1
- package/dist/web/bridges/apps-sdk/bridge.js +15 -3
- package/dist/web/bridges/apps-sdk/bridge.js.map +1 -1
- package/dist/web/bridges/apps-sdk/index.d.ts +0 -1
- package/dist/web/bridges/apps-sdk/index.js +0 -1
- package/dist/web/bridges/apps-sdk/index.js.map +1 -1
- package/dist/web/bridges/apps-sdk/types.d.ts +10 -4
- package/dist/web/bridges/apps-sdk/types.js.map +1 -1
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +11 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +11 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -1
- package/dist/web/bridges/get-adaptor.d.ts +7 -0
- package/dist/web/bridges/get-adaptor.js +9 -7
- package/dist/web/bridges/get-adaptor.js.map +1 -1
- package/dist/web/bridges/get-adaptor.test.d.ts +1 -0
- package/dist/web/bridges/get-adaptor.test.js +32 -0
- package/dist/web/bridges/get-adaptor.test.js.map +1 -0
- package/dist/web/bridges/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.d.ts +15 -2
- package/dist/web/bridges/mcp-app/bridge.js +80 -7
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/bridge.test.js +17 -0
- package/dist/web/bridges/mcp-app/bridge.test.js.map +1 -0
- package/dist/web/bridges/mcp-app/index.d.ts +0 -1
- package/dist/web/bridges/mcp-app/index.js +0 -1
- package/dist/web/bridges/mcp-app/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/types.d.ts +19 -2
- package/dist/web/bridges/mcp-app/types.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +13 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +12 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -1
- package/dist/web/bridges/mcp-app/view-tools.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/view-tools.test.js +143 -0
- package/dist/web/bridges/mcp-app/view-tools.test.js.map +1 -0
- package/dist/web/bridges/types.d.ts +174 -11
- package/dist/web/bridges/types.js +14 -1
- package/dist/web/bridges/types.js.map +1 -1
- package/dist/web/bridges/types.test.d.ts +1 -0
- package/dist/web/bridges/types.test.js +19 -0
- package/dist/web/bridges/types.test.js.map +1 -0
- package/dist/web/bridges/use-host-context.d.ts +5 -0
- package/dist/web/bridges/use-host-context.js +5 -0
- package/dist/web/bridges/use-host-context.js.map +1 -1
- package/dist/web/components/modal-provider.d.ts +1 -1
- package/dist/web/components/modal-provider.js +4 -3
- package/dist/web/components/modal-provider.js.map +1 -1
- package/dist/web/create-store.d.ts +26 -0
- package/dist/web/create-store.js +35 -9
- package/dist/web/create-store.js.map +1 -1
- package/dist/web/create-store.test.js +24 -23
- package/dist/web/create-store.test.js.map +1 -1
- package/dist/web/data-llm.d.ts +35 -2
- package/dist/web/data-llm.js +34 -5
- package/dist/web/data-llm.js.map +1 -1
- package/dist/web/data-llm.test.js +48 -29
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +25 -19
- package/dist/web/generate-helpers.js +23 -17
- package/dist/web/generate-helpers.js.map +1 -1
- package/dist/web/generate-helpers.test-d.js +14 -12
- package/dist/web/generate-helpers.test-d.js.map +1 -1
- package/dist/web/generate-helpers.test.js +2 -2
- package/dist/web/generate-helpers.test.js.map +1 -1
- package/dist/web/helpers/state.d.ts +2 -2
- package/dist/web/helpers/state.js +11 -11
- package/dist/web/helpers/state.js.map +1 -1
- package/dist/web/helpers/state.test.js +9 -9
- package/dist/web/helpers/state.test.js.map +1 -1
- package/dist/web/hooks/index.d.ts +11 -2
- package/dist/web/hooks/index.js +11 -2
- package/dist/web/hooks/index.js.map +1 -1
- package/dist/web/hooks/openai-extensions.test.d.ts +1 -0
- package/dist/web/hooks/openai-extensions.test.js +107 -0
- package/dist/web/hooks/openai-extensions.test.js.map +1 -0
- package/dist/web/hooks/test/utils.d.ts +7 -2
- package/dist/web/hooks/test/utils.js +14 -3
- package/dist/web/hooks/test/utils.js.map +1 -1
- package/dist/web/hooks/use-call-tool.d.ts +47 -2
- package/dist/web/hooks/use-call-tool.js +43 -10
- package/dist/web/hooks/use-call-tool.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test-d.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test.js +75 -29
- package/dist/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/web/hooks/use-deep-link.d.ts +22 -0
- package/dist/web/hooks/use-deep-link.js +34 -0
- package/dist/web/hooks/use-deep-link.js.map +1 -0
- package/dist/web/hooks/use-display-mode.d.ts +20 -0
- package/dist/web/hooks/use-display-mode.js +20 -0
- package/dist/web/hooks/use-display-mode.js.map +1 -1
- package/dist/web/hooks/use-display-mode.test-d.js.map +1 -1
- package/dist/web/hooks/use-display-mode.test.js +57 -21
- package/dist/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/web/hooks/use-download.d.ts +3 -0
- package/dist/web/hooks/use-download.js +7 -0
- package/dist/web/hooks/use-download.js.map +1 -0
- package/dist/web/hooks/use-download.test.d.ts +1 -0
- package/dist/web/hooks/use-download.test.js +103 -0
- package/dist/web/hooks/use-download.test.js.map +1 -0
- package/dist/web/hooks/use-file-resource.d.ts +37 -0
- package/dist/web/hooks/use-file-resource.js +98 -0
- package/dist/web/hooks/use-file-resource.js.map +1 -0
- package/dist/web/hooks/use-file-resource.test.d.ts +1 -0
- package/dist/web/hooks/use-file-resource.test.js +65 -0
- package/dist/web/hooks/use-file-resource.test.js.map +1 -0
- package/dist/web/hooks/use-files.d.ts +32 -0
- package/dist/web/hooks/use-files.js +32 -0
- package/dist/web/hooks/use-files.js.map +1 -1
- package/dist/web/hooks/use-files.test.js +11 -3
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/hooks/use-host.d.ts +44 -0
- package/dist/web/hooks/use-host.js +45 -0
- package/dist/web/hooks/use-host.js.map +1 -0
- package/dist/web/hooks/use-host.test.d.ts +1 -0
- package/dist/web/hooks/use-host.test.js +59 -0
- package/dist/web/hooks/use-host.test.js.map +1 -0
- package/dist/web/hooks/use-model-context.d.ts +44 -0
- package/dist/web/hooks/use-model-context.js +63 -0
- package/dist/web/hooks/use-model-context.js.map +1 -0
- package/dist/web/hooks/use-open-external.d.ts +17 -0
- package/dist/web/hooks/use-open-external.js +16 -0
- package/dist/web/hooks/use-open-external.js.map +1 -1
- package/dist/web/hooks/use-open-external.test.js +15 -5
- package/dist/web/hooks/use-open-external.test.js.map +1 -1
- package/dist/web/hooks/use-open-file.d.ts +20 -0
- package/dist/web/hooks/use-open-file.js +25 -0
- package/dist/web/hooks/use-open-file.js.map +1 -0
- package/dist/web/hooks/use-register-view-tool.d.ts +37 -0
- package/dist/web/hooks/use-register-view-tool.js +50 -0
- package/dist/web/hooks/use-register-view-tool.js.map +1 -0
- package/dist/web/hooks/use-request-close.d.ts +16 -0
- package/dist/web/hooks/use-request-close.js +21 -0
- package/dist/web/hooks/use-request-close.js.map +1 -0
- package/dist/web/hooks/use-request-close.test.d.ts +1 -0
- package/dist/web/hooks/use-request-close.test.js +47 -0
- package/dist/web/hooks/use-request-close.test.js.map +1 -0
- package/dist/web/hooks/use-request-modal.d.ts +16 -1
- package/dist/web/hooks/use-request-modal.js +19 -4
- package/dist/web/hooks/use-request-modal.js.map +1 -1
- package/dist/web/hooks/use-request-modal.test.js +12 -2
- package/dist/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/web/hooks/use-request-size.d.ts +20 -0
- package/dist/web/hooks/use-request-size.js +24 -0
- package/dist/web/hooks/use-request-size.js.map +1 -0
- package/dist/web/hooks/use-request-size.test.d.ts +1 -0
- package/dist/web/hooks/use-request-size.test.js +47 -0
- package/dist/web/hooks/use-request-size.test.js.map +1 -0
- package/dist/web/hooks/use-send-follow-up-message.d.ts +25 -1
- package/dist/web/hooks/use-send-follow-up-message.js +25 -2
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.d.ts +17 -0
- package/dist/web/hooks/use-set-open-in-app-url.js +17 -0
- package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.test.js +26 -12
- package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -1
- package/dist/web/hooks/use-tool-info.d.ts +46 -14
- package/dist/web/hooks/use-tool-info.js +29 -7
- package/dist/web/hooks/use-tool-info.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test-d.js +11 -34
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test.js +42 -37
- package/dist/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/web/hooks/use-user.d.ts +5 -2
- package/dist/web/hooks/use-user.js +6 -3
- package/dist/web/hooks/use-user.js.map +1 -1
- package/dist/web/hooks/use-user.test.js +85 -37
- package/dist/web/hooks/use-user.test.js.map +1 -1
- package/dist/web/hooks/use-view-state.d.ts +25 -0
- package/dist/web/hooks/use-view-state.js +42 -0
- package/dist/web/hooks/use-view-state.js.map +1 -0
- package/dist/web/hooks/use-view-state.test.d.ts +1 -0
- package/dist/web/hooks/{use-widget-state.test.js → use-view-state.test.js} +56 -21
- package/dist/web/hooks/use-view-state.test.js.map +1 -0
- package/dist/web/hooks/use-viewport.d.ts +20 -0
- package/dist/web/hooks/use-viewport.js +21 -0
- package/dist/web/hooks/use-viewport.js.map +1 -0
- package/dist/web/hooks/use-viewport.test.d.ts +1 -0
- package/dist/web/hooks/use-viewport.test.js +109 -0
- package/dist/web/hooks/use-viewport.test.js.map +1 -0
- package/dist/web/index.d.ts +1 -3
- package/dist/web/index.js +1 -2
- package/dist/web/index.js.map +1 -1
- package/dist/web/mount-view.d.ts +21 -0
- package/dist/web/mount-view.js +43 -0
- package/dist/web/mount-view.js.map +1 -0
- package/dist/web/proxy.js.map +1 -1
- package/dist/web/types.d.ts +4 -0
- package/dist/web/types.js.map +1 -1
- package/package.json +46 -28
- package/dist/server/templates/development.hbs +0 -12
- package/dist/server/templates/production.hbs +0 -6
- package/dist/web/bridges/apps-sdk/adaptor.d.ts +0 -24
- package/dist/web/bridges/apps-sdk/adaptor.js +0 -87
- package/dist/web/bridges/apps-sdk/adaptor.js.map +0 -1
- package/dist/web/bridges/mcp-app/adaptor.d.ts +0 -48
- package/dist/web/bridges/mcp-app/adaptor.js +0 -268
- package/dist/web/bridges/mcp-app/adaptor.js.map +0 -1
- package/dist/web/hooks/use-layout.d.ts +0 -22
- package/dist/web/hooks/use-layout.js +0 -23
- package/dist/web/hooks/use-layout.js.map +0 -1
- package/dist/web/hooks/use-layout.test.js +0 -96
- package/dist/web/hooks/use-layout.test.js.map +0 -1
- package/dist/web/hooks/use-widget-state.d.ts +0 -4
- package/dist/web/hooks/use-widget-state.js +0 -32
- package/dist/web/hooks/use-widget-state.js.map +0 -1
- package/dist/web/hooks/use-widget-state.test.js.map +0 -1
- package/dist/web/mount-widget.d.ts +0 -1
- package/dist/web/mount-widget.js +0 -27
- package/dist/web/mount-widget.js.map +0 -1
- package/dist/web/plugin/data-llm.test.js +0 -81
- package/dist/web/plugin/data-llm.test.js.map +0 -1
- package/dist/web/plugin/plugin.d.ts +0 -5
- package/dist/web/plugin/plugin.js +0 -141
- package/dist/web/plugin/plugin.js.map +0 -1
- package/dist/web/plugin/scan-views.js.map +0 -1
- package/dist/web/plugin/scan-views.test.js.map +0 -1
- package/dist/web/plugin/transform-data-llm.d.ts +0 -12
- package/dist/web/plugin/transform-data-llm.js +0 -96
- package/dist/web/plugin/transform-data-llm.js.map +0 -1
- package/dist/web/plugin/transform-data-llm.test.js +0 -81
- package/dist/web/plugin/transform-data-llm.test.js.map +0 -1
- package/dist/web/plugin/validate-view.d.ts +0 -1
- package/dist/web/plugin/validate-view.js.map +0 -1
- package/dist/web/plugin/validate-view.test.js.map +0 -1
- /package/dist/{web/hooks/use-layout.test.d.ts → cli/build-helpers.test.d.ts} +0 -0
- /package/dist/{web/hooks/use-widget-state.test.d.ts → cli/build-steps.test.d.ts} +0 -0
- /package/dist/{web/plugin/data-llm.test.d.ts → cli/tunnel-control-server.test.d.ts} +0 -0
- /package/dist/{web/plugin/scan-views.test.d.ts → cli/tunnel-handler.test.d.ts} +0 -0
- /package/dist/{web/plugin/transform-data-llm.test.d.ts → cli/tunnel.test.d.ts} +0 -0
- /package/dist/{web/plugin/validate-view.test.d.ts → context-warnings.test.d.ts} +0 -0
- /package/dist/{web/plugin → views}/validate-view.test.js +0 -0
package/dist/cli/use-tunnel.js
CHANGED
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
1
|
import { useEffect, useState } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
const POST_RETRY_DELAY_MS = 250;
|
|
3
|
+
export function useTunnel(port, pushMessage, verbose, autoStart) {
|
|
4
|
+
const [state, setState] = useState(port !== null && autoStart
|
|
5
|
+
? { status: "starting", message: "Starting tunnel…" }
|
|
6
|
+
: { status: "idle" });
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
if (port === null) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let stderrBuffer = "";
|
|
15
|
-
let connected = false;
|
|
16
|
-
const timeout = setTimeout(() => {
|
|
17
|
-
if (!connected) {
|
|
18
|
-
setState({
|
|
19
|
-
status: "error",
|
|
20
|
-
message: "Tunnel connection timed out after one minute",
|
|
21
|
-
});
|
|
22
|
-
tunnelProcess.kill();
|
|
23
|
-
}
|
|
24
|
-
}, 60_000);
|
|
11
|
+
const baseUrl = `http://localhost:${port}`;
|
|
12
|
+
const controller = new AbortController();
|
|
13
|
+
let cancelled = false;
|
|
25
14
|
const pushLog = (text, type) => {
|
|
26
15
|
const time = new Date().toLocaleTimeString("en-US", {
|
|
27
16
|
hour: "numeric",
|
|
@@ -31,67 +20,112 @@ export function useTunnel(port, pushMessage, verbose) {
|
|
|
31
20
|
});
|
|
32
21
|
pushMessage(`${time} [tunnel] ${text}`, type);
|
|
33
22
|
};
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
const handleEvent = (event, data) => {
|
|
24
|
+
if (event === "state") {
|
|
25
|
+
const next = JSON.parse(data);
|
|
26
|
+
setState(next);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (event === "activity") {
|
|
30
|
+
if (!verbose) {
|
|
31
|
+
return;
|
|
42
32
|
}
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
const activity = JSON.parse(data);
|
|
34
|
+
pushLog(activity.text, activity.level);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const consumeSse = async () => {
|
|
38
|
+
const res = await fetch(`${baseUrl}/__skybridge/tunnel/events`, {
|
|
39
|
+
signal: controller.signal,
|
|
40
|
+
headers: { Accept: "text/event-stream" },
|
|
41
|
+
});
|
|
42
|
+
if (!res.ok || !res.body) {
|
|
43
|
+
throw new Error(`SSE connection failed (${res.status})`);
|
|
44
|
+
}
|
|
45
|
+
const reader = res.body.getReader();
|
|
46
|
+
const decoder = new TextDecoder();
|
|
47
|
+
let buffer = "";
|
|
48
|
+
while (!cancelled) {
|
|
49
|
+
const { value, done } = await reader.read();
|
|
50
|
+
if (done) {
|
|
51
|
+
return;
|
|
49
52
|
}
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
buffer += decoder.decode(value, { stream: true });
|
|
54
|
+
// SSE frames are separated by a blank line ("\n\n").
|
|
55
|
+
let sep = buffer.indexOf("\n\n");
|
|
56
|
+
while (sep !== -1) {
|
|
57
|
+
const frame = buffer.slice(0, sep);
|
|
58
|
+
buffer = buffer.slice(sep + 2);
|
|
59
|
+
let eventName = "message";
|
|
60
|
+
const dataLines = [];
|
|
61
|
+
for (const rawLine of frame.split("\n")) {
|
|
62
|
+
const line = rawLine.replace(/\r$/, "");
|
|
63
|
+
if (line.startsWith("event:")) {
|
|
64
|
+
eventName = line.slice(6).trim();
|
|
65
|
+
}
|
|
66
|
+
else if (line.startsWith("data:")) {
|
|
67
|
+
dataLines.push(line.slice(5).trimStart());
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (dataLines.length > 0) {
|
|
71
|
+
handleEvent(eventName, dataLines.join("\n"));
|
|
72
|
+
}
|
|
73
|
+
sep = buffer.indexOf("\n\n");
|
|
52
74
|
}
|
|
53
75
|
}
|
|
54
76
|
};
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
77
|
+
const postUntilStarted = async () => {
|
|
78
|
+
// Retry indefinitely until POST lands once. Bounded by the effect
|
|
79
|
+
// lifetime via controller.abort() on unmount. Once the manager has
|
|
80
|
+
// been started, this returns and never POSTs again — a user-driven
|
|
81
|
+
// DELETE /tunnel won't be auto-undone.
|
|
82
|
+
while (!cancelled) {
|
|
83
|
+
try {
|
|
84
|
+
const res = await fetch(`${baseUrl}/__skybridge/tunnel`, {
|
|
85
|
+
method: "POST",
|
|
86
|
+
signal: controller.signal,
|
|
87
|
+
});
|
|
88
|
+
if (res.ok) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// dev server not up yet (or restarting under nodemon) — wait, retry
|
|
94
|
+
}
|
|
95
|
+
await new Promise((r) => setTimeout(r, POST_RETRY_DELAY_MS));
|
|
59
96
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
97
|
+
};
|
|
98
|
+
// Always observe the tunnel state so external triggers (curl, future
|
|
99
|
+
// devtools UI) update the cli UI. `autoStart` only decides whether we
|
|
100
|
+
// also POST /tunnel on mount. Reconnects indefinitely so we survive
|
|
101
|
+
// dev-server boot delay and nodemon restarts; the cli owns the actual
|
|
102
|
+
// subprocess so a temporarily-unreachable dev server is fine.
|
|
103
|
+
const observe = async () => {
|
|
104
|
+
while (!cancelled) {
|
|
105
|
+
try {
|
|
106
|
+
await consumeSse();
|
|
64
107
|
}
|
|
108
|
+
catch {
|
|
109
|
+
// network error or stream ended abnormally — fall through to retry
|
|
110
|
+
}
|
|
111
|
+
if (cancelled) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
await new Promise((r) => setTimeout(r, POST_RETRY_DELAY_MS));
|
|
65
115
|
}
|
|
66
116
|
};
|
|
67
|
-
|
|
68
|
-
|
|
117
|
+
// observe() always runs — it owns the cli's view of tunnel state. POST is
|
|
118
|
+
// a fire-and-forget side-effect that nudges the manager into starting and
|
|
119
|
+
// retries until it lands at least once.
|
|
120
|
+
if (autoStart) {
|
|
121
|
+
void postUntilStarted();
|
|
69
122
|
}
|
|
70
|
-
|
|
71
|
-
tunnelProcess.stderr.on("data", handleStderr);
|
|
72
|
-
}
|
|
73
|
-
tunnelProcess.on("error", (err) => {
|
|
74
|
-
clearTimeout(timeout);
|
|
75
|
-
setState({ status: "error", message: err.message });
|
|
76
|
-
});
|
|
77
|
-
tunnelProcess.on("close", (code) => {
|
|
78
|
-
clearTimeout(timeout);
|
|
79
|
-
if (code !== 0 && code !== null) {
|
|
80
|
-
const detail = stderrBuffer.trim() || `exited with code ${code}`;
|
|
81
|
-
const hint = verbose
|
|
82
|
-
? `Try manually: npx alpic tunnel --port ${port}`
|
|
83
|
-
: "Re-run with --verbose to see full tunnel logs";
|
|
84
|
-
setState({
|
|
85
|
-
status: "error",
|
|
86
|
-
message: `${detail}. ${hint}`,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
});
|
|
123
|
+
void observe();
|
|
90
124
|
return () => {
|
|
91
|
-
|
|
92
|
-
|
|
125
|
+
cancelled = true;
|
|
126
|
+
controller.abort();
|
|
93
127
|
};
|
|
94
|
-
}, [port, pushMessage, verbose]);
|
|
128
|
+
}, [port, pushMessage, verbose, autoStart]);
|
|
95
129
|
return state;
|
|
96
130
|
}
|
|
97
131
|
//# sourceMappingURL=use-tunnel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tunnel.js","sourceRoot":"","sources":["../../src/cli/use-tunnel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-tunnel.js","sourceRoot":"","sources":["../../src/cli/use-tunnel.ts"],"names":[],"mappings":"AAAA,OAAO,EA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AC,CAAC;oBACH,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;wBACX,OAAO;oBACT,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACP,oEAAoE;gBACtE,CAAC;gBACD,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC,CAAC;QAEF,qEAAqE;QACrE,sEAAsE;QACtE,oEAAoE;QACpE,sEAAsE;QACtE,8DAA8D;QAC9D,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;YACzB,OAAO,CAAC,SAAS,EAAE,CAAC;gBAClB,IAAI,CAAC;oBACH,MAAM,UAAU,EAAE,CAAC;gBACrB,CAAC;gBAAC,MAAM,CAAC;oBACP,mEAAmE;gBACrE,CAAC;gBACD,IAAI,SAAS,EAAE,CAAC;oBACd,OAAO;gBACT,CAAC;gBACD,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC,CAAC;QAEF,0EAA0E;QAC1E,0EAA0E;QAC1E,wCAAwC;QACxC,IAAI,SAAS,EAAE,CAAC;YACd,KAAK,gBAAgB,EAAE,CAAC;QAC1B,CAAC;QACD,KAAK,OAAO,EAAE,CAAC;QAEf,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YACjB,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IAE5C,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { useEffect, useState } from \"react\";\nimport type { PushMessage } from \"./use-messages.js\";\n\nexport type TunnelState =\n | { status: \"idle\" }\n | { status: \"starting\"; message: string }\n | { status: \"connected\"; url: string }\n | { status: \"error\"; message: string };\n\ntype TunnelActivity = {\n time: string;\n text: string;\n level: \"log\" | \"error\";\n};\n\nconst POST_RETRY_DELAY_MS = 250;\n\nexport function useTunnel(\n port: number | null,\n pushMessage: PushMessage,\n verbose: boolean,\n autoStart: boolean,\n): TunnelState {\n const [state, setState] = useState<TunnelState>(\n port !== null && autoStart\n ? { status: \"starting\", message: \"Starting tunnel…\" }\n : { status: \"idle\" },\n );\n\n useEffect(() => {\n if (port === null) {\n return;\n }\n\n const baseUrl = `http://localhost:${port}`;\n const controller = new AbortController();\n let cancelled = false;\n\n const pushLog = (text: string, type: \"log\" | \"error\") => {\n const time = new Date().toLocaleTimeString(\"en-US\", {\n hour: \"numeric\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hour12: true,\n });\n pushMessage(`${time} [tunnel] ${text}`, type);\n };\n\n const handleEvent = (event: string, data: string) => {\n if (event === \"state\") {\n const next = JSON.parse(data) as TunnelState;\n setState(next);\n return;\n }\n if (event === \"activity\") {\n if (!verbose) {\n return;\n }\n const activity = JSON.parse(data) as TunnelActivity;\n pushLog(activity.text, activity.level);\n }\n };\n\n const consumeSse = async () => {\n const res = await fetch(`${baseUrl}/__skybridge/tunnel/events`, {\n signal: controller.signal,\n headers: { Accept: \"text/event-stream\" },\n });\n if (!res.ok || !res.body) {\n throw new Error(`SSE connection failed (${res.status})`);\n }\n\n const reader = res.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n while (!cancelled) {\n const { value, done } = await reader.read();\n if (done) {\n return;\n }\n buffer += decoder.decode(value, { stream: true });\n\n // SSE frames are separated by a blank line (\"\\n\\n\").\n let sep = buffer.indexOf(\"\\n\\n\");\n while (sep !== -1) {\n const frame = buffer.slice(0, sep);\n buffer = buffer.slice(sep + 2);\n let eventName = \"message\";\n const dataLines: string[] = [];\n for (const rawLine of frame.split(\"\\n\")) {\n const line = rawLine.replace(/\\r$/, \"\");\n if (line.startsWith(\"event:\")) {\n eventName = line.slice(6).trim();\n } else if (line.startsWith(\"data:\")) {\n dataLines.push(line.slice(5).trimStart());\n }\n }\n if (dataLines.length > 0) {\n handleEvent(eventName, dataLines.join(\"\\n\"));\n }\n sep = buffer.indexOf(\"\\n\\n\");\n }\n }\n };\n\n const postUntilStarted = async () => {\n // Retry indefinitely until POST lands once. Bounded by the effect\n // lifetime via controller.abort() on unmount. Once the manager has\n // been started, this returns and never POSTs again — a user-driven\n // DELETE /tunnel won't be auto-undone.\n while (!cancelled) {\n try {\n const res = await fetch(`${baseUrl}/__skybridge/tunnel`, {\n method: \"POST\",\n signal: controller.signal,\n });\n if (res.ok) {\n return;\n }\n } catch {\n // dev server not up yet (or restarting under nodemon) — wait, retry\n }\n await new Promise((r) => setTimeout(r, POST_RETRY_DELAY_MS));\n }\n };\n\n // Always observe the tunnel state so external triggers (curl, future\n // devtools UI) update the cli UI. `autoStart` only decides whether we\n // also POST /tunnel on mount. Reconnects indefinitely so we survive\n // dev-server boot delay and nodemon restarts; the cli owns the actual\n // subprocess so a temporarily-unreachable dev server is fine.\n const observe = async () => {\n while (!cancelled) {\n try {\n await consumeSse();\n } catch {\n // network error or stream ended abnormally — fall through to retry\n }\n if (cancelled) {\n return;\n }\n await new Promise((r) => setTimeout(r, POST_RETRY_DELAY_MS));\n }\n };\n\n // observe() always runs — it owns the cli's view of tunnel state. POST is\n // a fire-and-forget side-effect that nudges the manager into starting and\n // retries until it lands at least once.\n if (autoStart) {\n void postUntilStarted();\n }\n void observe();\n\n return () => {\n cancelled = true;\n controller.abort();\n };\n }, [port, pushMessage, verbose, autoStart]);\n\n return state;\n}\n"]}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
type TsError = {
|
|
1
|
+
export type TsError = {
|
|
2
2
|
file: string;
|
|
3
3
|
line: number;
|
|
4
4
|
col: number;
|
|
5
|
+
code: string;
|
|
5
6
|
message: string;
|
|
6
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Spawn `tsc --noEmit --watch` and report each completed check via `onErrors`
|
|
10
|
+
* (empty array when the check is clean). Returns a cleanup function that kills
|
|
11
|
+
* the watcher. Shared by the Ink-based dev UI (via {@link useTypeScriptCheck})
|
|
12
|
+
* and the `--plain` runner.
|
|
13
|
+
*/
|
|
14
|
+
export declare function startTypeScriptCheck(onErrors: (errors: Array<TsError>) => void): () => void;
|
|
7
15
|
export declare function useTypeScriptCheck(): Array<TsError>;
|
|
8
|
-
export {};
|
|
@@ -1,59 +1,99 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
1
|
import { isAbsolute, relative } from "node:path";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
2
|
+
import spawn from "cross-spawn";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
// TypeScript nests from general to specific — the deepest line is the root cause.
|
|
5
|
+
function extractBestMessage(message, continuationLines) {
|
|
6
|
+
if (!continuationLines.length) {
|
|
7
|
+
return message;
|
|
8
|
+
}
|
|
9
|
+
let maxIndent = 0;
|
|
10
|
+
for (const line of continuationLines) {
|
|
11
|
+
const indent = line.length - line.trimStart().length;
|
|
12
|
+
if (indent > maxIndent) {
|
|
13
|
+
maxIndent = indent;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const deepest = continuationLines
|
|
17
|
+
.filter((l) => l.length - l.trimStart().length === maxIndent)
|
|
18
|
+
.map((l) => l.trim())
|
|
19
|
+
.filter(Boolean)[0];
|
|
20
|
+
return deepest ?? message;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Spawn `tsc --noEmit --watch` and report each completed check via `onErrors`
|
|
24
|
+
* (empty array when the check is clean). Returns a cleanup function that kills
|
|
25
|
+
* the watcher. Shared by the Ink-based dev UI (via {@link useTypeScriptCheck})
|
|
26
|
+
* and the `--plain` runner.
|
|
27
|
+
*/
|
|
28
|
+
export function startTypeScriptCheck(onErrors) {
|
|
29
|
+
const tsProcess = spawn("npx", ["tsc", "--noEmit", "--watch", "--pretty", "false"], {
|
|
30
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
31
|
+
});
|
|
32
|
+
let outputBuffer = "";
|
|
33
|
+
let currentErrors = [];
|
|
34
|
+
let pendingError = null;
|
|
35
|
+
let continuationLines = [];
|
|
36
|
+
const flushPending = () => {
|
|
37
|
+
if (!pendingError) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
pendingError.message = extractBestMessage(pendingError.message, continuationLines);
|
|
41
|
+
currentErrors.push(pendingError);
|
|
42
|
+
pendingError = null;
|
|
43
|
+
continuationLines = [];
|
|
44
|
+
};
|
|
45
|
+
const processOutput = (data) => {
|
|
46
|
+
outputBuffer += data.toString();
|
|
47
|
+
const lines = outputBuffer.split("\n");
|
|
48
|
+
outputBuffer = lines.pop() || "";
|
|
49
|
+
for (const line of lines) {
|
|
50
|
+
const trimmed = line.trim();
|
|
51
|
+
const errorMatch = trimmed.match(/^(.+?)\((\d+),(\d+)\):\s+error\s+(TS\d+)?\s*:?\s*(.+)$/);
|
|
52
|
+
if (errorMatch) {
|
|
53
|
+
flushPending();
|
|
54
|
+
const [, file, lineStr, colStr, code, message] = errorMatch;
|
|
55
|
+
if (file && lineStr && colStr && message) {
|
|
56
|
+
let cleanFile = file.trim();
|
|
57
|
+
if (isAbsolute(cleanFile)) {
|
|
58
|
+
cleanFile = relative(process.cwd(), cleanFile);
|
|
37
59
|
}
|
|
60
|
+
pendingError = {
|
|
61
|
+
file: cleanFile,
|
|
62
|
+
line: Number.parseInt(lineStr, 10),
|
|
63
|
+
col: Number.parseInt(colStr, 10),
|
|
64
|
+
code: code ?? "",
|
|
65
|
+
message: message.trim(),
|
|
66
|
+
};
|
|
38
67
|
}
|
|
39
|
-
|
|
40
|
-
setTsErrors(trimmed.match(/Found 0 error/) ? [] : [...currentErrors]);
|
|
41
|
-
currentErrors = [];
|
|
42
|
-
}
|
|
68
|
+
continue;
|
|
43
69
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (tsProcessRef.current) {
|
|
53
|
-
tsProcessRef.current.kill();
|
|
70
|
+
if (pendingError && line.startsWith(" ")) {
|
|
71
|
+
continuationLines.push(line);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (trimmed.includes("Found") && trimmed.includes("error")) {
|
|
75
|
+
flushPending();
|
|
76
|
+
onErrors(trimmed.match(/Found 0 error/) ? [] : [...currentErrors]);
|
|
77
|
+
currentErrors = [];
|
|
54
78
|
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
if (tsProcess.stdout) {
|
|
82
|
+
tsProcess.stdout.on("data", processOutput);
|
|
83
|
+
}
|
|
84
|
+
if (tsProcess.stderr) {
|
|
85
|
+
tsProcess.stderr.on("data", processOutput);
|
|
86
|
+
}
|
|
87
|
+
tsProcess.on("error", (err) => {
|
|
88
|
+
console.error(`TypeScript watcher failed to start: ${err.message}`);
|
|
89
|
+
});
|
|
90
|
+
return () => {
|
|
91
|
+
tsProcess.kill();
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export function useTypeScriptCheck() {
|
|
95
|
+
const [tsErrors, setTsErrors] = useState([]);
|
|
96
|
+
useEffect(() => startTypeScriptCheck(setTsErrors), []);
|
|
57
97
|
return tsErrors;
|
|
58
98
|
}
|
|
59
99
|
//# sourceMappingURL=use-typescript-check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-typescript-check.js","sourceRoot":"","sources":["../../src/cli/use-typescript-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-typescript-check.js","sourceRoot":"","sources":["../../src/cli/use-typescript-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAU5C,kFAAkF;AAClF,SAAS,kBAAkB,CACzB,OAAe,EACf,iBAAgC;IAEhC,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;QAC9B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC;QACrD,IAAI,MAAM,GAAG,SAAS,EAAE,CAAC;YACvB,SAAS,GAAG,MAAM,CAAC;QACrB,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAG,iBAAiB;SAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,MAAM,KAAK,SAAS,CAAC;SAC5D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,OAAO,IAAI,OAAO,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBA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,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;QACnC,OAAO,CAAC,KAAK,CAAC,uCAAuC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAiB,EAAE,CAAC,CAAC;IAE7D,SAAS,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;IAEvD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { isAbsolute, relative } from \"node:path\";\nimport spawn from \"cross-spawn\";\nimport { useEffect, useState } from \"react\";\n\nexport type TsError = {\n file: string;\n line: number;\n col: number;\n code: string;\n message: string;\n};\n\n// TypeScript nests from general to specific — the deepest line is the root cause.\nfunction extractBestMessage(\n message: string,\n continuationLines: Array<string>,\n): string {\n if (!continuationLines.length) {\n return message;\n }\n let maxIndent = 0;\n for (const line of continuationLines) {\n const indent = line.length - line.trimStart().length;\n if (indent > maxIndent) {\n maxIndent = indent;\n }\n }\n const deepest = continuationLines\n .filter((l) => l.length - l.trimStart().length === maxIndent)\n .map((l) => l.trim())\n .filter(Boolean)[0];\n return deepest ?? message;\n}\n\n/**\n * Spawn `tsc --noEmit --watch` and report each completed check via `onErrors`\n * (empty array when the check is clean). Returns a cleanup function that kills\n * the watcher. Shared by the Ink-based dev UI (via {@link useTypeScriptCheck})\n * and the `--plain` runner.\n */\nexport function startTypeScriptCheck(\n onErrors: (errors: Array<TsError>) => void,\n): () => void {\n const tsProcess = spawn(\n \"npx\",\n [\"tsc\", \"--noEmit\", \"--watch\", \"--pretty\", \"false\"],\n {\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n },\n );\n\n let outputBuffer = \"\";\n let currentErrors: Array<TsError> = [];\n let pendingError: TsError | null = null;\n let continuationLines: Array<string> = [];\n\n const flushPending = () => {\n if (!pendingError) {\n return;\n }\n pendingError.message = extractBestMessage(\n pendingError.message,\n continuationLines,\n );\n currentErrors.push(pendingError);\n pendingError = null;\n continuationLines = [];\n };\n\n const processOutput = (data: Buffer) => {\n outputBuffer += data.toString();\n const lines = outputBuffer.split(\"\\n\");\n outputBuffer = lines.pop() || \"\";\n\n for (const line of lines) {\n const trimmed = line.trim();\n\n const errorMatch = trimmed.match(\n /^(.+?)\\((\\d+),(\\d+)\\):\\s+error\\s+(TS\\d+)?\\s*:?\\s*(.+)$/,\n );\n if (errorMatch) {\n flushPending();\n const [, file, lineStr, colStr, code, message] = errorMatch;\n if (file && lineStr && colStr && message) {\n let cleanFile = file.trim();\n if (isAbsolute(cleanFile)) {\n cleanFile = relative(process.cwd(), cleanFile);\n }\n pendingError = {\n file: cleanFile,\n line: Number.parseInt(lineStr, 10),\n col: Number.parseInt(colStr, 10),\n code: code ?? \"\",\n message: message.trim(),\n };\n }\n continue;\n }\n\n if (pendingError && line.startsWith(\" \")) {\n continuationLines.push(line);\n continue;\n }\n\n if (trimmed.includes(\"Found\") && trimmed.includes(\"error\")) {\n flushPending();\n onErrors(trimmed.match(/Found 0 error/) ? [] : [...currentErrors]);\n currentErrors = [];\n }\n }\n };\n\n if (tsProcess.stdout) {\n tsProcess.stdout.on(\"data\", processOutput);\n }\n if (tsProcess.stderr) {\n tsProcess.stderr.on(\"data\", processOutput);\n }\n\n tsProcess.on(\"error\", (err: Error) => {\n console.error(`TypeScript watcher failed to start: ${err.message}`);\n });\n\n return () => {\n tsProcess.kill();\n };\n}\n\nexport function useTypeScriptCheck(): Array<TsError> {\n const [tsErrors, setTsErrors] = useState<Array<TsError>>([]);\n\n useEffect(() => startTypeScriptCheck(setTsErrors), []);\n\n return tsErrors;\n}\n"]}
|
package/dist/commands/build.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { Command } from "@oclif/core";
|
|
2
|
-
import { type CommandStep } from "../cli/use-execute-steps.js";
|
|
3
|
-
export declare const commandSteps: CommandStep[];
|
|
4
2
|
export default class Build extends Command {
|
|
5
3
|
static description: string;
|
|
6
4
|
static examples: string[];
|
|
7
|
-
static flags: {};
|
|
8
5
|
run(): Promise<void>;
|
|
9
6
|
}
|
package/dist/commands/build.js
CHANGED
|
@@ -1,51 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { rmSync } from "node:fs";
|
|
3
2
|
import { Command } from "@oclif/core";
|
|
4
3
|
import { Box, render, Text } from "ink";
|
|
5
4
|
import { useEffect } from "react";
|
|
5
|
+
import { getCommandSteps } from "../cli/build-steps.js";
|
|
6
6
|
import { Header } from "../cli/header.js";
|
|
7
7
|
import { useExecuteSteps } from "../cli/use-execute-steps.js";
|
|
8
|
-
import { scanAndWriteViewsDts } from "../web/plugin/scan-views.js";
|
|
9
|
-
async function resolveViewsDir(root) {
|
|
10
|
-
const { loadConfigFromFile } = await import("vite");
|
|
11
|
-
const loaded = await loadConfigFromFile({ command: "build", mode: "production" }, undefined, root);
|
|
12
|
-
const isPluginCandidate = (value) => typeof value === "object" && value !== null;
|
|
13
|
-
const plugins = [];
|
|
14
|
-
const walk = (value) => {
|
|
15
|
-
if (Array.isArray(value)) {
|
|
16
|
-
value.forEach(walk);
|
|
17
|
-
}
|
|
18
|
-
else if (isPluginCandidate(value)) {
|
|
19
|
-
plugins.push(value);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
walk(loaded?.config.plugins ?? []);
|
|
23
|
-
return plugins.find((p) => p.name === "skybridge")?.api?.viewsDir;
|
|
24
|
-
}
|
|
25
|
-
export const commandSteps = [
|
|
26
|
-
{
|
|
27
|
-
label: "Scanning views",
|
|
28
|
-
run: async () => {
|
|
29
|
-
const root = process.cwd();
|
|
30
|
-
const viewsDir = await resolveViewsDir(root);
|
|
31
|
-
scanAndWriteViewsDts(root, viewsDir);
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: "Compiling server",
|
|
36
|
-
run: () => rmSync("dist", { recursive: true, force: true }),
|
|
37
|
-
command: "tsc -b",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: "Building views",
|
|
41
|
-
command: "vite build",
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
8
|
export default class Build extends Command {
|
|
45
9
|
static description = "Build the views and MCP server";
|
|
46
10
|
static examples = ["skybridge build"];
|
|
47
|
-
static flags = {};
|
|
48
11
|
async run() {
|
|
12
|
+
const commandSteps = await getCommandSteps().catch((e) => this.error(e instanceof Error ? e.message : String(e)));
|
|
49
13
|
const App = () => {
|
|
50
14
|
const { currentStep, status, error, execute } = useExecuteSteps(commandSteps);
|
|
51
15
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,OAAO;IACxC,MAAM,CAAU,WAA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,CAAC,CAAC,CAAC,MAAM,aAC1D,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAC9D,IAAI,CAAC,KAAK,IACN,IAJC,IAAI,CAAC,KAAK,CAKd,CACP,CAAC;oBACJ,CAAC,CAAC,EAED,MAAM,KAAK,SAAS,IAAI,CACvB,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,2DAEjB,GACH,CACP,EAEA,MAAM,KAAK,OAAO,IAAI,KAAK,IAAI,CAC9B,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,aACvC,KAAC,IAAI,IAAC,KAAK,EAAC,KAAK,EAAC,IAAI,0CAEf,EACP,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,YACtC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC/B,KAAC,IAAI,IAAY,KAAK,EAAC,KAAK,YACzB,IAAI,IADI,IAAI,CAER,CACR,CAAC,GACE,IACF,CACP,IACG,CACP,CAAC;QACJ,CAAC,CAAC;QAEF,MAAM,CAAC,KAAC,GAAG,KAAG,EAAE;YACd,WAAW,EAAE,IAAI;YACjB,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;IACL,CAAC","sourcesContent":["import { Command } from \"@oclif/core\";\nimport { Box, render, Text } from \"ink\";\nimport { useEffect } from \"react\";\nimport { getCommandSteps } from \"../cli/build-steps.js\";\nimport { Header } from \"../cli/header.js\";\nimport { useExecuteSteps } from \"../cli/use-execute-steps.js\";\n\nexport default class Build extends Command {\n static override description = \"Build the views and MCP server\";\n static override examples = [\"skybridge build\"];\n\n public async run(): Promise<void> {\n const commandSteps = await getCommandSteps().catch((e: unknown) =>\n this.error(e instanceof Error ? e.message : String(e)),\n );\n\n const App = () => {\n const { currentStep, status, error, execute } =\n useExecuteSteps(commandSteps);\n\n useEffect(() => {\n execute();\n }, [execute]);\n\n return (\n <Box flexDirection=\"column\" padding={1}>\n <Header version={this.config.version}>\n <Text color=\"green\"> → building for production…</Text>\n </Header>\n\n {commandSteps.map((step, index) => {\n const isCurrent = index === currentStep && status === \"running\";\n const isCompleted = index < currentStep || status === \"success\";\n const isError = status === \"error\" && index === currentStep;\n\n return (\n <Box key={step.label} marginBottom={0}>\n <Text color={isError ? \"red\" : isCompleted ? \"green\" : \"grey\"}>\n {isError ? \"✗\" : isCompleted ? \"✓\" : isCurrent ? \"⟳\" : \"○\"}{\" \"}\n {step.label}\n </Text>\n </Box>\n );\n })}\n\n {status === \"success\" && (\n <Box marginTop={1}>\n <Text color=\"green\" bold>\n ✓ Build completed successfully!\n </Text>\n </Box>\n )}\n\n {status === \"error\" && error && (\n <Box marginTop={1} flexDirection=\"column\">\n <Text color=\"red\" bold>\n ✗ Build failed\n </Text>\n <Box marginTop={1} flexDirection=\"column\">\n {error.split(\"\\n\").map((line) => (\n <Text key={line} color=\"red\">\n {line}\n </Text>\n ))}\n </Box>\n </Box>\n )}\n </Box>\n );\n };\n\n render(<App />, {\n exitOnCtrlC: true,\n patchConsole: false,\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command, type Command as CommandLoadable, Help } from "@oclif/core";
|
|
2
|
+
export default class Create extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static strict: boolean;
|
|
5
|
+
run(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare class SkybridgeHelp extends Help {
|
|
8
|
+
showCommandHelp(command: CommandLoadable.Loadable): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Command, Help } from "@oclif/core";
|
|
2
|
+
import spawn from "cross-spawn";
|
|
3
|
+
function passthrough(args) {
|
|
4
|
+
const { status, error } = spawn.sync("npx", ["--yes", "create-skybridge@latest", ...args], { stdio: "inherit" });
|
|
5
|
+
if (error) {
|
|
6
|
+
console.error(error);
|
|
7
|
+
process.exit(1);
|
|
8
|
+
}
|
|
9
|
+
process.exit(status ?? 1);
|
|
10
|
+
}
|
|
11
|
+
export default class Create extends Command {
|
|
12
|
+
static description = "Scaffold a new Skybridge project";
|
|
13
|
+
static strict = false;
|
|
14
|
+
async run() {
|
|
15
|
+
passthrough(this.argv);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// Registered as `oclif.helpClass` so that `skybridge create --help` forwards
|
|
19
|
+
// to `create-skybridge --help` (single source of truth for the help text)
|
|
20
|
+
// instead of rendering oclif's auto-generated help. All other commands fall
|
|
21
|
+
// through to the default `Help` behaviour.
|
|
22
|
+
export class SkybridgeHelp extends Help {
|
|
23
|
+
async showCommandHelp(command) {
|
|
24
|
+
if (command.id === "create") {
|
|
25
|
+
passthrough(["--help"]);
|
|
26
|
+
}
|
|
27
|
+
return super.showCommandHelp(command);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmC,IAAI,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,SAAS,WAAW,CAAC,IAAc;IACjC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,IAAI,CAClC,KAAK,EACL,CAAC,OAAO,EAAE,yBAAyB,EAAE,GAAG,IAAI,CAAC,EAC7C,EAAE,KAAK,EAAE,SAAS,EAAE,CACrB,CAAC;IACF,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IACzC,MAAM,CAAU,WAAW,GAAG,kCAAkC,CAAC;IACjE,MAAM,CAAU,MAAM,GAAG,KAAK,CAAC;IAExB,KAAK,CAAC,GAAG;QACd,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;;AAGH,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,2CAA2C;AAC3C,MAAM,OAAO,aAAc,SAAQ,IAAI;IAC5B,KAAK,CAAC,eAAe,CAC5B,OAAiC;QAEjC,IAAI,OAAO,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;YAC5B,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import { Command, type Command as CommandLoadable, Help } from \"@oclif/core\";\nimport spawn from \"cross-spawn\";\n\nfunction passthrough(args: string[]): never {\n const { status, error } = spawn.sync(\n \"npx\",\n [\"--yes\", \"create-skybridge@latest\", ...args],\n { stdio: \"inherit\" },\n );\n if (error) {\n console.error(error);\n process.exit(1);\n }\n process.exit(status ?? 1);\n}\n\nexport default class Create extends Command {\n static override description = \"Scaffold a new Skybridge project\";\n static override strict = false;\n\n public async run(): Promise<void> {\n passthrough(this.argv);\n }\n}\n\n// Registered as `oclif.helpClass` so that `skybridge create --help` forwards\n// to `create-skybridge --help` (single source of truth for the help text)\n// instead of rendering oclif's auto-generated help. All other commands fall\n// through to the default `Help` behaviour.\nexport class SkybridgeHelp extends Help {\n override async showCommandHelp(\n command: CommandLoadable.Loadable,\n ): Promise<void> {\n if (command.id === \"create\") {\n passthrough([\"--help\"]);\n }\n return super.showCommandHelp(command);\n }\n}\n"]}
|
package/dist/commands/dev.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ export default class Dev extends Command {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
port: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
tunnel: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
open: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
plain: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
11
|
};
|
|
10
12
|
run(): Promise<void>;
|
|
11
13
|
}
|