|
|
@@ -331,78 +331,6 @@ const syncResult = await cg.sync();
|
|
|
cg.close();
|
|
|
```
|
|
|
|
|
|
-## 🛠️ Development
|
|
|
-
|
|
|
-### Running Tests
|
|
|
-
|
|
|
-```bash
|
|
|
-npm test # Run all tests
|
|
|
-npm run test:watch # Run tests in watch mode
|
|
|
-```
|
|
|
-
|
|
|
-### Building
|
|
|
-
|
|
|
-```bash
|
|
|
-npm run build # Compile TypeScript and copy assets
|
|
|
-npm run clean # Remove build artifacts
|
|
|
-```
|
|
|
-
|
|
|
-### Project Structure
|
|
|
-
|
|
|
-```
|
|
|
-codegraph/
|
|
|
-├── src/
|
|
|
-│ ├── index.ts # Main CodeGraph class
|
|
|
-│ ├── types.ts # TypeScript interfaces
|
|
|
-│ ├── config.ts # Configuration handling
|
|
|
-│ ├── directory.ts # .codegraph/ management
|
|
|
-│ ├── errors.ts # Custom error classes
|
|
|
-│ ├── utils.ts # Utilities (Mutex, batching, etc.)
|
|
|
-│ │
|
|
|
-│ ├── bin/
|
|
|
-│ │ └── codegraph.ts # CLI entry point
|
|
|
-│ │
|
|
|
-│ ├── db/
|
|
|
-│ │ ├── index.ts # Database connection
|
|
|
-│ │ ├── schema.sql # SQLite schema
|
|
|
-│ │ ├── migrations.ts # Schema versioning
|
|
|
-│ │ └── queries.ts # Prepared statements
|
|
|
-│ │
|
|
|
-│ ├── extraction/
|
|
|
-│ │ ├── index.ts # Extraction orchestrator
|
|
|
-│ │ ├── tree-sitter.ts # Parser wrapper
|
|
|
-│ │ ├── grammars.ts # Grammar loading
|
|
|
-│ │ └── queries/ # Tree-sitter queries (.scm)
|
|
|
-│ │
|
|
|
-│ ├── resolution/
|
|
|
-│ │ ├── index.ts # Reference resolver
|
|
|
-│ │ └── frameworks/ # Framework-specific patterns
|
|
|
-│ │
|
|
|
-│ ├── graph/
|
|
|
-│ │ ├── index.ts # Graph query interface
|
|
|
-│ │ ├── traversal.ts # BFS/DFS, impact radius
|
|
|
-│ │ └── queries.ts # Graph queries
|
|
|
-│ │
|
|
|
-│ ├── vectors/
|
|
|
-│ │ ├── index.ts # Vector operations
|
|
|
-│ │ └── search.ts # Similarity search
|
|
|
-│ │
|
|
|
-│ ├── sync/
|
|
|
-│ │ ├── index.ts # Sync orchestrator
|
|
|
-│ │ └── git-hooks.ts # Hook installation
|
|
|
-│ │
|
|
|
-│ ├── context/
|
|
|
-│ │ ├── index.ts # Context builder
|
|
|
-│ │ └── formatter.ts # Output formatting
|
|
|
-│ │
|
|
|
-│ └── mcp/
|
|
|
-│ ├── index.ts # MCP server
|
|
|
-│ ├── transport.ts # Stdio transport
|
|
|
-│ └── tools.ts # Tool definitions
|
|
|
-│
|
|
|
-└── __tests__/ # Test files
|
|
|
-```
|
|
|
-
|
|
|
## ⚙️ How It Works
|
|
|
|
|
|
### 1. Extraction
|