@ankurhalder/codebase-snapshot 4.0.3 → 4.0.4
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/dist/bin.js +62 -11
- package/dist/{chunk-L7QBLC4C.js → chunk-CDZDVU74.js} +45 -9
- package/dist/cli.cjs +62 -11
- package/dist/cli.js +20 -5
- package/dist/index.cjs +43 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -4514,7 +4514,31 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
4514
4514
|
}
|
|
4515
4515
|
lines.push("");
|
|
4516
4516
|
}
|
|
4517
|
-
|
|
4517
|
+
const parseIssues = manifest.files.filter(
|
|
4518
|
+
(file) => file.summary !== void 0 && typeof file.summary === "object" && "parseErrors" in file.summary && typeof file.summary.parseErrors === "number" && file.summary.parseErrors > 0
|
|
4519
|
+
);
|
|
4520
|
+
lines.push("## 2. Parse & AST Diagnostics", "");
|
|
4521
|
+
if (parseIssues.length === 0) {
|
|
4522
|
+
lines.push("\u2705 Every parsed file produced a complete structural summary.", "");
|
|
4523
|
+
} else {
|
|
4524
|
+
lines.push(
|
|
4525
|
+
`${parseIssues.length} file(s) produced an incomplete summary:`,
|
|
4526
|
+
"",
|
|
4527
|
+
"| File | Parse Errors |",
|
|
4528
|
+
"| :--- | ---: |"
|
|
4529
|
+
);
|
|
4530
|
+
for (const file of parseIssues) {
|
|
4531
|
+
const errors = file.summary.parseErrors;
|
|
4532
|
+
lines.push(`| \`${mask(file.relativePath)}\` | ${errors} |`);
|
|
4533
|
+
}
|
|
4534
|
+
lines.push(
|
|
4535
|
+
"",
|
|
4536
|
+
"A parse error here means the summary is incomplete, not that the file is excluded \u2014",
|
|
4537
|
+
"the content is still in the parts.",
|
|
4538
|
+
""
|
|
4539
|
+
);
|
|
4540
|
+
}
|
|
4541
|
+
lines.push("## 3. Large Files Analysis", "");
|
|
4518
4542
|
const largeFiles = manifest.files.filter((file) => file.isLarge);
|
|
4519
4543
|
if (largeFiles.length === 0) {
|
|
4520
4544
|
lines.push("\u2705 No files exceeded the large file budget.", "");
|
|
@@ -4533,7 +4557,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
4533
4557
|
lines.push("");
|
|
4534
4558
|
}
|
|
4535
4559
|
lines.push(
|
|
4536
|
-
"##
|
|
4560
|
+
"## 4. Architecture Layer Distribution",
|
|
4537
4561
|
"",
|
|
4538
4562
|
"| Layer | File Count | Percentage |",
|
|
4539
4563
|
"| :--- | :--- | :--- |"
|
|
@@ -4547,7 +4571,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
4547
4571
|
}
|
|
4548
4572
|
lines.push("");
|
|
4549
4573
|
lines.push(
|
|
4550
|
-
"##
|
|
4574
|
+
"## 5. File Kind Distribution",
|
|
4551
4575
|
"",
|
|
4552
4576
|
"| Kind | File Count | Percentage |",
|
|
4553
4577
|
"| :--- | :--- | :--- |"
|
|
@@ -4559,7 +4583,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
4559
4583
|
lines.push(`| \`${kind}\` | ${count} | ${pct}% |`);
|
|
4560
4584
|
}
|
|
4561
4585
|
lines.push("");
|
|
4562
|
-
lines.push("##
|
|
4586
|
+
lines.push("## 6. Skipped / Non-Text Files", "");
|
|
4563
4587
|
if (manifest.skipped.length === 0) {
|
|
4564
4588
|
lines.push("No files were skipped.", "");
|
|
4565
4589
|
} else {
|
|
@@ -5447,7 +5471,7 @@ function validateSnapshot(configInput) {
|
|
|
5447
5471
|
|
|
5448
5472
|
// src/index.ts
|
|
5449
5473
|
var GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
5450
|
-
var GENERATOR_VERSION = "4.0.
|
|
5474
|
+
var GENERATOR_VERSION = "4.0.4";
|
|
5451
5475
|
var SCHEMA_VERSION = "3.0.0";
|
|
5452
5476
|
function sha256Hex2(input) {
|
|
5453
5477
|
return crypto3.createHash("sha256").update(input).digest("hex");
|
|
@@ -5654,6 +5678,18 @@ function resolveSafeOutputDirs(config) {
|
|
|
5654
5678
|
var PLACEHOLDER_ENTRIES = /* @__PURE__ */ new Set([".gitkeep", ".gitignore", ".DS_Store"]);
|
|
5655
5679
|
var RUN_DIR_PREFIX = "run-";
|
|
5656
5680
|
var STALE_RUN_MS = 60 * 60 * 1e3;
|
|
5681
|
+
function maskSummaryStrings(value, secretRules) {
|
|
5682
|
+
if (typeof value === "string") return maskPathText(value, secretRules);
|
|
5683
|
+
if (Array.isArray(value)) return value.map((item) => maskSummaryStrings(item, secretRules));
|
|
5684
|
+
if (value && typeof value === "object") {
|
|
5685
|
+
const out = {};
|
|
5686
|
+
for (const [key, item] of Object.entries(value)) {
|
|
5687
|
+
out[key] = maskSummaryStrings(item, secretRules);
|
|
5688
|
+
}
|
|
5689
|
+
return out;
|
|
5690
|
+
}
|
|
5691
|
+
return value;
|
|
5692
|
+
}
|
|
5657
5693
|
function maskPathText(value, secretRules) {
|
|
5658
5694
|
return findSecretInPath(value, secretRules)?.masked ?? value;
|
|
5659
5695
|
}
|
|
@@ -6234,8 +6270,8 @@ function generateSnapshot(configInput, options) {
|
|
|
6234
6270
|
let summary;
|
|
6235
6271
|
let summaryQuality;
|
|
6236
6272
|
try {
|
|
6237
|
-
const outcome = summarizeFile(relativePath,
|
|
6238
|
-
summary = outcome?.summary;
|
|
6273
|
+
const outcome = summarizeFile(relativePath, rawContent);
|
|
6274
|
+
summary = outcome?.summary ? maskSummaryStrings(outcome.summary, config.secretRules) : void 0;
|
|
6239
6275
|
summaryQuality = outcome?.quality;
|
|
6240
6276
|
if (isSourceSummary(summary) && summary.parseErrors) {
|
|
6241
6277
|
warnings.push(
|
|
@@ -7782,7 +7818,7 @@ ${USAGE}
|
|
|
7782
7818
|
info(` - Schema: ${manifest.schemaVersion}`);
|
|
7783
7819
|
info(` - Fingerprint: ${manifest.fingerprint}`);
|
|
7784
7820
|
info(` - Files included: ${manifest.counts.totalFiles}`);
|
|
7785
|
-
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString()}`);
|
|
7821
|
+
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString("en-US")}`);
|
|
7786
7822
|
info(
|
|
7787
7823
|
` - Total size: ${(manifest.counts.totalSizeBytes / (1024 * 1024)).toFixed(2)} MB`
|
|
7788
7824
|
);
|
|
@@ -7834,14 +7870,14 @@ ${USAGE}
|
|
|
7834
7870
|
info(`
|
|
7835
7871
|
\u2705 Snapshot generated in ${elapsed}s:`);
|
|
7836
7872
|
info(` - Tracked files: ${manifest.counts.totalFiles}`);
|
|
7837
|
-
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString()}`);
|
|
7873
|
+
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString("en-US")}`);
|
|
7838
7874
|
info(
|
|
7839
7875
|
` - Total size: ${(manifest.counts.totalSizeBytes / (1024 * 1024)).toFixed(2)} MB`
|
|
7840
7876
|
);
|
|
7841
7877
|
const { artifacts } = resolved;
|
|
7842
7878
|
if (artifacts.parts) {
|
|
7843
7879
|
info(
|
|
7844
|
-
` - Parts written: ${manifest.counts.partsCount} under ${displayOutPath(resolved.cwd, resolved.outDir, "parts")}
|
|
7880
|
+
` - Parts written: ${manifest.counts.partsCount} under ${displayOutPath(resolved.cwd, resolved.outDir, "parts")}`
|
|
7845
7881
|
);
|
|
7846
7882
|
}
|
|
7847
7883
|
const reports = [
|
|
@@ -7851,7 +7887,7 @@ ${USAGE}
|
|
|
7851
7887
|
].filter(Boolean);
|
|
7852
7888
|
if (reports.length > 0) {
|
|
7853
7889
|
info(
|
|
7854
|
-
` - Reports: ${displayOutPath(resolved.cwd, resolved.outDir, "reports")}
|
|
7890
|
+
` - Reports: ${displayOutPath(resolved.cwd, resolved.outDir, "reports")} (${reports.join(", ")})`
|
|
7855
7891
|
);
|
|
7856
7892
|
}
|
|
7857
7893
|
if (artifacts.manifest) {
|
|
@@ -7979,6 +8015,21 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
7979
8015
|
});
|
|
7980
8016
|
return 0;
|
|
7981
8017
|
}
|
|
8018
|
+
var entryFile = process.argv[1] ?? "";
|
|
8019
|
+
var entryName = path12.basename(entryFile).toLowerCase();
|
|
8020
|
+
var invokedDirectly = entryName === "cli.js" || entryName === "cli.cjs";
|
|
8021
|
+
if (invokedDirectly) {
|
|
8022
|
+
void main().then(
|
|
8023
|
+
(code) => {
|
|
8024
|
+
process.exitCode = code;
|
|
8025
|
+
},
|
|
8026
|
+
(err) => {
|
|
8027
|
+
process.stderr.write(`\u274C ${err.message}
|
|
8028
|
+
`);
|
|
8029
|
+
process.exitCode = 1;
|
|
8030
|
+
}
|
|
8031
|
+
);
|
|
8032
|
+
}
|
|
7982
8033
|
|
|
7983
8034
|
// src/bin.ts
|
|
7984
8035
|
main().then(
|
|
@@ -3399,7 +3399,31 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
3399
3399
|
}
|
|
3400
3400
|
lines.push("");
|
|
3401
3401
|
}
|
|
3402
|
-
|
|
3402
|
+
const parseIssues = manifest.files.filter(
|
|
3403
|
+
(file) => file.summary !== void 0 && typeof file.summary === "object" && "parseErrors" in file.summary && typeof file.summary.parseErrors === "number" && file.summary.parseErrors > 0
|
|
3404
|
+
);
|
|
3405
|
+
lines.push("## 2. Parse & AST Diagnostics", "");
|
|
3406
|
+
if (parseIssues.length === 0) {
|
|
3407
|
+
lines.push("\u2705 Every parsed file produced a complete structural summary.", "");
|
|
3408
|
+
} else {
|
|
3409
|
+
lines.push(
|
|
3410
|
+
`${parseIssues.length} file(s) produced an incomplete summary:`,
|
|
3411
|
+
"",
|
|
3412
|
+
"| File | Parse Errors |",
|
|
3413
|
+
"| :--- | ---: |"
|
|
3414
|
+
);
|
|
3415
|
+
for (const file of parseIssues) {
|
|
3416
|
+
const errors = file.summary.parseErrors;
|
|
3417
|
+
lines.push(`| \`${mask(file.relativePath)}\` | ${errors} |`);
|
|
3418
|
+
}
|
|
3419
|
+
lines.push(
|
|
3420
|
+
"",
|
|
3421
|
+
"A parse error here means the summary is incomplete, not that the file is excluded \u2014",
|
|
3422
|
+
"the content is still in the parts.",
|
|
3423
|
+
""
|
|
3424
|
+
);
|
|
3425
|
+
}
|
|
3426
|
+
lines.push("## 3. Large Files Analysis", "");
|
|
3403
3427
|
const largeFiles = manifest.files.filter((file) => file.isLarge);
|
|
3404
3428
|
if (largeFiles.length === 0) {
|
|
3405
3429
|
lines.push("\u2705 No files exceeded the large file budget.", "");
|
|
@@ -3418,7 +3442,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
3418
3442
|
lines.push("");
|
|
3419
3443
|
}
|
|
3420
3444
|
lines.push(
|
|
3421
|
-
"##
|
|
3445
|
+
"## 4. Architecture Layer Distribution",
|
|
3422
3446
|
"",
|
|
3423
3447
|
"| Layer | File Count | Percentage |",
|
|
3424
3448
|
"| :--- | :--- | :--- |"
|
|
@@ -3432,7 +3456,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
3432
3456
|
}
|
|
3433
3457
|
lines.push("");
|
|
3434
3458
|
lines.push(
|
|
3435
|
-
"##
|
|
3459
|
+
"## 5. File Kind Distribution",
|
|
3436
3460
|
"",
|
|
3437
3461
|
"| Kind | File Count | Percentage |",
|
|
3438
3462
|
"| :--- | :--- | :--- |"
|
|
@@ -3444,7 +3468,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
3444
3468
|
lines.push(`| \`${kind}\` | ${count} | ${pct}% |`);
|
|
3445
3469
|
}
|
|
3446
3470
|
lines.push("");
|
|
3447
|
-
lines.push("##
|
|
3471
|
+
lines.push("## 6. Skipped / Non-Text Files", "");
|
|
3448
3472
|
if (manifest.skipped.length === 0) {
|
|
3449
3473
|
lines.push("No files were skipped.", "");
|
|
3450
3474
|
} else {
|
|
@@ -5410,7 +5434,7 @@ async function runInit(options) {
|
|
|
5410
5434
|
|
|
5411
5435
|
// src/index.ts
|
|
5412
5436
|
var GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
5413
|
-
var GENERATOR_VERSION = "4.0.
|
|
5437
|
+
var GENERATOR_VERSION = "4.0.4";
|
|
5414
5438
|
var SCHEMA_VERSION = "3.0.0";
|
|
5415
5439
|
function sha256Hex2(input) {
|
|
5416
5440
|
return crypto.createHash("sha256").update(input).digest("hex");
|
|
@@ -5617,6 +5641,18 @@ function resolveSafeOutputDirs(config) {
|
|
|
5617
5641
|
var PLACEHOLDER_ENTRIES = /* @__PURE__ */ new Set([".gitkeep", ".gitignore", ".DS_Store"]);
|
|
5618
5642
|
var RUN_DIR_PREFIX = "run-";
|
|
5619
5643
|
var STALE_RUN_MS = 60 * 60 * 1e3;
|
|
5644
|
+
function maskSummaryStrings(value, secretRules) {
|
|
5645
|
+
if (typeof value === "string") return maskPathText(value, secretRules);
|
|
5646
|
+
if (Array.isArray(value)) return value.map((item) => maskSummaryStrings(item, secretRules));
|
|
5647
|
+
if (value && typeof value === "object") {
|
|
5648
|
+
const out = {};
|
|
5649
|
+
for (const [key, item] of Object.entries(value)) {
|
|
5650
|
+
out[key] = maskSummaryStrings(item, secretRules);
|
|
5651
|
+
}
|
|
5652
|
+
return out;
|
|
5653
|
+
}
|
|
5654
|
+
return value;
|
|
5655
|
+
}
|
|
5620
5656
|
function maskPathText(value, secretRules) {
|
|
5621
5657
|
return findSecretInPath(value, secretRules)?.masked ?? value;
|
|
5622
5658
|
}
|
|
@@ -6197,8 +6233,8 @@ function generateSnapshot(configInput, options) {
|
|
|
6197
6233
|
let summary;
|
|
6198
6234
|
let summaryQuality;
|
|
6199
6235
|
try {
|
|
6200
|
-
const outcome = summarizeFile(relativePath,
|
|
6201
|
-
summary = outcome?.summary;
|
|
6236
|
+
const outcome = summarizeFile(relativePath, rawContent);
|
|
6237
|
+
summary = outcome?.summary ? maskSummaryStrings(outcome.summary, config.secretRules) : void 0;
|
|
6202
6238
|
summaryQuality = outcome?.quality;
|
|
6203
6239
|
if (isSourceSummary(summary) && summary.parseErrors) {
|
|
6204
6240
|
warnings.push(
|
|
@@ -6458,5 +6494,5 @@ async function generateSnapshotAsync(configInput, options) {
|
|
|
6458
6494
|
}
|
|
6459
6495
|
|
|
6460
6496
|
export { ARTIFACT_NAMES, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PRESETS, PromptCancelled, SCHEMA_VERSION, anchorForPath, assertReplaceable, assertUsableConfigInput, collectFiles, compareManifests, countLines, defineConfig, detectLanguage, detectPreset, explainPath, fenceForContent, fenceForText, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, isBinaryBuffer, isBinaryExtension, isBinaryFile, isInteractive, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, profileForPath, renderConfig, renderDiffText, renderExplainText, renderMinimalConfig, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, unknownPresetMessage, validateSnapshot };
|
|
6461
|
-
//# sourceMappingURL=chunk-
|
|
6462
|
-
//# sourceMappingURL=chunk-
|
|
6497
|
+
//# sourceMappingURL=chunk-CDZDVU74.js.map
|
|
6498
|
+
//# sourceMappingURL=chunk-CDZDVU74.js.map
|
package/dist/cli.cjs
CHANGED
|
@@ -4502,7 +4502,31 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
4502
4502
|
}
|
|
4503
4503
|
lines.push("");
|
|
4504
4504
|
}
|
|
4505
|
-
|
|
4505
|
+
const parseIssues = manifest.files.filter(
|
|
4506
|
+
(file) => file.summary !== void 0 && typeof file.summary === "object" && "parseErrors" in file.summary && typeof file.summary.parseErrors === "number" && file.summary.parseErrors > 0
|
|
4507
|
+
);
|
|
4508
|
+
lines.push("## 2. Parse & AST Diagnostics", "");
|
|
4509
|
+
if (parseIssues.length === 0) {
|
|
4510
|
+
lines.push("\u2705 Every parsed file produced a complete structural summary.", "");
|
|
4511
|
+
} else {
|
|
4512
|
+
lines.push(
|
|
4513
|
+
`${parseIssues.length} file(s) produced an incomplete summary:`,
|
|
4514
|
+
"",
|
|
4515
|
+
"| File | Parse Errors |",
|
|
4516
|
+
"| :--- | ---: |"
|
|
4517
|
+
);
|
|
4518
|
+
for (const file of parseIssues) {
|
|
4519
|
+
const errors = file.summary.parseErrors;
|
|
4520
|
+
lines.push(`| \`${mask(file.relativePath)}\` | ${errors} |`);
|
|
4521
|
+
}
|
|
4522
|
+
lines.push(
|
|
4523
|
+
"",
|
|
4524
|
+
"A parse error here means the summary is incomplete, not that the file is excluded \u2014",
|
|
4525
|
+
"the content is still in the parts.",
|
|
4526
|
+
""
|
|
4527
|
+
);
|
|
4528
|
+
}
|
|
4529
|
+
lines.push("## 3. Large Files Analysis", "");
|
|
4506
4530
|
const largeFiles = manifest.files.filter((file) => file.isLarge);
|
|
4507
4531
|
if (largeFiles.length === 0) {
|
|
4508
4532
|
lines.push("\u2705 No files exceeded the large file budget.", "");
|
|
@@ -4521,7 +4545,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
4521
4545
|
lines.push("");
|
|
4522
4546
|
}
|
|
4523
4547
|
lines.push(
|
|
4524
|
-
"##
|
|
4548
|
+
"## 4. Architecture Layer Distribution",
|
|
4525
4549
|
"",
|
|
4526
4550
|
"| Layer | File Count | Percentage |",
|
|
4527
4551
|
"| :--- | :--- | :--- |"
|
|
@@ -4535,7 +4559,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
4535
4559
|
}
|
|
4536
4560
|
lines.push("");
|
|
4537
4561
|
lines.push(
|
|
4538
|
-
"##
|
|
4562
|
+
"## 5. File Kind Distribution",
|
|
4539
4563
|
"",
|
|
4540
4564
|
"| Kind | File Count | Percentage |",
|
|
4541
4565
|
"| :--- | :--- | :--- |"
|
|
@@ -4547,7 +4571,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
4547
4571
|
lines.push(`| \`${kind}\` | ${count} | ${pct}% |`);
|
|
4548
4572
|
}
|
|
4549
4573
|
lines.push("");
|
|
4550
|
-
lines.push("##
|
|
4574
|
+
lines.push("## 6. Skipped / Non-Text Files", "");
|
|
4551
4575
|
if (manifest.skipped.length === 0) {
|
|
4552
4576
|
lines.push("No files were skipped.", "");
|
|
4553
4577
|
} else {
|
|
@@ -5427,7 +5451,7 @@ function validateSnapshot(configInput) {
|
|
|
5427
5451
|
|
|
5428
5452
|
// src/index.ts
|
|
5429
5453
|
var GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
5430
|
-
var GENERATOR_VERSION = "4.0.
|
|
5454
|
+
var GENERATOR_VERSION = "4.0.4";
|
|
5431
5455
|
var SCHEMA_VERSION = "3.0.0";
|
|
5432
5456
|
function sha256Hex2(input) {
|
|
5433
5457
|
return crypto__namespace.createHash("sha256").update(input).digest("hex");
|
|
@@ -5634,6 +5658,18 @@ function resolveSafeOutputDirs(config) {
|
|
|
5634
5658
|
var PLACEHOLDER_ENTRIES = /* @__PURE__ */ new Set([".gitkeep", ".gitignore", ".DS_Store"]);
|
|
5635
5659
|
var RUN_DIR_PREFIX = "run-";
|
|
5636
5660
|
var STALE_RUN_MS = 60 * 60 * 1e3;
|
|
5661
|
+
function maskSummaryStrings(value, secretRules) {
|
|
5662
|
+
if (typeof value === "string") return maskPathText(value, secretRules);
|
|
5663
|
+
if (Array.isArray(value)) return value.map((item) => maskSummaryStrings(item, secretRules));
|
|
5664
|
+
if (value && typeof value === "object") {
|
|
5665
|
+
const out = {};
|
|
5666
|
+
for (const [key, item] of Object.entries(value)) {
|
|
5667
|
+
out[key] = maskSummaryStrings(item, secretRules);
|
|
5668
|
+
}
|
|
5669
|
+
return out;
|
|
5670
|
+
}
|
|
5671
|
+
return value;
|
|
5672
|
+
}
|
|
5637
5673
|
function maskPathText(value, secretRules) {
|
|
5638
5674
|
return findSecretInPath(value, secretRules)?.masked ?? value;
|
|
5639
5675
|
}
|
|
@@ -6214,8 +6250,8 @@ function generateSnapshot(configInput, options) {
|
|
|
6214
6250
|
let summary;
|
|
6215
6251
|
let summaryQuality;
|
|
6216
6252
|
try {
|
|
6217
|
-
const outcome = summarizeFile(relativePath,
|
|
6218
|
-
summary = outcome?.summary;
|
|
6253
|
+
const outcome = summarizeFile(relativePath, rawContent);
|
|
6254
|
+
summary = outcome?.summary ? maskSummaryStrings(outcome.summary, config.secretRules) : void 0;
|
|
6219
6255
|
summaryQuality = outcome?.quality;
|
|
6220
6256
|
if (isSourceSummary(summary) && summary.parseErrors) {
|
|
6221
6257
|
warnings.push(
|
|
@@ -7770,7 +7806,7 @@ ${USAGE}
|
|
|
7770
7806
|
info(` - Schema: ${manifest.schemaVersion}`);
|
|
7771
7807
|
info(` - Fingerprint: ${manifest.fingerprint}`);
|
|
7772
7808
|
info(` - Files included: ${manifest.counts.totalFiles}`);
|
|
7773
|
-
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString()}`);
|
|
7809
|
+
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString("en-US")}`);
|
|
7774
7810
|
info(
|
|
7775
7811
|
` - Total size: ${(manifest.counts.totalSizeBytes / (1024 * 1024)).toFixed(2)} MB`
|
|
7776
7812
|
);
|
|
@@ -7822,14 +7858,14 @@ ${USAGE}
|
|
|
7822
7858
|
info(`
|
|
7823
7859
|
\u2705 Snapshot generated in ${elapsed}s:`);
|
|
7824
7860
|
info(` - Tracked files: ${manifest.counts.totalFiles}`);
|
|
7825
|
-
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString()}`);
|
|
7861
|
+
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString("en-US")}`);
|
|
7826
7862
|
info(
|
|
7827
7863
|
` - Total size: ${(manifest.counts.totalSizeBytes / (1024 * 1024)).toFixed(2)} MB`
|
|
7828
7864
|
);
|
|
7829
7865
|
const { artifacts } = resolved;
|
|
7830
7866
|
if (artifacts.parts) {
|
|
7831
7867
|
info(
|
|
7832
|
-
` - Parts written: ${manifest.counts.partsCount} under ${displayOutPath(resolved.cwd, resolved.outDir, "parts")}
|
|
7868
|
+
` - Parts written: ${manifest.counts.partsCount} under ${displayOutPath(resolved.cwd, resolved.outDir, "parts")}`
|
|
7833
7869
|
);
|
|
7834
7870
|
}
|
|
7835
7871
|
const reports = [
|
|
@@ -7839,7 +7875,7 @@ ${USAGE}
|
|
|
7839
7875
|
].filter(Boolean);
|
|
7840
7876
|
if (reports.length > 0) {
|
|
7841
7877
|
info(
|
|
7842
|
-
` - Reports: ${displayOutPath(resolved.cwd, resolved.outDir, "reports")}
|
|
7878
|
+
` - Reports: ${displayOutPath(resolved.cwd, resolved.outDir, "reports")} (${reports.join(", ")})`
|
|
7843
7879
|
);
|
|
7844
7880
|
}
|
|
7845
7881
|
if (artifacts.manifest) {
|
|
@@ -7967,6 +8003,21 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
7967
8003
|
});
|
|
7968
8004
|
return 0;
|
|
7969
8005
|
}
|
|
8006
|
+
var entryFile = process.argv[1] ?? "";
|
|
8007
|
+
var entryName = path10__namespace.basename(entryFile).toLowerCase();
|
|
8008
|
+
var invokedDirectly = entryName === "cli.js" || entryName === "cli.cjs";
|
|
8009
|
+
if (invokedDirectly) {
|
|
8010
|
+
void main().then(
|
|
8011
|
+
(code) => {
|
|
8012
|
+
process.exitCode = code;
|
|
8013
|
+
},
|
|
8014
|
+
(err) => {
|
|
8015
|
+
process.stderr.write(`\u274C ${err.message}
|
|
8016
|
+
`);
|
|
8017
|
+
process.exitCode = 1;
|
|
8018
|
+
}
|
|
8019
|
+
);
|
|
8020
|
+
}
|
|
7970
8021
|
|
|
7971
8022
|
exports.UsageError = UsageError;
|
|
7972
8023
|
exports.main = main;
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { loadConfigFileDetailed, resolveConfig, validateSnapshot, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, GENERATOR_VERSION, ARTIFACT_NAMES, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, PromptCancelled, MIN_MAX_PART_BYTES, SCHEMA_VERSION, PRESETS, parseByteSize, renderExplainText } from './chunk-CDZDVU74.js';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path2 from 'path';
|
|
4
4
|
import { parseArgs } from 'util';
|
|
@@ -1302,7 +1302,7 @@ ${USAGE}
|
|
|
1302
1302
|
info(` - Schema: ${manifest.schemaVersion}`);
|
|
1303
1303
|
info(` - Fingerprint: ${manifest.fingerprint}`);
|
|
1304
1304
|
info(` - Files included: ${manifest.counts.totalFiles}`);
|
|
1305
|
-
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString()}`);
|
|
1305
|
+
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString("en-US")}`);
|
|
1306
1306
|
info(
|
|
1307
1307
|
` - Total size: ${(manifest.counts.totalSizeBytes / (1024 * 1024)).toFixed(2)} MB`
|
|
1308
1308
|
);
|
|
@@ -1354,14 +1354,14 @@ ${USAGE}
|
|
|
1354
1354
|
info(`
|
|
1355
1355
|
\u2705 Snapshot generated in ${elapsed}s:`);
|
|
1356
1356
|
info(` - Tracked files: ${manifest.counts.totalFiles}`);
|
|
1357
|
-
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString()}`);
|
|
1357
|
+
info(` - Total lines: ${manifest.counts.totalLines.toLocaleString("en-US")}`);
|
|
1358
1358
|
info(
|
|
1359
1359
|
` - Total size: ${(manifest.counts.totalSizeBytes / (1024 * 1024)).toFixed(2)} MB`
|
|
1360
1360
|
);
|
|
1361
1361
|
const { artifacts } = resolved;
|
|
1362
1362
|
if (artifacts.parts) {
|
|
1363
1363
|
info(
|
|
1364
|
-
` - Parts written: ${manifest.counts.partsCount} under ${displayOutPath(resolved.cwd, resolved.outDir, "parts")}
|
|
1364
|
+
` - Parts written: ${manifest.counts.partsCount} under ${displayOutPath(resolved.cwd, resolved.outDir, "parts")}`
|
|
1365
1365
|
);
|
|
1366
1366
|
}
|
|
1367
1367
|
const reports = [
|
|
@@ -1371,7 +1371,7 @@ ${USAGE}
|
|
|
1371
1371
|
].filter(Boolean);
|
|
1372
1372
|
if (reports.length > 0) {
|
|
1373
1373
|
info(
|
|
1374
|
-
` - Reports: ${displayOutPath(resolved.cwd, resolved.outDir, "reports")}
|
|
1374
|
+
` - Reports: ${displayOutPath(resolved.cwd, resolved.outDir, "reports")} (${reports.join(", ")})`
|
|
1375
1375
|
);
|
|
1376
1376
|
}
|
|
1377
1377
|
if (artifacts.manifest) {
|
|
@@ -1499,6 +1499,21 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
1499
1499
|
});
|
|
1500
1500
|
return 0;
|
|
1501
1501
|
}
|
|
1502
|
+
var entryFile = process.argv[1] ?? "";
|
|
1503
|
+
var entryName = path2.basename(entryFile).toLowerCase();
|
|
1504
|
+
var invokedDirectly = entryName === "cli.js" || entryName === "cli.cjs";
|
|
1505
|
+
if (invokedDirectly) {
|
|
1506
|
+
void main().then(
|
|
1507
|
+
(code) => {
|
|
1508
|
+
process.exitCode = code;
|
|
1509
|
+
},
|
|
1510
|
+
(err) => {
|
|
1511
|
+
process.stderr.write(`\u274C ${err.message}
|
|
1512
|
+
`);
|
|
1513
|
+
process.exitCode = 1;
|
|
1514
|
+
}
|
|
1515
|
+
);
|
|
1516
|
+
}
|
|
1502
1517
|
|
|
1503
1518
|
export { UsageError, main, parseByteOption, parseCliArgs, parsePositiveInteger };
|
|
1504
1519
|
//# sourceMappingURL=cli.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -3429,7 +3429,31 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
3429
3429
|
}
|
|
3430
3430
|
lines.push("");
|
|
3431
3431
|
}
|
|
3432
|
-
|
|
3432
|
+
const parseIssues = manifest.files.filter(
|
|
3433
|
+
(file) => file.summary !== void 0 && typeof file.summary === "object" && "parseErrors" in file.summary && typeof file.summary.parseErrors === "number" && file.summary.parseErrors > 0
|
|
3434
|
+
);
|
|
3435
|
+
lines.push("## 2. Parse & AST Diagnostics", "");
|
|
3436
|
+
if (parseIssues.length === 0) {
|
|
3437
|
+
lines.push("\u2705 Every parsed file produced a complete structural summary.", "");
|
|
3438
|
+
} else {
|
|
3439
|
+
lines.push(
|
|
3440
|
+
`${parseIssues.length} file(s) produced an incomplete summary:`,
|
|
3441
|
+
"",
|
|
3442
|
+
"| File | Parse Errors |",
|
|
3443
|
+
"| :--- | ---: |"
|
|
3444
|
+
);
|
|
3445
|
+
for (const file of parseIssues) {
|
|
3446
|
+
const errors = file.summary.parseErrors;
|
|
3447
|
+
lines.push(`| \`${mask(file.relativePath)}\` | ${errors} |`);
|
|
3448
|
+
}
|
|
3449
|
+
lines.push(
|
|
3450
|
+
"",
|
|
3451
|
+
"A parse error here means the summary is incomplete, not that the file is excluded \u2014",
|
|
3452
|
+
"the content is still in the parts.",
|
|
3453
|
+
""
|
|
3454
|
+
);
|
|
3455
|
+
}
|
|
3456
|
+
lines.push("## 3. Large Files Analysis", "");
|
|
3433
3457
|
const largeFiles = manifest.files.filter((file) => file.isLarge);
|
|
3434
3458
|
if (largeFiles.length === 0) {
|
|
3435
3459
|
lines.push("\u2705 No files exceeded the large file budget.", "");
|
|
@@ -3448,7 +3472,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
3448
3472
|
lines.push("");
|
|
3449
3473
|
}
|
|
3450
3474
|
lines.push(
|
|
3451
|
-
"##
|
|
3475
|
+
"## 4. Architecture Layer Distribution",
|
|
3452
3476
|
"",
|
|
3453
3477
|
"| Layer | File Count | Percentage |",
|
|
3454
3478
|
"| :--- | :--- | :--- |"
|
|
@@ -3462,7 +3486,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
3462
3486
|
}
|
|
3463
3487
|
lines.push("");
|
|
3464
3488
|
lines.push(
|
|
3465
|
-
"##
|
|
3489
|
+
"## 5. File Kind Distribution",
|
|
3466
3490
|
"",
|
|
3467
3491
|
"| Kind | File Count | Percentage |",
|
|
3468
3492
|
"| :--- | :--- | :--- |"
|
|
@@ -3474,7 +3498,7 @@ function generateAuditReport(manifest, secretFindings, secretRules) {
|
|
|
3474
3498
|
lines.push(`| \`${kind}\` | ${count} | ${pct}% |`);
|
|
3475
3499
|
}
|
|
3476
3500
|
lines.push("");
|
|
3477
|
-
lines.push("##
|
|
3501
|
+
lines.push("## 6. Skipped / Non-Text Files", "");
|
|
3478
3502
|
if (manifest.skipped.length === 0) {
|
|
3479
3503
|
lines.push("No files were skipped.", "");
|
|
3480
3504
|
} else {
|
|
@@ -5440,7 +5464,7 @@ async function runInit(options) {
|
|
|
5440
5464
|
|
|
5441
5465
|
// src/index.ts
|
|
5442
5466
|
var GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
5443
|
-
var GENERATOR_VERSION = "4.0.
|
|
5467
|
+
var GENERATOR_VERSION = "4.0.4";
|
|
5444
5468
|
var SCHEMA_VERSION = "3.0.0";
|
|
5445
5469
|
function sha256Hex2(input) {
|
|
5446
5470
|
return crypto__namespace.createHash("sha256").update(input).digest("hex");
|
|
@@ -5647,6 +5671,18 @@ function resolveSafeOutputDirs(config) {
|
|
|
5647
5671
|
var PLACEHOLDER_ENTRIES = /* @__PURE__ */ new Set([".gitkeep", ".gitignore", ".DS_Store"]);
|
|
5648
5672
|
var RUN_DIR_PREFIX = "run-";
|
|
5649
5673
|
var STALE_RUN_MS = 60 * 60 * 1e3;
|
|
5674
|
+
function maskSummaryStrings(value, secretRules) {
|
|
5675
|
+
if (typeof value === "string") return maskPathText(value, secretRules);
|
|
5676
|
+
if (Array.isArray(value)) return value.map((item) => maskSummaryStrings(item, secretRules));
|
|
5677
|
+
if (value && typeof value === "object") {
|
|
5678
|
+
const out = {};
|
|
5679
|
+
for (const [key, item] of Object.entries(value)) {
|
|
5680
|
+
out[key] = maskSummaryStrings(item, secretRules);
|
|
5681
|
+
}
|
|
5682
|
+
return out;
|
|
5683
|
+
}
|
|
5684
|
+
return value;
|
|
5685
|
+
}
|
|
5650
5686
|
function maskPathText(value, secretRules) {
|
|
5651
5687
|
return findSecretInPath(value, secretRules)?.masked ?? value;
|
|
5652
5688
|
}
|
|
@@ -6227,8 +6263,8 @@ function generateSnapshot(configInput, options) {
|
|
|
6227
6263
|
let summary;
|
|
6228
6264
|
let summaryQuality;
|
|
6229
6265
|
try {
|
|
6230
|
-
const outcome = summarizeFile(relativePath,
|
|
6231
|
-
summary = outcome?.summary;
|
|
6266
|
+
const outcome = summarizeFile(relativePath, rawContent);
|
|
6267
|
+
summary = outcome?.summary ? maskSummaryStrings(outcome.summary, config.secretRules) : void 0;
|
|
6232
6268
|
summaryQuality = outcome?.quality;
|
|
6233
6269
|
if (isSourceSummary(summary) && summary.parseErrors) {
|
|
6234
6270
|
warnings.push(
|
package/dist/index.d.cts
CHANGED
|
@@ -495,7 +495,7 @@ declare function matchesExclude(relativePath: string, pattern: string): boolean;
|
|
|
495
495
|
declare function collectFiles(cwd: string, options?: CollectOptions): CollectResult;
|
|
496
496
|
|
|
497
497
|
declare const GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
498
|
-
declare const GENERATOR_VERSION = "4.0.
|
|
498
|
+
declare const GENERATOR_VERSION = "4.0.4";
|
|
499
499
|
declare const SCHEMA_VERSION = "3.0.0";
|
|
500
500
|
interface GenerateOptions {
|
|
501
501
|
/** Compute the full manifest but write nothing to disk. */
|
package/dist/index.d.ts
CHANGED
|
@@ -495,7 +495,7 @@ declare function matchesExclude(relativePath: string, pattern: string): boolean;
|
|
|
495
495
|
declare function collectFiles(cwd: string, options?: CollectOptions): CollectResult;
|
|
496
496
|
|
|
497
497
|
declare const GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
498
|
-
declare const GENERATOR_VERSION = "4.0.
|
|
498
|
+
declare const GENERATOR_VERSION = "4.0.4";
|
|
499
499
|
declare const SCHEMA_VERSION = "3.0.0";
|
|
500
500
|
interface GenerateOptions {
|
|
501
501
|
/** Compute the full manifest but write nothing to disk. */
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ARTIFACT_NAMES, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PRESETS, PromptCancelled, SCHEMA_VERSION, anchorForPath, assertReplaceable, assertUsableConfigInput, collectFiles, compareManifests, countLines, defineConfig, detectLanguage, detectPreset, explainPath, fenceForContent, fenceForText, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, isBinaryBuffer, isBinaryExtension, isBinaryFile, isInteractive, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, profileForPath, renderConfig, renderDiffText, renderExplainText, renderMinimalConfig, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, validateSnapshot } from './chunk-
|
|
1
|
+
export { ARTIFACT_NAMES, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PRESETS, PromptCancelled, SCHEMA_VERSION, anchorForPath, assertReplaceable, assertUsableConfigInput, collectFiles, compareManifests, countLines, defineConfig, detectLanguage, detectPreset, explainPath, fenceForContent, fenceForText, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, isBinaryBuffer, isBinaryExtension, isBinaryFile, isInteractive, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, profileForPath, renderConfig, renderDiffText, renderExplainText, renderMinimalConfig, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, validateSnapshot } from './chunk-CDZDVU74.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|