{"_id":"@apart-tech/code-index","_rev":"5-f06ab13ba498471abb5ba2e4b18e2170","name":"@apart-tech/code-index","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@apart-tech/code-index","version":"1.0.0","keywords":["typescript","javascript","code-analysis","llm","ai","ast","code-registry","cli","compiler-api","developer-tools"],"author":"","license":"MIT","_id":"@apart-tech/code-index@1.0.0","maintainers":[{"name":"aleksander-apart","email":"aleksander@apart.tech"},{"name":"marcinbrandys","email":"marcin@apart.tech"},{"name":"ilia_apart","email":"ilia@apart.tech"}],"homepage":"https://github.com/yourusername/code-index#readme","bugs":{"url":"https://github.com/yourusername/code-index/issues"},"bin":{"code-index":"dist/cli.js"},"dist":{"shasum":"8a3030b3a9aa0dd4b02da88a83a9a69275f1f333","tarball":"https://registry.npmjs.org/@apart-tech/code-index/-/code-index-1.0.0.tgz","fileCount":27,"integrity":"sha512-vFTqsHamKIhJcxT+M4bOrX9dHGdQsmSXZt82GFV+ZqHc+htOgwgE4tSwz3tK+FIkUqA+7X9B5pKXz+HAUi5X0g==","signatures":[{"sig":"MEUCIHmKr47pnBcE7J9fPjgGbXmBonGw+ngxmxaFScbHcq9+AiEAlUITW+h9iaqu28oZVsRhCw0/WPIoWB6vpNRCiSHlgoM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":162980},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"dev":"tsc --watch","test":"echo \"Tests coming soon\"","build":"tsc","start":"node dist/cli.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"aleksander-apart","email":"aleksander@apart.tech"},"repository":{"url":"git+https://github.com/yourusername/code-index.git","type":"git","directory":"packages/cli"},"_npmVersion":"11.0.0","description":"CLI tool for generating intelligent TypeScript/JavaScript code registries to reduce LLM hallucinations","directories":{},"_nodeVersion":"22.13.1","dependencies":{"commander":"^11.1.0","typescript":"^5.3.3"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.0"},"_npmOperationalInternal":{"tmp":"tmp/code-index_1.0.0_1762162296424_0.9723598498803181","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@apart-tech/code-index","version":"1.0.1","keywords":["typescript","javascript","code-analysis","llm","ai","ast","code-registry","cli","compiler-api","developer-tools"],"author":"","license":"MIT","_id":"@apart-tech/code-index@1.0.1","maintainers":[{"name":"aleksander-apart","email":"aleksander@apart.tech"},{"name":"marcinbrandys","email":"marcin@apart.tech"},{"name":"ilia_apart","email":"ilia@apart.tech"}],"homepage":"https://github.com/yourusername/code-index#readme","bugs":{"url":"https://github.com/yourusername/code-index/issues"},"bin":{"code-index":"dist/cli.js"},"dist":{"shasum":"7bcf0cf5a3c27ab2fa7b5c341becd896e50a101c","tarball":"https://registry.npmjs.org/@apart-tech/code-index/-/code-index-1.0.1.tgz","fileCount":28,"integrity":"sha512-BirkcPO3ztnTfemfOwOy+q2iskOtJtQU9GeMhUX6F1UmS6Gqfnnpuj2JRntw0DQISDRWFVA0h4sgoJ4/A3WNaw==","signatures":[{"sig":"MEUCIQDXgwAQFvoPkoj1h7gCQQABMP5sE7OjzBDNY7yklDINTQIgXrnDS84bbb9TVxC0m6PtS54lKQkEZZXw10tWR5Q9wfk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":196682},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"dev":"tsc --watch","test":"echo \"Tests coming soon\"","build":"tsc","start":"node dist/cli.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"aleksander-apart","email":"aleksander@apart.tech"},"repository":{"url":"git+https://github.com/yourusername/code-index.git","type":"git","directory":"packages/cli"},"_npmVersion":"11.0.0","description":"CLI tool for generating intelligent TypeScript/JavaScript code registries to reduce LLM hallucinations","directories":{},"_nodeVersion":"22.13.1","dependencies":{"commander":"^11.1.0","typescript":"^5.3.3"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.0"},"_npmOperationalInternal":{"tmp":"tmp/code-index_1.0.1_1762162369747_0.3336931752832062","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@apart-tech/code-index","version":"1.0.2","keywords":["typescript","javascript","code-analysis","llm","ai","ast","code-registry","cli","compiler-api","developer-tools"],"author":"","license":"MIT","_id":"@apart-tech/code-index@1.0.2","maintainers":[{"name":"aleksander-apart","email":"aleksander@apart.tech"},{"name":"marcinbrandys","email":"marcin@apart.tech"},{"name":"ilia_apart","email":"ilia@apart.tech"}],"homepage":"https://github.com/yourusername/code-index#readme","bugs":{"url":"https://github.com/yourusername/code-index/issues"},"bin":{"code-index":"dist/cli.js"},"dist":{"shasum":"4d6ecab326c62b67c259b078f73fb060b6d0bd33","tarball":"https://registry.npmjs.org/@apart-tech/code-index/-/code-index-1.0.2.tgz","fileCount":28,"integrity":"sha512-oEF2gfdIfcXjIBrxYuHMkky6ne7Sg5rEUB069/Tf2lzT27w923V8l/J075mkbRXvzR89sBnAe1MDdvMhpJhciw==","signatures":[{"sig":"MEUCIQC95i/mDzU0rA6f7QX3bUN4KUT1epn+F09RN4Iw1h25oQIgYAlwVJOUEmxZRWGwH9vNinHx2vKqBZvP16of/XDk+eU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":173461},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"dev":"tsc --watch","test":"echo \"Tests coming soon\"","build":"tsc","start":"node dist/cli.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"aleksander-apart","email":"aleksander@apart.tech"},"repository":{"url":"git+https://github.com/yourusername/code-index.git","type":"git","directory":"packages/cli"},"_npmVersion":"11.0.0","description":"CLI tool for generating intelligent TypeScript/JavaScript code registries to reduce LLM hallucinations","directories":{},"_nodeVersion":"22.13.1","dependencies":{"commander":"^11.1.0","typescript":"^5.3.3"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.0"},"_npmOperationalInternal":{"tmp":"tmp/code-index_1.0.2_1762162627967_0.7910940195209957","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@apart-tech/code-index","version":"1.1.0","keywords":["typescript","javascript","code-analysis","llm","ai","ast","code-registry","cli","compiler-api","developer-tools"],"author":"","license":"MIT","_id":"@apart-tech/code-index@1.1.0","maintainers":[{"name":"aleksander-apart","email":"aleksander@apart.tech"},{"name":"marcinbrandys","email":"marcin@apart.tech"},{"name":"ilia_apart","email":"ilia@apart.tech"}],"homepage":"https://github.com/yourusername/code-index#readme","bugs":{"url":"https://github.com/yourusername/code-index/issues"},"bin":{"code-index":"dist/cli.js"},"dist":{"shasum":"b1e520139958e67d1e0ec42e7bfc161b17fa2185","tarball":"https://registry.npmjs.org/@apart-tech/code-index/-/code-index-1.1.0.tgz","fileCount":30,"integrity":"sha512-vmHkuIQNtS5jmy9IBFxpl1PG/5BYQsh0ulDPBVRQw5kcCSrZ0CjYjlP7CpmWt+vKMgdX5no8ClUK6u3hgRoVhg==","signatures":[{"sig":"MEQCIDrhrDaeCLqmFU8IuPK4Ck+dFlbSgGFS1CkpDFehld80AiAP6tkdxpnG1TMelduxGuWbLQklNLwNDCfHXx9iSfopXQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":214971},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"dev":"tsc --watch","test":"echo \"Tests coming soon\"","build":"tsc","start":"node dist/cli.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"aleksander-apart","email":"aleksander@apart.tech"},"repository":{"url":"git+https://github.com/yourusername/code-index.git","type":"git","directory":"packages/cli"},"_npmVersion":"11.0.0","description":"CLI tool for generating intelligent TypeScript/JavaScript code registries to reduce LLM hallucinations","directories":{},"_nodeVersion":"22.13.1","dependencies":{"commander":"^11.1.0","typescript":"^5.3.3"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.0"},"_npmOperationalInternal":{"tmp":"tmp/code-index_1.1.0_1762646574329_0.7169812018087451","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@apart-tech/code-index","version":"1.2.0","description":"CLI tool for generating intelligent TypeScript/JavaScript code registries to reduce LLM hallucinations","main":"dist/index.js","types":"dist/index.d.ts","bin":{"code-index":"dist/cli.js"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"scripts":{"build":"tsc","dev":"tsc --watch","test":"echo \"Tests coming soon\"","start":"node dist/cli.js","prepublishOnly":"npm run build"},"keywords":["typescript","javascript","code-analysis","llm","ai","ast","code-registry","cli","compiler-api","developer-tools"],"repository":{"type":"git","url":"git+https://github.com/yourusername/code-index.git","directory":"packages/cli"},"author":"","license":"MIT","engines":{"node":">=18.0.0"},"dependencies":{"commander":"^11.1.0","typescript":"^5.3.3"},"devDependencies":{"@types/node":"^20.10.0"},"_id":"@apart-tech/code-index@1.2.0","bugs":{"url":"https://github.com/yourusername/code-index/issues"},"homepage":"https://github.com/yourusername/code-index#readme","_nodeVersion":"22.13.1","_npmVersion":"11.0.0","dist":{"integrity":"sha512-UiNMNqxecUK9O3ySvep/knJXohCNna2a92175FDNJH+NX5V5y6YeX/rBbcz+WlYW8ZGjFXCrnBL5xm/V+AmNOA==","shasum":"2ba790a33ac4e6341fa7a84ba75d31bb9b34bd2d","tarball":"https://registry.npmjs.org/@apart-tech/code-index/-/code-index-1.2.0.tgz","fileCount":30,"unpackedSize":224346,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFLkOk7OucpGejBEdfcW+dyxJAogQX8FKfaDIH+PhDq6AiBC7H+pVZHU0noinKEwZqF9KFvKBbhDol1R1ynVco00aw=="}]},"_npmUser":{"name":"aleksander-apart","email":"aleksander@apart.tech"},"directories":{},"maintainers":[{"name":"aleksander-apart","email":"aleksander@apart.tech"},{"name":"marcinbrandys","email":"marcin@apart.tech"},{"name":"ilia_apart","email":"ilia@apart.tech"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/code-index_1.2.0_1762993158536_0.0606963518044803"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-03T09:31:36.325Z","modified":"2025-11-13T00:19:18.946Z","1.0.0":"2025-11-03T09:31:36.648Z","1.0.1":"2025-11-03T09:32:49.966Z","1.0.2":"2025-11-03T09:37:08.135Z","1.1.0":"2025-11-09T00:02:54.556Z","1.2.0":"2025-11-13T00:19:18.705Z"},"bugs":{"url":"https://github.com/yourusername/code-index/issues"},"license":"MIT","homepage":"https://github.com/yourusername/code-index#readme","keywords":["typescript","javascript","code-analysis","llm","ai","ast","code-registry","cli","compiler-api","developer-tools"],"repository":{"type":"git","url":"git+https://github.com/yourusername/code-index.git","directory":"packages/cli"},"description":"CLI tool for generating intelligent TypeScript/JavaScript code registries to reduce LLM hallucinations","maintainers":[{"name":"aleksander-apart","email":"aleksander@apart.tech"},{"name":"marcinbrandys","email":"marcin@apart.tech"},{"name":"ilia_apart","email":"ilia@apart.tech"}],"readme":"# Code Index\n\n> Intelligent code analysis tool for TypeScript/JavaScript projects\n\nCode Index analyzes codebases and generates structured JSON registries that help developers, LLMs, and CI/CD systems understand code structure. Provides dependency analysis, dead code detection, test coverage analysis, and automated documentation generation.\n\n## Installation\n\n```bash\nnpm install -g @apart-tech/code-index\n```\n\n## Quick Start\n\n```bash\n# Analyze your project\ncode-index analyze --auto\n\n# Search for functions and types\ncode-index search code-index.json \"UserService\"\n\n# Find where a symbol is used\ncode-index find-usage code-index.json \"createUser\"\n\n# Show codebase statistics\ncode-index stats code-index.json\n\n# Find dead code\ncode-index dead-code code-index.json\n\n# Generate documentation\ncode-index docs code-index.json -o API.md\n```\n\n---\n\n## Commands\n\n### `analyze` - Generate Code Registry\n\nAnalyzes TypeScript/JavaScript projects and generates a structured JSON registry.\n\n```bash\ncode-index analyze [options]\n```\n\n**Key Options:**\n- `-p, --project <path>` - Project directory or feature folder (default: current directory)\n- `-o, --output <file>` - Output file path (default: `code-index.json`)\n- `--auto` - Auto-detect optimization based on project size\n- `--compact` - Reduce output size by 80-90% (recommended for LLMs)\n- `--exported-only` - Only include exported items (public API)\n- `--include-implementations` - Include function bodies\n- `--max-definition-length <n>` - Truncate long type definitions\n\n**Examples:**\n```bash\n# Auto-optimize based on project size\ncode-index analyze --auto\n\n# Analyze specific feature\ncode-index analyze -p ./src/features/auth --compact -o auth.json\n\n# Public API only\ncode-index analyze --exported-only -o public-api.json\n```\n\n**When to use:**\n- 🤖 LLM Context: Use `--compact --exported-only` for minimal token usage\n- 📊 Large Projects: Use `-p ./specific/feature` for feature-based analysis\n- 🔍 Documentation: Use `--exported-only` for public API\n\n---\n\n### `deps` - Dependency Analysis\n\nAnalyzes dependencies and builds a dependency graph.\n\n```bash\ncode-index deps <registry> [options]\n```\n\n**Key Options:**\n- `-f, --file <path>` - Show dependencies for specific file\n- `--transitive` - Include transitive dependencies\n- `--depth <number>` - Max depth for transitive dependencies (default: 3)\n- `--stats` - Show dependency statistics\n- `--circular` - Detect circular dependencies\n\n**Examples:**\n```bash\n# Overall statistics\ncode-index deps code-index.json --stats\n\n# File dependencies\ncode-index deps code-index.json --file src/api/users.ts\n\n# Find circular dependencies\ncode-index deps code-index.json --circular\n\n# Transitive dependencies\ncode-index deps code-index.json --file src/cli.ts --transitive\n```\n\n**When to use:**\n- 🔍 Impact Analysis: Find what breaks when you change a file\n- 🔄 Circular Dependencies: Detect and fix circular imports\n- 🎯 Refactoring: Understand module relationships\n\n---\n\n### `diff` - Compare Registries\n\nCompares two code registries and shows differences.\n\n```bash\ncode-index diff <before> <after> [options]\n```\n\n**Key Options:**\n- `-o, --output <file>` - Output diff to file\n- `--format <type>` - Output format: `json`, `markdown`, `text` (default: `text`)\n- `--breaking-only` - Only show breaking changes\n\n**Examples:**\n```bash\n# Compare versions\ncode-index diff v1.0.json v2.0.json\n\n# Save to file\ncode-index diff before.json after.json -o diff.json --format json\n\n# Only breaking changes\ncode-index diff main.json feature.json --breaking-only\n```\n\n**When to use:**\n- 🔄 Code Reviews: Generate diffs for pull requests\n- 📊 Release Notes: Track changes between versions\n- ⚠️ API Changes: Identify what changed\n\n---\n\n### `check-breaking` - CI/CD Breaking Change Detection\n\nChecks for breaking changes and exits with code 1 if found (perfect for CI/CD).\n\n```bash\ncode-index check-breaking <before> <after> [options]\n```\n\n**Key Options:**\n- `--format <type>` - Output format: `text`, `json`, `markdown` (default: `text`)\n- `-o, --output <file>` - Save output to file\n\n**Examples:**\n```bash\n# CI/CD: Fail build if breaking changes\ncode-index check-breaking main.json feature.json\n\n# Generate markdown for PR comment\ncode-index check-breaking main.json feature.json --format markdown -o breaking.md\n```\n\n**Breaking Change Types:**\n- `function_removed` - Exported function removed (major)\n- `function_signature_changed` - Function signature modified (major/minor)\n- `type_removed` - Exported type removed (major)\n- `type_modified` - Type definition changed (minor)\n- `export_removed` - Export statement removed (major)\n\n**When to use:**\n- ✅ CI/CD: Prevent accidental breaking changes in PRs\n- 📦 Semantic Versioning: Determine version bump type\n- 🔒 API Stability: Enforce API contract\n\n---\n\n### `dead-code` - Dead Code Detection\n\nIdentifies unused exports, functions, and potentially dead code.\n\n```bash\ncode-index dead-code <registry> [options]\n```\n\n**Key Options:**\n- `--format <type>` - Output format: `text`, `json`, `markdown` (default: `text`)\n- `-o, --output <file>` - Save output to file\n- `--show-all` - Show all categories (even if empty)\n\n**Examples:**\n```bash\n# Basic analysis\ncode-index dead-code code-index.json\n\n# Generate report\ncode-index dead-code code-index.json --format markdown -o dead-code-report.md\n```\n\n**What it detects:**\n- Unused Exports - Exported but never imported\n- Isolated Files - Files with exports but no dependents\n- Files Without Exports - Files that don't export anything\n- Unused Functions - Non-exported functions never called\n- Unused Types - Non-exported types never referenced\n- Potential Savings - Estimated LOC that could be removed\n\n**When to use:**\n- 🧹 Code Cleanup: Regular cleanup to remove dead code\n- 📉 Bundle Size: Reduce bundle size\n- 🔍 Refactoring: Safely identify deletable code\n\n---\n\n### `coverage` - Test Coverage Analysis\n\nAnalyzes test coverage by comparing source and test registries.\n\n```bash\ncode-index coverage <source> <tests> [options]\n```\n\n**Key Options:**\n- `--format <type>` - Output format: `text`, `json`, `markdown` (default: `text`)\n- `-o, --output <file>` - Save output to file\n- `--threshold <number>` - Minimum coverage % required (exits 1 if below)\n\n**Examples:**\n```bash\n# Generate indices\ncode-index analyze -p ./src --exported-only -o src.json\ncode-index analyze -p ./tests -o tests.json\n\n# Analyze coverage\ncode-index coverage src.json tests.json\n\n# Enforce threshold in CI/CD\ncode-index coverage src.json tests.json --threshold 80\n```\n\n**What it analyzes:**\n- Coverage Percentage - Overall % of functions tested\n- Untested Functions - Functions without tests\n- Suggested Test Files - Where tests should be created\n- Orphaned Tests - Test files without corresponding source\n- Per-File Coverage - Coverage breakdown by file\n\n**When to use:**\n- ✅ CI/CD: Enforce minimum coverage thresholds\n- 📊 Quality Metrics: Track coverage over time\n- 🎯 Test Planning: Identify what needs testing\n\n---\n\n### `docs` - Documentation Generation\n\nGenerates markdown documentation from code registry.\n\n```bash\ncode-index docs <registry> [options]\n```\n\n**Key Options:**\n- `-o, --output <file>` - Output file path (default: `API.md`)\n- `--style <type>` - Documentation style: `api`, `readme` (default: `api`)\n- `--title <title>` - Documentation title\n- `--description <desc>` - Documentation description\n- `--include-private` - Include non-exported items\n- `--group-by <type>` - Group by: `file`, `type` (default: `file`)\n- `--no-toc` - Disable table of contents\n\n**Examples:**\n```bash\n# Generate API documentation\ncode-index docs code-index.json -o API.md\n\n# Generate README\ncode-index docs code-index.json --style readme -o README.md\n\n# Customize\ncode-index docs code-index.json \\\n  --title \"My API\" \\\n  --group-by type \\\n  --include-private\n```\n\n**Documentation Styles:**\n- `api` - Complete API reference with all details\n- `readme` - Project README with quick start and overview\n\n**When to use:**\n- 📚 API Documentation: Auto-generate always up-to-date docs\n- 🔄 CI/CD: Regenerate docs on every commit\n- 📖 Developer Onboarding: Provide comprehensive reference\n\n---\n\n### `search` - Search Code Registry\n\nSearch for functions, types, and files in the code registry without grepping files.\n\n```bash\ncode-index search <registry> <query> [options]\n```\n\n**Key Options:**\n- `--type <filter>` - Filter by: `function`, `type`, `file`, `all` (default: `all`)\n- `--exported-only` - Only show exported items\n- `--case-sensitive` - Case-sensitive matching\n- `--regex` - Treat query as regular expression\n- `--limit <number>` - Limit number of results (default: 50)\n- `--format <type>` - Output format: `text`, `json`, `markdown` (default: `text`)\n- `-o, --output <file>` - Save output to file\n\n**Examples:**\n```bash\n# Basic search\ncode-index search code-index.json \"analyze\"\n\n# Search only functions\ncode-index search code-index.json \"buildGraph\" --type function\n\n# Search with regex\ncode-index search code-index.json \".*Project$\" --regex\n\n# Export to markdown\ncode-index search code-index.json \"Registry\" --format markdown -o results.md\n```\n\n**What it searches:**\n- Function names and signatures\n- Type names and definitions\n- File paths\n- JSDoc comments\n- Parameters and return types\n\n**When to use:**\n- 🔍 Quick Discovery: Find functions/types without grepping\n- 📚 Code Exploration: Understand what's available\n- 🎯 Targeted Search: Find specific patterns with regex\n\n---\n\n### `find-usage` - Find Symbol Usage\n\nFind where a specific symbol (function/type) is used throughout the codebase.\n\n```bash\ncode-index find-usage <registry> <symbol> [options]\n```\n\n**Key Options:**\n- `--format <type>` - Output format: `text`, `json`, `markdown` (default: `text`)\n- `-o, --output <file>` - Save output to file\n\n**Examples:**\n```bash\n# Find where a function is used\ncode-index find-usage code-index.json \"buildDependencyGraph\"\n\n# Generate markdown report\ncode-index find-usage code-index.json \"analyzeProject\" --format markdown -o usage.md\n```\n\n**What it shows:**\n- Symbol definition location\n- Files that import the symbol\n- Import statements\n- Direct usage count\n- Indirect impact (files affected transitively)\n- Total impact radius\n\n**When to use:**\n- 🔄 Refactoring: Assess impact before changing a function\n- 🎯 Impact Analysis: See what breaks when you modify code\n- 📊 Usage Patterns: Understand how APIs are used\n\n---\n\n### `stats` - Codebase Statistics\n\nShow comprehensive statistics and metrics about the codebase.\n\n```bash\ncode-index stats <registry> [options]\n```\n\n**Key Options:**\n- `--format <type>` - Output format: `text`, `json`, `markdown` (default: `text`)\n- `-o, --output <file>` - Save output to file\n- `--detailed` - Show detailed breakdowns\n\n**Examples:**\n```bash\n# Show statistics\ncode-index stats code-index.json\n\n# Generate detailed markdown report\ncode-index stats code-index.json --detailed --format markdown -o stats.md\n```\n\n**Metrics provided:**\n- **Overview**: File/function/type/export counts\n- **Functions**: Async %, exported %, avg parameters, complexity indicators\n- **Types**: Interface/type/class/enum breakdown\n- **Dependencies**: Avg per file, max dependencies, circular deps\n- **Largest Files**: Top files by function count\n- **Most Imported**: Files with most dependents\n- **Complexity Warnings**: Functions with many parameters (≥5)\n\n**When to use:**\n- 📊 Health Metrics: Track codebase complexity over time\n- 🎯 Technical Debt: Identify complexity hotspots\n- 📈 Growth Tracking: Monitor codebase growth\n- 🔍 Code Review: Quick overview for new developers\n\n---\n\n### `validate` - Validate Registry\n\nValidates the structure of a code registry file.\n\n```bash\ncode-index validate <file>\n```\n\n**Example:**\n```bash\ncode-index validate code-index.json\n```\n\n---\n\n## Common Workflows\n\n### LLM Context\n```bash\n# Generate minimal context for LLMs\ncode-index analyze -p ./src/features/auth \\\n  --compact \\\n  --exported-only \\\n  --max-definition-length 150 \\\n  -o context.json\n```\n\n### Pre-Release Check\n```bash\n# Generate baseline\ngit checkout main\ncode-index analyze --exported-only -o baseline.json\n\n# Check feature branch\ngit checkout feature-branch\ncode-index analyze --exported-only -o feature.json\n\n# Detect breaking changes\ncode-index check-breaking baseline.json feature.json\n```\n\n### Code Cleanup\n```bash\n# Find dead code\ncode-index analyze --auto -o project.json\ncode-index dead-code project.json --format markdown -o cleanup.md\n```\n\n### Test Coverage\n```bash\n# Analyze coverage\ncode-index analyze -p ./src --exported-only -o src.json\ncode-index analyze -p ./tests -o tests.json\ncode-index coverage src.json tests.json --threshold 80\n```\n\n---\n\n## Output Format\n\nGenerated registries are JSON files with this structure:\n\n```json\n{\n  \"metadata\": {\n    \"projectName\": \"my-app\",\n    \"fileCount\": 42,\n    \"totalFunctions\": 156,\n    \"totalTypes\": 89\n  },\n  \"files\": {\n    \"src/users.ts\": {\n      \"functions\": {\n        \"createUser\": {\n          \"signature\": \"async function createUser(data: UserData): Promise<User>\",\n          \"parameters\": [...],\n          \"returnType\": \"Promise<User>\",\n          \"isExported\": true,\n          \"line\": 15\n        }\n      },\n      \"types\": {...},\n      \"exports\": [...],\n      \"imports\": {...}\n    }\n  }\n}\n```\n\n---\n\n## Best Practices\n\n### For Developers\n- Use `--auto` for automatic optimization\n- Use `--compact` when sharing with LLMs\n- Run `dead-code` quarterly for cleanup\n- Use `deps --circular` to catch circular dependencies\n\n### For Large Projects (3000+ files)\n- Use feature-based analysis: `-p ./src/features/feature-name`\n- Always use `--compact` mode\n- Focus on public API with `--exported-only`\n\n### For CI/CD\n- Use `check-breaking` to fail builds on breaking changes\n- Use `coverage --threshold` to enforce minimum coverage\n- Generate docs automatically on merge\n\n### For LLM Integration\n- Use `--compact --exported-only --max-definition-length 200`\n- Analyze only relevant features\n- Regenerate before each LLM session\n\n---\n\n## License\n\nMIT\n\n---\n\n**Made for developers and LLMs** • [Documentation](docs/) • [npm](https://www.npmjs.com/package/@apart-tech/code-index)\n","readmeFilename":"README.md"}