codebase-snapshot 0.10.2 → 0.12.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.
- package/CHANGELOG.md +102 -0
- package/README.md +10 -1
- package/SECURITY.md +2 -2
- package/dist/bin.js +1282 -296
- package/dist/{chunk-5EYBTBFY.js → chunk-5FPYVWP3.js} +50 -3
- package/dist/{chunk-5AV7OR3J.js → chunk-6HXDYIJS.js} +1204 -338
- package/dist/cli.cjs +1423 -443
- package/dist/cli.d.cts +36 -3
- package/dist/cli.d.ts +36 -3
- package/dist/cli.js +71 -5
- package/dist/index.cjs +1199 -333
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +206 -4
- package/dist/mcp.js +2 -2
- package/dist/{types-BoWneA7n.d.cts → types-c0tLF2WC.d.cts} +91 -1
- package/dist/{types-BoWneA7n.d.ts → types-c0tLF2WC.d.ts} +91 -1
- package/docs/cli.md +8 -3
- package/docs/configuration.md +108 -0
- package/docs/how-to-feed-a-repo-to-claude.md +40 -9
- package/docs/mcp.md +3 -3
- package/docs/output.md +58 -2
- package/package.json +1 -1
|
@@ -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-
|
|
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';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
@@ -1440,6 +1440,9 @@ var VALIDATE_OPTIONS = [
|
|
|
1440
1440
|
"max-part-tokens",
|
|
1441
1441
|
"large-file-bytes",
|
|
1442
1442
|
"max-monolith-bytes",
|
|
1443
|
+
"max-parts",
|
|
1444
|
+
"brief",
|
|
1445
|
+
"prompt-task",
|
|
1443
1446
|
"include-monolith",
|
|
1444
1447
|
"include-sensitive-files",
|
|
1445
1448
|
"skip-artifacts",
|
|
@@ -1465,6 +1468,10 @@ var COMMAND_OPTION_SCOPE = {
|
|
|
1465
1468
|
"max-part-tokens",
|
|
1466
1469
|
"large-file-bytes",
|
|
1467
1470
|
"max-monolith-bytes",
|
|
1471
|
+
"attachment-slots",
|
|
1472
|
+
"max-parts",
|
|
1473
|
+
"brief",
|
|
1474
|
+
"prompt-task",
|
|
1468
1475
|
"include-monolith",
|
|
1469
1476
|
"include-sensitive-files",
|
|
1470
1477
|
"skip-artifacts",
|
|
@@ -1610,6 +1617,7 @@ var PACKAGE_NAME = "codebase-snapshot";
|
|
|
1610
1617
|
var MAJOR_VERSION = GENERATOR_VERSION.split(".")[0];
|
|
1611
1618
|
var ARTIFACT_SUMMARY = {
|
|
1612
1619
|
readme: "README.md describing the snapshot at the output root.",
|
|
1620
|
+
prompt: "PROMPT.md: the instruction sheet to paste with the snapshot, rendered from its manifest.",
|
|
1613
1621
|
manifest: "manifest.json: machine-readable index of every file, part, hash and config.",
|
|
1614
1622
|
parts: "parts/*.md: the packed, budget-limited markdown parts that carry the code.",
|
|
1615
1623
|
navigation: "reports/navigation.md: links between parts and layers.",
|
|
@@ -1619,6 +1627,7 @@ var ARTIFACT_SUMMARY = {
|
|
|
1619
1627
|
};
|
|
1620
1628
|
var ARTIFACT_DEFAULTS = {
|
|
1621
1629
|
readme: true,
|
|
1630
|
+
prompt: true,
|
|
1622
1631
|
manifest: true,
|
|
1623
1632
|
parts: true,
|
|
1624
1633
|
navigation: true,
|
|
@@ -1759,9 +1768,9 @@ function buildAgentContract() {
|
|
|
1759
1768
|
{
|
|
1760
1769
|
step: 6,
|
|
1761
1770
|
id: "consume",
|
|
1762
|
-
run: "read ./snapshot/
|
|
1771
|
+
run: "read ./snapshot/PROMPT.md first, then ./snapshot/parts/*.md, ./snapshot/manifest.json and ./snapshot/reports/audit.md",
|
|
1763
1772
|
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."
|
|
1773
|
+
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
1774
|
}
|
|
1766
1775
|
],
|
|
1767
1776
|
commands: [
|
|
@@ -1898,6 +1907,34 @@ function buildAgentContract() {
|
|
|
1898
1907
|
appliesTo: optionAppliesTo("discovery"),
|
|
1899
1908
|
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
1909
|
},
|
|
1910
|
+
{
|
|
1911
|
+
flag: "--attachment-slots",
|
|
1912
|
+
type: "number",
|
|
1913
|
+
default: "10",
|
|
1914
|
+
appliesTo: optionAppliesTo("attachment-slots"),
|
|
1915
|
+
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."
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
flag: "--brief",
|
|
1919
|
+
type: "string",
|
|
1920
|
+
default: "unset",
|
|
1921
|
+
appliesTo: optionAppliesTo("brief"),
|
|
1922
|
+
summary: "Path to the owner-written half of PROMPT.md: Stakes, The system, What came before, The bar and Calibration replace or extend the generated prose; any other heading is kept as Owner notes. The measured headings cannot be redefined. A missing file is an error and an edited file is config drift."
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
flag: "--prompt-task",
|
|
1926
|
+
type: "string",
|
|
1927
|
+
default: "audit",
|
|
1928
|
+
appliesTo: optionAppliesTo("prompt-task"),
|
|
1929
|
+
summary: "Which job the brief is written for: audit (default), review or explain. It changes the opening section, not the standard."
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
flag: "--max-parts",
|
|
1933
|
+
type: "number",
|
|
1934
|
+
default: "unset",
|
|
1935
|
+
appliesTo: optionAppliesTo("max-parts"),
|
|
1936
|
+
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."
|
|
1937
|
+
},
|
|
1901
1938
|
{
|
|
1902
1939
|
flag: "--skip-artifacts",
|
|
1903
1940
|
type: "string",
|
|
@@ -2111,6 +2148,10 @@ function buildAgentContract() {
|
|
|
2111
2148
|
{ key: "includeSensitiveFiles", type: "boolean", default: false, summary: "Emit .env / *.pem / credential files." },
|
|
2112
2149
|
{ key: "include", type: "string[]", default: "[]", summary: "Allow-list of globs; empty means everything." },
|
|
2113
2150
|
{ key: "excludePatterns", type: "string[]", default: "[]", summary: "Extra exclude globs." },
|
|
2151
|
+
{ key: "brief", type: "string", default: "unset", summary: "Path to the owner-written half of PROMPT.md. Recognised headings: Stakes, The system, What came before, The bar, Calibration; unknown headings are kept as Owner notes; measured headings are refused. The file is digested, so editing it is drift." },
|
|
2152
|
+
{ key: "promptTask", type: "string", default: "audit", summary: "Which job the brief is written for: audit, review or explain. The standard and the coverage duty are the same in all three." },
|
|
2153
|
+
{ 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." },
|
|
2154
|
+
{ 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
2155
|
{ 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
2156
|
{ key: "artifacts", type: "object", default: "all on except monolith", summary: "Per-artifact opt-out." },
|
|
2116
2157
|
{ key: "budgets", type: "object", default: "{ default, byLayer }", summary: "Per-layer byte budgets." },
|
|
@@ -2125,6 +2166,7 @@ function buildAgentContract() {
|
|
|
2125
2166
|
output: {
|
|
2126
2167
|
layout: [
|
|
2127
2168
|
"<outDir>/README.md",
|
|
2169
|
+
"<outDir>/PROMPT.md",
|
|
2128
2170
|
"<outDir>/manifest.json",
|
|
2129
2171
|
"<outDir>/parts/part-NNN.md",
|
|
2130
2172
|
"<outDir>/reports/project-tree.md",
|
|
@@ -2138,6 +2180,7 @@ function buildAgentContract() {
|
|
|
2138
2180
|
"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
2181
|
"validate re-checks manifest.incomplete[] against files[] and refuses a manifest whose two statements of what is missing disagree.",
|
|
2140
2182
|
"manifest.skipped[] carries the path and the exact reason it was excluded.",
|
|
2183
|
+
"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
2184
|
`The output directory is replaced atomically; ${MIN_MAX_PART_BYTES} bytes is the smallest legal budget.`
|
|
2142
2185
|
]
|
|
2143
2186
|
},
|
|
@@ -2308,6 +2351,10 @@ do not assume the repository is broken.
|
|
|
2308
2351
|
- \`snapshot/reports/audit.md\` \u2014 secrets found, large files, parse diagnostics, git
|
|
2309
2352
|
state. Read this before you quote code back to a user.
|
|
2310
2353
|
- \`snapshot/reports/project-tree.md\` and \`navigation.md\` \u2014 structure and cross-links.
|
|
2354
|
+
- \`snapshot/PROMPT.md\` \u2014 the instruction sheet to hand to the model that receives the
|
|
2355
|
+
snapshot: paste it with the parts. It is rendered from this run's manifest and names the
|
|
2356
|
+
parts, the partial files and the fingerprint, so do not rewrite it by hand \u2014 \`validate\`
|
|
2357
|
+
fails when it was edited.
|
|
2311
2358
|
|
|
2312
2359
|
## Project types
|
|
2313
2360
|
|