@magicpixelart/cli 0.5.31 → 0.5.32

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/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to `@magicpixelart/cli` will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
+ ## [0.5.32] - 2026-10-05
9
+
10
+ ### Fixed
11
+ - `sync --watch` status lines are clipped to the terminal width, so a long sprite path no longer wraps and leaves the previous status piled on screen.
12
+
8
13
  ## [0.5.31] - 2026-10-01
9
14
 
10
15
  ### Added
@@ -23,7 +23,7 @@ import { maxIsoTimestamp } from '../util/iso.js';
23
23
  import { formatBytes } from '../util/format.js';
24
24
  import { computePreviousKeyOrphans } from '../util/previousKeyOrphans.js';
25
25
  import { cmd } from '../util/invoke.js';
26
- import { formatSlowTickLine, formatWatchSpriteLine, SLOW_TICK_HEARTBEAT_MS } from '../util/watchCopy.js';
26
+ import { fitStatusLine, formatSlowTickLine, formatWatchSpriteLine, SLOW_TICK_HEARTBEAT_MS } from '../util/watchCopy.js';
27
27
  import { canSkipWithoutHashing, decidePull, hasNewExplicitRelease } from '../util/pullDecision.js';
28
28
  import { hasUnpushedLocalEdit } from '../util/localEdit.js';
29
29
  import { shouldReconcile } from '../util/reconcile.js';
@@ -227,7 +227,7 @@ async function watchLoop(opts) {
227
227
  const onStatus = (msg) => {
228
228
  if (opts.quiet)
229
229
  return;
230
- process.stdout.write(`\r\x1b[2K${kleur.dim(`${timestamp()} ${msg}`)}`);
230
+ writeStatusLine(msg);
231
231
  };
232
232
  // Heartbeat: a tick that legitimately takes minutes (huge first pull, slow
233
233
  // link) must not look like the silent hang a timeout-less fetch used to
@@ -307,7 +307,7 @@ async function watchLoop(opts) {
307
307
  printChanges(r, /* indent */ ' ');
308
308
  }
309
309
  else {
310
- process.stdout.write(`\r\x1b[2K${kleur.dim(`${timestamp()} Waiting for edits… (${r.unchanged} up to date)`)}`);
310
+ writeStatusLine(`Waiting for edits… (${r.unchanged} up to date)`);
311
311
  }
312
312
  }
313
313
  catch (e) {
@@ -1575,6 +1575,11 @@ function progressText(done, total, bytes) {
1575
1575
  const bar = '█'.repeat(filled) + '░'.repeat(barWidth - filled);
1576
1576
  return `${bar} ${done}/${total} ${kleur.dim(formatBytes(bytes))}`;
1577
1577
  }
1578
+ /** Rewrite the watcher's single status row, clipped so it never wraps. */
1579
+ function writeStatusLine(msg) {
1580
+ const line = fitStatusLine(`${timestamp()} ${msg}`, process.stdout.columns);
1581
+ process.stdout.write(`\r\x1b[2K${kleur.dim(line)}`);
1582
+ }
1578
1583
  function timestamp() {
1579
1584
  const d = new Date();
1580
1585
  return `[${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}:${String(d.getSeconds()).padStart(2, '0')}]`;
@@ -39,3 +39,19 @@ export function formatSlowTickLine(elapsedSec, lastStatus) {
39
39
  ? `${what} — still working (${elapsed})`
40
40
  : `Still working (${elapsed})`;
41
41
  }
42
+ /**
43
+ * Fit a carriage-return status line to one terminal row. `\r\x1b[2K` only
44
+ * clears the row the cursor is on, so a line that wraps leaves its first rows
45
+ * behind and the next status prints after them (long "Looking through your
46
+ * game sprites… <folder>" lines piled up this way). No width (not a TTY) →
47
+ * unchanged.
48
+ */
49
+ export function fitStatusLine(line, columns) {
50
+ if (!columns || columns < 2)
51
+ return line;
52
+ const max = columns - 1; // leave the last cell free so the cursor can't wrap
53
+ const chars = Array.from(line);
54
+ if (chars.length <= max)
55
+ return line;
56
+ return `${chars.slice(0, max - 1).join('')}…`;
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicpixelart/cli",
3
- "version": "0.5.31",
3
+ "version": "0.5.32",
4
4
  "description": "Sync MagicPixel pixel-art assets to your local project.",
5
5
  "type": "module",
6
6
  "bin": {