codebase-snapshot 0.22.0 → 0.22.1
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 +14 -0
- package/README.md +27 -18
- package/dist/bin.js +1830 -1019
- package/dist/{chunk-NPCDJBE4.js → chunk-7AAXOTKS.js} +1451 -724
- package/dist/cli.cjs +1954 -1146
- package/dist/cli.js +164 -83
- package/dist/index.cjs +1426 -710
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +827 -346
- package/dist/mcp.d.cts +5 -2
- package/dist/mcp.d.ts +5 -2
- package/dist/mcp.js +1 -1
- package/docs/about.md +3 -2
- package/docs/agent.md +2 -1
- package/docs/cli.md +17 -16
- package/docs/deploy.md +10 -4
- package/docs/guard.md +47 -4
- package/docs/impact.md +3 -2
- package/docs/mcp-server-for-codebase.md +2 -2
- package/docs/mcp.md +4 -4
- package/docs/security-review.md +3 -2
- package/docs/troubleshooting.md +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import './chunk-WMEZFLUT.js';
|
|
2
|
-
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, buildAgentContract, startWebServer, startHttpTransport, buildTools, runStdioServer, parseRemoteSource, assertPublicHost, cloneRepository, makeCloneDirectory, loadConfigFileDetailed, resolveConfig, validateSnapshot, readConfinedText, auditSnapshot, describeManifestShapeProblem, loadManifest, buildLiveIndex, resolveImpactChanges, computeImpact, DEFAULT_MAX_PROGRAM_FILES, findMultipleSymbolReferences, planTestRun, renderImpactText, runTestPlan, briefFromPaths, resolveDiffBase, filterAndRedactDiff, matchesExclude, defaultIgnoreReason, isSensitivePath, findSection, parsePartSections, buildBrief, explainPath, compareManifests, renderDiffText, generateSnapshot, getGitInfo, loadSigningKey, SIGNATURE_FILE, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, COMMAND_OPTION_SCOPE, commandsForOption, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, SKILL_NAME, renderSkill, resolveLatest, isNewer, updateCommand, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, escapeControls, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, runWithStdoutCapture, inlineCode, findSecretInPath, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderContractText, renderExplainText } from './chunk-
|
|
3
|
-
export { buildAgentContract } from './chunk-
|
|
2
|
+
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, buildAgentContract, startWebServer, startHttpTransport, buildTools, runStdioServer, parseRemoteSource, assertPublicHost, cloneRepository, makeCloneDirectory, loadConfigFileDetailed, assertServerSafeConfig, resolveConfig, validateSnapshot, readConfinedText, auditSnapshot, describeManifestShapeProblem, loadManifest, buildLiveIndex, resolveImpactChanges, computeImpact, DEFAULT_MAX_PROGRAM_FILES, findMultipleSymbolReferences, planTestRun, renderImpactText, runTestPlan, briefFromPaths, resolveDiffBase, filterAndRedactDiff, matchesExclude, defaultIgnoreReason, isSensitivePath, findSection, parsePartSections, buildBrief, explainPath, compareManifests, renderDiffText, generateSnapshot, getGitInfo, loadSigningKey, SIGNATURE_FILE, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, COMMAND_OPTION_SCOPE, commandsForOption, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, SKILL_NAME, renderSkill, resolveLatest, isNewer, updateCommand, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, escapeControls, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, runWithStdoutCapture, inlineCode, findSecretInPath, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderContractText, renderExplainText } from './chunk-7AAXOTKS.js';
|
|
3
|
+
export { buildAgentContract } from './chunk-7AAXOTKS.js';
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
|
-
import * as
|
|
5
|
+
import * as fs3 from 'fs';
|
|
6
6
|
import * as path3 from 'path';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
import { parseArgs } from 'util';
|
|
@@ -14,24 +14,27 @@ var MAX_HOOK_CHARS = 1200;
|
|
|
14
14
|
function take(values, limit) {
|
|
15
15
|
return { taken: values.slice(0, limit), omitted: Math.max(0, values.length - limit) };
|
|
16
16
|
}
|
|
17
|
+
function safePath(value) {
|
|
18
|
+
return escapeControls(findSecretInPath(value)?.masked ?? value);
|
|
19
|
+
}
|
|
17
20
|
function toGap(entry) {
|
|
18
21
|
return {
|
|
19
22
|
kind: "consumer",
|
|
20
|
-
path: entry.path,
|
|
23
|
+
path: safePath(entry.path),
|
|
21
24
|
distance: entry.distance,
|
|
22
|
-
via: entry.via,
|
|
25
|
+
via: safePath(entry.via),
|
|
23
26
|
...entry.confidence === void 0 ? {} : { confidence: entry.confidence }
|
|
24
27
|
};
|
|
25
28
|
}
|
|
26
29
|
function testGap(entry) {
|
|
27
|
-
return { kind: "test", path: entry.path, covers:
|
|
30
|
+
return { kind: "test", path: safePath(entry.path), covers: entry.covers.map(safePath) };
|
|
28
31
|
}
|
|
29
32
|
function routeGap(entry) {
|
|
30
|
-
return { kind: "route", path: entry.path, methods: [...entry.methods] };
|
|
33
|
+
return { kind: "route", path: safePath(entry.path), methods: [...entry.methods] };
|
|
31
34
|
}
|
|
32
35
|
function buildGuardReport(impact) {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
36
|
+
const changedSet = new Set(impact.changed.map((entry) => entry.path));
|
|
37
|
+
const changed = impact.changed.map((entry) => safePath(entry.path));
|
|
35
38
|
const consumers = impact.affected.filter((entry) => !changedSet.has(entry.path));
|
|
36
39
|
const tests = impact.tests.filter((entry) => !changedSet.has(entry.path));
|
|
37
40
|
const routes = (impact.routesAffected ?? []).filter((entry) => !changedSet.has(entry.path));
|
|
@@ -43,11 +46,15 @@ function buildGuardReport(impact) {
|
|
|
43
46
|
...testPart.taken.map(testGap),
|
|
44
47
|
...routePart.taken.map(routeGap)
|
|
45
48
|
];
|
|
49
|
+
const symbolPruned = impact.affected.some(
|
|
50
|
+
(entry) => entry.impactKind === "direct-symbol" || entry.impactKind === "reexport" || entry.impactKind === "namespace-or-cjs"
|
|
51
|
+
);
|
|
46
52
|
return {
|
|
47
53
|
schemaVersion: 1,
|
|
48
54
|
changed,
|
|
49
55
|
gaps,
|
|
50
56
|
trust: impact.trust,
|
|
57
|
+
confidence: symbolPruned ? "symbol-pruned" : "file-import",
|
|
51
58
|
truncated: impact.truncated || consumerPart.omitted > 0 || testPart.omitted > 0 || routePart.omitted > 0,
|
|
52
59
|
omitted: {
|
|
53
60
|
consumers: consumerPart.omitted,
|
|
@@ -88,7 +95,7 @@ function renderGuardText(report) {
|
|
|
88
95
|
" \u2026 truncated: " + omitted.consumers + " consumer(s), " + omitted.tests + " test(s), " + omitted.routes + " route(s) omitted"
|
|
89
96
|
);
|
|
90
97
|
}
|
|
91
|
-
lines.push(" coverage: " + report.trust.coverage + " \xB7 confidence:
|
|
98
|
+
lines.push(" coverage: " + report.trust.coverage + " \xB7 confidence: " + report.confidence);
|
|
92
99
|
return lines.join("\n");
|
|
93
100
|
}
|
|
94
101
|
function truncateGuardText(text, maxChars) {
|
|
@@ -111,7 +118,7 @@ function renderGuardHookText(report, maxChars = MAX_HOOK_CHARS) {
|
|
|
111
118
|
lines.push(" route " + gap.path + (gap.methods && gap.methods.length > 0 ? " (" + gap.methods.join(", ") + ")" : ""));
|
|
112
119
|
}
|
|
113
120
|
}
|
|
114
|
-
lines.push("coverage: " + report.trust.coverage + " \xB7 confidence:
|
|
121
|
+
lines.push("coverage: " + report.trust.coverage + " \xB7 confidence: " + report.confidence);
|
|
115
122
|
lines.push("run: npx codebase-snapshot brief --diff HEAD");
|
|
116
123
|
return truncateGuardText(lines.join("\n"), maxChars);
|
|
117
124
|
}
|
|
@@ -128,11 +135,22 @@ function renderGuardHook(report, client, event, maxChars = MAX_HOOK_CHARS) {
|
|
|
128
135
|
}
|
|
129
136
|
return JSON.stringify({ additionalContext: text });
|
|
130
137
|
}
|
|
138
|
+
function canonicalForRelative(target) {
|
|
139
|
+
try {
|
|
140
|
+
return fs3.realpathSync.native(target);
|
|
141
|
+
} catch {
|
|
142
|
+
try {
|
|
143
|
+
return path3.join(fs3.realpathSync.native(path3.dirname(target)), path3.basename(target));
|
|
144
|
+
} catch {
|
|
145
|
+
return path3.resolve(target);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
131
149
|
function normalizePath(cwd, raw) {
|
|
132
150
|
const value = raw.trim();
|
|
133
151
|
if (value.length === 0 || value.includes("\0")) return null;
|
|
134
152
|
const absolute = path3.isAbsolute(value) ? value : path3.resolve(cwd, value);
|
|
135
|
-
const relative4 = path3.relative(cwd, absolute).split(path3.sep).join("/");
|
|
153
|
+
const relative4 = path3.relative(canonicalForRelative(cwd), canonicalForRelative(absolute)).split(path3.sep).join("/");
|
|
136
154
|
if (relative4 === "" || relative4 === ".." || relative4.startsWith("../") || path3.isAbsolute(relative4)) {
|
|
137
155
|
return null;
|
|
138
156
|
}
|
|
@@ -223,11 +241,11 @@ function targetPath(cwd, target) {
|
|
|
223
241
|
}
|
|
224
242
|
}
|
|
225
243
|
function assertWritableInsideRepository(cwd, filePath) {
|
|
226
|
-
const root =
|
|
244
|
+
const root = fs3.realpathSync(cwd);
|
|
227
245
|
const shown = path3.relative(root, filePath) || filePath;
|
|
228
246
|
let stat = null;
|
|
229
247
|
try {
|
|
230
|
-
stat =
|
|
248
|
+
stat = fs3.lstatSync(filePath);
|
|
231
249
|
} catch {
|
|
232
250
|
stat = null;
|
|
233
251
|
}
|
|
@@ -243,13 +261,13 @@ function assertWritableInsideRepository(cwd, filePath) {
|
|
|
243
261
|
}
|
|
244
262
|
let existing = filePath;
|
|
245
263
|
const missing = [];
|
|
246
|
-
while (!
|
|
264
|
+
while (!fs3.existsSync(existing)) {
|
|
247
265
|
missing.unshift(path3.basename(existing));
|
|
248
266
|
const parent = path3.dirname(existing);
|
|
249
267
|
if (parent === existing) break;
|
|
250
268
|
existing = parent;
|
|
251
269
|
}
|
|
252
|
-
const realAncestor =
|
|
270
|
+
const realAncestor = fs3.realpathSync(existing);
|
|
253
271
|
const resolved = missing.length === 0 ? realAncestor : path3.join(realAncestor, ...missing);
|
|
254
272
|
if (resolved !== root && !resolved.startsWith(`${root}${path3.sep}`)) {
|
|
255
273
|
throw new Error(
|
|
@@ -258,17 +276,17 @@ function assertWritableInsideRepository(cwd, filePath) {
|
|
|
258
276
|
}
|
|
259
277
|
}
|
|
260
278
|
function writeIfChanged(target, filePath, content) {
|
|
261
|
-
const existing =
|
|
279
|
+
const existing = fs3.existsSync(filePath) ? fs3.readFileSync(filePath, "utf8") : null;
|
|
262
280
|
if (existing === content) return { target, path: filePath, action: "unchanged" };
|
|
263
|
-
|
|
264
|
-
|
|
281
|
+
fs3.mkdirSync(path3.dirname(filePath), { recursive: true });
|
|
282
|
+
fs3.writeFileSync(filePath, content, "utf8");
|
|
265
283
|
return { target, path: filePath, action: existing === null ? "created" : "updated" };
|
|
266
284
|
}
|
|
267
285
|
function legacyAgentsNote(cwd) {
|
|
268
286
|
const filePath = path3.join(cwd, "AGENTS.md");
|
|
269
287
|
try {
|
|
270
|
-
if (!
|
|
271
|
-
if (!
|
|
288
|
+
if (!fs3.existsSync(filePath)) return null;
|
|
289
|
+
if (!fs3.readFileSync(filePath, "utf8").includes(LEGACY_AGENTS_MARKER)) return null;
|
|
272
290
|
} catch {
|
|
273
291
|
return null;
|
|
274
292
|
}
|
|
@@ -280,7 +298,7 @@ function installSkill(cwd, target = "all", options = {}) {
|
|
|
280
298
|
const notes = [];
|
|
281
299
|
const wanted = target === "all" ? ["agents", "claude", "cursor"] : [target];
|
|
282
300
|
for (const item of wanted) assertWritableInsideRepository(cwd, targetPath(cwd, item));
|
|
283
|
-
const createsSomething = wanted.some((item) => !
|
|
301
|
+
const createsSomething = wanted.some((item) => !fs3.existsSync(targetPath(cwd, item)));
|
|
284
302
|
if (createsSomething) {
|
|
285
303
|
assertWritableInsideRepository(cwd, path3.join(cwd, ".gitignore"));
|
|
286
304
|
}
|
|
@@ -297,7 +315,7 @@ function installSkill(cwd, target = "all", options = {}) {
|
|
|
297
315
|
if (pendingMcp !== null) {
|
|
298
316
|
if (pendingMcp.note !== null) notes.push(pendingMcp.note);
|
|
299
317
|
if (pendingMcp.content !== null) {
|
|
300
|
-
|
|
318
|
+
fs3.writeFileSync(pendingMcp.filePath, pendingMcp.content, "utf8");
|
|
301
319
|
}
|
|
302
320
|
mcp = { path: pendingMcp.filePath, action: pendingMcp.action };
|
|
303
321
|
}
|
|
@@ -309,8 +327,8 @@ function prepareMcpConfig(cwd) {
|
|
|
309
327
|
const desired = { command: "npx", args: ["-y", "codebase-snapshot@latest", "mcp"] };
|
|
310
328
|
let parsed = {};
|
|
311
329
|
let existing = null;
|
|
312
|
-
if (
|
|
313
|
-
existing =
|
|
330
|
+
if (fs3.existsSync(filePath)) {
|
|
331
|
+
existing = fs3.readFileSync(filePath, "utf8");
|
|
314
332
|
let candidate;
|
|
315
333
|
try {
|
|
316
334
|
candidate = JSON.parse(existing);
|
|
@@ -589,29 +607,33 @@ Options:
|
|
|
589
607
|
--all-members Audit every snapshot a --workspace run wrote
|
|
590
608
|
--deep Replay every full body against the source on disk
|
|
591
609
|
|
|
592
|
-
impact
|
|
593
|
-
--diff <ref> Compare the working tree against this git ref
|
|
594
|
-
--paths <a,b> Treat these repository-relative paths as the change
|
|
595
|
-
--depth <n> Reverse-import hops to follow (default: 3, max: 8)
|
|
596
|
-
--max-results <n> Cap affected files (default: 200, max: 1000)
|
|
610
|
+
impact only:
|
|
597
611
|
--tests-paths Print candidate test paths, one per line
|
|
598
612
|
--run Run the detected test runner (text format only)
|
|
599
613
|
--precise Add bounded compiler-resolved symbol references
|
|
614
|
+
--include-imports Include outgoing imports of changed files
|
|
615
|
+
--include-cycles Include import cycles in the impacted subgraph
|
|
600
616
|
|
|
601
617
|
guard only:
|
|
602
618
|
--hook <client> Read one hook payload from stdin: claude | copilot | codex | raw
|
|
603
619
|
--changed Check the working tree against HEAD (default when no --hook)
|
|
604
620
|
--max-chars <n> Cap the model-facing hook text (default 1200, max 10000)
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
--no-live Require the persisted snapshot instead of the live index
|
|
608
|
-
--no-cache Bypass the OS live-index summary cache
|
|
621
|
+
|
|
622
|
+
brief only:
|
|
609
623
|
--max-tokens <n> Brief token budget (default: 12000, minimum: 500)
|
|
610
624
|
--lines-per-file <n> Brief lines per file (default: 80)
|
|
611
625
|
--include-tests Include candidate tests in the brief
|
|
612
626
|
--copy Copy the brief to the clipboard
|
|
613
627
|
--out <path> Write the brief inside the repository
|
|
614
628
|
|
|
629
|
+
impact, guard and brief:
|
|
630
|
+
--diff <ref> Compare the working tree against this git ref
|
|
631
|
+
--paths <a,b> Treat these repository-relative paths as the change
|
|
632
|
+
--depth <n> Reverse-import hops to follow (default: 3, max: 8)
|
|
633
|
+
--max-results <n> Cap affected files (default: 200, max: 1000)
|
|
634
|
+
--no-live Require the persisted snapshot instead of the live index
|
|
635
|
+
--no-cache Bypass the OS live-index summary cache
|
|
636
|
+
|
|
615
637
|
skill only:
|
|
616
638
|
--install Write the skill into the repository instead of printing
|
|
617
639
|
--target <name> agents | claude | cursor | all (default: all)
|
|
@@ -746,10 +768,10 @@ function parseCliArgs(argv) {
|
|
|
746
768
|
}
|
|
747
769
|
if (values.cwd !== void 0) {
|
|
748
770
|
const target = String(values.cwd);
|
|
749
|
-
if (!
|
|
771
|
+
if (!fs3.existsSync(target)) {
|
|
750
772
|
throw new UsageError(`--cwd directory does not exist: ${target}`);
|
|
751
773
|
}
|
|
752
|
-
if (!
|
|
774
|
+
if (!fs3.statSync(target).isDirectory()) {
|
|
753
775
|
throw new UsageError(`--cwd is not a directory: ${target}`);
|
|
754
776
|
}
|
|
755
777
|
}
|
|
@@ -857,6 +879,17 @@ function parseCliArgs(argv) {
|
|
|
857
879
|
throw new UsageError("guard --hook already runs on the payload; do not pass --changed.");
|
|
858
880
|
}
|
|
859
881
|
}
|
|
882
|
+
if (command === "guard") {
|
|
883
|
+
if (paths !== void 0 && rawDiff !== void 0) {
|
|
884
|
+
throw new UsageError("guard accepts either --diff <ref> or --paths <a,b>, not both.");
|
|
885
|
+
}
|
|
886
|
+
if (values.changed === true && paths !== void 0) {
|
|
887
|
+
throw new UsageError("guard --changed reads the working tree; do not combine it with --paths.");
|
|
888
|
+
}
|
|
889
|
+
if (values.changed === true && rawDiff !== void 0) {
|
|
890
|
+
throw new UsageError("guard --changed reads the working tree; do not combine it with --diff.");
|
|
891
|
+
}
|
|
892
|
+
}
|
|
860
893
|
const maxChars = parseCountOption(values["max-chars"], "max-chars", 200);
|
|
861
894
|
if (maxChars !== void 0 && maxChars > 1e4) {
|
|
862
895
|
throw new UsageError(`--max-chars must be at most 10000, received ${maxChars}.`);
|
|
@@ -1172,22 +1205,22 @@ function writeInside(root, relative4, content) {
|
|
|
1172
1205
|
throw new Error("--out must resolve inside the repository.");
|
|
1173
1206
|
}
|
|
1174
1207
|
const parent = path3.dirname(target);
|
|
1175
|
-
const realRoot =
|
|
1208
|
+
const realRoot = fs3.realpathSync(root);
|
|
1176
1209
|
let existingAncestor = parent;
|
|
1177
|
-
while (!
|
|
1210
|
+
while (!fs3.existsSync(existingAncestor)) {
|
|
1178
1211
|
const next = path3.dirname(existingAncestor);
|
|
1179
1212
|
if (next === existingAncestor) break;
|
|
1180
1213
|
existingAncestor = next;
|
|
1181
1214
|
}
|
|
1182
|
-
if (!realPathInside(realRoot,
|
|
1215
|
+
if (!realPathInside(realRoot, fs3.realpathSync(existingAncestor))) {
|
|
1183
1216
|
throw new Error("--out resolves outside the repository through a link.");
|
|
1184
1217
|
}
|
|
1185
|
-
|
|
1186
|
-
if (!realPathInside(realRoot,
|
|
1218
|
+
fs3.mkdirSync(parent, { recursive: true });
|
|
1219
|
+
if (!realPathInside(realRoot, fs3.realpathSync(parent))) {
|
|
1187
1220
|
throw new Error("--out resolves outside the repository through a link.");
|
|
1188
1221
|
}
|
|
1189
1222
|
try {
|
|
1190
|
-
const existing =
|
|
1223
|
+
const existing = fs3.lstatSync(target);
|
|
1191
1224
|
if (existing.isSymbolicLink() || !existing.isFile() || existing.nlink > 1) {
|
|
1192
1225
|
throw new Error("--out must be a regular file that is not a symbolic or hard link.");
|
|
1193
1226
|
}
|
|
@@ -1195,12 +1228,12 @@ function writeInside(root, relative4, content) {
|
|
|
1195
1228
|
if (error.code !== "ENOENT") throw error;
|
|
1196
1229
|
}
|
|
1197
1230
|
const temporary = path3.join(parent, "." + path3.basename(target) + ".tmp-" + process.pid + "-" + Math.random().toString(16).slice(2));
|
|
1198
|
-
|
|
1231
|
+
fs3.writeFileSync(temporary, content, { encoding: "utf8", flag: "wx", mode: 384 });
|
|
1199
1232
|
try {
|
|
1200
|
-
|
|
1233
|
+
fs3.renameSync(temporary, target);
|
|
1201
1234
|
} catch (error) {
|
|
1202
1235
|
try {
|
|
1203
|
-
|
|
1236
|
+
fs3.unlinkSync(temporary);
|
|
1204
1237
|
} catch (cleanupError) {
|
|
1205
1238
|
warn("Could not remove temporary file " + temporary + ": " + cleanupError.message);
|
|
1206
1239
|
}
|
|
@@ -1235,7 +1268,7 @@ function nextStepHint(cwd, scriptsAddedNow) {
|
|
|
1235
1268
|
if (!hasScript) {
|
|
1236
1269
|
try {
|
|
1237
1270
|
const parsed = JSON.parse(
|
|
1238
|
-
stripJsonComments(
|
|
1271
|
+
stripJsonComments(fs3.readFileSync(path3.join(cwd, "package.json"), "utf8"))
|
|
1239
1272
|
);
|
|
1240
1273
|
hasScript = typeof parsed.scripts?.snapshot === "string";
|
|
1241
1274
|
} catch {
|
|
@@ -1244,7 +1277,7 @@ function nextStepHint(cwd, scriptsAddedNow) {
|
|
|
1244
1277
|
}
|
|
1245
1278
|
if (!hasScript) return `npx ${GENERATOR_NAME} generate`;
|
|
1246
1279
|
const bin = path3.join(cwd, "node_modules", ".bin", "codebase-snapshot");
|
|
1247
|
-
const installed =
|
|
1280
|
+
const installed = fs3.existsSync(bin) || fs3.existsSync(`${bin}.cmd`);
|
|
1248
1281
|
return installed ? "npm run snapshot" : "npm install && npm run snapshot";
|
|
1249
1282
|
}
|
|
1250
1283
|
function presetSummary(init) {
|
|
@@ -1292,7 +1325,7 @@ async function runInitCommand(invocation) {
|
|
|
1292
1325
|
info(
|
|
1293
1326
|
` Wrote ${path3.basename(result.briefPath)}: a scaffold for the half of PROMPT.md only you can write. Fill it in, then set brief: ${JSON.stringify(path3.basename(result.briefPath))} in the config to merge it.`
|
|
1294
1327
|
);
|
|
1295
|
-
} else if (
|
|
1328
|
+
} else if (fs3.existsSync(result.briefPath)) {
|
|
1296
1329
|
info(` Kept ${path3.basename(result.briefPath)}: it already exists, and is never overwritten.`);
|
|
1297
1330
|
}
|
|
1298
1331
|
for (const note of result.notes) info(` \u26A0 ${note}`);
|
|
@@ -1330,7 +1363,7 @@ function renderHealthText(report) {
|
|
|
1330
1363
|
function generatorOrigin(cwd) {
|
|
1331
1364
|
try {
|
|
1332
1365
|
const pkg = JSON.parse(
|
|
1333
|
-
stripJsonComments(
|
|
1366
|
+
stripJsonComments(fs3.readFileSync(path3.join(cwd, "package.json"), "utf8"))
|
|
1334
1367
|
);
|
|
1335
1368
|
const spec = pkg.dependencies?.["codebase-snapshot"] ?? pkg.devDependencies?.["codebase-snapshot"];
|
|
1336
1369
|
if (typeof spec === "string") return `project dependency ${spec}`;
|
|
@@ -1341,7 +1374,7 @@ function generatorOrigin(cwd) {
|
|
|
1341
1374
|
return "global or direct install";
|
|
1342
1375
|
}
|
|
1343
1376
|
function detectPackageManager(cwd) {
|
|
1344
|
-
const has = (name) =>
|
|
1377
|
+
const has = (name) => fs3.existsSync(path3.join(cwd, name));
|
|
1345
1378
|
if (has("bun.lockb") || has("bun.lock")) return { name: "bun", command: "bun", args: ["install"] };
|
|
1346
1379
|
if (has("pnpm-lock.yaml")) return { name: "pnpm", command: "pnpm", args: ["install"] };
|
|
1347
1380
|
if (has("yarn.lock")) return { name: "yarn", command: "yarn", args: ["install"] };
|
|
@@ -1492,7 +1525,7 @@ async function runSetupCommand(invocation, options = {}) {
|
|
|
1492
1525
|
info(` \u26A0 --preset ${invocation.preset} was not applied: the existing config is kept.`);
|
|
1493
1526
|
}
|
|
1494
1527
|
}
|
|
1495
|
-
const hasManifest =
|
|
1528
|
+
const hasManifest = fs3.existsSync(path3.join(invocation.cwd, "package.json"));
|
|
1496
1529
|
let install = null;
|
|
1497
1530
|
if (invocation.noInstall) {
|
|
1498
1531
|
if (invocation.format !== "json") info(" Skipped the install (--no-install)");
|
|
@@ -1748,6 +1781,11 @@ async function readStdin(limit = 1024 * 1024) {
|
|
|
1748
1781
|
}
|
|
1749
1782
|
return Buffer.concat(chunks).toString("utf8");
|
|
1750
1783
|
}
|
|
1784
|
+
function guardHookSkipped(message) {
|
|
1785
|
+
warn("guard: " + message + " (hook skipped)");
|
|
1786
|
+
process.stdout.write("{}\n");
|
|
1787
|
+
return 0;
|
|
1788
|
+
}
|
|
1751
1789
|
async function runGuardCommand(invocation, resolved) {
|
|
1752
1790
|
const client = invocation.hook;
|
|
1753
1791
|
try {
|
|
@@ -1769,7 +1807,7 @@ async function runGuardCommand(invocation, resolved) {
|
|
|
1769
1807
|
let manifest;
|
|
1770
1808
|
let trust;
|
|
1771
1809
|
if (invocation.noLive) {
|
|
1772
|
-
if (!
|
|
1810
|
+
if (!fs3.existsSync(manifestPath)) {
|
|
1773
1811
|
if (client !== void 0) {
|
|
1774
1812
|
warn("guard: no snapshot manifest; the hook was skipped.");
|
|
1775
1813
|
process.stdout.write("{}\n");
|
|
@@ -1791,7 +1829,9 @@ async function runGuardCommand(invocation, resolved) {
|
|
|
1791
1829
|
cwd: resolved.cwd,
|
|
1792
1830
|
changes,
|
|
1793
1831
|
manifestPath,
|
|
1794
|
-
...trust === void 0 ? {} : { trust }
|
|
1832
|
+
...trust === void 0 ? {} : { trust },
|
|
1833
|
+
...invocation.depth === void 0 ? {} : { depth: invocation.depth },
|
|
1834
|
+
...invocation.maxResults === void 0 ? {} : { maxResults: invocation.maxResults }
|
|
1795
1835
|
});
|
|
1796
1836
|
const report = buildGuardReport(impact);
|
|
1797
1837
|
if (client !== void 0) {
|
|
@@ -1980,7 +2020,14 @@ ${USAGE}
|
|
|
1980
2020
|
});
|
|
1981
2021
|
sourceProvenance = clone.provenance;
|
|
1982
2022
|
const outDir = path3.resolve(invocation.cwd, invocation.outDir ?? "snapshot");
|
|
1983
|
-
|
|
2023
|
+
const delta = invocation.delta === void 0 ? void 0 : path3.resolve(invocation.cwd, invocation.delta);
|
|
2024
|
+
invocation = {
|
|
2025
|
+
...invocation,
|
|
2026
|
+
cwd: clone.directory,
|
|
2027
|
+
outDir,
|
|
2028
|
+
...delta === void 0 ? {} : { delta },
|
|
2029
|
+
noConfig: true
|
|
2030
|
+
};
|
|
1984
2031
|
info(
|
|
1985
2032
|
" Source: " + parsed.source.owner + "/" + parsed.source.repo + "@" + clone.commit.slice(0, 12) + " (fetched " + clone.provenance.fetchedAt + ")"
|
|
1986
2033
|
);
|
|
@@ -1990,7 +2037,7 @@ ${USAGE}
|
|
|
1990
2037
|
const directory = clone.directory;
|
|
1991
2038
|
process.once("exit", () => {
|
|
1992
2039
|
try {
|
|
1993
|
-
|
|
2040
|
+
fs3.rmSync(directory, { recursive: true, force: true });
|
|
1994
2041
|
} catch {
|
|
1995
2042
|
}
|
|
1996
2043
|
});
|
|
@@ -1999,15 +2046,37 @@ ${USAGE}
|
|
|
1999
2046
|
return fail(invocation.format, "Remote fetch failed: " + error.message);
|
|
2000
2047
|
}
|
|
2001
2048
|
}
|
|
2049
|
+
const guardHook = invocation.command === "guard" && invocation.hook !== void 0;
|
|
2002
2050
|
const skipConfig = invocation.noConfig || invocation.command === "diff";
|
|
2003
|
-
|
|
2051
|
+
let loaded;
|
|
2052
|
+
if (skipConfig) {
|
|
2053
|
+
loaded = { config: null, warnings: [], errors: [], file: null };
|
|
2054
|
+
} else {
|
|
2055
|
+
try {
|
|
2056
|
+
loaded = await loadConfigFileDetailed(
|
|
2057
|
+
invocation.cwd,
|
|
2058
|
+
guardHook ? { allowExecutableConfig: false } : {}
|
|
2059
|
+
);
|
|
2060
|
+
} catch (error) {
|
|
2061
|
+
if (guardHook) return guardHookSkipped(error.message);
|
|
2062
|
+
return fail(invocation.format, error.message);
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2004
2065
|
if (invocation.noConfig) info("\u2699 --no-config: using built-in defaults, config file ignored");
|
|
2005
2066
|
if (loaded.errors.length > 0) {
|
|
2067
|
+
if (guardHook) return guardHookSkipped(loaded.errors.join("; "));
|
|
2006
2068
|
return fail(
|
|
2007
2069
|
invocation.format,
|
|
2008
2070
|
`The config file could not be read: ${loaded.errors.join("; ")}. Fix it, or delete it to use the defaults.`
|
|
2009
2071
|
);
|
|
2010
2072
|
}
|
|
2073
|
+
if (guardHook) {
|
|
2074
|
+
try {
|
|
2075
|
+
assertServerSafeConfig(loaded.config, loaded.file ?? invocation.cwd);
|
|
2076
|
+
} catch (error) {
|
|
2077
|
+
return guardHookSkipped(error.message);
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2011
2080
|
for (const warning of loaded.warnings) warn(`\u26A0 Config: ${warning}`);
|
|
2012
2081
|
if (loaded.file) info(`\u2699 Using config ${path3.relative(process.cwd(), loaded.file) || loaded.file}`);
|
|
2013
2082
|
let resolved;
|
|
@@ -2018,6 +2087,7 @@ ${USAGE}
|
|
|
2018
2087
|
invocation.cwd
|
|
2019
2088
|
);
|
|
2020
2089
|
} catch (err) {
|
|
2090
|
+
if (guardHook) return guardHookSkipped(err.message);
|
|
2021
2091
|
return fail(invocation.format, err.message);
|
|
2022
2092
|
}
|
|
2023
2093
|
if (invocation.command === "guard") {
|
|
@@ -2032,7 +2102,7 @@ ${USAGE}
|
|
|
2032
2102
|
if (invocation.allMembers === true) {
|
|
2033
2103
|
const outRoot = path3.resolve(resolved.cwd, resolved.outDir);
|
|
2034
2104
|
const indexPath = path3.join(outRoot, "WORKSPACE.json");
|
|
2035
|
-
if (!
|
|
2105
|
+
if (!fs3.existsSync(indexPath)) {
|
|
2036
2106
|
return fail(
|
|
2037
2107
|
invocation.format,
|
|
2038
2108
|
`No workspace index at ${indexPath}. Run generate --workspace <a,b> first, or drop --all-members.`
|
|
@@ -2071,10 +2141,10 @@ ${USAGE}
|
|
|
2071
2141
|
let canonicalSnapshot = snapshotDir2;
|
|
2072
2142
|
let canonicalRepo = repoDir;
|
|
2073
2143
|
try {
|
|
2074
|
-
const outRootReal =
|
|
2075
|
-
const cwdReal =
|
|
2076
|
-
canonicalSnapshot =
|
|
2077
|
-
canonicalRepo =
|
|
2144
|
+
const outRootReal = fs3.realpathSync(outRoot);
|
|
2145
|
+
const cwdReal = fs3.realpathSync(resolved.cwd);
|
|
2146
|
+
canonicalSnapshot = fs3.realpathSync(snapshotDir2);
|
|
2147
|
+
canonicalRepo = fs3.existsSync(repoDir) ? fs3.realpathSync(repoDir) : repoDir;
|
|
2078
2148
|
if (!insidePath(outRootReal, canonicalSnapshot) || !insidePath(cwdReal, canonicalRepo)) {
|
|
2079
2149
|
rows.push({
|
|
2080
2150
|
name,
|
|
@@ -2089,7 +2159,7 @@ ${USAGE}
|
|
|
2089
2159
|
canonicalSnapshot = snapshotDir2;
|
|
2090
2160
|
canonicalRepo = repoDir;
|
|
2091
2161
|
}
|
|
2092
|
-
if (!
|
|
2162
|
+
if (!fs3.existsSync(path3.join(snapshotDir2, "manifest.json"))) {
|
|
2093
2163
|
rows.push({ name, score: 0, counts: { pass: 0, warn: 0, fail: 1 }, failed: [], error: "no snapshot at " + snapshotDir2 });
|
|
2094
2164
|
continue;
|
|
2095
2165
|
}
|
|
@@ -2098,8 +2168,8 @@ ${USAGE}
|
|
|
2098
2168
|
const memberLoaded = await loadConfigFileDetailed(canonicalRepo, {
|
|
2099
2169
|
allowExecutableConfig: false
|
|
2100
2170
|
});
|
|
2101
|
-
if (memberLoaded.errors.length === 0) {
|
|
2102
|
-
memberSecretRules = resolveConfig(memberLoaded.config,
|
|
2171
|
+
if (memberLoaded.errors.length === 0 && memberLoaded.config !== null) {
|
|
2172
|
+
memberSecretRules = resolveConfig(memberLoaded.config, { cwd: repoDir }, repoDir).customSecretRules ?? [];
|
|
2103
2173
|
}
|
|
2104
2174
|
} catch {
|
|
2105
2175
|
}
|
|
@@ -2150,12 +2220,12 @@ ${USAGE}
|
|
|
2150
2220
|
}
|
|
2151
2221
|
if (invocation.command === "report") {
|
|
2152
2222
|
const manifestPath = path3.resolve(resolved.cwd, resolved.outDir, "manifest.json");
|
|
2153
|
-
if (!
|
|
2223
|
+
if (!fs3.existsSync(manifestPath)) {
|
|
2154
2224
|
return fail(invocation.format, `Manifest not found at ${manifestPath}. Run generate first.`);
|
|
2155
2225
|
}
|
|
2156
2226
|
let manifest;
|
|
2157
2227
|
try {
|
|
2158
|
-
manifest = JSON.parse(
|
|
2228
|
+
manifest = JSON.parse(fs3.readFileSync(manifestPath, "utf8"));
|
|
2159
2229
|
} catch (err) {
|
|
2160
2230
|
return fail(invocation.format, `Could not read ${manifestPath}: ${err.message}`);
|
|
2161
2231
|
}
|
|
@@ -2226,7 +2296,7 @@ ${USAGE}
|
|
|
2226
2296
|
let manifest;
|
|
2227
2297
|
let live = null;
|
|
2228
2298
|
if (invocation.noLive) {
|
|
2229
|
-
if (!
|
|
2299
|
+
if (!fs3.existsSync(manifestPath)) {
|
|
2230
2300
|
return fail(invocation.format, "Manifest not found at " + manifestPath + ". Run generate first, or omit --no-live.");
|
|
2231
2301
|
}
|
|
2232
2302
|
manifest = loadManifest(manifestPath);
|
|
@@ -2348,7 +2418,7 @@ ${USAGE}
|
|
|
2348
2418
|
let manifest;
|
|
2349
2419
|
let live = null;
|
|
2350
2420
|
if (invocation.noLive) {
|
|
2351
|
-
if (!
|
|
2421
|
+
if (!fs3.existsSync(manifestPath)) {
|
|
2352
2422
|
return fail(invocation.format, "Manifest not found at " + manifestPath + ". Run generate first, or omit --no-live.");
|
|
2353
2423
|
}
|
|
2354
2424
|
manifest = loadManifest(manifestPath);
|
|
@@ -2368,7 +2438,7 @@ ${USAGE}
|
|
|
2368
2438
|
if (invocation.diff !== void 0 || question === void 0 && invocation.paths === void 0) {
|
|
2369
2439
|
const ref = invocation.diff ?? "HEAD";
|
|
2370
2440
|
const resolvedBase = resolveDiffBase(resolved.cwd, ref);
|
|
2371
|
-
const diffArgs = resolvedBase === null ? ["-c", "core.quotepath=false", "-c", "diff.noprefix=false", "-c", "diff.mnemonicPrefix=false", "-c", "core.fsmonitor=false", "diff", "--cached", "--no-color", "--no-ext-diff", "--no-textconv", "-U3"] : ["-c", "core.quotepath=false", "-c", "diff.noprefix=false", "-c", "diff.mnemonicPrefix=false", "-c", "core.fsmonitor=false", "diff", "--no-color", "--no-ext-diff", "--no-textconv", "-U3", resolvedBase, "--"];
|
|
2441
|
+
const diffArgs = resolvedBase === null ? ["-c", "core.quotepath=false", "-c", "diff.noprefix=false", "-c", "diff.mnemonicPrefix=false", "-c", "core.fsmonitor=false", "diff", "--cached", "--no-color", "--no-ext-diff", "--no-textconv", "--relative", "-U3"] : ["-c", "core.quotepath=false", "-c", "diff.noprefix=false", "-c", "diff.mnemonicPrefix=false", "-c", "core.fsmonitor=false", "diff", "--no-color", "--no-ext-diff", "--no-textconv", "--relative", "-U3", resolvedBase, "--"];
|
|
2372
2442
|
const result = spawnSync("git", diffArgs, {
|
|
2373
2443
|
cwd: resolved.cwd,
|
|
2374
2444
|
encoding: "utf8",
|
|
@@ -2378,6 +2448,17 @@ ${USAGE}
|
|
|
2378
2448
|
if (result.status === 0) {
|
|
2379
2449
|
const reportExcludes = [...resolved.excludePatterns, ...resolved.presetExclude];
|
|
2380
2450
|
const filtered = filterAndRedactDiff(result.stdout, resolved.secretRules, {
|
|
2451
|
+
cwd: resolved.cwd,
|
|
2452
|
+
// The removed side of a hunk is not in the working tree; read it at the same ref so a
|
|
2453
|
+
// partially changed PEM block or block scalar is masked on both sides.
|
|
2454
|
+
readOld: (relativePath) => {
|
|
2455
|
+
const shown = spawnSync(
|
|
2456
|
+
"git",
|
|
2457
|
+
["-c", "core.quotepath=false", "show", ref + ":" + relativePath],
|
|
2458
|
+
{ cwd: resolved.cwd, encoding: "utf8", shell: false, maxBuffer: 64 * 1024 * 1024 }
|
|
2459
|
+
);
|
|
2460
|
+
return shown.status === 0 ? shown.stdout : null;
|
|
2461
|
+
},
|
|
2381
2462
|
// The diff report generated by `generate` applies the repository's include/exclude
|
|
2382
2463
|
// rules; `brief --diff` used to pass only the secret rules, so a tracked file the
|
|
2383
2464
|
// config excluded still appeared in the review pack.
|
|
@@ -2385,7 +2466,7 @@ ${USAGE}
|
|
|
2385
2466
|
});
|
|
2386
2467
|
diffText = filtered.text;
|
|
2387
2468
|
if (filtered.omittedSensitive > 0) {
|
|
2388
|
-
diffNotes.push(filtered.omittedSensitive + " sensitive file section(s) were omitted from the diff.");
|
|
2469
|
+
diffNotes.push(filtered.omittedSensitive + " sensitive or excluded file section(s) were omitted from the diff.");
|
|
2389
2470
|
}
|
|
2390
2471
|
if (filtered.omittedUnparseable > 0) {
|
|
2391
2472
|
diffNotes.push(filtered.omittedUnparseable + " unparseable file section(s) were omitted from the diff.");
|
|
@@ -2414,7 +2495,7 @@ ${USAGE}
|
|
|
2414
2495
|
manifest,
|
|
2415
2496
|
...question === void 0 ? {} : { question },
|
|
2416
2497
|
...changes === void 0 ? {} : { changes },
|
|
2417
|
-
...diffText === void 0 ? {} : { diff: diffText },
|
|
2498
|
+
...diffText === void 0 ? {} : { diff: diffText, diffIsRedacted: true },
|
|
2418
2499
|
...diffNotes.length === 0 ? {} : { diffNotes },
|
|
2419
2500
|
readBody,
|
|
2420
2501
|
secretRules: resolved.secretRules,
|
|
@@ -2533,7 +2614,7 @@ ${USAGE}
|
|
|
2533
2614
|
const name = path3.basename(directory);
|
|
2534
2615
|
let stat;
|
|
2535
2616
|
try {
|
|
2536
|
-
stat =
|
|
2617
|
+
stat = fs3.statSync(directory);
|
|
2537
2618
|
} catch {
|
|
2538
2619
|
warn("\u26A0 Workspace member missing: " + member);
|
|
2539
2620
|
failed += 1;
|
|
@@ -2570,7 +2651,7 @@ ${USAGE}
|
|
|
2570
2651
|
failed += 1;
|
|
2571
2652
|
}
|
|
2572
2653
|
}
|
|
2573
|
-
if (!invocation.dryRun)
|
|
2654
|
+
if (!invocation.dryRun) fs3.mkdirSync(outRoot, { recursive: true });
|
|
2574
2655
|
const links = [];
|
|
2575
2656
|
for (const record of records) {
|
|
2576
2657
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -2612,7 +2693,7 @@ ${USAGE}
|
|
|
2612
2693
|
if (!invocation.dryRun) {
|
|
2613
2694
|
const workspacePath = path3.join(outRoot, "WORKSPACE.json");
|
|
2614
2695
|
try {
|
|
2615
|
-
const stats =
|
|
2696
|
+
const stats = fs3.lstatSync(workspacePath);
|
|
2616
2697
|
if (stats.isSymbolicLink() || !stats.isFile()) {
|
|
2617
2698
|
return fail(invocation.format, `${workspacePath} is not a regular file; refusing to replace it.`);
|
|
2618
2699
|
}
|
|
@@ -2621,11 +2702,11 @@ ${USAGE}
|
|
|
2621
2702
|
}
|
|
2622
2703
|
const tempPath = `${workspacePath}.${process.pid}.${Date.now()}.tmp`;
|
|
2623
2704
|
try {
|
|
2624
|
-
|
|
2625
|
-
|
|
2705
|
+
fs3.writeFileSync(tempPath, JSON.stringify(document, null, 2) + "\n", "utf8");
|
|
2706
|
+
fs3.renameSync(tempPath, workspacePath);
|
|
2626
2707
|
} catch (error) {
|
|
2627
2708
|
try {
|
|
2628
|
-
|
|
2709
|
+
fs3.rmSync(tempPath, { force: true });
|
|
2629
2710
|
} catch {
|
|
2630
2711
|
}
|
|
2631
2712
|
throw error;
|
|
@@ -2654,13 +2735,13 @@ ${USAGE}
|
|
|
2654
2735
|
let deltaBase;
|
|
2655
2736
|
if (invocation.delta !== void 0) {
|
|
2656
2737
|
const basePath = path3.resolve(invocation.cwd, invocation.delta);
|
|
2657
|
-
const manifestPath =
|
|
2658
|
-
if (!
|
|
2738
|
+
const manifestPath = fs3.existsSync(basePath) && fs3.statSync(basePath).isDirectory() ? path3.join(basePath, "manifest.json") : basePath;
|
|
2739
|
+
if (!fs3.existsSync(manifestPath)) {
|
|
2659
2740
|
return fail(invocation.format, "No manifest at " + manifestPath + ". Point --delta at a snapshot directory or its manifest.json.");
|
|
2660
2741
|
}
|
|
2661
2742
|
let base;
|
|
2662
2743
|
try {
|
|
2663
|
-
base = JSON.parse(
|
|
2744
|
+
base = JSON.parse(fs3.readFileSync(manifestPath, "utf8"));
|
|
2664
2745
|
} catch (error) {
|
|
2665
2746
|
return fail(invocation.format, "Could not read " + manifestPath + ": " + error.message);
|
|
2666
2747
|
}
|
|
@@ -2689,7 +2770,7 @@ ${USAGE}
|
|
|
2689
2770
|
if (invocation.sign === true && !invocation.dryRun) {
|
|
2690
2771
|
const signaturePath = path3.resolve(resolved.cwd, resolved.outDir, SIGNATURE_FILE);
|
|
2691
2772
|
try {
|
|
2692
|
-
const record = JSON.parse(
|
|
2773
|
+
const record = JSON.parse(fs3.readFileSync(signaturePath, "utf8"));
|
|
2693
2774
|
info(
|
|
2694
2775
|
" Signature: ed25519, " + (record.keyOrigin ?? "unknown") + " key, " + (record.fingerprint ?? manifest.fingerprint).slice(0, 12)
|
|
2695
2776
|
);
|
|
@@ -2952,7 +3033,7 @@ async function runWatchLoop(invocation, resolved, options) {
|
|
|
2952
3033
|
info("\u{1F440} Watching for changes. Press Ctrl+C to stop.");
|
|
2953
3034
|
let watcher;
|
|
2954
3035
|
try {
|
|
2955
|
-
watcher =
|
|
3036
|
+
watcher = fs3.watch(resolved.cwd, { recursive: true }, (_event, filename) => {
|
|
2956
3037
|
const decision = decideWatchEvent(
|
|
2957
3038
|
state,
|
|
2958
3039
|
{
|
|
@@ -2997,7 +3078,7 @@ async function runWatchLoop(invocation, resolved, options) {
|
|
|
2997
3078
|
var entryFile = process.argv[1] ?? "";
|
|
2998
3079
|
var sameFile = (left, right) => {
|
|
2999
3080
|
try {
|
|
3000
|
-
return
|
|
3081
|
+
return fs3.realpathSync(path3.resolve(left)) === fs3.realpathSync(path3.resolve(right));
|
|
3001
3082
|
} catch {
|
|
3002
3083
|
return false;
|
|
3003
3084
|
}
|