codebase-snapshot 0.13.0 → 0.14.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 +130 -0
- package/README.md +1 -1
- package/SECURITY.md +2 -2
- package/dist/bin.js +329 -85
- package/dist/{chunk-BOJYZQFB.js → chunk-2YNQ42B3.js} +287 -85
- package/dist/{chunk-NESEHOPU.js → chunk-7WSZUMT6.js} +41 -1
- package/dist/cli.cjs +327 -85
- package/dist/cli.js +3 -3
- package/dist/index.cjs +287 -85
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +327 -85
- package/dist/mcp.d.cts +6 -15
- package/dist/mcp.d.ts +6 -15
- package/dist/mcp.js +2 -2
- package/docs/cli.md +3 -3
- package/docs/deploy.md +2 -2
- package/docs/health.md +31 -0
- package/docs/mcp.md +9 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4012,7 +4012,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
4012
4012
|
|
|
4013
4013
|
// src/version.ts
|
|
4014
4014
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
4015
|
-
var GENERATOR_VERSION = "0.
|
|
4015
|
+
var GENERATOR_VERSION = "0.14.0";
|
|
4016
4016
|
var SCHEMA_VERSION = "3.0.0";
|
|
4017
4017
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
4018
4018
|
function isOurGeneratorName(name) {
|
|
@@ -9995,6 +9995,92 @@ function verifySnapshotSignature(snapshotDir) {
|
|
|
9995
9995
|
return verified ? { ok: true, record } : { ok: false, reason: "the signature does not match the manifest" };
|
|
9996
9996
|
}
|
|
9997
9997
|
|
|
9998
|
+
// src/partitioner/part-format.ts
|
|
9999
|
+
var FILE_HEADING = "### FILE: ";
|
|
10000
|
+
var CONTENT_MARKERS = /* @__PURE__ */ new Set(["#### Content", "#### Bounded Preview"]);
|
|
10001
|
+
var ANCHOR_LINE = /^<a id="([^"]+)"><\/a>$/;
|
|
10002
|
+
var META_PREFIX = "- Meta: ";
|
|
10003
|
+
var LEGACY_INCLUSION_PREFIX = "- Inclusion: ";
|
|
10004
|
+
var LEGACY_INCLUDED_LINES_PREFIX = "- Included Lines: ";
|
|
10005
|
+
var INCLUSION_MODES = /* @__PURE__ */ new Set(["full", "preview", "signatures"]);
|
|
10006
|
+
var COMPACT_COUNTS = /^(\d+)\s+lines?(?:\s+of\s+\d+\s+lines?)?/;
|
|
10007
|
+
function readIncludedLines(fields) {
|
|
10008
|
+
const last = fields[fields.length - 1];
|
|
10009
|
+
if (last === void 0) return null;
|
|
10010
|
+
const counts = COMPACT_COUNTS.exec(last.trim());
|
|
10011
|
+
return counts === null ? null : Number(counts[1]);
|
|
10012
|
+
}
|
|
10013
|
+
function parsePartSections(partText) {
|
|
10014
|
+
const lines = partText.split("\n");
|
|
10015
|
+
const sections = [];
|
|
10016
|
+
let index = 0;
|
|
10017
|
+
while (index < lines.length) {
|
|
10018
|
+
if (!lines[index].startsWith(FILE_HEADING)) {
|
|
10019
|
+
index += 1;
|
|
10020
|
+
continue;
|
|
10021
|
+
}
|
|
10022
|
+
const heading = lines[index].slice(FILE_HEADING.length);
|
|
10023
|
+
const anchorMatch = index > 0 ? ANCHOR_LINE.exec(lines[index - 1]) : null;
|
|
10024
|
+
let cursor = index + 1;
|
|
10025
|
+
let inclusion = null;
|
|
10026
|
+
let includedLines = null;
|
|
10027
|
+
while (cursor < lines.length && !CONTENT_MARKERS.has(lines[cursor])) {
|
|
10028
|
+
const line = lines[cursor];
|
|
10029
|
+
if (line.startsWith(FILE_HEADING)) break;
|
|
10030
|
+
if (line.startsWith(META_PREFIX)) {
|
|
10031
|
+
const fields = line.slice(META_PREFIX.length).split("|");
|
|
10032
|
+
for (const field of fields) {
|
|
10033
|
+
const value = field.trim();
|
|
10034
|
+
if (INCLUSION_MODES.has(value)) inclusion = value;
|
|
10035
|
+
}
|
|
10036
|
+
includedLines = readIncludedLines(fields);
|
|
10037
|
+
} else if (line.startsWith(LEGACY_INCLUSION_PREFIX)) {
|
|
10038
|
+
inclusion = line.slice(LEGACY_INCLUSION_PREFIX.length).trim();
|
|
10039
|
+
} else if (line.startsWith(LEGACY_INCLUDED_LINES_PREFIX)) {
|
|
10040
|
+
const value = Number(line.slice(LEGACY_INCLUDED_LINES_PREFIX.length).trim());
|
|
10041
|
+
includedLines = Number.isFinite(value) ? value : null;
|
|
10042
|
+
}
|
|
10043
|
+
cursor += 1;
|
|
10044
|
+
}
|
|
10045
|
+
if (cursor >= lines.length || !CONTENT_MARKERS.has(lines[cursor])) {
|
|
10046
|
+
index = cursor + 1;
|
|
10047
|
+
continue;
|
|
10048
|
+
}
|
|
10049
|
+
let fenceLine = cursor + 1;
|
|
10050
|
+
while (fenceLine < lines.length && lines[fenceLine].trim().length === 0) fenceLine += 1;
|
|
10051
|
+
const fenceMatch = /^(`{4,})/.exec(lines[fenceLine] ?? "");
|
|
10052
|
+
if (!fenceMatch) {
|
|
10053
|
+
index = cursor + 1;
|
|
10054
|
+
continue;
|
|
10055
|
+
}
|
|
10056
|
+
const fence = fenceMatch[1];
|
|
10057
|
+
const body = [];
|
|
10058
|
+
let bodyLine = fenceLine + 1;
|
|
10059
|
+
while (bodyLine < lines.length && lines[bodyLine] !== fence) {
|
|
10060
|
+
body.push(lines[bodyLine]);
|
|
10061
|
+
bodyLine += 1;
|
|
10062
|
+
}
|
|
10063
|
+
sections.push({ path: heading, anchor: anchorMatch?.[1] ?? null, body: body.join("\n"), inclusion, includedLines });
|
|
10064
|
+
index = bodyLine + 1;
|
|
10065
|
+
}
|
|
10066
|
+
return sections;
|
|
10067
|
+
}
|
|
10068
|
+
function findSection(sections, relativePath) {
|
|
10069
|
+
const anchor = anchorForPath(relativePath);
|
|
10070
|
+
const byAnchor = sections.find((section) => section.anchor === anchor);
|
|
10071
|
+
if (byAnchor) return byAnchor;
|
|
10072
|
+
const rendered = displayPath(relativePath);
|
|
10073
|
+
const samePath = (section) => section.path === relativePath || section.path === rendered;
|
|
10074
|
+
const exact = sections.find(samePath);
|
|
10075
|
+
if (exact) return exact;
|
|
10076
|
+
const foldedPath = rendered.toLowerCase();
|
|
10077
|
+
const folded = sections.filter((section) => {
|
|
10078
|
+
const path26 = section.path.toLowerCase();
|
|
10079
|
+
return path26 === relativePath.toLowerCase() || path26 === foldedPath;
|
|
10080
|
+
});
|
|
10081
|
+
return folded.length === 1 ? folded[0] : null;
|
|
10082
|
+
}
|
|
10083
|
+
|
|
9998
10084
|
// src/auditor/health.ts
|
|
9999
10085
|
var ARTIFACT_FILES = {
|
|
10000
10086
|
readme: "README.md",
|
|
@@ -10304,6 +10390,206 @@ function auditSnapshot(options) {
|
|
|
10304
10390
|
)
|
|
10305
10391
|
);
|
|
10306
10392
|
}
|
|
10393
|
+
const bookkeeping = [];
|
|
10394
|
+
const expect = (name, recorded2, computed) => {
|
|
10395
|
+
if (recorded2 !== computed) bookkeeping.push(name + ": manifest says " + recorded2 + ", the data has " + computed);
|
|
10396
|
+
};
|
|
10397
|
+
expect("counts.totalFiles", manifest.counts.totalFiles, manifest.files.length);
|
|
10398
|
+
expect("counts.partsCount", manifest.counts.partsCount, manifest.parts.length);
|
|
10399
|
+
expect("counts.skippedCount", manifest.counts.skippedCount, manifest.skipped.length);
|
|
10400
|
+
if (typeof manifest.totals.includedFiles === "number") {
|
|
10401
|
+
expect("totals.includedFiles", manifest.totals.includedFiles, manifest.files.length);
|
|
10402
|
+
}
|
|
10403
|
+
const contentBytes = manifest.files.reduce((sum, file) => sum + file.includedBytes, 0);
|
|
10404
|
+
expect("totals.totalContentBytes", manifest.totals.totalContentBytes, contentBytes);
|
|
10405
|
+
const layerCounts = /* @__PURE__ */ new Map();
|
|
10406
|
+
for (const file of manifest.files) layerCounts.set(file.layer, (layerCounts.get(file.layer) ?? 0) + 1);
|
|
10407
|
+
for (const [layer2, count] of layerCounts) {
|
|
10408
|
+
expect("layers." + layer2, manifest.layers[layer2] ?? -1, count);
|
|
10409
|
+
}
|
|
10410
|
+
for (const layer2 of Object.keys(manifest.layers)) {
|
|
10411
|
+
if (!layerCounts.has(layer2)) expect("layers." + layer2, manifest.layers[layer2], 0);
|
|
10412
|
+
}
|
|
10413
|
+
checks.push(
|
|
10414
|
+
bookkeeping.length === 0 ? check(
|
|
10415
|
+
"bookkeeping",
|
|
10416
|
+
"The counts equal the data they summarise",
|
|
10417
|
+
"critical",
|
|
10418
|
+
"pass",
|
|
10419
|
+
"Files, parts, skips, content bytes and layer counts all agree."
|
|
10420
|
+
) : check(
|
|
10421
|
+
"bookkeeping",
|
|
10422
|
+
"The counts equal the data they summarise",
|
|
10423
|
+
"critical",
|
|
10424
|
+
"fail",
|
|
10425
|
+
bookkeeping.length + " mismatch(es): " + sample(bookkeeping)
|
|
10426
|
+
)
|
|
10427
|
+
);
|
|
10428
|
+
const packReaders = [
|
|
10429
|
+
{
|
|
10430
|
+
key: "fullJson",
|
|
10431
|
+
file: "full-codebase.json",
|
|
10432
|
+
label: "JSON",
|
|
10433
|
+
paths: (text2) => {
|
|
10434
|
+
try {
|
|
10435
|
+
const parsed = JSON.parse(text2);
|
|
10436
|
+
if (!Array.isArray(parsed?.files)) return null;
|
|
10437
|
+
return new Set(parsed.files.map((entry) => String(entry?.relativePath)));
|
|
10438
|
+
} catch {
|
|
10439
|
+
return null;
|
|
10440
|
+
}
|
|
10441
|
+
}
|
|
10442
|
+
},
|
|
10443
|
+
{
|
|
10444
|
+
key: "fullXml",
|
|
10445
|
+
file: "full-codebase.xml",
|
|
10446
|
+
label: "XML",
|
|
10447
|
+
paths: (text2) => {
|
|
10448
|
+
const found = [...text2.matchAll(/<file path="([^"]+)"/g)].map((match) => match[1]);
|
|
10449
|
+
if (found.length === 0) return null;
|
|
10450
|
+
return new Set(found.map((value) => value.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&")));
|
|
10451
|
+
}
|
|
10452
|
+
},
|
|
10453
|
+
{
|
|
10454
|
+
key: "fullMarkdown",
|
|
10455
|
+
file: "full-codebase.md",
|
|
10456
|
+
label: "markdown",
|
|
10457
|
+
paths: (text2) => {
|
|
10458
|
+
const found = [...text2.matchAll(/^## File: (.+)$/gm)].map((match) => match[1].trim());
|
|
10459
|
+
if (found.length === 0) return null;
|
|
10460
|
+
return new Set(found);
|
|
10461
|
+
}
|
|
10462
|
+
}
|
|
10463
|
+
];
|
|
10464
|
+
for (const reader of packReaders) {
|
|
10465
|
+
if (manifest.artifacts?.[reader.key] == null) continue;
|
|
10466
|
+
const packText = readText2(path25__namespace.join(snapshotDir, reader.file));
|
|
10467
|
+
const problems = [];
|
|
10468
|
+
if (packText === null) {
|
|
10469
|
+
problems.push(reader.file + " is recorded but unreadable");
|
|
10470
|
+
} else {
|
|
10471
|
+
const packed = reader.paths(packText);
|
|
10472
|
+
if (packed === null) {
|
|
10473
|
+
problems.push(reader.file + " could not be parsed for its file list");
|
|
10474
|
+
} else {
|
|
10475
|
+
const known2 = new Set(manifest.files.map((file) => file.relativePath));
|
|
10476
|
+
for (const file of manifest.files) {
|
|
10477
|
+
if (!packed.has(file.relativePath)) problems.push(file.relativePath + " is in the manifest but not the pack");
|
|
10478
|
+
}
|
|
10479
|
+
for (const path26 of packed) {
|
|
10480
|
+
if (!known2.has(path26)) problems.push(path26 + " is in the pack but not the manifest");
|
|
10481
|
+
}
|
|
10482
|
+
}
|
|
10483
|
+
}
|
|
10484
|
+
const title = "The " + reader.label + " pack holds every file the manifest lists";
|
|
10485
|
+
checks.push(
|
|
10486
|
+
problems.length === 0 ? check(
|
|
10487
|
+
"pipeline.monolith",
|
|
10488
|
+
title,
|
|
10489
|
+
"critical",
|
|
10490
|
+
"pass",
|
|
10491
|
+
manifest.files.length + " file(s) present in " + reader.file + ", and nothing extra."
|
|
10492
|
+
) : check(
|
|
10493
|
+
"pipeline.monolith",
|
|
10494
|
+
title,
|
|
10495
|
+
"critical",
|
|
10496
|
+
"fail",
|
|
10497
|
+
problems.length + " problem(s): " + sample(problems)
|
|
10498
|
+
)
|
|
10499
|
+
);
|
|
10500
|
+
}
|
|
10501
|
+
const bodyProblems = [];
|
|
10502
|
+
let bodiesChecked = 0;
|
|
10503
|
+
for (const part of manifest.parts) {
|
|
10504
|
+
const partText = readText2(path25__namespace.join(snapshotDir, "parts", part.filename));
|
|
10505
|
+
if (partText === null) continue;
|
|
10506
|
+
const sections = parsePartSections(partText);
|
|
10507
|
+
for (const file of manifest.files) {
|
|
10508
|
+
if (file.part !== part.filename) continue;
|
|
10509
|
+
const section = findSection(sections, file.relativePath);
|
|
10510
|
+
if (section === null) {
|
|
10511
|
+
bodyProblems.push(file.relativePath + " has no section in " + part.filename);
|
|
10512
|
+
continue;
|
|
10513
|
+
}
|
|
10514
|
+
bodiesChecked += 1;
|
|
10515
|
+
const bytes = Buffer.byteLength(section.body, "utf8");
|
|
10516
|
+
const bodyLines = section.body === "" ? 0 : section.body.split("\n").length - (section.body.endsWith("\n") ? 1 : 0);
|
|
10517
|
+
if (bytes !== file.includedBytes) {
|
|
10518
|
+
bodyProblems.push(file.relativePath + ": manifest says " + file.includedBytes + " B, part holds " + bytes + " B");
|
|
10519
|
+
} else if (bodyLines !== file.includedLines) {
|
|
10520
|
+
bodyProblems.push(file.relativePath + ": manifest says " + file.includedLines + " line(s), part holds " + bodyLines);
|
|
10521
|
+
}
|
|
10522
|
+
}
|
|
10523
|
+
}
|
|
10524
|
+
checks.push(
|
|
10525
|
+
bodyProblems.length === 0 ? check(
|
|
10526
|
+
"pipeline.bodies",
|
|
10527
|
+
"Every file body matches the manifest accounting",
|
|
10528
|
+
"critical",
|
|
10529
|
+
"pass",
|
|
10530
|
+
bodiesChecked + " file body/bodies match their recorded bytes and lines."
|
|
10531
|
+
) : check(
|
|
10532
|
+
"pipeline.bodies",
|
|
10533
|
+
"Every file body matches the manifest accounting",
|
|
10534
|
+
"critical",
|
|
10535
|
+
"fail",
|
|
10536
|
+
bodyProblems.length + " file(s) disagree: " + sample(bodyProblems)
|
|
10537
|
+
)
|
|
10538
|
+
);
|
|
10539
|
+
const indexParent = path25__namespace.dirname(snapshotDir);
|
|
10540
|
+
const indexPath = path25__namespace.join(indexParent, "WORKSPACE.json");
|
|
10541
|
+
if (fs24__namespace.existsSync(indexPath)) {
|
|
10542
|
+
const indexText = readText2(indexPath);
|
|
10543
|
+
let members = [];
|
|
10544
|
+
let problem2 = null;
|
|
10545
|
+
try {
|
|
10546
|
+
const parsed = JSON.parse(indexText ?? "null");
|
|
10547
|
+
if (!Array.isArray(parsed?.members)) problem2 = "its members field is not an array";
|
|
10548
|
+
else members = parsed.members;
|
|
10549
|
+
} catch (error) {
|
|
10550
|
+
problem2 = error.message;
|
|
10551
|
+
}
|
|
10552
|
+
const memberName = path25__namespace.basename(snapshotDir);
|
|
10553
|
+
const member = members.find((entry) => entry.name === memberName);
|
|
10554
|
+
if (problem2 !== null) {
|
|
10555
|
+
checks.push(check(
|
|
10556
|
+
"workspace.index",
|
|
10557
|
+
"The workspace index agrees with this member",
|
|
10558
|
+
"warning",
|
|
10559
|
+
"warn",
|
|
10560
|
+
"WORKSPACE.json could not be read: " + problem2
|
|
10561
|
+
));
|
|
10562
|
+
} else if (member === void 0) {
|
|
10563
|
+
checks.push(check(
|
|
10564
|
+
"workspace.index",
|
|
10565
|
+
"The workspace index agrees with this member",
|
|
10566
|
+
"warning",
|
|
10567
|
+
"skip",
|
|
10568
|
+
"WORKSPACE.json lists no member named " + memberName + "."
|
|
10569
|
+
));
|
|
10570
|
+
} else {
|
|
10571
|
+
const disagreements = [];
|
|
10572
|
+
if (member.fingerprint !== manifest.fingerprint) disagreements.push("fingerprint");
|
|
10573
|
+
if (typeof member.files === "number" && member.files !== manifest.counts.totalFiles) {
|
|
10574
|
+
disagreements.push("file count");
|
|
10575
|
+
}
|
|
10576
|
+
checks.push(
|
|
10577
|
+
disagreements.length === 0 ? check(
|
|
10578
|
+
"workspace.index",
|
|
10579
|
+
"The workspace index agrees with this member",
|
|
10580
|
+
"warning",
|
|
10581
|
+
"pass",
|
|
10582
|
+
"Member " + memberName + " matches the index fingerprint and file count."
|
|
10583
|
+
) : check(
|
|
10584
|
+
"workspace.index",
|
|
10585
|
+
"The workspace index agrees with this member",
|
|
10586
|
+
"warning",
|
|
10587
|
+
"warn",
|
|
10588
|
+
"The index disagrees with this member on: " + disagreements.join(", ") + ". Regenerate the workspace."
|
|
10589
|
+
)
|
|
10590
|
+
);
|
|
10591
|
+
}
|
|
10592
|
+
}
|
|
10307
10593
|
const rules = [...compileSecretRules(DEFAULT_SECRET_PATTERNS), ...options.secretRules ?? []];
|
|
10308
10594
|
const scanBudget = options.maxScanBytes ?? 32 * 1024 * 1024;
|
|
10309
10595
|
const leakHits = [];
|
|
@@ -10815,90 +11101,6 @@ function generateInWorker(cwd, cliOptions, options = {}) {
|
|
|
10815
11101
|
}
|
|
10816
11102
|
|
|
10817
11103
|
// src/mcp/part.ts
|
|
10818
|
-
var FILE_HEADING = "### FILE: ";
|
|
10819
|
-
var CONTENT_MARKERS = /* @__PURE__ */ new Set(["#### Content", "#### Bounded Preview"]);
|
|
10820
|
-
var ANCHOR_LINE = /^<a id="([^"]+)"><\/a>$/;
|
|
10821
|
-
var META_PREFIX = "- Meta: ";
|
|
10822
|
-
var LEGACY_INCLUSION_PREFIX = "- Inclusion: ";
|
|
10823
|
-
var LEGACY_INCLUDED_LINES_PREFIX = "- Included Lines: ";
|
|
10824
|
-
var INCLUSION_MODES = /* @__PURE__ */ new Set(["full", "preview", "signatures"]);
|
|
10825
|
-
var COMPACT_COUNTS = /^(\d+)\s+lines?(?:\s+of\s+\d+\s+lines?)?/;
|
|
10826
|
-
function readIncludedLines(fields) {
|
|
10827
|
-
const last = fields[fields.length - 1];
|
|
10828
|
-
if (last === void 0) return null;
|
|
10829
|
-
const counts = COMPACT_COUNTS.exec(last.trim());
|
|
10830
|
-
return counts === null ? null : Number(counts[1]);
|
|
10831
|
-
}
|
|
10832
|
-
function parsePartSections(partText) {
|
|
10833
|
-
const lines = partText.split("\n");
|
|
10834
|
-
const sections = [];
|
|
10835
|
-
let index = 0;
|
|
10836
|
-
while (index < lines.length) {
|
|
10837
|
-
if (!lines[index].startsWith(FILE_HEADING)) {
|
|
10838
|
-
index += 1;
|
|
10839
|
-
continue;
|
|
10840
|
-
}
|
|
10841
|
-
const heading = lines[index].slice(FILE_HEADING.length);
|
|
10842
|
-
const anchorMatch = index > 0 ? ANCHOR_LINE.exec(lines[index - 1]) : null;
|
|
10843
|
-
let cursor = index + 1;
|
|
10844
|
-
let inclusion = null;
|
|
10845
|
-
let includedLines = null;
|
|
10846
|
-
while (cursor < lines.length && !CONTENT_MARKERS.has(lines[cursor])) {
|
|
10847
|
-
const line = lines[cursor];
|
|
10848
|
-
if (line.startsWith(FILE_HEADING)) break;
|
|
10849
|
-
if (line.startsWith(META_PREFIX)) {
|
|
10850
|
-
const fields = line.slice(META_PREFIX.length).split("|");
|
|
10851
|
-
for (const field of fields) {
|
|
10852
|
-
const value = field.trim();
|
|
10853
|
-
if (INCLUSION_MODES.has(value)) inclusion = value;
|
|
10854
|
-
}
|
|
10855
|
-
includedLines = readIncludedLines(fields);
|
|
10856
|
-
} else if (line.startsWith(LEGACY_INCLUSION_PREFIX)) {
|
|
10857
|
-
inclusion = line.slice(LEGACY_INCLUSION_PREFIX.length).trim();
|
|
10858
|
-
} else if (line.startsWith(LEGACY_INCLUDED_LINES_PREFIX)) {
|
|
10859
|
-
const value = Number(line.slice(LEGACY_INCLUDED_LINES_PREFIX.length).trim());
|
|
10860
|
-
includedLines = Number.isFinite(value) ? value : null;
|
|
10861
|
-
}
|
|
10862
|
-
cursor += 1;
|
|
10863
|
-
}
|
|
10864
|
-
if (cursor >= lines.length || !CONTENT_MARKERS.has(lines[cursor])) {
|
|
10865
|
-
index = cursor + 1;
|
|
10866
|
-
continue;
|
|
10867
|
-
}
|
|
10868
|
-
let fenceLine = cursor + 1;
|
|
10869
|
-
while (fenceLine < lines.length && lines[fenceLine].trim().length === 0) fenceLine += 1;
|
|
10870
|
-
const fenceMatch = /^(`{4,})/.exec(lines[fenceLine] ?? "");
|
|
10871
|
-
if (!fenceMatch) {
|
|
10872
|
-
index = cursor + 1;
|
|
10873
|
-
continue;
|
|
10874
|
-
}
|
|
10875
|
-
const fence = fenceMatch[1];
|
|
10876
|
-
const body = [];
|
|
10877
|
-
let bodyLine = fenceLine + 1;
|
|
10878
|
-
while (bodyLine < lines.length && lines[bodyLine] !== fence) {
|
|
10879
|
-
body.push(lines[bodyLine]);
|
|
10880
|
-
bodyLine += 1;
|
|
10881
|
-
}
|
|
10882
|
-
sections.push({ path: heading, anchor: anchorMatch?.[1] ?? null, body: body.join("\n"), inclusion, includedLines });
|
|
10883
|
-
index = bodyLine + 1;
|
|
10884
|
-
}
|
|
10885
|
-
return sections;
|
|
10886
|
-
}
|
|
10887
|
-
function findSection(sections, relativePath) {
|
|
10888
|
-
const anchor = anchorForPath(relativePath);
|
|
10889
|
-
const byAnchor = sections.find((section) => section.anchor === anchor);
|
|
10890
|
-
if (byAnchor) return byAnchor;
|
|
10891
|
-
const rendered = displayPath(relativePath);
|
|
10892
|
-
const samePath = (section) => section.path === relativePath || section.path === rendered;
|
|
10893
|
-
const exact = sections.find(samePath);
|
|
10894
|
-
if (exact) return exact;
|
|
10895
|
-
const foldedPath = rendered.toLowerCase();
|
|
10896
|
-
const folded = sections.filter((section) => {
|
|
10897
|
-
const path26 = section.path.toLowerCase();
|
|
10898
|
-
return path26 === relativePath.toLowerCase() || path26 === foldedPath;
|
|
10899
|
-
});
|
|
10900
|
-
return folded.length === 1 ? folded[0] : null;
|
|
10901
|
-
}
|
|
10902
11104
|
function windowText(body, fromLine, lineCount) {
|
|
10903
11105
|
const lines = body.split("\n");
|
|
10904
11106
|
const total = body.length === 0 ? 0 : lines.length;
|
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.
|
|
551
|
+
declare const GENERATOR_VERSION = "0.14.0";
|
|
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.
|
|
551
|
+
declare const GENERATOR_VERSION = "0.14.0";
|
|
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, assertPublicHost, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, cloneRepository, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, crc32, 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, isPrivateHost, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, makeCloneDirectory, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, parseRemoteSource, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, workerEntry, wrapLines, writeZip } from './chunk-
|
|
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, assertPublicHost, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, cloneRepository, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, crc32, 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, isPrivateHost, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, makeCloneDirectory, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, parseRemoteSource, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, workerEntry, wrapLines, writeZip } from './chunk-2YNQ42B3.js';
|