local-codebase-indexer 0.4.0__tar.gz → 0.6.0__tar.gz

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.
Files changed (77) hide show
  1. local_codebase_indexer-0.6.0/.claude-plugin/marketplace.json +14 -0
  2. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/AGENTS.md +22 -4
  3. local_codebase_indexer-0.6.0/CHANGELOG.md +29 -0
  4. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/CLAUDE.md +12 -2
  5. local_codebase_indexer-0.6.0/MANIFEST.in +9 -0
  6. {local_codebase_indexer-0.4.0/local_codebase_indexer.egg-info → local_codebase_indexer-0.6.0}/PKG-INFO +42 -7
  7. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/README.md +40 -5
  8. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/README.zh-CN.md +32 -5
  9. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/README.zh-TW.md +36 -5
  10. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/TODO.md +5 -1
  11. local_codebase_indexer-0.6.0/bin/indexer +11 -0
  12. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/__init__.py +1 -1
  13. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/cli.py +58 -11
  14. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/core.py +150 -12
  15. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/csdata.py +3 -1
  16. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/dataflow.py +31 -21
  17. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/db.py +10 -2
  18. local_codebase_indexer-0.6.0/local_codebase_indexer/impact.py +178 -0
  19. local_codebase_indexer-0.6.0/local_codebase_indexer/mcp_server.py +196 -0
  20. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/query.py +242 -38
  21. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/scanner.py +88 -10
  22. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/synonyms.py +18 -4
  23. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0/local_codebase_indexer.egg-info}/PKG-INFO +42 -7
  24. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer.egg-info/SOURCES.txt +8 -1
  25. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer.egg-info/requires.txt +1 -1
  26. local_codebase_indexer-0.6.0/plugins/local-codebase-indexer/.claude-plugin/plugin.json +8 -0
  27. local_codebase_indexer-0.6.0/plugins/local-codebase-indexer/.mcp.json +8 -0
  28. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/pyproject.toml +1 -1
  29. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/requirements.txt +1 -1
  30. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/server.json +2 -2
  31. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/tests/test_dataaccess.py +74 -0
  32. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/tests/test_indexer.py +56 -2
  33. local_codebase_indexer-0.6.0/tests/test_reliability.py +265 -0
  34. local_codebase_indexer-0.4.0/MANIFEST.in +0 -5
  35. local_codebase_indexer-0.4.0/local_codebase_indexer/mcp_server.py +0 -136
  36. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/README.md +0 -0
  37. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/baseline.json +0 -0
  38. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Auth/LoginService.cs +0 -0
  39. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Controllers/LotController.cs +0 -0
  40. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Controllers/ScrapController.cs +0 -0
  41. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Data/MesDbContext.cs +0 -0
  42. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Legacy/frmChangeLine.frm +0 -0
  43. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Models/DrillBreakEvent.cs +0 -0
  44. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Models/Lot.cs +0 -0
  45. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Models/ScrapRecord.cs +0 -0
  46. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Printing/LabelPrinter.cs +0 -0
  47. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Repositories/LotRepository.cs +0 -0
  48. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Repositories/ScrapRepository.cs +0 -0
  49. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Services/IScrapService.cs +0 -0
  50. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Services/InspectionService.cs +0 -0
  51. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Services/LotService.cs +0 -0
  52. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Services/ScrapService.cs +0 -0
  53. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Sql/MES_Lot.sql +0 -0
  54. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Sql/usp_Inspection_Report.sql +0 -0
  55. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Sql/usp_Lot_UpdateStatus.sql +0 -0
  56. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Sql/usp_Scrap_Insert.sql +0 -0
  57. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Utils/DateRangeHelper.cs +0 -0
  58. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Utils/PartNumberDecoder.cs +0 -0
  59. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Web/scrapForm.ts +0 -0
  60. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/Web.config +0 -0
  61. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/corpus/tools/export_report.py +0 -0
  62. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/queries_stdlib.json +0 -0
  63. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/queries_synthetic.json +0 -0
  64. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/benchmarks/run_benchmark.py +0 -0
  65. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/index.md +0 -0
  66. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/llms.txt +0 -0
  67. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/__main__.py +0 -0
  68. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/callgraph.py +0 -0
  69. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/cscalls.py +0 -0
  70. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/embedder.py +0 -0
  71. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/langparse.py +0 -0
  72. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer/sqlaccess.py +0 -0
  73. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer.egg-info/dependency_links.txt +0 -0
  74. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer.egg-info/entry_points.txt +0 -0
  75. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/local_codebase_indexer.egg-info/top_level.txt +0 -0
  76. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/setup.cfg +0 -0
  77. {local_codebase_indexer-0.4.0 → local_codebase_indexer-0.6.0}/tests/test_onnx_plumbing.py +0 -0
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "local-codebase-indexer",
3
+ "description": "Local code index for AI coding assistants: search, call relations and SQL table/procedure access",
4
+ "owner": {
5
+ "name": "sfy257000"
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "local-codebase-indexer",
10
+ "source": "./plugins/local-codebase-indexer",
11
+ "description": "MCP server that indexes your project locally (SQLite, no cloud) for code search, callers and SQL data access"
12
+ }
13
+ ]
14
+ }
@@ -18,12 +18,22 @@ Check: `local-codebase-indexer --help`. No API keys or network access are needed
18
18
  local-codebase-indexer --root <project> index # build / refresh the index
19
19
  local-codebase-indexer --root <project> search "natural language or identifier" --limit 5
20
20
  local-codebase-indexer --root <project> relations <SymbolName> --direction both
21
- local-codebase-indexer --root <project> data-access <TableOrProcedure> # who reads / writes / executes it
21
+ local-codebase-indexer --root <project> data-access <TableOrProcedure> # who reads / writes / executes it, which programs and pages reach it
22
+ local-codebase-indexer --root <project> impact [base] # what a diff touches: symbols, tables, programs, pages
22
23
  local-codebase-indexer --root <project> context <file> --lines 120 --padding 15
23
24
  local-codebase-indexer --root <project> status # is the index fresh?
24
25
  ```
25
26
 
26
- Put `--json` before the subcommand for JSON output. The index lives in `<project>/.ai_context/` (git-ignored automatically).
27
+ Put `--json` before or after the subcommand for JSON output. The index lives in `<project>/.ai_context/` (git-ignored automatically).
28
+
29
+ ## Install as a Claude Code plugin
30
+
31
+ ```text
32
+ /plugin marketplace add sfy257000/local-codebase-indexer
33
+ /plugin install local-codebase-indexer@local-codebase-indexer
34
+ ```
35
+
36
+ Needs `uv` (`pip install uv`). Then restart Claude Code.
27
37
 
28
38
  ## Register as an MCP server (Claude Code)
29
39
 
@@ -31,7 +41,7 @@ Put `--json` before the subcommand for JSON output. The index lives in `<project
31
41
  claude mcp add local-indexer -- local-codebase-indexer --root <project> serve
32
42
  ```
33
43
 
34
- Tools: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_get_optimized_context`, `codebase_get_data_access`, `codebase_index_status`.
44
+ Tools: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_get_optimized_context`, `codebase_get_data_access`, `codebase_impact_analysis`, `codebase_index_status`, `codebase_index_doctor`.
35
45
 
36
46
  ## Reading the results
37
47
 
@@ -41,8 +51,16 @@ Tools: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_ge
41
51
  ## Working on this repo itself
42
52
 
43
53
  ```bash
44
- pip install -e ".[dev,onnx]" && python -m pytest -q
54
+ pip install -e ".[dev,onnx]" onnx && python -m pytest -q
45
55
  python benchmarks/run_benchmark.py --compare benchmarks/baseline.json
