codebase-snapshot 0.9.14 → 0.9.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1839,6 +1839,14 @@ function scanWorkspacePackages(cwd, patterns) {
1839
1839
  }
1840
1840
  return { files, dependencies };
1841
1841
  }
1842
+ var SNAPSHOT_MARKER = ".codebase-snapshot";
1843
+ function isToolOwnedDirectory(dir) {
1844
+ try {
1845
+ return fs14__namespace.statSync(dir).isDirectory() && fs14__namespace.existsSync(path16__namespace.join(dir, SNAPSHOT_MARKER));
1846
+ } catch {
1847
+ return false;
1848
+ }
1849
+ }
1842
1850
  function countMarkdownFiles(cwd) {
1843
1851
  let count = 0;
1844
1852
  let directoriesSeen = 0;
@@ -1860,7 +1868,9 @@ function countMarkdownFiles(cwd) {
1860
1868
  }
1861
1869
  if (!entry.isDirectory() || current.depth >= 2) continue;
1862
1870
  if (entry.name.startsWith(".") || SKIPPED_WALK_DIRS.has(entry.name)) continue;
1863
- queue.push({ dir: path16__namespace.join(current.dir, entry.name), depth: current.depth + 1 });
1871
+ const child = path16__namespace.join(current.dir, entry.name);
1872
+ if (isToolOwnedDirectory(child)) continue;
1873
+ queue.push({ dir: child, depth: current.depth + 1 });
1864
1874
  }
1865
1875
  }
1866
1876
  return count;
@@ -2729,18 +2739,24 @@ function detectPreset(cwd, forced) {
2729
2739
  }
2730
2740
 
2731
2741
  // src/security/patterns.ts
2732
- var STRONG_CREDENTIAL_NAME = "(?:password|passwd|passphrase|pwd|api[_-]?key|api[_-]?secret|secret[_-]?access[_-]?key|secret[_-]?key|client[_-]?secret[_-]?key|client[_-]?secret|private[_-]?key|aws[_-]?secret[_-]?access[_-]?key|access[_-]?token|refresh[_-]?token|auth[_-]?token|session[_-]?token|secret|token)";
2733
- var WEAK_CREDENTIAL_NAME = "(?:pass|id[_-]?token|credentials?)";
2742
+ var STRONG_CREDENTIAL_NAME = "(?:password|passwd|passphrase|pwd|api[_-]?key|api[_-]?secret|access[_-]?key|secret[_-]?access[_-]?key|secret[_-]?key|client[_-]?secret[_-]?key|client[_-]?secret|private[_-]?key|aws[_-]?secret[_-]?access[_-]?key|access[_-]?token|refresh[_-]?token|auth[_-]?token|session[_-]?token|session[_-]?key|secret|token)";
2743
+ var WEAK_CREDENTIAL_NAME = "(?:pass|credentials?)";
2734
2744
  var NOT_A_LITERAL_VALUE = "(?!(?:string|number|boolean|bigint|symbol|unknown|any|never|void|null|undefined|true|false|await|async|new|this|typeof|delete|yield|function|return|process\\.env|Buffer|Record|object)\\b)";
2735
2745
  var UNQUOTED_MIN_LENGTH = 2;
2736
2746
  var PROSE_CONTINUATION = String.raw`(?!\s+[a-z])`;
2737
- var UNQUOTED_LITERAL = String.raw`(?![0-9]+(?![A-Za-z0-9_+=/%:.~-]))([A-Za-z0-9_][A-Za-z0-9_+=/%:~-]{${UNQUOTED_MIN_LENGTH - 1},511})(?![A-Za-z0-9_+=/%:.~-]|[({[])` + PROSE_CONTINUATION;
2738
- var UNQUOTED_AMBIGUOUS_LITERAL = String.raw`(?![0-9]+(?![A-Za-z0-9_+=/%:.~-]))([A-Za-z0-9_][A-Za-z0-9_+=/%:~-]{7,511})(?![A-Za-z0-9_+=/%:.~-]|[({[])` + PROSE_CONTINUATION;
2747
+ var UNQUOTED_VALUE_CHARS = String.raw`A-Za-z0-9_+=/%:~$!@#^*?-`;
2748
+ var UNQUOTED_VALUE_END = String.raw`[A-Za-z0-9_+=/%:.~$!@#^*?-]`;
2749
+ var UNQUOTED_VALUE_START = String.raw`[$!@#%^&*~+]`;
2750
+ var UNQUOTED_LITERAL = String.raw`(` + // one capture, whichever branch matched: valueGroup is 1
2751
+ String.raw`(?![0-9]+(?!${UNQUOTED_VALUE_END}))[A-Za-z0-9_][${UNQUOTED_VALUE_CHARS}]{${UNQUOTED_MIN_LENGTH - 1},511}(?!${UNQUOTED_VALUE_END}|[({[]|[<>|\\])` + String.raw`|(?=${UNQUOTED_VALUE_START}[^ \t]{0,62}(?:[0-9]|${UNQUOTED_VALUE_START}))${UNQUOTED_VALUE_START}[${UNQUOTED_VALUE_CHARS}]{2,511}(?!${UNQUOTED_VALUE_END}|[({[]|[<>|\\])` + String.raw`|\([^()\s]{1,510}\)|\[[^\[\]\s]{1,510}\]|\{[^{}\s]{1,510}\}` + String.raw`)` + PROSE_CONTINUATION;
2752
+ var UNQUOTED_AMBIGUOUS_LITERAL = String.raw`(?![0-9]+(?!${UNQUOTED_VALUE_END}))([A-Za-z0-9_][${UNQUOTED_VALUE_CHARS}]{7,511})(?!${UNQUOTED_VALUE_END}|[({[]|[<>|\\])` + PROSE_CONTINUATION;
2739
2753
  var ASSIGN = String.raw`(?<![=!<>])[:=](?!=)`;
