local-codebase-indexer 0.7.0__tar.gz → 0.9.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.
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/AGENTS.md +15 -1
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/CHANGELOG.md +26 -0
- local_codebase_indexer-0.9.0/CLAUDE.md +5 -0
- local_codebase_indexer-0.9.0/CONTRIBUTING.md +35 -0
- local_codebase_indexer-0.9.0/LICENSE +21 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/MANIFEST.in +4 -1
- local_codebase_indexer-0.9.0/PKG-INFO +134 -0
- local_codebase_indexer-0.9.0/README.md +90 -0
- local_codebase_indexer-0.9.0/README.zh-CN.md +88 -0
- local_codebase_indexer-0.9.0/README.zh-TW.md +88 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/TODO.md +4 -2
- local_codebase_indexer-0.9.0/assets/demo-output.txt +25 -0
- local_codebase_indexer-0.9.0/assets/demo-preview.png +0 -0
- local_codebase_indexer-0.9.0/assets/demo-report.json +192 -0
- local_codebase_indexer-0.9.0/assets/demo.gif +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/queries_project.json +1 -1
- local_codebase_indexer-0.9.0/docs/case-study.md +75 -0
- local_codebase_indexer-0.9.0/docs/discovery.md +31 -0
- local_codebase_indexer-0.9.0/docs/launch/community.en.md +28 -0
- local_codebase_indexer-0.9.0/docs/launch/community.zh-TW.md +28 -0
- local_codebase_indexer-0.9.0/docs/launch/directory-entry.md +52 -0
- local_codebase_indexer-0.7.0/README.md → local_codebase_indexer-0.9.0/docs/reference.md +8 -4
- local_codebase_indexer-0.7.0/README.zh-CN.md → local_codebase_indexer-0.9.0/docs/reference.zh-CN.md +7 -3
- local_codebase_indexer-0.7.0/README.zh-TW.md → local_codebase_indexer-0.9.0/docs/reference.zh-TW.md +7 -3
- local_codebase_indexer-0.9.0/docs/sql-legacy-support.md +65 -0
- local_codebase_indexer-0.9.0/llms.txt +14 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/__init__.py +1 -1
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/cli.py +17 -2
- local_codebase_indexer-0.9.0/local_codebase_indexer/context.py +96 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/core.py +5 -13
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/csdata.py +29 -6
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/dataflow.py +15 -8
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/db.py +5 -5
- local_codebase_indexer-0.9.0/local_codebase_indexer/demo.py +100 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/demo_project/Controllers/OrdersController.cs +26 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/demo_project/Data/OrderRepository.cs +28 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/demo_project/Models/Order.cs +8 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/demo_project/README.md +15 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/demo_project/Services/IOrderService.cs +10 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/demo_project/Services/OrderService.cs +25 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/demo_project/Sql/Sales_OrderHeader.sql +5 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/demo_project/Sql/usp_ApproveOrder.sql +6 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/demo_project/Views/Orders/Details.cshtml +6 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/evaluation.py +4 -4
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/impact.py +20 -8
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/langparse.py +43 -26
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/locking.py +4 -5
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/mcp_server.py +13 -5
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/query.py +37 -542
- local_codebase_indexer-0.9.0/local_codebase_indexer/query_common.py +17 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/relations.py +182 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/rendering.py +273 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/scanner.py +33 -13
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/sqlaccess.py +175 -53
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/synonyms.py +3 -1
- local_codebase_indexer-0.9.0/local_codebase_indexer/textdecode.py +42 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer/vbdata.py +156 -0
- local_codebase_indexer-0.9.0/local_codebase_indexer.egg-info/PKG-INFO +134 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer.egg-info/SOURCES.txt +35 -2
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer.egg-info/requires.txt +5 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/pyproject.toml +26 -3
- local_codebase_indexer-0.9.0/scripts/render_demo.py +73 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/server.json +3 -3
- local_codebase_indexer-0.9.0/tests/test_demo.py +51 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/tests/test_navigation_stability.py +41 -0
- local_codebase_indexer-0.9.0/tests/test_sql_regressions.py +295 -0
- local_codebase_indexer-0.7.0/CLAUDE.md +0 -58
- local_codebase_indexer-0.7.0/PKG-INFO +0 -221
- local_codebase_indexer-0.7.0/llms.txt +0 -10
- local_codebase_indexer-0.7.0/local_codebase_indexer.egg-info/PKG-INFO +0 -221
- local_codebase_indexer-0.7.0/requirements.txt +0 -10
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/.claude-plugin/marketplace.json +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/README.md +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/baseline.json +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Auth/LoginService.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Controllers/LotController.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Controllers/ScrapController.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Data/MesDbContext.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Legacy/frmChangeLine.frm +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Models/DrillBreakEvent.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Models/Lot.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Models/ScrapRecord.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Printing/LabelPrinter.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Repositories/LotRepository.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Repositories/ScrapRepository.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Services/IScrapService.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Services/InspectionService.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Services/LotService.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Services/ScrapService.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Sql/MES_Lot.sql +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Sql/usp_Inspection_Report.sql +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Sql/usp_Lot_UpdateStatus.sql +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Sql/usp_Scrap_Insert.sql +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Utils/DateRangeHelper.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Utils/PartNumberDecoder.cs +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Web/scrapForm.ts +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/Web.config +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/corpus/tools/export_report.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/queries_stdlib.json +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/queries_synthetic.json +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/benchmarks/run_benchmark.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/bin/indexer +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/index.md +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/__main__.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/callgraph.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/cscalls.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/embedder.py +1 -1
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer/pagination.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer.egg-info/dependency_links.txt +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer.egg-info/entry_points.txt +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/local_codebase_indexer.egg-info/top_level.txt +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/plugins/local-codebase-indexer/.claude-plugin/plugin.json +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/plugins/local-codebase-indexer/.mcp.json +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/scripts/release_assets.py +3 -3
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/setup.cfg +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/tests/test_dataaccess.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/tests/test_evaluation.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/tests/test_indexer.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/tests/test_onnx_plumbing.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/tests/test_release_assets.py +0 -0
- {local_codebase_indexer-0.7.0 → local_codebase_indexer-0.9.0}/tests/test_reliability.py +0 -0
|
@@ -55,7 +55,7 @@ pip install -e ".[dev,onnx]" onnx && python -m pytest -q
|
|
|
55
55
|
python benchmarks/run_benchmark.py --compare benchmarks/baseline.json
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
The package is `local_codebase_indexer/`. See `
|
|
58
|
+
The package is `local_codebase_indexer/`. See `docs/reference.md` for design notes and known limits, `TODO.md` for planned work.
|
|
59
59
|
|
|
60
60
|
## Diagnostics and bounded results (0.6.0)
|
|
61
61
|
|
|
@@ -73,3 +73,17 @@ The package is `local_codebase_indexer/`. See `README.md` for design notes and k
|
|
|
73
73
|
- `impact A..B` and `A...B` use both Git snapshots and label target lines `after`; a single base revision compares with the working tree.
|
|
74
74
|
- Context clipping keeps focus lines. Synonym configuration hot-reloads. ONNX identities include model/tokenizer/configuration fingerprints.
|
|
75
75
|
- Future Release events validate and build once, then use the same files for PyPI and GitHub attachments. Validate locally with `python scripts/release_assets.py --tag v<package-version> --dist <directory>`; add `--upload` only when publishing was requested.
|
|
76
|
+
|
|
77
|
+
## First-run demo (0.8.0)
|
|
78
|
+
|
|
79
|
+
Run `local-codebase-indexer demo` without a database or model. It uses a temporary bundled synthetic project, checks four relationships, and leaves the current project alone. `--output <new-or-empty-directory>` keeps a copy; `--json` returns evidence and timings. This is a supported-path demonstration, not a production accuracy or time-savings measurement.
|
|
80
|
+
|
|
81
|
+
## SQL and legacy-source correctness (0.9.0)
|
|
82
|
+
|
|
83
|
+
- Run `python -m ruff check local_codebase_indexer scripts`, `python -m mypy`, and the full pytest suite before publishing. CI covers Linux and Windows on Python 3.10, 3.12, and 3.13.
|
|
84
|
+
- Dependency declarations live in `pyproject.toml`; `requirements.txt` was removed to avoid drift.
|
|
85
|
+
- Source decoding and context extraction handle BOM-tagged UTF-16/UTF-32. True binary files are excluded consistently by scanning and status.
|
|
86
|
+
- `data-access` has additive `schema_changes` entries (`access=schema`) for table/index DDL. They are not row writers. File-level SQL changes appear in impact with before/current/after labels and source evidence.
|
|
87
|
+
- VB6 `.frm`/`.bas`/`.cls` SQL strings get procedure owners. Complete SQL at known ADO/DAO receivers may be confirmed; unknown receivers or incomplete concatenation remain probable/uncertain. No VB6 call graph or runtime execution proof is implied.
|
|
88
|
+
- Explicit negations in `.ai_context/ignore` can include default source directories such as `!bin/` and `!bin/**`, overriding `.gitignore`. Include excluded parents first. `.git`, `.svn`, `.hg`, and `.ai_context` remain excluded.
|
|
89
|
+
- Keep `query.py` as the facade/search implementation; navigation, source context, and rendering live in `relations.py`, `context.py`, and `rendering.py`. Legacy public imports from `query` remain supported.
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
- Fix a first-run Windows lock-file initialization race found by concurrent-process CI; serialize index ignore-file creation.
|
|
6
|
+
|
|
7
|
+
- Fix SQL aliases `a` / `an` / `the`, parameterized TOP, UPDATE table hints, old NOLOCK hints, and comma sources after JOIN predicates.
|
|
8
|
+
- Preserve bracketed/quoted identifiers and linked-server names, including spaces, backslashes, escaped delimiters, and quoted dots. Ignore keywords inside identifiers and nested block comments.
|
|
9
|
+
- Exclude cursor FETCH and scalar TRIM FROM operands from table reads; analyze literal OPENQUERY SQL as uncertain.
|
|
10
|
+
- Decode BOM-tagged UTF-16/UTF-32 before binary detection; make source context and freshness diagnostics consistent. True binary files no longer remain pending forever.
|
|
11
|
+
- Attribute constant C# SQL to each executing method without sharing same-named constants across unrelated classes.
|
|
12
|
+
- Add conservative VB6 SQL analysis for .frm/.bas/.cls, with enclosing method owners and explicit confidence levels.
|
|
13
|
+
- Track table/index schema operations separately from row writes; include file-level SQL and before/after source evidence in Git impact.
|
|
14
|
+
- Allow explicit project-ignore negations to include default build/dependency-named source directories, preserving hard exclusions for VCS and index state.
|
|
15
|
+
- Split relation, context, and rendering code out of the query facade while preserving public imports and commands.
|
|
16
|
+
- Clear the existing mypy errors; add Ruff/mypy CI and release gates; test Windows and Linux on Python 3.10, 3.12, and 3.13.
|
|
17
|
+
- Canonical assistant instructions live in AGENTS.md; CLAUDE.md points there. Remove duplicate requirements.txt dependency declarations.
|
|
18
|
+
- Index format 9 triggers one full rebuild after upgrade. See docs/sql-legacy-support.md for supported patterns and limitations.
|
|
19
|
+
|
|
20
|
+
## 0.8.0
|
|
21
|
+
|
|
22
|
+
- MIT license and SPDX package metadata.
|
|
23
|
+
- Bundled `demo` command traces a synthetic SQL Server table through a stored procedure, C# callers, controller actions, and a Razor page without a database or .NET runtime. JSON output includes source evidence, four scenario checks, an exact-reference baseline, and measured timings.
|
|
24
|
+
- `demo --output` saves the fixture in a new or empty directory and refuses to overwrite user content.
|
|
25
|
+
- English, Traditional Chinese, and Simplified Chinese READMEs focus on the SQL Server / C# workflow with a three-step first run and a reproducible 32-second demonstration.
|
|
26
|
+
- Recorded case study, raw evidence, contribution guide, issue forms, and community/directory submission copy.
|
|
27
|
+
- Official MCP Registry publication follows successful PyPI publication using GitHub OIDC and a pinned, signature-verified publisher.
|
|
28
|
+
|
|
3
29
|
## 0.7.0
|
|
4
30
|
|
|
5
31
|
- Stable search ranking across page sizes/offsets, with query- and revision-bound continuation cursors.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Instructions for Claude
|
|
2
|
+
|
|
3
|
+
Read and follow [AGENTS.md](AGENTS.md) before working on this repository. It is the canonical source for development checks, all seven MCP tools (including `codebase_index_doctor`), CLI usage, confidence labels, and release validation.
|
|
4
|
+
|
|
5
|
+
Installation dependencies are declared in `pyproject.toml`. Use `python -m pip install -e ".[dev,onnx]" onnx` for development.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Useful contributions include small reproductions of missing SQL access or wrong C# callers, corrected documentation, and tests for supported patterns. Please discuss a larger parser or storage change in an issue first.
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
Use Python 3.10+ in a virtual environment:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
python -m pip install -e ".[dev,onnx]" onnx build twine
|
|
11
|
+
python -m ruff check local_codebase_indexer scripts
|
|
12
|
+
python -m mypy
|
|
13
|
+
python -m pytest -q
|
|
14
|
+
python -m build
|
|
15
|
+
python -m twine check dist/*
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
ONNX dependencies are required for the full CI suite; do not silently skip these checks. CI covers Linux and Windows. To reproduce the first-run experience, run `local-codebase-indexer demo --json`.
|
|
19
|
+
|
|
20
|
+
## Report a navigation problem
|
|
21
|
+
|
|
22
|
+
Include your package/Python/OS versions, the exact command, expected source locations, actual output and its confidence labels. Prefer a small synthetic reproduction that you can share. Do not upload private application code, credentials, or your entire index database. `doctor --path <file>` can explain an excluded file before you report it.
|
|
23
|
+
|
|
24
|
+
## Evaluate a retrieval change
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python benchmarks/run_benchmark.py --compare benchmarks/baseline.json
|
|
28
|
+
local-codebase-indexer --root . evaluate --queries benchmarks/queries_project.json --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Add verified questions and expected source locations when a new behavior needs coverage. Keep evaluation datasets separate from query-expansion rules; do not copy test answers into synonyms, weaken a threshold, or edit gold answers just to make a run pass. A synthetic demo checks a supported path; it does not replace retrieval or real-project evaluation.
|
|
32
|
+
|
|
33
|
+
Public documentation and Release notes use English, with Traditional/Simplified Chinese README translations. Keep generated demo assets in sync by running `python scripts/render_demo.py` after installing `.[media]`.
|
|
34
|
+
|
|
35
|
+
Contributions are under this repository's [MIT license](LICENSE).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sfy257000
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
include server.json CHANGELOG.md README*.md TODO.md AGENTS.md CLAUDE.md llms.txt index.md
|
|
1
|
+
include server.json CHANGELOG.md README*.md TODO.md AGENTS.md CLAUDE.md llms.txt index.md
|
|
2
2
|
graft scripts
|
|
3
3
|
graft tests
|
|
4
4
|
graft plugins
|
|
@@ -8,3 +8,6 @@ prune benchmarks/__pycache__
|
|
|
8
8
|
global-exclude __pycache__ *.py[cod]
|
|
9
9
|
prune benchmarks/corpus/.ai_context
|
|
10
10
|
include bin/indexer
|
|
11
|
+
include LICENSE CONTRIBUTING.md
|
|
12
|
+
graft docs
|
|
13
|
+
graft assets
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: local-codebase-indexer
|
|
3
|
+
Version: 0.9.0
|
|
4
|
+
Summary: Trace SQL Server tables to C# callers and Razor pages locally. MCP server and CLI for code search and change impact.
|
|
5
|
+
Author: sfy257000
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sfy257000/local-codebase-indexer
|
|
8
|
+
Project-URL: Repository, https://github.com/sfy257000/local-codebase-indexer
|
|
9
|
+
Project-URL: Issues, https://github.com/sfy257000/local-codebase-indexer/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/reference.md
|
|
11
|
+
Project-URL: Case study, https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/case-study.md
|
|
12
|
+
Keywords: mcp,model-context-protocol,claude-code,code-search,semantic-search,codebase-index,tree-sitter,sqlite,stored-procedure,csharp,dapper,t-sql,call-graph,ai-coding-assistant
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: tree-sitter>=0.23
|
|
28
|
+
Requires-Dist: tree-sitter-c-sharp
|
|
29
|
+
Requires-Dist: tree-sitter-python
|
|
30
|
+
Requires-Dist: tree-sitter-javascript
|
|
31
|
+
Requires-Dist: tree-sitter-typescript
|
|
32
|
+
Requires-Dist: numpy
|
|
33
|
+
Requires-Dist: pathspec>=0.12.1
|
|
34
|
+
Provides-Extra: onnx
|
|
35
|
+
Requires-Dist: onnxruntime; extra == "onnx"
|
|
36
|
+
Requires-Dist: tokenizers; extra == "onnx"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest; extra == "dev"
|
|
39
|
+
Requires-Dist: ruff>=0.9; extra == "dev"
|
|
40
|
+
Requires-Dist: mypy>=1.14; extra == "dev"
|
|
41
|
+
Provides-Extra: media
|
|
42
|
+
Requires-Dist: Pillow>=10; extra == "media"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# Local Codebase Indexer
|
|
46
|
+
|
|
47
|
+
**English** | [繁體中文](https://github.com/sfy257000/local-codebase-indexer/blob/main/README.zh-TW.md) | [简体中文](https://github.com/sfy257000/local-codebase-indexer/blob/main/README.zh-CN.md)
|
|
48
|
+
|
|
49
|
+
**Which C# code and pages reach this SQL Server table?**
|
|
50
|
+
|
|
51
|
+
Trace tables and stored procedures to repositories, controller actions, and Razor pages in a local source tree. Use the CLI yourself or give your AI assistant the same evidence through MCP. Especially useful when maintaining C# / SQL Server applications with Dapper, ADO.NET, or Entity Framework.
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
[Case study and raw results](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/case-study.md) · [CLI reference](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/reference.md) · [PyPI](https://pypi.org/project/local-codebase-indexer/) · [MIT license](https://github.com/sfy257000/local-codebase-indexer/blob/main/LICENSE)
|
|
56
|
+
|
|
57
|
+
## Try it in three steps
|
|
58
|
+
|
|
59
|
+
Python **3.10+**. Run these in a virtual environment; no SQL Server, .NET runtime, model download, or API key is needed for the demo.
|
|
60
|
+
|
|
61
|
+
**1. Install**
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
python -m pip install --upgrade local-codebase-indexer
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
If Python reports an externally managed environment, create and activate a [virtual environment](https://docs.python.org/3/library/venv.html) first. See the [reference](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/reference.md#install) for isolated installation alternatives.
|
|
68
|
+
|
|
69
|
+
**2. Run the bundled example**
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
local-codebase-indexer demo
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
This creates a temporary **synthetic** source tree, indexes it, and checks four expected relationships. It does not index your current directory. The animation uses this command's actual output, with reading pauses added. An excerpt:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
table Sales_OrderHeader
|
|
79
|
+
WRITTEN BY (2)
|
|
80
|
+
[confirmed] procedure dbo.usp_ApproveOrder
|
|
81
|
+
[confirmed] method Shop.Data.OrderRepository.Approve ... via usp_ApproveOrder
|
|
82
|
+
READ BY (1)
|
|
83
|
+
[confirmed] method Shop.Data.OrderRepository.Get
|
|
84
|
+
USED BY PROGRAMS (1)
|
|
85
|
+
[probable] Orders ... (Approve, Details)
|
|
86
|
+
pages: Views/Orders/Details.cshtml
|
|
87
|
+
Verified 4/4 expected relationships: PASS
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Use `local-codebase-indexer demo --output demo-orders` to keep a copy in a new or empty folder, or `demo --json` for the complete report.
|
|
91
|
+
|
|
92
|
+
**3. Point it at your source tree**
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
local-codebase-indexer --root "/path/to/project" data-access YourTable
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Replace the path and table name. The first query builds the index; subsequent queries refresh it incrementally. SQL definitions must be present in source files for procedure bodies to be analyzed. There is no connection to a live database.
|
|
99
|
+
|
|
100
|
+
## Give the same evidence to your assistant
|
|
101
|
+
|
|
102
|
+
For Claude Code, after installing the package:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
claude mcp add local-indexer -- local-codebase-indexer --root "/absolute/path/to/project" serve
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Ask: “Which code writes `YourTable`, and which controller actions and pages reach it? Show paths and confidence levels.” Restart/reconnect the MCP client if needed. For other stdio MCP clients, use command `local-codebase-indexer` and arguments `--root`, your absolute project path, `serve`.
|
|
109
|
+
|
|
110
|
+
Codex / Copilot can use the CLI. [AGENTS.md](https://github.com/sfy257000/local-codebase-indexer/blob/main/AGENTS.md) contains assistant instructions. The [reference](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/reference.md) also covers the Claude Code plugin, seven MCP tools, ONNX models, aliases, and configuration.
|
|
111
|
+
|
|
112
|
+
## More maintenance questions
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
local-codebase-indexer --root "/path/to/project" relations OrderRepository.Approve --direction upstream
|
|
116
|
+
local-codebase-indexer --root "/path/to/project" impact main...HEAD
|
|
117
|
+
local-codebase-indexer --root "/path/to/project" search "order approval" --explain --limit 5
|
|
118
|
+
local-codebase-indexer --root "/path/to/project" doctor
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Relations show callers; impact compares Git snapshots; search combines identifiers, text, and local embeddings. C#, Python, JavaScript, and TypeScript have symbol parsing; T-SQL and C# have additional data-access analysis. Add `--json` for structured output.
|
|
122
|
+
|
|
123
|
+
## What to verify
|
|
124
|
+
|
|
125
|
+
- This is **static analysis**, with confidence labels. Interface dispatch can be `probable`; name-only candidates and dynamic SQL require source verification. There is no Roslyn overload resolution or runtime execution proof.
|
|
126
|
+
- The default hashing embedder is best at identifiers and related terms. Natural-language paraphrases can miss results. [Benchmarks](https://github.com/sfy257000/local-codebase-indexer/blob/main/benchmarks/README.md) and the [case study](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/case-study.md) explain what was measured; four demo checks do not establish general accuracy or time savings.
|
|
127
|
+
- The index is local at `<project>/.ai_context/indexer.db`. Indexing needs no remote service after dependencies are installed. Your MCP client's model provider controls where returned context is sent.
|
|
128
|
+
- Start with a table or procedure that you know. If files are missing, run `doctor --path path/to/file.cs`; check `.gitignore` and `.ai_context/ignore`. See [known limitations](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/reference.md#differences-from-the-spec) and [planned work](https://github.com/sfy257000/local-codebase-indexer/blob/main/TODO.md).
|
|
129
|
+
|
|
130
|
+
Found a wrong edge or missing result? Open a [reproducible issue](https://github.com/sfy257000/local-codebase-indexer/issues/new/choose). [Contributions](https://github.com/sfy257000/local-codebase-indexer/blob/main/CONTRIBUTING.md) are welcome. Licensed under [MIT](https://github.com/sfy257000/local-codebase-indexer/blob/main/LICENSE).
|
|
131
|
+
|
|
132
|
+
[SQL / Unicode / VB6 support and upgrade notes](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/sql-legacy-support.md)
|
|
133
|
+
|
|
134
|
+
<!-- mcp-name: io.github.sfy257000/local-codebase-indexer -->
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Local Codebase Indexer
|
|
2
|
+
|
|
3
|
+
**English** | [繁體中文](https://github.com/sfy257000/local-codebase-indexer/blob/main/README.zh-TW.md) | [简体中文](https://github.com/sfy257000/local-codebase-indexer/blob/main/README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
**Which C# code and pages reach this SQL Server table?**
|
|
6
|
+
|
|
7
|
+
Trace tables and stored procedures to repositories, controller actions, and Razor pages in a local source tree. Use the CLI yourself or give your AI assistant the same evidence through MCP. Especially useful when maintaining C# / SQL Server applications with Dapper, ADO.NET, or Entity Framework.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
[Case study and raw results](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/case-study.md) · [CLI reference](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/reference.md) · [PyPI](https://pypi.org/project/local-codebase-indexer/) · [MIT license](https://github.com/sfy257000/local-codebase-indexer/blob/main/LICENSE)
|
|
12
|
+
|
|
13
|
+
## Try it in three steps
|
|
14
|
+
|
|
15
|
+
Python **3.10+**. Run these in a virtual environment; no SQL Server, .NET runtime, model download, or API key is needed for the demo.
|
|
16
|
+
|
|
17
|
+
**1. Install**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
python -m pip install --upgrade local-codebase-indexer
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If Python reports an externally managed environment, create and activate a [virtual environment](https://docs.python.org/3/library/venv.html) first. See the [reference](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/reference.md#install) for isolated installation alternatives.
|
|
24
|
+
|
|
25
|
+
**2. Run the bundled example**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
local-codebase-indexer demo
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This creates a temporary **synthetic** source tree, indexes it, and checks four expected relationships. It does not index your current directory. The animation uses this command's actual output, with reading pauses added. An excerpt:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
table Sales_OrderHeader
|
|
35
|
+
WRITTEN BY (2)
|
|
36
|
+
[confirmed] procedure dbo.usp_ApproveOrder
|
|
37
|
+
[confirmed] method Shop.Data.OrderRepository.Approve ... via usp_ApproveOrder
|
|
38
|
+
READ BY (1)
|
|
39
|
+
[confirmed] method Shop.Data.OrderRepository.Get
|
|
40
|
+
USED BY PROGRAMS (1)
|
|
41
|
+
[probable] Orders ... (Approve, Details)
|
|
42
|
+
pages: Views/Orders/Details.cshtml
|
|
43
|
+
Verified 4/4 expected relationships: PASS
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Use `local-codebase-indexer demo --output demo-orders` to keep a copy in a new or empty folder, or `demo --json` for the complete report.
|
|
47
|
+
|
|
48
|
+
**3. Point it at your source tree**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
local-codebase-indexer --root "/path/to/project" data-access YourTable
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Replace the path and table name. The first query builds the index; subsequent queries refresh it incrementally. SQL definitions must be present in source files for procedure bodies to be analyzed. There is no connection to a live database.
|
|
55
|
+
|
|
56
|
+
## Give the same evidence to your assistant
|
|
57
|
+
|
|
58
|
+
For Claude Code, after installing the package:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
claude mcp add local-indexer -- local-codebase-indexer --root "/absolute/path/to/project" serve
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Ask: “Which code writes `YourTable`, and which controller actions and pages reach it? Show paths and confidence levels.” Restart/reconnect the MCP client if needed. For other stdio MCP clients, use command `local-codebase-indexer` and arguments `--root`, your absolute project path, `serve`.
|
|
65
|
+
|
|
66
|
+
Codex / Copilot can use the CLI. [AGENTS.md](https://github.com/sfy257000/local-codebase-indexer/blob/main/AGENTS.md) contains assistant instructions. The [reference](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/reference.md) also covers the Claude Code plugin, seven MCP tools, ONNX models, aliases, and configuration.
|
|
67
|
+
|
|
68
|
+
## More maintenance questions
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
local-codebase-indexer --root "/path/to/project" relations OrderRepository.Approve --direction upstream
|
|
72
|
+
local-codebase-indexer --root "/path/to/project" impact main...HEAD
|
|
73
|
+
local-codebase-indexer --root "/path/to/project" search "order approval" --explain --limit 5
|
|
74
|
+
local-codebase-indexer --root "/path/to/project" doctor
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Relations show callers; impact compares Git snapshots; search combines identifiers, text, and local embeddings. C#, Python, JavaScript, and TypeScript have symbol parsing; T-SQL and C# have additional data-access analysis. Add `--json` for structured output.
|
|
78
|
+
|
|
79
|
+
## What to verify
|
|
80
|
+
|
|
81
|
+
- This is **static analysis**, with confidence labels. Interface dispatch can be `probable`; name-only candidates and dynamic SQL require source verification. There is no Roslyn overload resolution or runtime execution proof.
|
|
82
|
+
- The default hashing embedder is best at identifiers and related terms. Natural-language paraphrases can miss results. [Benchmarks](https://github.com/sfy257000/local-codebase-indexer/blob/main/benchmarks/README.md) and the [case study](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/case-study.md) explain what was measured; four demo checks do not establish general accuracy or time savings.
|
|
83
|
+
- The index is local at `<project>/.ai_context/indexer.db`. Indexing needs no remote service after dependencies are installed. Your MCP client's model provider controls where returned context is sent.
|
|
84
|
+
- Start with a table or procedure that you know. If files are missing, run `doctor --path path/to/file.cs`; check `.gitignore` and `.ai_context/ignore`. See [known limitations](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/reference.md#differences-from-the-spec) and [planned work](https://github.com/sfy257000/local-codebase-indexer/blob/main/TODO.md).
|
|
85
|
+
|
|
86
|
+
Found a wrong edge or missing result? Open a [reproducible issue](https://github.com/sfy257000/local-codebase-indexer/issues/new/choose). [Contributions](https://github.com/sfy257000/local-codebase-indexer/blob/main/CONTRIBUTING.md) are welcome. Licensed under [MIT](https://github.com/sfy257000/local-codebase-indexer/blob/main/LICENSE).
|
|
87
|
+
|
|
88
|
+
[SQL / Unicode / VB6 support and upgrade notes](https://github.com/sfy257000/local-codebase-indexer/blob/main/docs/sql-legacy-support.md)
|
|
89
|
+
|
|
90
|
+
<!-- mcp-name: io.github.sfy257000/local-codebase-indexer -->
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Local Codebase Indexer
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [繁體中文](README.zh-TW.md) | **简体中文**
|
|
4
|
+
|
|
5
|
+
**这张 SQL Server 数据表,会被哪些 C# 代码和页面使用?**
|
|
6
|
+
|
|
7
|
+
从源代码追踪数据表、存储过程、Repository、Controller Action 和 Razor 页面的关系。可以直接使用 CLI,也可以通过 MCP 让 AI 助手取得同样的路径与证据。适合维护使用 Dapper、ADO.NET 或 Entity Framework 的 C#/SQL Server 项目。
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
[可复现案例及完整输出](docs/case-study.md) · [进阶手册](docs/reference.zh-CN.md) · [PyPI](https://pypi.org/project/local-codebase-indexer/) · [MIT 许可](LICENSE)
|
|
12
|
+
|
|
13
|
+
## 三步开始
|
|
14
|
+
|
|
15
|
+
需要 **Python 3.10+**,建议在虚拟环境执行。内置 demo 不需要 SQL Server、.NET 运行环境、模型下载或 API key。
|
|
16
|
+
|
|
17
|
+
**1. 安装**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
python -m pip install --upgrade local-codebase-indexer
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
若 Python 提示 externally managed environment,请先创建并激活 [venv](https://docs.python.org/3/library/venv.html)。其他独立安装方式见[手册](docs/reference.zh-CN.md)。
|
|
24
|
+
|
|
25
|
+
**2. 运行内置示例**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
local-codebase-indexer demo
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
这会在临时目录创建**合成示例**、建立索引,并检查四项预期关系,不会索引当前工作目录。动画使用该命令的实际输出,并增加阅读停留时间。节选:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
table Sales_OrderHeader
|
|
35
|
+
WRITTEN BY (2)
|
|
36
|
+
[confirmed] procedure dbo.usp_ApproveOrder
|
|
37
|
+
[confirmed] method Shop.Data.OrderRepository.Approve ... via usp_ApproveOrder
|
|
38
|
+
READ BY (1)
|
|
39
|
+
[confirmed] method Shop.Data.OrderRepository.Get
|
|
40
|
+
USED BY PROGRAMS (1)
|
|
41
|
+
[probable] Orders ... (Approve, Details)
|
|
42
|
+
pages: Views/Orders/Details.cshtml
|
|
43
|
+
Verified 4/4 expected relationships: PASS
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
使用 `local-codebase-indexer demo --output demo-orders` 将示例保存在新建或空文件夹;`demo --json` 获取完整报告。
|
|
47
|
+
|
|
48
|
+
**3. 换成自己的项目**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
local-codebase-indexer --root "/path/to/project" data-access YourTable
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
替换路径和表名。首次查询建立索引,之后增量更新。要分析存储过程的内容,源码中必须包含 SQL 定义文件;工具不会连接数据库。
|
|
55
|
+
|
|
56
|
+
## 接入 AI 助手
|
|
57
|
+
|
|
58
|
+
安装包后,在 Claude Code 中注册:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
claude mcp add local-indexer -- local-codebase-indexer --root "/absolute/path/to/project" serve
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
可以问:“哪些代码写入 `YourTable`?哪些 Controller Action 和页面会到达它?请列出路径和置信度。”必要时重新连接或重启 MCP 客户端。
|
|
65
|
+
|
|
66
|
+
其他 stdio MCP 客户端使用命令 `local-codebase-indexer`,参数依次为 `--root`、项目绝对路径、`serve`。Codex/Copilot 可使用 CLI;[AGENTS.md](AGENTS.md) 有助手说明。[进阶手册](docs/reference.zh-CN.md) 包含 Claude Code plugin、七个 MCP 工具、ONNX 模型与配置。
|
|
67
|
+
|
|
68
|
+
## 其他维护问题
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
local-codebase-indexer --root "/path/to/project" relations OrderRepository.Approve --direction upstream
|
|
72
|
+
local-codebase-indexer --root "/path/to/project" impact main...HEAD
|
|
73
|
+
local-codebase-indexer --root "/path/to/project" search "order approval" --explain --limit 5
|
|
74
|
+
local-codebase-indexer --root "/path/to/project" doctor
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
可查询调用者、Git 版本间影响,以及结合标识符、文本和本地 embedding 的搜索。C#、Python、JavaScript、TypeScript 支持符号解析;T-SQL 和 C# 另有数据访问分析。加上 `--json` 获取结构化结果。
|
|
78
|
+
|
|
79
|
+
## 使用前要知道
|
|
80
|
+
|
|
81
|
+
- 这是带有置信度标签的**静态分析**。接口分派可能为 `probable`;名称匹配和动态 SQL 必须回查源码。没有 Roslyn 的重载解析,也不能证明运行时行为。
|
|
82
|
+
- 默认 hashing embedder 适合标识符及相关词,自然语言改写可能漏查。[基准测试](benchmarks/README.md)和[案例](docs/case-study.md)说明测量方式;demo 四项通过不代表一般准确率或节省时间。
|
|
83
|
+
- 索引保存在 `<project>/.ai_context/indexer.db`,安装依赖后不需要远程索引服务。MCP 返回的代码片段发到哪里,取决于你使用的 AI 客户端和模型提供方。
|
|
84
|
+
- 先选一张已知用途的数据表核对结果。遗漏文件时运行 `doctor --path path/to/file.cs`,检查 `.gitignore` 和 `.ai_context/ignore`。更多[限制](docs/reference.zh-CN.md)与[待办](TODO.md)可查手册。
|
|
85
|
+
|
|
86
|
+
发现错误关系或漏查,请附最小示例[提交 issue](https://github.com/sfy257000/local-codebase-indexer/issues/new/choose)。欢迎[贡献](CONTRIBUTING.md)。采用 [MIT 许可](LICENSE)。
|
|
87
|
+
|
|
88
|
+
[SQL/Unicode/VB6 支援與升級說明](docs/sql-legacy-support.md)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Local Codebase Indexer
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **繁體中文** | [简体中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
**這張 SQL Server 資料表,會被哪些 C# 程式與頁面使用?**
|
|
6
|
+
|
|
7
|
+
從原始碼追出資料表、預存程序、Repository、Controller Action 與 Razor 頁面的關係。可以直接用 CLI,也可以透過 MCP 讓 AI 助手取得同樣的路徑與證據。適合維護使用 Dapper、ADO.NET 或 Entity Framework 的 C#/SQL Server 專案。
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
[可重現案例與完整輸出](docs/case-study.md) · [進階手冊](docs/reference.zh-TW.md) · [PyPI](https://pypi.org/project/local-codebase-indexer/) · [MIT 授權](LICENSE)
|
|
12
|
+
|
|
13
|
+
## 三步開始
|
|
14
|
+
|
|
15
|
+
需要 **Python 3.10+**,建議在虛擬環境執行。內建 demo 不需要 SQL Server、.NET 執行環境、模型下載或 API key。
|
|
16
|
+
|
|
17
|
+
**1. 安裝**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
python -m pip install --upgrade local-codebase-indexer
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
若 Python 提示 externally managed environment,先建立並啟用 [venv](https://docs.python.org/3/library/venv.html)。其他獨立安裝方式請看[手冊](docs/reference.zh-TW.md)。
|
|
24
|
+
|
|
25
|
+
**2. 執行內建範例**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
local-codebase-indexer demo
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
這會在暫存目錄建立**合成範例**、建立索引,並檢查四項預期關係,不會索引目前的工作目錄。動畫使用此命令的實際輸出,另加閱讀停留時間。節錄:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
table Sales_OrderHeader
|
|
35
|
+
WRITTEN BY (2)
|
|
36
|
+
[confirmed] procedure dbo.usp_ApproveOrder
|
|
37
|
+
[confirmed] method Shop.Data.OrderRepository.Approve ... via usp_ApproveOrder
|
|
38
|
+
READ BY (1)
|
|
39
|
+
[confirmed] method Shop.Data.OrderRepository.Get
|
|
40
|
+
USED BY PROGRAMS (1)
|
|
41
|
+
[probable] Orders ... (Approve, Details)
|
|
42
|
+
pages: Views/Orders/Details.cshtml
|
|
43
|
+
Verified 4/4 expected relationships: PASS
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
使用 `local-codebase-indexer demo --output demo-orders` 把範例保存在新建或空的資料夾;`demo --json` 可取得完整報告。
|
|
47
|
+
|
|
48
|
+
**3. 換成自己的專案**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
local-codebase-indexer --root "/path/to/project" data-access YourTable
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
替換路徑與資料表名稱。首次查詢建立索引,之後增量更新。若要分析預存程序的內容,原始碼中必須包含 SQL 定義檔;工具不會連線到資料庫。
|
|
55
|
+
|
|
56
|
+
## 接上 AI 助手
|
|
57
|
+
|
|
58
|
+
安裝套件後,在 Claude Code 註冊:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
claude mcp add local-indexer -- local-codebase-indexer --root "/absolute/path/to/project" serve
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
可以問:「哪些程式寫入 `YourTable`?哪些 Controller Action 與頁面會到達它?請列出路徑與信心等級。」必要時重新連線或重啟 MCP 用戶端。
|
|
65
|
+
|
|
66
|
+
其他 stdio MCP 用戶端使用命令 `local-codebase-indexer`,參數依序為 `--root`、專案絕對路徑、`serve`。Codex/Copilot 可使用 CLI;[AGENTS.md](AGENTS.md) 有助手指引。[進階手冊](docs/reference.zh-TW.md) 包含 Claude Code plugin、七個 MCP 工具、ONNX 模型與設定。
|
|
67
|
+
|
|
68
|
+
## 其他維護問題
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
local-codebase-indexer --root "/path/to/project" relations OrderRepository.Approve --direction upstream
|
|
72
|
+
local-codebase-indexer --root "/path/to/project" impact main...HEAD
|
|
73
|
+
local-codebase-indexer --root "/path/to/project" search "order approval" --explain --limit 5
|
|
74
|
+
local-codebase-indexer --root "/path/to/project" doctor
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
可查呼叫者、Git 版本間影響,以及結合識別字、文字與本機 embedding 的搜尋。C#、Python、JavaScript、TypeScript 支援符號解析;T-SQL 與 C# 另有資料存取分析。加上 `--json` 可取得結構化結果。
|
|
78
|
+
|
|
79
|
+
## 使用前要知道
|
|
80
|
+
|
|
81
|
+
- 這是帶有信心標籤的**靜態分析**。介面派送可能是 `probable`;名稱比對與動態 SQL 必須回查原始碼。沒有 Roslyn 的多載解析,也不能證明執行時行為。
|
|
82
|
+
- 預設 hashing embedder 適合識別字及相關詞,自然語言改寫可能漏查。[基準測試](benchmarks/README.md)與[案例](docs/case-study.md)說明測量方式;demo 四項通過不代表一般準確率或省時成效。
|
|
83
|
+
- 索引儲存在 `<project>/.ai_context/indexer.db`,安裝依賴後不需要遠端索引服務。MCP 回傳的程式片段會送到哪裡,取決於你使用的 AI 用戶端與模型供應商。
|
|
84
|
+
- 先選一張已知用途的資料表核對結果。漏掉檔案時執行 `doctor --path path/to/file.cs`,檢查 `.gitignore` 與 `.ai_context/ignore`。更多[限制](docs/reference.zh-TW.md)與[待辦](TODO.md)可查手冊。
|
|
85
|
+
|
|
86
|
+
發現錯誤關係或漏查,請附最小範例[回報 issue](https://github.com/sfy257000/local-codebase-indexer/issues/new/choose)。歡迎[貢獻](CONTRIBUTING.md)。採用 [MIT 授權](LICENSE)。
|
|
87
|
+
|
|
88
|
+
[SQL/Unicode/VB6 支援與升級說明](docs/sql-legacy-support.md)
|
|
@@ -4,8 +4,8 @@ Priorities come from the benchmark (`benchmarks/run_benchmark.py`, baseline in `
|
|
|
4
4
|
|
|
5
5
|
## Next
|
|
6
6
|
|
|
7
|
-
0. **
|
|
8
|
-
1. **
|
|
7
|
+
0. **MCP Registry discovery**: the 0.8.0 release workflow publishes `server.json` after PyPI succeeds, using GitHub OIDC. Verify the live entry after each release; a local manifest alone does not establish publication. See [discovery instructions](docs/discovery.md).
|
|
8
|
+
1. **Remaining data-flow gaps**: non-sink SQL proc-name literals (`Run("usp_X")`), EF `this.ToTable(..)` inside `EntityTypeConfiguration<T>` (entity not taken from the base class yet), and EF updates through tracked entities when the entity was loaded in another method than the one calling `SaveChanges` (only same-method read + `SaveChanges` is listed, as uncertain).
|
|
9
9
|
2. **C# call graph gaps**: overload resolution by argument type, delegates / lambdas / extension methods, call chains longer than one level. Without Roslyn these stay approximate; edges carry `confirmed` / `probable` / `candidate`.
|
|
10
10
|
|
|
11
11
|
## Deferred (not worth doing yet)
|
|
@@ -22,6 +22,8 @@ Priorities come from the benchmark (`benchmarks/run_benchmark.py`, baseline in `
|
|
|
22
22
|
|
|
23
23
|
## Done
|
|
24
24
|
|
|
25
|
+
- 0.9.0: SQL alias/hint/TOP and quoted-name fixes; cursor/TRIM false-positive removal; nested comments and uncertain OPENQUERY analysis; comma sources after JOIN; BOM-aware Unicode source/context handling; constant SQL method attribution; VB6 SQL analysis; separate DDL/schema impact; explicit ignore overrides; modular navigation/context/rendering; lint/mypy CI and Windows Python 3.10/3.12/3.13.
|
|
26
|
+
|
|
25
27
|
- 0.7.0: revision-bound search cursors; historical target snapshots; model content identities; process coordination and crash recovery; focus-preserving context; synonym hot reload; retrieval explanations; project evaluation runner; automatic validated Release assets. Representative user-authored evaluation questions and broader semantic retrieval remain ongoing work.
|
|
26
28
|
|
|
27
29
|
- 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.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Local Codebase Indexer: SQL Server -> C# -> page
|
|
2
|
+
Bundled synthetic sample. No SQL Server, .NET runtime or API key required.
|
|
3
|
+
Indexed 9 files; 0 failed.
|
|
4
|
+
|
|
5
|
+
table Sales_OrderHeader
|
|
6
|
+
defined in Sql/Sales_OrderHeader.sql:1
|
|
7
|
+
WRITTEN BY (2)
|
|
8
|
+
[confirmed] procedure dbo.usp_ApproveOrder Sql/usp_ApproveOrder.sql:4 update (sql)
|
|
9
|
+
[confirmed] method Shop.Data.OrderRepository.Approve Data/OrderRepository.cs:24 update (csharp_sp) via usp_ApproveOrder
|
|
10
|
+
READ BY (1)
|
|
11
|
+
[confirmed] method Shop.Data.OrderRepository.Get Data/OrderRepository.cs:19 select (csharp_sql)
|
|
12
|
+
SCHEMA CHANGED BY (1)
|
|
13
|
+
[confirmed] file Sql/Sales_OrderHeader.sql Sql/Sales_OrderHeader.sql:1 create_table (sql)
|
|
14
|
+
USED BY PROGRAMS (1)
|
|
15
|
+
[probable] Orders read/write Controllers/OrdersController.cs (Approve, Details)
|
|
16
|
+
pages: Views/Orders/Details.cshtml
|
|
17
|
+
note: Static analysis: dynamic SQL is listed under 'possible' and cannot be resolved. PROGRAMS follows confirmed / probable C# calls up to 8 hops to *Controller methods; use relations for a single method's callers.
|
|
18
|
+
|
|
19
|
+
Verified 4/4 expected relationships: PASS
|
|
20
|
+
Exact table mentions: 3 files; controller/page reachability is computed separately.
|
|
21
|
+
Local timing: index 17.2 ms; data-access 0.6 ms.
|
|
22
|
+
This fixture does not establish accuracy or time savings on your project.
|
|
23
|
+
|
|
24
|
+
Try your project:
|
|
25
|
+
local-codebase-indexer --root "/path/to/project" data-access YourTable
|
|
Binary file
|