46
56
  ```
47
57
 
48
58
  The package is `local_codebase_indexer/`. See `README.md` for design notes and known limits, `TODO.md` for planned work.
59
+
60
+ ## Diagnostics and bounded results (0.6.0)
61
+
62
+ - `local-codebase-indexer --root <project> doctor --path <file>` explains exclusions.
63
+ - `search <query> --file '*Repository*.cs' --language csharp --limit 5 --offset 5` filters before ranking. Follow `pagination.next_offset` in JSON.
64
+ - `data-access <table> --confidence confirmed --limit 20 --offset 20` pages each section independently. JSON has section totals and next offsets; `--full` really lists every entry.
65
+ - `impact` includes historical accesses and callers for removed code. `snapshot=before` line numbers refer to the base revision. Historical indexes are cached in `.ai_context/impact/`; deleting that cache is safe.
66
+ - A missing root is an error; an empty or failed indexing run returns exit status 3. `--json` and `--root` work before or after the subcommand.
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ ## 0.6.0
4
+
5
+ ### Fixed
6
+
7
+ - Impact analysis reports all methods in a changed hunk and retains removed methods/files, historical SQL accesses and callers. Current and historical line numbers are labeled separately.
8
+ - Malformed JSON-RPC messages and invalid tool arguments return errors without terminating the MCP session.
9
+ - Nested `.gitignore` negations correctly override parent file patterns.
10
+ - Missing project roots fail before creating directories; empty or partially failed indexing returns exit status 3 with diagnostics.
11
+ - Search strictly honors its result limit, including queries routed to SQL data access.
12
+ - Generated packaging metadata is no longer tracked; source distributions exclude generated benchmark indexes.
13
+ - CI explicitly installs and imports `onnx`, `onnxruntime` and `tokenizers`, so ONNX plumbing tests cannot silently skip for missing dependencies.
14
+
15
+ ### Added
16
+
17
+ - `doctor --path <file>` and the `codebase_index_doctor` MCP tool explain indexing exclusions and report index health.
18
+ - Search file/language filters, offset pagination, similar-name suggestions and actionable no-result hints.
19
+ - Data-access confidence filtering, per-section pagination, totals and next offsets. `--full` / `detail=true` no longer silently truncates at 40 displayed or 200 queried entries.
20
+ - General English/Chinese paraphrases for common operations and password terminology. Keyword expansion is separated from vector expansion to preserve existing rankings.
21
+ - Cached historical impact indexes under `.ai_context/impact/`, reusable per base revision and package/index version.
22
+ - `--json` and `--root` also work after the subcommand.
23
+
24
+ ### Validation and limits
25
+
26
+ - Full tests include ONNX plumbing and regression coverage for deleted code, multi-method hunks, Chinese paths, cached historical indexes, invalid MCP messages, ignore negations, filters and pagination beyond 200 entries.
27
+ - Python 3.12 comparison against 0.5.0, with unchanged benchmark queries and baseline: synthetic Recall@5 0.893 → 0.917; noisy synthetic 0.857 → 0.881; synonym Recall@5 0.30 → 0.50 in both synthetic suites. Standard-library retrieval metrics are unchanged. These small author-written suites do not establish general semantic understanding.
28
+ - First-time historical impact analysis indexes the Git archive and may take time on large projects. External `extra_roots` cannot be reconstructed historically. Existing call-graph and dynamic-SQL limitations remain.
29
+ - Pagination assumes the index remains unchanged between requests.
@@ -18,20 +18,30 @@ Check: `local-codebase-indexer --help`. No API keys or network access are needed
18
18
  local-codebase-indexer --root <project> index # build / refresh the index
19
19
  local-codebase-indexer --root <project> search "natural language or identifier" --limit 5
20
20
  local-codebase-indexer --root <project> relations <SymbolName> --direction both
21
- local-codebase-indexer --root <project> data-access <TableOrProcedure> # who reads / writes / executes it
21
+ local-codebase-indexer --root <project> data-access <TableOrProcedure> # who reads / writes / executes it, which programs and pages reach it
22
+ local-codebase-indexer --root <project> impact [base] # what a diff touches: symbols, tables, programs, pages
22
23
  local-codebase-indexer --root <project> context <file> --lines 120 --padding 15
23
24
  local-codebase-indexer --root <project> status # is the index fresh?
24
25
  ```
25
26
 
26
27
  Put `--json` before the subcommand for JSON output. The index lives in `<project>/.ai_context/` (git-ignored automatically).
27
28
 
29
+ ## Install as a Claude Code plugin
30
+
31
+ ```text
32
+ /plugin marketplace add sfy257000/local-codebase-indexer
33
+ /plugin install local-codebase-indexer@local-codebase-indexer
34
+ ```
35
+
36
+ Needs `uv` (`pip install uv`). Then restart Claude Code.
37
+
28
38
  ## Register as an MCP server (Claude Code)
29
39
 
30
40
  ```bash
31
41
  claude mcp add local-indexer -- local-codebase-indexer --root <project> serve
32
42
  ```
33
43
 
34
- Tools: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_get_optimized_context`, `codebase_get_data_access`, `codebase_index_status`.
44
+ Tools: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_get_optimized_context`, `codebase_get_data_access`, `codebase_impact_analysis`, `codebase_index_status`.
35
45
 
36
46
  ## Reading the results
37
47
 
@@ -0,0 +1,9 @@
1
+ include server.json CHANGELOG.md README*.md TODO.md AGENTS.md CLAUDE.md llms.txt index.md requirements.txt
2
+ graft tests
3
+ graft plugins
4
+ graft .claude-plugin
5
+ graft benchmarks
6
+ prune benchmarks/__pycache__
7
+ global-exclude __pycache__ *.pyc
8
+ prune benchmarks/corpus/.ai_context
9
+ include bin/indexer
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: local-codebase-indexer
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: Local codebase indexer and context provider for AI coding assistants: MCP server and CLI with SQL data-access and C# call relations. No cloud, no server.
5
5
  Author: sfy257000
6
6
  Project-URL: Homepage, https://github.com/sfy257000/local-codebase-indexer
@@ -26,7 +26,7 @@ Requires-Dist: tree-sitter-python
26
26
  Requires-Dist: tree-sitter-javascript
27
27
  Requires-Dist: tree-sitter-typescript
28
28
  Requires-Dist: numpy
29
- Requires-Dist: pathspec
29
+ Requires-Dist: pathspec>=0.12.1
30
30
  Provides-Extra: onnx
31
31
  Requires-Dist: onnxruntime; extra == "onnx"
32
32
  Requires-Dist: tokenizers; extra == "onnx"