2740
2754
  var NOT_AFTER_QUOTE = String.raw`(?<!["'])`;
2741
2755
  var NOT_A_NAMESPACED_IDENTIFIER = String.raw`(?![a-z][a-z0-9]*(?:\.[a-z][a-z0-9-]*)+/)`;
2756
+ var QUOTED_CREDENTIAL_KEY = `["'](?!id[-_]token["'])[A-Za-z0-9_$-]{0,64}${STRONG_CREDENTIAL_NAME}["']`;
2742
2757
  var QUOTED_VALUE = String.raw`((?:[^"'\\\n]|\\\\["'](?=[A-Za-z0-9_])|\\.){1,512})`;
2743
2758
  var UNQUOTED_STRONG_NAME = `(?<!id[-_])${STRONG_CREDENTIAL_NAME}`;
2759
+ var CREDENTIAL_KEY_TAIL = new RegExp(`(?:${STRONG_CREDENTIAL_NAME})$`, "i");
2744
2760
  var DEFAULT_SECRET_PATTERNS = [
2745
2761
  {
2746
2762
  rule: "private-key-header",
@@ -2807,13 +2823,28 @@ var DEFAULT_SECRET_PATTERNS = [
2807
2823
  pattern: /xox[baprsdc]-[0-9A-Za-z-]{10,250}/
2808
2824
  },
2809
2825
  {
2810
- // Prefix-only vendors. Each prefix below is documented, globally unique and
2811
- // cannot collide with an ordinary identifier, which is what makes a bare
2812
- // prefix rule cheap and safe: `glpat-` (GitLab), `hvs.`/`s.` (Vault service
2813
- // and batch tokens), `whsec_` (Stripe webhook secret), `dckr_pat_` (Docker
2814
- // Hub), `hf_` (HuggingFace), `ya29.` (Google OAuth access token).
2826
+ // Known vendor token shapes: prefix-unique tokens, plus the few fixed layouts whose format is
2827
+ // documented and cannot collide with an ordinary identifier.
2828
+ //
2829
+ // Each prefix below is globally unique, which is what makes a bare prefix rule cheap and
2830
+ // safe: `glpat-` (GitLab), `hvs.`/`s.` (Vault service and batch tokens), `whsec_`
2831
+ // (Stripe webhook secret), `dckr_pat_` (Docker Hub), `hf_` (HuggingFace), `ya29.`
2832
+ // (Google OAuth access token), `shpat_`/`shpca_`/`shppa_`/`shpss_` (Shopify admin and
2833
+ // storefront tokens).
2834
+ //
2835
+ // The fixed shapes have no prefix to anchor on and were each emitted in clear:
2836
+ // - Telegram bot token: `<8-10 digit bot id>:<35-character secret>`.
2837
+ // - Discord bot token: `<base64 user id>.<6-8 char hmac>.<25-45 char signature>`; demanding
2838
+ // all three segments keeps ordinary dotted identifiers out.
2839
+ // - Azure DevOps personal access token: exactly 52 alphanumerics that always mix case and
2840
+ // digits, so a hash, a UUID or a plain identifier — all single-case or a different length —
2841
+ // does not match.
2842
+ //
2843
+ // The rule name still says "prefix" because that is how the catalogue began; it is the
2844
+ // vendor-token rule, and growing a new named rule per vendor would make the documented
2845
+ // pattern count drift on every release.
2815
2846
  rule: "known-vendor-token-prefix",
2816
- pattern: /\b(?:glpat-[A-Za-z0-9_-]{20,64}|glrt-[A-Za-z0-9_-]{20,64}|hvs\.[A-Za-z0-9_-]{20,128}|hvb\.[A-Za-z0-9_-]{20,128}|s\.[A-Za-z0-9]{20,64}|whsec_[A-Za-z0-9]{20,64}|dckr_pat_[A-Za-z0-9_-]{20,64}|hf_[A-Za-z0-9]{30,64}|ya29\.[A-Za-z0-9_-]{20,128}|sk_test_[A-Za-z0-9]{16,64}|1\/\/0[A-Za-z0-9_-]{20,64})/
2847
+ pattern: /\b(?:glpat-[A-Za-z0-9_-]{20,64}|glrt-[A-Za-z0-9_-]{20,64}|hvs\.[A-Za-z0-9_-]{20,128}|hvb\.[A-Za-z0-9_-]{20,128}|s\.[A-Za-z0-9]{20,64}|whsec_[A-Za-z0-9]{20,64}|dckr_pat_[A-Za-z0-9_-]{20,64}|hf_[A-Za-z0-9]{30,64}|ya29\.[A-Za-z0-9_-]{20,128}|sk_test_[A-Za-z0-9]{16,64}|1\/\/0[A-Za-z0-9_-]{20,64}|shpat_[A-Za-z0-9]{20,64}|shpca_[A-Za-z0-9]{20,64}|shppa_[A-Za-z0-9]{20,64}|shpss_[A-Za-z0-9]{20,64}|[0-9]{8,10}:[A-Za-z0-9_-]{35}|[A-Za-z0-9]{20,30}\.[A-Za-z0-9_-]{5,8}\.[A-Za-z0-9_-]{25,45}|(?=[A-Za-z0-9]{0,51}[a-z])(?=[A-Za-z0-9]{0,51}[A-Z])(?=[A-Za-z0-9]{0,51}[0-9])[A-Za-z0-9]{52})(?![A-Za-z0-9])/
2817
2848
  },
2818
2849
  {
2819
2850
  rule: "slack-webhook-url",
@@ -2868,39 +2899,52 @@ var DEFAULT_SECRET_PATTERNS = [
2868
2899
  // (including one invented tomorrow) is covered, provided the `//` is followed
2869
2900
  // immediately by the userinfo: `// see the docs` and a bare reminder comment
2870
2901
  // never match, because a space or the comment wording breaks the shape.
2902
+ //
2903
+ // Three shapes joined it, all the same fact — a URL carries the credential in plain sight —
2904
+ // and each cost a leak while it was elsewhere:
2905
+ // - The user part may be **empty**: Redis, SMTP, AMQP and FTP URLs routinely omit the username
2906
+ // (`redis://:password@host`), and a `{1,128}` prefix made every one of those invisible.
2907
+ // - `curl -u user:password` sends the same userinfo without a scheme; the lookbehind
2908
+ // consumes the flag so the match is the credential alone.
2909
+ // - An Azure SAS link authenticates with `?sig=`; the signature *is* the credential.
2871
2910
  rule: "uri-credentials",
2872
- pattern: /\/\/[^\s:/@"'`;()<>,]{1,128}:[^\s:/@"'`;()<>,]{1,256}@[^\s/"'`;()<>,]{1,256}/
2911
+ pattern: /\/\/[^\s:/@"'`;()<>,]{0,128}:[^\s:/@"'`;()<>,]{1,256}@[^\s/"'`;()<>,]{1,256}|(?<=(?:^|[\s;|&(])--?u(?:ser)?[ \t=]{1,8})["']?[^\s"']{1,300}:[^\s"']{0,256}["']?|(?<=[?&])sig=[A-Za-z0-9%._=~-]{20,300}(?![A-Za-z0-9%._=~-])/
2873
2912
  },
2874
2913
  {
2875
2914
  // The host tail stops at quotes, `;`, `)`, `<`, `>` and `,`: an unbounded
2876
2915
  // `[^\s/]` used to swallow the closing quote and the statement separator of
2877
2916
  // the string the URL was written in.
2917
+ // The user part may be empty here too: `redis://:password@host` and `amqp://:password@host`
2918
+ // are how those services are configured when the account is the server's default.
2878
2919
  rule: "database-uri-credentials",
2879
- pattern: /(?:mongodb(?:\+srv)?|postgres(?:ql)?|mysql|maria(?:db)?|redis(?:s)?|amqp(?:s)?|clickhouse|mssql|sqlserver|oracle):\/\/[^\s:@/"'`;()<>,]{1,128}:[^\s@/"'`;()<>,]{1,256}@[^\s/"'`;()<>,]{1,256}/
2920
+ pattern: /(?:mongodb(?:\+srv)?|postgres(?:ql)?|mysql|maria(?:db)?|redis(?:s)?|amqp(?:s)?|clickhouse|mssql|sqlserver|oracle):\/\/[^\s:@/"'`;()<>,]{0,128}:[^\s@/"'`;()<>,]{1,256}@[^\s/"'`;()<>,]{1,256}/
2880
2921
  },
2881
2922
  {
2923
+ // An empty user part is valid userinfo (`smtp://:password@host`: the account is the server's
2924
+ // default), and it used to be the one shape every scheme-listed rule refused.
2882
2925
  rule: "basic-auth-url",
2883
- pattern: /(?:https?|ftp|sftp|ssh|git|smtp|smtps|ldap|ldaps):\/\/[^\s:@/"'`;()<>,]{1,128}:[^\s@/"'`;()<>,]{1,256}@[^\s/"'`;()<>,]{1,256}/i
2926
+ pattern: /(?:https?|ftp|sftp|ssh|git|smtp|smtps|ldap|ldaps):\/\/[^\s:@/"'`;()<>,]{0,128}:[^\s@/"'`;()<>,]{1,256}@[^\s/"'`;()<>,]{1,256}/i
2884
2927
  },
2885
2928
  {
2886
2929
  // Quoted credentials in any common key spelling. The value may be as short
2887
2930
  // as one character: `password: "hunter2"` is a credential whatever its
2888
2931
  // entropy, and a length floor was exactly how it survived into `parts`.
2889
2932
  //
2890
- // The key is either bare (`dbPassword:`) or wholly quoted (`"dbPassword":`).
2933
+ // The key is bare (`dbPassword:`), wholly quoted (`"password":`), or quoted with a
2934
+ // camelCase prefix (`"dbPassword":`) — the last one is {@link QUOTED_CREDENTIAL_KEY}.
2891
2935
  // There is deliberately no optional quote *before* the separator: that let a
2892
2936
  // previous string's closing quote stand in for the key's, so
2893
2937
  // ``${pass ? " PASS" : " FAIL"}`` had `" FAIL"` masked as if `PASS` were
2894
2938
  // the key name.
2895
2939
  rule: "credential-assignment",
2896
2940
  pattern: new RegExp(
2897
- `(?:["']${STRONG_CREDENTIAL_NAME}["']|${NOT_AFTER_QUOTE}${STRONG_CREDENTIAL_NAME})\\s{0,8}${ASSIGN}\\s{0,8}${NOT_A_NAMESPACED_IDENTIFIER}(["'\`])${QUOTED_VALUE}\\1`,
2941
+ `(?:${QUOTED_CREDENTIAL_KEY}|${NOT_AFTER_QUOTE}(?<!id[-_])${STRONG_CREDENTIAL_NAME})\\s{0,8}${ASSIGN}\\s{0,8}${NOT_A_NAMESPACED_IDENTIFIER}(["'\`])${QUOTED_VALUE}\\1`,
2898
2942
  "i"
2899
2943
  ),
2900
2944
  valueGroup: 2
2901
2945
  },
2902
2946
  {
2903
- // `pass`, `id-token` and `credentials` are ambiguous on their own, so they
2947
+ // `pass` and `credentials` are ambiguous on their own, so they
2904
2948
  // are accepted only against a quoted value long enough to be a credential.
2905
2949
  rule: "credential-assignment-weak",
2906
2950
  pattern: new RegExp(
@@ -2922,9 +2966,31 @@ var DEFAULT_SECRET_PATTERNS = [
2922
2966
  // character, so `["awsSecret:", "apiKey:"]` — the list of key names the lookbehind was added
2923
2967
  // for — cannot match here anyway. `redact.ts` still refuses a match whose separator is inside
2924
2968
  // the literal, which is the case that list actually is.
2969
+ //
2970
+ // The name may also be a *quoted* key: YAML allows `"dbPassword": hunter2`, and JSON cannot
2971
+ // spell a key any other way, so the same {@link QUOTED_CREDENTIAL_KEY} fragment is used here.
2972
+ // Without it a quoted key whose value was not quoted emitted the value in clear.
2973
+ //
2974
+ // A colon-form assignment in a data file masks the whole remainder of the value to
2975
+ // end-of-line, whatever punctuation it holds. A strong credential name is the evidence that
2976
+ // the thing after it is a value, and the character classes above cannot cover every symbol a
2977
+ // password may contain — `password: pa&ss` used to stop at the `&`. This branch is a
2978
+ // lookbehind, so the match is the value alone, and `redact.ts` only applies it to a data or
2979
+ // shell file: in source code the same shape is an expression and stays untouched, and an `URL`
2980
+ // query string keeps its `&` separators because they are not a colon form.
2981
+ //
2982
+ // The `KEY=value` twin does the same for the `=` form, which INI, .properties and shell files
2983
+ // use: with a credential key the whole value is masked whatever symbols it contains
2984
+ // (`password=pa&ss`, `token=a<b`, `client_secret=x|y`). The value is bounded by whitespace
2985
+ // (end of line, or the space before a `# comment`), not by a symbol class — `envpass!@#$%^&*()` used
2986
+ // to stop before the parenthesis and leave the tail in clear. The lookbehind matches the value
2987
+ // alone and `redact.ts` decides, from the file and from the key, whether the line is an
2988
+ // assignment (it must be a data/shell file, the key must end in a credential name, and a URL
2989
+ // query parameter or `$VARIABLE` reference is not an assignment).
2925
2990
  rule: "credential-assignment-unquoted",
2926
2991
  pattern: new RegExp(
2927
- `${UNQUOTED_STRONG_NAME}\\s{0,8}${ASSIGN}\\s{0,8}${NOT_A_LITERAL_VALUE}${UNQUOTED_LITERAL}`,
2992
+ `(?:${QUOTED_CREDENTIAL_KEY}|${UNQUOTED_STRONG_NAME})\\s{0,8}${ASSIGN}\\s{0,8}${NOT_A_LITERAL_VALUE}${UNQUOTED_LITERAL}|(?<=${UNQUOTED_STRONG_NAME}\\s{0,8}=(?!=)\\s{0,8})(?![\\s#$"'\`])[^\\s]{1,512}|(?<=${UNQUOTED_STRONG_NAME}\\s{0,8}:[ ]{1,8})(?![ ]*["'\`])(?![ ]*[|>])${NOT_A_LITERAL_VALUE}[^\r
2993
+ #]{1,300}`,
2928
2994
  "i"
2929
2995
  ),
2930
2996
  valueGroup: 1
@@ -2947,8 +3013,14 @@ var DEFAULT_SECRET_PATTERNS = [
2947
3013
  // needs no `valueGroup`. A lone `Bearer`/`Basic`, and a word after it that
2948
3014
  // cannot be a credential (`Bearer authentication`), stay readable: the value
2949
3015
  // must contain a digit, be at least 32 chars, or carry base64 `=` padding.
3016
+ //
3017
+ // A fourth shape was leaking: `Basic dXNlcjpwYXNz` is the base64 of `user:pass` — 12
3018
+ // characters, no digit, no padding — and the three tests above all said "not a
3019
+ // credential", so it reached the parts in clear. Mixed case is the discriminator: a base64
3020
+ // rendering of textual userinfo mixes cases, while the prose the earlier rules were
3021
+ // protecting (`Bearer authentication`) is a lowercase word.
2950
3022
  rule: "authorization-header",
2951
- pattern: /(?<=(?:Bearer|Basic)\s{1,8})(?:[A-Za-z0-9_.+/-]{0,31}[0-9][A-Za-z0-9_.+/-]{0,1024}|[A-Za-z0-9_.+/-]{32,1024}|[A-Za-z0-9_.+/-]{8,1024}={1,2})(?![A-Za-z0-9_.+/=-])/
3023
+ pattern: /(?<=(?:Bearer|Basic)\s{1,8})(?:[A-Za-z0-9_.+/-]{0,31}[0-9][A-Za-z0-9_.+/-]{0,1024}|[A-Za-z0-9_.+/-]{32,1024}|[A-Za-z0-9_.+/-]{8,1024}={1,2}|(?=[A-Za-z0-9_.+/-]{0,1023}[A-Z])(?=[A-Za-z0-9_.+/-]{0,1023}[a-z])[A-Za-z0-9_.+/-]{12,1024})(?![A-Za-z0-9_.+/=-])/
2952
3024
  },
2953
3025
  {
2954
3026
  // Broader names than before (`apiKey`, `clientSecret`, `privateKey` were
@@ -3160,6 +3232,32 @@ function scanAndRedactSecrets(content, rules, filePath) {
3160
3232
  continue;
3161
3233
  }
3162
3234
  if (group && isTemplateInterpolation(line, group[0], group[1])) continue;
3235
+ if (group && isUnquotedValue(line, group[0]) && TRUNCATING_VALUE_CHARS.test(line[group[1]] ?? "")) {
3236
+ continue;
3237
+ }
3238
+ if (valueGroup !== void 0 && group === void 0) {
3239
+ if (!isAssignmentFile(filePath)) continue;
3240
+ const assignment = assignmentAround(line, match.index);
3241
+ if (assignment.form === "=" && (assignment.reference || assignment.key === null || !CREDENTIAL_KEY_TAIL.test(assignment.key))) {
3242
+ continue;
3243
+ }
3244
+ }
3245
+ if (group && isUnquotedValue(line, group[0]) && OPENER_LED_VALUE.test(line.slice(group[0], group[1])) && !isAssignmentFile(filePath)) {
3246
+ continue;
3247
+ }
3248
+ if (group && isUnquotedValue(line, group[0])) {
3249
+ const assignment = assignmentAround(line, group[0]);
3250
+ const wholeValue = isAssignmentFile(filePath) && assignment.form !== null && !assignment.reference && !assignment.urlValue;
3251
+ if (wholeValue) {
3252
+ spans.push({
3253
+ start: group[0],
3254
+ end: Math.max(group[1], tokenEnd(line, group[0])),
3255
+ rule
3256
+ });
3257
+ matchedRules.add(rule);
3258
+ continue;
3259
+ }
3260
+ }
3163
3261
  spans.push(
3164
3262
  group ? { start: group[0], end: group[1], rule } : { start: match.index, end: match.index + match[0].length, rule }
3165
3263
  );
@@ -3177,6 +3275,8 @@ function scanAndRedactSecrets(content, rules, filePath) {
3177
3275
  }
3178
3276
  var TOKEN_CHARS_LEFT = /[A-Za-z0-9_+/-]/;
3179
3277
  var TOKEN_CHARS_RIGHT = /[A-Za-z0-9_+/=-]/;
3278
+ var TRUNCATING_VALUE_CHARS = /[<>|\\]/;
3279
+ var OPENER_LED_VALUE = /^[(\\[{]/;
3180
3280
  function expandOverToken(line, start, end) {
3181
3281
  let left = start;
3182
3282
  let right = end;
@@ -3223,6 +3323,31 @@ function isSelfNamingConstant(line, start, end) {
3223
3323
  }
3224
3324
  return line.endsWith(value, index);
3225
3325
  }
3326
+ function assignmentAround(line, valueStart) {
3327
+ let index = valueStart;
3328
+ while (index > 0 && (line[index - 1] === " " || line[index - 1] === " ")) index -= 1;
3329
+ const separator = index > 0 ? line[index - 1] : "";
3330
+ if (separator !== ":" && separator !== "=") {
3331
+ return { form: null, key: null, reference: false, rhsStart: -1, urlValue: false };
3332
+ }
3333
+ const separatorIndex = index - 1;
3334
+ index = separatorIndex;
3335
+ while (index > 0 && (line[index - 1] === " " || line[index - 1] === " ")) index -= 1;
3336
+ const keyEnd = index;
3337
+ while (index > 0 && /[A-Za-z0-9_$.-]/.test(line[index - 1])) index -= 1;
3338
+ const key = line.slice(index, keyEnd).replace(/^-+/, "");
3339
+ const before = index > 0 ? line[index - 1] : "";
3340
+ const reference = before === "?" || before === "&" || before === "$" || before === '"' || before === "'" || before === "`";
3341
+ let rhsStart = separatorIndex + 1;
3342
+ while (rhsStart < line.length && (line[rhsStart] === " " || line[rhsStart] === " ")) rhsStart += 1;
3343
+ const urlValue = /^[A-Za-z][A-Za-z0-9+.-]*:\/\//.test(line.slice(rhsStart, tokenEnd(line, rhsStart)));
3344
+ return { form: separator === ":" ? ":" : "=", key, reference, rhsStart, urlValue };
3345
+ }
3346
+ function tokenEnd(line, start) {
3347
+ let end = start;
3348
+ while (end < line.length && !/\s/.test(line[end])) end += 1;
3349
+ return end;
3350
+ }
3226
3351
  function isUnquotedValue(line, start) {
3227
3352
  const before = start > 0 ? line[start - 1] : "";
3228
3353
  return before !== '"' && before !== "'" && before !== "`";
@@ -5402,7 +5527,7 @@ function partitionFilesForBuckets(buckets, contentFingerprint) {
5402
5527
  bucket.budgetBytes
5403
5528
  );
5404
5529
  const sectionBudget = budget - HEADER_RESERVE_BYTES;
5405
- const prepared = bucket.files.map((file) => prepareSection(file, sectionBudget));
5530
+ const prepared = bucket.files.map((file) => prepareSection(file, sectionBudget, budget));
5406
5531
  for (const sections of greedyGroups(prepared, budget)) groups.push({ sections, budget });
5407
5532
  }
5408
5533
  if (groups.length === 0) return [];
@@ -5572,7 +5697,7 @@ var displayPath = (value) => capValue(escapeControls(value), DISPLAY_PATH_MAX);
5572
5697
  function topEntries(counts, limit) {
5573
5698
  return Object.entries(counts).sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0)).slice(0, limit).map(([key, value]) => `${capMetadata(key)} (${value})`).join(", ");
5574
5699
  }
5575
- function prepareSection(file, sectionBudget) {
5700
+ function prepareSection(file, sectionBudget, partBudget) {
5576
5701
  let text2 = renderFileSection(file);
5577
5702
  let byteSize = Buffer.byteLength(text2, "utf8");
5578
5703
  if (byteSize <= sectionBudget) return { file, text: text2, byteSize };
@@ -5584,7 +5709,7 @@ function prepareSection(file, sectionBudget) {
5584
5709
  const truncated = truncateWithBudgetMarker(
5585
5710
  content,
5586
5711
  allowed,
5587
- sectionBudget,
5712
+ partBudget,
5588
5713
  file.originalLines
5589
5714
  );
5590
5715
  if (!truncated.isTruncated) return;
@@ -6386,16 +6511,14 @@ function emptyDrift() {
6386
6511
  function sha256Hex(buffer) {
6387
6512
  return crypto2__namespace.createHash("sha256").update(buffer).digest("hex");
6388
6513
  }
6389
- var VERIFY_SNIFF_MAX_BYTES = 8 * 1024 * 1024;
6390
6514
  function wouldNowBeIncluded(cwd, relativePath) {
6391
6515
  const absolutePath = path16__namespace.join(cwd, relativePath);
6392
6516
  try {
6393
6517
  const stats = fs14__namespace.statSync(absolutePath);
6394
6518
  if (!stats.isFile()) return false;
6395
- if (stats.size <= VERIFY_SNIFF_MAX_BYTES) {
6396
- return !decodeText(fs14__namespace.readFileSync(absolutePath)).binary;
6397
- }
6398
- return !isBinaryFile(absolutePath);
6519
+ if (isBinaryExtension(absolutePath)) return false;
6520
+ if (stats.size > BINARY_SCAN_BYTES && isBinaryFile(absolutePath)) return false;
6521
+ return !decodeText(fs14__namespace.readFileSync(absolutePath)).binary;
6399
6522
  } catch {
6400
6523
  return false;
6401
6524
  }
@@ -6972,7 +7095,7 @@ function validateSnapshot(configInput) {
6972
7095
 
6973
7096
  // src/version.ts
6974
7097
  var GENERATOR_NAME = "codebase-snapshot";
6975
- var GENERATOR_VERSION = "0.9.14";
7098
+ var GENERATOR_VERSION = "0.9.15";
6976
7099
  var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
6977
7100
  function isOurGeneratorName(name) {
6978
7101
  if (typeof name !== "string") return false;
@@ -7299,6 +7422,12 @@ function explainPath(config, target) {
7299
7422
  return result;
7300
7423
  }
7301
7424
  }
7425
+ if (isBinaryExtension(absolute)) {
7426
+ result.included = false;
7427
+ result.reason = "binary";
7428
+ result.detail = "binary extension; generate skips it without reading and records `binary` in manifest.skipped[]";
7429
+ return result;
7430
+ }
7302
7431
  let sizeOnDisk = null;
7303
7432
  try {
7304
7433
  sizeOnDisk = fs14__namespace.statSync(absolute).size;
@@ -7311,13 +7440,6 @@ function explainPath(config, target) {
7311
7440
  result.detail = "binary content; generate skips it and records `binary` in manifest.skipped[]";
7312
7441
  return result;
7313
7442
  }
7314
- result.layer = classifyLayer(relative8, config.layers);
7315
- result.kind = classifyKind(relative8, config.kinds);
7316
- result.language = detectLanguage(relative8);
7317
- const layerRule = findRuleMatch(config.layers, relative8);
7318
- if (layerRule) result.layerMatch = describeMatcher(layerRule.match);
7319
- const kindRule = findRuleMatch(config.kinds, relative8);
7320
- if (kindRule) result.kindMatch = describeMatcher(kindRule.match);
7321
7443
  if (fs14__namespace.existsSync(absolute) && fs14__namespace.statSync(absolute).isFile()) {
7322
7444
  const buffer = fs14__namespace.readFileSync(absolute);
7323
7445
  const decoded = decodeText(buffer);
@@ -7335,6 +7457,13 @@ function explainPath(config, target) {
7335
7457
  result.secretCount = findings.length;
7336
7458
  result.secrets = findings.slice(0, 20).map((finding) => ({ rules: finding.rules, line: finding.line }));
7337
7459
  }
7460
+ result.layer = classifyLayer(relative8, config.layers);
7461
+ result.kind = classifyKind(relative8, config.kinds);
7462
+ result.language = detectLanguage(relative8);
7463
+ const layerRule = findRuleMatch(config.layers, relative8);
7464
+ if (layerRule) result.layerMatch = describeMatcher(layerRule.match);
7465
+ const kindRule = findRuleMatch(config.kinds, relative8);
7466
+ if (kindRule) result.kindMatch = describeMatcher(kindRule.match);
7338
7467
  const manifest = readManifest2(config);
7339
7468
  const entry = Array.isArray(manifest?.files) ? manifest.files.find((file) => file.relativePath === relative8) : void 0;
7340
7469
  result.part = entry?.part ?? null;
@@ -7472,7 +7601,7 @@ function describePayloadDiff(before, after, sourceFilesIdentical) {
7472
7601
  }
7473
7602
  if (fingerprintDiffers && (sourceFilesIdentical || configurationDiffers)) {
7474
7603
  reasons.push(
7475
- `content fingerprint ${shortDigest(before.fingerprint)} \u2192 ${shortDigest(after.fingerprint)}` + (sourceFilesIdentical ? " (same source files, packed differently)" : "")
7604
+ `content fingerprint ${shortDigest(before.fingerprint)} \u2192 ${shortDigest(after.fingerprint)}` + (sourceFilesIdentical ? " (same source files, packed or configured differently)" : "")
7476
7605
  );
7477
7606
  }
7478
7607
  if (partsDiffer) {
@@ -7744,7 +7873,8 @@ function renderConfig(answers) {
7744
7873
  // matched value is never included \u2014 only the path, the line and the rule.
7745
7874
  sarif: ${answers.sarif},
7746
7875
  // Snapshot only the files that differ from a git ref (for example "main"),
7747
- // plus untracked ones. null and false both mean "snapshot everything".
7876
+ // plus untracked ones. null means "snapshot everything"; any other value must
7877
+ // be a git ref string, and anything else is a configuration error.
7748
7878
  changedSince: null,
7749
7879
  // Snapshot only what is staged in the index: the pre-commit counterpart.
7750
7880
  staged: false,
@@ -9111,6 +9241,7 @@ function isProcessAlive(pid) {
9111
9241
  var OWNERSHIP_MARKER = ".codebase-snapshot";
9112
9242
  var SUPPORTED_MARKER_SCHEMAS = /* @__PURE__ */ new Set([SCHEMA_VERSION]);
9113
9243
  var SNAPSHOT_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
9244
+ var SHA256_HEX_PATTERN = /^[0-9a-f]{64}$/;
9114
9245
  function listEntries(dir) {
9115
9246
  const entries = [];
9116
9247
  const walk = (absolute, prefix) => {
@@ -9129,7 +9260,32 @@ function listEntries(dir) {
9129
9260
  walk(dir, "");
9130
9261
  return entries.sort();
9131
9262
  }
9263
+ function markerInventory(dir) {
9264
+ const entries = listEntries(dir);
9265
+ const files = [];
9266
+ for (const entry of entries) {
9267
+ if (entry === OWNERSHIP_MARKER) continue;
9268
+ if (IGNORABLE_ENTRIES.has(entry.slice(entry.lastIndexOf("/") + 1))) continue;
9269
+ const full = path16__namespace.join(dir, ...entry.split("/"));
9270
+ let stats;
9271
+ try {
9272
+ stats = fs14__namespace.lstatSync(full);
9273
+ } catch {
9274
+ continue;
9275
+ }
9276
+ if (!stats.isFile()) continue;
9277
+ let digest;
9278
+ try {
9279
+ digest = sha256Hex2(fs14__namespace.readFileSync(full));
9280
+ } catch {
9281
+ continue;
9282
+ }
9283
+ files.push({ path: entry, bytes: stats.size, sha256: digest });
9284
+ }
9285
+ return { entries, files };
9286
+ }
9132
9287
  function markerPayload(dir, state, id, createdAt) {
9288
+ const { entries, files } = markerInventory(dir);
9133
9289
  const marker2 = {
9134
9290
  generator: GENERATOR_NAME,
9135
9291
  version: GENERATOR_VERSION,
@@ -9138,7 +9294,8 @@ function markerPayload(dir, state, id, createdAt) {
9138
9294
  state,
9139
9295
  id,
9140
9296
  pid: process.pid,
9141
- entries: listEntries(dir)
9297
+ entries,
9298
+ files
9142
9299
  };
9143
9300
  const manifestPath = path16__namespace.join(dir, "manifest.json");
9144
9301
  if (fs14__namespace.existsSync(manifestPath)) {
@@ -9198,6 +9355,33 @@ function readOwnershipMarker(dir) {
9198
9355
  if (candidate.state !== "staging" && candidate.state !== "complete") {
9199
9356
  return { marker: null, problem: "its .codebase-snapshot marker records no run state" };
9200
9357
  }
9358
+ const rawFiles = candidate.files;
9359
+ let files;
9360
+ if (rawFiles !== void 0) {
9361
+ if (!Array.isArray(rawFiles)) {
9362
+ return {
9363
+ marker: null,
9364
+ problem: "its .codebase-snapshot marker's file inventory is not an array"
9365
+ };
9366
+ }
9367
+ files = [];
9368
+ for (const item of rawFiles) {
9369
+ if (!item || typeof item !== "object" || Array.isArray(item)) {
9370
+ return {
9371
+ marker: null,
9372
+ problem: "its .codebase-snapshot marker's file inventory holds an entry that is not an object"
9373
+ };
9374
+ }
9375
+ const record = item;
9376
+ if (typeof record.path !== "string" || typeof record.bytes !== "number" || !Number.isInteger(record.bytes) || record.bytes < 0 || typeof record.sha256 !== "string" || !SHA256_HEX_PATTERN.test(record.sha256)) {
9377
+ return {
9378
+ marker: null,
9379
+ problem: "its .codebase-snapshot marker's file inventory holds an entry this build cannot read"
9380
+ };
9381
+ }
9382
+ files.push({ path: record.path, bytes: record.bytes, sha256: record.sha256 });
9383
+ }
9384
+ }
9201
9385
  return {
9202
9386
  marker: {
9203
9387
  generator: GENERATOR_NAME,
@@ -9208,7 +9392,8 @@ function readOwnershipMarker(dir) {
9208
9392
  id: candidate.id,
9209
9393
  pid: typeof candidate.pid === "number" ? candidate.pid : void 0,
9210
9394
  manifestSha256: typeof candidate.manifestSha256 === "string" ? candidate.manifestSha256 : void 0,
9211
- entries: Array.isArray(candidate.entries) && candidate.entries.every((entry) => typeof entry === "string") ? candidate.entries : void 0
9395
+ entries: Array.isArray(candidate.entries) && candidate.entries.every((entry) => typeof entry === "string") ? candidate.entries : void 0,
9396
+ files
9212
9397
  },
9213
9398
  problem: null
9214
9399
  };
@@ -9223,6 +9408,59 @@ function describeManifestProblem(value) {
9223
9408
  if (!Array.isArray(candidate.files)) return "has no files array";
9224
9409
  return null;
9225
9410
  }
9411
+ function verifyMarkerInventory(dir, entries, files) {
9412
+ const diskEntries = new Set(entries);
9413
+ const recorded = /* @__PURE__ */ new Map();
9414
+ for (const record of files) {
9415
+ if (recorded.has(record.path)) {
9416
+ return `its .codebase-snapshot inventory records ${record.path} twice`;
9417
+ }
9418
+ if (!diskEntries.has(record.path)) {
9419
+ return `its .codebase-snapshot inventory records ${record.path}, which is missing from the directory`;
9420
+ }
9421
+ recorded.set(record.path, record);
9422
+ }
9423
+ for (const entry of entries) {
9424
+ if (entry === OWNERSHIP_MARKER) continue;
9425
+ if (IGNORABLE_ENTRIES.has(entry.slice(entry.lastIndexOf("/") + 1))) continue;
9426
+ const full = path16__namespace.join(dir, ...entry.split("/"));
9427
+ let stats;
9428
+ try {
9429
+ stats = fs14__namespace.lstatSync(full);
9430
+ } catch {
9431
+ return `its .codebase-snapshot inventory lists ${entry}, which cannot be read`;
9432
+ }
9433
+ if (stats.isDirectory()) {
9434
+ if (recorded.has(entry)) {
9435
+ return `its .codebase-snapshot inventory records the directory ${entry} as a file`;
9436
+ }
9437
+ continue;
9438
+ }
9439
+ if (!stats.isFile()) {
9440
+ if (recorded.has(entry)) {
9441
+ return `its .codebase-snapshot inventory records ${entry} as a regular file, but it is not one`;
9442
+ }
9443
+ continue;
9444
+ }
9445
+ const record = recorded.get(entry);
9446
+ if (record === void 0) {
9447
+ return `its .codebase-snapshot inventory does not record the file ${entry}`;
9448
+ }
9449
+ if (record.bytes !== stats.size) {
9450
+ return `its .codebase-snapshot inventory records ${entry} as ${record.bytes} B, but it is ${stats.size} B`;
9451
+ }
9452
+ let digest;
9453
+ try {
9454
+ digest = sha256Hex2(fs14__namespace.readFileSync(full));
9455
+ } catch {
9456
+ return `its .codebase-snapshot inventory cannot verify ${entry}: the file could not be read`;
9457
+ }
9458
+ if (digest !== record.sha256) {
9459
+ return `its .codebase-snapshot inventory's digest for ${entry} does not match the file`;
9460
+ }
9461
+ }
9462
+ return null;
9463
+ }
9226
9464
  function assessSnapshotDirectory(dir) {
9227
9465
  const { marker: marker2, problem } = readOwnershipMarker(dir);
9228
9466
  if (!marker2) return { owned: false, problem, foreignEntries: [], marker: null };
@@ -9235,7 +9473,8 @@ function assessSnapshotDirectory(dir) {
9235
9473
  };
9236
9474
  }
9237
9475
  const manifestPath = path16__namespace.join(dir, "manifest.json");
9238
- if (fs14__namespace.existsSync(manifestPath)) {
9476
+ const hasManifest = fs14__namespace.existsSync(manifestPath);
9477
+ if (hasManifest) {
9239
9478
  let raw;
9240
9479
  try {
9241
9480
  raw = fs14__namespace.readFileSync(manifestPath, "utf8");
@@ -9291,6 +9530,14 @@ function assessSnapshotDirectory(dir) {
9291
9530
  marker: marker2
9292
9531
  };
9293
9532
  }
9533
+ if (marker2.files === void 0 && !hasManifest) {
9534
+ return {
9535
+ owned: false,
9536
+ problem: "its .codebase-snapshot marker records neither per-file digests nor a manifest digest, so it cannot prove this generator wrote the directory",
9537
+ foreignEntries: [],
9538
+ marker: marker2
9539
+ };
9540
+ }
9294
9541
  const recorded = new Set(marker2.entries ?? []);
9295
9542
  if (recorded.size === 0) {
9296
9543
  return {
@@ -9300,13 +9547,18 @@ function assessSnapshotDirectory(dir) {
9300
9547
  marker: marker2
9301
9548
  };
9302
9549
  }
9303
- const foreignEntries = listEntries(dir).filter(
9550
+ const entries = listEntries(dir);
9551
+ const foreignEntries = entries.filter(
9304
9552
  (entry) => !recorded.has(entry) && !IGNORABLE_ENTRIES.has(entry)
9305
9553
  );
9554
+ if (foreignEntries.length > 0) {
9555
+ return { owned: false, problem: null, foreignEntries, marker: marker2 };
9556
+ }
9557
+ const inventoryProblem = marker2.files === void 0 ? null : verifyMarkerInventory(dir, entries, marker2.files);
9306
9558
  return {
9307
- owned: foreignEntries.length === 0,
9308
- problem: null,
9309
- foreignEntries,
9559
+ owned: inventoryProblem === null,
9560
+ problem: inventoryProblem,
9561
+ foreignEntries: [],
9310
9562
  marker: marker2
9311
9563
  };
9312
9564
  }
@@ -9930,9 +10182,12 @@ function generateSnapshot(configInput, options) {
9930
10182
  }
9931
10183
  }
9932
10184
  const fingerprint = sha256Hex2(
9933
- files.map(
9934
- (file) => `${file.relativePath}:${file.hashSha256}:${file.sizeBytes}:${file.inclusionMode}`
9935
- ).join("\n")
10185
+ [
10186
+ ...files.map(
10187
+ (file) => `${file.relativePath}:${file.hashSha256}:${file.sizeBytes}:${file.inclusionMode}`
10188
+ ),
10189
+ `settings:${configDigest(config)}`
10190
+ ].join("\n")
9936
10191
  );
9937
10192
  const fullContents = /* @__PURE__ */ new Map();
9938
10193
  if (config.includeMonolith) {
@@ -10200,7 +10455,7 @@ function generateSnapshot(configInput, options) {
10200
10455
  }
10201
10456
  writeOwnershipMarker(outDir, markerPayload(outDir, "complete", snapshotId, createdAt));
10202
10457
  };
10203
- shipHookState();
10458
+ if (config.hooks.afterGenerate) shipHookState();
10204
10459
  if (pendingHook) {
10205
10460
  const tracked = pendingHook.then(
10206
10461
  () => {
package/dist/index.d.cts CHANGED
@@ -509,7 +509,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
509
509
  * `package.json` carries the same version; `npm run verify` compares the two.
510
510
  */
511
511
  declare const GENERATOR_NAME = "codebase-snapshot";
512
- declare const GENERATOR_VERSION = "0.9.14";
512
+ declare const GENERATOR_VERSION = "0.9.15";
513
513
 
514
514
  /** The one endpoint this package will ever request. */
515
515
  declare const PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
package/dist/index.d.ts CHANGED
@@ -509,7 +509,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
509
509
  * `package.json` carries the same version; `npm run verify` compares the two.
510
510
  */
511
511
  declare const GENERATOR_NAME = "codebase-snapshot";
512
- declare const GENERATOR_VERSION = "0.9.14";
512
+ declare const GENERATOR_VERSION = "0.9.15";
513
513
 
514
514
  /** The one endpoint this package will ever request. */
515
515
  declare const PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
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-DUZK5VL2.js';
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-JL4VDGXL.js';