@pulumix/cli 0.1.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.
- package/dist/commands/dev.d.ts +6 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +124 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/graph.d.ts +6 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/commands/graph.js +118 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/commands/inspect.d.ts +6 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +173 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/list.d.ts +7 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +108 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/validate.d.ts +6 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +118 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +247 -0
- package/dist/index.js.map +1 -0
- package/dist/ui/components/grouped-output.d.ts +33 -0
- package/dist/ui/components/grouped-output.d.ts.map +1 -0
- package/dist/ui/components/grouped-output.js +130 -0
- package/dist/ui/components/grouped-output.js.map +1 -0
- package/dist/ui/components/progress-bar.d.ts +21 -0
- package/dist/ui/components/progress-bar.d.ts.map +1 -0
- package/dist/ui/components/progress-bar.js +65 -0
- package/dist/ui/components/progress-bar.js.map +1 -0
- package/dist/ui/formatters/config-formatter.d.ts +3 -0
- package/dist/ui/formatters/config-formatter.d.ts.map +1 -0
- package/dist/ui/formatters/config-formatter.js +11 -0
- package/dist/ui/formatters/config-formatter.js.map +1 -0
- package/dist/ui/formatters/index.d.ts +4 -0
- package/dist/ui/formatters/index.d.ts.map +1 -0
- package/dist/ui/formatters/index.js +20 -0
- package/dist/ui/formatters/index.js.map +1 -0
- package/dist/ui/formatters/resource-formatter.d.ts +7 -0
- package/dist/ui/formatters/resource-formatter.d.ts.map +1 -0
- package/dist/ui/formatters/resource-formatter.js +65 -0
- package/dist/ui/formatters/resource-formatter.js.map +1 -0
- package/dist/ui/formatters/summary-formatter.d.ts +3 -0
- package/dist/ui/formatters/summary-formatter.d.ts.map +1 -0
- package/dist/ui/formatters/summary-formatter.js +90 -0
- package/dist/ui/formatters/summary-formatter.js.map +1 -0
- package/dist/ui/formatters/types.d.ts +26 -0
- package/dist/ui/formatters/types.d.ts.map +1 -0
- package/dist/ui/formatters/types.js +3 -0
- package/dist/ui/formatters/types.js.map +1 -0
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +20 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/logger/index.d.ts +2 -0
- package/dist/ui/logger/index.d.ts.map +1 -0
- package/dist/ui/logger/index.js +34 -0
- package/dist/ui/logger/index.js.map +1 -0
- package/dist/ui/logger/line-formatter.d.ts +14 -0
- package/dist/ui/logger/line-formatter.d.ts.map +1 -0
- package/dist/ui/logger/line-formatter.js +218 -0
- package/dist/ui/logger/line-formatter.js.map +1 -0
- package/dist/ui/logger/name-formatter.d.ts +3 -0
- package/dist/ui/logger/name-formatter.d.ts.map +1 -0
- package/dist/ui/logger/name-formatter.js +20 -0
- package/dist/ui/logger/name-formatter.js.map +1 -0
- package/dist/ui/logger/simple-line-formatter.d.ts +14 -0
- package/dist/ui/logger/simple-line-formatter.d.ts.map +1 -0
- package/dist/ui/logger/simple-line-formatter.js +210 -0
- package/dist/ui/logger/simple-line-formatter.js.map +1 -0
- package/dist/ui/logger/simple-logger.d.ts +3 -0
- package/dist/ui/logger/simple-logger.d.ts.map +1 -0
- package/dist/ui/logger/simple-logger.js +39 -0
- package/dist/ui/logger/simple-logger.js.map +1 -0
- package/dist/ui/logger/simple-task-formatter.d.ts +47 -0
- package/dist/ui/logger/simple-task-formatter.d.ts.map +1 -0
- package/dist/ui/logger/simple-task-formatter.js +187 -0
- package/dist/ui/logger/simple-task-formatter.js.map +1 -0
- package/dist/ui/logger/task-formatter.d.ts +47 -0
- package/dist/ui/logger/task-formatter.d.ts.map +1 -0
- package/dist/ui/logger/task-formatter.js +187 -0
- package/dist/ui/logger/task-formatter.js.map +1 -0
- package/dist/ui/shell-listr2.d.ts +36 -0
- package/dist/ui/shell-listr2.d.ts.map +1 -0
- package/dist/ui/shell-listr2.js +200 -0
- package/dist/ui/shell-listr2.js.map +1 -0
- package/dist/ui/shell-ora.d.ts +39 -0
- package/dist/ui/shell-ora.d.ts.map +1 -0
- package/dist/ui/shell-ora.js +295 -0
- package/dist/ui/shell-ora.js.map +1 -0
- package/dist/ui/shell.d.ts +42 -0
- package/dist/ui/shell.d.ts.map +1 -0
- package/dist/ui/shell.js +312 -0
- package/dist/ui/shell.js.map +1 -0
- package/dist/ui/streams/event-bus.d.ts +36 -0
- package/dist/ui/streams/event-bus.d.ts.map +1 -0
- package/dist/ui/streams/event-bus.js +78 -0
- package/dist/ui/streams/event-bus.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createUIShell = exports.UIShell = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const listr2_1 = require("listr2");
|
|
9
|
+
const formatters_1 = require("./formatters");
|
|
10
|
+
const SECTION_NAMES = {
|
|
11
|
+
'Discovery': 'Discovery',
|
|
12
|
+
'Configuration': 'Configuration',
|
|
13
|
+
'DependencyGraph': 'Dependencies',
|
|
14
|
+
'Bootstrap': 'Bootstrap',
|
|
15
|
+
'Secrets': 'Secrets',
|
|
16
|
+
'Build': 'Build',
|
|
17
|
+
'Deploy': 'Deploy',
|
|
18
|
+
'Outputs': 'Outputs'
|
|
19
|
+
};
|
|
20
|
+
class UIShell {
|
|
21
|
+
eventBus;
|
|
22
|
+
config;
|
|
23
|
+
unsubscribers = [];
|
|
24
|
+
phaseStartTimes = new Map();
|
|
25
|
+
deploymentConfig;
|
|
26
|
+
phaseMetrics = new Map();
|
|
27
|
+
listrTasks = new Map();
|
|
28
|
+
currentListr = null;
|
|
29
|
+
activePhase = null;
|
|
30
|
+
resourceCounts = { created: 0, updated: 0, deleted: 0, same: 0 };
|
|
31
|
+
constructor(eventBus, config) {
|
|
32
|
+
this.eventBus = eventBus;
|
|
33
|
+
this.config = {
|
|
34
|
+
verbose: false,
|
|
35
|
+
colors: true,
|
|
36
|
+
interactive: process.stdout.isTTY,
|
|
37
|
+
...config
|
|
38
|
+
};
|
|
39
|
+
this.setupEventListeners();
|
|
40
|
+
}
|
|
41
|
+
formatDuration(ms) {
|
|
42
|
+
const seconds = ms / 1000;
|
|
43
|
+
if (seconds < 60) {
|
|
44
|
+
return `${seconds.toFixed(1)}s`;
|
|
45
|
+
}
|
|
46
|
+
const minutes = Math.floor(seconds / 60);
|
|
47
|
+
const remainingSeconds = seconds % 60;
|
|
48
|
+
return `${minutes}m ${remainingSeconds.toFixed(0)}s`;
|
|
49
|
+
}
|
|
50
|
+
printSection(phase) {
|
|
51
|
+
const name = SECTION_NAMES[phase] || phase;
|
|
52
|
+
console.log('');
|
|
53
|
+
console.log(chalk_1.default.bold(name));
|
|
54
|
+
}
|
|
55
|
+
printItem(icon, text, suffix) {
|
|
56
|
+
const line = suffix
|
|
57
|
+
? ` ${icon} ${text} ${chalk_1.default.dim(suffix)}`
|
|
58
|
+
: ` ${icon} ${text}`;
|
|
59
|
+
console.log(line);
|
|
60
|
+
}
|
|
61
|
+
setupEventListeners() {
|
|
62
|
+
this.unsubscribers.push(this.eventBus.onPhaseStart((event) => {
|
|
63
|
+
this.phaseStartTimes.set(event.phase, Date.now());
|
|
64
|
+
this.activePhase = event.phase;
|
|
65
|
+
if (event.phase === 'Discovery' && this.deploymentConfig) {
|
|
66
|
+
console.log((0, formatters_1.formatDeploymentConfig)(this.deploymentConfig));
|
|
67
|
+
}
|
|
68
|
+
if (event.phase === 'Build' || event.phase === 'Deploy' || event.phase === 'Bootstrap') {
|
|
69
|
+
this.printSection(event.phase);
|
|
70
|
+
this.currentListr = new listr2_1.Listr([], {
|
|
71
|
+
concurrent: true,
|
|
72
|
+
renderer: this.config.interactive ? 'default' : 'verbose',
|
|
73
|
+
rendererOptions: {
|
|
74
|
+
collapseSubtasks: false,
|
|
75
|
+
showSubtasks: true,
|
|
76
|
+
clearOutput: false
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else if (event.phase !== 'Outputs') {
|
|
81
|
+
this.printSection(event.phase);
|
|
82
|
+
}
|
|
83
|
+
if (event.phase === 'Deploy') {
|
|
84
|
+
this.resourceCounts = { created: 0, updated: 0, deleted: 0, same: 0 };
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
this.unsubscribers.push(this.eventBus.onPhaseComplete(async (event) => {
|
|
88
|
+
const startTime = this.phaseStartTimes.get(event.phase) || Date.now();
|
|
89
|
+
const duration = Date.now() - startTime;
|
|
90
|
+
this.collectPhaseMetric(event.phase, duration, event.status);
|
|
91
|
+
if ((event.phase === 'Build' || event.phase === 'Deploy' || event.phase === 'Bootstrap') && this.currentListr) {
|
|
92
|
+
try {
|
|
93
|
+
await this.currentListr.run();
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
}
|
|
97
|
+
this.currentListr = null;
|
|
98
|
+
}
|
|
99
|
+
if (event.phase === 'Deploy') {
|
|
100
|
+
const parts = [];
|
|
101
|
+
if (this.resourceCounts.created > 0)
|
|
102
|
+
parts.push(chalk_1.default.green(`${this.resourceCounts.created} created`));
|
|
103
|
+
if (this.resourceCounts.updated > 0)
|
|
104
|
+
parts.push(chalk_1.default.yellow(`${this.resourceCounts.updated} updated`));
|
|
105
|
+
if (this.resourceCounts.deleted > 0)
|
|
106
|
+
parts.push(chalk_1.default.red(`${this.resourceCounts.deleted} deleted`));
|
|
107
|
+
if (parts.length > 0) {
|
|
108
|
+
console.log('');
|
|
109
|
+
const icon = event.status === 'success' ? chalk_1.default.green('✓') : chalk_1.default.red('✗');
|
|
110
|
+
this.printItem(icon, parts.join(', '), this.formatDuration(duration));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}));
|
|
114
|
+
this.unsubscribers.push(this.eventBus.onDiagnostic((event) => {
|
|
115
|
+
if (!this.currentListr && event.phase) {
|
|
116
|
+
if (event.phase === 'DependencyGraph') {
|
|
117
|
+
console.log(` ${chalk_1.default.dim(event.message)}`);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
this.printItem(chalk_1.default.dim('•'), event.message);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}));
|
|
124
|
+
this.unsubscribers.push(this.eventBus.onTaskStart((event) => {
|
|
125
|
+
if (!this.currentListr)
|
|
126
|
+
return;
|
|
127
|
+
let taskName = event.taskName;
|
|
128
|
+
if (event.phase === 'Deploy') {
|
|
129
|
+
const parts = event.taskName.split(':');
|
|
130
|
+
const resourceType = parts[0] || 'Resource';
|
|
131
|
+
const resourceName = parts.slice(1).join(':') || event.taskName;
|
|
132
|
+
taskName = `${resourceType} ${resourceName}`;
|
|
133
|
+
}
|
|
134
|
+
const task = {
|
|
135
|
+
title: taskName,
|
|
136
|
+
task: async () => {
|
|
137
|
+
return new Promise((resolve) => {
|
|
138
|
+
this.listrTasks.set(event.taskId, {
|
|
139
|
+
resolve,
|
|
140
|
+
startTime: Date.now(),
|
|
141
|
+
title: taskName
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
this.currentListr.add(task);
|
|
147
|
+
}));
|
|
148
|
+
this.unsubscribers.push(this.eventBus.onTaskComplete((event) => {
|
|
149
|
+
const taskCtx = this.listrTasks.get(event.taskId);
|
|
150
|
+
if (taskCtx) {
|
|
151
|
+
if (this.activePhase === 'Deploy' && event.status === 'success') {
|
|
152
|
+
this.resourceCounts.created++;
|
|
153
|
+
}
|
|
154
|
+
taskCtx.resolve();
|
|
155
|
+
this.listrTasks.delete(event.taskId);
|
|
156
|
+
}
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
log(message) {
|
|
160
|
+
console.log(message);
|
|
161
|
+
}
|
|
162
|
+
info(message) {
|
|
163
|
+
this.printItem(chalk_1.default.blue('ℹ'), message);
|
|
164
|
+
}
|
|
165
|
+
success(message) {
|
|
166
|
+
this.printItem(chalk_1.default.green('✓'), message);
|
|
167
|
+
}
|
|
168
|
+
warn(message) {
|
|
169
|
+
this.printItem(chalk_1.default.yellow('⚠'), message);
|
|
170
|
+
}
|
|
171
|
+
error(message) {
|
|
172
|
+
this.printItem(chalk_1.default.red('✗'), message);
|
|
173
|
+
}
|
|
174
|
+
setDeploymentConfig(config) {
|
|
175
|
+
this.deploymentConfig = config;
|
|
176
|
+
}
|
|
177
|
+
getPhaseMetrics() {
|
|
178
|
+
return Array.from(this.phaseMetrics.values());
|
|
179
|
+
}
|
|
180
|
+
printFinalSummary(result) {
|
|
181
|
+
const phases = this.getPhaseMetrics();
|
|
182
|
+
console.log((0, formatters_1.formatFinalSummary)(result, phases));
|
|
183
|
+
}
|
|
184
|
+
collectPhaseMetric(phase, duration, status) {
|
|
185
|
+
this.phaseMetrics.set(phase, { phase, duration, status });
|
|
186
|
+
}
|
|
187
|
+
cleanup() {
|
|
188
|
+
for (const unsubscribe of this.unsubscribers) {
|
|
189
|
+
unsubscribe();
|
|
190
|
+
}
|
|
191
|
+
this.unsubscribers = [];
|
|
192
|
+
this.listrTasks.clear();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
exports.UIShell = UIShell;
|
|
196
|
+
const createUIShell = (eventBus, config) => {
|
|
197
|
+
return new UIShell(eventBus, config);
|
|
198
|
+
};
|
|
199
|
+
exports.createUIShell = createUIShell;
|
|
200
|
+
//# sourceMappingURL=shell-listr2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-listr2.js","sourceRoot":"","sources":["../../src/ui/shell-listr2.ts"],"names":[],"mappings":";;;;;;AAOA,kDAAyB;AACzB,mCAAyC;AAGzC,6CAMqB;AAWrB,MAAM,aAAa,GAA8B;IAC/C,WAAW,EAAE,WAAW;IACxB,eAAe,EAAE,eAAe;IAChC,iBAAiB,EAAE,cAAc;IACjC,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,SAAS;CACrB,CAAA;AAQD,MAAa,OAAO;IACD,QAAQ,CAAoB;IAC5B,MAAM,CAAe;IAC9B,aAAa,GAAsB,EAAE,CAAA;IACrC,eAAe,GAA2B,IAAI,GAAG,EAAE,CAAA;IACnD,gBAAgB,CAAmB;IACnC,YAAY,GAAgC,IAAI,GAAG,EAAE,CAAA;IAGrD,UAAU,GAA6B,IAAI,GAAG,EAAE,CAAA;IAChD,YAAY,GAAgC,IAAI,CAAA;IAChD,WAAW,GAAqB,IAAI,CAAA;IACpC,cAAc,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA;IAExE,YAAY,QAA4B,EAAE,MAAsB;QAC9D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK;YACjC,GAAG,MAAM;SACV,CAAA;QAED,IAAI,CAAC,mBAAmB,EAAE,CAAA;IAC5B,CAAC;IAKO,cAAc,CAAC,EAAU;QAC/B,MAAM,OAAO,GAAG,EAAE,GAAG,I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AAI,CAAC,aAAa,GAAG,EAAE,CAAA;QACvB,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;IACzB,CAAC;CACF;AAxPD,0BAwPC;AAEM,MAAM,aAAa,GAAG,CAAC,QAA4B,EAAE,MAAsB,EAAW,EAAE;IAC7F,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC,CAAA;AAFY,QAAA,aAAa,iBAEzB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DeploymentEventBus } from './streams/event-bus';
|
|
2
|
+
import { DeploymentConfig, PhaseMetric, DeploymentResult } from './formatters';
|
|
3
|
+
export interface UIShellConfig {
|
|
4
|
+
readonly verbose?: boolean;
|
|
5
|
+
readonly colors?: boolean;
|
|
6
|
+
readonly interactive?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class UIShell {
|
|
9
|
+
private readonly eventBus;
|
|
10
|
+
private readonly config;
|
|
11
|
+
private unsubscribers;
|
|
12
|
+
private phaseStartTimes;
|
|
13
|
+
private deploymentConfig?;
|
|
14
|
+
private phaseMetrics;
|
|
15
|
+
private currentSpinner;
|
|
16
|
+
private activePhase;
|
|
17
|
+
private activeTasks;
|
|
18
|
+
private resourceCounts;
|
|
19
|
+
constructor(eventBus: DeploymentEventBus, config?: UIShellConfig);
|
|
20
|
+
private formatDuration;
|
|
21
|
+
private printSection;
|
|
22
|
+
private printItem;
|
|
23
|
+
private startPhaseSpinner;
|
|
24
|
+
private updateSpinner;
|
|
25
|
+
private completeSpinner;
|
|
26
|
+
private setupEventListeners;
|
|
27
|
+
log(message: string): void;
|
|
28
|
+
info(message: string): void;
|
|
29
|
+
success(message: string): void;
|
|
30
|
+
warn(message: string): void;
|
|
31
|
+
error(message: string): void;
|
|
32
|
+
setDeploymentConfig(config: DeploymentConfig): void;
|
|
33
|
+
getPhaseMetrics(): PhaseMetric[];
|
|
34
|
+
printFinalSummary(result: DeploymentResult): void;
|
|
35
|
+
private collectPhaseMetric;
|
|
36
|
+
cleanup(): void;
|
|
37
|
+
}
|
|
38
|
+
export declare const createUIShell: (eventBus: DeploymentEventBus, config?: UIShellConfig) => UIShell;
|
|
39
|
+
//# sourceMappingURL=shell-ora.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-ora.d.ts","sourceRoot":"","sources":["../../src/ui/shell-ora.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAExD,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAGjB,MAAM,cAAc,CAAA;AAErB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAC/B;AAqBD,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,eAAe,CAAoC;IAC3D,OAAO,CAAC,gBAAgB,CAAC,CAAkB;IAC3C,OAAO,CAAC,YAAY,CAAyC;IAG7D,OAAO,CAAC,cAAc,CAAmB;IACzC,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,WAAW,CAA8D;IACjF,OAAO,CAAC,cAAc,CAAkD;gBAE5D,QAAQ,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,aAAa;IAehE,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,mBAAmB;IAwL3B,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAY1B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM3B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM9B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAS5B,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAOnD,eAAe,IAAI,WAAW,EAAE;IAOhC,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAQjD,OAAO,CAAC,kBAAkB;IAI1B,OAAO,IAAI,IAAI;CAchB;AAED,eAAO,MAAM,aAAa,GAAI,UAAU,kBAAkB,EAAE,SAAS,aAAa,KAAG,OAEpF,CAAA"}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createUIShell = exports.UIShell = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
9
|
+
const formatters_1 = require("./formatters");
|
|
10
|
+
const SECTION_NAMES = {
|
|
11
|
+
'Discovery': 'Discovery',
|
|
12
|
+
'Configuration': 'Configuration',
|
|
13
|
+
'DependencyGraph': 'Dependencies',
|
|
14
|
+
'Bootstrap': 'Bootstrap',
|
|
15
|
+
'Secrets': 'Secrets',
|
|
16
|
+
'Build': 'Build',
|
|
17
|
+
'Deploy': 'Deploy',
|
|
18
|
+
'Outputs': 'Outputs'
|
|
19
|
+
};
|
|
20
|
+
const SPINNER_PHASES = ['Discovery', 'Bootstrap', 'Build', 'Deploy'];
|
|
21
|
+
class UIShell {
|
|
22
|
+
eventBus;
|
|
23
|
+
config;
|
|
24
|
+
unsubscribers = [];
|
|
25
|
+
phaseStartTimes = new Map();
|
|
26
|
+
deploymentConfig;
|
|
27
|
+
phaseMetrics = new Map();
|
|
28
|
+
currentSpinner = null;
|
|
29
|
+
activePhase = null;
|
|
30
|
+
activeTasks = new Map();
|
|
31
|
+
resourceCounts = { created: 0, updated: 0, deleted: 0, same: 0 };
|
|
32
|
+
constructor(eventBus, config) {
|
|
33
|
+
this.eventBus = eventBus;
|
|
34
|
+
this.config = {
|
|
35
|
+
verbose: false,
|
|
36
|
+
colors: true,
|
|
37
|
+
interactive: process.stdout.isTTY,
|
|
38
|
+
...config
|
|
39
|
+
};
|
|
40
|
+
this.setupEventListeners();
|
|
41
|
+
}
|
|
42
|
+
formatDuration(ms) {
|
|
43
|
+
const seconds = ms / 1000;
|
|
44
|
+
if (seconds < 60) {
|
|
45
|
+
return `${seconds.toFixed(1)}s`;
|
|
46
|
+
}
|
|
47
|
+
const minutes = Math.floor(seconds / 60);
|
|
48
|
+
const remainingSeconds = seconds % 60;
|
|
49
|
+
return `${minutes}m ${remainingSeconds.toFixed(0)}s`;
|
|
50
|
+
}
|
|
51
|
+
printSection(phase) {
|
|
52
|
+
const name = SECTION_NAMES[phase] || phase;
|
|
53
|
+
console.log('');
|
|
54
|
+
console.log(chalk_1.default.bold(name));
|
|
55
|
+
}
|
|
56
|
+
printItem(icon, text, suffix) {
|
|
57
|
+
const line = suffix
|
|
58
|
+
? ` ${icon} ${text} ${chalk_1.default.dim(suffix)}`
|
|
59
|
+
: ` ${icon} ${text}`;
|
|
60
|
+
console.log(line);
|
|
61
|
+
}
|
|
62
|
+
startPhaseSpinner(phase) {
|
|
63
|
+
const name = SECTION_NAMES[phase] || phase;
|
|
64
|
+
if (this.currentSpinner) {
|
|
65
|
+
this.currentSpinner.stop();
|
|
66
|
+
}
|
|
67
|
+
console.log('');
|
|
68
|
+
console.log(chalk_1.default.bold(name));
|
|
69
|
+
if (this.config.interactive) {
|
|
70
|
+
this.currentSpinner = (0, ora_1.default)({
|
|
71
|
+
text: 'Starting...',
|
|
72
|
+
color: 'blue'
|
|
73
|
+
}).start();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
updateSpinner(text) {
|
|
77
|
+
if (this.currentSpinner) {
|
|
78
|
+
this.currentSpinner.text = text;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
completeSpinner(success, text) {
|
|
82
|
+
if (this.currentSpinner) {
|
|
83
|
+
if (success) {
|
|
84
|
+
this.currentSpinner.succeed(text);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
this.currentSpinner.fail(text);
|
|
88
|
+
}
|
|
89
|
+
this.currentSpinner = null;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const icon = success ? chalk_1.default.green('✓') : chalk_1.default.red('✗');
|
|
93
|
+
this.printItem(icon, text);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
setupEventListeners() {
|
|
97
|
+
this.unsubscribers.push(this.eventBus.onPhaseStart((event) => {
|
|
98
|
+
this.phaseStartTimes.set(event.phase, Date.now());
|
|
99
|
+
this.activePhase = event.phase;
|
|
100
|
+
if (event.phase === 'Discovery' && this.deploymentConfig) {
|
|
101
|
+
console.log((0, formatters_1.formatDeploymentConfig)(this.deploymentConfig));
|
|
102
|
+
}
|
|
103
|
+
if (SPINNER_PHASES.includes(event.phase)) {
|
|
104
|
+
this.startPhaseSpinner(event.phase);
|
|
105
|
+
}
|
|
106
|
+
else if (event.phase !== 'Outputs') {
|
|
107
|
+
this.printSection(event.phase);
|
|
108
|
+
}
|
|
109
|
+
if (event.phase === 'Deploy') {
|
|
110
|
+
this.resourceCounts = { created: 0, updated: 0, deleted: 0, same: 0 };
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
113
|
+
this.unsubscribers.push(this.eventBus.onPhaseComplete((event) => {
|
|
114
|
+
const startTime = this.phaseStartTimes.get(event.phase) || Date.now();
|
|
115
|
+
const duration = Date.now() - startTime;
|
|
116
|
+
const durationStr = this.formatDuration(duration);
|
|
117
|
+
this.collectPhaseMetric(event.phase, duration, event.status);
|
|
118
|
+
if (SPINNER_PHASES.includes(event.phase)) {
|
|
119
|
+
const name = SECTION_NAMES[event.phase] || event.phase;
|
|
120
|
+
let message = `${name} completed`;
|
|
121
|
+
if (event.phase === 'Deploy') {
|
|
122
|
+
const parts = [];
|
|
123
|
+
if (this.resourceCounts.created > 0)
|
|
124
|
+
parts.push(`${this.resourceCounts.created} created`);
|
|
125
|
+
if (this.resourceCounts.updated > 0)
|
|
126
|
+
parts.push(`${this.resourceCounts.updated} updated`);
|
|
127
|
+
if (this.resourceCounts.deleted > 0)
|
|
128
|
+
parts.push(`${this.resourceCounts.deleted} deleted`);
|
|
129
|
+
if (parts.length > 0) {
|
|
130
|
+
message = `${parts.join(', ')} (${durationStr})`;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
message = `No changes (${durationStr})`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
message = `${name} (${durationStr})`;
|
|
138
|
+
}
|
|
139
|
+
this.completeSpinner(event.status === 'success', message);
|
|
140
|
+
}
|
|
141
|
+
this.activeTasks.clear();
|
|
142
|
+
}));
|
|
143
|
+
this.unsubscribers.push(this.eventBus.onDiagnostic((event) => {
|
|
144
|
+
if (event.phase && !SPINNER_PHASES.includes(event.phase)) {
|
|
145
|
+
if (event.phase === 'DependencyGraph') {
|
|
146
|
+
console.log(` ${chalk_1.default.dim(event.message)}`);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this.printItem(chalk_1.default.dim('•'), event.message);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
this.unsubscribers.push(this.eventBus.onTaskStart((event) => {
|
|
154
|
+
if (!SPINNER_PHASES.includes(event.phase))
|
|
155
|
+
return;
|
|
156
|
+
this.activeTasks.set(event.taskId, {
|
|
157
|
+
name: event.taskName,
|
|
158
|
+
startTime: Date.now()
|
|
159
|
+
});
|
|
160
|
+
let taskName = event.taskName;
|
|
161
|
+
if (event.phase === 'Deploy') {
|
|
162
|
+
const parts = event.taskName.split(':');
|
|
163
|
+
const resourceType = parts[0] || 'Resource';
|
|
164
|
+
const resourceName = parts.slice(1).join(':') || event.taskName;
|
|
165
|
+
taskName = `${resourceType} ${resourceName}`;
|
|
166
|
+
}
|
|
167
|
+
const taskCount = this.activeTasks.size;
|
|
168
|
+
if (taskCount === 1) {
|
|
169
|
+
this.updateSpinner(taskName);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
this.updateSpinner(`${taskName} (${taskCount} tasks running)`);
|
|
173
|
+
}
|
|
174
|
+
}));
|
|
175
|
+
this.unsubscribers.push(this.eventBus.onTaskUpdate((event) => {
|
|
176
|
+
const task = this.activeTasks.get(event.taskId);
|
|
177
|
+
if (task && event.message) {
|
|
178
|
+
this.updateSpinner(event.message);
|
|
179
|
+
}
|
|
180
|
+
}));
|
|
181
|
+
this.unsubscribers.push(this.eventBus.onTaskComplete((event) => {
|
|
182
|
+
const task = this.activeTasks.get(event.taskId);
|
|
183
|
+
if (!task)
|
|
184
|
+
return;
|
|
185
|
+
const duration = event.duration || (Date.now() - task.startTime);
|
|
186
|
+
const durationStr = this.formatDuration(duration);
|
|
187
|
+
if (this.activePhase === 'Deploy') {
|
|
188
|
+
if (event.status === 'success') {
|
|
189
|
+
this.resourceCounts.created++;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (this.currentSpinner) {
|
|
193
|
+
this.currentSpinner.stop();
|
|
194
|
+
}
|
|
195
|
+
let taskName = task.name;
|
|
196
|
+
if (this.activePhase === 'Deploy') {
|
|
197
|
+
const parts = task.name.split(':');
|
|
198
|
+
const resourceType = parts[0] || 'Resource';
|
|
199
|
+
const resourceName = parts.slice(1).join(':') || task.name;
|
|
200
|
+
taskName = `${resourceType} ${resourceName}`;
|
|
201
|
+
}
|
|
202
|
+
const icon = event.status === 'success' ? chalk_1.default.green('+') : chalk_1.default.red('-');
|
|
203
|
+
const verb = event.status === 'success' ? 'created' : 'failed';
|
|
204
|
+
console.log(` ${icon} ${taskName} ${verb} ${chalk_1.default.dim(`(${durationStr})`)}`);
|
|
205
|
+
this.activeTasks.delete(event.taskId);
|
|
206
|
+
if (this.currentSpinner && this.activeTasks.size > 0) {
|
|
207
|
+
const remaining = Array.from(this.activeTasks.values());
|
|
208
|
+
const nextTask = remaining[0];
|
|
209
|
+
if (nextTask) {
|
|
210
|
+
let nextTaskName = nextTask.name;
|
|
211
|
+
if (this.activePhase === 'Deploy') {
|
|
212
|
+
const parts = nextTask.name.split(':');
|
|
213
|
+
const resourceType = parts[0] || 'Resource';
|
|
214
|
+
const resourceName = parts.slice(1).join(':') || nextTask.name;
|
|
215
|
+
nextTaskName = `${resourceType} ${resourceName}`;
|
|
216
|
+
}
|
|
217
|
+
this.currentSpinner.start();
|
|
218
|
+
if (remaining.length === 1) {
|
|
219
|
+
this.updateSpinner(nextTaskName);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
this.updateSpinner(`${nextTaskName} (${remaining.length} tasks running)`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
228
|
+
log(message) {
|
|
229
|
+
if (this.currentSpinner) {
|
|
230
|
+
this.currentSpinner.stop();
|
|
231
|
+
}
|
|
232
|
+
console.log(message);
|
|
233
|
+
if (this.currentSpinner && this.activeTasks.size > 0) {
|
|
234
|
+
this.currentSpinner.start();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
info(message) {
|
|
238
|
+
if (this.currentSpinner)
|
|
239
|
+
this.currentSpinner.stop();
|
|
240
|
+
this.printItem(chalk_1.default.blue('ℹ'), message);
|
|
241
|
+
if (this.currentSpinner && this.activeTasks.size > 0)
|
|
242
|
+
this.currentSpinner.start();
|
|
243
|
+
}
|
|
244
|
+
success(message) {
|
|
245
|
+
if (this.currentSpinner)
|
|
246
|
+
this.currentSpinner.stop();
|
|
247
|
+
this.printItem(chalk_1.default.green('✓'), message);
|
|
248
|
+
if (this.currentSpinner && this.activeTasks.size > 0)
|
|
249
|
+
this.currentSpinner.start();
|
|
250
|
+
}
|
|
251
|
+
warn(message) {
|
|
252
|
+
if (this.currentSpinner)
|
|
253
|
+
this.currentSpinner.stop();
|
|
254
|
+
this.printItem(chalk_1.default.yellow('⚠'), message);
|
|
255
|
+
if (this.currentSpinner && this.activeTasks.size > 0)
|
|
256
|
+
this.currentSpinner.start();
|
|
257
|
+
}
|
|
258
|
+
error(message) {
|
|
259
|
+
if (this.currentSpinner)
|
|
260
|
+
this.currentSpinner.stop();
|
|
261
|
+
this.printItem(chalk_1.default.red('✗'), message);
|
|
262
|
+
if (this.currentSpinner && this.activeTasks.size > 0)
|
|
263
|
+
this.currentSpinner.start();
|
|
264
|
+
}
|
|
265
|
+
setDeploymentConfig(config) {
|
|
266
|
+
this.deploymentConfig = config;
|
|
267
|
+
}
|
|
268
|
+
getPhaseMetrics() {
|
|
269
|
+
return Array.from(this.phaseMetrics.values());
|
|
270
|
+
}
|
|
271
|
+
printFinalSummary(result) {
|
|
272
|
+
const phases = this.getPhaseMetrics();
|
|
273
|
+
console.log((0, formatters_1.formatFinalSummary)(result, phases));
|
|
274
|
+
}
|
|
275
|
+
collectPhaseMetric(phase, duration, status) {
|
|
276
|
+
this.phaseMetrics.set(phase, { phase, duration, status });
|
|
277
|
+
}
|
|
278
|
+
cleanup() {
|
|
279
|
+
if (this.currentSpinner) {
|
|
280
|
+
this.currentSpinner.stop();
|
|
281
|
+
this.currentSpinner = null;
|
|
282
|
+
}
|
|
283
|
+
for (const unsubscribe of this.unsubscribers) {
|
|
284
|
+
unsubscribe();
|
|
285
|
+
}
|
|
286
|
+
this.unsubscribers = [];
|
|
287
|
+
this.activeTasks.clear();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
exports.UIShell = UIShell;
|
|
291
|
+
const createUIShell = (eventBus, config) => {
|
|
292
|
+
return new UIShell(eventBus, config);
|
|
293
|
+
};
|
|
294
|
+
exports.createUIShell = createUIShell;
|
|
295
|
+
//# sourceMappingURL=shell-ora.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-ora.js","sourceRoot":"","sources":["../../src/ui/shell-ora.ts"],"names":[],"mappings":";;;;;;AAOA,kDAAyB;AACzB,8CAA8B;AAG9B,6CAMqB;AAWrB,MAAM,aAAa,GAA8B;IAC/C,WAAW,EAAE,WAAW;IACxB,eAAe,EAAE,eAAe;IAChC,iBAAiB,EAAE,cAAc;IACjC,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,SAAS;CACrB,CAAA;AAKD,MAAM,cAAc,GAAgB,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;AAEjF,MAAa,OAAO;IACD,QAAQ,CAAoB;IAC5B,MAAM,CAAe;IAC9B,aAAa,GAAsB,EAAE,CAAA;IACrC,eAAe,GAA2B,IAAI,GAAG,EAAE,CAAA;IACnD,gBAAgB,CAAmB;IACnC,YAAY,GAAgC,IAAI,GAAG,EAAE,CAAA;IAGrD,cAAc,GAAe,IAAI,CAAA;IACjC,WAAW,GAAqB,IAAI,CAAA;IACpC,WAAW,GAAqD,IAAI,GAAG,EAAE,CAAA;IACzE,cAAc,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA;IAExE,YAAY,QAA4B,EAAE,MAAsB;QAC9D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK;YACjC,GAA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M,CAAC,CAAA;AACtC,CAAC,CAAA;AAFY,QAAA,aAAa,iBAEzB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DeploymentEventBus } from './streams/event-bus';
|
|
2
|
+
import { DeploymentConfig, PhaseMetric, DeploymentResult } from './formatters';
|
|
3
|
+
export interface UIShellConfig {
|
|
4
|
+
readonly verbose?: boolean;
|
|
5
|
+
readonly colors?: boolean;
|
|
6
|
+
readonly interactive?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class UIShell {
|
|
9
|
+
private readonly eventBus;
|
|
10
|
+
private readonly config;
|
|
11
|
+
private readonly buildSpinner;
|
|
12
|
+
private unsubscribers;
|
|
13
|
+
private phaseStartTimes;
|
|
14
|
+
private sectionPrinted;
|
|
15
|
+
private resourceCounts;
|
|
16
|
+
private seenResources;
|
|
17
|
+
private taskPhases;
|
|
18
|
+
private deploymentConfig?;
|
|
19
|
+
private phaseMetrics;
|
|
20
|
+
constructor(eventBus: DeploymentEventBus, config?: UIShellConfig);
|
|
21
|
+
private printSection;
|
|
22
|
+
private printItem;
|
|
23
|
+
private printSubItem;
|
|
24
|
+
private formatDuration;
|
|
25
|
+
private printPhaseComplete;
|
|
26
|
+
private isDynamic;
|
|
27
|
+
private setupEventListeners;
|
|
28
|
+
private processDeployOutput;
|
|
29
|
+
log(message: string): void;
|
|
30
|
+
info(message: string): void;
|
|
31
|
+
success(message: string): void;
|
|
32
|
+
warn(message: string): void;
|
|
33
|
+
error(message: string): void;
|
|
34
|
+
setDeploymentConfig(config: DeploymentConfig): void;
|
|
35
|
+
getPhaseMetrics(): PhaseMetric[];
|
|
36
|
+
printDeploymentStart(config: DeploymentConfig): void;
|
|
37
|
+
printFinalSummary(result: DeploymentResult): void;
|
|
38
|
+
private collectPhaseMetric;
|
|
39
|
+
cleanup(): void;
|
|
40
|
+
}
|
|
41
|
+
export declare const createUIShell: (eventBus: DeploymentEventBus, config?: UIShellConfig) => UIShell;
|
|
42
|
+
//# sourceMapping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