@speedkit/cli 4.50.4 → 4.51.0-run-control.1
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 +1369 -10
- 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 +6 -1
- package/dist/commands/diff.js +9 -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 +93 -0
- package/dist/commands/onboarding/browser/emulate.js +23 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +67 -0
- package/dist/commands/onboarding/browser/navigate.js +18 -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 +77 -0
- package/dist/commands/onboarding/debug/arm.js +18 -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 +256 -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/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 +220 -3
- 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 +8 -0
- package/dist/services/diff/diff-service-build-context.js +40 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +48 -20
- 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/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/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/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/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/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 +521 -0
- package/dist/services/onboarding/control/browser-session.js +1273 -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 +1390 -0
- package/dist/services/onboarding/control/control-protocol.js +69 -0
- package/dist/services/onboarding/control/control-server.d.ts +284 -0
- package/dist/services/onboarding/control/control-server.js +1609 -0
- package/dist/services/onboarding/control/debug-session.d.ts +190 -0
- package/dist/services/onboarding/control/debug-session.js +801 -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/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 +119 -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 +149 -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 +94 -32
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +4 -25
- 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/html-charset.d.ts +28 -0
- package/dist/services/onboarding/html-charset.js +57 -0
- package/dist/services/onboarding/onboarding-model.d.ts +30 -1
- package/dist/services/onboarding/onboarding-model.js +10 -1
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +6 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +131 -17
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +135 -22
- 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/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 +526 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +338 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +693 -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/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 +172 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +202 -0
- package/dist/services/onboarding/spec/fetch-events/customer-domain-document-response.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-events/customer-domain-document-response.spec.js +39 -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/html-charset.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/html-charset.spec.js +58 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +37 -0
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +1 -0
- 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/index.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/index.spec.js +19 -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 +34 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +85 -53
- 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.js +9 -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 +541 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +78 -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 +64 -0
- package/dist/services/run-control/browser/run-browser-service.js +199 -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 +411 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +44 -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 +38 -0
- package/dist/services/run-control/debug/run-debug-service.js +161 -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 +32 -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 +203 -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 +193 -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 +25 -0
- package/dist/services/run-control/session/run-session-service.js +95 -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 +224 -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 +101 -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 +80 -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 +150 -0
- package/dist/services/run-registry/run-registry.js +409 -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 +509 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3293 -272
- package/package.json +21 -3
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ChalkInstance } from "chalk";
|
|
2
2
|
import { Options } from "cli-progress";
|
|
3
3
|
import { CliServiceInterface, CliTableColumns } from "./cli-service-model.js";
|
|
4
|
+
import { LogLevel, LogMeta, RunLogInterface } from "../run-log/index.js";
|
|
4
5
|
import { ClipboardService } from "./clipboard/index.js";
|
|
5
6
|
import type { CliEnvironment } from "./cli-environment.js";
|
|
7
|
+
import { CliSink } from "./sink.js";
|
|
6
8
|
import { ExecSyncOptions } from "node:child_process";
|
|
7
9
|
/** What the CLI needs to know about where it runs. */
|
|
8
10
|
export type CliTerminal = Pick<CliEnvironment, "isCI" | "nonInteractive">;
|
|
@@ -10,6 +12,7 @@ export declare class CliService implements CliServiceInterface {
|
|
|
10
12
|
private readonly clipboard;
|
|
11
13
|
private readonly terminal;
|
|
12
14
|
readonly quiet: boolean;
|
|
15
|
+
private readonly sink;
|
|
13
16
|
style: ChalkInstance;
|
|
14
17
|
private buffer;
|
|
15
18
|
private progressBar?;
|
|
@@ -26,6 +29,8 @@ export declare class CliService implements CliServiceInterface {
|
|
|
26
29
|
private readonly animates;
|
|
27
30
|
/** The text of each running action, for the log line that replaces it. */
|
|
28
31
|
private readonly actions;
|
|
32
|
+
/** Where a structured copy of the output goes, once a run owns one. */
|
|
33
|
+
private log?;
|
|
29
34
|
/**
|
|
30
35
|
* True when this shell cannot be asked a question: CI, no TTY on either end,
|
|
31
36
|
* or SK_NON_INTERACTIVE. Callers that would otherwise block on a prompt check
|
|
@@ -33,15 +38,54 @@ export declare class CliService implements CliServiceInterface {
|
|
|
33
38
|
* than being re-derived wherever a prompt happens to be.
|
|
34
39
|
*/
|
|
35
40
|
get nonInteractive(): boolean;
|
|
36
|
-
constructor(clipboard: ClipboardService, terminal: CliTerminal, quiet?: boolean);
|
|
37
|
-
|
|
41
|
+
constructor(clipboard: ClipboardService, terminal: CliTerminal, quiet?: boolean, sink?: CliSink);
|
|
42
|
+
/**
|
|
43
|
+
* Put the terminal back the way it was found.
|
|
44
|
+
*
|
|
45
|
+
* Spinnies hides the cursor while a spinner runs and shows it again only
|
|
46
|
+
* when the last one ends. A shutdown that happens mid-spinner would otherwise
|
|
47
|
+
* leave the user with an invisible cursor — which is what spinnies' own
|
|
48
|
+
* SIGINT handler existed to prevent, and that handler is gone for the reasons
|
|
49
|
+
* in {@link createSpinners}. Owning the cleanup is the price of owning the
|
|
50
|
+
* signal.
|
|
51
|
+
*/
|
|
52
|
+
restoreTerminal(): void;
|
|
53
|
+
attachLog(log: RunLogInterface): void;
|
|
54
|
+
logOnly(level: LogLevel, message: string, meta?: LogMeta): void;
|
|
55
|
+
/**
|
|
56
|
+
* Record one line, if a run is listening.
|
|
57
|
+
*
|
|
58
|
+
* Everything the CLI prints goes through here as well as through the sink,
|
|
59
|
+
* which is what makes the log a copy of the session rather than a second
|
|
60
|
+
* account of it. The level comes from the method that was called — a
|
|
61
|
+
* `writeWarning` is a `warn` — and a caller that knows better overrides it in
|
|
62
|
+
* `meta`.
|
|
63
|
+
*
|
|
64
|
+
* **Deliberately upstream of `quiet`.** A quiet run prints nothing and still
|
|
65
|
+
* happened; the log is not the terminal, and a `--quiet` session with an
|
|
66
|
+
* empty log would be the most misleading file in the directory.
|
|
67
|
+
*/
|
|
68
|
+
private record;
|
|
69
|
+
code(code: string, buffered?: boolean, meta?: LogMeta): void;
|
|
38
70
|
codeStyle(code: string): string;
|
|
39
|
-
comment(message: string, buffered?: boolean): void;
|
|
71
|
+
comment(message: string, buffered?: boolean, meta?: LogMeta): void;
|
|
40
72
|
confirm(message: string, defaultAnswer?: boolean): Promise<boolean>;
|
|
73
|
+
/**
|
|
74
|
+
* A question that is now on screen, waiting.
|
|
75
|
+
*
|
|
76
|
+
* Logged before the answer exists, and again once it arrives, because an
|
|
77
|
+
* append-only file cannot go back and fill one in — and a run that died
|
|
78
|
+
* waiting at a prompt is exactly the run whose log has to show the question.
|
|
79
|
+
* The cost is two lines per prompt; the alternative is a log that ends in
|
|
80
|
+
* silence with no indication that anything was being asked.
|
|
81
|
+
*/
|
|
82
|
+
private asked;
|
|
83
|
+
private answered;
|
|
41
84
|
exit(code?: number): void;
|
|
42
85
|
prompt(message: string, options?: {
|
|
43
86
|
defaultAnswer?: any;
|
|
44
87
|
validator?: any;
|
|
88
|
+
sensitive?: boolean;
|
|
45
89
|
}): Promise<string>;
|
|
46
90
|
select(message: string, choices: any, defaultValue?: string): Promise<string>;
|
|
47
91
|
multiSelect<T>(message: string, choices: {
|
|
@@ -80,10 +124,10 @@ export declare class CliService implements CliServiceInterface {
|
|
|
80
124
|
*/
|
|
81
125
|
note(message: string): void;
|
|
82
126
|
spacer(): void;
|
|
83
|
-
startAction(name: string, message: string): void;
|
|
84
|
-
endAction(name: string, message?: string): void;
|
|
85
|
-
failAction(name: string, message?: string): void;
|
|
86
|
-
successAction(name: string, message?: string): void;
|
|
127
|
+
startAction(name: string, message: string, meta?: LogMeta): void;
|
|
128
|
+
endAction(name: string, message?: string, meta?: LogMeta): void;
|
|
129
|
+
failAction(name: string, message?: string, meta?: LogMeta): void;
|
|
130
|
+
successAction(name: string, message?: string, meta?: LogMeta): void;
|
|
87
131
|
/**
|
|
88
132
|
* One line for an action that ended, where a spinner cannot be drawn. The
|
|
89
133
|
* text comes from the action that started, so a caller that ends one without
|
|
@@ -94,11 +138,16 @@ export declare class CliService implements CliServiceInterface {
|
|
|
94
138
|
updateProgress(current: number, payload?: object): void;
|
|
95
139
|
stopProgress(): void;
|
|
96
140
|
table<T extends Record<string, unknown>>(data: T[], columns: CliTableColumns<T>): void;
|
|
97
|
-
write(message: string, buffered?: boolean): void;
|
|
141
|
+
write(message: string, buffered?: boolean, meta?: LogMeta): void;
|
|
142
|
+
/**
|
|
143
|
+
* Flush what was buffered. Nothing is recorded here: each line was logged
|
|
144
|
+
* with its own level when it was buffered, and logging the joined block
|
|
145
|
+
* again would report a page of mixed warnings and successes as one `info`.
|
|
146
|
+
*/
|
|
98
147
|
writeBuffer(): void;
|
|
99
|
-
writeError(message: string, buffered?: boolean): void;
|
|
100
|
-
writeSuccess(message: string, buffered?: boolean): void;
|
|
101
|
-
writeWarning(message: string, buffered?: boolean): void;
|
|
148
|
+
writeError(message: string, buffered?: boolean, meta?: LogMeta): void;
|
|
149
|
+
writeSuccess(message: string, buffered?: boolean, meta?: LogMeta): void;
|
|
150
|
+
writeWarning(message: string, buffered?: boolean, meta?: LogMeta): void;
|
|
102
151
|
execSync(command: string, options?: ExecSyncOptions): string;
|
|
103
152
|
private getFormattedMessage;
|
|
104
153
|
}
|
|
@@ -3,9 +3,12 @@ import { Chalk } from "chalk";
|
|
|
3
3
|
import Table from "tty-table";
|
|
4
4
|
import { Presets, SingleBar } from "cli-progress";
|
|
5
5
|
import Spinnies from "spinnies";
|
|
6
|
+
import { ConsoleSink } from "./sink.js";
|
|
6
7
|
import { safe } from "../../helpers/safe.js";
|
|
7
8
|
import { execSync } from "node:child_process";
|
|
8
9
|
import ApplicationError from "../error-handling/error/application-error.js";
|
|
10
|
+
/** How many table rows reach the log. A terminal table is never longer than this. */
|
|
11
|
+
const TABLE_ROWS = 100;
|
|
9
12
|
/** The padding and the gutter that a table draws inside every column. */
|
|
10
13
|
const CELL_OVERHEAD = 3;
|
|
11
14
|
/** The left margin and the outer borders of a table. */
|
|
@@ -43,10 +46,38 @@ function columnWidths(entries, rows) {
|
|
|
43
46
|
}
|
|
44
47
|
return widths;
|
|
45
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Construct Spinnies without letting it take SIGINT.
|
|
51
|
+
*
|
|
52
|
+
* Its constructor calls `bindSigint()` unconditionally, and that begins with
|
|
53
|
+
* `process.removeAllListeners("SIGINT")` before installing one that calls
|
|
54
|
+
* `process.exit(0)`. There is no option to turn it off. So a CLI that
|
|
55
|
+
* registered a SIGINT handler — `sk onboarding` does, before the browser
|
|
56
|
+
* launches — silently loses it the moment anything constructs a CliService,
|
|
57
|
+
* and its shutdown is replaced by a bare exit. That cost three test sessions to
|
|
58
|
+
* find, because every symptom pointed at the CLI's own handler being wrong.
|
|
59
|
+
*
|
|
60
|
+
* Registering later cannot help: `removeAllListeners` deletes whatever exists
|
|
61
|
+
* at that moment. So the listeners are snapshotted and put back, and spinnies'
|
|
62
|
+
* own is dropped. `rawListeners` rather than `listeners`, so a `once`
|
|
63
|
+
* registration goes back as a `once`.
|
|
64
|
+
*/
|
|
65
|
+
function createSpinners() {
|
|
66
|
+
const ours = process.rawListeners("SIGINT");
|
|
67
|
+
const spinners = new Spinnies();
|
|
68
|
+
for (const listener of process.rawListeners("SIGINT")) {
|
|
69
|
+
process.off("SIGINT", listener);
|
|
70
|
+
}
|
|
71
|
+
for (const listener of ours) {
|
|
72
|
+
process.on("SIGINT", listener);
|
|
73
|
+
}
|
|
74
|
+
return spinners;
|
|
75
|
+
}
|
|
46
76
|
export class CliService {
|
|
47
77
|
clipboard;
|
|
48
78
|
terminal;
|
|
49
79
|
quiet;
|
|
80
|
+
sink;
|
|
50
81
|
style;
|
|
51
82
|
buffer = [];
|
|
52
83
|
progressBar;
|
|
@@ -63,6 +94,8 @@ export class CliService {
|
|
|
63
94
|
animates;
|
|
64
95
|
/** The text of each running action, for the log line that replaces it. */
|
|
65
96
|
actions = new Map();
|
|
97
|
+
/** Where a structured copy of the output goes, once a run owns one. */
|
|
98
|
+
log;
|
|
66
99
|
/**
|
|
67
100
|
* True when this shell cannot be asked a question: CI, no TTY on either end,
|
|
68
101
|
* or SK_NON_INTERACTIVE. Callers that would otherwise block on a prompt check
|
|
@@ -72,51 +105,138 @@ export class CliService {
|
|
|
72
105
|
get nonInteractive() {
|
|
73
106
|
return this.terminal.nonInteractive;
|
|
74
107
|
}
|
|
75
|
-
constructor(clipboard, terminal, quiet = false) {
|
|
108
|
+
constructor(clipboard, terminal, quiet = false, sink = new ConsoleSink()) {
|
|
76
109
|
this.clipboard = clipboard;
|
|
77
110
|
this.terminal = terminal;
|
|
78
111
|
this.quiet = quiet;
|
|
112
|
+
this.sink = sink;
|
|
79
113
|
this.animates = Boolean(!terminal.isCI && process.stderr && process.stderr.isTTY);
|
|
80
|
-
this.spinners =
|
|
114
|
+
this.spinners = createSpinners();
|
|
81
115
|
this.style = new Chalk();
|
|
82
116
|
}
|
|
83
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Put the terminal back the way it was found.
|
|
119
|
+
*
|
|
120
|
+
* Spinnies hides the cursor while a spinner runs and shows it again only
|
|
121
|
+
* when the last one ends. A shutdown that happens mid-spinner would otherwise
|
|
122
|
+
* leave the user with an invisible cursor — which is what spinnies' own
|
|
123
|
+
* SIGINT handler existed to prevent, and that handler is gone for the reasons
|
|
124
|
+
* in {@link createSpinners}. Owning the cleanup is the price of owning the
|
|
125
|
+
* signal.
|
|
126
|
+
*/
|
|
127
|
+
restoreTerminal() {
|
|
128
|
+
if (this.animates) {
|
|
129
|
+
this.spinners.stopAll();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
attachLog(log) {
|
|
133
|
+
this.log = log;
|
|
134
|
+
}
|
|
135
|
+
logOnly(level, message, meta) {
|
|
136
|
+
this.record(level, message, meta);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Record one line, if a run is listening.
|
|
140
|
+
*
|
|
141
|
+
* Everything the CLI prints goes through here as well as through the sink,
|
|
142
|
+
* which is what makes the log a copy of the session rather than a second
|
|
143
|
+
* account of it. The level comes from the method that was called — a
|
|
144
|
+
* `writeWarning` is a `warn` — and a caller that knows better overrides it in
|
|
145
|
+
* `meta`.
|
|
146
|
+
*
|
|
147
|
+
* **Deliberately upstream of `quiet`.** A quiet run prints nothing and still
|
|
148
|
+
* happened; the log is not the terminal, and a `--quiet` session with an
|
|
149
|
+
* empty log would be the most misleading file in the directory.
|
|
150
|
+
*/
|
|
151
|
+
record(level, message, meta, extra) {
|
|
152
|
+
this.log?.event({
|
|
153
|
+
level: meta?.level ?? level,
|
|
154
|
+
scope: meta?.scope,
|
|
155
|
+
msg: message,
|
|
156
|
+
data: meta?.data,
|
|
157
|
+
...extra,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
code(code, buffered = false, meta) {
|
|
161
|
+
this.record("info", code, meta);
|
|
84
162
|
code = ` ${code} `;
|
|
85
163
|
if (buffered) {
|
|
86
164
|
this.buffer.push(this.style.bgBlack.white(code));
|
|
87
165
|
return;
|
|
88
166
|
}
|
|
89
|
-
|
|
167
|
+
this.sink.line(this.style.bgBlack.white(code));
|
|
90
168
|
}
|
|
91
169
|
codeStyle(code) {
|
|
92
170
|
const padding = " ";
|
|
93
171
|
return this.style.bgGray.rgb(230, 126, 0)(`${padding}${code}${padding}`);
|
|
94
172
|
}
|
|
95
|
-
comment(message, buffered = false) {
|
|
173
|
+
comment(message, buffered = false, meta) {
|
|
174
|
+
this.record("info", message, meta);
|
|
96
175
|
if (buffered) {
|
|
97
176
|
this.buffer.push(this.style.grey.italic(message));
|
|
98
177
|
return;
|
|
99
178
|
}
|
|
100
|
-
|
|
179
|
+
// Straight to the sink rather than through `write`, which would record the
|
|
180
|
+
// same line a second time — once as a comment and once as a bare write.
|
|
181
|
+
this.sink.line(this.style.grey.italic(message));
|
|
101
182
|
}
|
|
102
183
|
async confirm(message, defaultAnswer = true) {
|
|
103
184
|
if (this.quiet) {
|
|
185
|
+
this.answered("confirm", message, defaultAnswer, { defaulted: true });
|
|
104
186
|
return defaultAnswer;
|
|
105
187
|
}
|
|
106
|
-
|
|
188
|
+
this.asked("confirm", message);
|
|
189
|
+
const answer = await confirm({
|
|
107
190
|
default: defaultAnswer,
|
|
108
191
|
message: this.getFormattedMessage(message),
|
|
109
192
|
});
|
|
193
|
+
this.answered("confirm", message, answer);
|
|
194
|
+
return answer;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* A question that is now on screen, waiting.
|
|
198
|
+
*
|
|
199
|
+
* Logged before the answer exists, and again once it arrives, because an
|
|
200
|
+
* append-only file cannot go back and fill one in — and a run that died
|
|
201
|
+
* waiting at a prompt is exactly the run whose log has to show the question.
|
|
202
|
+
* The cost is two lines per prompt; the alternative is a log that ends in
|
|
203
|
+
* silence with no indication that anything was being asked.
|
|
204
|
+
*/
|
|
205
|
+
asked(kind, question) {
|
|
206
|
+
this.record("info", question, undefined, {
|
|
207
|
+
interaction: { kind, question, pending: true },
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
answered(kind, question, answer, options) {
|
|
211
|
+
this.record("info", question, undefined, {
|
|
212
|
+
interaction: {
|
|
213
|
+
kind,
|
|
214
|
+
question,
|
|
215
|
+
answer: options?.sensitive ? undefined : answer,
|
|
216
|
+
...options,
|
|
217
|
+
},
|
|
218
|
+
});
|
|
110
219
|
}
|
|
111
220
|
exit(code = 0) {
|
|
112
221
|
process.exit(code);
|
|
113
222
|
}
|
|
114
223
|
async prompt(message, options) {
|
|
224
|
+
// `sensitive` is declared here, by the caller collecting the value, and
|
|
225
|
+
// never inferred from the wording of the question. A redactor that guessed
|
|
226
|
+
// would eventually guess wrong in the direction that writes a password to
|
|
227
|
+
// disk, and this file is read by agents.
|
|
228
|
+
const sensitive = Boolean(options?.sensitive);
|
|
115
229
|
if (this.quiet) {
|
|
116
|
-
|
|
230
|
+
const defaulted = options?.defaultAnswer || "";
|
|
231
|
+
this.answered("prompt", message, defaulted, {
|
|
232
|
+
defaulted: true,
|
|
233
|
+
sensitive,
|
|
234
|
+
});
|
|
235
|
+
return defaulted;
|
|
117
236
|
}
|
|
118
237
|
const { defaultAnswer, validator } = options;
|
|
119
|
-
|
|
238
|
+
this.asked("prompt", message);
|
|
239
|
+
const answer = await input({
|
|
120
240
|
default: defaultAnswer,
|
|
121
241
|
message: this.getFormattedMessage(message),
|
|
122
242
|
validate: (input) => {
|
|
@@ -129,25 +249,37 @@ export class CliService {
|
|
|
129
249
|
return this.style.red(`${errorMessage}. Please try again.`);
|
|
130
250
|
},
|
|
131
251
|
});
|
|
252
|
+
this.answered("prompt", message, answer, { sensitive });
|
|
253
|
+
return answer;
|
|
132
254
|
}
|
|
133
255
|
async select(message, choices, defaultValue) {
|
|
134
|
-
|
|
256
|
+
this.asked("select", message);
|
|
257
|
+
// `choices` is untyped here, so inquirer infers `unknown` for the answer;
|
|
258
|
+
// the signature has always promised a string and the callers rely on it.
|
|
259
|
+
const answer = (await select({
|
|
135
260
|
choices,
|
|
136
261
|
default: defaultValue,
|
|
137
262
|
message: this.getFormattedMessage(message),
|
|
138
|
-
});
|
|
263
|
+
}));
|
|
264
|
+
this.answered("select", message, answer);
|
|
265
|
+
return answer;
|
|
139
266
|
}
|
|
140
267
|
async multiSelect(message, choices, validate) {
|
|
141
268
|
if (this.quiet) {
|
|
142
|
-
|
|
269
|
+
const defaulted = choices.filter((c) => c.checked).map((c) => c.value);
|
|
270
|
+
this.answered("multiSelect", message, defaulted, { defaulted: true });
|
|
271
|
+
return defaulted;
|
|
143
272
|
}
|
|
144
|
-
|
|
273
|
+
this.asked("multiSelect", message);
|
|
274
|
+
const answer = await checkbox({
|
|
145
275
|
choices,
|
|
146
276
|
message: this.getFormattedMessage(message),
|
|
147
277
|
validate: validate
|
|
148
278
|
? (chosen) => validate(chosen.map((choice) => choice.value))
|
|
149
279
|
: undefined,
|
|
150
280
|
});
|
|
281
|
+
this.answered("multiSelect", message, answer);
|
|
282
|
+
return answer;
|
|
151
283
|
}
|
|
152
284
|
/**
|
|
153
285
|
* Put text on the system clipboard.
|
|
@@ -173,7 +305,12 @@ export class CliService {
|
|
|
173
305
|
* for a terminal) or `note` (stderr, alongside a payload).
|
|
174
306
|
*/
|
|
175
307
|
pipe(data) {
|
|
176
|
-
|
|
308
|
+
// The payload itself is not logged. It is a result, not narration, and it
|
|
309
|
+
// is routinely a whole SQL query or a config file — the log records that
|
|
310
|
+
// one was produced and how big it was, and the caller redirecting stdout
|
|
311
|
+
// already has the bytes.
|
|
312
|
+
this.record("debug", `payload written (${data.length} bytes)`);
|
|
313
|
+
this.sink.payload(data);
|
|
177
314
|
}
|
|
178
315
|
/**
|
|
179
316
|
* A human-facing line that must stay out of the data channel.
|
|
@@ -182,12 +319,15 @@ export class CliService {
|
|
|
182
319
|
* being redirected — and so it can never corrupt the payload.
|
|
183
320
|
*/
|
|
184
321
|
note(message) {
|
|
185
|
-
|
|
322
|
+
this.sink.aside(message);
|
|
186
323
|
}
|
|
187
324
|
spacer() {
|
|
188
|
-
|
|
325
|
+
this.sink.line("");
|
|
189
326
|
}
|
|
190
|
-
startAction(name, message) {
|
|
327
|
+
startAction(name, message, meta) {
|
|
328
|
+
this.record("info", message, meta, {
|
|
329
|
+
action: { name, state: "start" },
|
|
330
|
+
});
|
|
191
331
|
if (this.quiet) {
|
|
192
332
|
return;
|
|
193
333
|
}
|
|
@@ -199,7 +339,10 @@ export class CliService {
|
|
|
199
339
|
}
|
|
200
340
|
this.spinners.add(name, { text: message });
|
|
201
341
|
}
|
|
202
|
-
endAction(name, message) {
|
|
342
|
+
endAction(name, message, meta) {
|
|
343
|
+
this.record("info", message ?? this.actions.get(name) ?? name, meta, {
|
|
344
|
+
action: { name, state: "end" },
|
|
345
|
+
});
|
|
203
346
|
if (this.quiet) {
|
|
204
347
|
return;
|
|
205
348
|
}
|
|
@@ -212,7 +355,10 @@ export class CliService {
|
|
|
212
355
|
}
|
|
213
356
|
this.spinners.update(name, { status: "stopped", text: message });
|
|
214
357
|
}
|
|
215
|
-
failAction(name, message) {
|
|
358
|
+
failAction(name, message, meta) {
|
|
359
|
+
this.record("error", message ?? this.actions.get(name) ?? name, meta, {
|
|
360
|
+
action: { name, state: "fail" },
|
|
361
|
+
});
|
|
216
362
|
if (this.quiet) {
|
|
217
363
|
return;
|
|
218
364
|
}
|
|
@@ -225,7 +371,10 @@ export class CliService {
|
|
|
225
371
|
}
|
|
226
372
|
this.spinners.fail(name, { text: message });
|
|
227
373
|
}
|
|
228
|
-
successAction(name, message) {
|
|
374
|
+
successAction(name, message, meta) {
|
|
375
|
+
this.record("success", message ?? this.actions.get(name) ?? name, meta, {
|
|
376
|
+
action: { name, state: "success" },
|
|
377
|
+
});
|
|
229
378
|
if (this.quiet) {
|
|
230
379
|
return;
|
|
231
380
|
}
|
|
@@ -248,7 +397,7 @@ export class CliService {
|
|
|
248
397
|
if (!this.actions.delete(name) && !message) {
|
|
249
398
|
return;
|
|
250
399
|
}
|
|
251
|
-
|
|
400
|
+
this.sink.line(`${symbol} ${text}`);
|
|
252
401
|
}
|
|
253
402
|
startProgress(total, start = 0, payload, config) {
|
|
254
403
|
if (this.quiet) {
|
|
@@ -270,6 +419,12 @@ export class CliService {
|
|
|
270
419
|
this.progressBar.stop();
|
|
271
420
|
}
|
|
272
421
|
table(data, columns) {
|
|
422
|
+
// The rows go in as data, not as the rendered grid: box-drawing characters
|
|
423
|
+
// and column padding are for a terminal, and anything reading the log wants
|
|
424
|
+
// the values. Capped, because a table is occasionally a whole url list.
|
|
425
|
+
this.record("info", `table of ${data.length} rows`, {
|
|
426
|
+
data: { columns: Object.keys(columns), rows: data.slice(0, TABLE_ROWS) },
|
|
427
|
+
});
|
|
273
428
|
this.spacer();
|
|
274
429
|
const entries = Object.entries(columns);
|
|
275
430
|
const rows = data.map((row) => entries.map(([key, col]) => String(col?.get ? col.get(row) : (row[key] ?? ""))));
|
|
@@ -282,41 +437,50 @@ export class CliService {
|
|
|
282
437
|
width: widths[index],
|
|
283
438
|
}));
|
|
284
439
|
const t = Table(header, rows, { compact: true });
|
|
285
|
-
|
|
440
|
+
this.sink.line(t.render());
|
|
286
441
|
this.spacer();
|
|
287
442
|
}
|
|
288
|
-
write(message, buffered = false) {
|
|
443
|
+
write(message, buffered = false, meta) {
|
|
444
|
+
this.record("info", message, meta);
|
|
289
445
|
if (buffered) {
|
|
290
446
|
this.buffer.push(this.style.white(message));
|
|
291
447
|
return;
|
|
292
448
|
}
|
|
293
|
-
|
|
449
|
+
this.sink.line(message);
|
|
294
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* Flush what was buffered. Nothing is recorded here: each line was logged
|
|
453
|
+
* with its own level when it was buffered, and logging the joined block
|
|
454
|
+
* again would report a page of mixed warnings and successes as one `info`.
|
|
455
|
+
*/
|
|
295
456
|
writeBuffer() {
|
|
296
|
-
|
|
297
|
-
|
|
457
|
+
this.sink.line(this.buffer.join(`\n`));
|
|
458
|
+
this.sink.line("");
|
|
298
459
|
this.buffer = [];
|
|
299
460
|
}
|
|
300
|
-
writeError(message, buffered = false) {
|
|
461
|
+
writeError(message, buffered = false, meta) {
|
|
462
|
+
this.record("error", message, meta);
|
|
301
463
|
if (buffered) {
|
|
302
464
|
this.buffer.push(this.style.red(message));
|
|
303
465
|
return;
|
|
304
466
|
}
|
|
305
|
-
this.
|
|
467
|
+
this.sink.line(this.style.red(message));
|
|
306
468
|
}
|
|
307
|
-
writeSuccess(message, buffered = false) {
|
|
469
|
+
writeSuccess(message, buffered = false, meta) {
|
|
470
|
+
this.record("success", message, meta);
|
|
308
471
|
if (buffered) {
|
|
309
472
|
this.buffer.push(this.style.green(message));
|
|
310
473
|
return;
|
|
311
474
|
}
|
|
312
|
-
this.
|
|
475
|
+
this.sink.line(this.style.green(message));
|
|
313
476
|
}
|
|
314
|
-
writeWarning(message, buffered = false) {
|
|
477
|
+
writeWarning(message, buffered = false, meta) {
|
|
478
|
+
this.record("warn", message, meta);
|
|
315
479
|
if (buffered) {
|
|
316
480
|
this.buffer.push(this.style.yellow(message));
|
|
317
481
|
return;
|
|
318
482
|
}
|
|
319
|
-
this.
|
|
483
|
+
this.sink.line(this.style.yellow(message));
|
|
320
484
|
}
|
|
321
485
|
execSync(command, options) {
|
|
322
486
|
const result = safe(() => {
|
|
@@ -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 {};
|