codebase-snapshot 0.9.12 → 0.9.14
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 +379 -0
- package/README.md +1 -1
- package/dist/bin.js +1313 -633
- package/dist/{chunk-3H45YMBG.js → chunk-DUZK5VL2.js} +1413 -767
- package/dist/{chunk-5OR3WVPW.js → chunk-J4W74N4Y.js} +144 -44
- package/dist/cli.cjs +1305 -628
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +43 -54
- package/dist/{generate-worker-D5Xgh27c.d.cts → generate-worker-D_mUjgXw.d.cts} +21 -5
- package/dist/{generate-worker-D5Xgh27c.d.ts → generate-worker-D_mUjgXw.d.ts} +21 -5
- package/dist/index.cjs +1389 -760
- package/dist/index.d.cts +58 -35
- package/dist/index.d.ts +58 -35
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +973 -405
- package/dist/mcp.d.cts +67 -67
- package/dist/mcp.d.ts +67 -67
- package/dist/mcp.js +2 -2
- package/dist/{types-CTewen3J.d.cts → types-DIX6zWSt.d.cts} +15 -0
- package/dist/{types-CTewen3J.d.ts → types-DIX6zWSt.d.ts} +15 -0
- package/docs/cli.md +8 -6
- package/docs/configuration.md +44 -10
- package/docs/mcp.md +16 -3
- package/docs/output.md +13 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, P as PartMetadata, F as FileEntry, T as TextEncoding, d as SecretFinding, V as ValidationResult, e as Manifest, A as ArtifactSelection } from './types-
|
|
2
|
-
export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as ManifestArtifact, h as ManifestConfigSnapshot, i as ManifestIndexes, j as ManifestTotals, k as Mode, O as OutputFormat, l as PartFileEntry, m as ResolvedArtifacts, n as ResolvedBudgets, o as SecretRuleInput, p as SkipReason, q as SummaryQuality, r as ValidationDrift } from './types-
|
|
3
|
-
export { w as workerEntry } from './generate-worker-
|
|
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, P as PartMetadata, F as FileEntry, T as TextEncoding, d as SecretFinding, V as ValidationResult, e as Manifest, A as ArtifactSelection } from './types-DIX6zWSt.cjs';
|
|
2
|
+
export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as ManifestArtifact, h as ManifestConfigSnapshot, i as ManifestIndexes, j as ManifestTotals, k as Mode, O as OutputFormat, l as PartFileEntry, m as ResolvedArtifacts, n as ResolvedBudgets, o as SecretRuleInput, p as SkipReason, q as SummaryQuality, r as ValidationDrift } from './types-DIX6zWSt.cjs';
|
|
3
|
+
export { w as workerEntry } from './generate-worker-D_mUjgXw.cjs';
|
|
4
4
|
|
|
5
5
|
interface GitInfo {
|
|
6
6
|
branch: string;
|
|
@@ -70,6 +70,12 @@ declare function findSecretInPath(relativePath: string, extraRules?: readonly Se
|
|
|
70
70
|
* Brace groups and character classes are supported because they are what people
|
|
71
71
|
* actually write: `*.{ts,tsx}` previously matched nothing at all, since `{` and
|
|
72
72
|
* `}` were escaped as literals.
|
|
73
|
+
*
|
|
74
|
+
* Compiled once per distinct pattern. `matchesExclude` calls this for every
|
|
75
|
+
* (file, include), (file, exclude), (file, layer rule) and (file, kind rule)
|
|
76
|
+
* pair, so a 20 000-file repository with 55 patterns compiled over a million
|
|
77
|
+
* identical RegExp objects per run. The result is a pure function of the string,
|
|
78
|
+
* so the cache cannot change an answer.
|
|
73
79
|
*/
|
|
74
80
|
declare function globToRegExp(glob: string): RegExp;
|
|
75
81
|
/**
|
|
@@ -90,9 +96,19 @@ declare function matchesExclude(relativePath: string, pattern: string): boolean;
|
|
|
90
96
|
declare function collectFiles(cwd: string, options?: CollectOptions): CollectResult;
|
|
91
97
|
|
|
92
98
|
/**
|
|
93
|
-
* Strips `//` and block comments the way JSONC does, without touching
|
|
94
|
-
* inside a string literal.
|
|
95
|
-
*
|
|
99
|
+
* Strips `//` and block comments the way JSONC does, plus trailing commas, without touching
|
|
100
|
+
* anything inside a string literal.
|
|
101
|
+
*
|
|
102
|
+
* `JSON.parse` alone made every `.jsonc` file — and every `tsconfig.json` an editor had
|
|
103
|
+
* reformatted — report `invalid-json`, losing its key shape entirely. Two things this file's
|
|
104
|
+
* matcher did that `src/config.ts`'s did not, and both are JSONC, not extensions of it:
|
|
105
|
+
*
|
|
106
|
+
* - **Trailing commas.** `{ "a": 1, }` is valid JSONC and invalid JSON.
|
|
107
|
+
* - **`\r`-only line endings.** A `//` comment ended only at `\n`, so on a CR-delimited file it
|
|
108
|
+
* swallowed everything to the end of the document.
|
|
109
|
+
*
|
|
110
|
+
* A block comment keeps the line breaks it spans. Dropping them renumbered every line after it,
|
|
111
|
+
* and the only thing a reader has to place a summary key is the line number.
|
|
96
112
|
*/
|
|
97
113
|
declare function stripJsonComments(content: string): string;
|
|
98
114
|
declare function summarizeJson(content: string): JsonSummary;
|
|
@@ -170,13 +186,6 @@ declare function supportsTypeScriptImports(): boolean;
|
|
|
170
186
|
* "unknown setting(s): secretRules" while the same key worked when passed in code).
|
|
171
187
|
*/
|
|
172
188
|
declare const CONFIG_KEYS: ReadonlySet<string>;
|
|
173
|
-
/**
|
|
174
|
-
* Loads the first usable config file from `cwd`.
|
|
175
|
-
*
|
|
176
|
-
* Every failure is reported through `warnings` instead of being swallowed by an
|
|
177
|
-
* empty `catch`: a syntax error in a user's config used to be indistinguishable
|
|
178
|
-
* from having no config at all.
|
|
179
|
-
*/
|
|
180
189
|
declare function loadConfigFileDetailed(cwd: string): Promise<ConfigLoadResult>;
|
|
181
190
|
declare function loadConfigFile(cwd: string): Promise<SnapshotConfig | null>;
|
|
182
191
|
/** Smallest usable part budget: a part header plus one section must fit. */
|
|
@@ -324,6 +333,10 @@ interface PreviewResult {
|
|
|
324
333
|
*
|
|
325
334
|
* Previously `index.ts` recorded 0 for an empty file while `preview.ts` recorded
|
|
326
335
|
* 1, and every newline-terminated file was over-counted by one.
|
|
336
|
+
*
|
|
337
|
+
* Counted by scanning rather than by `split`: this runs on every file body and on every part, and
|
|
338
|
+
* normalising first would allocate a second copy of a multi-megabyte string to answer a question
|
|
339
|
+
* about its terminator count.
|
|
327
340
|
*/
|
|
328
341
|
declare function countLines(content: string): number;
|
|
329
342
|
/**
|
|
@@ -465,18 +478,6 @@ declare function isBinaryFile(absolutePath: string): boolean;
|
|
|
465
478
|
|
|
466
479
|
declare function detectLanguage(filePath: string): string;
|
|
467
480
|
|
|
468
|
-
/**
|
|
469
|
-
* Redacts secrets from `content`.
|
|
470
|
-
*
|
|
471
|
-
* - Replaces only the matched span, so unrelated code sharing the line survives
|
|
472
|
-
* (the previous implementation discarded the whole line).
|
|
473
|
-
* - When a rule declares `valueGroup`, only that capture group is masked, so
|
|
474
|
-
* `dbPassword: "…"` keeps its key and stays parseable.
|
|
475
|
-
* - Masks PEM private-key blocks as a unit; per-line rules can only see the
|
|
476
|
-
* `BEGIN` header, which left every body line of a real key in the output.
|
|
477
|
-
* - Records `{ rule, line, path }` only. No excerpt of the source is retained,
|
|
478
|
-
* because that excerpt was being written verbatim into `reports/audit.md`.
|
|
479
|
-
*/
|
|
480
481
|
declare function scanAndRedactSecrets(content: string, rules: SecretRule[], filePath?: string): {
|
|
481
482
|
redacted: string;
|
|
482
483
|
findings: SecretFinding[];
|
|
@@ -508,7 +509,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
508
509
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
509
510
|
*/
|
|
510
511
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
511
|
-
declare const GENERATOR_VERSION = "0.9.
|
|
512
|
+
declare const GENERATOR_VERSION = "0.9.14";
|
|
512
513
|
|
|
513
514
|
/** The one endpoint this package will ever request. */
|
|
514
515
|
declare const PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
|
|
@@ -553,7 +554,13 @@ interface UpdateCheckOptions {
|
|
|
553
554
|
fetchLatest?: (url: string, timeoutMs: number) => Promise<string | null>;
|
|
554
555
|
enabled?: boolean;
|
|
555
556
|
}
|
|
556
|
-
/**
|
|
557
|
+
/**
|
|
558
|
+
* True when `candidate` is a version worth telling somebody about.
|
|
559
|
+
*
|
|
560
|
+
* A prerelease is never announced — being offered `1.0.0-rc.1` while running `0.9.12` is not an
|
|
561
|
+
* upgrade, and a check that says so is wrong every time it fires. A stable release *is* newer than
|
|
562
|
+
* the prerelease of itself, so somebody on `0.9.12-beta.1` is told about `0.9.12`.
|
|
563
|
+
*/
|
|
557
564
|
declare function isNewer(candidate: string, current: string): boolean;
|
|
558
565
|
/** The per-user cache directory, following each platform's convention. */
|
|
559
566
|
declare function cacheDirectory(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
|
|
@@ -566,7 +573,18 @@ declare function cacheFilePath(env?: NodeJS.ProcessEnv): string;
|
|
|
566
573
|
* spends a CI job's network and pollutes a machine-readable stream.
|
|
567
574
|
*/
|
|
568
575
|
declare function shouldCheck(argv: readonly string[], env: NodeJS.ProcessEnv): boolean;
|
|
569
|
-
/**
|
|
576
|
+
/**
|
|
577
|
+
* One GET with a hard deadline. Resolves null for every failure.
|
|
578
|
+
*
|
|
579
|
+
* The deadline is a **wall clock**, not an idle-socket timeout. `request.setTimeout` only fires
|
|
580
|
+
* when the socket goes quiet, so a slow or trickling proxy — one that sends a byte every second —
|
|
581
|
+
* kept the CLI process alive long past `REQUEST_TIMEOUT_MS`. The timer below is absolute: when it
|
|
582
|
+
* fires the request is destroyed and the answer is "could not determine", which is what the notice
|
|
583
|
+
* already treats as "say nothing".
|
|
584
|
+
*
|
|
585
|
+
* The scheme picks the transport so the deadline can be exercised against a local server; the
|
|
586
|
+
* default URL is https either way.
|
|
587
|
+
*/
|
|
570
588
|
declare function fetchLatestVersion(url?: string, timeoutMs?: number): Promise<string | null>;
|
|
571
589
|
/**
|
|
572
590
|
* Returns a notice when a newer version is published, or null.
|
|
@@ -1049,8 +1067,7 @@ interface ChangedScope {
|
|
|
1049
1067
|
*/
|
|
1050
1068
|
declare function resolveChangedScope(cwd: string, request: ChangedScopeRequest): ChangedScope;
|
|
1051
1069
|
|
|
1052
|
-
/**
|
|
1053
|
-
* One-pass lookup tables for relative-import resolution.
|
|
1070
|
+
/** One-pass lookup tables for relative-import resolution.
|
|
1054
1071
|
*
|
|
1055
1072
|
* `resolveSpecifier` used to fall back to scanning every known file for every
|
|
1056
1073
|
* unresolved import — 100k files × 100k imports — and built a RegExp from the
|
|
@@ -1093,9 +1110,9 @@ declare function importsOfText(relativePath: string, text: string): string[];
|
|
|
1093
1110
|
/**
|
|
1094
1111
|
* Import specifiers of one file on disk.
|
|
1095
1112
|
*
|
|
1096
|
-
* A file this cannot read, a binary file and a file the parser rejects all
|
|
1097
|
-
* is what the generator saw for them too — so the answer stays consistent
|
|
1098
|
-
* rather than becoming a third opinion about it.
|
|
1113
|
+
* A file this cannot read, a binary file, an oversized file and a file the parser rejects all
|
|
1114
|
+
* contribute `[]`, which is what the generator saw for them too — so the answer stays consistent
|
|
1115
|
+
* with the snapshot rather than becoming a third opinion about it.
|
|
1099
1116
|
*/
|
|
1100
1117
|
declare function importsOfFile(relativePath: string, absolutePath: string): string[];
|
|
1101
1118
|
|
|
@@ -1111,7 +1128,7 @@ interface SkeletonResult {
|
|
|
1111
1128
|
* replacement never invalidates a later span's offsets.
|
|
1112
1129
|
*/
|
|
1113
1130
|
/**
|
|
1114
|
-
* True when a filename is
|
|
1131
|
+
* True when a filename is JavaScript-with-JSX, in any letter case.
|
|
1115
1132
|
*
|
|
1116
1133
|
* One function for one question, because two spellings of it is exactly how `.TSX` came to be
|
|
1117
1134
|
* eligible for a skeleton and then parsed as plain TypeScript, where JSX is a syntax error.
|
|
@@ -1121,7 +1138,13 @@ interface SkeletonResult {
|
|
|
1121
1138
|
*/
|
|
1122
1139
|
declare function isTsxFileName(fileName: string): boolean;
|
|
1123
1140
|
declare function skeletonizeTypeScript(source: string, fileName?: string): SkeletonResult;
|
|
1124
|
-
/**
|
|
1141
|
+
/**
|
|
1142
|
+
* True for a path this module can compress.
|
|
1143
|
+
*
|
|
1144
|
+
* `.d.ts` and friends are excluded first: they are declarations, so there is nothing to collapse,
|
|
1145
|
+
* and parsing them was pure cost. Everything else the TypeScript parser can read is included —
|
|
1146
|
+
* JavaScript and JSX included, which is most of the code in most repositories.
|
|
1147
|
+
*/
|
|
1125
1148
|
declare function isSkeletonizable(filePath: string): boolean;
|
|
1126
1149
|
|
|
1127
1150
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, P as PartMetadata, F as FileEntry, T as TextEncoding, d as SecretFinding, V as ValidationResult, e as Manifest, A as ArtifactSelection } from './types-
|
|
2
|
-
export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as ManifestArtifact, h as ManifestConfigSnapshot, i as ManifestIndexes, j as ManifestTotals, k as Mode, O as OutputFormat, l as PartFileEntry, m as ResolvedArtifacts, n as ResolvedBudgets, o as SecretRuleInput, p as SkipReason, q as SummaryQuality, r as ValidationDrift } from './types-
|
|
3
|
-
export { w as workerEntry } from './generate-worker-
|
|
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, P as PartMetadata, F as FileEntry, T as TextEncoding, d as SecretFinding, V as ValidationResult, e as Manifest, A as ArtifactSelection } from './types-DIX6zWSt.js';
|
|
2
|
+
export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as ManifestArtifact, h as ManifestConfigSnapshot, i as ManifestIndexes, j as ManifestTotals, k as Mode, O as OutputFormat, l as PartFileEntry, m as ResolvedArtifacts, n as ResolvedBudgets, o as SecretRuleInput, p as SkipReason, q as SummaryQuality, r as ValidationDrift } from './types-DIX6zWSt.js';
|
|
3
|
+
export { w as workerEntry } from './generate-worker-D_mUjgXw.js';
|
|
4
4
|
|
|
5
5
|
interface GitInfo {
|
|
6
6
|
branch: string;
|
|
@@ -70,6 +70,12 @@ declare function findSecretInPath(relativePath: string, extraRules?: readonly Se
|
|
|
70
70
|
* Brace groups and character classes are supported because they are what people
|
|
71
71
|
* actually write: `*.{ts,tsx}` previously matched nothing at all, since `{` and
|
|
72
72
|
* `}` were escaped as literals.
|
|
73
|
+
*
|
|
74
|
+
* Compiled once per distinct pattern. `matchesExclude` calls this for every
|
|
75
|
+
* (file, include), (file, exclude), (file, layer rule) and (file, kind rule)
|
|
76
|
+
* pair, so a 20 000-file repository with 55 patterns compiled over a million
|
|
77
|
+
* identical RegExp objects per run. The result is a pure function of the string,
|
|
78
|
+
* so the cache cannot change an answer.
|
|
73
79
|
*/
|
|
74
80
|
declare function globToRegExp(glob: string): RegExp;
|
|
75
81
|
/**
|
|
@@ -90,9 +96,19 @@ declare function matchesExclude(relativePath: string, pattern: string): boolean;
|
|
|
90
96
|
declare function collectFiles(cwd: string, options?: CollectOptions): CollectResult;
|
|
91
97
|
|
|
92
98
|
/**
|
|
93
|
-
* Strips `//` and block comments the way JSONC does, without touching
|
|
94
|
-
* inside a string literal.
|
|
95
|
-
*
|
|
99
|
+
* Strips `//` and block comments the way JSONC does, plus trailing commas, without touching
|
|
100
|
+
* anything inside a string literal.
|
|
101
|
+
*
|
|
102
|
+
* `JSON.parse` alone made every `.jsonc` file — and every `tsconfig.json` an editor had
|
|
103
|
+
* reformatted — report `invalid-json`, losing its key shape entirely. Two things this file's
|
|
104
|
+
* matcher did that `src/config.ts`'s did not, and both are JSONC, not extensions of it:
|
|
105
|
+
*
|
|
106
|
+
* - **Trailing commas.** `{ "a": 1, }` is valid JSONC and invalid JSON.
|
|
107
|
+
* - **`\r`-only line endings.** A `//` comment ended only at `\n`, so on a CR-delimited file it
|
|
108
|
+
* swallowed everything to the end of the document.
|
|
109
|
+
*
|
|
110
|
+
* A block comment keeps the line breaks it spans. Dropping them renumbered every line after it,
|
|
111
|
+
* and the only thing a reader has to place a summary key is the line number.
|
|
96
112
|
*/
|
|
97
113
|
declare function stripJsonComments(content: string): string;
|
|
98
114
|
declare function summarizeJson(content: string): JsonSummary;
|
|
@@ -170,13 +186,6 @@ declare function supportsTypeScriptImports(): boolean;
|
|
|
170
186
|
* "unknown setting(s): secretRules" while the same key worked when passed in code).
|
|
171
187
|
*/
|
|
172
188
|
declare const CONFIG_KEYS: ReadonlySet<string>;
|
|
173
|
-
/**
|
|
174
|
-
* Loads the first usable config file from `cwd`.
|
|
175
|
-
*
|
|
176
|
-
* Every failure is reported through `warnings` instead of being swallowed by an
|
|
177
|
-
* empty `catch`: a syntax error in a user's config used to be indistinguishable
|
|
178
|
-
* from having no config at all.
|
|
179
|
-
*/
|
|
180
189
|
declare function loadConfigFileDetailed(cwd: string): Promise<ConfigLoadResult>;
|
|
181
190
|
declare function loadConfigFile(cwd: string): Promise<SnapshotConfig | null>;
|
|
182
191
|
/** Smallest usable part budget: a part header plus one section must fit. */
|
|
@@ -324,6 +333,10 @@ interface PreviewResult {
|
|
|
324
333
|
*
|
|
325
334
|
* Previously `index.ts` recorded 0 for an empty file while `preview.ts` recorded
|
|
326
335
|
* 1, and every newline-terminated file was over-counted by one.
|
|
336
|
+
*
|
|
337
|
+
* Counted by scanning rather than by `split`: this runs on every file body and on every part, and
|
|
338
|
+
* normalising first would allocate a second copy of a multi-megabyte string to answer a question
|
|
339
|
+
* about its terminator count.
|
|
327
340
|
*/
|
|
328
341
|
declare function countLines(content: string): number;
|
|
329
342
|
/**
|
|
@@ -465,18 +478,6 @@ declare function isBinaryFile(absolutePath: string): boolean;
|
|
|
465
478
|
|
|
466
479
|
declare function detectLanguage(filePath: string): string;
|
|
467
480
|
|
|
468
|
-
/**
|
|
469
|
-
* Redacts secrets from `content`.
|
|
470
|
-
*
|
|
471
|
-
* - Replaces only the matched span, so unrelated code sharing the line survives
|
|
472
|
-
* (the previous implementation discarded the whole line).
|
|
473
|
-
* - When a rule declares `valueGroup`, only that capture group is masked, so
|
|
474
|
-
* `dbPassword: "…"` keeps its key and stays parseable.
|
|
475
|
-
* - Masks PEM private-key blocks as a unit; per-line rules can only see the
|
|
476
|
-
* `BEGIN` header, which left every body line of a real key in the output.
|
|
477
|
-
* - Records `{ rule, line, path }` only. No excerpt of the source is retained,
|
|
478
|
-
* because that excerpt was being written verbatim into `reports/audit.md`.
|
|
479
|
-
*/
|
|
480
481
|
declare function scanAndRedactSecrets(content: string, rules: SecretRule[], filePath?: string): {
|
|
481
482
|
redacted: string;
|
|
482
483
|
findings: SecretFinding[];
|
|
@@ -508,7 +509,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
508
509
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
509
510
|
*/
|
|
510
511
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
511
|
-
declare const GENERATOR_VERSION = "0.9.
|
|
512
|
+
declare const GENERATOR_VERSION = "0.9.14";
|
|
512
513
|
|
|
513
514
|
/** The one endpoint this package will ever request. */
|
|
514
515
|
declare const PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
|
|
@@ -553,7 +554,13 @@ interface UpdateCheckOptions {
|
|
|
553
554
|
fetchLatest?: (url: string, timeoutMs: number) => Promise<string | null>;
|
|
554
555
|
enabled?: boolean;
|
|
555
556
|
}
|
|
556
|
-
/**
|
|
557
|
+
/**
|
|
558
|
+
* True when `candidate` is a version worth telling somebody about.
|
|
559
|
+
*
|
|
560
|
+
* A prerelease is never announced — being offered `1.0.0-rc.1` while running `0.9.12` is not an
|
|
561
|
+
* upgrade, and a check that says so is wrong every time it fires. A stable release *is* newer than
|
|
562
|
+
* the prerelease of itself, so somebody on `0.9.12-beta.1` is told about `0.9.12`.
|
|
563
|
+
*/
|
|
557
564
|
declare function isNewer(candidate: string, current: string): boolean;
|
|
558
565
|
/** The per-user cache directory, following each platform's convention. */
|
|
559
566
|
declare function cacheDirectory(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
|
|
@@ -566,7 +573,18 @@ declare function cacheFilePath(env?: NodeJS.ProcessEnv): string;
|
|
|
566
573
|
* spends a CI job's network and pollutes a machine-readable stream.
|
|
567
574
|
*/
|
|
568
575
|
declare function shouldCheck(argv: readonly string[], env: NodeJS.ProcessEnv): boolean;
|
|
569
|
-
/**
|
|
576
|
+
/**
|
|
577
|
+
* One GET with a hard deadline. Resolves null for every failure.
|
|
578
|
+
*
|
|
579
|
+
* The deadline is a **wall clock**, not an idle-socket timeout. `request.setTimeout` only fires
|
|
580
|
+
* when the socket goes quiet, so a slow or trickling proxy — one that sends a byte every second —
|
|
581
|
+
* kept the CLI process alive long past `REQUEST_TIMEOUT_MS`. The timer below is absolute: when it
|
|
582
|
+
* fires the request is destroyed and the answer is "could not determine", which is what the notice
|
|
583
|
+
* already treats as "say nothing".
|
|
584
|
+
*
|
|
585
|
+
* The scheme picks the transport so the deadline can be exercised against a local server; the
|
|
586
|
+
* default URL is https either way.
|
|
587
|
+
*/
|
|
570
588
|
declare function fetchLatestVersion(url?: string, timeoutMs?: number): Promise<string | null>;
|
|
571
589
|
/**
|
|
572
590
|
* Returns a notice when a newer version is published, or null.
|
|
@@ -1049,8 +1067,7 @@ interface ChangedScope {
|
|
|
1049
1067
|
*/
|
|
1050
1068
|
declare function resolveChangedScope(cwd: string, request: ChangedScopeRequest): ChangedScope;
|
|
1051
1069
|
|
|
1052
|
-
/**
|
|
1053
|
-
* One-pass lookup tables for relative-import resolution.
|
|
1070
|
+
/** One-pass lookup tables for relative-import resolution.
|
|
1054
1071
|
*
|
|
1055
1072
|
* `resolveSpecifier` used to fall back to scanning every known file for every
|
|
1056
1073
|
* unresolved import — 100k files × 100k imports — and built a RegExp from the
|
|
@@ -1093,9 +1110,9 @@ declare function importsOfText(relativePath: string, text: string): string[];
|
|
|
1093
1110
|
/**
|
|
1094
1111
|
* Import specifiers of one file on disk.
|
|
1095
1112
|
*
|
|
1096
|
-
* A file this cannot read, a binary file and a file the parser rejects all
|
|
1097
|
-
* is what the generator saw for them too — so the answer stays consistent
|
|
1098
|
-
* rather than becoming a third opinion about it.
|
|
1113
|
+
* A file this cannot read, a binary file, an oversized file and a file the parser rejects all
|
|
1114
|
+
* contribute `[]`, which is what the generator saw for them too — so the answer stays consistent
|
|
1115
|
+
* with the snapshot rather than becoming a third opinion about it.
|
|
1099
1116
|
*/
|
|
1100
1117
|
declare function importsOfFile(relativePath: string, absolutePath: string): string[];
|
|
1101
1118
|
|
|
@@ -1111,7 +1128,7 @@ interface SkeletonResult {
|
|
|
1111
1128
|
* replacement never invalidates a later span's offsets.
|
|
1112
1129
|
*/
|
|
1113
1130
|
/**
|
|
1114
|
-
* True when a filename is
|
|
1131
|
+
* True when a filename is JavaScript-with-JSX, in any letter case.
|
|
1115
1132
|
*
|
|
1116
1133
|
* One function for one question, because two spellings of it is exactly how `.TSX` came to be
|
|
1117
1134
|
* eligible for a skeleton and then parsed as plain TypeScript, where JSX is a syntax error.
|
|
@@ -1121,7 +1138,13 @@ interface SkeletonResult {
|
|
|
1121
1138
|
*/
|
|
1122
1139
|
declare function isTsxFileName(fileName: string): boolean;
|
|
1123
1140
|
declare function skeletonizeTypeScript(source: string, fileName?: string): SkeletonResult;
|
|
1124
|
-
/**
|
|
1141
|
+
/**
|
|
1142
|
+
* True for a path this module can compress.
|
|
1143
|
+
*
|
|
1144
|
+
* `.d.ts` and friends are excluded first: they are declarations, so there is nothing to collapse,
|
|
1145
|
+
* and parsing them was pure cost. Everything else the TypeScript parser can read is included —
|
|
1146
|
+
* JavaScript and JSX included, which is most of the code in most repositories.
|
|
1147
|
+
*/
|
|
1125
1148
|
declare function isSkeletonizable(filePath: string): boolean;
|
|
1126
1149
|
|
|
1127
1150
|
/**
|
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, anchorForPath, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, updateCommand, validateSnapshot, workerEntry, wrapLines } 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, anchorForPath, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, updateCommand, validateSnapshot, workerEntry, wrapLines } from './chunk-DUZK5VL2.js';
|