@vibgrate/cli 1.0.85 → 1.0.87

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,8 +1,8 @@
1
1
  import {
2
2
  baselineCommand,
3
3
  runBaseline
4
- } from "./chunk-MD34DF3S.js";
5
- import "./chunk-IP2AFRZI.js";
4
+ } from "./chunk-2VJCLUTR.js";
5
+ import "./chunk-XCIPC2J7.js";
6
6
  import "./chunk-JQHUH6A3.js";
7
7
  export {
8
8
  baselineCommand,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runScan
3
- } from "./chunk-IP2AFRZI.js";
3
+ } from "./chunk-XCIPC2J7.js";
4
4
  import {
5
5
  writeJsonFile
6
6
  } from "./chunk-JQHUH6A3.js";
@@ -1585,6 +1585,7 @@ function parseNpmMetaPayload(data) {
1585
1585
  var BATCH_SIZE = 24;
1586
1586
  var WINDOWS_MAX_COMMAND_CHARS = 7e3;
1587
1587
  var POSIX_MAX_COMMAND_CHARS = 3e4;
1588
+ var NPM_COMMAND = process.platform === "win32" ? "npm.cmd" : "npm";
1588
1589
  function buildNpmViewChunks(pkgs, platform = process.platform) {
1589
1590
  const maxCommandChars = platform === "win32" ? WINDOWS_MAX_COMMAND_CHARS : POSIX_MAX_COMMAND_CHARS;
1590
1591
  const chunks = [];
@@ -1605,10 +1606,9 @@ function buildNpmViewChunks(pkgs, platform = process.platform) {
1605
1606
  }
1606
1607
  async function npmViewJson(args, cwd) {
1607
1608
  return new Promise((resolve9, reject) => {
1608
- const child = spawn2("npm", ["view", ...args, "--json"], {
1609
+ const child = spawn2(NPM_COMMAND, ["view", ...args, "--json"], {
1609
1610
  cwd,
1610
- stdio: ["ignore", "pipe", "pipe"],
1611
- shell: true
1611
+ stdio: ["ignore", "pipe", "pipe"]
1612
1612
  });
1613
1613
  let out = "";
1614
1614
  let err = "";
@@ -7237,9 +7237,10 @@ var ScanProgress = class {
7237
7237
  };
7238
7238
  spinnerFrame = 0;
7239
7239
  timer = null;
7240
- lastLineCount = 0;
7240
+ lastRowCount = 0;
7241
7241
  startTime = Date.now();
7242
7242
  isTTY;
7243
+ useLiveUpdates;
7243
7244
  rootDir = "";
7244
7245
  /** Last rendered frame content (strip to compare for dirty-checking) */
7245
7246
  lastFrame = "";
@@ -7253,8 +7254,11 @@ var ScanProgress = class {
7253
7254
  stepStartTimes = /* @__PURE__ */ new Map();
7254
7255
  /** Per-step recorded durations (completed steps) */
7255
7256
  stepTimings = [];
7257
+ /** Last emitted step snapshot for append-only output modes */
7258
+ lastLoggedStates = /* @__PURE__ */ new Map();
7256
7259
  constructor(rootDir) {
7257
7260
  this.isTTY = process.stderr.isTTY ?? false;
7261
+ this.useLiveUpdates = this.isTTY && process.env.VIBGRATE_PROGRESS_MODE !== "plain";
7258
7262
  this.rootDir = rootDir;
7259
7263
  if (this.isTTY) {
7260
7264
  const restore = () => {
@@ -7299,7 +7303,9 @@ var ScanProgress = class {
7299
7303
  ""
7300
7304
  ].join("\n") + "\n";
7301
7305
  process.stderr.write(header);
7302
- this.startSpinner();
7306
+ if (this.useLiveUpdates) {
7307
+ this.startSpinner();
7308
+ }
7303
7309
  }
7304
7310
  this.render();
7305
7311
  }
@@ -7391,14 +7397,14 @@ var ScanProgress = class {
7391
7397
  }
7392
7398
  if (this.isTTY) {
7393
7399
  let buf = "";
7394
- if (this.lastLineCount > 0) {
7395
- buf += `\x1B[${this.lastLineCount}A`;
7400
+ if (this.lastRowCount > 0) {
7401
+ buf += `\x1B[${this.lastRowCount}A`;
7396
7402
  buf += "\x1B[J";
7397
7403
  }
7398
7404
  buf += "\x1B[?25h";
7399
7405
  if (buf) process.stderr.write(buf);
7400
7406
  this.cursorHidden = false;
7401
- this.lastLineCount = 0;
7407
+ this.lastRowCount = 0;
7402
7408
  }
7403
7409
  const elapsed = this.formatElapsed(Date.now() - this.startTime);
7404
7410
  const doneCount = this.steps.filter((s) => s.status === "done").length;
@@ -7425,7 +7431,7 @@ var ScanProgress = class {
7425
7431
  clearLines() {
7426
7432
  }
7427
7433
  render() {
7428
- if (!this.isTTY) {
7434
+ if (!this.useLiveUpdates) {
7429
7435
  this.renderCI();
7430
7436
  return;
7431
7437
  }
@@ -7464,18 +7470,48 @@ var ScanProgress = class {
7464
7470
  lines.push(this.renderStats());
7465
7471
  lines.push("");
7466
7472
  const content = lines.join("\n") + "\n";
7467
- if (content === this.lastFrame && this.lastLineCount === lines.length) {
7473
+ const rowCount = this.countRenderedRows(lines);
7474
+ if (content === this.lastFrame && this.lastRowCount === rowCount) {
7468
7475
  return;
7469
7476
  }
7470
7477
  this.lastFrame = content;
7471
7478
  let buf = "";
7472
- if (this.lastLineCount > 0) {
7473
- buf += `\x1B[${this.lastLineCount}A`;
7479
+ if (this.lastRowCount > 0) {
7480
+ buf += `\x1B[${this.lastRowCount}A`;
7474
7481
  buf += "\x1B[J";
7475
7482
  }
7476
7483
  buf += content;
7477
7484
  process.stderr.write(buf);
7478
- this.lastLineCount = lines.length;
7485
+ this.lastRowCount = rowCount;
7486
+ }
7487
+ countRenderedRows(lines) {
7488
+ const columns = Math.max(process.stderr.columns ?? 80, 20);
7489
+ return lines.reduce((total, line) => total + this.countWrappedRows(line, columns), 0);
7490
+ }
7491
+ countWrappedRows(line, columns) {
7492
+ const visibleWidth = Math.max(this.getDisplayWidth(line), 1);
7493
+ return Math.max(1, Math.ceil(visibleWidth / columns));
7494
+ }
7495
+ getDisplayWidth(text) {
7496
+ const clean10 = this.stripAnsi(text).replace(/\r/g, "");
7497
+ let width = 0;
7498
+ for (const char of clean10) {
7499
+ const code = char.codePointAt(0);
7500
+ if (code === void 0) {
7501
+ continue;
7502
+ }
7503
+ if (code >= 0 && code < 32 || code >= 127 && code < 160) {
7504
+ continue;
7505
+ }
7506
+ width += this.isWideCodePoint(code) ? 2 : 1;
7507
+ }
7508
+ return width;
7509
+ }
7510
+ stripAnsi(text) {
7511
+ return text.replace(/\x1b(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\))/g, "");
7512
+ }
7513
+ isWideCodePoint(code) {
7514
+ return code >= 4352 && (code <= 4447 || code === 9001 || code === 9002 || code >= 11904 && code <= 42191 && code !== 12351 || code >= 44032 && code <= 55203 || code >= 63744 && code <= 64255 || code >= 65040 && code <= 65049 || code >= 65072 && code <= 65135 || code >= 65280 && code <= 65376 || code >= 65504 && code <= 65510 || code >= 127744 && code <= 128591 || code >= 129280 && code <= 129535 || code >= 131072 && code <= 262141);
7479
7515
  }
7480
7516
  renderStep(step) {
7481
7517
  const spinner = SPINNER_FRAMES[this.spinnerFrame];
@@ -7538,18 +7574,40 @@ var ScanProgress = class {
7538
7574
  return ` ${chalk4.dim("\u2503")} ${parts.join(chalk4.dim(" \u2502 "))}`;
7539
7575
  }
7540
7576
  /** Simple CI-friendly output (no ANSI rewriting) */
7541
- lastCIStep = null;
7542
7577
  renderCI() {
7543
- const active = this.steps.find((s) => s.status === "active");
7544
- if (active && active.id !== this.lastCIStep) {
7545
- this.lastCIStep = active.id;
7546
- process.stderr.write(` \u25C9 ${active.label}...
7547
- `);
7548
- }
7549
7578
  for (const step of this.steps) {
7550
- if (step.status === "done" && step.id !== this.lastCIStep) {
7579
+ const stateKey = step.status === "done" ? [step.status, step.detail ?? "", step.count?.toString() ?? ""].join("|") : step.status;
7580
+ if (this.lastLoggedStates.get(step.id) === stateKey) {
7581
+ continue;
7551
7582
  }
7583
+ this.lastLoggedStates.set(step.id, stateKey);
7584
+ if (step.status === "active") {
7585
+ process.stderr.write(` \u25C9 ${step.label}...
7586
+ `);
7587
+ continue;
7588
+ }
7589
+ if (step.status === "done") {
7590
+ const detail = this.formatLoggedStepDetail(step);
7591
+ process.stderr.write(` \u2714 ${step.label}${detail}
7592
+ `);
7593
+ continue;
7594
+ }
7595
+ if (step.status === "skipped") {
7596
+ const detail = step.detail ? ` \xB7 ${step.detail}` : "";
7597
+ process.stderr.write(` \u25CC ${step.label}${detail}
7598
+ `);
7599
+ }
7600
+ }
7601
+ }
7602
+ formatLoggedStepDetail(step) {
7603
+ let detail = "";
7604
+ if (step.detail) {
7605
+ detail += ` \xB7 ${step.detail}`;
7606
+ }
7607
+ if (step.count !== void 0 && step.count > 0) {
7608
+ detail += ` (${step.count})`;
7552
7609
  }
7610
+ return detail;
7553
7611
  }
7554
7612
  // ── Time formatting helpers ──
7555
7613
  /**
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  baselineCommand
4
- } from "./chunk-MD34DF3S.js";
4
+ } from "./chunk-2VJCLUTR.js";
5
5
  import {
6
6
  VERSION,
7
7
  computeHmac,
@@ -12,7 +12,7 @@ import {
12
12
  pushCommand,
13
13
  scanCommand,
14
14
  writeDefaultConfig
15
- } from "./chunk-IP2AFRZI.js";
15
+ } from "./chunk-XCIPC2J7.js";
16
16
  import {
17
17
  Semaphore,
18
18
  ensureDir,
@@ -42,7 +42,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
42
42
  console.log(chalk.green("\u2714") + ` Created ${chalk.bold("vibgrate.config.ts")}`);
43
43
  }
44
44
  if (opts.baseline) {
45
- const { runBaseline } = await import("./baseline-GNFZTOFL.js");
45
+ const { runBaseline } = await import("./baseline-QZZXBT74.js");
46
46
  await runBaseline(rootDir);
47
47
  }
48
48
  console.log("");
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  formatText,
6
6
  generateFindings,
7
7
  runScan
8
- } from "./chunk-IP2AFRZI.js";
8
+ } from "./chunk-XCIPC2J7.js";
9
9
  import "./chunk-JQHUH6A3.js";
10
10
  export {
11
11
  computeDriftScore,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibgrate/cli",
3
- "version": "1.0.85",
3
+ "version": "1.0.87",
4
4
  "description": "CLI for measuring upgrade drift across Node, .NET, Python & Java projects",
5
5
  "type": "module",
6
6
  "bin": {