@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,14 +1,16 @@
1
1
  import chalk from 'chalk';
2
- import ora from 'ora';
3
- import { infoBox, successBox, warningBox } from './boxes.js';
4
- import { OrchestrationListrManager } from './orchestration-listr.js';
5
- import { calculateDuration, formatDuration, NameAligner } from './renderer-utils.js';
2
+ import { calculateDuration, formatDuration, sym } from './renderer-utils.js';
3
+ import { createDisplayStrategy } from './strategies/index.js';
6
4
  /**
7
- * Renders build progress in different output modes
5
+ * Renders build progress by translating build/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.
8
10
  */
9
11
  export class BuildProgressRenderer {
10
- analyzerNameAligner = new NameAligner();
11
12
  buildResult;
13
+ display;
12
14
  /**
13
15
  * Event configuration mapping events to handlers
14
16
  */
@@ -17,79 +19,76 @@ export class BuildProgressRenderer {
17
19
  'analyzer:start': { description: 'Analyzer started', handler: this.handleAnalyzerStart.bind(this) },
18
20
  'analyzers:complete': { description: 'All analyzers complete', handler: this.handleAnalyzersComplete.bind(this) },
19
21
  'analyzers:start': { description: 'Analyzers started', handler: this.handleAnalyzersStart.bind(this) },
20
- 'build:complete': { description: 'Build completed', handler: this.handleBuildComplete.bind(this) },
21
- 'build:error': { description: 'Build failed', handler: this.handleBuildError.bind(this) },
22
- 'build:skipped': { description: 'Build skipped', handler: this.handleBuildSkipped.bind(this) },
23
- 'build:start': { description: 'Build started', handler: this.handleBuildStart.bind(this) },
24
22
  'builder:complete': { description: 'Builder complete', handler: this.handleBuilderComplete.bind(this) },
25
23
  'builder:start': { description: 'Builder started', handler: this.handleBuilderStart.bind(this) },
24
+ complete: { description: 'Build completed', handler: this.handleBuildComplete.bind(this) },
26
25
  'connection:complete': { description: 'Connection complete', handler: this.handleConnectionComplete.bind(this) },
27
26
  'connection:start': { description: 'Connection started', handler: this.handleConnectionStart.bind(this) },
27
+ 'create:complete': { description: 'Package creation complete', handler: this.handleCreateComplete.bind(this) },
28
+ 'create:progress': { description: 'Package creation progress', handler: this.handleCreateProgress.bind(this) },
29
+ 'create:start': { description: 'Package creation started', handler: this.handleCreateStart.bind(this) },
30
+ error: { description: 'Build failed', handler: this.handleBuildError.bind(this) },
31
+ 'hook:complete': { description: 'Hook complete', handler: this.handleHookComplete.bind(this) },
32
+ 'hooks:complete': { description: 'All hooks complete', handler: this.handleHooksComplete.bind(this) },
33
+ 'hooks:start': { description: 'Hooks started', handler: this.handleHooksStart.bind(this) },
34
+ skip: { description: 'Build skipped', handler: this.handleBuildSkipped.bind(this) },
28
35
  'stage:complete': { description: 'Staging complete', handler: this.handleStageComplete.bind(this) },
29
36
  'stage:start': { description: 'Staging package', handler: this.handleStageStart.bind(this) },
37
+ start: { description: 'Build started', handler: this.handleBuildStart.bind(this) },
30
38
  'task:complete': { description: 'Task complete', handler: this.handleTaskComplete.bind(this) },
39
+ 'task:skipped': { description: 'Task skipped', handler: this.handleTaskSkipped.bind(this) },
31
40
  'task:start': { description: 'Task started', handler: this.handleTaskStart.bind(this) },
32
- 'unlocked:create:complete': { description: 'Package creation complete', handler: this.handleCreateComplete.bind(this) },
33
- 'unlocked:create:progress': { description: 'Package creation progress', handler: this.handleCreateProgress.bind(this) },
34
- 'unlocked:create:start': { description: 'Package creation started', handler: this.handleCreateStart.bind(this) },
41
+ 'validate:queued': { description: 'Validation queued', handler: this.handleValidationQueued.bind(this) },
35
42
  };
36
43
  events = [];
37
- listr;
38
- logger;
39
- mode;
44
+ /**
45
+ * Tracks completed hook names per package for rolling title updates.
46
+ */
47
+ hookProgress = new Map();
40
48
  /**
41
49
  * Event configuration for orchestration-level events
42
50
  */
43
51
  orchestrationEventConfigs = {
44
- 'orchestration:complete': { description: 'Orchestration complete', handler: this.handleOrchestrationComplete.bind(this) },
45
- 'orchestration:level:complete': { description: 'Level complete', handler: this.handleOrchestrationLevelComplete.bind(this) },
46
- 'orchestration:level:start': { description: 'Level started', handler: this.handleOrchestrationLevelStart.bind(this) },
47
- 'orchestration:package:complete': { description: 'Package complete', handler: this.handleOrchestrationPackageComplete.bind(this) },
48
- 'orchestration:start': { description: 'Orchestration started', handler: this.handleOrchestrationStart.bind(this) },
52
+ complete: { description: 'Orchestration complete', handler: this.handleOrchestrationComplete.bind(this) },
53
+ 'level:complete': { description: 'Level complete', handler: this.handleOrchestrationLevelComplete.bind(this) },
54
+ 'level:start': { description: 'Level started', handler: this.handleOrchestrationLevelStart.bind(this) },
55
+ 'package:complete': { description: 'Package complete', handler: this.handleOrchestrationPackageComplete.bind(this) },
56
+ start: { description: 'Orchestration started', handler: this.handleOrchestrationStart.bind(this) },
49
57
  };
58
+ packageVersions = new Map();
50
59
  /**
51
- * Tracks pending analyzer names during collection.
52
- * Once all `analyzer:start` events arrive, subtasks are created.
60
+ * Tracks running analyzer names per package for rolling title updates.
53
61
  */
54
- pendingAnalyzers = new Map();
62
+ runningAnalyzers = new Map();
55
63
  /**
56
64
  * Tracks skip reasons per package so they survive across event handlers.
57
65
  * Populated by `build:skipped`, consumed by `orchestration:package:complete`.
58
66
  */
59
67
  skippedReasons = new Map();
60
- spinner;
61
- timings = {
62
- analyzerStarts: new Map(),
63
- };
68
+ timings = {};
64
69
  constructor(options) {
65
- this.logger = options.logger;
66
- this.mode = options.mode;
67
- this.listr = new OrchestrationListrManager(event => {
68
- const count = event.packages.length;
69
- const pkgText = count === 1 ? 'package' : 'packages';
70
- return `Building ${chalk.cyan(String(count))} ${pkgText}`;
71
- }, { enableSubtasks: true });
70
+ this.display = createDisplayStrategy(options.mode, options.logger);
72
71
  }
73
72
  /**
74
- * Attach this renderer to a PackageBuilder or BuildOrchestrator instance
73
+ * Attach this renderer to typed event buses.
75
74
  */
76
- attachTo(emitter) {
77
- // Attach all configured build event handlers
75
+ attachTo(buildBus, orchestrationBus) {
78
76
  for (const [eventName, config] of Object.entries(this.eventConfigs)) {
79
- emitter.on(eventName, (data) => {
77
+ buildBus.on(eventName, (data) => {
80
78
  this.logEvent(eventName, data);
81
79
  config.handler(data);
82
80
  });
83
81
  }
84
- // Attach orchestration event handlers (no-ops if emitter is a plain PackageBuilder)
85
- for (const [eventName, config] of Object.entries(this.orchestrationEventConfigs)) {
86
- emitter.on(eventName, (data) => {
87
- config.handler(data);
88
- });
82
+ if (orchestrationBus) {
83
+ for (const [eventName, config] of Object.entries(this.orchestrationEventConfigs)) {
84
+ orchestrationBus.on(eventName, (data) => {
85
+ config.handler(data);
86
+ });
87
+ }
89
88
  }
90
89
  }
91
90
  // ========================================================================
92
- // Spinner Management
91
+ // Public API
93
92
  // ========================================================================
94
93
  /**
95
94
  * Get JSON output for --json flag
@@ -109,132 +108,43 @@ export class BuildProgressRenderer {
109
108
  * Handle error display
110
109
  */
111
110
  handleError(error) {
112
- if (!this.isInteractive())
113
- return;
114
- this.stopSpinner(false);
111
+ this.display.error(error);
115
112
  }
116
113
  // ========================================================================
117
- // Event Handlers
114
+ // Build Event Handlers
118
115
  // ========================================================================
119
- /**
120
- * Look up the Listr sub-task for a package within the active orchestration level.
121
- * Returns undefined when running in standalone (non-orchestration) mode.
122
- */
123
- getPackageTask(packageName) {
124
- return this.listr.getPackageTask(packageName);
125
- }
126
116
  handleAnalyzerComplete(event) {
127
- if (!this.isInteractive())
128
- return;
129
- const startTime = this.timings.analyzerStarts.get(event.analyzerName);
130
- const duration = calculateDuration(startTime, event.timestamp);
131
- const task = this.getPackageTask(event.packageName);
132
- if (task) {
133
- if (this.listr.hasSubtasks(event.packageName)) {
134
- // Build findings suffix for the subtask title
135
- let findingsSuffix = '';
136
- if (event.findings && Object.keys(event.findings).length > 0) {
137
- const findings = Object.entries(event.findings)
138
- .filter(([_, value]) => value && (Array.isArray(value) ? value.length > 0 : true))
139
- .map(([key, value]) => (Array.isArray(value) ? `${key}: ${value.length}` : key))
140
- .join(', ');
141
- if (findings)
142
- findingsSuffix = ` ${chalk.gray(`- ${findings}`)}`;
143
- }
144
- this.listr.updateSubtaskTitle(event.packageName, event.analyzerName, `${chalk.green(event.analyzerName)} ${chalk.gray(`(${duration})`)}${findingsSuffix}`);
145
- this.listr.resolveSubtask(event.packageName, event.analyzerName);
146
- }
147
- else {
148
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - Analyzer: ${event.analyzerName} ${chalk.gray(`(${duration})`)}`);
149
- }
150
- }
151
- else if (!this.isOrchestrating()) {
152
- // Build findings summary
153
- let findingsSummary = '';
154
- if (event.findings && Object.keys(event.findings).length > 0) {
155
- const findings = Object.entries(event.findings)
156
- .filter(([_, value]) => value && (Array.isArray(value) ? value.length > 0 : true))
157
- .map(([key, value]) => {
158
- if (Array.isArray(value)) {
159
- return `${key}: ${value.length}`;
160
- }
161
- return key;
162
- })
163
- .join(', ');
164
- if (findings) {
165
- findingsSummary = `: ${findings}`;
166
- }
167
- }
168
- // Pad duration and analyzer name for alignment
169
- const paddedDuration = duration.padStart(6);
170
- const paddedName = this.analyzerNameAligner.pad(event.analyzerName);
171
- // Log completion with aligned duration and analyzer name
172
- console.log(` ${chalk.green('✓')} ${chalk.gray(paddedDuration)} - ${chalk.cyan(paddedName)}${chalk.gray(findingsSummary)}`);
117
+ const progress = this.runningAnalyzers.get(event.packageName);
118
+ if (progress) {
119
+ progress.completed.push(event.analyzerName);
120
+ const remaining = progress.total.filter(n => !progress.completed.includes(n));
121
+ const label = remaining.length > 0
122
+ ? `analyzing — ${remaining.join(', ')}`
123
+ : 'analyzing...';
124
+ this.display.subtaskUpdate(event.packageName, 'build', label);
173
125
  }
174
126
  }
175
127
  handleAnalyzersComplete(event) {
176
- if (!this.isInteractive() || event.completedCount === 0)
128
+ if (event.completedCount === 0)
177
129
  return;
178
- const task = this.getPackageTask(event.packageName);
179
- if (task) {
180
- // With subtasks the individual analyzer tasks already show completion;
181
- // only update the parent title when NOT using subtask mode.
182
- if (!this.listr.hasSubtasks(event.packageName)) {
183
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - Analyzed (${event.completedCount} analyzers)`);
184
- }
185
- }
186
- else if (!this.isOrchestrating()) {
187
- // Show completion summary
188
- const duration = calculateDuration(this.timings.analyzersStart, event.timestamp);
189
- const analyzerText = event.completedCount === 1 ? 'analyzer' : 'analyzers';
190
- this.logger.log(chalk.green(`✔ Completed ${event.completedCount} ${analyzerText} in ${duration}`));
191
- this.logger.log('');
192
- }
193
- // Reset analyzer tracking for next build
194
- this.analyzerNameAligner.reset();
130
+ const duration = calculateDuration(this.timings.analyzersStart, event.timestamp);
131
+ const analyzerText = event.completedCount === 1 ? 'analyzer' : 'analyzers';
132
+ this.display.subtaskUpdate(event.packageName, 'build', `analyzed (${event.completedCount} ${analyzerText}) ${chalk.gray(`(${duration})`)}`);
133
+ this.runningAnalyzers.delete(event.packageName);
195
134
  }
196
135
  handleAnalyzersStart(event) {
197
136
  this.timings.analyzersStart = event.timestamp;
198
- if (!this.isInteractive())
199
- return;
200
- // In orchestration mode, set up subtask collection or skip
201
- if (this.isOrchestrating()) {
202
- if (event.analyzerCount === 0) {
203
- this.listr.skipPackageSubtasks(event.packageName);
204
- }
205
- else {
206
- this.pendingAnalyzers.set(event.packageName, { count: event.analyzerCount, names: [] });
207
- }
208
- }
209
137
  if (event.analyzerCount === 0)
210
138
  return;
211
- const task = this.getPackageTask(event.packageName);
212
- if (task) {
213
- // Package title is not updated here — subtasks will show analyzer detail.
214
- // For packages without subtasks (0 analyzers), this block is not reached
215
- // because we return early above.
216
- }
217
- else if (!this.isOrchestrating()) {
218
- // Log a static message instead of spinner for parallel analyzers
219
- const analyzerText = event.analyzerCount === 1 ? 'analyzer' : 'analyzers';
220
- this.logger.log(chalk.dim(`Running ${event.analyzerCount} ${analyzerText}...`));
221
- }
139
+ this.runningAnalyzers.set(event.packageName, { completed: [], total: [] });
140
+ this.display.subtaskUpdate(event.packageName, 'build', 'analyzing...');
222
141
  }
223
142
  handleAnalyzerStart(event) {
224
- this.timings.analyzerStarts.set(event.analyzerName, event.timestamp);
225
- // Track analyzer names for alignment
226
- this.analyzerNameAligner.add(event.analyzerName);
227
- // In orchestration mode, collect names then create subtasks
228
- if (this.isOrchestrating()) {
229
- const pending = this.pendingAnalyzers.get(event.packageName);
230
- if (pending) {
231
- pending.names.push(event.analyzerName);
232
- if (pending.names.length === pending.count) {
233
- // All analyzer names collected — declare subtask structure
234
- this.listr.setPackageSubtasks(event.packageName, pending.names.map(name => ({ name, title: chalk.cyan(name) })));
235
- this.pendingAnalyzers.delete(event.packageName);
236
- }
237
- }
143
+ const progress = this.runningAnalyzers.get(event.packageName);
144
+ if (progress) {
145
+ progress.total.push(event.analyzerName);
146
+ const names = progress.total.filter(n => !progress.completed.includes(n));
147
+ this.display.subtaskUpdate(event.packageName, 'build', `analyzing — ${names.join(', ')}`);
238
148
  }
239
149
  }
240
150
  handleBuildComplete(event) {
@@ -242,443 +152,175 @@ export class BuildProgressRenderer {
242
152
  packageVersionId: event.packageVersionId,
243
153
  success: true,
244
154
  };
245
- if (!this.isInteractive())
246
- return;
247
- const duration = calculateDuration(this.timings.buildStart, event.timestamp);
248
- const task = this.getPackageTask(event.packageName);
249
- if (task) {
250
- this.listr.updatePackageTitle(event.packageName, `${chalk.green('Built')} ${chalk.cyan(event.packageName)} ${chalk.gray(`(${duration})`)}`);
251
- }
252
- else if (!this.isOrchestrating()) {
253
- this.logger.log(chalk.green.bold('\n✓ Build complete!') + chalk.gray(` (${duration})`));
254
- }
155
+ if (event.version)
156
+ this.packageVersions.set(event.packageName, event.version);
157
+ const version = event.version ? ` @ ${event.version}` : '';
158
+ this.display.subtaskUpdate(event.packageName, 'build', `artifact${chalk.dim(version)}`);
255
159
  }
256
- handleBuilderComplete(event) {
257
- // No UI update needed — subsequent events (build:complete, etc.) handle display
160
+ handleBuilderComplete(_event) {
161
+ // No UI update needed — subsequent events handle display
258
162
  }
259
163
  handleBuildError(event) {
260
164
  this.buildResult = {
261
165
  error: event.error,
262
166
  success: false,
263
167
  };
264
- const task = this.getPackageTask(event.packageName);
265
- if (task) {
266
- this.listr.updatePackageTitle(event.packageName, `${chalk.red('Failed')} ${chalk.cyan(event.packageName)} - ${event.phase}`);
267
- }
268
- else if (this.isOrchestrating()) {
269
- // During orchestration, error display is handled by orchestration:package:complete
270
- }
271
- else {
272
- // Stop any active spinner
273
- if (this.isInteractive()) {
274
- this.stopSpinner(false);
275
- }
276
- // Always show errors, even in quiet mode
277
- this.logger.error(chalk.red.bold(`✗ Build failed in ${event.phase} phase: `) + event.error.message);
278
- }
168
+ this.display.subtaskUpdate(event.packageName, 'build', `${chalk.red('failed')} in ${event.phase}`);
169
+ this.display.packageFail(event.packageName, `Build failed in ${event.phase}: ${event.error.message}`);
279
170
  }
280
171
  handleBuilderStart(event) {
281
172
  this.timings.builderStart = event.timestamp;
282
- if (!this.isInteractive())
283
- return;
284
- // If subtasks haven't been set for this package yet (e.g. Data packages
285
- // that skip analyzers entirely), resolve with empty subtasks now.
286
- if (this.isOrchestrating()) {
287
- this.listr.skipPackageSubtasks(event.packageName);
288
- }
289
- const task = this.getPackageTask(event.packageName);
290
- if (task) {
291
- const statusText = `Executing ${event.packageType} builder...`;
292
- if (this.listr.hasSubtasks(event.packageName)) {
293
- this.listr.updateSentinelTitle(event.packageName, statusText);
294
- }
295
- else {
296
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${statusText}`);
297
- }
298
- }
299
- else if (!this.isOrchestrating()) {
300
- this.startSpinner(`Executing ${event.packageType} package builder...`);
301
- }
173
+ this.display.subtaskUpdate(event.packageName, 'build', `executing ${event.packageType} builder...`);
302
174
  }
303
175
  handleBuildSkipped(event) {
304
- this.buildResult = {
305
- success: true,
306
- };
307
- if (!this.isInteractive())
308
- return;
176
+ this.buildResult = { success: true };
309
177
  const reasonLabels = {
310
178
  'empty-package': 'package contains no deployable components',
311
179
  'no-changes': 'no source changes detected',
312
180
  };
313
181
  const reasonLabel = reasonLabels[event.reason] ?? event.reason;
314
- // Store the reason so orchestration:package:complete can use it
315
182
  this.skippedReasons.set(event.packageName, reasonLabel);
316
- const task = this.getPackageTask(event.packageName);
317
- if (task) {
318
- this.listr.updatePackageTitle(event.packageName, `${chalk.yellow('Skipped')} ${chalk.cyan(event.packageName)} - ${reasonLabel}`);
319
- }
320
- else if (!this.isOrchestrating()) {
321
- // Stop any active spinner before showing the box
322
- this.stopSpinner(true, chalk.yellow('Build skipped'));
323
- const duration = calculateDuration(this.timings.buildStart, event.timestamp);
324
- const entries = {
325
- Package: chalk.cyan(event.packageName),
326
- Type: event.packageType,
327
- };
328
- if (event.version) {
329
- entries.Version = event.version;
330
- }
331
- if (event.latestVersion) {
332
- entries['Latest Build'] = event.latestVersion;
333
- }
334
- if (event.sourceHash) {
335
- entries['Source Hash'] = chalk.dim(event.sourceHash);
336
- }
337
- if (event.artifactPath) {
338
- entries.Artifact = chalk.dim(event.artifactPath);
339
- }
340
- entries.Reason = chalk.yellow(reasonLabel.charAt(0).toUpperCase() + reasonLabel.slice(1));
341
- entries.Duration = duration;
342
- this.logger.log(infoBox('Build Skipped', entries));
343
- }
183
+ this.display.subtaskUpdate(event.packageName, 'build', chalk.dim(reasonLabel));
184
+ this.display.packageSkip(event.packageName, reasonLabel);
344
185
  }
345
186
  handleBuildStart(event) {
346
187
  this.timings.buildStart = event.timestamp;
347
- if (!this.isInteractive())
348
- return;
349
- const task = this.getPackageTask(event.packageName);
350
- if (task) {
351
- if (this.listr.hasSubtasks(event.packageName)) {
352
- this.listr.updateSentinelTitle(event.packageName, `Building (${event.packageType})...`);
353
- }
354
- else {
355
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - Building (${event.packageType})...`);
356
- }
357
- }
358
- else if (!this.isOrchestrating()) {
359
- this.logger.log(chalk.bold(`\nBuilding package: ${chalk.cyan(event.packageName)} (${event.packageType})\n`));
360
- }
188
+ this.display.packageStart(event.packageName);
189
+ this.display.subtaskStart(event.packageName, `building (${event.packageType})`);
361
190
  }
362
191
  handleConnectionComplete(event) {
363
- if (!this.isInteractive())
364
- return;
365
192
  const duration = calculateDuration(this.timings.connectionStart, event.timestamp);
366
- const task = this.getPackageTask(event.packageName);
367
- if (task) {
368
- const statusText = `Connected to ${chalk.yellow(event.username)} ${chalk.gray(`(${duration})`)}`;
369
- if (this.listr.hasSubtasks(event.packageName)) {
370
- this.listr.updateSentinelTitle(event.packageName, statusText);
371
- }
372
- else {
373
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${statusText}`);
374
- }
375
- }
376
- else if (!this.isOrchestrating()) {
377
- this.stopSpinner(true, chalk.gray(`Successfully connected to: ${event.username} (${duration})`));
378
- }
193
+ this.display.subtaskUpdate(event.packageName, 'build', `connected to ${chalk.yellow(event.username)} ${chalk.gray(`(${duration})`)}`);
379
194
  }
380
195
  handleConnectionStart(event) {
381
196
  this.timings.connectionStart = event.timestamp;
382
- if (!this.isInteractive())
383
- return;
384
- const task = this.getPackageTask(event.packageName);
385
- if (task) {
386
- const statusText = `Connecting to ${event.orgType}: ${chalk.yellow(event.username)}...`;
387
- if (this.listr.hasSubtasks(event.packageName)) {
388
- this.listr.updateSentinelTitle(event.packageName, statusText);
389
- }
390
- else {
391
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${statusText}`);
392
- }
393
- }
394
- else if (!this.isOrchestrating()) {
395
- this.startSpinner(`Connecting to ${event.orgType}: ${event.username}`);
396
- }
197
+ this.display.subtaskStart(event.packageName, `connecting to ${event.orgType}: ${chalk.yellow(event.username)}`);
397
198
  }
398
199
  handleCreateComplete(event) {
399
- if (!this.isInteractive())
400
- return;
401
200
  const elapsed = this.timings.createStart
402
201
  ? formatDuration(Date.now() - this.timings.createStart.getTime())
403
202
  : '';
404
203
  const elapsedSuffix = elapsed ? chalk.dim(` (${elapsed})`) : '';
405
- const task = this.getPackageTask(event.packageName);
406
- if (task) {
407
- const statusText = `Created ${event.versionNumber}${elapsedSuffix}`;
408
- if (this.listr.hasSubtasks(event.packageName)) {
409
- this.listr.updateSentinelTitle(event.packageName, statusText);
410
- }
411
- else {
412
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${statusText}`);
413
- }
414
- }
415
- else if (!this.isOrchestrating()) {
416
- this.stopSpinner(true, chalk.green(`Package ${event.packageName}@${event.versionNumber} successfully created with Id: ${event.packageVersionId}`) + elapsedSuffix);
417
- // Build package details entries
418
- const entries = {
419
- 'Package Name': event.packageName,
420
- 'Version ID': event.packageVersionId,
421
- 'Version Number': event.versionNumber,
422
- };
423
- if (event.packageId) {
424
- entries['Package ID'] = event.packageId;
425
- }
426
- if (event.status) {
427
- entries.Status = event.status;
428
- }
429
- if (event.totalNumberOfMetadataFiles !== undefined) {
430
- entries['Metadata Files'] = String(event.totalNumberOfMetadataFiles);
431
- }
432
- if (event.codeCoverage !== null && event.codeCoverage !== undefined) {
433
- const coverageColor = event.hasPassedCodeCoverageCheck ? chalk.green : chalk.yellow;
434
- entries['Code Coverage'] = coverageColor(`${event.codeCoverage}%`);
435
- }
436
- if (event.createdDate) {
437
- entries.Created = event.createdDate;
438
- }
439
- // Display the box
440
- this.logger.log('');
441
- this.logger.log(infoBox('Package Version Details', entries));
442
- this.logger.log('');
443
- }
204
+ this.display.subtaskUpdate(event.packageName, 'build', `created ${event.versionNumber}${elapsedSuffix}`);
444
205
  }
445
206
  handleCreateProgress(event) {
446
- if (!this.isInteractive() || !event.message)
207
+ if (!event.message)
447
208
  return;
448
209
  const elapsed = this.timings.createStart
449
210
  ? formatDuration(Date.now() - this.timings.createStart.getTime())
450
211
  : '';
451
212
  const elapsedSuffix = elapsed ? chalk.dim(` (${elapsed})`) : '';
452
- const task = this.getPackageTask(event.packageName);
453
- if (task) {
454
- const statusText = `Creating: ${event.message}${elapsedSuffix}`;
455
- if (this.listr.hasSubtasks(event.packageName)) {
456
- this.listr.updateSentinelTitle(event.packageName, statusText);
457
- }
458
- else {
459
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${statusText}`);
460
- }
461
- }
462
- else if (!this.isOrchestrating() && this.spinner) {
463
- this.spinner.text = `Creating package version: ${event.message}${elapsedSuffix}`;
464
- }
213
+ this.display.subtaskUpdate(event.packageName, 'build', `creating: ${event.message}${elapsedSuffix}`);
465
214
  }
466
215
  handleCreateStart(event) {
467
- if (!this.isInteractive())
468
- return;
469
216
  this.timings.createStart = event.timestamp;
470
- const task = this.getPackageTask(event.packageName);
471
- if (task) {
472
- const statusText = `Creating version ${event.versionNumber}...`;
473
- if (this.listr.hasSubtasks(event.packageName)) {
474
- this.listr.updateSentinelTitle(event.packageName, statusText);
475
- }
476
- else {
477
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${statusText}`);
478
- }
479
- }
480
- else if (!this.isOrchestrating()) {
481
- this.startSpinner(`Creating package version ${event.packageName}@${event.versionNumber}`);
217
+ this.display.subtaskUpdate(event.packageName, 'build', `creating version: ${event.versionNumber}`);
218
+ }
219
+ handleHookComplete(event) {
220
+ const progress = this.hookProgress.get(event.packageName);
221
+ if (progress) {
222
+ progress.completed.push(event.hookName);
482
223
  }
483
224
  }
225
+ handleHooksComplete(event) {
226
+ if (event.completedCount === 0)
227
+ return;
228
+ const duration = calculateDuration(this.timings.hooksStart, event.timestamp);
229
+ const hookText = event.completedCount === 1 ? 'hook' : 'hooks';
230
+ const phase = `${event.timing}-hooks`;
231
+ this.display.subtaskComplete(event.packageName, phase, `${event.timing}-${event.operation} ${hookText} (${event.completedCount}) ${chalk.gray(`(${duration})`)}`);
232
+ this.hookProgress.delete(event.packageName);
233
+ }
234
+ handleHooksStart(event) {
235
+ this.timings.hooksStart = event.timestamp;
236
+ if (event.hookCount === 0)
237
+ return;
238
+ this.hookProgress.set(event.packageName, { completed: [], total: [...event.hookNames] });
239
+ const phase = `${event.timing}-hooks`;
240
+ const label = event.hookNames.map(n => chalk.dim(n)).join(chalk.dim(', '));
241
+ this.display.subtaskStart(event.packageName, phase);
242
+ this.display.subtaskUpdate(event.packageName, phase, `running ${event.timing}-${event.operation} hooks — ${label}`);
243
+ }
244
+ // ========================================================================
245
+ // Orchestration Event Handlers
246
+ // ========================================================================
484
247
  handleOrchestrationComplete(event) {
485
248
  this.logEvent('orchestration:complete', event);
486
- if (!this.isInteractive())
487
- return;
488
- // Cleanup — Listr rendering is done
489
- this.listr.destroy();
490
- this.logger.log('');
491
249
  const succeeded = event.results.filter(r => r.success && !r.skipped).length;
492
250
  const failed = event.results.filter(r => !r.success && !r.skipped).length;
493
251
  const skipped = event.results.filter(r => r.skipped).length;
494
- const duration = formatDuration(event.totalDuration);
495
- const entries = {
496
- Succeeded: String(succeeded),
497
- 'Total Packages': String(event.results.length),
498
- };
499
- if (failed > 0)
500
- entries.Failed = chalk.red(String(failed));
501
- if (skipped > 0)
502
- entries.Skipped = chalk.yellow(String(skipped));
503
- entries.Duration = duration;
504
- const allSucceeded = failed === 0;
505
- const title = allSucceeded ? 'Build Orchestration Complete' : 'Build Orchestration Complete (with failures)';
506
- if (allSucceeded) {
507
- this.logger.log(successBox(title, entries));
508
- }
509
- else {
510
- this.logger.log(warningBox(title, entries));
511
- }
252
+ this.display.complete({
253
+ duration: formatDuration(event.totalDuration),
254
+ failed,
255
+ packages: event.results.map(r => ({
256
+ error: r.error,
257
+ name: r.packageName,
258
+ skipped: r.skipped,
259
+ success: r.success,
260
+ })),
261
+ skipped,
262
+ succeeded,
263
+ });
512
264
  }
513
265
  handleOrchestrationLevelComplete(event) {
514
266
  this.logEvent('orchestration:level:complete', event);
515
- // No cleanup needed — Listr keeps completed level tasks visible
516
- // and the next level task starts automatically (sequential root).
517
267
  }
518
268
  handleOrchestrationLevelStart(event) {
519
269
  this.logEvent('orchestration:level:start', event);
520
- if (!this.isInteractive())
521
- return;
522
- this.listr.onLevelStart(event);
270
+ this.display.levelStart(event.level, event.packages);
523
271
  }
524
- // ========================================================================
525
- // Orchestration Event Handlers
526
- // ========================================================================
527
272
  handleOrchestrationPackageComplete(event) {
528
273
  this.logEvent('orchestration:package:complete', event);
529
- if (!this.isInteractive())
530
- return;
531
274
  const duration = formatDuration(event.duration);
532
275
  if (event.skipped) {
533
276
  const reason = this.skippedReasons.get(event.packageName);
534
- const reasonSuffix = reason ? ` - ${reason}` : '';
535
- this.listr.updatePackageTitle(event.packageName, `${chalk.yellow('Skipped')} ${chalk.cyan(event.packageName)}${reasonSuffix} ${chalk.gray(`(${duration})`)}`);
536
- this.listr.resolvePackage(event.packageName);
277
+ this.display.packageSkip(event.packageName, reason ?? 'skipped');
537
278
  }
538
279
  else if (event.success) {
539
- // Title may already be set by build:complete — update with duration if not
540
- const task = this.getPackageTask(event.packageName);
541
- if (task && !task.title?.startsWith(chalk.green('Built'))) {
542
- this.listr.updatePackageTitle(event.packageName, `${chalk.green('Built')} ${chalk.cyan(event.packageName)} ${chalk.gray(`(${duration})`)}`);
543
- }
544
- this.listr.resolvePackage(event.packageName);
280
+ const version = this.packageVersions.get(event.packageName);
281
+ const versionSuffix = version ? ` @ ${version}` : '';
282
+ this.display.packageComplete(event.packageName, `${formatDuration(event.duration)}${chalk.dim(versionSuffix)}`);
545
283
  }
546
284
  else {
547
- const errorMsg = event.error || 'Build failed';
548
- this.listr.rejectPackage(event.packageName, errorMsg);
285
+ this.display.packageFail(event.packageName, event.error || 'Build failed');
549
286
  }
550
287
  }
551
288
  handleOrchestrationStart(event) {
552
289
  this.logEvent('orchestration:start', event);
553
- if (!this.isInteractive())
554
- return;
555
290
  const levelText = event.totalLevels === 1 ? 'level' : 'levels';
556
291
  const pkgText = event.totalPackages === 1 ? 'package' : 'packages';
557
- this.logger.log(chalk.bold(`\nBuilding ${chalk.cyan(String(event.totalPackages))} ${pkgText} in ${chalk.cyan(String(event.totalLevels))} ${levelText}`));
292
+ let title = `Building ${chalk.cyan(String(event.totalPackages))} ${pkgText} across ${chalk.cyan(String(event.totalLevels))} ${levelText}`;
558
293
  if (event.includeDependencies) {
559
- this.logger.log(chalk.dim(' Dependencies auto-included'));
294
+ title += chalk.dim('\n Dependencies auto-included');
560
295
  }
561
- this.logger.log('');
562
- this.listr.start(event.totalLevels);
296
+ this.display.start(title, event.packageNames, event.levels);
563
297
  }
564
298
  handleStageComplete(event) {
565
- if (!this.isInteractive())
566
- return;
567
299
  const duration = calculateDuration(this.timings.stageStart, event.timestamp);
568
- const task = this.getPackageTask(event.packageName);
569
- if (task) {
570
- const statusText = `Staged ${event.componentCount} components ${chalk.gray(`(${duration})`)}`;
571
- if (this.listr.hasSubtasks(event.packageName)) {
572
- this.listr.updateSentinelTitle(event.packageName, statusText);
573
- }
574
- else {
575
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${statusText}`);
576
- }
577
- }
578
- else if (!this.isOrchestrating()) {
579
- this.stopSpinner(true, chalk.gray(`Successfully staged ${event.packageName} with ${event.componentCount} component(s) (${duration})`));
580
- }
300
+ this.display.subtaskUpdate(event.packageName, 'build', `staged ${event.componentCount} components ${chalk.gray(`(${duration})`)}`);
581
301
  }
582
302
  handleStageStart(event) {
583
303
  this.timings.stageStart = event.timestamp;
584
- if (!this.isInteractive())
585
- return;
586
- const task = this.getPackageTask(event.packageName);
587
- if (task) {
588
- const statusText = 'Staging...';
589
- if (this.listr.hasSubtasks(event.packageName)) {
590
- this.listr.updateSentinelTitle(event.packageName, statusText);
591
- }
592
- else {
593
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${statusText}`);
594
- }
595
- }
596
- else if (!this.isOrchestrating()) {
597
- this.startSpinner('Staging package');
598
- }
304
+ this.display.subtaskStart(event.packageName, 'staging');
599
305
  }
600
306
  handleTaskComplete(event) {
601
- if (!this.isInteractive())
602
- return;
603
- const task = this.getPackageTask(event.packageName);
604
- if (task) {
605
- const status = event.success ? chalk.green('✓') : chalk.red('✗');
606
- const statusText = `${status} ${event.taskName}`;
607
- if (this.listr.hasSubtasks(event.packageName)) {
608
- this.listr.updateSentinelTitle(event.packageName, statusText);
609
- }
610
- else {
611
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${statusText}`);
612
- }
613
- }
614
- else if (!this.isOrchestrating()) {
615
- if (event.success) {
616
- this.stopSpinner(true, chalk.gray(event.taskName));
617
- }
618
- else {
619
- this.stopSpinner(false, chalk.red(`${event.taskName} failed`));
620
- }
621
- }
307
+ const status = event.success ? sym.success : sym.fail;
308
+ this.display.subtaskUpdate(event.packageName, 'build', `${status} ${event.taskName}`);
622
309
  }
623
- // ========================================================================
624
- // Utility Methods
625
- // ========================================================================
626
- handleTaskStart(event) {
627
- if (!this.isInteractive())
628
- return;
629
- const task = this.getPackageTask(event.packageName);
630
- if (task) {
631
- const statusText = `${event.taskType}: ${event.taskName}`;
632
- if (this.listr.hasSubtasks(event.packageName)) {
633
- this.listr.updateSentinelTitle(event.packageName, statusText);
634
- }
635
- else {
636
- this.listr.updatePackageTitle(event.packageName, `${chalk.cyan(event.packageName)} - ${statusText}`);
637
- }
638
- }
639
- else if (!this.isOrchestrating()) {
640
- this.startSpinner(` ${chalk.cyan(event.taskType)}: ${event.taskName}`);
641
- }
310
+ handleTaskSkipped(event) {
311
+ this.display.subtaskUpdate(event.packageName, 'build', `${sym.skip} ${event.taskName} skipped`);
642
312
  }
643
- /**
644
- * Check if renderer is in interactive mode
645
- */
646
- isInteractive() {
647
- return this.mode === 'interactive';
313
+ handleTaskStart(event) {
314
+ this.display.subtaskUpdate(event.packageName, 'build', `${event.taskType}: ${event.taskName}`);
648
315
  }
649
- /**
650
- * Check if an orchestration level is currently active.
651
- * Used to prevent standalone spinner creation during orchestration —
652
- * all output should flow through Listr sub-tasks instead.
653
- */
654
- isOrchestrating() {
655
- return this.listr.isActive();
316
+ handleValidationQueued(event) {
317
+ this.display.subtaskStart(event.packageName, 'validation');
656
318
  }
319
+ // ========================================================================
320
+ // Utility Methods
321
+ // ========================================================================
657
322
  logEvent(type, data) {
658
323
  this.events.push({ data, timestamp: data.timestamp ?? new Date(), type });
659
324
  }
660
- /**
661
- * Start a spinner with the given text
662
- */
663
- startSpinner(text) {
664
- if (this.spinner) {
665
- this.spinner.stop();
666
- }
667
- this.spinner = ora(text).start();
668
- }
669
- /**
670
- * Stop the active spinner
671
- */
672
- stopSpinner(success, text) {
673
- if (this.spinner) {
674
- if (success) {
675
- this.spinner.succeed(text);
676
- }
677
- else {
678
- this.spinner.fail(text);
679
- }
680
- this.spinner = undefined;
681
- }
682
- }
683
325
  }
684
326
  //# sourceMappingURL=build-progress-renderer.js.map