@steipete/summarize 0.7.0 → 0.7.1

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
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.1 - 2025-12-26
4
+
5
+ ### Fixed
6
+
7
+ - Packaging: `@steipete/summarize-core` now ships a CJS build for `require()` consumers (fixes `pnpm dlx @steipete/summarize --help` and the published CLI runtime).
8
+
3
9
  ## 0.7.0 - 2025-12-26
4
10
 
5
11
  ### Highlights
package/dist/cli.cjs CHANGED
@@ -54102,7 +54102,7 @@ function parseRetriesArg(raw) {
54102
54102
  var import_node_fs = __toESM(require("node:fs"), 1);
54103
54103
  var import_node_path = __toESM(require("node:path"), 1);
54104
54104
  var import_node_url = require("node:url");
54105
- var FALLBACK_VERSION = "0.7.0";
54105
+ var FALLBACK_VERSION = "0.7.1";
54106
54106
  function resolvePackageVersion(importMetaUrl) {
54107
54107
  const injected = typeof process !== "undefined" && typeof process.env.SUMMARIZE_VERSION === "string" ? process.env.SUMMARIZE_VERSION.trim() : "";
54108
54108
  if (injected.length > 0) return injected;
@@ -54177,7 +54177,7 @@ function resolveGitShaFromGitDir(gitDir) {
54177
54177
  return null;
54178
54178
  }
54179
54179
  function resolveGitSha(importMetaUrl) {
54180
- const injected = typeof process !== "undefined" && true ? "a2915dbb".trim() : "";
54180
+ const injected = typeof process !== "undefined" && true ? "2d0a7c01".trim() : "";
54181
54181
  if (injected.length > 0) return truncateSha(injected);
54182
54182
  const startDir = (() => {
54183
54183
  if (typeof importMetaUrl === "string" && importMetaUrl.trim().length > 0) {
@@ -63656,13 +63656,23 @@ function startSpinner({
63656
63656
  stream
63657
63657
  }) {
63658
63658
  if (!enabled) {
63659
- return { stop: () => {
63660
- }, clear: () => {
63661
- }, stopAndClear: () => {
63662
- }, setText: () => {
63663
- } };
63659
+ return {
63660
+ stop: () => {
63661
+ },
63662
+ clear: () => {
63663
+ },
63664
+ pause: () => {
63665
+ },
63666
+ resume: () => {
63667
+ },
63668
+ stopAndClear: () => {
63669
+ },
63670
+ setText: () => {
63671
+ }
63672
+ };
63664
63673
  }
63665
- let stopped = false;
63674
+ let ended = false;
63675
+ let paused = false;
63666
63676
  const oraStream = stream;
63667
63677
  if (typeof oraStream.cursorTo !== "function") oraStream.cursorTo = () => {
63668
63678
  };
@@ -63671,25 +63681,39 @@ function startSpinner({
63671
63681
  if (typeof oraStream.moveCursor !== "function") oraStream.moveCursor = () => {
63672
63682
  };
63673
63683
  const clear = () => {
63674
- if (stopped) return;
63684
+ if (ended) return;
63675
63685
  spinner.clear();
63676
63686
  stream.write("\r\x1B[2K");
63677
63687
  };
63688
+ const pause = () => {
63689
+ if (ended || paused) return;
63690
+ paused = true;
63691
+ if (spinner.isSpinning) spinner.stop();
63692
+ spinner.clear();
63693
+ stream.write("\r\x1B[2K");
63694
+ };
63695
+ const resume = () => {
63696
+ if (ended || !paused) return;
63697
+ paused = false;
63698
+ spinner.start();
63699
+ };
63678
63700
  const stop = () => {
63679
- if (stopped) return;
63680
- stopped = true;
63701
+ if (ended) return;
63702
+ ended = true;
63681
63703
  if (spinner.isSpinning) spinner.stop();
63682
63704
  };
63683
63705
  const stopAndClear = () => {
63684
- if (stopped) return;
63685
- stop();
63706
+ if (ended) return;
63707
+ ended = true;
63708
+ paused = false;
63709
+ if (spinner.isSpinning) spinner.stop();
63686
63710
  spinner.clear();
63687
63711
  stream.write("\r\x1B[2K");
63688
63712
  };
63689
63713
  const setText = (next) => {
63690
- if (stopped) return;
63714
+ if (ended) return;
63691
63715
  spinner.text = next;
63692
- spinner.render?.();
63716
+ if (!paused) spinner.render?.();
63693
63717
  };
63694
63718
  const spinner = ora({
63695
63719
  text: text5,
@@ -63699,7 +63723,7 @@ function startSpinner({
63699
63723
  color: "cyan",
63700
63724
  discardStdin: true
63701
63725
  }).start();
63702
- return { stop, clear, stopAndClear, setText };
63726
+ return { stop, clear, pause, resume, stopAndClear, setText };
63703
63727
  }
63704
63728
 
63705
63729
  // src/run/attachments.ts
@@ -63862,7 +63886,11 @@ async function handleFileInput(ctx, inputTarget) {
63862
63886
  spinner.stopAndClear();
63863
63887
  stopOscProgress();
63864
63888
  };
63865
- ctx.setClearProgressBeforeStdout(stopProgress);
63889
+ const clearProgressLine = () => {
63890
+ spinner.pause();
63891
+ queueMicrotask(() => spinner.resume());
63892
+ };
63893
+ ctx.setClearProgressBeforeStdout(clearProgressLine);
63866
63894
  try {
63867
63895
  const loaded = await loadLocalAsset({ filePath: inputTarget.filePath });
63868
63896
  assertAssetMediaTypeSupported({ attachment: loaded.attachment, sizeLabel });
@@ -63888,7 +63916,7 @@ async function handleFileInput(ctx, inputTarget) {
63888
63916
  });
63889
63917
  return true;
63890
63918
  } finally {
63891
- ctx.clearProgressIfCurrent(stopProgress);
63919
+ ctx.clearProgressIfCurrent(clearProgressLine);
63892
63920
  stopProgress();
63893
63921
  }
63894
63922
  }
@@ -63915,7 +63943,11 @@ async function handleUrlAsset(ctx, url2, isYoutubeUrl) {
63915
63943
  spinner.stopAndClear();
63916
63944
  stopOscProgress();
63917
63945
  };
63918
- ctx.setClearProgressBeforeStdout(stopProgress);
63946
+ const clearProgressLine = () => {
63947
+ spinner.pause();
63948
+ queueMicrotask(() => spinner.resume());
63949
+ };
63950
+ ctx.setClearProgressBeforeStdout(clearProgressLine);
63919
63951
  try {
63920
63952
  const loaded = await (async () => {
63921
63953
  try {
@@ -63941,7 +63973,7 @@ async function handleUrlAsset(ctx, url2, isYoutubeUrl) {
63941
63973
  });
63942
63974
  return true;
63943
63975
  } finally {
63944
- ctx.clearProgressIfCurrent(stopProgress);
63976
+ ctx.clearProgressIfCurrent(clearProgressLine);
63945
63977
  stopProgress();
63946
63978
  }
63947
63979
  }
@@ -76170,8 +76202,36 @@ function materializeInlineMarkdownLinks(markdown) {
76170
76202
  }
76171
76203
  return out.join("\n");
76172
76204
  }
76205
+ function collapseExtraBlankLines(markdown) {
76206
+ const lines = markdown.split(/\r?\n/);
76207
+ let inFence = false;
76208
+ let blankRun = 0;
76209
+ const out = [];
76210
+ for (const line of lines) {
76211
+ const trimmed = line.trimStart();
76212
+ if (trimmed.startsWith("```")) {
76213
+ inFence = !inFence;
76214
+ blankRun = 0;
76215
+ out.push(line);
76216
+ continue;
76217
+ }
76218
+ if (inFence) {
76219
+ blankRun = 0;
76220
+ out.push(line);
76221
+ continue;
76222
+ }
76223
+ if (line.trim().length === 0) {
76224
+ blankRun += 1;
76225
+ if (blankRun === 1) out.push("");
76226
+ continue;
76227
+ }
76228
+ blankRun = 0;
76229
+ out.push(line);
76230
+ }
76231
+ return out.join("\n");
76232
+ }
76173
76233
  function prepareMarkdownForTerminalStreaming(markdown) {
76174
- return materializeInlineMarkdownLinks(markdown);
76234
+ return collapseExtraBlankLines(materializeInlineMarkdownLinks(markdown));
76175
76235
  }
76176
76236
  function inlineReferenceStyleLinks(markdown) {
76177
76237
  const lines = markdown.split(/\r?\n/);
@@ -76201,7 +76261,9 @@ function inlineReferenceStyleLinks(markdown) {
76201
76261
  return withoutDefinitions;
76202
76262
  }
76203
76263
  function prepareMarkdownForTerminal(markdown) {
76204
- return materializeInlineMarkdownLinks(inlineReferenceStyleLinks(markdown));
76264
+ return collapseExtraBlankLines(
76265
+ materializeInlineMarkdownLinks(inlineReferenceStyleLinks(markdown))
76266
+ );
76205
76267
  }
76206
76268
 
76207
76269
  // src/run/model-attempts.ts
@@ -78147,7 +78209,12 @@ async function runUrlFlow({
78147
78209
  spinner.stopAndClear();
78148
78210
  oscProgress.clear();
78149
78211
  };
78150
- ctx.setClearProgressBeforeStdout(stopProgress);
78212
+ const clearProgressLine = () => {
78213
+ spinner.pause();
78214
+ oscProgress.clear();
78215
+ queueMicrotask(() => spinner.resume());
78216
+ };
78217
+ ctx.setClearProgressBeforeStdout(clearProgressLine);
78151
78218
  try {
78152
78219
  let extracted = await fetchLinkContentWithBirdTip({
78153
78220
  client,
@@ -78280,7 +78347,7 @@ async function runUrlFlow({
78280
78347
  onModelChosen
78281
78348
  });
78282
78349
  } finally {
78283
- ctx.clearProgressIfCurrent(stopProgress);
78350
+ ctx.clearProgressIfCurrent(clearProgressLine);
78284
78351
  stopProgress();
78285
78352
  }
78286
78353
  }
@@ -78293,9 +78360,7 @@ function createProgressGate() {
78293
78360
  clearFn = fn;
78294
78361
  },
78295
78362
  clearProgressForStdout: () => {
78296
- const fn = clearFn;
78297
- clearFn = null;
78298
- fn?.();
78363
+ clearFn?.();
78299
78364
  },
78300
78365
  clearProgressIfCurrent: (fn) => {
78301
78366
  if (clearFn === fn) {
@@ -79872,9 +79937,10 @@ function createSummaryEngine(deps) {
79872
79937
  if (lastNl >= 0 && lastNl + 1 > plainFlushedLen) {
79873
79938
  if (!cleared) {
79874
79939
  deps.clearProgressForStdout();
79875
- deps.stdout.write("\n");
79940
+ deps.stdout.write("\n\n");
79876
79941
  cleared = true;
79877
79942
  }
79943
+ deps.clearProgressForStdout();
79878
79944
  deps.stdout.write(streamed.slice(plainFlushedLen, lastNl + 1));
79879
79945
  plainFlushedLen = lastNl + 1;
79880
79946
  }
@@ -79883,17 +79949,16 @@ function createSummaryEngine(deps) {
79883
79949
  if (shouldStreamRenderedMarkdownToStdout && streamer) {
79884
79950
  const out = streamer.push(merged.appended);
79885
79951
  if (out) {
79886
- if (!cleared) {
79887
- deps.clearProgressForStdout();
79888
- cleared = true;
79889
- }
79952
+ deps.clearProgressForStdout();
79890
79953
  if (!wroteLeadingBlankLine) {
79891
79954
  deps.stdout.write(`
79955
+
79892
79956
  ${out.replace(/^\n+/, "")}`);
79893
79957
  wroteLeadingBlankLine = true;
79894
79958
  } else {
79895
79959
  deps.stdout.write(out);
79896
79960
  }
79961
+ cleared = true;
79897
79962
  }
79898
79963
  }
79899
79964
  }
@@ -79907,6 +79972,7 @@ ${out.replace(/^\n+/, "")}`);
79907
79972
  deps.clearProgressForStdout();
79908
79973
  if (!wroteLeadingBlankLine) {
79909
79974
  deps.stdout.write(`
79975
+
79910
79976
  ${out.replace(/^\n+/, "")}`);
79911
79977
  wroteLeadingBlankLine = true;
79912
79978
  } else {