codebase-snapshot 0.12.0 → 0.12.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
@@ -8,8 +8,11 @@ All notable changes to `codebase-snapshot`.
8
8
 
9
9
  This package started its public life as `@ankurhalder/codebase-snapshot`, which reached 4.4.1. It
10
10
  moved to the unscoped name and **restarted at 0.9.0**, so the numbers below are not a continuation of
11
- the old line — `0.9.0` is newer than `4.4.1`, not older. 1.0.0 is reserved for when the CLI surface
12
- is settled.
11
+ the old line — `0.9.0` is newer than `4.4.1`, not older.
12
+
13
+ The line stays at **`0.12.x`**. Every change ships as a patch release: there is no `0.13`, and
14
+ `1.0.0` is not planned. A feature that would normally justify a minor bump is released as
15
+ `0.12.<n+1>` with the same rigour; the number is not the promise, the entry below is.
13
16
 
14
17
  Two versions exist on the registry that are not releases, and both are deprecated:
15
18
 
@@ -23,6 +26,27 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
23
26
 
24
27
  ---
25
28
 
29
+ ## 0.12.1
30
+
31
+ Three defects in the facts 0.12.0 printed about a project, found by reading the artifact as the
32
+ model that receives it:
33
+
34
+ - **The README summary leaked markup.** A centred header wraps the first prose in `<p>` with `<br>`
35
+ and `<code>` inside it, and the brief printed the tags. Markup is now removed before the paragraph
36
+ is found, and heading elements are removed whole — after stripping tags, `<h1>Demo</h1>` became
37
+ the line "Demo", which read as the first paragraph and then ended it at the next blank line, so
38
+ the summary of every such README was its own title.
39
+ - **"Most recent releases" listed prose headings.** `CHANGELOG.md` has a `## A note on version
40
+ numbers`; the brief called it a release. Only version-shaped headings count now.
41
+ - **Commit bodies were cut mid-word.** A 400-character `slice` produced bodies ending in "…and the
42
+ bui…", which reads as a truncated file rather than an edited quotation. They are cut at a sentence
43
+ boundary, fall back to a word boundary, and no longer carry the pipes of a quoted markdown table.
44
+
45
+ Also: "The last 1 commits" is "commit", and two lines that wrapped past 100 columns were reflowed.
46
+
47
+ Nothing else changes; no setting, artifact or manifest field is different.
48
+
49
+ Verified: 1 171 tests, 1 163 pass, 0 fail, 8 host skips; lint 225 files; every gate clean at 0.12.1.
26
50
  ## 0.12.0
27
51
 
28
52
  The brief stops being only generated. Facts can be proved from the repository; judgement cannot,
package/README.md CHANGED
@@ -210,7 +210,7 @@ Everything an agent needs is available as data, and the tool can install its own
210
210
  ```bash
211
211
  npx codebase-snapshot describe --format json # contract: workflow, options, exit codes
212
212
  npx codebase-snapshot skill --install # into .claude/skills + .cursor/rules
213
- npx -y codebase-snapshot@0.12.0 mcp # or serve it over MCP
213
+ npx -y codebase-snapshot@0.12.1 mcp # or serve it over MCP
214
214
  ```
215
215
 
216
216
  An agent told only "use `npx codebase-snapshot`" can read the contract, follow its ordered
