@speedkit/cli 4.36.1 → 4.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +12 -5
  3. package/dist/base/sk-command.d.ts +41 -0
  4. package/dist/base/sk-command.js +56 -0
  5. package/dist/commands/auto-prewarm.d.ts +6 -4
  6. package/dist/commands/auto-prewarm.js +13 -66
  7. package/dist/commands/autocomplete/fish.d.ts +2 -2
  8. package/dist/commands/autocomplete/fish.js +3 -2
  9. package/dist/commands/browser/clean.d.ts +2 -2
  10. package/dist/commands/browser/clean.js +6 -6
  11. package/dist/commands/browser/list.d.ts +2 -2
  12. package/dist/commands/browser/list.js +6 -7
  13. package/dist/commands/browser/update.d.ts +2 -2
  14. package/dist/commands/browser/update.js +9 -11
  15. package/dist/commands/bulk-deploy.d.ts +4 -2
  16. package/dist/commands/bulk-deploy.js +7 -37
  17. package/dist/commands/config/edit.d.ts +2 -2
  18. package/dist/commands/config/edit.js +2 -2
  19. package/dist/commands/config/setup.d.ts +5 -2
  20. package/dist/commands/config/setup.js +9 -19
  21. package/dist/commands/deploy.d.ts +12 -3
  22. package/dist/commands/deploy.js +14 -20
  23. package/dist/commands/diff-url-parameters.d.ts +3 -2
  24. package/dist/commands/diff-url-parameters.js +19 -16
  25. package/dist/commands/extension/add.d.ts +2 -2
  26. package/dist/commands/extension/add.js +6 -6
  27. package/dist/commands/extension/devtools.d.ts +2 -2
  28. package/dist/commands/extension/devtools.js +6 -7
  29. package/dist/commands/extension/list.d.ts +2 -2
  30. package/dist/commands/extension/list.js +5 -6
  31. package/dist/commands/extension/remove.d.ts +2 -2
  32. package/dist/commands/extension/remove.js +6 -6
  33. package/dist/commands/extension/update.d.ts +2 -2
  34. package/dist/commands/extension/update.js +5 -6
  35. package/dist/commands/find-pops.d.ts +2 -2
  36. package/dist/commands/find-pops.js +10 -11
  37. package/dist/commands/generate-customer-config.d.ts +5 -2
  38. package/dist/commands/generate-customer-config.js +9 -27
  39. package/dist/commands/generate-pop-config.d.ts +2 -2
  40. package/dist/commands/generate-pop-config.js +19 -15
  41. package/dist/commands/login.d.ts +2 -2
  42. package/dist/commands/login.js +6 -9
  43. package/dist/commands/onboarding.d.ts +19 -3
  44. package/dist/commands/onboarding.js +15 -11
  45. package/dist/commands/origin-request.d.ts +4 -2
  46. package/dist/commands/origin-request.js +10 -42
  47. package/dist/commands/prewarm.d.ts +4 -2
  48. package/dist/commands/prewarm.js +12 -56
  49. package/dist/commands/pull.d.ts +4 -2
  50. package/dist/commands/pull.js +9 -14
  51. package/dist/commands/query/parameter.d.ts +4 -2
  52. package/dist/commands/query/parameter.js +12 -19
  53. package/dist/commands/query/prewarm.d.ts +4 -2
  54. package/dist/commands/query/prewarm.js +16 -23
  55. package/dist/commands/revalidate.d.ts +4 -2
  56. package/dist/commands/revalidate.js +13 -56
  57. package/dist/commands/wpt-launcher.d.ts +2 -2
  58. package/dist/commands/wpt-launcher.js +16 -17
  59. package/dist/hooks/init/first-run.js +9 -10
  60. package/dist/models/context.d.ts +24 -0
  61. package/dist/models/context.js +31 -0
  62. package/dist/services/athena/athena-flags.d.ts +18 -0
  63. package/dist/services/athena/athena-flags.js +29 -0
  64. package/dist/services/athena/athena-service-build-context.d.ts +25 -0
  65. package/dist/services/athena/athena-service-build-context.js +4 -0
  66. package/dist/services/athena/athena-service-factory.d.ts +3 -16
  67. package/dist/services/athena/athena-service-factory.js +11 -27
  68. package/dist/services/athena/baqend-athena-service.d.ts +3 -14
  69. package/dist/services/athena/baqend-athena-service.js +8 -16
  70. package/dist/services/athena/index.d.ts +1 -0
  71. package/dist/services/athena/index.js +1 -0
  72. package/dist/services/athena/spec/baqend-athena-service.spec.js +2 -2
  73. package/dist/services/browser-fetch/browser-origin-fetch.d.ts +2 -2
  74. package/dist/services/browser-fetch/browser-origin-fetch.js +1 -1
  75. package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +3 -3
  76. package/dist/services/browser-fetch/browser-origin-fetcher.js +5 -5
  77. package/dist/services/browser-fetch/spec/browser-origin-fetch.spec.js +10 -10
  78. package/dist/services/cli/cli-environment-factory.d.ts +25 -0
  79. package/dist/services/cli/cli-environment-factory.js +30 -0
  80. package/dist/services/cli/cli-environment.d.ts +73 -0
  81. package/dist/services/cli/cli-environment.js +216 -0
  82. package/dist/services/cli/cli-service-build-context.d.ts +10 -0
  83. package/dist/services/cli/cli-service-build-context.js +4 -0
  84. package/dist/services/cli/cli-service-factory.d.ts +7 -7
  85. package/dist/services/cli/cli-service-factory.js +7 -7
  86. package/dist/services/cli/cli-service-model.d.ts +0 -4
  87. package/dist/services/cli/cli-service-model.js +0 -6
  88. package/dist/services/cli/cli-service.d.ts +16 -2
  89. package/dist/services/cli/cli-service.js +17 -18
  90. package/dist/services/cli/cli-settings.d.ts +37 -0
  91. package/dist/services/cli/cli-settings.js +23 -0
  92. package/dist/services/cli/command-build-context.d.ts +23 -0
  93. package/dist/services/cli/index.d.ts +5 -1
  94. package/dist/services/cli/index.js +5 -1
  95. package/dist/services/cli/spec/cli-environment-detection.spec.js +52 -0
  96. package/dist/services/cli/spec/cli-environment.spec.js +125 -0
  97. package/dist/services/cli/spec/cli-service.spec.js +9 -19
  98. package/dist/services/config-api/client.d.ts +3 -3
  99. package/dist/services/config-api/client.js +4 -4
  100. package/dist/services/config-api/config-api-factory.js +3 -3
  101. package/dist/services/config-api/entity-manager-provider.d.ts +11 -0
  102. package/dist/services/config-api/{entity-manager-factory.js → entity-manager-provider.js} +7 -1
  103. package/dist/services/customer-config/customer-config-service-build-context.d.ts +33 -0
  104. package/dist/services/customer-config/customer-config-service-build-context.js +36 -0
  105. package/dist/services/customer-config/customer-config-service-factory.d.ts +3 -4
  106. package/dist/services/customer-config/customer-config-service-factory.js +5 -8
  107. package/dist/services/customer-config/customer-config-service.d.ts +2 -2
  108. package/dist/services/customer-config/index.d.ts +1 -1
  109. package/dist/services/customer-config/index.js +1 -1
  110. package/dist/services/customer-config/site-analyzer/index.d.ts +1 -0
  111. package/dist/services/customer-config/site-analyzer/index.js +1 -0
  112. package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.d.ts +6 -0
  113. package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.js +4 -0
  114. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.d.ts +3 -3
  115. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.js +4 -5
  116. package/dist/services/deploy/bulk/bulk-deploy-model.d.ts +0 -25
  117. package/dist/services/deploy/bulk/bulk-deploy-model.js +1 -27
  118. package/dist/services/deploy/bulk/bulk-deploy-service-build-context.d.ts +51 -0
  119. package/dist/services/deploy/bulk/bulk-deploy-service-build-context.js +50 -0
  120. package/dist/services/deploy/bulk/bulk-deploy-service-factory.d.ts +2 -4
  121. package/dist/services/deploy/bulk/bulk-deploy-service-factory.js +2 -5
  122. package/dist/services/deploy/bulk/bulk-deploy-service.d.ts +3 -2
  123. package/dist/services/deploy/bulk/config-deploy-factory.d.ts +3 -3
  124. package/dist/services/deploy/bulk/config-deploy-factory.js +16 -8
  125. package/dist/services/deploy/bulk/index.d.ts +1 -0
  126. package/dist/services/deploy/bulk/index.js +1 -0
  127. package/dist/services/deploy/checks/activation/customer-approval-check.d.ts +3 -1
  128. package/dist/services/deploy/checks/activation/customer-approval-check.js +4 -2
  129. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.d.ts +3 -1
  130. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +4 -2
  131. package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -1
  132. package/dist/services/deploy/checks/pre-deploy/split-change-check.js +4 -2
  133. package/dist/services/deploy/deploy-service-build-context.d.ts +63 -0
  134. package/dist/services/deploy/deploy-service-build-context.js +64 -0
  135. package/dist/services/deploy/deploy-service-factory.d.ts +5 -8
  136. package/dist/services/deploy/deploy-service-factory.js +28 -19
  137. package/dist/services/deploy/mr/base-config-reader.d.ts +6 -4
  138. package/dist/services/deploy/mr/base-config-reader.js +6 -8
  139. package/dist/services/deploy/mr/index.d.ts +1 -0
  140. package/dist/services/deploy/mr/index.js +1 -0
  141. package/dist/services/deploy/mr/merge-request-deploy-model.d.ts +0 -35
  142. package/dist/services/deploy/mr/merge-request-deploy-model.js +0 -34
  143. package/dist/services/deploy/mr/merge-request-deploy-service-build-context.d.ts +32 -0
  144. package/dist/services/deploy/mr/merge-request-deploy-service-build-context.js +20 -0
  145. package/dist/services/deploy/mr/merge-request-deploy-service-factory.d.ts +2 -4
  146. package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +31 -10
  147. package/dist/services/deploy/mr/merge-request-deploy-service.d.ts +3 -2
  148. package/dist/services/deploy/spec/bulk/bulk-deploy-service.spec.js +14 -3
  149. package/dist/services/deploy/spec/checks/activation/customer-approval-check.spec.js +7 -5
  150. package/dist/services/deploy/spec/checks/pre-deploy/split-change-check.spec.js +2 -1
  151. package/dist/services/diff/diff-service-build-context.d.ts +14 -0
  152. package/dist/services/diff/diff-service-build-context.js +4 -0
  153. package/dist/services/diff/diff-service-factory.d.ts +4 -5
  154. package/dist/services/diff/diff-service-factory.js +4 -7
  155. package/dist/services/diff/index.d.ts +1 -1
  156. package/dist/services/diff/index.js +1 -1
  157. package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.d.ts → document-handler-runtime-model.d.ts} +0 -5
  158. package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.d.ts +11 -0
  159. package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.js +4 -0
  160. package/dist/services/document-handler-runtime/document-handler-server.js +2 -2
  161. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
  162. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +14 -14
  163. package/dist/services/document-handler-runtime/server/request.js +1 -1
  164. package/dist/services/document-handler-runtime/templates/database-mock.d.ts +1 -1
  165. package/dist/services/document-handler-runtime/templates/database-mock.js +1 -1
  166. package/dist/services/integration-api/customer-config-flags.d.ts +16 -0
  167. package/dist/services/integration-api/customer-config-flags.js +30 -0
  168. package/dist/services/integration-api/handler/install-resource-handler.d.ts +8 -0
  169. package/dist/services/integration-api/handler/install-resource-handler.js +10 -1
  170. package/dist/services/integration-api/index.d.ts +1 -0
  171. package/dist/services/integration-api/index.js +1 -0
  172. package/dist/services/integration-api/integration-api-factory.d.ts +4 -6
  173. package/dist/services/integration-api/integration-api-factory.js +11 -11
  174. package/dist/services/integration-api/integration-api-model.d.ts +0 -9
  175. package/dist/services/integration-api/integration-api-model.js +0 -16
  176. package/dist/services/integration-api/integration-api-service-build-context.d.ts +19 -0
  177. package/dist/services/integration-api/integration-api-service-build-context.js +4 -0
  178. package/dist/services/integration-api/spec/config-plugin.spec.js +1 -1
  179. package/dist/services/integration-api/spec/integration-api-service.spec.js +7 -3
  180. package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +9 -2
  181. package/dist/services/integration-api/struct/config-plugin.d.ts +1 -1
  182. package/dist/services/integration-api/struct/config-plugin.js +12 -7
  183. package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +18 -2
  184. package/dist/services/integration-api/struct/speed-kit-config-file.js +22 -12
  185. package/dist/services/integration-api/struct/speed-kit-config.d.ts +1 -1
  186. package/dist/services/onboarding/browse/browse-service.d.ts +18 -0
  187. package/dist/services/onboarding/browse/browse-service.js +61 -0
  188. package/dist/services/onboarding/browse/browse-url.d.ts +10 -0
  189. package/dist/services/onboarding/browse/browse-url.js +19 -0
  190. package/dist/services/onboarding/browser/config/browser-config.d.ts +3 -3
  191. package/dist/services/onboarding/browser/config/browser-config.js +5 -5
  192. package/dist/services/onboarding/browser/executable/executable-validator.d.ts +3 -3
  193. package/dist/services/onboarding/browser/executable/executable-validator.js +20 -16
  194. package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +3 -3
  195. package/dist/services/onboarding/browser/extension/extension-downloader.js +8 -6
  196. package/dist/services/onboarding/browser/extension/extension-validator.d.ts +3 -3
  197. package/dist/services/onboarding/browser/extension/extension-validator.js +4 -4
  198. package/dist/services/onboarding/browser/launch-browser.d.ts +9 -0
  199. package/dist/services/onboarding/browser/launch-browser.js +20 -0
  200. package/dist/services/onboarding/error/browse-domain-error.d.ts +6 -0
  201. package/dist/services/onboarding/error/browse-domain-error.js +11 -0
  202. package/dist/services/onboarding/error/missing-customer-path-error.d.ts +6 -0
  203. package/dist/services/onboarding/error/missing-customer-path-error.js +11 -0
  204. package/dist/services/onboarding/file-events/file-watcher.js +1 -0
  205. package/dist/services/onboarding/index.d.ts +1 -1
  206. package/dist/services/onboarding/index.js +1 -1
  207. package/dist/services/onboarding/onboarding-model.d.ts +8 -24
  208. package/dist/services/onboarding/onboarding-model.js +19 -87
  209. package/dist/services/onboarding/onboarding-service-build-context.d.ts +61 -0
  210. package/dist/services/onboarding/onboarding-service-build-context.js +79 -0
  211. package/dist/services/onboarding/onboarding-service-factory.d.ts +31 -6
  212. package/dist/services/onboarding/onboarding-service-factory.js +120 -48
  213. package/dist/services/onboarding/onboarding-service.d.ts +2 -0
  214. package/dist/services/onboarding/onboarding-service.js +5 -16
  215. package/dist/services/onboarding/spec/browse/browse-url.spec.d.ts +1 -0
  216. package/dist/services/onboarding/spec/browse/browse-url.spec.js +28 -0
  217. package/dist/services/onboarding/spec/onboarding-model.spec.js +11 -6
  218. package/dist/services/onboarding/spec/onboarding-service-factory.spec.d.ts +1 -0
  219. package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +155 -0
  220. package/dist/services/origin-request/index.d.ts +1 -1
  221. package/dist/services/origin-request/index.js +1 -1
  222. package/dist/services/origin-request/origin-request-service-build-context.d.ts +52 -0
  223. package/dist/services/origin-request/origin-request-service-build-context.js +54 -0
  224. package/dist/services/origin-request/origin-request-service-factory.d.ts +2 -5
  225. package/dist/services/origin-request/origin-request-service-factory.js +12 -12
  226. package/dist/services/origin-request/origin-request-service.d.ts +2 -2
  227. package/dist/services/pop-config/index.d.ts +1 -0
  228. package/dist/services/pop-config/index.js +1 -0
  229. package/dist/services/pop-config/pop-config-factory.d.ts +4 -1
  230. package/dist/services/pop-config/pop-config-factory.js +10 -3
  231. package/dist/services/pop-config/pop-config-service-build-context.d.ts +10 -0
  232. package/dist/services/pop-config/pop-config-service-build-context.js +4 -0
  233. package/dist/services/prewarm/auto-pre-warm-factory.d.ts +3 -31
  234. package/dist/services/prewarm/auto-pre-warm-factory.js +6 -11
  235. package/dist/services/prewarm/auto-pre-warm-service-build-context.d.ts +84 -0
  236. package/dist/services/prewarm/auto-pre-warm-service-build-context.js +68 -0
  237. package/dist/services/prewarm/index.d.ts +2 -0
  238. package/dist/services/prewarm/index.js +2 -0
  239. package/dist/services/prewarm/pre-warm-factory.d.ts +4 -5
  240. package/dist/services/prewarm/pre-warm-factory.js +6 -8
  241. package/dist/services/prewarm/pre-warm-model.d.ts +0 -10
  242. package/dist/services/prewarm/pre-warm-model.js +0 -18
  243. package/dist/services/prewarm/pre-warm-service-build-context.d.ts +47 -0
  244. package/dist/services/prewarm/pre-warm-service-build-context.js +64 -0
  245. package/dist/services/pull/index.d.ts +1 -0
  246. package/dist/services/pull/index.js +1 -0
  247. package/dist/services/pull/pull-service-build-context.d.ts +28 -0
  248. package/dist/services/pull/pull-service-build-context.js +17 -0
  249. package/dist/services/pull/pull-service-factory.d.ts +3 -5
  250. package/dist/services/pull/pull-service-factory.js +13 -14
  251. package/dist/services/pull/pull-service-model.d.ts +0 -5
  252. package/dist/services/pull/pull-service-model.js +0 -9
  253. package/dist/services/query-builder/query-builder-factory.d.ts +9 -7
  254. package/dist/services/query-builder/query-builder-factory.js +26 -15
  255. package/dist/{models/cli-parameters.d.ts → services/query-builder/query-builder-flags.d.ts} +1 -120
  256. package/dist/services/query-builder/query-builder-flags.js +150 -0
  257. package/dist/services/query-builder/query-builder-model.d.ts +1 -14
  258. package/dist/services/query-builder/query-builder-service-build-context.d.ts +113 -0
  259. package/dist/services/query-builder/query-builder-service-build-context.js +68 -0
  260. package/dist/services/query-builder/query-builder-service.d.ts +3 -3
  261. package/dist/services/query-builder/spec/query-builder-flags.spec.d.ts +1 -0
  262. package/dist/{models/spec/cli-parameters.spec.js → services/query-builder/spec/query-builder-flags.spec.js} +1 -1
  263. package/dist/services/revalidate/index.d.ts +1 -0
  264. package/dist/services/revalidate/index.js +1 -0
  265. package/dist/services/revalidate/revalidate-factory.d.ts +3 -5
  266. package/dist/services/revalidate/revalidate-factory.js +2 -6
  267. package/dist/services/revalidate/revalidate-model.d.ts +0 -9
  268. package/dist/services/revalidate/revalidate-model.js +0 -8
  269. package/dist/services/revalidate/revalidate-service-build-context.d.ts +38 -0
  270. package/dist/services/revalidate/revalidate-service-build-context.js +59 -0
  271. package/dist/services/setup/browser/browser-setup-service.d.ts +3 -4
  272. package/dist/services/setup/browser/browser-setup-service.js +16 -18
  273. package/dist/services/setup/difftool/difftool-setup-service.d.ts +3 -4
  274. package/dist/services/setup/difftool/difftool-setup-service.js +5 -7
  275. package/dist/services/setup/extension/extension-setup-service.d.ts +3 -4
  276. package/dist/services/setup/extension/extension-setup-service.js +8 -10
  277. package/dist/services/setup/index.d.ts +1 -1
  278. package/dist/services/setup/index.js +1 -1
  279. package/dist/services/setup/setup-service-build-context.d.ts +27 -0
  280. package/dist/services/setup/setup-service-build-context.js +26 -0
  281. package/dist/services/setup/setup-service-factory.d.ts +2 -6
  282. package/dist/services/setup/setup-service-factory.js +10 -18
  283. package/dist/services/setup/setup-service.d.ts +4 -5
  284. package/dist/services/setup/setup-service.js +6 -7
  285. package/oclif.manifest.json +155 -147
  286. package/package.json +4 -2
  287. package/dist/models/cli-parameters.js +0 -297
  288. package/dist/services/cli/cli-config.d.ts +0 -59
  289. package/dist/services/cli/cli-config.js +0 -180
  290. package/dist/services/cli/environment.d.ts +0 -15
  291. package/dist/services/cli/environment.js +0 -40
  292. package/dist/services/cli/spec/cli-config.spec.js +0 -117
  293. package/dist/services/cli/spec/environment.spec.js +0 -28
  294. package/dist/services/config-api/entity-manager-factory.d.ts +0 -5
  295. package/dist/services/customer-config/customer-config-service-context.d.ts +0 -13
  296. package/dist/services/customer-config/customer-config-service-context.js +0 -21
  297. package/dist/services/deploy/context/deploy-context.d.ts +0 -32
  298. package/dist/services/deploy/context/deploy-context.js +0 -72
  299. package/dist/services/diff/diff-model.d.ts +0 -9
  300. package/dist/services/diff/diff-model.js +0 -12
  301. package/dist/services/origin-request/origin-request-context.d.ts +0 -13
  302. package/dist/services/origin-request/origin-request-context.js +0 -23
  303. package/dist/services/query-builder/query-command.d.ts +0 -28
  304. package/dist/services/query-builder/query-command.js +0 -37
  305. package/dist/services/setup/setup-context.d.ts +0 -14
  306. package/dist/services/setup/setup-context.js +0 -15
  307. /package/dist/{models/spec/cli-parameters.spec.d.ts → services/cli/command-build-context.js} +0 -0
  308. /package/dist/services/cli/spec/{cli-config.spec.d.ts → cli-environment-detection.spec.d.ts} +0 -0
  309. /package/dist/services/cli/spec/{environment.spec.d.ts → cli-environment.spec.d.ts} +0 -0
  310. /package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.js → document-handler-runtime-model.js} +0 -0
