@speedkit/cli 4.35.1 → 4.36.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.
Files changed (349) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +43 -34
  3. package/dist/commands/auto-prewarm.js +1 -1
  4. package/dist/commands/browser/clean.js +1 -2
  5. package/dist/commands/browser/list.js +1 -2
  6. package/dist/commands/browser/update.js +1 -2
  7. package/dist/commands/bulk-deploy.d.ts +19 -0
  8. package/dist/commands/bulk-deploy.js +52 -0
  9. package/dist/commands/config/setup.js +4 -3
  10. package/dist/commands/deploy.d.ts +2 -0
  11. package/dist/commands/deploy.js +34 -3
  12. package/dist/commands/diff-url-parameters.d.ts +2 -2
  13. package/dist/commands/diff-url-parameters.js +12 -5
  14. package/dist/commands/extension/add.js +1 -1
  15. package/dist/commands/extension/devtools.js +1 -1
  16. package/dist/commands/extension/list.js +1 -1
  17. package/dist/commands/extension/remove.js +1 -1
  18. package/dist/commands/extension/update.js +1 -1
  19. package/dist/commands/find-pops.js +3 -2
  20. package/dist/commands/generate-pop-config.js +9 -13
  21. package/dist/commands/onboarding.js +1 -1
  22. package/dist/commands/origin-request.js +1 -1
  23. package/dist/commands/pull.js +1 -1
  24. package/dist/commands/revalidate.js +4 -3
  25. package/dist/commands/wpt-launcher.js +3 -2
  26. package/dist/helpers/{chrome-flags.spec.js → spec/chrome-flags.spec.js} +1 -1
  27. package/dist/helpers/{origin-proxy.spec.js → spec/origin-proxy.spec.js} +1 -1
  28. package/dist/hooks/init/first-run.js +3 -3
  29. package/dist/hooks/{init → spec/init}/dns-result-order.spec.js +1 -1
  30. package/dist/hooks/{init → spec/init}/http1-global-dispatcher.spec.js +1 -1
  31. package/dist/models/cli-parameters.d.ts +0 -2
  32. package/dist/models/cli-parameters.js +0 -2
  33. package/dist/models/{cli-parameters.spec.js → spec/cli-parameters.spec.js} +1 -1
  34. package/dist/services/athena/athena-service-factory.d.ts +3 -1
  35. package/dist/services/athena/athena-service-factory.js +4 -2
  36. package/dist/services/athena/{athena-service.spec.js → spec/athena-service.spec.js} +1 -1
  37. package/dist/services/athena/{baqend-athena-service.spec.js → spec/baqend-athena-service.spec.js} +2 -2
  38. package/dist/services/browser-fetch/browser-origin-fetch.d.ts +1 -1
  39. package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +1 -1
  40. package/dist/services/browser-fetch/{browser-origin-fetch.spec.js → spec/browser-origin-fetch.spec.js} +2 -2
  41. package/dist/services/browser-fetch/{browser-origin-fetcher.spec.js → spec/browser-origin-fetcher.spec.js} +1 -1
  42. package/dist/services/browser-fetch/{browser-response.spec.js → spec/browser-response.spec.js} +1 -1
  43. package/dist/services/browser-fetch/{device-emulation.spec.js → spec/device-emulation.spec.js} +2 -2
  44. package/dist/services/bundler/{bundle-service.spec.js → spec/bundle-service.spec.js} +1 -1
  45. package/dist/{helpers → services/cli}/cli-config.js +1 -1
  46. package/dist/services/cli/cli-service-factory.d.ts +10 -2
  47. package/dist/services/cli/cli-service-factory.js +11 -9
  48. package/dist/services/cli/cli-service-model.d.ts +10 -2
  49. package/dist/services/cli/cli-service.d.ts +37 -0
  50. package/dist/services/cli/cli-service.js +90 -3
  51. package/dist/{helpers/clipboard.d.ts → services/cli/clipboard/clipboard-service.d.ts} +3 -1
  52. package/dist/{helpers/clipboard.js → services/cli/clipboard/clipboard-service.js} +6 -1
  53. package/dist/services/cli/clipboard/index.d.ts +1 -0
  54. package/dist/services/cli/clipboard/index.js +1 -0
  55. package/dist/services/cli/index.d.ts +1 -0
  56. package/dist/services/cli/index.js +1 -0
  57. package/dist/{helpers → services/cli/spec}/cli-config.spec.js +1 -1
  58. package/dist/services/cli/{cli-service.spec.js → spec/cli-service.spec.js} +42 -1
  59. package/dist/{helpers → services/cli/spec}/environment.spec.js +1 -1
  60. package/dist/services/customer-config/customer-config-service-factory.d.ts +3 -1
  61. package/dist/services/customer-config/customer-config-service-factory.js +7 -3
  62. package/dist/services/customer-config/customer-config-service.d.ts +4 -2
  63. package/dist/services/customer-config/customer-config-service.js +4 -3
  64. package/dist/services/customer-config/site-analyzer/index.d.ts +3 -0
  65. package/dist/services/customer-config/site-analyzer/index.js +3 -0
  66. package/dist/{helpers/site-analyzer.d.ts → services/customer-config/site-analyzer/site-analyzer-model.d.ts} +0 -1
  67. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.d.ts +7 -0
  68. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.js +11 -0
  69. package/dist/services/customer-config/site-analyzer/site-analyzer-service.d.ts +16 -0
  70. package/dist/{helpers/site-analyzer.js → services/customer-config/site-analyzer/site-analyzer-service.js} +20 -5
  71. package/dist/services/deploy/bulk/bulk-deploy-model.d.ts +46 -0
  72. package/dist/services/deploy/bulk/bulk-deploy-model.js +27 -0
  73. package/dist/services/deploy/bulk/bulk-deploy-service-factory.d.ts +11 -0
  74. package/dist/services/deploy/bulk/bulk-deploy-service-factory.js +24 -0
  75. package/dist/services/deploy/bulk/bulk-deploy-service.d.ts +47 -0
  76. package/dist/services/deploy/bulk/bulk-deploy-service.js +201 -0
  77. package/dist/services/deploy/bulk/config-deploy-factory.d.ts +13 -0
  78. package/dist/services/deploy/bulk/config-deploy-factory.js +20 -0
  79. package/dist/services/deploy/bulk/index.d.ts +5 -0
  80. package/dist/services/deploy/bulk/index.js +5 -0
  81. package/dist/services/deploy/bulk/touched-configs.d.ts +12 -0
  82. package/dist/services/deploy/bulk/touched-configs.js +54 -0
  83. package/dist/services/deploy/checks/activation/customer-approval-check.d.ts +3 -1
  84. package/dist/services/deploy/checks/activation/customer-approval-check.js +5 -2
  85. package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.d.ts +4 -2
  86. package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.js +6 -3
  87. package/dist/services/deploy/checks/post-deploy/refresh-deployment-job-check.d.ts +2 -2
  88. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +2 -2
  89. package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +4 -2
  90. package/dist/services/deploy/checks/post-deploy/save-files-check.js +5 -2
  91. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.d.ts +3 -1
  92. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +9 -5
  93. package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -1
  94. package/dist/services/deploy/checks/pre-deploy/split-change-check.js +8 -5
  95. package/dist/services/deploy/context/deploy-context.d.ts +21 -1
  96. package/dist/services/deploy/context/deploy-context.js +30 -1
  97. package/dist/services/deploy/deploy-service-factory.d.ts +15 -2
  98. package/dist/services/deploy/deploy-service-factory.js +43 -20
  99. package/dist/services/deploy/deploy-service.d.ts +2 -2
  100. package/dist/services/deploy/error/deploy-aborted-error.d.ts +12 -0
  101. package/dist/services/deploy/error/deploy-aborted-error.js +16 -0
  102. package/dist/services/deploy/handler/customer-config-handler.d.ts +4 -2
  103. package/dist/services/deploy/handler/customer-config-handler.js +11 -7
  104. package/dist/services/deploy/handler/install-resource-handler.d.ts +4 -2
  105. package/dist/services/deploy/handler/install-resource-handler.js +12 -7
  106. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.d.ts +4 -2
  107. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +5 -2
  108. package/dist/services/deploy/handler/module-handler.d.ts +4 -2
  109. package/dist/services/deploy/handler/module-handler.js +7 -4
  110. package/dist/services/deploy/handler/server-config-handler.d.ts +4 -2
  111. package/dist/services/deploy/handler/server-config-handler.js +6 -3
  112. package/dist/services/deploy/mr/base-config-reader.d.ts +25 -0
  113. package/dist/services/deploy/mr/base-config-reader.js +55 -0
  114. package/dist/services/deploy/mr/index.d.ts +6 -0
  115. package/dist/services/deploy/mr/index.js +6 -0
  116. package/dist/services/deploy/mr/live-state-check.d.ts +38 -0
  117. package/dist/services/deploy/mr/live-state-check.js +81 -0
  118. package/dist/services/deploy/mr/merge-request-deploy-model.d.ts +59 -0
  119. package/dist/services/deploy/mr/merge-request-deploy-model.js +50 -0
  120. package/dist/services/deploy/mr/merge-request-deploy-service-factory.d.ts +20 -0
  121. package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +46 -0
  122. package/dist/services/deploy/mr/merge-request-deploy-service.d.ts +61 -0
  123. package/dist/services/deploy/mr/merge-request-deploy-service.js +189 -0
  124. package/dist/services/deploy/mr/merge-request-description.d.ts +16 -0
  125. package/dist/services/deploy/mr/merge-request-description.js +27 -0
  126. package/dist/services/deploy/policy/auto-deploy-policy.d.ts +43 -0
  127. package/dist/services/deploy/policy/auto-deploy-policy.js +77 -0
  128. package/dist/services/deploy/policy/deploy-policy-model.d.ts +61 -0
  129. package/dist/services/deploy/policy/deploy-policy-model.js +41 -0
  130. package/dist/services/deploy/policy/index.d.ts +2 -0
  131. package/dist/services/deploy/policy/index.js +2 -0
  132. package/dist/services/deploy/policy/interactive-deploy-policy.d.ts +15 -0
  133. package/dist/services/deploy/policy/interactive-deploy-policy.js +16 -0
  134. package/dist/services/deploy/spec/bulk/bulk-deploy-service.spec.js +146 -0
  135. package/dist/services/deploy/spec/bulk/touched-configs.spec.js +77 -0
  136. package/dist/services/deploy/{checks → spec/checks}/activation/customer-approval-check.spec.js +20 -17
  137. package/dist/services/deploy/{checks → spec/checks}/post-deploy/refresh-deployment-job-check.spec.js +2 -2
  138. package/dist/services/deploy/spec/checks/pre-deploy/split-change-check.spec.js +55 -0
  139. package/dist/services/deploy/spec/handler/module-handler.spec.js +49 -0
  140. package/dist/services/deploy/{handler → spec/handler}/testing-installation-links.spec.js +1 -1
  141. package/dist/services/deploy/spec/mr/live-state-check.spec.js +74 -0
  142. package/dist/services/deploy/spec/mr/merge-request-description.spec.js +55 -0
  143. package/dist/services/deploy/spec/policy/auto-deploy-policy.spec.js +83 -0
  144. package/dist/services/diff/diff-model.d.ts +5 -1
  145. package/dist/services/diff/diff-model.js +5 -1
  146. package/dist/services/diff/diff-service-factory.d.ts +3 -1
  147. package/dist/services/diff/diff-service-factory.js +5 -3
  148. package/dist/services/diff/diff-service.d.ts +11 -2
  149. package/dist/services/diff/diff-service.js +32 -7
  150. package/dist/services/diff/index.d.ts +1 -0
  151. package/dist/services/diff/index.js +1 -0
  152. package/dist/services/document-handler-runtime/context/document-handler-runtime-context.d.ts +2 -14
  153. package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +0 -52
  154. package/dist/services/document-handler-runtime/document-handler-server.d.ts +2 -2
  155. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -11
  156. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +6 -72
  157. package/dist/services/document-handler-runtime/{document-handler-abort.spec.js → spec/document-handler-abort.spec.js} +2 -2
  158. package/dist/services/git/git-repository-model.d.ts +13 -0
  159. package/dist/services/git/git-repository.d.ts +35 -0
  160. package/dist/services/git/git-repository.js +120 -0
  161. package/dist/services/git/index.d.ts +2 -0
  162. package/dist/services/git/index.js +2 -0
  163. package/dist/services/git/spec/git-repository.spec.js +87 -0
  164. package/dist/services/integration-api/handler/customer-config-handler.d.ts +2 -2
  165. package/dist/services/integration-api/integration-api-factory.d.ts +3 -2
  166. package/dist/services/integration-api/integration-api-factory.js +5 -3
  167. package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +1 -1
  168. package/dist/services/integration-api/struct/customer-config-file.js +1 -1
  169. package/dist/services/integration-api/virtual/virtual-file-handler.d.ts +2 -2
  170. package/dist/services/onboarding/browser/config/browser-config.d.ts +1 -1
  171. package/dist/services/onboarding/browser/executable/executable-validator.d.ts +1 -2
  172. package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +1 -2
  173. package/dist/services/onboarding/browser/extension/extension-validator.d.ts +1 -2
  174. package/dist/services/onboarding/dashboard/diff-against-current-page.d.ts +2 -2
  175. package/dist/services/onboarding/dashboard/diff-against-current-page.js +1 -1
  176. package/dist/services/onboarding/dashboard/request-diff-service.d.ts +3 -1
  177. package/dist/services/onboarding/dashboard/request-diff-service.js +5 -3
  178. package/dist/services/onboarding/fetch-event-handler.d.ts +2 -2
  179. package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +3 -1
  180. package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +5 -3
  181. package/dist/services/onboarding/file-events/file-watcher.d.ts +2 -2
  182. package/dist/services/onboarding/file-events/file-watcher.js +2 -2
  183. package/dist/services/onboarding/onboarding-model.d.ts +1 -1
  184. package/dist/services/onboarding/onboarding-service-factory.d.ts +3 -2
  185. package/dist/services/onboarding/onboarding-service-factory.js +17 -17
  186. package/dist/services/onboarding/onboarding-service.d.ts +2 -2
  187. package/dist/services/onboarding/request-cache/cache.d.ts +2 -2
  188. package/dist/services/onboarding/server-config/index.d.ts +2 -2
  189. package/dist/services/onboarding/{browser → spec/browser}/executable/headed-user-agent.spec.js +1 -1
  190. package/dist/services/onboarding/{empty-service-worker.spec.js → spec/empty-service-worker.spec.js} +1 -1
  191. package/dist/services/onboarding/{onboarding-model.spec.js → spec/onboarding-model.spec.js} +2 -2
  192. package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/crawler.spec.js +1 -1
  193. package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/origin-error-cause.spec.js +1 -1
  194. package/dist/services/onboarding/virtual-orestes-app/crawler.d.ts +2 -2
  195. package/dist/services/onboarding/virtual-orestes-app/index.d.ts +2 -2
  196. package/dist/services/origin-request/asset-variations.js +1 -1
  197. package/dist/services/origin-request/origin-request-service-factory.d.ts +3 -2
  198. package/dist/services/origin-request/origin-request-service-factory.js +8 -6
  199. package/dist/services/origin-request/origin-request-service.d.ts +2 -2
  200. package/dist/services/origin-request/{asset-variations.spec.js → spec/asset-variations.spec.js} +1 -1
  201. package/dist/services/prewarm/assets/asset-api-client.d.ts +3 -1
  202. package/dist/services/prewarm/assets/asset-api-client.js +5 -3
  203. package/dist/services/prewarm/auto-pre-warm-factory.d.ts +3 -2
  204. package/dist/services/prewarm/auto-pre-warm-factory.js +8 -5
  205. package/dist/{helpers → services/prewarm}/normalize.d.ts +0 -6
  206. package/dist/{helpers → services/prewarm}/normalize.js +0 -8
  207. package/dist/services/prewarm/pre-warm-factory.d.ts +3 -1
  208. package/dist/services/prewarm/pre-warm-factory.js +7 -4
  209. package/dist/services/prewarm/{csv-reader.spec.js → spec/csv-reader.spec.js} +1 -1
  210. package/dist/services/prewarm/{prewarm-targets.spec.js → spec/prewarm-targets.spec.js} +1 -1
  211. package/dist/services/pull/pull-service-factory.d.ts +3 -2
  212. package/dist/services/pull/pull-service-factory.js +8 -6
  213. package/dist/services/query-builder/query-builder-factory.d.ts +3 -2
  214. package/dist/services/query-builder/query-builder-factory.js +9 -7
  215. package/dist/services/query-builder/query-builder-service.js +4 -5
  216. package/dist/services/query-builder/query-command.js +1 -1
  217. package/dist/services/query-builder/{queries/spec → spec/queries}/golden.spec.js +3 -3
  218. package/dist/services/query-builder/{queries/spec → spec/queries}/pops-query.spec.js +2 -2
  219. package/dist/services/query-builder/{queries/spec → spec/queries}/queries.spec.js +3 -3
  220. package/dist/services/query-builder/{queries/spec → spec/queries}/reported-bugs.spec.js +2 -2
  221. package/dist/services/query-builder/{query-builder-service.spec.js → spec/query-builder-service.spec.js} +4 -4
  222. package/dist/services/query-builder/{rules/spec → spec/rules}/pattern-language.spec.js +1 -1
  223. package/dist/services/query-builder/{rules/spec → spec/rules}/rule-parser.spec.js +1 -1
  224. package/dist/services/query-builder/{rules/spec → spec/rules}/rule-reducer.spec.js +2 -2
  225. package/dist/services/query-builder/{rules/spec → spec/rules}/rule-relevance.spec.js +2 -2
  226. package/dist/services/query-builder/{rules/spec → spec/rules}/rule-to-sql.spec.js +2 -2
  227. package/dist/services/query-builder/{rules/spec → spec/rules}/runtime-semantics.spec.js +1 -1
  228. package/dist/services/query-builder/spec/rules/strip-parameters.spec.d.ts +1 -0
  229. package/dist/services/query-builder/{rules/spec → spec/rules}/strip-parameters.spec.js +3 -3
  230. package/dist/services/query-builder/spec/sql/expression.spec.d.ts +1 -0
  231. package/dist/services/query-builder/{sql/spec → spec/sql}/expression.spec.js +2 -2
  232. package/dist/services/query-builder/spec/sql/format.spec.d.ts +1 -0
  233. package/dist/services/query-builder/{sql/spec → spec/sql}/format.spec.js +2 -2
  234. package/dist/services/query-builder/spec/sql/predicate.spec.d.ts +1 -0
  235. package/dist/services/query-builder/{sql/spec → spec/sql}/predicate.spec.js +1 -1
  236. package/dist/services/query-builder/spec/sql/regex.spec.d.ts +1 -0
  237. package/dist/services/query-builder/{sql/spec → spec/sql}/regex.spec.js +1 -1
  238. package/dist/services/revalidate/revalidate-factory.d.ts +3 -1
  239. package/dist/services/revalidate/revalidate-factory.js +6 -3
  240. package/dist/services/revalidate/revalidate-service.d.ts +2 -2
  241. package/dist/services/revalidate/spec/revalidate-service.spec.d.ts +1 -0
  242. package/dist/services/revalidate/{revalidate-service.spec.js → spec/revalidate-service.spec.js} +1 -1
  243. package/dist/services/setup/browser/browser-setup-service.d.ts +1 -2
  244. package/dist/services/setup/difftool/difftool-setup-service.d.ts +1 -2
  245. package/dist/services/setup/extension/extension-installer.d.ts +1 -1
  246. package/dist/services/setup/extension/extension-setup-service.d.ts +1 -2
  247. package/dist/services/setup/setup-service-factory.d.ts +3 -1
  248. package/dist/services/setup/setup-service-factory.js +5 -4
  249. package/dist/services/setup/setup-service.d.ts +1 -2
  250. package/dist/services/setup/spec/extension/crx.spec.d.ts +1 -0
  251. package/dist/services/setup/{extension → spec/extension}/crx.spec.js +1 -1
  252. package/dist/services/setup/spec/extension/webstore.spec.d.ts +1 -0
  253. package/dist/services/setup/{extension → spec/extension}/webstore.spec.js +1 -1
  254. package/dist/services/setup/spec/os/tool-registry.spec.d.ts +1 -0
  255. package/dist/services/setup/{os → spec/os}/tool-registry.spec.js +1 -1
  256. package/oclif.manifest.json +139 -84
  257. package/package.json +3 -2
  258. package/dist/commands/document-handler.d.ts +0 -16
  259. package/dist/commands/document-handler.js +0 -32
  260. package/dist/helpers/customer-config.d.ts +0 -45
  261. package/dist/helpers/customer-config.js +0 -136
  262. package/dist/helpers/file-helper.d.ts +0 -8
  263. package/dist/helpers/file-helper.js +0 -28
  264. package/dist/helpers/is-directory.d.ts +0 -5
  265. package/dist/helpers/is-directory.js +0 -19
  266. package/dist/helpers/is-file.d.ts +0 -5
  267. package/dist/helpers/is-file.js +0 -19
  268. package/dist/helpers/logging-helper.d.ts +0 -15
  269. package/dist/helpers/logging-helper.js +0 -23
  270. package/dist/helpers/scrape.d.ts +0 -1
  271. package/dist/helpers/scrape.js +0 -8
  272. package/dist/helpers/speed-kit-rule-to-reg-exp.d.ts +0 -1
  273. package/dist/helpers/speed-kit-rule-to-reg-exp.js +0 -6
  274. package/dist/models/install.d.ts +0 -24
  275. package/dist/services/config-api-service.d.ts +0 -21
  276. package/dist/services/config-api-service.js +0 -107
  277. package/dist/services/diff-service.d.ts +0 -27
  278. package/dist/services/diff-service.js +0 -116
  279. package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +0 -31
  280. package/dist/services/document-handler-runtime/document-handler-runtime-service.js +0 -222
  281. package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.d.ts +0 -3
  282. package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.js +0 -3
  283. package/dist/services/document-handler-runtime/templates/execute-document-handler.d.ts +0 -6
  284. package/dist/services/document-handler-runtime/templates/execute-document-handler.js +0 -74
  285. package/dist/services/document-handler-runtime/templates/orestes-mock.d.ts +0 -9
  286. package/dist/services/document-handler-runtime/templates/orestes-mock.js +0 -166
  287. package/dist/services/document-handler-runtime/templates/package-json.d.ts +0 -6
  288. package/dist/services/document-handler-runtime/templates/package-json.js +0 -17
  289. package/dist/services/document-handler-runtime/templates/test.d.ts +0 -6
  290. package/dist/services/document-handler-runtime/templates/test.js +0 -64
  291. /package/dist/helpers/{chrome-flags.spec.d.ts → spec/chrome-flags.spec.d.ts} +0 -0
  292. /package/dist/helpers/{origin-proxy.spec.d.ts → spec/origin-proxy.spec.d.ts} +0 -0
  293. /package/dist/hooks/{init → spec/init}/dns-result-order.spec.d.ts +0 -0
  294. /package/dist/hooks/{init → spec/init}/http1-global-dispatcher.spec.d.ts +0 -0
  295. /package/dist/models/{cli-parameters.spec.d.ts → spec/cli-parameters.spec.d.ts} +0 -0
  296. /package/dist/services/athena/{athena-service.spec.d.ts → spec/athena-service.spec.d.ts} +0 -0
  297. /package/dist/services/athena/{baqend-athena-service.spec.d.ts → spec/baqend-athena-service.spec.d.ts} +0 -0
  298. /package/dist/services/browser-fetch/{browser-origin-fetch.spec.d.ts → spec/browser-origin-fetch.spec.d.ts} +0 -0
  299. /package/dist/services/browser-fetch/{browser-origin-fetcher.spec.d.ts → spec/browser-origin-fetcher.spec.d.ts} +0 -0
  300. /package/dist/services/browser-fetch/{browser-response.spec.d.ts → spec/browser-response.spec.d.ts} +0 -0
  301. /package/dist/services/browser-fetch/{device-emulation.spec.d.ts → spec/device-emulation.spec.d.ts} +0 -0
  302. /package/dist/services/bundler/{bundle-service.spec.d.ts → spec/bundle-service.spec.d.ts} +0 -0
  303. /package/dist/{helpers → services/cli}/cli-config.d.ts +0 -0
  304. /package/dist/{helpers → services/cli}/environment.d.ts +0 -0
  305. /package/dist/{helpers → services/cli}/environment.js +0 -0
  306. /package/dist/{helpers → services/cli/spec}/cli-config.spec.d.ts +0 -0
  307. /package/dist/services/cli/{cli-service.spec.d.ts → spec/cli-service.spec.d.ts} +0 -0
  308. /package/dist/{helpers → services/cli/spec}/environment.spec.d.ts +0 -0
  309. /package/dist/{models/install.js → services/customer-config/site-analyzer/site-analyzer-model.js} +0 -0
  310. /package/dist/services/deploy/{checks/activation/customer-approval-check.spec.d.ts → spec/bulk/bulk-deploy-service.spec.d.ts} +0 -0
  311. /package/dist/services/deploy/{checks/post-deploy/refresh-deployment-job-check.spec.d.ts → spec/bulk/touched-configs.spec.d.ts} +0 -0
  312. /package/dist/services/deploy/{handler/testing-installation-links.spec.d.ts → spec/checks/activation/customer-approval-check.spec.d.ts} +0 -0
  313. /package/dist/services/{document-handler-runtime/document-handler-abort.spec.d.ts → deploy/spec/checks/post-deploy/refresh-deployment-job-check.spec.d.ts} +0 -0
  314. /package/dist/services/{onboarding/browser/executable/headed-user-agent.spec.d.ts → deploy/spec/checks/pre-deploy/split-change-check.spec.d.ts} +0 -0
  315. /package/dist/services/{onboarding/empty-service-worker.spec.d.ts → deploy/spec/handler/module-handler.spec.d.ts} +0 -0
  316. /package/dist/services/{onboarding/onboarding-model.spec.d.ts → deploy/spec/handler/testing-installation-links.spec.d.ts} +0 -0
  317. /package/dist/services/{onboarding/virtual-orestes-app/crawler.spec.d.ts → deploy/spec/mr/live-state-check.spec.d.ts} +0 -0
  318. /package/dist/services/{onboarding/virtual-orestes-app/origin-error-cause.spec.d.ts → deploy/spec/mr/merge-request-description.spec.d.ts} +0 -0
  319. /package/dist/services/{origin-request/asset-variations.spec.d.ts → deploy/spec/policy/auto-deploy-policy.spec.d.ts} +0 -0
  320. /package/dist/{helpers/html-format-helper.d.ts → services/diff/html-format.d.ts} +0 -0
  321. /package/dist/{helpers/html-format-helper.js → services/diff/html-format.js} +0 -0
  322. /package/dist/services/{prewarm/csv-reader.spec.d.ts → document-handler-runtime/spec/document-handler-abort.spec.d.ts} +0 -0
  323. /package/dist/services/{prewarm/prewarm-targets.spec.d.ts → git/git-repository-model.js} +0 -0
  324. /package/dist/services/{query-builder/queries/spec/golden.spec.d.ts → git/spec/git-repository.spec.d.ts} +0 -0
  325. /package/dist/{helpers → services/integration-api}/array-helper.d.ts +0 -0
  326. /package/dist/{helpers → services/integration-api}/array-helper.js +0 -0
  327. /package/dist/services/{query-builder/queries/spec/pops-query.spec.d.ts → onboarding/spec/browser/executable/headed-user-agent.spec.d.ts} +0 -0
  328. /package/dist/services/{query-builder/queries/spec/queries.spec.d.ts → onboarding/spec/empty-service-worker.spec.d.ts} +0 -0
  329. /package/dist/services/{query-builder/queries/spec/reported-bugs.spec.d.ts → onboarding/spec/onboarding-model.spec.d.ts} +0 -0
  330. /package/dist/services/{query-builder/query-builder-service.spec.d.ts → onboarding/spec/virtual-orestes-app/crawler.spec.d.ts} +0 -0
  331. /package/dist/services/{query-builder/rules/spec/pattern-language.spec.d.ts → onboarding/spec/virtual-orestes-app/origin-error-cause.spec.d.ts} +0 -0
  332. /package/dist/{helpers → services/origin-request}/java-regex.d.ts +0 -0
  333. /package/dist/{helpers → services/origin-request}/java-regex.js +0 -0
  334. /package/dist/services/{query-builder/rules/spec/rule-parser.spec.d.ts → origin-request/spec/asset-variations.spec.d.ts} +0 -0
  335. /package/dist/services/{query-builder/rules/spec/rule-reducer.spec.d.ts → prewarm/spec/csv-reader.spec.d.ts} +0 -0
  336. /package/dist/services/{query-builder/rules/spec/rule-relevance.spec.d.ts → prewarm/spec/prewarm-targets.spec.d.ts} +0 -0
  337. /package/dist/services/query-builder/{queries/spec → spec/queries}/golden-configs.d.ts +0 -0
  338. /package/dist/services/query-builder/{queries/spec → spec/queries}/golden-configs.js +0 -0
  339. /package/dist/services/query-builder/{rules/spec/rule-to-sql.spec.d.ts → spec/queries/golden.spec.d.ts} +0 -0
  340. /package/dist/services/query-builder/{rules/spec/runtime-semantics.spec.d.ts → spec/queries/pops-query.spec.d.ts} +0 -0
  341. /package/dist/services/query-builder/{rules/spec/strip-parameters.spec.d.ts → spec/queries/queries.spec.d.ts} +0 -0
  342. /package/dist/services/query-builder/{sql/spec/expression.spec.d.ts → spec/queries/reported-bugs.spec.d.ts} +0 -0
  343. /package/dist/services/query-builder/{sql/spec/format.spec.d.ts → spec/query-builder-service.spec.d.ts} +0 -0
  344. /package/dist/services/query-builder/{sql/spec/predicate.spec.d.ts → spec/rules/pattern-language.spec.d.ts} +0 -0
  345. /package/dist/services/query-builder/{sql/spec/regex.spec.d.ts → spec/rules/rule-parser.spec.d.ts} +0 -0
  346. /package/dist/services/{revalidate/revalidate-service.spec.d.ts → query-builder/spec/rules/rule-reducer.spec.d.ts} +0 -0
  347. /package/dist/services/{setup/extension/crx.spec.d.ts → query-builder/spec/rules/rule-relevance.spec.d.ts} +0 -0
  348. /package/dist/services/{setup/extension/webstore.spec.d.ts → query-builder/spec/rules/rule-to-sql.spec.d.ts} +0 -0
  349. /package/dist/services/{setup/os/tool-registry.spec.d.ts → query-builder/spec/rules/runtime-semantics.spec.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { expect } from "chai";
2
2
  import { describe, beforeEach, afterEach, it } from "mocha";
3
3
  import http from "node:http";
4
- import { applyOriginProxy, chromeProxyFlag, findProxyInChromeFlags, originFetch, parseSocksProxy, PROXY_ENVIRONMENT_VARIABLE, resetOriginProxy, setOriginProxy, withOriginProxyFlag, } from "./origin-proxy.js";
4
+ import { applyOriginProxy, chromeProxyFlag, findProxyInChromeFlags, originFetch, parseSocksProxy, PROXY_ENVIRONMENT_VARIABLE, resetOriginProxy, setOriginProxy, withOriginProxyFlag, } from "../origin-proxy.js";
5
5
  /** Sets or clears the enforcing environment variable. */
6
6
  function setEnvironmentProxy(value) {
7
7
  if (value === undefined) {
@@ -1,6 +1,5 @@
1
- import { CliConfig } from "../../helpers/cli-config.js";
2
1
  import { SetupServiceFactory } from "../../services/setup/index.js";
3
- import { isNonInteractive } from "../../helpers/environment.js";
2
+ import { CliConfig, CliServiceFactory } from "../../services/cli/index.js";
4
3
  // commands the hook must never interfere with (setup itself, help, plugins)
5
4
  const IGNORED_PREFIXES = ["config:setup", "help", "autocomplete", "plugins"];
6
5
  /**
@@ -10,7 +9,8 @@ const IGNORED_PREFIXES = ["config:setup", "help", "autocomplete", "plugins"];
10
9
  */
11
10
  const hook = async function (opts) {
12
11
  try {
13
- if (isNonInteractive()) {
12
+ const cli = new CliServiceFactory().getService();
13
+ if (cli.nonInteractive) {
14
14
  return;
15
15
  }
16
16
  const id = opts.id ?? "";
@@ -1,7 +1,7 @@
1
1
  import { expect } from "chai";
2
2
  import { after, describe, it } from "mocha";
3
3
  import { getDefaultResultOrder, setDefaultResultOrder } from "node:dns";
4
- import hook from "./dns-result-order.js";
4
+ import hook from "../../init/dns-result-order.js";
5
5
  describe("dns-result-order hook", () => {
6
6
  const previousOrder = getDefaultResultOrder();
7
7
  after(() => {
@@ -2,7 +2,7 @@ import { expect } from "chai";
2
2
  import { after, before, describe, it } from "mocha";
3
3
  import tls from "node:tls";
4
4
  import { Agent, getGlobalDispatcher, setGlobalDispatcher } from "undici";
5
- import hook from "./http1-global-dispatcher.js";
5
+ import hook from "../../init/http1-global-dispatcher.js";
6
6
  describe("http1-global-dispatcher hook", () => {
7
7
  const previousDispatcher = getGlobalDispatcher();
8
8
  let server;
@@ -6,7 +6,6 @@ export declare enum CLIParameters {
6
6
  Catalog = "catalog",
7
7
  Cookies = "cookies",
8
8
  Count = "count",
9
- CreateTests = "CreateTests",
10
9
  CustomerPath = "customerPath",
11
10
  CustomersDirectory = "customersDirectory",
12
11
  Days = "days",
@@ -48,7 +47,6 @@ export declare enum CLIParametersChar {
48
47
  ConfigName = "c",
49
48
  ContentTypes = "c",
50
49
  Cookies = "c",
51
- CreateTests = "t",
52
50
  CustomerPath = "p",
53
51
  CustomersDirectory = "d",
54
52
  Days = "d",
@@ -14,7 +14,6 @@ export var CLIParameters;
14
14
  CLIParameters["Catalog"] = "catalog";
15
15
  CLIParameters["Cookies"] = "cookies";
16
16
  CLIParameters["Count"] = "count";
17
- CLIParameters["CreateTests"] = "CreateTests";
18
17
  CLIParameters["CustomerPath"] = "customerPath";
19
18
  CLIParameters["CustomersDirectory"] = "customersDirectory";
20
19
  CLIParameters["Days"] = "days";
@@ -58,7 +57,6 @@ export var CLIParametersChar;
58
57
  CLIParametersChar["ConfigName"] = "c";
59
58
  CLIParametersChar["ContentTypes"] = "c";
60
59
  CLIParametersChar["Cookies"] = "c";
61
- CLIParametersChar["CreateTests"] = "t";
62
60
  CLIParametersChar["CustomerPath"] = "p";
63
61
  CLIParametersChar["CustomersDirectory"] = "d";
64
62
  CLIParametersChar["Days"] = "d";
@@ -1,7 +1,7 @@
1
1
  import { parse } from "@oclif/core/parser";
2
2
  import { expect } from "chai";
3
3
  import { describe, it } from "mocha";
4
- import { CLI_QUERY_VARIATIONS } from "./cli-parameters.js";
4
+ import { CLI_QUERY_VARIATIONS } from "../cli-parameters.js";
5
5
  async function parseFlags(argv) {
6
6
  const { flags } = await parse(argv, { flags: CLI_QUERY_VARIATIONS });
7
7
  return flags;
@@ -1,8 +1,10 @@
1
+ import { CliServiceInterface } from "../cli/index.js";
1
2
  import { AthenaService } from "./athena-query-service.js";
2
3
  export declare class AthenaServiceFactory {
3
4
  private app?;
4
5
  private workgroup?;
5
6
  private catalog?;
7
+ private cli?;
6
8
  service?: AthenaService;
7
9
  /**
8
10
  * @param app - the app to query. Enables the Baqend native query path (app
@@ -14,7 +16,7 @@ export declare class AthenaServiceFactory {
14
16
  * told so it can recognise the prefix, not so it can use it: the server
15
17
  * resolves the catalog itself.
16
18
  */
17
- constructor(app?: string, workgroup?: string, catalog?: string);
19
+ constructor(app?: string, workgroup?: string, catalog?: string, cli?: CliServiceInterface);
18
20
  getService(): Promise<AthenaService>;
19
21
  /**
20
22
  * Prefer direct AWS Athena whenever AWS credentials are present — they
@@ -10,6 +10,7 @@ export class AthenaServiceFactory {
10
10
  app;
11
11
  workgroup;
12
12
  catalog;
13
+ cli;
13
14
  service;
14
15
  /**
15
16
  * @param app - the app to query. Enables the Baqend native query path (app
@@ -21,10 +22,11 @@ export class AthenaServiceFactory {
21
22
  * told so it can recognise the prefix, not so it can use it: the server
22
23
  * resolves the catalog itself.
23
24
  */
24
- constructor(app, workgroup, catalog) {
25
+ constructor(app, workgroup, catalog, cli) {
25
26
  this.app = app;
26
27
  this.workgroup = workgroup;
27
28
  this.catalog = catalog;
29
+ this.cli = cli;
28
30
  }
29
31
  async getService() {
30
32
  if (!this.service) {
@@ -39,7 +41,7 @@ export class AthenaServiceFactory {
39
41
  * path (which needs an `app`).
40
42
  */
41
43
  async createService() {
42
- const cli = new CliServiceFactory().getService();
44
+ const cli = this.cli ?? new CliServiceFactory().getService();
43
45
  const client = await this.tryGetAthenaClient();
44
46
  if (client) {
45
47
  cli.comment(this.workgroup
@@ -1,7 +1,7 @@
1
1
  import { GetQueryResultsCommand, StartQueryExecutionCommand, } from "@aws-sdk/client-athena";
2
2
  import { expect } from "chai";
3
3
  import { describe, it } from "mocha";
4
- import { AwsAthenaService } from "./athena-service.js";
4
+ import { AwsAthenaService } from "../athena-service.js";
5
5
  /** The cli calls the service makes, in the order it made them. */
6
6
  function recordingCli() {
7
7
  const calls = [];
@@ -1,7 +1,7 @@
1
1
  import { expect } from "chai";
2
2
  import { describe, it } from "mocha";
3
- import { AthenaBucket } from "./athena-query-service.js";
4
- import { BaqendAthenaService } from "./baqend-athena-service.js";
3
+ import { AthenaBucket } from "../athena-query-service.js";
4
+ import { BaqendAthenaService } from "../baqend-athena-service.js";
5
5
  const cli = {
6
6
  failAction: () => undefined,
7
7
  startAction: () => undefined,
@@ -1,4 +1,4 @@
1
- import { UserCliConfig } from "../../helpers/cli-config.js";
1
+ import { UserCliConfig } from "../cli/index.js";
2
2
  import { directOriginFetch } from "../../helpers/origin-proxy.js";
3
3
  import { BrowserFetchLogger, BrowserOriginFetcher } from "./browser-origin-fetcher.js";
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { Frame, HTTPRequest } from "puppeteer";
2
- import { UserCliConfig } from "../../helpers/cli-config.js";
2
+ import { UserCliConfig } from "../cli/index.js";
3
3
  import { OriginFetchOptions } from "../../helpers/origin-proxy.js";
4
4
  /** Only the writers this fetcher uses, so it does not depend on the whole CLI service. */
5
5
  export interface BrowserFetchLogger {
@@ -1,7 +1,7 @@
1
1
  import { expect } from "chai";
2
2
  import { afterEach, beforeEach, describe, it } from "mocha";
3
- import { originFetch, resetOriginProxy, setOriginFetchTransport, } from "../../helpers/origin-proxy.js";
4
- import { installBrowserOriginFetch, } from "./browser-origin-fetch.js";
3
+ import { originFetch, resetOriginProxy, setOriginFetchTransport, } from "../../../helpers/origin-proxy.js";
4
+ import { installBrowserOriginFetch, } from "../browser-origin-fetch.js";
5
5
  /** Records what each leg was asked for, so the policy can be asserted on the calls it made. */
6
6
  class FetchLog {
7
7
  direct = [];
@@ -1,6 +1,6 @@
1
1
  import { expect } from "chai";
2
2
  import { describe, it } from "mocha";
3
- import { isDocumentRequest } from "./browser-origin-fetcher.js";
3
+ import { isDocumentRequest } from "../browser-origin-fetcher.js";
4
4
  const mainFrame = { name: "main" };
5
5
  const childFrame = { name: "child" };
6
6
  function request(isNavigation, frame) {
@@ -1,6 +1,6 @@
1
1
  import { expect } from "chai";
2
2
  import { describe, it } from "mocha";
3
- import { toFetchResponse, toPlainHeaders } from "./browser-response.js";
3
+ import { toFetchResponse, toPlainHeaders } from "../browser-response.js";
4
4
  /**
5
5
  * The four accessors `toFetchResponse` reads. Chrome reports repeated headers newline-joined in a
6
6
  * flat map, which is the shape this stands in for.
@@ -1,7 +1,7 @@
1
1
  import { expect } from "chai";
2
2
  import { describe, it } from "mocha";
3
- import { DEFAULT_USER_AGENT, MOBILE_USER_AGENT, TABLET_USER_AGENT, } from "../origin-request/asset-variations.js";
4
- import { deviceEmulation, deviceForUserAgent, isSpeedKitUserAgent, } from "./device-emulation.js";
3
+ import { DEFAULT_USER_AGENT, MOBILE_USER_AGENT, TABLET_USER_AGENT, } from "../../origin-request/asset-variations.js";
4
+ import { deviceEmulation, deviceForUserAgent, isSpeedKitUserAgent, } from "../device-emulation.js";
5
5
  const CHROME_VERSION = "Chrome/146.0.7680.165";
6
6
  describe("deviceForUserAgent", () => {
7
7
  it("maps the three user agents of the Asset API's device variations", () => {
@@ -3,7 +3,7 @@ import { after, before, describe, it } from "mocha";
3
3
  import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
- import { BundleService } from "./bundle-service.js";
6
+ import { BundleService } from "../bundle-service.js";
7
7
  describe("BundleService resolve fallback", () => {
8
8
  const bundleWithFallback = (source, fallback, moduleDiscoveryDir = process.cwd()) => new BundleService(moduleDiscoveryDir).bundle({
9
9
  entryPoints: { "handler.js": source },
@@ -1,7 +1,7 @@
1
1
  import * as dotenv from "dotenv";
2
2
  import fs from "node:fs";
3
3
  import path, { resolve } from "node:path";
4
- import { parseChromeFlags } from "./chrome-flags.js";
4
+ import { parseChromeFlags } from "../../helpers/chrome-flags.js";
5
5
  dotenv.config({ quiet: true });
6
6
  const environmentMapping = {
7
7
  chromeExtensionPaths: "CHROME_EXTENSION_PATHS",
@@ -1,8 +1,16 @@
1
1
  import { CliService } from "./cli-service.js";
2
2
  import { CliContext } from "./cli-service-model.js";
3
+ /**
4
+ * Builds the CLI service. Deliberately neither a singleton nor cached.
5
+ *
6
+ * One instance is created per invocation — at the command — and threaded into
7
+ * every factory that needs it, each of which takes an optional `cli`. Sharing
8
+ * by construction rather than by global state is what keeps `--quiet` honest:
9
+ * with a cached instance the flag would be decided by whichever factory
10
+ * happened to build first, which is not something a caller can reason about.
11
+ */
3
12
  export declare class CliServiceFactory {
4
- private context?;
5
- service?: CliService;
13
+ private context;
6
14
  constructor(context?: CliContext);
7
15
  getService(): CliService;
8
16
  }
@@ -1,18 +1,20 @@
1
1
  import { CliService } from "./cli-service.js";
2
2
  import { CliContext } from "./cli-service-model.js";
3
+ /**
4
+ * Builds the CLI service. Deliberately neither a singleton nor cached.
5
+ *
6
+ * One instance is created per invocation — at the command — and threaded into
7
+ * every factory that needs it, each of which takes an optional `cli`. Sharing
8
+ * by construction rather than by global state is what keeps `--quiet` honest:
9
+ * with a cached instance the flag would be decided by whichever factory
10
+ * happened to build first, which is not something a caller can reason about.
11
+ */
3
12
  export class CliServiceFactory {
4
13
  context;
5
- service = undefined;
6
- constructor(context) {
14
+ constructor(context = new CliContext()) {
7
15
  this.context = context;
8
- if (!context) {
9
- this.context = new CliContext(false);
10
- }
11
16
  }
12
17
  getService() {
13
- if (!(this.service instanceof CliService)) {
14
- this.service = new CliService(this.context.quiet);
15
- }
16
- return this.service;
18
+ return new CliService(this.context.quiet);
17
19
  }
18
20
  }
@@ -27,11 +27,13 @@ export interface CliTableOptions {
27
27
  export interface CliServiceInterface {
28
28
  style: ChalkInstance;
29
29
  readonly quiet: boolean;
30
+ /** True when this shell cannot be prompted (CI, no TTY, SK_NON_INTERACTIVE). */
31
+ readonly nonInteractive: boolean;
30
32
  code(code: string, buffered?: boolean): void;
31
33
  codeStyle(code: string): string;
32
34
  comment(message: string, buffered?: boolean): void;
33
- confirm(message: string, defaultAnswer: boolean): Promise<boolean>;
34
- exit(code: number): void;
35
+ confirm(message: string, defaultAnswer?: boolean): Promise<boolean>;
36
+ exit(code?: number): void;
35
37
  prompt(message: string, options?: {
36
38
  defaultAnswer?: any;
37
39
  validator?: any;
@@ -43,6 +45,12 @@ export interface CliServiceInterface {
43
45
  checked?: boolean;
44
46
  description?: string;
45
47
  }[]): Promise<T[]>;
48
+ /** Put text on the system clipboard; resolves to whether it arrived. */
49
+ copyToClipboard(text: string): Promise<boolean>;
50
+ /** Machine-readable payload, verbatim, to the data channel. */
51
+ pipe(data: string): void;
52
+ /** A human-facing line that must stay out of the data channel. */
53
+ note(message: string): void;
46
54
  spacer(): void;
47
55
  startAction(name: string, message: string): void;
48
56
  endAction(name: string, message?: string): void;
@@ -8,9 +8,17 @@ export declare class CliService implements CliServiceInterface {
8
8
  private buffer;
9
9
  private progressBar?;
10
10
  private spinners;
11
+ private readonly clipboard;
11
12
  private readonly animates;
12
13
  /** The text of each running action, for the log line that replaces it. */
13
14
  private readonly actions;
15
+ /**
16
+ * True when this shell cannot be asked a question: CI, no TTY on either end,
17
+ * or SK_NON_INTERACTIVE. Callers that would otherwise block on a prompt check
18
+ * it and take the non-interactive branch — which is why it lives here rather
19
+ * than being re-derived wherever a prompt happens to be.
20
+ */
21
+ get nonInteractive(): boolean;
14
22
  constructor(quiet?: boolean);
15
23
  code(code: string, buffered?: boolean): void;
16
24
  codeStyle(code: string): string;
@@ -28,6 +36,35 @@ export declare class CliService implements CliServiceInterface {
28
36
  checked?: boolean;
29
37
  description?: string;
30
38
  }[]): Promise<T[]>;
39
+ /**
40
+ * Put text on the system clipboard.
41
+ *
42
+ * Reports whether it arrived rather than throwing: a machine with no
43
+ * clipboard tool, or one whose tool cannot be reached in time, is an
44
+ * ordinary condition, and every caller has something useful to print
45
+ * instead.
46
+ */
47
+ copyToClipboard(text: string): Promise<boolean>;
48
+ /**
49
+ * Write machine-readable output to the data channel, verbatim.
50
+ *
51
+ * No styling, no trailing newline, and deliberately not suppressed by
52
+ * `quiet`: under `--quiet` stdout *is* the result, and this is the one path
53
+ * whose bytes a caller pipes into a file or another process. Callers add
54
+ * their own separators, because whether the payload ends in a newline is
55
+ * part of the format.
56
+ *
57
+ * Human-facing lines never come through here — they go to `write` (stdout,
58
+ * for a terminal) or `note` (stderr, alongside a payload).
59
+ */
60
+ pipe(data: string): void;
61
+ /**
62
+ * A human-facing line that must stay out of the data channel.
63
+ *
64
+ * Goes to stderr, so it stays visible on the terminal while `pipe` output is
65
+ * being redirected — and so it can never corrupt the payload.
66
+ */
67
+ note(message: string): void;
31
68
  spacer(): void;
32
69
  startAction(name: string, message: string): void;
33
70
  endAction(name: string, message?: string): void;
@@ -3,6 +3,8 @@ 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 { ClipboardService } from "./clipboard/index.js";
7
+ import { isCI, isNonInteractive } from "./environment.js";
6
8
  import { safe } from "../../helpers/safe.js";
7
9
  import { execSync } from "node:child_process";
8
10
  import ApplicationError from "../error-handling/error/application-error.js";
@@ -16,7 +18,44 @@ import ApplicationError from "../error-handling/error/application-error.js";
16
18
  * job that only ever built one.
17
19
  */
18
20
  function canAnimate() {
19
- return Boolean(!process.env.CI && process.stderr && process.stderr.isTTY);
21
+ return Boolean(!isCI() && process.stderr && process.stderr.isTTY);
22
+ }
23
+ /** The padding and the gutter that a table draws inside every column. */
24
+ const CELL_OVERHEAD = 3;
25
+ /** The left margin and the outer borders of a table. */
26
+ const TABLE_OVERHEAD = 3;
27
+ /** No column is squeezed below this, so a short name stays readable. */
28
+ const MIN_COLUMN_WIDTH = 8;
29
+ /**
30
+ * Column widths that fit the terminal.
31
+ *
32
+ * Every column starts with the width of its widest cell. While the table is
33
+ * wider than the terminal, the column with the most room to give gives way,
34
+ * so one long text does not squeeze every other column to single letters.
35
+ */
36
+ function columnWidths(entries, rows) {
37
+ const content = entries.map(([key, column], index) => Math.max((column?.header ?? key).length, column?.minWidth ?? 0, ...rows.map((row) => row[index].length)));
38
+ const widths = content.map((width) => width + CELL_OVERHEAD);
39
+ const floors = entries.map(([key, column], index) => Math.min(widths[index], CELL_OVERHEAD +
40
+ Math.max(MIN_COLUMN_WIDTH, column?.minWidth ?? 0, (column?.header ?? key).length)));
41
+ const available = (process.stdout.columns || 120) - entries.length - TABLE_OVERHEAD;
42
+ let excess = widths.reduce((total, width) => total + width, 0) - available;
43
+ while (excess > 0) {
44
+ let widest = -1;
45
+ let slack = 0;
46
+ for (const [index, width] of widths.entries()) {
47
+ if (width - floors[index] > slack) {
48
+ slack = width - floors[index];
49
+ widest = index;
50
+ }
51
+ }
52
+ if (widest === -1) {
53
+ break;
54
+ }
55
+ widths[widest] -= 1;
56
+ excess -= 1;
57
+ }
58
+ return widths;
20
59
  }
21
60
  export class CliService {
22
61
  quiet;
@@ -24,9 +63,19 @@ export class CliService {
24
63
  buffer = [];
25
64
  progressBar;
26
65
  spinners;
66
+ clipboard = new ClipboardService();
27
67
  animates = canAnimate();
28
68
  /** The text of each running action, for the log line that replaces it. */
29
69
  actions = new Map();
70
+ /**
71
+ * True when this shell cannot be asked a question: CI, no TTY on either end,
72
+ * or SK_NON_INTERACTIVE. Callers that would otherwise block on a prompt check
73
+ * it and take the non-interactive branch — which is why it lives here rather
74
+ * than being re-derived wherever a prompt happens to be.
75
+ */
76
+ get nonInteractive() {
77
+ return isNonInteractive();
78
+ }
30
79
  constructor(quiet = false) {
31
80
  this.quiet = quiet;
32
81
  this.spinners = new Spinnies();
@@ -98,6 +147,41 @@ export class CliService {
98
147
  message: this.getFormattedMessage(message),
99
148
  });
100
149
  }
150
+ /**
151
+ * Put text on the system clipboard.
152
+ *
153
+ * Reports whether it arrived rather than throwing: a machine with no
154
+ * clipboard tool, or one whose tool cannot be reached in time, is an
155
+ * ordinary condition, and every caller has something useful to print
156
+ * instead.
157
+ */
158
+ async copyToClipboard(text) {
159
+ return this.clipboard.copy(text);
160
+ }
161
+ /**
162
+ * Write machine-readable output to the data channel, verbatim.
163
+ *
164
+ * No styling, no trailing newline, and deliberately not suppressed by
165
+ * `quiet`: under `--quiet` stdout *is* the result, and this is the one path
166
+ * whose bytes a caller pipes into a file or another process. Callers add
167
+ * their own separators, because whether the payload ends in a newline is
168
+ * part of the format.
169
+ *
170
+ * Human-facing lines never come through here — they go to `write` (stdout,
171
+ * for a terminal) or `note` (stderr, alongside a payload).
172
+ */
173
+ pipe(data) {
174
+ process.stdout.write(data);
175
+ }
176
+ /**
177
+ * A human-facing line that must stay out of the data channel.
178
+ *
179
+ * Goes to stderr, so it stays visible on the terminal while `pipe` output is
180
+ * being redirected — and so it can never corrupt the payload.
181
+ */
182
+ note(message) {
183
+ process.stderr.write(`${message}\n`);
184
+ }
101
185
  spacer() {
102
186
  console.log("");
103
187
  }
@@ -185,13 +269,16 @@ export class CliService {
185
269
  }
186
270
  table(data, columns) {
187
271
  this.spacer();
188
- const header = Object.entries(columns).map(([key, col]) => ({
272
+ const entries = Object.entries(columns);
273
+ const rows = data.map((row) => entries.map(([key, col]) => String(col?.get ? col.get(row) : (row[key] ?? ""))));
274
+ const widths = columnWidths(entries, rows);
275
+ const header = entries.map(([key, col], index) => ({
189
276
  value: key,
190
277
  alias: col?.header,
191
278
  align: "left",
192
279
  headerAlign: "left",
280
+ width: widths[index],
193
281
  }));
194
- const rows = data.map((row) => Object.entries(columns).map(([key, col]) => String(col?.get ? col.get(row) : (row[key] ?? ""))));
195
282
  const t = Table(header, rows, { compact: true });
196
283
  console.log(t.render());
197
284
  this.spacer();
@@ -22,4 +22,6 @@
22
22
  *
23
23
  * @returns whether the text reached the clipboard.
24
24
  */
25
- export declare function copyToClipboard(text: string): Promise<boolean>;
25
+ export declare class ClipboardService {
26
+ copy(text: string): Promise<boolean>;
27
+ }
@@ -25,7 +25,12 @@ const TIMEOUT_IN_MS = 2000;
25
25
  *
26
26
  * @returns whether the text reached the clipboard.
27
27
  */
28
- export async function copyToClipboard(text) {
28
+ export class ClipboardService {
29
+ async copy(text) {
30
+ return copyToClipboard(text);
31
+ }
32
+ }
33
+ async function copyToClipboard(text) {
29
34
  if (isWayland()) {
30
35
  const copied = await copyWithWaylandClipboard(text);
31
36
  if (copied) {
@@ -0,0 +1 @@
1
+ export * from "./clipboard-service.js";
@@ -0,0 +1 @@
1
+ export * from "./clipboard-service.js";
@@ -1,3 +1,4 @@
1
1
  export * from "./cli-service.js";
2
2
  export * from "./cli-service-model.js";
3
3
  export * from "./cli-service-factory.js";
4
+ export * from "./cli-config.js";
@@ -1,3 +1,4 @@
1
1
  export * from "./cli-service.js";
2
2
  export * from "./cli-service-model.js";
3
3
  export * from "./cli-service-factory.js";
4
+ export * from "./cli-config.js";
@@ -3,7 +3,7 @@ import { describe, beforeEach, afterEach, it } from "mocha";
3
3
  import { mkdtempSync, rmSync, readFileSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import path from "node:path";
6
- import { CliConfig } from "./cli-config.js";
6
+ import { CliConfig } from "../cli-config.js";
7
7
  function fakeOclifConfig(dir) {
8
8
  return {
9
9
  configDir: dir,
@@ -1,6 +1,6 @@
1
1
  import { expect } from "chai";
2
2
  import { afterEach, beforeEach, describe, it } from "mocha";
3
- import { CliService } from "./cli-service.js";
3
+ import { CliService } from "../cli-service.js";
4
4
  /** The lines a block of work put on stdout. */
5
5
  function captured(work) {
6
6
  const lines = [];
@@ -65,3 +65,44 @@ describe("CliService actions without a terminal", () => {
65
65
  expect(lines).to.have.lengthOf(0);
66
66
  });
67
67
  });
68
+ describe("CliService table", () => {
69
+ let columns;
70
+ beforeEach(() => {
71
+ columns = process.stdout.columns;
72
+ Object.defineProperty(process.stdout, "columns", {
73
+ value: 80,
74
+ configurable: true,
75
+ });
76
+ });
77
+ afterEach(() => {
78
+ Object.defineProperty(process.stdout, "columns", {
79
+ value: columns,
80
+ configurable: true,
81
+ });
82
+ });
83
+ /** A row whose last column is far too long for any terminal. */
84
+ const row = {
85
+ customer: "carhartt-wip-new",
86
+ outcome: "alreadyDeployed",
87
+ reason: "commits after !8021 change config_documentHandler.js and config_dynamicStyles.css of this customer",
88
+ };
89
+ it("keeps the short columns readable and wraps the long one", () => {
90
+ const lines = captured(() => new CliService().table([row], {
91
+ customer: {},
92
+ outcome: {},
93
+ reason: {},
94
+ }));
95
+ expect(lines.join("\n")).to.contain("carhartt-wip-new");
96
+ expect(lines.join("\n")).to.contain("alreadyDeployed");
97
+ });
98
+ it("stays inside the terminal", () => {
99
+ const lines = captured(() => new CliService().table([row], {
100
+ customer: {},
101
+ outcome: {},
102
+ reason: {},
103
+ }));
104
+ for (const line of lines.join("\n").split("\n")) {
105
+ expect(line.length, line).to.be.at.most(80);
106
+ }
107
+ });
108
+ });
@@ -1,6 +1,6 @@
1
1
  import { expect } from "chai";
2
2
  import { describe, it } from "mocha";
3
- import { isCI, isNonInteractive } from "./environment.js";
3
+ import { isCI, isNonInteractive } from "../environment.js";
4
4
  describe("environment.isCI", () => {
5
5
  it("is false for an empty environment", () => {
6
6
  expect(isCI({})).to.equal(false);
@@ -1,8 +1,10 @@
1
+ import { CliServiceInterface } from "../cli/index.js";
1
2
  import { CustomerConfigService, CustomerConfigServiceContext } from "./index.js";
2
3
  export declare class CustomerConfigServiceFactory {
4
+ private cli?;
3
5
  private readonly context;
4
6
  private service?;
5
- constructor(context: CustomerConfigServiceContext);
7
+ constructor(context: CustomerConfigServiceContext, cli?: CliServiceInterface);
6
8
  buildService(): Promise<CustomerConfigService>;
7
9
  private build;
8
10
  }