@b64hub/sfpm-cli 0.1.0 → 0.2.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 (279) hide show
  1. package/README.md +416 -204
  2. package/dist/commands/add.d.ts +10 -0
  3. package/dist/commands/add.js +50 -0
  4. package/dist/commands/add.js.map +1 -0
  5. package/dist/commands/bootstrap.d.ts +18 -5
  6. package/dist/commands/bootstrap.js +372 -167
  7. package/dist/commands/bootstrap.js.map +1 -1
  8. package/dist/commands/build/index.d.ts +59 -0
  9. package/dist/commands/build/index.js +425 -0
  10. package/dist/commands/build/index.js.map +1 -0
  11. package/dist/commands/build/status.d.ts +3 -4
  12. package/dist/commands/build/status.js +13 -162
  13. package/dist/commands/build/status.js.map +1 -1
  14. package/dist/commands/deploy/artifact.d.ts +17 -13
  15. package/dist/commands/deploy/artifact.js +31 -88
  16. package/dist/commands/deploy/artifact.js.map +1 -1
  17. package/dist/commands/deploy/index.d.ts +52 -0
  18. package/dist/commands/deploy/index.js +162 -0
  19. package/dist/commands/deploy/index.js.map +1 -0
  20. package/dist/commands/dev/pool-list-replay.d.ts +11 -0
  21. package/dist/commands/dev/pool-list-replay.js +19 -0
  22. package/dist/commands/dev/pool-list-replay.js.map +1 -0
  23. package/dist/commands/dev/pool-replay.d.ts +16 -0
  24. package/dist/commands/dev/pool-replay.js +80 -0
  25. package/dist/commands/dev/pool-replay.js.map +1 -0
  26. package/dist/commands/dev/replay.d.ts +21 -0
  27. package/dist/commands/dev/replay.js +103 -0
  28. package/dist/commands/dev/replay.js.map +1 -0
  29. package/dist/commands/install.d.ts +10 -4
  30. package/dist/commands/install.js +73 -70
  31. package/dist/commands/install.js.map +1 -1
  32. package/dist/commands/package/create.d.ts +31 -0
  33. package/dist/commands/package/create.js +270 -0
  34. package/dist/commands/package/create.js.map +1 -0
  35. package/dist/commands/pool/delete.d.ts +4 -5
  36. package/dist/commands/pool/delete.js +64 -52
  37. package/dist/commands/pool/delete.js.map +1 -1
  38. package/dist/commands/pool/fetch.d.ts +5 -4
  39. package/dist/commands/pool/fetch.js +77 -37
  40. package/dist/commands/pool/fetch.js.map +1 -1
  41. package/dist/commands/pool/fill.d.ts +22 -0
  42. package/dist/commands/pool/fill.js +172 -0
  43. package/dist/commands/pool/fill.js.map +1 -0
  44. package/dist/commands/pool/list.d.ts +3 -6
  45. package/dist/commands/pool/list.js +60 -58
  46. package/dist/commands/pool/list.js.map +1 -1
  47. package/dist/commands/{project.d.ts → project/index.d.ts} +1 -1
  48. package/dist/commands/{project.js → project/index.js} +6 -6
  49. package/dist/commands/project/index.js.map +1 -0
  50. package/dist/commands/project/init/turbo.js +3 -11
  51. package/dist/commands/project/init/turbo.js.map +1 -1
  52. package/dist/commands/project/sync.js +2 -10
  53. package/dist/commands/project/sync.js.map +1 -1
  54. package/dist/commands/project/version/bump.js +12 -13
  55. package/dist/commands/project/version/bump.js.map +1 -1
  56. package/dist/commands/publish.d.ts +14 -0
  57. package/dist/commands/publish.js +60 -0
  58. package/dist/commands/publish.js.map +1 -0
  59. package/dist/commands/watch/cancel.d.ts +12 -0
  60. package/dist/commands/watch/cancel.js +44 -0
  61. package/dist/commands/watch/cancel.js.map +1 -0
  62. package/dist/commands/watch/clean.d.ts +10 -0
  63. package/dist/commands/watch/clean.js +29 -0
  64. package/dist/commands/watch/clean.js.map +1 -0
  65. package/dist/commands/watch/status.d.ts +13 -0
  66. package/dist/commands/watch/status.js +137 -0
  67. package/dist/commands/watch/status.js.map +1 -0
  68. package/dist/logger.d.ts +80 -0
  69. package/dist/logger.js +143 -0
  70. package/dist/logger.js.map +1 -0
  71. package/dist/sfpm-command.d.ts +40 -3
  72. package/dist/sfpm-command.js +112 -18
  73. package/dist/sfpm-command.js.map +1 -1
  74. package/dist/types/bootstrap.d.ts +67 -0
  75. package/dist/types/bootstrap.js +78 -0
  76. package/dist/types/bootstrap.js.map +1 -0
  77. package/dist/ui/apps/BuildApp.d.ts +11 -0
  78. package/dist/ui/apps/BuildApp.js +32 -0
  79. package/dist/ui/apps/BuildApp.js.map +1 -0
  80. package/dist/ui/apps/PoolDeleteApp.d.ts +6 -0
  81. package/dist/ui/apps/PoolDeleteApp.js +77 -0
  82. package/dist/ui/apps/PoolDeleteApp.js.map +1 -0
  83. package/dist/ui/apps/PoolFillApp.d.ts +7 -0
  84. package/dist/ui/apps/PoolFillApp.js +107 -0
  85. package/dist/ui/apps/PoolFillApp.js.map +1 -0
  86. package/dist/ui/apps/PoolListApp.d.ts +14 -0
  87. package/dist/ui/apps/PoolListApp.js +33 -0
  88. package/dist/ui/apps/PoolListApp.js.map +1 -0
  89. package/dist/ui/build-event-bridge.d.ts +21 -0
  90. package/dist/ui/build-event-bridge.js +140 -0
  91. package/dist/ui/build-event-bridge.js.map +1 -0
  92. package/dist/ui/build-progress-renderer.d.ts +21 -35
  93. package/dist/ui/build-progress-renderer.js +147 -505
  94. package/dist/ui/build-progress-renderer.js.map +1 -1
  95. package/dist/ui/build-summary.d.ts +15 -0
  96. package/dist/ui/build-summary.js +26 -0
  97. package/dist/ui/build-summary.js.map +1 -0
  98. package/dist/ui/components/OrchestrationView.d.ts +20 -0
  99. package/dist/ui/components/OrchestrationView.js +59 -0
  100. package/dist/ui/components/OrchestrationView.js.map +1 -0
  101. package/dist/ui/components/PackageRow.d.ts +130 -0
  102. package/dist/ui/components/PackageRow.js +80 -0
  103. package/dist/ui/components/PackageRow.js.map +1 -0
  104. package/dist/ui/components/ValidationView.d.ts +4 -0
  105. package/dist/ui/components/ValidationView.js +9 -0
  106. package/dist/ui/components/ValidationView.js.map +1 -0
  107. package/dist/ui/components/base/Divider.d.ts +4 -0
  108. package/dist/ui/components/base/Divider.js +9 -0
  109. package/dist/ui/components/base/Divider.js.map +1 -0
  110. package/dist/ui/components/base/ElapsedTime.d.ts +14 -0
  111. package/dist/ui/components/base/ElapsedTime.js +19 -0
  112. package/dist/ui/components/base/ElapsedTime.js.map +1 -0
  113. package/dist/ui/components/base/Footer.d.ts +58 -0
  114. package/dist/ui/components/base/Footer.js +59 -0
  115. package/dist/ui/components/base/Footer.js.map +1 -0
  116. package/dist/ui/components/base/GradientBar.d.ts +7 -0
  117. package/dist/ui/components/base/GradientBar.js +19 -0
  118. package/dist/ui/components/base/GradientBar.js.map +1 -0
  119. package/dist/ui/components/base/OrgBadge.d.ts +8 -0
  120. package/dist/ui/components/base/OrgBadge.js +10 -0
  121. package/dist/ui/components/base/OrgBadge.js.map +1 -0
  122. package/dist/ui/components/base/StatusIcon.d.ts +4 -0
  123. package/dist/ui/components/base/StatusIcon.js +22 -0
  124. package/dist/ui/components/base/StatusIcon.js.map +1 -0
  125. package/dist/ui/components/pool/OrgRow.d.ts +17 -0
  126. package/dist/ui/components/pool/OrgRow.js +37 -0
  127. package/dist/ui/components/pool/OrgRow.js.map +1 -0
  128. package/dist/ui/components/pool/PoolOrgRow.d.ts +16 -0
  129. package/dist/ui/components/pool/PoolOrgRow.js +44 -0
  130. package/dist/ui/components/pool/PoolOrgRow.js.map +1 -0
  131. package/dist/ui/connect-devhub.d.ts +41 -0
  132. package/dist/ui/connect-devhub.js +52 -0
  133. package/dist/ui/connect-devhub.js.map +1 -0
  134. package/dist/ui/fixtures/happy-path.d.ts +85 -0
  135. package/dist/ui/fixtures/happy-path.js +62 -0
  136. package/dist/ui/fixtures/happy-path.js.map +1 -0
  137. package/dist/ui/fixtures/large-scale.d.ts +19 -0
  138. package/dist/ui/fixtures/large-scale.js +140 -0
  139. package/dist/ui/fixtures/large-scale.js.map +1 -0
  140. package/dist/ui/fixtures/partial-failure.d.ts +71 -0
  141. package/dist/ui/fixtures/partial-failure.js +21 -0
  142. package/dist/ui/fixtures/partial-failure.js.map +1 -0
  143. package/dist/ui/fixtures/pool-happy-path.d.ts +14 -0
  144. package/dist/ui/fixtures/pool-happy-path.js +74 -0
  145. package/dist/ui/fixtures/pool-happy-path.js.map +1 -0
  146. package/dist/ui/fixtures/pool-list.d.ts +6 -0
  147. package/dist/ui/fixtures/pool-list.js +44 -0
  148. package/dist/ui/fixtures/pool-list.js.map +1 -0
  149. package/dist/ui/fixtures/pool-partial-failure.d.ts +15 -0
  150. package/dist/ui/fixtures/pool-partial-failure.js +86 -0
  151. package/dist/ui/fixtures/pool-partial-failure.js.map +1 -0
  152. package/dist/ui/hooks/use-event-bus-wiring.d.ts +7 -0
  153. package/dist/ui/hooks/use-event-bus-wiring.js +32 -0
  154. package/dist/ui/hooks/use-event-bus-wiring.js.map +1 -0
  155. package/dist/ui/hooks/use-term-width.d.ts +2 -0
  156. package/dist/ui/hooks/use-term-width.js +7 -0
  157. package/dist/ui/hooks/use-term-width.js.map +1 -0
  158. package/dist/ui/install-event-bridge.d.ts +9 -0
  159. package/dist/ui/install-event-bridge.js +91 -0
  160. package/dist/ui/install-event-bridge.js.map +1 -0
  161. package/dist/ui/install-progress-renderer.d.ts +20 -60
  162. package/dist/ui/install-progress-renderer.js +161 -307
  163. package/dist/ui/install-progress-renderer.js.map +1 -1
  164. package/dist/ui/orchestration-listr.d.ts +35 -187
  165. package/dist/ui/orchestration-listr.js +164 -328
  166. package/dist/ui/orchestration-listr.js.map +1 -1
  167. package/dist/ui/pino-bridge.d.ts +11 -0
  168. package/dist/ui/pino-bridge.js +24 -0
  169. package/dist/ui/pino-bridge.js.map +1 -0
  170. package/dist/ui/pool-delete-event-bridge.d.ts +12 -0
  171. package/dist/ui/pool-delete-event-bridge.js +18 -0
  172. package/dist/ui/pool-delete-event-bridge.js.map +1 -0
  173. package/dist/ui/pool-fill-event-bridge.d.ts +9 -0
  174. package/dist/ui/pool-fill-event-bridge.js +51 -0
  175. package/dist/ui/pool-fill-event-bridge.js.map +1 -0
  176. package/dist/ui/pool-utils.d.ts +6 -0
  177. package/dist/ui/pool-utils.js +49 -0
  178. package/dist/ui/pool-utils.js.map +1 -0
  179. package/dist/ui/renderer-utils.d.ts +58 -4
  180. package/dist/ui/renderer-utils.js +65 -0
  181. package/dist/ui/renderer-utils.js.map +1 -1
  182. package/dist/ui/run-pool-delete.d.ts +11 -0
  183. package/dist/ui/run-pool-delete.js +15 -0
  184. package/dist/ui/run-pool-delete.js.map +1 -0
  185. package/dist/ui/run-pool-fill.d.ts +15 -0
  186. package/dist/ui/run-pool-fill.js +19 -0
  187. package/dist/ui/run-pool-fill.js.map +1 -0
  188. package/dist/ui/run-pool-list.d.ts +3 -0
  189. package/dist/ui/run-pool-list.js +7 -0
  190. package/dist/ui/run-pool-list.js.map +1 -0
  191. package/dist/ui/run.d.ts +12 -0
  192. package/dist/ui/run.js +7 -0
  193. package/dist/ui/run.js.map +1 -0
  194. package/dist/ui/state/adapters.d.ts +4 -0
  195. package/dist/ui/state/adapters.js +62 -0
  196. package/dist/ui/state/adapters.js.map +1 -0
  197. package/dist/ui/state/pool-delete-reducer.d.ts +37 -0
  198. package/dist/ui/state/pool-delete-reducer.js +47 -0
  199. package/dist/ui/state/pool-delete-reducer.js.map +1 -0
  200. package/dist/ui/state/pool-fill-reducer.d.ts +87 -0
  201. package/dist/ui/state/pool-fill-reducer.js +109 -0
  202. package/dist/ui/state/pool-fill-reducer.js.map +1 -0
  203. package/dist/ui/state/reducer.d.ts +7 -0
  204. package/dist/ui/state/reducer.js +150 -0
  205. package/dist/ui/state/reducer.js.map +1 -0
  206. package/dist/ui/state/selectors.d.ts +18 -0
  207. package/dist/ui/state/selectors.js +36 -0
  208. package/dist/ui/state/selectors.js.map +1 -0
  209. package/dist/ui/state/types.d.ts +35 -0
  210. package/dist/ui/state/types.js +2 -0
  211. package/dist/ui/state/types.js.map +1 -0
  212. package/dist/ui/strategies/display-strategy.d.ts +51 -0
  213. package/dist/ui/strategies/display-strategy.js +5 -0
  214. package/dist/ui/strategies/display-strategy.js.map +1 -0
  215. package/dist/ui/strategies/index.d.ts +14 -0
  216. package/dist/ui/strategies/index.js +24 -0
  217. package/dist/ui/strategies/index.js.map +1 -0
  218. package/dist/ui/strategies/interactive.d.ts +36 -0
  219. package/dist/ui/strategies/interactive.js +149 -0
  220. package/dist/ui/strategies/interactive.js.map +1 -0
  221. package/dist/ui/strategies/plain.d.ts +24 -0
  222. package/dist/ui/strategies/plain.js +72 -0
  223. package/dist/ui/strategies/plain.js.map +1 -0
  224. package/dist/ui/strategies/silent.d.ts +22 -0
  225. package/dist/ui/strategies/silent.js +25 -0
  226. package/dist/ui/strategies/silent.js.map +1 -0
  227. package/dist/ui/strategies/validation-display-strategy.d.ts +64 -0
  228. package/dist/ui/strategies/validation-display-strategy.js +109 -0
  229. package/dist/ui/strategies/validation-display-strategy.js.map +1 -0
  230. package/dist/ui/table.d.ts +4 -0
  231. package/dist/ui/table.js +33 -0
  232. package/dist/ui/table.js.map +1 -0
  233. package/dist/ui/theme.d.ts +12 -0
  234. package/dist/ui/theme.js +4 -0
  235. package/dist/ui/theme.js.map +1 -0
  236. package/dist/ui/validation-progress-renderer.d.ts +48 -0
  237. package/dist/ui/validation-progress-renderer.js +114 -0
  238. package/dist/ui/validation-progress-renderer.js.map +1 -0
  239. package/dist/utils/package-resolver.d.ts +20 -0
  240. package/dist/utils/package-resolver.js +44 -0
  241. package/dist/utils/package-resolver.js.map +1 -0
  242. package/dist/utils/project-dir.d.ts +9 -0
  243. package/dist/utils/project-dir.js +13 -0
  244. package/dist/utils/project-dir.js.map +1 -0
  245. package/dist/utils/suppress.d.ts +13 -0
  246. package/dist/utils/suppress.js +29 -0
  247. package/dist/utils/suppress.js.map +1 -0
  248. package/dist/utils/validation-runner.js +69 -0
  249. package/dist/utils/validation-runner.js.map +1 -0
  250. package/dist/utils/watcher-runner.d.ts +1 -0
  251. package/dist/utils/watcher-runner.js +148 -0
  252. package/dist/utils/watcher-runner.js.map +1 -0
  253. package/dist/utils/watcher.d.ts +27 -0
  254. package/dist/utils/watcher.js +51 -0
  255. package/dist/utils/watcher.js.map +1 -0
  256. package/oclif.manifest.json +1519 -501
  257. package/package.json +19 -8
  258. package/dist/commands/build.d.ts +0 -30
  259. package/dist/commands/build.js +0 -228
  260. package/dist/commands/build.js.map +0 -1
  261. package/dist/commands/deploy.d.ts +0 -20
  262. package/dist/commands/deploy.js +0 -141
  263. package/dist/commands/deploy.js.map +0 -1
  264. package/dist/commands/hello/index.d.ts +0 -12
  265. package/dist/commands/hello/index.js +0 -20
  266. package/dist/commands/hello/index.js.map +0 -1
  267. package/dist/commands/hello/world.d.ts +0 -8
  268. package/dist/commands/hello/world.js +0 -15
  269. package/dist/commands/hello/world.js.map +0 -1
  270. package/dist/commands/pool/provision.d.ts +0 -22
  271. package/dist/commands/pool/provision.js +0 -115
  272. package/dist/commands/pool/provision.js.map +0 -1
  273. package/dist/commands/project.js.map +0 -1
  274. package/dist/ui/pool-progress-renderer.d.ts +0 -68
  275. package/dist/ui/pool-progress-renderer.js +0 -298
  276. package/dist/ui/pool-progress-renderer.js.map +0 -1
  277. package/dist/utils/validation-watcher.js +0 -114
  278. package/dist/utils/validation-watcher.js.map +0 -1
  279. /package/dist/utils/{validation-watcher.d.ts → validation-runner.d.ts} +0 -0