@@ -0,0 +1,29 @@
1
+ import { Flags } from "@oclif/core";
2
+ import { DEFAULT_ATHENA_CATALOG } from "./athena-service-model.js";
3
+ /** The flags that say where an Athena query runs. */
4
+ /**
5
+ * Where a query that is executed actually runs.
6
+ *
7
+ * The catalog is the account's, not the query's: our own logins reach the rum
8
+ * tables under `live`, while a role scoped to one account reaches the same
9
+ * tables under `AwsDataCatalog`. `SK_ATHENA_CATALOG` lets a CI job say so once.
10
+ *
11
+ * Athena resolves the account's default workgroup when none is named, which is
12
+ * only right where the credentials are allowed to use it — a role scoped to one
13
+ * workgroup is refused on any other, and the result location is a workgroup
14
+ * setting too. `SK_ATHENA_WORKGROUP` lets a CI job set it once for every
15
+ * command in the job.
16
+ */
17
+ export const CLI_ATHENA = {
18
+ catalog: Flags.string({
19
+ default: DEFAULT_ATHENA_CATALOG,
20
+ description: "Athena data catalog holding the rum tables. Names the catalog both in the query and in the context it runs in, so the two always agree",
21
+ env: "SK_ATHENA_CATALOG",
22
+ required: false,
23
+ }),
24
+ workgroup: Flags.string({
25
+ description: "Athena workgroup to run the query in, e.g. 'prewarming'. Defaults to the account's default workgroup",
26
+ env: "SK_ATHENA_WORKGROUP",
27
+ required: false,
28
+ }),
29
+ };
@@ -0,0 +1,25 @@
1
+ import { CommandContextValues } from "../cli/index.js";
2
+ export interface AthenaServiceBuildContextValues extends CommandContextValues {
3
+ /**
4
+ * The app to query. Enables the Baqend native query path (app token only) as
5
+ * a fallback when no AWS login is present. Without it, only the AWS path is
6
+ * available.
7
+ */
8
+ readonly app?: string;
9
+ /**
10
+ * Athena workgroup for the AWS path. The Baqend path has no such notion, so
11
+ * it is ignored there.
12
+ */
13
+ readonly workgroup?: string;
14
+ /**
15
+ * The data catalog the tables live in. The Baqend path is told so it can
16
+ * recognise the prefix, not so it can use it: the server resolves the
17
+ * catalog itself.
18
+ */
19
+ readonly catalog?: string;
20
+ }
21
+ declare const AthenaServiceBuildContext_base: new (values: AthenaServiceBuildContextValues) => Readonly<AthenaServiceBuildContextValues>;
22
+ /** Which app, workgroup and catalog an Athena query goes to. */
23
+ export declare class AthenaServiceBuildContext extends AthenaServiceBuildContext_base {
24
+ }
25
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Context } from "../../models/context.js";
2
+ /** Which app, workgroup and catalog an Athena query goes to. */
3
+ export class AthenaServiceBuildContext extends Context() {
4
+ }
@@ -1,22 +1,9 @@
1
- import { CliServiceInterface } from "../cli/index.js";
1
+ import { AthenaServiceBuildContext } from "./athena-service-build-context.js";
2
2
  import { AthenaService } from "./athena-query-service.js";
