The AI-native local code index that cuts token waste in terminal and MCP workflows.
cdidx indexes a repository once, then serves full-text, symbol, and dependency queries from a local SQLite FTS5 database. Instead of making an AI agent rescan the same tree on every turn, you can reuse the local index and hand the model smaller, structured payloads.
cdidx . # Index current directory
cdidx search "authenticate" # Full-text search
cdidx definition UserService # Find symbol definitions
cdidx find "guard" --path src/Auth.cs
cdidx deps --path src/ # File-level dependency graph
cdidx mcp # Start MCP server for AI tools46 languages supported. 24 MCP tools. Incremental updates. Zero config.
- Docs: DEVELOPER_GUIDE.md for architecture, AI response details, and release workflow
- AI dev contract: SELF_IMPROVEMENT.md
- Testing: TESTING_GUIDE.md
Most code search tools optimize for either desktop UI workflows or one-off text scanning in a shell. cdidx is built for a different loop: local repositories that need to be searched repeatedly by both humans and AI agents.
CLI-firstâ designed for terminal workflows, scripts, and automation.AI-nativeâ--jsonoutput and MCP structured results are built in, not bolted on.Token-efficientâ compact snippets,map,inspect, and path filters reduce repeated scans and round-trips.Local-firstâ SQLite database lives with the project in.cdidx/.Incrementalâ refresh only changed files with--filesor--commits.
It is not an IDE replacement or desktop search app. It is a small local search runtime you can script, automate, and hand to AI tools.
Use rg when you want a zero-setup one-off scan. Use cdidx when the same repository will be searched again and again.
rg |
cdidx |
|
|---|---|---|
| Best at | One-off text scans | Repeated local code search |
| Setup | None | One-time index build |
| Search model | Reads files every time | Queries a local SQLite FTS5 index |
| Output for automation | Plain text | Human-readable, JSON, and MCP |
| AI integration | Needs parsing | Structured by design |
| Token cost in AI loops | Re-sends broad repo context repeatedly | Reuses the index and fetches short, scoped results |
| Updates after edits | Re-run search | Refresh only changed files |
# One-liner install (no .NET required)
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bash
cdidx .
cdidx search "handleRequest"That is the whole loop:
cdidx .builds or refreshes.cdidx/codeindex.dbcdidx search ...returns results from the local index- after edits, refresh with
cdidx . --files path/to/file.csorcdidx . --commits HEAD
Works in containers, CI, and any Linux/macOS environment â no .NET SDK needed.
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bashInstall a specific version (fetches the installer from that tag to avoid version skew):
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/v1.5.0/install.sh | bash -s -- v1.5.0Supported platforms: linux-x64, linux-arm64, osx-arm64 (glibc-based Linux only; Alpine/musl is not supported). Installs to ~/.local/bin by default (override with CDIDX_INSTALL_DIR).
Dockerfile example:
# Install cdidx into /usr/local/bin so it's on PATH immediately
RUN export CDIDX_INSTALL_DIR=/usr/local/bin \
&& curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bashRequires .NET 8.0 SDK.
dotnet tool install -g cdidxThat's it. cdidx is now available as a command.
If you already have cdidx installed, update to the latest version:
dotnet tool update -g cdidxRequires .NET 8.0 SDK.
dotnet build src/CodeIndex/CodeIndex.csproj -c Release
dotnet publish src/CodeIndex/CodeIndex.csproj -c Release -o ./publishThen add the binary to your PATH:
Linux:
sudo cp ./publish/cdidx /usr/local/bin/cdidxmacOS:
sudo cp ./publish/cdidx /usr/local/bin/cdidxIf /usr/local/bin is not in your PATH (Apple Silicon default shell):
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zprofile
source ~/.zprofileWindows:
# PowerShell (run as Administrator)
New-Item -ItemType Directory -Force -Path C:\Tools
Copy-Item .\publish\cdidx.exe C:\Tools\cdidx.exe
# Add to PATH permanently (current user)
$path = [Environment]::GetEnvironmentVariable('Path', 'User')
if ($path -notlike '*C:\Tools*') {
[Environment]::SetEnvironmentVariable('Path', "$path;C:\Tools", 'User')
}Restart your terminal after adding to PATH.
cdidx --versioncdidx ./myproject
cdidx ./myproject --rebuild # full rebuild from scratch
cdidx ./myproject --verbose # show per-file detailsBy default, cdidx index stores the database in <projectPath>/.cdidx/codeindex.db, even if you run the command from another directory.
Default output:
â ¹ Scanning...
Found 42 files
Indexing...
ââââââââââââââââââââââââââââââââ 67.0% [28/42]
Done.
Files : 42
Chunks : 318
Symbols : 156
Skipped : 28 (unchanged)
Graph : ready
Issues : ready
Fold : ready
Elapsed : 00:00:02
Machine-readable output also reports the post-run readiness bits directly:
cdidx ./myproject --json{"status":"success","mode":"incremental","summary":{"files_total":42,"chunks_total":318,"symbols_total":156,"references_total":420,"files_scanned":42,"files_skipped":28,"files_purged":0,"errors":0},"graph_table_available":true,"issues_table_available":true,"fold_ready":true,"elapsed_ms":2012}With --verbose, each file also shows a status tag so you can see exactly what happened:
[OK ] src/app.cs (12 chunks, 5 symbols)
[SKIP] src/utils.cs
[DEL ] src/old.cs
[ERR ] src/bad.cs: <message>
[OK ]= indexed successfully,[SKIP]= unchanged / skipped,[DEL ]= deleted from DB (file removed from disk),[ERR ]= failed (verbose mode includes stack trace)
This is useful for debugging indexing issues or verifying which files were actually processed.
If you only need to upgrade an older .cdidx/codeindex.db to Unicode-aware --exact, you do not need a full rebuild:
cdidx backfill-foldThis recomputes name_folded / *_folded columns from the existing DB rows and stamps fold_ready without reparsing source files. The target must already be an existing CodeIndex DB; blank or missing paths are rejected instead of creating a new database.
cdidx search "authenticate" # full-text search
cdidx search "handleRequest" --lang go # filter by language
cdidx search "TODO" --limit 50 # more results
cdidx search "auth*" --fts # raw FTS5 syntax (prefix search)
cdidx search "Run();" --exact-substring # case-sensitive exact substring, no FTS5Output:
src/Auth/Login.cs:15-30
public bool Authenticate(string user, string pass)
{
var hash = ComputeHash(pass);
return _store.Verify(user, hash);
...
src/Auth/TokenService.cs:42-58
public string GenerateToken(User user)
{
var claims = BuildClaims(user);
return _jwt.CreateToken(claims);
...
(2 results)
Human-readable search output is centered around the first matching line when possible, instead of always showing the start of the chunk.
Use --json for machine-readable output (AI agents):
{"path":"src/Auth/Login.cs","start_line":15,"end_line":30,"content":"public bool Authenticate(...)...","lang":"csharp","score":12.5}
{"path":"src/Auth/TokenService.cs","lang":"csharp","chunk_start_line":1,"chunk_end_line":80,"snippet_start_line":40,"snippet_end_line":47,"snippet":"if (claims.Count == 0)\\n throw new InvalidOperationException();\\nreturn GenerateToken(claims);","match_lines":[42,47],"highlights":[{"line":47,"text":"return GenerateToken(claims);","terms":["GenerateToken"]}],"context_before":2,"context_after":3,"score":9.8}cdidx symbols UserService # find by name
cdidx symbols UserService OrderService AuthService # multi-name OR (positional)
cdidx symbols --name UserService --name OrderService # multi-name OR (--name)
cdidx symbols Run --exact-name # exact name match (no `RunAsync` / `RunImpact` expansion)
cdidx symbols --kind class # all classes
cdidx symbols --kind function --lang pythonUse --exact-name when you already have a precise candidate list (e.g. names returned from an earlier search / inspect / map call). Names are compared case-insensitively for equality instead of substring, so Run will not also pull in RunAsync, RunImpact, etc. --exact-name composes with --name, positional names, and all existing filters. The older --exact spelling still works on these commands for backward compatibility, but --exact-name avoids the semantic clash with search. The fold is NFKC + Unicode CaseFold: common non-ASCII pairs such as à / À, fullwidth ïœïœ / Run, ligatures, sharp-S (StraÃe / STRASSE), and Greek final sigma (Σ / Ï / Ï) now collapse correctly. Unicode CaseFold remains locale-invariant, so Turkish dotted İ still folds to i\u0307 rather than plain i. DBs with stale fold metadata fall back to ASCII COLLATE NOCASE until the DB contains only current folded keys. Prefer cdidx backfill-fold to refresh stored folded keys without reparsing. A plain cdidx index . is also enough if the scan rewrites or purges every stale row; otherwise use cdidx index . --rebuild. Use status --json â fold_ready to detect which path is active.
Output:
class UserService src/Services/UserService.cs:8-72
function GetUserById src/Services/UserService.cs:24-41
function CreateUser src/Services/UserService.cs:45-61
(3 symbols)
With --json, symbol results also include definition ranges, optional body ranges, signature text, container symbol, visibility, and return type when the language extractor can infer them:
{"path":"src/Services/UserService.cs","lang":"csharp","kind":"function","name":"GetUserById","line":24,"start_line":24,"end_line":41,"body_start_line":26,"body_end_line":41,"signature":"public async Task<User> GetUserById(int id)","container_kind":"class","container_name":"UserService","visibility":"public","return_type":"Task<User>"}search, definition, references, callers, callees, symbols, files, and find also share repeatable --path <pattern> (multiple values are OR'd together), repeatable --exclude-path <pattern>, and --exclude-tests filters. Search results prefer source files over tests and docs, and search boosts files whose symbol names or paths match the query exactly.
search --json and MCP search return compact match-centered snippets instead of whole chunks. Each result includes chunk_start_line, chunk_end_line, snippet_start_line, snippet_end_line, snippet, match_lines, highlights, context_before, and context_after. Use --snippet-lines <n> to shrink or widen the excerpt window (default: 8, max: 20).
cdidx definition ResolveGitCommonDir
cdidx definition ResolveGitCommonDir --path src/CodeIndex/Cli --exclude-tests
cdidx definition ResolveGitCommonDir --body --jsondefinition uses indexed symbol ranges plus chunk reconstruction to return the actual declaration text, and optional body content when the language extractor can infer a body range.
cdidx inspect ResolveGitCommonDir --exclude-tests
cdidx inspect ResolveGitCommonDir --exclude-tests --jsoninspect bundles the primary definition, nearby symbols from the same file, references, callers, callees, file metadata, workspace freshness metadata, and call-graph support metadata so AI clients can answer many symbol-oriented questions without chaining several separate commands. When a language is unsupported for references / callers / callees, inspect --json now says so explicitly instead of leaving AI clients to infer that from empty arrays.
cdidx references ResolveGitCommonDir --exclude-tests
cdidx callers ResolveGitCommonDir --exclude-tests --json
cdidx callees AddToGitExclude --exclude-testsThese commands use the indexed reference graph and are intended for languages where cdidx already extracts named symbols and call-like references: Python, JavaScript/TypeScript, C#, Go, Rust, Java, Kotlin, Ruby, C/C++, PHP, Swift, Dart, Scala, Elixir, Lua, and VB.NET (18 languages). F# uses space-separated call syntax so graph queries are not supported; use search instead. For docs, config, markup, or other unsupported languages, fall back to search.
When you pass --lang for an unsupported language, human-readable graph commands now say so explicitly, and MCP graph tools expose graph_language, graph_supported, and graph_support_reason alongside the empty result list.
cdidx outline src/CodeIndex/Cli/GitHelper.cs
cdidx outline src/CodeIndex/Cli/GitHelper.cs --jsonShows all symbols in a single file ordered by line, with kind, signature, visibility, and container nesting. Lets AI agents understand file structure in one call instead of reading the whole file or chaining symbols + definition.
cdidx excerpt src/CodeIndex/Cli/GitHelper.cs --start 19 --end 28
cdidx excerpt src/CodeIndex/Cli/GitHelper.cs --start 19 --end 28 --before 3 --after 3 --jsoncdidx find "graph table" --path src/CodeIndex/Cli/QueryCommandRunner.cs
cdidx find "Graph Table" --path src/CodeIndex/Cli/QueryCommandRunner.cs --exact --before 1 --after 1 --jsonfind fills the gap between repo-wide search and line-number-based excerpt: when you already know the target file, it returns matching line numbers, columns, and short surrounding context from the indexed file without falling back to raw-text tools.
cdidx files # all indexed files
cdidx files --lang csharp # only C# files
cdidx files --path src/Services --exclude-path MigrationsOutput:
csharp 120 lines src/Services/UserService.cs
csharp 85 lines src/Controllers/UserController.cs
csharp 42 lines src/Models/User.cs
(3 files)
cdidx statusOutput:
Files : 42
Chunks : 318
Symbols : 156
Refs : 912
Languages:
csharp 28
python 10
javascript 4
cdidx map --path src/ --exclude-tests
cdidx map --path src/ --exclude-tests --jsonmap is the fastest way to orient both a human and an AI agent before deeper queries. Use it to get languages, modules, hot files, and likely entrypoints, then narrow with inspect, search, or definition. For the full freshness and metadata contract of status --json, map --json, inspect --json, and MCP analyze_symbol, see DEVELOPER_GUIDE.md.
| Option | Applies to | Description |
|---|---|---|
--db <path> |
All commands | Database file path. index defaults to <projectPath>/.cdidx/codeindex.db; query commands default to .cdidx/codeindex.db in the current directory. |
--json |
All commands | JSON output (for AI/machine use) |
--limit <n> |
Query commands | Max results (default: 20; map uses it per section) |
--lang <lang> |
Query commands | Filter by language |
--path <pattern> |
search, definition, references, callers, callees, symbols, files, find, map, inspect |
Restrict results to paths containing this text. Repeatable; multiple values are OR'd together |
--exclude-path <pattern> |
search, definition, references, callers, callees, symbols, files, find, map, inspect |
Exclude paths containing this text (repeatable) |
--exclude-tests |
search, definition, references, callers, callees, symbols, files, find, map, inspect |
Exclude likely test files and prefer production code |
--snippet-lines <n> |
search |
Search snippet length for human-readable output and JSON/MCP snippets (default: 8, max: 20) |
--fts |
search |
Use raw FTS5 query syntax instead of literal-safe quoting |
--exact |
search, find, symbols, definition, references, callers, callees, inspect |
Backward-compatible shorthand. Prefer --exact-substring for search, keep --exact for find, and prefer --exact-name for symbol / graph commands plus inspect. JSON and MCP degraded-state metadata remain exact_index_available / degraded_reason (plus legacy camelCase aliases in MCP). |
--exact-substring |
search |
Preferred explicit name for search exactness: case-sensitive exact substring (FTS5 bypassed). |
--exact-name |
symbols, definition, references, callers, callees, inspect |
Preferred explicit name for symbol-name exactness: NFKC + Unicode CaseFold exact equality (à / À, ïœïœ / Run, ligatures, sharp-S, and Greek final sigma collapse). Unicode CaseFold remains locale-invariant, so Turkish dotted İ is still distinct from plain i. Falls back to ASCII COLLATE NOCASE while the DB still contains stale fold metadata; prefer cdidx backfill-fold, or use a plain cdidx index . if it rewrites or purges every stale row, otherwise --rebuild. status --json exposes fold_ready so AI clients can tell which path is active. When a read-only legacy DB is missing the fallback exact-match indexes, human-readable output warns and CLI JSON / MCP structuredContent expose degraded-state metadata. |
--kind <kind> |
definition, symbols |
Filter by symbol kind (function/class/struct/interface/enum/property/event/delegate/namespace/import) |
--body |
definition, inspect |
Include reconstructed body content when the language extractor can infer the body range |
--count |
search, definition, references, callers, callees, symbols, files, find, unused |
Return only the result count (with --json: a single count object; graph-aware commands may add trust metadata) |
--start <line> |
excerpt |
Start line for excerpt reconstruction |
--end <line> |
excerpt |
End line for excerpt reconstruction (defaults to --start) |
--before <n> |
excerpt, find |
Include extra context lines before the requested excerpt or match |
--after <n> |
excerpt, find |
Include extra context lines after the requested excerpt or match |
--rebuild |
index |
Delete existing DB and rebuild |
--verbose |
index |
Show per-file status ([OK ]/[SKIP]/[DEL ]/[ERR ]) |
--commits <id...> |
index |
Update only files changed in specified commits. Prefer this after a normal commit because git history includes rename/delete paths. |
--files <path...> |
index |
Update only the specified files. Safe for known in-place edits or new files; old rename/delete paths are not purged unless you also list them explicitly. |
--since <datetime> |
files |
Filter to files modified since this ISO 8601 timestamp |
--no-dedup |
search |
Disable overlapping-chunk deduplication for raw results |
--reverse |
deps |
Reverse lookup: show files that depend ON the matched path |
--top <n> |
Query commands | Alias for --limit |
| Code | Meaning |
|---|---|
0 |
Success |
1 |
Usage error (invalid arguments) |
2 |
Not found (no search results, missing directory) |
3 |
Database error |
If a query fails with a SQLite reader error such as The data is NULL at ordinal N, set CDIDX_DEBUG=1 and rerun. The failing SQL, bound parameters, and the last-read row's columns will be printed to stderr so the offending record can be located. No-op when unset.
Text values (chunk content, context, paths, signatures, string parameters) are redacted by default â only the length and a short SHA256 prefix are emitted, so diagnostics can be pasted into issues without leaking indexed source code. Numeric columns, column names, NULL markers, and SQL text are shown as-is. To include raw text content in a local troubleshooting session, set CDIDX_DEBUG=unsafe instead (never paste this output publicly).
CDIDX_DEBUG=1 cdidx unused # redacted text / ããã¹ãäŒåå
CDIDX_DEBUG=unsafe cdidx unused # raw content, local only / çããã¹ããããŒã«ã«ã®ã¿cdidx scans your project directory, splits each source file into overlapping chunks, and stores everything in a SQLite database with FTS5 full-text search. Incremental mode (default) first purges database entries for files that no longer exist on disk, then checks each file's last-modified timestamp against the database â only files whose timestamp exactly matches are skipped, and any difference (newer or older) triggers re-indexing. Newly appeared files are indexed as new entries. This means re-indexing after a branch switch only processes the files that actually differ.
cdidx index automatically adds .cdidx/ to .git/info/exclude. You don't need to edit .gitignore.
.git/info/exclude is a standard Git mechanism that works just like .gitignore. Many tools use .git/info/exclude or store data inside .git/ to avoid polluting .gitignore â git-lfs, git-secret, git-crypt, git-annex, Husky, pre-commit, JetBrains IDEs, VS Code (GitLens), Eclipse, etc.
The database reflects the working tree at the time of the last index. After switching branches, simply re-run cdidx . â files that no longer exist on disk are purged from the database, newly appeared files are indexed, and existing files are re-indexed only when their timestamp differs. The update is proportional to the number of changed files, not the total project size.
| Situation | What happens |
|---|---|
| File unchanged across branches | Skipped (instant) |
| File content changed | Re-indexed |
| File deleted after checkout | Purged from DB |
| File added after checkout | Indexed as new |
| Language | Extensions | Symbols |
|---|---|---|
| Python | .py |
yes |
| JavaScript | .js, .jsx |
yes |
| TypeScript | .ts, .tsx |
yes |
| C# | .cs |
yes |
| Go | .go |
yes |
| Rust | .rs |
yes |
| Java | .java |
yes |
| Kotlin | .kt |
yes |
| Ruby | .rb |
yes |
| C | .c, .h |
yes |
| C++ | .cpp, .cc, .cxx, .hpp, .hxx |
yes |
| PHP | .php |
yes |
| Swift | .swift |
yes |
| Dart | .dart |
yes |
| Scala | .scala, .sc |
yes |
| Elixir | .ex, .exs |
yes |
| Lua | .lua |
yes |
| R | .r, .R |
yes |
| Haskell | .hs, .lhs |
yes |
| F# | .fs, .fsx, .fsi |
yes |
| VB.NET | .vb, .vbs |
yes |
| Razor/Blazor | .cshtml, .razor |
yes (as C#) |
| Protobuf | .proto |
yes |
| GraphQL | .graphql, .gql |
yes |
| Gradle | .gradle |
yes |
| Makefile | Makefile |
yes |
| Dockerfile | Dockerfile |
yes |
| Zig | .zig |
yes |
| XAML | .xaml, .axaml |
-- |
| MSBuild | .csproj, .fsproj, .vbproj, .props, .targets |
-- |
| Shell | .sh, .bash, .zsh, .fish |
-- |
| PowerShell | .ps1 |
yes |
| Batch | .bat, .cmd |
-- |
| CMake | .cmake, CMakeLists.txt |
-- |
| SQL | .sql |
-- |
| Markdown | .md |
-- |
| YAML | .yaml, .yml |
-- |
| JSON | .json |
-- |
| TOML | .toml |
-- |
| HTML | .html |
-- |
| CSS | .css, .scss |
yes |
| Vue | .vue |
-- |
| Svelte | .svelte |
-- |
| Terraform | .tf |
-- |
All languages are fully searchable via FTS5. Languages with Symbols = yes also support structured queries by function/class/import name.
AI agents that query the database directly via SQL need the sqlite3 CLI.
| OS | Status |
|---|---|
| macOS | Pre-installed |
| Linux | Usually pre-installed. If not: sudo apt install sqlite3 |
| Windows | winget install SQLite.SQLite or scoop install sqlite |
cdidx helps AI tools by replacing repeated repo-wide scans with a reusable local index.
search --jsonand MCPsearchreturn compact match-centered snippets instead of large file dumps, and--snippet-lineslets you cap payload size up front.map,inspect,definition,deps, andimpactreduce multi-step repository exploration into fewer round-trips.--path, repeatable--exclude-path, and--exclude-testskeep results focused before you spend tokens on excerpts or follow-up prompts.status --json,map --json, andinspect --jsonexpose freshness and git-state signals so an agent can decide whether the index is trustworthy.unused --jsonand MCPunused_symbolsexpose bucketed dead-code triage metadata plus graph-support signals, so machine clients can distinguish likely-private cleanup from public/config/reflection suspects and from unsupported-language empty pages.cdidx mcpgives Claude Code, Cursor, Windsurf, Copilot, and Codex a native MCP server instead of forcing them to scrape shell text.
For the full MCP tool list, JSON field contracts, exact-match metadata, and fallback behavior on legacy databases, see DEVELOPER_GUIDE.md.
To let AI agents use the generated index, place a CLAUDE.md in your project root (the template below is for downstream projects that adopt cdidx â contributors working on the cdidx repo itself should follow CLAUDE.md in this repo, which routes execution through the locally built dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll instead of a bare cdidx command):
# Code Search Rules
This project uses **cdidx** for fast code search via a pre-built SQLite index (`.cdidx/codeindex.db`).
**Query this database** instead of using `find`, `grep`, or `ls -R`.
## Setup
First check if `cdidx` is available:
```bash
cdidx --version
```
**If not found**, install it:
```bash
# No .NET required â downloads a self-contained binary
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bash
```
Or, if .NET 8+ SDK is available:
```bash
dotnet tool install -g cdidx
```
**If already installed**, update to the latest version:
```bash
# Re-run the installer to upgrade
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bash
```
If install fails (no network, unsupported platform), skip to the **"Direct SQL queries"** section below â you can query `.cdidx/codeindex.db` directly with `sqlite3`, provided the database was already built. If neither `cdidx` nor `sqlite3` is available, use the Claude Code built-in `Grep` / `Glob` tools (or your harness's equivalent) â do not fall back to shell `rg` / `grep` / `find` or a global `cdidx` in a Claude Code session, since those may be blocked by a repo-tracked deny list and bypassing them can hide stale-binary bugs.
Before searching, update the index so results are accurate:
```bash
cdidx . # incremental update (skips unchanged files)
```
## Keeping the index up to date (requires cdidx)
After editing files, update the database so search results stay accurate:
```bash
cdidx . --files path/to/changed_file.cs # update specific files you modified
cdidx . --commits HEAD # update all files changed in the last commit
cdidx . --commits abc123 # you can also pass a specific commit hash
cdidx . # full incremental update (skips unchanged files)
```
**Rule: whenever you modify source files, run one of the above before your next search.**
If the checkout changed because of `git reset`, `git rebase`, `git commit --amend`, `git switch`, or `git merge`, prefer `cdidx .` so stale files are purged against the current worktree instead of only refreshing commit-local paths.
## Query strategy
- Start with `map` when you need a quick overview of languages, modules, and likely hot spots before issuing symbol or text queries.
- Check `status --json` when freshness matters. Use `indexed_at`, `latest_modified`, `git_head`, and `git_is_dirty` to decide whether you need to re-run `cdidx .` before trusting results. If you already started with `map --json`, treat `indexed_at` / `latest_modified` there as filter-scoped freshness and `workspace_indexed_at` / `workspace_latest_modified` as the whole-workspace view.
- Use `inspect` when you already have a candidate symbol name and want bundled definition/caller/callee/reference context in one round-trip. Add `--exact` to match leaf-command precision â `exact` is propagated into every bundled sub-query so `inspect Run --exact` will not drag in `RunAsync` / `RunImpact`. `inspect --json` also carries `workspace_indexed_at`, `workspace_latest_modified`, `project_root`, `git_head`, and `git_is_dirty` for trust decisions.
- Use `definition` when you need the declaration text for a named symbol, and add `--body` when the implementation body matters.
- Use `references`, `callers`, and `callees` for symbol-aware call graph questions in Python, JavaScript/TypeScript, C#, Go, Rust, Java, Kotlin, Ruby, C/C++, PHP, Swift, Dart, Scala, Elixir, Lua, and VB.NET (18 languages). F# uses space-separated call syntax so graph queries are not supported; use `search` instead. Add `--exact` when you already have a precise name (e.g. resolved from `symbols --exact` / `inspect`) so `references Run` no longer pulls in `RunAsync` / `RunImpact` / etc. â same for `callers` / `callees` / `definition`.
- Use `impact` for pre-edit ripple checks on callable symbols. When the query resolves, within the active `--lang` / `--path` / `--exclude-path` / `--exclude-tests` scope and graph-supported languages only, to a single class / struct / interface definition and no symbol-level callers exist, `impact` / MCP `impact_analysis` may return heuristic file-level dependency hints instead of a silent false negative; same-name non-callable siblings such as `namespace` or `import` definitions do not block that fallback, and pure non-callable queries return `non_callable_symbol_kind` guidance instead of an unexplained zero. To reduce noise, those hints are emitted only for files that both reference one of the target type's member names and also carry same-file structured type evidence in indexed symbol metadata such as signatures or return types, rather than raw comment/string text matches. That evidence path is Unicode-aware, so fullwidth/accented identifiers follow the same exact-match semantics as the rest of the impact resolver. The hints are still not authoritative because the current graph does not record the resolved target file/type for each call, but they are returned as normal successful output: `count` / `file_count` describe the visible returned set, while `confirmed_count` / `confirmed_file_count` stay at the symbol-level caller totals so clients can inspect `impact_mode`, `heuristic`, `hint_count`, and `truncated`. `impact --json --count` uses the same `*_count` field names as the full payload. When the scoped query resolves to multiple class-like definitions (for example partial classes or same-name definitions sharing one file), the zero-result payload explains that and suggests `deps --path <definition-path> --reverse` or a more specific member query.
- Use `symbols` for named code entities in symbol-aware languages (32 languages including Python, JavaScript/TypeScript, C#, Go, Rust, Java, Kotlin, Ruby, C/C++, PHP, Swift, Dart, Scala, F#, VB.NET, Elixir, Lua, R, Haskell, Shell, SQL, Terraform, Protobuf, GraphQL, Gradle, Makefile, Dockerfile, Zig, PowerShell, CSS/SCSS). Add `--exact` when you already have a precise candidate list (e.g. names from a prior `inspect` / `map` / `search` result) so `Run` no longer expands to `RunAsync` / `RunImpact` â pairs cleanly with repeated `--name`.
- Use `outline` to see the full symbol structure of a single file without reading its content.
- Use `search` for raw text, comments, strings, or languages without structured symbol extraction such as XAML, Markdown, YAML, JSON, TOML, HTML, Vue, Svelte.
- Add `--exclude-tests` unless you are explicitly investigating tests.
- Add `--path <text>` and repeatable `--exclude-path <text>` before broad searches so results stay inside the relevant module.
- Add `--snippet-lines <n>` to `search` when you need tighter JSON output before handing results to another model or tool.
- Use `files` to discover candidate paths, `find` to re-locate exact text inside known files, then `excerpt` to fetch only the needed lines instead of opening entire files.
- Use `deps` to understand file-level dependencies â which files reference symbols from other files. Add `--reverse` to find what depends on a given file (impact analysis).
- Use `unused` to find potentially dead code â symbols defined but never referenced (only meaningful for graph-supported languages). Results are bucketed so private/file-local candidates stay earlier than public/exported or config/reflection suspects, and returned pages use bounded overfetch plus cross-bucket diversification before `--limit` is applied so one noisy bucket is less likely to hide the rest without silently capping large `--limit` requests. The suspect bucket is reserved for public/exported properties that look config-bound or, for C#, have nearby serializer/ORM-style attributes. Unsupported `--lang` filters now return an empty page with `graph_supported=false` instead of fake unused hits. CLI JSON uses per-symbol `unused_bucket` / `unused_confidence` / `unused_reason`, MCP uses `unusedBucket` / `unusedConfidence` / `unusedReason`, and both include page-scoped `returned_bucket_counts`. Zero-result JSON pages keep the same schema (`count`, empty `symbols`, empty page counts, and graph trust metadata) instead of going silent, and `unused --json` returns that payload with exit code `0` so machine clients can consume it as a normal empty page. When `--lang` is specified, CLI JSON also includes `graph_supported` / `graph_support_reason` so AI clients can tell whether the language actually has indexed call-graph support.
- Use `hotspots` to find the most-referenced symbols â central, high-impact code that changes may affect widely.
- Use `files --since <datetime>` or `search --since <datetime>` to focus on recently modified code.
- Use `--dry-run` with `index` to preview what would be indexed without writing to the database.
- Use `--count` to get result counts before fetching full data (saves tokens for AI agents).
- If you encounter a bug, unexpected behavior, or think of a feature that would improve cdidx, file an issue at https://github.com/Widthdom/CodeIndex/issues describing what happened and the expected behavior.
## CLI (recommended if cdidx is available)
```bash
cdidx map --path src/ --exclude-tests --json
cdidx inspect "Authenticate" --exclude-tests
cdidx search "keyword" --path src/ --exclude-tests --snippet-lines 6
cdidx definition "ClassName" --path src/Services --body
cdidx callers "Authenticate" --lang csharp --exclude-tests
cdidx callees "HandleRequest" --path src/ --exclude-tests
cdidx symbols "ClassName" --lang csharp --exclude-tests
cdidx find "guard" --path src/app.py --after 2
cdidx excerpt src/app.py --start 10 --end 20
cdidx files --lang python --path src/
cdidx status --json
```
## Direct SQL queries (fallback if cdidx is unavailable)
The queries below require `sqlite3`. If it is not installed, suggest the user install it:
- **macOS**: pre-installed
- **Linux**: `sudo apt install sqlite3`
- **Windows**: `winget install SQLite.SQLite` or `scoop install sqlite`
### Full-text search
```sql
SELECT f.path, c.start_line, c.content
FROM fts_chunks fc
JOIN chunks c ON c.id = fc.rowid
JOIN files f ON f.id = c.file_id
WHERE fts_chunks MATCH 'keyword'
LIMIT 20;
```
### Search by function/class name
```sql
SELECT f.path, s.name, s.line
FROM symbols s
JOIN files f ON f.id = s.file_id
WHERE s.kind = 'function' AND s.name LIKE '%keyword%';
```
### Incremental updates for CI / hooks
Instead of re-indexing the entire project, AI agents can update only the files that changed:
```bash
# Update only files changed in specific commits
# Prefer this after a normal commit because git history also carries rename/delete paths
cdidx ./myproject --commits abc123 def456
# Update only specific files after known in-place edits or new-file additions
# Old rename/delete paths are not purged unless you also list them explicitly
cdidx ./myproject --files src/app.cs src/utils.cs
```
Prefer `--commits` for commit-driven automation. Use `--files` for editor/save hooks that only touch existing paths or add new files. After `git reset`, `git rebase`, `git commit --amend`, `git switch`, or `git merge`, prefer a full `cdidx ./myproject --json` refresh so repo-wide stale paths are purged against the current checkout.
These options make it practical to keep the index up-to-date in real time, even on large codebases, without pretending that every delta workflow purges stale paths equally.cdidx includes a built-in MCP (Model Context Protocol) server. MCP is a standard protocol that lets AI coding tools communicate with external programs. When you run cdidx mcp, cdidx starts listening on stdin/stdout â your AI tool sends search requests as JSON, and cdidx returns results instantly from the pre-built index.
Tool results include structured JSON in structuredContent plus a short text summary in content, so AI tools can parse typed data without scraping large text blocks.
flowchart LR
tools["Claude Code<br/>Cursor<br/>Windsurf"]
server["cdidx<br/>mcp server"]
tools -->|"stdin (JSON-RPC)"| server
server -->|"stdout (JSON-RPC)"| tools
Setup â add to your AI tool's config:
Claude Code (.claude/settings.json or .mcp.json):
{
"mcpServers": {
"cdidx": {
"command": "cdidx",
"args": ["mcp", "--db", ".cdidx/codeindex.db"]
}
}
}Cursor (.cursor/mcp.json):
{
"mcpServers": {
"cdidx": {
"command": "cdidx",
"args": ["mcp", "--db", ".cdidx/codeindex.db"]
}
}
}Windsurf (.windsurf/mcp.json):
{
"mcpServers": {
"cdidx": {
"command": "cdidx",
"args": ["mcp", "--db", ".cdidx/codeindex.db"]
}
}
}GitHub Copilot (VS Code â .vscode/mcp.json):
{
"servers": {
"cdidx": {
"type": "stdio",
"command": "cdidx",
"args": ["mcp", "--db", ".cdidx/codeindex.db"]
}
}
}OpenAI Codex CLI (codex.json or ~/.codex/config.json):
{
"mcpServers": {
"cdidx": {
"command": "cdidx",
"args": ["mcp", "--db", ".cdidx/codeindex.db"]
}
}
}Once configured, the AI can directly call these tools:
| Tool | Description |
|---|---|
search |
Full-text search across code chunks |
definition |
Reconstruct a symbol declaration and optional body |
references |
Find indexed references for supported languages |
callers |
List callers for a named symbol in supported languages |
callees |
List callees for a named symbol in supported languages |
symbols |
Find functions, classes, interfaces, imports, and namespaces by name |
files |
List indexed files |
find_in_file |
Find literal substring matches inside known indexed files with line/column context |
excerpt |
Reconstruct a specific line range from indexed chunks |
map |
Summarize languages, modules, hotspots, and likely entrypoints |
analyze_symbol |
Bundle definition, nearby symbols, references, callers, callees, file metadata, workspace trust metadata, and graph support metadata |
outline |
Show all symbols in a single file with line numbers, signatures, and nesting |
status |
Database statistics |
deps |
File-level dependency edges from the reference graph |
impact_analysis |
Compute transitive callers of a symbol, with single-type fallback to heuristic file-level dependency hints and partial-definition hints |
unused_symbols |
Find symbols defined but never referenced, with confidence buckets for dead-code triage |
symbol_hotspots |
Find most-referenced symbols (high-impact code) |
batch_query |
Execute multiple queries in a single call (MCP only, max 10) |
validate |
Report encoding issues (U+FFFD, BOM, null bytes, mixed line endings) |
languages |
List all supported languages, file extensions, and capabilities |
ping |
Lightweight connection check |
index |
Index or re-index a project directory |
backfill_fold |
Upgrade folded-name keys in an existing DB without reparsing source files |
suggest_improvement |
Submit structured improvement suggestions or error reports |
No CLAUDE.md hacks or SQL templates needed â the AI interacts with cdidx natively.
If you only need to upgrade an older .cdidx/codeindex.db for Unicode --exact, or to repair fold metadata drift by regenerating folded keys without reparsing source files, run:
cdidx backfill-foldThis recomputes persisted name_folded / *_folded columns from existing DB rows and stamps fold_ready when verification succeeds. The target must already be an existing CodeIndex DB; blank or missing paths are rejected instead of creating a new database.
Graph-oriented MCP tools such as references, callers, and callees also return graph_language, graph_supported, and graph_support_reason when a language filter is provided, so clients can distinguish unsupported languages from genuine zero-hit queries.
All MCP tools include annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) so AI clients can auto-approve safe read-only queries without prompting the user.
grep / rg |
cdidx |
|
|---|---|---|
| Output format | Plain text (needs parsing) | Structured JSON (search/symbols-style hits stream as JSON lines; summaries/counts and degraded zero-result graph responses use one object) |
| Search speed on large repos | Scans every file each time | Pre-built FTS5 index |
| Symbol awareness | None | Functions, classes, imports |
| Token footprint across repeated turns | Broad raw context | Short indexed snippets |
| Incremental update | N/A | --commits, --files |
cdidx includes a suggest_improvement MCP tool for AI agents that hit gaps or bugs. Suggestions are saved locally to .cdidx/suggestions.json, and are sent to GitHub only when the user explicitly provides CDIDX_GITHUB_TOKEN. Payload details and source-code leak guardrails are documented in the Developer Guide.
Maintainers / forkers only â the full release procedure now lives in DEVELOPER_GUIDE.md#release-workflow. MAINTAINERS.md is the maintainer index.
The short version: version.json is the single source of truth, and the maintainer checklist covers branch/PR triage, changelog promotion, tagging, and clean-install verification.
- Developer Guide â Architecture, database schema, AI response contracts, release workflow, design decisions
- Testing Guide â Test suite layout, helper utilities, cross-platform rules, and test maintenance conventions
- Self-Improvement Loop â Ready-to-use operating contract for iterative AI-driven cdidx improvements
ã¿ãŒããã«ãšMCPã¯ãŒã¯ãããŒã§AIã®ããŒã¯ã³æµªè²»ãæžãããAIãã€ãã£ããªããŒã«ã«ã³ãŒãã€ã³ããã¯ã¹ã
cdidx ã¯ããªããžããªãäžåºŠã€ã³ããã¯ã¹ãããã®åŸã®å
šææ€çŽ¢ã»ã·ã³ãã«æ€çŽ¢ã»äŸåé¢ä¿æ€çŽ¢ãããŒã«ã«ã® SQLite FTS5 DB ããè¿ããŸããAI ãšãŒãžã§ã³ãã«æ¯ã¿ãŒã³åãããªãŒãèªã¿çŽããã代ããã«ãå°ããæ§é åãããçµæã ããæž¡ããŸãã
cdidx . # ã«ã¬ã³ããã£ã¬ã¯ããªãã€ã³ããã¯ã¹
cdidx search "authenticate" # å
šææ€çŽ¢
cdidx definition UserService # ã·ã³ãã«å®çŸ©ãæ€çŽ¢
cdidx find "guard" --path src/Auth.cs
cdidx deps --path src/ # ãã¡ã€ã«éäŸåã°ã©ã
cdidx mcp # AIããŒã«åãMCPãµãŒããŒèµ·å46èšèªå¯Ÿå¿ã24 MCPããŒã«ãã€ã³ã¯ãªã¡ã³ã¿ã«æŽæ°ãèšå®äžèŠã
- ããã¥ã¡ã³ã: DEVELOPER_GUIDE.md ã¢ãŒããã¯ãã£ãAIå¿çã®è©³çްããªãªãŒã¹æé
- AIéçºèŠçŽ: SELF_IMPROVEMENT.md
- ãã¹ãã¬ã€ã: TESTING_GUIDE.md
å€ãã®ã³ãŒãæ€çŽ¢ããŒã«ã¯ããã¹ã¯ãããUIäžå¿ã®ã¯ãŒã¯ãããŒããã·ã§ã«ã§ã®åçºããã¹ãæ€çŽ¢ã®ã©ã¡ããã«æé©åãããŠããŸããcdidx ãçã£ãŠããã®ã¯å¥ã®ã«ãŒãã§ããããŒã«ã«ãªããžããªãã人éãšAIã®äž¡æ¹ãäœåºŠãæ€çŽ¢ããåæã§èšèšããŠããŸãã
ã¿ãŒããã«äžå¿â ã¿ãŒããã«ãã¹ã¯ãªãããèªåååãã«èšèšãAIãã€ãã£ãâ--jsonåºåãš MCP ã®æ§é åçµæãæšæºæèŒãçããŒã¯ã³â ã³ã³ãã¯ããªã¹ãããããmapãinspectããã¹çµã蟌ã¿ã§åèµ°æ»ãšåŸåŸ©åæ°ãæžãããããŒã«ã«å®çµâ SQLite DB ã¯ãããžã§ã¯ãå ã®.cdidx/ã«é 眮ãå·®åæŽæ°â--filesãš--commitsã§å€æŽåã ãæŽæ°ã
IDEã®çœ®ãæãããã¹ã¯ãããæ€çŽ¢ã¢ããªã§ã¯ãããŸãããã¹ã¯ãªããå¯èœã§ãèªååã§ããŠãAIããŒã«ã«ãã®ãŸãŸæž¡ããå°ããªããŒã«ã«æ€çŽ¢ã©ã³ã¿ã€ã ã§ãã
åçºã§æååãæããããªã rgãåããªããžããªã人éãšAIã®äž¡æ¹ãäœåºŠãæ€çŽ¢ãããªã cdidx ãåããŠããŸãã
rg |
cdidx |
|
|---|---|---|
| åŸæãªçšé | åçºã®ããã¹ãèµ°æ» | ç¹°ãè¿ãè¡ãããŒã«ã«ã³ãŒãæ€çŽ¢ |
| åæã»ããã¢ãã | äžèŠ | æåã«äžåºŠã€ã³ããã¯ã¹äœæ |
| æ€çŽ¢ã¢ãã« | æ¯åãã¡ã€ã«ãèªã | ããŒã«ã«ã® SQLite FTS5 ã€ã³ããã¯ã¹ãæ€çŽ¢ |
| èªåååãåºå | ãã¬ãŒã³ããã¹ã | 人éåãåºåãJSONãMCP |
| AI飿º | ããŒã¹ãå¿ èŠ | æ§é ååæ |
| AIã«ãŒãã§ã®ããŒã¯ã³æ¶è²» | åºãæèãäœåºŠãéãçŽã | ã€ã³ããã¯ã¹ãåå©çšããå¿ èŠãªçµæã ãåã |
| ç·šéåŸã®æŽæ° | åæ€çŽ¢ããã ã | 倿Žãã¡ã€ã«ã ãæŽæ°ã§ãã |
# .NET äžèŠã®ã¯ã³ã©ã€ããŒã€ã³ã¹ããŒã«
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bash
cdidx .
cdidx search "handleRequest"ããããšã¯ããã ãã§ã:
cdidx .ã§.cdidx/codeindex.dbãäœæãŸãã¯æŽæ°cdidx search ...ã§ããŒã«ã«ã€ã³ããã¯ã¹ãæ€çŽ¢- ç·šéåŸã¯
cdidx . --files path/to/file.csãcdidx . --commits HEADã§å·®åæŽæ°
ã³ã³ãããCIãLinux/macOS ç°å¢ã§ .NET SDK ãªãã§äœ¿ããŸãã
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bashç¹å®ããŒãžã§ã³ãã€ã³ã¹ããŒã«ïŒããŒãžã§ã³ã¹ãã¥ãŒãé²ãããããã®ã¿ã°ããã€ã³ã¹ããŒã©ãŒãååŸïŒ:
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/v1.5.0/install.sh | bash -s -- v1.5.0察å¿ãã©ãããã©ãŒã : linux-x64, linux-arm64, osx-arm64ïŒglibc ããŒã¹ã® Linux ã®ã¿ãAlpine/musl ã¯é察å¿ïŒãããã©ã«ãã§ ~/.local/bin ã«ã€ã³ã¹ããŒã«ïŒCDIDX_INSTALL_DIR ã§å€æŽå¯ïŒã
Dockerfile ã®äŸ:
# /usr/local/bin ã«ã€ã³ã¹ããŒã«ã㊠PATH ã«å³åæ
RUN export CDIDX_INSTALL_DIR=/usr/local/bin \
&& curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bash.NET 8.0 SDK ãå¿ èŠã§ãã
dotnet tool install -g cdidxããã ãã§ããcdidx ã³ãã³ãããã䜿ããŸãã
ãã§ã«ã€ã³ã¹ããŒã«æžã¿ã®å Žåãææ°çã«æŽæ°ã§ããŸã:
dotnet tool update -g cdidx.NET 8.0 SDK ãå¿ èŠã§ãã
dotnet build src/CodeIndex/CodeIndex.csproj -c Release
dotnet publish src/CodeIndex/CodeIndex.csproj -c Release -o ./publishãã«ãåŸããã€ããªãPATHã«è¿œå ããŸã:
Linux:
sudo cp ./publish/cdidx /usr/local/bin/cdidxmacOS:
sudo cp ./publish/cdidx /usr/local/bin/cdidx/usr/local/bin ãPATHã«å«ãŸããŠããªãå ŽåïŒApple Siliconã®ããã©ã«ãã·ã§ã«ïŒ:
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zprofile
source ~/.zprofileWindows:
# PowerShellïŒç®¡çè
ãšããŠå®è¡ïŒ
New-Item -ItemType Directory -Force -Path C:\Tools
Copy-Item .\publish\cdidx.exe C:\Tools\cdidx.exe
# PATHã«æ°žç¶çã«è¿œå ïŒçŸåšã®ãŠãŒã¶ãŒïŒ
$path = [Environment]::GetEnvironmentVariable('Path', 'User')
if ($path -notlike '*C:\Tools*') {
[Environment]::SetEnvironmentVariable('Path', "$path;C:\Tools", 'User')
}PATH远å åŸã¯ã¿ãŒããã«ãåèµ·åããŠãã ããã
cdidx --versioncdidx ./myproject
cdidx ./myproject --rebuild # å®å
šåæ§ç¯
cdidx ./myproject --verbose # ãã¡ã€ã«ããšã®è©³çŽ°è¡šç€ºcdidx index ã¯ãå¥ãã£ã¬ã¯ããªããå®è¡ããŠããããã©ã«ãã§ã¯ <projectPath>/.cdidx/codeindex.db ã«DBãä¿åããŸãã
ããã©ã«ãåºå:
â ¹ Scanning...
Found 42 files
Indexing...
ââââââââââââââââââââââââââââââââ 67.0% [28/42]
Done.
Files : 42
Chunks : 318
Symbols : 156
Skipped : 28 (unchanged)
Graph : ready
Issues : ready
Fold : ready
Elapsed : 00:00:02
æ©æ¢°åãã® --json åºåã§ããå®è¡åŸã® readiness bit ããã®ãŸãŸè¿ããŸã:
cdidx ./myproject --json{"status":"success","mode":"incremental","summary":{"files_total":42,"chunks_total":318,"symbols_total":156,"references_total":420,"files_scanned":42,"files_skipped":28,"files_purged":0,"errors":0},"graph_table_available":true,"issues_table_available":true,"fold_ready":true,"elapsed_ms":2012}--verbose ãä»ãããšãåãã¡ã€ã«ã«ã¹ããŒã¿ã¹ã¿ã°ã衚瀺ãããäœãèµ·ãããäžç®ã§ããããŸã:
[OK ] src/app.cs (12 chunks, 5 symbols)
[SKIP] src/utils.cs
[DEL ] src/old.cs
[ERR ] src/bad.cs: <message>
[OK ]= ã€ã³ããã¯ã¹æåã[SKIP]= æªå€æŽã»ã¹ãããã[DEL ]= DBããåé€ïŒãã£ã¹ã¯äžã®ãã¡ã€ã«ãæ¶ããïŒã[ERR ]= 倱æïŒverboseã§ã¯ã¹ã¿ãã¯ãã¬ãŒã¹ã衚瀺ïŒ
ã€ã³ããã¯ã¹ã®åé¡ããããã°ããããã©ã®ãã¡ã€ã«ãå®éã«åŠçããããã確èªããã®ã«äŸ¿å©ã§ãã
å€ã .cdidx/codeindex.db ã Unicode-aware 㪠--exact ã«äžãããã ããªãããã« rebuild ã¯äžèŠã§ã:
cdidx backfill-foldããã¯æ¢å DB è¡ãã name_folded / *_folded åãåèšç®ãããœãŒã¹åè§£æãªãã§ fold_ready ã stamp ããŸããå¯Ÿè±¡ã¯æ¢åã® CodeIndex DB ã«éããã空ã®DBãååšããªããã¹ãæå®ããŠãæ°èŠäœæããæåŠããŸãã
cdidx search "authenticate" # å
šææ€çŽ¢
cdidx search "handleRequest" --lang go # èšèªã§ãã£ã«ã¿
cdidx search "TODO" --limit 50 # çµææ°ãå¢ãã
cdidx search "auth*" --fts # çã®FTS5æ§æïŒåæ¹äžèŽæ€çŽ¢ïŒ
cdidx search "Run();" --exact-substring # 倧æåå°æååºå¥ã®å®å
šéšåäžèŽãFTS5 ãªãåºå:
src/Auth/Login.cs:15-30
public bool Authenticate(string user, string pass)
{
var hash = ComputeHash(pass);
return _store.Verify(user, hash);
...
src/Auth/TokenService.cs:42-58
public string GenerateToken(User user)
{
var claims = BuildClaims(user);
return _jwt.CreateToken(claims);
...
(2 results)
人éåãã®æ€çŽ¢åºåã¯ãå¯èœãªéãæåã®äžèŽè¡ãäžå¿ã«ã¹ããããã衚瀺ããåžžã«ãã£ã³ã¯å é ã ããåºãããšã¯ãããŸããã
--json ã§AI/æ©æ¢°åãåºå:
{"path":"src/Auth/Login.cs","start_line":15,"end_line":30,"content":"public bool Authenticate(...)...","lang":"csharp","score":12.5}
{"path":"src/Auth/TokenService.cs","start_line":42,"end_line":58,"content":"public string GenerateToken(...)...","lang":"csharp","score":9.8}cdidx symbols UserService # ååã§æ€çŽ¢
cdidx symbols UserService OrderService AuthService # è€æ°åã OR çµåïŒpositionalïŒ
cdidx symbols --name UserService --name OrderService # è€æ°åã OR çµåïŒ--nameïŒ
cdidx symbols Run --exact-name # ååã®å®å
šäžèŽïŒ`RunAsync` / `RunImpact` ã«åºãããªãïŒ
cdidx symbols --kind class # ãã¹ãŠã®ã¯ã©ã¹
cdidx symbols --kind function --lang python--exact-name ã¯ããã§ã«è§£æ±ºæžã¿ã®åè£ãªã¹ãïŒäŸ: search / inspect / map ã®çµæïŒãæž¡ããŠæ£ç¢ºã«ãã®è¡ã ãåãè¿ããããšãã«äœ¿ããéšåäžèŽã§ã¯ãªã倧æåå°æåãç¡èŠããå®å
šäžèŽã§æ¯èŒãããããRun ãæå®ããŠã RunAsyncãRunImpact çã«ã¯åºãããªãã--exact-name 㯠--nameãpositional åãä»ã®å
šãã£ã«ã¿ãšçµã¿åããå¯èœãåŸæ¥ã® --exact ãåŸæ¹äºæã§åŒãç¶ã䜿ããããsearch ãšæå³ãã¶ã€ãããªã --exact-name ãæšå¥šãããfold 㯠NFKC æ£èŠå + Unicode CaseFold ã§ãà / Àãå
šè§ ïœïœ / Runãååãsharp-SïŒStraÃe / STRASSEïŒãGreek final sigmaïŒÎ£ / Ï / ÏïŒãªã©ã®é ASCII å·®åãæ£ããäžèŽãããUnicode CaseFold 㯠locale-invariant ã®ããããã«ã³èªã® dotted İ ã¯äŸç¶ plain i ã§ã¯ãªã i\u0307 ã« fold ããããstale 㪠fold metadata ãå«ã DB ã¯ãDB å
ã current folded key ã®ã¿ã«ãªããŸã§ ASCII COLLATE NOCASE ã«é»ã£ãŠãã©ãŒã«ããã¯ãããstored folded key ãåè§£æãªãã§æŽæ°ããããªã cdidx backfill-fold ãåªå
ããscan ã stale row ããã¹ãŠ rewrite / purge ã§ãããªãéåžžã® cdidx index . ã§ã埩垰ã§ãããstale row ãæ®ãå Žåã ã cdidx index . --rebuild ãå¿
èŠãstatus --json ã® fold_ready ã§çŸåšã®çµè·¯ãå€å®å¯èœã
åºå:
class UserService src/Services/UserService.cs:8-72
function GetUserById src/Services/UserService.cs:24-41
function CreateUser src/Services/UserService.cs:45-61
(3 symbols)
--json ã䜿ããšãã·ã³ãã«çµæã«ã¯å®çŸ©ç¯å²ãå€å®ã§ããå Žåã®æ¬äœç¯å²ãã·ã°ããã£æååã芪ã·ã³ãã«ãå¯èŠæ§ãæ»ãå€åãå«ãŸããŸãã
{"path":"src/Services/UserService.cs","lang":"csharp","kind":"function","name":"GetUserById","line":24,"start_line":24,"end_line":41,"body_start_line":26,"body_end_line":41,"signature":"public async Task<User> GetUserById(int id)","container_kind":"class","container_name":"UserService","visibility":"public","return_type":"Task<User>"}searchãdefinitionãreferencesãcallersãcalleesãsymbolsãfiles ã¯å
±éã§ç¹°ãè¿ãæå®ã§ãã --path <pattern>ïŒè€æ°å€ã¯ OR ã§çµåïŒãç¹°ãè¿ãæå®ã§ãã --exclude-path <pattern>ã--exclude-tests ã«å¯Ÿå¿ããŠããŸããæ€çŽ¢çµæã¯ tests ã docs ãã source ãåªå
ããsearch ã¯ã·ã³ãã«åããã¹ãã¯ãšãªãšæ£ç¢ºã«äžèŽãããã¡ã€ã«ãäžã«åºããŸãã
search --json ãš MCP ã® search ã¯ããã£ã³ã¯å
šæã§ã¯ãªãäžèŽäžå¿ã®è»œéã¹ãããããè¿ããŸããåçµæã«ã¯ chunk_start_lineãchunk_end_lineãsnippet_start_lineãsnippet_end_lineãsnippetãmatch_linesãhighlightsãcontext_beforeãcontext_after ãå«ãŸããŸããæç²ã®é·ã㯠--snippet-lines <n> ã§èª¿æŽã§ããŸãïŒããã©ã«ã: 8ãæå€§: 20ïŒã
cdidx definition ResolveGitCommonDir
cdidx definition ResolveGitCommonDir --path src/CodeIndex/Cli --exclude-tests
cdidx definition ResolveGitCommonDir --body --jsondefinition ã¯ãã€ã³ããã¯ã¹æžã¿ã·ã³ãã«ç¯å²ãšãã£ã³ã¯åæ§æã䜿ã£ãŠå®éã®å®£èšããã¹ããè¿ããŸããèšèªæœåºåšãæ¬äœç¯å²ãæšè«ã§ããå Žåã¯ã--body ã§æ¬äœå
容ãè¿ããŸãã
cdidx inspect ResolveGitCommonDir --exclude-tests
cdidx inspect ResolveGitCommonDir --exclude-tests --jsoninspect ã¯ãäž»å®çŸ©ãåäžãã¡ã€ã«å
ã®è¿åã·ã³ãã«ãåç
§ãcallerãcalleeããã¡ã€ã«ã¡ã¿ããŒã¿ãããã«ã¯ãŒã¯ã¹ããŒã¹é®®åºŠã¡ã¿ããŒã¿ãš call graph 察å¿ã¡ã¿ããŒã¿ããŸãšããŠè¿ããããAIã¯ã©ã€ã¢ã³ããè€æ°ã³ãã³ããé£éãããã«ã·ã³ãã«èª¿æ»ãé²ããããŸããreferences / callers / callees ãæªå¯Ÿå¿èšèªã§ç©ºã«ãªãå Žåããinspect --json ããã®çç±ãæç€ºããŸãã
cdidx references ResolveGitCommonDir --exclude-tests
cdidx callers ResolveGitCommonDir --exclude-tests --json
cdidx callees AddToGitExclude --exclude-testsãããã®ã³ãã³ãã¯ã€ã³ããã¯ã¹æžã¿åç
§ã°ã©ãã䜿ããŸãã察象ã¯ãcdidx ãååä»ãã·ã³ãã«ãš call çžåœã®åç
§ãæœåºããŠããèšèªãã€ãŸã PythonãJavaScript/TypeScriptãC#ãGoãRustãJavaãKotlinãRubyãC/C++ãPHPãSwiftãDartãScalaãElixirãLuaãVB.NET ã§ãïŒ18èšèªïŒãF# ã¯ã¹ããŒã¹åºåãã®åŒã³åºãæ§æã®ãã graph ã¯ãšãªé察å¿ã§ããããã¥ã¡ã³ããèšå®ãã¡ã€ã«ãããŒã¯ã¢ãããªã©ã®æªå¯Ÿå¿èšèªã§ã¯ search ã«æ»ããŠãã ããã
æªå¯Ÿå¿èšèªã --lang ã§æå®ããå Žåã人éåãã® graph ã³ãã³ãã¯ãã®æšãæç€ºããMCP ã® graph ããŒã«ã¯ç©ºçµæã«å ã㊠graph_languageãgraph_supportedãgraph_support_reason ãè¿ããŸãã
cdidx outline src/CodeIndex/Cli/GitHelper.cs
cdidx outline src/CodeIndex/Cli/GitHelper.cs --json1ãã¡ã€ã«å
ã®å
šã·ã³ãã«ãè¡é ã«ãçš®å¥ã»ã·ã°ããã£ã»å¯èŠæ§ã»ã³ã³ãããã¹ãä»ãã§è¡šç€ºããŸãããã¡ã€ã«å
šäœãèªãã ã symbols + definition ããã§ãŒã³ããããã代ããã«ã1åã§ãã¡ã€ã«æ§é ãææ¡ã§ããŸãã
cdidx excerpt src/CodeIndex/Cli/GitHelper.cs --start 19 --end 28
cdidx excerpt src/CodeIndex/Cli/GitHelper.cs --start 19 --end 28 --before 3 --after 3 --jsoncdidx find "graph table" --path src/CodeIndex/Cli/QueryCommandRunner.cs
cdidx find "Graph Table" --path src/CodeIndex/Cli/QueryCommandRunner.cs --exact --before 1 --after 1 --jsonfind ã¯ããªããžããªå
šäœã察象ã«ãã search ãšãè¡çªå·ãå¿
èŠãª excerpt ã®éãåããã³ãã³ãã§ãã察象ãã¡ã€ã«ãæ¢ã«åãã£ãŠãããšãã«ãraw text ããŒã«ãžæ»ããã«ãã€ã³ããã¯ã¹æžã¿ãã¡ã€ã«ããäžèŽè¡çªå·ã»åçªå·ã»çãååŸæèãè¿ããŸãã
cdidx files # å
šã€ã³ããã¯ã¹æžã¿ãã¡ã€ã«
cdidx files --lang csharp # C#ãã¡ã€ã«ã®ã¿
cdidx files --path src/Services --exclude-path Migrationsåºå:
csharp 120 lines src/Services/UserService.cs
csharp 85 lines src/Controllers/UserController.cs
csharp 42 lines src/Models/User.cs
(3 files)
cdidx statusåºå:
Files : 42
Chunks : 318
Symbols : 156
Refs : 912
Languages:
csharp 28
python 10
javascript 4
cdidx map --path src/ --exclude-tests
cdidx map --path src/ --exclude-tests --jsonmap ã¯ã人㚠AI ã®ã©ã¡ãã«ãæçã§å
šäœåãæž¡ãããã®å
¥å£ã§ããèšèªãã¢ãžã¥ãŒã«ãããããªãã¡ã€ã«ãæšå®ãšã³ããªãã€ã³ããææ¡ããããinspectãsearchãdefinition ã«é²ãã§ãã ãããstatus --jsonãmap --jsonãinspect --jsonãMCP analyze_symbol ã®è©³çްãªã¡ã¿ããŒã¿å¥çŽã¯ DEVELOPER_GUIDE.md ã«ãŸãšããŠããŸãã
| ãªãã·ã§ã³ | 察象 | 説æ |
|---|---|---|
--db <path> |
å šã³ãã³ã | DBãã¡ã€ã«ãã¹ãindex ã®ããã©ã«ã㯠<projectPath>/.cdidx/codeindex.dbãã¯ãšãªç³»ã³ãã³ãã®ããã©ã«ãã¯ã«ã¬ã³ããã£ã¬ã¯ããªã® .cdidx/codeindex.dbã |
--json |
å šã³ãã³ã | JSONåºåïŒAI/æ©æ¢°åãïŒ |
--limit <n> |
ã¯ãšãªç³» | æå€§çµææ°ïŒããã©ã«ã: 20ãmap ã§ã¯åã»ã¯ã·ã§ã³ããšã®ä»¶æ°ïŒ |
--lang <lang> |
ã¯ãšãªç³» | èšèªã§ãã£ã«ã¿ |
--path <pattern> |
search, definition, references, callers, callees, symbols, files, find, map, inspect |
æå®æååãå«ããã¹ã«çµæãçµããç¹°ãè¿ãæå®å¯ïŒè€æ°å€ã¯ OR ã§çµåïŒ |
--exclude-path <pattern> |
search, definition, references, callers, callees, symbols, files, find, map, inspect |
æå®æååãå«ããã¹ãé€å€ïŒç¹°ãè¿ãæå®å¯ïŒ |
--exclude-tests |
search, definition, references, callers, callees, symbols, files, find, map, inspect |
ãã¹ãããããã¹ãé€å€ããæ¬çªã³ãŒããåªå |
--snippet-lines <n> |
search |
人éåãåºåãš JSON/MCP ã¹ããããã®æç²è¡æ°ïŒããã©ã«ã: 8ãæå€§: 20ïŒ |
--fts |
search |
ãªãã©ã«å®å šãªåŒçšã§ã¯ãªãçã®FTS5ã¯ãšãªæ§æã䜿ã |
--exact |
search, find, symbols, definition, references, callers, callees, inspect |
åŸæ¹äºæã®ç瞮圢ãsearch ã§ã¯ --exact-substringãfind ã§ã¯ --exact ã䜿ããsymbol / graph ç³»ã³ãã³ããš inspect ã§ã¯ --exact-name ãæšå¥šãJSON / MCP ã®çž®éã¡ã¿ããŒã¿ã¯åŸæ¥ã©ãã exact_index_available / degraded_reasonïŒMCP 㯠camelCase alias ãç¶æïŒã |
--exact-substring |
search |
search çšã®æšå¥š explicit aliasã倧æåå°æåãåºå¥ããå®å
šéšåäžèŽïŒFTS5 ãã€ãã¹ïŒã |
--exact-name |
symbols, definition, references, callers, callees, inspect |
symbol-name exactness çšã®æšå¥š explicit aliasãNFKC + Unicode CaseFold ã«ããå®å
šäžèŽïŒÃ / Àãå
šè§ ïœïœ / Runãååãsharp-SãGreek final sigma ãç³ã¿èŸŒãïŒãUnicode CaseFold 㯠locale-invariant ã®ããããã«ã³èªã® dotted İ 㯠plain i ãšåäžèŠããªããDB ã« stale 㪠fold metadata ãæ®ãé㯠ASCII COLLATE NOCASE ã« fallback ããããããŸã cdidx backfill-foldããŸã㯠stale row ãå
šçœ®æã§ããéåžžã® cdidx index .ããããç¡çãªã --rebuild ã䜿ãïŒstatus --json ã® fold_ready ã§å€å®ïŒãread-only ãªæ§DBã« fallback exact-match index ãç¡ãå Žåã¯ã人éåãåºåã WARN ã衚瀺ããCLI JSON ãš MCP structuredContent ãçž®éã¡ã¿ããŒã¿ãè¿ãã |
--kind <kind> |
definition, symbols |
ã·ã³ãã«çš®å¥ã§ãã£ã«ã¿ïŒfunction/class/struct/interface/enum/property/event/delegate/namespace/importïŒ |
--body |
definition, inspect |
èšèªæœåºåšãæ¬äœç¯å²ãæšè«ã§ããå Žåã«æ¬äœå 容ãå«ãã |
--count |
search, definition, references, callers, callees, symbols, files, find, unused |
çµæã®ã«ãŠã³ãã ããè¿ãïŒ--json äœµçšæã¯åäžã® count ãªããžã§ã¯ããgraph 系㯠trust metadata ãå«ãå ŽåããïŒ |
--start <line> |
excerpt |
æç²åæ§æã®éå§è¡ |
--end <line> |
excerpt |
æç²åæ§æã®çµäºè¡ïŒçç¥æã¯ --start ãšåãïŒ |
--before <n> |
excerpt, find |
æå®ç¯å²ãŸãã¯äžèŽç®æã®åã«è¿œå ããæèè¡æ° |
--after <n> |
excerpt, find |
æå®ç¯å²ãŸãã¯äžèŽç®æã®åŸã«è¿œå ããæèè¡æ° |
--rebuild |
index |
æ¢åDBãåé€ããŠåæ§ç¯ |
--verbose |
index |
ãã¡ã€ã«ããšã®ã¹ããŒã¿ã¹è¡šç€ºïŒ[OK ]/[SKIP]/[DEL ]/[ERR ]ïŒ |
--commits <id...> |
index |
æå®ã³ãããã®å€æŽãã¡ã€ã«ã®ã¿æŽæ° |
--files <path...> |
index |
æå®ãã¡ã€ã«ã®ã¿æŽæ° |
--since <datetime> |
files |
æå®ã¿ã€ã ã¹ã¿ã³ã以éã«å€æŽããããã¡ã€ã«ã®ã¿ïŒISO 8601ïŒ |
--no-dedup |
search |
ãªãŒããŒã©ãããã£ã³ã¯éè€æé€ãç¡å¹å |
--reverse |
deps |
éåŒã: æå®ãã¹ã«äŸåããŠãããã¡ã€ã«ã衚瀺 |
--top <n> |
ã¯ãšãªç³» | --limit ã®ãšã€ãªã¢ã¹ |
| ã³ãŒã | æå³ |
|---|---|
0 |
æå |
1 |
åŒæ°ãšã©ãŒ |
2 |
æªæ€åºïŒæ€çŽ¢çµæãªãããã£ã¬ã¯ããªäžåšïŒ |
3 |
ããŒã¿ããŒã¹ãšã©ãŒ |
The data is NULL at ordinal N ã®ãã㪠SQLite reader ãšã©ãŒã§ã¯ãšãªã倱æããå Žåã¯ãCDIDX_DEBUG=1 ãèšå®ããŠåå®è¡ããŠãã ããã倱æãã SQLããã€ã³ãæžã¿ãã©ã¡ãŒã¿ãçŽè¿ã«èªã¿åã£ãè¡ã®ã«ã©ã ã stderr ã«åºåãããŸããæªèšå®æã¯äœãããŸããã
ããã¹ãå€ïŒãã£ã³ã¯ã® contentãcontextããã¹ãã·ã°ããã£ãæååãã©ã¡ãŒã¿ïŒã¯æ¢å®ã§äŒååãããé·ããš SHA256 å
é ã®ã¿ãåºåããŸããIssue ã«è²Œã£ãŠãçŽ¢åŒæžã¿ãœãŒã¹ãæŒããŸãããæ°å€ã»ã«ã©ã åã»NULL ããŒã«ãŒã»SQL æ¬æã¯ãã®ãŸãŸåºåãããŸããããŒã«ã«ã§ã®èª¿æ»ã§çããã¹ããå¿
èŠãªå Žå㯠CDIDX_DEBUG=unsafe ãæå®ããŠãã ããïŒå
¬éã®å Žã«ã¯è²ŒããªãããšïŒã
CDIDX_DEBUG=1 cdidx unused # ããã¹ãäŒåå
CDIDX_DEBUG=unsafe cdidx unused # çããã¹ããããŒã«ã«ã®ã¿cdidxã¯ãããžã§ã¯ããã£ã¬ã¯ããªãèµ°æ»ããåãœãŒã¹ãã¡ã€ã«ãéè€ãæã€ãã£ã³ã¯ã«åå²ããFTS5å šææ€çŽ¢ä»ãã®SQLiteããŒã¿ããŒã¹ã«æ ŒçŽããŸããã€ã³ã¯ãªã¡ã³ã¿ã«ã¢ãŒãïŒããã©ã«ãïŒã§ã¯åãã¡ã€ã«ã®æçµæŽæ°ã¿ã€ã ã¹ã¿ã³ããDBå ã®å€ãšæ¯èŒããå®å šäžèŽãããã¡ã€ã«ã®ã¿ã¹ãããããŸããã¿ã€ã ã¹ã¿ã³ããç°ãªãã°ïŒæ°ãããŠãå€ããŠãïŒåã€ã³ããã¯ã¹ãããããããã©ã³ãåãæ¿ãåŸãæ£ç¢ºã«ã€ã³ããã¯ã¹ãæŽæ°ãããŸãã
cdidx index ãå®è¡ãããšã.cdidx/ ãèªåã§ .git/info/exclude ã«è¿œå ãããŸãã.gitignore ãç·šéããå¿
èŠã¯ãããŸããã
.git/info/exclude 㯠.gitignore ãšåã广ãæã€ Git æšæºã®ä»çµã¿ã§ãã.gitignore ãæ±ããªããã .git/info/exclude ã .git/ é
äžãå©çšããããŒã«ã¯å€æ°ãããŸã â git-lfsãgit-secretãgit-cryptãgit-annexãHuskyãpre-commitãJetBrains IDEãVS Code (GitLens)ãEclipse ãªã©ã
ããŒã¿ããŒã¹ã¯ã€ã³ããã¯ã¹å®è¡æã®ã¯ãŒãã³ã°ããªãŒãåæ ããŸãããã©ã³ãåãæ¿ãåŸã¯ cdidx . ãåå®è¡ããŠãã ããããã£ã¹ã¯äžããæ¶ãããã¡ã€ã«ã¯DBããããŒãžãããæ°ãã«çŸãããã¡ã€ã«ã¯ã€ã³ããã¯ã¹ã«è¿œå ãããæ¢åãã¡ã€ã«ã¯ã¿ã€ã ã¹ã¿ã³ããç°ãªãå Žåã®ã¿åã€ã³ããã¯ã¹ãããŸããæŽæ°éã¯ãããžã§ã¯ãå
šäœã®ãµã€ãºã§ã¯ãªã倿Žãã¡ã€ã«æ°ã«æ¯äŸããŸãã
| ç¶æ³ | åäœ |
|---|---|
| ãã©ã³ãéã§ãã¡ã€ã«æªå€æŽ | ã¹ãããïŒå³æïŒ |
| ãã¡ã€ã«å 容ãå€æŽ | åã€ã³ããã¯ã¹ |
| checkoutåŸã«ãã¡ã€ã«åé€ | DBããããŒãž |
| checkoutåŸã«ãã¡ã€ã«è¿œå | æ°èŠã€ã³ããã¯ã¹ |
| èšèª | æ¡åŒµå | ã·ã³ãã« |
|---|---|---|
| Python | .py |
yes |
| JavaScript | .js, .jsx |
yes |
| TypeScript | .ts, .tsx |
yes |
| C# | .cs |
yes |
| Go | .go |
yes |
| Rust | .rs |
yes |
| Java | .java |
yes |
| Kotlin | .kt |
yes |
| Ruby | .rb |
yes |
| C | .c, .h |
yes |
| C++ | .cpp, .cc, .cxx, .hpp, .hxx |
yes |
| PHP | .php |
yes |
| Swift | .swift |
yes |
| Dart | .dart |
yes |
| Scala | .scala, .sc |
yes |
| Elixir | .ex, .exs |
yes |
| Lua | .lua |
yes |
| R | .r, .R |
yes |
| Haskell | .hs, .lhs |
yes |
| F# | .fs, .fsx, .fsi |
yes |
| VB.NET | .vb, .vbs |
yes |
| Razor/Blazor | .cshtml, .razor |
yes (as C#) |
| Protobuf | .proto |
yes |
| GraphQL | .graphql, .gql |
yes |
| Gradle | .gradle |
yes |
| Makefile | Makefile |
yes |
| Dockerfile | Dockerfile |
yes |
| Zig | .zig |
yes |
| XAML | .xaml, .axaml |
-- |
| MSBuild | .csproj, .fsproj, .vbproj, .props, .targets |
-- |
| Shell | .sh, .bash, .zsh, .fish |
-- |
| PowerShell | .ps1 |
yes |
| Batch | .bat, .cmd |
-- |
| CMake | .cmake, CMakeLists.txt |
-- |
| SQL | .sql |
-- |
| Markdown | .md |
-- |
| YAML | .yaml, .yml |
-- |
| JSON | .json |
-- |
| TOML | .toml |
-- |
| HTML | .html |
-- |
| CSS | .css, .scss |
yes |
| Vue | .vue |
-- |
| Svelte | .svelte |
-- |
| Terraform | .tf |
-- |
å šèšèªãFTS5ã«ããå šææ€çŽ¢ã«å¯Ÿå¿ãã·ã³ãã« = yes ã®èšèªã¯é¢æ°ã»ã¯ã©ã¹ã»ã€ã³ããŒãåã§ã®æ§é åæ€çŽ¢ã«ã察å¿ããŠããŸãã
AIãšãŒãžã§ã³ããDBãçŽæ¥SQLæ€çŽ¢ããå Žåãsqlite3 CLIãå¿
èŠã§ãã
| OS | ç¶æ³ |
|---|---|
| macOS | ããªã€ã³ã¹ããŒã«æžã¿ |
| Linux | éåžžããªã€ã³ã¹ããŒã«æžã¿ãæªå°å
¥æ: sudo apt install sqlite3 |
| Windows | winget install SQLite.SQLite ãŸã㯠scoop install sqlite |
cdidx ã AI ã¯ãŒã¯ãããŒã§å¹ãæå€§ã®çç±ã¯ãæ¯ã¿ãŒã³åããªããžããªãèªã¿çŽããã«æžãããšã§ãã
search --jsonãš MCPsearchã¯ã倧ããªãã¡ã€ã«æçã§ã¯ãªãäžèŽäžå¿ã®ã³ã³ãã¯ããªã¹ãããããè¿ãã--snippet-linesã§ãµã€ãºãå ã«çµããŸããmapãinspectãdefinitionãdepsãimpactã䜿ããšã段éçãªèª¿æ»ãå°ãªãåŸåŸ©ã§é²ããããŸãã--pathãç¹°ãè¿ãæå®ã§ãã--exclude-pathã--exclude-testsã«ãããæç²ååŸåã«ãã€ãºãæžãããŸããstatus --jsonãmap --jsonãinspect --jsonã¯é®®åºŠãš Git ç¶æ ã®ã·ã°ãã«ãè¿ããããAI ãã€ã³ããã¯ã¹ãä¿¡çšããŠããã倿ã§ããŸããunused --jsonãš MCPunused_symbolsã¯ãbucket åããããããã³ãŒãåè£ãš graph-support ã·ã°ãã«ãè¿ããããprivate cleanup åè£ãš public/config/reflection suspectãæªå¯Ÿå¿èšèªã®ç©ºããŒãžãæ©æ¢°çã«åºå¥ã§ããŸããcdidx mcpã䜿ãã°ãClaude CodeãCursorãWindsurfãCopilotãCodex ããã·ã§ã«åºåãç¡çã«è§£éããã«ãã€ãã£ãæ¥ç¶ã§ããŸãã
MCP ããŒã«äžèЧãJSON ãã£ãŒã«ãå¥çŽã--exact ãŸããã®ã¡ã¿ããŒã¿ãæ§ DB ãã©ãŒã«ããã¯æã®æå㯠DEVELOPER_GUIDE.md ãåç
§ããŠãã ããã
AIãšãŒãžã§ã³ãã«ã€ã³ããã¯ã¹ã掻çšãããã«ã¯ããããžã§ã¯ãã«ãŒãã« CLAUDE.md ãé
眮ããŠãã ããïŒä»¥äžã®ãã³ãã¬ãŒã㯠cdidx ãå°å
¥ããäžæµãããžã§ã¯ãåãã§ããcdidx æ¬äœã®ãªããžããªã«è²¢ç®ããå Žåã¯åœ repo ã® CLAUDE.md ãåç
§ããŠãã ãããçŽ ã® cdidx ã³ãã³ãã§ã¯ãªãããŒã«ã«ãã«ãã® dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll ãçµç±ããéçšã«ãªã£ãŠããŸãïŒ:
# ã³ãŒãããŒã¹æ€çŽ¢ã«ãŒã«
ãã®ãããžã§ã¯ã㯠**cdidx** ã䜿ããäºåæ§ç¯æžã¿SQLiteã€ã³ããã¯ã¹ïŒ`.cdidx/codeindex.db`ïŒã§é«éã³ãŒãæ€çŽ¢ãè¡ããŸãã
ã³ãŒããæ€çŽ¢ããé㯠`find`, `grep`, `ls -R` ã§ã¯ãªã**ãã®ããŒã¿ããŒã¹ãæ€çŽ¢**ããŠãã ããã
## ã»ããã¢ãã
ãŸã `cdidx` ãå©çšå¯èœã確èªããŠãã ãã:
```bash
cdidx --version
```
**èŠã€ãããªãå Žå**ãã€ã³ã¹ããŒã«ããŠãã ãã:
```bash
# .NET äžèŠ â self-contained ãã€ããªãããŠã³ããŒã
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bash
```
ãŸã㯠.NET 8+ SDK ãããå Žå:
```bash
dotnet tool install -g cdidx
```
**ãã§ã«ã€ã³ã¹ããŒã«æžã¿ã®å Žå**ãææ°çã«æŽæ°ããŠãã ãã:
```bash
# ã€ã³ã¹ããŒã©ãŒãåå®è¡ããŠã¢ããã°ã¬ãŒã
curl -fsSL https://raw.githubusercontent.com/Widthdom/CodeIndex/main/install.sh | bash
```
ã€ã³ã¹ããŒã«ã«å€±æããå ŽåïŒãããã¯ãŒã¯äžéãæªå¯Ÿå¿ãã©ãããã©ãŒã çïŒã¯ãããŒã¿ããŒã¹ãæ§ç¯æžã¿ã§ããã°äžèšã® **ãçŽæ¥SQLã¯ãšãªã** ã»ã¯ã·ã§ã³ã§ `sqlite3` ãã `.cdidx/codeindex.db` ãçŽæ¥æ€çŽ¢ã§ããŸãã`cdidx` ã `sqlite3` ãå©çšã§ããªãå Žåã¯ãClaude Code ã®çµã¿èŸŒã¿ `Grep` / `Glob` ããŒã«ïŒãããã¯äœ¿çšããŒãã¹ã®åçæ©èœïŒã䜿ã£ãŠãã ãã â Claude Code ã»ãã·ã§ã³å
ã§ã¯ shell ã® `rg` / `grep` / `find` ãã°ããŒãã« `cdidx` ã«ãã©ãŒã«ããã¯ããªãã§ãã ããããããã¯ãªããžããªè¿œè·¡ã® deny ãªã¹ãã§å¡ãããŠããå¯èœæ§ããããè¿åãããšå€ããã€ããªç±æ¥ã®ãã°ãé ããŠããŸãããã§ãã
æ€çŽ¢ãå§ããåã«ãã€ã³ããã¯ã¹ãææ°åããŠãã ãã:
```bash
cdidx . # ã€ã³ã¯ãªã¡ã³ã¿ã«æŽæ°ïŒæªå€æŽãã¡ã€ã«ã¯ã¹ãããïŒ
```
## ã€ã³ããã¯ã¹ã®ææ°åïŒcdidxãå¿
èŠïŒ
ãã¡ã€ã«ãç·šéããããæ€çŽ¢çµæãæ£ç¢ºã«ä¿ã€ããã«ããŒã¿ããŒã¹ãæŽæ°ããŠãã ãã:
```bash
cdidx . --files path/to/changed_file.cs # 倿Žãããã¡ã€ã«ã ãæŽæ°
cdidx . --commits HEAD # çŽåã®ã³ãããã§å€æŽããããã¡ã€ã«ãæŽæ°
cdidx . --commits abc123 # ç¹å®ã®ã³ãããããã·ã¥ãæå®å¯èœ
cdidx . # ãã«ã€ã³ã¯ãªã¡ã³ã¿ã«æŽæ°ïŒæªå€æŽãã¡ã€ã«ã¯ã¹ãããïŒ
```
**ã«ãŒã«: ãœãŒã¹ãã¡ã€ã«ãä¿®æ£ããããæ¬¡ã®æ€çŽ¢ã®åã«äžèšã®ãããããå®è¡ããããšã**
`git reset`ã`git rebase`ã`git commit --amend`ã`git switch`ã`git merge` ã§ checkout èªäœãå€ãã£ãåŸã¯ãã³ãããåäœã®æŽæ°ã ãã§ãªã stale file ã®æé€ãå¿
èŠã«ãªãããã`cdidx .` ãåªå
ããŠãã ããã
## ã¯ãšãªæŠç¥
- ãŸãå
šäœåãæ¬²ãããšã㯠`map` ããå§ããŠãèšèªãã¢ãžã¥ãŒã«ãäž»èŠãã¡ã€ã«ããããã¹ããããææ¡ããã
- 鮮床ãéèŠãªå Žå㯠`status --json` ãå
ã«èŠãŠã`indexed_at`ã`latest_modified`ã`git_head`ã`git_is_dirty` ã確èªããŠããæ€çŽ¢çµæãä¿¡çšããã倿ããããã§ã« `map --json` ã䜿ã£ãŠããå Žåã¯ããã® `indexed_at` / `latest_modified` ã¯çµã蟌ã¿çµæã«å¯Ÿããå€ã`workspace_indexed_at` / `workspace_latest_modified` ã¯ã¯ãŒã¯ã¹ããŒã¹å
šäœã«å¯Ÿããå€ãšããŠèªãã
- åè£ã·ã³ãã«åãæ±ºãŸã£ãŠããŠãå®çŸ©ã»callerã»calleeã»åç
§ããŸãšããŠæ¬²ãããšã㯠`inspect` ã䜿ããleaf ã³ãã³ããšåã precision ã«ããããšã㯠`--exact` ãä»ããïŒbundle å
ã®å
š sub-query ã«äŒæããããã`inspect Run --exact` ã `RunAsync` / `RunImpact` ãå·»ã蟌ãããšã¯ãªãïŒã`inspect --json` ã«ã¯ `workspace_indexed_at`ã`workspace_latest_modified`ã`project_root`ã`git_head`ã`git_is_dirty` ãå«ãŸãããããä¿¡é Œå€æãåæã«è¡ããã
- ååä»ãã·ã³ãã«ã®å®£èšãåããããšã㯠`definition` ã䜿ããæ¬äœãå¿
èŠãªã `--body` ãä»ããã
- PythonãJavaScript/TypeScriptãC#ãGoãRustãJavaãKotlinãRubyãC/C++ãPHPãSwiftãDartãScala ã® call graph 系調æ»ã§ã¯ `references`ã`callers`ã`callees` ã䜿ããååããã§ã«ç¢ºå®ããŠããå Žå㯠`--exact` ãä»ãããš `Run` ã `RunAsync` / `RunImpact` ã«åºãããã`definition` ãåæ§ã« `--exact` ããµããŒãããã
- 倿Žåã®æ³¢å確èªã«ã¯ `impact` ã䜿ããactive 㪠`--lang` / `--path` / `--exclude-path` / `--exclude-tests` scope ãš graph-supported language ã®ç¯å²ã§ãquery ãåäžã® class / struct / interface å®çŸ©ã«è§£æ±ºãããsymbol-level caller ãç¡ãå Žåã¯ã`impact` / MCP `impact_analysis` ãç¡èšã® 0 ä»¶ã§ã¯ãªã heuristic 㪠file-level dependency hint ãè¿ãããšããããååã® `namespace` ã `import` ãªã© non-callable 㪠sibling å®çŸ©ã¯ãã® fallback ã劚ãããpure import/namespace query ã¯èª¬æãªãã® 0 ä»¶ã§ã¯ãªã `non_callable_symbol_kind` guidance ãè¿ãããã€ãºãæžãããããhint ã¯ã察象åã® member åã«äžèŽããåç
§ãããããã€åã file å
ã® indexed symbol metadataïŒsignature ã return type ãªã©ïŒã«å¯Ÿè±¡åã®æ§é åãããçè·¡ãããããã¡ã€ã«ã«ã ãåºããã³ã¡ã³ããæååã®çããã¹ãäžèŽã§ã¯ææ Œããªãããã® evidence å€å®ã Unicode-aware ãªã®ã§ãå
šè§ãã¢ã¯ã»ã³ãä»ãèå¥åã§ã exact-match ãšåãæå³è«ã§æ±ãããã ãçŸè¡ã°ã©ãã¯å call ã®è§£æ±ºå
file/type ãä¿æããŠããªãããããã® hint 㯠authoritative ã§ã¯ãªããäžæ¹ã§ãããã® hint ãéåžžã®æååºåãšããŠè¿ããããã¯ã©ã€ã¢ã³ãåŽã§ã¯ `impact_mode` / `heuristic` / `hint_count` / `truncated` ãèŠãŠå€å®ããã`count` / `file_count` ã¯è¿ããå¯èŠçµæã®ä»¶æ°ã衚ãã`confirmed_count` / `confirmed_file_count` 㯠symbol-level caller ã®ç¢ºå®ä»¶æ°ãä¿æããã`impact --json --count` ã full payload ãšåã `*_count` ãã£ãŒã«ãåã䜿ããscoped query ã partial class ãåäžãã¡ã€ã«å
ã®åå class ãªã©è€æ°ã® class-like å®çŸ©ã«è§£æ±ºãããå Žåã¯ã0 ä»¶ payload ã«ãã®æšãš `deps --path <definition-path> --reverse` ãŸãã¯ããå
·äœç㪠member query ã詊ããã³ããå
¥ãã
- PythonãJavaScript/TypeScriptãC#ãGoãRustãJavaãKotlinãRubyãC/C++ãPHPãSwiftãDartãScalaãF#ãVB.NETãElixirãLuaãRãHaskellãZigãPowerShellãCSS/SCSS ã®ãããªã·ã³ãã«æœåºå¯Ÿå¿èšèªã§ã¯ãååããŒã¹ã®èª¿æ»ã« `symbols` ã䜿ãã`inspect` / `map` / `search` çã§æ¢ã«åè£åãç¹å®ã§ããŠããå Žå㯠`--exact` ãä»ãããšã`Run` ã `RunAsync` / `RunImpact` ã«åºããããæž¡ããååã ããè¿ãïŒç¹°ãè¿ãã® `--name` ãšäœµçšå¯ïŒã
- 1ãã¡ã€ã«ã®ã·ã³ãã«æ§é ããã¡ã€ã«å
容ãèªãŸãã«ææ¡ããããšã㯠`outline` ã䜿ãã
- XAMLãMarkdownãYAMLãJSONãTOMLãHTMLãVueãSvelte ã®ãããªæ§é åã·ã³ãã«æœåºã匱ãèšèªããã³ã¡ã³ãã»æååã»çããã¹ããæ¢ãå Žå㯠`search` ã䜿ãã
- ãã¹ããæç€ºçã«èª¿ã¹ãã®ã§ãªããã°ããŸã `--exclude-tests` ãä»ããã
- åºãæ€çŽ¢ãå§ããåã« `--path <text>` ãšç¹°ãè¿ãæå®ã§ãã `--exclude-path <text>` ã䜿ã£ãŠå¯Ÿè±¡ã¢ãžã¥ãŒã«ã«çµãã
- å¥ã®ã¢ãã«ãããŒã«ãžæž¡ãåæã§æ€çŽ¢JSONãããã«çްãããããšãã¯ã`search` ã« `--snippet-lines <n>` ãä»ããã
- åè£ãã¹ã®ææ¡ã«ã¯ `files` ã䜿ããæ¢ç¥ãã¡ã€ã«å
ã®åæ¢çŽ¢ã«ã¯ `find`ãå¿
èŠè¡ã ãèªããšã㯠`excerpt` ã䜿ã£ãŠãã¡ã€ã«å
šäœãéããªãã
- `deps` ã§ãã¡ã€ã«éã®äŸåé¢ä¿ãææ¡ããã`--reverse` ã§æå®ãã¡ã€ã«ã«äŸåããŠãããã¡ã€ã«ãç¹å®ïŒåœ±é¿åæïŒã
- `unused` ã§æœåšçãªãããã³ãŒããæ€åºãã â å®çŸ©ãããŠãããäžåºŠãåç
§ãããŠããªãã·ã³ãã«ïŒã°ã©ã察å¿èšèªã§ã®ã¿æå¹ïŒãçµæã¯ bucket åãããprivate/file-local ãªåè£ã public/exported ã config/reflection suspect ããåã«ç¶æãããäžæ¹ãè¿åŽããŒãžã¯ `--limit` é©çšåã« bounded overfetch ãš bucket éã®åæ£ãè¡ãããããã€ãºã®å€ã 1 bucket ãä»ãé ãã«ããã倧ãã `--limit` ãæé»ã«åãè©°ããªããsuspect bucket 㯠public/exported 㪠property ã®ãã¡ãconfig ãã€ã³ããããŠããããªãã®ããŸã㯠C# ã§è¿åã« serializer/ORM ç³» attribute ããããã®åãã«äºçŽãããŠãããæªå¯Ÿå¿èšèªã `--lang` ã§æå®ããå Žåã¯åœã® unused hit ãè¿ããã`graph_supported=false` ä»ãã®ç©ºããŒãžãè¿ããCLI JSON ã§ã¯ã·ã³ãã«ããšã« `unused_bucket` / `unused_confidence` / `unused_reason`ãMCP ã§ã¯ `unusedBucket` / `unusedConfidence` / `unusedReason` ãè¿ããã©ã¡ããè¿åŽããŒãžåäœã® `returned_bucket_counts` ãå«ãããŒãä»¶ã§ã JSON schema ã¯åãã§ã`count`ã空㮠`symbols`ã空㮠page countãgraph trust metadata ãè¿ãã`unused --json` ã¯ãã® payload ã exit code `0` ã§è¿ãã`--lang` æå®æã® CLI JSON ã«ã¯ `graph_supported` / `graph_support_reason` ãå
¥ãããããã®èšèªãæ¬åœã« call graph 察å¿ãã AI ã¯ã©ã€ã¢ã³ãã倿ã§ããã
- `hotspots` ã§æãåç
§ãããã·ã³ãã«ãç¹å®ãã â 倿Žãåºç¯å²ã«åœ±é¿ããäžå¿çãªã³ãŒãã
- `files --since <datetime>` ã `search --since <datetime>` ã§æè¿å€æŽãããã³ãŒãã«çµãã
- `index` ã® `--dry-run` ã§DBã«æžã蟌ãŸãã€ã³ããã¯ã¹å¯Ÿè±¡ãäºå確èªã
- `--count` ã§çµææ°ãå
ã«ç¢ºèªããå
šããŒã¿ååŸåã«ããŒã¯ã³ãç¯çŽã
- cdidx ã®ãã°ãäºæããªãåäœãèŠã€ããå ŽåããŸãã¯æ¹åã¢ã€ãã¢ãããå Žåã¯ãhttps://github.com/Widthdom/CodeIndex/issues ã« issue ãäœæããçºçããäºè±¡ãšæåŸ
ããåäœãèšè¿°ããŠãã ããã
## CLIïŒcdidxãå©çšå¯èœãªå Žåã«æšå¥šïŒ
```bash
cdidx map --path src/ --exclude-tests --json
cdidx inspect "Authenticate" --exclude-tests
cdidx search "keyword" --path src/ --exclude-tests --snippet-lines 6
cdidx definition "ClassName" --path src/Services --body
cdidx callers "Authenticate" --lang csharp --exclude-tests
cdidx callees "HandleRequest" --path src/ --exclude-tests
cdidx symbols "ClassName" --lang csharp --exclude-tests
cdidx excerpt src/app.py --start 10 --end 20
cdidx files --lang python --path src/
cdidx status --json
```
## çŽæ¥SQLã¯ãšãªïŒcdidxãå©çšã§ããªãå Žåã®ãã©ãŒã«ããã¯ïŒ
以äžã®ã¯ãšãªã«ã¯ `sqlite3` ãå¿
èŠã§ããæªã€ã³ã¹ããŒã«ã®å ŽåããŠãŒã¶ãŒã«ã€ã³ã¹ããŒã«ãææ¡ããŠãã ãã:
- **macOS**: ããªã€ã³ã¹ããŒã«æžã¿
- **Linux**: `sudo apt install sqlite3`
- **Windows**: `winget install SQLite.SQLite` ãŸã㯠`scoop install sqlite`
### å
šææ€çŽ¢
```sql
SELECT f.path, c.start_line, c.content
FROM fts_chunks fc
JOIN chunks c ON c.id = fc.rowid
JOIN files f ON f.id = c.file_id
WHERE fts_chunks MATCH 'ããŒã¯ãŒã'
LIMIT 20;
```
### 颿°ã»ã¯ã©ã¹åã§æ€çŽ¢
```sql
SELECT f.path, s.name, s.line
FROM symbols s
JOIN files f ON f.id = s.file_id
WHERE s.kind = 'function' AND s.name LIKE '%ããŒã¯ãŒã%';
```
### CI / ããã¯åãã€ã³ã¯ãªã¡ã³ã¿ã«æŽæ°
ãããžã§ã¯ãå
šäœãåã€ã³ããã¯ã¹ãã代ããã«ã倿Žã®ãã£ããã¡ã€ã«ã ããæŽæ°ã§ããŸã:
```bash
# ç¹å®ã³ãããã®å€æŽãã¡ã€ã«ã®ã¿æŽæ°
# éåžžã®ã³ãããçŽåŸã¯ãã¡ããåªå
ãgit å±¥æŽã« rename/delete path ãå«ãŸãã
cdidx ./myproject --commits abc123 def456
# ç¹å®ãã¡ã€ã«ã®ã¿æŽæ°ïŒin-place ç·šéãæ°èŠè¿œå åãïŒ
# rename/delete ã®æ§ path ã¯ãæç€ºããªãéã purge ãããªã
cdidx ./myproject --files src/app.cs src/utils.cs
```
ã³ãããåäœã®èªååã§ã¯ `--commits` ãåªå
ããŠãã ããã`--files` ã¯æ¢å path ã®ç·šéãæ°èŠãã¡ã€ã«è¿œå ã ããåæã«ãã editor/save hook åãã§ãã`git reset`ã`git rebase`ã`git commit --amend`ã`git switch`ã`git merge` ã®åŸã¯ãrepo å
šäœã® stale path ãæé€ããããã« `cdidx ./myproject --json` ã®ãã«æŽæ°ãåªå
ããŠãã ããã
ãããã®ãªãã·ã§ã³ã«ãããå€§èŠæš¡ã³ãŒãããŒã¹ã§ããªã¢ã«ã¿ã€ã ã«ã€ã³ããã¯ã¹ãææ°ã«ä¿ã¡ããããªããŸãããstale path ã purge ã§ããç¯å²ã¯æŽæ°ã¢ãŒãããšã«ç°ãªããŸããcdidxã«ã¯MCPïŒModel Context ProtocolïŒãµãŒããŒãçµã¿èŸŒãŸããŠããŸããMCPã¯ãAIã³ãŒãã£ã³ã°ããŒã«ãå€éšããã°ã©ã ãšéä¿¡ããããã®æšæºãããã³ã«ã§ããcdidx mcp ãå®è¡ãããšãcdidxãstdin/stdoutã§åŸ
æ©ããAIããŒã«ããã®æ€çŽ¢ãªã¯ãšã¹ããJSONã§åãåããæ§ç¯æžã¿ã€ã³ããã¯ã¹ããå³åº§ã«çµæãè¿ããŸãã
ããŒã«çµæã¯ structuredContent ã«æ§é åJSONãcontent ã«çãèŠçŽããã¹ããè¿ããããAIããŒã«ã¯å·šå€§ãªããã¹ããããŒã¹ããã«åä»ãããŒã¿ãæ±ããŸãã
flowchart LR
tools["Claude Code<br/>Cursor<br/>Windsurf"]
server["cdidx<br/>mcp server"]
tools -->|"stdin (JSON-RPC)"| server
server -->|"stdout (JSON-RPC)"| tools
ã»ããã¢ãã â AIããŒã«ã®èšå®ãã¡ã€ã«ã«è¿œå ããã ã:
Claude Code (.claude/settings.json ãŸã㯠.mcp.json):
{
"mcpServers": {
"cdidx": {
"command": "cdidx",
"args": ["mcp", "--db", ".cdidx/codeindex.db"]
}
}
}Cursor (.cursor/mcp.json):
{
"mcpServers": {
"cdidx": {
"command": "cdidx",
"args": ["mcp", "--db", ".cdidx/codeindex.db"]
}
}
}Windsurf (.windsurf/mcp.json):
{
"mcpServers": {
"cdidx": {
"command": "cdidx",
"args": ["mcp", "--db", ".cdidx/codeindex.db"]
}
}
}GitHub Copilot (VS Code â .vscode/mcp.json):
{
"servers": {
"cdidx": {
"type": "stdio",
"command": "cdidx",
"args": ["mcp", "--db", ".cdidx/codeindex.db"]
}
}
}OpenAI Codex CLI (codex.json ãŸã㯠~/.codex/config.json):
{
"mcpServers": {
"cdidx": {
"command": "cdidx",
"args": ["mcp", "--db", ".cdidx/codeindex.db"]
}
}
}èšå®ããã ãã§ãAIã以äžã®ããŒã«ãçŽæ¥åŒã³åºããŸã:
| ããŒã« | 説æ |
|---|---|
search |
ã³ãŒããã£ã³ã¯ã®å šææ€çŽ¢ |
definition |
ã·ã³ãã«ã®å®£èšãšå¿ èŠãªãæ¬äœãåæ§æããŠååŸ |
references |
察å¿èšèªã§ã€ã³ããã¯ã¹æžã¿åç §ãæ€çŽ¢ |
callers |
察å¿èšèªã§æå®ã·ã³ãã«ã® caller ãåæ |
callees |
察å¿èšèªã§æå®ã·ã³ãã«ã® callee ãåæ |
symbols |
颿°ã»ã¯ã©ã¹ã»ã€ã³ã¿ãŒãã§ãŒã¹ã»importã»namespace ãååã§æ€çŽ¢ |
files |
ã€ã³ããã¯ã¹æžã¿ãã¡ã€ã«äžèЧ |
find_in_file |
æ¢ç¥ã®ã€ã³ããã¯ã¹æžã¿ãã¡ã€ã«å ã§ãªãã©ã«éšåæååäžèŽãè¡ã»åä»ãã§æ€çŽ¢ |
excerpt |
ã€ã³ããã¯ã¹æžã¿ãã£ã³ã¯ããç¹å®è¡ç¯å²ãåæ§æ |
map |
èšèªãã¢ãžã¥ãŒã«ããããã¹ããããæšå®ãšã³ããªãã€ã³ããèŠçŽ |
analyze_symbol |
å®çŸ©ãè¿åã·ã³ãã«ãåç §ãcallerãcalleeããã¡ã€ã«æ å ±ãã¯ãŒã¯ã¹ããŒã¹ä¿¡é Œã¡ã¿ããŒã¿ãgraph 察å¿ã¡ã¿ããŒã¿ããŸãšããŠè¿ã |
outline |
1ãã¡ã€ã«ã®å šã·ã³ãã«ãè¡çªå·ã»ã·ã°ããã£ã»ãã¹ãæ§é ä»ãã§è¡šç€º |
status |
ããŒã¿ããŒã¹çµ±èšæ å ± |
deps |
åç §ã°ã©ããããã¡ã€ã«éäŸåãšããžã衚瀺 |
impact_analysis |
ã·ã³ãã«ã®æšç§»ç caller ãç®åºããåäžå®çŸ©ã®å㯠heuristic 㪠file-level dependency hint ã«ãã©ãŒã«ããã¯ããè€æ°å®çŸ©æã¯ãã³ããè¿ã |
unused_symbols |
å®çŸ©ãããŠãããåç §ãããŠããªãã·ã³ãã«ã bucket ä»ãã§æ€çŽ¢ïŒãããã³ãŒãæ€åºåãïŒ |
symbol_hotspots |
æãåç §ãããã·ã³ãã«ãæ€çŽ¢ïŒåœ±é¿ã®å€§ããã³ãŒãïŒ |
batch_query |
è€æ°ã¯ãšãªã1åã§å®è¡ïŒMCPå°çšãæå€§10ä»¶ïŒ |
validate |
ãšã³ã³ãŒãã£ã³ã°åé¡ïŒU+FFFDãBOMãnull ãã€ããæ¹è¡æ··åšïŒãå ±å |
languages |
察å¿èšèªäžèŠ§ãæ¡åŒµåã»æ©èœä»ãã§è¡šç€º |
ping |
軜éãªæ¥ç¶ç¢ºèª |
index |
ãããžã§ã¯ãã®ã€ã³ããã¯ã¹äœæã»æŽæ° |
backfill_fold |
æ¢å DB ã® folded-name key ããœãŒã¹åè§£æãªãã§æŽæ° |
suggest_improvement |
æ§é åãããæ¹åææ¡ãŸãã¯ãšã©ãŒå ±åãéä¿¡ |
CLAUDE.mdã®èšå®ãSQLãã³ãã¬ãŒãã¯äžèŠ â AIãcdidxãšãã€ãã£ãã«é£æºããŸãã
å€ã .cdidx/codeindex.db ã Unicode --exact 察å¿ãžäžãããã ãããŸã㯠fold metadata ã® drift ã folded key åçæã ãã§è§£æ¶ããããªãããœãŒã¹åè§£æãªãã§æ¬¡ãå®è¡ã§ããŸã:
cdidx backfill-foldããã¯æ¢å DB è¡ãã name_folded / *_folded åãåèšç®ããfold_ready ã stamp ãããå¯Ÿè±¡ã¯æ¢åã® CodeIndex DB ã«éããã空ã®DBãååšããªããã¹ãæå®ããŠãæ°èŠäœæããæåŠããã
referencesãcallersãcallees ãªã©ã® graph ç³» MCP ããŒã«ããèšèªãã£ã«ã¿ãæå®ãããŠããå Žå㯠graph_languageãgraph_supportedãgraph_support_reason ãè¿ããæªå¯Ÿå¿èšèªãšåãªã 0 ä»¶ããããåºå¥ã§ããããã«ããŠããŸãã
å
š MCP ããŒã«ã¯ annotationsïŒreadOnlyHintãdestructiveHintãidempotentHintãopenWorldHintïŒãå«ã¿ãAIã¯ã©ã€ã¢ã³ãããŠãŒã¶ãŒãžã®ç¢ºèªãªãã«å®å
šãªèªã¿åãå°çšã¯ãšãªãèªåæ¿èªã§ããããã«ããŠããŸãã
grep / rg |
cdidx |
|
|---|---|---|
| åºååœ¢åŒ | ãã¬ãŒã³ããã¹ãïŒããŒã¹å¿ èŠïŒ | æ§é åJSONïŒsearch / symbols ç³»ã®ããã㯠JSON ã©ã€ã³ãsummary/count ãš degraded 㪠graph 0ä»¶ã¯åäžãªããžã§ã¯ãïŒ |
| å€§èŠæš¡ãªããžããªã§ã®æ€çŽ¢é床 | æ¯åå šãã¡ã€ã«ã¹ãã£ã³ | æ§ç¯æžã¿FTS5ã€ã³ããã¯ã¹ |
| ã·ã³ãã«èªè | ãªã | 颿°ãã¯ã©ã¹ãã€ã³ããŒã |
| ç¹°ãè¿ã調æ»ã§ã®ããŒã¯ã³é | çã®åºãæè | çãã€ã³ããã¯ã¹æžã¿ã¹ãããã |
| ã€ã³ã¯ãªã¡ã³ã¿ã«æŽæ° | N/A | --commits, --files |
cdidx ã«ã¯ãAI ãšãŒãžã§ã³ããã®ã£ãããäžå
·åã«æ°ã¥ãããšãã«äœ¿ãã suggest_improvement MCP ããŒã«ããããŸããææ¡ã¯ .cdidx/suggestions.json ã«ããŒã«ã«ä¿åãããCDIDX_GITHUB_TOKEN ãæç€ºèšå®ããå Žåã«éã£ãŠ GitHub ãžéä¿¡ãããŸãããã€ããŒã詳现ãšãœãŒã¹ã³ãŒãæŒããã¬ãŒã㯠DEVELOPER_GUIDE.md#ai-feedback-implementation ã«ãŸãšããŠããŸãã
Maintainerã»forker åã â 詳现ãªãªãªãŒã¹æé 㯠DEVELOPER_GUIDE.md#release-workflow ã«ãããŸããMAINTAINERS.md 㯠maintainer åã玢åŒã§ãã
èŠç¹ã ãèšããšãããŒãžã§ã³ã®çå®ã¯ version.json ã«éçŽãããŠãããã¡ã³ããåããã§ãã¯ãªã¹ãã«ã¯æªããŒãžæ/PR ã®ããªã¢ãŒãžãCHANGELOG ææ Œãã¿ã°ä»ããã¯ãªãŒã³ã€ã³ã¹ããŒã«æ€èšŒãŸã§å«ãŸããŸãã
- éçºè ã¬ã€ã â ã¢ãŒããã¯ãã£ãDBã¹ããŒããAIå¿çå¥çŽããªãªãŒã¹æé ãèšèšå€æ
- ãã¹ãã¬ã€ã â ãã¹ãã¹ã€ãŒãæ§æãå ±æãã«ããŒãã¯ãã¹ãã©ãããã©ãŒã 泚æç¹ãä¿å®ã«ãŒã«
- èªå·±æ¹åã«ãŒã â AIã cdidx èªèº«ãç¶ç¶æ¹åãããšãã®ããã®ãŸãŸäœ¿ããéçšå¥çŽ