kodevu 0.1.18 → 0.1.19

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/progress-ui.js +12 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kodevu",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "description": "Poll SVN revisions or Git commits, send each change diff to a reviewer CLI, and write configurable review reports.",
6
6
  "bin": {
@@ -2,6 +2,7 @@ import readline from "node:readline";
2
2
 
3
3
  const SPINNER_FRAMES = ["|", "/", "-", "\\"];
4
4
  const ELLIPSIS = "...";
5
+ const MIN_DYNAMIC_WIDTH = 60;
5
6
 
6
7
  function clampProgress(value) {
7
8
  if (!Number.isFinite(value)) {
@@ -97,7 +98,7 @@ class ProgressItem {
97
98
  this.active = true;
98
99
  this.stage = stage;
99
100
 
100
- if (!this.display.enabled) {
101
+ if (!this.display.canRenderDynamically()) {
101
102
  this.writeFallback(`... ${this.label}: ${stage}`);
102
103
  return;
103
104
  }
@@ -113,11 +114,12 @@ class ProgressItem {
113
114
  this.stage = stage;
114
115
  }
115
116
 
116
- if (!this.display.enabled) {
117
+ if (!this.display.canRenderDynamically()) {
117
118
  this.writeFallback(`... ${this.label}: ${this.stage}`);
118
119
  return;
119
120
  }
120
121
 
122
+ this.display.start();
121
123
  this.display.activate(this);
122
124
  }
123
125
 
@@ -216,7 +218,7 @@ export class ProgressDisplay {
216
218
  }
217
219
 
218
220
  log(message) {
219
- if (!this.enabled) {
221
+ if (!this.canRenderDynamically()) {
220
222
  this.stream.write(`${message}\n`);
221
223
  return;
222
224
  }
@@ -227,7 +229,7 @@ export class ProgressDisplay {
227
229
  }
228
230
 
229
231
  writeStaticLine(message) {
230
- if (!this.enabled) {
232
+ if (!this.canRenderDynamically()) {
231
233
  this.stream.write(`${message}\n`);
232
234
  return;
233
235
  }
@@ -238,7 +240,8 @@ export class ProgressDisplay {
238
240
  }
239
241
 
240
242
  render() {
241
- if (!this.enabled || !this.currentItem?.active) {
243
+ if (!this.canRenderDynamically() || !this.currentItem?.active) {
244
+ this.clearStatusLine();
242
245
  return;
243
246
  }
244
247
 
@@ -291,6 +294,10 @@ export class ProgressDisplay {
291
294
  return Math.max(columns - 1, 1);
292
295
  }
293
296
 
297
+ canRenderDynamically() {
298
+ return this.enabled && this.getAvailableWidth() >= MIN_DYNAMIC_WIDTH;
299
+ }
300
+
294
301
  handleResize() {
295
302
  if (!this.enabled) {
296
303
  return;