3
3
  export declare class AthenaServiceFactory {
4
- private app?;
5
- private workgroup?;
6
- private catalog?;
7
- private cli?;
4
+ private readonly context;
8
5
  service?: AthenaService;
9
- /**
10
- * @param app - the app to query. Enables the Baqend native query path (app
11
- * token only) as a fallback when no AWS login is present. Without it, only
12
- * the AWS path is available.
13
- * @param workgroup - Athena workgroup for the AWS path. The Baqend path has
14
- * no such notion, so it is ignored there.
15
- * @param catalog - the data catalog the tables live in. The Baqend path is
16
- * told so it can recognise the prefix, not so it can use it: the server
17
- * resolves the catalog itself.
18
- */
19
- constructor(app?: string, workgroup?: string, catalog?: string, cli?: CliServiceInterface);
6
+ constructor(context: AthenaServiceBuildContext);
20
7
  getService(): Promise<AthenaService>;
21
8
  /**
22
9
  * Prefer direct AWS Athena whenever AWS credentials are present — they
@@ -1,32 +1,15 @@
1
1
  import { AthenaClient } from "@aws-sdk/client-athena";
2
2
  import { safe } from "../../helpers/safe.js";
3
- import { CliServiceFactory } from "../cli/index.js";
4
3
  import { ATHENA_CONFIG } from "./athena-service-model.js";
5
4
  import { FetchCredentialsError } from "./error/fetch-credentials-error.js";
6
5
  import { AwsAthenaService } from "./athena-service.js";
7
6
  import { BaqendAthenaService } from "./baqend-athena-service.js";
8
- import { EntityManagerFactory } from "../config-api/entity-manager-factory.js";
7
+ import { EntityManagerProvider } from "../config-api/entity-manager-provider.js";
9
8
  export class AthenaServiceFactory {
10
- app;
11
- workgroup;
12
- catalog;
13
- cli;
9
+ context;
14
10
  service;
15
- /**
16
- * @param app - the app to query. Enables the Baqend native query path (app
17
- * token only) as a fallback when no AWS login is present. Without it, only
18
- * the AWS path is available.
19
- * @param workgroup - Athena workgroup for the AWS path. The Baqend path has
20
- * no such notion, so it is ignored there.
21
- * @param catalog - the data catalog the tables live in. The Baqend path is
22
- * told so it can recognise the prefix, not so it can use it: the server
23
- * resolves the catalog itself.
24
- */
25
- constructor(app, workgroup, catalog, cli) {
26
- this.app = app;
27
- this.workgroup = workgroup;
28
- this.catalog = catalog;
29
- this.cli = cli;
11
+ constructor(context) {
12
+ this.context = context;
30
13
  }
31
14
  async getService() {
32
15
  if (!this.service) {
@@ -41,16 +24,17 @@ export class AthenaServiceFactory {
41
24
  * path (which needs an `app`).
42
25
  */
43
26
  async createService() {
44
- const cli = this.cli ?? new CliServiceFactory().getService();
27
+ const cli = this.context.environment.cli;
28
+ const { app, workgroup, catalog } = this.context;
45
29
  const client = await this.tryGetAthenaClient();
46
30
  if (client) {
47
- cli.comment(this.workgroup
48
- ? `Using AWS credentials for Athena queries, workgroup ${this.workgroup}.`
31
+ cli.comment(workgroup
32
+ ? `Using AWS credentials for Athena queries, workgroup ${workgroup}.`
49
33
  : "Using AWS credentials for Athena queries.");
50
- return new AwsAthenaService(client, cli, this.workgroup, this.catalog);
34
+ return new AwsAthenaService(client, cli, workgroup, catalog);
51
35
  }
52
- if (this.app) {
53
- return new BaqendAthenaService(this.app, new EntityManagerFactory(), cli, this.catalog);
36
+ if (app) {
37
+ return new BaqendAthenaService(app, new EntityManagerProvider(), cli, catalog);
54
38
  }
55
39
  throw new FetchCredentialsError("Cannot send Athena queries: no AWS credentials found and no app given for the Baqend API.");
56
40
  }
@@ -1,27 +1,16 @@
1
1
  import { AthenaBucket, AthenaParameter, AthenaService } from "./athena-query-service.js";
2
- import { EntityManagerFactory } from "../config-api/entity-manager-factory.js";
2
+ import { EntityManagerProvider } from "../config-api/entity-manager-provider.js";
3
3
  import { CliServiceInterface } from "../cli/index.js";
4
- /**
5
- * Runs Athena SQL through the Baqend API, authenticated by the app token only
6
- * (no AWS login). Hits the native query path via
7
- * `db["<bucket>"].executeQuery(sql, triggeredBy, ttl)`.
8
- *
9
- * Two normalizations vs the AWS path:
10
- * - `?` placeholders are inlined (the native path has no parameter binding).
11
- * - the catalog prefix is stripped — the server derives catalog and database
12
- * itself, and a 3-part `<catalog>.<db>.<table>` reference fails there
13
- * (verified against a live app), whereas 2-part `<db>.<table>` works.
14
- */
15
4
  export declare class BaqendAthenaService implements AthenaService {
16
5
  private app;
17
- private entityManagerFactory;
6
+ private entityManagerProvider;
18
7
  private cli;
19
8
  private static readonly TRIGGERED_BY;
20
9
  /** A catalog qualifier in front of a `<db>.<table>` reference. */
21
10
  private readonly catalogPrefix;
22
11
  /** The catalog whose qualifier has to come back out of the query. */
23
12
  private readonly catalog;
24
- constructor(app: string, entityManagerFactory: EntityManagerFactory, cli: CliServiceInterface,
13
+ constructor(app: string, entityManagerProvider: EntityManagerProvider, cli: CliServiceInterface,
25
14
  /**
26
15
  * The catalog the queries name. Whichever one the caller runs under, the
27
16
  * prefix has to come back out here — so the name is read rather than
@@ -4,27 +4,16 @@ import { safe } from "../../helpers/safe.js";
4
4
  function escapeRegExp(value) {
5
5
  return value.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw `\$&`);
6
6
  }
7
- /**
8
- * Runs Athena SQL through the Baqend API, authenticated by the app token only
9
- * (no AWS login). Hits the native query path via
10
- * `db["<bucket>"].executeQuery(sql, triggeredBy, ttl)`.
11
- *
12
- * Two normalizations vs the AWS path:
13
- * - `?` placeholders are inlined (the native path has no parameter binding).
14
- * - the catalog prefix is stripped — the server derives catalog and database
15
- * itself, and a 3-part `<catalog>.<db>.<table>` reference fails there
16
- * (verified against a live app), whereas 2-part `<db>.<table>` works.
17
- */
18
7
  export class BaqendAthenaService {
19
8
  app;
20
- entityManagerFactory;
9
+ entityManagerProvider;
21
10
  cli;
22
11
  static TRIGGERED_BY = "speed-kit-cli";
23
12
  /** A catalog qualifier in front of a `<db>.<table>` reference. */
24
13
  catalogPrefix;
25
14
  /** The catalog whose qualifier has to come back out of the query. */
26
15
  catalog;
27
- constructor(app, entityManagerFactory, cli,
16
+ constructor(app, entityManagerProvider, cli,
28
17
  /**
29
18
  * The catalog the queries name. Whichever one the caller runs under, the
30
19
  * prefix has to come back out here — so the name is read rather than
@@ -32,7 +21,7 @@ export class BaqendAthenaService {
32
21
  */
33
22
  catalog) {
34
23
  this.app = app;
35
- this.entityManagerFactory = entityManagerFactory;
24
+ this.entityManagerProvider = entityManagerProvider;
36
25
  this.cli = cli;
37
26
  this.catalog = athenaCatalog(catalog);
38
27
  this.catalogPrefix = new RegExp(`^${escapeRegExp(this.catalog)}\\.[a-z_]\\w*\\.[a-z_]`, "i");
@@ -42,10 +31,13 @@ export class BaqendAthenaService {
42
31
  throw new Error("BaqendAthenaService.getResult requires a bucket to target");
43
32
  }
44
33
  this.cli.startAction("ATHENA:QUERY", "execute athena query via baqend");
45
- const db = await this.entityManagerFactory.getEntityManager(this.app);
34
+ const db = await this.entityManagerProvider.getEntityManager(this.app);
46
35
  const sql = this.prepareQuery(query, parameters);
47
36
  const ttl = `${maxAgeInMinutes}m`;
48
- const result = await safe(db[bucket].executeQuery(sql, BaqendAthenaService.TRIGGERED_BY, ttl));
37
+ // The bucket entities are not in the SDK's types: an app has the ones its
38
+ // schema declares.
39
+ const entity = db[bucket];
40
+ const result = await safe(entity.executeQuery(sql, BaqendAthenaService.TRIGGERED_BY, ttl));
49
41
  if (result.success === true) {
50
42
  this.cli.successAction("ATHENA:QUERY");
51
43
  return result.data;
@@ -2,5 +2,6 @@ export * from "./athena-query-service.js";
2
2
  export * from "./athena-service.js";
3
3
  export * from "./baqend-athena-service.js";
4
4
  export * from "./athena-service-factory.js";
5
+ export * from "./athena-service-build-context.js";
5
6
  export * from "./athena-service-model.js";
6
7
  export * from "./error/fetch-credentials-error.js";
@@ -2,5 +2,6 @@ export * from "./athena-query-service.js";
2
2
  export * from "./athena-service.js";
3
3
  export * from "./baqend-athena-service.js";
4
4
  export * from "./athena-service-factory.js";
5
+ export * from "./athena-service-build-context.js";
5
6
  export * from "./athena-service-model.js";
6
7
  export * from "./error/fetch-credentials-error.js";
@@ -9,7 +9,7 @@ const cli = {
9
9
  writeError: () => undefined,
10
10
  };
11
11
  /** An entity manager that records the sql it was asked to run. */
12
- function factoryCapturing(sent) {
12
+ function providerCapturing(sent) {
13
13
  return {
14
14
  getEntityManager: async () => ({
15
15
  [AthenaBucket.RumPi]: {
@@ -24,7 +24,7 @@ function factoryCapturing(sent) {
24
24
  /** The sql that reached the Baqend API for a query run under `catalog`. */
25
25
  async function sentFor(query, catalog) {
26
26
  const sent = [];
27
- const service = new BaqendAthenaService("shop-de", factoryCapturing(sent), cli, catalog);
27
+ const service = new BaqendAthenaService("shop-de", providerCapturing(sent), cli, catalog);
28
28
  await service.getResult(query, [], 60, AthenaBucket.RumPi);
29
29
  return sent[0];
30
30
  }
@@ -1,4 +1,4 @@
1
- import { UserCliConfig } from "../cli/index.js";
1
+ import { CliEnvironment } 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
  /**
@@ -17,7 +17,7 @@ export interface BrowserOriginFetchHandle {
17
17
  close(): Promise<void>;
18
18
  }
19
19
  export interface BrowserOriginFetchOptions {
20
- userConfig: UserCliConfig;
20
+ environment: CliEnvironment;
21
21
  logger?: BrowserFetchLogger;
22
22
  mode?: BrowserFetchMode;
23
23
  /**
@@ -18,7 +18,7 @@ export function installBrowserOriginFetch(options) {
18
18
  const mode = options.mode ?? "auto";
19
19
  const direct = options.direct ?? directOriginFetch;
20
20
  const fetcher = options.fetcher ??
21
- new BrowserOriginFetcher(options.userConfig, options.logger);
21
+ new BrowserOriginFetcher(options.environment, options.logger);
22
22
  /** Hosts a network fetch was refused by, which the browser serves from then on. */
23
23
  const browserHosts = new Set();
24
24
  const transport = async (url, init, fetchOptions) => {
@@ -1,5 +1,5 @@
1
1
  import { Frame, HTTPRequest } from "puppeteer";
2
- import { UserCliConfig } from "../cli/index.js";
2
+ import { CliEnvironment } 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 {
@@ -45,7 +45,7 @@ export declare function isDocumentRequest(request: Pick<HTTPRequest, "isNavigati
45
45
  * the access this fetcher exists to get. See `device-emulation.ts`.
46
46
  */
47
47
  export declare class BrowserOriginFetcher {
48
- private readonly userConfig;
48
+ private readonly environment;
49
49
  private readonly logger?;
50
50
  private readonly navigationTimeout;
51
51
  private browser?;
@@ -69,7 +69,7 @@ export declare class BrowserOriginFetcher {
69
69
  private profile?;
70
70
  /** When the session was last thrown away, so recovery cannot run per request. */
71
71
  private lastRecycle;
72
- constructor(userConfig: UserCliConfig, logger?: BrowserFetchLogger, navigationTimeout?: number);
72
+ constructor(environment: CliEnvironment, logger?: BrowserFetchLogger, navigationTimeout?: number);
73
73
  /**
74
74
  * Fetches one origin URL through the browser.
75
75
  *
@@ -105,7 +105,7 @@ export function isDocumentRequest(request, mainFrame) {
105
105
  * the access this fetcher exists to get. See `device-emulation.ts`.
106
106
  */
107
107
  export class BrowserOriginFetcher {
108
- userConfig;
108
+ environment;
109
109
  logger;
110
110
  navigationTimeout;
111
111
  browser;
@@ -129,8 +129,8 @@ export class BrowserOriginFetcher {
129
129
  profile;
130
130
  /** When the session was last thrown away, so recovery cannot run per request. */
131
131
  lastRecycle = 0;
132
- constructor(userConfig, logger, navigationTimeout = DEFAULT_NAVIGATION_TIMEOUT) {
133
- this.userConfig = userConfig;
132
+ constructor(environment, logger, navigationTimeout = DEFAULT_NAVIGATION_TIMEOUT) {
133
+ this.environment = environment;
134
134
  this.logger = logger;
135
135
  this.navigationTimeout = navigationTimeout;
136
136
  }
@@ -472,7 +472,7 @@ export class BrowserOriginFetcher {
472
472
  const proxy = currentOriginProxy();
473
473
  const browser = await puppeteer.launch({
474
474
  headless: true,
475
- executablePath: path.resolve(this.userConfig.chromePath),
475
+ executablePath: path.resolve(this.environment.settings.chromePath),
476
476
  defaultViewport: null,
477
477
  acceptInsecureCerts: true,
478
478
  timeout: this.navigationTimeout,
@@ -500,7 +500,7 @@ export class BrowserOriginFetcher {
500
500
  * once, and one must not delete the profile the other is holding open.
501
501
  */
502
502
  async createProfile() {
503
- const parent = path.resolve(this.userConfig.tempFolder, PROFILE_FOLDER);
503
+ const parent = path.resolve(this.environment.cacheDir, PROFILE_FOLDER);
504
504
  mkdirSync(parent, { recursive: true });
505
505
  this.pruneProfiles(parent);
506
506
  return mkdtemp(path.join(parent, "profile-"));
@@ -22,7 +22,7 @@ const logger = {
22
22
  comment: () => undefined,
23
23
  };
24
24
  /** The fetcher is always stubbed in these specs, so no Chrome is ever launched from them. */
25
- const userConfig = {};
25
+ const environment = {};
26
26
  describe("installBrowserOriginFetch", () => {
27
27
  let handle;
28
28
  let log;
@@ -39,7 +39,7 @@ describe("installBrowserOriginFetch", () => {
39
39
  describe("auto mode", () => {
40
40
  it("leaves an origin that answers on the network alone", async () => {
41
41
  handle = installBrowserOriginFetch({
42
- userConfig,
42
+ environment,
43
43
  logger,
44
44
  fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
45
45
  direct: (url) => {
@@ -53,7 +53,7 @@ describe("installBrowserOriginFetch", () => {
53
53
  });
54
54
  it("retries through the browser once the origin refuses the request", async () => {
55
55
  handle = installBrowserOriginFetch({
56
- userConfig,
56
+ environment,
57
57
  logger,
58
58
  fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
59
59
  direct: (url) => {
@@ -67,7 +67,7 @@ describe("installBrowserOriginFetch", () => {
67
67
  });
68
68
  it("keeps a refused host on the browser, instead of paying for the network leg again", async () => {
69
69
  handle = installBrowserOriginFetch({
70
- userConfig,
70
+ environment,
71
71
  logger,
72
72
  fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
73
73
  direct: (url) => {
@@ -85,7 +85,7 @@ describe("installBrowserOriginFetch", () => {
85
85
  });
86
86
  it("leaves another host on the network, because only the refused one is rerouted", async () => {
87
87
  handle = installBrowserOriginFetch({
88
- userConfig,
88
+ environment,
89
89
  logger,
90
90
  fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
91
91
  direct: (url) => {
@@ -101,7 +101,7 @@ describe("installBrowserOriginFetch", () => {
101
101
  });
102
102
  it("does not reroute an ordinary origin error", async () => {
103
103
  handle = installBrowserOriginFetch({
104
- userConfig,
104
+ environment,
105
105
  logger,
106
106
  fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
107
107
  direct: () => Promise.resolve(new Response("gone", { status: 404 })),
@@ -112,7 +112,7 @@ describe("installBrowserOriginFetch", () => {
112
112
  });
113
113
  it("answers the refusal when the browser cannot reach the origin either", async () => {
114
114
  handle = installBrowserOriginFetch({
115
- userConfig,
115
+ environment,
116
116
  logger,
117
117
  fetcher: stubFetcher(log, () => Promise.reject(new Error("navigation timeout"))),
118
118
  direct: () => Promise.resolve(new Response("blocked", { status: 403 })),
@@ -126,7 +126,7 @@ describe("installBrowserOriginFetch", () => {
126
126
  describe("always mode", () => {
127
127
  it("sends the first request through the browser", async () => {
128
128
  handle = installBrowserOriginFetch({
129
- userConfig,
129
+ environment,
130
130
  logger,
131
131
  mode: "always",
132
132
  fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
@@ -141,7 +141,7 @@ describe("installBrowserOriginFetch", () => {
141
141
  });
142
142
  it("falls back to the network when the browser fails", async () => {
143
143
  handle = installBrowserOriginFetch({
144
- userConfig,
144
+ environment,
145
145
  logger,
146
146
  mode: "always",
147
147
  fetcher: stubFetcher(log, () => Promise.reject(new Error("no chrome"))),
@@ -157,7 +157,7 @@ describe("installBrowserOriginFetch", () => {
157
157
  });
158
158
  it("restores the direct transport when the handle is closed", async () => {
159
159
  const installed = installBrowserOriginFetch({
160
- userConfig,
160
+ environment,
161
161
  logger,
162
162
  mode: "always",
163
163
  fetcher: stubFetcher(log, () => Promise.resolve(new Response("browser"))),
@@ -0,0 +1,25 @@
1
+ import { Config } from "@oclif/core";
2
+ import { CliEnvironment } from "./cli-environment.js";
3
+ export interface CliEnvironmentOptions {
4
+ /** The customer the command works on, for its documentHandler's node modules. */
5
+ readonly customerPath?: string;
6
+ /** Keep the CLI to what `--quiet` allows: no spinners, default answers. */
7
+ readonly quiet?: boolean;
8
+ }
9
+ /**
10
+ * Builds the environment of one invocation, with its one CLI.
11
+ *
12
+ * The CLI asks the environment whether it runs in CI and whether it may prompt,
13
+ * and the environment hands the CLI out, so the settings are loaded first, the
14
+ * CLI is built against them, and only then is the environment complete.
15
+ */
16
+ export declare class CliEnvironmentFactory {
17
+ private readonly oclif;
18
+ private readonly options;
19
+ /**
20
+ * @param oclif the oclif config of the running command
21
+ * @param options what the command knows about its invocation
22
+ */
23
+ constructor(oclif: Config, options?: CliEnvironmentOptions);
24
+ buildEnvironment(): CliEnvironment;
25
+ }
@@ -0,0 +1,30 @@
1
+ import { CliEnvironment } from "./cli-environment.js";
2
+ import { CliServiceFactory } from "./cli-service-factory.js";
3
+ import { CliServiceBuildContext } from "./cli-service-build-context.js";
4
+ /**
5
+ * Builds the environment of one invocation, with its one CLI.
6
+ *
7
+ * The CLI asks the environment whether it runs in CI and whether it may prompt,
8
+ * and the environment hands the CLI out, so the settings are loaded first, the
9
+ * CLI is built against them, and only then is the environment complete.
10
+ */
11
+ export class CliEnvironmentFactory {
12
+ oclif;
13
+ options;
14
+ /**
15
+ * @param oclif the oclif config of the running command
16
+ * @param options what the command knows about its invocation
17
+ */
18
+ constructor(oclif, options = {}) {
19
+ this.oclif = oclif;
20
+ this.options = options;
21
+ }
22
+ buildEnvironment() {
23
+ const environment = CliEnvironment.load(this.oclif, this.options.customerPath);
24
+ const cli = new CliServiceFactory(new CliServiceBuildContext({
25
+ environment,
26
+ quiet: this.options.quiet ?? false,
27
+ })).getService();
28
+ return environment.attachCli(cli);
29
+ }
30
+ }
@@ -0,0 +1,73 @@
1
+ import { Config } from "@oclif/core";
2
+ import { CliSettings } from "./cli-settings.js";
3
+ import type { CliServiceInterface } from "./cli-service-model.js";
4
+ /**
5
+ * Where a command runs: the user's settings, oclif's config and the
6
+ * directories the CLI owns.
7
+ *
8
+ * One per invocation, built by {@link CliEnvironmentFactory} together with the
9
+ * invocation's one CLI ({@link cli}) and handed to every factory in its
10
+ * context. The settings merge three sources, later winning over earlier:
11
+ *
12
+ * ```
13
+ * ~/.config/speed-kit-cli/config.json < .env < process.env
14
+ * ```
15
+ */
16
+ export declare class CliEnvironment {
17
+ readonly oclif: Config;
18
+ private readonly env;
19
+ /** The user's settings; {@link save} writes changes back. */
20
+ readonly settings: CliSettings;
21
+ /** Where the extra node modules of a customer's documentHandler live. */
22
+ readonly nodeModulesPath: string;
23
+ private attachedCli?;
24
+ /**
25
+ * Loads the settings for one invocation.
26
+ *
27
+ * @param oclif the oclif config of the running command
28
+ * @param customerPath the customer the command works on, if any, for its
29
+ * node modules
30
+ * @param env the process environment; a test passes its own
31
+ */
32
+ static load(oclif: Config, customerPath?: string, env?: NodeJS.ProcessEnv): CliEnvironment;
33
+ private constructor();
34
+ /** The one CLI of this invocation: every output and every prompt. */
35
+ get cli(): CliServiceInterface;
36
+ /**
37
+ * Completes the environment with its CLI. Only {@link CliEnvironmentFactory}
38
+ * calls this, once: the CLI is built against the environment, so the two
39
+ * cannot be created in one step.
40
+ */
41
+ attachCli(cli: CliServiceInterface): this;
42
+ /** The directory the CLI keeps its caches and scratch files in. */
43
+ get cacheDir(): string;
44
+ /**
45
+ * Whether this runs in CI. Most CI providers set `CI=true`, and several set
46
+ * their own dedicated variable, so both are checked.
47
+ */
48
+ get isCI(): boolean;
49
+ /**
50
+ * True when the user cannot safely be prompted: in CI, without an attached
51
+ * TTY (piped output, an npm background install), or when they opted out
52
+ * with SK_NON_INTERACTIVE.
53
+ */
54
+ get nonInteractive(): boolean;
55
+ /**
56
+ * Persists the given settings into the user config.json, merging with what
57
+ * is already there. Also reflects the change in {@link settings} so the
58
+ * running command sees it immediately.
59
+ */
60
+ save(partial: Partial<CliSettings>): void;
61
+ private loadSettings;
62
+ private createEmptyConfigFile;
63
+ private getConfigFilePath;
64
+ private loadConfigFromConfigFile;
65
+ private loadConfigFromEnvironment;
66
+ private resolveExtensionConfigPaths;
67
+ private readCliConfigFromFile;
68
+ /**
69
+ * Reads and parses config.json without any side effects. Returns null when
70
+ * the file is missing or cannot be parsed.
71
+ */
72
+ private readRawConfigFile;
73
+ }