package/dist/bin.js CHANGED
@@ -2191,7 +2191,7 @@ function applySpansKeepingQuotes(line, spans) {
2191
2191
 
2192
2192
  // src/version.ts
2193
2193
  var GENERATOR_NAME = "codebase-snapshot";
2194
- var GENERATOR_VERSION = "0.12.0";
2194
+ var GENERATOR_VERSION = "0.12.1";
2195
2195
  var SCHEMA_VERSION = "3.0.0";
2196
2196
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
2197
2197
  function isOurGeneratorName(name) {
@@ -2640,6 +2640,15 @@ function defaultIgnoreReason(relativePath, toolDirNames = DEFAULT_TOOL_DIR_NAMES
2640
2640
  return null;
2641
2641
  }
2642
2642
  var COMMIT_BODY_LIMIT = 400;
2643
+ function truncateAtSentence(text2, limit) {
2644
+ if (text2.length <= limit) return text2;
2645
+ const window = text2.slice(0, limit);
2646
+ const sentence = Math.max(window.lastIndexOf(". "), window.lastIndexOf("; "));
2647
+ if (sentence > limit / 3) return window.slice(0, sentence + 1).trim();
2648
+ const space = window.lastIndexOf(" ");
2649
+ if (space > limit / 3) return window.slice(0, space).trim() + "\u2026";
2650
+ return window.trim() + "\u2026";
2651
+ }
2643
2652
  function recentCommits(cwd, limit = 10) {
2644
2653
  try {
2645
2654
  const stdout = childProcess.execFileSync(
@@ -2658,10 +2667,10 @@ function recentCommits(cwd, limit = 10) {
2658
2667
  const separator = record.indexOf("");
2659
2668
  const subject = separator === -1 ? record : record.slice(0, separator);
2660
2669
  const rawBody = separator === -1 ? "" : record.slice(separator + 1);
2661
- const body = rawBody.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).join(" ");
2670
+ const body = rawBody.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).join(" ").replace(/\s*\|\s*/g, " ").replace(/\s+/g, " ").trim();
2662
2671
  return {
2663
2672
  subject: subject.trim(),
2664
- body: body.length > COMMIT_BODY_LIMIT ? body.slice(0, COMMIT_BODY_LIMIT - 1) + "\u2026" : body
2673
+ body: truncateAtSentence(body, COMMIT_BODY_LIMIT)
2665
2674
  };
2666
2675
  }).filter((commit) => commit.subject.length > 0);
2667
2676
  } catch {
@@ -10109,9 +10118,9 @@ function historySection(history, brief, code) {
10109
10118
  return out;
10110
10119
  }
10111
10120
  out.push(
10112
- "The last " + formatNumber(history.length) + " commit(s), newest first. Subjects and bodies are",
10113
- "claims by whoever wrote them, not evidence - the code beside them is the evidence. If one of",
10114
- "these fixes looks incomplete, quote the lines and say which call site it missed.",
10121
+ "The last " + formatNumber(history.length) + " " + (history.length === 1 ? "commit" : "commits") + ", newest first. Subjects and bodies are claims",
10122
+ "by whoever wrote them, not evidence - the code beside them is the evidence. If one of these",
10123
+ "fixes looks incomplete, quote the lines and say which call site it missed.",
10115
10124
  ""
10116
10125
  );
10117
10126
  for (const commit of history) {
@@ -10375,7 +10384,8 @@ function deliverySection(manifest, partsWritten, slots) {
10375
10384
  );
10376
10385
  if (parts > 1) {
10377
10386
  out.push(
10378
- " Either raise `--max-part-bytes` to merge the parts, or set `--max-parts " + slots + "` and let the parts grow to the count instead."
10387
+ " Either raise `--max-part-bytes` to merge the parts, or set",
10388
+ " `--max-parts " + slots + "` and let the parts grow to the count instead."
10379
10389
  );
10380
10390
  }
10381
10391
  } else {
@@ -10622,13 +10632,13 @@ function readDescription(cwd) {
10622
10632
  function readSummary(cwd) {
10623
10633
  const raw = readText(path13.join(cwd, "README.md"));
10624
10634
  if (raw === null) return {};
10625
- const lines = raw.split(/\r?\n/);
10635
+ const text2 = raw.replace(/<h[1-6][^>]*>[\s\S]*?<\/h[1-6]>/gi, "\n").replace(/<\/(p|div|section|header|footer|li)>/gi, "\n").replace(/<br\s*\/?>/gi, " ").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'");
10626
10636
  const paragraph = [];
10627
- for (const line of lines) {
10637
+ for (const line of text2.split(/\r?\n/)) {
10628
10638
  const trimmed = line.trim();
10629
10639
  if (paragraph.length === 0) {
10630
10640
  if (trimmed.length === 0) continue;
10631
- if (/^#/.test(trimmed) || /^!\[/.test(trimmed) || /^</.test(trimmed) || /^[-*|]/.test(trimmed)) continue;
10641
+ if (/^#/.test(trimmed) || /^!\[/.test(trimmed) || /^[-*|]/.test(trimmed)) continue;
10632
10642
  if (/^\[[^\]]+\]:/.test(trimmed)) continue;
10633
10643
  } else if (trimmed.length === 0 || /^#/.test(trimmed)) {
10634
10644
  break;
@@ -10637,12 +10647,18 @@ function readSummary(cwd) {
10637
10647
  }
10638
10648
  const summary = paragraph.join(" ").replace(/\s+/g, " ").trim();
10639
10649
  if (summary.length === 0) return {};
10640
- return { summary: summary.length > SUMMARY_LIMIT ? summary.slice(0, SUMMARY_LIMIT - 1) + "\u2026" : summary };
10650
+ return { summary: truncate(summary, SUMMARY_LIMIT) };
10651
+ }
10652
+ function truncate(text2, limit) {
10653
+ if (text2.length <= limit) return text2;
10654
+ const window = text2.slice(0, limit);
10655
+ const space = window.lastIndexOf(" ");
10656
+ return (space > limit / 2 ? window.slice(0, space) : window).trim() + "\u2026";
10641
10657
  }
10642
10658
  function readReleases(cwd) {
10643
10659
  const raw = readText(path13.join(cwd, "CHANGELOG.md"));
10644
10660
  if (raw === null) return [];
10645
- const headings = raw.split(/\r?\n/).filter((line) => /^##\s+\S/.test(line)).map((line) => line.replace(/^##\s+/, "").trim());
10661
+ const headings = raw.split(/\r?\n/).map((line) => /^##\s+(.+?)\s*$/.exec(line)?.[1]?.trim()).filter((heading) => heading !== void 0 && /^v?\d+\.\d+/.test(heading));
10646
10662
  return headings.slice(0, MAX_RELEASES);
10647
10663
  }
10648
10664
 
@@ -1,4 +1,4 @@
1
- import { GENERATOR_VERSION, anchorForPath, displayPath, MIN_MAX_PART_BYTES, SCHEMA_VERSION, GENERATOR_NAME, ARTIFACT_NAMES, PRESETS, generateInWorker, validateSnapshot, buildImportResolver, resolveSpecifier, truncateToBytes, explainPath, renderExplainText, describeManifestShapeProblem, loadConfigFileDetailed, parseByteSize, resolveConfig } from './chunk-6HXDYIJS.js';
1
+ import { GENERATOR_VERSION, anchorForPath, displayPath, MIN_MAX_PART_BYTES, SCHEMA_VERSION, GENERATOR_NAME, ARTIFACT_NAMES, PRESETS, generateInWorker, validateSnapshot, buildImportResolver, resolveSpecifier, truncateToBytes, explainPath, renderExplainText, describeManifestShapeProblem, loadConfigFileDetailed, parseByteSize, resolveConfig } from './chunk-H4FSGTEW.js';
2
2
  import * as fs from 'fs';
3
3
  import * as path from 'path';
4
4
 
@@ -3977,7 +3977,7 @@ function applySpansKeepingQuotes(line, spans) {
3977
3977
 
3978
3978
  // src/version.ts
3979
3979
  var GENERATOR_NAME = "codebase-snapshot";
3980
- var GENERATOR_VERSION = "0.12.0";
3980
+ var GENERATOR_VERSION = "0.12.1";
3981
3981
  var SCHEMA_VERSION = "3.0.0";
3982
3982
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
3983
3983
  function isOurGeneratorName(name) {
@@ -4426,6 +4426,15 @@ function defaultIgnoreReason(relativePath, toolDirNames = DEFAULT_TOOL_DIR_NAMES
4426
4426
  return null;
4427
4427
  }
4428
4428
  var COMMIT_BODY_LIMIT = 400;
4429
+ function truncateAtSentence(text2, limit) {
4430
+ if (text2.length <= limit) return text2;
4431
+ const window = text2.slice(0, limit);
4432
+ const sentence = Math.max(window.lastIndexOf(". "), window.lastIndexOf("; "));
4433
+ if (sentence > limit / 3) return window.slice(0, sentence + 1).trim();
4434
+ const space = window.lastIndexOf(" ");
4435
+ if (space > limit / 3) return window.slice(0, space).trim() + "\u2026";
4436
+ return window.trim() + "\u2026";
4437
+ }
4429
4438
  function recentCommits(cwd, limit = 10) {
4430
4439
  try {
4431
4440
  const stdout = childProcess.execFileSync(
@@ -4444,10 +4453,10 @@ function recentCommits(cwd, limit = 10) {
4444
4453
  const separator = record.indexOf("");
4445
4454
  const subject = separator === -1 ? record : record.slice(0, separator);
4446
4455
  const rawBody = separator === -1 ? "" : record.slice(separator + 1);
4447
- const body = rawBody.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).join(" ");
4456
+ const body = rawBody.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).join(" ").replace(/\s*\|\s*/g, " ").replace(/\s+/g, " ").trim();
4448
4457
  return {
4449
4458
  subject: subject.trim(),
4450
- body: body.length > COMMIT_BODY_LIMIT ? body.slice(0, COMMIT_BODY_LIMIT - 1) + "\u2026" : body
4459
+ body: truncateAtSentence(body, COMMIT_BODY_LIMIT)
4451
4460
  };
4452
4461
  }).filter((commit) => commit.subject.length > 0);
4453
4462
  } catch {
@@ -7061,9 +7070,9 @@ function historySection(history, brief, code) {
7061
7070
  return out;
7062
7071
  }
7063
7072
  out.push(
7064
- "The last " + formatNumber(history.length) + " commit(s), newest first. Subjects and bodies are",
7065
- "claims by whoever wrote them, not evidence - the code beside them is the evidence. If one of",
7066
- "these fixes looks incomplete, quote the lines and say which call site it missed.",
7073
+ "The last " + formatNumber(history.length) + " " + (history.length === 1 ? "commit" : "commits") + ", newest first. Subjects and bodies are claims",
7074
+ "by whoever wrote them, not evidence - the code beside them is the evidence. If one of these",
7075
+ "fixes looks incomplete, quote the lines and say which call site it missed.",
7067
7076
  ""
7068
7077
  );
7069
7078
  for (const commit of history) {
@@ -7327,7 +7336,8 @@ function deliverySection(manifest, partsWritten, slots) {
7327
7336
  );
7328
7337
  if (parts > 1) {
7329
7338
  out.push(
7330
- " Either raise `--max-part-bytes` to merge the parts, or set `--max-parts " + slots + "` and let the parts grow to the count instead."
7339
+ " Either raise `--max-part-bytes` to merge the parts, or set",
7340
+ " `--max-parts " + slots + "` and let the parts grow to the count instead."
7331
7341
  );
7332
7342
  }
7333
7343
  } else {
@@ -7865,13 +7875,13 @@ function readDescription(cwd) {
7865
7875
  function readSummary(cwd) {
7866
7876
  const raw = readText(path17.join(cwd, "README.md"));
7867
7877
  if (raw === null) return {};
7868
- const lines = raw.split(/\r?\n/);
7878
+ const text2 = raw.replace(/<h[1-6][^>]*>[\s\S]*?<\/h[1-6]>/gi, "\n").replace(/<\/(p|div|section|header|footer|li)>/gi, "\n").replace(/<br\s*\/?>/gi, " ").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'");
7869
7879
  const paragraph = [];
7870
- for (const line of lines) {
7880
+ for (const line of text2.split(/\r?\n/)) {
7871
7881
  const trimmed = line.trim();
7872
7882
  if (paragraph.length === 0) {
7873
7883
  if (trimmed.length === 0) continue;
7874
- if (/^#/.test(trimmed) || /^!\[/.test(trimmed) || /^</.test(trimmed) || /^[-*|]/.test(trimmed)) continue;
7884
+ if (/^#/.test(trimmed) || /^!\[/.test(trimmed) || /^[-*|]/.test(trimmed)) continue;
7875
7885
  if (/^\[[^\]]+\]:/.test(trimmed)) continue;
7876
7886
  } else if (trimmed.length === 0 || /^#/.test(trimmed)) {
7877
7887
  break;
@@ -7880,12 +7890,18 @@ function readSummary(cwd) {
7880
7890
  }
7881
7891
  const summary = paragraph.join(" ").replace(/\s+/g, " ").trim();
7882
7892
  if (summary.length === 0) return {};
7883
- return { summary: summary.length > SUMMARY_LIMIT ? summary.slice(0, SUMMARY_LIMIT - 1) + "\u2026" : summary };
7893
+ return { summary: truncate(summary, SUMMARY_LIMIT) };
7894
+ }
7895
+ function truncate(text2, limit) {
7896
+ if (text2.length <= limit) return text2;
7897
+ const window = text2.slice(0, limit);
7898
+ const space = window.lastIndexOf(" ");
7899
+ return (space > limit / 2 ? window.slice(0, space) : window).trim() + "\u2026";
7884
7900
  }
7885
7901
  function readReleases(cwd) {
7886
7902
  const raw = readText(path17.join(cwd, "CHANGELOG.md"));
7887
7903
  if (raw === null) return [];
7888
- const headings = raw.split(/\r?\n/).filter((line) => /^##\s+\S/.test(line)).map((line) => line.replace(/^##\s+/, "").trim());
7904
+ const headings = raw.split(/\r?\n/).map((line) => /^##\s+(.+?)\s*$/.exec(line)?.[1]?.trim()).filter((heading) => heading !== void 0 && /^v?\d+\.\d+/.test(heading));
7889
7905
  return headings.slice(0, MAX_RELEASES);
7890
7906
  }
7891
7907
  var LANGUAGE_BY_EXTENSION = {
package/dist/cli.cjs CHANGED
@@ -2220,7 +2220,7 @@ function applySpansKeepingQuotes(line, spans) {
2220
2220
 
2221
2221
  // src/version.ts
2222
2222
  var GENERATOR_NAME = "codebase-snapshot";
2223
- var GENERATOR_VERSION = "0.12.0";
2223
+ var GENERATOR_VERSION = "0.12.1";
2224
2224
  var SCHEMA_VERSION = "3.0.0";
2225
2225
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
2226
2226
  function isOurGeneratorName(name) {
@@ -2669,6 +2669,15 @@ function defaultIgnoreReason(relativePath, toolDirNames = DEFAULT_TOOL_DIR_NAMES
2669
2669
  return null;
2670
2670
  }
2671
2671
  var COMMIT_BODY_LIMIT = 400;
2672
+ function truncateAtSentence(text2, limit) {
2673
+ if (text2.length <= limit) return text2;
2674
+ const window = text2.slice(0, limit);
2675
+ const sentence = Math.max(window.lastIndexOf(". "), window.lastIndexOf("; "));
2676
+ if (sentence > limit / 3) return window.slice(0, sentence + 1).trim();
2677
+ const space = window.lastIndexOf(" ");
2678
+ if (space > limit / 3) return window.slice(0, space).trim() + "\u2026";
2679
+ return window.trim() + "\u2026";
2680
+ }
2672
2681
  function recentCommits(cwd, limit = 10) {
2673
2682
  try {
2674
2683
  const stdout = childProcess__namespace.execFileSync(
@@ -2687,10 +2696,10 @@ function recentCommits(cwd, limit = 10) {
2687
2696
  const separator = record.indexOf("");
2688
2697
  const subject = separator === -1 ? record : record.slice(0, separator);
2689
2698
  const rawBody = separator === -1 ? "" : record.slice(separator + 1);
2690
- const body = rawBody.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).join(" ");
2699
+ const body = rawBody.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).join(" ").replace(/\s*\|\s*/g, " ").replace(/\s+/g, " ").trim();
2691
2700
  return {
2692
2701
  subject: subject.trim(),
2693
- body: body.length > COMMIT_BODY_LIMIT ? body.slice(0, COMMIT_BODY_LIMIT - 1) + "\u2026" : body
2702
+ body: truncateAtSentence(body, COMMIT_BODY_LIMIT)
2694
2703
  };
2695
2704
  }).filter((commit) => commit.subject.length > 0);
2696
2705
  } catch {
@@ -10057,9 +10066,9 @@ function historySection(history, brief, code) {
10057
10066
  return out;
10058
10067
  }
10059
10068
  out.push(
10060
- "The last " + formatNumber(history.length) + " commit(s), newest first. Subjects and bodies are",
10061
- "claims by whoever wrote them, not evidence - the code beside them is the evidence. If one of",
10062
- "these fixes looks incomplete, quote the lines and say which call site it missed.",
10069
+ "The last " + formatNumber(history.length) + " " + (history.length === 1 ? "commit" : "commits") + ", newest first. Subjects and bodies are claims",
10070
+ "by whoever wrote them, not evidence - the code beside them is the evidence. If one of these",
10071
+ "fixes looks incomplete, quote the lines and say which call site it missed.",
10063
10072
  ""
10064
10073
  );
10065
10074
  for (const commit of history) {
@@ -10323,7 +10332,8 @@ function deliverySection(manifest, partsWritten, slots) {
10323
10332
  );
10324
10333
  if (parts > 1) {
10325
10334
  out.push(
10326
- " Either raise `--max-part-bytes` to merge the parts, or set `--max-parts " + slots + "` and let the parts grow to the count instead."
10335
+ " Either raise `--max-part-bytes` to merge the parts, or set",
10336
+ " `--max-parts " + slots + "` and let the parts grow to the count instead."
10327
10337
  );
10328
10338
  }
10329
10339
  } else {
@@ -10566,13 +10576,13 @@ function readDescription(cwd) {
10566
10576
  function readSummary(cwd) {
10567
10577
  const raw = readText(path17__namespace.join(cwd, "README.md"));
10568
10578
  if (raw === null) return {};
10569
- const lines = raw.split(/\r?\n/);
10579
+ const text2 = raw.replace(/<h[1-6][^>]*>[\s\S]*?<\/h[1-6]>/gi, "\n").replace(/<\/(p|div|section|header|footer|li)>/gi, "\n").replace(/<br\s*\/?>/gi, " ").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'");
10570
10580
  const paragraph = [];
10571
- for (const line of lines) {
10581
+ for (const line of text2.split(/\r?\n/)) {
10572
10582
  const trimmed = line.trim();
10573
10583
  if (paragraph.length === 0) {
10574
10584
  if (trimmed.length === 0) continue;
10575
- if (/^#/.test(trimmed) || /^!\[/.test(trimmed) || /^</.test(trimmed) || /^[-*|]/.test(trimmed)) continue;
10585
+ if (/^#/.test(trimmed) || /^!\[/.test(trimmed) || /^[-*|]/.test(trimmed)) continue;
10576
10586
  if (/^\[[^\]]+\]:/.test(trimmed)) continue;
10577
10587
  } else if (trimmed.length === 0 || /^#/.test(trimmed)) {
10578
10588
  break;
@@ -10581,12 +10591,18 @@ function readSummary(cwd) {
10581
10591
  }
10582
10592
  const summary = paragraph.join(" ").replace(/\s+/g, " ").trim();
10583
10593
  if (summary.length === 0) return {};
10584
- return { summary: summary.length > SUMMARY_LIMIT ? summary.slice(0, SUMMARY_LIMIT - 1) + "\u2026" : summary };
10594
+ return { summary: truncate(summary, SUMMARY_LIMIT) };
10595
+ }
10596
+ function truncate(text2, limit) {
10597
+ if (text2.length <= limit) return text2;
10598
+ const window = text2.slice(0, limit);
10599
+ const space = window.lastIndexOf(" ");
10600
+ return (space > limit / 2 ? window.slice(0, space) : window).trim() + "\u2026";
10585
10601
  }
10586
10602
  function readReleases(cwd) {
10587
10603
  const raw = readText(path17__namespace.join(cwd, "CHANGELOG.md"));
10588
10604
  if (raw === null) return [];
10589
- const headings = raw.split(/\r?\n/).filter((line) => /^##\s+\S/.test(line)).map((line) => line.replace(/^##\s+/, "").trim());
10605
+ const headings = raw.split(/\r?\n/).map((line) => /^##\s+(.+?)\s*$/.exec(line)?.[1]?.trim()).filter((heading) => heading !== void 0 && /^v?\d+\.\d+/.test(heading));
10590
10606
  return headings.slice(0, MAX_RELEASES);
10591
10607
  }
10592
10608
  var PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
- import { buildAgentContract, runStdioServer, COMMAND_OPTION_SCOPE, commandsForOption, SKILL_NAME, renderSkill, renderContractText } from './chunk-5FPYVWP3.js';
2
- export { buildAgentContract } from './chunk-5FPYVWP3.js';
3
- import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, loadConfigFileDetailed, resolveConfig, validateSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, runWithStdoutCapture, escapeControls, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderExplainText } from './chunk-6HXDYIJS.js';
1
+ import { buildAgentContract, runStdioServer, COMMAND_OPTION_SCOPE, commandsForOption, SKILL_NAME, renderSkill, renderContractText } from './chunk-BXWV2OXE.js';
2
+ export { buildAgentContract } from './chunk-BXWV2OXE.js';
3
+ import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, loadConfigFileDetailed, resolveConfig, validateSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, runWithStdoutCapture, escapeControls, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderExplainText } from './chunk-H4FSGTEW.js';
4
4
  import { spawnSync } from 'child_process';
5
5
  import * as fs from 'fs';
6
6
  import * as path2 from 'path';
package/dist/index.cjs CHANGED
@@ -3994,7 +3994,7 @@ function applySpansKeepingQuotes(line, spans) {
3994
3994
 
3995
3995
  // src/version.ts
3996
3996
  var GENERATOR_NAME = "codebase-snapshot";
3997
- var GENERATOR_VERSION = "0.12.0";
3997
+ var GENERATOR_VERSION = "0.12.1";
3998
3998
  var SCHEMA_VERSION = "3.0.0";
3999
3999
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
4000
4000
  function isOurGeneratorName(name) {
@@ -4443,6 +4443,15 @@ function defaultIgnoreReason(relativePath, toolDirNames = DEFAULT_TOOL_DIR_NAMES
4443
4443
  return null;
4444
4444
  }
4445
4445
  var COMMIT_BODY_LIMIT = 400;
4446
+ function truncateAtSentence(text2, limit) {
4447
+ if (text2.length <= limit) return text2;
4448
+ const window = text2.slice(0, limit);
4449
+ const sentence = Math.max(window.lastIndexOf(". "), window.lastIndexOf("; "));
4450
+ if (sentence > limit / 3) return window.slice(0, sentence + 1).trim();
4451
+ const space = window.lastIndexOf(" ");
4452
+ if (space > limit / 3) return window.slice(0, space).trim() + "\u2026";
4453
+ return window.trim() + "\u2026";
4454
+ }
4446
4455
  function recentCommits(cwd, limit = 10) {
4447
4456
  try {
4448
4457
  const stdout = childProcess__namespace.execFileSync(
@@ -4461,10 +4470,10 @@ function recentCommits(cwd, limit = 10) {
4461
4470
  const separator = record.indexOf("");
4462
4471
  const subject = separator === -1 ? record : record.slice(0, separator);
4463
4472
  const rawBody = separator === -1 ? "" : record.slice(separator + 1);
4464
- const body = rawBody.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).join(" ");
4473
+ const body = rawBody.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).join(" ").replace(/\s*\|\s*/g, " ").replace(/\s+/g, " ").trim();
4465
4474
  return {
4466
4475
  subject: subject.trim(),
4467
- body: body.length > COMMIT_BODY_LIMIT ? body.slice(0, COMMIT_BODY_LIMIT - 1) + "\u2026" : body
4476
+ body: truncateAtSentence(body, COMMIT_BODY_LIMIT)
4468
4477
  };
4469
4478
  }).filter((commit) => commit.subject.length > 0);
4470
4479
  } catch {
@@ -7056,9 +7065,9 @@ function historySection(history, brief, code) {
7056
7065
  return out;
7057
7066
  }
7058
7067
  out.push(
7059
- "The last " + formatNumber(history.length) + " commit(s), newest first. Subjects and bodies are",
7060
- "claims by whoever wrote them, not evidence - the code beside them is the evidence. If one of",
7061
- "these fixes looks incomplete, quote the lines and say which call site it missed.",
7068
+ "The last " + formatNumber(history.length) + " " + (history.length === 1 ? "commit" : "commits") + ", newest first. Subjects and bodies are claims",
7069
+ "by whoever wrote them, not evidence - the code beside them is the evidence. If one of these",
7070
+ "fixes looks incomplete, quote the lines and say which call site it missed.",
7062
7071
  ""
7063
7072
  );
7064
7073
  for (const commit of history) {
@@ -7322,7 +7331,8 @@ function deliverySection(manifest, partsWritten, slots) {
7322
7331
  );
7323
7332
  if (parts > 1) {
7324
7333
  out.push(
7325
- " Either raise `--max-part-bytes` to merge the parts, or set `--max-parts " + slots + "` and let the parts grow to the count instead."
7334
+ " Either raise `--max-part-bytes` to merge the parts, or set",
7335
+ " `--max-parts " + slots + "` and let the parts grow to the count instead."
7326
7336
  );
7327
7337
  }
7328
7338
  } else {
@@ -7860,13 +7870,13 @@ function readDescription(cwd) {
7860
7870
  function readSummary(cwd) {
7861
7871
  const raw = readText(path17__namespace.join(cwd, "README.md"));
7862
7872
  if (raw === null) return {};
7863
- const lines = raw.split(/\r?\n/);
7873
+ const text2 = raw.replace(/<h[1-6][^>]*>[\s\S]*?<\/h[1-6]>/gi, "\n").replace(/<\/(p|div|section|header|footer|li)>/gi, "\n").replace(/<br\s*\/?>/gi, " ").replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'");
7864
7874
  const paragraph = [];
7865
- for (const line of lines) {
7875
+ for (const line of text2.split(/\r?\n/)) {
7866
7876
  const trimmed = line.trim();
7867
7877
  if (paragraph.length === 0) {
7868
7878
  if (trimmed.length === 0) continue;
7869
- if (/^#/.test(trimmed) || /^!\[/.test(trimmed) || /^</.test(trimmed) || /^[-*|]/.test(trimmed)) continue;
7879
+ if (/^#/.test(trimmed) || /^!\[/.test(trimmed) || /^[-*|]/.test(trimmed)) continue;
7870
7880
  if (/^\[[^\]]+\]:/.test(trimmed)) continue;
7871
7881
  } else if (trimmed.length === 0 || /^#/.test(trimmed)) {
7872
7882
  break;
@@ -7875,12 +7885,18 @@ function readSummary(cwd) {
7875
7885
  }
7876
7886
  const summary = paragraph.join(" ").replace(/\s+/g, " ").trim();
7877
7887
  if (summary.length === 0) return {};
7878
- return { summary: summary.length > SUMMARY_LIMIT ? summary.slice(0, SUMMARY_LIMIT - 1) + "\u2026" : summary };
7888
+ return { summary: truncate(summary, SUMMARY_LIMIT) };
7889
+ }
7890
+ function truncate(text2, limit) {
7891
+ if (text2.length <= limit) return text2;
7892
+ const window = text2.slice(0, limit);
7893
+ const space = window.lastIndexOf(" ");
7894
+ return (space > limit / 2 ? window.slice(0, space) : window).trim() + "\u2026";
7879
7895
  }
7880
7896
  function readReleases(cwd) {
7881
7897
  const raw = readText(path17__namespace.join(cwd, "CHANGELOG.md"));
7882
7898
  if (raw === null) return [];
7883
- const headings = raw.split(/\r?\n/).filter((line) => /^##\s+\S/.test(line)).map((line) => line.replace(/^##\s+/, "").trim());
7899
+ const headings = raw.split(/\r?\n/).map((line) => /^##\s+(.+?)\s*$/.exec(line)?.[1]?.trim()).filter((heading) => heading !== void 0 && /^v?\d+\.\d+/.test(heading));
7884
7900
  return headings.slice(0, MAX_RELEASES);
7885
7901
  }
7886
7902
  var LANGUAGE_BY_EXTENSION = {
package/dist/index.d.cts CHANGED
@@ -548,7 +548,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
548
548
  * `package.json` carries the same version; `npm run verify` compares the two.
549
549
  */
550
550
  declare const GENERATOR_NAME = "codebase-snapshot";
551
- declare const GENERATOR_VERSION = "0.12.0";
551
+ declare const GENERATOR_VERSION = "0.12.1";
552
552
  /**
553
553
  * The manifest and ownership-marker schema this build writes and understands.
554
554
  *
package/dist/index.d.ts CHANGED
@@ -548,7 +548,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
548
548
  * `package.json` carries the same version; `npm run verify` compares the two.
549
549
  */
550
550
  declare const GENERATOR_NAME = "codebase-snapshot";
551
- declare const GENERATOR_VERSION = "0.12.0";
551
+ declare const GENERATOR_VERSION = "0.12.1";
552
552
  /**
553
553
  * The manifest and ownership-marker schema this build writes and understands.
554
554
  *
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, CONFIG_KEYS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, HOOK_MARKER, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, UP_TO_DATE_INTERVAL_MS, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, workerEntry, wrapLines } from './chunk-6HXDYIJS.js';
1
+ export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, CONFIG_KEYS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, HOOK_MARKER, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, UP_TO_DATE_INTERVAL_MS, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, workerEntry, wrapLines } from './chunk-H4FSGTEW.js';
package/dist/mcp.cjs CHANGED
@@ -2522,7 +2522,7 @@ function applySpansKeepingQuotes(line, spans) {
2522
2522
 
2523
2523
  // src/version.ts
2524
2524
  var GENERATOR_NAME = "codebase-snapshot";
2525
- var GENERATOR_VERSION = "0.12.0";
2525
+ var GENERATOR_VERSION = "0.12.1";
2526
2526
  var SCHEMA_VERSION = "3.0.0";
2527
2527
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
2528
2528
  function isOurGeneratorName(name) {
package/dist/mcp.js CHANGED
@@ -1,2 +1,2 @@
1
- export { ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, inspectModernMeta, negotiateLegacyVersion, parsePartSections, runStdioServer, validateArguments, windowText } from './chunk-5FPYVWP3.js';
2
- export { generateInWorker } from './chunk-6HXDYIJS.js';
1
+ export { ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, inspectModernMeta, negotiateLegacyVersion, parsePartSections, runStdioServer, validateArguments, windowText } from './chunk-BXWV2OXE.js';
2
+ export { generateInWorker } from './chunk-H4FSGTEW.js';
package/docs/cli.md CHANGED
@@ -97,7 +97,7 @@ Exit `0` when the snapshot passes its own integrity check, `1` when it does not.
97
97
 
98
98
  ```
99
99
  📸 Generating snapshot for: /path/to/repo
100
- Branch: main | Part budget: 300 KB | Generator: 0.12.0 (project dependency ^0.12.0)
100
+ Branch: main | Part budget: 300 KB | Generator: 0.12.1 (project dependency ^0.12.1)
101
101
 
102
102
  ✅ Snapshot generated in 0.14s:
103
103
  - Tracked files: 121 included of 128 paths found — 7 skipped (default-ignore 5, binary 1, sensitive-file 1); every one is listed in snapshot/reports/audit.md
@@ -192,7 +192,7 @@ The whole first run in one command, with defaults and no prompts. This is the sa
192
192
  🚀 Setup for: /path/to/repo
193
193
  ✅ Created snapshot.config.ts (preset: nextjs)
194
194
  Added npm scripts: snapshot, snapshot:validate
195
- Added devDependency: codebase-snapshot ^0.12.0
195
+ Added devDependency: codebase-snapshot ^0.12.1
196
196
  Added to .gitignore: /snapshot/, /snapshot.tmp/
197
197
  ⏳ Installing dependencies…
198
198
  ✅ Installed dependencies (npm install, 2.1s)
@@ -244,7 +244,7 @@ It also has three side effects on files you own, and it says so when it does the
244
244
  ```
245
245
  ✅ Created snapshot.config.ts (preset: node-lib)
246
246
  Added npm scripts: snapshot, snapshot:validate
247
- Added devDependency: codebase-snapshot ^0.12.0
247
+ Added devDependency: codebase-snapshot ^0.12.1
248
248
  Added to .gitignore: /snapshot/, /snapshot.tmp/
249
249
  ```
250
250
 
package/docs/mcp.md CHANGED
@@ -10,7 +10,7 @@ walk — that the client sees.
10
10
  ## Start it
11
11
 
12
12
  ```bash
13
- npx -y codebase-snapshot@0.12.0 mcp
13
+ npx -y codebase-snapshot@0.12.1 mcp
14
14
  ```
15
15
 
16
16
  The server serves the directory it was started in. `--cwd <path>` points it elsewhere, and that
@@ -25,7 +25,7 @@ Claude Desktop and Cursor:
25
25
  "mcpServers": {
26
26
  "codebase-snapshot": {
27
27
  "command": "npx",
28
- "args": ["-y", "codebase-snapshot@0.12.0", "mcp", "--cwd", "/absolute/path/to/repo"]
28
+ "args": ["-y", "codebase-snapshot@0.12.1", "mcp", "--cwd", "/absolute/path/to/repo"]
29
29
  }
30
30
  }
31
31
  }
@@ -34,7 +34,7 @@ Claude Desktop and Cursor:
34
34
  Claude Code registers the same thing from a shell:
35
35
 
36
36
  ```bash
37
- claude mcp add codebase-snapshot -- npx -y codebase-snapshot@0.12.0 mcp --cwd /absolute/path/to/repo
37
+ claude mcp add codebase-snapshot -- npx -y codebase-snapshot@0.12.1 mcp --cwd /absolute/path/to/repo
38
38
  ```
39
39
 
40
40
  On Windows, wrap the command as `cmd /c npx` with the same arguments — `npx` is a `.cmd` shim
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-snapshot",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Create a codebase snapshot an LLM can read: budgeted Markdown parts for Claude, ChatGPT and Cursor, a manifest of every included and skipped file, secret redaction, and validate, which fails when the snapshot drifts. Local CLI and MCP server.",
5
5
  "keywords": [
6
6
  "codebase-snapshot",