cskit-cli 1.0.38 → 1.0.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cskit-cli",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "Content Suite Kit CLI - Download and manage CSK skills from private repository",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -45,129 +45,67 @@ const {
45
45
  // Timeline Display
46
46
  // =============================================================================
47
47
 
48
- const SYMBOLS = {
49
- pending: chalk.dim('◇'),
50
- active: chalk.cyan('◈'),
51
- done: chalk.green('◆'),
52
- error: chalk.red('◆'),
53
- skip: chalk.yellow('◇'),
54
- file: chalk.dim('│ '),
55
- fileNew: chalk.green('│ + '),
56
- fileUpdate: chalk.blue('│ ~ '),
57
- fileSkip: chalk.yellow('│ ! '),
58
- fileDel: chalk.red('│ - '),
59
- branch: chalk.dim('├──'),
60
- branchLast: chalk.dim('└──'),
61
- indent: ' ',
62
- };
63
-
48
+ /**
49
+ * Linear Timeline - shows progress step by step
50
+ * Each step prints its header, then children as they happen
51
+ */
64
52
  class Timeline {
65
53
  constructor() {
66
54
  this.steps = [];
67
55
  this.currentStep = -1;
68
- this.lastLineCount = 0;
69
- this.paused = false; // After prompt, stop full re-renders
70
56
  }
71
57
 
72
58
  addStep(name) {
73
59
  this.steps.push({ name, status: 'pending', children: [] });
74
60
  }
75
61
 
62
+ // Print step header when starting
76
63
  start(stepIndex) {
77
64
  this.currentStep = stepIndex;
78
65
  this.steps[stepIndex].status = 'active';
79
- this.render();
66
+ const num = chalk.dim(`${stepIndex + 1}.`);
67
+ const name = chalk.cyan(this.steps[stepIndex].name);
68
+ console.log(`\n ${num} ${name}`);
80
69
  }
81
70
 
71
+ // Print completion message
82
72
  complete(stepIndex, message = null) {
83
73
  this.steps[stepIndex].status = 'done';
84
- if (message) this.steps[stepIndex].message = message;
85
- this.render();
74
+ if (message) {
75
+ console.log(` ${chalk.dim('└──')} ${chalk.green('✓')} ${chalk.dim(message)}`);
76
+ } else {
77
+ console.log(` ${chalk.dim('└──')} ${chalk.green('✓')} Done`);
78
+ }
86
79
  }
87
80
 
81
+ // Print error message
88
82
  error(stepIndex, message) {
89
83
  this.steps[stepIndex].status = 'error';
90
- this.steps[stepIndex].message = message;
91
- this.render();
84
+ console.log(` ${chalk.dim('└──')} ${chalk.red('✗')} ${message}`);
92
85
  }
93
86
 
87
+ // Print skip message
94
88
  skip(stepIndex, message) {
95
89
  this.steps[stepIndex].status = 'skip';
96
- this.steps[stepIndex].message = message;
97
- this.render();
90
+ console.log(` ${chalk.dim('└──')} ${chalk.yellow('○')} ${message}`);
98
91
  }
99
92
 
93
+ // Print child item immediately
100
94
  addChild(stepIndex, text, type = 'info') {
101
95
  this.steps[stepIndex].children.push({ text, type });
102
- }
103
-
104
- // Call before any prompt - stops full re-renders
105
- pause() {
106
- this.paused = true;
107
- this.lastLineCount = 0;
108
- }
109
-
110
- // Resume after prompt - no separator needed, step headers are enough
111
- resume() {
112
- console.log('');
113
- }
114
-
115
- buildStatusLine(stepIndex) {
116
- const step = this.steps[stepIndex];
117
- const symbol = SYMBOLS[step.status];
118
- const num = chalk.dim(`${stepIndex + 1}.`);
119
- const name = step.status === 'active' ? chalk.cyan(step.name) : step.name;
120
- const msg = step.message ? chalk.dim(` (${step.message})`) : '';
121
- return ` ${symbol} ${num} ${name}${msg}`;
122
- }
123
-
124
- render() {
125
- // After pause, only print current step status (no full timeline)
126
- if (this.paused) {
127
- console.log(this.buildStatusLine(this.currentStep));
128
- return;
129
- }
130
-
131
- const lines = [];
132
- for (let i = 0; i < this.steps.length; i++) {
133
- lines.push(this.buildStatusLine(i));
134
-
135
- const step = this.steps[i];
136
- // Children for non-pending steps
137
- if (step.status !== 'pending') {
138
- for (let j = 0; j < step.children.length; j++) {
139
- const child = step.children[j];
140
- const isLast = j === step.children.length - 1;
141
- const branch = isLast ? SYMBOLS.branchLast : SYMBOLS.branch;
142
- const prefix = child.type === 'new' ? chalk.green('+') :
143
- child.type === 'update' ? chalk.blue('~') :
144
- child.type === 'skip' ? chalk.yellow('!') :
145
- child.type === 'delete' ? chalk.red('-') :
146
- child.type === 'info' ? chalk.cyan('i') :
147
- chalk.dim('•');
148
- lines.push(` ${SYMBOLS.indent}${branch} ${prefix} ${child.text}`);
149
- }
150
- }
151
- }
152
-
153
- // In-place update if have previous output
154
- if (this.lastLineCount > 0) {
155
- process.stdout.write(`\x1b[${this.lastLineCount}A`);
156
- for (let i = 0; i < this.lastLineCount; i++) {
157
- process.stdout.write('\x1b[2K\n');
158
- }
159
- process.stdout.write(`\x1b[${this.lastLineCount}A`);
160
- } else {
161
- console.log('');
162
- }
163
-
164
- for (const line of lines) {
165
- console.log(line);
166
- }
167
- console.log('');
168
-
169
- this.lastLineCount = lines.length + 1;
170
- }
96
+ const prefix = type === 'new' ? chalk.green('+') :
97
+ type === 'update' ? chalk.blue('~') :
98
+ type === 'skip' ? chalk.yellow('!') :
99
+ type === 'delete' ? chalk.red('-') :
100
+ type === 'info' ? chalk.cyan('i') :
101
+ chalk.dim('•');
102
+ console.log(` ${chalk.dim('├──')} ${prefix} ${text}`);
103
+ }
104
+
105
+ // No-op for compatibility
106
+ pause() {}
107
+ resume() { console.log(''); }
108
+ render() {}
171
109
  }
172
110
 
173
111
  // =============================================================================