codebase-snapshot 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/README.md +1 -1
- package/SECURITY.md +2 -2
- package/dist/bin.js +84 -8
- package/dist/{chunk-7WSZUMT6.js → chunk-4OHQULCV.js} +1 -1
- package/dist/{chunk-2YNQ42B3.js → chunk-KHHUC6UT.js} +78 -8
- package/dist/cli.cjs +84 -8
- package/dist/cli.d.cts +11 -1
- package/dist/cli.d.ts +11 -1
- package/dist/cli.js +9 -3
- package/dist/index.cjs +78 -8
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +78 -8
- package/dist/mcp.js +2 -2
- package/dist/{types-CbD8yQRZ.d.cts → types-5G2Q6tWP.d.cts} +4 -0
- package/dist/{types-CbD8yQRZ.d.ts → types-5G2Q6tWP.d.ts} +4 -0
- package/docs/benchmarks.md +54 -9
- package/docs/cli.md +6 -4
- package/docs/deploy.md +2 -2
- package/docs/mcp.md +4 -4
- package/docs/tools.md +3 -1
- package/package.json +1 -1
package/dist/cli.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-
|
|
1
|
+
import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-5G2Q6tWP.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The machine-readable description of this tool.
|
|
@@ -304,6 +304,12 @@ declare const CLI_OPTIONS: {
|
|
|
304
304
|
readonly "remove-empty-lines": {
|
|
305
305
|
readonly type: "boolean";
|
|
306
306
|
};
|
|
307
|
+
readonly only: {
|
|
308
|
+
readonly type: "string";
|
|
309
|
+
};
|
|
310
|
+
readonly ignore: {
|
|
311
|
+
readonly type: "string";
|
|
312
|
+
};
|
|
307
313
|
readonly "all-members": {
|
|
308
314
|
readonly type: "boolean";
|
|
309
315
|
};
|
|
@@ -436,6 +442,10 @@ interface ParsedInvocation {
|
|
|
436
442
|
stripComments?: boolean;
|
|
437
443
|
/** `--remove-empty-lines`: drop blank lines from emitted bodies (line numbers move). */
|
|
438
444
|
removeEmptyLines?: boolean;
|
|
445
|
+
/** `--only <globs>`: override the include allow-list for this run. */
|
|
446
|
+
only?: string[];
|
|
447
|
+
/** `--ignore <globs>`: add to the exclude list for this run. */
|
|
448
|
+
ignore?: string[];
|
|
439
449
|
/** `--all-members` (health): audit every snapshot a `--workspace` run wrote. */
|
|
440
450
|
allMembers?: boolean;
|
|
441
451
|
}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-
|
|
1
|
+
import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-5G2Q6tWP.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The machine-readable description of this tool.
|
|
@@ -304,6 +304,12 @@ declare const CLI_OPTIONS: {
|
|
|
304
304
|
readonly "remove-empty-lines": {
|
|
305
305
|
readonly type: "boolean";
|
|
306
306
|
};
|
|
307
|
+
readonly only: {
|
|
308
|
+
readonly type: "string";
|
|
309
|
+
};
|
|
310
|
+
readonly ignore: {
|
|
311
|
+
readonly type: "string";
|
|
312
|
+
};
|
|
307
313
|
readonly "all-members": {
|
|
308
314
|
readonly type: "boolean";
|
|
309
315
|
};
|
|
@@ -436,6 +442,10 @@ interface ParsedInvocation {
|
|
|
436
442
|
stripComments?: boolean;
|
|
437
443
|
/** `--remove-empty-lines`: drop blank lines from emitted bodies (line numbers move). */
|
|
438
444
|
removeEmptyLines?: boolean;
|
|
445
|
+
/** `--only <globs>`: override the include allow-list for this run. */
|
|
446
|
+
only?: string[];
|
|
447
|
+
/** `--ignore <globs>`: add to the exclude list for this run. */
|
|
448
|
+
ignore?: string[];
|
|
439
449
|
/** `--all-members` (health): audit every snapshot a `--workspace` run wrote. */
|
|
440
450
|
allMembers?: boolean;
|
|
441
451
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { startHttpTransport } from './chunk-
|
|
2
|
-
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, buildAgentContract, startWebServer, runStdioServer, parseRemoteSource, assertPublicHost, cloneRepository, makeCloneDirectory, loadConfigFileDetailed, resolveConfig, validateSnapshot, auditSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, signManifest, loadSigningKey, writeSignature, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, COMMAND_OPTION_SCOPE, commandsForOption, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, SKILL_NAME, renderSkill, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, escapeControls, runWithStdoutCapture, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderContractText, renderExplainText } from './chunk-
|
|
3
|
-
export { buildAgentContract } from './chunk-
|
|
1
|
+
import { startHttpTransport } from './chunk-4OHQULCV.js';
|
|
2
|
+
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, buildAgentContract, startWebServer, runStdioServer, parseRemoteSource, assertPublicHost, cloneRepository, makeCloneDirectory, loadConfigFileDetailed, resolveConfig, validateSnapshot, auditSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, signManifest, loadSigningKey, writeSignature, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, COMMAND_OPTION_SCOPE, commandsForOption, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, SKILL_NAME, renderSkill, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, escapeControls, runWithStdoutCapture, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderContractText, renderExplainText } from './chunk-KHHUC6UT.js';
|
|
3
|
+
export { buildAgentContract } from './chunk-KHHUC6UT.js';
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
5
|
import * as fs2 from 'fs';
|
|
6
6
|
import * as path2 from 'path';
|
|
@@ -185,6 +185,8 @@ var CLI_OPTIONS = {
|
|
|
185
185
|
workspace: { type: "string" },
|
|
186
186
|
"strip-comments": { type: "boolean" },
|
|
187
187
|
"remove-empty-lines": { type: "boolean" },
|
|
188
|
+
only: { type: "string" },
|
|
189
|
+
ignore: { type: "string" },
|
|
188
190
|
"all-members": { type: "boolean" },
|
|
189
191
|
help: { type: "boolean", short: "h" },
|
|
190
192
|
version: { type: "boolean", short: "v" }
|
|
@@ -633,6 +635,8 @@ function parseCliArgs(argv) {
|
|
|
633
635
|
workspace: values.workspace === void 0 ? void 0 : String(values.workspace),
|
|
634
636
|
stripComments: values["strip-comments"] === true ? true : void 0,
|
|
635
637
|
removeEmptyLines: values["remove-empty-lines"] === true ? true : void 0,
|
|
638
|
+
only: values.only === void 0 ? void 0 : String(values.only).split(",").map((item) => item.trim()).filter(Boolean),
|
|
639
|
+
ignore: values.ignore === void 0 ? void 0 : String(values.ignore).split(",").map((item) => item.trim()).filter(Boolean),
|
|
636
640
|
allMembers: values["all-members"] === true ? true : void 0,
|
|
637
641
|
budgetTokens: values["budget-tokens"] === void 0 ? void 0 : parsePositiveInteger(values["budget-tokens"], "budget-tokens", 500),
|
|
638
642
|
delta: values.delta === void 0 ? void 0 : String(values.delta),
|
|
@@ -1334,6 +1338,8 @@ ${USAGE}
|
|
|
1334
1338
|
...invocation.tokenTree === true ? { tokenTree: true } : {},
|
|
1335
1339
|
...invocation.stripComments === true ? { stripComments: true } : {},
|
|
1336
1340
|
...invocation.removeEmptyLines === true ? { removeEmptyLines: true } : {},
|
|
1341
|
+
...invocation.only === void 0 ? {} : { only: invocation.only },
|
|
1342
|
+
...invocation.ignore === void 0 ? {} : { ignore: invocation.ignore },
|
|
1337
1343
|
...invocation.pack === void 0 ? {} : { pack: invocation.pack },
|
|
1338
1344
|
brief: invocation.brief,
|
|
1339
1345
|
promptTask: invocation.promptTask,
|
package/dist/index.cjs
CHANGED
|
@@ -4012,7 +4012,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
4012
4012
|
|
|
4013
4013
|
// src/version.ts
|
|
4014
4014
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
4015
|
-
var GENERATOR_VERSION = "0.
|
|
4015
|
+
var GENERATOR_VERSION = "0.15.0";
|
|
4016
4016
|
var SCHEMA_VERSION = "3.0.0";
|
|
4017
4017
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
4018
4018
|
function isOurGeneratorName(name) {
|
|
@@ -5884,7 +5884,12 @@ function resolveConfig(userConfig, cliOptions, baseDir) {
|
|
|
5884
5884
|
logCount: resolveLogCount(
|
|
5885
5885
|
cliOptions?.logCount ?? cliOptions?.includeLogs ?? userConfig?.logCount
|
|
5886
5886
|
),
|
|
5887
|
-
|
|
5887
|
+
// `--only` replaces the allow-list for this run; `--ignore` adds to the deny-list. The two
|
|
5888
|
+
// directions are different on purpose: a narrower allow-list is a statement about the whole
|
|
5889
|
+
// run, while "also ignore this" is naturally cumulative with what the config already excludes.
|
|
5890
|
+
include: resolveInclude(
|
|
5891
|
+
cliOptions?.only ?? userConfig?.include
|
|
5892
|
+
),
|
|
5888
5893
|
preset: preset.presetName,
|
|
5889
5894
|
presetExclude,
|
|
5890
5895
|
artifacts,
|
|
@@ -5895,9 +5900,12 @@ function resolveConfig(userConfig, cliOptions, baseDir) {
|
|
|
5895
5900
|
kinds,
|
|
5896
5901
|
// `exclude` is the flag spelling of the same setting; writing it in a config used to
|
|
5897
5902
|
// be ignored without a word.
|
|
5898
|
-
excludePatterns:
|
|
5899
|
-
|
|
5900
|
-
|
|
5903
|
+
excludePatterns: [
|
|
5904
|
+
...resolveExcludePatterns(
|
|
5905
|
+
userConfig?.excludePatterns ?? userConfig?.exclude
|
|
5906
|
+
),
|
|
5907
|
+
...resolveExcludePatterns(cliOptions?.ignore)
|
|
5908
|
+
],
|
|
5901
5909
|
secretRules,
|
|
5902
5910
|
// Extra property rather than a `ResolvedSnapshotConfig` field: the resolved
|
|
5903
5911
|
// shape is owned elsewhere, and every scan reads it through the registry in
|
|
@@ -12218,6 +12226,11 @@ var symbolTool = {
|
|
|
12218
12226
|
name: { type: "string", description: "Symbol name, case-insensitive." },
|
|
12219
12227
|
lines: { type: "integer", description: "Window size around the definition (default 40).", minimum: 5 },
|
|
12220
12228
|
maxFiles: { type: "integer", description: "Cap on files searched (default 5).", minimum: 1 },
|
|
12229
|
+
references: {
|
|
12230
|
+
type: "boolean",
|
|
12231
|
+
description: "Also report call sites: other files whose body mentions the name (default true)."
|
|
12232
|
+
},
|
|
12233
|
+
maxReferences: { type: "integer", description: "Cap on reported call sites (default 20).", minimum: 1 },
|
|
12221
12234
|
root: ROOT_PROPERTY,
|
|
12222
12235
|
outDir: OUT_DIR_PROPERTY
|
|
12223
12236
|
},
|
|
@@ -12228,7 +12241,8 @@ var symbolTool = {
|
|
|
12228
12241
|
type: "object",
|
|
12229
12242
|
properties: {
|
|
12230
12243
|
found: { type: "integer" },
|
|
12231
|
-
matches: { type: "array", items: { type: "object" } }
|
|
12244
|
+
matches: { type: "array", items: { type: "object" } },
|
|
12245
|
+
references: { type: "array", items: { type: "object" } }
|
|
12232
12246
|
}
|
|
12233
12247
|
},
|
|
12234
12248
|
annotations: READ_ONLY,
|
|
@@ -12281,8 +12295,44 @@ var symbolTool = {
|
|
|
12281
12295
|
structured: { found: 0, matches: [] }
|
|
12282
12296
|
};
|
|
12283
12297
|
}
|
|
12284
|
-
const
|
|
12285
|
-
|
|
12298
|
+
const callSites = [];
|
|
12299
|
+
if (args.references !== false) {
|
|
12300
|
+
const limit = Math.max(1, typeof args.maxReferences === "number" ? args.maxReferences : 20);
|
|
12301
|
+
const definitionKeys = new Set(matches.map((match) => match.path + ":" + match.line));
|
|
12302
|
+
const word = new RegExp("\\b" + name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "\\b");
|
|
12303
|
+
const parts = /* @__PURE__ */ new Map();
|
|
12304
|
+
let scanned = 0;
|
|
12305
|
+
for (const file of read.manifest.files) {
|
|
12306
|
+
if (callSites.length >= limit) break;
|
|
12307
|
+
const partPath = partPathFor(workspace, file.part);
|
|
12308
|
+
if (partPath === null) continue;
|
|
12309
|
+
let partText = parts.get(partPath);
|
|
12310
|
+
if (partText === void 0) {
|
|
12311
|
+
try {
|
|
12312
|
+
partText = fs24__namespace.readFileSync(partPath, "utf8");
|
|
12313
|
+
} catch {
|
|
12314
|
+
continue;
|
|
12315
|
+
}
|
|
12316
|
+
parts.set(partPath, partText);
|
|
12317
|
+
}
|
|
12318
|
+
if (scanned > MAX_SEARCH_BYTES) break;
|
|
12319
|
+
scanned += Buffer.byteLength(partText, "utf8");
|
|
12320
|
+
const section = findSection(parsePartSections(partText), file.relativePath);
|
|
12321
|
+
if (section === null) continue;
|
|
12322
|
+
const bodyLines = section.body.split("\n");
|
|
12323
|
+
for (let index = 0; index < bodyLines.length && callSites.length < limit; index += 1) {
|
|
12324
|
+
if (!word.test(bodyLines[index])) continue;
|
|
12325
|
+
callSites.push({
|
|
12326
|
+
path: file.relativePath,
|
|
12327
|
+
line: index + 1,
|
|
12328
|
+
text: bodyLines[index].trim().slice(0, 200),
|
|
12329
|
+
definition: definitionKeys.has(file.relativePath + ":" + (index + 1))
|
|
12330
|
+
});
|
|
12331
|
+
}
|
|
12332
|
+
}
|
|
12333
|
+
}
|
|
12334
|
+
const text2 = matches.map((match) => "### " + match.path + " (" + match.part + ", line " + match.line + ")\n" + match.text).join("\n\n") + (args.references === false ? "" : "\n\n" + (callSites.length === 0 ? "No call site was found in the snapshot." : "Call sites (" + callSites.length + "):\n" + callSites.map((site) => " " + site.path + ":" + site.line + " " + site.text).join("\n")));
|
|
12335
|
+
return { text: text2, structured: { found: matches.length, matches, references: callSites } };
|
|
12286
12336
|
}
|
|
12287
12337
|
};
|
|
12288
12338
|
var contextTool = {
|
|
@@ -13586,6 +13636,8 @@ var VALIDATE_OPTIONS = [
|
|
|
13586
13636
|
"sarif",
|
|
13587
13637
|
"strip-comments",
|
|
13588
13638
|
"remove-empty-lines",
|
|
13639
|
+
"only",
|
|
13640
|
+
"ignore",
|
|
13589
13641
|
"pack",
|
|
13590
13642
|
// The opt-in reports change the artifact selection the manifest records, so validate must accept
|
|
13591
13643
|
// them to compare like with like: without the flags it reports the selection as drift.
|
|
@@ -13621,6 +13673,8 @@ var COMMAND_OPTION_SCOPE = {
|
|
|
13621
13673
|
generate: [
|
|
13622
13674
|
"strip-comments",
|
|
13623
13675
|
"remove-empty-lines",
|
|
13676
|
+
"only",
|
|
13677
|
+
"ignore",
|
|
13624
13678
|
"workspace",
|
|
13625
13679
|
"budget-tokens",
|
|
13626
13680
|
"sign",
|
|
@@ -13701,6 +13755,10 @@ var COMMAND_OPTION_SCOPE = {
|
|
|
13701
13755
|
// Removed rather than implemented, because a flag that parses and does nothing is the defect
|
|
13702
13756
|
// this table exists to prevent.
|
|
13703
13757
|
"large-file-bytes",
|
|
13758
|
+
// `--only` and `--ignore` change which files are scanned, so they change what `explain` can say
|
|
13759
|
+
// about a path; without them the answer for an ignored file is "included: true".
|
|
13760
|
+
"only",
|
|
13761
|
+
"ignore",
|
|
13704
13762
|
"include-sensitive-files",
|
|
13705
13763
|
"no-config",
|
|
13706
13764
|
"discovery",
|
|
@@ -14173,6 +14231,18 @@ function buildAgentContract() {
|
|
|
14173
14231
|
appliesTo: optionAppliesTo("allow-origin"),
|
|
14174
14232
|
summary: "mcp --http: comma-separated extra CORS origins. Loopback origins are always allowed."
|
|
14175
14233
|
},
|
|
14234
|
+
{
|
|
14235
|
+
flag: "--only",
|
|
14236
|
+
type: "string",
|
|
14237
|
+
summary: "Comma-separated globs to include: overrides the config include list for this run.",
|
|
14238
|
+
appliesTo: optionAppliesTo("only")
|
|
14239
|
+
},
|
|
14240
|
+
{
|
|
14241
|
+
flag: "--ignore",
|
|
14242
|
+
type: "string",
|
|
14243
|
+
summary: "Comma-separated globs to exclude, added to the config exclude list for this run.",
|
|
14244
|
+
appliesTo: optionAppliesTo("ignore")
|
|
14245
|
+
},
|
|
14176
14246
|
{
|
|
14177
14247
|
flag: "--remove-empty-lines",
|
|
14178
14248
|
type: "boolean",
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, M as MarkdownSummary, b as SourceSummary, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, c as SnapshotConfig, B as ByteSize, C as CliOptions, d as PartMetadata, F as FileEntry, T as TextEncoding, e as SecretFinding, V as ValidationResult, f as Manifest, A as ArtifactSelection } from './types-
|
|
2
|
-
export { g as BudgetConfig, H as HooksConfig, I as InclusionMode, h as IncompleteFile, i as ManifestArtifact, j as ManifestConfigSnapshot, k as ManifestIndexes, l as ManifestTotals, m as Mode, O as OutputFormat, n as OwnerBrief, o as PartFileEntry, P as PromptTask, p as ResolvedArtifacts, q as ResolvedBudgets, r as SecretRuleInput, s as SkipReason, t as SummaryQuality, u as TruncationReason, v as ValidationDrift } from './types-
|
|
1
|
+
import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, M as MarkdownSummary, b as SourceSummary, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, c as SnapshotConfig, B as ByteSize, C as CliOptions, d as PartMetadata, F as FileEntry, T as TextEncoding, e as SecretFinding, V as ValidationResult, f as Manifest, A as ArtifactSelection } from './types-5G2Q6tWP.cjs';
|
|
2
|
+
export { g as BudgetConfig, H as HooksConfig, I as InclusionMode, h as IncompleteFile, i as ManifestArtifact, j as ManifestConfigSnapshot, k as ManifestIndexes, l as ManifestTotals, m as Mode, O as OutputFormat, n as OwnerBrief, o as PartFileEntry, P as PromptTask, p as ResolvedArtifacts, q as ResolvedBudgets, r as SecretRuleInput, s as SkipReason, t as SummaryQuality, u as TruncationReason, v as ValidationDrift } from './types-5G2Q6tWP.cjs';
|
|
3
3
|
export { w as workerEntry } from './generate-worker-B79yGkQO.cjs';
|
|
4
4
|
|
|
5
5
|
interface GitInfo {
|
|
@@ -548,7 +548,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
548
548
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
549
549
|
*/
|
|
550
550
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
551
|
-
declare const GENERATOR_VERSION = "0.
|
|
551
|
+
declare const GENERATOR_VERSION = "0.15.0";
|
|
552
552
|
/**
|
|
553
553
|
* The manifest and ownership-marker schema this build writes and understands.
|
|
554
554
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, M as MarkdownSummary, b as SourceSummary, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, c as SnapshotConfig, B as ByteSize, C as CliOptions, d as PartMetadata, F as FileEntry, T as TextEncoding, e as SecretFinding, V as ValidationResult, f as Manifest, A as ArtifactSelection } from './types-
|
|
2
|
-
export { g as BudgetConfig, H as HooksConfig, I as InclusionMode, h as IncompleteFile, i as ManifestArtifact, j as ManifestConfigSnapshot, k as ManifestIndexes, l as ManifestTotals, m as Mode, O as OutputFormat, n as OwnerBrief, o as PartFileEntry, P as PromptTask, p as ResolvedArtifacts, q as ResolvedBudgets, r as SecretRuleInput, s as SkipReason, t as SummaryQuality, u as TruncationReason, v as ValidationDrift } from './types-
|
|
1
|
+
import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, M as MarkdownSummary, b as SourceSummary, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, c as SnapshotConfig, B as ByteSize, C as CliOptions, d as PartMetadata, F as FileEntry, T as TextEncoding, e as SecretFinding, V as ValidationResult, f as Manifest, A as ArtifactSelection } from './types-5G2Q6tWP.js';
|
|
2
|
+
export { g as BudgetConfig, H as HooksConfig, I as InclusionMode, h as IncompleteFile, i as ManifestArtifact, j as ManifestConfigSnapshot, k as ManifestIndexes, l as ManifestTotals, m as Mode, O as OutputFormat, n as OwnerBrief, o as PartFileEntry, P as PromptTask, p as ResolvedArtifacts, q as ResolvedBudgets, r as SecretRuleInput, s as SkipReason, t as SummaryQuality, u as TruncationReason, v as ValidationDrift } from './types-5G2Q6tWP.js';
|
|
3
3
|
export { w as workerEntry } from './generate-worker-B79yGkQO.js';
|
|
4
4
|
|
|
5
5
|
interface GitInfo {
|
|
@@ -548,7 +548,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
548
548
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
549
549
|
*/
|
|
550
550
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
551
|
-
declare const GENERATOR_VERSION = "0.
|
|
551
|
+
declare const GENERATOR_VERSION = "0.15.0";
|
|
552
552
|
/**
|
|
553
553
|
* The manifest and ownership-marker schema this build writes and understands.
|
|
554
554
|
*
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, CONFIG_KEYS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, HOOK_MARKER, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, UP_TO_DATE_INTERVAL_MS, anchorForPath, appendGitignoreEntries, assertPublicHost, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, cloneRepository, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, crc32, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isPrivateHost, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, makeCloneDirectory, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, parseRemoteSource, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, workerEntry, wrapLines, writeZip } from './chunk-
|
|
1
|
+
export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, CONFIG_KEYS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, HOOK_MARKER, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, UP_TO_DATE_INTERVAL_MS, anchorForPath, appendGitignoreEntries, assertPublicHost, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, cloneRepository, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, crc32, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isPrivateHost, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, makeCloneDirectory, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, parseRemoteSource, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, workerEntry, wrapLines, writeZip } from './chunk-KHHUC6UT.js';
|
package/dist/mcp.cjs
CHANGED
|
@@ -2548,7 +2548,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
2548
2548
|
|
|
2549
2549
|
// src/version.ts
|
|
2550
2550
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
2551
|
-
var GENERATOR_VERSION = "0.
|
|
2551
|
+
var GENERATOR_VERSION = "0.15.0";
|
|
2552
2552
|
var SCHEMA_VERSION = "3.0.0";
|
|
2553
2553
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
2554
2554
|
function isOurGeneratorName(name) {
|
|
@@ -4372,7 +4372,12 @@ function resolveConfig(userConfig, cliOptions, baseDir) {
|
|
|
4372
4372
|
logCount: resolveLogCount(
|
|
4373
4373
|
cliOptions?.logCount ?? cliOptions?.includeLogs ?? userConfig?.logCount
|
|
4374
4374
|
),
|
|
4375
|
-
|
|
4375
|
+
// `--only` replaces the allow-list for this run; `--ignore` adds to the deny-list. The two
|
|
4376
|
+
// directions are different on purpose: a narrower allow-list is a statement about the whole
|
|
4377
|
+
// run, while "also ignore this" is naturally cumulative with what the config already excludes.
|
|
4378
|
+
include: resolveInclude(
|
|
4379
|
+
cliOptions?.only ?? userConfig?.include
|
|
4380
|
+
),
|
|
4376
4381
|
preset: preset.presetName,
|
|
4377
4382
|
presetExclude,
|
|
4378
4383
|
artifacts,
|
|
@@ -4383,9 +4388,12 @@ function resolveConfig(userConfig, cliOptions, baseDir) {
|
|
|
4383
4388
|
kinds,
|
|
4384
4389
|
// `exclude` is the flag spelling of the same setting; writing it in a config used to
|
|
4385
4390
|
// be ignored without a word.
|
|
4386
|
-
excludePatterns:
|
|
4387
|
-
|
|
4388
|
-
|
|
4391
|
+
excludePatterns: [
|
|
4392
|
+
...resolveExcludePatterns(
|
|
4393
|
+
userConfig?.excludePatterns ?? userConfig?.exclude
|
|
4394
|
+
),
|
|
4395
|
+
...resolveExcludePatterns(cliOptions?.ignore)
|
|
4396
|
+
],
|
|
4389
4397
|
secretRules,
|
|
4390
4398
|
// Extra property rather than a `ResolvedSnapshotConfig` field: the resolved
|
|
4391
4399
|
// shape is owned elsewhere, and every scan reads it through the registry in
|
|
@@ -10252,6 +10260,11 @@ var symbolTool = {
|
|
|
10252
10260
|
name: { type: "string", description: "Symbol name, case-insensitive." },
|
|
10253
10261
|
lines: { type: "integer", description: "Window size around the definition (default 40).", minimum: 5 },
|
|
10254
10262
|
maxFiles: { type: "integer", description: "Cap on files searched (default 5).", minimum: 1 },
|
|
10263
|
+
references: {
|
|
10264
|
+
type: "boolean",
|
|
10265
|
+
description: "Also report call sites: other files whose body mentions the name (default true)."
|
|
10266
|
+
},
|
|
10267
|
+
maxReferences: { type: "integer", description: "Cap on reported call sites (default 20).", minimum: 1 },
|
|
10255
10268
|
root: ROOT_PROPERTY,
|
|
10256
10269
|
outDir: OUT_DIR_PROPERTY
|
|
10257
10270
|
},
|
|
@@ -10262,7 +10275,8 @@ var symbolTool = {
|
|
|
10262
10275
|
type: "object",
|
|
10263
10276
|
properties: {
|
|
10264
10277
|
found: { type: "integer" },
|
|
10265
|
-
matches: { type: "array", items: { type: "object" } }
|
|
10278
|
+
matches: { type: "array", items: { type: "object" } },
|
|
10279
|
+
references: { type: "array", items: { type: "object" } }
|
|
10266
10280
|
}
|
|
10267
10281
|
},
|
|
10268
10282
|
annotations: READ_ONLY,
|
|
@@ -10315,8 +10329,44 @@ var symbolTool = {
|
|
|
10315
10329
|
structured: { found: 0, matches: [] }
|
|
10316
10330
|
};
|
|
10317
10331
|
}
|
|
10318
|
-
const
|
|
10319
|
-
|
|
10332
|
+
const callSites = [];
|
|
10333
|
+
if (args.references !== false) {
|
|
10334
|
+
const limit = Math.max(1, typeof args.maxReferences === "number" ? args.maxReferences : 20);
|
|
10335
|
+
const definitionKeys = new Set(matches.map((match) => match.path + ":" + match.line));
|
|
10336
|
+
const word = new RegExp("\\b" + name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "\\b");
|
|
10337
|
+
const parts = /* @__PURE__ */ new Map();
|
|
10338
|
+
let scanned = 0;
|
|
10339
|
+
for (const file of read.manifest.files) {
|
|
10340
|
+
if (callSites.length >= limit) break;
|
|
10341
|
+
const partPath = partPathFor(workspace, file.part);
|
|
10342
|
+
if (partPath === null) continue;
|
|
10343
|
+
let partText = parts.get(partPath);
|
|
10344
|
+
if (partText === void 0) {
|
|
10345
|
+
try {
|
|
10346
|
+
partText = fs2__namespace.readFileSync(partPath, "utf8");
|
|
10347
|
+
} catch {
|
|
10348
|
+
continue;
|
|
10349
|
+
}
|
|
10350
|
+
parts.set(partPath, partText);
|
|
10351
|
+
}
|
|
10352
|
+
if (scanned > MAX_SEARCH_BYTES) break;
|
|
10353
|
+
scanned += Buffer.byteLength(partText, "utf8");
|
|
10354
|
+
const section = findSection(parsePartSections(partText), file.relativePath);
|
|
10355
|
+
if (section === null) continue;
|
|
10356
|
+
const bodyLines = section.body.split("\n");
|
|
10357
|
+
for (let index = 0; index < bodyLines.length && callSites.length < limit; index += 1) {
|
|
10358
|
+
if (!word.test(bodyLines[index])) continue;
|
|
10359
|
+
callSites.push({
|
|
10360
|
+
path: file.relativePath,
|
|
10361
|
+
line: index + 1,
|
|
10362
|
+
text: bodyLines[index].trim().slice(0, 200),
|
|
10363
|
+
definition: definitionKeys.has(file.relativePath + ":" + (index + 1))
|
|
10364
|
+
});
|
|
10365
|
+
}
|
|
10366
|
+
}
|
|
10367
|
+
}
|
|
10368
|
+
const text = matches.map((match) => "### " + match.path + " (" + match.part + ", line " + match.line + ")\n" + match.text).join("\n\n") + (args.references === false ? "" : "\n\n" + (callSites.length === 0 ? "No call site was found in the snapshot." : "Call sites (" + callSites.length + "):\n" + callSites.map((site) => " " + site.path + ":" + site.line + " " + site.text).join("\n")));
|
|
10369
|
+
return { text, structured: { found: matches.length, matches, references: callSites } };
|
|
10320
10370
|
}
|
|
10321
10371
|
};
|
|
10322
10372
|
var contextTool = {
|
|
@@ -11589,6 +11639,8 @@ var VALIDATE_OPTIONS = [
|
|
|
11589
11639
|
"sarif",
|
|
11590
11640
|
"strip-comments",
|
|
11591
11641
|
"remove-empty-lines",
|
|
11642
|
+
"only",
|
|
11643
|
+
"ignore",
|
|
11592
11644
|
"pack",
|
|
11593
11645
|
// The opt-in reports change the artifact selection the manifest records, so validate must accept
|
|
11594
11646
|
// them to compare like with like: without the flags it reports the selection as drift.
|
|
@@ -11624,6 +11676,8 @@ var COMMAND_OPTION_SCOPE = {
|
|
|
11624
11676
|
generate: [
|
|
11625
11677
|
"strip-comments",
|
|
11626
11678
|
"remove-empty-lines",
|
|
11679
|
+
"only",
|
|
11680
|
+
"ignore",
|
|
11627
11681
|
"workspace",
|
|
11628
11682
|
"budget-tokens",
|
|
11629
11683
|
"sign",
|
|
@@ -11704,6 +11758,10 @@ var COMMAND_OPTION_SCOPE = {
|
|
|
11704
11758
|
// Removed rather than implemented, because a flag that parses and does nothing is the defect
|
|
11705
11759
|
// this table exists to prevent.
|
|
11706
11760
|
"large-file-bytes",
|
|
11761
|
+
// `--only` and `--ignore` change which files are scanned, so they change what `explain` can say
|
|
11762
|
+
// about a path; without them the answer for an ignored file is "included: true".
|
|
11763
|
+
"only",
|
|
11764
|
+
"ignore",
|
|
11707
11765
|
"include-sensitive-files",
|
|
11708
11766
|
"no-config",
|
|
11709
11767
|
"discovery",
|
|
@@ -12176,6 +12234,18 @@ function buildAgentContract() {
|
|
|
12176
12234
|
appliesTo: optionAppliesTo("allow-origin"),
|
|
12177
12235
|
summary: "mcp --http: comma-separated extra CORS origins. Loopback origins are always allowed."
|
|
12178
12236
|
},
|
|
12237
|
+
{
|
|
12238
|
+
flag: "--only",
|
|
12239
|
+
type: "string",
|
|
12240
|
+
summary: "Comma-separated globs to include: overrides the config include list for this run.",
|
|
12241
|
+
appliesTo: optionAppliesTo("only")
|
|
12242
|
+
},
|
|
12243
|
+
{
|
|
12244
|
+
flag: "--ignore",
|
|
12245
|
+
type: "string",
|
|
12246
|
+
summary: "Comma-separated globs to exclude, added to the config exclude list for this run.",
|
|
12247
|
+
appliesTo: optionAppliesTo("ignore")
|
|
12248
|
+
},
|
|
12179
12249
|
{
|
|
12180
12250
|
flag: "--remove-empty-lines",
|
|
12181
12251
|
type: "boolean",
|
package/dist/mcp.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { generateToken, startHttpTransport } from './chunk-
|
|
2
|
-
export { ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, generateInWorker, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, stripComments, validateArguments, windowText } from './chunk-
|
|
1
|
+
export { generateToken, startHttpTransport } from './chunk-4OHQULCV.js';
|
|
2
|
+
export { ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, generateInWorker, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, stripComments, validateArguments, windowText } from './chunk-KHHUC6UT.js';
|
|
@@ -923,6 +923,10 @@ interface CliOptions {
|
|
|
923
923
|
stripComments?: boolean;
|
|
924
924
|
/** `--remove-empty-lines`: drop blank lines from emitted bodies. */
|
|
925
925
|
removeEmptyLines?: boolean;
|
|
926
|
+
/** `--only <globs>`: override the config include allow-list for this run. */
|
|
927
|
+
only?: string[];
|
|
928
|
+
/** `--ignore <globs>`: add to the config exclude list for this run. */
|
|
929
|
+
ignore?: string[];
|
|
926
930
|
maxPartBytes?: number;
|
|
927
931
|
maxPartTokens?: ByteSize | null;
|
|
928
932
|
largeFileBytes?: number;
|
|
@@ -923,6 +923,10 @@ interface CliOptions {
|
|
|
923
923
|
stripComments?: boolean;
|
|
924
924
|
/** `--remove-empty-lines`: drop blank lines from emitted bodies. */
|
|
925
925
|
removeEmptyLines?: boolean;
|
|
926
|
+
/** `--only <globs>`: override the config include allow-list for this run. */
|
|
927
|
+
only?: string[];
|
|
928
|
+
/** `--ignore <globs>`: add to the config exclude list for this run. */
|
|
929
|
+
ignore?: string[];
|
|
926
930
|
maxPartBytes?: number;
|
|
927
931
|
maxPartTokens?: ByteSize | null;
|
|
928
932
|
largeFileBytes?: number;
|
package/docs/benchmarks.md
CHANGED
|
@@ -37,6 +37,47 @@ tokens in full.
|
|
|
37
37
|
4. **Generation is not the bottleneck.** All three modes take about the same time; the saving is in
|
|
38
38
|
what gets written, not in what gets read.
|
|
39
39
|
|
|
40
|
+
## Ten public repositories
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
node scripts/benchmark-suite.mjs # the ten default repositories
|
|
44
|
+
node scripts/benchmark-suite.mjs --json # the same run, as data
|
|
45
|
+
node scripts/benchmark-suite.mjs <url> ... # your own list
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Each repository is cloned shallow into a scratch directory, packed by all three tools, and the
|
|
49
|
+
clone is deleted. A repository that cannot be cloned is reported as skipped with the reason, never
|
|
50
|
+
dropped from the table. Measured at 0.14.5, repomix 1.19.0, gitingest from PyPI:
|
|
51
|
+
|
|
52
|
+
| Repository | Ours files | Ours tokens | repomix tokens | repomix / ours | gitingest bytes |
|
|
53
|
+
| :-- | --: | --: | --: | --: | --: |
|
|
54
|
+
| jonschlinkert/is-odd | 11 | 5,450 | 4,291 | 0.79 | 29,392 |
|
|
55
|
+
| chalk/chalk | 32 | 77,684 | 79,006 | 1.02 | 238,864 |
|
|
56
|
+
| tj/co | 19 | 12,996 | 9,189 | 0.71 | 74,613 |
|
|
57
|
+
| isaacs/minimatch | 85 | 319,879 | 64,846,987 | 202.7 | 1,800,672 |
|
|
58
|
+
| moment/luxon | 151 | 303,032 | 250,093 | 0.83 | 806,740 |
|
|
59
|
+
| psf/requests | 117 | 382,695 | 687,333 | 1.80 | 524,712 |
|
|
60
|
+
| pallets/click | 177 | 470,265 | 335,153 | 0.71 | 1,413,342 |
|
|
61
|
+
| expressjs/express | 215 | 261,829 | 198,639 | 0.76 | 792,177 |
|
|
62
|
+
| colinhacks/zod | 686 | 1,762,835 | 1,748,187 | 0.99 | 4,468,877 |
|
|
63
|
+
| anuraghazra/github-readme-stats | 131 | 205,009 | 169,079 | 0.82 | 553,367 |
|
|
64
|
+
|
|
65
|
+
Read it carefully:
|
|
66
|
+
|
|
67
|
+
- **The ratio is not a contest.** Our estimate is one token per four bytes of emitted body; repomix
|
|
68
|
+
uses a tokenizer. Across nine repositories the two land within about plus or minus 30%, which is
|
|
69
|
+
what two reasonable estimates of the same text do.
|
|
70
|
+
- **minimatch is the exception, and it is a policy difference, not an estimate.** That repository
|
|
71
|
+
carries five benchmark fixtures of 20 to 25 MB of JSON. repomix emits them (64.8M tokens); our
|
|
72
|
+
large-file rule emits a bounded preview and records the omission, so the pack stays 319,879 tokens.
|
|
73
|
+
A pack that will not fit in a context window has not helped the reader, however complete it is.
|
|
74
|
+
- **gitingest publishes no token count**, so its column is the size of its one-document digest.
|
|
75
|
+
- **File counts agree within one or two** everywhere except minimatch, where our preview keeps the
|
|
76
|
+
files and repomix keeps their bytes.
|
|
77
|
+
|
|
78
|
+
The point of ten repositories is not a leaderboard; it is that the shape holds outside the
|
|
79
|
+
repository the tool was written in.
|
|
80
|
+
|
|
40
81
|
## Honest limits
|
|
41
82
|
|
|
42
83
|
- Self-benchmark. This repository is TypeScript with a clean import graph; a vendored monorepo with
|
|
@@ -52,15 +93,17 @@ tokens in full.
|
|
|
52
93
|
node scripts/compare.mjs --repomix # add --json for machine-readable output
|
|
53
94
|
```
|
|
54
95
|
|
|
55
|
-
repomix is fetched through `npx` at run time
|
|
56
|
-
this repository at 0.
|
|
96
|
+
repomix is fetched through `npx` at run time and gitingest through `python -m gitingest`;
|
|
97
|
+
neither is a dependency of this package. Measured on this repository at 0.14.2, repomix 1.19.0,
|
|
98
|
+
gitingest from PyPI, same machine:
|
|
57
99
|
|
|
58
100
|
| Tool / mode | Files | Content bytes | Tokens | vs full | Time |
|
|
59
101
|
| :-- | --: | --: | --: | --: | --: |
|
|
60
|
-
| codebase-snapshot (full) |
|
|
61
|
-
| codebase-snapshot (slice) | 4 | 239,
|
|
62
|
-
| codebase-snapshot (budget 30,000) |
|
|
63
|
-
| repomix 1.19.0 |
|
|
102
|
+
| codebase-snapshot (full) | 336 | 3,301,883 | 1,060,727 | 100% | 2.22 s |
|
|
103
|
+
| codebase-snapshot (slice) | 4 | 239,837 | 66,903 | 6.3% | 2.14 s |
|
|
104
|
+
| codebase-snapshot (budget 30,000) | 22 | 119,915 | 36,107 | 3.4% | 2.09 s |
|
|
105
|
+
| repomix 1.19.0 | 335 | 3,519,653 | 888,168 | 83.7% | n/a |
|
|
106
|
+
| gitingest | ? | 3,123,817 | n/a | n/a | n/a |
|
|
64
107
|
|
|
65
108
|
Read that honestly:
|
|
66
109
|
|
|
@@ -72,9 +115,11 @@ Read that honestly:
|
|
|
72
115
|
which includes its own wrappers), and the file sets differ slightly: 330 against 329.
|
|
73
116
|
- **The modes are what the other tool does not have.** repomix packs the repository; a slice and a
|
|
74
117
|
budget are the same snapshot narrowed after scanning, at 6.5% and 3.5% of the tokens.
|
|
75
|
-
- **gitingest is
|
|
76
|
-
|
|
118
|
+
- **gitingest's digest is smaller in bytes** (3.12 MB against our 3.30 MB of file content), and it
|
|
119
|
+
publishes no token count at all; the harness reports its digest size and says so. Its output is
|
|
120
|
+
one flat document with a tree and a separator per file, which is why a byte comparison is the
|
|
121
|
+
only honest one.
|
|
77
122
|
|
|
78
123
|
The same caveats apply to any comparison: different ignore rules, different wrappers, different
|
|
79
124
|
tokenizers. What is comparable is the shape — full packs are too large for a context window, and a
|
|
80
|
-
selection is one to two orders of magnitude smaller.
|
|
125
|
+
selection is one to two orders of magnitude smaller.
|
package/docs/cli.md
CHANGED
|
@@ -97,7 +97,7 @@ Exit `0` when the snapshot passes its own integrity check, `1` when it does not.
|
|
|
97
97
|
|
|
98
98
|
```
|
|
99
99
|
📸 Generating snapshot for: /path/to/repo
|
|
100
|
-
Branch: main | Part budget: 300 KB | Generator: 0.
|
|
100
|
+
Branch: main | Part budget: 300 KB | Generator: 0.15.0 (project dependency ^0.15.0)
|
|
101
101
|
|
|
102
102
|
✅ Snapshot generated in 0.14s:
|
|
103
103
|
- Tracked files: 121 included of 128 paths found — 7 skipped (default-ignore 5, binary 1, sensitive-file 1); every one is listed in snapshot/reports/audit.md
|
|
@@ -218,7 +218,7 @@ The whole first run in one command, with defaults and no prompts. This is the sa
|
|
|
218
218
|
🚀 Setup for: /path/to/repo
|
|
219
219
|
✅ Created snapshot.config.ts (preset: nextjs)
|
|
220
220
|
Added npm scripts: snapshot, snapshot:validate
|
|
221
|
-
Added devDependency: codebase-snapshot ^0.
|
|
221
|
+
Added devDependency: codebase-snapshot ^0.15.0
|
|
222
222
|
Added to .gitignore: /snapshot/, /snapshot.tmp/
|
|
223
223
|
⏳ Installing dependencies…
|
|
224
224
|
✅ Installed dependencies (npm install, 2.1s)
|
|
@@ -270,7 +270,7 @@ It also has three side effects on files you own, and it says so when it does the
|
|
|
270
270
|
```
|
|
271
271
|
✅ Created snapshot.config.ts (preset: node-lib)
|
|
272
272
|
Added npm scripts: snapshot, snapshot:validate
|
|
273
|
-
Added devDependency: codebase-snapshot ^0.
|
|
273
|
+
Added devDependency: codebase-snapshot ^0.15.0
|
|
274
274
|
Added to .gitignore: /snapshot/, /snapshot.tmp/
|
|
275
275
|
```
|
|
276
276
|
|
|
@@ -494,6 +494,8 @@ for the two install flags, and the init-and-setup flags list both commands.
|
|
|
494
494
|
| `--prompt-task <task>` | string | `audit` | generate, validate | `audit`, `review` or `explain` — which job the brief is written for. Changes the opening section, not the standard. |
|
|
495
495
|
| `--budget-tokens <n>` | count | unset | generate | Fit the snapshot into n tokens by selecting whole files (entry points, then the most-imported). Records a `budget` block; the rest are `not-selected`. See [budget](budget.md). |
|
|
496
496
|
| `--sign` | flag | off | generate | Sign `manifest.json` with Ed25519 and write `signature.json`. Key from `SNAPSHOT_SIGNING_KEY`, else generated (trust on first use). See [signing](signing.md). |
|
|
497
|
+
| `--only <globs>` | list | unset | generate, validate, explain | Comma-separated globs to include: **replaces** the config `include` list for this run. |
|
|
498
|
+
| `--ignore <globs>` | list | unset | generate, validate, explain | Comma-separated globs to exclude: **adds to** the config exclude list for this run. Both are part of the config digest, so `validate` needs the same flags. |
|
|
497
499
|
| `--remove-empty-lines` | flag | off | generate, validate | Drop blank and whitespace-only lines from emitted bodies. Line numbers no longer match the source; every affected file records `emptyLinesRemoved: true` and the brief says so. |
|
|
498
500
|
| `--strip-comments` | flag | off | generate, validate | Remove comment text from JavaScript/TypeScript bodies. Newlines are kept, so line numbers do not move; files record `inclusionMode: "comments-stripped"`. |
|
|
499
501
|
| `--workspace <a,b>` | list | unset | generate | One snapshot per member under `<outDir>/<name>`, plus `WORKSPACE.json`. Exits 1 if any member failed. See [workspaces](workspace.md). |
|
|
@@ -671,4 +673,4 @@ npx codebase-snapshot generate --watch
|
|
|
671
673
|
|
|
672
674
|
# Give an agent everything it needs
|
|
673
675
|
npx codebase-snapshot skill --install
|
|
674
|
-
```
|
|
676
|
+
```
|
package/docs/deploy.md
CHANGED
|
@@ -61,8 +61,8 @@ After=network.target
|
|
|
61
61
|
Type=oneshot
|
|
62
62
|
User=deploy
|
|
63
63
|
WorkingDirectory=/srv/app
|
|
64
|
-
ExecStart=/usr/bin/npx -y codebase-snapshot@0.
|
|
65
|
-
ExecStartPost=/usr/bin/npx -y codebase-snapshot@0.
|
|
64
|
+
ExecStart=/usr/bin/npx -y codebase-snapshot@0.15.0 generate --cwd /srv/app
|
|
65
|
+
ExecStartPost=/usr/bin/npx -y codebase-snapshot@0.15.0 validate --cwd /srv/app
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
```ini
|