codebase-snapshot 0.10.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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-5AV7OR3J.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-NJ75RVHO.js';
2
2
  import * as fs from 'fs';
3
3
  import * as path from 'path';
4
4
 
@@ -1440,6 +1440,7 @@ var VALIDATE_OPTIONS = [
1440
1440
  "max-part-tokens",
1441
1441
  "large-file-bytes",
1442
1442
  "max-monolith-bytes",
1443
+ "max-parts",
1443
1444
  "include-monolith",
1444
1445
  "include-sensitive-files",
1445
1446
  "skip-artifacts",
@@ -1465,6 +1466,8 @@ var COMMAND_OPTION_SCOPE = {
1465
1466
  "max-part-tokens",
1466
1467
  "large-file-bytes",
1467
1468
  "max-monolith-bytes",
1469
+ "attachment-slots",
1470
+ "max-parts",
1468
1471
  "include-monolith",
1469
1472
  "include-sensitive-files",
1470
1473
  "skip-artifacts",
@@ -1610,6 +1613,7 @@ var PACKAGE_NAME = "codebase-snapshot";
1610
1613
  var MAJOR_VERSION = GENERATOR_VERSION.split(".")[0];
1611
1614
  var ARTIFACT_SUMMARY = {
1612
1615
  readme: "README.md describing the snapshot at the output root.",
1616
+ prompt: "PROMPT.md: the instruction sheet to paste with the snapshot, rendered from its manifest.",
1613
1617
  manifest: "manifest.json: machine-readable index of every file, part, hash and config.",
1614
1618
  parts: "parts/*.md: the packed, budget-limited markdown parts that carry the code.",
1615
1619
  navigation: "reports/navigation.md: links between parts and layers.",
@@ -1619,6 +1623,7 @@ var ARTIFACT_SUMMARY = {
1619
1623
  };
1620
1624
  var ARTIFACT_DEFAULTS = {
1621
1625
  readme: true,
1626
+ prompt: true,
1622
1627
  manifest: true,
1623
1628
  parts: true,
1624
1629
  navigation: true,
@@ -1759,9 +1764,9 @@ function buildAgentContract() {
1759
1764
  {
1760
1765
  step: 6,
1761
1766
  id: "consume",
1762
- run: "read ./snapshot/parts/*.md, then ./snapshot/manifest.json, then ./snapshot/reports/audit.md",
1767
+ run: "read ./snapshot/PROMPT.md first, then ./snapshot/parts/*.md, ./snapshot/manifest.json and ./snapshot/reports/audit.md",
1763
1768
  expect: "the code, the index of what was included, and the risk findings",
1764
- notes: "manifest.json.files[] lists every included file with layer, kind, language, part and summary. manifest.skipped[] explains every file that was left out and why; manifest.incomplete[] lists every included file that is not present in full, with its missing line ranges."
1769
+ notes: "manifest.json.files[] lists every included file with layer, kind, language, part and summary. manifest.skipped[] explains every file that was left out and why; manifest.incomplete[] lists every included file that is not present in full, with its missing line ranges. PROMPT.md is the instruction sheet for whoever reads the snapshot; it is rendered from the manifest, so it names this run's omissions rather than describing snapshots in general."
1765
1770
  }
1766
1771
  ],
1767
1772
  commands: [
@@ -1898,6 +1903,20 @@ function buildAgentContract() {
1898
1903
  appliesTo: optionAppliesTo("discovery"),
1899
1904
  summary: "How files are discovered: auto (git when usable), git (require git), walk (read .gitignore files directly, including nested ones; the escape hatch for a .git that cannot be listed)."
1900
1905
  },
1906
+ {
1907
+ flag: "--attachment-slots",
1908
+ type: "number",
1909
+ default: "10",
1910
+ appliesTo: optionAppliesTo("attachment-slots"),
1911
+ summary: "Files the destination accepts in one message (0 = no limit). PROMPT.md plans the delivery against it: which parts to attach, what to leave behind, and the part budget that would merge them. It does not change the payload."
1912
+ },
1913
+ {
1914
+ flag: "--max-parts",
1915
+ type: "number",
1916
+ default: "unset",
1917
+ appliesTo: optionAppliesTo("max-parts"),
1918
+ summary: "Experimental: grow the per-part budget until the snapshot has at most this many parts. The budget it settles on is recorded in manifest.budgets.maxPartBytes and may exceed maxPartBytes; a warning says so."
1919
+ },
1901
1920
  {
1902
1921
  flag: "--skip-artifacts",
1903
1922
  type: "string",
@@ -2111,6 +2130,8 @@ function buildAgentContract() {
2111
2130
  { key: "includeSensitiveFiles", type: "boolean", default: false, summary: "Emit .env / *.pem / credential files." },
2112
2131
  { key: "include", type: "string[]", default: "[]", summary: "Allow-list of globs; empty means everything." },
2113
2132
  { key: "excludePatterns", type: "string[]", default: "[]", summary: "Extra exclude globs." },
2133
+ { key: "maxParts", type: "number | null", default: null, summary: "Experimental: the most parts a snapshot may have. The per-part budget grows to fit, up to the run's own needs; the effective ceiling is recorded in manifest.budgets.maxPartBytes and may exceed maxPartBytes." },
2134
+ { key: "attachmentSlots", type: "number", default: 10, summary: "Files the destination accepts in one message (0 = no limit); PROMPT.md plans the delivery to fit. It does not change the payload, and it is not part of the config digest." },
2114
2135
  { key: "discovery", type: '"auto" | "git" | "walk"', default: "auto", summary: "How files are discovered; `walk` scans the tree and reads .gitignore directly when a .git directory cannot be listed." },
2115
2136
  { key: "artifacts", type: "object", default: "all on except monolith", summary: "Per-artifact opt-out." },
2116
2137
  { key: "budgets", type: "object", default: "{ default, byLayer }", summary: "Per-layer byte budgets." },
@@ -2125,6 +2146,7 @@ function buildAgentContract() {
2125
2146
  output: {
2126
2147
  layout: [
2127
2148
  "<outDir>/README.md",
2149
+ "<outDir>/PROMPT.md",
2128
2150
  "<outDir>/manifest.json",
2129
2151
  "<outDir>/parts/part-NNN.md",
2130
2152
  "<outDir>/reports/project-tree.md",
@@ -2138,6 +2160,7 @@ function buildAgentContract() {
2138
2160
  "indexes.imports.byFile includes previewed files (their import specifiers are still extracted); such an entry carries `exportsOmitted: true` instead of pretending it exports nothing.",
2139
2161
  "validate re-checks manifest.incomplete[] against files[] and refuses a manifest whose two statements of what is missing disagree.",
2140
2162
  "manifest.skipped[] carries the path and the exact reason it was excluded.",
2163
+ "PROMPT.md is rendered from the manifest of the run that wrote it \u2014 its parts, partial files, skip tallies and fingerprint are that run's \u2014 and manifest.artifacts.prompt records its digest, so an edited prompt fails validate.",
2141
2164
  `The output directory is replaced atomically; ${MIN_MAX_PART_BYTES} bytes is the smallest legal budget.`
2142
2165
  ]
2143
2166
  },
@@ -2308,6 +2331,10 @@ do not assume the repository is broken.
2308
2331
  - \`snapshot/reports/audit.md\` \u2014 secrets found, large files, parse diagnostics, git
2309
2332
  state. Read this before you quote code back to a user.
2310
2333
  - \`snapshot/reports/project-tree.md\` and \`navigation.md\` \u2014 structure and cross-links.
2334
+ - \`snapshot/PROMPT.md\` \u2014 the instruction sheet to hand to the model that receives the
2335
+ snapshot: paste it with the parts. It is rendered from this run's manifest and names the
2336
+ parts, the partial files and the fingerprint, so do not rewrite it by hand \u2014 \`validate\`
2337
+ fails when it was edited.
2311
2338
 
2312
2339
  ## Project types
2313
2340