codebase-snapshot 0.9.7 → 0.9.9

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
@@ -21,6 +21,65 @@ Two versions exist on the registry that are not releases, and both are deprecate
21
21
  Deleting them requires account-level rights that the release pipeline does not have, so they are
22
22
  deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 since it existed.
23
23
 
24
+ ## 0.9.9
25
+
26
+ ### `snapshot -version` now answers the question it was asked
27
+
28
+ Reported from a real terminal, by someone trying to find out which version they had:
29
+
30
+ ```
31
+ > snapshot -version
32
+ ❌ Unknown option '-e'. To specify a positional argument starting with a '-', place it at the
33
+ end of the command after '--', as in '-- "-e"'
34
+ ```
35
+
36
+ That message came from `node:util.parseArgs`, which reads `-version` as the short-flag cluster
37
+ `-v -e -r -s -i -o -n` and objects to the third character. It names something the caller never
38
+ typed, and it buries the actual mistake — one dash where two belong — which is exactly the
39
+ information a usage error exists to give.
40
+
41
+ Every token of that shape is now caught before the parser sees it and answered as a spelling
42
+ problem:
43
+
44
+ ```
45
+ ❌ Unknown option '-version'. Options start with two dashes — did you mean '--version'?
46
+ ```
47
+
48
+ `-cwd`, `-help`, `-format` and `-dry-run` get the same treatment with their own long form
49
+ suggested. A token that is not an option at all (`-frobnicate`) is told to go after `--` instead of
50
+ being pointed at a `--frobnicate` that does not exist, and a cluster of short flags that *are* real
51
+ (`-vh`) still works.
52
+
53
+ ### The update notice suggests the command that fits this copy
54
+
55
+ It said `npm install -g codebase-snapshot` to everybody, which is wrong for two of the three ways
56
+ people run this. `setup` deliberately adds the package as a **devDependency**, where `-g` installs a
57
+ second global copy that shadows the pinned one; an `npx` invocation is a cache entry that the next
58
+ `@latest` run replaces by itself.
59
+
60
+ The suggested command is now derived from the path Node is running: `-g` for a global install,
61
+ `npm install codebase-snapshot@latest` for a dependency of the project being worked in (npm rewrites
62
+ the entry where it already is, so a devDependency stays one), and `npx -y codebase-snapshot@latest`
63
+ for npx. The classification is `_npx` in the path for the cache, and `node_modules` under the
64
+ working directory for a local dependency — evidence rather than a guess.
65
+
66
+ ## 0.9.8
67
+
68
+ ### A wrapped menu no longer changes height under the cursor
69
+
70
+ Found while checking 0.9.7, by rendering it at 48 columns. The wrapping added there made a frame
71
+ the height it claimed to be, but the wrap point was measured from a line's leading whitespace — and
72
+ a selected row starts ` ❯ ` while an unselected one starts ` `. So the same hint wrapped one
73
+ word differently depending on whether the cursor was on it, and at some widths the whole menu grew
74
+ a row as you moved through it.
75
+
76
+ Continuation rows now line up with the *content*: the marker gutter is measured rather than guessed,
77
+ which keeps the wrap stable — and puts a wrapped hint under the label instead of two columns past
78
+ it, which reads better at any width.
79
+
80
+ `tests/wizard-frame.test.js` now also asserts that five repaints of the same menu are all the same
81
+ height, at 48 columns: the width where it used to flicker.
82
+
24
83
  ## 0.9.7
25
84
 
26
85
  ### The setup menu stops eating its own screen
package/README.md CHANGED
@@ -200,7 +200,7 @@ Everything an agent needs is available as data, and the tool can install its own
200
200
  ```bash
201
201
  npx codebase-snapshot describe --format json # contract: workflow, options, exit codes
202
202
  npx codebase-snapshot skill --install # into .claude/skills + .cursor/rules
203
- npx -y codebase-snapshot@0.9.7 mcp # or serve it over MCP
203
+ npx -y codebase-snapshot@0.9.9 mcp # or serve it over MCP
204
204
  ```
205
205
 
206
206
  An agent told only "use `npx codebase-snapshot`" can read the contract, follow its ordered
