@speedkit/cli 4.36.1 → 4.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/base/sk-command.d.ts +41 -0
  3. package/dist/base/sk-command.js +56 -0
  4. package/dist/commands/auto-prewarm.d.ts +6 -4
  5. package/dist/commands/auto-prewarm.js +13 -66
  6. package/dist/commands/autocomplete/fish.d.ts +2 -2
  7. package/dist/commands/autocomplete/fish.js +3 -2
  8. package/dist/commands/browser/clean.d.ts +2 -2
  9. package/dist/commands/browser/clean.js +6 -6
  10. package/dist/commands/browser/list.d.ts +2 -2
  11. package/dist/commands/browser/list.js +6 -7
  12. package/dist/commands/browser/update.d.ts +2 -2
  13. package/dist/commands/browser/update.js +9 -11
  14. package/dist/commands/bulk-deploy.d.ts +4 -2
  15. package/dist/commands/bulk-deploy.js +7 -37
  16. package/dist/commands/config/edit.d.ts +2 -2
  17. package/dist/commands/config/edit.js +2 -2
  18. package/dist/commands/config/setup.d.ts +5 -2
  19. package/dist/commands/config/setup.js +9 -19
  20. package/dist/commands/deploy.d.ts +12 -3
  21. package/dist/commands/deploy.js +14 -20
  22. package/dist/commands/diff-url-parameters.d.ts +3 -2
  23. package/dist/commands/diff-url-parameters.js +19 -16
  24. package/dist/commands/extension/add.d.ts +2 -2
  25. package/dist/commands/extension/add.js +6 -6
  26. package/dist/commands/extension/devtools.d.ts +2 -2
  27. package/dist/commands/extension/devtools.js +6 -7
  28. package/dist/commands/extension/list.d.ts +2 -2
  29. package/dist/commands/extension/list.js +5 -6
  30. package/dist/commands/extension/remove.d.ts +2 -2
  31. package/dist/commands/extension/remove.js +6 -6
  32. package/dist/commands/extension/update.d.ts +2 -2
  33. package/dist/commands/extension/update.js +5 -6
  34. package/dist/commands/find-pops.d.ts +2 -2
  35. package/dist/commands/find-pops.js +10 -11
  36. package/dist/commands/generate-customer-config.d.ts +5 -2
  37. package/dist/commands/generate-customer-config.js +9 -27
  38. package/dist/commands/generate-pop-config.d.ts +2 -2
  39. package/dist/commands/generate-pop-config.js +19 -15
  40. package/dist/commands/login.d.ts +2 -2
  41. package/dist/commands/login.js +6 -9
  42. package/dist/commands/onboarding.d.ts +18 -3
  43. package/dist/commands/onboarding.js +13 -11
  44. package/dist/commands/origin-request.d.ts +4 -2
  45. package/dist/commands/origin-request.js +10 -42
  46. package/dist/commands/prewarm.d.ts +4 -2
  47. package/dist/commands/prewarm.js +12 -56
  48. package/dist/commands/pull.d.ts +4 -2
  49. package/dist/commands/pull.js +9 -14
  50. package/dist/commands/query/parameter.d.ts +4 -2
  51. package/dist/commands/query/parameter.js +12 -19
  52. package/dist/commands/query/prewarm.d.ts +4 -2
  53. package/dist/commands/query/prewarm.js +16 -23
  54. package/dist/commands/revalidate.d.ts +4 -2
  55. package/dist/commands/revalidate.js +13 -56
  56. package/dist/commands/wpt-launcher.d.ts +2 -2
  57. package/dist/commands/wpt-launcher.js +16 -17
  58. package/dist/hooks/init/first-run.js +9 -10
  59. package/dist/models/context.d.ts +24 -0
  60. package/dist/models/context.js +31 -0
  61. package/dist/services/athena/athena-flags.d.ts +18 -0
  62. package/dist/services/athena/athena-flags.js +29 -0
  63. package/dist/services/athena/athena-service-build-context.d.ts +25 -0
  64. package/dist/services/athena/athena-service-build-context.js +4 -0
  65. package/dist/services/athena/athena-service-factory.d.ts +3 -16
  66. package/dist/services/athena/athena-service-factory.js +11 -27
  67. package/dist/services/athena/baqend-athena-service.d.ts +3 -14
  68. package/dist/services/athena/baqend-athena-service.js +8 -16
  69. package/dist/services/athena/index.d.ts +1 -0
  70. package/dist/services/athena/index.js +1 -0
  71. package/dist/services/athena/spec/baqend-athena-service.spec.js +2 -2
  72. package/dist/services/browser-fetch/browser-origin-fetch.d.ts +2 -2
  73. package/dist/services/browser-fetch/browser-origin-fetch.js +1 -1
  74. package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +3 -3
  75. package/dist/services/browser-fetch/browser-origin-fetcher.js +5 -5
  76. package/dist/services/browser-fetch/spec/browser-origin-fetch.spec.js +10 -10
  77. package/dist/services/cli/cli-environment-factory.d.ts +25 -0
  78. package/dist/services/cli/cli-environment-factory.js +30 -0
  79. package/dist/services/cli/cli-environment.d.ts +73 -0
  80. package/dist/services/cli/cli-environment.js +216 -0
  81. package/dist/services/cli/cli-service-build-context.d.ts +10 -0
  82. package/dist/services/cli/cli-service-build-context.js +4 -0
  83. package/dist/services/cli/cli-service-factory.d.ts +7 -7
  84. package/dist/services/cli/cli-service-factory.js +7 -7
  85. package/dist/services/cli/cli-service-model.d.ts +0 -4
  86. package/dist/services/cli/cli-service-model.js +0 -6
  87. package/dist/services/cli/cli-service.d.ts +16 -2
  88. package/dist/services/cli/cli-service.js +17 -18
  89. package/dist/services/cli/cli-settings.d.ts +37 -0
  90. package/dist/services/cli/cli-settings.js +23 -0
  91. package/dist/services/cli/command-build-context.d.ts +23 -0
  92. package/dist/services/cli/index.d.ts +5 -1
  93. package/dist/services/cli/index.js +5 -1
  94. package/dist/services/cli/spec/cli-environment-detection.spec.js +52 -0
  95. package/dist/services/cli/spec/cli-environment.spec.js +125 -0
  96. package/dist/services/cli/spec/cli-service.spec.js +9 -19
  97. package/dist/services/config-api/client.d.ts +3 -3
  98. package/dist/services/config-api/client.js +4 -4
  99. package/dist/services/config-api/config-api-factory.js +3 -3
  100. package/dist/services/config-api/entity-manager-provider.d.ts +11 -0
  101. package/dist/services/config-api/{entity-manager-factory.js → entity-manager-provider.js} +7 -1
  102. package/dist/services/customer-config/customer-config-service-build-context.d.ts +33 -0
  103. package/dist/services/customer-config/customer-config-service-build-context.js +36 -0
  104. package/dist/services/customer-config/customer-config-service-factory.d.ts +3 -4
  105. package/dist/services/customer-config/customer-config-service-factory.js +5 -8
  106. package/dist/services/customer-config/customer-config-service.d.ts +2 -2
  107. package/dist/services/customer-config/index.d.ts +1 -1
  108. package/dist/services/customer-config/index.js +1 -1
  109. package/dist/services/customer-config/site-analyzer/index.d.ts +1 -0
  110. package/dist/services/customer-config/site-analyzer/index.js +1 -0
  111. package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.d.ts +6 -0
  112. package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.js +4 -0
  113. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.d.ts +3 -3
  114. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.js +4 -5
  115. package/dist/services/deploy/bulk/bulk-deploy-model.d.ts +0 -25
  116. package/dist/services/deploy/bulk/bulk-deploy-model.js +1 -27
  117. package/dist/services/deploy/bulk/bulk-deploy-service-build-context.d.ts +51 -0
  118. package/dist/services/deploy/bulk/bulk-deploy-service-build-context.js +50 -0
  119. package/dist/services/deploy/bulk/bulk-deploy-service-factory.d.ts +2 -4
  120. package/dist/services/deploy/bulk/bulk-deploy-service-factory.js +2 -5
  121. package/dist/services/deploy/bulk/bulk-deploy-service.d.ts +3 -2
  122. package/dist/services/deploy/bulk/config-deploy-factory.d.ts +3 -3
  123. package/dist/services/deploy/bulk/config-deploy-factory.js +16 -8
  124. package/dist/services/deploy/bulk/index.d.ts +1 -0
  125. package/dist/services/deploy/bulk/index.js +1 -0
  126. package/dist/services/deploy/checks/activation/customer-approval-check.d.ts +3 -1
  127. package/dist/services/deploy/checks/activation/customer-approval-check.js +4 -2
  128. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.d.ts +3 -1
  129. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +4 -2
  130. package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -1
  131. package/dist/services/deploy/checks/pre-deploy/split-change-check.js +4 -2
  132. package/dist/services/deploy/deploy-service-build-context.d.ts +63 -0
  133. package/dist/services/deploy/deploy-service-build-context.js +64 -0
  134. package/dist/services/deploy/deploy-service-factory.d.ts +5 -8
  135. package/dist/services/deploy/deploy-service-factory.js +28 -19
  136. package/dist/services/deploy/mr/base-config-reader.d.ts +6 -4
  137. package/dist/services/deploy/mr/base-config-reader.js +6 -8
  138. package/dist/services/deploy/mr/index.d.ts +1 -0
  139. package/dist/services/deploy/mr/index.js +1 -0
  140. package/dist/services/deploy/mr/merge-request-deploy-model.d.ts +0 -35
  141. package/dist/services/deploy/mr/merge-request-deploy-model.js +0 -34
  142. package/dist/services/deploy/mr/merge-request-deploy-service-build-context.d.ts +32 -0
  143. package/dist/services/deploy/mr/merge-request-deploy-service-build-context.js +20 -0
  144. package/dist/services/deploy/mr/merge-request-deploy-service-factory.d.ts +2 -4
  145. package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +31 -10
  146. package/dist/services/deploy/mr/merge-request-deploy-service.d.ts +3 -2
  147. package/dist/services/deploy/spec/bulk/bulk-deploy-service.spec.js +14 -3
  148. package/dist/services/deploy/spec/checks/activation/customer-approval-check.spec.js +7 -5
  149. package/dist/services/deploy/spec/checks/pre-deploy/split-change-check.spec.js +2 -1
  150. package/dist/services/diff/diff-service-build-context.d.ts +14 -0
  151. package/dist/services/diff/diff-service-build-context.js +4 -0
  152. package/dist/services/diff/diff-service-factory.d.ts +4 -5
  153. package/dist/services/diff/diff-service-factory.js +4 -7
  154. package/dist/services/diff/index.d.ts +1 -1
  155. package/dist/services/diff/index.js +1 -1
  156. package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.d.ts → document-handler-runtime-model.d.ts} +0 -5
  157. package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.d.ts +11 -0
  158. package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.js +4 -0
  159. package/dist/services/document-handler-runtime/document-handler-server.js +2 -2
  160. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
  161. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +14 -14
  162. package/dist/services/document-handler-runtime/server/request.js +1 -1
  163. package/dist/services/document-handler-runtime/templates/database-mock.d.ts +1 -1
  164. package/dist/services/document-handler-runtime/templates/database-mock.js +1 -1
  165. package/dist/services/integration-api/customer-config-flags.d.ts +16 -0
  166. package/dist/services/integration-api/customer-config-flags.js +30 -0
  167. package/dist/services/integration-api/handler/install-resource-handler.d.ts +8 -0
  168. package/dist/services/integration-api/handler/install-resource-handler.js +10 -1
  169. package/dist/services/integration-api/index.d.ts +1 -0
  170. package/dist/services/integration-api/index.js +1 -0
  171. package/dist/services/integration-api/integration-api-factory.d.ts +4 -6
  172. package/dist/services/integration-api/integration-api-factory.js +11 -11
  173. package/dist/services/integration-api/integration-api-model.d.ts +0 -9
  174. package/dist/services/integration-api/integration-api-model.js +0 -16
  175. package/dist/services/integration-api/integration-api-service-build-context.d.ts +19 -0
  176. package/dist/services/integration-api/integration-api-service-build-context.js +4 -0
  177. package/dist/services/integration-api/spec/config-plugin.spec.js +1 -1
  178. package/dist/services/integration-api/spec/integration-api-service.spec.js +7 -3
  179. package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +9 -2
  180. package/dist/services/integration-api/struct/config-plugin.d.ts +1 -1
  181. package/dist/services/integration-api/struct/config-plugin.js +12 -7
  182. package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +18 -2
  183. package/dist/services/integration-api/struct/speed-kit-config-file.js +22 -12
  184. package/dist/services/integration-api/struct/speed-kit-config.d.ts +1 -1
  185. package/dist/services/onboarding/browser/config/browser-config.d.ts +3 -3
  186. package/dist/services/onboarding/browser/config/browser-config.js +5 -5
  187. package/dist/services/onboarding/browser/executable/executable-validator.d.ts +3 -3
  188. package/dist/services/onboarding/browser/executable/executable-validator.js +17 -15
  189. package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +3 -3
  190. package/dist/services/onboarding/browser/extension/extension-downloader.js +6 -6
  191. package/dist/services/onboarding/browser/extension/extension-validator.d.ts +3 -3
  192. package/dist/services/onboarding/browser/extension/extension-validator.js +4 -4
  193. package/dist/services/onboarding/file-events/file-watcher.js +1 -0
  194. package/dist/services/onboarding/index.d.ts +1 -1
  195. package/dist/services/onboarding/index.js +1 -1
  196. package/dist/services/onboarding/onboarding-model.d.ts +8 -24
  197. package/dist/services/onboarding/onboarding-model.js +19 -87
  198. package/dist/services/onboarding/onboarding-service-build-context.d.ts +57 -0
  199. package/dist/services/onboarding/onboarding-service-build-context.js +67 -0
  200. package/dist/services/onboarding/onboarding-service-factory.d.ts +2 -5
  201. package/dist/services/onboarding/onboarding-service-factory.js +47 -34
  202. package/dist/services/onboarding/spec/onboarding-model.spec.js +11 -6
  203. package/dist/services/origin-request/index.d.ts +1 -1
  204. package/dist/services/origin-request/index.js +1 -1
  205. package/dist/services/origin-request/origin-request-service-build-context.d.ts +52 -0
  206. package/dist/services/origin-request/origin-request-service-build-context.js +54 -0
  207. package/dist/services/origin-request/origin-request-service-factory.d.ts +2 -5
  208. package/dist/services/origin-request/origin-request-service-factory.js +12 -12
  209. package/dist/services/origin-request/origin-request-service.d.ts +2 -2
  210. package/dist/services/pop-config/index.d.ts +1 -0
  211. package/dist/services/pop-config/index.js +1 -0
  212. package/dist/services/pop-config/pop-config-factory.d.ts +4 -1
  213. package/dist/services/pop-config/pop-config-factory.js +10 -3
  214. package/dist/services/pop-config/pop-config-service-build-context.d.ts +10 -0
  215. package/dist/services/pop-config/pop-config-service-build-context.js +4 -0
  216. package/dist/services/prewarm/auto-pre-warm-factory.d.ts +3 -31
  217. package/dist/services/prewarm/auto-pre-warm-factory.js +6 -11
  218. package/dist/services/prewarm/auto-pre-warm-service-build-context.d.ts +84 -0
  219. package/dist/services/prewarm/auto-pre-warm-service-build-context.js +68 -0
  220. package/dist/services/prewarm/index.d.ts +2 -0
  221. package/dist/services/prewarm/index.js +2 -0
  222. package/dist/services/prewarm/pre-warm-factory.d.ts +4 -5
  223. package/dist/services/prewarm/pre-warm-factory.js +6 -8
  224. package/dist/services/prewarm/pre-warm-model.d.ts +0 -10
  225. package/dist/services/prewarm/pre-warm-model.js +0 -18
  226. package/dist/services/prewarm/pre-warm-service-build-context.d.ts +47 -0
  227. package/dist/services/prewarm/pre-warm-service-build-context.js +64 -0
  228. package/dist/services/pull/index.d.ts +1 -0
  229. package/dist/services/pull/index.js +1 -0
  230. package/dist/services/pull/pull-service-build-context.d.ts +28 -0
  231. package/dist/services/pull/pull-service-build-context.js +17 -0
  232. package/dist/services/pull/pull-service-factory.d.ts +3 -5
  233. package/dist/services/pull/pull-service-factory.js +13 -14
  234. package/dist/services/pull/pull-service-model.d.ts +0 -5
  235. package/dist/services/pull/pull-service-model.js +0 -9
  236. package/dist/services/query-builder/query-builder-factory.d.ts +9 -7
  237. package/dist/services/query-builder/query-builder-factory.js +26 -15
  238. package/dist/{models/cli-parameters.d.ts → services/query-builder/query-builder-flags.d.ts} +1 -120
  239. package/dist/services/query-builder/query-builder-flags.js +150 -0
  240. package/dist/services/query-builder/query-builder-model.d.ts +1 -14
  241. package/dist/services/query-builder/query-builder-service-build-context.d.ts +113 -0
  242. package/dist/services/query-builder/query-builder-service-build-context.js +68 -0
  243. package/dist/services/query-builder/query-builder-service.d.ts +3 -3
  244. package/dist/services/query-builder/spec/query-builder-flags.spec.d.ts +1 -0
  245. package/dist/{models/spec/cli-parameters.spec.js → services/query-builder/spec/query-builder-flags.spec.js} +1 -1
  246. package/dist/services/revalidate/index.d.ts +1 -0
  247. package/dist/services/revalidate/index.js +1 -0
  248. package/dist/services/revalidate/revalidate-factory.d.ts +3 -5
  249. package/dist/services/revalidate/revalidate-factory.js +2 -6
  250. package/dist/services/revalidate/revalidate-model.d.ts +0 -9
  251. package/dist/services/revalidate/revalidate-model.js +0 -8
  252. package/dist/services/revalidate/revalidate-service-build-context.d.ts +38 -0
  253. package/dist/services/revalidate/revalidate-service-build-context.js +59 -0
  254. package/dist/services/setup/browser/browser-setup-service.d.ts +3 -4
  255. package/dist/services/setup/browser/browser-setup-service.js +16 -18
  256. package/dist/services/setup/difftool/difftool-setup-service.d.ts +3 -4
  257. package/dist/services/setup/difftool/difftool-setup-service.js +5 -7
  258. package/dist/services/setup/extension/extension-setup-service.d.ts +3 -4
  259. package/dist/services/setup/extension/extension-setup-service.js +8 -10
  260. package/dist/services/setup/index.d.ts +1 -1
  261. package/dist/services/setup/index.js +1 -1
  262. package/dist/services/setup/setup-service-build-context.d.ts +27 -0
  263. package/dist/services/setup/setup-service-build-context.js +26 -0
  264. package/dist/services/setup/setup-service-factory.d.ts +2 -6
  265. package/dist/services/setup/setup-service-factory.js +10 -18
  266. package/dist/services/setup/setup-service.d.ts +4 -5
  267. package/dist/services/setup/setup-service.js +6 -7
  268. package/oclif.manifest.json +1 -1
  269. package/package.json +4 -2
  270. package/dist/models/cli-parameters.js +0 -297
  271. package/dist/services/cli/cli-config.d.ts +0 -59
  272. package/dist/services/cli/cli-config.js +0 -180
  273. package/dist/services/cli/environment.d.ts +0 -15
  274. package/dist/services/cli/environment.js +0 -40
  275. package/dist/services/cli/spec/cli-config.spec.js +0 -117
  276. package/dist/services/cli/spec/environment.spec.js +0 -28
  277. package/dist/services/config-api/entity-manager-factory.d.ts +0 -5
  278. package/dist/services/customer-config/customer-config-service-context.d.ts +0 -13
  279. package/dist/services/customer-config/customer-config-service-context.js +0 -21
  280. package/dist/services/deploy/context/deploy-context.d.ts +0 -32
  281. package/dist/services/deploy/context/deploy-context.js +0 -72
  282. package/dist/services/diff/diff-model.d.ts +0 -9
  283. package/dist/services/diff/diff-model.js +0 -12
  284. package/dist/services/origin-request/origin-request-context.d.ts +0 -13
  285. package/dist/services/origin-request/origin-request-context.js +0 -23
  286. package/dist/services/query-builder/query-command.d.ts +0 -28
  287. package/dist/services/query-builder/query-command.js +0 -37
  288. package/dist/services/setup/setup-context.d.ts +0 -14
  289. package/dist/services/setup/setup-context.js +0 -15
  290. /package/dist/{models/spec/cli-parameters.spec.d.ts → services/cli/command-build-context.js} +0 -0
  291. /package/dist/services/cli/spec/{cli-config.spec.d.ts → cli-environment-detection.spec.d.ts} +0 -0
  292. /package/dist/services/cli/spec/{environment.spec.d.ts → cli-environment.spec.d.ts} +0 -0
  293. /package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.js → document-handler-runtime-model.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [4.36.2](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.36.1...v4.36.2) (2026-09-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **query:** keep the action lines out of a --quiet payload ([a71aa5e](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/a71aa5eb80ed0f121d43e1191efaf1135860bb9a))
7
+
1
8
  ## [4.36.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.36.0...v4.36.1) (2026-09-25)
2
9
 
3
10
 
@@ -0,0 +1,41 @@
1
+ import { Command } from "@oclif/core";
2
+ import { CliEnvironment, CommandBuildContext } from "../services/cli/index.js";
3
+ /**
4
+ * The base of every `sk` command: before `run()` it builds the invocation's
5
+ * environment, with its one CLI, and — when the command names one — the build
6
+ * context of the service it runs.
7
+ *
8
+ * ```ts
9
+ * export default class Pull extends SkCommand<PullServiceBuildContext> {
10
+ * static buildContext = PullServiceBuildContext;
11
+ * static args = PullServiceBuildContext.args;
12
+ * static flags = PullServiceBuildContext.flags;
13
+ *
14
+ * async run() {
15
+ * const service = await new PullServiceFactory(this.context).buildService();
16
+ * await service.run();
17
+ * }
18
+ * }
19
+ * ```
20
+ *
21
+ * Building both here, once, is what makes the environment and the CLI single
22
+ * per run. Commands live in `src/commands/`, where oclif loads every file as a
23
+ * command, so this base lives outside it.
24
+ */
25
+ export declare abstract class SkCommand<Built = never> extends Command {
26
+ /** The build context this command creates from its args and flags, if any. */
27
+ static buildContext?: CommandBuildContext<unknown>;
28
+ /** The environment of this invocation; `environment.cli` is its CLI. */
29
+ protected environment: CliEnvironment;
30
+ /** The build context, when the command names one in `buildContext`. */
31
+ protected context: Built;
32
+ init(): Promise<void>;
33
+ /**
34
+ * The customer whose documentHandler node modules the environment points
35
+ * at. None by default; onboarding, which runs the documentHandler locally,
36
+ * names its customer.
37
+ */
38
+ protected customerPathForModules(_args: Record<string, unknown>): string | undefined;
39
+ /** Whether the CLI is built quiet: the command's `--quiet`, if it has one. */
40
+ protected quietCli(flags: Record<string, unknown>): boolean;
41
+ }
@@ -0,0 +1,56 @@
1
+ import { Command } from "@oclif/core";
2
+ import { CliEnvironmentFactory, } from "../services/cli/index.js";
3
+ /**
4
+ * The base of every `sk` command: before `run()` it builds the invocation's
5
+ * environment, with its one CLI, and — when the command names one — the build
6
+ * context of the service it runs.
7
+ *
8
+ * ```ts
9
+ * export default class Pull extends SkCommand<PullServiceBuildContext> {
10
+ * static buildContext = PullServiceBuildContext;
11
+ * static args = PullServiceBuildContext.args;
12
+ * static flags = PullServiceBuildContext.flags;
13
+ *
14
+ * async run() {
15
+ * const service = await new PullServiceFactory(this.context).buildService();
16
+ * await service.run();
17
+ * }
18
+ * }
19
+ * ```
20
+ *
21
+ * Building both here, once, is what makes the environment and the CLI single
22
+ * per run. Commands live in `src/commands/`, where oclif loads every file as a
23
+ * command, so this base lives outside it.
24
+ */
25
+ export class SkCommand extends Command {
26
+ /** The build context this command creates from its args and flags, if any. */
27
+ static buildContext;
28
+ /** The environment of this invocation; `environment.cli` is its CLI. */
29
+ environment;
30
+ /** The build context, when the command names one in `buildContext`. */
31
+ context;
32
+ async init() {
33
+ await super.init();
34
+ const { args, flags } = await this.parse();
35
+ this.environment = new CliEnvironmentFactory(this.config, {
36
+ customerPath: this.customerPathForModules(args),
37
+ quiet: this.quietCli(flags),
38
+ }).buildEnvironment();
39
+ const { buildContext } = this.constructor;
40
+ if (buildContext) {
41
+ this.context = buildContext.create(args, flags, this.environment);
42
+ }
43
+ }
44
+ /**
45
+ * The customer whose documentHandler node modules the environment points
46
+ * at. None by default; onboarding, which runs the documentHandler locally,
47
+ * names its customer.
48
+ */
49
+ customerPathForModules(_args) {
50
+ return undefined;
51
+ }
52
+ /** Whether the CLI is built quiet: the command's `--quiet`, if it has one. */
53
+ quietCli(flags) {
54
+ return flags["quiet"] === true;
55
+ }
56
+ }
@@ -1,12 +1,12 @@
1
- import { Command } from "@oclif/core";
2
- export default class AutoPrewarm extends Command {
1
+ import { SkCommand } from "../base/sk-command.js";
2
+ import { AutoPreWarmServiceBuildContext } from "../services/prewarm/index.js";
3
+ export default class AutoPrewarm extends SkCommand<AutoPreWarmServiceBuildContext> {
4
+ static buildContext: typeof AutoPreWarmServiceBuildContext;
3
5
  static args: {
4
6
  customerPath: import("@oclif/core/interfaces").Arg<string, {
5
7
  exists?: boolean;
6
8
  }>;
7
9
  };
8
- static description: string;
9
- static examples: string[];
10
10
  static flags: {
11
11
  variationPath: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
12
  keepParameterSorting: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -27,5 +27,7 @@ export default class AutoPrewarm extends Command {
27
27
  catalog: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
28
28
  workgroup: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
29
29
  };
30
+ static description: string;
31
+ static examples: string[];
30
32
  run(): Promise<void>;
31
33
  }
@@ -1,73 +1,20 @@
1
- import { Command, Flags } from "@oclif/core";
2
- import { CLI_ATHENA, CLI_CONFIG_NAME, CLI_CUSTOMER_CONFIG, CLI_QUERY_DAYS, CLI_QUERY_FILTERS, CLI_QUERY_PREWARM_LIST, CLIParameters, CLIParametersChar, CLIParametersExample, } from "../models/cli-parameters.js";
3
- import { AutoPreWarmFactory } from "../services/prewarm/index.js";
4
- import { CliConfig } from "../services/cli/index.js";
5
- export default class AutoPrewarm extends Command {
6
- static args = CLI_CUSTOMER_CONFIG;
1
+ import { SkCommand } from "../base/sk-command.js";
2
+ import { AutoPreWarmFactory, AutoPreWarmServiceBuildContext, } from "../services/prewarm/index.js";
3
+ export default class AutoPrewarm extends SkCommand {
4
+ static buildContext = AutoPreWarmServiceBuildContext;
5
+ static args = AutoPreWarmServiceBuildContext.args;
6
+ static flags = AutoPreWarmServiceBuildContext.flags;
7
7
  static description = "Build and execute the prewarm query for a customer config and start a prewarm job from the resulting URLs — no CSV needed";
8
8
  static examples = [
9
- `$ sk auto-prewarm <${CLIParameters.CustomerPath}> -${CLIParametersChar.ConfigName} <${CLIParameters.ConfigName}>`,
10
- `$ sk auto-prewarm ${CLIParametersExample.CustomerPath} -${CLIParametersChar.ConfigName} ${CLIParametersExample.ConfigName}`,
11
- `$ sk auto-prewarm ${CLIParametersExample.CustomerPath} --${CLIParameters.Device} ${CLIParametersExample.Devices}`,
12
- `$ sk auto-prewarm ${CLIParametersExample.CustomerPath} -${CLIParametersChar.Variation} ${CLIParametersExample.Variations}`,
13
- `$ sk auto-prewarm ${CLIParametersExample.CustomerPath} --${CLIParameters.Limit} 5000 --${CLIParameters.MinHits} 5`,
14
- `$ sk auto-prewarm ${CLIParametersExample.CustomerPath} --${CLIParameters.Workgroup} prewarming`,
9
+ `$ sk auto-prewarm <customerPath> -c <configName>`,
10
+ `$ sk auto-prewarm customers/decathlon.de -c production`,
11
+ `$ sk auto-prewarm customers/decathlon.de --device desktop,mobile`,
12
+ `$ sk auto-prewarm customers/decathlon.de -v MOBILE,DESKTOP`,
13
+ `$ sk auto-prewarm customers/decathlon.de --limit 5000 --minHits 5`,
14
+ `$ sk auto-prewarm customers/decathlon.de --workgroup prewarming`,
15
15
  ];
16
- static flags = {
17
- ...CLI_ATHENA,
18
- ...CLI_CONFIG_NAME,
19
- ...CLI_QUERY_DAYS,
20
- ...CLI_QUERY_FILTERS,
21
- // Every flag that shapes the pre-warm list, not a subset of them: this
22
- // command builds the same query `sk query prewarm` does, and a list it
23
- // could not narrow the same way could not be counted by that command
24
- // either — the two would describe different runs. `--count` is not among
25
- // them: this command warms the list rather than reporting its size.
26
- ...CLI_QUERY_PREWARM_LIST,
27
- // A variations file says what `--variation` says, read from disk.
28
- [CLIParameters.VariationPath]: Flags.file({
29
- char: CLIParametersChar.VariationPath,
30
- description: "path to variations.csv",
31
- exclusive: [CLIParameters.Device, CLIParameters.Variation],
32
- }),
33
- [CLIParameters.KeepParameterSorting]: Flags.boolean({
34
- char: CLIParametersChar.KeepParameterSorting,
35
- default: false,
36
- description: "Prevents alphabetical sorting of the URL parameters",
37
- }),
38
- [CLIParameters.Quiet]: Flags.boolean({
39
- char: CLIParametersChar.Quiet,
40
- default: false,
41
- description: "less output non interactive",
42
- }),
43
- [CLIParameters.Verbose]: Flags.boolean({
44
- default: false,
45
- description: "Log information about failed requests",
46
- }),
47
- };
48
16
  async run() {
49
- const { args: { customerPath }, flags: { configName, days, device, excludeNoindex, excludeNotFound, excludeSuspicious, hardNavigationsOnly, keepParameterSorting, limit, match, minHits, quiet, variation, variationPath, verbose, workgroup, catalog, }, } = await this.parse(AutoPrewarm);
50
- const service = await new AutoPreWarmFactory({
51
- customerPath,
52
- configName,
53
- days,
54
- device,
55
- excludeNoindex,
56
- excludeNotFound,
57
- excludeSuspicious,
58
- hardNavigationsOnly,
59
- limit,
60
- match,
61
- minHits,
62
- variation,
63
- variationPath,
64
- sortParameters: !keepParameterSorting,
65
- quiet,
66
- verbose,
67
- workgroup,
68
- catalog,
69
- isWindows: this.config.windows,
70
- }, new CliConfig(this.config).load()).getService();
17
+ const service = await new AutoPreWarmFactory(this.context).getService();
71
18
  await service.run();
72
19
  }
73
20
  }
@@ -1,11 +1,11 @@
1
- import { Command } from "@oclif/core";
1
+ import { SkCommand } from "../../base/sk-command.js";
2
2
  /**
3
3
  * Fish is not supported by @oclif/plugin-autocomplete (only bash, zsh and
4
4
  * powershell), so this command generates a fish completion script from the
5
5
  * oclif command manifest and installs it to ~/.config/fish/completions,
6
6
  * where fish picks it up automatically.
7
7
  */
8
- export default class AutocompleteFish extends Command {
8
+ export default class AutocompleteFish extends SkCommand {
9
9
  static description: string;
10
10
  static examples: string[];
11
11
  static flags: {
@@ -1,4 +1,5 @@
1
- import { Command, Flags } from "@oclif/core";
1
+ import { Flags } from "@oclif/core";
2
+ import { SkCommand } from "../../base/sk-command.js";
2
3
  import { mkdir, writeFile } from "node:fs/promises";
3
4
  import os from "node:os";
4
5
  import path from "node:path";
@@ -8,7 +9,7 @@ import path from "node:path";
8
9
  * oclif command manifest and installs it to ~/.config/fish/completions,
9
10
  * where fish picks it up automatically.
10
11
  */
11
- export default class AutocompleteFish extends Command {
12
+ export default class AutocompleteFish extends SkCommand {
12
13
  static description = "Generate fish shell completions and install them to ~/.config/fish/completions.";
13
14
  static examples = [
14
15
  "$ sk autocomplete fish",
@@ -1,5 +1,5 @@
1
- import { Command } from "@oclif/core";
2
- export default class BrowserClean extends Command {
1
+ import { SkCommand } from "../../base/sk-command.js";
2
+ export default class BrowserClean extends SkCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static flags: {
@@ -1,7 +1,7 @@
1
- import { Command, Flags } from "@oclif/core";
2
- import { CliConfig, CliServiceFactory } from "../../services/cli/index.js";
1
+ import { Flags } from "@oclif/core";
2
+ import { SkCommand } from "../../base/sk-command.js";
3
3
  import { BrowserManager, } from "../../services/setup/index.js";
4
- export default class BrowserClean extends Command {
4
+ export default class BrowserClean extends SkCommand {
5
5
  static description = "Remove puppeteer-managed browser builds from the cache";
6
6
  static examples = ["$ sk browser clean", "$ sk browser clean --all"];
7
7
  static flags = {
@@ -12,9 +12,9 @@ export default class BrowserClean extends Command {
12
12
  };
13
13
  async run() {
14
14
  const { flags } = await this.parse(BrowserClean);
15
- const cli = new CliServiceFactory().getService();
16
- const userConfig = new CliConfig(this.config).load();
17
- const manager = new BrowserManager(userConfig.tempFolder, cli);
15
+ const cli = this.environment.cli;
16
+ const environment = this.environment;
17
+ const manager = new BrowserManager(environment.cacheDir, cli);
18
18
  const installed = manager.list();
19
19
  if (installed.length === 0) {
20
20
  cli.writeWarning("No puppeteer-managed browsers to clean.");
@@ -1,5 +1,5 @@
1
- import { Command } from "@oclif/core";
2
- export default class BrowserList extends Command {
1
+ import { SkCommand } from "../../base/sk-command.js";
2
+ export default class BrowserList extends SkCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  run(): Promise<void>;
@@ -1,13 +1,12 @@
1
- import { Command } from "@oclif/core";
2
- import { CliConfig, CliServiceFactory } from "../../services/cli/index.js";
1
+ import { SkCommand } from "../../base/sk-command.js";
3
2
  import { BrowserDetector, normalizePlatform, } from "../../services/setup/index.js";
4
- export default class BrowserList extends Command {
3
+ export default class BrowserList extends SkCommand {
5
4
  static description = "List detected system browsers and puppeteer-managed builds";
6
5
  static examples = ["$ sk browser list"];
7
6
  async run() {
8
- const cli = new CliServiceFactory().getService();
9
- const userConfig = new CliConfig(this.config).load();
10
- const detector = new BrowserDetector(normalizePlatform(this.config.platform), this.config.home, userConfig.tempFolder);
7
+ const cli = this.environment.cli;
8
+ const environment = this.environment;
9
+ const detector = new BrowserDetector(normalizePlatform(this.config.platform), this.config.home, environment.cacheDir);
11
10
  const browsers = detector.detectAll();
12
11
  if (browsers.length === 0) {
13
12
  cli.writeWarning("No browsers detected.");
@@ -17,7 +16,7 @@ export default class BrowserList extends Command {
17
16
  name: browser.name,
18
17
  source: browser.source,
19
18
  path: browser.executablePath,
20
- active: browser.executablePath === userConfig.chromePath ? "✔" : "",
19
+ active: browser.executablePath === environment.settings.chromePath ? "✔" : "",
21
20
  })), {
22
21
  name: { header: "Browser" },
23
22
  source: { header: "Source" },
@@ -1,5 +1,5 @@
1
- import { Command } from "@oclif/core";
2
- export default class BrowserUpdate extends Command {
1
+ import { SkCommand } from "../../base/sk-command.js";
2
+ export default class BrowserUpdate extends SkCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  run(): Promise<void>;
@@ -1,27 +1,25 @@
1
- import { Command } from "@oclif/core";
2
- import { CliConfig, CliServiceFactory } from "../../services/cli/index.js";
1
+ import { SkCommand } from "../../base/sk-command.js";
3
2
  import { BrowserManager } from "../../services/setup/index.js";
4
- export default class BrowserUpdate extends Command {
3
+ export default class BrowserUpdate extends SkCommand {
5
4
  static description = "Update the puppeteer-managed browser to the latest build of its channel";
6
5
  static examples = ["$ sk browser update"];
7
6
  async run() {
8
- const cli = new CliServiceFactory().getService();
9
- const cliConfig = new CliConfig(this.config);
10
- const userConfig = cliConfig.load();
11
- const channel = userConfig.browserChannel;
7
+ const cli = this.environment.cli;
8
+ const environment = this.environment;
9
+ const channel = environment.settings.browserChannel;
12
10
  if (channel !== "stable" && channel !== "experimental") {
13
11
  cli.writeWarning("No puppeteer-managed browser configured. Run `sk config setup` first.");
14
12
  return;
15
13
  }
16
- const manager = new BrowserManager(userConfig.tempFolder, cli);
14
+ const manager = new BrowserManager(environment.cacheDir, cli);
17
15
  const latest = await manager.resolveBuildId(channel);
18
- if (latest === userConfig.browserBuildId) {
16
+ if (latest === environment.settings.browserBuildId) {
19
17
  cli.writeSuccess(`Already on the latest ${channel} build (${latest}).`);
20
- cliConfig.save({ lastBrowserUpdateCheck: new Date().toISOString() });
18
+ environment.save({ lastBrowserUpdateCheck: new Date().toISOString() });
21
19
  return;
22
20
  }
23
21
  const installed = await manager.installChannel(channel);
24
- cliConfig.save({
22
+ environment.save({
25
23
  chromePath: installed.executablePath,
26
24
  browserBuildId: installed.buildId,
27
25
  lastBrowserUpdateCheck: new Date().toISOString(),
@@ -1,5 +1,7 @@
1
- import { Command } from "@oclif/core";
2
- export default class BulkDeploy extends Command {
1
+ import { SkCommand } from "../base/sk-command.js";
2
+ import { BulkDeployServiceBuildContext } from "../services/deploy/bulk/index.js";
3
+ export default class BulkDeploy extends SkCommand<BulkDeployServiceBuildContext> {
4
+ static buildContext: typeof BulkDeployServiceBuildContext;
3
5
  static args: {
4
6
  mr: import("@oclif/core/interfaces").Arg<number, {
5
7
  max?: number;
@@ -1,47 +1,17 @@
1
- import { Args, Command, Flags } from "@oclif/core";
2
- import { CliConfig } from "../services/cli/index.js";
3
- import { BulkDeployContext, BulkDeployServiceFactory, } from "../services/deploy/bulk/index.js";
1
+ import { SkCommand } from "../base/sk-command.js";
2
+ import { BulkDeployServiceBuildContext, BulkDeployServiceFactory, } from "../services/deploy/bulk/index.js";
4
3
  import { DeployOutcome } from "../services/deploy/mr/index.js";
5
- export default class BulkDeploy extends Command {
6
- static args = {
7
- mr: Args.integer({
8
- name: "mr",
9
- required: true,
10
- description: "The number of the merged merge request",
11
- }),
12
- };
4
+ export default class BulkDeploy extends SkCommand {
5
+ static buildContext = BulkDeployServiceBuildContext;
6
+ static args = BulkDeployServiceBuildContext.args;
13
7
  static description = "Deploys the production config of every customer of a merged merge request at once. Use sk deploy --mr for a single customer";
14
- static flags = {
15
- repository: Flags.directory({
16
- char: "r",
17
- default: ".",
18
- description: "A path in the repository that holds the customer configs",
19
- }),
20
- approval: Flags.string({
21
- options: ["approved", "testing", "skip"],
22
- description: "what to do with a customer that approves every rollout themselves",
23
- }),
24
- description: Flags.string({
25
- description: "the description every installation of the run gets, asked while it is left out",
26
- }),
27
- dryRun: Flags.boolean({
28
- char: "d",
29
- default: false,
30
- description: "dry run",
31
- }),
32
- yes: Flags.boolean({
33
- char: "y",
34
- default: false,
35
- description: "deploy the plan without the confirmation",
36
- }),
37
- };
8
+ static flags = BulkDeployServiceBuildContext.flags;
38
9
  static examples = [
39
10
  "$ sk bulk-deploy 8017",
40
11
  "$ sk bulk-deploy 8017 -r ../sk-onboarding --approval testing",
41
12
  ];
42
13
  async run() {
43
- const { args: { mr }, flags: { repository, approval, description, dryRun, yes }, } = await this.parse(BulkDeploy);
44
- const service = new BulkDeployServiceFactory(new BulkDeployContext(repository, mr, approval, description, dryRun, yes), new CliConfig(this.config).load()).getService();
14
+ const service = new BulkDeployServiceFactory(this.context).getService();
45
15
  const results = await service.run();
46
16
  // A failure of one configuration is a failure of the run, so a pipeline
47
17
  // that calls this command sees it.
@@ -1,5 +1,5 @@
1
- import { Command } from "@oclif/core";
2
- export default class Edit extends Command {
1
+ import { SkCommand } from "../../base/sk-command.js";
2
+ export default class Edit extends SkCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  run(): Promise<void>;
@@ -1,9 +1,9 @@
1
- import { Command } from "@oclif/core";
1
+ import { SkCommand } from "../../base/sk-command.js";
2
2
  import path from "node:path";
3
3
  import { spawn } from "node:child_process";
4
4
  import * as dotenv from "dotenv";
5
5
  dotenv.config({ quiet: true });
6
- export default class Edit extends Command {
6
+ export default class Edit extends SkCommand {
7
7
  static description = "Edit cli config";
8
8
  static examples = [`$ sk config edit`];
9
9
  async run() {
@@ -1,7 +1,10 @@
1
- import { Command } from "@oclif/core";
2
- export default class Setup extends Command {
1
+ import { SkCommand } from "../../base/sk-command.js";
2
+ import { SetupServiceBuildContext } from "../../services/setup/index.js";
3
+ export default class Setup extends SkCommand<SetupServiceBuildContext> {
3
4
  static description: string;
4
5
  static examples: string[];
6
+ static buildContext: typeof SetupServiceBuildContext;
7
+ static args: {};
5
8
  static flags: {
6
9
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
10
  postInstall: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -1,26 +1,16 @@
1
- import { Command, Flags } from "@oclif/core";
2
- import { SetupContext, SetupServiceFactory, } from "../../services/setup/index.js";
3
- import { CliServiceFactory } from "../../services/cli/index.js";
4
- export default class Setup extends Command {
1
+ import { SkCommand } from "../../base/sk-command.js";
2
+ import { SetupServiceBuildContext, SetupServiceFactory, } from "../../services/setup/index.js";
3
+ export default class Setup extends SkCommand {
5
4
  static description = "Run the Speed Kit CLI setup wizard (choose browser and diff tool)";
6
5
  static examples = ["$ sk config setup", "$ sk config setup --force"];
7
- static flags = {
8
- force: Flags.boolean({
9
- char: "f",
10
- description: "Re-run even if setup was already completed",
11
- }),
12
- postInstall: Flags.boolean({
13
- hidden: true,
14
- description: "Internal flag used by the npm postinstall hook",
15
- }),
16
- };
6
+ static buildContext = SetupServiceBuildContext;
7
+ static args = SetupServiceBuildContext.args;
8
+ static flags = SetupServiceBuildContext.flags;
17
9
  async run() {
18
- const { flags } = await this.parse(Setup);
19
- const cli = new CliServiceFactory().getService();
20
- const context = new SetupContext(flags.postInstall, flags.force);
21
- const service = new SetupServiceFactory(this.config, context, cli).getService();
10
+ const cli = this.environment.cli;
11
+ const service = new SetupServiceFactory(this.context).getService();
22
12
  // When triggered by postinstall, only run if it is safe and not yet done.
23
- if (flags.postInstall &&
13
+ if (this.context.postInstall &&
24
14
  (cli.nonInteractive || service.isFirstRunCompleted())) {
25
15
  return;
26
16
  }
@@ -1,11 +1,20 @@
1
- import { Command } from "@oclif/core";
2
- export default class Deploy extends Command {
1
+ import { SkCommand } from "../base/sk-command.js";
2
+ export default class Deploy extends SkCommand {
3
3
  static args: {
4
4
  customerPath: import("@oclif/core/interfaces").Arg<string, {
5
5
  exists?: boolean;
6
6
  }>;
7
7
  };
8
- static flags: Record<string, Command.Flag>;
8
+ static flags: {
9
+ dryRun: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ verboseLevel: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ artifacts: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ mr: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
13
+ description: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ approval: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ useTestConfig: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ configName: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
17
+ };
9
18
  static description: string;
10
19
  static examples: string[];
11
20
  run(): Promise<void>;
@@ -1,27 +1,23 @@
1
- import { Command } from "@oclif/core";
2
- import { CLI_CUSTOMER_CONFIG, CLIParameters, CLIParametersChar, CLIParametersExample, } from "../models/cli-parameters.js";
3
- import DeployContext from "../services/deploy/context/deploy-context.js";
1
+ import { SkCommand } from "../base/sk-command.js";
2
+ import { DeployServiceBuildContext } from "../services/deploy/deploy-service-build-context.js";
4
3
  import DeployServiceFactory from "../services/deploy/deploy-service-factory.js";
5
4
  import { DeployAbortedError } from "../services/deploy/error/deploy-aborted-error.js";
6
- import { MergeRequestDeployContext, MergeRequestDeployServiceFactory, } from "../services/deploy/mr/index.js";
7
- import { ApprovalAnswer } from "../services/deploy/policy/auto-deploy-policy.js";
8
- import { CliConfig } from "../services/cli/index.js";
9
- export default class Deploy extends Command {
10
- static args = CLI_CUSTOMER_CONFIG;
11
- static flags = DeployContext.flags;
5
+ import { MergeRequestDeployServiceBuildContext, MergeRequestDeployServiceFactory, } from "../services/deploy/mr/index.js";
6
+ export default class Deploy extends SkCommand {
7
+ static args = DeployServiceBuildContext.args;
8
+ static flags = DeployServiceBuildContext.flags;
12
9
  static description = "Deploys the specified customer config while comparing to the live version before";
13
10
  static examples = [
14
- `$ sk deploy <${CLIParameters.CustomerPath}> -${CLIParametersChar.ConfigName} <${CLIParameters.ConfigName}> -${CLIParametersChar.SlackToken} <${CLIParameters.SlackToken}> -${CLIParametersChar.Artifacts} <${CLIParameters.Artifacts}> -${CLIParametersChar.DryRun} <${CLIParameters.DryRun}>`,
15
- `$ sk deploy ${CLIParametersExample.CustomerPath} -${CLIParametersChar.ConfigName} ${CLIParametersExample.ConfigName} -${CLIParametersChar.SlackToken} ${CLIParametersExample.SlackToken} -${CLIParametersChar.Artifacts} ${CLIParametersExample.Artifacts} -${CLIParametersChar.DryRun}`,
11
+ `$ sk deploy <customerPath> -c <configName> -t <slackToken> -a <artifacts> -d <dryRun>`,
12
+ `$ sk deploy customers/decathlon.de -c production -t someSlackToken -a dynamic,SpeedKit -d`,
16
13
  ];
17
14
  async run() {
18
- const { args: { customerPath }, flags: { artifacts, configName, dryRun, useTestConfig, mr, approval, description, }, } = await this.parse(Deploy);
19
- if (mr) {
20
- await this.deployMergeRequest(customerPath, configName, mr, (approval ?? ApprovalAnswer.Skip), description, dryRun);
15
+ const { args, flags } = await this.parse(Deploy);
16
+ if (flags.mr) {
17
+ await this.deployMergeRequest(MergeRequestDeployServiceBuildContext.create(args, flags, this.environment));
21
18
  return;
22
19
  }
23
- const deployContext = new DeployContext(customerPath, configName, artifacts, dryRun, useTestConfig);
24
- const deployService = await new DeployServiceFactory(deployContext, new CliConfig(this.config).load()).buildService();
20
+ const deployService = await new DeployServiceFactory(DeployServiceBuildContext.create(args, flags, this.environment)).buildService();
25
21
  try {
26
22
  await deployService.run();
27
23
  }
@@ -35,10 +31,8 @@ export default class Deploy extends Command {
35
31
  }
36
32
  }
37
33
  /** Deploys the change of a merged merge request, without asking anybody. */
38
- async deployMergeRequest(customerPath, configName, iid, approval, description, dryRun) {
39
- const service = await new MergeRequestDeployServiceFactory(new MergeRequestDeployContext(customerPath, configName, iid, approval, description, dryRun, false,
40
- // A person at the keyboard reviews the change in their diff tool.
41
- Boolean(process.stdout.isTTY)), new CliConfig(this.config).load()).buildService();
34
+ async deployMergeRequest(context) {
35
+ const service = await new MergeRequestDeployServiceFactory(context).buildService();
42
36
  const result = await service.run();
43
37
  this.log(`${result.configName}: ${result.outcome}`);
44
38
  if (result.reason) {
@@ -1,6 +1,7 @@
1
- import { Config, Command } from "@oclif/core";
1
+ import { Config } from "@oclif/core";
2
+ import { SkCommand } from "../base/sk-command.js";
2
3
  import { CliServiceInterface } from "../services/cli/index.js";
3
- export default class DiffUrlParameters extends Command {
4
+ export default class DiffUrlParameters extends SkCommand {
4
5
  cli: CliServiceInterface;
5
6
  static description: string;
6
7
  static aliases: string[];