codebase-snapshot 0.9.5 → 0.9.6
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 +46 -0
- package/README.md +4 -1
- package/dist/bin.js +405 -203
- package/dist/{chunk-B336MMNC.js → chunk-3KUL3QRH.js} +379 -222
- package/dist/{chunk-4AHHSNGG.js → chunk-ZKZOGGM3.js} +33 -7
- package/dist/cli.cjs +508 -310
- package/dist/cli.d.cts +7 -1
- package/dist/cli.d.ts +7 -1
- package/dist/cli.js +16 -2
- package/dist/index.cjs +384 -215
- package/dist/index.d.cts +54 -2
- package/dist/index.d.ts +54 -2
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +31 -4
- package/dist/mcp.d.cts +14 -1
- package/dist/mcp.d.ts +14 -1
- package/dist/mcp.js +2 -2
- package/docs/cli.md +19 -2
- package/docs/mcp.md +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var crypto = require('crypto');
|
|
4
4
|
var async_hooks = require('async_hooks');
|
|
5
|
-
var
|
|
5
|
+
var fs12 = require('fs');
|
|
6
6
|
var os = require('os');
|
|
7
|
-
var
|
|
7
|
+
var path13 = require('path');
|
|
8
8
|
var ts = require('typescript');
|
|
9
9
|
var module$1 = require('module');
|
|
10
10
|
var url = require('url');
|
|
11
11
|
var childProcess = require('child_process');
|
|
12
|
+
var https = require('https');
|
|
12
13
|
var readline = require('readline');
|
|
13
14
|
|
|
14
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -32,11 +33,12 @@ function _interopNamespace(e) {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
var crypto__namespace = /*#__PURE__*/_interopNamespace(crypto);
|
|
35
|
-
var
|
|
36
|
+
var fs12__namespace = /*#__PURE__*/_interopNamespace(fs12);
|
|
36
37
|
var os__namespace = /*#__PURE__*/_interopNamespace(os);
|
|
37
|
-
var
|
|
38
|
+
var path13__namespace = /*#__PURE__*/_interopNamespace(path13);
|
|
38
39
|
var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
39
40
|
var childProcess__namespace = /*#__PURE__*/_interopNamespace(childProcess);
|
|
41
|
+
var https__namespace = /*#__PURE__*/_interopNamespace(https);
|
|
40
42
|
var readline__namespace = /*#__PURE__*/_interopNamespace(readline);
|
|
41
43
|
|
|
42
44
|
// src/index.ts
|
|
@@ -263,9 +265,9 @@ var JAVA_METHOD = /^\s+(?:public|private|protected)\s+(?:static\s+)?(?:final\s+)
|
|
|
263
265
|
var jvmProfile = {
|
|
264
266
|
id: "jvm",
|
|
265
267
|
extensions: [".java", ".kt", ".kts", ".scala"],
|
|
266
|
-
summarize(
|
|
268
|
+
summarize(path14, content) {
|
|
267
269
|
const summary = emptySummary();
|
|
268
|
-
const lower =
|
|
270
|
+
const lower = path14.toLowerCase();
|
|
269
271
|
const isJava = lower.endsWith(".java");
|
|
270
272
|
const isKotlin = lower.endsWith(".kt") || lower.endsWith(".kts");
|
|
271
273
|
eachLine(content, (line) => {
|
|
@@ -718,16 +720,16 @@ function summarizeTypeScriptSource(relativePath, content) {
|
|
|
718
720
|
// src/ast/profiles/sfc.ts
|
|
719
721
|
var SCRIPT_BLOCK = /<script[^>]*>([\s\S]*?)<\/script>/gi;
|
|
720
722
|
var ASTRO_FRONTMATTER = /^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?=\r?\n|$)/;
|
|
721
|
-
function componentName(
|
|
722
|
-
const base =
|
|
723
|
+
function componentName(path14) {
|
|
724
|
+
const base = path14.split("/").pop() ?? path14;
|
|
723
725
|
return base.replace(/\.[^.]+$/, "");
|
|
724
726
|
}
|
|
725
727
|
var sfcProfile = {
|
|
726
728
|
id: "sfc",
|
|
727
729
|
extensions: [".vue", ".svelte", ".astro"],
|
|
728
|
-
summarize(
|
|
730
|
+
summarize(path14, content) {
|
|
729
731
|
let script = "";
|
|
730
|
-
if (
|
|
732
|
+
if (path14.toLowerCase().endsWith(".astro")) {
|
|
731
733
|
const frontmatter = ASTRO_FRONTMATTER.exec(content);
|
|
732
734
|
if (frontmatter) script += `${frontmatter[1]}
|
|
733
735
|
`;
|
|
@@ -736,7 +738,7 @@ var sfcProfile = {
|
|
|
736
738
|
script += `${match[1]}
|
|
737
739
|
`;
|
|
738
740
|
}
|
|
739
|
-
const name = componentName(
|
|
741
|
+
const name = componentName(path14);
|
|
740
742
|
if (!script.trim()) {
|
|
741
743
|
const summary2 = emptySummary();
|
|
742
744
|
if (name) {
|
|
@@ -770,15 +772,15 @@ for (const profile of LANGUAGE_PROFILES) {
|
|
|
770
772
|
BY_EXTENSION.set(extension.toLowerCase(), profile);
|
|
771
773
|
}
|
|
772
774
|
}
|
|
773
|
-
function profileForPath(
|
|
774
|
-
const lower =
|
|
775
|
+
function profileForPath(path14) {
|
|
776
|
+
const lower = path14.toLowerCase();
|
|
775
777
|
const dot = lower.lastIndexOf(".");
|
|
776
778
|
if (dot === -1) return null;
|
|
777
779
|
return BY_EXTENSION.get(lower.slice(dot)) ?? null;
|
|
778
780
|
}
|
|
779
|
-
function summarizeWithProfile(
|
|
780
|
-
const profile = profileForPath(
|
|
781
|
-
return profile ? profile.summarize(
|
|
781
|
+
function summarizeWithProfile(path14, content) {
|
|
782
|
+
const profile = profileForPath(path14);
|
|
783
|
+
return profile ? profile.summarize(path14, content) : null;
|
|
782
784
|
}
|
|
783
785
|
|
|
784
786
|
// src/ast/structured.ts
|
|
@@ -949,15 +951,15 @@ var SKIPPED_WALK_DIRS = /* @__PURE__ */ new Set([
|
|
|
949
951
|
]);
|
|
950
952
|
function readSmallFile(fullPath) {
|
|
951
953
|
try {
|
|
952
|
-
const stats =
|
|
954
|
+
const stats = fs12__namespace.statSync(fullPath);
|
|
953
955
|
if (!stats.isFile() || stats.size > MANIFEST_MAX_BYTES) return null;
|
|
954
|
-
return
|
|
956
|
+
return fs12__namespace.readFileSync(fullPath, "utf8");
|
|
955
957
|
} catch {
|
|
956
958
|
return null;
|
|
957
959
|
}
|
|
958
960
|
}
|
|
959
961
|
function readManifest(cwd, name) {
|
|
960
|
-
return readSmallFile(
|
|
962
|
+
return readSmallFile(path13__namespace.join(cwd, name));
|
|
961
963
|
}
|
|
962
964
|
function dependenciesFromPackageJson(raw) {
|
|
963
965
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -1017,7 +1019,7 @@ function pnpmWorkspacePatterns(raw) {
|
|
|
1017
1019
|
function childDirectories(cwd, parent) {
|
|
1018
1020
|
let entries;
|
|
1019
1021
|
try {
|
|
1020
|
-
entries =
|
|
1022
|
+
entries = fs12__namespace.readdirSync(path13__namespace.join(cwd, parent), { withFileTypes: true });
|
|
1021
1023
|
} catch {
|
|
1022
1024
|
return [];
|
|
1023
1025
|
}
|
|
@@ -1053,12 +1055,12 @@ function scanWorkspacePackages(cwd, patterns) {
|
|
|
1053
1055
|
const files = /* @__PURE__ */ new Set();
|
|
1054
1056
|
const dependencies = /* @__PURE__ */ new Set();
|
|
1055
1057
|
for (const relative7 of workspacePackageDirs(cwd, patterns)) {
|
|
1056
|
-
const full =
|
|
1058
|
+
const full = path13__namespace.join(cwd, relative7);
|
|
1057
1059
|
try {
|
|
1058
|
-
for (const entry of
|
|
1060
|
+
for (const entry of fs12__namespace.readdirSync(full, { withFileTypes: true })) files.add(entry.name);
|
|
1059
1061
|
} catch {
|
|
1060
1062
|
}
|
|
1061
|
-
const raw = readSmallFile(
|
|
1063
|
+
const raw = readSmallFile(path13__namespace.join(full, "package.json"));
|
|
1062
1064
|
if (raw !== null) {
|
|
1063
1065
|
for (const name of dependenciesFromPackageJson(raw)) dependencies.add(name);
|
|
1064
1066
|
}
|
|
@@ -1075,7 +1077,7 @@ function countMarkdownFiles(cwd) {
|
|
|
1075
1077
|
directoriesSeen += 1;
|
|
1076
1078
|
let entries;
|
|
1077
1079
|
try {
|
|
1078
|
-
entries =
|
|
1080
|
+
entries = fs12__namespace.readdirSync(current.dir, { withFileTypes: true });
|
|
1079
1081
|
} catch {
|
|
1080
1082
|
continue;
|
|
1081
1083
|
}
|
|
@@ -1086,7 +1088,7 @@ function countMarkdownFiles(cwd) {
|
|
|
1086
1088
|
}
|
|
1087
1089
|
if (!entry.isDirectory() || current.depth >= 2) continue;
|
|
1088
1090
|
if (entry.name.startsWith(".") || SKIPPED_WALK_DIRS.has(entry.name)) continue;
|
|
1089
|
-
queue.push({ dir:
|
|
1091
|
+
queue.push({ dir: path13__namespace.join(current.dir, entry.name), depth: current.depth + 1 });
|
|
1090
1092
|
}
|
|
1091
1093
|
}
|
|
1092
1094
|
return count;
|
|
@@ -1095,7 +1097,7 @@ function buildPresetContext(cwd) {
|
|
|
1095
1097
|
const files = /* @__PURE__ */ new Set();
|
|
1096
1098
|
const dirs = /* @__PURE__ */ new Set();
|
|
1097
1099
|
try {
|
|
1098
|
-
for (const entry of
|
|
1100
|
+
for (const entry of fs12__namespace.readdirSync(cwd, { withFileTypes: true })) {
|
|
1099
1101
|
if (entry.isDirectory()) dirs.add(entry.name);
|
|
1100
1102
|
else if (entry.isFile()) files.add(entry.name);
|
|
1101
1103
|
}
|
|
@@ -1112,7 +1114,7 @@ function buildPresetContext(cwd) {
|
|
|
1112
1114
|
const isWorkspace = files.has("pnpm-workspace.yaml") || files.has("nx.json") || files.has("turbo.json") || files.has("lerna.json") || packageJson !== void 0 && packageJson.includes('"workspaces"') || declaredWorkspaces.length > 0;
|
|
1113
1115
|
let workspace = { files: /* @__PURE__ */ new Set(), dependencies: /* @__PURE__ */ new Set() };
|
|
1114
1116
|
if (isWorkspace) {
|
|
1115
|
-
const pnpmRaw = files.has("pnpm-workspace.yaml") ? readSmallFile(
|
|
1117
|
+
const pnpmRaw = files.has("pnpm-workspace.yaml") ? readSmallFile(path13__namespace.join(cwd, "pnpm-workspace.yaml")) : null;
|
|
1116
1118
|
const declared = pnpmRaw === null ? [] : pnpmWorkspacePatterns(pnpmRaw);
|
|
1117
1119
|
const patterns = declared.length > 0 ? declared : declaredWorkspaces.length > 0 ? declaredWorkspaces : DEFAULT_WORKSPACE_PATTERNS;
|
|
1118
1120
|
workspace = scanWorkspacePackages(cwd, patterns);
|
|
@@ -2387,14 +2389,14 @@ var PRESET_IGNORES = new Set(
|
|
|
2387
2389
|
);
|
|
2388
2390
|
function readLinkTarget(linkPath, fallback) {
|
|
2389
2391
|
try {
|
|
2390
|
-
return
|
|
2392
|
+
return fs12__namespace.readlinkSync(linkPath);
|
|
2391
2393
|
} catch {
|
|
2392
2394
|
return fallback;
|
|
2393
2395
|
}
|
|
2394
2396
|
}
|
|
2395
2397
|
function isInside(root, candidate) {
|
|
2396
|
-
const relative7 =
|
|
2397
|
-
return relative7 === "" || !relative7.startsWith(`..${
|
|
2398
|
+
const relative7 = path13__namespace.relative(root, candidate);
|
|
2399
|
+
return relative7 === "" || !relative7.startsWith(`..${path13__namespace.sep}`) && relative7 !== ".." && !path13__namespace.isAbsolute(relative7);
|
|
2398
2400
|
}
|
|
2399
2401
|
function getGitInfo(cwd, fallbackBranch = "main") {
|
|
2400
2402
|
try {
|
|
@@ -2599,10 +2601,10 @@ function trimUnescapedTrailingSpaces(line) {
|
|
|
2599
2601
|
return line.slice(0, end);
|
|
2600
2602
|
}
|
|
2601
2603
|
function readGitignoreRules(dir) {
|
|
2602
|
-
const gitignorePath =
|
|
2604
|
+
const gitignorePath = path13__namespace.join(dir, ".gitignore");
|
|
2603
2605
|
let raw;
|
|
2604
2606
|
try {
|
|
2605
|
-
raw =
|
|
2607
|
+
raw = fs12__namespace.readFileSync(gitignorePath, "utf8");
|
|
2606
2608
|
} catch {
|
|
2607
2609
|
return [];
|
|
2608
2610
|
}
|
|
@@ -2729,7 +2731,7 @@ function isToolOwnedDirName(name) {
|
|
|
2729
2731
|
}
|
|
2730
2732
|
function hasSnapshotMarker(target) {
|
|
2731
2733
|
try {
|
|
2732
|
-
return
|
|
2734
|
+
return fs12__namespace.statSync(target).isDirectory() && fs12__namespace.existsSync(path13__namespace.join(target, ".codebase-snapshot"));
|
|
2733
2735
|
} catch {
|
|
2734
2736
|
return false;
|
|
2735
2737
|
}
|
|
@@ -2743,7 +2745,7 @@ function makeToolOwnedDecider(cwd, toolOwnedPaths) {
|
|
|
2743
2745
|
const prefix = parts.slice(0, depth).join("/");
|
|
2744
2746
|
let hasMarker = markers.get(prefix);
|
|
2745
2747
|
if (hasMarker === void 0) {
|
|
2746
|
-
hasMarker =
|
|
2748
|
+
hasMarker = fs12__namespace.existsSync(path13__namespace.join(cwd, prefix, ".codebase-snapshot"));
|
|
2747
2749
|
markers.set(prefix, hasMarker);
|
|
2748
2750
|
}
|
|
2749
2751
|
if (hasMarker) return true;
|
|
@@ -2758,7 +2760,7 @@ function makeLinkProbe() {
|
|
|
2758
2760
|
let known = cache.get(absolutePath);
|
|
2759
2761
|
if (known === void 0) {
|
|
2760
2762
|
try {
|
|
2761
|
-
known =
|
|
2763
|
+
known = fs12__namespace.lstatSync(absolutePath).isSymbolicLink();
|
|
2762
2764
|
} catch {
|
|
2763
2765
|
known = false;
|
|
2764
2766
|
}
|
|
@@ -2771,7 +2773,7 @@ function dropLinkedDirectories(cwd, candidates, skipped) {
|
|
|
2771
2773
|
const isLink = makeLinkProbe();
|
|
2772
2774
|
let rootReal = cwd;
|
|
2773
2775
|
try {
|
|
2774
|
-
rootReal =
|
|
2776
|
+
rootReal = fs12__namespace.realpathSync(cwd);
|
|
2775
2777
|
} catch {
|
|
2776
2778
|
}
|
|
2777
2779
|
const reported = /* @__PURE__ */ new Set();
|
|
@@ -2781,7 +2783,7 @@ function dropLinkedDirectories(cwd, candidates, skipped) {
|
|
|
2781
2783
|
let linkedDir = null;
|
|
2782
2784
|
for (let depth = 1; depth <= parts.length; depth += 1) {
|
|
2783
2785
|
const prefix = parts.slice(0, depth).join("/");
|
|
2784
|
-
if (isLink(
|
|
2786
|
+
if (isLink(path13__namespace.join(cwd, prefix))) {
|
|
2785
2787
|
linkedDir = prefix;
|
|
2786
2788
|
break;
|
|
2787
2789
|
}
|
|
@@ -2792,10 +2794,10 @@ function dropLinkedDirectories(cwd, candidates, skipped) {
|
|
|
2792
2794
|
}
|
|
2793
2795
|
if (reported.has(linkedDir)) continue;
|
|
2794
2796
|
reported.add(linkedDir);
|
|
2795
|
-
const absolute =
|
|
2797
|
+
const absolute = path13__namespace.join(cwd, linkedDir);
|
|
2796
2798
|
let targetReal = absolute;
|
|
2797
2799
|
try {
|
|
2798
|
-
targetReal =
|
|
2800
|
+
targetReal = fs12__namespace.realpathSync(absolute);
|
|
2799
2801
|
} catch {
|
|
2800
2802
|
}
|
|
2801
2803
|
const target = readLinkTarget(absolute, targetReal);
|
|
@@ -2872,7 +2874,7 @@ function collectFiles(cwd, options = {}) {
|
|
|
2872
2874
|
"Discovery mode is `git`, but git could not list this directory's files. Run inside a working repository, or pass --discovery walk (or auto) to scan the tree directly."
|
|
2873
2875
|
);
|
|
2874
2876
|
}
|
|
2875
|
-
if (
|
|
2877
|
+
if (fs12__namespace.existsSync(path13__namespace.join(cwd, ".git"))) {
|
|
2876
2878
|
throw new Error(
|
|
2877
2879
|
"This directory is a git repository, but git could not list its files. A plain walk honours .gitignore files, but git also applies .git/info/exclude and your global excludes file, includes files that are tracked although a .gitignore now matches them, and treats a submodule as a single entry. Fix the repository (git status should work), run outside git, or pass --discovery walk to accept those differences."
|
|
2878
2880
|
);
|
|
@@ -2931,7 +2933,7 @@ function collectFiles(cwd, options = {}) {
|
|
|
2931
2933
|
}
|
|
2932
2934
|
function rootRealFor(root) {
|
|
2933
2935
|
try {
|
|
2934
|
-
return
|
|
2936
|
+
return fs12__namespace.realpathSync(root);
|
|
2935
2937
|
} catch {
|
|
2936
2938
|
return root;
|
|
2937
2939
|
}
|
|
@@ -2939,18 +2941,18 @@ function rootRealFor(root) {
|
|
|
2939
2941
|
function walkDirectory(dir, baseDir, rootReal, visited, reservedPaths = /* @__PURE__ */ new Set(), parentGitignoreLayers = []) {
|
|
2940
2942
|
const results = { files: [], skipped: [] };
|
|
2941
2943
|
const stack = [];
|
|
2942
|
-
const relativeToBase = (target) =>
|
|
2944
|
+
const relativeToBase = (target) => path13__namespace.relative(baseDir, target).replace(/\\/g, "/") || ".";
|
|
2943
2945
|
const enter = (current, layers) => {
|
|
2944
2946
|
if (visited.has(current)) return false;
|
|
2945
2947
|
visited.add(current);
|
|
2946
2948
|
const localRules = readGitignoreRules(current);
|
|
2947
2949
|
const gitignoreLayers = localRules.length === 0 ? layers : [
|
|
2948
2950
|
...layers,
|
|
2949
|
-
{ prefix:
|
|
2951
|
+
{ prefix: path13__namespace.relative(baseDir, current).replace(/\\/g, "/"), rules: localRules }
|
|
2950
2952
|
];
|
|
2951
2953
|
let entries;
|
|
2952
2954
|
try {
|
|
2953
|
-
entries =
|
|
2955
|
+
entries = fs12__namespace.readdirSync(current, { withFileTypes: true });
|
|
2954
2956
|
} catch {
|
|
2955
2957
|
results.skipped.push({
|
|
2956
2958
|
path: relativeToBase(current),
|
|
@@ -2972,8 +2974,8 @@ function walkDirectory(dir, baseDir, rootReal, visited, reservedPaths = /* @__PU
|
|
|
2972
2974
|
}
|
|
2973
2975
|
const entry = frame.entries[frame.index];
|
|
2974
2976
|
frame.index += 1;
|
|
2975
|
-
const fullPath =
|
|
2976
|
-
const relPath =
|
|
2977
|
+
const fullPath = path13__namespace.join(frame.dir, entry.name);
|
|
2978
|
+
const relPath = path13__namespace.relative(baseDir, fullPath).replace(/\\/g, "/");
|
|
2977
2979
|
if (isToolOwnedDirName(entry.name) && reservedPaths.has(relPath)) continue;
|
|
2978
2980
|
if (DEFAULT_IGNORED_DIRS.includes(entry.name)) {
|
|
2979
2981
|
results.skipped.push({
|
|
@@ -3006,14 +3008,14 @@ function walkDirectory(dir, baseDir, rootReal, visited, reservedPaths = /* @__PU
|
|
|
3006
3008
|
if (entry.isSymbolicLink()) {
|
|
3007
3009
|
let targetReal;
|
|
3008
3010
|
try {
|
|
3009
|
-
targetReal =
|
|
3011
|
+
targetReal = fs12__namespace.realpathSync(fullPath);
|
|
3010
3012
|
} catch {
|
|
3011
3013
|
results.skipped.push({ path: relPath, reason: "read-error", detail: "broken symlink" });
|
|
3012
3014
|
continue;
|
|
3013
3015
|
}
|
|
3014
3016
|
let stats;
|
|
3015
3017
|
try {
|
|
3016
|
-
stats =
|
|
3018
|
+
stats = fs12__namespace.statSync(fullPath);
|
|
3017
3019
|
} catch {
|
|
3018
3020
|
results.skipped.push({ path: relPath, reason: "read-error", detail: "unreadable symlink" });
|
|
3019
3021
|
continue;
|
|
@@ -3311,11 +3313,11 @@ async function loadConfigFileDetailed(cwd) {
|
|
|
3311
3313
|
const warnings = [];
|
|
3312
3314
|
const errors = [];
|
|
3313
3315
|
for (const filename of CONFIG_FILENAMES) {
|
|
3314
|
-
const fullPath =
|
|
3315
|
-
if (!
|
|
3316
|
+
const fullPath = path13__namespace.join(cwd, filename);
|
|
3317
|
+
if (!fs12__namespace.existsSync(fullPath)) continue;
|
|
3316
3318
|
if (filename.endsWith(".json") || filename === ".snapshotrc") {
|
|
3317
3319
|
try {
|
|
3318
|
-
const config = parseJsonish(
|
|
3320
|
+
const config = parseJsonish(fs12__namespace.readFileSync(fullPath, "utf8"), fullPath);
|
|
3319
3321
|
if (config === null || typeof config !== "object" || Array.isArray(config)) {
|
|
3320
3322
|
throw new Error(
|
|
3321
3323
|
`${fullPath} does not hold a configuration object (received ${describeValue2(config)}).`
|
|
@@ -3349,10 +3351,10 @@ async function loadConfigFileDetailed(cwd) {
|
|
|
3349
3351
|
continue;
|
|
3350
3352
|
}
|
|
3351
3353
|
}
|
|
3352
|
-
const pkgJsonPath =
|
|
3353
|
-
if (
|
|
3354
|
+
const pkgJsonPath = path13__namespace.join(cwd, "package.json");
|
|
3355
|
+
if (fs12__namespace.existsSync(pkgJsonPath)) {
|
|
3354
3356
|
try {
|
|
3355
|
-
const parsed = parseJsonish(
|
|
3357
|
+
const parsed = parseJsonish(fs12__namespace.readFileSync(pkgJsonPath, "utf8"), pkgJsonPath);
|
|
3356
3358
|
const snapshotKey = parsed.snapshot;
|
|
3357
3359
|
if (snapshotKey && typeof snapshotKey === "object" && !Array.isArray(snapshotKey)) {
|
|
3358
3360
|
return { config: snapshotKey, file: pkgJsonPath, warnings, errors };
|
|
@@ -3375,7 +3377,7 @@ async function loadConfigFile(cwd) {
|
|
|
3375
3377
|
const loaded = await loadConfigFileDetailed(cwd);
|
|
3376
3378
|
if (loaded.config && loaded.file && typeof loaded.config === "object") {
|
|
3377
3379
|
Object.defineProperty(loaded.config, CONFIG_DIR_SYMBOL, {
|
|
3378
|
-
value:
|
|
3380
|
+
value: path13__namespace.dirname(loaded.file),
|
|
3379
3381
|
enumerable: false,
|
|
3380
3382
|
configurable: true
|
|
3381
3383
|
});
|
|
@@ -3534,9 +3536,9 @@ function resolveKindRules(value) {
|
|
|
3534
3536
|
function outputExcludePatterns(cwd, outDir, tmpDir) {
|
|
3535
3537
|
const patterns = [];
|
|
3536
3538
|
for (const dir of [outDir, tmpDir]) {
|
|
3537
|
-
const absolute =
|
|
3538
|
-
const relative7 =
|
|
3539
|
-
if (!relative7 || relative7 === ".." || relative7.startsWith(`..${
|
|
3539
|
+
const absolute = path13__namespace.resolve(cwd, dir);
|
|
3540
|
+
const relative7 = path13__namespace.relative(cwd, absolute);
|
|
3541
|
+
if (!relative7 || relative7 === ".." || relative7.startsWith(`..${path13__namespace.sep}`) || path13__namespace.isAbsolute(relative7)) {
|
|
3540
3542
|
continue;
|
|
3541
3543
|
}
|
|
3542
3544
|
patterns.push(`${relative7.replace(/\\/g, "/")}/**`);
|
|
@@ -3655,11 +3657,11 @@ function resolveCandidateCwd(userConfig, cliOptions, baseDir) {
|
|
|
3655
3657
|
);
|
|
3656
3658
|
}
|
|
3657
3659
|
const candidate = cliOptions?.cwd || userConfig?.cwd || baseDir || process.cwd();
|
|
3658
|
-
const resolved =
|
|
3659
|
-
if (!
|
|
3660
|
+
const resolved = path13__namespace.resolve(candidate);
|
|
3661
|
+
if (!fs12__namespace.existsSync(resolved)) {
|
|
3660
3662
|
throw new Error(`Working directory does not exist: ${resolved}`);
|
|
3661
3663
|
}
|
|
3662
|
-
if (!
|
|
3664
|
+
if (!fs12__namespace.statSync(resolved).isDirectory()) {
|
|
3663
3665
|
throw new Error(`Working directory is not a directory: ${resolved}`);
|
|
3664
3666
|
}
|
|
3665
3667
|
return resolved;
|
|
@@ -4683,7 +4685,7 @@ var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
4683
4685
|
".so"
|
|
4684
4686
|
]);
|
|
4685
4687
|
function isBinaryExtension(filePath) {
|
|
4686
|
-
const ext =
|
|
4688
|
+
const ext = path13__namespace.extname(filePath).toLowerCase();
|
|
4687
4689
|
return BINARY_EXTENSIONS.has(ext);
|
|
4688
4690
|
}
|
|
4689
4691
|
function isBinaryBuffer(buffer) {
|
|
@@ -4853,13 +4855,13 @@ function isBinaryFile(absolutePath) {
|
|
|
4853
4855
|
if (isBinaryExtension(absolutePath)) return true;
|
|
4854
4856
|
let fd;
|
|
4855
4857
|
try {
|
|
4856
|
-
fd =
|
|
4858
|
+
fd = fs12__namespace.openSync(absolutePath, "r");
|
|
4857
4859
|
const buffer = Buffer.alloc(CHUNK);
|
|
4858
4860
|
let sample;
|
|
4859
4861
|
let position = 0;
|
|
4860
4862
|
while (position < BINARY_SCAN_BYTES) {
|
|
4861
4863
|
const wanted = Math.min(CHUNK, BINARY_SCAN_BYTES - position);
|
|
4862
|
-
const bytesRead =
|
|
4864
|
+
const bytesRead = fs12__namespace.readSync(fd, buffer, 0, wanted, position);
|
|
4863
4865
|
if (bytesRead === 0) return false;
|
|
4864
4866
|
const chunk = buffer.subarray(0, bytesRead);
|
|
4865
4867
|
if (sample === void 0) {
|
|
@@ -4877,7 +4879,7 @@ function isBinaryFile(absolutePath) {
|
|
|
4877
4879
|
} finally {
|
|
4878
4880
|
if (fd !== void 0) {
|
|
4879
4881
|
try {
|
|
4880
|
-
|
|
4882
|
+
fs12__namespace.closeSync(fd);
|
|
4881
4883
|
} catch {
|
|
4882
4884
|
}
|
|
4883
4885
|
}
|
|
@@ -4937,10 +4939,10 @@ var LANGUAGE_BY_BASENAME = {
|
|
|
4937
4939
|
};
|
|
4938
4940
|
function detectLanguage(filePath) {
|
|
4939
4941
|
const normalized = filePath.replace(/\\/g, "/");
|
|
4940
|
-
const base =
|
|
4942
|
+
const base = path13__namespace.posix.basename(normalized);
|
|
4941
4943
|
if (LANGUAGE_BY_BASENAME[base]) return LANGUAGE_BY_BASENAME[base];
|
|
4942
4944
|
if (base === ".env" || base.startsWith(".env.")) return "dotenv";
|
|
4943
|
-
const ext =
|
|
4945
|
+
const ext = path13__namespace.posix.extname(base).toLowerCase();
|
|
4944
4946
|
return LANGUAGE_BY_EXTENSION[ext] ?? "text";
|
|
4945
4947
|
}
|
|
4946
4948
|
function maskedPath(value, secretRules) {
|
|
@@ -4948,33 +4950,33 @@ function maskedPath(value, secretRules) {
|
|
|
4948
4950
|
}
|
|
4949
4951
|
function confineToDirectory(directory, filename) {
|
|
4950
4952
|
if (filename.includes("\0")) return null;
|
|
4951
|
-
if (
|
|
4952
|
-
const base =
|
|
4953
|
-
const resolved =
|
|
4953
|
+
if (path13__namespace.isAbsolute(filename)) return null;
|
|
4954
|
+
const base = path13__namespace.resolve(directory);
|
|
4955
|
+
const resolved = path13__namespace.resolve(base, filename);
|
|
4954
4956
|
const caseInsensitive = process.platform === "win32" || process.platform === "darwin";
|
|
4955
|
-
const prefix = caseInsensitive ? `${base}${
|
|
4957
|
+
const prefix = caseInsensitive ? `${base}${path13__namespace.sep}`.toLowerCase() : `${base}${path13__namespace.sep}`;
|
|
4956
4958
|
const candidate = caseInsensitive ? resolved.toLowerCase() : resolved;
|
|
4957
4959
|
return candidate.startsWith(prefix) ? resolved : null;
|
|
4958
4960
|
}
|
|
4959
4961
|
function findStagingDirectory(config) {
|
|
4960
|
-
const tmpDir =
|
|
4962
|
+
const tmpDir = path13__namespace.resolve(config.cwd, config.tmpDir);
|
|
4961
4963
|
let entries;
|
|
4962
4964
|
try {
|
|
4963
|
-
entries =
|
|
4965
|
+
entries = fs12__namespace.readdirSync(tmpDir);
|
|
4964
4966
|
} catch {
|
|
4965
4967
|
return null;
|
|
4966
4968
|
}
|
|
4967
4969
|
const runs = entries.filter((name) => name.startsWith("run-")).sort();
|
|
4968
4970
|
const newest = runs[runs.length - 1];
|
|
4969
|
-
return newest ?
|
|
4971
|
+
return newest ? path13__namespace.join(tmpDir, newest) : null;
|
|
4970
4972
|
}
|
|
4971
4973
|
function describeMissingManifest(config, manifestPath) {
|
|
4972
|
-
const outDir =
|
|
4973
|
-
const markerPath =
|
|
4974
|
+
const outDir = path13__namespace.resolve(config.cwd, config.outDir);
|
|
4975
|
+
const markerPath = path13__namespace.join(outDir, ".codebase-snapshot");
|
|
4974
4976
|
let marker2 = null;
|
|
4975
4977
|
try {
|
|
4976
|
-
if (
|
|
4977
|
-
const parsed = JSON.parse(
|
|
4978
|
+
if (fs12__namespace.existsSync(markerPath)) {
|
|
4979
|
+
const parsed = JSON.parse(fs12__namespace.readFileSync(markerPath, "utf8"));
|
|
4978
4980
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
4979
4981
|
marker2 = parsed;
|
|
4980
4982
|
}
|
|
@@ -5010,14 +5012,14 @@ function sha256Hex(buffer) {
|
|
|
5010
5012
|
}
|
|
5011
5013
|
var VERIFY_SNIFF_MAX_BYTES = 8 * 1024 * 1024;
|
|
5012
5014
|
function wouldNowBeIncluded(cwd, relativePath, reason) {
|
|
5013
|
-
const absolutePath =
|
|
5015
|
+
const absolutePath = path13__namespace.join(cwd, relativePath);
|
|
5014
5016
|
try {
|
|
5015
|
-
const stats =
|
|
5017
|
+
const stats = fs12__namespace.statSync(absolutePath);
|
|
5016
5018
|
if (!stats.isFile()) return false;
|
|
5017
5019
|
if (isBinaryFile(absolutePath)) return false;
|
|
5018
5020
|
if (reason !== "binary") return true;
|
|
5019
5021
|
if (stats.size > VERIFY_SNIFF_MAX_BYTES) return false;
|
|
5020
|
-
return !decodeText(
|
|
5022
|
+
return !decodeText(fs12__namespace.readFileSync(absolutePath)).binary;
|
|
5021
5023
|
} catch {
|
|
5022
5024
|
return false;
|
|
5023
5025
|
}
|
|
@@ -5075,8 +5077,8 @@ function describeManifestShapeProblem(value) {
|
|
|
5075
5077
|
function validateSnapshot(configInput) {
|
|
5076
5078
|
assertUsableConfigInput(configInput);
|
|
5077
5079
|
const config = isResolvedConfig(configInput) ? normalizeResolvedConfig(configInput) : resolveConfig(configInput);
|
|
5078
|
-
const manifestPath =
|
|
5079
|
-
if (!
|
|
5080
|
+
const manifestPath = path13__namespace.resolve(config.cwd, config.outDir, "manifest.json");
|
|
5081
|
+
if (!fs12__namespace.existsSync(manifestPath)) {
|
|
5080
5082
|
return {
|
|
5081
5083
|
valid: false,
|
|
5082
5084
|
manifestPresent: false,
|
|
@@ -5087,7 +5089,7 @@ function validateSnapshot(configInput) {
|
|
|
5087
5089
|
}
|
|
5088
5090
|
let manifest;
|
|
5089
5091
|
try {
|
|
5090
|
-
manifest = JSON.parse(
|
|
5092
|
+
manifest = JSON.parse(fs12__namespace.readFileSync(manifestPath, "utf8"));
|
|
5091
5093
|
} catch (err) {
|
|
5092
5094
|
return {
|
|
5093
5095
|
valid: false,
|
|
@@ -5109,7 +5111,7 @@ function validateSnapshot(configInput) {
|
|
|
5109
5111
|
}
|
|
5110
5112
|
const drift = emptyDrift();
|
|
5111
5113
|
const warnings = [];
|
|
5112
|
-
const snapshotDir =
|
|
5114
|
+
const snapshotDir = path13__namespace.resolve(config.cwd, config.outDir);
|
|
5113
5115
|
const manifestFileMap = /* @__PURE__ */ new Map();
|
|
5114
5116
|
for (const file of manifest.files) {
|
|
5115
5117
|
if (file && typeof file.relativePath === "string") {
|
|
@@ -5143,7 +5145,7 @@ function validateSnapshot(configInput) {
|
|
|
5143
5145
|
}
|
|
5144
5146
|
let diskHash;
|
|
5145
5147
|
try {
|
|
5146
|
-
diskHash = sha256Hex(
|
|
5148
|
+
diskHash = sha256Hex(fs12__namespace.readFileSync(path13__namespace.join(config.cwd, diskFile)));
|
|
5147
5149
|
} catch (err) {
|
|
5148
5150
|
if (err.code === "ENOENT") {
|
|
5149
5151
|
drift.missingOnDisk.push(diskFile);
|
|
@@ -5167,7 +5169,7 @@ function validateSnapshot(configInput) {
|
|
|
5167
5169
|
}
|
|
5168
5170
|
let statFailure = null;
|
|
5169
5171
|
try {
|
|
5170
|
-
|
|
5172
|
+
fs12__namespace.statSync(confined);
|
|
5171
5173
|
} catch (err) {
|
|
5172
5174
|
statFailure = err;
|
|
5173
5175
|
}
|
|
@@ -5187,7 +5189,7 @@ function validateSnapshot(configInput) {
|
|
|
5187
5189
|
...Object.values(config.budgets.byLayer)
|
|
5188
5190
|
);
|
|
5189
5191
|
const partNames = /* @__PURE__ */ new Set();
|
|
5190
|
-
const partsDir =
|
|
5192
|
+
const partsDir = path13__namespace.join(snapshotDir, "parts");
|
|
5191
5193
|
for (const part of manifest.parts) {
|
|
5192
5194
|
if (!part || typeof part.filename !== "string") continue;
|
|
5193
5195
|
partNames.add(part.filename);
|
|
@@ -5202,7 +5204,7 @@ function validateSnapshot(configInput) {
|
|
|
5202
5204
|
}
|
|
5203
5205
|
let buffer;
|
|
5204
5206
|
try {
|
|
5205
|
-
buffer =
|
|
5207
|
+
buffer = fs12__namespace.readFileSync(partPath);
|
|
5206
5208
|
} catch {
|
|
5207
5209
|
drift.partIssues.push({ part: part.filename, issue: "missing from snapshot/parts" });
|
|
5208
5210
|
continue;
|
|
@@ -5416,9 +5418,9 @@ function validateSnapshot(configInput) {
|
|
|
5416
5418
|
["full-codebase.md", manifest.artifacts?.fullMarkdown]
|
|
5417
5419
|
]) {
|
|
5418
5420
|
if (!artifact) continue;
|
|
5419
|
-
const artifactPath =
|
|
5421
|
+
const artifactPath = path13__namespace.join(snapshotDir, key);
|
|
5420
5422
|
try {
|
|
5421
|
-
const buffer =
|
|
5423
|
+
const buffer = fs12__namespace.readFileSync(artifactPath);
|
|
5422
5424
|
if (sha256Hex(buffer) !== artifact.sha256 || buffer.length !== artifact.byteSize) {
|
|
5423
5425
|
drift.partIssues.push({ part: key, issue: "artifact does not match its recorded digest" });
|
|
5424
5426
|
}
|
|
@@ -5488,12 +5490,168 @@ function validateSnapshot(configInput) {
|
|
|
5488
5490
|
|
|
5489
5491
|
// src/version.ts
|
|
5490
5492
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
5491
|
-
var GENERATOR_VERSION = "0.9.
|
|
5493
|
+
var GENERATOR_VERSION = "0.9.6";
|
|
5492
5494
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
5493
5495
|
function isOurGeneratorName(name) {
|
|
5494
5496
|
if (typeof name !== "string") return false;
|
|
5495
5497
|
return name === GENERATOR_NAME || LEGACY_GENERATOR_NAMES.includes(name);
|
|
5496
5498
|
}
|
|
5499
|
+
var PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
|
|
5500
|
+
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
5501
|
+
var FAILURE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
5502
|
+
var REQUEST_TIMEOUT_MS = 1200;
|
|
5503
|
+
function versionParts(value) {
|
|
5504
|
+
const core = value.trim().replace(/^v/i, "").split("-")[0];
|
|
5505
|
+
return core.split(".").map((part) => {
|
|
5506
|
+
const parsed = Number(part);
|
|
5507
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
5508
|
+
});
|
|
5509
|
+
}
|
|
5510
|
+
function isNewer(candidate, current) {
|
|
5511
|
+
const left = versionParts(candidate);
|
|
5512
|
+
const right = versionParts(current);
|
|
5513
|
+
const length = Math.max(left.length, right.length);
|
|
5514
|
+
for (let index = 0; index < length; index += 1) {
|
|
5515
|
+
const a = left[index] ?? 0;
|
|
5516
|
+
const b = right[index] ?? 0;
|
|
5517
|
+
if (a !== b) return a > b;
|
|
5518
|
+
}
|
|
5519
|
+
return false;
|
|
5520
|
+
}
|
|
5521
|
+
function cacheDirectory(env = process.env, platform = process.platform) {
|
|
5522
|
+
if (platform === "win32") {
|
|
5523
|
+
const base2 = env.LOCALAPPDATA ?? path13__namespace.join(os__namespace.homedir(), "AppData", "Local");
|
|
5524
|
+
return path13__namespace.join(base2, "codebase-snapshot");
|
|
5525
|
+
}
|
|
5526
|
+
if (platform === "darwin") {
|
|
5527
|
+
return path13__namespace.join(os__namespace.homedir(), "Library", "Caches", "codebase-snapshot");
|
|
5528
|
+
}
|
|
5529
|
+
const base = env.XDG_CACHE_HOME ?? path13__namespace.join(os__namespace.homedir(), ".cache");
|
|
5530
|
+
return path13__namespace.join(base, "codebase-snapshot");
|
|
5531
|
+
}
|
|
5532
|
+
function cacheFilePath(env = process.env) {
|
|
5533
|
+
return path13__namespace.join(cacheDirectory(env), "update-check.json");
|
|
5534
|
+
}
|
|
5535
|
+
function shouldCheck(argv, env) {
|
|
5536
|
+
const disabled = ["1", "true", "yes"].includes(
|
|
5537
|
+
String(env.CODEBASE_SNAPSHOT_NO_UPDATE_CHECK ?? "").toLowerCase()
|
|
5538
|
+
);
|
|
5539
|
+
if (disabled) return false;
|
|
5540
|
+
if (env.CI !== void 0 && env.CI !== "" && env.CI !== "false" && env.CI !== "0") return false;
|
|
5541
|
+
const args = argv.map((argument) => argument.toLowerCase());
|
|
5542
|
+
if (args.includes("--no-update-check")) return false;
|
|
5543
|
+
for (const skip of ["mcp", "describe", "skill", "--version", "-v", "--help", "-h"]) {
|
|
5544
|
+
if (args.includes(skip)) return false;
|
|
5545
|
+
}
|
|
5546
|
+
if (args.some((argument) => argument.includes("json"))) return false;
|
|
5547
|
+
return true;
|
|
5548
|
+
}
|
|
5549
|
+
function readCache(file) {
|
|
5550
|
+
let raw;
|
|
5551
|
+
try {
|
|
5552
|
+
raw = fs12__namespace.readFileSync(file, "utf8");
|
|
5553
|
+
} catch {
|
|
5554
|
+
return null;
|
|
5555
|
+
}
|
|
5556
|
+
try {
|
|
5557
|
+
const parsed = JSON.parse(raw);
|
|
5558
|
+
if (typeof parsed !== "object" || parsed === null) return null;
|
|
5559
|
+
const candidate = parsed;
|
|
5560
|
+
if (typeof candidate.checkedAt !== "number") return null;
|
|
5561
|
+
const latest = typeof candidate.latest === "string" ? candidate.latest : null;
|
|
5562
|
+
return { checkedAt: candidate.checkedAt, latest };
|
|
5563
|
+
} catch {
|
|
5564
|
+
return null;
|
|
5565
|
+
}
|
|
5566
|
+
}
|
|
5567
|
+
function writeCache(file, entry) {
|
|
5568
|
+
try {
|
|
5569
|
+
fs12__namespace.mkdirSync(path13__namespace.dirname(file), { recursive: true });
|
|
5570
|
+
fs12__namespace.writeFileSync(file, `${JSON.stringify(entry)}
|
|
5571
|
+
`, "utf8");
|
|
5572
|
+
} catch {
|
|
5573
|
+
}
|
|
5574
|
+
}
|
|
5575
|
+
function fetchLatestVersion(url = PACKAGE_LATEST_URL, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
5576
|
+
return new Promise((resolve5) => {
|
|
5577
|
+
let settled = false;
|
|
5578
|
+
const finish = (value) => {
|
|
5579
|
+
if (settled) return;
|
|
5580
|
+
settled = true;
|
|
5581
|
+
resolve5(value);
|
|
5582
|
+
};
|
|
5583
|
+
const request = https__namespace.get(
|
|
5584
|
+
url,
|
|
5585
|
+
{
|
|
5586
|
+
headers: {
|
|
5587
|
+
accept: "application/json",
|
|
5588
|
+
"user-agent": "codebase-snapshot (update check)"
|
|
5589
|
+
}
|
|
5590
|
+
},
|
|
5591
|
+
(response) => {
|
|
5592
|
+
if (response.statusCode !== 200) {
|
|
5593
|
+
response.resume();
|
|
5594
|
+
finish(null);
|
|
5595
|
+
return;
|
|
5596
|
+
}
|
|
5597
|
+
let body = "";
|
|
5598
|
+
response.setEncoding("utf8");
|
|
5599
|
+
response.on("data", (chunk) => {
|
|
5600
|
+
body += chunk;
|
|
5601
|
+
if (body.length > 64 * 1024) {
|
|
5602
|
+
request.destroy();
|
|
5603
|
+
finish(null);
|
|
5604
|
+
}
|
|
5605
|
+
});
|
|
5606
|
+
response.on("end", () => {
|
|
5607
|
+
try {
|
|
5608
|
+
const parsed = JSON.parse(body);
|
|
5609
|
+
finish(typeof parsed.version === "string" ? parsed.version : null);
|
|
5610
|
+
} catch {
|
|
5611
|
+
finish(null);
|
|
5612
|
+
}
|
|
5613
|
+
});
|
|
5614
|
+
}
|
|
5615
|
+
);
|
|
5616
|
+
request.on("error", () => finish(null));
|
|
5617
|
+
request.setTimeout(timeoutMs, () => {
|
|
5618
|
+
request.destroy();
|
|
5619
|
+
finish(null);
|
|
5620
|
+
});
|
|
5621
|
+
});
|
|
5622
|
+
}
|
|
5623
|
+
async function checkForUpdate(options) {
|
|
5624
|
+
if (options.enabled === false) return null;
|
|
5625
|
+
const now = options.now ?? (() => Date.now());
|
|
5626
|
+
const fetchLatest = options.fetchLatest ?? fetchLatestVersion;
|
|
5627
|
+
let latest = null;
|
|
5628
|
+
try {
|
|
5629
|
+
const cached = readCache(options.cacheFile);
|
|
5630
|
+
let needsFetch = cached === null;
|
|
5631
|
+
if (cached) {
|
|
5632
|
+
const age = now() - cached.checkedAt;
|
|
5633
|
+
if (cached.latest === null) {
|
|
5634
|
+
needsFetch = age >= FAILURE_INTERVAL_MS;
|
|
5635
|
+
} else {
|
|
5636
|
+
latest = cached.latest;
|
|
5637
|
+
needsFetch = age >= CHECK_INTERVAL_MS;
|
|
5638
|
+
}
|
|
5639
|
+
}
|
|
5640
|
+
if (needsFetch) {
|
|
5641
|
+
const fetched = await fetchLatest(PACKAGE_LATEST_URL, REQUEST_TIMEOUT_MS);
|
|
5642
|
+
writeCache(options.cacheFile, { checkedAt: now(), latest: fetched });
|
|
5643
|
+
latest = fetched;
|
|
5644
|
+
}
|
|
5645
|
+
} catch {
|
|
5646
|
+
return null;
|
|
5647
|
+
}
|
|
5648
|
+
if (!latest) return null;
|
|
5649
|
+
return isNewer(latest, options.current) ? { current: options.current, latest } : null;
|
|
5650
|
+
}
|
|
5651
|
+
function formatUpdateNotice(notice) {
|
|
5652
|
+
return `\u2191 codebase-snapshot ${notice.latest} is available \u2014 you have ${notice.current}.
|
|
5653
|
+
npm install -g codebase-snapshot`;
|
|
5654
|
+
}
|
|
5497
5655
|
function describeMatcher(matcher) {
|
|
5498
5656
|
if (typeof matcher === "string") return matcher;
|
|
5499
5657
|
if (matcher instanceof RegExp) return String(matcher);
|
|
@@ -5503,10 +5661,10 @@ function describeMatcher(matcher) {
|
|
|
5503
5661
|
return String(matcher);
|
|
5504
5662
|
}
|
|
5505
5663
|
function normalizeTarget(cwd, target) {
|
|
5506
|
-
const absolute =
|
|
5507
|
-
const relative7 =
|
|
5508
|
-
if (relative7.startsWith("..") ||
|
|
5509
|
-
return relative7.split(
|
|
5664
|
+
const absolute = path13__namespace.resolve(cwd, target);
|
|
5665
|
+
const relative7 = path13__namespace.relative(cwd, absolute);
|
|
5666
|
+
if (relative7.startsWith("..") || path13__namespace.isAbsolute(relative7)) return target;
|
|
5667
|
+
return relative7.split(path13__namespace.sep).join("/");
|
|
5510
5668
|
}
|
|
5511
5669
|
function findRuleMatch(rules, relativePath) {
|
|
5512
5670
|
return rules.find(
|
|
@@ -5525,20 +5683,20 @@ function findRecordedAncestor(skipped, relative7, maskedPath2) {
|
|
|
5525
5683
|
return nearest;
|
|
5526
5684
|
}
|
|
5527
5685
|
function readManifest2(config) {
|
|
5528
|
-
const manifestPath =
|
|
5686
|
+
const manifestPath = path13__namespace.resolve(config.cwd, config.outDir, "manifest.json");
|
|
5529
5687
|
try {
|
|
5530
|
-
return JSON.parse(
|
|
5688
|
+
return JSON.parse(fs12__namespace.readFileSync(manifestPath, "utf8"));
|
|
5531
5689
|
} catch {
|
|
5532
5690
|
return null;
|
|
5533
5691
|
}
|
|
5534
5692
|
}
|
|
5535
5693
|
function explainPath(config, target) {
|
|
5536
5694
|
const relative7 = normalizeTarget(config.cwd, target);
|
|
5537
|
-
const absolute =
|
|
5695
|
+
const absolute = path13__namespace.join(config.cwd, relative7);
|
|
5538
5696
|
const maskedPath2 = findSecretInPath(relative7, config.secretRules)?.masked ?? relative7;
|
|
5539
5697
|
const result = {
|
|
5540
5698
|
path: maskedPath2,
|
|
5541
|
-
exists:
|
|
5699
|
+
exists: fs12__namespace.existsSync(absolute),
|
|
5542
5700
|
included: false
|
|
5543
5701
|
};
|
|
5544
5702
|
const collection = collectFiles(config.cwd, {
|
|
@@ -5549,7 +5707,7 @@ function explainPath(config, target) {
|
|
|
5549
5707
|
// Same exclusion `generate` applies, so `explain` never says "not-discovered" about a file
|
|
5550
5708
|
// that is only missing because the walker dropped the tool's own output directory.
|
|
5551
5709
|
toolOwnedPaths: [config.outDir, config.tmpDir].map(
|
|
5552
|
-
(directory) =>
|
|
5710
|
+
(directory) => path13__namespace.relative(config.cwd, path13__namespace.resolve(config.cwd, directory)).replace(/\\/g, "/")
|
|
5553
5711
|
).filter((relative8) => relative8.length > 0 && !relative8.startsWith(".."))
|
|
5554
5712
|
});
|
|
5555
5713
|
if (!collection.files.includes(relative7)) {
|
|
@@ -5588,8 +5746,8 @@ function explainPath(config, target) {
|
|
|
5588
5746
|
if (layerRule) result.layerMatch = describeMatcher(layerRule.match);
|
|
5589
5747
|
const kindRule = findRuleMatch(config.kinds, relative7);
|
|
5590
5748
|
if (kindRule) result.kindMatch = describeMatcher(kindRule.match);
|
|
5591
|
-
if (
|
|
5592
|
-
const buffer =
|
|
5749
|
+
if (fs12__namespace.existsSync(absolute) && fs12__namespace.statSync(absolute).isFile()) {
|
|
5750
|
+
const buffer = fs12__namespace.readFileSync(absolute);
|
|
5593
5751
|
const decoded = decodeText(buffer);
|
|
5594
5752
|
if (decoded.binary) {
|
|
5595
5753
|
result.included = false;
|
|
@@ -5837,14 +5995,14 @@ function compareManifests(before, after) {
|
|
|
5837
5995
|
function loadManifest(target) {
|
|
5838
5996
|
let isDirectory;
|
|
5839
5997
|
try {
|
|
5840
|
-
isDirectory =
|
|
5998
|
+
isDirectory = fs12__namespace.statSync(target).isDirectory();
|
|
5841
5999
|
} catch {
|
|
5842
6000
|
throw new Error(`No snapshot found at ${target}: the path does not exist.`);
|
|
5843
6001
|
}
|
|
5844
|
-
const manifestPath = isDirectory ?
|
|
6002
|
+
const manifestPath = isDirectory ? path13__namespace.join(target, "manifest.json") : target;
|
|
5845
6003
|
let raw;
|
|
5846
6004
|
try {
|
|
5847
|
-
raw =
|
|
6005
|
+
raw = fs12__namespace.readFileSync(manifestPath, "utf8");
|
|
5848
6006
|
} catch {
|
|
5849
6007
|
throw new Error(`Could not read a manifest at ${manifestPath}.`);
|
|
5850
6008
|
}
|
|
@@ -5901,15 +6059,15 @@ function renderDiffText(diff) {
|
|
|
5901
6059
|
function appendGitignoreEntries(cwd, entries) {
|
|
5902
6060
|
const wanted = [...new Set(entries)].filter((entry) => entry.trim().length > 0);
|
|
5903
6061
|
if (wanted.length === 0) return { added: [], note: null };
|
|
5904
|
-
const ignorePath =
|
|
6062
|
+
const ignorePath = path13__namespace.join(cwd, ".gitignore");
|
|
5905
6063
|
const manual = `Add ${wanted.map((entry) => `"${entry}"`).join(" and ")} to your .gitignore yourself.`;
|
|
5906
6064
|
let existing = "";
|
|
5907
6065
|
try {
|
|
5908
|
-
if (
|
|
5909
|
-
if (
|
|
6066
|
+
if (fs12__namespace.existsSync(ignorePath)) {
|
|
6067
|
+
if (fs12__namespace.statSync(ignorePath).isDirectory()) {
|
|
5910
6068
|
return { added: [], note: `${ignorePath} is a directory, so it was not updated. ${manual}` };
|
|
5911
6069
|
}
|
|
5912
|
-
existing =
|
|
6070
|
+
existing = fs12__namespace.readFileSync(ignorePath, "utf8");
|
|
5913
6071
|
}
|
|
5914
6072
|
} catch (err) {
|
|
5915
6073
|
return {
|
|
@@ -5922,7 +6080,7 @@ function appendGitignoreEntries(cwd, entries) {
|
|
|
5922
6080
|
if (added.length === 0) return { added: [], note: null };
|
|
5923
6081
|
const prefix = existing.length === 0 || existing.endsWith("\n") ? "" : "\n";
|
|
5924
6082
|
try {
|
|
5925
|
-
|
|
6083
|
+
fs12__namespace.writeFileSync(ignorePath, `${existing}${prefix}${added.join("\n")}
|
|
5926
6084
|
`, "utf8");
|
|
5927
6085
|
} catch (err) {
|
|
5928
6086
|
return { added: [], note: `${err.message}. ${manual}` };
|
|
@@ -6349,10 +6507,10 @@ var CONFIG_CANDIDATES = [
|
|
|
6349
6507
|
];
|
|
6350
6508
|
function chooseConfigFileName(cwd) {
|
|
6351
6509
|
if (!supportsTypeScriptImports()) return "snapshot.config.mjs";
|
|
6352
|
-
const pkgPath =
|
|
6353
|
-
if (!
|
|
6510
|
+
const pkgPath = path13__namespace.join(cwd, "package.json");
|
|
6511
|
+
if (!fs12__namespace.existsSync(pkgPath)) return "snapshot.config.mjs";
|
|
6354
6512
|
try {
|
|
6355
|
-
const parsed = JSON.parse(
|
|
6513
|
+
const parsed = JSON.parse(fs12__namespace.readFileSync(pkgPath, "utf8"));
|
|
6356
6514
|
return parsed.type === "module" ? "snapshot.config.ts" : "snapshot.config.mjs";
|
|
6357
6515
|
} catch {
|
|
6358
6516
|
return "snapshot.config.mjs";
|
|
@@ -6366,7 +6524,7 @@ var SIZE_CHOICES = [
|
|
|
6366
6524
|
];
|
|
6367
6525
|
function packageJsonHasConfig(cwd) {
|
|
6368
6526
|
try {
|
|
6369
|
-
const parsed = JSON.parse(
|
|
6527
|
+
const parsed = JSON.parse(fs12__namespace.readFileSync(path13__namespace.join(cwd, "package.json"), "utf8"));
|
|
6370
6528
|
return typeof parsed.snapshot === "object" && parsed.snapshot !== null && !Array.isArray(parsed.snapshot);
|
|
6371
6529
|
} catch {
|
|
6372
6530
|
return false;
|
|
@@ -6387,7 +6545,7 @@ function artifactAnswers(options) {
|
|
|
6387
6545
|
}
|
|
6388
6546
|
function topLevelDirs(cwd) {
|
|
6389
6547
|
try {
|
|
6390
|
-
return
|
|
6548
|
+
return fs12__namespace.readdirSync(cwd, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules").map((entry) => entry.name).sort();
|
|
6391
6549
|
} catch {
|
|
6392
6550
|
return [];
|
|
6393
6551
|
}
|
|
@@ -6400,7 +6558,7 @@ function describeJsonValue(value) {
|
|
|
6400
6558
|
}
|
|
6401
6559
|
function writeFileOrExplain(target, content) {
|
|
6402
6560
|
try {
|
|
6403
|
-
|
|
6561
|
+
fs12__namespace.writeFileSync(target, content, "utf8");
|
|
6404
6562
|
} catch (err) {
|
|
6405
6563
|
const code = err.code;
|
|
6406
6564
|
const reason = code === "EACCES" || code === "EPERM" || code === "EROFS" ? `permission denied (${code})` : code === "EISDIR" ? "it is a directory" : `${err.message}`;
|
|
@@ -6411,7 +6569,7 @@ function canWriteModuleConfig(name, cwd) {
|
|
|
6411
6569
|
if (name.endsWith(".mjs") || name.endsWith(".ts")) return true;
|
|
6412
6570
|
if (!name.endsWith(".js")) return false;
|
|
6413
6571
|
try {
|
|
6414
|
-
const parsed = JSON.parse(
|
|
6572
|
+
const parsed = JSON.parse(fs12__namespace.readFileSync(path13__namespace.join(cwd, "package.json"), "utf8"));
|
|
6415
6573
|
return parsed.type === "module";
|
|
6416
6574
|
} catch {
|
|
6417
6575
|
return false;
|
|
@@ -6446,19 +6604,19 @@ function serializePackageJson(raw, value) {
|
|
|
6446
6604
|
return `${text2}${raw.endsWith("\n") ? crlf ? "\r\n" : "\n" : ""}`;
|
|
6447
6605
|
}
|
|
6448
6606
|
function updatePackageJson(cwd, notes) {
|
|
6449
|
-
const packagePath =
|
|
6607
|
+
const packagePath = path13__namespace.join(cwd, "package.json");
|
|
6450
6608
|
const unchanged = {
|
|
6451
6609
|
scripts: [],
|
|
6452
6610
|
dependency: { name: GENERATOR_NAME, range: null, added: false }
|
|
6453
6611
|
};
|
|
6454
|
-
if (!
|
|
6612
|
+
if (!fs12__namespace.existsSync(packagePath)) {
|
|
6455
6613
|
notes.push("No package.json found, so npm scripts and the devDependency were not added.");
|
|
6456
6614
|
return unchanged;
|
|
6457
6615
|
}
|
|
6458
6616
|
let raw;
|
|
6459
6617
|
let parsed;
|
|
6460
6618
|
try {
|
|
6461
|
-
raw =
|
|
6619
|
+
raw = fs12__namespace.readFileSync(packagePath, "utf8");
|
|
6462
6620
|
parsed = JSON.parse(raw);
|
|
6463
6621
|
} catch {
|
|
6464
6622
|
notes.push("Could not parse package.json; npm scripts and the devDependency were not added.");
|
|
@@ -6750,7 +6908,7 @@ async function runInit(options) {
|
|
|
6750
6908
|
const configText = renderConfig(answers);
|
|
6751
6909
|
const preferredName = chooseConfigFileName(options.cwd);
|
|
6752
6910
|
const presentConfigs = CONFIG_CANDIDATES.filter(
|
|
6753
|
-
(name) =>
|
|
6911
|
+
(name) => fs12__namespace.existsSync(path13__namespace.join(options.cwd, name))
|
|
6754
6912
|
);
|
|
6755
6913
|
const present = presentConfigs[0] ?? null;
|
|
6756
6914
|
if (presentConfigs.length > 1) {
|
|
@@ -6759,7 +6917,7 @@ async function runInit(options) {
|
|
|
6759
6917
|
);
|
|
6760
6918
|
}
|
|
6761
6919
|
const configName = present !== null && options.force ? present : preferredName;
|
|
6762
|
-
const configPath =
|
|
6920
|
+
const configPath = path13__namespace.join(options.cwd, configName);
|
|
6763
6921
|
const reused = present !== null && options.force !== true && options.reuseConfig === true;
|
|
6764
6922
|
if (reused) notes.push(`Kept the existing ${present} instead of writing a new one.`);
|
|
6765
6923
|
if (options.dryRun) {
|
|
@@ -6792,7 +6950,7 @@ async function runInit(options) {
|
|
|
6792
6950
|
'package.json already defines a "snapshot" config. Remove that key, or re-run with --force to write a config file that takes precedence over it.'
|
|
6793
6951
|
);
|
|
6794
6952
|
}
|
|
6795
|
-
if (
|
|
6953
|
+
if (fs12__namespace.existsSync(configPath) && !options.force && !reused) {
|
|
6796
6954
|
throw new Error(`${configName} already exists. Re-run with --force to replace it.`);
|
|
6797
6955
|
}
|
|
6798
6956
|
if (!reused) writeFileOrExplain(configPath, configText);
|
|
@@ -6814,9 +6972,9 @@ async function runInit(options) {
|
|
|
6814
6972
|
};
|
|
6815
6973
|
}
|
|
6816
6974
|
function describeTarget(cwd) {
|
|
6817
|
-
const relative7 =
|
|
6975
|
+
const relative7 = path13__namespace.relative(process.cwd(), cwd);
|
|
6818
6976
|
if (relative7 === "") return "this directory";
|
|
6819
|
-
if (relative7.startsWith("..") ||
|
|
6977
|
+
if (relative7.startsWith("..") || path13__namespace.isAbsolute(relative7)) return cwd;
|
|
6820
6978
|
return relative7;
|
|
6821
6979
|
}
|
|
6822
6980
|
function firstRunMessage(reason, cwd) {
|
|
@@ -6840,7 +6998,7 @@ function planFirstRun(facts) {
|
|
|
6840
6998
|
var NOT_CONTENT = /* @__PURE__ */ new Set([".git", ".hg", ".svn", ".bzr", ".DS_Store", "Thumbs.db"]);
|
|
6841
6999
|
function isEffectivelyEmpty(cwd) {
|
|
6842
7000
|
try {
|
|
6843
|
-
return
|
|
7001
|
+
return fs12__namespace.readdirSync(cwd).every((entry) => NOT_CONTENT.has(entry));
|
|
6844
7002
|
} catch {
|
|
6845
7003
|
return false;
|
|
6846
7004
|
}
|
|
@@ -6848,7 +7006,7 @@ function isEffectivelyEmpty(cwd) {
|
|
|
6848
7006
|
function hasPriorSnapshot(cwd, outDir) {
|
|
6849
7007
|
let parsed;
|
|
6850
7008
|
try {
|
|
6851
|
-
parsed = JSON.parse(
|
|
7009
|
+
parsed = JSON.parse(fs12__namespace.readFileSync(path13__namespace.join(cwd, outDir, ".codebase-snapshot"), "utf8"));
|
|
6852
7010
|
} catch {
|
|
6853
7011
|
return false;
|
|
6854
7012
|
}
|
|
@@ -6936,13 +7094,13 @@ function buildImportResolver(files) {
|
|
|
6936
7094
|
const relativePath = file.relativePath;
|
|
6937
7095
|
remember(byPath, relativePath, relativePath);
|
|
6938
7096
|
remember(byPathFolded, relativePath.toLowerCase(), relativePath);
|
|
6939
|
-
const extension =
|
|
7097
|
+
const extension = path13__namespace.posix.extname(relativePath);
|
|
6940
7098
|
if (!SOURCE_EXTENSIONS.has(extension)) continue;
|
|
6941
7099
|
const stem = relativePath.slice(0, -extension.length);
|
|
6942
7100
|
remember(byStem, stem, relativePath);
|
|
6943
7101
|
remember(byStemFolded, stem.toLowerCase(), relativePath);
|
|
6944
|
-
if (
|
|
6945
|
-
const directory =
|
|
7102
|
+
if (path13__namespace.posix.basename(stem) === "index") {
|
|
7103
|
+
const directory = path13__namespace.posix.dirname(stem);
|
|
6946
7104
|
remember(byStem, directory, relativePath);
|
|
6947
7105
|
remember(byStemFolded, directory.toLowerCase(), relativePath);
|
|
6948
7106
|
}
|
|
@@ -6951,8 +7109,8 @@ function buildImportResolver(files) {
|
|
|
6951
7109
|
}
|
|
6952
7110
|
function resolveSpecifier(fromFile, specifier, resolver) {
|
|
6953
7111
|
if (!RELATIVE_SPECIFIER.test(specifier)) return null;
|
|
6954
|
-
const joined =
|
|
6955
|
-
|
|
7112
|
+
const joined = path13__namespace.posix.normalize(
|
|
7113
|
+
path13__namespace.posix.join(path13__namespace.posix.dirname(fromFile), specifier)
|
|
6956
7114
|
);
|
|
6957
7115
|
const exact = (key) => resolver.byPath.get(key) ?? resolver.byPathFolded.get(key.toLowerCase()) ?? null;
|
|
6958
7116
|
const direct = exact(joined);
|
|
@@ -7045,11 +7203,11 @@ function verifyInMemory(files, parts, maxPartBytes) {
|
|
|
7045
7203
|
return errors;
|
|
7046
7204
|
}
|
|
7047
7205
|
function resolveSafeOutputDirs(config) {
|
|
7048
|
-
const cwd =
|
|
7049
|
-
const outDir =
|
|
7050
|
-
const tmpDir =
|
|
7051
|
-
const root =
|
|
7052
|
-
const contains = (parent, child) => child === parent || child.startsWith(`${parent}${
|
|
7206
|
+
const cwd = path13__namespace.resolve(config.cwd);
|
|
7207
|
+
const outDir = path13__namespace.resolve(cwd, config.outDir);
|
|
7208
|
+
const tmpDir = path13__namespace.resolve(cwd, config.tmpDir);
|
|
7209
|
+
const root = path13__namespace.parse(cwd).root;
|
|
7210
|
+
const contains = (parent, child) => child === parent || child.startsWith(`${parent}${path13__namespace.sep}`);
|
|
7053
7211
|
const reject = (reason) => {
|
|
7054
7212
|
throw new Error(
|
|
7055
7213
|
`Refusing to generate: ${reason}. outDir=${outDir} tmpDir=${tmpDir} cwd=${cwd}`
|
|
@@ -7105,14 +7263,14 @@ function listEntries(dir) {
|
|
|
7105
7263
|
const walk = (absolute, prefix) => {
|
|
7106
7264
|
let children;
|
|
7107
7265
|
try {
|
|
7108
|
-
children =
|
|
7266
|
+
children = fs12__namespace.readdirSync(absolute, { withFileTypes: true });
|
|
7109
7267
|
} catch {
|
|
7110
7268
|
return;
|
|
7111
7269
|
}
|
|
7112
7270
|
for (const child of children) {
|
|
7113
7271
|
const relative7 = prefix === "" ? child.name : `${prefix}/${child.name}`;
|
|
7114
7272
|
entries.push(relative7);
|
|
7115
|
-
if (child.isDirectory()) walk(
|
|
7273
|
+
if (child.isDirectory()) walk(path13__namespace.join(absolute, child.name), relative7);
|
|
7116
7274
|
}
|
|
7117
7275
|
};
|
|
7118
7276
|
walk(dir, "");
|
|
@@ -7129,28 +7287,28 @@ function markerPayload(dir, state, id, createdAt) {
|
|
|
7129
7287
|
pid: process.pid,
|
|
7130
7288
|
entries: listEntries(dir)
|
|
7131
7289
|
};
|
|
7132
|
-
const manifestPath =
|
|
7133
|
-
if (
|
|
7134
|
-
marker2.manifestSha256 = sha256Hex2(
|
|
7290
|
+
const manifestPath = path13__namespace.join(dir, "manifest.json");
|
|
7291
|
+
if (fs12__namespace.existsSync(manifestPath)) {
|
|
7292
|
+
marker2.manifestSha256 = sha256Hex2(fs12__namespace.readFileSync(manifestPath));
|
|
7135
7293
|
}
|
|
7136
7294
|
return marker2;
|
|
7137
7295
|
}
|
|
7138
7296
|
function writeOwnershipMarker(dir, marker2) {
|
|
7139
|
-
|
|
7140
|
-
|
|
7297
|
+
fs12__namespace.writeFileSync(
|
|
7298
|
+
path13__namespace.join(dir, OWNERSHIP_MARKER),
|
|
7141
7299
|
`${JSON.stringify(marker2, null, 2)}
|
|
7142
7300
|
`,
|
|
7143
7301
|
"utf8"
|
|
7144
7302
|
);
|
|
7145
7303
|
}
|
|
7146
7304
|
function readOwnershipMarker(dir) {
|
|
7147
|
-
const markerPath =
|
|
7148
|
-
if (!
|
|
7305
|
+
const markerPath = path13__namespace.join(dir, OWNERSHIP_MARKER);
|
|
7306
|
+
if (!fs12__namespace.existsSync(markerPath)) {
|
|
7149
7307
|
return { marker: null, problem: "it holds no .codebase-snapshot marker" };
|
|
7150
7308
|
}
|
|
7151
7309
|
let raw;
|
|
7152
7310
|
try {
|
|
7153
|
-
raw =
|
|
7311
|
+
raw = fs12__namespace.readFileSync(markerPath, "utf8");
|
|
7154
7312
|
} catch {
|
|
7155
7313
|
return { marker: null, problem: "its .codebase-snapshot marker could not be read" };
|
|
7156
7314
|
}
|
|
@@ -7218,11 +7376,11 @@ function assessSnapshotDirectory(dir) {
|
|
|
7218
7376
|
marker: marker2
|
|
7219
7377
|
};
|
|
7220
7378
|
}
|
|
7221
|
-
const manifestPath =
|
|
7222
|
-
if (
|
|
7379
|
+
const manifestPath = path13__namespace.join(dir, "manifest.json");
|
|
7380
|
+
if (fs12__namespace.existsSync(manifestPath)) {
|
|
7223
7381
|
let raw;
|
|
7224
7382
|
try {
|
|
7225
|
-
raw =
|
|
7383
|
+
raw = fs12__namespace.readFileSync(manifestPath, "utf8");
|
|
7226
7384
|
} catch {
|
|
7227
7385
|
return {
|
|
7228
7386
|
owned: false,
|
|
@@ -7304,13 +7462,13 @@ function containsNoFiles(dir) {
|
|
|
7304
7462
|
const current = pending.pop();
|
|
7305
7463
|
let entries;
|
|
7306
7464
|
try {
|
|
7307
|
-
entries =
|
|
7465
|
+
entries = fs12__namespace.readdirSync(current, { withFileTypes: true });
|
|
7308
7466
|
} catch {
|
|
7309
7467
|
return false;
|
|
7310
7468
|
}
|
|
7311
7469
|
for (const entry of entries) {
|
|
7312
7470
|
if (entry.isDirectory()) {
|
|
7313
|
-
pending.push(
|
|
7471
|
+
pending.push(path13__namespace.join(current, entry.name));
|
|
7314
7472
|
} else if (!IGNORABLE_ENTRIES.has(entry.name)) {
|
|
7315
7473
|
return false;
|
|
7316
7474
|
}
|
|
@@ -7319,13 +7477,13 @@ function containsNoFiles(dir) {
|
|
|
7319
7477
|
return true;
|
|
7320
7478
|
}
|
|
7321
7479
|
function assertReplaceable(target, label, secretRules) {
|
|
7322
|
-
if (!
|
|
7323
|
-
if (!
|
|
7480
|
+
if (!fs12__namespace.existsSync(target)) return;
|
|
7481
|
+
if (!fs12__namespace.statSync(target).isDirectory()) {
|
|
7324
7482
|
throw new Error(
|
|
7325
7483
|
`Refusing to write into ${label} ${target}: it exists but is not a directory.`
|
|
7326
7484
|
);
|
|
7327
7485
|
}
|
|
7328
|
-
const entries =
|
|
7486
|
+
const entries = fs12__namespace.readdirSync(target);
|
|
7329
7487
|
if (entries.length === 0) return;
|
|
7330
7488
|
if (entries.every((name) => IGNORABLE_ENTRIES.has(name))) return;
|
|
7331
7489
|
if (containsNoFiles(target)) return;
|
|
@@ -7345,18 +7503,18 @@ function assertReplaceable(target, label, secretRules) {
|
|
|
7345
7503
|
);
|
|
7346
7504
|
}
|
|
7347
7505
|
function assertStagingRootUsable(tmpDir, secretRules) {
|
|
7348
|
-
if (!
|
|
7349
|
-
if (!
|
|
7506
|
+
if (!fs12__namespace.existsSync(tmpDir)) return;
|
|
7507
|
+
if (!fs12__namespace.statSync(tmpDir).isDirectory()) {
|
|
7350
7508
|
throw new Error(`Refusing to write into tmpDir ${tmpDir}: it exists but is not a directory.`);
|
|
7351
7509
|
}
|
|
7352
|
-
const entries =
|
|
7510
|
+
const entries = fs12__namespace.readdirSync(tmpDir);
|
|
7353
7511
|
if (entries.length === 0) return;
|
|
7354
7512
|
const foreign = entries.filter((name) => {
|
|
7355
|
-
const full =
|
|
7513
|
+
const full = path13__namespace.join(tmpDir, name);
|
|
7356
7514
|
if (!name.startsWith(RUN_DIR_PREFIX)) return true;
|
|
7357
7515
|
let stats;
|
|
7358
7516
|
try {
|
|
7359
|
-
stats =
|
|
7517
|
+
stats = fs12__namespace.statSync(full);
|
|
7360
7518
|
} catch {
|
|
7361
7519
|
return true;
|
|
7362
7520
|
}
|
|
@@ -7364,7 +7522,7 @@ function assertStagingRootUsable(tmpDir, secretRules) {
|
|
|
7364
7522
|
const { marker: marker2 } = readOwnershipMarker(full);
|
|
7365
7523
|
if (marker2) return false;
|
|
7366
7524
|
try {
|
|
7367
|
-
return
|
|
7525
|
+
return fs12__namespace.readdirSync(full).length > 0;
|
|
7368
7526
|
} catch {
|
|
7369
7527
|
return true;
|
|
7370
7528
|
}
|
|
@@ -7379,13 +7537,13 @@ function assertStagingRootUsable(tmpDir, secretRules) {
|
|
|
7379
7537
|
function cleanStaleRunDirs(tmpDir) {
|
|
7380
7538
|
let entries;
|
|
7381
7539
|
try {
|
|
7382
|
-
entries =
|
|
7540
|
+
entries = fs12__namespace.readdirSync(tmpDir);
|
|
7383
7541
|
} catch {
|
|
7384
7542
|
return;
|
|
7385
7543
|
}
|
|
7386
7544
|
for (const name of entries) {
|
|
7387
7545
|
if (!name.startsWith(RUN_DIR_PREFIX)) continue;
|
|
7388
|
-
const full =
|
|
7546
|
+
const full = path13__namespace.join(tmpDir, name);
|
|
7389
7547
|
const { marker: marker2 } = readOwnershipMarker(full);
|
|
7390
7548
|
if (marker2) {
|
|
7391
7549
|
const created = Date.parse(marker2.createdAt);
|
|
@@ -7393,33 +7551,33 @@ function cleanStaleRunDirs(tmpDir) {
|
|
|
7393
7551
|
const abandoned = typeof marker2.pid === "number" && !isProcessAlive(marker2.pid);
|
|
7394
7552
|
if (aged || abandoned) {
|
|
7395
7553
|
try {
|
|
7396
|
-
|
|
7554
|
+
fs12__namespace.rmSync(full, { recursive: true, force: true });
|
|
7397
7555
|
} catch {
|
|
7398
7556
|
}
|
|
7399
7557
|
}
|
|
7400
7558
|
continue;
|
|
7401
7559
|
}
|
|
7402
7560
|
try {
|
|
7403
|
-
if (
|
|
7561
|
+
if (fs12__namespace.readdirSync(full).length === 0) fs12__namespace.rmSync(full, { recursive: true, force: true });
|
|
7404
7562
|
} catch {
|
|
7405
7563
|
}
|
|
7406
7564
|
}
|
|
7407
7565
|
}
|
|
7408
7566
|
function removeIfEmpty(dir) {
|
|
7409
7567
|
try {
|
|
7410
|
-
if (
|
|
7568
|
+
if (fs12__namespace.readdirSync(dir).length === 0) fs12__namespace.rmSync(dir, { recursive: true, force: true });
|
|
7411
7569
|
} catch {
|
|
7412
7570
|
}
|
|
7413
7571
|
}
|
|
7414
7572
|
function ensureParentDirectory(target, label) {
|
|
7415
|
-
const parent =
|
|
7416
|
-
if (
|
|
7573
|
+
const parent = path13__namespace.dirname(target);
|
|
7574
|
+
if (fs12__namespace.existsSync(parent) && !fs12__namespace.statSync(parent).isDirectory()) {
|
|
7417
7575
|
throw new Error(
|
|
7418
7576
|
`Refusing to create ${label} ${target}: ${parent} exists but is not a directory.`
|
|
7419
7577
|
);
|
|
7420
7578
|
}
|
|
7421
7579
|
try {
|
|
7422
|
-
|
|
7580
|
+
fs12__namespace.mkdirSync(parent, { recursive: true });
|
|
7423
7581
|
} catch (err) {
|
|
7424
7582
|
throw new Error(
|
|
7425
7583
|
`Refusing to create ${label} ${target}: its parent ${parent} could not be created (${err.message}).`
|
|
@@ -7428,7 +7586,7 @@ function ensureParentDirectory(target, label) {
|
|
|
7428
7586
|
}
|
|
7429
7587
|
function acquireRunLock(stagingRoot) {
|
|
7430
7588
|
const key = lockKeyFor(stagingRoot);
|
|
7431
|
-
const lockPath =
|
|
7589
|
+
const lockPath = path13__namespace.join(os__namespace.tmpdir(), `codebase-snapshot-${key}.lock`);
|
|
7432
7590
|
const payload = `${JSON.stringify({
|
|
7433
7591
|
pid: process.pid,
|
|
7434
7592
|
stagingRoot,
|
|
@@ -7437,22 +7595,22 @@ function acquireRunLock(stagingRoot) {
|
|
|
7437
7595
|
`;
|
|
7438
7596
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
7439
7597
|
try {
|
|
7440
|
-
const handle =
|
|
7598
|
+
const handle = fs12__namespace.openSync(lockPath, "wx");
|
|
7441
7599
|
try {
|
|
7442
|
-
|
|
7600
|
+
fs12__namespace.writeSync(handle, payload);
|
|
7443
7601
|
} finally {
|
|
7444
|
-
|
|
7602
|
+
fs12__namespace.closeSync(handle);
|
|
7445
7603
|
}
|
|
7446
7604
|
return () => {
|
|
7447
7605
|
try {
|
|
7448
|
-
|
|
7606
|
+
fs12__namespace.rmSync(lockPath, { force: true });
|
|
7449
7607
|
} catch {
|
|
7450
7608
|
}
|
|
7451
7609
|
};
|
|
7452
7610
|
} catch (err) {
|
|
7453
7611
|
if (err.code !== "EEXIST") throw err;
|
|
7454
7612
|
if (attempt === 0 && lockOwnerIsGone(lockPath)) {
|
|
7455
|
-
|
|
7613
|
+
fs12__namespace.rmSync(lockPath, { force: true });
|
|
7456
7614
|
continue;
|
|
7457
7615
|
}
|
|
7458
7616
|
throw new Error(
|
|
@@ -7465,7 +7623,7 @@ function acquireRunLock(stagingRoot) {
|
|
|
7465
7623
|
function lockKeyFor(stagingRoot) {
|
|
7466
7624
|
let key = stagingRoot;
|
|
7467
7625
|
try {
|
|
7468
|
-
key =
|
|
7626
|
+
key = fs12__namespace.realpathSync(stagingRoot);
|
|
7469
7627
|
} catch {
|
|
7470
7628
|
}
|
|
7471
7629
|
if (process.platform === "win32" || process.platform === "darwin") key = key.toLowerCase();
|
|
@@ -7474,7 +7632,7 @@ function lockKeyFor(stagingRoot) {
|
|
|
7474
7632
|
function lockOwnerIsGone(lockPath) {
|
|
7475
7633
|
let raw;
|
|
7476
7634
|
try {
|
|
7477
|
-
raw =
|
|
7635
|
+
raw = fs12__namespace.readFileSync(lockPath, "utf8");
|
|
7478
7636
|
} catch {
|
|
7479
7637
|
return false;
|
|
7480
7638
|
}
|
|
@@ -7494,12 +7652,12 @@ function lockOwnerIsGone(lockPath) {
|
|
|
7494
7652
|
}
|
|
7495
7653
|
function writeManifestAtomically(manifestPath, manifest) {
|
|
7496
7654
|
const tempPath = `${manifestPath}.${process.pid}.tmp`;
|
|
7497
|
-
|
|
7655
|
+
fs12__namespace.writeFileSync(tempPath, JSON.stringify(manifest, null, 2), "utf8");
|
|
7498
7656
|
try {
|
|
7499
|
-
|
|
7657
|
+
fs12__namespace.renameSync(tempPath, manifestPath);
|
|
7500
7658
|
} catch (err) {
|
|
7501
7659
|
try {
|
|
7502
|
-
|
|
7660
|
+
fs12__namespace.rmSync(tempPath, { force: true });
|
|
7503
7661
|
} catch {
|
|
7504
7662
|
}
|
|
7505
7663
|
throw err;
|
|
@@ -7522,31 +7680,31 @@ function swapIntoPlace(stagingDir, outDir) {
|
|
|
7522
7680
|
}
|
|
7523
7681
|
function swapOnce(stagingDir, outDir) {
|
|
7524
7682
|
const backupDir = `${outDir}.backup-${process.pid}-${Date.now()}`;
|
|
7525
|
-
const hadPrevious =
|
|
7526
|
-
if (hadPrevious)
|
|
7683
|
+
const hadPrevious = fs12__namespace.existsSync(outDir);
|
|
7684
|
+
if (hadPrevious) fs12__namespace.renameSync(outDir, backupDir);
|
|
7527
7685
|
try {
|
|
7528
7686
|
try {
|
|
7529
|
-
|
|
7687
|
+
fs12__namespace.renameSync(stagingDir, outDir);
|
|
7530
7688
|
} catch (err) {
|
|
7531
7689
|
if (err.code !== "EXDEV") throw err;
|
|
7532
7690
|
const partialDir = `${outDir}.partial-${process.pid}-${Date.now()}`;
|
|
7533
7691
|
try {
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7692
|
+
fs12__namespace.cpSync(stagingDir, partialDir, { recursive: true });
|
|
7693
|
+
fs12__namespace.renameSync(partialDir, outDir);
|
|
7694
|
+
fs12__namespace.rmSync(stagingDir, { recursive: true, force: true });
|
|
7537
7695
|
} catch (copyErr) {
|
|
7538
7696
|
try {
|
|
7539
|
-
|
|
7697
|
+
fs12__namespace.rmSync(partialDir, { recursive: true, force: true });
|
|
7540
7698
|
} catch {
|
|
7541
7699
|
}
|
|
7542
7700
|
throw copyErr;
|
|
7543
7701
|
}
|
|
7544
7702
|
}
|
|
7545
|
-
if (hadPrevious)
|
|
7703
|
+
if (hadPrevious) fs12__namespace.rmSync(backupDir, { recursive: true, force: true });
|
|
7546
7704
|
} catch (err) {
|
|
7547
|
-
if (hadPrevious &&
|
|
7548
|
-
if (
|
|
7549
|
-
|
|
7705
|
+
if (hadPrevious && fs12__namespace.existsSync(backupDir)) {
|
|
7706
|
+
if (fs12__namespace.existsSync(outDir)) fs12__namespace.rmSync(outDir, { recursive: true, force: true });
|
|
7707
|
+
fs12__namespace.renameSync(backupDir, outDir);
|
|
7550
7708
|
}
|
|
7551
7709
|
throw err;
|
|
7552
7710
|
}
|
|
@@ -7641,7 +7799,7 @@ function generateSnapshot(configInput, options) {
|
|
|
7641
7799
|
// first run cannot have marked them yet, so the name alone keeps a run from recording its own
|
|
7642
7800
|
// output — but only at these exact paths, not at every directory that shares the name.
|
|
7643
7801
|
toolOwnedPaths: [config.outDir, config.tmpDir].map(
|
|
7644
|
-
(directory) =>
|
|
7802
|
+
(directory) => path13__namespace.relative(config.cwd, path13__namespace.resolve(config.cwd, directory)).replace(/\\/g, "/")
|
|
7645
7803
|
).filter((relative7) => relative7.length > 0 && !relative7.startsWith(".."))
|
|
7646
7804
|
});
|
|
7647
7805
|
const files = [];
|
|
@@ -7662,12 +7820,12 @@ function generateSnapshot(configInput, options) {
|
|
|
7662
7820
|
let totalSizeBytes = 0;
|
|
7663
7821
|
let largeFileCount = 0;
|
|
7664
7822
|
for (const relativePath of collection.files) {
|
|
7665
|
-
const absolutePath =
|
|
7823
|
+
const absolutePath = path13__namespace.join(config.cwd, relativePath);
|
|
7666
7824
|
let stats;
|
|
7667
7825
|
try {
|
|
7668
|
-
stats =
|
|
7826
|
+
stats = fs12__namespace.statSync(absolutePath);
|
|
7669
7827
|
if (!stats.isFile()) {
|
|
7670
|
-
const nestedRepository = stats.isDirectory() &&
|
|
7828
|
+
const nestedRepository = stats.isDirectory() && fs12__namespace.existsSync(path13__namespace.join(absolutePath, ".git"));
|
|
7671
7829
|
skipped.push(
|
|
7672
7830
|
nestedRepository ? {
|
|
7673
7831
|
path: relativePath,
|
|
@@ -7687,7 +7845,7 @@ function generateSnapshot(configInput, options) {
|
|
|
7687
7845
|
}
|
|
7688
7846
|
let buffer;
|
|
7689
7847
|
try {
|
|
7690
|
-
buffer =
|
|
7848
|
+
buffer = fs12__namespace.readFileSync(absolutePath);
|
|
7691
7849
|
} catch {
|
|
7692
7850
|
skipped.push({ path: relativePath, reason: "read-error" });
|
|
7693
7851
|
continue;
|
|
@@ -8017,12 +8175,12 @@ function generateSnapshot(configInput, options) {
|
|
|
8017
8175
|
let stagingDir = null;
|
|
8018
8176
|
try {
|
|
8019
8177
|
ensureParentDirectory(outDir, "outDir");
|
|
8020
|
-
|
|
8178
|
+
fs12__namespace.mkdirSync(tmpDir, { recursive: true });
|
|
8021
8179
|
cleanStaleRunDirs(tmpDir);
|
|
8022
8180
|
const snapshotId = crypto__namespace.randomUUID();
|
|
8023
8181
|
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
8024
|
-
stagingDir =
|
|
8025
|
-
|
|
8182
|
+
stagingDir = path13__namespace.join(tmpDir, `${RUN_DIR_PREFIX}${process.pid}-${snapshotId.slice(0, 8)}`);
|
|
8183
|
+
fs12__namespace.mkdirSync(stagingDir);
|
|
8026
8184
|
writeOwnershipMarker(stagingDir, {
|
|
8027
8185
|
generator: GENERATOR_NAME,
|
|
8028
8186
|
version: GENERATOR_VERSION,
|
|
@@ -8032,41 +8190,41 @@ function generateSnapshot(configInput, options) {
|
|
|
8032
8190
|
id: snapshotId,
|
|
8033
8191
|
pid: process.pid
|
|
8034
8192
|
});
|
|
8035
|
-
const partsDir =
|
|
8036
|
-
const reportsDir =
|
|
8037
|
-
if (artifacts.parts)
|
|
8193
|
+
const partsDir = path13__namespace.join(stagingDir, "parts");
|
|
8194
|
+
const reportsDir = path13__namespace.join(stagingDir, "reports");
|
|
8195
|
+
if (artifacts.parts) fs12__namespace.mkdirSync(partsDir, { recursive: true });
|
|
8038
8196
|
if (artifacts.navigation || artifacts.projectTree || artifacts.audit) {
|
|
8039
|
-
|
|
8197
|
+
fs12__namespace.mkdirSync(reportsDir, { recursive: true });
|
|
8040
8198
|
}
|
|
8041
8199
|
if (artifacts.parts) {
|
|
8042
8200
|
for (const part of parts) {
|
|
8043
|
-
|
|
8201
|
+
fs12__namespace.writeFileSync(path13__namespace.join(partsDir, part.filename), part.markdown, "utf8");
|
|
8044
8202
|
}
|
|
8045
8203
|
}
|
|
8046
8204
|
if (projectTree !== null) {
|
|
8047
|
-
|
|
8205
|
+
fs12__namespace.writeFileSync(path13__namespace.join(reportsDir, "project-tree.md"), projectTree, "utf8");
|
|
8048
8206
|
}
|
|
8049
8207
|
if (artifacts.navigation) {
|
|
8050
|
-
|
|
8208
|
+
fs12__namespace.writeFileSync(path13__namespace.join(reportsDir, "navigation.md"), generateNavigation(manifest), "utf8");
|
|
8051
8209
|
}
|
|
8052
8210
|
if (artifacts.audit) {
|
|
8053
|
-
|
|
8054
|
-
|
|
8211
|
+
fs12__namespace.writeFileSync(
|
|
8212
|
+
path13__namespace.join(reportsDir, "audit.md"),
|
|
8055
8213
|
generateAuditReport(manifest, secretFindings, config.secretRules),
|
|
8056
8214
|
"utf8"
|
|
8057
8215
|
);
|
|
8058
8216
|
}
|
|
8059
8217
|
if (artifacts.readme) {
|
|
8060
|
-
|
|
8218
|
+
fs12__namespace.writeFileSync(path13__namespace.join(stagingDir, "README.md"), generateReadme(manifest, artifacts), "utf8");
|
|
8061
8219
|
}
|
|
8062
8220
|
if (artifacts.manifest) {
|
|
8063
|
-
|
|
8221
|
+
fs12__namespace.writeFileSync(path13__namespace.join(stagingDir, "manifest.json"), JSON.stringify(manifest, null, 2), "utf8");
|
|
8064
8222
|
}
|
|
8065
8223
|
if (monolithJson !== null) {
|
|
8066
|
-
|
|
8224
|
+
fs12__namespace.writeFileSync(path13__namespace.join(stagingDir, "full-codebase.json"), monolithJson, "utf8");
|
|
8067
8225
|
}
|
|
8068
8226
|
if (monolithMarkdown !== null) {
|
|
8069
|
-
|
|
8227
|
+
fs12__namespace.writeFileSync(path13__namespace.join(stagingDir, "full-codebase.md"), monolithMarkdown, "utf8");
|
|
8070
8228
|
}
|
|
8071
8229
|
writeOwnershipMarker(stagingDir, markerPayload(stagingDir, "complete", snapshotId, createdAt));
|
|
8072
8230
|
swapIntoPlace(stagingDir, outDir);
|
|
@@ -8075,7 +8233,7 @@ function generateSnapshot(configInput, options) {
|
|
|
8075
8233
|
const pendingHook = runAfterGenerate(config, manifest);
|
|
8076
8234
|
const shipHookState = () => {
|
|
8077
8235
|
if (artifacts.manifest && manifest.warnings.length !== warningsBeforeHook) {
|
|
8078
|
-
writeManifestAtomically(
|
|
8236
|
+
writeManifestAtomically(path13__namespace.join(outDir, "manifest.json"), manifest);
|
|
8079
8237
|
}
|
|
8080
8238
|
writeOwnershipMarker(outDir, markerPayload(outDir, "complete", snapshotId, createdAt));
|
|
8081
8239
|
};
|
|
@@ -8098,7 +8256,7 @@ function generateSnapshot(configInput, options) {
|
|
|
8098
8256
|
} catch (err) {
|
|
8099
8257
|
if (stagingDir !== null) {
|
|
8100
8258
|
try {
|
|
8101
|
-
|
|
8259
|
+
fs12__namespace.rmSync(stagingDir, { recursive: true, force: true });
|
|
8102
8260
|
} catch {
|
|
8103
8261
|
}
|
|
8104
8262
|
}
|
|
@@ -8113,18 +8271,25 @@ async function generateSnapshotAsync(configInput, options) {
|
|
|
8113
8271
|
}
|
|
8114
8272
|
|
|
8115
8273
|
exports.ARTIFACT_NAMES = ARTIFACT_NAMES;
|
|
8274
|
+
exports.CHECK_INTERVAL_MS = CHECK_INTERVAL_MS;
|
|
8116
8275
|
exports.DEFAULT_ANSWERS = DEFAULT_ANSWERS;
|
|
8117
8276
|
exports.DEFAULT_SECRET_PATTERNS = DEFAULT_SECRET_PATTERNS;
|
|
8277
|
+
exports.FAILURE_INTERVAL_MS = FAILURE_INTERVAL_MS;
|
|
8118
8278
|
exports.GENERATOR_NAME = GENERATOR_NAME;
|
|
8119
8279
|
exports.GENERATOR_VERSION = GENERATOR_VERSION;
|
|
8120
8280
|
exports.LANGUAGE_PROFILES = LANGUAGE_PROFILES;
|
|
8121
8281
|
exports.MIN_MAX_PART_BYTES = MIN_MAX_PART_BYTES;
|
|
8282
|
+
exports.PACKAGE_LATEST_URL = PACKAGE_LATEST_URL;
|
|
8122
8283
|
exports.PRESETS = PRESETS;
|
|
8123
8284
|
exports.PromptCancelled = PromptCancelled;
|
|
8285
|
+
exports.REQUEST_TIMEOUT_MS = REQUEST_TIMEOUT_MS;
|
|
8124
8286
|
exports.SCHEMA_VERSION = SCHEMA_VERSION;
|
|
8125
8287
|
exports.anchorForPath = anchorForPath;
|
|
8126
8288
|
exports.assertReplaceable = assertReplaceable;
|
|
8127
8289
|
exports.assertUsableConfigInput = assertUsableConfigInput;
|
|
8290
|
+
exports.cacheDirectory = cacheDirectory;
|
|
8291
|
+
exports.cacheFilePath = cacheFilePath;
|
|
8292
|
+
exports.checkForUpdate = checkForUpdate;
|
|
8128
8293
|
exports.collectFiles = collectFiles;
|
|
8129
8294
|
exports.compareManifests = compareManifests;
|
|
8130
8295
|
exports.countInvalidUtf8Bytes = countInvalidUtf8Bytes;
|
|
@@ -8136,7 +8301,9 @@ exports.detectPreset = detectPreset;
|
|
|
8136
8301
|
exports.explainPath = explainPath;
|
|
8137
8302
|
exports.fenceForContent = fenceForContent;
|
|
8138
8303
|
exports.fenceForText = fenceForText;
|
|
8304
|
+
exports.fetchLatestVersion = fetchLatestVersion;
|
|
8139
8305
|
exports.firstRunMessage = firstRunMessage;
|
|
8306
|
+
exports.formatUpdateNotice = formatUpdateNotice;
|
|
8140
8307
|
exports.generateProjectTree = generateProjectTree;
|
|
8141
8308
|
exports.generateSnapshot = generateSnapshot;
|
|
8142
8309
|
exports.generateSnapshotAsync = generateSnapshotAsync;
|
|
@@ -8148,6 +8315,7 @@ exports.isBinaryExtension = isBinaryExtension;
|
|
|
8148
8315
|
exports.isBinaryFile = isBinaryFile;
|
|
8149
8316
|
exports.isEffectivelyEmpty = isEffectivelyEmpty;
|
|
8150
8317
|
exports.isInteractive = isInteractive;
|
|
8318
|
+
exports.isNewer = isNewer;
|
|
8151
8319
|
exports.isResolvedConfig = isResolvedConfig;
|
|
8152
8320
|
exports.isSensitivePath = isSensitivePath;
|
|
8153
8321
|
exports.listPresetNames = listPresetNames;
|
|
@@ -8170,6 +8338,7 @@ exports.resolveConfig = resolveConfig;
|
|
|
8170
8338
|
exports.resolveSafeOutputDirs = resolveSafeOutputDirs;
|
|
8171
8339
|
exports.runInit = runInit;
|
|
8172
8340
|
exports.scanAndRedactSecrets = scanAndRedactSecrets;
|
|
8341
|
+
exports.shouldCheck = shouldCheck;
|
|
8173
8342
|
exports.stripJsonComments = stripJsonComments;
|
|
8174
8343
|
exports.summarizeJson = summarizeJson;
|
|
8175
8344
|
exports.summarizeMarkdown = summarizeMarkdown;
|