package/dist/bin.js CHANGED
@@ -4346,7 +4346,7 @@ function gitignorePath(cwd, filePath) {
4346
4346
 
4347
4347
  // src/version.ts
4348
4348
  var GENERATOR_NAME = "codebase-snapshot";
4349
- var GENERATOR_VERSION = "0.9.7";
4349
+ var GENERATOR_VERSION = "0.9.9";
4350
4350
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
4351
4351
  function isOurGeneratorName(name) {
4352
4352
  if (typeof name !== "string") return false;
@@ -4531,13 +4531,15 @@ function displayWidth(line) {
4531
4531
  }
4532
4532
  return width;
4533
4533
  }
4534
+ var GUTTER_PATTERN = /^[ \t]*(?:[❯◆◻◼▏✖][ \t]+)*/;
4534
4535
  function wrapOneLine(line, limit) {
4535
4536
  if (displayWidth(line) <= limit) return [line];
4536
- const indent = /^[ \t]*/.exec(line)?.[0] ?? "";
4537
- const continuation = `${indent} `;
4537
+ const gutter = GUTTER_PATTERN.exec(line)?.[0] ?? "";
4538
+ const gutterWidth = displayWidth(gutter);
4539
+ const continuation = " ".repeat(gutterWidth);
4538
4540
  const rows = [];
4539
- let prefix = indent;
4540
- let rest = line.slice(indent.length).trimEnd();
4541
+ let prefix = gutter;
4542
+ let rest = line.slice(gutter.length).trimEnd();
4541
4543
  while (rest.length > 0) {
4542
4544
  const room = limit - displayWidth(prefix);
4543
4545
  if (room <= 0 || displayWidth(rest) <= room) {
@@ -6955,6 +6957,23 @@ var PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
6955
6957
  var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
6956
6958
  var FAILURE_INTERVAL_MS = 60 * 60 * 1e3;
6957
6959
  var REQUEST_TIMEOUT_MS = 1200;
6960
+ function installKind(scriptPath = process.argv[1] ?? "", cwd = process.cwd()) {
6961
+ const normalise = (value) => value.replace(/\\/g, "/").replace(/\/+$/, "");
6962
+ const script = normalise(scriptPath);
6963
+ if (script === "") return "global";
6964
+ const scriptKey = script.toLowerCase();
6965
+ if (scriptKey.includes("/_npx/")) return "npx";
6966
+ const root = normalise(cwd).toLowerCase();
6967
+ if (scriptKey.includes("/node_modules/") && root !== "" && scriptKey.startsWith(`${root}/`)) {
6968
+ return "local";
6969
+ }
6970
+ return "global";
6971
+ }
6972
+ function updateCommand(kind) {
6973
+ if (kind === "npx") return "npx -y codebase-snapshot@latest";
6974
+ if (kind === "local") return "npm install codebase-snapshot@latest";
6975
+ return "npm install -g codebase-snapshot";
6976
+ }
6958
6977
  function versionParts(value) {
6959
6978
  const core = value.trim().replace(/^v/i, "").split("-")[0];
6960
6979
  return core.split(".").map((part) => {
@@ -7103,9 +7122,9 @@ async function checkForUpdate(options) {
7103
7122
  if (!latest) return null;
7104
7123
  return isNewer(latest, options.current) ? { current: options.current, latest } : null;
7105
7124
  }
7106
- function formatUpdateNotice(notice) {
7125
+ function formatUpdateNotice(notice, kind) {
7107
7126
  return `\u2191 codebase-snapshot ${notice.latest} is available \u2014 you have ${notice.current}.
7108
- npm install -g codebase-snapshot`;
7127
+ ${updateCommand(kind)}`;
7109
7128
  }
7110
7129
 
7111
7130
  // src/index.ts
@@ -11229,7 +11248,27 @@ function parseArtifactList(raw, flag) {
11229
11248
  }
11230
11249
  return names;
11231
11250
  }
11251
+ var SHORT_FLAGS = new Set(
11252
+ Object.values(CLI_OPTIONS).map((spec) => spec.short).filter((short) => typeof short === "string").map((short) => `-${short}`)
11253
+ );
11254
+ function misdashedLongOption(argv) {
11255
+ for (const token of argv) {
11256
+ if (token === "--") break;
11257
+ if (!/^-[A-Za-z][A-Za-z0-9-]+$/.test(token)) continue;
11258
+ if ([...token.slice(1)].every((character) => SHORT_FLAGS.has(`-${character}`))) continue;
11259
+ return token;
11260
+ }
11261
+ return null;
11262
+ }
11232
11263
  function parseCliArgs(argv) {
11264
+ const misdashed = misdashedLongOption(argv);
11265
+ if (misdashed !== null) {
11266
+ const long = `--${misdashed.slice(1)}`;
11267
+ const known = Object.prototype.hasOwnProperty.call(CLI_OPTIONS, misdashed.slice(1));
11268
+ throw new UsageError(
11269
+ known ? `Unknown option '${misdashed}'. Options start with two dashes \u2014 did you mean '${long}'?` : `Unknown option '${misdashed}'. Options start with two dashes; if '${misdashed}' is a path or an argument, put it after '--'.`
11270
+ );
11271
+ }
11233
11272
  let parsed;
11234
11273
  try {
11235
11274
  parsed = parseArgs({
@@ -11811,7 +11850,7 @@ async function main(argv = process.argv.slice(2)) {
11811
11850
  if (pending) {
11812
11851
  const notice = await pending;
11813
11852
  if (notice) process.stderr.write(`
11814
- ${formatUpdateNotice(notice)}
11853
+ ${formatUpdateNotice(notice, installKind())}
11815
11854
  `);
11816
11855
  }
11817
11856
  return code;
@@ -1,4 +1,4 @@
1
- import { GENERATOR_VERSION, MIN_MAX_PART_BYTES, SCHEMA_VERSION, GENERATOR_NAME, ARTIFACT_NAMES, PRESETS, generateSnapshot, validateSnapshot, explainPath, renderExplainText, describeManifestShapeProblem, loadConfigFileDetailed, parseByteSize, resolveConfig } from './chunk-QABL7NRC.js';
1
+ import { GENERATOR_VERSION, MIN_MAX_PART_BYTES, SCHEMA_VERSION, GENERATOR_NAME, ARTIFACT_NAMES, PRESETS, generateSnapshot, validateSnapshot, explainPath, renderExplainText, describeManifestShapeProblem, loadConfigFileDetailed, parseByteSize, resolveConfig } from './chunk-KUVFTJHK.js';
2
2
  import * as fs from 'fs';
3
3
  import * as path2 from 'path';
4
4
 
@@ -2599,5 +2599,5 @@ async function runStdioServer(options) {
2599
2599
  }
2600
2600
 
2601
2601
  export { COMMAND_OPTION_SCOPE, ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, SERVER_INSTRUCTIONS, SKILL_NAME, SUPPORTED_PROTOCOL_VERSIONS, buildAgentContract, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, commandsForOption, createLineReader, createMcpServer, createServer, createSession, createWriter, inspectModernMeta, negotiateLegacyVersion, renderContractText, renderSkill, runStdioServer, validateArguments };
2602
- //# sourceMappingURL=chunk-DPK6ZTOG.js.map
2603
- //# sourceMappingURL=chunk-DPK6ZTOG.js.map
2602
+ //# sourceMappingURL=chunk-HQBEQ67K.js.map
2603
+ //# sourceMappingURL=chunk-HQBEQ67K.js.map
@@ -5474,7 +5474,7 @@ function validateSnapshot(configInput) {
5474
5474
 
5475
5475
  // src/version.ts
5476
5476
  var GENERATOR_NAME = "codebase-snapshot";
5477
- var GENERATOR_VERSION = "0.9.7";
5477
+ var GENERATOR_VERSION = "0.9.9";
5478
5478
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
5479
5479
  function isOurGeneratorName(name) {
5480
5480
  if (typeof name !== "string") return false;
@@ -5484,6 +5484,23 @@ var PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
5484
5484
  var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
5485
5485
  var FAILURE_INTERVAL_MS = 60 * 60 * 1e3;
5486
5486
  var REQUEST_TIMEOUT_MS = 1200;
5487
+ function installKind(scriptPath = process.argv[1] ?? "", cwd = process.cwd()) {
5488
+ const normalise = (value) => value.replace(/\\/g, "/").replace(/\/+$/, "");
5489
+ const script = normalise(scriptPath);
5490
+ if (script === "") return "global";
5491
+ const scriptKey = script.toLowerCase();
5492
+ if (scriptKey.includes("/_npx/")) return "npx";
5493
+ const root = normalise(cwd).toLowerCase();
5494
+ if (scriptKey.includes("/node_modules/") && root !== "" && scriptKey.startsWith(`${root}/`)) {
5495
+ return "local";
5496
+ }
5497
+ return "global";
5498
+ }
5499
+ function updateCommand(kind) {
5500
+ if (kind === "npx") return "npx -y codebase-snapshot@latest";
5501
+ if (kind === "local") return "npm install codebase-snapshot@latest";
5502
+ return "npm install -g codebase-snapshot";
5503
+ }
5487
5504
  function versionParts(value) {
5488
5505
  const core = value.trim().replace(/^v/i, "").split("-")[0];
5489
5506
  return core.split(".").map((part) => {
@@ -5632,9 +5649,9 @@ async function checkForUpdate(options) {
5632
5649
  if (!latest) return null;
5633
5650
  return isNewer(latest, options.current) ? { current: options.current, latest } : null;
5634
5651
  }
5635
- function formatUpdateNotice(notice) {
5652
+ function formatUpdateNotice(notice, kind) {
5636
5653
  return `\u2191 codebase-snapshot ${notice.latest} is available \u2014 you have ${notice.current}.
5637
- npm install -g codebase-snapshot`;
5654
+ ${updateCommand(kind)}`;
5638
5655
  }
5639
5656
  function describeMatcher(matcher) {
5640
5657
  if (typeof matcher === "string") return matcher;
@@ -6250,13 +6267,15 @@ function displayWidth(line) {
6250
6267
  }
6251
6268
  return width;
6252
6269
  }
6270
+ var GUTTER_PATTERN = /^[ \t]*(?:[❯◆◻◼▏✖][ \t]+)*/;
6253
6271
  function wrapOneLine(line, limit) {
6254
6272
  if (displayWidth(line) <= limit) return [line];
6255
- const indent = /^[ \t]*/.exec(line)?.[0] ?? "";
6256
- const continuation = `${indent} `;
6273
+ const gutter = GUTTER_PATTERN.exec(line)?.[0] ?? "";
6274
+ const gutterWidth = displayWidth(gutter);
6275
+ const continuation = " ".repeat(gutterWidth);
6257
6276
  const rows = [];
6258
- let prefix = indent;
6259
- let rest = line.slice(indent.length).trimEnd();
6277
+ let prefix = gutter;
6278
+ let rest = line.slice(gutter.length).trimEnd();
6260
6279
  while (rest.length > 0) {
6261
6280
  const room = limit - displayWidth(prefix);
6262
6281
  if (room <= 0 || displayWidth(rest) <= room) {
@@ -8321,6 +8340,6 @@ async function generateSnapshotAsync(configInput, options) {
8321
8340
  return generateSnapshot(configInput, options);
8322
8341
  }
8323
8342
 
8324
- export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, cacheDirectory, cacheFilePath, checkForUpdate, collectFiles, compareManifests, countInvalidUtf8Bytes, countLines, decodeText, defaultIO, defineConfig, describeManifestShapeProblem, detectLanguage, detectPreset, displayWidth, escapeControls, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findConfigFile, firstRunMessage, formatNumber, formatUpdateNotice, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, isBinaryBuffer, isBinaryExtension, isBinaryFile, isDiscoveryMode, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, shouldCheck, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, unknownPresetMessage, validateSnapshot, wrapLines };
8325
- //# sourceMappingURL=chunk-QABL7NRC.js.map
8326
- //# sourceMappingURL=chunk-QABL7NRC.js.map
8343
+ export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, cacheDirectory, cacheFilePath, checkForUpdate, collectFiles, compareManifests, countInvalidUtf8Bytes, countLines, decodeText, defaultIO, defineConfig, describeManifestShapeProblem, detectLanguage, detectPreset, displayWidth, escapeControls, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findConfigFile, firstRunMessage, formatNumber, formatUpdateNotice, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, installKind, isBinaryBuffer, isBinaryExtension, isBinaryFile, isDiscoveryMode, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, shouldCheck, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, unknownPresetMessage, updateCommand, validateSnapshot, wrapLines };
8344
+ //# sourceMappingURL=chunk-KUVFTJHK.js.map
8345
+ //# sourceMappingURL=chunk-KUVFTJHK.js.map
package/dist/cli.cjs CHANGED
@@ -4340,7 +4340,7 @@ function gitignorePath(cwd, filePath) {
4340
4340
 
4341
4341
  // src/version.ts
4342
4342
  var GENERATOR_NAME = "codebase-snapshot";
4343
- var GENERATOR_VERSION = "0.9.7";
4343
+ var GENERATOR_VERSION = "0.9.9";
4344
4344
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
4345
4345
  function isOurGeneratorName(name) {
4346
4346
  if (typeof name !== "string") return false;
@@ -4518,13 +4518,15 @@ function displayWidth(line) {
4518
4518
  }
4519
4519
  return width;
4520
4520
  }
4521
+ var GUTTER_PATTERN = /^[ \t]*(?:[❯◆◻◼▏✖][ \t]+)*/;
4521
4522
  function wrapOneLine(line, limit) {
4522
4523
  if (displayWidth(line) <= limit) return [line];
4523
- const indent = /^[ \t]*/.exec(line)?.[0] ?? "";
4524
- const continuation = `${indent} `;
4524
+ const gutter = GUTTER_PATTERN.exec(line)?.[0] ?? "";
4525
+ const gutterWidth = displayWidth(gutter);
4526
+ const continuation = " ".repeat(gutterWidth);
4525
4527
  const rows = [];
4526
- let prefix = indent;
4527
- let rest = line.slice(indent.length).trimEnd();
4528
+ let prefix = gutter;
4529
+ let rest = line.slice(gutter.length).trimEnd();
4528
4530
  while (rest.length > 0) {
4529
4531
  const room = limit - displayWidth(prefix);
4530
4532
  if (room <= 0 || displayWidth(rest) <= room) {
@@ -6919,6 +6921,23 @@ var PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
6919
6921
  var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
6920
6922
  var FAILURE_INTERVAL_MS = 60 * 60 * 1e3;
6921
6923
  var REQUEST_TIMEOUT_MS = 1200;
6924
+ function installKind(scriptPath = process.argv[1] ?? "", cwd = process.cwd()) {
6925
+ const normalise = (value) => value.replace(/\\/g, "/").replace(/\/+$/, "");
6926
+ const script = normalise(scriptPath);
6927
+ if (script === "") return "global";
6928
+ const scriptKey = script.toLowerCase();
6929
+ if (scriptKey.includes("/_npx/")) return "npx";
6930
+ const root = normalise(cwd).toLowerCase();
6931
+ if (scriptKey.includes("/node_modules/") && root !== "" && scriptKey.startsWith(`${root}/`)) {
6932
+ return "local";
6933
+ }
6934
+ return "global";
6935
+ }
6936
+ function updateCommand(kind) {
6937
+ if (kind === "npx") return "npx -y codebase-snapshot@latest";
6938
+ if (kind === "local") return "npm install codebase-snapshot@latest";
6939
+ return "npm install -g codebase-snapshot";
6940
+ }
6922
6941
  function versionParts(value) {
6923
6942
  const core = value.trim().replace(/^v/i, "").split("-")[0];
6924
6943
  return core.split(".").map((part) => {
@@ -7067,9 +7086,9 @@ async function checkForUpdate(options) {
7067
7086
  if (!latest) return null;
7068
7087
  return isNewer(latest, options.current) ? { current: options.current, latest } : null;
7069
7088
  }
7070
- function formatUpdateNotice(notice) {
7089
+ function formatUpdateNotice(notice, kind) {
7071
7090
  return `\u2191 codebase-snapshot ${notice.latest} is available \u2014 you have ${notice.current}.
7072
- npm install -g codebase-snapshot`;
7091
+ ${updateCommand(kind)}`;
7073
7092
  }
7074
7093
 
7075
7094
  // src/index.ts
@@ -11182,7 +11201,27 @@ function parseArtifactList(raw, flag) {
11182
11201
  }
11183
11202
  return names;
11184
11203
  }
11204
+ var SHORT_FLAGS = new Set(
11205
+ Object.values(CLI_OPTIONS).map((spec) => spec.short).filter((short) => typeof short === "string").map((short) => `-${short}`)
11206
+ );
11207
+ function misdashedLongOption(argv) {
11208
+ for (const token of argv) {
11209
+ if (token === "--") break;
11210
+ if (!/^-[A-Za-z][A-Za-z0-9-]+$/.test(token)) continue;
11211
+ if ([...token.slice(1)].every((character) => SHORT_FLAGS.has(`-${character}`))) continue;
11212
+ return token;
11213
+ }
11214
+ return null;
11215
+ }
11185
11216
  function parseCliArgs(argv) {
11217
+ const misdashed = misdashedLongOption(argv);
11218
+ if (misdashed !== null) {
11219
+ const long = `--${misdashed.slice(1)}`;
11220
+ const known = Object.prototype.hasOwnProperty.call(CLI_OPTIONS, misdashed.slice(1));
11221
+ throw new UsageError(
11222
+ known ? `Unknown option '${misdashed}'. Options start with two dashes \u2014 did you mean '${long}'?` : `Unknown option '${misdashed}'. Options start with two dashes; if '${misdashed}' is a path or an argument, put it after '--'.`
11223
+ );
11224
+ }
11186
11225
  let parsed;
11187
11226
  try {
11188
11227
  parsed = util.parseArgs({
@@ -11764,7 +11803,7 @@ async function main(argv = process.argv.slice(2)) {
11764
11803
  if (pending) {
11765
11804
  const notice = await pending;
11766
11805
  if (notice) process.stderr.write(`
11767
- ${formatUpdateNotice(notice)}
11806
+ ${formatUpdateNotice(notice, installKind())}
11768
11807
  `);
11769
11808
  }
11770
11809
  return code;
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
- import { buildAgentContract, runStdioServer, COMMAND_OPTION_SCOPE, commandsForOption, SKILL_NAME, renderSkill, renderContractText } from './chunk-DPK6ZTOG.js';
2
- import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, loadConfigFileDetailed, resolveConfig, validateSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, PromptCancelled, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, findConfigFile, firstRunMessage, parseByteSize, gitignorePath, appendGitignoreEntries, escapeControls, MIN_MAX_PART_BYTES, renderExplainText } from './chunk-QABL7NRC.js';
1
+ import { buildAgentContract, runStdioServer, COMMAND_OPTION_SCOPE, commandsForOption, SKILL_NAME, renderSkill, renderContractText } from './chunk-HQBEQ67K.js';
2
+ 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, PromptCancelled, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, findConfigFile, firstRunMessage, parseByteSize, gitignorePath, appendGitignoreEntries, escapeControls, MIN_MAX_PART_BYTES, renderExplainText } from './chunk-KUVFTJHK.js';
3
3
  import { spawnSync } from 'child_process';
4
4
  import * as fs from 'fs';
5
5
  import * as path2 from 'path';
@@ -269,7 +269,27 @@ function parseArtifactList(raw, flag) {
269
269
  }
270
270
  return names;
271
271
  }
272
+ var SHORT_FLAGS = new Set(
273
+ Object.values(CLI_OPTIONS).map((spec) => spec.short).filter((short) => typeof short === "string").map((short) => `-${short}`)
274
+ );
275
+ function misdashedLongOption(argv) {
276
+ for (const token of argv) {
277
+ if (token === "--") break;
278
+ if (!/^-[A-Za-z][A-Za-z0-9-]+$/.test(token)) continue;
279
+ if ([...token.slice(1)].every((character) => SHORT_FLAGS.has(`-${character}`))) continue;
280
+ return token;
281
+ }
282
+ return null;
283
+ }
272
284
  function parseCliArgs(argv) {
285
+ const misdashed = misdashedLongOption(argv);
286
+ if (misdashed !== null) {
287
+ const long = `--${misdashed.slice(1)}`;
288
+ const known = Object.prototype.hasOwnProperty.call(CLI_OPTIONS, misdashed.slice(1));
289
+ throw new UsageError(
290
+ known ? `Unknown option '${misdashed}'. Options start with two dashes \u2014 did you mean '${long}'?` : `Unknown option '${misdashed}'. Options start with two dashes; if '${misdashed}' is a path or an argument, put it after '--'.`
291
+ );
292
+ }
273
293
  let parsed;
274
294
  try {
275
295
  parsed = parseArgs({
@@ -851,7 +871,7 @@ async function main(argv = process.argv.slice(2)) {
851
871
  if (pending) {
852
872
  const notice = await pending;
853
873
  if (notice) process.stderr.write(`
854
- ${formatUpdateNotice(notice)}
874
+ ${formatUpdateNotice(notice, installKind())}
855
875
  `);
856
876
  }
857
877
  return code;
package/dist/index.cjs CHANGED
@@ -5490,7 +5490,7 @@ function validateSnapshot(configInput) {
5490
5490
 
5491
5491
  // src/version.ts
5492
5492
  var GENERATOR_NAME = "codebase-snapshot";
5493
- var GENERATOR_VERSION = "0.9.7";
5493
+ var GENERATOR_VERSION = "0.9.9";
5494
5494
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
5495
5495
  function isOurGeneratorName(name) {
5496
5496
  if (typeof name !== "string") return false;
@@ -5500,6 +5500,23 @@ var PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
5500
5500
  var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
5501
5501
  var FAILURE_INTERVAL_MS = 60 * 60 * 1e3;
5502
5502
  var REQUEST_TIMEOUT_MS = 1200;
5503
+ function installKind(scriptPath = process.argv[1] ?? "", cwd = process.cwd()) {
5504
+ const normalise = (value) => value.replace(/\\/g, "/").replace(/\/+$/, "");
5505
+ const script = normalise(scriptPath);
5506
+ if (script === "") return "global";
5507
+ const scriptKey = script.toLowerCase();
5508
+ if (scriptKey.includes("/_npx/")) return "npx";
5509
+ const root = normalise(cwd).toLowerCase();
5510
+ if (scriptKey.includes("/node_modules/") && root !== "" && scriptKey.startsWith(`${root}/`)) {
5511
+ return "local";
5512
+ }
5513
+ return "global";
5514
+ }
5515
+ function updateCommand(kind) {
5516
+ if (kind === "npx") return "npx -y codebase-snapshot@latest";
5517
+ if (kind === "local") return "npm install codebase-snapshot@latest";
5518
+ return "npm install -g codebase-snapshot";
5519
+ }
5503
5520
  function versionParts(value) {
5504
5521
  const core = value.trim().replace(/^v/i, "").split("-")[0];
5505
5522
  return core.split(".").map((part) => {
@@ -5648,9 +5665,9 @@ async function checkForUpdate(options) {
5648
5665
  if (!latest) return null;
5649
5666
  return isNewer(latest, options.current) ? { current: options.current, latest } : null;
5650
5667
  }
5651
- function formatUpdateNotice(notice) {
5668
+ function formatUpdateNotice(notice, kind) {
5652
5669
  return `\u2191 codebase-snapshot ${notice.latest} is available \u2014 you have ${notice.current}.
5653
- npm install -g codebase-snapshot`;
5670
+ ${updateCommand(kind)}`;
5654
5671
  }
5655
5672
  function describeMatcher(matcher) {
5656
5673
  if (typeof matcher === "string") return matcher;
@@ -6263,13 +6280,15 @@ function displayWidth(line) {
6263
6280
  }
6264
6281
  return width;
6265
6282
  }
6283
+ var GUTTER_PATTERN = /^[ \t]*(?:[❯◆◻◼▏✖][ \t]+)*/;
6266
6284
  function wrapOneLine(line, limit) {
6267
6285
  if (displayWidth(line) <= limit) return [line];
6268
- const indent = /^[ \t]*/.exec(line)?.[0] ?? "";
6269
- const continuation = `${indent} `;
6286
+ const gutter = GUTTER_PATTERN.exec(line)?.[0] ?? "";
6287
+ const gutterWidth = displayWidth(gutter);
6288
+ const continuation = " ".repeat(gutterWidth);
6270
6289
  const rows = [];
6271
- let prefix = indent;
6272
- let rest = line.slice(indent.length).trimEnd();
6290
+ let prefix = gutter;
6291
+ let rest = line.slice(gutter.length).trimEnd();
6273
6292
  while (rest.length > 0) {
6274
6293
  const room = limit - displayWidth(prefix);
6275
6294
  if (room <= 0 || displayWidth(rest) <= room) {
@@ -8376,6 +8395,7 @@ exports.generateSnapshotAsync = generateSnapshotAsync;
8376
8395
  exports.getPreset = getPreset;
8377
8396
  exports.globToRegExp = globToRegExp;
8378
8397
  exports.hasPriorSnapshot = hasPriorSnapshot;
8398
+ exports.installKind = installKind;
8379
8399
  exports.isBinaryBuffer = isBinaryBuffer;
8380
8400
  exports.isBinaryExtension = isBinaryExtension;
8381
8401
  exports.isBinaryFile = isBinaryFile;
@@ -8413,6 +8433,7 @@ exports.summarizeWithProfile = summarizeWithProfile;
8413
8433
  exports.supportsTypeScriptImports = supportsTypeScriptImports;
8414
8434
  exports.truncatePreview = truncatePreview;
8415
8435
  exports.truncateToBytes = truncateToBytes;
8436
+ exports.updateCommand = updateCommand;
8416
8437
  exports.validateSnapshot = validateSnapshot;
8417
8438
  exports.wrapLines = wrapLines;
8418
8439
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -422,7 +422,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
422
422
  * `package.json` carries the same version; `npm run verify` compares the two.
423
423
  */
424
424
  declare const GENERATOR_NAME = "codebase-snapshot";
425
- declare const GENERATOR_VERSION = "0.9.7";
425
+ declare const GENERATOR_VERSION = "0.9.9";
426
426
 
427
427
  /** The one endpoint this package will ever request. */
428
428
  declare const PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
@@ -441,6 +441,22 @@ interface UpdateNotice {
441
441
  current: string;
442
442
  latest: string;
443
443
  }
444
+ /** How the running copy of the tool was reached, which decides how to replace it. */
445
+ type InstallKind = "global" | "local" | "npx";
446
+ /**
447
+ * Classifies the script path Node is running.
448
+ *
449
+ * The notice used to tell everybody to run `npm install -g codebase-snapshot`, and that is wrong
450
+ * for two of the three ways people run this. A repository that added it as a devDependency —
451
+ * which is exactly what `setup` does — does not want a second global copy shadowing its pinned
452
+ * one, and an `npx` invocation is a cache entry that the next `@latest` run replaces by itself.
453
+ *
454
+ * The path is the evidence, because it is available without asking npm anything: `_npx` is npm's
455
+ * own cache directory name, and a local dependency lives under the project's `node_modules`.
456
+ */
457
+ declare function installKind(scriptPath?: string, cwd?: string): InstallKind;
458
+ /** The command that replaces this copy with the published latest. */
459
+ declare function updateCommand(kind: InstallKind): string;
444
460
  interface UpdateCheckOptions {
445
461
  current: string;
446
462
  /** Absolute path to the cache file. */
@@ -473,7 +489,7 @@ declare function fetchLatestVersion(url?: string, timeoutMs?: number): Promise<s
473
489
  */
474
490
  declare function checkForUpdate(options: UpdateCheckOptions): Promise<UpdateNotice | null>;
475
491
  /** The two lines a user sees, or an empty string when there is nothing to say. */
476
- declare function formatUpdateNotice(notice: UpdateNotice): string;
492
+ declare function formatUpdateNotice(notice: UpdateNotice, kind: InstallKind): string;
477
493
 
478
494
  declare const DEFAULT_SECRET_PATTERNS: SecretRule[];
479
495
 
@@ -879,4 +895,4 @@ declare function generateSnapshot(configInput?: SnapshotConfig | ResolvedSnapsho
879
895
  /** Promise-returning wrapper for consumers that prefer an async call site. */
880
896
  declare function generateSnapshotAsync(configInput?: SnapshotConfig | ResolvedSnapshotConfig | null, options?: GenerateOptions): Promise<Manifest>;
881
897
 
882
- export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CliOptions, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, type HeuristicResult, type InitDependency, type InitOptions, type InitResult, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, anchorForPath, assertReplaceable, assertUsableConfigInput, cacheDirectory, cacheFilePath, checkForUpdate, collectFiles, compareManifests, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayWidth, explainPath, fenceForContent, fenceForText, fetchLatestVersion, firstRunMessage, formatUpdateNotice, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, hasPriorSnapshot, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, shouldCheck, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, validateSnapshot, wrapLines };
898
+ export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CliOptions, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, type HeuristicResult, type InitDependency, type InitOptions, type InitResult, type InstallKind, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, anchorForPath, assertReplaceable, assertUsableConfigInput, cacheDirectory, cacheFilePath, checkForUpdate, collectFiles, compareManifests, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayWidth, explainPath, fenceForContent, fenceForText, fetchLatestVersion, firstRunMessage, formatUpdateNotice, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, hasPriorSnapshot, installKind, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, shouldCheck, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, updateCommand, validateSnapshot, wrapLines };
package/dist/index.d.ts CHANGED
@@ -422,7 +422,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
422
422
  * `package.json` carries the same version; `npm run verify` compares the two.
423
423
  */
424
424
  declare const GENERATOR_NAME = "codebase-snapshot";
425
- declare const GENERATOR_VERSION = "0.9.7";
425
+ declare const GENERATOR_VERSION = "0.9.9";
426
426
 
427
427
  /** The one endpoint this package will ever request. */
428
428
  declare const PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
@@ -441,6 +441,22 @@ interface UpdateNotice {
441
441
  current: string;
442
442
  latest: string;
443
443
  }
444
+ /** How the running copy of the tool was reached, which decides how to replace it. */
445
+ type InstallKind = "global" | "local" | "npx";
446
+ /**
447
+ * Classifies the script path Node is running.
448
+ *
449
+ * The notice used to tell everybody to run `npm install -g codebase-snapshot`, and that is wrong
450
+ * for two of the three ways people run this. A repository that added it as a devDependency —
451
+ * which is exactly what `setup` does — does not want a second global copy shadowing its pinned
452
+ * one, and an `npx` invocation is a cache entry that the next `@latest` run replaces by itself.
453
+ *
454
+ * The path is the evidence, because it is available without asking npm anything: `_npx` is npm's
455
+ * own cache directory name, and a local dependency lives under the project's `node_modules`.
456
+ */
457
+ declare function installKind(scriptPath?: string, cwd?: string): InstallKind;
458
+ /** The command that replaces this copy with the published latest. */
459
+ declare function updateCommand(kind: InstallKind): string;
444
460
  interface UpdateCheckOptions {
445
461
  current: string;
446
462
  /** Absolute path to the cache file. */
@@ -473,7 +489,7 @@ declare function fetchLatestVersion(url?: string, timeoutMs?: number): Promise<s
473
489
  */
474
490
  declare function checkForUpdate(options: UpdateCheckOptions): Promise<UpdateNotice | null>;
475
491
  /** The two lines a user sees, or an empty string when there is nothing to say. */
476
- declare function formatUpdateNotice(notice: UpdateNotice): string;
492
+ declare function formatUpdateNotice(notice: UpdateNotice, kind: InstallKind): string;
477
493
 
478
494
  declare const DEFAULT_SECRET_PATTERNS: SecretRule[];
479
495
 
@@ -879,4 +895,4 @@ declare function generateSnapshot(configInput?: SnapshotConfig | ResolvedSnapsho
879
895
  /** Promise-returning wrapper for consumers that prefer an async call site. */
880
896
  declare function generateSnapshotAsync(configInput?: SnapshotConfig | ResolvedSnapshotConfig | null, options?: GenerateOptions): Promise<Manifest>;
881
897
 
882
- export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CliOptions, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, type HeuristicResult, type InitDependency, type InitOptions, type InitResult, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, anchorForPath, assertReplaceable, assertUsableConfigInput, cacheDirectory, cacheFilePath, checkForUpdate, collectFiles, compareManifests, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayWidth, explainPath, fenceForContent, fenceForText, fetchLatestVersion, firstRunMessage, formatUpdateNotice, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, hasPriorSnapshot, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, shouldCheck, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, validateSnapshot, wrapLines };
898
+ export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CliOptions, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, type HeuristicResult, type InitDependency, type InitOptions, type InitResult, type InstallKind, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, anchorForPath, assertReplaceable, assertUsableConfigInput, cacheDirectory, cacheFilePath, checkForUpdate, collectFiles, compareManifests, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayWidth, explainPath, fenceForContent, fenceForText, fetchLatestVersion, firstRunMessage, formatUpdateNotice, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, hasPriorSnapshot, installKind, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, shouldCheck, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, updateCommand, validateSnapshot, wrapLines };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, anchorForPath, assertReplaceable, assertUsableConfigInput, cacheDirectory, cacheFilePath, checkForUpdate, collectFiles, compareManifests, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayWidth, explainPath, fenceForContent, fenceForText, fetchLatestVersion, firstRunMessage, formatUpdateNotice, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, hasPriorSnapshot, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, shouldCheck, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, validateSnapshot, wrapLines } from './chunk-QABL7NRC.js';
1
+ export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, anchorForPath, assertReplaceable, assertUsableConfigInput, cacheDirectory, cacheFilePath, checkForUpdate, collectFiles, compareManifests, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayWidth, explainPath, fenceForContent, fenceForText, fetchLatestVersion, firstRunMessage, formatUpdateNotice, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, hasPriorSnapshot, installKind, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, shouldCheck, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, updateCommand, validateSnapshot, wrapLines } from './chunk-KUVFTJHK.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
package/dist/mcp.cjs CHANGED
@@ -6128,7 +6128,7 @@ function validateSnapshot(configInput) {
6128
6128
 
6129
6129
  // src/version.ts
6130
6130
  var GENERATOR_NAME = "codebase-snapshot";
6131
- var GENERATOR_VERSION = "0.9.7";
6131
+ var GENERATOR_VERSION = "0.9.9";
6132
6132
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
6133
6133
  function isOurGeneratorName(name) {
6134
6134
  if (typeof name !== "string") return false;
package/dist/mcp.js CHANGED
@@ -1,4 +1,4 @@
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, inspectModernMeta, negotiateLegacyVersion, runStdioServer, validateArguments } from './chunk-DPK6ZTOG.js';
2
- import './chunk-QABL7NRC.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, inspectModernMeta, negotiateLegacyVersion, runStdioServer, validateArguments } from './chunk-HQBEQ67K.js';
2
+ import './chunk-KUVFTJHK.js';
3
3
  //# sourceMappingURL=mcp.js.map
4
4
  //# sourceMappingURL=mcp.js.map
package/docs/cli.md CHANGED
@@ -174,7 +174,7 @@ The whole first run in one command, with defaults and no prompts. This is the sa
174
174
  🚀 Setup for: /path/to/repo
175
175
  ✅ Created snapshot.config.ts (preset: nextjs)
176
176
  Added npm scripts: snapshot, snapshot:validate
177
- Added devDependency: codebase-snapshot ^0.9.7
177
+ Added devDependency: codebase-snapshot ^0.9.9
178
178
  Added to .gitignore: snapshot/, snapshot.tmp/
179
179
  ⏳ Installing dependencies…
180
180
  ✅ Installed dependencies (npm install, 2.1s)
@@ -211,7 +211,7 @@ It also has three side effects on files you own, and it says so when it does the
211
211
  ```
212
212
  ✅ Created snapshot.config.ts (preset: node-lib)
213
213
  Added npm scripts: snapshot, snapshot:validate
214
- Added devDependency: codebase-snapshot ^0.9.7
214
+ Added devDependency: codebase-snapshot ^0.9.9
215
215
  Added to .gitignore: snapshot/, snapshot.tmp/
216
216
  ```
217
217
 
@@ -491,10 +491,15 @@ Once a day, after a command finishes, `snapshot` asks the npm registry whether a
491
491
  published and prints two lines on stderr if there is one:
492
492
 
493
493
  ```
494
- ↑ codebase-snapshot 0.9.6 is available — you have 0.9.5.
494
+ ↑ codebase-snapshot 0.9.8 is available — you have 0.9.7.
495
495
  npm install -g codebase-snapshot
496
496
  ```
497
497
 
498
+ The second line names the command that would actually replace *this* copy: `-g` for a global
499
+ install, a plain `npm install codebase-snapshot@latest` when the package is a dependency of the
500
+ project being worked in, and `npx -y codebase-snapshot@latest` when it was reached through `npx` —
501
+ a global install would leave a second copy shadowing the pinned one.
502
+
498
503
  The request goes to `registry.npmjs.org/codebase-snapshot/latest`, carries no identifier of any
499
504
  kind, and its answer is remembered for 24 hours — one request per machine per day at most. It is
500
505
  skipped when stdout is not a terminal, in CI, in any `--format json` run, and in `mcp`, whose server
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.9.7 mcp
13
+ npx -y codebase-snapshot@0.9.9 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.9.7", "mcp", "--cwd", "/absolute/path/to/repo"]
28
+ "args": ["-y", "codebase-snapshot@0.9.9", "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.9.7 mcp --cwd /absolute/path/to/repo
37
+ claude mcp add codebase-snapshot -- npx -y codebase-snapshot@0.9.9 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.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "Pack a codebase for an LLM into budgeted Markdown parts, with a manifest of every file and skip, and validate to prove the snapshot is current.",
5
5
  "keywords": [
6
6
  "codebase",