@speedkit/cli 4.51.1 → 4.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +1426 -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/browser-fetch/device-emulation.d.ts +11 -0
- package/dist/services/browser-fetch/device-emulation.js +14 -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 +43 -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 +68 -13
- 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 +6 -1
- package/dist/services/onboarding/browser/resume-restarted-workers.d.ts +14 -0
- package/dist/services/onboarding/browser/resume-restarted-workers.js +26 -0
- 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 +547 -0
- package/dist/services/onboarding/control/browser-session.js +1337 -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 +1430 -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 +40 -7
- package/dist/services/onboarding/onboarding-model.js +20 -9
- 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 +139 -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/browser/resume-restarted-workers.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.js +45 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.js +753 -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 +67 -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 +328 -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 +3493 -372
- package/package.json +20 -2
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
+
import { MemorySink } from "../sink.js";
|
|
4
|
+
import { MemoryRunLog } from "../../run-log/index.js";
|
|
5
|
+
import { memoryCli } from "./memory-cli.js";
|
|
6
|
+
describe("CliService writing to a run log", () => {
|
|
7
|
+
let ci;
|
|
8
|
+
let sink;
|
|
9
|
+
let log;
|
|
10
|
+
let cli;
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
ci = process.env.CI;
|
|
13
|
+
process.env.CI = "true";
|
|
14
|
+
sink = new MemorySink();
|
|
15
|
+
log = new MemoryRunLog();
|
|
16
|
+
cli = memoryCli(sink);
|
|
17
|
+
cli.attachLog(log);
|
|
18
|
+
});
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
if (ci === undefined) {
|
|
21
|
+
delete process.env.CI;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
process.env.CI = ci;
|
|
25
|
+
});
|
|
26
|
+
it("records nothing before a log is attached", () => {
|
|
27
|
+
const detached = memoryCli();
|
|
28
|
+
expect(() => detached.write("no log here")).to.not.throw();
|
|
29
|
+
});
|
|
30
|
+
it("gives each write the level its method implies", () => {
|
|
31
|
+
cli.write("plain");
|
|
32
|
+
cli.writeSuccess("done");
|
|
33
|
+
cli.writeWarning("careful");
|
|
34
|
+
cli.writeError("broken");
|
|
35
|
+
expect(log.events.map((event) => [event.level, event.msg])).to.eql([
|
|
36
|
+
["info", "plain"],
|
|
37
|
+
["success", "done"],
|
|
38
|
+
["warn", "careful"],
|
|
39
|
+
["error", "broken"],
|
|
40
|
+
]);
|
|
41
|
+
});
|
|
42
|
+
it("records a warning once, not once as a warning and once as a write", () => {
|
|
43
|
+
// `writeWarning` used to delegate to `write`, which would log the same line
|
|
44
|
+
// twice — the second time at the wrong level.
|
|
45
|
+
cli.writeWarning("careful");
|
|
46
|
+
expect(log.events).to.have.length(1);
|
|
47
|
+
expect(sink.lines).to.have.length(1);
|
|
48
|
+
});
|
|
49
|
+
it("carries the scope and data the caller annotated", () => {
|
|
50
|
+
cli.write("served from origin", false, {
|
|
51
|
+
scope: "fetch",
|
|
52
|
+
data: { url: "/checkout", responseCause: "SwBooting" },
|
|
53
|
+
});
|
|
54
|
+
expect(log.events[0].scope).to.equal("fetch");
|
|
55
|
+
expect(log.events[0].data).to.eql({
|
|
56
|
+
url: "/checkout",
|
|
57
|
+
responseCause: "SwBooting",
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
it("lets a caller overrule the level its method implies", () => {
|
|
61
|
+
cli.writeWarning("this one is routine", false, { level: "debug" });
|
|
62
|
+
expect(log.events[0].level).to.equal("debug");
|
|
63
|
+
});
|
|
64
|
+
it("records a buffered line when it is buffered, with its own level", () => {
|
|
65
|
+
// Buffered lines are flushed as one block. Logging at flush time would
|
|
66
|
+
// report a page of mixed warnings and successes as a single info line.
|
|
67
|
+
cli.writeWarning("careful", true);
|
|
68
|
+
cli.writeSuccess("done", true);
|
|
69
|
+
cli.writeBuffer();
|
|
70
|
+
expect(log.events.map((event) => event.level)).to.eql(["warn", "success"]);
|
|
71
|
+
});
|
|
72
|
+
it("records an action's whole lifecycle", () => {
|
|
73
|
+
cli.startAction("INSTALL", "install Speed Kit");
|
|
74
|
+
cli.failAction("INSTALL", "could not reach the origin");
|
|
75
|
+
expect(log.events.map((event) => [event.action?.state, event.level])).to.eql([
|
|
76
|
+
["start", "info"],
|
|
77
|
+
["fail", "error"],
|
|
78
|
+
]);
|
|
79
|
+
});
|
|
80
|
+
it("names the action it ended, even when the caller did not", () => {
|
|
81
|
+
cli.startAction("WARM", "warm the list");
|
|
82
|
+
cli.successAction("WARM");
|
|
83
|
+
expect(log.events[1].msg).to.equal("warm the list");
|
|
84
|
+
});
|
|
85
|
+
it("records what a quiet run would have printed", () => {
|
|
86
|
+
// The log is not the terminal. A `--quiet` session prints nothing and still
|
|
87
|
+
// happened, and an empty log would be the most misleading file in the run
|
|
88
|
+
// directory.
|
|
89
|
+
const quiet = memoryCli(sink, true);
|
|
90
|
+
quiet.attachLog(log);
|
|
91
|
+
quiet.startAction("BUILD", "build the bundle");
|
|
92
|
+
expect(log.events).to.have.length(1);
|
|
93
|
+
});
|
|
94
|
+
it("records a question before the answer exists, and again after", async () => {
|
|
95
|
+
const quiet = memoryCli(sink, true);
|
|
96
|
+
quiet.attachLog(log);
|
|
97
|
+
// Under `--quiet` the default is taken without asking, so the pair here is
|
|
98
|
+
// one event: there was never a question on screen to record as pending.
|
|
99
|
+
await quiet.confirm("Start anyway?", false);
|
|
100
|
+
expect(log.events).to.have.length(1);
|
|
101
|
+
expect(log.events[0].interaction).to.include({
|
|
102
|
+
kind: "confirm",
|
|
103
|
+
question: "Start anyway?",
|
|
104
|
+
answer: false,
|
|
105
|
+
defaulted: true,
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
it("withholds the answer to a prompt the caller marked sensitive", async () => {
|
|
109
|
+
const quiet = memoryCli(sink, true);
|
|
110
|
+
quiet.attachLog(log);
|
|
111
|
+
await quiet.prompt("Basic auth password", {
|
|
112
|
+
defaultAnswer: "hunter2",
|
|
113
|
+
sensitive: true,
|
|
114
|
+
});
|
|
115
|
+
expect(log.events[0].interaction?.sensitive).to.equal(true);
|
|
116
|
+
expect(log.events[0].interaction?.answer).to.equal(undefined);
|
|
117
|
+
// The question itself is the useful part, and it is not the secret.
|
|
118
|
+
expect(log.events[0].interaction?.question).to.equal("Basic auth password");
|
|
119
|
+
});
|
|
120
|
+
it("records a table as rows, not as the rendered grid", () => {
|
|
121
|
+
cli.table([{ url: "/a", hits: 2 }], { url: {}, hits: {} });
|
|
122
|
+
expect(log.events[0].data).to.eql({
|
|
123
|
+
columns: ["url", "hits"],
|
|
124
|
+
rows: [{ url: "/a", hits: 2 }],
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
it("records that a payload was written, without its bytes", () => {
|
|
128
|
+
cli.pipe("SELECT * FROM rum.pi\n");
|
|
129
|
+
expect(log.events[0].level).to.equal("debug");
|
|
130
|
+
expect(log.events[0].msg).to.contain("bytes");
|
|
131
|
+
expect(log.events[0].msg).to.not.contain("SELECT");
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -1,58 +1,67 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
/** What a CI runner looks like to the CLI: no spinner can spin, nobody to ask. */
|
|
6
|
-
const CI_TERMINAL = { isCI: true, nonInteractive: true };
|
|
7
|
-
/** The lines a block of work put on stdout. */
|
|
8
|
-
function captured(work) {
|
|
9
|
-
const lines = [];
|
|
10
|
-
const log = console.log;
|
|
11
|
-
console.log = (line) => lines.push(line);
|
|
12
|
-
try {
|
|
13
|
-
work();
|
|
14
|
-
}
|
|
15
|
-
finally {
|
|
16
|
-
console.log = log;
|
|
17
|
-
}
|
|
18
|
-
return lines;
|
|
19
|
-
}
|
|
3
|
+
import { MemorySink } from "../sink.js";
|
|
4
|
+
import { memoryCli } from "./memory-cli.js";
|
|
20
5
|
describe("CliService actions without a terminal", () => {
|
|
6
|
+
let sink;
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
sink = new MemorySink();
|
|
9
|
+
});
|
|
21
10
|
it("should say nothing while an action runs", () => {
|
|
22
|
-
const cli =
|
|
23
|
-
|
|
11
|
+
const cli = memoryCli(sink);
|
|
12
|
+
cli.startAction("BUILD", "build prewarm-query");
|
|
13
|
+
expect(sink.lines).to.have.lengthOf(0);
|
|
24
14
|
});
|
|
25
15
|
it("should log an action that ended exactly once", () => {
|
|
26
16
|
// Spinnies re-renders every spinner it knows on each update when it cannot
|
|
27
17
|
// animate, so a running action reappears under each later one — a job with
|
|
28
18
|
// four actions logged "build prewarm-query" four times.
|
|
29
|
-
const cli =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
expect(lines).to.
|
|
37
|
-
expect(lines
|
|
38
|
-
expect(lines[1]).to.contain("execute athena query");
|
|
39
|
-
expect(lines.join("\n")).to.not.contain("build prewarm-query\n✖ execute athena query\n✔ build prewarm-query");
|
|
19
|
+
const cli = memoryCli(sink);
|
|
20
|
+
cli.startAction("BUILD", "build prewarm-query");
|
|
21
|
+
cli.successAction("BUILD");
|
|
22
|
+
cli.startAction("QUERY", "execute athena query");
|
|
23
|
+
cli.failAction("QUERY");
|
|
24
|
+
expect(sink.lines).to.have.lengthOf(2);
|
|
25
|
+
expect(sink.lines[0]).to.contain("build prewarm-query");
|
|
26
|
+
expect(sink.lines[1]).to.contain("execute athena query");
|
|
27
|
+
expect(sink.lines.join("\n")).to.not.contain("build prewarm-query\n✖ execute athena query\n✔ build prewarm-query");
|
|
40
28
|
});
|
|
41
29
|
it("should keep the text of the action it ends", () => {
|
|
42
|
-
const cli =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
expect(lines).to.deep.equal(["- warm the list"]);
|
|
30
|
+
const cli = memoryCli(sink);
|
|
31
|
+
cli.startAction("WARM", "warm the list");
|
|
32
|
+
cli.endAction("WARM");
|
|
33
|
+
expect(sink.lines).to.deep.equal(["- warm the list"]);
|
|
48
34
|
});
|
|
49
35
|
it("should stay silent when it was told to be quiet", () => {
|
|
50
|
-
const cli =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
const cli = memoryCli(sink, true);
|
|
37
|
+
cli.startAction("BUILD", "build prewarm-query");
|
|
38
|
+
cli.successAction("BUILD");
|
|
39
|
+
expect(sink.lines).to.have.lengthOf(0);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
describe("CliService channels", () => {
|
|
43
|
+
it("should keep a payload off the line channel and asides off both", () => {
|
|
44
|
+
const sink = new MemorySink();
|
|
45
|
+
const cli = memoryCli(sink);
|
|
46
|
+
cli.write("a human line");
|
|
47
|
+
cli.pipe("SELECT 1");
|
|
48
|
+
cli.note("2 rules were reduced");
|
|
49
|
+
expect(sink.lines).to.deep.equal(["a human line"]);
|
|
50
|
+
expect(sink.payloads).to.deep.equal(["SELECT 1"]);
|
|
51
|
+
expect(sink.asides).to.deep.equal(["2 rules were reduced"]);
|
|
52
|
+
});
|
|
53
|
+
it("should not add a newline to a payload", () => {
|
|
54
|
+
const sink = new MemorySink();
|
|
55
|
+
const cli = memoryCli(sink);
|
|
56
|
+
cli.pipe("a\tb\n");
|
|
57
|
+
cli.pipe("c");
|
|
58
|
+
expect(sink.payloads.join("")).to.equal("a\tb\nc");
|
|
59
|
+
});
|
|
60
|
+
it("should write a payload even when quiet, because quiet is what asks for it", () => {
|
|
61
|
+
const sink = new MemorySink();
|
|
62
|
+
const cli = memoryCli(sink, true);
|
|
63
|
+
cli.pipe("SELECT 1");
|
|
64
|
+
expect(sink.payloads).to.deep.equal(["SELECT 1"]);
|
|
56
65
|
});
|
|
57
66
|
});
|
|
58
67
|
describe("CliService table", () => {
|
|
@@ -76,23 +85,77 @@ describe("CliService table", () => {
|
|
|
76
85
|
outcome: "alreadyDeployed",
|
|
77
86
|
reason: "commits after !8021 change config_documentHandler.js and config_dynamicStyles.css of this customer",
|
|
78
87
|
};
|
|
79
|
-
|
|
80
|
-
|
|
88
|
+
/** The lines the table put out, the row above as its only row. */
|
|
89
|
+
function tabled() {
|
|
90
|
+
const sink = new MemorySink();
|
|
91
|
+
memoryCli(sink).table([row], {
|
|
81
92
|
customer: {},
|
|
82
93
|
outcome: {},
|
|
83
94
|
reason: {},
|
|
84
|
-
})
|
|
95
|
+
});
|
|
96
|
+
return sink.lines;
|
|
97
|
+
}
|
|
98
|
+
it("keeps the short columns readable and wraps the long one", () => {
|
|
99
|
+
const lines = tabled();
|
|
85
100
|
expect(lines.join("\n")).to.contain("carhartt-wip-new");
|
|
86
101
|
expect(lines.join("\n")).to.contain("alreadyDeployed");
|
|
87
102
|
});
|
|
88
103
|
it("stays inside the terminal", () => {
|
|
89
|
-
const lines =
|
|
90
|
-
customer: {},
|
|
91
|
-
outcome: {},
|
|
92
|
-
reason: {},
|
|
93
|
-
}));
|
|
104
|
+
const lines = tabled();
|
|
94
105
|
for (const line of lines.join("\n").split("\n")) {
|
|
95
106
|
expect(line.length, line).to.be.at.most(80);
|
|
96
107
|
}
|
|
97
108
|
});
|
|
98
109
|
});
|
|
110
|
+
describe("CliService and the SIGINT listener", () => {
|
|
111
|
+
let saved;
|
|
112
|
+
beforeEach(() => {
|
|
113
|
+
// Start from a known-clean slate. Without this a listener spinnies left
|
|
114
|
+
// behind in an earlier case makes the count assertions pass by accident.
|
|
115
|
+
saved = process.rawListeners("SIGINT");
|
|
116
|
+
for (const listener of saved) {
|
|
117
|
+
process.off("SIGINT", listener);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
afterEach(() => {
|
|
121
|
+
for (const listener of process.rawListeners("SIGINT")) {
|
|
122
|
+
process.off("SIGINT", listener);
|
|
123
|
+
}
|
|
124
|
+
for (const listener of saved) {
|
|
125
|
+
process.on("SIGINT", listener);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
it("should leave a handler registered before it alone", () => {
|
|
129
|
+
// Spinnies' constructor calls process.removeAllListeners("SIGINT") and
|
|
130
|
+
// installs one that process.exit(0)s. `sk onboarding` registers its
|
|
131
|
+
// shutdown handler before the browser launches, so constructing a
|
|
132
|
+
// CliService used to delete it — silently, and three test sessions blamed
|
|
133
|
+
// the CLI's own handler for the result.
|
|
134
|
+
const ours = () => undefined;
|
|
135
|
+
process.on("SIGINT", ours);
|
|
136
|
+
try {
|
|
137
|
+
memoryCli();
|
|
138
|
+
expect(process.listeners("SIGINT")).to.contain(ours);
|
|
139
|
+
}
|
|
140
|
+
finally {
|
|
141
|
+
process.off("SIGINT", ours);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
it("should not leave a listener of its own behind", () => {
|
|
145
|
+
memoryCli();
|
|
146
|
+
// Spinnies' handler would otherwise exit(0) on Ctrl+C, skipping every
|
|
147
|
+
// shutdown the CLI owns. The cursor it restored is restoreTerminal's job.
|
|
148
|
+
expect(process.listeners("SIGINT")).to.have.lengthOf(0);
|
|
149
|
+
});
|
|
150
|
+
it("should keep a once-registration a once-registration", () => {
|
|
151
|
+
const ours = () => undefined;
|
|
152
|
+
process.once("SIGINT", ours);
|
|
153
|
+
memoryCli();
|
|
154
|
+
// Deliberately asserted on the wrapper rather than by emitting a signal:
|
|
155
|
+
// if this regresses, the listener in place is spinnies' `process.exit(0)`,
|
|
156
|
+
// and emitting would take the test runner down with it instead of failing.
|
|
157
|
+
// Node marks a once-wrapper by hanging the original off `.listener`.
|
|
158
|
+
const [raw] = process.rawListeners("SIGINT");
|
|
159
|
+
expect(raw?.listener).to.equal(ours);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CliService } from "../cli-service.js";
|
|
2
|
+
import { MemorySink } from "../sink.js";
|
|
3
|
+
/** What a CI runner looks like to the CLI: no spinner can spin, nobody to ask. */
|
|
4
|
+
export declare const CI_TERMINAL: {
|
|
5
|
+
isCI: boolean;
|
|
6
|
+
nonInteractive: boolean;
|
|
7
|
+
};
|
|
8
|
+
/** A CLI on a CI runner that writes into `sink` rather than the terminal. */
|
|
9
|
+
export declare function memoryCli(sink?: MemorySink, quiet?: boolean): CliService;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CliService } from "../cli-service.js";
|
|
2
|
+
import { ClipboardService } from "../clipboard/index.js";
|
|
3
|
+
import { MemorySink } from "../sink.js";
|
|
4
|
+
/** What a CI runner looks like to the CLI: no spinner can spin, nobody to ask. */
|
|
5
|
+
export const CI_TERMINAL = { isCI: true, nonInteractive: true };
|
|
6
|
+
/** A CLI on a CI runner that writes into `sink` rather than the terminal. */
|
|
7
|
+
export function memoryCli(sink = new MemorySink(), quiet = false) {
|
|
8
|
+
return new CliService(new ClipboardService(), CI_TERMINAL, quiet, sink);
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GitRepository } from "../git/index.js";
|
|
2
|
+
/** A customer directory as a git ref holds it, written to a temp directory. */
|
|
3
|
+
export interface ConfigAtRef {
|
|
4
|
+
/** The customer directory in the temp directory. */
|
|
5
|
+
readonly customerPath: string;
|
|
6
|
+
/** The commit the files come from: where HEAD left the ref. */
|
|
7
|
+
readonly commit: string;
|
|
8
|
+
/** Deletes the temp directory. */
|
|
9
|
+
remove(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Writes the customer directory as `ref` holds it to a temp directory, so
|
|
13
|
+
* the documentHandler can be built from it beside the working tree's.
|
|
14
|
+
* The files come from the merge base of HEAD and `ref`, so changes that
|
|
15
|
+
* landed on `ref` after the branch left it do not show up reversed.
|
|
16
|
+
*
|
|
17
|
+
* shortcut: files are read as utf8, so a binary file in the customer
|
|
18
|
+
* directory is mangled; read buffers when a config ships one.
|
|
19
|
+
*/
|
|
20
|
+
export declare function configAtRef(customerPath: string, ref: string, repository?: GitRepository): Promise<ConfigAtRef>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import ApplicationError from "../error-handling/error/application-error.js";
|
|
5
|
+
import { GitRepository } from "../git/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* Writes the customer directory as `ref` holds it to a temp directory, so
|
|
8
|
+
* the documentHandler can be built from it beside the working tree's.
|
|
9
|
+
* The files come from the merge base of HEAD and `ref`, so changes that
|
|
10
|
+
* landed on `ref` after the branch left it do not show up reversed.
|
|
11
|
+
*
|
|
12
|
+
* shortcut: files are read as utf8, so a binary file in the customer
|
|
13
|
+
* directory is mangled; read buffers when a config ships one.
|
|
14
|
+
*/
|
|
15
|
+
export async function configAtRef(customerPath, ref, repository = GitRepository.at(customerPath)) {
|
|
16
|
+
const directory = repository.relative(customerPath);
|
|
17
|
+
const commit = repository.mergeBase(ref);
|
|
18
|
+
const files = repository.pathsAt(commit, directory);
|
|
19
|
+
if (files.length === 0) {
|
|
20
|
+
throw new ApplicationError(`no config at ${ref} (${commit.slice(0, 8)}) for ${directory}; use a ref that has one, or drop --base for a new customer.`);
|
|
21
|
+
}
|
|
22
|
+
const root = await mkdtemp(path.join(tmpdir(), "sk-diff-base-"));
|
|
23
|
+
for (const file of files) {
|
|
24
|
+
const target = path.join(root, file);
|
|
25
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
26
|
+
await writeFile(target, repository.contentAt(commit, file));
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
customerPath: path.join(root, directory),
|
|
30
|
+
commit,
|
|
31
|
+
remove: () => rm(root, { recursive: true, force: true }),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -11,6 +11,8 @@ declare const flags: {
|
|
|
11
11
|
variations: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
12
12
|
against: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
13
13
|
variation: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
14
|
+
base: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
15
|
+
html: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
14
16
|
baseline: Interfaces.BooleanFlag<boolean>;
|
|
15
17
|
params: Interfaces.BooleanFlag<boolean>;
|
|
16
18
|
param: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
@@ -20,6 +22,7 @@ declare const flags: {
|
|
|
20
22
|
browserFetch: Interfaces.BooleanFlag<boolean>;
|
|
21
23
|
host: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
22
24
|
variationsFile: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
25
|
+
run: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
23
26
|
hideDiff: Interfaces.BooleanFlag<boolean>;
|
|
24
27
|
configName: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
25
28
|
};
|
|
@@ -46,6 +49,10 @@ export interface DiffOptions {
|
|
|
46
49
|
readonly pageUrl: string;
|
|
47
50
|
/** The page {@link pageUrl} is compared with, in place of the parameter check. */
|
|
48
51
|
readonly against?: string;
|
|
52
|
+
/** The git ref whose customer config renders the page, against the working tree's. */
|
|
53
|
+
readonly base?: string;
|
|
54
|
+
/** With {@link base}: a saved origin page, rendered instead of a request. */
|
|
55
|
+
readonly html?: string;
|
|
49
56
|
/** The variation `against` and a parameter check without `variations` request. */
|
|
50
57
|
readonly variation: string;
|
|
51
58
|
/** Ask which variation to request the pages in, in place of {@link variation}. */
|
|
@@ -69,6 +76,8 @@ export interface DiffOptions {
|
|
|
69
76
|
readonly ignore: readonly string[];
|
|
70
77
|
readonly host?: string;
|
|
71
78
|
readonly variationsFile?: string;
|
|
79
|
+
/** `--run`: the live run whose runtime config the requests follow. */
|
|
80
|
+
readonly run?: string;
|
|
72
81
|
/** Fetch through a headless Chrome instead of a direct request. */
|
|
73
82
|
readonly browserFetch: boolean;
|
|
74
83
|
}
|
|
@@ -87,6 +96,8 @@ export declare class DiffServiceBuildContext extends DiffServiceBuildContext_bas
|
|
|
87
96
|
variations: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
88
97
|
against: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
89
98
|
variation: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
99
|
+
base: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
100
|
+
html: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
90
101
|
baseline: Interfaces.BooleanFlag<boolean>;
|
|
91
102
|
params: Interfaces.BooleanFlag<boolean>;
|
|
92
103
|
param: Interfaces.OptionFlag<string[], Interfaces.CustomOptions>;
|
|
@@ -96,6 +107,7 @@ export declare class DiffServiceBuildContext extends DiffServiceBuildContext_bas
|
|
|
96
107
|
browserFetch: Interfaces.BooleanFlag<boolean>;
|
|
97
108
|
host: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
98
109
|
variationsFile: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
110
|
+
run: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
99
111
|
hideDiff: Interfaces.BooleanFlag<boolean>;
|
|
100
112
|
configName: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
101
113
|
};
|
|
@@ -38,7 +38,13 @@ const flags = {
|
|
|
38
38
|
description: "Compare the page against this other page, both requested and rendered the same way: ?color=red against ?color=blue. Replaces the parameter check",
|
|
39
39
|
}),
|
|
40
40
|
variation: Flags.string({
|
|
41
|
-
description: "The one variation the pages are requested in, for --against or the parameter check: mobile, tablet or a custom one; an empty one asks which. Defaults to desktop",
|
|
41
|
+
description: "The one variation the pages are requested in, for --against, --base or the parameter check: mobile, tablet or a custom one; an empty one asks which. Defaults to desktop",
|
|
42
|
+
}),
|
|
43
|
+
base: Flags.string({
|
|
44
|
+
description: "Render the page with the customer config where HEAD left this git ref (their merge base) and with the working tree, and diff the two: what a config change does to the page. Replaces the parameter check; takes --variation and --html",
|
|
45
|
+
}),
|
|
46
|
+
html: Flags.string({
|
|
47
|
+
description: "With --base, render this saved origin HTML instead of requesting the page",
|
|
42
48
|
}),
|
|
43
49
|
baseline: Flags.boolean({
|
|
44
50
|
description: "Fetch every side twice and ignore what differs between the two, such as nonces, timestamps or reordered preloads. Doubles the requests: 4 per comparison",
|
|
@@ -71,6 +77,10 @@ const flags = {
|
|
|
71
77
|
variationsFile: Flags.string({
|
|
72
78
|
description: "Resolve the requests against a runtime config in a local file instead of the app's deployed one",
|
|
73
79
|
}),
|
|
80
|
+
run: Flags.string({
|
|
81
|
+
exclusive: ["variationsFile"],
|
|
82
|
+
description: "Take the runtime config from this live sk onboarding run: its id, its customer name, or its path. Without it, the one live run of the customer is used",
|
|
83
|
+
}),
|
|
74
84
|
hideDiff: Flags.boolean({
|
|
75
85
|
char: "h",
|
|
76
86
|
hidden: true,
|
|
@@ -129,6 +139,36 @@ function againstUrl(pageUrl, parsedFlags) {
|
|
|
129
139
|
}
|
|
130
140
|
return against;
|
|
131
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* The git ref `--base` names. It compares two configs on one page, so it
|
|
144
|
+
* needs the customer and the documentHandler, and refuses the flags of the
|
|
145
|
+
* checks it replaces. `--html` only feeds it.
|
|
146
|
+
*/
|
|
147
|
+
function baseRef(customerPath, parsedFlags) {
|
|
148
|
+
const { base, html } = parsedFlags;
|
|
149
|
+
if (base === undefined) {
|
|
150
|
+
if (html !== undefined) {
|
|
151
|
+
throw new ApplicationError("--html renders a saved page for --base.", [
|
|
152
|
+
"sk diff <customerPath> <pageUrl> --base origin/main --html page.html",
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
if (!customerPath || parsedFlags.raw) {
|
|
158
|
+
throw new ApplicationError("--base compares two configs of a customer, so it needs the customer path and the documentHandler.", ["sk diff <customerPath> <pageUrl> --base origin/main"]);
|
|
159
|
+
}
|
|
160
|
+
const conflicting = [
|
|
161
|
+
parsedFlags.against !== undefined && "--against",
|
|
162
|
+
parsedFlags.param !== undefined && "--param",
|
|
163
|
+
parsedFlags.params && "--params",
|
|
164
|
+
parsedFlags.variations !== undefined && "--variations",
|
|
165
|
+
parsedFlags.baseline && "--baseline",
|
|
166
|
+
].filter(Boolean);
|
|
167
|
+
if (conflicting.length > 0) {
|
|
168
|
+
throw new ApplicationError(`--base renders one page with two configs, so it does not take ${conflicting.join(", ")}.`, ["For another variation than desktop, name one: --variation mobile"]);
|
|
169
|
+
}
|
|
170
|
+
return base;
|
|
171
|
+
}
|
|
132
172
|
/**
|
|
133
173
|
* The one variation `--variation` names, desktop by default, or before an
|
|
134
174
|
* empty one is answered. `--variations` compares a pair, so the two are
|
|
@@ -268,6 +308,7 @@ export class DiffServiceBuildContext extends Context() {
|
|
|
268
308
|
if (!customerPath && !parsedFlags.raw) {
|
|
269
309
|
throw new ApplicationError("Without a customer path there is no documentHandler to render with.", ["Name the customer, or pass --raw to compare the origin's HTML."]);
|
|
270
310
|
}
|
|
311
|
+
const base = baseRef(customerPath, parsedFlags);
|
|
271
312
|
const against = againstUrl(pageUrl, parsedFlags);
|
|
272
313
|
const variation = singleVariation(parsedFlags);
|
|
273
314
|
const chooseVariation = choosesVariation(parsedFlags.variation, environment);
|
|
@@ -280,6 +321,8 @@ export class DiffServiceBuildContext extends Context() {
|
|
|
280
321
|
configName: parsedFlags.configName,
|
|
281
322
|
pageUrl,
|
|
282
323
|
against,
|
|
324
|
+
base,
|
|
325
|
+
html: parsedFlags.html,
|
|
283
326
|
variation,
|
|
284
327
|
chooseVariation,
|
|
285
328
|
variations: chooseVariations
|
|
@@ -295,6 +338,7 @@ export class DiffServiceBuildContext extends Context() {
|
|
|
295
338
|
ignore: parsedFlags.ignore ?? [],
|
|
296
339
|
host: parsedFlags.host,
|
|
297
340
|
variationsFile: parsedFlags.variationsFile,
|
|
341
|
+
run: parsedFlags.run,
|
|
298
342
|
browserFetch: parsedFlags.browserFetch,
|
|
299
343
|
});
|
|
300
344
|
}
|
|
@@ -6,6 +6,8 @@ export declare class DiffServiceFactory {
|
|
|
6
6
|
constructor(context: DiffServiceBuildContext);
|
|
7
7
|
buildService(): Promise<DiffService>;
|
|
8
8
|
private build;
|
|
9
|
+
/** The pages rendered with the customer config at `--base`, from a checkout of it. */
|
|
10
|
+
private buildBase;
|
|
9
11
|
/**
|
|
10
12
|
* The options, with the parameters an empty `--param` asked for added to
|
|
11
13
|
* the ones removed. Asked first, before anything is loaded or fetched.
|