codebase-snapshot 0.20.8 → 0.20.12
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 +67 -6
- package/README.md +15 -16
- package/SECURITY.md +0 -1
- package/dist/bin.js +8200 -6854
- package/dist/{chunk-RVWDPCJ6.js → chunk-TUKY6KLH.js} +8707 -6963
- package/dist/chunk-WMEZFLUT.js +1 -0
- package/dist/cli.cjs +10993 -9653
- package/dist/cli.d.cts +2 -2
- package/dist/cli.d.ts +2 -2
- package/dist/cli.js +68 -19
- package/dist/{generate-worker-CkWFKtf0.d.ts → generate-worker-CRMESc0b.d.ts} +24 -11
- package/dist/{generate-worker-Wne8FzN5.d.cts → generate-worker-DMzNbsAW.d.cts} +24 -11
- package/dist/index.cjs +8334 -6753
- package/dist/index.d.cts +66 -40
- package/dist/index.d.ts +66 -40
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +5026 -10058
- package/dist/mcp.d.cts +17 -5
- package/dist/mcp.d.ts +17 -5
- package/dist/mcp.js +2 -2
- package/dist/{types-CykWdR6V.d.cts → types-C5ytHMYz.d.cts} +10 -0
- package/dist/{types-CykWdR6V.d.ts → types-C5ytHMYz.d.ts} +10 -0
- package/docs/benchmarks.md +9 -6
- package/docs/budget.md +3 -2
- package/docs/cli.md +22 -21
- package/docs/configuration.md +17 -16
- package/docs/deploy.md +2 -2
- package/docs/health.md +1 -1
- package/docs/how-to-feed-a-repo-to-claude.md +8 -11
- package/docs/mcp.md +22 -16
- package/docs/migration.md +42 -43
- package/docs/output.md +2 -1
- package/docs/security-review.md +35 -8
- package/docs/tools.md +4 -3
- package/docs/vs-gitingest.md +2 -2
- package/docs/vs-repomix.md +7 -6
- package/docs/workspace.md +4 -2
- package/package.json +1 -1
- package/dist/chunk-STWEFBES.js +0 -459
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as node_crypto from 'node:crypto';
|
|
2
|
-
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,
|
|
3
|
-
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-
|
|
4
|
-
export { w as workerEntry } from './generate-worker-
|
|
2
|
+
import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, M as MarkdownSummary, b as SourceSummary, c as SnapshotConfig, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, 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-C5ytHMYz.cjs';
|
|
3
|
+
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-C5ytHMYz.cjs';
|
|
4
|
+
export { w as workerEntry } from './generate-worker-DMzNbsAW.cjs';
|
|
5
5
|
|
|
6
6
|
interface GitInfo {
|
|
7
7
|
branch: string;
|
|
@@ -140,6 +140,16 @@ declare function summarizeMarkdown(content: string): MarkdownSummary;
|
|
|
140
140
|
*/
|
|
141
141
|
declare function summarizeTypeScriptSource(relativePath: string, content: string): SourceSummary;
|
|
142
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Rejects configuration that is not safe for a server that answers untrusted prompts.
|
|
145
|
+
*
|
|
146
|
+
* The CLI may honor `includeSensitiveFiles` and a deliberately broad custom pattern: the user
|
|
147
|
+
* invoked the repository's own command. An MCP or `serve` process cannot make that assumption —
|
|
148
|
+
* the config and the request can both come from a repository the user is reviewing. The check is
|
|
149
|
+
* a refusal rather than a silent override, because a setting that was ignored and a setting that
|
|
150
|
+
* was applied must never look alike.
|
|
151
|
+
*/
|
|
152
|
+
declare function assertServerSafeConfig(config: SnapshotConfig | null, source?: string): void;
|
|
143
153
|
/**
|
|
144
154
|
* Brands a resolved config so consumers can distinguish it from a user
|
|
145
155
|
* `SnapshotConfig` structurally, instead of guessing from the presence of a
|
|
@@ -555,7 +565,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
555
565
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
556
566
|
*/
|
|
557
567
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
558
|
-
declare const GENERATOR_VERSION = "0.20.
|
|
568
|
+
declare const GENERATOR_VERSION = "0.20.12";
|
|
559
569
|
/**
|
|
560
570
|
* The manifest and ownership-marker schema this build writes and understands.
|
|
561
571
|
*
|
|
@@ -641,21 +651,6 @@ declare function cloneRepository(source: RemoteSource, options: CloneOptions): P
|
|
|
641
651
|
/** A temp directory for one clone, removed by the caller. */
|
|
642
652
|
declare function makeCloneDirectory(): string;
|
|
643
653
|
|
|
644
|
-
/**
|
|
645
|
-
* `snapshot serve`: the browser face of the tool.
|
|
646
|
-
*
|
|
647
|
-
* One process serves the page, the API it calls, and the MCP endpoint, so a browser client and an
|
|
648
|
-
* agent talk to the same snapshot. Three rules shape it:
|
|
649
|
-
*
|
|
650
|
-
* - Loopback by default, a bearer token always (generated on first run, printed once). The page
|
|
651
|
-
* asks for the token and keeps it in localStorage, so serving / can never leak the credential.
|
|
652
|
-
* - The API only ever writes where a person pointed it: a local path that exists, with the
|
|
653
|
-
* repository's own JSON settings and its executable config refused. A remote URL is refused
|
|
654
|
-
* with a message that says what is missing, rather
|
|
655
|
-
* than pretending to fetch.
|
|
656
|
-
* - Every response is bounded. The preview is the first 64 KiB of PROMPT.md, the file list is
|
|
657
|
-
* capped, the zip is built in memory and streamed once.
|
|
658
|
-
*/
|
|
659
654
|
interface ServeOptions {
|
|
660
655
|
cwd: string;
|
|
661
656
|
host?: string;
|
|
@@ -808,6 +803,57 @@ declare function formatUpdateNotice(notice: UpdateNotice, kind: InstallKind): st
|
|
|
808
803
|
|
|
809
804
|
declare const DEFAULT_SECRET_PATTERNS: SecretRule[];
|
|
810
805
|
|
|
806
|
+
/**
|
|
807
|
+
* The health service: audits a written snapshot against the repository it claims to describe.
|
|
808
|
+
*
|
|
809
|
+
* validate answers "did the code move since this was generated?". It cannot answer the
|
|
810
|
+
* questions a reader cares about before pasting a snapshot somewhere: did anything secret
|
|
811
|
+
* survive into an artifact, can the claims be checked, is the token count real, does the
|
|
812
|
+
* machine identity leak into the text? This module answers those, with severities and a score.
|
|
813
|
+
*
|
|
814
|
+
* Nothing here writes. A report that mutates is not evidence.
|
|
815
|
+
*/
|
|
816
|
+
type HealthSeverity = "critical" | "warning" | "info";
|
|
817
|
+
type HealthStatus = "pass" | "warn" | "fail" | "skip";
|
|
818
|
+
interface HealthCheck {
|
|
819
|
+
id: string;
|
|
820
|
+
title: string;
|
|
821
|
+
severity: HealthSeverity;
|
|
822
|
+
status: HealthStatus;
|
|
823
|
+
/** What was measured, in one sentence. Never includes a secret value. */
|
|
824
|
+
detail: string;
|
|
825
|
+
}
|
|
826
|
+
interface HealthReport {
|
|
827
|
+
snapshotDir: string;
|
|
828
|
+
repoDir: string;
|
|
829
|
+
generatedAt: string;
|
|
830
|
+
score: number;
|
|
831
|
+
checks: HealthCheck[];
|
|
832
|
+
counts: {
|
|
833
|
+
pass: number;
|
|
834
|
+
warn: number;
|
|
835
|
+
fail: number;
|
|
836
|
+
skip: number;
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
interface HealthOptions {
|
|
840
|
+
snapshotDir: string;
|
|
841
|
+
repoDir: string;
|
|
842
|
+
/** Extra rules on top of the built-in set, e.g. the project config. */
|
|
843
|
+
secretRules?: readonly SecretRule[];
|
|
844
|
+
/** Cap on how much artifact text the secret scan reads. */
|
|
845
|
+
maxScanBytes?: number;
|
|
846
|
+
/**
|
|
847
|
+
* Replay every full body against the bytes on disk.
|
|
848
|
+
*
|
|
849
|
+
* Off by default because it re-reads the whole repository; on by `--deep`. The cheap checks
|
|
850
|
+
* compare the snapshot with its own manifest, which cannot see a generator that read the source
|
|
851
|
+
* incorrectly in the first place.
|
|
852
|
+
*/
|
|
853
|
+
deep?: boolean;
|
|
854
|
+
}
|
|
855
|
+
declare function auditSnapshot(options: HealthOptions): HealthReport;
|
|
856
|
+
|
|
811
857
|
interface ExplainResult {
|
|
812
858
|
/** Path relative to the configured cwd, POSIX separators. */
|
|
813
859
|
path: string;
|
|
@@ -1194,26 +1240,6 @@ interface WizardAnswers {
|
|
|
1194
1240
|
brief?: string;
|
|
1195
1241
|
}
|
|
1196
1242
|
declare const DEFAULT_ANSWERS: WizardAnswers;
|
|
1197
|
-
/**
|
|
1198
|
-
* Renders the full, self-documenting config — the only shape `init` writes.
|
|
1199
|
-
*
|
|
1200
|
-
* Every setting appears at its current value, commented and grouped, because
|
|
1201
|
-
* most developers never open the documentation — a file that lists only their
|
|
1202
|
-
* changes cannot tell them what else exists. Deleting any line is safe: the
|
|
1203
|
-
* defaults are real.
|
|
1204
|
-
*
|
|
1205
|
-
* There used to be a `--minimal` variant that wrote only the settings that
|
|
1206
|
-
* differed from the defaults. It produced a seven-line file for a Next.js
|
|
1207
|
-
* project — `export default { preset: "nextjs" }` — which is the one file the
|
|
1208
|
-
* user is supposed to open to change things, holding none of the things. The
|
|
1209
|
-
* flag is gone: one canonical config, always complete.
|
|
1210
|
-
*
|
|
1211
|
-
* The object is assigned to `config` and exported by name. An anonymous
|
|
1212
|
-
* `export default { … }` is what every lint preset derived from
|
|
1213
|
-
* `eslint-config-next` reports as `import/no-anonymous-default-export`, so the
|
|
1214
|
-
* generated file was a lint error on the first save in a Next.js project — the
|
|
1215
|
-
* preset this tool detects most often.
|
|
1216
|
-
*/
|
|
1217
1243
|
declare function renderConfig(answers: WizardAnswers): string;
|
|
1218
1244
|
|
|
1219
1245
|
interface HeuristicResult {
|
|
@@ -1562,4 +1588,4 @@ declare function generateSnapshot(configInput?: SnapshotConfig | ResolvedSnapsho
|
|
|
1562
1588
|
/** Promise-returning wrapper for consumers that prefer an async call site. */
|
|
1563
1589
|
declare function generateSnapshotAsync(configInput?: SnapshotConfig | ResolvedSnapshotConfig | null, options?: GenerateOptions): Promise<Manifest>;
|
|
1564
1590
|
|
|
1565
|
-
export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CONFIG_KEYS, type ChangedScope, type ChangedScopeRequest, CliOptions, type CloneOptions, type CloneResult, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, HOOK_MARKER, type HeuristicResult, type HookInstallResult, type ImportCandidate, type ImportResolver, type InitDependency, type InitOptions, type InitResult, type InstallKind, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, type ParsedSource, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, type RemoteSource, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, type ServeHandle, type ServeOptions, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, UP_TO_DATE_INTERVAL_MS, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, type ZipEntry, type ZipOptions, 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, releaseAbandonedRun, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveLatest, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, tokenAllowedForHost, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, wrapLines, writeZip };
|
|
1591
|
+
export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CONFIG_KEYS, type ChangedScope, type ChangedScopeRequest, CliOptions, type CloneOptions, type CloneResult, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, HOOK_MARKER, type HeuristicResult, type HookInstallResult, type ImportCandidate, type ImportResolver, type InitDependency, type InitOptions, type InitResult, type InstallKind, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, type ParsedSource, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, type RemoteSource, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, type ServeHandle, type ServeOptions, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, UP_TO_DATE_INTERVAL_MS, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, type ZipEntry, type ZipOptions, anchorForPath, appendGitignoreEntries, assertPublicHost, assertReplaceable, assertServerSafeConfig, assertUsableConfigInput, auditSnapshot, 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, releaseAbandonedRun, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveLatest, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, tokenAllowedForHost, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, wrapLines, writeZip };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as node_crypto from 'node:crypto';
|
|
2
|
-
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,
|
|
3
|
-
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-
|
|
4
|
-
export { w as workerEntry } from './generate-worker-
|
|
2
|
+
import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, M as MarkdownSummary, b as SourceSummary, c as SnapshotConfig, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, 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-C5ytHMYz.js';
|
|
3
|
+
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-C5ytHMYz.js';
|
|
4
|
+
export { w as workerEntry } from './generate-worker-CRMESc0b.js';
|
|
5
5
|
|
|
6
6
|
interface GitInfo {
|
|
7
7
|
branch: string;
|
|
@@ -140,6 +140,16 @@ declare function summarizeMarkdown(content: string): MarkdownSummary;
|
|
|
140
140
|
*/
|
|
141
141
|
declare function summarizeTypeScriptSource(relativePath: string, content: string): SourceSummary;
|
|
142
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Rejects configuration that is not safe for a server that answers untrusted prompts.
|
|
145
|
+
*
|
|
146
|
+
* The CLI may honor `includeSensitiveFiles` and a deliberately broad custom pattern: the user
|
|
147
|
+
* invoked the repository's own command. An MCP or `serve` process cannot make that assumption —
|
|
148
|
+
* the config and the request can both come from a repository the user is reviewing. The check is
|
|
149
|
+
* a refusal rather than a silent override, because a setting that was ignored and a setting that
|
|
150
|
+
* was applied must never look alike.
|
|
151
|
+
*/
|
|
152
|
+
declare function assertServerSafeConfig(config: SnapshotConfig | null, source?: string): void;
|
|
143
153
|
/**
|
|
144
154
|
* Brands a resolved config so consumers can distinguish it from a user
|
|
145
155
|
* `SnapshotConfig` structurally, instead of guessing from the presence of a
|
|
@@ -555,7 +565,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
555
565
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
556
566
|
*/
|
|
557
567
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
558
|
-
declare const GENERATOR_VERSION = "0.20.
|
|
568
|
+
declare const GENERATOR_VERSION = "0.20.12";
|
|
559
569
|
/**
|
|
560
570
|
* The manifest and ownership-marker schema this build writes and understands.
|
|
561
571
|
*
|
|
@@ -641,21 +651,6 @@ declare function cloneRepository(source: RemoteSource, options: CloneOptions): P
|
|
|
641
651
|
/** A temp directory for one clone, removed by the caller. */
|
|
642
652
|
declare function makeCloneDirectory(): string;
|
|
643
653
|
|
|
644
|
-
/**
|
|
645
|
-
* `snapshot serve`: the browser face of the tool.
|
|
646
|
-
*
|
|
647
|
-
* One process serves the page, the API it calls, and the MCP endpoint, so a browser client and an
|
|
648
|
-
* agent talk to the same snapshot. Three rules shape it:
|
|
649
|
-
*
|
|
650
|
-
* - Loopback by default, a bearer token always (generated on first run, printed once). The page
|
|
651
|
-
* asks for the token and keeps it in localStorage, so serving / can never leak the credential.
|
|
652
|
-
* - The API only ever writes where a person pointed it: a local path that exists, with the
|
|
653
|
-
* repository's own JSON settings and its executable config refused. A remote URL is refused
|
|
654
|
-
* with a message that says what is missing, rather
|
|
655
|
-
* than pretending to fetch.
|
|
656
|
-
* - Every response is bounded. The preview is the first 64 KiB of PROMPT.md, the file list is
|
|
657
|
-
* capped, the zip is built in memory and streamed once.
|
|
658
|
-
*/
|
|
659
654
|
interface ServeOptions {
|
|
660
655
|
cwd: string;
|
|
661
656
|
host?: string;
|
|
@@ -808,6 +803,57 @@ declare function formatUpdateNotice(notice: UpdateNotice, kind: InstallKind): st
|
|
|
808
803
|
|
|
809
804
|
declare const DEFAULT_SECRET_PATTERNS: SecretRule[];
|
|
810
805
|
|
|
806
|
+
/**
|
|
807
|
+
* The health service: audits a written snapshot against the repository it claims to describe.
|
|
808
|
+
*
|
|
809
|
+
* validate answers "did the code move since this was generated?". It cannot answer the
|
|
810
|
+
* questions a reader cares about before pasting a snapshot somewhere: did anything secret
|
|
811
|
+
* survive into an artifact, can the claims be checked, is the token count real, does the
|
|
812
|
+
* machine identity leak into the text? This module answers those, with severities and a score.
|
|
813
|
+
*
|
|
814
|
+
* Nothing here writes. A report that mutates is not evidence.
|
|
815
|
+
*/
|
|
816
|
+
type HealthSeverity = "critical" | "warning" | "info";
|
|
817
|
+
type HealthStatus = "pass" | "warn" | "fail" | "skip";
|
|
818
|
+
interface HealthCheck {
|
|
819
|
+
id: string;
|
|
820
|
+
title: string;
|
|
821
|
+
severity: HealthSeverity;
|
|
822
|
+
status: HealthStatus;
|
|
823
|
+
/** What was measured, in one sentence. Never includes a secret value. */
|
|
824
|
+
detail: string;
|
|
825
|
+
}
|
|
826
|
+
interface HealthReport {
|
|
827
|
+
snapshotDir: string;
|
|
828
|
+
repoDir: string;
|
|
829
|
+
generatedAt: string;
|
|
830
|
+
score: number;
|
|
831
|
+
checks: HealthCheck[];
|
|
832
|
+
counts: {
|
|
833
|
+
pass: number;
|
|
834
|
+
warn: number;
|
|
835
|
+
fail: number;
|
|
836
|
+
skip: number;
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
interface HealthOptions {
|
|
840
|
+
snapshotDir: string;
|
|
841
|
+
repoDir: string;
|
|
842
|
+
/** Extra rules on top of the built-in set, e.g. the project config. */
|
|
843
|
+
secretRules?: readonly SecretRule[];
|
|
844
|
+
/** Cap on how much artifact text the secret scan reads. */
|
|
845
|
+
maxScanBytes?: number;
|
|
846
|
+
/**
|
|
847
|
+
* Replay every full body against the bytes on disk.
|
|
848
|
+
*
|
|
849
|
+
* Off by default because it re-reads the whole repository; on by `--deep`. The cheap checks
|
|
850
|
+
* compare the snapshot with its own manifest, which cannot see a generator that read the source
|
|
851
|
+
* incorrectly in the first place.
|
|
852
|
+
*/
|
|
853
|
+
deep?: boolean;
|
|
854
|
+
}
|
|
855
|
+
declare function auditSnapshot(options: HealthOptions): HealthReport;
|
|
856
|
+
|
|
811
857
|
interface ExplainResult {
|
|
812
858
|
/** Path relative to the configured cwd, POSIX separators. */
|
|
813
859
|
path: string;
|
|
@@ -1194,26 +1240,6 @@ interface WizardAnswers {
|
|
|
1194
1240
|
brief?: string;
|
|
1195
1241
|
}
|
|
1196
1242
|
declare const DEFAULT_ANSWERS: WizardAnswers;
|
|
1197
|
-
/**
|
|
1198
|
-
* Renders the full, self-documenting config — the only shape `init` writes.
|
|
1199
|
-
*
|
|
1200
|
-
* Every setting appears at its current value, commented and grouped, because
|
|
1201
|
-
* most developers never open the documentation — a file that lists only their
|
|
1202
|
-
* changes cannot tell them what else exists. Deleting any line is safe: the
|
|
1203
|
-
* defaults are real.
|
|
1204
|
-
*
|
|
1205
|
-
* There used to be a `--minimal` variant that wrote only the settings that
|
|
1206
|
-
* differed from the defaults. It produced a seven-line file for a Next.js
|
|
1207
|
-
* project — `export default { preset: "nextjs" }` — which is the one file the
|
|
1208
|
-
* user is supposed to open to change things, holding none of the things. The
|
|
1209
|
-
* flag is gone: one canonical config, always complete.
|
|
1210
|
-
*
|
|
1211
|
-
* The object is assigned to `config` and exported by name. An anonymous
|
|
1212
|
-
* `export default { … }` is what every lint preset derived from
|
|
1213
|
-
* `eslint-config-next` reports as `import/no-anonymous-default-export`, so the
|
|
1214
|
-
* generated file was a lint error on the first save in a Next.js project — the
|
|
1215
|
-
* preset this tool detects most often.
|
|
1216
|
-
*/
|
|
1217
1243
|
declare function renderConfig(answers: WizardAnswers): string;
|
|
1218
1244
|
|
|
1219
1245
|
interface HeuristicResult {
|
|
@@ -1562,4 +1588,4 @@ declare function generateSnapshot(configInput?: SnapshotConfig | ResolvedSnapsho
|
|
|
1562
1588
|
/** Promise-returning wrapper for consumers that prefer an async call site. */
|
|
1563
1589
|
declare function generateSnapshotAsync(configInput?: SnapshotConfig | ResolvedSnapshotConfig | null, options?: GenerateOptions): Promise<Manifest>;
|
|
1564
1590
|
|
|
1565
|
-
export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CONFIG_KEYS, type ChangedScope, type ChangedScopeRequest, CliOptions, type CloneOptions, type CloneResult, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, HOOK_MARKER, type HeuristicResult, type HookInstallResult, type ImportCandidate, type ImportResolver, type InitDependency, type InitOptions, type InitResult, type InstallKind, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, type ParsedSource, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, type RemoteSource, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, type ServeHandle, type ServeOptions, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, UP_TO_DATE_INTERVAL_MS, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, type ZipEntry, type ZipOptions, 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, releaseAbandonedRun, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveLatest, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, tokenAllowedForHost, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, wrapLines, writeZip };
|
|
1591
|
+
export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CONFIG_KEYS, type ChangedScope, type ChangedScopeRequest, CliOptions, type CloneOptions, type CloneResult, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, HOOK_MARKER, type HeuristicResult, type HookInstallResult, type ImportCandidate, type ImportResolver, type InitDependency, type InitOptions, type InitResult, type InstallKind, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, type ParsedSource, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, type RemoteSource, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, type ServeHandle, type ServeOptions, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, UP_TO_DATE_INTERVAL_MS, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, type ZipEntry, type ZipOptions, anchorForPath, appendGitignoreEntries, assertPublicHost, assertReplaceable, assertServerSafeConfig, assertUsableConfigInput, auditSnapshot, 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, releaseAbandonedRun, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveLatest, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, tokenAllowedForHost, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, wrapLines, writeZip };
|
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, releaseAbandonedRun, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveLatest, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, tokenAllowedForHost, 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, assertServerSafeConfig, assertUsableConfigInput, auditSnapshot, 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, releaseAbandonedRun, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveLatest, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, tokenAllowedForHost, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, workerEntry, wrapLines, writeZip } from './chunk-TUKY6KLH.js';
|