@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,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where `CliService` output actually goes.
|
|
3
|
+
*
|
|
4
|
+
* Every write the CLI makes passes through one of these three methods, so
|
|
5
|
+
* redirecting the CLI is a matter of handing it a different sink rather than
|
|
6
|
+
* intercepting `process.stdout`. That is the whole point: a process whose
|
|
7
|
+
* stdout belongs to something else — a protocol, a payload — cannot afford a
|
|
8
|
+
* stray byte, and nothing can be intercepted reliably enough to
|
|
9
|
+
* guarantee that.
|
|
10
|
+
*
|
|
11
|
+
* The three channels exist because they have different rules, not because the
|
|
12
|
+
* streams differ:
|
|
13
|
+
*
|
|
14
|
+
* - `line` is for a human reading along.
|
|
15
|
+
* - `payload` is the machine-readable result under `--quiet`, written verbatim.
|
|
16
|
+
* Callers own their separators, because whether a format ends in a newline is
|
|
17
|
+
* part of the format.
|
|
18
|
+
* - `aside` is a human line that must never share a channel with a payload, so
|
|
19
|
+
* it survives `sk … --quiet > file`.
|
|
20
|
+
*/
|
|
21
|
+
export interface CliSink {
|
|
22
|
+
/** A human-facing line. The sink adds the newline. */
|
|
23
|
+
line(message: string): void;
|
|
24
|
+
/** Machine-readable output, verbatim — no styling, no added newline. */
|
|
25
|
+
payload(data: string): void;
|
|
26
|
+
/** A human-facing line that must stay off the payload channel. */
|
|
27
|
+
aside(message: string): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The default: a terminal. `line` and `payload` share stdout, which is what
|
|
31
|
+
* makes `aside` necessary — under `--quiet` a caller is redirecting stdout, and
|
|
32
|
+
* an aside written there would end up inside the data.
|
|
33
|
+
*/
|
|
34
|
+
export declare class ConsoleSink implements CliSink {
|
|
35
|
+
line(message: string): void;
|
|
36
|
+
payload(data: string): void;
|
|
37
|
+
aside(message: string): void;
|
|
38
|
+
}
|
|
39
|
+
/** Keeps every write in memory. For tests, and for asserting on output. */
|
|
40
|
+
export declare class MemorySink implements CliSink {
|
|
41
|
+
readonly lines: string[];
|
|
42
|
+
readonly payloads: string[];
|
|
43
|
+
readonly asides: string[];
|
|
44
|
+
line(message: string): void;
|
|
45
|
+
payload(data: string): void;
|
|
46
|
+
aside(message: string): void;
|
|
47
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default: a terminal. `line` and `payload` share stdout, which is what
|
|
3
|
+
* makes `aside` necessary — under `--quiet` a caller is redirecting stdout, and
|
|
4
|
+
* an aside written there would end up inside the data.
|
|
5
|
+
*/
|
|
6
|
+
export class ConsoleSink {
|
|
7
|
+
line(message) {
|
|
8
|
+
process.stdout.write(`${message}\n`);
|
|
9
|
+
}
|
|
10
|
+
payload(data) {
|
|
11
|
+
process.stdout.write(data);
|
|
12
|
+
}
|
|
13
|
+
aside(message) {
|
|
14
|
+
process.stderr.write(`${message}\n`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Keeps every write in memory. For tests, and for asserting on output. */
|
|
18
|
+
export class MemorySink {
|
|
19
|
+
lines = [];
|
|
20
|
+
payloads = [];
|
|
21
|
+
asides = [];
|
|
22
|
+
line(message) {
|
|
23
|
+
this.lines.push(message);
|
|
24
|
+
}
|
|
25
|
+
payload(data) {
|
|
26
|
+
this.payloads.push(data);
|
|
27
|
+
}
|
|
28
|
+
aside(message) {
|
|
29
|
+
this.asides.push(message);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { describe, it } from "mocha";
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { resolve } from "node:path";
|
|
6
|
+
/**
|
|
7
|
+
* The guard for "this process knows which build it is".
|
|
8
|
+
*
|
|
9
|
+
* `sk onboarding` runs for hours, and `dist/` is replaced underneath it by
|
|
10
|
+
* every rebuild. The stamp used to be read lazily on first call, which meant a
|
|
11
|
+
* long-lived process reported whatever was on disk the moment something first
|
|
12
|
+
* asked — a process started at 08:02 named a commit made at 12:40, with
|
|
13
|
+
* `dirty: false` to make it look trustworthy. A run's `meta.json` records that
|
|
14
|
+
* commit, so the opposite of what the field is for.
|
|
15
|
+
*
|
|
16
|
+
* Run in a child process against the built module, because the bug only exists
|
|
17
|
+
* across a rebuild: it cannot be reproduced by calling a function twice in one
|
|
18
|
+
* process unless that process loaded the module before the file changed.
|
|
19
|
+
* `npm test` skips it without a build, the way the stdio guard does.
|
|
20
|
+
*/
|
|
21
|
+
describe("build identity across a rebuild", () => {
|
|
22
|
+
const stamp = resolve("dist/build-info.json");
|
|
23
|
+
const module = resolve("dist/services/cli/build-info.js");
|
|
24
|
+
/**
|
|
25
|
+
* Import the built module, rewrite the stamp, and only *then* ask.
|
|
26
|
+
*
|
|
27
|
+
* The order is the test. Calling `buildInfo()` before the rewrite caches the
|
|
28
|
+
* right answer and the bug disappears — which is exactly what the first
|
|
29
|
+
* version of this spec did, and it passed against the broken implementation.
|
|
30
|
+
* A lazily-read stamp is only wrong when the first call lands after the
|
|
31
|
+
* rebuild, which is the real case: a process started at 08:02 that is first
|
|
32
|
+
* asked something at 13:00.
|
|
33
|
+
*/
|
|
34
|
+
function askAfterRebuild(rewrite) {
|
|
35
|
+
const script = `
|
|
36
|
+
import { writeFileSync } from "node:fs";
|
|
37
|
+
// Imported here, asked below. Nothing may call buildInfo() in between.
|
|
38
|
+
import { buildInfo } from ${JSON.stringify(module)};
|
|
39
|
+
|
|
40
|
+
if (${rewrite}) {
|
|
41
|
+
writeFileSync(${JSON.stringify(stamp)}, JSON.stringify({
|
|
42
|
+
commit: "deadbeef",
|
|
43
|
+
dirty: false,
|
|
44
|
+
buildId: "ffffffffffff",
|
|
45
|
+
builtAt: new Date().toISOString(),
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
process.stdout.write(JSON.stringify({
|
|
50
|
+
reported: { ...buildInfo() },
|
|
51
|
+
}));
|
|
52
|
+
`;
|
|
53
|
+
return JSON.parse(execFileSync(process.execPath, ["--input-type=module", "-e", script], {
|
|
54
|
+
encoding: "utf8",
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
it("should keep naming the build it loaded, not the one on disk", function () {
|
|
58
|
+
if (!existsSync(module) || !existsSync(stamp)) {
|
|
59
|
+
this.skip();
|
|
60
|
+
}
|
|
61
|
+
const original = readFileSync(stamp, "utf8");
|
|
62
|
+
const loaded = JSON.parse(original).buildId;
|
|
63
|
+
try {
|
|
64
|
+
const result = askAfterRebuild(true);
|
|
65
|
+
// The assertion the lazy implementation fails: asked for the first time
|
|
66
|
+
// after the rebuild, it reported the build it had never loaded.
|
|
67
|
+
expect(result.reported.buildId).to.equal(loaded);
|
|
68
|
+
expect(result.reported.buildId).to.not.equal("ffffffffffff");
|
|
69
|
+
expect(result.reported.commit).to.not.equal("deadbeef");
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
writeFileSync(stamp, original);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
it("should restore the stamp it borrowed", function () {
|
|
76
|
+
if (!existsSync(stamp)) {
|
|
77
|
+
this.skip();
|
|
78
|
+
}
|
|
79
|
+
// The case above rewrites a real file in `dist/`. If it leaves it
|
|
80
|
+
// wrong, every later answer about this build is wrong too — so it is worth
|
|
81
|
+
// one assertion rather than trust.
|
|
82
|
+
const current = JSON.parse(readFileSync(stamp, "utf8"));
|
|
83
|
+
expect(current.buildId).to.not.equal("ffffffffffff");
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { describe, it } from "mocha";
|
|
3
|
+
import { buildLabel } from "../build-info.js";
|
|
4
|
+
describe("buildLabel", () => {
|
|
5
|
+
it("should name a build even where the stamp is missing", () => {
|
|
6
|
+
// A tarball install has no git and a build predating the stamp has no
|
|
7
|
+
// file. Reporting the bare version is honest; inventing a commit is not.
|
|
8
|
+
expect(buildLabel("4.28.0")).to.be.a("string").and.contain("4.28.0");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
};
|