@maxgfr/codeindex 2.11.1 → 2.13.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/src/types.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Single source of truth for the engine version the bundle reports. Kept in
2
2
  // lockstep with package.json by the release pipeline. Do not edit by hand
3
3
  // outside a release.
4
- export const ENGINE_VERSION = "2.11.1";
4
+ export const ENGINE_VERSION = "2.13.0";
5
5
 
6
6
  // Bumped whenever the on-disk artifact shape changes, so a consumer can reject
7
7
  // an index written by an incompatible engine instead of misreading it. The
@@ -30,9 +30,18 @@ export const SCHEMA_VERSION = 4;
30
30
  // "reexport" when it resolves in-file. v8 fixes the C/C++ regex tier
31
31
  // reporting a function DEFINITION as a call to itself (`void load(void) {`
32
32
  // yielding a spurious call `load@<defline>`, found during the ultrasec
33
- // consumer migration) by excluding call candidates whose name+line match one
34
- // of the file's own extracted symbols.
35
- export const EXTRACTOR_VERSION = 8;
33
+ // consumer migration) by excluding, from call candidates, only the
34
+ // definition's own token on its definition line — not every occurrence of
35
+ // that name+line pair, which would also drop genuine same-line calls (dense
36
+ // one-liners packing several definitions, one-line recursion); v9 makes a
37
+ // resolved export-alias symbol also cite the original declaration's own line
38
+ // (and endLine, when the AST tier populated one) instead of the export
39
+ // statement's line — a citation-precision fix (issue #9) for consumers
40
+ // (ultradoc) that use file:line as evidence; v10 stops the regex tier
41
+ // emitting a spurious exported class symbol named "extends" for
42
+ // `export default class extends Base {}` (issue #11) — the file-stem
43
+ // default symbol is unchanged.
44
+ export const EXTRACTOR_VERSION = 10;
36
45
 
37
46
  // How a file is classified. `code` gets symbol/import extraction; `doc` gets
38
47
  // link/heading extraction; the rest are catalogued but not deeply parsed.
package/src/walk.ts CHANGED
@@ -4,12 +4,15 @@ import { parseGitignore, isIgnored, type IgnoreRule } from "./ignore.js";
4
4
 
5
5
  // Directories that never carry signal for a documentation/code question and
6
6
  // would bloat the index (dependencies, build output, VCS internals, caches).
7
+ // .codeindex is the engine's OWN output (index artifacts, pulled models, MCP
8
+ // memories) — indexing it would feed memories into search and churn the scan
9
+ // fingerprint on every write_memory (issue #12).
7
10
  // Exported so grep.ts can align ripgrep's universe with the walker's.
8
11
  export const IGNORE_DIRS = new Set([
9
12
  ".git", "node_modules", ".pnpm", "bower_components", "vendor", "dist", "build", "out",
10
13
  "target", ".next", ".nuxt", ".svelte-kit", ".turbo", "coverage", "__pycache__", ".venv",
11
14
  "venv", ".tox", ".mypy_cache", ".pytest_cache", ".gradle", ".idea", ".vscode", ".cache",
12
- "tmp", ".ultraindex", "Pods", "DerivedData", ".terraform", "elm-stuff", ".dart_tool",
15
+ "tmp", ".ultraindex", ".codeindex", "Pods", "DerivedData", ".terraform", "elm-stuff", ".dart_tool",
13
16
  ]);
14
17
 
15
18
  // Lockfiles: huge, machine-generated, and pure noise for a code/docs question —
@@ -36,6 +39,13 @@ export interface WalkOptions {
36
39
  // semantics — see ignore.ts). Default TRUE: an ignored file is noise for
37
40
  // every consumer; pass false to index generated/ignored trees deliberately.
38
41
  gitignore?: boolean;
42
+ // Directory names to skip, REPLACING the default set entirely (not merging
43
+ // with it). IGNORE_DIRS is a public export, so consumers compose
44
+ // `[...IGNORE_DIRS, "extra"]` — or filter it — themselves; replace is the
45
+ // simplest contract. Deliberate scope boundary: grep.ts (the ripgrep
46
+ // universe) and the MCP server keep the DEFAULT set — recall consumers
47
+ // (e.g. ultrasec) consume scan/extract, not grep.
48
+ ignoreDirs?: string[];
39
49
  }
40
50
 
41
51
  export interface WalkedFile {
@@ -65,6 +75,9 @@ export function walk(root: string, opts: WalkOptions = {}): WalkResult {
65
75
  const maxFileBytes = opts.maxFileBytes ?? 1024 * 1024;
66
76
  const maxFiles = opts.maxFiles ?? DEFAULT_MAX_FILES;
67
77
  const useGitignore = opts.gitignore !== false;
78
+ // Effective ignored-directory set, built once: the caller's replacement when
79
+ // given (see WalkOptions.ignoreDirs — replace, never merge), else the default.
80
+ const ignoreDirs = opts.ignoreDirs ? new Set(opts.ignoreDirs) : IGNORE_DIRS;
68
81
  const out: WalkedFile[] = [];
69
82
  let capped = false;
70
83
  let excluded = 0;
@@ -125,7 +138,7 @@ export function walk(root: string, opts: WalkOptions = {}): WalkResult {
125
138
  continue;
126
139
  }
127
140
  if (st.isDirectory()) {
128
- if (IGNORE_DIRS.has(name)) continue;
141
+ if (ignoreDirs.has(name)) continue;
129
142
  // An in-repo DIRECTORY symlink is skipped entirely: its target is (or
130
143
  // will be) walked under its canonical name, and letting both paths race
131
144
  // through the cycle guard would keep whichever readdir served first —