@maxgfr/codeindex 2.13.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,9 +8,8 @@ import resolution, a typed cross-file link-graph, and graph analytics — shippe
8
8
  as a single zero-dependency `engine.mjs` that consumer tools **vendor** (copy
9
9
  into their repo) instead of installing.
10
10
 
11
- Extracted from [ultraindex](https://github.com/maxgfr/ultraindex) 5.1.0's core,
12
- and consumed by the ultra* skill family (ultraindex, ultradoc, ultrasec,
13
- ultraeval, reconstruct, construct, ultra11y).
11
+ Designed for downstream tools — agent skills, CLIs, CI gates — that vendor the
12
+ engine as a single file instead of taking an npm dependency.
14
13
 
15
14
  ## What it does
16
15
 
@@ -44,7 +43,28 @@ const { scan, graph, symbols } = buildIndexArtifacts("/path/to/repo");
44
43
 
45
44
  The AST tier is optional: without a `grammars/` directory next to the bundle
46
45
  the engine silently uses its regex tier. Only tools that want AST precision
47
- (e.g. ultraindex) also vendor `scripts/grammars/` (~17 MiB of wasm).
46
+ also vendor `scripts/grammars/` (~17 MiB of wasm).
47
+
48
+ ### Slim grammars (pull instead of vendor)
49
+
50
+ Consumers that want AST precision but not the ~17 MiB of vendored wasm can
51
+ `codeindex grammars pull` the grammars once into a shared, per-machine cache
52
+ (`<XDG_CACHE_HOME|~/.cache>/codeindex/grammars/<ENGINE_VERSION>`) instead:
53
+
54
+ ```sh
55
+ codeindex grammars status # active tier (adjacent/env/cache/none) + whether a pull is needed
56
+ codeindex grammars pull # fetch the per-release grammars asset, sha256-verified, into the cache
57
+ ```
58
+
59
+ Resolution is **adjacent > env > cache > regex**: a bundle-adjacent `grammars/`
60
+ still wins if present (offline setups are untouched), then
61
+ `CODEINDEX_GRAMMARS_DIR`, then the pulled cache. `pull` fetches the official
62
+ `grammars-<version>.tar.gz` release asset (its `.sha256` sidecar is verified
63
+ before anything is written) and extracts it atomically; the same wasm bytes
64
+ produce **byte-identical** AST extraction from the cache as from a vendored dir.
65
+ It is fully **offline-safe**: with no grammars resolvable anywhere — and after a
66
+ failed or absent pull — the engine silently falls back to the regex tier exactly
67
+ as it does today; a pull never throws into indexing.
48
68
 
49
69
  ## Use from npm
50
70
 
@@ -62,8 +82,8 @@ const scan = scanRepo("/path/to/repo");
62
82
  ```
63
83
 
64
84
  The CLI ships in the same package — see **Use as a CLI** below for the global
65
- install command. Skills should still prefer vendoring: it keeps their own
66
- bundle single-file and pinned to an exact commit without an npm dependency.
85
+ install command. Consumer tools should still prefer vendoring: it keeps their
86
+ own bundle single-file and pinned to an exact commit without an npm dependency.
67
87
 
68
88
  ## Use as a CLI
69
89
 
@@ -186,8 +206,8 @@ into their own CLIs); `cli.mjs` is the thin standalone CLI/MCP wrapper.
186
206
  ## Versioning
187
207
 
188
208
  - `ENGINE_VERSION` — the release tag, embedded greppably in the bundle.
189
- - `SCHEMA_VERSION` — the `graph.json`/`symbols.json` shape (continues
190
- ultraindex's lineage; currently 4). Consumers reject mismatched artifacts.
209
+ - `SCHEMA_VERSION` — the `graph.json`/`symbols.json` shape (currently 4).
210
+ Consumers reject mismatched artifacts.
191
211
  - `EXTRACTOR_VERSION` — the extraction output shape; incremental caches keyed
192
212
  on it are discarded wholesale when it bumps.
193
213
 
@@ -218,8 +238,8 @@ pnpm check:build # proves the committed bundle is byte-reproducible
218
238
  pnpm test:e2e # opt-in: pinned real-repo builds with ratchets
219
239
  ```
220
240
 
221
- The compat suite pins the exact bytes ultraindex 5.1.0 produced for the
222
- `mini-repo` fixture — the proof that extraction was lossless.
241
+ The compat suite pins golden bytes for the `mini-repo` fixture the proof
242
+ that extraction stays lossless across releases.
223
243
 
224
244
  ## License
225
245
 
package/docs/MIGRATION.md CHANGED
@@ -1,4 +1,4 @@
1
- # Migrating a skill onto the codeindex engine
1
+ # Migrating a consumer tool onto the codeindex engine
2
2
 
3
3
  The engine ships as two files, released together at every tag:
4
4
 
@@ -6,12 +6,12 @@ The engine ships as two files, released together at every tag:
6
6
  - `scripts/engine.d.mts` — TypeScript declarations for the bundle
7
7
 
8
8
  Consumers **vendor** them (commit a copy) — never an npm dependency — so every
9
- skill stays standalone-installable.
9
+ consumer stays standalone-installable.
10
10
 
11
11
  ## Vendoring steps
12
12
 
13
- 1. Copy `scripts/sync-engine.mjs` (reference implementation lives in the
14
- ultraeval repo) into your repo and run:
13
+ 1. Add a small `scripts/sync-engine.mjs` to your repo (a ~50-line fetch script
14
+ with the behavior described below) and run:
15
15
 
16
16
  ```sh
17
17
  node scripts/sync-engine.mjs --ref v1.0.0
@@ -40,8 +40,7 @@ skill stays standalone-installable.
40
40
 
41
41
  The AST tier is optional: without a `grammars/` directory next to the vendored
42
42
  bundle the engine uses its regex tier (15 languages). Only vendor
43
- `scripts/grammars/` (~17 MiB wasm) if you need AST-exact symbols (ultraindex
44
- does; nobody else should).
43
+ `scripts/grammars/` (~17 MiB wasm) if you need AST-exact symbols.
45
44
 
46
45
  ## Version constants
47
46
 
@@ -53,7 +52,7 @@ does; nobody else should).
53
52
 
54
53
  `buildGraph(...)` / `buildIndexArtifacts(...)` accept
55
54
  `meta: { version, schemaVersion }` so a consumer stamps its own identity into
56
- artifacts it persists (ultraindex does this to keep its graph.json lineage).
55
+ artifacts it persists and keeps its own `graph.json` lineage.
57
56
 
58
57
  ## v2.9.0 — `search` trigram fuzzy fallback
59
58
 
@@ -130,39 +129,122 @@ untouched, so **no re-pin is required**; a consumer that deliberately wants
130
129
  `.codeindex` walked can pass `ignoreDirs` (replace semantics, also new in
131
130
  this release) with its own set.
132
131
 
133
- ## Per-skill mapping (what to replace with what)
132
+ ## v2.14.0 incremental fastpaths (all additive, no re-pin required)
134
133
 
135
- | Skill | Replace | With (engine export) |
136
- |---|---|---|
137
- | **ultraeval** | `walkFiles`, `SKIP_DIRS` | `scanRepo` (gitignore on by default) |
138
- | | `importsOf` + `resolveImport` (JS/TS+py regex) | `FileRecord.refs` (kind `import`) + `buildResolveContext`/`resolveImport` |
139
- | | `gitChurn`, `changedFiles` | `gitChurn`, `changedSince` |
140
- | | keeps | cycle DFS, hotspot scoring, todos/maxIndent, ANALYSIS.md rendering |
141
- | **construct** | walker clone + language histogram + test count | `scanRepo` (`.languages`) + `isTestPath` |
142
- | **ultraindex** | the whole core (walk/scan/extract/resolve/modules/graph/calls/analytics/renderers) | vendored engine + shim `src/engine.ts` re-exporting it; pass `meta: { version: VERSION, schemaVersion: SCHEMA_VERSION }` to keep graph.json byte-lineage |
143
- | | keeps | store/manifest, encyclopedia, merge/entries, find/ask, check/verify, embeddings, orchestrate |
144
- | **ultradoc** | walker, `EXT_LANG` map, symbol `RULES` + `applyExportLists` | `scanRepo`, `extToLang`/`languageOf`, `extractSymbols`/`buildSymbolIndex` |
145
- | | `PKG_MANIFESTS` workspace probing | `detectWorkspaces` |
146
- | | `rgSearch` + JS fallback | `grepRepo` |
147
- | | keeps | issues/PRs/SO/web retrieval, citations, DOC.md |
148
- | **ultra11y** | walker + glob scoping | `walk`/`scanRepo` with `include`/`exclude` |
149
- | | tsconfig path-alias resolution | `buildResolveContext` + `resolveImport` |
150
- | | keeps | its JSX component graph and every WCAG check |
151
- | **reconstruct** | walker + gitignore parser + `categorize` | `scanRepo`, `categorize` |
152
- | | `EXT_LANGUAGE` | `extToLang` |
153
- | | workspace detection + dep graph + cycle + topo | `detectWorkspaces` (packages/dependsOn/cycle/topoOrder) |
154
- | | `resolveModule` | `resolveImport` |
155
- | | keeps | framework adapters (routes), data-model inference, PRD rendering |
156
- | **ultrasec** | walker + gitignore + scope + symlink guard | `scanRepo` (`scope`, `gitignore` its own semantics, ported here) |
157
- | | per-language defs/imports/calls extraction | `extractCode` (`symbols`/`refs`/`calls`) |
158
- | | `resolveImport` | `resolveImport` |
159
- | | `buildGraph` (import+call edges, symbolDefs) | `buildGraph` + `resolveCallEdges` |
160
- | | `callersBySymbol`, `enclosingSymbol` (raw-recall taint-BFS input) | `buildRawCallerIndex` (issue #8) — every name-matched call site keyed by the raw callee name, no def resolution or gating, `enclosingSymbol` computed per site. `buildCallerIndex` is **NOT** a substitute here: it is def-resolved and gated (language-family filter, JS/TS import gate, same-file self-declaration skip) and will silently drop sites a recall consumer needs. Both are bounded by `FileRecord.calls`'s per-file 512-call cap (dedup by name+line) — a file with more raw call sites than that loses sites upstream of either function. |
161
- | | keeps | taint source→sink enumeration, external scanners, EPSS/KEV/CVSS, SARIF |
134
+ Pure fastpaths: every entry point still produces byte-identical artifacts for
135
+ unchanged inputs, so **no re-pin is required** and no consumer needs to act.
136
+ `SCHEMA_VERSION` / `EMBED_VERSION` / `EXTRACTOR_VERSION` are untouched; the new
137
+ surface is additive (semver-minor).
138
+
139
+ - **`RepoScan.contentUnchanged` / `RepoScan.cacheDirty` + `ScanOptions.precomputedWalk`.**
140
+ Two derived read-only flags: `contentUnchanged` is true when a `cache` was
141
+ supplied and every kept file reused its cached record (stat fastpath or exact
142
+ content-hash) with an unchanged file set; `cacheDirty` is true when persisting
143
+ the cache would change any byte (a hash/size/mtime drift, a file-set
144
+ difference, or no cache at all). `precomputedWalk` lets a caller that already
145
+ walked hand its `WalkResult` to `scanRepo` instead of re-walking — it must
146
+ come from `walk(root, <the same options>)`.
147
+ - **`buildArtifactsFromScan(scan, opts)` export.** The downstream half of
148
+ `buildIndexArtifacts` (resolve graph communities centrality symbol
149
+ index) split out as its own export; `buildIndexArtifacts` is now `scanRepo` +
150
+ this call. A consumer already holding a `RepoScan` builds artifacts without
151
+ re-walking; the extracted body is verbatim, so output is byte-identical.
152
+ - **`cache.json` additive meta keys.** Writes gain a fixed-order `meta` block
153
+ `engineVersion`, `commit`, `graphSha1`, `symbolsSha1`, and `embed`
154
+ (`{ embedVersion, modelId, sha1 }`) only when `embeddings.bin` was written.
155
+ Old engines ignore these keys (they only check schema/extractor); an old cache
156
+ lacking them never fastpaths but still reuses records. `cache.json` embeds
157
+ mtimes so it never was cross-machine byte-reproducible — no determinism
158
+ surface changes.
159
+ - **CLI `index` fastpath.** `index` skips `buildArtifactsFromScan`, both renders
160
+ and every artifact write when a guard proves the run would reproduce the
161
+ on-disk bytes: `scan.contentUnchanged`, `meta.engineVersion` matches,
162
+ `meta.commit` matches the scan's commit (graph.json embeds the commit — an
163
+ identical tree under a new HEAD rebuilds), the sha1 of the on-disk
164
+ graph/symbols equals the recorded shas, and the embed leg holds (no model, or
165
+ the model's embedVersion+modelId and `embeddings.bin` sha match — a model swap
166
+ rebuilds the sidecar). Any failure — deleted, truncated or tampered artifacts
167
+ included — falls through to the full rebuild that rewrites everything, so the
168
+ fastpath self-heals on corruption; `cache.json` is rewritten on the fastpath
169
+ only when `scan.cacheDirty`.
170
+ - **MCP session scan + artifacts cache.** The long-lived server memoizes a
171
+ single scan and its artifacts across tool calls: `getScan` re-runs `scanRepo`
172
+ with the prior scan re-expressed as its `cache`, so scan.ts's stat/hash oracle
173
+ decides freshness and an unchanged repo returns the SAME `RepoScan` object,
174
+ while `getArtifacts` lazily runs `buildArtifactsFromScan` memoized on scan
175
+ object identity (rendered strings are never cached). Any successful edit tool
176
+ (`replace_symbol_body`, `insert_after_/insert_before_symbol`) drops the entry
177
+ — a controlled write landing in the same mtime tick at the same byte count
178
+ would fool the (size, mtime) fastpath; `write_memory` needs no invalidation
179
+ (`.codeindex/` is off the walk since v2.13.0).
180
+ - **`runMcpServer` serverInfo override.** `runMcpServer(opts?)` accepts
181
+ `{ serverInfo?: { name?, version? } }` so a consumer embedding the server
182
+ announces its own identity in the `initialize` response; omitted fields keep
183
+ the `{ name: "codeindex", version: ENGINE_VERSION }` defaults, the zero-arg
184
+ call is unchanged, and `McpServerOptions` is exported from the barrel.
185
+ - **Lazy grammar warm — covering-set guarantee.** The CLI and MCP server warm
186
+ only the grammars for languages actually present (`grammarKeysForExts` over
187
+ the walked extensions) rather than every grammar at startup. The walk's
188
+ extension set is a superset of what `scanRepo` keeps (scope/include/exclude
189
+ only filter further), so every extracted file has its grammar loaded before
190
+ extraction and AST output stays byte-identical — including a language whose
191
+ first file appears mid-session (the MCP warm re-derives per call). The
192
+ **pre-existing cache-tier caveat is unchanged**: a record reused by hash may
193
+ have been extracted under a different grammar tier.
194
+ - **Slim grammars-pull tier (`grammars pull` / `grammars status`).** The AST
195
+ wasm sidecar (`scripts/grammars/`, ~17 MiB) stays optional and opt-in by
196
+ presence, but a consumer that vendors only `engine.mjs` no longer has to
197
+ vendor the wasm to get AST-exact symbols. `resolveGrammarsTier` /
198
+ `resolveGrammarsDir` now resolve in order **adjacent > env > cache > regex**:
199
+ the bundle-adjacent `grammars/` dir wins if present (the offline, no-network
200
+ story is untouched), then `CODEINDEX_GRAMMARS_DIR`, then the shared
201
+ version-scoped cache `sharedGrammarsCacheDir()`
202
+ (`<XDG_CACHE_HOME|~/.cache>/codeindex/grammars/<ENGINE_VERSION>`), else nothing
203
+ resolvable → the regex tier exactly as today. `codeindex grammars pull`
204
+ fetches the per-release `grammars-<ENGINE_VERSION>.tar.gz` asset (built and
205
+ uploaded to the `v<ENGINE_VERSION>` tag by the release workflow) plus its
206
+ `.sha256` sidecar, verifies the digest, and extracts atomically into that
207
+ cache with a zero-dep inline ustar reader (path-traversal-guarded, no spawned
208
+ `tar`); it is idempotent (a matching marker skips the ~22 MB download) and
209
+ `CODEINDEX_GRAMMARS_URL` overrides the source (private mirror, unverified,
210
+ like the embed-pull precedent). `codeindex grammars status` reports the active
211
+ tier, resolved dir, pinned `ENGINE_VERSION`, and whether a pull is needed
212
+ (JSON). The **guarantee**: the same committed wasm bytes loaded from the cache
213
+ produce byte-identical AST extraction as from a bundle-adjacent dir (same wasm
214
+ → same AST → same symbols), so `SCHEMA_VERSION` / `EXTRACTOR_VERSION` are
215
+ untouched and **no re-pin is required**. **Offline-safe**: `grammars pull`
216
+ never runs during indexing, and a failed/absent pull only ever leaves the
217
+ cache empty — it never throws into the scan, which silently uses the regex
218
+ tier. New exports: `resolveGrammarsTier`, `resolveGrammarsDir`,
219
+ `sharedGrammarsCacheDir`, `GrammarsTier` / `GrammarsTierName`,
220
+ `resolveGrammarsPullTarget`, `fetchGrammarsTarball`, `fetchExpectedSha256`,
221
+ `extractGrammarsTarball`, `GrammarsPullTarget`.
222
+
223
+ ## Typical mapping (what to replace with what)
224
+
225
+ What a consumer usually deletes from its own codebase, and the engine export
226
+ that replaces it:
227
+
228
+ | Hand-rolled piece | Engine replacement |
229
+ |---|---|
230
+ | file walker + skip lists + gitignore parser | `walk` / `scanRepo` (gitignore on by default; `include`/`exclude`/`scope`) |
231
+ | extension→language map | `extToLang` / `languageOf` |
232
+ | per-language symbol/import/call regexes | `extractCode` / `extractSymbols` (`symbols`/`refs`/`calls`), `buildSymbolIndex` |
233
+ | import resolution (tsconfig paths, package `exports`, go.mod, Cargo…) | `buildResolveContext` + `resolveImport` |
234
+ | workspace/monorepo probing | `detectWorkspaces` (packages/dependsOn/cycle/topoOrder) |
235
+ | dependency/link graph construction | `buildGraph` + `resolveCallEdges` |
236
+ | grep with ripgrep + JS fallback | `grepRepo` |
237
+ | git churn / changed-files helpers | `gitChurn`, `changedSince` |
238
+ | language histogram, test detection | `scanRepo` (`.languages`) + `isTestPath` |
239
+ | caller lookup, precision-gated | `buildCallerIndex` (def-resolved and gated: language-family filter, JS/TS import gate, same-file self-declaration skip) |
240
+ | caller lookup, raw recall (e.g. taint-BFS input) | `buildRawCallerIndex` (issue #8) — every name-matched call site keyed by the raw callee name, no def resolution or gating, `enclosingSymbol` computed per site. `buildCallerIndex` is **NOT** a substitute here: its gates silently drop sites a recall consumer needs. Both are bounded by `FileRecord.calls`'s per-file 512-call cap (dedup by name+line) — a file with more raw call sites than that loses sites upstream of either function. |
241
+
242
+ What a consumer keeps is everything above the index: its own scoring,
243
+ rendering, retrieval and domain logic.
162
244
 
163
245
  ## Golden-diff adjudication (every migration)
164
246
 
165
- Capture the skill's load-bearing artifact **before** touching code (a committed
247
+ Capture the consumer's load-bearing artifact **before** touching code (a committed
166
248
  snapshot test), migrate, then adjudicate every diff:
167
249
 
168
250
  - **Accept + document**: file-set changes from better ignore rules (gitignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxgfr/codeindex",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "Self-contained, deterministic repo-indexing engine: walk + language detection + symbol/import extraction (tree-sitter AST with regex fallback) + import resolution + typed cross-file link-graph + analytics. Ships as a single zero-dependency engine.mjs that consumer tools vendor.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.33.0",
@@ -1,4 +1,4 @@
1
- declare const ENGINE_VERSION = "2.13.0";
1
+ declare const ENGINE_VERSION = "2.14.0";
2
2
  declare const SCHEMA_VERSION = 4;
3
3
  declare const EXTRACTOR_VERSION = 10;
4
4
  type FileKind = "code" | "doc" | "config" | "asset" | "other";
@@ -148,6 +148,8 @@ interface RepoScan {
148
148
  mtimes: Map<string, number>;
149
149
  capped: boolean;
150
150
  excluded: number;
151
+ contentUnchanged: boolean;
152
+ cacheDirty: boolean;
151
153
  }
152
154
  interface ScanOptions {
153
155
  include?: string[];
@@ -166,6 +168,7 @@ interface ScanOptions {
166
168
  mtimeMs?: number;
167
169
  }>;
168
170
  fullHash?: boolean;
171
+ precomputedWalk?: WalkResult;
169
172
  }
170
173
  declare function scanRepo(root: string, opts?: ScanOptions): RepoScan;
171
174
 
@@ -218,8 +221,22 @@ interface MarkdownInfo {
218
221
  declare function extractMarkdown(content: string): MarkdownInfo;
219
222
 
220
223
  declare function grammarKeyForExt(ext: string): string | undefined;
224
+ type GrammarsTierName = "adjacent" | "env" | "cache" | "none";
225
+ interface GrammarsTier {
226
+ tier: GrammarsTierName;
227
+ dir?: string;
228
+ cacheDir: string;
229
+ }
230
+ declare function sharedGrammarsCacheDir(): string;
231
+ declare function resolveGrammarsTier(opts?: {
232
+ moduleDir?: string;
233
+ }): GrammarsTier;
234
+ declare function resolveGrammarsDir(opts?: {
235
+ moduleDir?: string;
236
+ }): string | undefined;
221
237
  declare function ensureGrammars(keys: Iterable<string>): Promise<void>;
222
238
  declare function allGrammarKeys(): string[];
239
+ declare function grammarKeysForExts(exts: Iterable<string>): string[];
223
240
  declare function grammarReady(key: string): boolean;
224
241
 
225
242
  interface AstResult {
@@ -238,6 +255,17 @@ declare function extractAst(rel: string, ext: string, content: string, opts?: {
238
255
  maxCalls?: number;
239
256
  }): AstResult | undefined;
240
257
 
258
+ declare const DEFAULT_GRAMMARS_URL = "https://github.com/maxgfr/codeindex/releases/download/v2.14.0/grammars-2.14.0.tar.gz";
259
+ interface GrammarsPullTarget {
260
+ url: string;
261
+ sha256Url?: string;
262
+ }
263
+ declare function resolveGrammarsPullTarget(): GrammarsPullTarget;
264
+ declare function fetchGrammarsTarball(url: string, expectedSha256?: string): Promise<Uint8Array>;
265
+ declare function fetchExpectedSha256(url: string): Promise<string>;
266
+ declare function extractTarInto(rawTar: Uint8Array, destDir: string): string[];
267
+ declare function extractGrammarsTarball(bytes: Uint8Array, destDir: string): string[];
268
+
241
269
  type Resolution = {
242
270
  kind: "resolved";
243
271
  target: string;
@@ -449,6 +477,7 @@ interface IndexArtifacts {
449
477
  symbols: SymbolIndex;
450
478
  }
451
479
  declare function buildIndexArtifacts(repo: string, opts?: BuildIndexOptions): IndexArtifacts;
480
+ declare function buildArtifactsFromScan(scan: RepoScan, opts?: BuildIndexOptions): IndexArtifacts;
452
481
 
453
482
  declare function headCommit(dir: string): string | undefined;
454
483
  interface DiffFile {
@@ -679,9 +708,15 @@ interface MermaidOptions {
679
708
  }
680
709
  declare function renderMermaid(graph: Graph, opts?: MermaidOptions): string;
681
710
 
682
- declare function runMcpServer(): Promise<void>;
711
+ interface McpServerOptions {
712
+ serverInfo?: {
713
+ name?: string;
714
+ version?: string;
715
+ };
716
+ }
717
+ declare function runMcpServer(opts?: McpServerOptions): Promise<void>;
683
718
 
684
- declare function sha1(s: string): string;
719
+ declare function sha1(s: string | Uint8Array): string;
685
720
  declare function shortHash(s: string, n?: number): string;
686
721
 
687
722
  declare function byStr(a: string, b: string): number;
@@ -712,4 +747,4 @@ declare function rrf<T>(lists: T[][], keyOf: (item: T) => string, k?: number): M
712
747
 
713
748
  declare function runCli(argv: string[]): Promise<void>;
714
749
 
715
- export { type ArchRule, type BuildIndexOptions, type BuiltinRule, type CallerEntry, type CallerIndex, type CallerIndexOptions, type CallerSite, type ChangeCoupling, type CodeInfo, type CodeSymbol, type CouplingOptions, DEFAULT_MAX_FILES, type DeadSymbol, type DiffFile, type DiffSpec, EMBED_VERSION, ENGINE_VERSION, EXTRACTOR_VERSION, type Edge, type EdgeKind, type EditResult, type EmbedEndpointOptions, type EmbedPullTarget, type EmbeddingIndex, type EmbeddingRecord, type EmbeddingUnit, type FileCategory, type FileKind, type FileNode, type FileRecord, type FindSymbolOptions, type ForbiddenEdgeRule, type Graph, type GrepOptions, type Hotspot, type Hunk, type IgnoreRule, type IndexArtifacts, MARKDOWN_EXT, type MarkdownInfo, type MermaidOptions, type ModuleInfo, type ModuleNode, type RawCallerIndex, type RawCallerSite, type RawRef, type RenderScipOptions, type RepoMapOptions, type RepoScan, type Resolution, type ResolveContext, type RiskHotspot, type RuleSeverity, type RuleViolation, SCHEMA_VERSION, type ScanOptions, type SearchHit, type SearchOptions, type SearchResult, type SemanticSearchOptions, type SemanticSearchResult, type ShResult, type StaticEmbedModel, type SurpriseEdge, type SymbolComplexity, type SymbolIndex, type SymbolMatch, type SymbolReferences, type TestMap, type Tier, type WalkOptions, type WalkResult, type WalkedFile, type WorkspaceInfo, type WorkspaceKind, type WorkspacePackage, allGrammarKeys, applyCentrality, basicTokenize, betweennessOf, buildCallerIndex, buildEmbeddingIndex, buildEndpointIndex, buildGraph, buildIndexArtifacts, buildModules, buildRawCallerIndex, buildResolveContext, buildSymbolIndex, byKey, byStr, categorize, changeCoupling, changedSince, checkRules, classify, clip, clipInline, communityOf, compileGlobs, complexityOfSource, computeImportPairs, computeSurprises, computeSymbolRefs, computeTestMap, deleteMemory, deserializeEmbeddings, detectCommunities, detectWorkspaces, diffFiles, diffHunks, embedEndpointUrl, embedViaEndpoint, embeddingUnits, enclosingSymbol, encode, encodeQueryViaEndpoint, ensureGrammars, escapeRegExp, extToLang, extractAst, extractCode, extractMarkdown, extractSymbols, findDeadCode, findReferences, findSymbol, foldText, gitChurn, grammarKeyForExt, grammarReady, grepRepo, hasEmbedModel, have, headCommit, healthzUrl, insertAfterSymbol, insertBeforeSymbol, intDot, isCode, isDoc, isGitWorktree, isIgnored, isSurprising, isTestFile, isTestPath, keywords, languageOf, listMemories, loadEmbedModel, pagerankOf, parseGitignore, parseRules, probeEndpoint, quantize, rankHotspots, rankedKeywords, readMemory, readText, renderGraphJson, renderMermaid, renderRepoMap, renderScip, renderSymbolsJson, replaceSymbolBody, resolveBaseRef, resolveCallEdges, resolveDocLink, resolveEmbedEndpoint, resolveEmbedModelDir, resolveEmbedPullUrl, resolveImport, resolveUniqueSymbol, riskHotspots, roundHalfToEven, rrf, runCli, runMcpServer, scanRepo, searchIndex, searchSemantic, serializeEmbeddings, sh, sha1, shortHash, slugify, subtokens, symbolComplexity, symbolsOverview, testsForModule, tierForPath, tokenize, uniqueSymbolDefs, untestedModules, untrackedFiles, walk, wordpiece, writeMemory };
750
+ export { type ArchRule, type BuildIndexOptions, type BuiltinRule, type CallerEntry, type CallerIndex, type CallerIndexOptions, type CallerSite, type ChangeCoupling, type CodeInfo, type CodeSymbol, type CouplingOptions, DEFAULT_GRAMMARS_URL, DEFAULT_MAX_FILES, type DeadSymbol, type DiffFile, type DiffSpec, EMBED_VERSION, ENGINE_VERSION, EXTRACTOR_VERSION, type Edge, type EdgeKind, type EditResult, type EmbedEndpointOptions, type EmbedPullTarget, type EmbeddingIndex, type EmbeddingRecord, type EmbeddingUnit, type FileCategory, type FileKind, type FileNode, type FileRecord, type FindSymbolOptions, type ForbiddenEdgeRule, type GrammarsPullTarget, type GrammarsTier, type GrammarsTierName, type Graph, type GrepOptions, type Hotspot, type Hunk, type IgnoreRule, type IndexArtifacts, MARKDOWN_EXT, type MarkdownInfo, type McpServerOptions, type MermaidOptions, type ModuleInfo, type ModuleNode, type RawCallerIndex, type RawCallerSite, type RawRef, type RenderScipOptions, type RepoMapOptions, type RepoScan, type Resolution, type ResolveContext, type RiskHotspot, type RuleSeverity, type RuleViolation, SCHEMA_VERSION, type ScanOptions, type SearchHit, type SearchOptions, type SearchResult, type SemanticSearchOptions, type SemanticSearchResult, type ShResult, type StaticEmbedModel, type SurpriseEdge, type SymbolComplexity, type SymbolIndex, type SymbolMatch, type SymbolReferences, type TestMap, type Tier, type WalkOptions, type WalkResult, type WalkedFile, type WorkspaceInfo, type WorkspaceKind, type WorkspacePackage, allGrammarKeys, applyCentrality, basicTokenize, betweennessOf, buildArtifactsFromScan, buildCallerIndex, buildEmbeddingIndex, buildEndpointIndex, buildGraph, buildIndexArtifacts, buildModules, buildRawCallerIndex, buildResolveContext, buildSymbolIndex, byKey, byStr, categorize, changeCoupling, changedSince, checkRules, classify, clip, clipInline, communityOf, compileGlobs, complexityOfSource, computeImportPairs, computeSurprises, computeSymbolRefs, computeTestMap, deleteMemory, deserializeEmbeddings, detectCommunities, detectWorkspaces, diffFiles, diffHunks, embedEndpointUrl, embedViaEndpoint, embeddingUnits, enclosingSymbol, encode, encodeQueryViaEndpoint, ensureGrammars, escapeRegExp, extToLang, extractAst, extractCode, extractGrammarsTarball, extractMarkdown, extractSymbols, extractTarInto, fetchExpectedSha256, fetchGrammarsTarball, findDeadCode, findReferences, findSymbol, foldText, gitChurn, grammarKeyForExt, grammarKeysForExts, grammarReady, grepRepo, hasEmbedModel, have, headCommit, healthzUrl, insertAfterSymbol, insertBeforeSymbol, intDot, isCode, isDoc, isGitWorktree, isIgnored, isSurprising, isTestFile, isTestPath, keywords, languageOf, listMemories, loadEmbedModel, pagerankOf, parseGitignore, parseRules, probeEndpoint, quantize, rankHotspots, rankedKeywords, readMemory, readText, renderGraphJson, renderMermaid, renderRepoMap, renderScip, renderSymbolsJson, replaceSymbolBody, resolveBaseRef, resolveCallEdges, resolveDocLink, resolveEmbedEndpoint, resolveEmbedModelDir, resolveEmbedPullUrl, resolveGrammarsDir, resolveGrammarsPullTarget, resolveGrammarsTier, resolveImport, resolveUniqueSymbol, riskHotspots, roundHalfToEven, rrf, runCli, runMcpServer, scanRepo, searchIndex, searchSemantic, serializeEmbeddings, sh, sha1, sharedGrammarsCacheDir, shortHash, slugify, subtokens, symbolComplexity, symbolsOverview, testsForModule, tierForPath, tokenize, uniqueSymbolDefs, untestedModules, untrackedFiles, walk, wordpiece, writeMemory };