@@ -54,6 +54,15 @@ From a clone: `pip install -e .` (the `bin/indexer` launcher still works in a ch
54
54
 
55
55
  If you are an AI coding assistant asked to set this up: run `pip install local-codebase-indexer`, then `claude mcp add local-indexer -- local-codebase-indexer --root <project> serve` (Claude Code) or use the CLI commands below. Full instructions are in [`AGENTS.md`](AGENTS.md).
56
56
 
57
+ ### As a Claude Code plugin
58
+
59
+ ```text
60
+ /plugin marketplace add sfy257000/local-codebase-indexer
61
+ /plugin install local-codebase-indexer@local-codebase-indexer
62
+ ```
63
+
64
+ This registers the MCP server for the project you open (it runs `uvx local-codebase-indexer --root <project> serve`, so [uv](https://docs.astral.sh/uv/) must be installed: `pip install uv`). Restart Claude Code afterwards.
65
+
57
66
  ## Usage (CLI)
58
67
 
59
68
  ```bash
@@ -61,13 +70,14 @@ local-codebase-indexer --root <project> index # build / in
61
70
  local-codebase-indexer search "database mapping for LotNo" --limit 5
62
71
  local-codebase-indexer relations IExistOpenHandleService --direction both # upstream | downstream | both
63
72
  local-codebase-indexer context Services/LotService.cs --lines 120 --padding 15 # alias: slice
64
- local-codebase-indexer data-access MES_Lot # who reads / writes / executes a table or procedure; what a procedure touches
73
+ local-codebase-indexer data-access MES_Lot # who reads / writes / executes a table or procedure; what a procedure touches (--full: every entry)
74
+ local-codebase-indexer impact main...HEAD # symbols, tables, programs and pages a change touches (no argument: uncommitted work)
65
75
  local-codebase-indexer stats
66
76
  local-codebase-indexer status # is the index fresh? failed files, git commit, consistency checks
67
77
  ```
68
78
 
69
79
  - Without `--root` the current directory is used; `INDEXER_ROOT` also works.
70
- - Put `--json` before the subcommand to get JSON output.
80
+ - Put `--json` before or after the subcommand to get JSON output.
71
81
  - `search`, `relations` and `context` run an incremental refresh first (mtime check, then md5 only when mtime changed).
72
82
  - The tool names from the spec also work as subcommands: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_get_optimized_context` (options `--query`, `--symbol_name --relation_direction`, `--file_path --focus_lines --padding_lines`).
73
83
 
@@ -78,7 +88,28 @@ claude mcp add local-indexer -- local-codebase-indexer --root /path/to/project s
78
88
  # without installing: claude mcp add local-indexer -- uvx local-codebase-indexer --root /path/to/project serve
79
89
  ```
80
90
 
81
- `serve` speaks JSON-RPC (MCP) over stdio and exposes five tools: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_get_optimized_context`, `codebase_get_data_access`, `codebase_index_status`.
91
+ `serve` speaks JSON-RPC (MCP) over stdio and exposes seven tools: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_get_optimized_context`, `codebase_get_data_access`, `codebase_impact_analysis`, `codebase_index_status`, `codebase_index_doctor`. A long-lived server re-checks the index before a query when the last check is older than 15 s (a no-op check takes about a second on a few thousand files). `codebase_get_data_access` returns a summary (5 entries per section, every program) unless `detail` is set; `codebase_semantic_search` lists dependency-graph neighbours only with `related`.
92
+
93
+ ## Diagnose missing code and control output
94
+
95
+ ```bash
96
+ local-codebase-indexer --root <project> doctor
97
+ local-codebase-indexer --root <project> doctor --path src/Service.cs
98
+ local-codebase-indexer --root <project> search "retrieve invoice" --file '*.py' --language python --limit 5
99
+ local-codebase-indexer --root <project> search "retrieve invoice" --file '*.py' --language python --limit 5 --offset 5
100
+ local-codebase-indexer --root <project> data-access MES_Lot --confidence confirmed --limit 20 --offset 0
101
+ local-codebase-indexer --root <project> data-access MES_Lot --full
102
+ ```
103
+
104
+ `doctor` reports supported text files, ignore rules, excluded directories, unsupported extensions, files over 5 MB, binary files and index health. `--path` explains a specific file, including a parent directory that prevents indexing. Directory counts are counts of excluded directories, not all the files hidden inside them. Nested `.gitignore` negations override parent file patterns; an excluded parent directory must first be re-included, just as with Git. Built-in excluded directories such as `node_modules` remain excluded.
105
+
106
+ Search filters apply **before** ranking. `--file` is a case-sensitive glob over the complete project-relative path (`*` also matches `/`); languages are `csharp`, `python`, `javascript`, `typescript`, `tsx`, and `text`. The JSON `pagination` object has `has_more` and `next_offset`; keep the same query and filters for subsequent pages. Pages assume the index remains unchanged. No-result responses suggest similar symbols where available and explain useful next steps. General verb paraphrases expand keyword/symbol matching without diluting vector queries; project-specific jargon still belongs in `.ai_context/synonyms.json`.
107
+
108
+ Data-access `--confidence` selects an exact level (`confirmed`, `probable`, or `uncertain`). `--limit` and `--offset` apply independently to each section, including programs and procedure accesses. JSON includes `pagination.sections` with totals and next offsets. MCP accepts the same `limit`, `offset`, and `confidence` fields; search uses `file_pattern` and `language`. `--full` / MCP `detail=true` lists all entries when no explicit page size is supplied. The old 40-entry display and 200-entry query caps have been removed.
109
+
110
+ `impact` includes both current symbols and affected symbols/accesses/callers from the base revision, so deleting a method or file remains visible. `snapshot: before` means its line numbers refer to the base revision, not the current file. The first request for a base revision builds a temporary historical index, which can take time on a large repository; a complete baseline is cached under `.ai_context/impact/` for reuse. Remove this directory to reclaim space. Historical analysis covers files in the Git archive; external `extra_roots` are not reconstructed. Static call-graph confidence and known language limitations still apply.
111
+
112
+ A nonexistent `--root` is rejected without creating it. `index` returns exit status 3 for an empty or partially failed run; use `doctor` and `status` to diagnose it. Invalid MCP inputs return an error while keeping the server available for the next request.
82
113
 
83
114
  ## Three-layer index
84
115
 
@@ -99,7 +130,7 @@ Encodings: UTF-8 first, then Big5, then cp1252. Files over 5MB are skipped. Root
99
130
 
100
131
  ## Data access (SQL)
101
132
 
102
- `data-access <table-or-procedure>` answers "what writes / reads / executes X". It is built from T-SQL (INSERT / UPDATE / DELETE / MERGE / TRUNCATE / SELECT INTO / FROM / JOIN / EXEC, with alias resolution; CTEs, temp tables and system objects excluded), from C# SQL strings (literals, `+`, interpolation, `string.Format`, consts, locals, `StringBuilder.Append` / `AppendLine` / `AppendFormat`) passed to Dapper, `SqlCommand` or EF `FromSql`, from stored-procedure names used with `CommandType.StoredProcedure`, from EF LINQ on `DbSet<T>` members (`ctx.Orders.Where(..)` / `.Add(..)` / `.Remove(..)`, `from o in ctx.Orders`; `probable`, since only the member name is matched) and from EF `ToTable` / `[Table]` mappings. A procedure's callers are indirect writers of the tables it writes (followed up to 4 hops). `programs` (USED BY PROGRAMS) follows confirmed / probable C# calls upward from those accessors to `*Controller` methods (up to 8 hops) (including from an implementation to the callers of the interface method it implements, for `foreach (var step in steps) step.Run()` pipelines) and groups them per controller file, with the Razor pages (`.cshtml`) whose `Url.Action("Action"[, "Controller"])` or AngularJS `ControllerPath + 'Action'` (controller from `$scope.Controller = 'X'`) targets those actions, so a table maps to the screens that touch it. A method that reads a DbSet and calls `SaveChanges` without an explicit `Add` / `Remove` may update tracked entities; it is listed as a possible (`uncertain`) writer. Each entry has a confidence; **dynamic SQL (`EXEC(@sql)`, `sp_executesql`, SQL built from unknown values) cannot be resolved and is listed separately as `uncertain`**, never mixed into the confirmed lists. Known gaps: `FROM a JOIN b ON ..., c` loses `c`, and a stored-procedure name passed to a non-database method is not seen.
133
+ `data-access <table-or-procedure>` answers "what writes / reads / executes X". It is built from T-SQL (INSERT / UPDATE / DELETE / MERGE / TRUNCATE / SELECT INTO / FROM / JOIN / EXEC, with alias resolution; CTEs, temp tables and system objects excluded), from C# SQL strings (literals, `+`, interpolation, `string.Format`, consts, locals, `StringBuilder.Append` / `AppendLine` / `AppendFormat`) passed to Dapper, `SqlCommand` or EF `FromSql`, from stored-procedure names used with `CommandType.StoredProcedure`, from EF LINQ on `DbSet<T>` members (`ctx.Orders.Where(..)` / `.Add(..)` / `.Remove(..)`, `from o in ctx.Orders`; `probable`, since only the member name is matched) and from EF `ToTable` / `[Table]` mappings. A procedure's callers are indirect writers of the tables it writes (followed up to 4 hops). `programs` (USED BY PROGRAMS) follows confirmed / probable C# calls upward from those accessors to `*Controller` methods (up to 8 hops) (including from an implementation to the callers of the interface method it implements, for `foreach (var step in steps) step.Run()` pipelines) and groups them per controller file, with the Razor pages (`.cshtml`) whose `Url.Action("Action"[, "Controller"])` or AngularJS `ControllerPath + 'Action'` (controller from `$scope.Controller = 'X'`) targets those actions, so a table maps to the screens that touch it. A method that reads a DbSet and calls `SaveChanges` without an explicit `Add` / `Remove` may update tracked entities; it is listed as a possible (`uncertain`) writer. Each entry has a confidence; **dynamic SQL (`EXEC(@sql)`, `sp_executesql`, SQL built from unknown values) cannot be resolved and is listed separately as `uncertain`**, never mixed into the confirmed lists. EF accesses are `confirmed` when the context variable (`using (var db = new X())`, a field or property, or `this`) is typed as a class that declares or inherits the DbSet, `probable` otherwise. Methods on the way up that have no confirmed / probable caller at all are listed under NO KNOWN CALLER: entry points such as API endpoints, jobs or `Main`, or calls the graph could not resolve. Known gaps: `FROM a JOIN b ON ..., c` loses `c`, and a stored-procedure name passed to a non-database method is not seen.
103
134
 
104
135
  Stored procedures that live only in the database can be exported to a folder outside the repo and listed in `.ai_context/extra_roots` (one folder per line, absolute or relative to the root); their files are indexed under their absolute paths.
105
136
 
@@ -109,9 +140,13 @@ Natural-language search routes questions such as "who modifies MES_ScrapRecord"
109
140
 
110
141
  Queries are expanded with a small synonym dictionary (`SP` / `預存程序` / `stored procedure` / `usp`, table, lot, scrap, ...; `local_codebase_indexer/synonyms.py`). Add or disable groups per project in `.ai_context/synonyms.json`: `{"groups": [["wpnlot", "在製批"]], "disable": ["sp"]}`. This helps abbreviations and Chinese/English terms, not free paraphrase.
111
142
 
143
+ The index also mines its own dictionary: Chinese bigrams in the comments right above a symbol are paired with the sub-words of its name (`/// 收帳` above `ReceiveLotAsync` gives 收帳 = receive). A pair is kept when at least 5 symbols support it, it covers at least 15% of the symbols commented with the bigram (smoothed) and the word is at least 15x likelier there than overall. On a 30k-chunk C# codebase this yields about 350 pairs (收帳 -> receive, 拆批 -> divide, 油墨 -> ink, 底片 -> film) and raised MRR on paraphrased queries from 0.57 to 0.64.
144
+
112
145
  ## Index health
113
146
 
114
- `status` (also the MCP tool `codebase_index_status`) reports whether the index can be trusted without refreshing it: `fresh`, `stale` (files changed or git HEAD moved since the last update), `degraded` (failed files or an inconsistent database) or `not_indexed`. A file that fails to parse is removed from the index, listed with its error, and retried on every update, so search never returns stale lines for it. `index --force` rebuilds everything.
147
+ `status` (also the MCP tool `codebase_index_status`) reports whether the index can be trusted without refreshing it: `fresh`, `stale` (files changed or git HEAD moved since the last update), `degraded` (failed files or an inconsistent database) or `not_indexed`. A file that fails to parse is removed from the index, listed with its error, and retried on every update, so search never returns stale lines for it. `index --force` rebuilds everything. Status also shows the running version and warns when the package's code changed on disk after the process started (restart the MCP server, i.e. open a new Claude Code session, to run it).
148
+
149
+ Speed (2.3k files, 30k chunks, hashing embedder): full build about 36 s into an empty database, a branch switch that rewrites 400 files about 10 s, a no-op check about 1 s. Each file is written inside a savepoint (atomic), and commits are batched every 500 files.
115
150
 
116
151
  ## Benchmark
117
152
 
@@ -19,6 +19,15 @@ From a clone: `pip install -e .` (the `bin/indexer` launcher still works in a ch
19
19
 
20
20
  If you are an AI coding assistant asked to set this up: run `pip install local-codebase-indexer`, then `claude mcp add local-indexer -- local-codebase-indexer --root <project> serve` (Claude Code) or use the CLI commands below. Full instructions are in [`AGENTS.md`](AGENTS.md).
21
21
 
22
+ ### As a Claude Code plugin
23
+
24
+ ```text
25
+ /plugin marketplace add sfy257000/local-codebase-indexer
26
+ /plugin install local-codebase-indexer@local-codebase-indexer
27
+ ```
28
+
29
+ This registers the MCP server for the project you open (it runs `uvx local-codebase-indexer --root <project> serve`, so [uv](https://docs.astral.sh/uv/) must be installed: `pip install uv`). Restart Claude Code afterwards.
30
+
22
31
  ## Usage (CLI)
23
32
 
24
33
  ```bash
@@ -26,13 +35,14 @@ local-codebase-indexer --root <project> index # build / in
26
35
  local-codebase-indexer search "database mapping for LotNo" --limit 5
27
36
  local-codebase-indexer relations IExistOpenHandleService --direction both # upstream | downstream | both
28
37
  local-codebase-indexer context Services/LotService.cs --lines 120 --padding 15 # alias: slice
29
- local-codebase-indexer data-access MES_Lot # who reads / writes / executes a table or procedure; what a procedure touches
38
+ local-codebase-indexer data-access MES_Lot # who reads / writes / executes a table or procedure; what a procedure touches (--full: every entry)
39
+ local-codebase-indexer impact main...HEAD # symbols, tables, programs and pages a change touches (no argument: uncommitted work)
30
40
  local-codebase-indexer stats
31
41
  local-codebase-indexer status # is the index fresh? failed files, git commit, consistency checks
32
42
  ```
33
43
 
34
44
  - Without `--root` the current directory is used; `INDEXER_ROOT` also works.
35
- - Put `--json` before the subcommand to get JSON output.
45
+ - Put `--json` before or after the subcommand to get JSON output.
36
46
  - `search`, `relations` and `context` run an incremental refresh first (mtime check, then md5 only when mtime changed).
37
47
  - The tool names from the spec also work as subcommands: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_get_optimized_context` (options `--query`, `--symbol_name --relation_direction`, `--file_path --focus_lines --padding_lines`).
38
48
 
@@ -43,7 +53,28 @@ claude mcp add local-indexer -- local-codebase-indexer --root /path/to/project s
43
53
  # without installing: claude mcp add local-indexer -- uvx local-codebase-indexer --root /path/to/project serve
44
54
  ```
45
55
 
46
- `serve` speaks JSON-RPC (MCP) over stdio and exposes five tools: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_get_optimized_context`, `codebase_get_data_access`, `codebase_index_status`.
56
+ `serve` speaks JSON-RPC (MCP) over stdio and exposes seven tools: `codebase_semantic_search`, `codebase_get_symbol_relations`, `codebase_get_optimized_context`, `codebase_get_data_access`, `codebase_impact_analysis`, `codebase_index_status`, `codebase_index_doctor`. A long-lived server re-checks the index before a query when the last check is older than 15 s (a no-op check takes about a second on a few thousand files). `codebase_get_data_access` returns a summary (5 entries per section, every program) unless `detail` is set; `codebase_semantic_search` lists dependency-graph neighbours only with `related`.
57
+
58
+ ## Diagnose missing code and control output
59
+
60
+ ```bash
61
+ local-codebase-indexer --root <project> doctor
62
+ local-codebase-indexer --root <project> doctor --path src/Service.cs
63
+ local-codebase-indexer --root <project> search "retrieve invoice" --file '*.py' --language python --limit 5
64
+ local-codebase-indexer --root <project> search "retrieve invoice" --file '*.py' --language python --limit 5 --offset 5
65
+ local-codebase-indexer --root <project> data-access MES_Lot --confidence confirmed --limit 20 --offset 0
66
+ local-codebase-indexer --root <project> data-access MES_Lot --full
67
+ ```
68
+
69
+ `doctor` reports supported text files, ignore rules, excluded directories, unsupported extensions, files over 5 MB, binary files and index health. `--path` explains a specific file, including a parent directory that prevents indexing. Directory counts are counts of excluded directories, not all the files hidden inside them. Nested `.gitignore` negations override parent file patterns; an excluded parent directory must first be re-included, just as with Git. Built-in excluded directories such as `node_modules` remain excluded.
70
+
71
+ Search filters apply **before** ranking. `--file` is a case-sensitive glob over the complete project-relative path (`*` also matches `/`); languages are `csharp`, `python`, `javascript`, `typescript`, `tsx`, and `text`. The JSON `pagination` object has `has_more` and `next_offset`; keep the same query and filters for subsequent pages. Pages assume the index remains unchanged. No-result responses suggest similar symbols where available and explain useful next steps. General verb paraphrases expand keyword/symbol matching without diluting vector queries; project-specific jargon still belongs in `.ai_context/synonyms.json`.
72
+
73
+ Data-access `--confidence` selects an exact level (`confirmed`, `probable`, or `uncertain`). `--limit` and `--offset` apply independently to each section, including programs and procedure accesses. JSON includes `pagination.sections` with totals and next offsets. MCP accepts the same `limit`, `offset`, and `confidence` fields; search uses `file_pattern` and `language`. `--full` / MCP `detail=true` lists all entries when no explicit page size is supplied. The old 40-entry display and 200-entry query caps have been removed.
74
+
75
+ `impact` includes both current symbols and affected symbols/accesses/callers from the base revision, so deleting a method or file remains visible. `snapshot: before` means its line numbers refer to the base revision, not the current file. The first request for a base revision builds a temporary historical index, which can take time on a large repository; a complete baseline is cached under `.ai_context/impact/` for reuse. Remove this directory to reclaim space. Historical analysis covers files in the Git archive; external `extra_roots` are not reconstructed. Static call-graph confidence and known language limitations still apply.
76
+
77
+ A nonexistent `--root` is rejected without creating it. `index` returns exit status 3 for an empty or partially failed run; use `doctor` and `status` to diagnose it. Invalid MCP inputs return an error while keeping the server available for the next request.
47
78
 
48
79
  ## Three-layer index
49
80
 
@@ -64,7 +95,7 @@ Encodings: UTF-8 first, then Big5, then cp1252. Files over 5MB are skipped. Root
64
95
 
65
96
  ## Data access (SQL)
66
97
 
67
- `data-access <table-or-procedure>` answers "what writes / reads / executes X". It is built from T-SQL (INSERT / UPDATE / DELETE / MERGE / TRUNCATE / SELECT INTO / FROM / JOIN / EXEC, with alias resolution; CTEs, temp tables and system objects excluded), from C# SQL strings (literals, `+`, interpolation, `string.Format`, consts, locals, `StringBuilder.Append` / `AppendLine` / `AppendFormat`) passed to Dapper, `SqlCommand` or EF `FromSql`, from stored-procedure names used with `CommandType.StoredProcedure`, from EF LINQ on `DbSet<T>` members (`ctx.Orders.Where(..)` / `.Add(..)` / `.Remove(..)`, `from o in ctx.Orders`; `probable`, since only the member name is matched) and from EF `ToTable` / `[Table]` mappings. A procedure's callers are indirect writers of the tables it writes (followed up to 4 hops). `programs` (USED BY PROGRAMS) follows confirmed / probable C# calls upward from those accessors to `*Controller` methods (up to 8 hops) (including from an implementation to the callers of the interface method it implements, for `foreach (var step in steps) step.Run()` pipelines) and groups them per controller file, with the Razor pages (`.cshtml`) whose `Url.Action("Action"[, "Controller"])` or AngularJS `ControllerPath + 'Action'` (controller from `$scope.Controller = 'X'`) targets those actions, so a table maps to the screens that touch it. A method that reads a DbSet and calls `SaveChanges` without an explicit `Add` / `Remove` may update tracked entities; it is listed as a possible (`uncertain`) writer. Each entry has a confidence; **dynamic SQL (`EXEC(@sql)`, `sp_executesql`, SQL built from unknown values) cannot be resolved and is listed separately as `uncertain`**, never mixed into the confirmed lists. Known gaps: `FROM a JOIN b ON ..., c` loses `c`, and a stored-procedure name passed to a non-database method is not seen.
98
+ `data-access <table-or-procedure>` answers "what writes / reads / executes X". It is built from T-SQL (INSERT / UPDATE / DELETE / MERGE / TRUNCATE / SELECT INTO / FROM / JOIN / EXEC, with alias resolution; CTEs, temp tables and system objects excluded), from C# SQL strings (literals, `+`, interpolation, `string.Format`, consts, locals, `StringBuilder.Append` / `AppendLine` / `AppendFormat`) passed to Dapper, `SqlCommand` or EF `FromSql`, from stored-procedure names used with `CommandType.StoredProcedure`, from EF LINQ on `DbSet<T>` members (`ctx.Orders.Where(..)` / `.Add(..)` / `.Remove(..)`, `from o in ctx.Orders`; `probable`, since only the member name is matched) and from EF `ToTable` / `[Table]` mappings. A procedure's callers are indirect writers of the tables it writes (followed up to 4 hops). `programs` (USED BY PROGRAMS) follows confirmed / probable C# calls upward from those accessors to `*Controller` methods (up to 8 hops) (including from an implementation to the callers of the interface method it implements, for `foreach (var step in steps) step.Run()` pipelines) and groups them per controller file, with the Razor pages (`.cshtml`) whose `Url.Action("Action"[, "Controller"])` or AngularJS `ControllerPath + 'Action'` (controller from `$scope.Controller = 'X'`) targets those actions, so a table maps to the screens that touch it. A method that reads a DbSet and calls `SaveChanges` without an explicit `Add` / `Remove` may update tracked entities; it is listed as a possible (`uncertain`) writer. Each entry has a confidence; **dynamic SQL (`EXEC(@sql)`, `sp_executesql`, SQL built from unknown values) cannot be resolved and is listed separately as `uncertain`**, never mixed into the confirmed lists. EF accesses are `confirmed` when the context variable (`using (var db = new X())`, a field or property, or `this`) is typed as a class that declares or inherits the DbSet, `probable` otherwise. Methods on the way up that have no confirmed / probable caller at all are listed under NO KNOWN CALLER: entry points such as API endpoints, jobs or `Main`, or calls the graph could not resolve. Known gaps: `FROM a JOIN b ON ..., c` loses `c`, and a stored-procedure name passed to a non-database method is not seen.
68
99
 
69
100
  Stored procedures that live only in the database can be exported to a folder outside the repo and listed in `.ai_context/extra_roots` (one folder per line, absolute or relative to the root); their files are indexed under their absolute paths.
70
101
 
@@ -74,9 +105,13 @@ Natural-language search routes questions such as "who modifies MES_ScrapRecord"
74
105
 
75
106
  Queries are expanded with a small synonym dictionary (`SP` / `預存程序` / `stored procedure` / `usp`, table, lot, scrap, ...; `local_codebase_indexer/synonyms.py`). Add or disable groups per project in `.ai_context/synonyms.json`: `{"groups": [["wpnlot", "在製批"]], "disable": ["sp"]}`. This helps abbreviations and Chinese/English terms, not free paraphrase.
76
107
 
108
+ The index also mines its own dictionary: Chinese bigrams in the comments right above a symbol are paired with the sub-words of its name (`/// 收帳` above `ReceiveLotAsync` gives 收帳 = receive). A pair is kept when at least 5 symbols support it, it covers at least 15% of the symbols commented with the bigram (smoothed) and the word is at least 15x likelier there than overall. On a 30k-chunk C# codebase this yields about 350 pairs (收帳 -> receive, 拆批 -> divide, 油墨 -> ink, 底片 -> film) and raised MRR on paraphrased queries from 0.57 to 0.64.
109
+
77
110
  ## Index health
78
111
 
79
- `status` (also the MCP tool `codebase_index_status`) reports whether the index can be trusted without refreshing it: `fresh`, `stale` (files changed or git HEAD moved since the last update), `degraded` (failed files or an inconsistent database) or `not_indexed`. A file that fails to parse is removed from the index, listed with its error, and retried on every update, so search never returns stale lines for it. `index --force` rebuilds everything.
112
+ `status` (also the MCP tool `codebase_index_status`) reports whether the index can be trusted without refreshing it: `fresh`, `stale` (files changed or git HEAD moved since the last update), `degraded` (failed files or an inconsistent database) or `not_indexed`. A file that fails to parse is removed from the index, listed with its error, and retried on every update, so search never returns stale lines for it. `index --force` rebuilds everything. Status also shows the running version and warns when the package's code changed on disk after the process started (restart the MCP server, i.e. open a new Claude Code session, to run it).
113
+
114
+ Speed (2.3k files, 30k chunks, hashing embedder): full build about 36 s into an empty database, a branch switch that rewrites 400 files about 10 s, a no-op check about 1 s. Each file is written inside a savepoint (atomic), and commits are batched every 500 files.
80
115
 
81
116
  ## Benchmark
82
117
 
@@ -15,6 +15,15 @@ pipx install local-codebase-indexer
15
15
 
16
16
  从源码:`pip install -e .`(在 clone 下 `bin/indexer` 仍可使用)。
17
17
 
18
+ ### 作为 Claude Code plugin 安装
19
+
20
+ ```text
21
+ /plugin marketplace add sfy257000/local-codebase-indexer
22
+ /plugin install local-codebase-indexer@local-codebase-indexer
23
+ ```
24
+
25
+ 会为你打开的项目注册 MCP 服务器(实际运行 `uvx local-codebase-indexer --root <项目> serve`,所以要先装 [uv](https://docs.astral.sh/uv/):`pip install uv`)。安装后重启 Claude Code。
26
+
18
27
  ## 使用(CLI)
19
28
 
20
29
  ```bash
@@ -22,13 +31,14 @@ local-codebase-indexer --root <项目路径> index # 建立
22
31
  local-codebase-indexer search "database mapping for LotNo" --limit 5
23
32
  local-codebase-indexer relations IExistOpenHandleService --direction both # upstream | downstream | both
24
33
  local-codebase-indexer context Services/LotService.cs --lines 120 --padding 15 # 别名:slice
25
- local-codebase-indexer data-access MES_Lot # 谁读 / 写 / 执行某数据表或存储过程;存储过程碰了哪些数据
34
+ local-codebase-indexer data-access MES_Lot # 谁读 / 写 / 执行某数据表或存储过程;存储过程碰了哪些数据(--full 列出全部)
35
+ local-codebase-indexer impact main...HEAD # 一次变更动到的符号、数据表、程序与页面(不给参数=未提交的变更)
26
36
  local-codebase-indexer stats
27
37
  local-codebase-indexer status # 索引是否新鲜、失败文件、git commit、一致性检查
28
38
  ```
29
39
 
30
40
  - 不指定 `--root` 时使用当前目录,也可用环境变量 `INDEXER_ROOT`。
31
- - 加 `--json`(放在子命令前)输出 JSON。
41
+ - 加 `--json`(可放在子命令前后)输出 JSON。
32
42
  - `search`、`relations`、`context` 执行前会自动做一次增量更新(先比较 mtime,mtime 变了才计算 md5)。
33
43
  - 规格中的工具名称也可以直接作为子命令:`codebase_semantic_search`、`codebase_get_symbol_relations`、`codebase_get_optimized_context`(参数 `--query`、`--symbol_name --relation_direction`、`--file_path --focus_lines --padding_lines`)。
34
44
 
@@ -39,7 +49,20 @@ claude mcp add local-indexer -- local-codebase-indexer --root /path/to/project s
39
49
  # 不安装直接运行:claude mcp add local-indexer -- uvx local-codebase-indexer --root /path/to/project serve
40
50
  ```
41
51
 
42
- `serve` 通过 stdio 提供 JSON-RPC(MCP),暴露五个工具:`codebase_semantic_search`、`codebase_get_symbol_relations`、`codebase_get_optimized_context`、`codebase_get_data_access`、`codebase_index_status`。
52
+ `serve` 通过 stdio 提供 JSON-RPC(MCP),暴露七个工具:`codebase_semantic_search`、`codebase_get_symbol_relations`、`codebase_get_optimized_context`、`codebase_get_data_access`、`codebase_impact_analysis`、`codebase_index_status`、`codebase_index_doctor`。常驻的 server 在距离上次检查超过 15 秒时,查询前会重新检查索引(几千个文件无变动约 1 秒)。`codebase_get_data_access` 默认返回摘要(每区 5 条、程序全列),加 `detail` 才列全部;`codebase_semantic_search` 加 `related` 才附依赖文件。
53
+
54
+ ## 诊断、筛选与分页(0.6.0)
55
+
56
+ ```bash
57
+ local-codebase-indexer --root <项目> doctor --path src/Service.cs
58
+ local-codebase-indexer --root <项目> search "读取发票" --file '*.py' --language python --limit 5 --offset 0
59
+ local-codebase-indexer --root <项目> data-access MES_Lot --confidence confirmed --limit 20 --offset 20
60
+ local-codebase-indexer --root <项目> data-access MES_Lot --full
61
+ ```
62
+
63
+ `doctor` 解释忽略规则、不支持的扩展名、过大和二进制文件以及索引状态。搜索先筛选再排名;文件 glob 区分大小写,`*` 可以跨 `/`。JSON 提供 `pagination.next_offset`。数据访问支持精确信心等级筛选和每个区段独立分页;`--full`/MCP `detail=true` 不再受旧有 40/200 条上限限制。MCP 搜索使用 `file_pattern`、`language`、`limit`、`offset`,数据访问使用 `confidence`、`limit`、`offset`,新增诊断工具 `codebase_index_doctor`。
64
+
65
+ `impact` 保留删除代码及历史调用、数据表影响;`snapshot=before` 的行号属于基准版本。历史索引首次建立后缓存在 `.ai_context/impact/`,可安全删除以释放空间;不会重建外部 `extra_roots`,静态分析限制仍适用。不存在的根目录会报错,空索引或部分失败返回退出码 3;MCP 参数错误不会结束服务。新增常见中英文同义词,项目术语仍可配置在 `.ai_context/synonyms.json`。
43
66
 
44
67
  ## 三层索引
45
68
 
@@ -60,7 +83,7 @@ claude mcp add local-indexer -- local-codebase-indexer --root /path/to/project s
60
83
 
61
84
  ## 数据访问(SQL)
62
85
 
63
- `data-access <数据表或存储过程>` 回答“谁写入 / 读取 / 执行 X”。数据来源:T-SQL(INSERT / UPDATE / DELETE / MERGE / TRUNCATE / SELECT INTO / FROM / JOIN / EXEC,含别名解析,排除 CTE、临时表、系统对象)、C# 的 SQL 字符串(字面值、`+`、字符串插值、`string.Format`、常量、局部变量、`StringBuilder.Append` / `AppendLine` / `AppendFormat`)经 Dapper、`SqlCommand` 或 EF `FromSql` 发出、配合 `CommandType.StoredProcedure` 的存储过程名称、对 `DbSet<T>` 成员的 EF LINQ(`ctx.Orders.Where(..)` / `.Add(..)` / `.Remove(..)`、`from o in ctx.Orders`;只比对成员名称,所以是 `probable`),以及 EF 的 `ToTable` / `[Table]` 映射。调用某存储过程的代码视为该过程所写数据表的间接写入者(最多追 4 层)。`programs`(USED BY PROGRAMS)沿 confirmed / probable 的 C# 调用往上追到 `*Controller` 方法(最多 8 层),(实现方法也会接到它所实现接口方法的调用者,涵盖 `foreach (var step in steps) step.Run()` 这种管线),按 controller 文件分组,并列出 `Url.Action("Action"[, "Controller"])` 或 AngularJS `ControllerPath + 'Action'`(controller 取自 `$scope.Controller = 'X'`)指向这些 action 的 Razor 页面(`.cshtml`),查一张表就知道哪些画面会动到它。方法读了某 DbSet 又调用 `SaveChanges`、但没有明确 `Add` / `Remove` 时,可能是在更新跟踪中的实体,列为可能(`uncertain`)写入者。每条都有置信等级;**动态 SQL(`EXEC(@sql)`、`sp_executesql`、由未知值组成的 SQL)无法解析,会单独列为 `uncertain`**,不会混进确定的清单。已知缺口:`FROM a JOIN b ON ..., c` 会漏掉 `c`;把存储过程名称传给非数据库方法时看不到。
86
+ `data-access <数据表或存储过程>` 回答“谁写入 / 读取 / 执行 X”。数据来源:T-SQL(INSERT / UPDATE / DELETE / MERGE / TRUNCATE / SELECT INTO / FROM / JOIN / EXEC,含别名解析,排除 CTE、临时表、系统对象)、C# 的 SQL 字符串(字面值、`+`、字符串插值、`string.Format`、常量、局部变量、`StringBuilder.Append` / `AppendLine` / `AppendFormat`)经 Dapper、`SqlCommand` 或 EF `FromSql` 发出、配合 `CommandType.StoredProcedure` 的存储过程名称、对 `DbSet<T>` 成员的 EF LINQ(`ctx.Orders.Where(..)` / `.Add(..)` / `.Remove(..)`、`from o in ctx.Orders`;只比对成员名称,所以是 `probable`),以及 EF 的 `ToTable` / `[Table]` 映射。调用某存储过程的代码视为该过程所写数据表的间接写入者(最多追 4 层)。`programs`(USED BY PROGRAMS)沿 confirmed / probable 的 C# 调用往上追到 `*Controller` 方法(最多 8 层),(实现方法也会接到它所实现接口方法的调用者,涵盖 `foreach (var step in steps) step.Run()` 这种管线),按 controller 文件分组,并列出 `Url.Action("Action"[, "Controller"])` 或 AngularJS `ControllerPath + 'Action'`(controller 取自 `$scope.Controller = 'X'`)指向这些 action 的 Razor 页面(`.cshtml`),查一张表就知道哪些画面会动到它。方法读了某 DbSet 又调用 `SaveChanges`、但没有明确 `Add` / `Remove` 时,可能是在更新跟踪中的实体,列为可能(`uncertain`)写入者。每条都有置信等级;**动态 SQL(`EXEC(@sql)`、`sp_executesql`、由未知值组成的 SQL)无法解析,会单独列为 `uncertain`**,不会混进确定的清单。EF 访问在 context 变量(`using (var db = new X())`、字段或属性、`this`)的类型是声明或继承该 DbSet 的类时为 `confirmed`,否则 `probable`。往上追时没有任何 confirmed / probable 调用者的方法列在 NO KNOWN CALLER:可能是 API、计划任务、`Main` 等入口,或是调用图解不出的调用。已知缺口:`FROM a JOIN b ON ..., c` 会漏掉 `c`;把存储过程名称传给非数据库方法时看不到。
64
87
 
65
88
  只存在数据库里的存储过程,可导出到仓库外的文件夹,再写进 `.ai_context/extra_roots`(一行一个文件夹,绝对路径或相对于项目根目录);这些文件以绝对路径索引。
66
89
 
@@ -70,9 +93,13 @@ claude mcp add local-indexer -- local-codebase-indexer --root /path/to/project s
70
93
 
71
94
  查询会用小型同义词字典扩展(`SP` / `预存程序` / `stored procedure` / `usp`、数据表、批号、报废等;见 `local_codebase_indexer/synonyms.py`)。可在 `.ai_context/synonyms.json` 为项目新增或停用分组:`{"groups": [["wpnlot", "在制批"]], "disable": ["sp"]}`。这对缩写与中英对照有帮助,对自由改写的同义说法没用。
72
95
 
96
+ 索引也会自动挖项目自己的词典:符号正上方注释里的中文双字词,配对符号名称的英文子词(`ReceiveLotAsync` 上面写 `/// 收帳` → 收帳 = receive)。至少 5 个符号支持、在带有该词注释的符号中占 15% 以上(有平滑)、且该英文词在那里出现的概率是整体的 15 倍以上才保留。在 3 万 chunk 的 C# 项目上约得到 350 组(收帳→receive、拆批→divide、油墨→ink、底片→film),换个说法的查询 MRR 由 0.57 提升到 0.64。
97
+
73
98
  ## 索引健康状态
74
99
 
75
- `status`(也是 MCP 工具 `codebase_index_status`)不更新索引,只报告索引是否可信:`fresh`(新鲜)、`stale`(文件有变更或 git HEAD 已移动)、`degraded`(有解析失败的文件或数据库不一致)、`not_indexed`(尚未建立)。解析失败的文件会从索引移除、连同错误原因列出,并在每次更新时重试,所以搜索不会返回它的过期内容。`index --force` 可全部重建。
100
+ `status`(也是 MCP 工具 `codebase_index_status`)不更新索引,只报告索引是否可信:`fresh`(新鲜)、`stale`(文件有变更或 git HEAD 已移动)、`degraded`(有解析失败的文件或数据库不一致)、`not_indexed`(尚未建立)。解析失败的文件会从索引移除、连同错误原因列出,并在每次更新时重试,所以搜索不会返回它的过期内容。`index --force` 可全部重建。status 也会显示运行中的版本;包的代码在进程启动后有改动时会提示重启 MCP server(也就是开新的 Claude Code session)。
101
+
102
+ 速度(2.3k 文件、3 万 chunk、hashing 嵌入):空数据库全量约 36 秒,切分支改写 400 个文件约 10 秒,无变动检查约 1 秒。每个文件在 savepoint 内写入(不可分割),每 500 个文件 commit 一次。
76
103
 
77
104
  ## 基准测试
78
105
 
@@ -15,6 +15,15 @@ pipx install local-codebase-indexer
15
15
 
16
16
  從原始碼:`pip install -e .`(在 clone 下 `bin/indexer` 仍可使用)。
17
17
 
18
+ ### 當作 Claude Code plugin 安裝
19
+
20
+ ```text
21
+ /plugin marketplace add sfy257000/local-codebase-indexer
22
+ /plugin install local-codebase-indexer@local-codebase-indexer
23
+ ```
24
+
25
+ 會替你開啟的專案註冊 MCP 伺服器(實際執行 `uvx local-codebase-indexer --root <專案> serve`,所以要先裝 [uv](https://docs.astral.sh/uv/):`pip install uv`)。安裝後重開 Claude Code。
26
+
18
27
  ## 使用(CLI)
19
28
 
20
29
  ```bash
@@ -22,13 +31,14 @@ local-codebase-indexer --root <專案路徑> index # 建立
22
31
  local-codebase-indexer search "database mapping for LotNo" --limit 5
23
32
  local-codebase-indexer relations IExistOpenHandleService --direction both # upstream | downstream | both
24
33
  local-codebase-indexer context Services/LotService.cs --lines 120 --padding 15 # 別名:slice
25
- local-codebase-indexer data-access MES_Lot # 誰讀 / 寫 / 執行某資料表或預存程序;預存程序碰了哪些資料
34
+ local-codebase-indexer data-access MES_Lot # 誰讀 / 寫 / 執行某資料表或預存程序;預存程序碰了哪些資料(--full 列出全部)
35
+ local-codebase-indexer impact main...HEAD # 一次變更動到的符號、資料表、程式與頁面(不給參數=未提交的變更)
26
36
  local-codebase-indexer stats
27
37
  local-codebase-indexer status # 索引是否新鮮、失敗檔案、git commit、一致性檢查
28
38
  ```
29
39
 
30
40
  - 不給 `--root` 時使用目前目錄,也可用環境變數 `INDEXER_ROOT`。
31
- - 加 `--json`(放在子命令前)輸出 JSON。
41
+ - 加 `--json`(可放在子命令前後)輸出 JSON。
32
42
  - `search`、`relations`、`context` 執行前會自動做一次增量更新(先比 mtime,mtime 變了才算 md5)。
33
43
  - 規格中的工具名稱也可直接當子命令:`codebase_semantic_search`、`codebase_get_symbol_relations`、`codebase_get_optimized_context`(參數 `--query`、`--symbol_name --relation_direction`、`--file_path --focus_lines --padding_lines`)。
34
44
 
@@ -39,7 +49,24 @@ claude mcp add local-indexer -- local-codebase-indexer --root /path/to/project s
39
49
  # 不安裝直接跑:claude mcp add local-indexer -- uvx local-codebase-indexer --root /path/to/project serve
40
50
  ```
41
51
 
42
- `serve` 以 stdio 提供 JSON-RPC(MCP),暴露五個工具:`codebase_semantic_search`、`codebase_get_symbol_relations`、`codebase_get_optimized_context`、`codebase_get_data_access`、`codebase_index_status`。
52
+ `serve` 以 stdio 提供 JSON-RPC(MCP),暴露七個工具:`codebase_semantic_search`、`codebase_get_symbol_relations`、`codebase_get_optimized_context`、`codebase_get_data_access`、`codebase_impact_analysis`、`codebase_index_status`、`codebase_index_doctor`。長駐的 server 在距離上次檢查超過 15 秒時,查詢前會重新檢查索引(幾千個檔案無變動約 1 秒)。`codebase_get_data_access` 預設回摘要(每區 5 筆、程式全列),加 `detail` 才列全部;`codebase_semantic_search` 加 `related` 才附相依檔案。
53
+
54
+ ## 診斷、篩選與分頁(0.6.0)
55
+
56
+ ```bash
57
+ local-codebase-indexer --root <專案> doctor --path src/Service.cs
58
+ local-codebase-indexer --root <專案> search "讀取發票" --file '*.py' --language python --limit 5 --offset 0
59
+ local-codebase-indexer --root <專案> data-access MES_Lot --confidence confirmed --limit 20 --offset 20
60
+ local-codebase-indexer --root <專案> data-access MES_Lot --full
61
+ ```
62
+
63
+ - `doctor` 顯示索引範圍、忽略項目、不支援的副檔名、過大/二進位檔案與索引狀態;`--path` 可查單一檔案的排除原因。排除目錄的數量不代表其中的檔案數量。
64
+ - 搜尋先套用檔案與語言篩選再排序。`--file` 是完整相對路徑的 glob,區分大小寫,`*` 可跨 `/`。JSON 的 `pagination.next_offset` 提供下一頁;翻頁時保留相同查詢與篩選,並避免在中途修改索引。
65
+ - `data-access` 的 `--confidence` 精確選取 `confirmed`/`probable`/`uncertain`;分頁對每個區段各自套用,JSON 提供各區總數與下一個 offset。`--full`/MCP `detail=true` 不再受舊有 40/200 筆上限限制。
66
+ - MCP 搜尋參數為 `file_pattern`、`language`、`limit`、`offset`;資料存取工具支援 `confidence`、`limit`、`offset`。新增 `codebase_index_doctor` 診斷工具。
67
+ - `impact` 同時分析修改前後的程式,包含刪除項目及舊有呼叫/資料表影響;`snapshot=before` 的行號屬於基準版本。首次會建立歷史索引,之後重用 `.ai_context/impact/` 快取;此目錄可安全刪除以釋放空間。歷史分析不重建 Git 之外的 `extra_roots`,既有靜態分析限制仍適用。
68
+ - 不存在的根目錄會報錯,不會自動建立;空索引或有失敗項目的 `index` 回傳結束碼 3。MCP 收到錯誤參數後仍可繼續處理下一個請求。
69
+ - 擴充一般中英文動詞與密碼用語;專案術語仍建議放入 `.ai_context/synonyms.json`。這是詞彙搜尋改善,並不保證能理解所有自然語句。
43
70
 
44
71
  ## 三層索引
45
72
 
@@ -60,7 +87,7 @@ claude mcp add local-indexer -- local-codebase-indexer --root /path/to/project s
60
87
 
61
88
  ## 資料存取(SQL)
62
89
 
63
- `data-access <資料表或預存程序>` 回答「誰寫入 / 讀取 / 執行 X」。資料來源:T-SQL(INSERT / UPDATE / DELETE / MERGE / TRUNCATE / SELECT INTO / FROM / JOIN / EXEC,含別名解析,排除 CTE、暫存表、系統物件)、C# 的 SQL 字串(字面值、`+`、字串內插、`string.Format`、常數、區域變數、`StringBuilder.Append` / `AppendLine` / `AppendFormat`)經 Dapper、`SqlCommand` 或 EF `FromSql` 送出、搭配 `CommandType.StoredProcedure` 的 SP 名稱、對 `DbSet<T>` 成員的 EF LINQ(`ctx.Orders.Where(..)` / `.Add(..)` / `.Remove(..)`、`from o in ctx.Orders`;只比對成員名稱,所以是 `probable`),以及 EF 的 `ToTable` / `[Table]` 對應。呼叫某 SP 的程式視為該 SP 所寫資料表的間接寫入者(最多追 4 層)。`programs`(USED BY PROGRAMS)沿 confirmed / probable 的 C# 呼叫往上追到 `*Controller` 方法(最多 8 層),(實作方法也會接到它所實作介面方法的呼叫者,涵蓋 `foreach (var step in steps) step.Run()` 這種管線),依 controller 檔案分組,並列出 `Url.Action("Action"[, "Controller"])` 或 AngularJS `ControllerPath + 'Action'`(controller 取自 `$scope.Controller = 'X'`)指向這些 action 的 Razor 頁面(`.cshtml`),查一張表就知道哪些畫面會動到它。方法讀了某 DbSet 又呼叫 `SaveChanges`、但沒有明確 `Add` / `Remove` 時,可能是在更新追蹤中的實體,列為可能(`uncertain`)寫入者。每筆都有信心等級;**動態 SQL(`EXEC(@sql)`、`sp_executesql`、由未知值組成的 SQL)無法解析,會獨立列為 `uncertain`**,不會混進確定的清單。已知缺口:`FROM a JOIN b ON ..., c` 會漏掉 `c`;把 SP 名稱傳給非資料庫方法時看不到。
90
+ `data-access <資料表或預存程序>` 回答「誰寫入 / 讀取 / 執行 X」。資料來源:T-SQL(INSERT / UPDATE / DELETE / MERGE / TRUNCATE / SELECT INTO / FROM / JOIN / EXEC,含別名解析,排除 CTE、暫存表、系統物件)、C# 的 SQL 字串(字面值、`+`、字串內插、`string.Format`、常數、區域變數、`StringBuilder.Append` / `AppendLine` / `AppendFormat`)經 Dapper、`SqlCommand` 或 EF `FromSql` 送出、搭配 `CommandType.StoredProcedure` 的 SP 名稱、對 `DbSet<T>` 成員的 EF LINQ(`ctx.Orders.Where(..)` / `.Add(..)` / `.Remove(..)`、`from o in ctx.Orders`;只比對成員名稱,所以是 `probable`),以及 EF 的 `ToTable` / `[Table]` 對應。呼叫某 SP 的程式視為該 SP 所寫資料表的間接寫入者(最多追 4 層)。`programs`(USED BY PROGRAMS)沿 confirmed / probable 的 C# 呼叫往上追到 `*Controller` 方法(最多 8 層),(實作方法也會接到它所實作介面方法的呼叫者,涵蓋 `foreach (var step in steps) step.Run()` 這種管線),依 controller 檔案分組,並列出 `Url.Action("Action"[, "Controller"])` 或 AngularJS `ControllerPath + 'Action'`(controller 取自 `$scope.Controller = 'X'`)指向這些 action 的 Razor 頁面(`.cshtml`),查一張表就知道哪些畫面會動到它。方法讀了某 DbSet 又呼叫 `SaveChanges`、但沒有明確 `Add` / `Remove` 時,可能是在更新追蹤中的實體,列為可能(`uncertain`)寫入者。每筆都有信心等級;**動態 SQL(`EXEC(@sql)`、`sp_executesql`、由未知值組成的 SQL)無法解析,會獨立列為 `uncertain`**,不會混進確定的清單。EF 存取在 context 變數(`using (var db = new X())`、欄位或屬性、`this`)的型別是宣告或繼承該 DbSet 的類別時為 `confirmed`,否則 `probable`。往上追時沒有任何 confirmed / probable 呼叫者的方法列在 NO KNOWN CALLER:可能是 API、排程、`Main` 等入口,或是呼叫圖解不出的呼叫。已知缺口:`FROM a JOIN b ON ..., c` 會漏掉 `c`;把 SP 名稱傳給非資料庫方法時看不到。
64
91
 
65
92
  只存在資料庫裡的預存程序,可匯出到 repo 外的資料夾,再寫進 `.ai_context/extra_roots`(一行一個資料夾,絕對路徑或相對於專案根目錄);這些檔案以絕對路徑索引。
66
93
 
@@ -70,9 +97,13 @@ claude mcp add local-indexer -- local-codebase-indexer --root /path/to/project s
70
97
 
71
98
  查詢會用小型同義詞字典擴展(`SP` / `預存程序` / `stored procedure` / `usp`、資料表、批號、報廢等;見 `local_codebase_indexer/synonyms.py`)。可在 `.ai_context/synonyms.json` 為專案新增或停用群組:`{"groups": [["wpnlot", "在製批"]], "disable": ["sp"]}`。這對縮寫與中英對照有幫助,對自由改寫的同義說法沒用。
72
99
 
100
+ 索引也會自動挖專案自己的字典:符號正上方註解裡的中文雙字詞,配對符號名稱的英文子詞(`ReceiveLotAsync` 上面寫 `/// 收帳` → 收帳 = receive)。至少 5 個符號支持、在帶有該詞註解的符號中占 15% 以上(有平滑)、且該英文詞在那裡出現的機率是整體的 15 倍以上才保留。在 3 萬 chunk 的 C# 專案上約得到 350 組(收帳→receive、拆批→divide、油墨→ink、底片→film),換句話說的查詢 MRR 由 0.57 提升到 0.64。
101
+
73
102
  ## 索引健康狀態
74
103
 
75
- `status`(也是 MCP 工具 `codebase_index_status`)不更新索引,只回報索引是否可信:`fresh`(新鮮)、`stale`(檔案有變更或 git HEAD 已移動)、`degraded`(有解析失敗的檔案或資料庫不一致)、`not_indexed`(尚未建立)。解析失敗的檔案會從索引移除、連同錯誤原因列出,並在每次更新時重試,所以搜尋不會回傳它的過期內容。`index --force` 可全部重建。
104
+ `status`(也是 MCP 工具 `codebase_index_status`)不更新索引,只回報索引是否可信:`fresh`(新鮮)、`stale`(檔案有變更或 git HEAD 已移動)、`degraded`(有解析失敗的檔案或資料庫不一致)、`not_indexed`(尚未建立)。解析失敗的檔案會從索引移除、連同錯誤原因列出,並在每次更新時重試,所以搜尋不會回傳它的過期內容。`index --force` 可全部重建。status 也會顯示執行中的版本;套件程式碼在程序啟動後有改動時會提示重開 MCP server(也就是開新的 Claude Code session)。
105
+
106
+ 速度(2.3k 檔、3 萬 chunk、hashing 嵌入):空資料庫全量約 36 秒,切分支改寫 400 個檔約 10 秒,無變動檢查約 1 秒。每個檔案在 savepoint 內寫入(不可分割),每 500 個檔案 commit 一次。
76
107
 
77
108
  ## 基準測試
78
109
 
@@ -13,15 +13,19 @@ Priorities come from the benchmark (`benchmarks/run_benchmark.py`, baseline in `
13
13
  | Item | Why deferred | Revisit when |
14
14
  |---|---|---|
15
15
  | Real embedding model as default | Measured 0.4.0 on a real 30k-chunk C# codebase with Chinese comments, 12 paraphrased queries (6 zh, 6 en): hashing MRR 0.48 / hit@5 6, `all-MiniLM-L6-v2` 0.29 / 6, `paraphrase-multilingual-MiniLM-L12-v2` (int8) 0.41 / 6; full index 128 s vs 35 / 43 min. Benchmark: MiniLM +0.08-0.13 MRR, multilingual -0.01..+0.03. Domain jargon ("split a lot into two") was missed by all three | A model trained on code + Chinese, or embedding becomes incremental enough that branch switches stay under a minute |
16
+ | Content-hash cache of parse results across branch switches | Measured: a switch that rewrites 400 files re-indexes in about 10 s; parsing is about 40% of that, so a cache would save a few seconds at the cost of a large table | Branch switches routinely rewrite thousands of files |
16
17
  | ANN index | Exact search is not the bottleneck. Measured (Python stdlib copies, linear growth): 17k chunks cold CLI search 0.35 s / warm 0.13 s / index 10 s; 52k chunks 0.75 s / 0.36 s / 28 s; 104k chunks 1.09 s / 0.73 s / 54 s, 372 MB RSS, 729 MB database. At 104k chunks the cosine product plus top-k takes about 12 ms; loading the vectors out of SQLite (fetch 0.31 s, join 0.12 s) is about half of a warm query | Exact cosine itself becomes slow, which is far beyond 1M chunks |
17
18
  | Vector matrix cache | Cheap and measurable: it removes about half of a warm query at 104k chunks (about 0.8 s -> 0.3 s). Not needed below ~50k chunks | A real project passes ~50k chunks. Keep the matrix in the MCP server process, and/or store it as a memory-mapped `.npy` next to the database so the CLI benefits too (invalidate on any index change) |
18
19
  | `codebase_trace_execution` | Needs reliable call / data-flow relations; today's usage edges are name matches | Call graph gaps (item 3) are narrowed; today edges carry a confidence level |
19
- | `codebase_impact_analysis` | Same dependency; must separate confirmed from guessed edges | Call graph gaps (item 3) are narrowed; today edges carry a confidence level |
20
20
  | `codebase_architecture_overview` | Low value for the intended use cases | A concrete need appears |
21
21
  | `codebase_find_references` (upgrade) | `relations` already returns name-matched references | Done in part: `relations` already separates confirmed / probable / candidate callers |
22
22
 
23
23
  ## Done
24
24
 
25
+ - 0.6.0: complete before/after impact analysis with cached historical indexes; resilient MCP input validation; nested ignore negations; root validation; doctor diagnostics; bounded and filtered search; confidence-filtered data-access pagination with no hidden full-output caps; general paraphrases; mandatory ONNX dependencies in CI. See CHANGELOG.md for validation and limitations.
26
+
27
+ - 0.5.0: a long-lived MCP server re-checks the index (was: once per process); full build 155 s -> 36 s on 2.3k files (C# usings no longer scanned as Python modules, per-file savepoints with batched commits); Chinese comment <-> identifier dictionary mined per project (iWAP paraphrase MRR 0.57 -> 0.64); data-access summary by default (`detail` / `--full`), related files only on request; EF confidence from the context variable's type; NO KNOWN CALLER roots; `impact` tool for a git diff; status shows the running version and warns when the code changed after start
28
+
25
29
  - Data access: `StringBuilder` SQL, EF LINQ on `DbSet<T>` members (resolved after indexing against declared DbSets), `programs` roll-up from accessors to controller actions; `relations Type.Method`; call graph resolves `Lazy<T>.Value` and `foreach (var x in ...)` element types; programs roll-up walks from an implementation to its interface method's callers and lists Razor pages (`Url.Action`, AngularJS `ControllerPath + 'Action'`); a typed identifier's scope includes files named after it and ranks names matching the rest of the query first ("WD0096 存檔" -> SetRecord); EF `SaveChanges` on tracked entities listed as possible writes; `.ai_context/extra_roots`; `.ai_context/ignore`, minified files skipped; C# namespace imports only link files whose types are used; piped CLI output is UTF-8
26
30
 
27
31
  - SQL / data-access relations: `data_access` table and tool (`data-access` CLI, `codebase_get_data_access` MCP); T-SQL read / write / exec, C# SQL strings and Dapper / SqlCommand / EF sinks, EF table mappings, indirect writers through procedures, dynamic SQL reported as `uncertain`; search routes "who writes / reads / calls X" to it. Benchmark `sql_dataflow` Recall@5 0.72 -> 1.00, new `data_access` queries 0.67 -> 1.00
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env python3
2
+ """Launcher: bin/indexer <tool_name> --params"""
3
+ import os
4
+ import sys
5
+
6
+ sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
7
+
8
+ from local_codebase_indexer.cli import main # noqa: E402
9
+
10
+ if __name__ == "__main__":
11
+ sys.exit(main())
@@ -1,3 +1,3 @@
1
1
  """Universal Local Codebase Indexer & Context Provider (see index.md)."""
2
2
 
3
- __version__ = "0.4.0"
3
+ __version__ = "0.6.0"