@@ -1,72 +1,75 @@
1
- import boxen from 'boxen';
2
1
  import chalk from 'chalk';
3
- import ora from 'ora';
4
- import { successBox, warningBox } from './boxes.js';
5
- import { OrchestrationListrManager } from './orchestration-listr.js';
6
2
  import { formatDuration } from './renderer-utils.js';
3
+ import { createDisplayStrategy } from './strategies/index.js';
7
4
  /**
8
- * Renders install progress in different output modes
5
+ * Renders install progress by translating install/orchestration events
6
+ * into display strategy calls.
7
+ *
8
+ * The renderer owns event-to-semantic translation. The display strategy
9
+ * (interactive, plain, silent) owns how that is rendered.
9
10
  */
10
11
  export class InstallProgressRenderer {
12
+ display;
11
13
  /**
12
14
  * Event configuration mapping events to handlers
13
15
  */
14
16
  eventConfigs = {
17
+ complete: { description: 'Install completed', handler: this.handleInstallComplete.bind(this) },
15
18
  'connection:complete': { description: 'Connected to org', handler: this.handleConnectionComplete.bind(this) },
16
19
  'connection:start': { description: 'Connecting to org', handler: this.handleConnectionStart.bind(this) },
17
- 'deployment:complete': { description: 'Deployment completed', handler: this.handleDeploymentComplete.bind(this) },
18
- 'deployment:progress': { description: 'Deployment progress', handler: this.handleDeploymentProgress.bind(this) },
19
- 'deployment:start': { description: 'Deployment started', handler: this.handleDeploymentStart.bind(this) },
20
- 'install:complete': { description: 'Install completed', handler: this.handleInstallComplete.bind(this) },
21
- 'install:error': { description: 'Install error', handler: this.handleInstallError.bind(this) },
22
- 'install:skip': { description: 'Install skipped', handler: this.handleInstallSkip.bind(this) },
23
- 'install:start': { description: 'Install started', handler: this.handleInstallStart.bind(this) },
24
- 'version-install:complete': { description: 'Version install completed', handler: this.handleVersionInstallComplete.bind(this) },
25
- 'version-install:progress': { description: 'Version install progress', handler: this.handleVersionInstallProgress.bind(this) },
26
- 'version-install:start': { description: 'Version install started', handler: this.handleVersionInstallStart.bind(this) },
20
+ 'deploy:complete': { description: 'Deployment completed', handler: this.handleDeploymentComplete.bind(this) },
21
+ 'deploy:progress': { description: 'Deployment progress', handler: this.handleDeploymentProgress.bind(this) },
22
+ 'deploy:start': { description: 'Deployment started', handler: this.handleDeploymentStart.bind(this) },
23
+ error: { description: 'Install error', handler: this.handleInstallError.bind(this) },
24
+ 'hook:complete': { description: 'Hook complete', handler: this.handleHookComplete.bind(this) },
25
+ 'hooks:complete': { description: 'All hooks complete', handler: this.handleHooksComplete.bind(this) },
26
+ 'hooks:start': { description: 'Hooks started', handler: this.handleHooksStart.bind(this) },
27
+ skip: { description: 'Install skipped', handler: this.handleInstallSkip.bind(this) },
28
+ start: { description: 'Install started', handler: this.handleInstallStart.bind(this) },
29
+ 'version:complete': { description: 'Version install completed', handler: this.handleVersionInstallComplete.bind(this) },
30
+ 'version:progress': { description: 'Version install progress', handler: this.handleVersionInstallProgress.bind(this) },
31
+ 'version:start': { description: 'Version install started', handler: this.handleVersionInstallStart.bind(this) },
27
32
  };
28
33
  events = [];
34
+ /**
35
+ * Tracks completed hook names per package for rolling title updates.
36
+ */
37
+ hookProgress = new Map();
29
38
  installResult;
30
- listr;
31
- logger;
32
- mode;
33
39
  /**
34
40
  * Event configuration for orchestration-level events
35
41
  */
36
42
  orchestrationEventConfigs = {
37
- 'orchestration:complete': { description: 'Orchestration complete', handler: this.handleOrchestrationComplete.bind(this) },
38
- 'orchestration:level:complete': { description: 'Level complete', handler: this.handleOrchestrationLevelComplete.bind(this) },
39
- 'orchestration:level:start': { description: 'Level started', handler: this.handleOrchestrationLevelStart.bind(this) },
40
- 'orchestration:start': { description: 'Orchestration started', handler: this.handleOrchestrationStart.bind(this) },
43
+ complete: { description: 'Orchestration complete', handler: this.handleOrchestrationComplete.bind(this) },
44
+ 'level:complete': { description: 'Level complete', handler: this.handleOrchestrationLevelComplete.bind(this) },
45
+ 'level:start': { description: 'Level started', handler: this.handleOrchestrationLevelStart.bind(this) },
46
+ 'regression:complete': { description: 'Regression tests complete', handler: this.handleRegressionComplete.bind(this) },
47
+ 'regression:package:complete': { description: 'Regression package complete', handler: this.handleRegressionPackageComplete.bind(this) },
48
+ 'regression:start': { description: 'Regression tests started', handler: this.handleRegressionStart.bind(this) },
49
+ start: { description: 'Orchestration started', handler: this.handleOrchestrationStart.bind(this) },
41
50
  };
42
- spinner;
43
51
  targetOrg;
44
52
  timings = {};
45
53
  constructor(options) {
46
- this.logger = options.logger;
47
- this.mode = options.mode;
54
+ this.display = createDisplayStrategy(options.mode, options.logger, { operationLabel: 'installing...' });
48
55
  this.targetOrg = options.targetOrg;
49
- this.listr = new OrchestrationListrManager(event => {
50
- const count = event.packages.length;
51
- const pkgText = count === 1 ? 'package' : 'packages';
52
- return `Installing ${chalk.cyan(String(count))} ${pkgText} to ${chalk.yellow(this.targetOrg)}`;
53
- });
54
56
  }
55
57
  /**
56
- * Attach renderer to a PackageInstaller or InstallOrchestrator instance
58
+ * Attach renderer to typed event buses.
57
59
  */
58
- attachTo(emitter) {
60
+ attachTo(installBus, orchestrationBus) {
59
61
  for (const [event, config] of Object.entries(this.eventConfigs)) {
60
- emitter.on(event, (data) => {
62
+ installBus.on(event, (data) => {
61
63
  this.logEvent(event, data);
62
64
  config.handler(data);
63
65
  });
64
66
  }
65
- // Attach orchestration event handlers (no-ops if emitter is a plain PackageInstaller)
66
- for (const [event, config] of Object.entries(this.orchestrationEventConfigs)) {
67
- emitter.on(event, (data) => {
68
- config.handler(data);
69
- });
67
+ if (orchestrationBus) {
68
+ for (const [event, config] of Object.entries(this.orchestrationEventConfigs)) {
69
+ orchestrationBus.on(event, (data) => {
70
+ config.handler(data);
71
+ });
72
+ }
70
73
  }
71
74
  }
72
75
  /**
@@ -92,345 +95,196 @@ export class InstallProgressRenderer {
92
95
  error,
93
96
  success: false,
94
97
  };
95
- if (!this.isInteractive()) {
96
- if (this.mode === 'quiet') {
97
- this.logger.error(error);
98
- }
99
- return;
100
- }
101
- this.spinner?.fail(chalk.red('Installation failed'));
102
- this.logger.log(boxen(chalk.white(error.message), {
103
- borderColor: 'red',
104
- borderStyle: 'round',
105
- margin: { bottom: 1, top: 1 },
106
- padding: 1,
107
- title: 'Installation Error',
108
- titleAlignment: 'center',
109
- }));
110
- }
111
- /**
112
- * Look up the Listr sub-task for a package within the active orchestration level.
113
- * Returns undefined when running in standalone (non-orchestration) mode.
114
- */
115
- getPackageTask(packageName) {
116
- return this.listr.getPackageTask(packageName);
98
+ this.display.error(error);
117
99
  }
118
- /**
119
- * Handle connection complete event
120
- */
100
+ // ========================================================================
101
+ // Connection Events
102
+ // ========================================================================
121
103
  handleConnectionComplete(event) {
122
- if (!this.isInteractive())
123
- return;
124
- const task = this.getPackageTask(event.packageName);
125
- if (task) {
126
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - Connected to ${chalk.yellow(event.username)}`);
127
- }
128
- else if (!this.isOrchestrating()) {
129
- this.spinner?.succeed(chalk.green(`Connected to org ${chalk.yellow(event.username)}`));
130
- }
104
+ this.display.subtaskUpdate(event.packageName, 'install', `connected to ${chalk.yellow(event.username)}`);
131
105
  this.targetOrg = event.targetOrg ?? event.username;
132
106
  }
133
- /**
134
- * Handle connection start event
135
- */
136
107
  handleConnectionStart(event) {
137
108
  this.timings.connectionStart = new Date();
138
- if (!this.isInteractive())
139
- return;
140
- const task = this.getPackageTask(event.packageName);
141
- if (task) {
142
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - Connecting to org...`);
143
- }
144
- else if (!this.isOrchestrating()) {
145
- this.spinner?.start(`Connecting to org ${chalk.yellow(event.username)}...`);
146
- }
147
- }
148
- /**
149
- * Handle deployment complete event
150
- */
151
- handleDeploymentComplete(event) {
152
- if (!this.isInteractive())
153
- return;
154
- const task = this.getPackageTask(event.packageName);
155
- if (task) {
156
- const components = event.numberComponentsDeployed ? ` (${event.numberComponentsDeployed} components)` : '';
157
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - Deployed${components}`);
158
- }
159
- else if (!this.isOrchestrating()) {
160
- this.spinner?.succeed(chalk.green('Metadata deployed successfully'));
161
- if (event.numberComponentsDeployed) {
162
- this.logger.log(chalk.gray(` Deployed ${event.numberComponentsDeployed} components`));
163
- }
164
- }
109
+ this.display.subtaskStart(event.packageName, `connecting to org ${chalk.yellow(event.username)}`);
165
110
  }
166
111
  // ========================================================================
167
- // Connection Events
112
+ // Deployment Events (source packages)
168
113
  // ========================================================================
169
- /**
170
- * Handle deployment progress event
171
- */
114
+ handleDeploymentComplete(event) {
115
+ const components = event.numberComponentsDeployed ? ` (${event.numberComponentsDeployed} components)` : '';
116
+ this.display.subtaskUpdate(event.packageName, 'install', `deployed${components}`);
117
+ }
172
118
  handleDeploymentProgress(event) {
173
- if (!this.isInteractive())
174
- return;
175
119
  const status = event.status || 'InProgress';
176
120
  const componentsDeployed = event.numberComponentsDeployed || 0;
177
121
  const componentsTotal = event.numberComponentsTotal || 0;
178
122
  let progressText;
179
123
  if (componentsTotal > 0) {
180
124
  const percentage = Math.round((componentsDeployed / componentsTotal) * 100);
181
- progressText = `Deploying: ${status} (${componentsDeployed}/${componentsTotal} - ${percentage}%)`;
125
+ progressText = `deploying: ${status} (${componentsDeployed}/${componentsTotal} — ${percentage}%)`;
182
126
  }
183
127
  else {
184
- progressText = `Deploying: ${status}`;
185
- }
186
- const task = this.getPackageTask(event.packageName);
187
- if (task) {
188
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${progressText}`);
189
- }
190
- else if (!this.isOrchestrating() && this.spinner) {
191
- this.spinner.text = progressText;
128
+ progressText = `deploying: ${status}`;
192
129
  }
130
+ this.display.subtaskUpdate(event.packageName, 'install', progressText);
193
131
  }
194
- /**
195
- * Handle deployment start event
196
- */
197
132
  handleDeploymentStart(event) {
198
133
  this.timings.deploymentStart = new Date();
199
- if (!this.isInteractive())
200
- return;
201
- const task = this.getPackageTask(event.packageName);
202
- if (task) {
203
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - Deploying metadata...`);
204
- }
205
- else if (!this.isOrchestrating()) {
206
- this.spinner = ora({
207
- color: 'cyan',
208
- text: `Deploying metadata to ${chalk.yellow(event.targetOrg)}...`,
209
- }).start();
134
+ this.display.subtaskStart(event.packageName, `deploying metadata to ${chalk.yellow(event.targetOrg)}`);
135
+ }
136
+ // ========================================================================
137
+ // Hook Events
138
+ // ========================================================================
139
+ handleHookComplete(event) {
140
+ const progress = this.hookProgress.get(event.packageName);
141
+ if (progress) {
142
+ progress.completed.push(event.hookName);
210
143
  }
211
144
  }
145
+ handleHooksComplete(event) {
146
+ if (event.completedCount === 0)
147
+ return;
148
+ const duration = this.timings.hooksStart
149
+ ? formatDuration(Date.now() - this.timings.hooksStart.getTime())
150
+ : '';
151
+ const hookText = event.completedCount === 1 ? 'hook' : 'hooks';
152
+ const phase = `${event.timing}-hooks`;
153
+ this.display.subtaskComplete(event.packageName, phase, `${event.timing}-${event.operation} ${hookText} (${event.completedCount}) ${chalk.gray(`(${duration})`)}`);
154
+ this.hookProgress.delete(event.packageName);
155
+ }
156
+ handleHooksStart(event) {
157
+ this.timings.hooksStart = event.timestamp;
158
+ if (event.hookCount === 0)
159
+ return;
160
+ this.hookProgress.set(event.packageName, { completed: [], total: [...event.hookNames] });
161
+ const phase = `${event.timing}-hooks`;
162
+ const label = event.hookNames.map(n => chalk.dim(n)).join(chalk.dim(', '));
163
+ this.display.subtaskStart(event.packageName, phase);
164
+ this.display.subtaskUpdate(event.packageName, phase, `running ${event.timing}-${event.operation} hooks — ${label}`);
165
+ }
212
166
  // ========================================================================
213
- // Deployment Events (source packages)
167
+ // Install Events
214
168
  // ========================================================================
215
- /**
216
- * Handle install complete event — resolves the Listr sub-task in orchestration mode
217
- */
218
169
  handleInstallComplete(event) {
219
170
  this.installResult = { success: true };
220
- if (!this.isInteractive())
221
- return;
222
- const task = this.getPackageTask(event.packageName);
223
- if (task) {
224
- const version = event.versionNumber ? `@${event.versionNumber}` : '';
225
- this.listr.updatePackageTitle(event.packageName, `${chalk.green('Installed')} ${chalk.cyan(`${event.packageName}${version}`)}`);
226
- this.listr.resolvePackage(event.packageName);
227
- }
228
- else if (this.isOrchestrating()) {
229
- // Listr task not ready yet — resolve via deferred directly
230
- this.listr.resolvePackage(event.packageName);
231
- }
232
- else {
233
- this.spinner?.succeed(chalk.green(`Successfully installed ${chalk.bold(event.packageName)}`));
234
- const duration = this.timings.installStart
235
- ? Date.now() - this.timings.installStart.getTime()
236
- : 0;
237
- this.logger.log(successBox('Installation Complete', {
238
- Duration: formatDuration(duration),
239
- 'Package Name': event.packageName,
240
- Source: event.source,
241
- 'Target Org': event.targetOrg,
242
- 'Version ID': event.packageVersionId,
243
- 'Version Number': event.versionNumber,
244
- }));
245
- }
171
+ const version = event.versionNumber ? `@${event.versionNumber}` : '';
172
+ const duration = this.timings.installStart
173
+ ? formatDuration(Date.now() - this.timings.installStart.getTime())
174
+ : '';
175
+ this.display.subtaskUpdate(event.packageName, 'install', `installed${version}`);
176
+ this.display.packageComplete(event.packageName, duration);
246
177
  }
247
- /**
248
- * Handle install error event — rejects the Listr sub-task in orchestration mode
249
- */
250
178
  handleInstallError(event) {
251
179
  this.installResult = {
252
180
  error: event.error,
253
181
  success: false,
254
182
  };
255
- if (!this.isInteractive()) {
256
- if (this.mode === 'quiet') {
257
- this.logger.error(event.error);
258
- }
259
- return;
260
- }
261
- const task = this.getPackageTask(event.packageName);
262
- if (task) {
263
- const errorMsg = typeof event.error === 'string' ? event.error : event.error?.message ?? 'Installation failed';
264
- this.listr.rejectPackage(event.packageName, errorMsg);
265
- }
266
- else if (this.isOrchestrating()) {
267
- // Listr task not ready yet — reject via deferred directly
268
- const errorMsg = typeof event.error === 'string' ? event.error : event.error?.message ?? 'Installation failed';
269
- this.listr.rejectPackage(event.packageName, errorMsg);
270
- }
271
- else {
272
- this.spinner?.fail(chalk.red(`Failed to install ${chalk.bold(event.packageName)}`));
273
- }
183
+ const errorMsg = typeof event.error === 'string' ? event.error : event.error?.message ?? 'Installation failed';
184
+ this.display.packageFail(event.packageName, errorMsg);
274
185
  }
275
- /**
276
- * Handle install skip event — resolves the Listr sub-task with a skip message
277
- */
278
186
  handleInstallSkip(event) {
279
- if (!this.isInteractive())
280
- return;
281
187
  const reason = event.reason || 'Already installed';
282
- const task = this.getPackageTask(event.packageName);
283
- if (task) {
284
- this.listr.updatePackageTitle(event.packageName, `${chalk.yellow('Skipped')} ${chalk.cyan(event.packageName)} - ${reason}`);
285
- this.listr.resolvePackage(event.packageName);
286
- }
287
- else if (this.isOrchestrating()) {
288
- this.listr.resolvePackage(event.packageName);
289
- }
290
- else {
291
- this.spinner?.info(chalk.yellow(`Skipped ${chalk.bold(event.packageName)}: ${reason}`));
292
- }
188
+ this.display.packageSkip(event.packageName, reason);
293
189
  }
294
- /**
295
- * Handle install start event
296
- */
297
190
  handleInstallStart(event) {
298
191
  this.timings.installStart = new Date();
299
- if (!this.isInteractive())
300
- return;
301
- const task = this.getPackageTask(event.packageName);
302
- if (task) {
303
- const version = event.versionNumber ? `@${event.versionNumber}` : '';
304
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(`${event.packageName}${version}`)} - Starting installation...`);
305
- }
306
- else if (!this.isOrchestrating()) {
307
- const packageDisplay = event.versionNumber
308
- ? `${event.packageName}@${event.versionNumber}`
309
- : event.packageName;
310
- this.logger.log(chalk.bold(`Installing package: ${chalk.cyan(packageDisplay)} (${event.packageType})\n`));
311
- this.spinner = ora({
312
- color: 'cyan',
313
- text: `Installing ${chalk.cyan(event.packageName)} to ${chalk.yellow(event.targetOrg)}`,
314
- }).start();
315
- }
192
+ const version = event.versionNumber ? `@${event.versionNumber}` : '';
193
+ this.display.packageStart(event.packageName);
194
+ this.display.subtaskStart(event.packageName, `${event.packageName}${version} (${event.packageType})`);
316
195
  }
196
+ // ========================================================================
197
+ // Orchestration Events
198
+ // ========================================================================
317
199
  handleOrchestrationComplete(event) {
318
200
  this.logEvent('orchestration:complete', event);
319
- if (!this.isInteractive())
320
- return;
321
- // Cleanup \u2014 Listr rendering is done
322
- this.listr.destroy();
323
- this.logger.log('');
324
201
  const succeeded = event.results.filter(r => r.success && !r.skipped).length;
325
202
  const failed = event.results.filter(r => !r.success && !r.skipped).length;
326
203
  const skipped = event.results.filter(r => r.skipped).length;
327
- const duration = formatDuration(event.totalDuration);
328
- const entries = {
329
- Succeeded: String(succeeded),
330
- 'Total Packages': String(event.results.length),
331
- };
332
- if (failed > 0)
333
- entries.Failed = chalk.red(String(failed));
334
- if (skipped > 0)
335
- entries.Skipped = chalk.yellow(String(skipped));
336
- entries.Duration = duration;
337
- const allSucceeded = failed === 0;
338
- const title = allSucceeded ? 'Install Orchestration Complete' : 'Install Orchestration Complete (with failures)';
339
- if (allSucceeded) {
340
- this.logger.log(successBox(title, entries));
341
- }
342
- else {
343
- this.logger.log(warningBox(title, entries));
344
- }
204
+ this.display.complete({
205
+ duration: formatDuration(event.totalDuration),
206
+ failed,
207
+ packages: event.results.map(r => ({
208
+ error: r.error,
209
+ name: r.packageName,
210
+ skipped: r.skipped,
211
+ success: r.success,
212
+ })),
213
+ skipped,
214
+ succeeded,
215
+ });
345
216
  }
346
217
  handleOrchestrationLevelComplete(event) {
347
218
  this.logEvent('orchestration:level:complete', event);
348
- // No cleanup needed — Listr keeps completed level tasks visible
349
- // and the next level task starts automatically (sequential root).
350
219
  }
351
220
  handleOrchestrationLevelStart(event) {
352
221
  this.logEvent('orchestration:level:start', event);
353
- if (!this.isInteractive())
354
- return;
355
- this.listr.onLevelStart(event);
222
+ this.display.levelStart(event.level, event.packages);
356
223
  }
357
- // ========================================================================
358
- // Version Install Events (unlocked packages)
359
- // ========================================================================
360
224
  handleOrchestrationStart(event) {
361
225
  this.logEvent('orchestration:start', event);
362
- if (!this.isInteractive())
363
- return;
364
226
  const pkgText = event.totalPackages === 1 ? 'package' : 'packages';
365
- this.logger.log(chalk.bold(`\nInstalling ${chalk.cyan(String(event.totalPackages))} ${pkgText} to ${chalk.cyan(this.targetOrg)}`));
227
+ let title = `Installing ${chalk.cyan(String(event.totalPackages))} ${pkgText} to ${chalk.cyan(this.targetOrg)}`;
366
228
  if (event.includeDependencies) {
367
- this.logger.log(chalk.dim(' Dependencies auto-included'));
229
+ title += chalk.dim('\n Dependencies auto-included');
368
230
  }
369
- this.logger.log('');
370
- this.listr.start(event.totalLevels);
231
+ this.display.start(title, event.packageNames, event.levels);
371
232
  }
372
- /**
373
- * Handle version install complete event
374
- */
375
- handleVersionInstallComplete(event) {
376
- if (!this.isInteractive())
377
- return;
378
- const task = this.getPackageTask(event.packageName);
379
- if (task) {
380
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - Version installed`);
233
+ // ========================================================================
234
+ // Regression Test Events
235
+ // ========================================================================
236
+ handleRegressionComplete(event) {
237
+ this.logEvent('regression:complete', event);
238
+ const passCount = event.passed.length;
239
+ const failCount = event.failed.length;
240
+ const duration = formatDuration(event.duration);
241
+ if (failCount === 0) {
242
+ this.display.info(`${chalk.green('✓')} Regression tests passed — ${chalk.cyan(String(passCount))} dependent package(s) ${chalk.gray(`(${duration})`)}`);
381
243
  }
382
- else if (!this.isOrchestrating()) {
383
- this.spinner?.succeed(chalk.green('Package version installed'));
244
+ else {
245
+ this.display.info(`${chalk.red('✗')} Regression tests — ${chalk.green(String(passCount))} passed, ${chalk.red(String(failCount))} failed ${chalk.gray(`(${duration})`)}`);
384
246
  }
385
247
  }
386
- /**
387
- * Handle version install progress event
388
- */
389
- handleVersionInstallProgress(event) {
390
- if (!this.isInteractive())
391
- return;
392
- const status = event.status || 'InProgress';
393
- const task = this.getPackageTask(event.packageName);
394
- if (task) {
395
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - Installing version: ${status}`);
248
+ handleRegressionPackageComplete(event) {
249
+ this.logEvent('regression:package:complete', event);
250
+ if (event.success) {
251
+ const detail = `${event.passed}/${event.total} tests passed`;
252
+ this.display.packageComplete(event.packageName, detail);
396
253
  }
397
- else if (!this.isOrchestrating() && this.spinner) {
398
- this.spinner.text = `Installing package version: ${status}`;
254
+ else if (event.error) {
255
+ this.display.packageFail(event.packageName, event.error);
399
256
  }
400
- }
401
- /**
402
- * Handle version install start event
403
- */
404
- handleVersionInstallStart(event) {
405
- if (!this.isInteractive())
406
- return;
407
- const task = this.getPackageTask(event.packageName);
408
- if (task) {
409
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - Installing package version...`);
257
+ else {
258
+ this.display.packageFail(event.packageName, `${event.failed}/${event.total} tests failed`);
410
259
  }
411
- else if (!this.isOrchestrating()) {
412
- this.spinner = ora({
413
- color: 'cyan',
414
- text: `Installing package version ${event.packageVersionId ?? ''}...`,
415
- }).start();
260
+ }
261
+ handleRegressionStart(event) {
262
+ this.logEvent('regression:start', event);
263
+ const pkgText = event.packages.length === 1 ? 'dependent' : 'dependents';
264
+ this.display.info(`\n${chalk.cyan('⟳')} Running regression tests on ${chalk.cyan(String(event.packages.length))} ${pkgText}`);
265
+ for (const pkg of event.packages) {
266
+ this.display.packageStart(pkg);
267
+ this.display.subtaskStart(pkg, 'running apex tests');
416
268
  }
417
269
  }
418
- /**
419
- * Check if renderer is in interactive mode
420
- */
421
- isInteractive() {
422
- return this.mode === 'interactive';
270
+ // ========================================================================
271
+ // Version Install Events (unlocked packages)
272
+ // ========================================================================
273
+ handleVersionInstallComplete(event) {
274
+ this.display.subtaskUpdate(event.packageName, 'install', 'version installed');
423
275
  }
424
- /**
425
- * Check if an orchestration level is currently active.
426
- * Used to prevent standalone spinner creation during orchestration —
427
- * all output should flow through Listr sub-tasks instead.
428
- */
429
- isOrchestrating() {
430
- return this.listr.isActive();
276
+ handleVersionInstallProgress(event) {
277
+ const status = event.status || 'InProgress';
278
+ this.display.subtaskUpdate(event.packageName, 'install', `installing version: ${status}`);
431
279
  }
280
+ handleVersionInstallStart(event) {
281
+ this.display.subtaskStart(event.packageName, 'installing package version');
282
+ }
283
+ // ========================================================================
284
+ // Utility
285
+ // ========================================================================
432
286
  /**
433
- * Log an event for JSON output and quiet mode
287
+ * Log an event for JSON output
434
288
  */
435
289
  logEvent(type, data) {
436
290
  this.events.push({