@ankurhalder/codebase-snapshot 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +18 -13
- package/dist/{chunk-RGIMMEAW.js → chunk-CY3XU5TS.js} +18 -14
- package/dist/cli.cjs +18 -13
- package/dist/cli.js +6 -2
- package/dist/index.cjs +16 -12
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -1334,12 +1334,8 @@ function isSensitivePath(relativePath) {
|
|
|
1334
1334
|
}
|
|
1335
1335
|
return matchesSensitiveList(posixPath, base);
|
|
1336
1336
|
}
|
|
1337
|
-
var activeSecretRules = null;
|
|
1338
|
-
function setActiveSecretRules(rules) {
|
|
1339
|
-
activeSecretRules = rules === null ? null : [...rules];
|
|
1340
|
-
}
|
|
1341
1337
|
function pathScanRules(extraRules) {
|
|
1342
|
-
const fallback = extraRules ??
|
|
1338
|
+
const fallback = extraRules ?? [];
|
|
1343
1339
|
return [...DEFAULT_SECRET_PATTERNS, ...fallback];
|
|
1344
1340
|
}
|
|
1345
1341
|
function findSecretInPath(relativePath, extraRules) {
|
|
@@ -1379,7 +1375,12 @@ function findSecretInPath(relativePath, extraRules) {
|
|
|
1379
1375
|
function maskSkipPaths(records, extraRules) {
|
|
1380
1376
|
return records.map((record) => {
|
|
1381
1377
|
const hit = findSecretInPath(record.path, extraRules);
|
|
1382
|
-
|
|
1378
|
+
const detail = record.detail ? findSecretInPath(record.detail, extraRules) : null;
|
|
1379
|
+
return {
|
|
1380
|
+
...record,
|
|
1381
|
+
path: hit ? hit.masked : record.path,
|
|
1382
|
+
...detail ? { detail: detail.masked } : {}
|
|
1383
|
+
};
|
|
1383
1384
|
});
|
|
1384
1385
|
}
|
|
1385
1386
|
function globToRegExp(glob) {
|
|
@@ -2520,7 +2521,6 @@ function resolveConfig(userConfig, cliOptions, baseDir) {
|
|
|
2520
2521
|
...aliasedRules ?? []
|
|
2521
2522
|
]);
|
|
2522
2523
|
const secretRules = disableDefaultPatterns ? compiledCustomRules : [...compileSecretRules(DEFAULT_SECRET_PATTERNS), ...compiledCustomRules];
|
|
2523
|
-
setActiveSecretRules(secretRules);
|
|
2524
2524
|
const cliMonolith = cliOptions?.includeMonolith;
|
|
2525
2525
|
const includeMonolith = cliMonolith ?? strictBoolean(userConfig?.includeMonolith, false, "`includeMonolith`");
|
|
2526
2526
|
const artifacts = resolveArtifacts(
|
|
@@ -5444,7 +5444,7 @@ function validateSnapshot(configInput) {
|
|
|
5444
5444
|
|
|
5445
5445
|
// src/index.ts
|
|
5446
5446
|
var GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
5447
|
-
var GENERATOR_VERSION = "4.0.
|
|
5447
|
+
var GENERATOR_VERSION = "4.0.2";
|
|
5448
5448
|
var SCHEMA_VERSION = "3.0.0";
|
|
5449
5449
|
function sha256Hex2(input) {
|
|
5450
5450
|
return crypto3.createHash("sha256").update(input).digest("hex");
|
|
@@ -6285,6 +6285,7 @@ function generateSnapshot(configInput, options) {
|
|
|
6285
6285
|
const truncatedPreviewCount = files.filter((file) => file.isPreviewTruncated).length;
|
|
6286
6286
|
const validationErrors = verifyInMemory(files, parts, maxEffectiveBudget);
|
|
6287
6287
|
const totalContentBytes = files.reduce((total, file) => total + file.includedBytes, 0);
|
|
6288
|
+
const maskName = (value) => maskPathText(value, config.secretRules);
|
|
6288
6289
|
const manifest = {
|
|
6289
6290
|
schemaVersion: SCHEMA_VERSION,
|
|
6290
6291
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -6305,13 +6306,13 @@ function generateSnapshot(configInput, options) {
|
|
|
6305
6306
|
includeMonolith: config.includeMonolith,
|
|
6306
6307
|
includeSensitiveFiles: config.includeSensitiveFiles,
|
|
6307
6308
|
artifacts: { ...config.artifacts },
|
|
6308
|
-
include: [...config.include],
|
|
6309
|
+
include: [...config.include].map(maskName),
|
|
6309
6310
|
preset: config.preset,
|
|
6310
6311
|
layersMode: config.layersMode,
|
|
6311
6312
|
budgets: { default: config.budgets.default, byLayer: { ...config.budgets.byLayer } },
|
|
6312
|
-
excludePatterns: [...config.excludePatterns],
|
|
6313
|
-
layers: config.layers.map((layer2) => layer2.name),
|
|
6314
|
-
kinds: config.kinds.map((kind) => kind.kind)
|
|
6313
|
+
excludePatterns: [...config.excludePatterns].map(maskName),
|
|
6314
|
+
layers: config.layers.map((layer2) => maskName(layer2.name)),
|
|
6315
|
+
kinds: config.kinds.map((kind) => maskName(kind.kind))
|
|
6315
6316
|
},
|
|
6316
6317
|
counts: {
|
|
6317
6318
|
totalFiles: files.length,
|
|
@@ -6967,8 +6968,8 @@ function buildAgentContract() {
|
|
|
6967
6968
|
"snapshot.config.mjs",
|
|
6968
6969
|
"snapshot.config.cjs",
|
|
6969
6970
|
"snapshot.config.json",
|
|
6970
|
-
".snapshotrc",
|
|
6971
6971
|
".snapshotrc.json",
|
|
6972
|
+
".snapshotrc",
|
|
6972
6973
|
'package.json \u2192 "snapshot" key'
|
|
6973
6974
|
],
|
|
6974
6975
|
settings: [
|
|
@@ -7909,6 +7910,8 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
7909
7910
|
(segment) => segment === outName || segment === tmpName || segment.startsWith(`${outName}.backup-`) || VCS_SEGMENTS.has(segment)
|
|
7910
7911
|
);
|
|
7911
7912
|
let running = false;
|
|
7913
|
+
let quietUntil = 0;
|
|
7914
|
+
const QUIET_MS = 1500;
|
|
7912
7915
|
const regenerate = async () => {
|
|
7913
7916
|
if (running) return;
|
|
7914
7917
|
running = true;
|
|
@@ -7946,6 +7949,7 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
7946
7949
|
} catch (err) {
|
|
7947
7950
|
warn(`\u274C ${err.message}`);
|
|
7948
7951
|
} finally {
|
|
7952
|
+
quietUntil = performance.now() + QUIET_MS;
|
|
7949
7953
|
running = false;
|
|
7950
7954
|
}
|
|
7951
7955
|
};
|
|
@@ -7953,6 +7957,7 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
7953
7957
|
void regenerate();
|
|
7954
7958
|
let timer = null;
|
|
7955
7959
|
const watcher = fs11.watch(resolved.cwd, { recursive: true }, (_event, filename) => {
|
|
7960
|
+
if (performance.now() < quietUntil) return;
|
|
7956
7961
|
if (filename) {
|
|
7957
7962
|
const changed = path12.resolve(resolved.cwd, filename.toString());
|
|
7958
7963
|
if (isGenerated(changed)) return;
|
|
@@ -2188,12 +2188,8 @@ function isSensitivePath(relativePath) {
|
|
|
2188
2188
|
}
|
|
2189
2189
|
return matchesSensitiveList(posixPath, base);
|
|
2190
2190
|
}
|
|
2191
|
-
var activeSecretRules = null;
|
|
2192
|
-
function setActiveSecretRules(rules) {
|
|
2193
|
-
activeSecretRules = rules === null ? null : [...rules];
|
|
2194
|
-
}
|
|
2195
2191
|
function pathScanRules(extraRules) {
|
|
2196
|
-
const fallback = extraRules ??
|
|
2192
|
+
const fallback = extraRules ?? [];
|
|
2197
2193
|
return [...DEFAULT_SECRET_PATTERNS, ...fallback];
|
|
2198
2194
|
}
|
|
2199
2195
|
function findSecretInPath(relativePath, extraRules) {
|
|
@@ -2233,7 +2229,12 @@ function findSecretInPath(relativePath, extraRules) {
|
|
|
2233
2229
|
function maskSkipPaths(records, extraRules) {
|
|
2234
2230
|
return records.map((record) => {
|
|
2235
2231
|
const hit = findSecretInPath(record.path, extraRules);
|
|
2236
|
-
|
|
2232
|
+
const detail = record.detail ? findSecretInPath(record.detail, extraRules) : null;
|
|
2233
|
+
return {
|
|
2234
|
+
...record,
|
|
2235
|
+
path: hit ? hit.masked : record.path,
|
|
2236
|
+
...detail ? { detail: detail.masked } : {}
|
|
2237
|
+
};
|
|
2237
2238
|
});
|
|
2238
2239
|
}
|
|
2239
2240
|
function globToRegExp(glob) {
|
|
@@ -2923,6 +2924,9 @@ async function loadConfigFileDetailed(cwd) {
|
|
|
2923
2924
|
}
|
|
2924
2925
|
async function loadConfigFile(cwd) {
|
|
2925
2926
|
const loaded = await loadConfigFileDetailed(cwd);
|
|
2927
|
+
if (loaded.errors.length > 0) {
|
|
2928
|
+
throw new Error(`The config file could not be read: ${loaded.errors.join("; ")}`);
|
|
2929
|
+
}
|
|
2926
2930
|
return loaded.config;
|
|
2927
2931
|
}
|
|
2928
2932
|
var MIN_MAX_PART_BYTES = 4096;
|
|
@@ -3244,7 +3248,6 @@ function resolveConfig(userConfig, cliOptions, baseDir) {
|
|
|
3244
3248
|
...aliasedRules ?? []
|
|
3245
3249
|
]);
|
|
3246
3250
|
const secretRules = disableDefaultPatterns ? compiledCustomRules : [...compileSecretRules(DEFAULT_SECRET_PATTERNS), ...compiledCustomRules];
|
|
3247
|
-
setActiveSecretRules(secretRules);
|
|
3248
3251
|
const cliMonolith = cliOptions?.includeMonolith;
|
|
3249
3252
|
const includeMonolith = cliMonolith ?? strictBoolean(userConfig?.includeMonolith, false, "`includeMonolith`");
|
|
3250
3253
|
const artifacts = resolveArtifacts(
|
|
@@ -5404,7 +5407,7 @@ async function runInit(options) {
|
|
|
5404
5407
|
|
|
5405
5408
|
// src/index.ts
|
|
5406
5409
|
var GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
5407
|
-
var GENERATOR_VERSION = "4.0.
|
|
5410
|
+
var GENERATOR_VERSION = "4.0.2";
|
|
5408
5411
|
var SCHEMA_VERSION = "3.0.0";
|
|
5409
5412
|
function sha256Hex2(input) {
|
|
5410
5413
|
return crypto.createHash("sha256").update(input).digest("hex");
|
|
@@ -6245,6 +6248,7 @@ function generateSnapshot(configInput, options) {
|
|
|
6245
6248
|
const truncatedPreviewCount = files.filter((file) => file.isPreviewTruncated).length;
|
|
6246
6249
|
const validationErrors = verifyInMemory(files, parts, maxEffectiveBudget);
|
|
6247
6250
|
const totalContentBytes = files.reduce((total, file) => total + file.includedBytes, 0);
|
|
6251
|
+
const maskName = (value) => maskPathText(value, config.secretRules);
|
|
6248
6252
|
const manifest = {
|
|
6249
6253
|
schemaVersion: SCHEMA_VERSION,
|
|
6250
6254
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -6265,13 +6269,13 @@ function generateSnapshot(configInput, options) {
|
|
|
6265
6269
|
includeMonolith: config.includeMonolith,
|
|
6266
6270
|
includeSensitiveFiles: config.includeSensitiveFiles,
|
|
6267
6271
|
artifacts: { ...config.artifacts },
|
|
6268
|
-
include: [...config.include],
|
|
6272
|
+
include: [...config.include].map(maskName),
|
|
6269
6273
|
preset: config.preset,
|
|
6270
6274
|
layersMode: config.layersMode,
|
|
6271
6275
|
budgets: { default: config.budgets.default, byLayer: { ...config.budgets.byLayer } },
|
|
6272
|
-
excludePatterns: [...config.excludePatterns],
|
|
6273
|
-
layers: config.layers.map((layer2) => layer2.name),
|
|
6274
|
-
kinds: config.kinds.map((kind) => kind.kind)
|
|
6276
|
+
excludePatterns: [...config.excludePatterns].map(maskName),
|
|
6277
|
+
layers: config.layers.map((layer2) => maskName(layer2.name)),
|
|
6278
|
+
kinds: config.kinds.map((kind) => maskName(kind.kind))
|
|
6275
6279
|
},
|
|
6276
6280
|
counts: {
|
|
6277
6281
|
totalFiles: files.length,
|
|
@@ -6451,5 +6455,5 @@ async function generateSnapshotAsync(configInput, options) {
|
|
|
6451
6455
|
}
|
|
6452
6456
|
|
|
6453
6457
|
export { ARTIFACT_NAMES, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PRESETS, PromptCancelled, SCHEMA_VERSION, anchorForPath, assertReplaceable, assertUsableConfigInput, collectFiles, compareManifests, countLines, defineConfig, detectLanguage, detectPreset, explainPath, fenceForContent, fenceForText, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, isBinaryBuffer, isBinaryExtension, isBinaryFile, isInteractive, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, profileForPath, renderConfig, renderDiffText, renderExplainText, renderMinimalConfig, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, unknownPresetMessage, validateSnapshot };
|
|
6454
|
-
//# sourceMappingURL=chunk-
|
|
6455
|
-
//# sourceMappingURL=chunk-
|
|
6458
|
+
//# sourceMappingURL=chunk-CY3XU5TS.js.map
|
|
6459
|
+
//# sourceMappingURL=chunk-CY3XU5TS.js.map
|
package/dist/cli.cjs
CHANGED
|
@@ -1356,12 +1356,8 @@ function isSensitivePath(relativePath) {
|
|
|
1356
1356
|
}
|
|
1357
1357
|
return matchesSensitiveList(posixPath, base);
|
|
1358
1358
|
}
|
|
1359
|
-
var activeSecretRules = null;
|
|
1360
|
-
function setActiveSecretRules(rules) {
|
|
1361
|
-
activeSecretRules = rules === null ? null : [...rules];
|
|
1362
|
-
}
|
|
1363
1359
|
function pathScanRules(extraRules) {
|
|
1364
|
-
const fallback = extraRules ??
|
|
1360
|
+
const fallback = extraRules ?? [];
|
|
1365
1361
|
return [...DEFAULT_SECRET_PATTERNS, ...fallback];
|
|
1366
1362
|
}
|
|
1367
1363
|
function findSecretInPath(relativePath, extraRules) {
|
|
@@ -1401,7 +1397,12 @@ function findSecretInPath(relativePath, extraRules) {
|
|
|
1401
1397
|
function maskSkipPaths(records, extraRules) {
|
|
1402
1398
|
return records.map((record) => {
|
|
1403
1399
|
const hit = findSecretInPath(record.path, extraRules);
|
|
1404
|
-
|
|
1400
|
+
const detail = record.detail ? findSecretInPath(record.detail, extraRules) : null;
|
|
1401
|
+
return {
|
|
1402
|
+
...record,
|
|
1403
|
+
path: hit ? hit.masked : record.path,
|
|
1404
|
+
...detail ? { detail: detail.masked } : {}
|
|
1405
|
+
};
|
|
1405
1406
|
});
|
|
1406
1407
|
}
|
|
1407
1408
|
function globToRegExp(glob) {
|
|
@@ -2533,7 +2534,6 @@ function resolveConfig(userConfig, cliOptions, baseDir) {
|
|
|
2533
2534
|
...aliasedRules ?? []
|
|
2534
2535
|
]);
|
|
2535
2536
|
const secretRules = disableDefaultPatterns ? compiledCustomRules : [...compileSecretRules(DEFAULT_SECRET_PATTERNS), ...compiledCustomRules];
|
|
2536
|
-
setActiveSecretRules(secretRules);
|
|
2537
2537
|
const cliMonolith = cliOptions?.includeMonolith;
|
|
2538
2538
|
const includeMonolith = cliMonolith ?? strictBoolean(userConfig?.includeMonolith, false, "`includeMonolith`");
|
|
2539
2539
|
const artifacts = resolveArtifacts(
|
|
@@ -5424,7 +5424,7 @@ function validateSnapshot(configInput) {
|
|
|
5424
5424
|
|
|
5425
5425
|
// src/index.ts
|
|
5426
5426
|
var GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
5427
|
-
var GENERATOR_VERSION = "4.0.
|
|
5427
|
+
var GENERATOR_VERSION = "4.0.2";
|
|
5428
5428
|
var SCHEMA_VERSION = "3.0.0";
|
|
5429
5429
|
function sha256Hex2(input) {
|
|
5430
5430
|
return crypto__namespace.createHash("sha256").update(input).digest("hex");
|
|
@@ -6265,6 +6265,7 @@ function generateSnapshot(configInput, options) {
|
|
|
6265
6265
|
const truncatedPreviewCount = files.filter((file) => file.isPreviewTruncated).length;
|
|
6266
6266
|
const validationErrors = verifyInMemory(files, parts, maxEffectiveBudget);
|
|
6267
6267
|
const totalContentBytes = files.reduce((total, file) => total + file.includedBytes, 0);
|
|
6268
|
+
const maskName = (value) => maskPathText(value, config.secretRules);
|
|
6268
6269
|
const manifest = {
|
|
6269
6270
|
schemaVersion: SCHEMA_VERSION,
|
|
6270
6271
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -6285,13 +6286,13 @@ function generateSnapshot(configInput, options) {
|
|
|
6285
6286
|
includeMonolith: config.includeMonolith,
|
|
6286
6287
|
includeSensitiveFiles: config.includeSensitiveFiles,
|
|
6287
6288
|
artifacts: { ...config.artifacts },
|
|
6288
|
-
include: [...config.include],
|
|
6289
|
+
include: [...config.include].map(maskName),
|
|
6289
6290
|
preset: config.preset,
|
|
6290
6291
|
layersMode: config.layersMode,
|
|
6291
6292
|
budgets: { default: config.budgets.default, byLayer: { ...config.budgets.byLayer } },
|
|
6292
|
-
excludePatterns: [...config.excludePatterns],
|
|
6293
|
-
layers: config.layers.map((layer2) => layer2.name),
|
|
6294
|
-
kinds: config.kinds.map((kind) => kind.kind)
|
|
6293
|
+
excludePatterns: [...config.excludePatterns].map(maskName),
|
|
6294
|
+
layers: config.layers.map((layer2) => maskName(layer2.name)),
|
|
6295
|
+
kinds: config.kinds.map((kind) => maskName(kind.kind))
|
|
6295
6296
|
},
|
|
6296
6297
|
counts: {
|
|
6297
6298
|
totalFiles: files.length,
|
|
@@ -6947,8 +6948,8 @@ function buildAgentContract() {
|
|
|
6947
6948
|
"snapshot.config.mjs",
|
|
6948
6949
|
"snapshot.config.cjs",
|
|
6949
6950
|
"snapshot.config.json",
|
|
6950
|
-
".snapshotrc",
|
|
6951
6951
|
".snapshotrc.json",
|
|
6952
|
+
".snapshotrc",
|
|
6952
6953
|
'package.json \u2192 "snapshot" key'
|
|
6953
6954
|
],
|
|
6954
6955
|
settings: [
|
|
@@ -7897,6 +7898,8 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
7897
7898
|
(segment) => segment === outName || segment === tmpName || segment.startsWith(`${outName}.backup-`) || VCS_SEGMENTS.has(segment)
|
|
7898
7899
|
);
|
|
7899
7900
|
let running = false;
|
|
7901
|
+
let quietUntil = 0;
|
|
7902
|
+
const QUIET_MS = 1500;
|
|
7900
7903
|
const regenerate = async () => {
|
|
7901
7904
|
if (running) return;
|
|
7902
7905
|
running = true;
|
|
@@ -7934,6 +7937,7 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
7934
7937
|
} catch (err) {
|
|
7935
7938
|
warn(`\u274C ${err.message}`);
|
|
7936
7939
|
} finally {
|
|
7940
|
+
quietUntil = performance.now() + QUIET_MS;
|
|
7937
7941
|
running = false;
|
|
7938
7942
|
}
|
|
7939
7943
|
};
|
|
@@ -7941,6 +7945,7 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
7941
7945
|
void regenerate();
|
|
7942
7946
|
let timer = null;
|
|
7943
7947
|
const watcher = fs9__namespace.watch(resolved.cwd, { recursive: true }, (_event, filename) => {
|
|
7948
|
+
if (performance.now() < quietUntil) return;
|
|
7944
7949
|
if (filename) {
|
|
7945
7950
|
const changed = path10__namespace.resolve(resolved.cwd, filename.toString());
|
|
7946
7951
|
if (isGenerated(changed)) return;
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseByteSize, GENERATOR_VERSION, ARTIFACT_NAMES, getPreset, unknownPresetMessage, MIN_MAX_PART_BYTES, loadConfigFileDetailed, resolveConfig, validateSnapshot, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, GENERATOR_NAME, runInit, PromptCancelled, SCHEMA_VERSION, PRESETS, renderExplainText } from './chunk-
|
|
1
|
+
import { parseByteSize, GENERATOR_VERSION, ARTIFACT_NAMES, getPreset, unknownPresetMessage, MIN_MAX_PART_BYTES, loadConfigFileDetailed, resolveConfig, validateSnapshot, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, GENERATOR_NAME, runInit, PromptCancelled, SCHEMA_VERSION, PRESETS, renderExplainText } from './chunk-CY3XU5TS.js';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path2 from 'path';
|
|
4
4
|
import { parseArgs } from 'util';
|
|
@@ -483,8 +483,8 @@ function buildAgentContract() {
|
|
|
483
483
|
"snapshot.config.mjs",
|
|
484
484
|
"snapshot.config.cjs",
|
|
485
485
|
"snapshot.config.json",
|
|
486
|
-
".snapshotrc",
|
|
487
486
|
".snapshotrc.json",
|
|
487
|
+
".snapshotrc",
|
|
488
488
|
'package.json \u2192 "snapshot" key'
|
|
489
489
|
],
|
|
490
490
|
settings: [
|
|
@@ -1433,6 +1433,8 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
1433
1433
|
(segment) => segment === outName || segment === tmpName || segment.startsWith(`${outName}.backup-`) || VCS_SEGMENTS.has(segment)
|
|
1434
1434
|
);
|
|
1435
1435
|
let running = false;
|
|
1436
|
+
let quietUntil = 0;
|
|
1437
|
+
const QUIET_MS = 1500;
|
|
1436
1438
|
const regenerate = async () => {
|
|
1437
1439
|
if (running) return;
|
|
1438
1440
|
running = true;
|
|
@@ -1470,6 +1472,7 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
1470
1472
|
} catch (err) {
|
|
1471
1473
|
warn(`\u274C ${err.message}`);
|
|
1472
1474
|
} finally {
|
|
1475
|
+
quietUntil = performance.now() + QUIET_MS;
|
|
1473
1476
|
running = false;
|
|
1474
1477
|
}
|
|
1475
1478
|
};
|
|
@@ -1477,6 +1480,7 @@ async function runWatchLoop(invocation, resolved) {
|
|
|
1477
1480
|
void regenerate();
|
|
1478
1481
|
let timer = null;
|
|
1479
1482
|
const watcher = fs.watch(resolved.cwd, { recursive: true }, (_event, filename) => {
|
|
1483
|
+
if (performance.now() < quietUntil) return;
|
|
1480
1484
|
if (filename) {
|
|
1481
1485
|
const changed = path2.resolve(resolved.cwd, filename.toString());
|
|
1482
1486
|
if (isGenerated(changed)) return;
|
package/dist/index.cjs
CHANGED
|
@@ -2218,12 +2218,8 @@ function isSensitivePath(relativePath) {
|
|
|
2218
2218
|
}
|
|
2219
2219
|
return matchesSensitiveList(posixPath, base);
|
|
2220
2220
|
}
|
|
2221
|
-
var activeSecretRules = null;
|
|
2222
|
-
function setActiveSecretRules(rules) {
|
|
2223
|
-
activeSecretRules = rules === null ? null : [...rules];
|
|
2224
|
-
}
|
|
2225
2221
|
function pathScanRules(extraRules) {
|
|
2226
|
-
const fallback = extraRules ??
|
|
2222
|
+
const fallback = extraRules ?? [];
|
|
2227
2223
|
return [...DEFAULT_SECRET_PATTERNS, ...fallback];
|
|
2228
2224
|
}
|
|
2229
2225
|
function findSecretInPath(relativePath, extraRules) {
|
|
@@ -2263,7 +2259,12 @@ function findSecretInPath(relativePath, extraRules) {
|
|
|
2263
2259
|
function maskSkipPaths(records, extraRules) {
|
|
2264
2260
|
return records.map((record) => {
|
|
2265
2261
|
const hit = findSecretInPath(record.path, extraRules);
|
|
2266
|
-
|
|
2262
|
+
const detail = record.detail ? findSecretInPath(record.detail, extraRules) : null;
|
|
2263
|
+
return {
|
|
2264
|
+
...record,
|
|
2265
|
+
path: hit ? hit.masked : record.path,
|
|
2266
|
+
...detail ? { detail: detail.masked } : {}
|
|
2267
|
+
};
|
|
2267
2268
|
});
|
|
2268
2269
|
}
|
|
2269
2270
|
function globToRegExp(glob) {
|
|
@@ -2953,6 +2954,9 @@ async function loadConfigFileDetailed(cwd) {
|
|
|
2953
2954
|
}
|
|
2954
2955
|
async function loadConfigFile(cwd) {
|
|
2955
2956
|
const loaded = await loadConfigFileDetailed(cwd);
|
|
2957
|
+
if (loaded.errors.length > 0) {
|
|
2958
|
+
throw new Error(`The config file could not be read: ${loaded.errors.join("; ")}`);
|
|
2959
|
+
}
|
|
2956
2960
|
return loaded.config;
|
|
2957
2961
|
}
|
|
2958
2962
|
var MIN_MAX_PART_BYTES = 4096;
|
|
@@ -3274,7 +3278,6 @@ function resolveConfig(userConfig, cliOptions, baseDir) {
|
|
|
3274
3278
|
...aliasedRules ?? []
|
|
3275
3279
|
]);
|
|
3276
3280
|
const secretRules = disableDefaultPatterns ? compiledCustomRules : [...compileSecretRules(DEFAULT_SECRET_PATTERNS), ...compiledCustomRules];
|
|
3277
|
-
setActiveSecretRules(secretRules);
|
|
3278
3281
|
const cliMonolith = cliOptions?.includeMonolith;
|
|
3279
3282
|
const includeMonolith = cliMonolith ?? strictBoolean(userConfig?.includeMonolith, false, "`includeMonolith`");
|
|
3280
3283
|
const artifacts = resolveArtifacts(
|
|
@@ -5434,7 +5437,7 @@ async function runInit(options) {
|
|
|
5434
5437
|
|
|
5435
5438
|
// src/index.ts
|
|
5436
5439
|
var GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
5437
|
-
var GENERATOR_VERSION = "4.0.
|
|
5440
|
+
var GENERATOR_VERSION = "4.0.2";
|
|
5438
5441
|
var SCHEMA_VERSION = "3.0.0";
|
|
5439
5442
|
function sha256Hex2(input) {
|
|
5440
5443
|
return crypto__namespace.createHash("sha256").update(input).digest("hex");
|
|
@@ -6275,6 +6278,7 @@ function generateSnapshot(configInput, options) {
|
|
|
6275
6278
|
const truncatedPreviewCount = files.filter((file) => file.isPreviewTruncated).length;
|
|
6276
6279
|
const validationErrors = verifyInMemory(files, parts, maxEffectiveBudget);
|
|
6277
6280
|
const totalContentBytes = files.reduce((total, file) => total + file.includedBytes, 0);
|
|
6281
|
+
const maskName = (value) => maskPathText(value, config.secretRules);
|
|
6278
6282
|
const manifest = {
|
|
6279
6283
|
schemaVersion: SCHEMA_VERSION,
|
|
6280
6284
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -6295,13 +6299,13 @@ function generateSnapshot(configInput, options) {
|
|
|
6295
6299
|
includeMonolith: config.includeMonolith,
|
|
6296
6300
|
includeSensitiveFiles: config.includeSensitiveFiles,
|
|
6297
6301
|
artifacts: { ...config.artifacts },
|
|
6298
|
-
include: [...config.include],
|
|
6302
|
+
include: [...config.include].map(maskName),
|
|
6299
6303
|
preset: config.preset,
|
|
6300
6304
|
layersMode: config.layersMode,
|
|
6301
6305
|
budgets: { default: config.budgets.default, byLayer: { ...config.budgets.byLayer } },
|
|
6302
|
-
excludePatterns: [...config.excludePatterns],
|
|
6303
|
-
layers: config.layers.map((layer2) => layer2.name),
|
|
6304
|
-
kinds: config.kinds.map((kind) => kind.kind)
|
|
6306
|
+
excludePatterns: [...config.excludePatterns].map(maskName),
|
|
6307
|
+
layers: config.layers.map((layer2) => maskName(layer2.name)),
|
|
6308
|
+
kinds: config.kinds.map((kind) => maskName(kind.kind))
|
|
6305
6309
|
},
|
|
6306
6310
|
counts: {
|
|
6307
6311
|
totalFiles: files.length,
|
package/dist/index.d.cts
CHANGED
|
@@ -495,7 +495,7 @@ declare function matchesExclude(relativePath: string, pattern: string): boolean;
|
|
|
495
495
|
declare function collectFiles(cwd: string, options?: CollectOptions): CollectResult;
|
|
496
496
|
|
|
497
497
|
declare const GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
498
|
-
declare const GENERATOR_VERSION = "4.0.
|
|
498
|
+
declare const GENERATOR_VERSION = "4.0.2";
|
|
499
499
|
declare const SCHEMA_VERSION = "3.0.0";
|
|
500
500
|
interface GenerateOptions {
|
|
501
501
|
/** Compute the full manifest but write nothing to disk. */
|
package/dist/index.d.ts
CHANGED
|
@@ -495,7 +495,7 @@ declare function matchesExclude(relativePath: string, pattern: string): boolean;
|
|
|
495
495
|
declare function collectFiles(cwd: string, options?: CollectOptions): CollectResult;
|
|
496
496
|
|
|
497
497
|
declare const GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
|
|
498
|
-
declare const GENERATOR_VERSION = "4.0.
|
|
498
|
+
declare const GENERATOR_VERSION = "4.0.2";
|
|
499
499
|
declare const SCHEMA_VERSION = "3.0.0";
|
|
500
500
|
interface GenerateOptions {
|
|
501
501
|
/** Compute the full manifest but write nothing to disk. */
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ARTIFACT_NAMES, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PRESETS, PromptCancelled, SCHEMA_VERSION, anchorForPath, assertReplaceable, assertUsableConfigInput, collectFiles, compareManifests, countLines, defineConfig, detectLanguage, detectPreset, explainPath, fenceForContent, fenceForText, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, isBinaryBuffer, isBinaryExtension, isBinaryFile, isInteractive, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, profileForPath, renderConfig, renderDiffText, renderExplainText, renderMinimalConfig, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, validateSnapshot } from './chunk-
|
|
1
|
+
export { ARTIFACT_NAMES, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PRESETS, PromptCancelled, SCHEMA_VERSION, anchorForPath, assertReplaceable, assertUsableConfigInput, collectFiles, compareManifests, countLines, defineConfig, detectLanguage, detectPreset, explainPath, fenceForContent, fenceForText, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, isBinaryBuffer, isBinaryExtension, isBinaryFile, isInteractive, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, profileForPath, renderConfig, renderDiffText, renderExplainText, renderMinimalConfig, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, validateSnapshot } from './chunk-CY3XU5TS.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|