@speedkit/cli 4.50.5 → 4.51.0-run-control.2
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 +1425 -14
- package/dist/base/run-control-command.d.ts +15 -0
- package/dist/base/run-control-command.js +20 -0
- package/dist/build-info.json +6 -0
- package/dist/commands/diff.d.ts +7 -1
- package/dist/commands/diff.js +9 -3
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.js +14 -3
- package/dist/commands/onboarding/browser/click.d.ts +75 -0
- package/dist/commands/onboarding/browser/click.js +19 -0
- package/dist/commands/onboarding/browser/emulate.d.ts +105 -0
- package/dist/commands/onboarding/browser/emulate.js +26 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +75 -0
- package/dist/commands/onboarding/browser/navigate.js +19 -0
- package/dist/commands/onboarding/browser/panel.d.ts +63 -0
- package/dist/commands/onboarding/browser/panel.js +12 -0
- package/dist/commands/onboarding/browser/reinstall-sw.d.ts +63 -0
- package/dist/commands/onboarding/browser/reinstall-sw.js +14 -0
- package/dist/commands/onboarding/browser/reset.d.ts +71 -0
- package/dist/commands/onboarding/browser/reset.js +18 -0
- package/dist/commands/onboarding/browser/screenshot.d.ts +77 -0
- package/dist/commands/onboarding/browser/screenshot.js +19 -0
- package/dist/commands/onboarding/browser/state.d.ts +63 -0
- package/dist/commands/onboarding/browser/state.js +12 -0
- package/dist/commands/onboarding/browser/tabs.d.ts +58 -0
- package/dist/commands/onboarding/browser/tabs.js +16 -0
- package/dist/commands/onboarding/cache/clear.d.ts +58 -0
- package/dist/commands/onboarding/cache/clear.js +12 -0
- package/dist/commands/onboarding/cache/errors.d.ts +58 -0
- package/dist/commands/onboarding/cache/errors.js +12 -0
- package/dist/commands/onboarding/cache/evict.d.ts +62 -0
- package/dist/commands/onboarding/cache/evict.js +15 -0
- package/dist/commands/onboarding/cache/get.d.ts +85 -0
- package/dist/commands/onboarding/cache/get.js +17 -0
- package/dist/commands/onboarding/cache/list.d.ts +58 -0
- package/dist/commands/onboarding/cache/list.js +15 -0
- package/dist/commands/onboarding/cache/prewarm.d.ts +73 -0
- package/dist/commands/onboarding/cache/prewarm.js +20 -0
- package/dist/commands/onboarding/cache/refresh.d.ts +62 -0
- package/dist/commands/onboarding/cache/refresh.js +18 -0
- package/dist/commands/onboarding/cdp.d.ts +81 -0
- package/dist/commands/onboarding/cdp.js +18 -0
- package/dist/commands/onboarding/debug/arm.d.ts +83 -0
- package/dist/commands/onboarding/debug/arm.js +19 -0
- package/dist/commands/onboarding/debug/await.d.ts +71 -0
- package/dist/commands/onboarding/debug/await.js +18 -0
- package/dist/commands/onboarding/debug/disarm.d.ts +63 -0
- package/dist/commands/onboarding/debug/disarm.js +12 -0
- package/dist/commands/onboarding/debug/eval.d.ts +75 -0
- package/dist/commands/onboarding/debug/eval.js +16 -0
- package/dist/commands/onboarding/debug/release.d.ts +63 -0
- package/dist/commands/onboarding/debug/release.js +12 -0
- package/dist/commands/onboarding/debug/resume.d.ts +63 -0
- package/dist/commands/onboarding/debug/resume.js +12 -0
- package/dist/commands/onboarding/debug/status.d.ts +63 -0
- package/dist/commands/onboarding/debug/status.js +12 -0
- package/dist/commands/onboarding/debug/step.d.ts +67 -0
- package/dist/commands/onboarding/debug/step.js +15 -0
- package/dist/commands/onboarding/files/list.d.ts +58 -0
- package/dist/commands/onboarding/files/list.js +12 -0
- package/dist/commands/onboarding/files/read.d.ts +73 -0
- package/dist/commands/onboarding/files/read.js +16 -0
- package/dist/commands/onboarding/files/rebuild.d.ts +63 -0
- package/dist/commands/onboarding/files/rebuild.js +18 -0
- package/dist/commands/onboarding/files/validate.d.ts +58 -0
- package/dist/commands/onboarding/files/validate.js +12 -0
- package/dist/commands/onboarding/fouc.d.ts +77 -0
- package/dist/commands/onboarding/fouc.js +16 -0
- package/dist/commands/onboarding/inject/add.d.ts +89 -0
- package/dist/commands/onboarding/inject/add.js +17 -0
- package/dist/commands/onboarding/inject/clear.d.ts +63 -0
- package/dist/commands/onboarding/inject/clear.js +12 -0
- package/dist/commands/onboarding/inject/list.d.ts +63 -0
- package/dist/commands/onboarding/inject/list.js +12 -0
- package/dist/commands/onboarding/inject/read.d.ts +75 -0
- package/dist/commands/onboarding/inject/read.js +18 -0
- package/dist/commands/onboarding/inject/recipes.d.ts +63 -0
- package/dist/commands/onboarding/inject/recipes.js +12 -0
- package/dist/commands/onboarding/inject/remove.d.ts +67 -0
- package/dist/commands/onboarding/inject/remove.js +15 -0
- package/dist/commands/onboarding/list.d.ts +13 -0
- package/dist/commands/onboarding/list.js +12 -0
- package/dist/commands/onboarding/logs.d.ts +41 -0
- package/dist/commands/onboarding/logs.js +257 -0
- package/dist/commands/onboarding/navwalk.d.ts +95 -0
- package/dist/commands/onboarding/navwalk.js +19 -0
- package/dist/commands/onboarding/response.d.ts +67 -0
- package/dist/commands/onboarding/response.js +18 -0
- package/dist/commands/onboarding/rum/beacons.d.ts +75 -0
- package/dist/commands/onboarding/rum/beacons.js +16 -0
- package/dist/commands/onboarding/rum/get.d.ts +77 -0
- package/dist/commands/onboarding/rum/get.js +18 -0
- package/dist/commands/onboarding/rum/key.d.ts +67 -0
- package/dist/commands/onboarding/rum/key.js +13 -0
- package/dist/commands/onboarding/rum/previous.d.ts +63 -0
- package/dist/commands/onboarding/rum/previous.js +12 -0
- package/dist/commands/onboarding/status.d.ts +13 -0
- package/dist/commands/onboarding/status.js +17 -0
- package/dist/commands/onboarding/stop.d.ts +13 -0
- package/dist/commands/onboarding/stop.js +17 -0
- package/dist/commands/onboarding/todo.d.ts +58 -0
- package/dist/commands/onboarding/todo.js +12 -0
- package/dist/commands/onboarding/viewport.d.ts +101 -0
- package/dist/commands/onboarding/viewport.js +18 -0
- package/dist/commands/onboarding/watch.d.ts +93 -0
- package/dist/commands/onboarding/watch.js +16 -0
- package/dist/commands/onboarding.d.ts +26 -0
- package/dist/commands/onboarding.js +221 -4
- package/dist/commands/origin-request.d.ts +4 -0
- package/dist/commands/origin-request.js +4 -0
- package/dist/commands/spec/onboarding.spec.d.ts +1 -0
- package/dist/commands/spec/onboarding.spec.js +127 -0
- package/dist/services/cli/build-info.d.ts +33 -0
- package/dist/services/cli/build-info.js +63 -0
- package/dist/services/cli/cli-environment-factory.d.ts +3 -0
- package/dist/services/cli/cli-environment-factory.js +1 -0
- package/dist/services/cli/cli-service-build-context.d.ts +3 -0
- package/dist/services/cli/cli-service-factory.js +1 -1
- package/dist/services/cli/cli-service-model.d.ts +29 -10
- package/dist/services/cli/cli-service.d.ts +60 -11
- package/dist/services/cli/cli-service.js +196 -32
- package/dist/services/cli/index.d.ts +2 -0
- package/dist/services/cli/index.js +2 -0
- package/dist/services/cli/sink.d.ts +47 -0
- package/dist/services/cli/sink.js +31 -0
- package/dist/services/cli/spec/build-identity.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-identity.spec.js +85 -0
- package/dist/services/cli/spec/build-info.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-info.spec.js +10 -0
- package/dist/services/cli/spec/cli-service-log.spec.d.ts +1 -0
- package/dist/services/cli/spec/cli-service-log.spec.js +133 -0
- package/dist/services/cli/spec/cli-service.spec.js +113 -50
- package/dist/services/cli/spec/memory-cli.d.ts +9 -0
- package/dist/services/cli/spec/memory-cli.js +9 -0
- package/dist/services/diff/config-at-ref.d.ts +20 -0
- package/dist/services/diff/config-at-ref.js +33 -0
- package/dist/services/diff/diff-service-build-context.d.ts +12 -0
- package/dist/services/diff/diff-service-build-context.js +45 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +65 -25
- package/dist/services/diff/diff-service.d.ts +11 -0
- package/dist/services/diff/diff-service.js +37 -11
- package/dist/services/diff/page-source.d.ts +12 -0
- package/dist/services/diff/page-source.js +16 -11
- package/dist/services/diff/run-runtime-config.d.ts +33 -0
- package/dist/services/diff/run-runtime-config.js +74 -0
- package/dist/services/diff/sinks/tool-diff-sink.d.ts +3 -2
- package/dist/services/diff/sinks/tool-diff-sink.js +3 -2
- package/dist/services/diff/spec/config-at-ref.spec.d.ts +1 -0
- package/dist/services/diff/spec/config-at-ref.spec.js +46 -0
- package/dist/services/diff/spec/diff-service-build-context.spec.js +19 -0
- package/dist/services/diff/spec/diff-service.spec.js +95 -0
- package/dist/services/diff/spec/run-runtime-config.spec.d.ts +1 -0
- package/dist/services/diff/spec/run-runtime-config.spec.js +87 -0
- package/dist/services/git/git-repository.d.ts +2 -0
- package/dist/services/git/git-repository.js +6 -0
- package/dist/services/integration-api/customer-config-flags.js +1 -0
- package/dist/services/onboarding/browse/browse-service.d.ts +13 -1
- package/dist/services/onboarding/browse/browse-service.js +40 -7
- package/dist/services/onboarding/browser/answer-dialogs.d.ts +12 -0
- package/dist/services/onboarding/browser/answer-dialogs.js +25 -0
- package/dist/services/onboarding/browser/baqend-response.d.ts +17 -1
- package/dist/services/onboarding/browser/baqend-response.js +23 -0
- package/dist/services/onboarding/browser/console-log.d.ts +9 -0
- package/dist/services/onboarding/browser/console-log.js +27 -0
- package/dist/services/onboarding/browser/emulate-device.d.ts +12 -1
- package/dist/services/onboarding/browser/emulate-device.js +33 -6
- package/dist/services/onboarding/browser/executable/executable-validator.js +4 -2
- package/dist/services/onboarding/browser/extension/extension-bridge.js +5 -3
- package/dist/services/onboarding/browser/extension/extension-downloader.js +17 -8
- package/dist/services/onboarding/browser/extension/extension-validator.js +9 -4
- package/dist/services/onboarding/browser/launch-browser.d.ts +2 -1
- package/dist/services/onboarding/browser/launch-browser.js +3 -1
- package/dist/services/onboarding/control/body-inspect.d.ts +24 -0
- package/dist/services/onboarding/control/body-inspect.js +106 -0
- package/dist/services/onboarding/control/browser-session.d.ts +535 -0
- package/dist/services/onboarding/control/browser-session.js +1300 -0
- package/dist/services/onboarding/control/config-validation.d.ts +17 -0
- package/dist/services/onboarding/control/config-validation.js +46 -0
- package/dist/services/onboarding/control/control-protocol.d.ts +1428 -0
- package/dist/services/onboarding/control/control-protocol.js +58 -0
- package/dist/services/onboarding/control/control-server.d.ts +292 -0
- package/dist/services/onboarding/control/control-server.js +1629 -0
- package/dist/services/onboarding/control/debug-session.d.ts +219 -0
- package/dist/services/onboarding/control/debug-session.js +897 -0
- package/dist/services/onboarding/control/fouc.d.ts +23 -0
- package/dist/services/onboarding/control/fouc.js +151 -0
- package/dist/services/onboarding/control/index.d.ts +4 -0
- package/dist/services/onboarding/control/index.js +4 -0
- package/dist/services/onboarding/control/navigate-wait.d.ts +33 -0
- package/dist/services/onboarding/control/navigate-wait.js +56 -0
- package/dist/services/onboarding/control/navwalk.d.ts +65 -0
- package/dist/services/onboarding/control/navwalk.js +248 -0
- package/dist/services/onboarding/control/preload-registry.d.ts +150 -0
- package/dist/services/onboarding/control/preload-registry.js +829 -0
- package/dist/services/onboarding/control/response-explainer.d.ts +24 -0
- package/dist/services/onboarding/control/response-explainer.js +257 -0
- package/dist/services/onboarding/control/rum.d.ts +8 -0
- package/dist/services/onboarding/control/rum.js +220 -0
- package/dist/services/onboarding/control/service-worker-tracker.d.ts +68 -0
- package/dist/services/onboarding/control/service-worker-tracker.js +120 -0
- package/dist/services/onboarding/control/viewport.d.ts +45 -0
- package/dist/services/onboarding/control/viewport.js +344 -0
- package/dist/services/onboarding/control/watch.d.ts +26 -0
- package/dist/services/onboarding/control/watch.js +157 -0
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +3 -1
- package/dist/services/onboarding/dashboard/index.js +7 -2
- package/dist/services/onboarding/fetch-event-handler.d.ts +24 -5
- package/dist/services/onboarding/fetch-event-handler.js +103 -32
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +11 -2
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +14 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +30 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +13 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +28 -1
- package/dist/services/onboarding/file-events/file-watcher.d.ts +42 -1
- package/dist/services/onboarding/file-events/file-watcher.js +117 -12
- package/dist/services/onboarding/inject/inject-service.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +30 -0
- package/dist/services/onboarding/onboarding-model.js +12 -1
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +7 -1
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +150 -23
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +136 -23
- package/dist/services/onboarding/request-cache/asset-key.d.ts +61 -0
- package/dist/services/onboarding/request-cache/asset-key.js +115 -0
- package/dist/services/onboarding/request-cache/cache.d.ts +62 -5
- package/dist/services/onboarding/request-cache/cache.js +128 -17
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.js +66 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.js +42 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.js +651 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +371 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +751 -0
- package/dist/services/onboarding/spec/control/fakes.d.ts +31 -0
- package/dist/services/onboarding/spec/control/fakes.js +66 -0
- package/dist/services/onboarding/spec/control/fouc.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/fouc.spec.js +167 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.js +47 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.js +222 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.js +432 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.js +324 -0
- package/dist/services/onboarding/spec/control/rum.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/rum.spec.js +222 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.js +193 -0
- package/dist/services/onboarding/spec/control/viewport.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/viewport.spec.js +200 -0
- package/dist/services/onboarding/spec/control/watch.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/watch.spec.js +187 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +219 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.js +41 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +39 -3
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +25 -1
- package/dist/services/onboarding/spec/request-cache/cache.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/request-cache/cache.spec.js +107 -0
- package/dist/services/onboarding/spec/todo-collector.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/todo-collector.spec.js +136 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.js +65 -0
- package/dist/services/onboarding/todo-collector.d.ts +7 -2
- package/dist/services/onboarding/todo-collector.js +49 -12
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +38 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +113 -27
- package/dist/services/origin-request/asset-variations.d.ts +14 -0
- package/dist/services/origin-request/asset-variations.js +11 -4
- package/dist/services/origin-request/origin-fetcher.d.ts +7 -0
- package/dist/services/origin-request/origin-fetcher.js +43 -5
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +17 -0
- package/dist/services/origin-request/origin-request-service-build-context.js +8 -0
- package/dist/services/origin-request/origin-request-service-factory.d.ts +0 -5
- package/dist/services/origin-request/origin-request-service-factory.js +2 -30
- package/dist/services/origin-request/origin-request-service.d.ts +121 -6
- package/dist/services/origin-request/origin-request-service.js +273 -49
- package/dist/services/origin-request/runtime-config-source.d.ts +6 -0
- package/dist/services/origin-request/runtime-config-source.js +15 -4
- package/dist/services/origin-request/spec/asset-variations.spec.js +20 -0
- package/dist/services/origin-request/spec/origin-request-service.spec.js +329 -6
- package/dist/services/query-builder/rules/rule-match.d.ts +35 -0
- package/dist/services/query-builder/rules/rule-match.js +70 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.d.ts +1 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.js +121 -0
- package/dist/services/run-control/browser/run-browser-contexts.d.ts +557 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +91 -0
- package/dist/services/run-control/browser/run-browser-service-factory.d.ts +5 -0
- package/dist/services/run-control/browser/run-browser-service-factory.js +7 -0
- package/dist/services/run-control/browser/run-browser-service.d.ts +68 -0
- package/dist/services/run-control/browser/run-browser-service.js +206 -0
- package/dist/services/run-control/cache/run-cache-contexts.d.ts +349 -0
- package/dist/services/run-control/cache/run-cache-contexts.js +51 -0
- package/dist/services/run-control/cache/run-cache-service-factory.d.ts +6 -0
- package/dist/services/run-control/cache/run-cache-service-factory.js +12 -0
- package/dist/services/run-control/cache/run-cache-service.d.ts +35 -0
- package/dist/services/run-control/cache/run-cache-service.js +151 -0
- package/dist/services/run-control/control-client.d.ts +36 -0
- package/dist/services/run-control/control-client.js +147 -0
- package/dist/services/run-control/debug/run-debug-contexts.d.ts +416 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +47 -0
- package/dist/services/run-control/debug/run-debug-service-factory.d.ts +5 -0
- package/dist/services/run-control/debug/run-debug-service-factory.js +7 -0
- package/dist/services/run-control/debug/run-debug-service.d.ts +39 -0
- package/dist/services/run-control/debug/run-debug-service.js +164 -0
- package/dist/services/run-control/files/run-files-contexts.d.ts +238 -0
- package/dist/services/run-control/files/run-files-contexts.js +26 -0
- package/dist/services/run-control/files/run-files-service-factory.d.ts +5 -0
- package/dist/services/run-control/files/run-files-service-factory.js +7 -0
- package/dist/services/run-control/files/run-files-service.d.ts +29 -0
- package/dist/services/run-control/files/run-files-service.js +120 -0
- package/dist/services/run-control/index.d.ts +32 -0
- package/dist/services/run-control/index.js +31 -0
- package/dist/services/run-control/inject/run-inject-contexts.d.ts +319 -0
- package/dist/services/run-control/inject/run-inject-contexts.js +38 -0
- package/dist/services/run-control/inject/run-inject-service-factory.d.ts +5 -0
- package/dist/services/run-control/inject/run-inject-service-factory.js +7 -0
- package/dist/services/run-control/inject/run-inject-service.d.ts +31 -0
- package/dist/services/run-control/inject/run-inject-service.js +227 -0
- package/dist/services/run-control/live-run.d.ts +37 -0
- package/dist/services/run-control/live-run.js +56 -0
- package/dist/services/run-control/probe/run-probe-contexts.d.ts +333 -0
- package/dist/services/run-control/probe/run-probe-contexts.js +73 -0
- package/dist/services/run-control/probe/run-probe-service-factory.d.ts +5 -0
- package/dist/services/run-control/probe/run-probe-service-factory.js +7 -0
- package/dist/services/run-control/probe/run-probe-service.d.ts +54 -0
- package/dist/services/run-control/probe/run-probe-service.js +194 -0
- package/dist/services/run-control/rum/run-rum-contexts.d.ts +216 -0
- package/dist/services/run-control/rum/run-rum-contexts.js +34 -0
- package/dist/services/run-control/rum/run-rum-service-factory.d.ts +5 -0
- package/dist/services/run-control/rum/run-rum-service-factory.js +7 -0
- package/dist/services/run-control/rum/run-rum-service.d.ts +36 -0
- package/dist/services/run-control/rum/run-rum-service.js +122 -0
- package/dist/services/run-control/run-answer.d.ts +28 -0
- package/dist/services/run-control/run-answer.js +58 -0
- package/dist/services/run-control/run-control-context.d.ts +102 -0
- package/dist/services/run-control/run-control-context.js +36 -0
- package/dist/services/run-control/run-control-flags.d.ts +12 -0
- package/dist/services/run-control/run-control-flags.js +22 -0
- package/dist/services/run-control/run-control-model.d.ts +9 -0
- package/dist/services/run-control/run-control-model.js +1 -0
- package/dist/services/run-control/run-control-service-factory.d.ts +14 -0
- package/dist/services/run-control/run-control-service-factory.js +26 -0
- package/dist/services/run-control/session/run-session-contexts.d.ts +25 -0
- package/dist/services/run-control/session/run-session-contexts.js +20 -0
- package/dist/services/run-control/session/run-session-service-factory.d.ts +8 -0
- package/dist/services/run-control/session/run-session-service-factory.js +18 -0
- package/dist/services/run-control/session/run-session-service.d.ts +32 -0
- package/dist/services/run-control/session/run-session-service.js +151 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.js +327 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.js +454 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.js +113 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.js +234 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.js +251 -0
- package/dist/services/run-control/spec/live-run-fixture.d.ts +32 -0
- package/dist/services/run-control/spec/live-run-fixture.js +109 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.js +108 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.js +47 -0
- package/dist/services/run-control/spec/run-answer.spec.d.ts +1 -0
- package/dist/services/run-control/spec/run-answer.spec.js +57 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.js +150 -0
- package/dist/services/run-log/crash-mirror.d.ts +31 -0
- package/dist/services/run-log/crash-mirror.js +69 -0
- package/dist/services/run-log/index.d.ts +11 -0
- package/dist/services/run-log/index.js +11 -0
- package/dist/services/run-log/jsonl-appender.d.ts +46 -0
- package/dist/services/run-log/jsonl-appender.js +91 -0
- package/dist/services/run-log/log-event-model.d.ts +104 -0
- package/dist/services/run-log/log-event-model.js +56 -0
- package/dist/services/run-log/log-query-service-factory.d.ts +11 -0
- package/dist/services/run-log/log-query-service-factory.js +14 -0
- package/dist/services/run-log/log-query-service.d.ts +59 -0
- package/dist/services/run-log/log-query-service.js +111 -0
- package/dist/services/run-log/log-reader.d.ts +84 -0
- package/dist/services/run-log/log-reader.js +180 -0
- package/dist/services/run-log/log-summary.d.ts +72 -0
- package/dist/services/run-log/log-summary.js +208 -0
- package/dist/services/run-log/redaction.d.ts +34 -0
- package/dist/services/run-log/redaction.js +124 -0
- package/dist/services/run-log/request-log.d.ts +82 -0
- package/dist/services/run-log/request-log.js +69 -0
- package/dist/services/run-log/request-summary.d.ts +76 -0
- package/dist/services/run-log/request-summary.js +0 -0
- package/dist/services/run-log/run-log.d.ts +61 -0
- package/dist/services/run-log/run-log.js +102 -0
- package/dist/services/run-log/spec/log-query-service.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-query-service.spec.js +197 -0
- package/dist/services/run-log/spec/log-reader.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-reader.spec.js +109 -0
- package/dist/services/run-log/spec/log-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-summary.spec.js +153 -0
- package/dist/services/run-log/spec/redaction.spec.d.ts +1 -0
- package/dist/services/run-log/spec/redaction.spec.js +61 -0
- package/dist/services/run-log/spec/request-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-log.spec.js +101 -0
- package/dist/services/run-log/spec/request-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-summary.spec.js +171 -0
- package/dist/services/run-log/spec/run-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/run-log.spec.js +122 -0
- package/dist/services/run-registry/exit-classification.d.ts +39 -0
- package/dist/services/run-registry/exit-classification.js +42 -0
- package/dist/services/run-registry/index.d.ts +3 -0
- package/dist/services/run-registry/index.js +3 -0
- package/dist/services/run-registry/process-identity.d.ts +28 -0
- package/dist/services/run-registry/process-identity.js +80 -0
- package/dist/services/run-registry/run-registry-model.d.ts +128 -0
- package/dist/services/run-registry/run-registry-model.js +16 -0
- package/dist/services/run-registry/run-registry.d.ts +155 -0
- package/dist/services/run-registry/run-registry.js +430 -0
- package/dist/services/run-registry/spec/exit-classification.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/exit-classification.spec.js +82 -0
- package/dist/services/run-registry/spec/run-registry.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/run-registry.spec.js +526 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3409 -288
- package/package.json +20 -2
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { RunControlCommand } from "../../base/run-control-command.js";
|
|
2
|
+
import { WatchBuildContext } from "../../services/run-control/index.js";
|
|
3
|
+
export default class Watch extends RunControlCommand<InstanceType<typeof WatchBuildContext>> {
|
|
4
|
+
static description: string;
|
|
5
|
+
static buildContext: {
|
|
6
|
+
new (values: import("../../services/run-control/run-control-context.js").RunControlBuildContextValues<{
|
|
7
|
+
expression: string;
|
|
8
|
+
} & {
|
|
9
|
+
interval: number;
|
|
10
|
+
duration: number;
|
|
11
|
+
reload: any;
|
|
12
|
+
full: any;
|
|
13
|
+
tab: string;
|
|
14
|
+
json: boolean | undefined;
|
|
15
|
+
}>): {
|
|
16
|
+
readonly run?: string;
|
|
17
|
+
readonly json: boolean;
|
|
18
|
+
readonly timeout?: number;
|
|
19
|
+
readonly tab?: string;
|
|
20
|
+
readonly input: {
|
|
21
|
+
expression: string;
|
|
22
|
+
} & {
|
|
23
|
+
interval: number;
|
|
24
|
+
duration: number;
|
|
25
|
+
reload: any;
|
|
26
|
+
full: any;
|
|
27
|
+
tab: string;
|
|
28
|
+
json: boolean | undefined;
|
|
29
|
+
};
|
|
30
|
+
readonly environment: import("../../services/cli/cli-environment.js").CliEnvironment;
|
|
31
|
+
};
|
|
32
|
+
readonly args: {
|
|
33
|
+
expression: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
34
|
+
};
|
|
35
|
+
readonly flags: {
|
|
36
|
+
run: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
37
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
38
|
+
timeout: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
39
|
+
} & {
|
|
40
|
+
interval: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
41
|
+
duration: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
42
|
+
reload: import("@oclif/core/interfaces").BooleanFlag<any>;
|
|
43
|
+
full: import("@oclif/core/interfaces").BooleanFlag<any>;
|
|
44
|
+
} & {
|
|
45
|
+
tab: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
46
|
+
};
|
|
47
|
+
create(parsedArgs: {
|
|
48
|
+
expression: string;
|
|
49
|
+
}, parsedFlags: {
|
|
50
|
+
run: string;
|
|
51
|
+
json: boolean | undefined;
|
|
52
|
+
timeout: number;
|
|
53
|
+
interval: number;
|
|
54
|
+
duration: number;
|
|
55
|
+
reload: any;
|
|
56
|
+
full: any;
|
|
57
|
+
tab: string;
|
|
58
|
+
}, environment: import("../../services/cli/cli-environment.js").CliEnvironment): {
|
|
59
|
+
readonly run?: string;
|
|
60
|
+
readonly json: boolean;
|
|
61
|
+
readonly timeout?: number;
|
|
62
|
+
readonly tab?: string;
|
|
63
|
+
readonly input: {
|
|
64
|
+
expression: string;
|
|
65
|
+
} & {
|
|
66
|
+
interval: number;
|
|
67
|
+
duration: number;
|
|
68
|
+
reload: any;
|
|
69
|
+
full: any;
|
|
70
|
+
tab: string;
|
|
71
|
+
json: boolean | undefined;
|
|
72
|
+
};
|
|
73
|
+
readonly environment: import("../../services/cli/cli-environment.js").CliEnvironment;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
static args: {
|
|
77
|
+
expression: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
78
|
+
};
|
|
79
|
+
static flags: {
|
|
80
|
+
run: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
81
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
82
|
+
timeout: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
83
|
+
} & {
|
|
84
|
+
interval: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
85
|
+
duration: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
86
|
+
reload: import("@oclif/core/interfaces").BooleanFlag<any>;
|
|
87
|
+
full: import("@oclif/core/interfaces").BooleanFlag<any>;
|
|
88
|
+
} & {
|
|
89
|
+
tab: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
90
|
+
};
|
|
91
|
+
static examples: string[];
|
|
92
|
+
run(): Promise<void>;
|
|
93
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RunControlCommand } from "../../base/run-control-command.js";
|
|
2
|
+
import { WatchBuildContext, RunProbeServiceFactory, } from "../../services/run-control/index.js";
|
|
3
|
+
export default class Watch extends RunControlCommand {
|
|
4
|
+
static description = "Sample an expression in the page across a load, with the console messages beside it";
|
|
5
|
+
static buildContext = WatchBuildContext;
|
|
6
|
+
static args = WatchBuildContext.args;
|
|
7
|
+
static flags = WatchBuildContext.flags;
|
|
8
|
+
static examples = [
|
|
9
|
+
`$ sk onboarding watch '!!window.SpeedKit' --reload`,
|
|
10
|
+
`$ sk onboarding watch 'document.title' --reload --duration 30000`,
|
|
11
|
+
];
|
|
12
|
+
async run() {
|
|
13
|
+
const { input } = this.context;
|
|
14
|
+
await new RunProbeServiceFactory(this.context).buildService().watch(input);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { SkCommand } from "../base/sk-command.js";
|
|
2
2
|
import { OnboardingServiceBuildContext } from "../services/onboarding/index.js";
|
|
3
|
+
import { CliServiceInterface } from "../services/cli/index.js";
|
|
4
|
+
import { RunRegistry } from "../services/run-registry/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Warn about a live run this one would collide with, and ask before joining it.
|
|
7
|
+
*
|
|
8
|
+
* Both collisions used to be silent, and the second one is the expensive kind:
|
|
9
|
+
* a second run on the same debug port does not fail, it quietly ends up with
|
|
10
|
+
* one Chrome on `127.0.0.1` and the other on `[::1]`, and CDP reaches whichever
|
|
11
|
+
* resolves first. Finding that out costs an hour of inspecting the wrong
|
|
12
|
+
* browser.
|
|
13
|
+
*
|
|
14
|
+
* @returns whether to go ahead.
|
|
15
|
+
*/
|
|
16
|
+
export declare function confirmConflicts(cli: CliServiceInterface, registry: RunRegistry, intent: {
|
|
17
|
+
customerPath?: string;
|
|
18
|
+
debugPort?: number;
|
|
19
|
+
}): Promise<boolean>;
|
|
3
20
|
export default class Onboarding extends SkCommand<OnboardingServiceBuildContext> {
|
|
4
21
|
static description: string;
|
|
5
22
|
static buildContext: typeof OnboardingServiceBuildContext;
|
|
@@ -14,6 +31,7 @@ export default class Onboarding extends SkCommand<OnboardingServiceBuildContext>
|
|
|
14
31
|
debuggingPort: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
32
|
debugPort: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
33
|
verboseLevel: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
34
|
+
logFile: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
35
|
ignoreContentSecurityPolicy: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
36
|
headless: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
37
|
device: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -29,5 +47,13 @@ export default class Onboarding extends SkCommand<OnboardingServiceBuildContext>
|
|
|
29
47
|
init(): Promise<void>;
|
|
30
48
|
/** Onboarding runs the customer's documentHandler, with its node modules. */
|
|
31
49
|
protected customerPathForModules(args: Record<string, unknown>): string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Why a customer path that is not there was refused — and, when its words
|
|
52
|
+
* name a subcommand, the call that was meant.
|
|
53
|
+
*
|
|
54
|
+
* `sk onboarding "rum get"`, with the two words as one argument, is what a
|
|
55
|
+
* script or an agent produces, and oclif can only read it as a path.
|
|
56
|
+
*/
|
|
57
|
+
private missingCustomerPath;
|
|
32
58
|
run(): Promise<void>;
|
|
33
59
|
}
|
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
import { SkCommand } from "../base/sk-command.js";
|
|
2
2
|
import { OnboardingServiceBuildContext, OnboardingServiceFactory, withInjectDefault, } from "../services/onboarding/index.js";
|
|
3
|
+
import { buildInfo } from "../services/cli/index.js";
|
|
4
|
+
import { classifyExit, RunRegistry } from "../services/run-registry/index.js";
|
|
5
|
+
import { LOG_SCHEMA_VERSION, mirrorCrashes, RequestLog, RunLog, } from "../services/run-log/index.js";
|
|
6
|
+
import { existsSync, statSync } from "node:fs";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
/**
|
|
9
|
+
* When the running build was compiled, from the mtime of this very module.
|
|
10
|
+
*
|
|
11
|
+
* `cliVersion` reports the same string for every development build of a
|
|
12
|
+
* version, so a run from a fixed build looks exactly like one from the build it
|
|
13
|
+
* fixed. This is what tells them apart without a release.
|
|
14
|
+
*/
|
|
15
|
+
function buildTime() {
|
|
16
|
+
try {
|
|
17
|
+
return statSync(fileURLToPath(import.meta.url)).mtime.toISOString();
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Warn about a live run this one would collide with, and ask before joining it.
|
|
25
|
+
*
|
|
26
|
+
* Both collisions used to be silent, and the second one is the expensive kind:
|
|
27
|
+
* a second run on the same debug port does not fail, it quietly ends up with
|
|
28
|
+
* one Chrome on `127.0.0.1` and the other on `[::1]`, and CDP reaches whichever
|
|
29
|
+
* resolves first. Finding that out costs an hour of inspecting the wrong
|
|
30
|
+
* browser.
|
|
31
|
+
*
|
|
32
|
+
* @returns whether to go ahead.
|
|
33
|
+
*/
|
|
34
|
+
export async function confirmConflicts(cli, registry, intent) {
|
|
35
|
+
const { sameCustomer, samePort } = registry.conflicts(intent);
|
|
36
|
+
if (sameCustomer.length === 0 && samePort.length === 0) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
cli.spacer();
|
|
40
|
+
for (const run of sameCustomer) {
|
|
41
|
+
cli.writeWarning(`${run.meta.customerPath} is already open in run ${run.meta.id} (pid ${run.meta.pid}, config ${run.meta.configName}), started ${run.meta.startedAt}.`);
|
|
42
|
+
cli.comment(" Two runs of one customer share its config files, its .local directory and its browser profile.");
|
|
43
|
+
}
|
|
44
|
+
for (const run of samePort) {
|
|
45
|
+
cli.writeWarning(`Debug port ${intent.debugPort} is already taken by run ${run.meta.id} (pid ${run.meta.pid}).`);
|
|
46
|
+
cli.comment(" Chrome will not report this. One instance ends up on 127.0.0.1 and the other on [::1], and a debugger reaches whichever resolves first — quite possibly the other one. Pass --debugPort to pick a free one.");
|
|
47
|
+
}
|
|
48
|
+
cli.spacer();
|
|
49
|
+
// A shell that cannot be asked is not a reason to refuse: say it plainly and
|
|
50
|
+
// carry on, so a scripted run is warned rather than wedged.
|
|
51
|
+
if (cli.nonInteractive) {
|
|
52
|
+
cli.writeWarning("Continuing anyway — this shell cannot be asked.");
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return cli.confirm("Start anyway?", false);
|
|
56
|
+
}
|
|
3
57
|
export default class Onboarding extends SkCommand {
|
|
4
58
|
static description = "Start a local dev environment for building and testing the Speed Kit configuration";
|
|
5
59
|
static buildContext = OnboardingServiceBuildContext;
|
|
@@ -8,7 +62,7 @@ export default class Onboarding extends SkCommand {
|
|
|
8
62
|
static examples = [
|
|
9
63
|
`$ sk onboarding <customerPath> -c <configName> -d <domain>`,
|
|
10
64
|
`$ sk onboarding customers/decathlon.de -c production -d www.decathlon.de`,
|
|
11
|
-
`$ sk onboarding --browse -d www.decathlon.de --headless
|
|
65
|
+
`$ sk onboarding --browse -d www.decathlon.de --headless`,
|
|
12
66
|
`$ sk onboarding customers/decathlon.de --browse -p`,
|
|
13
67
|
`$ sk onboarding customers/decathlon.de -p --device tablet`,
|
|
14
68
|
`$ sk onboarding customers/decathlon.de --inject`,
|
|
@@ -22,20 +76,183 @@ export default class Onboarding extends SkCommand {
|
|
|
22
76
|
customerPathForModules(args) {
|
|
23
77
|
return args.customerPath;
|
|
24
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Why a customer path that is not there was refused — and, when its words
|
|
81
|
+
* name a subcommand, the call that was meant.
|
|
82
|
+
*
|
|
83
|
+
* `sk onboarding "rum get"`, with the two words as one argument, is what a
|
|
84
|
+
* script or an agent produces, and oclif can only read it as a path.
|
|
85
|
+
*/
|
|
86
|
+
missingCustomerPath(customerPath) {
|
|
87
|
+
const words = customerPath.trim().split(/\s+/);
|
|
88
|
+
for (let length = words.length; length > 0; length -= 1) {
|
|
89
|
+
const id = ["onboarding", ...words.slice(0, length)].join(":");
|
|
90
|
+
if (this.config.findCommand(id)) {
|
|
91
|
+
return `No customer directory at "${customerPath}". To run \`sk onboarding ${words.slice(0, length).join(" ")}\`, pass its words as separate arguments.`;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return `No customer directory at "${customerPath}".`;
|
|
95
|
+
}
|
|
25
96
|
async run() {
|
|
26
|
-
const
|
|
97
|
+
const { customerPath, configName, domain, headless, debuggingPort, debugPort, useTestConfig, ignoreContentSecurityPolicy, logFile, } = this.context;
|
|
98
|
+
// The invocation's one CLI — the signal handler below restores the
|
|
99
|
+
// terminal with it.
|
|
100
|
+
const cli = this.environment.cli;
|
|
101
|
+
// Before anything is recorded: a path that is not there would leave a
|
|
102
|
+
// failed run in the registry, and retention keeps only the newest twenty,
|
|
103
|
+
// so a few of those push real runs out of `sk onboarding list`.
|
|
104
|
+
if (customerPath && !existsSync(customerPath)) {
|
|
105
|
+
this.error(this.missingCustomerPath(customerPath), { exit: 2 });
|
|
106
|
+
}
|
|
107
|
+
const registry = new RunRegistry(this.environment.cacheDir);
|
|
108
|
+
if (!(await confirmConflicts(cli, registry, {
|
|
109
|
+
customerPath,
|
|
110
|
+
debugPort: debuggingPort ? debugPort : undefined,
|
|
111
|
+
}))) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// Recorded before the factory runs, so a run that dies while loading its
|
|
115
|
+
// config still leaves something to read afterwards.
|
|
116
|
+
const run = registry.start({
|
|
117
|
+
customerPath,
|
|
118
|
+
configName,
|
|
119
|
+
domain,
|
|
120
|
+
cliVersion: this.config.version,
|
|
121
|
+
buildTime: buildTime(),
|
|
122
|
+
commit: buildInfo().commit,
|
|
123
|
+
debugPort: debuggingPort ? debugPort : undefined,
|
|
124
|
+
logSchemaVersion: logFile ? LOG_SCHEMA_VERSION : undefined,
|
|
125
|
+
flags: {
|
|
126
|
+
local: true,
|
|
127
|
+
headless,
|
|
128
|
+
useTestConfig,
|
|
129
|
+
ignoreContentSecurityPolicy,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
// Attached only now: the run directory does not exist until the collision
|
|
133
|
+
// question above has been answered, and a declined start has to leave
|
|
134
|
+
// nothing behind. Everything printed before this point belonged to no run.
|
|
135
|
+
const log = logFile ? new RunLog(run.dir) : undefined;
|
|
136
|
+
// A second stream rather than a second kind of line in the first: one
|
|
137
|
+
// navigation of a large site produces hundreds of request records, and
|
|
138
|
+
// mixing them into the narration would bury it under the traffic.
|
|
139
|
+
const requestLog = logFile ? new RequestLog(run.dir) : undefined;
|
|
140
|
+
const unmirror = log ? mirrorCrashes(log) : undefined;
|
|
141
|
+
if (log) {
|
|
142
|
+
cli.attachLog(log);
|
|
143
|
+
log.event({
|
|
144
|
+
level: "info",
|
|
145
|
+
msg: `run ${run.id} started`,
|
|
146
|
+
data: {
|
|
147
|
+
customerPath,
|
|
148
|
+
configName,
|
|
149
|
+
domain,
|
|
150
|
+
debugPort: debuggingPort ? debugPort : undefined,
|
|
151
|
+
flags: {
|
|
152
|
+
local: true,
|
|
153
|
+
headless,
|
|
154
|
+
useTestConfig,
|
|
155
|
+
ignoreContentSecurityPolicy,
|
|
156
|
+
},
|
|
157
|
+
cliVersion: this.config.version,
|
|
158
|
+
buildTime: buildTime(),
|
|
159
|
+
commit: buildInfo().commit,
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
// Ctrl+C signals the whole foreground process group, so Chrome dies too and
|
|
164
|
+
// every handle closes at once. The event loop can then drain while the
|
|
165
|
+
// awaited shutdown below is still unwinding, which fires `exit` *before* the
|
|
166
|
+
// `finally` — so the exit handler has to know a stop was asked for, or it
|
|
167
|
+
// records a deliberate shutdown as a failure. First-write-wins made that
|
|
168
|
+
// stick.
|
|
169
|
+
let stopping = false;
|
|
170
|
+
let signalName;
|
|
171
|
+
// Whether the run got to the end on its own. Without this a process that
|
|
172
|
+
// vanished mid-run and a run that ended by itself are indistinguishable:
|
|
173
|
+
// both leave exit code 0 and no signal.
|
|
174
|
+
let runReturned = false;
|
|
175
|
+
// Layer two of three (see .local/onboarding-log-api.md §11.5): `finally`
|
|
176
|
+
// covers a normal or thrown exit, this covers a `process.exit` from
|
|
177
|
+
// anywhere, and nothing covers SIGKILL — for that, a reader reconciles the
|
|
178
|
+
// recorded status against the pid and reports `crashed`.
|
|
179
|
+
// A clean exit is never a failure. The disconnect path stamps itself in
|
|
180
|
+
// OnboardingService, so by the time this runs the outcome is usually
|
|
181
|
+
// already recorded; this is the backstop for everything that did not.
|
|
182
|
+
const onExit = (code) => {
|
|
183
|
+
run.update({ exitCode: code });
|
|
184
|
+
const { status, error } = classifyExit({
|
|
185
|
+
stopping,
|
|
186
|
+
signal: signalName,
|
|
187
|
+
runReturned,
|
|
188
|
+
code,
|
|
189
|
+
});
|
|
190
|
+
run.finish(status, error);
|
|
191
|
+
};
|
|
192
|
+
process.once("exit", onExit);
|
|
27
193
|
const shutdown = new AbortController();
|
|
28
|
-
const onSignal = () =>
|
|
194
|
+
const onSignal = (signal) => {
|
|
195
|
+
stopping = true;
|
|
196
|
+
signalName = signal;
|
|
197
|
+
// Stamped here, synchronously, and not left for the shutdown to finish.
|
|
198
|
+
// `signal-exit` — reached through spinnies → cli-cursor →
|
|
199
|
+
// restore-cursor — re-raises the signal with
|
|
200
|
+
// `process.kill(process.pid, sig)` once its own cleanup is done, so the
|
|
201
|
+
// process dies *by signal*. Death by signal fires no `exit` handlers, so
|
|
202
|
+
// nothing registered after this point is guaranteed to run at all. A run
|
|
203
|
+
// ended with SIGTERM or SIGHUP used to be left `running` with a dead pid,
|
|
204
|
+
// which a reader reconciles to `crashed` — the wrong word for closing a
|
|
205
|
+
// window on purpose.
|
|
206
|
+
//
|
|
207
|
+
// The cost is that the run reads as ended a moment before its pid goes.
|
|
208
|
+
// That is the correct trade: it *is* ending, and the alternative is no
|
|
209
|
+
// status at all.
|
|
210
|
+
run.update({ signal });
|
|
211
|
+
run.finish("stopped", `received ${signal}`);
|
|
212
|
+
// Spinnies' own SIGINT handler used to do this before exiting; it no
|
|
213
|
+
// longer exists (see createSpinners), so the cursor is ours to restore.
|
|
214
|
+
cli.restoreTerminal();
|
|
215
|
+
shutdown.abort();
|
|
216
|
+
};
|
|
29
217
|
// `once`: a second Ctrl+C falls through to Node's default handler and
|
|
30
|
-
// force-quits if cleanup hangs.
|
|
218
|
+
// force-quits if cleanup hangs. Safe now that the status is already written.
|
|
31
219
|
process.once("SIGINT", onSignal);
|
|
32
220
|
process.once("SIGTERM", onSignal);
|
|
221
|
+
// Closing the terminal — or the tmux pane a run lives in — sends SIGHUP.
|
|
222
|
+
process.once("SIGHUP", onSignal);
|
|
33
223
|
try {
|
|
224
|
+
const service = await new OnboardingServiceFactory(this.context, run, requestLog).getService();
|
|
34
225
|
await service.run(shutdown.signal);
|
|
226
|
+
runReturned = true;
|
|
227
|
+
const { status, error } = classifyExit({
|
|
228
|
+
stopping,
|
|
229
|
+
signal: signalName,
|
|
230
|
+
runReturned,
|
|
231
|
+
});
|
|
232
|
+
run.finish(status, error);
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
// A teardown that throws after Ctrl+C is still a run that was stopped —
|
|
236
|
+
// calling it "failed" describes the exit path rather than what happened.
|
|
237
|
+
// The message is recorded either way, so nothing is lost by saying so.
|
|
238
|
+
run.finish(stopping ? "stopped" : "failed", error instanceof Error ? error.message : String(error));
|
|
239
|
+
throw error;
|
|
35
240
|
}
|
|
36
241
|
finally {
|
|
242
|
+
process.off("exit", onExit);
|
|
37
243
|
process.off("SIGINT", onSignal);
|
|
38
244
|
process.off("SIGTERM", onSignal);
|
|
245
|
+
process.off("SIGHUP", onSignal);
|
|
246
|
+
unmirror?.();
|
|
247
|
+
// Said once, at the end, and never mid-run: a log that cannot be written
|
|
248
|
+
// is worth knowing about, and a run that printed the same errno on every
|
|
249
|
+
// line would have buried whatever it was actually doing.
|
|
250
|
+
const stopped = log?.error ?? requestLog?.error;
|
|
251
|
+
if (stopped) {
|
|
252
|
+
cli.writeWarning(`This run's log stopped early: ${stopped}. Everything up to that point is in ${run.dir}.`);
|
|
253
|
+
}
|
|
254
|
+
log?.close();
|
|
255
|
+
requestLog?.close();
|
|
39
256
|
}
|
|
40
257
|
}
|
|
41
258
|
}
|
|
@@ -14,11 +14,15 @@ export default class OriginRequest extends SkCommand<OriginRequestServiceBuildCo
|
|
|
14
14
|
host: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
15
|
body: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
16
|
grep: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
select: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
maxMatches: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
19
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
20
|
variations: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
21
|
raw: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
22
|
configName: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
23
|
};
|
|
22
24
|
static examples: string[];
|
|
25
|
+
/** `--json` owns stdout: the progress lines would land in front of the document. */
|
|
26
|
+
protected quietCli(flags: Record<string, unknown>): boolean;
|
|
23
27
|
run(): Promise<void>;
|
|
24
28
|
}
|
|
@@ -11,6 +11,10 @@ export default class OriginRequest extends SkCommand {
|
|
|
11
11
|
`$ sk origin-request customers/decathlon.de https://www.decathlon.de/ --grep "storeId" --body /tmp/origin.html`,
|
|
12
12
|
`$ sk origin-request --raw https://www.decathlon.de/ -v mobile --body /tmp/mobile.html`,
|
|
13
13
|
];
|
|
14
|
+
/** `--json` owns stdout: the progress lines would land in front of the document. */
|
|
15
|
+
quietCli(flags) {
|
|
16
|
+
return flags["json"] === true;
|
|
17
|
+
}
|
|
14
18
|
async run() {
|
|
15
19
|
const service = await new OriginRequestServiceFactory(this.context).buildService();
|
|
16
20
|
// Exit 2 like `sk diff` when nothing could be requested, so a script does not read a success.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { confirmConflicts } from "../onboarding.js";
|
|
7
|
+
import { RunRegistry } from "../../services/run-registry/index.js";
|
|
8
|
+
import { META_FILE, } from "../../services/run-registry/run-registry-model.js";
|
|
9
|
+
import { processStartToken } from "../../services/run-registry/process-identity.js";
|
|
10
|
+
/**
|
|
11
|
+
* A CLI that records what it said and answers the prompt however the test
|
|
12
|
+
* wants. The real one derives `nonInteractive` from the environment, which
|
|
13
|
+
* under mocha is always true — so the interactive branch, the one that decides
|
|
14
|
+
* whether a run starts, could not be reached with it.
|
|
15
|
+
*/
|
|
16
|
+
class FakeCli {
|
|
17
|
+
nonInteractive;
|
|
18
|
+
answer;
|
|
19
|
+
warnings = [];
|
|
20
|
+
comments = [];
|
|
21
|
+
questions = [];
|
|
22
|
+
constructor(nonInteractive, answer) {
|
|
23
|
+
this.nonInteractive = nonInteractive;
|
|
24
|
+
this.answer = answer;
|
|
25
|
+
}
|
|
26
|
+
writeWarning(message) {
|
|
27
|
+
this.warnings.push(message);
|
|
28
|
+
}
|
|
29
|
+
comment(message) {
|
|
30
|
+
this.comments.push(message);
|
|
31
|
+
}
|
|
32
|
+
spacer() {
|
|
33
|
+
this.comments.push("");
|
|
34
|
+
}
|
|
35
|
+
async confirm(message) {
|
|
36
|
+
this.questions.push(message);
|
|
37
|
+
return this.answer;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const asCli = (fake) => fake;
|
|
41
|
+
describe("sk onboarding conflict check", () => {
|
|
42
|
+
let cacheDirectory;
|
|
43
|
+
let registry;
|
|
44
|
+
const liveRun = (id, extra = {}) => {
|
|
45
|
+
const meta = {
|
|
46
|
+
id,
|
|
47
|
+
customer: "example.com",
|
|
48
|
+
customerPath: "customers/example.com",
|
|
49
|
+
configName: "production",
|
|
50
|
+
pid: process.pid,
|
|
51
|
+
startToken: processStartToken(process.pid) ?? undefined,
|
|
52
|
+
startedAt: new Date().toISOString(),
|
|
53
|
+
status: "running",
|
|
54
|
+
flags: {
|
|
55
|
+
local: false,
|
|
56
|
+
headless: false,
|
|
57
|
+
useTestConfig: false,
|
|
58
|
+
ignoreContentSecurityPolicy: false,
|
|
59
|
+
},
|
|
60
|
+
cliVersion: "0.0.0",
|
|
61
|
+
...extra,
|
|
62
|
+
};
|
|
63
|
+
const dir = join(registry.directory, id);
|
|
64
|
+
mkdirSync(dir, { recursive: true });
|
|
65
|
+
writeFileSync(join(dir, META_FILE), JSON.stringify(meta));
|
|
66
|
+
};
|
|
67
|
+
beforeEach(() => {
|
|
68
|
+
cacheDirectory = mkdtempSync(join(tmpdir(), "sk-conflicts-"));
|
|
69
|
+
registry = new RunRegistry(cacheDirectory);
|
|
70
|
+
});
|
|
71
|
+
afterEach(() => {
|
|
72
|
+
rmSync(cacheDirectory, { recursive: true, force: true });
|
|
73
|
+
});
|
|
74
|
+
it("should not ask anything when nothing collides", async () => {
|
|
75
|
+
const cli = new FakeCli(false, false);
|
|
76
|
+
const go = await confirmConflicts(asCli(cli), registry, {
|
|
77
|
+
customerPath: "customers/example.com",
|
|
78
|
+
});
|
|
79
|
+
expect(go).to.equal(true);
|
|
80
|
+
expect(cli.questions).to.deep.equal([]);
|
|
81
|
+
expect(cli.warnings).to.deep.equal([]);
|
|
82
|
+
});
|
|
83
|
+
it("should stop the start when the answer is no", async () => {
|
|
84
|
+
liveRun("example.com-production-1");
|
|
85
|
+
const cli = new FakeCli(false, false);
|
|
86
|
+
const go = await confirmConflicts(asCli(cli), registry, {
|
|
87
|
+
customerPath: "./customers/example.com/",
|
|
88
|
+
});
|
|
89
|
+
expect(go).to.equal(false);
|
|
90
|
+
expect(cli.questions).to.have.lengthOf(1);
|
|
91
|
+
});
|
|
92
|
+
it("should let the start through when the answer is yes", async () => {
|
|
93
|
+
liveRun("example.com-production-1");
|
|
94
|
+
const cli = new FakeCli(false, true);
|
|
95
|
+
expect(await confirmConflicts(asCli(cli), registry, {
|
|
96
|
+
customerPath: "customers/example.com",
|
|
97
|
+
})).to.equal(true);
|
|
98
|
+
});
|
|
99
|
+
it("should name the run in the way of the port, and how to move", async () => {
|
|
100
|
+
liveRun("other-production-1", {
|
|
101
|
+
customerPath: "customers/other.com",
|
|
102
|
+
debugPort: 9222,
|
|
103
|
+
});
|
|
104
|
+
const cli = new FakeCli(false, true);
|
|
105
|
+
await confirmConflicts(asCli(cli), registry, {
|
|
106
|
+
customerPath: "customers/example.com",
|
|
107
|
+
debugPort: 9222,
|
|
108
|
+
});
|
|
109
|
+
expect(cli.warnings.join("\n")).to.contain("9222");
|
|
110
|
+
expect(cli.warnings.join("\n")).to.contain("other-production-1");
|
|
111
|
+
// The warning is only useful if it says what to do about it.
|
|
112
|
+
expect(cli.comments.join("\n")).to.contain("--debugPort");
|
|
113
|
+
});
|
|
114
|
+
it("should warn but not wedge a shell it cannot ask", async () => {
|
|
115
|
+
liveRun("example.com-production-1");
|
|
116
|
+
// `confirm` would answer `false` here if it were reached — so a pass proves
|
|
117
|
+
// the non-interactive branch returned true on its own rather than by
|
|
118
|
+
// taking the default. A scripted run is warned, never blocked.
|
|
119
|
+
const cli = new FakeCli(true, false);
|
|
120
|
+
const go = await confirmConflicts(asCli(cli), registry, {
|
|
121
|
+
customerPath: "customers/example.com",
|
|
122
|
+
});
|
|
123
|
+
expect(go).to.equal(true);
|
|
124
|
+
expect(cli.questions).to.deep.equal([]);
|
|
125
|
+
expect(cli.warnings.join("\n")).to.contain("cannot be asked");
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface BuildInfo {
|
|
2
|
+
/** Short commit the build came from. Absent where git was not available. */
|
|
3
|
+
commit?: string;
|
|
4
|
+
/** Whether anything was uncommitted when it was built. */
|
|
5
|
+
dirty?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* A digest of `dist/` as it was built — the build's own identity.
|
|
8
|
+
*
|
|
9
|
+
* `commit` describes where the build came from, which on a dirty tree is the
|
|
10
|
+
* commit *before* the change under test. This describes the build itself, so
|
|
11
|
+
* two dirty builds can be told apart and a rebuild can be confirmed to have
|
|
12
|
+
* happened. Compare this when `dirty` is true.
|
|
13
|
+
*/
|
|
14
|
+
buildId?: string;
|
|
15
|
+
/** ISO 8601. */
|
|
16
|
+
builtAt?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Which build **this process** is running, written by `npm run build`.
|
|
20
|
+
*
|
|
21
|
+
* `version` does not answer this. semantic-release bumps it only on a release,
|
|
22
|
+
* so every development build of a version reports the same string and a run
|
|
23
|
+
* from a fixed build is indistinguishable from one from the build it fixed. Two
|
|
24
|
+
* test sweeps in a row had to date-match a build time against the commit log by
|
|
25
|
+
* hand — across timezones — to establish what they had been testing.
|
|
26
|
+
*
|
|
27
|
+
* Everything is optional on purpose: a tarball install has no git, and a build
|
|
28
|
+
* that predates this file has no stamp. Reporting nothing is better than
|
|
29
|
+
* reporting a guess.
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildInfo(): BuildInfo;
|
|
32
|
+
/** One line naming the build, for anything that reports what it is running. */
|
|
33
|
+
export declare function buildLabel(version: string): string;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
/**
|
|
5
|
+
* Where the stamp lives, relative to this module once compiled.
|
|
6
|
+
* dist/services/cli/build-info.js → dist/build-info.json
|
|
7
|
+
*/
|
|
8
|
+
const STAMP_PATH = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "build-info.json");
|
|
9
|
+
function readStamp() {
|
|
10
|
+
try {
|
|
11
|
+
return JSON.parse(readFileSync(STAMP_PATH, "utf8"));
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
// A tarball install has no git, a build predating this file has no stamp,
|
|
15
|
+
// and running from source under tsx has no dist at all. Reporting nothing
|
|
16
|
+
// beats reporting a guess.
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Read once, at import — **not** on first call.
|
|
22
|
+
*
|
|
23
|
+
* This is the whole correctness of the field. The stamp is a file in `dist/`,
|
|
24
|
+
* and `dist/` is replaced by every build, so a long-lived process that reads it
|
|
25
|
+
* lazily reports whatever happens to be on disk the moment something first
|
|
26
|
+
* asks. `sk onboarding` is exactly that process: it runs for hours, so a
|
|
27
|
+
* rebuild mid-run left it executing the old code while naming the new commit —
|
|
28
|
+
* with `dirty: false`, which made it look trustworthy. A process started at
|
|
29
|
+
* 08:02 reported a commit made at 12:40.
|
|
30
|
+
*
|
|
31
|
+
* ESM evaluates a statically imported module at process start, so reading here
|
|
32
|
+
* pins the stamp to the build this process actually loaded. It cannot drift
|
|
33
|
+
* afterwards, because nothing re-reads it.
|
|
34
|
+
*/
|
|
35
|
+
const LOADED = readStamp();
|
|
36
|
+
/**
|
|
37
|
+
* Which build **this process** is running, written by `npm run build`.
|
|
38
|
+
*
|
|
39
|
+
* `version` does not answer this. semantic-release bumps it only on a release,
|
|
40
|
+
* so every development build of a version reports the same string and a run
|
|
41
|
+
* from a fixed build is indistinguishable from one from the build it fixed. Two
|
|
42
|
+
* test sweeps in a row had to date-match a build time against the commit log by
|
|
43
|
+
* hand — across timezones — to establish what they had been testing.
|
|
44
|
+
*
|
|
45
|
+
* Everything is optional on purpose: a tarball install has no git, and a build
|
|
46
|
+
* that predates this file has no stamp. Reporting nothing is better than
|
|
47
|
+
* reporting a guess.
|
|
48
|
+
*/
|
|
49
|
+
export function buildInfo() {
|
|
50
|
+
return LOADED;
|
|
51
|
+
}
|
|
52
|
+
/** One line naming the build, for anything that reports what it is running. */
|
|
53
|
+
export function buildLabel(version) {
|
|
54
|
+
const { commit, dirty, buildId } = buildInfo();
|
|
55
|
+
if (!commit) {
|
|
56
|
+
return buildId ? `${version} (build ${buildId})` : version;
|
|
57
|
+
}
|
|
58
|
+
// On a dirty tree the commit is not the code, so the build id is what the
|
|
59
|
+
// reader needs; on a clean one the commit says it better than a digest can.
|
|
60
|
+
return dirty
|
|
61
|
+
? `${version} (${commit}+dirty, build ${buildId ?? "unknown"})`
|
|
62
|
+
: `${version} (${commit})`;
|
|
63
|
+
}
|