@contentstack/cli-utilities 2.0.0-beta.2 → 2.0.0-beta.4

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.
@@ -1,120 +1,125 @@
1
1
  "use strict";
2
- const chalk = require('chalk');
3
- const figures = require('figures');
4
- const Table = require('cli-table');
5
- const cliCursor = require('cli-cursor');
6
- const Base = require('inquirer/lib/prompts/base');
7
- const observe = require('inquirer/lib/utils/events');
8
- const { map, takeUntil } = require('rxjs/operators');
9
- const Choices = require('inquirer/lib/objects/choices');
10
- class TablePrompt extends Base {
11
- /**
12
- * Initialise the prompt
13
- *
14
- * @param {Object} questions
15
- * @param {Object} rl
16
- * @param {Object} answers
17
- */
18
- constructor(questions, rl, answers) {
19
- super(questions, rl, answers);
20
- this.selectAll = this.opt.selectAll || false;
21
- const formattedRows = this.selectAll
22
- ? [
23
- {
24
- name: 'Select All',
25
- value: 'selectAll',
26
- },
27
- ...(this.opt.rows || []),
28
- ]
29
- : [];
30
- this.columns = new Choices(this.opt.columns, []);
2
+ /**
3
+ * Table prompt for inquirer v12.
4
+ * Standalone implementation (no inquirer/lib) compatible with
5
+ * inquirer 12 legacy adapter: constructor(question, rl, answers) + run() returns Promise.
6
+ */
7
+ const tslib_1 = require("tslib");
8
+ const chalk_1 = require("./chalk");
9
+ const figures_1 = tslib_1.__importDefault(require("figures"));
10
+ const cli_cursor_1 = tslib_1.__importDefault(require("cli-cursor"));
11
+ const cli_table_1 = tslib_1.__importDefault(require("cli-table"));
12
+ function pluckName(c) {
13
+ var _a, _b;
14
+ return (_a = c.name) !== null && _a !== void 0 ? _a : String((_b = c.value) !== null && _b !== void 0 ? _b : '');
15
+ }
16
+ function getValue(c) {
17
+ var _a, _b;
18
+ return (_b = (_a = c.value) !== null && _a !== void 0 ? _a : c.name) !== null && _b !== void 0 ? _b : '';
19
+ }
20
+ class TablePrompt {
21
+ constructor(question, rl, _answers) {
22
+ this.question = question;
23
+ this.rl = rl;
24
+ this.selectAll = Boolean(question.selectAll);
25
+ this.columns = Array.isArray(question.columns) ? question.columns : [];
26
+ this.rows = this.selectAll
27
+ ? [{ name: 'Select All', value: 'selectAll' }, ...(question.rows || [])]
28
+ : Array.isArray(question.rows) ? question.rows : [];
31
29
  this.pointer = 0;
32
30
  this.horizontalPointer = 0;
33
- this.rows = new Choices(formattedRows, []);
34
- this.values = this.columns.filter(() => true).map(() => undefined);
35
- this.pageSize = this.opt.pageSize || 5;
31
+ this.values = this.columns.map(() => undefined);
32
+ this.pageSize = Number(question.pageSize) || 5;
33
+ this.spaceKeyPressed = false;
34
+ this.status = 'idle';
35
+ this.done = null;
36
+ this.lastHeight = 0;
36
37
  }
37
- /**
38
- * Start the inquirer session
39
- *
40
- * @param {Function} callback
41
- * @return {TablePrompt}
42
- */
43
- _run(callback) {
44
- this.done = callback;
45
- const events = observe(this.rl);
46
- const validation = this.handleSubmitEvents(events.line.pipe(map(this.getCurrentValue.bind(this))));
47
- validation.success.forEach(this.onEnd.bind(this));
48
- validation.error.forEach(this.onError.bind(this));
49
- events.keypress.forEach(({ key }) => {
50
- switch (key.name) {
51
- case 'left':
52
- return this.onLeftKey();
53
- case 'right':
54
- return this.onRightKey();
55
- }
38
+ run() {
39
+ return new Promise((resolve) => {
40
+ this.done = (value) => {
41
+ this.status = 'answered';
42
+ cli_cursor_1.default.show();
43
+ resolve(value);
44
+ };
45
+ const onKeypress = (_str, key) => {
46
+ if (this.status === 'answered')
47
+ return;
48
+ if (key.ctrl && key.name === 'c')
49
+ return;
50
+ switch (key.name) {
51
+ case 'up':
52
+ this.onUpKey();
53
+ break;
54
+ case 'down':
55
+ this.onDownKey();
56
+ break;
57
+ case 'left':
58
+ this.onLeftKey();
59
+ break;
60
+ case 'right':
61
+ this.onRightKey();
62
+ break;
63
+ case 'space':
64
+ this.onSpaceKey();
65
+ break;
66
+ case 'enter':
67
+ case 'return':
68
+ this.onSubmit();
69
+ break;
70
+ default:
71
+ return;
72
+ }
73
+ this.render();
74
+ };
75
+ this.rl.input.on('keypress', onKeypress);
76
+ cli_cursor_1.default.hide();
77
+ this.render();
56
78
  });
57
- events.normalizedUpKey.pipe(takeUntil(validation.success)).forEach(this.onUpKey.bind(this));
58
- events.normalizedDownKey.pipe(takeUntil(validation.success)).forEach(this.onDownKey.bind(this));
59
- events.spaceKey.pipe(takeUntil(validation.success)).forEach(this.onSpaceKey.bind(this));
60
- if (this.rl.line) {
61
- this.onKeypress();
62
- }
63
- cliCursor.hide();
64
- this.render();
65
- return this;
66
79
  }
67
80
  getCurrentValue() {
68
- const currentValue = [];
69
- this.rows.forEach((row, rowIndex) => {
70
- currentValue.push(this.values[rowIndex]);
71
- });
72
- return currentValue;
73
- }
74
- onDownKey() {
75
- const length = this.rows.realLength;
76
- this.pointer = this.pointer < length - 1 ? this.pointer + 1 : this.pointer;
77
- this.render();
81
+ const out = [];
82
+ for (let i = 0; i < this.rows.length; i++) {
83
+ out.push(this.values[i]);
84
+ }
85
+ return out;
78
86
  }
79
- onEnd(state) {
80
- this.status = 'answered';
81
- this.spaceKeyPressed = true;
82
- this.render();
83
- this.screen.done();
84
- cliCursor.show();
85
- if (this.selectAll) {
86
- // remove select all row
87
- const [, ...truncatedValue] = state.value;
88
- this.done(truncatedValue);
87
+ onSubmit() {
88
+ if (!this.done)
89
+ return;
90
+ const raw = this.getCurrentValue();
91
+ if (this.selectAll && raw.length > 0) {
92
+ this.done(raw.slice(1));
89
93
  }
90
94
  else {
91
- this.done(state.value);
95
+ this.done(raw);
92
96
  }
93
97
  }
94
- onError(state) {
95
- this.render(state.isValid);
98
+ onUpKey() {
99
+ this.pointer = this.pointer > 0 ? this.pointer - 1 : this.pointer;
100
+ }
101
+ onDownKey() {
102
+ const len = this.rows.length;
103
+ this.pointer = this.pointer < len - 1 ? this.pointer + 1 : this.pointer;
96
104
  }
97
105
  onLeftKey() {
98
- const length = this.columns.realLength;
99
- this.horizontalPointer = this.horizontalPointer > 0 ? this.horizontalPointer - 1 : length - 1;
100
- this.render();
106
+ const len = this.columns.length;
107
+ this.horizontalPointer = this.horizontalPointer > 0 ? this.horizontalPointer - 1 : len - 1;
101
108
  }
102
109
  onRightKey() {
103
- const length = this.columns.realLength;
104
- this.horizontalPointer = this.horizontalPointer < length - 1 ? this.horizontalPointer + 1 : 0;
105
- this.render();
110
+ const len = this.columns.length;
111
+ this.horizontalPointer = this.horizontalPointer < len - 1 ? this.horizontalPointer + 1 : 0;
106
112
  }
107
113
  selectAllValues(value) {
108
- let values = [];
109
- for (let i = 0; i < this.rows.length; i++) {
110
- values.push(value);
111
- }
112
- this.values = values;
114
+ this.values = this.rows.map(() => value);
113
115
  }
114
116
  onSpaceKey() {
115
- var _a;
116
- const value = this.columns.get(this.horizontalPointer).value;
117
- const rowValue = ((_a = this.rows.get(this.pointer)) === null || _a === void 0 ? void 0 : _a.value) || '';
117
+ const col = this.columns[this.horizontalPointer];
118
+ const row = this.rows[this.pointer];
119
+ if (!col)
120
+ return;
121
+ const value = getValue(col);
122
+ const rowValue = row ? getValue(row) : '';
118
123
  if (rowValue === 'selectAll') {
119
124
  this.selectAllValues(value);
120
125
  }
@@ -122,55 +127,58 @@ class TablePrompt extends Base {
122
127
  this.values[this.pointer] = value;
123
128
  }
124
129
  this.spaceKeyPressed = true;
125
- this.render();
126
- }
127
- onUpKey() {
128
- this.pointer = this.pointer > 0 ? this.pointer - 1 : this.pointer;
129
- this.render();
130
130
  }
131
131
  paginate() {
132
- const middleOfPage = Math.floor(this.pageSize / 2);
133
- const firstIndex = Math.max(0, this.pointer - middleOfPage);
134
- const lastIndex = Math.min(firstIndex + this.pageSize - 1, this.rows.realLength - 1);
135
- const lastPageOffset = this.pageSize - 1 - lastIndex + firstIndex;
136
- return [Math.max(0, firstIndex - lastPageOffset), lastIndex];
132
+ const mid = Math.floor(this.pageSize / 2);
133
+ const len = this.rows.length;
134
+ let first = Math.max(0, this.pointer - mid);
135
+ let last = Math.min(first + this.pageSize - 1, len - 1);
136
+ const offset = this.pageSize - 1 - (last - first);
137
+ first = Math.max(0, first - offset);
138
+ return [first, last];
137
139
  }
138
- render(error) {
139
- let message = this.getQuestion();
140
- let bottomContent = '';
140
+ getMessage() {
141
+ let msg = this.question.message || 'Select';
141
142
  if (!this.spaceKeyPressed) {
142
- message +=
143
- '(Press ' +
144
- chalk.cyan.bold('<space>') +
143
+ msg +=
144
+ ' (Press ' +
145
+ (0, chalk_1.getChalk)().cyan.bold('<space>') +
145
146
  ' to select, ' +
146
- chalk.cyan.bold('<Up and Down>') +
147
- ' to move rows, ' +
148
- chalk.cyan.bold('<Left and Right>') +
149
- ' to move columns)';
147
+ (0, chalk_1.getChalk)().cyan.bold('<Up/Down>') +
148
+ ' rows, ' +
149
+ (0, chalk_1.getChalk)().cyan.bold('<Left/Right>') +
150
+ ' columns, ' +
151
+ (0, chalk_1.getChalk)().cyan.bold('<Enter>') +
152
+ ' to confirm)';
150
153
  }
154
+ return msg;
155
+ }
156
+ render() {
151
157
  const [firstIndex, lastIndex] = this.paginate();
152
- const table = new Table({
153
- head: [chalk.reset.dim(`${firstIndex + 1}-${lastIndex} of ${this.rows.realLength - 1}`)].concat(this.columns.pluck('name').map((name) => chalk.reset.bold(name))),
158
+ const table = new cli_table_1.default({
159
+ head: [(0, chalk_1.getChalk)().reset.dim(`${firstIndex + 1}-${lastIndex + 1} of ${this.rows.length}`)].concat(this.columns.map((c) => (0, chalk_1.getChalk)().reset.bold(pluckName(c)))),
154
160
  });
155
- this.rows.forEach((row, rowIndex) => {
156
- if (rowIndex < firstIndex || rowIndex > lastIndex)
157
- return;
161
+ for (let rowIndex = firstIndex; rowIndex <= lastIndex; rowIndex++) {
162
+ const row = this.rows[rowIndex];
163
+ if (!row)
164
+ continue;
158
165
  const columnValues = [];
159
- this.columns.forEach((column, columnIndex) => {
160
- const isSelected = this.status !== 'answered' && this.pointer === rowIndex && this.horizontalPointer === columnIndex;
161
- const value = column.value === this.values[rowIndex] ? figures.radioOn : figures.radioOff;
162
- columnValues.push(`${isSelected ? '[' : ' '} ${value} ${isSelected ? ']' : ' '}`);
163
- });
164
- const chalkModifier = this.status !== 'answered' && this.pointer === rowIndex ? chalk.reset.bold.cyan : chalk.reset;
165
- table.push({
166
- [chalkModifier(row.name)]: columnValues,
167
- });
168
- });
169
- message += '\n\n' + table.toString();
170
- if (error) {
171
- bottomContent = chalk.red('>> ') + error;
166
+ for (let colIndex = 0; colIndex < this.columns.length; colIndex++) {
167
+ const isSelected = this.status !== 'answered' && this.pointer === rowIndex && this.horizontalPointer === colIndex;
168
+ const cellValue = getValue(this.columns[colIndex]) === this.values[rowIndex] ? figures_1.default.radioOn : figures_1.default.radioOff;
169
+ columnValues.push(`${isSelected ? '[' : ' '} ${cellValue} ${isSelected ? ']' : ' '}`);
170
+ }
171
+ const chalkModifier = this.status !== 'answered' && this.pointer === rowIndex ? (0, chalk_1.getChalk)().reset.bold.cyan : (0, chalk_1.getChalk)().reset;
172
+ table.push({ [chalkModifier(pluckName(row))]: columnValues });
173
+ }
174
+ const message = this.getMessage() + '\n\n' + table.toString();
175
+ const lines = message.split('\n').length;
176
+ const out = this.rl.output;
177
+ if (this.lastHeight > 0) {
178
+ out.write('\u001b[' + this.lastHeight + 'A\u001b[0J');
172
179
  }
173
- this.screen.render(message, bottomContent);
180
+ out.write(message);
181
+ this.lastHeight = lines;
174
182
  }
175
183
  }
176
184
  module.exports = TablePrompt;
@@ -150,3 +150,5 @@ export interface ProgressResult {
150
150
  success: number;
151
151
  failures: number;
152
152
  }
153
+ export type Answers = Record<string, unknown>;
154
+ export type InquirerQuestion = InquirePayload;
package/lib/logger/log.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLogPath = exports.handleAndLogError = exports.cliErrorHandler = exports.v2Logger = exports.getSessionLogPath = void 0;
3
+ exports.cliErrorHandler = exports.v2Logger = exports.getSessionLogPath = void 0;
4
+ exports.handleAndLogError = handleAndLogError;
5
+ exports.getLogPath = getLogPath;
4
6
  const tslib_1 = require("tslib");
5
7
  const fs = tslib_1.__importStar(require("fs"));
6
8
  const os = tslib_1.__importStar(require("os"));
@@ -68,7 +70,6 @@ function handleAndLogError(error, context, errorMessage) {
68
70
  meta: classified.meta,
69
71
  });
70
72
  }
71
- exports.handleAndLogError = handleAndLogError;
72
73
  /**
73
74
  * Get the log path for centralized logging
74
75
  * Priority:
@@ -102,7 +103,6 @@ function getLogPath() {
102
103
  // 4. Fallback to home directory
103
104
  return path.join(os.homedir(), 'contentstack', 'logs');
104
105
  }
105
- exports.getLogPath = getLogPath;
106
106
  // Re-export getSessionLogPath for external use
107
107
  var session_path_1 = require("./session-path");
108
108
  Object.defineProperty(exports, "getSessionLogPath", { enumerable: true, get: function () { return session_path_1.getSessionLogPath; } });
@@ -5,3 +5,8 @@
5
5
  * @returns The session-specific log directory path
6
6
  */
7
7
  export declare function getSessionLogPath(): string;
8
+ /**
9
+ * Clear the cached session path. Used by tests so each test gets a fresh path.
10
+ * Not needed in normal CLI usage (one process = one command = one cache).
11
+ */
12
+ export declare function clearSessionLogPathCache(): void;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSessionLogPath = void 0;
3
+ exports.getSessionLogPath = getSessionLogPath;
4
+ exports.clearSessionLogPathCache = clearSessionLogPathCache;
4
5
  const tslib_1 = require("tslib");
5
6
  const fs = tslib_1.__importStar(require("fs"));
6
7
  const os = tslib_1.__importStar(require("os"));
@@ -49,6 +50,10 @@ function createSessionMetadataFile(sessionPath, metadata) {
49
50
  // The session folder and logs will still be created
50
51
  }
51
52
  }
53
+ // Cache session path for the process so multiple callers (e.g. Logger's 5 level
54
+ // loggers, export/import command at end, completeProgressWithMessage per module)
55
+ // get one folder instead of many.
56
+ let cachedSessionPath = null;
52
57
  /**
53
58
  * Get the session-based log path for date-organized logging
54
59
  * Structure: {basePath}/{YYYY-MM-DD}/{command}-{YYYYMMDD-HHMMSS}-{sessionId}/
@@ -56,6 +61,9 @@ function createSessionMetadataFile(sessionPath, metadata) {
56
61
  * @returns The session-specific log directory path
57
62
  */
58
63
  function getSessionLogPath() {
64
+ if (cachedSessionPath) {
65
+ return cachedSessionPath;
66
+ }
59
67
  // Get base log path
60
68
  const basePath = (0, log_1.getLogPath)();
61
69
  // Get current date in YYYY-MM-DD format
@@ -91,6 +99,13 @@ function getSessionLogPath() {
91
99
  const metadata = generateSessionMetadata(__1.configHandler.get('currentCommandId') || commandId, sessionId, now);
92
100
  createSessionMetadataFile(sessionPath, metadata);
93
101
  }
102
+ cachedSessionPath = sessionPath;
94
103
  return sessionPath;
95
104
  }
96
- exports.getSessionLogPath = getSessionLogPath;
105
+ /**
106
+ * Clear the cached session path. Used by tests so each test gets a fresh path.
107
+ * Not needed in normal CLI usage (one process = one command = one cache).
108
+ */
109
+ function clearSessionLogPathCache() {
110
+ cachedSessionPath = null;
111
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
4
+ const chalk_1 = require("../chalk");
5
5
  const ora_1 = tslib_1.__importDefault(require("ora"));
6
6
  const cli_progress_1 = tslib_1.__importDefault(require("cli-progress"));
7
7
  const summary_manager_1 = tslib_1.__importDefault(require("./summary-manager"));
@@ -46,11 +46,11 @@ class CLIProgressManager {
46
46
  return;
47
47
  const safeBranchName = branchName || 'main';
48
48
  const branchInfo = headerTitle || `${safeBranchName === null || safeBranchName === void 0 ? void 0 : safeBranchName.toUpperCase()} CONTENT`;
49
- console.log('\n' + chalk_1.default.bold('='.repeat(80)));
49
+ console.log('\n' + (0, chalk_1.getChalk)().bold('='.repeat(80)));
50
50
  if (branchInfo) {
51
- console.log(chalk_1.default.bold.white(` ${branchInfo}`));
51
+ console.log((0, chalk_1.getChalk)().bold.white(` ${branchInfo}`));
52
52
  }
53
- console.log(chalk_1.default.bold('='.repeat(80)) + '\n');
53
+ console.log((0, chalk_1.getChalk)().bold('='.repeat(80)) + '\n');
54
54
  }
55
55
  /**
56
56
  * Print the final summary for all modules using strategies.
@@ -58,9 +58,13 @@ class CLIProgressManager {
58
58
  * so output is pure timestamped log lines (per documentation).
59
59
  */
60
60
  static printGlobalSummary() {
61
+ var _a;
61
62
  if (!CLIProgressManager.globalSummary) {
62
63
  return;
63
64
  }
65
+ if ((_a = __1.configHandler.get('log')) === null || _a === void 0 ? void 0 : _a.showConsoleLogs) {
66
+ return;
67
+ }
64
68
  // Apply strategy-based corrections before printing
65
69
  CLIProgressManager.applyStrategyCorrections();
66
70
  // Print the final summary
@@ -240,20 +244,20 @@ class CLIProgressManager {
240
244
  this.multiBar = new cli_progress_1.default.MultiBar({
241
245
  clearOnComplete: false,
242
246
  hideCursor: true,
243
- format: ' {label} |' + chalk_1.default.cyan('{bar}') + '| {percentage}% | {value}/{total} | {status}',
247
+ format: ' {label} |' + (0, chalk_1.getChalk)().cyan('{bar}') + '| {percentage}% | {value}/{total} | {status}',
244
248
  barCompleteChar: '\u2588',
245
249
  barIncompleteChar: '\u2591',
246
250
  }, cli_progress_1.default.Presets.shades_classic);
247
251
  if (!this.showConsoleLogs) {
248
- console.log(chalk_1.default.bold.cyan(`\n${this.moduleName}:`));
252
+ console.log((0, chalk_1.getChalk)().bold.cyan(`\n${this.moduleName}:`));
249
253
  }
250
254
  }
251
255
  else if (this.total > 0) {
252
256
  if (!this.showConsoleLogs) {
253
- console.log(chalk_1.default.bold.cyan(`\n${this.moduleName}:`));
257
+ console.log((0, chalk_1.getChalk)().bold.cyan(`\n${this.moduleName}:`));
254
258
  }
255
259
  this.progressBar = new cli_progress_1.default.SingleBar({
256
- format: ' {label} |' + chalk_1.default.cyan('{bar}') + '| {percentage}% | {value}/{total} | {status}',
260
+ format: ' {label} |' + (0, chalk_1.getChalk)().cyan('{bar}') + '| {percentage}% | {value}/{total} | {status}',
257
261
  barCompleteChar: '\u2588',
258
262
  barIncompleteChar: '\u2591',
259
263
  hideCursor: true,
@@ -261,13 +265,13 @@ class CLIProgressManager {
261
265
  const formattedName = this.formatModuleName(this.moduleName);
262
266
  const displayName = formattedName.length > 20 ? formattedName.substring(0, 17) + '...' : formattedName;
263
267
  this.progressBar.start(this.total, 0, {
264
- label: chalk_1.default.gray(` └─ ${displayName}`.padEnd(25)),
265
- status: chalk_1.default.gray('Starting...'),
268
+ label: (0, chalk_1.getChalk)().gray(` └─ ${displayName}`.padEnd(25)),
269
+ status: (0, chalk_1.getChalk)().gray('Starting...'),
266
270
  percentage: ' 0',
267
271
  });
268
272
  }
269
273
  else {
270
- this.spinner = (0, ora_1.default)(`${chalk_1.default.bold(this.moduleName)}: Processing...`).start();
274
+ this.spinner = (0, ora_1.default)(`${(0, chalk_1.getChalk)().bold(this.moduleName)}: Processing...`).start();
271
275
  }
272
276
  }
273
277
  /**
@@ -289,8 +293,8 @@ class CLIProgressManager {
289
293
  const displayName = this.formatProcessName(processName);
290
294
  const indentedLabel = ` ├─ ${displayName}`.padEnd(25);
291
295
  process.progressBar = this.multiBar.create(total, 0, {
292
- label: chalk_1.default.gray(indentedLabel),
293
- status: chalk_1.default.gray('Pending'),
296
+ label: (0, chalk_1.getChalk)().gray(indentedLabel),
297
+ status: (0, chalk_1.getChalk)().gray('Pending'),
294
298
  percentage: ' 0',
295
299
  });
296
300
  }
@@ -326,8 +330,8 @@ class CLIProgressManager {
326
330
  const displayName = this.formatProcessName(processName);
327
331
  const indentedLabel = ` ├─ ${displayName}`.padEnd(25);
328
332
  process.progressBar.update(0, {
329
- label: chalk_1.default.yellow(indentedLabel),
330
- status: chalk_1.default.yellow('Processing'),
333
+ label: (0, chalk_1.getChalk)().yellow(indentedLabel),
334
+ status: (0, chalk_1.getChalk)().yellow('Processing'),
331
335
  percentage: ' 0',
332
336
  });
333
337
  }
@@ -356,12 +360,12 @@ class CLIProgressManager {
356
360
  const percentage = Math.round((totalProcessed / process.total) * 100);
357
361
  const formattedPercentage = this.formatPercentage(percentage);
358
362
  const statusText = success
359
- ? chalk_1.default.green(`✓ Complete (${process.successCount}/${process.current})`)
360
- : chalk_1.default.red(`✗ Failed (${process.successCount}/${process.current})`);
363
+ ? (0, chalk_1.getChalk)().green(`✓ Complete (${process.successCount}/${process.current})`)
364
+ : (0, chalk_1.getChalk)().red(`✗ Failed (${process.successCount}/${process.current})`);
361
365
  const displayName = this.formatProcessName(processName);
362
366
  const indentedLabel = ` ├─ ${displayName}`.padEnd(25);
363
367
  process.progressBar.update(process.total, {
364
- label: success ? chalk_1.default.green(indentedLabel) : chalk_1.default.red(indentedLabel),
368
+ label: success ? (0, chalk_1.getChalk)().green(indentedLabel) : (0, chalk_1.getChalk)().red(indentedLabel),
365
369
  status: statusText,
366
370
  percentage: formattedPercentage,
367
371
  });
@@ -382,8 +386,8 @@ class CLIProgressManager {
382
386
  const displayName = this.formatProcessName(processName);
383
387
  const indentedLabel = ` ├─ ${displayName}`.padEnd(25);
384
388
  process.progressBar.update(process.current, {
385
- label: chalk_1.default.yellow(indentedLabel),
386
- status: chalk_1.default.yellow(message),
389
+ label: (0, chalk_1.getChalk)().yellow(indentedLabel),
390
+ status: (0, chalk_1.getChalk)().yellow(message),
387
391
  percentage: formattedPercentage,
388
392
  });
389
393
  }
@@ -394,13 +398,13 @@ class CLIProgressManager {
394
398
  const formattedName = this.formatModuleName(this.moduleName);
395
399
  const displayName = formattedName.length > 20 ? formattedName.substring(0, 17) + '...' : formattedName;
396
400
  this.progressBar.update(this.progressBar.getProgress() * this.total, {
397
- label: chalk_1.default.yellow(` └─ ${displayName}`.padEnd(25)),
398
- status: chalk_1.default.yellow(message),
401
+ label: (0, chalk_1.getChalk)().yellow(` └─ ${displayName}`.padEnd(25)),
402
+ status: (0, chalk_1.getChalk)().yellow(message),
399
403
  percentage: formattedPercentage,
400
404
  });
401
405
  }
402
406
  else if (this.spinner) {
403
- this.spinner.text = `${chalk_1.default.bold(this.moduleName)}: ${message}`;
407
+ this.spinner.text = `${(0, chalk_1.getChalk)().bold(this.moduleName)}: ${message}`;
404
408
  }
405
409
  }
406
410
  return this;
@@ -444,8 +448,8 @@ class CLIProgressManager {
444
448
  const displayName = this.formatProcessName(targetProcess);
445
449
  const indentedLabel = ` ├─ ${displayName}`.padEnd(25);
446
450
  process.progressBar.increment(1, {
447
- label: chalk_1.default.cyan(indentedLabel),
448
- status: chalk_1.default.cyan(statusText),
451
+ label: (0, chalk_1.getChalk)().cyan(indentedLabel),
452
+ status: (0, chalk_1.getChalk)().cyan(statusText),
449
453
  percentage: formattedPercentage,
450
454
  });
451
455
  }
@@ -461,10 +465,10 @@ class CLIProgressManager {
461
465
  // Show completion status when finished, otherwise show running count
462
466
  const statusText = totalProcessed >= this.total
463
467
  ? this.failureCount === 0
464
- ? chalk_1.default.green(`✓ Complete (${this.successCount}/${totalProcessed})`)
465
- : chalk_1.default.yellow(`✓ Complete (${this.successCount}/${totalProcessed})`)
466
- : chalk_1.default.cyan(`${this.successCount}✓ ${this.failureCount}✗`);
467
- const labelColor = totalProcessed >= this.total ? (this.failureCount === 0 ? chalk_1.default.green : chalk_1.default.yellow) : chalk_1.default.cyan;
468
+ ? (0, chalk_1.getChalk)().green(`✓ Complete (${this.successCount}/${totalProcessed})`)
469
+ : (0, chalk_1.getChalk)().yellow(`✓ Complete (${this.successCount}/${totalProcessed})`)
470
+ : (0, chalk_1.getChalk)().cyan(`${this.successCount}✓ ${this.failureCount}✗`);
471
+ const labelColor = totalProcessed >= this.total ? (this.failureCount === 0 ? (0, chalk_1.getChalk)().green : (0, chalk_1.getChalk)().yellow) : (0, chalk_1.getChalk)().cyan;
468
472
  const formattedName = this.formatModuleName(this.moduleName);
469
473
  const displayName = formattedName.length > 20 ? formattedName.substring(0, 17) + '...' : formattedName;
470
474
  this.progressBar.increment(1, {
@@ -475,7 +479,7 @@ class CLIProgressManager {
475
479
  }
476
480
  else if (this.spinner) {
477
481
  const total = this.successCount + this.failureCount;
478
- this.spinner.text = `${chalk_1.default.bold(this.moduleName)}: ${total} items (${this.successCount}✓ ${this.failureCount}✗)`;
482
+ this.spinner.text = `${(0, chalk_1.getChalk)().bold(this.moduleName)}: ${total} items (${this.successCount}✓ ${this.failureCount}✗)`;
479
483
  }
480
484
  }
481
485
  }
@@ -520,13 +524,13 @@ class CLIProgressManager {
520
524
  }
521
525
  if (!this.enableNestedProgress) {
522
526
  // Simple summary for single progress
523
- this.log('\n' + chalk_1.default.bold(`${this.moduleName} Summary:`));
524
- this.log(`✓ Success: ${chalk_1.default.green(this.successCount)}`);
525
- this.log(`✗ Failures: ${chalk_1.default.red(this.failureCount)}`);
527
+ this.log('\n' + (0, chalk_1.getChalk)().bold(`${this.moduleName} Summary:`));
528
+ this.log(`✓ Success: ${(0, chalk_1.getChalk)().green(this.successCount)}`);
529
+ this.log(`✗ Failures: ${(0, chalk_1.getChalk)().red(this.failureCount)}`);
526
530
  return;
527
531
  }
528
532
  // Detailed summary for nested progress
529
- this.log('\n' + chalk_1.default.bold(`${this.moduleName} Detailed Summary:`));
533
+ this.log('\n' + (0, chalk_1.getChalk)().bold(`${this.moduleName} Detailed Summary:`));
530
534
  for (const [processName, process] of this.processes) {
531
535
  const status = process.status === 'completed'
532
536
  ? '✓'
@@ -546,5 +550,5 @@ class CLIProgressManager {
546
550
  return this.failureCount;
547
551
  }
548
552
  }
549
- exports.default = CLIProgressManager;
550
553
  CLIProgressManager.globalSummary = null;
554
+ exports.default = CLIProgressManager;