@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
@@ -0,0 +1,80 @@
1
+ import type { Logger, LogLevel } from '@b64hub/sfpm-core';
2
+ import type EventEmitter from 'node:events';
3
+ import type { Logger as PinoLogger } from 'pino';
4
+ export interface CliLoggerOptions {
5
+ /** Log level threshold (default: 'warn') */
6
+ level?: LogLevel;
7
+ /** Use pretty-printed output instead of JSON (default: true) */
8
+ pretty?: boolean;
9
+ }
10
+ /**
11
+ * Singleton factory for the CLI pino logger.
12
+ *
13
+ * Creates a pino instance that writes to stderr, leaving stdout
14
+ * clean for command output and --json results. Wraps the pino
15
+ * instance in the core Logger interface so it can be injected
16
+ * into core services via DI.
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // In SfpmCommand.run():
21
+ * const logger = CliLoggerFactory.create({ level: 'debug', pretty: true });
22
+ *
23
+ * // Child logger with package context:
24
+ * const pkgLogger = CliLoggerFactory.child(logger, { package: '@b64/my-pkg' });
25
+ * ```
26
+ */
27
+ export interface ForRunOptions {
28
+ /** Command name/slug embedded in the run ID and log filename. */
29
+ command: string;
30
+ /** Minimum log level for the stderr stream in non-interactive mode (default: 'warn'). */
31
+ level?: LogLevel;
32
+ /** When provided (interactive path), logs are bridged to the ink UI instead of stderr. */
33
+ uiBus?: EventEmitter;
34
+ }
35
+ export declare class CliLoggerFactory {
36
+ private static instance;
37
+ /**
38
+ * Create a child Logger with bound context fields.
39
+ * Every message logged through the child includes the context.
40
+ */
41
+ static child(parent: CliLogger, context: Record<string, string>): CliLogger;
42
+ /**
43
+ * Create a Logger backed by pino writing to stderr.
44
+ * Subsequent calls return a wrapper around the same pino instance.
45
+ */
46
+ static create(options?: CliLoggerOptions): CliLogger;
47
+ /**
48
+ * Create a run-scoped multistream logger that always writes full-fidelity
49
+ * JSON to `.sfpm/logs/<runId>.log` at the project root, and additionally:
50
+ * - interactive path: routes logs to the ink UI via `log:append` events
51
+ * - non-interactive path: mirrors logs to stderr at the configured level
52
+ *
53
+ * The project root is resolved via {@link resolveCliProjectDir} —
54
+ * `SFPM_PROJECT_DIR` if set, otherwise walking up from CWD looking for
55
+ * `sfpm.config.{ts,js,mjs}`.
56
+ *
57
+ * @returns the logger and the absolute path to the log file.
58
+ */
59
+ static forRun(options: ForRunOptions): {
60
+ logger: CliLogger;
61
+ logPath: string;
62
+ };
63
+ /** Reset the singleton (for testing). */
64
+ static reset(): void;
65
+ }
66
+ /**
67
+ * Logger implementation backed by pino. Conforms to the core Logger
68
+ * interface so it can be injected into any core service.
69
+ */
70
+ export declare class CliLogger implements Logger {
71
+ /** @internal */
72
+ readonly pino: PinoLogger;
73
+ constructor(pinoInstance: PinoLogger);
74
+ child(bindings: Record<string, string>): CliLogger;
75
+ debug(message: string): void;
76
+ error(message: string): void;
77
+ info(message: string): void;
78
+ trace(message: string): void;
79
+ warn(message: string): void;
80
+ }
package/dist/logger.js ADDED
@@ -0,0 +1,143 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import { mkdirSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import pino from 'pino';
5
+ import { createPinoBridge } from './ui/pino-bridge.js';
6
+ import { resolveCliProjectDir } from './utils/project-dir.js';
7
+ export class CliLoggerFactory {
8
+ static instance;
9
+ /**
10
+ * Create a child Logger with bound context fields.
11
+ * Every message logged through the child includes the context.
12
+ */
13
+ static child(parent, context) {
14
+ return new CliLogger(parent.pino.child(context));
15
+ }
16
+ /**
17
+ * Create a Logger backed by pino writing to stderr.
18
+ * Subsequent calls return a wrapper around the same pino instance.
19
+ */
20
+ static create(options) {
21
+ const level = mapLevel(options?.level ?? 'warn');
22
+ const pretty = options?.pretty ?? true;
23
+ if (CliLoggerFactory.instance) {
24
+ CliLoggerFactory.instance.level = level;
25
+ }
26
+ else {
27
+ CliLoggerFactory.instance = createPinoInstance(level, pretty);
28
+ }
29
+ return new CliLogger(CliLoggerFactory.instance);
30
+ }
31
+ /**
32
+ * Create a run-scoped multistream logger that always writes full-fidelity
33
+ * JSON to `.sfpm/logs/<runId>.log` at the project root, and additionally:
34
+ * - interactive path: routes logs to the ink UI via `log:append` events
35
+ * - non-interactive path: mirrors logs to stderr at the configured level
36
+ *
37
+ * The project root is resolved via {@link resolveCliProjectDir} —
38
+ * `SFPM_PROJECT_DIR` if set, otherwise walking up from CWD looking for
39
+ * `sfpm.config.{ts,js,mjs}`.
40
+ *
41
+ * @returns the logger and the absolute path to the log file.
42
+ */
43
+ static forRun(options) {
44
+ const projectRoot = resolveCliProjectDir();
45
+ const logDir = path.join(projectRoot, '.sfpm', 'logs');
46
+ mkdirSync(logDir, { recursive: true });
47
+ const slug = options.command.replaceAll(/[:/\\]/g, '-');
48
+ const logPath = path.join(logDir, `${generateRunId(slug)}.log`);
49
+ const fileStream = pino.destination({ dest: logPath, sync: false });
50
+ const streams = [
51
+ { level: 'debug', stream: fileStream },
52
+ ];
53
+ if (options.uiBus) {
54
+ // Interactive: route to ink UI; stderr is owned by ink so we skip it.
55
+ streams.unshift({ stream: createPinoBridge(options.uiBus) });
56
+ }
57
+ else {
58
+ // Non-interactive: mirror to stderr at the configured log level.
59
+ streams.unshift({
60
+ level: mapLevel(options.level ?? 'warn'),
61
+ stream: pino.destination({ dest: 2, sync: false }),
62
+ });
63
+ }
64
+ return {
65
+ logger: new CliLogger(pino({ level: 'debug' }, pino.multistream(streams))),
66
+ logPath,
67
+ };
68
+ }
69
+ /** Reset the singleton (for testing). */
70
+ static reset() {
71
+ CliLoggerFactory.instance = undefined;
72
+ }
73
+ }
74
+ // ============================================================================
75
+ // CLI Logger Implementation
76
+ // ============================================================================
77
+ /**
78
+ * Logger implementation backed by pino. Conforms to the core Logger
79
+ * interface so it can be injected into any core service.
80
+ */
81
+ export class CliLogger {
82
+ /** @internal */
83
+ pino;
84
+ constructor(pinoInstance) {
85
+ this.pino = pinoInstance;
86
+ }
87
+ child(bindings) {
88
+ return new CliLogger(this.pino.child(bindings));
89
+ }
90
+ debug(message) {
91
+ this.pino.debug(message);
92
+ }
93
+ error(message) {
94
+ this.pino.error(message);
95
+ }
96
+ info(message) {
97
+ this.pino.info(message);
98
+ }
99
+ trace(message) {
100
+ this.pino.trace(message);
101
+ }
102
+ warn(message) {
103
+ this.pino.warn(message);
104
+ }
105
+ }
106
+ // ============================================================================
107
+ // Internal Helpers
108
+ // ============================================================================
109
+ /** Map SFPM LogLevel names to pino level names. */
110
+ function mapLevel(level) {
111
+ return level;
112
+ }
113
+ /**
114
+ * Generate a unique, chronologically-sortable run ID:
115
+ * {YYYYMMDDTHHMMSS}-{command}-{8hex}
116
+ *
117
+ * The timestamp prefix ensures lexicographic sort == chronological sort.
118
+ * The 4-byte hex suffix ensures uniqueness for parallel runs (e.g. turborepo).
119
+ */
120
+ function generateRunId(command) {
121
+ const d = new Date();
122
+ // eslint-disable-next-line unicorn/consistent-function-scoping -- simple function used once
123
+ const p = (n) => String(n).padStart(2, '0');
124
+ const ts = `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}T${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`;
125
+ return `${ts}-${command}-${randomBytes(4).toString('hex')}`;
126
+ }
127
+ function createPinoInstance(level, pretty) {
128
+ if (pretty) {
129
+ return pino({
130
+ level,
131
+ transport: {
132
+ options: {
133
+ colorize: true,
134
+ ignore: 'pid,hostname',
135
+ translateTime: 'HH:MM:ss',
136
+ },
137
+ target: 'pino-pretty',
138
+ },
139
+ }, pino.destination({ dest: 2, sync: false }));
140
+ }
141
+ return pino({ level }, pino.destination({ dest: 2, sync: false }));
142
+ }
143
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAuC5D,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAC,QAAQ,CAAyB;IAEhD;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAiB,EAAE,OAA+B;QAC7D,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,OAA0B;QACtC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,EAAE,KAAK,IAAI,MAAM,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC;QAEvC,IAAI,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YAC9B,gBAAgB,CAAC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;QAC1C,CAAC;aAAM,CAAC;YACN,gBAAgB,CAAC,QAAQ,GAAG,k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:events';
1
2
  import { Command } from '@oclif/core';
3
+ import type { OutputMode } from './ui/renderer-utils.js';
4
+ import { CliLogger } from './logger.js';
2
5
  /**
3
- * A base class that provides common funtionality for sfp commands
6
+ * Standard JSON envelope emitted by every command in `--json` mode.
7
+ */
8
+ export interface JsonEnvelope<T = unknown> {
9
+ command: string;
10
+ duration: number;
11
+ error?: {
12
+ code?: string;
13
+ message: string;
14
+ };
15
+ result?: T;
16
+ status: 'error' | 'success';
17
+ }
18
+ /**
19
+ * A base class that provides common functionality for sfpm commands.
4
20
  */
5
21
  export default abstract class SfpmCommand extends Command {
22
+ static baseFlags: {
23
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
24
+ 'log-level': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
25
+ plain: import("@oclif/core/interfaces").BooleanFlag<boolean>;
26
+ };
27
+ /** Resolved output mode for this execution. */
28
+ protected outputMode: OutputMode;
29
+ /** Pino-backed logger for diagnostic output (writes to stderr). */
30
+ protected sfpmLogger: CliLogger;
31
+ /**
32
+ * Create a run-scoped multistream logger for the orchestrator.
33
+ * Always writes full-fidelity JSON to `.sfpm/logs/<runId>.log`.
34
+ * Also routes to the ink UI when `inkBus` is provided, or to stderr otherwise.
35
+ * Returns the logger and the log file path (for display on failure).
36
+ */
37
+ protected createRunLogger(inkBus?: EventEmitter): {
38
+ logger: CliLogger;
39
+ logPath: string;
40
+ };
6
41
  /**
7
- * Command run code goes here
42
+ * Command implementation. Return a structured result for the JSON envelope,
43
+ * or void for commands that don't produce a meaningful result.
8
44
  */
9
45
  abstract execute(): Promise<any>;
10
46
  /**
11
- * Entry point of all commands
47
+ * Entry point for all commands. Resolves output mode, configures logging,
48
+ * executes the command, and handles the JSON envelope.
12
49
  */
13
50
  run(): Promise<any>;
14
51
  private logHeader;
@@ -1,33 +1,127 @@
1
- import { Command } from '@oclif/core';
2
- import boxen from 'boxen';
1
+ import { Command, Flags } from '@oclif/core';
3
2
  import chalk from 'chalk';
3
+ import gradient from 'gradient-string';
4
+ import { CliLoggerFactory } from './logger.js';
5
+ import { suppressStderr } from './utils/suppress.js';
6
+ const LOG_LEVELS = ['trace', 'debug', 'info', 'warn', 'error'];
4
7
  /**
5
- * A base class that provides common funtionality for sfp commands
8
+ * Resolves the output mode from explicit flags and environment signals.
9
+ *
10
+ * Precedence:
11
+ * 1. `--json` → json
12
+ * 2. `--plain` or `--turbo` → plain
13
+ * 3. CI=true / TERM=dumb / !isTTY → plain (auto-detect)
14
+ * 4. Otherwise → interactive
15
+ */
16
+ function resolveOutputMode(flags) {
17
+ if (flags.json)
18
+ return 'json';
19
+ if (flags.plain || flags.turbo)
20
+ return 'plain';
21
+ if (process.env.CI === 'true')
22
+ return 'plain';
23
+ if (process.env.TERM === 'dumb')
24
+ return 'plain';
25
+ if (!process.stdout.isTTY)
26
+ return 'plain';
27
+ // Any log level below error writes to stderr — interactive spinners and
28
+ // cursor movement make that output unreadable, so fall back to plain.
29
+ if (flags['log-level'] && flags['log-level'] !== 'error')
30
+ return 'plain';
31
+ return 'interactive';
32
+ }
33
+ /**
34
+ * A base class that provides common functionality for sfpm commands.
6
35
  */
7
36
  export default class SfpmCommand extends Command {
37
+ static baseFlags = {
38
+ json: Flags.boolean({
39
+ description: 'output result as JSON',
40
+ exclusive: ['plain'],
41
+ }),
42
+ 'log-level': Flags.string({
43
+ default: 'error',
44
+ description: 'diagnostic log level',
45
+ env: 'SFPM_LOG_LEVEL',
46
+ options: [...LOG_LEVELS],
47
+ }),
48
+ plain: Flags.boolean({
49
+ description: 'non-interactive output (no spinners or cursor movement)',
50
+ exclusive: ['json'],
51
+ }),
52
+ };
53
+ /** Resolved output mode for this execution. */
54
+ outputMode;
55
+ /** Pino-backed logger for diagnostic output (writes to stderr). */
56
+ sfpmLogger;
8
57
  /**
9
- * Entry point of all commands
58
+ * Create a run-scoped multistream logger for the orchestrator.
59
+ * Always writes full-fidelity JSON to `.sfpm/logs/<runId>.log`.
60
+ * Also routes to the ink UI when `inkBus` is provided, or to stderr otherwise.
61
+ * Returns the logger and the log file path (for display on failure).
62
+ */
63
+ createRunLogger(inkBus) {
64
+ return CliLoggerFactory.forRun({
65
+ command: this.id ?? 'sfpm',
66
+ level: this.sfpmLogger.pino.level,
67
+ uiBus: inkBus,
68
+ });
69
+ }
70
+ /**
71
+ * Entry point for all commands. Resolves output mode, configures logging,
72
+ * executes the command, and handles the JSON envelope.
10
73
  */
11
74
  async run() {
75
+ const startTime = Date.now();
12
76
  const { flags } = await this.parse(this.constructor);
13
- if (!this.jsonEnabled()) {
77
+ this.outputMode = resolveOutputMode(flags);
78
+ const logLevel = (flags['log-level'] ?? 'warn');
79
+ this.sfpmLogger = CliLoggerFactory.create({
80
+ level: logLevel,
81
+ pretty: this.outputMode !== 'json',
82
+ });
83
+ if (this.outputMode !== 'json') {
14
84
  this.logHeader();
15
85
  }
16
- return this.execute();
86
+ try {
87
+ const cap = this.outputMode === 'interactive' ? suppressStderr() : null;
88
+ const result = await this.execute().finally(() => {
89
+ const captured = cap?.release() ?? '';
90
+ if (captured)
91
+ process.stderr.write(captured);
92
+ });
93
+ if (this.outputMode === 'json') {
94
+ const envelope = {
95
+ command: this.id ?? 'unknown',
96
+ duration: Date.now() - startTime,
97
+ status: 'success',
98
+ };
99
+ if (result !== undefined) {
100
+ envelope.result = result;
101
+ }
102
+ this.log(JSON.stringify(envelope));
103
+ }
104
+ return result;
105
+ }
106
+ catch (error) {
107
+ if (this.outputMode === 'json') {
108
+ const err = error instanceof Error ? error : new Error(String(error));
109
+ const envelope = {
110
+ command: this.id ?? 'unknown',
111
+ duration: Date.now() - startTime,
112
+ error: { message: err.message },
113
+ status: 'error',
114
+ };
115
+ this.log(JSON.stringify(envelope));
116
+ }
117
+ throw error;
118
+ }
17
119
  }
18
120
  logHeader() {
19
- const theme = this.config.theme;
20
- const header = boxen(chalk.hex(theme.bin).bold('sfpm') +
21
- chalk.gray(' • by ') +
22
- chalk.hex(theme.bin)('b64') +
23
- chalk.gray(' • ') +
24
- chalk.gray(`v${this.config.version} • ${this.config.pjson.release}`), {
25
- padding: { left: 2, right: 2, top: 0, bottom: 0 },
26
- margin: { left: 0, right: 0, top: 0, bottom: 1 },
27
- borderStyle: 'round',
28
- borderColor: theme.bin,
29
- dimBorder: false,
30
- });
121
+ const sfpmGradient = gradient(['#3d7fff', '#ff3366'], { interpolation: 'hsv' });
122
+ const header = sfpmGradient('sfpm')
123
+ + chalk.gray(' • ')
124
+ + chalk.gray(`${this.config.version}`);
31
125
  this.log(header);
32
126
  }
33
127
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sfpm-command.js","sourceRoot":"","sources":["../src/sfpm-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,OAAO,OAAgB,WAAY,SAAQ,OAAO;IAOrD;;OAEG;IACH,KAAK,CAAC,GAAG;QACL,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAkB,CAAC,CAAC;QAE5D,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACtB,IAAI,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAEO,SAAS;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAM,CAAC;QAEjC,MAAM,MAAM,GAAG,KAAK,CAChB,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,GAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;YACpB,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,GAAI,CAAC,CAAC,KAAK,CAAC;YAC5B,KAAK,C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ED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrC,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,IAAI,CAAC,UAAU,KAAK,MAAM,EAAE,CAAC;gBAC/B,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBACtE,MAAM,QAAQ,GAAiB;oBAC7B,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,SAAS;oBAC7B,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;oBAChC,KAAK,EAAE,EAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAC;oBAC7B,MAAM,EAAE,OAAO;iBAChB,CAAC;gBAEF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrC,CAAC;YAED,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAEO,SAAS;QACf,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,EAAC,aAAa,EAAE,KAAK,EAAC,CAAC,CAAC;QAE9E,MAAM,MAAM,GACR,YAAY,CAAC,MAAM,CAAC;cAClB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;cACjB,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { type PackageCreateConfig } from '@b64hub/sfpm-core';
2
+ /**
3
+ * Bootstrap tiers determine which packages are installed into the target org.
4
+ *
5
+ * - `Core` — sfpm-artifact only (custom setting for artifact tracking)
6
+ * - `Pool` — Core + sfpm-orgs (scratch org & sandbox pooling, org-dependent)
7
+ * - `Full` — Pool + sfpm-ui (artifact history object + UI components)
8
+ */
9
+ export declare enum BootstrapTier {
10
+ Core = "core",
11
+ Full = "full",
12
+ Pool = "pool"
13
+ }
14
+ /** Static definition of the three SFPM bootstrap packages and their relationships. */
15
+ export interface BootstrapPackageConfig extends PackageCreateConfig {
16
+ /** Package names this package depends on (within the bootstrap set). */
17
+ dependencies: string[];
18
+ }
19
+ /** Per-package action determined by the idempotent status check. */
20
+ export type BootstrapAction = 'build' | 'install' | 'promote' | 'skip';
21
+ /** Per-package outcome within a bootstrap run. */
22
+ export interface BootstrapPackageResult {
23
+ action: BootstrapAction;
24
+ error?: string;
25
+ packageName: string;
26
+ promoted?: boolean;
27
+ skipped: boolean;
28
+ success: boolean;
29
+ version?: string;
30
+ }
31
+ /** Overall result of the bootstrap operation. */
32
+ export interface BootstrapResult {
33
+ /** Per-package build+install outcomes. */
34
+ packages: BootstrapPackageResult[];
35
+ /** Whether all packages were successfully bootstrapped. */
36
+ success: boolean;
37
+ /** The target org alias/username. */
38
+ targetOrg: string;
39
+ /** Selected tier. */
40
+ tier: BootstrapTier;
41
+ }
42
+ /** The canonical package configs for the bootstrap repo. */
43
+ export declare const BOOTSTRAP_PACKAGES: BootstrapPackageConfig[];
44
+ /** Input state for the per-package decision function. */
45
+ export interface PackageResolveState {
46
+ force: boolean;
47
+ hasPackage: boolean;
48
+ hasReleasedVersions: boolean;
49
+ hasUnreleasedVersions: boolean;
50
+ installedVersion?: string;
51
+ latestVersion?: string;
52
+ }
53
+ /**
54
+ * Pure decision function: given DevHub + target org state, determine the action.
55
+ *
56
+ * Decision table:
57
+ * --force → build
58
+ * No Package2 in DevHub → build
59
+ * No versions at all → build
60
+ * Unreleased version only → promote
61
+ * Released, not installed → install
62
+ * Released, older installed → install
63
+ * Released, same version → skip
64
+ */
65
+ export declare function resolveAction(state: PackageResolveState): BootstrapAction;
66
+ /** Resolve which packages to include for a given tier. */
67
+ export declare function getPackagesForTier(tier: BootstrapTier): BootstrapPackageConfig[];
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Bootstrap tiers determine which packages are installed into the target org.
3
+ *
4
+ * - `Core` — sfpm-artifact only (custom setting for artifact tracking)
5
+ * - `Pool` — Core + sfpm-orgs (scratch org & sandbox pooling, org-dependent)
6
+ * - `Full` — Pool + sfpm-ui (artifact history object + UI components)
7
+ */
8
+ export var BootstrapTier;
9
+ (function (BootstrapTier) {
10
+ BootstrapTier["Core"] = "core";
11
+ BootstrapTier["Full"] = "full";
12
+ BootstrapTier["Pool"] = "pool";
13
+ })(BootstrapTier || (BootstrapTier = {}));
14
+ /** The canonical package configs for the bootstrap repo. */
15
+ export const BOOTSTRAP_PACKAGES = [
16
+ {
17
+ dependencies: [],
18
+ description: 'Core custom setting for artifact tracking (SfpmArtifact__c)',
19
+ isOrgDependent: false,
20
+ name: '@b64hub/sfpm-artifact',
21
+ path: 'packages/sfpm-artifact',
22
+ },
23
+ {
24
+ dependencies: ['@b64hub/sfpm-artifact'],
25
+ description: 'Scratch org & sandbox pool management (org-dependent)',
26
+ isOrgDependent: true,
27
+ name: '@b64hub/sfpm-orgs',
28
+ path: 'packages/sfpm-orgs',
29
+ },
30
+ {
31
+ dependencies: ['@b64hub/sfpm-artifact'],
32
+ description: 'Artifact history object & UI components',
33
+ isOrgDependent: false,
34
+ name: '@b64hub/sfpm-ui',
35
+ path: 'packages/sfpm-ui',
36
+ },
37
+ ];
38
+ /**
39
+ * Pure decision function: given DevHub + target org state, determine the action.
40
+ *
41
+ * Decision table:
42
+ * --force → build
43
+ * No Package2 in DevHub → build
44
+ * No versions at all → build
45
+ * Unreleased version only → promote
46
+ * Released, not installed → install
47
+ * Released, older installed → install
48
+ * Released, same version → skip
49
+ */
50
+ export function resolveAction(state) {
51
+ if (state.force)
52
+ return 'build';
53
+ if (!state.hasPackage)
54
+ return 'build';
55
+ if (!state.hasReleasedVersions) {
56
+ return state.hasUnreleasedVersions ? 'promote' : 'build';
57
+ }
58
+ if (!state.installedVersion)
59
+ return 'install';
60
+ if (state.installedVersion === state.latestVersion)
61
+ return 'skip';
62
+ return 'install';
63
+ }
64
+ /** Resolve which packages to include for a given tier. */
65
+ export function getPackagesForTier(tier) {
66
+ switch (tier) {
67
+ case BootstrapTier.Core: {
68
+ return BOOTSTRAP_PACKAGES.filter(p => p.name === '@b64hub/sfpm-artifact');
69
+ }
70
+ case BootstrapTier.Full: {
71
+ return [...BOOTSTRAP_PACKAGES];
72
+ }
73
+ case BootstrapTier.Pool: {
74
+ return BOOTSTRAP_PACKAGES.filter(p => p.name !== '@b64hub/sfpm-ui');
75
+ }
76
+ }
77
+ }
78
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/types/bootstrap.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,8BAAa,CAAA;IACb,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAkCD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAA6B;IAC1D;QACE,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,6DAA6D;QAC1E,cAAc,EAAE,KAAK;QACrB,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,wBAAwB;KAC/B;IACD;QACE,YAAY,EAAE,CAAC,uBAAuB,CAAC;QACvC,WAAW,EAAE,uDAAuD;QACpE,cAAc,EAAE,IAAI;QACpB,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,oBAAoB;KAC3B;IACD;QACE,YAAY,EAAE,CAAC,uBAAuB,CAAC;QACvC,WAAW,EAAE,yCAAyC;QACtD,cAAc,EAAE,KAAK;QACrB,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,kBAAkB;KACzB;CACF,CAAA;AAYD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,KAA0B;IACtD,IAAI,KAAK,CAAC,KAAK;QAAE,OAAO,OAAO,CAAA;IAC/B,IAAI,CAAC,KAAK,CAAC,UAAU;QAAE,OAAO,OAAO,CAAA;IACrC,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAA;IAC1D,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,gBAAgB;QAAE,OAAO,SAAS,CAAA;IAC7C,IAAI,KAAK,CAAC,gBAAgB,KAAK,KAAK,CAAC,aAAa;QAAE,OAAO,MAAM,CAAA;IACjE,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,kBAAkB,CAAC,IAAmB;IACpD,QAAQ,IAAI,EAAE,CAAC;QACf,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;YACxB,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,uBAAuB,CAAC,CAAA;QAC3E,CAAC;QAED,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;YACxB,OAAO,CAAC,GAAG,kBAAkB,CAAC,CAAA;QAChC,CAAC;QAED,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;YACxB,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,iBAAiB,CAAC,CAAA;QACrE,CAAC;IACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type EventEmitter from 'node:events';
2
+ export interface ConnectedOrg {
3
+ alias: string;
4
+ username?: string;
5
+ }
6
+ export declare function App({ bus, logPath, onAdvance, org }: {
7
+ bus: EventEmitter;
8
+ logPath?: string;
9
+ onAdvance?: (key: string) => void;
10
+ org?: ConnectedOrg;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text, useApp, useInput } from 'ink';
3
+ import { useEffect, useReducer } from 'react';
4
+ import { useEventBusWiring } from '../hooks/use-event-bus-wiring.js';
5
+ import { initialState, reducer } from '../state/reducer.js';
6
+ import { countPackages } from '../state/selectors.js';
7
+ import { Footer } from '../components/base/Footer.js';
8
+ import { OrgBadge } from '../components/base/OrgBadge.js';
9
+ import { OrchestrationView } from '../components/OrchestrationView.js';
10
+ import { PackageRow } from '../components/PackageRow.js';
11
+ const META_COLS = [
12
+ { key: 'components', width: 5, label: 'cmp' },
13
+ { key: 'version', width: 7, label: 'ver' },
14
+ { key: 'hash', width: 8, label: 'hash' },
15
+ ];
16
+ export function App({ bus, logPath, onAdvance, org }) {
17
+ const [state, dispatch] = useReducer(reducer, undefined, initialState);
18
+ const { exit } = useApp();
19
+ useEventBusWiring(bus, dispatch);
20
+ useInput((input, key) => { onAdvance?.(input || (key.escape ? '\x1b' : '')); }, { isActive: Boolean(onAdvance) });
21
+ useEffect(() => {
22
+ if (state.phase === 'done' || state.phase === 'failed') {
23
+ const t = setTimeout(exit, 80);
24
+ return () => clearTimeout(t);
25
+ }
26
+ }, [state.phase, exit]);
27
+ const counts = countPackages(state.levels);
28
+ return (_jsxs(Box, { flexDirection: "column", children: [org && _jsx(OrgBadge, { alias: org.alias, username: org.username }), state.levels.length > 0 && (_jsx(OrchestrationView, { levels: state.levels, validation: state.validation, getColumns: node => _jsx(PackageRow.MetaCols, { cols: META_COLS, meta: node.meta }), headerColumns: _jsx(PackageRow.MetaCols, { cols: META_COLS, header: true }) })), _jsx(Footer, { counts: counts, progressBar: state.phase === 'running', activeSlot: _jsx(Footer.Active, { counts: counts }), resultsSlot: _jsx(Footer.Results, { counts: counts }), timeSlot: state.startedAt !== undefined
29
+ ? _jsx(Footer.Elapsed, { startedAt: state.startedAt, dimColor: true })
30
+ : undefined }), state.phase === 'failed' && logPath && (_jsxs(Text, { dimColor: true, children: ["Full logs: ", logPath] }))] }));
31
+ }
32
+ //# sourceMappingURL=BuildApp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuildApp.js","sourceRoot":"","sources":["../../../src/ui/apps/BuildApp.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,KAAK,CAAC;AAChD,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAC,YAAY,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAGvD,MAAM,SAAS,GAAkB;IAC/B,EAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAAG,KAAK,EAAE,KAAK,EAAC;IAC5C,EAAC,GAAG,EAAE,SAAS,EAAK,KAAK,EAAE,CAAC,EAAG,KAAK,EAAE,KAAK,EAAC;IAC5C,EAAC,GAAG,EAAE,MAAM,EAAQ,KAAK,EAAE,CAAC,EAAG,KAAK,EAAE,MAAM,EAAC;CAC9C,CAAC;AAOF,MAAM,UAAU,GAAG,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAA+F;IAC9I,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,Y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