[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-78872":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":14,"forks30d":14,"starsTrendScore":16,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":14,"starSnapshotCount":14,"syncStatus":13,"lastSyncTime":26,"discoverSource":27},78872,"codeindex","scheidydude\u002Fcodeindex","scheidydude","Repo dependency analyzer with **blast-radius impact scoring** for AI-assisted development.",null,"Python",259,35,2,0,1,4,157,4.67,"Other",false,"main",[],"2026-06-12 02:03:48","# codeindex\n\nRepo dependency analyzer with **blast-radius impact scoring** and **symbol indexing** for AI-assisted development.\n\nPoint it at any project — Python, JavaScript\u002FTypeScript, Go, Ruby, Rust, Java, PHP, and more — and get:\n\n- A `codeindex.json` dependency index written directly into your repo\n- Per-file blast-radius scores (how many files break if this one changes)\n- A `symbolindex.json` symbol map so AI can find any function\u002Fclass without scanning every file\n- Five ways to consume the data: CLI, markdown report, MCP server, pre-commit hook, CLAUDE.md injection\n- An interactive visualization UI (2D\u002F3D graphs, dependency matrix, treemap)\n\nNo build step. No npm. Pure Python stdlib — zero required dependencies.\n\n---\n\n## Install\n\n```bash\npip install codeindex\n```\n\nOr from source:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fscheidydudes\u002Fcodeindex\ncd codeindex\npip install -e .\n```\n\n---\n\n## Quickstart\n\n```bash\n# Build the dependency index\ncodeindex analyze .\u002Fmyapp\n\n# Build the symbol index (where every function and class lives)\ncodeindex symbols .\u002Fmyapp\n\n# See blast radius for a file before touching it\ncodeindex impact src\u002Fauth.py\n\n# Launch the visualization UI\ncodeindex serve --viz --repo .\u002Fmyapp\nopen http:\u002F\u002Flocalhost:8080\n```\n\n---\n\n## Commands\n\n### `codeindex analyze`\n\n```bash\ncodeindex analyze [REPO_PATH] [--output PATH] [--watch]\n```\n\nAnalyzes the repo and writes `codeindex.json` to the repo root. Detects 12+ languages automatically.\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `REPO_PATH` | `.` | Path to repo root |\n| `--output` | `\u003Crepo>\u002Fcodeindex.json` | Override output path |\n| `--watch` | off | Re-index on file changes (requires `watchdog`) |\n\n---\n\n### `codeindex symbols`\n\n```bash\ncodeindex symbols [REPO_PATH] [--output PATH] [--inline] [--index PATH]\n                  [--claude-md] [--claude-md-path PATH] [--all-symbols]\n```\n\nBuilds a symbol index — a map of every function, class, struct, and type to its exact file and line number. Lets AI tools (and humans) find any symbol in one lookup instead of scanning the entire repo.\n\n**Modes:**\n\n| Flag | Description |\n|------|-------------|\n| _(none)_ | Write a standalone `symbolindex.json` |\n| `--inline` | Embed symbols into each node in `codeindex.json` instead |\n| `--claude-md` | Append a compressed symbol summary to `CLAUDE.md` |\n\nBoth `--inline` and `--claude-md` can be combined in a single run.\n\n**Options:**\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `REPO_PATH` | `.` | Path to repo root |\n| `--output` | `\u003Crepo>\u002Fsymbolindex.json` | Output path (standalone mode) |\n| `--index` | auto-discovered | Path to `codeindex.json` (for `--inline`) |\n| `--claude-md-path` | `\u003Crepo>\u002FCLAUDE.md` | Override CLAUDE.md path |\n| `--all-symbols` | off | Include non-exported symbols in CLAUDE.md (default: exported only) |\n\n**Examples:**\n\n```bash\n# Standalone symbol index\ncodeindex symbols .\u002Fmyapp\n\n# Embed into codeindex.json (one file for blast radius + symbols)\ncodeindex symbols .\u002Fmyapp --inline\n\n# Write CLAUDE.md summary so Claude Code loads symbols automatically\ncodeindex symbols .\u002Fmyapp --claude-md\n\n# All three at once\ncodeindex symbols .\u002Fmyapp --inline --claude-md\n\n# Re-generate when code changes\ncodeindex symbols .\u002Fmyapp --inline --claude-md\n```\n\n**Why it matters:** Claude Code and other AI tools normally scan every file to find a function definition. With a symbol index, Claude can load one file, do an O(1) lookup, and open only the relevant file — cutting token usage 60–90% on symbol-location tasks.\n\n**CLAUDE.md injection** is opt-in because it increases base context size on every prompt. Use it when symbol lookups are frequent in your workflow; skip it for simple tasks where the overhead outweighs the benefit.\n\n---\n\n### `codeindex impact`\n\n```bash\ncodeindex impact FILE [--index PATH] [--out FILE] [--json]\n```\n\nShows the blast-radius impact for a specific file: direct dependents, transitive dependents, blast score, and risk level.\n\n```\nImpact: src\u002Fauth.py\nBlast Score: 8.5  (2 direct · 7 transitive)  [HIGH]\n\nDirect dependents (2)\n  src\u002Fapi.py\n  src\u002Fmiddleware.py\n\nTransitive dependents (5 additional)\n  src\u002Fmain.py  ← src\u002Fapi.py\n  src\u002Fapp.py   ← src\u002Fmiddleware.py\n  ...\n\nRisk: HIGH — affects 7\u002F42 files (16.7% of codebase)\n```\n\n**Blast score formula:** `direct + (0.5 × transitive)`\n\n| Flag | Description |\n|------|-------------|\n| `--index PATH` | Path to `codeindex.json` (auto-discovered if omitted) |\n| `--out FILE` | Write a markdown report to this file |\n| `--json` | Output raw JSON |\n\n---\n\n### `codeindex serve`\n\n```bash\ncodeindex serve --viz [--repo PATH] [--port PORT] [--watch]\ncodeindex serve --mcp\n```\n\n`--viz` launches an interactive visualization UI in your browser (5 modes: 2D force graph, 3D network, dependency matrix, treemap, infrastructure graph).\n\n`--mcp` starts a stdio MCP server that exposes codeindex tools directly to Claude and other MCP clients.\n\n**MCP tools:**\n\n| Tool | Description |\n|------|-------------|\n| `analyze_repo` | Build or refresh the dependency index |\n| `get_impact` | Blast-radius report for a file |\n| `get_dependencies` | imports + imported-by for a file |\n| `get_high_blast_files` | All files above a blast score threshold |\n| `build_symbol_index` | Build or refresh the symbol index |\n| `lookup_symbol` | Find where any function\u002Fclass\u002Ftype is defined (file + line) |\n\n**Claude Code MCP config** (`.claude\u002Fsettings.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"codeindex\": {\n      \"command\": \"codeindex\",\n      \"args\": [\"serve\", \"--mcp\"]\n    }\n  }\n}\n```\n\n---\n\n### `codeindex lookup`\n\n```bash\ncodeindex lookup SYMBOL [--index PATH] [--json]\n```\n\nFinds where a function, class, struct, or other symbol is defined. O(1) lookup against `symbolindex.json` — no file scanning.\n\n```\n$ codeindex lookup compute_blast_radius\ncodeindex\u002Fimpact.py:6  (function)\n\n$ codeindex lookup AuthService\nsrc\u002Fauth.py:44  (class)  methods: login, logout, refresh\n```\n\n| Flag | Description |\n|------|-------------|\n| `--index PATH` | Path to `symbolindex.json` (auto-discovered if omitted) |\n| `--json` | Output raw JSON |\n\n---\n\n### `codeindex dependencies`\n\n```bash\ncodeindex dependencies FILE [--index PATH] [--json]\n```\n\nShows what a file imports and what imports it, plus its blast score.\n\n```\n$ codeindex dependencies src\u002Fauth.py\nFile: src\u002Fauth.py  (blast score: 8.5)\n\nImports (3):\n  src\u002Fdb.py\n  src\u002Fconfig.py\n  src\u002Futils.py\n\nImported by (2):\n  src\u002Fapi.py\n  src\u002Fmiddleware.py\n```\n\n| Flag | Description |\n|------|-------------|\n| `--index PATH` | Path to `codeindex.json` (auto-discovered if omitted) |\n| `--json` | Output raw JSON |\n\n---\n\n### `codeindex high-blast`\n\n```bash\ncodeindex high-blast [--threshold N] [--index PATH] [--json]\n```\n\nLists all files whose blast score exceeds the threshold, sorted by score descending. Useful for identifying the riskiest files before a refactor.\n\n```\n$ codeindex high-blast --threshold 5\nFiles with blast score ≥ 5.0  (3 found)\n\n  13.0  src\u002Fdb.py          (12d \u002F 2t)\n   8.5  src\u002Fauth.py        (3d \u002F 7t)\n   5.5  src\u002Fconfig.py      (5d \u002F 1t)\n```\n\n`d` = direct dependents · `t` = transitive dependents\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `--threshold N` | `5` | Minimum blast score to include |\n| `--index PATH` | auto-discovered | Path to `codeindex.json` |\n| `--json` | off | Output raw JSON |\n\n---\n\n### `codeindex install-hook`\n\n```bash\ncodeindex install-hook [--repo PATH] [--threshold N] [--strict] [--remove]\n```\n\nInstalls a git pre-commit hook that warns when staged files exceed the blast score threshold.\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `--threshold N` | `10` | Blast score above which to warn |\n| `--strict` | off | Block the commit instead of just warning |\n| `--remove` | — | Uninstall the hook |\n\n---\n\n## Using codeindex in another repo with Claude\n\nThree workflows, ordered by automation level.\n\n### Workflow 1 — MCP server (recommended for active coding)\n\nClaude gets symbol lookup, dependency, and impact tools it calls automatically. No extra prompting needed.\n\n**One-time setup:**\n```bash\ncd \u002Fyour\u002Fother\u002Frepo\ncodeindex analyze .\ncodeindex symbols .\n```\n\nRegister the MCP server with Claude Code using `claude mcp add`. Use `--scope project` to limit it to this repo, or `--scope global` to use it everywhere:\n\n```bash\n# Project-scoped (recommended — stored in .claude\u002Fsettings.json)\nclaude mcp add --scope project codeindex -- \u002Fpath\u002Fto\u002Fcodeindex serve --mcp\n\n# Global (available in all repos)\nclaude mcp add --scope global codeindex -- \u002Fpath\u002Fto\u002Fcodeindex serve --mcp\n```\n\nFind the full path to your codeindex binary with `which codeindex`, then substitute it above.\n\n```bash\n# Example with conda install\nclaude mcp add --scope project codeindex -- \u002Fopt\u002Fhomebrew\u002FCaskroom\u002Fminiforge\u002Fbase\u002Fbin\u002Fcodeindex serve --mcp\n```\n\nVerify it registered:\n```bash\nclaude mcp list\n```\n\n> **Note:** Do not use `\"command\": \"codeindex\"` with a bare name — Claude Code does not inherit your shell PATH, so the binary won't be found unless you use the absolute path.\n\nClaude now has all 6 MCP tools available in every session. When it needs to find `processPayment`, it calls `lookup_symbol(\"processPayment\")` and gets `src\u002Fbilling.py:142` back in one shot — no file scanning.\n\n**Keep the index fresh:**\n```bash\n# Auto-rebuild on file changes (leave running in a terminal)\ncodeindex symbols . --watch\n```\n\n---\n\n### Workflow 2 — CLAUDE.md injection (best for repos you revisit often)\n\nSymbol table is embedded in `CLAUDE.md` so it loads into every session automatically — no tool call needed at all.\n\n```bash\ncd \u002Fyour\u002Fother\u002Frepo\ncodeindex symbols . --claude-md\n```\n\nThis upserts a `symbolindex` code fence into `CLAUDE.md`. Every Claude Code session in that repo loads it at startup. Claude can answer \"where is `X` defined?\" from context alone with zero tool calls.\n\n**Tradeoff:** adds ~500–2000 tokens to every prompt depending on repo size. Worth it for repos where symbol lookups are frequent; skip it for repos where you mostly write new code.\n\n**Keep it fresh:**\n```bash\n# Re-run after significant refactors\ncodeindex analyze . && codeindex symbols . --claude-md\n```\n\n---\n\n### Workflow 3 — Hybrid (large repos)\n\nFor large repos where the `--claude-md` section would be too large, use the MCP server for lookups and add a short hint to `CLAUDE.md` so Claude reaches for the tool first:\n\n```bash\ncodeindex analyze .\ncodeindex symbols .\n```\n\nThen add to `CLAUDE.md`:\n```markdown\n## Codeindex\nSymbol index: `symbolindex.json` — use the `lookup_symbol` MCP tool before grepping for any function or class.\nDependency index: `codeindex.json` — use `get_impact` before modifying high-blast files.\n```\n\nThis costs almost no tokens but primes Claude to use the index rather than defaulting to grep.\n\n---\n\n### CLI quick reference for human use\n\nThe same data available via MCP is also accessible directly from the terminal:\n\n```bash\n# Find where a symbol is defined\ncodeindex lookup MyClassName\ncodeindex lookup process_payment --json\n\n# Show what a file imports and what depends on it\ncodeindex dependencies src\u002Fauth.py\n\n# List the riskiest files to change\ncodeindex high-blast --threshold 5\n\n# Blast-radius report before touching a file\ncodeindex impact src\u002Fauth.py\n```\n\n---\n\n### Which workflow to pick\n\n| Situation | Workflow |\n|-----------|----------|\n| Daily driver repo, active feature work | MCP server |\n| Medium repo, frequent symbol lookups | CLAUDE.md injection |\n| Large repo (1000+ files) | MCP server + short CLAUDE.md hint |\n| Quick one-off in an unfamiliar repo | `codeindex symbols . --claude-md`, delete after |\n| Terminal \u002F scripting use | CLI commands (`lookup`, `dependencies`, `high-blast`) |\n\n---\n\n## Supported Languages\n\n| Language | Dependency analysis | Symbol extraction |\n|----------|--------------------|--------------------|\n| Python | AST imports, type detection | Functions, classes, methods (AST-precise) |\n| JavaScript \u002F TypeScript | ES modules, `require()`, framework detection | Exported functions, classes, types, enums, consts |\n| Vue | SFC `\u003Cscript>` imports | Exported symbols from `\u003Cscript>` block |\n| Go | Package-level nodes, `import` blocks | Functions, structs, interfaces (exported flag) |\n| Ruby | `require`, `require_relative`, `autoload` | Classes, modules, methods |\n| Rust | `mod`, `use crate::` | `pub fn`, structs, enums, traits |\n| Java \u002F Kotlin | FQN imports, wildcard imports | Classes, interfaces, methods |\n| PHP | PSR-4 namespace resolution | Classes, interfaces, functions |\n| CSS \u002F SCSS \u002F Less | `@import`, `@use`, `@forward` | — |\n| Docker | Services, `depends_on` edges | — |\n| CI\u002FCD | GitHub Actions + GitLab CI jobs, `needs:` edges | — |\n| SQL \u002F Prisma | Tables\u002Fmodels, foreign key edges | — |\n\n---\n\n## Output schemas\n\n### `codeindex.json`\n\n```json\n{\n  \"meta\": {\n    \"root\": \"myapp\u002F\",\n    \"total_files\": 60,\n    \"total_loc\": 4085,\n    \"languages\": [\"python\", \"javascript\"]\n  },\n  \"nodes\": [\n    {\n      \"id\": \"src\u002Fauth.py\",\n      \"type\": \"module\",\n      \"language\": \"python\",\n      \"layer\": \"backend\",\n      \"loc\": 142,\n      \"imports\": [\"src\u002Fdb.py\"],\n      \"imported_by\": [\"src\u002Fapi.py\", \"src\u002Fmiddleware.py\"],\n      \"direct_dependents\": 2,\n      \"transitive_dependents\": 7,\n      \"blast_score\": 5.5,\n      \"symbols\": [\n        { \"name\": \"verify_token\", \"line\": 18, \"kind\": \"function\", \"exported\": true },\n        { \"name\": \"AuthService\",  \"line\": 44, \"kind\": \"class\",    \"exported\": true,\n          \"methods\": [\"login\", \"logout\", \"refresh\"] }\n      ]\n    }\n  ],\n  \"links\": [\n    { \"source\": \"src\u002Fapi.py\", \"target\": \"src\u002Fauth.py\", \"weight\": 1, \"kind\": \"imports\" }\n  ]\n}\n```\n\nThe `symbols` field is only present when `codeindex symbols --inline` has been run.\n\n---\n\n### `symbolindex.json`\n\n```json\n{\n  \"meta\": {\n    \"generated\": \"2026-05-21\",\n    \"repo\": \"myapp\u002F\",\n    \"total_symbols\": 312\n  },\n  \"symbols\": {\n    \"verify_token\": [\n      {\n        \"file\": \"src\u002Fauth.py\",\n        \"line\": 18,\n        \"kind\": \"function\",\n        \"exported\": true,\n        \"doc\": \"Verify a JWT and return the decoded payload.\"\n      }\n    ],\n    \"AuthService\": [\n      {\n        \"file\": \"src\u002Fauth.py\",\n        \"line\": 44,\n        \"kind\": \"class\",\n        \"exported\": true,\n        \"methods\": [\"login\", \"logout\", \"refresh\"]\n      }\n    ]\n  },\n  \"file_symbols\": {\n    \"src\u002Fauth.py\": [\n      { \"name\": \"verify_token\", \"line\": 18, \"kind\": \"function\", \"exported\": true },\n      { \"name\": \"AuthService\",  \"line\": 44, \"kind\": \"class\",    \"exported\": true,\n        \"methods\": [\"login\", \"logout\", \"refresh\"] }\n    ]\n  }\n}\n```\n\n**Lookup patterns:**\n\n- *\"Where is `verify_token` defined?\"* → `symbols[\"verify_token\"][0].file` + `.line` — O(1)\n- *\"What symbols live in `src\u002Fauth.py`?\"* → `file_symbols[\"src\u002Fauth.py\"]` — O(1)\n- *\"What's the blast radius of changing `verify_token`?\"* → cross-reference `codeindex.json` via the file\n\n---\n\n### CLAUDE.md symbol section\n\nWhen `--claude-md` is used, a compact section is upserted into `CLAUDE.md` bounded by HTML comment markers so re-runs update in place:\n\n```\n\u003C!-- codeindex-symbols-start -->\n## Symbol Index\n_Generated by codeindex. Update: `codeindex symbols --claude-md`_\n\n```symbolindex\nsrc\u002Fauth.py: verify_token:fn:18 AuthService:cls:44[login,logout,refresh]\nsrc\u002Fdb.py: connect:fn:12 query:fn:28 close:fn:55\n```\n\u003C!-- codeindex-symbols-end -->\n```\n\nFormat per symbol: `name:kind_abbr:line[methods...]`\nKind abbreviations: `fn` function · `cls` class · `st` struct · `en` enum · `tr` trait · `if` interface · `ty` type · `co` const\n\n---\n\n## AI workflow comparison\n\n| Task | Without codeindex | With symbolindex.json |\n|------|-------------------|----------------------|\n| Find where `process_payment` is defined | Grep \u002F scan ~200 files | Load 1 file, O(1) lookup |\n| Understand blast radius of a change | Manual tracing | `codeindex impact \u003Cfile>` |\n| Load only relevant context | Full repo scan | File + line from symbol map |\n| Estimated token savings | baseline | **60–90% on symbol tasks** |\n\n---\n\n## Optional dependencies\n\n| Package | Purpose | Install |\n|---------|---------|---------|\n| `watchdog` | `--watch` file change detection | `pip install 'codeindex[watch]'` |\n| `PyYAML` | Better Docker Compose \u002F CI YAML parsing | `pip install 'codeindex[yaml]'` |\n| `tomli` | Rust `Cargo.toml` on Python \u003C 3.11 | `pip install 'codeindex[toml]'` |\n\n---\n\n## Requirements\n\n- Python 3.9+\n- A modern browser (for `--viz` mode)\n\n---\n\n## License\n\nApache 2.0 — free to use and build on; attribution required in derivative works and documentation. Copyright 2026 David Scheiderman.\n","codeindex 是一个用于分析代码仓库依赖关系的工具，支持AI辅助开发，并提供爆炸半径影响评分和符号索引功能。它能够生成`codeindex.json`文件来记录项目的依赖关系，以及每个文件的爆炸半径得分（即修改该文件可能影响到的其他文件数量），同时还生成`symbolindex.json`以便于AI或开发者快速查找特定函数或类的位置。此外，codeindex提供了多种数据消费方式如命令行界面、Markdown报告等，并且拥有交互式可视化界面帮助理解项目结构。此工具适用于需要了解复杂代码库内部依赖关系及其潜在变更影响的所有软件开发场景，尤其是大型多语言项目维护。安装简便，仅需Python标准库即可运行，无需额外构建步骤或其他依赖。","2026-06-11 03:57:15","CREATED_QUERY"]