@vohongtho.infotech/code-intel 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Code Intelligence Platform
2
2
 
3
+ [![npm version](https://img.shields.io/badge/npm-v0.5.0-blue)](https://www.npmjs.com/package/@vohongtho.infotech/code-intel)
4
+
3
5
  A static code analysis platform that builds a **Knowledge Graph** from your source code and makes it explorable through a Web UI, HTTP API, CLI, and MCP server.
4
6
 
5
7
  ![Code Intelligence Platform](screenshots/explorer-overview.png)
@@ -10,13 +12,18 @@ A static code analysis platform that builds a **Knowledge Graph** from your sour
10
12
 
11
13
  - **Knowledge Graph** — parses 14+ languages into nodes (functions, classes, files, etc.) and edges (calls, imports, extends, etc.)
12
14
  - **Force-directed Graph Explorer** — interactive Sigma.js visualization with color-coded node types, hover highlighting, and filters
13
- - **Semantic Vector Search** — embeddings via `all-MiniLM-L6-v2` stored in LadybugDB vector index for natural-language code search
14
- - **BM25 Text Search** — keyword-based search with reciprocal rank fusion
15
+ - **Graph Query Language (GQL)** — query your codebase with `FIND`, `TRAVERSE`, `PATH`, `COUNT GROUP BY`; CLI, HTTP API, and MCP tool
16
+ - **Source Code Preview** — click any node to open syntax-highlighted source at the exact line; "Open in editor" (`vscode://`) button
17
+ - **Query Console** — web UI panel with GQL editor, sortable results table, query history, and example queries
18
+ - **AI-Generated Symbol Summaries** — optional `--summarize` flag generates 1-2 sentence summaries per symbol via OpenAI, Anthropic, or Ollama; cached by code hash
19
+ - **Hybrid Search (BM25 + Vector RRF)** — Reciprocal Rank Fusion of keyword + semantic search; `searchMode: 'bm25' | 'vector' | 'hybrid'` in response
20
+ - **Semantic Vector Search** — embeddings via `all-MiniLM-L6-v2`; enriched with summaries when available
15
21
  - **Code AI Chat** — grounded assistant that cites source files in every answer
16
- - **LadybugDB Persistence** — graph and vector index stored as embedded graph database
17
- - **HTTP API** — REST endpoints for graph, search, inspect, blast radius, flows
22
+ - **File Watcher & Auto-Reindex** — `code-intel watch` detects file saves and patches the live graph within ~1 second; WebSocket push notifies connected clients
23
+ - **Code Health** — `code-intel health` reports dead code, circular dependencies (Tarjan SCC), god nodes, orphan files, and a 0–100 health score
24
+ - **HTTP API** — REST endpoints for graph, search, inspect, blast radius, flows, query, source, health
18
25
  - **MCP Server** — Model Context Protocol integration for LLM tooling
19
- - **CLI** — analyze, serve, search, inspect, impact commands with animated progress bars and spinners
26
+ - **CLI** — analyze, serve, watch, query, search, inspect, impact, health commands with animated progress bars and spinners
20
27
  - **Multi-language** — TypeScript, JavaScript, Python, Java, Go, C, C++, C#, Rust, PHP, Ruby, Swift, Kotlin, Dart (14 languages via tree-sitter AST)
21
28
  - **Incremental Analysis** — `--incremental` re-parses only changed files; 10k-file repo / 3 changes: 288ms
22
29
  - **Parallel Analysis** — `--parallel` runs parse + resolve phases on worker threads for large repos
@@ -32,6 +39,11 @@ A static code analysis platform that builds a **Knowledge Graph** from your sour
32
39
  npm install -g @vohongtho.infotech/code-intel
33
40
  ```
34
41
 
42
+ > **Note:** You may see `npm warn ERESOLVE overriding peer dependency` warnings about `tree-sitter`. These are **harmless** — they relate to the native Node.js bindings which are not used. The CLI uses `web-tree-sitter` (WASM) exclusively. If you prefer a warning-free install, use:
43
+ > ```bash
44
+ > npm install -g @vohongtho.infotech/code-intel --legacy-peer-deps
45
+ > ```
46
+
35
47
  The `code-intel` binary is placed in your `$PATH` automatically (via the `bin` field in `package.json`).
36
48
 
37
49
  Verify:
@@ -57,6 +69,8 @@ npm run build
57
69
  | **Filters** | Toggle node/edge types, set focus depth |
58
70
  | **Files** | Recursive file tree with search filter and file icons |
59
71
  | **Graph Canvas** | Force-directed graph, click nodes to inspect, hover to highlight neighbors |
72
+ | **Source Preview** | Syntax-highlighted source code at the exact symbol line; resizable panel; "Open in editor" button |
73
+ | **Query Console** | GQL editor with keyword highlighting, run button (`Ctrl+Enter`), sortable results table, query history |
60
74
  | **Code AI** | Chat with grounded answers citing source file locations |
61
75
 
62
76
  ### Search Modes
@@ -106,6 +120,7 @@ code-intel-platform/
106
120
  | `resolve` | Resolve imports → edges, build call graph (O(log n) lookup), detect heritage (extends/implements) |
107
121
  | `cluster` | Directory-based community detection, add cluster nodes |
108
122
  | `flow` | Detect entry points, trace execution flows |
123
+ | `summarize` | _(opt-in)_ Generate 1–2 sentence AI summaries via OpenAI, Anthropic, or Ollama; skips unchanged nodes |
109
124
 
110
125
  Each phase reports live progress to the CLI via animated `█░` progress bars.
111
126
 
@@ -150,11 +165,22 @@ Sensitive data (passwords, tokens, API keys, emails, etc.) is automatically mask
150
165
  code-intel analyze [path] # Analyze and persist graph
151
166
  code-intel analyze --incremental # Re-parse only changed files (git diff / mtime)
152
167
  code-intel analyze --parallel # Use worker threads (faster on multi-core)
168
+ code-intel analyze --summarize # Generate AI summaries after analysis
153
169
  code-intel analyze --skills # Emit per-cluster SKILL.md files
154
170
  code-intel serve [path] -p 4747 # Analyze + start HTTP server
171
+ code-intel watch [path] -p 4747 # HTTP server + file watcher (auto-reindex on save)
155
172
  code-intel mcp [path] # Start MCP server (stdio)
156
173
  code-intel setup # Register MCP server in editor config (one-time)
157
- code-intel search <query> [path] # Text search
174
+ code-intel query "<gql>" # Run a GQL query (FIND / TRAVERSE / PATH / COUNT GROUP BY)
175
+ code-intel query "<gql>" --format table|json|csv
176
+ code-intel query --save <name> "<gql>" # Save a named query
177
+ code-intel query --run <name> # Run a saved query
178
+ code-intel query --list # List saved queries
179
+ code-intel health [path] # Code health: dead code, cycles, god nodes, orphans, score
180
+ code-intel health --dead-code # List dead-code symbols
181
+ code-intel health --cycles # List circular dependency cycles
182
+ code-intel health --json # Machine-readable output
183
+ code-intel search <query> # Text search
158
184
  code-intel inspect <symbol> # Inspect a symbol
159
185
  code-intel impact <symbol> # Blast radius analysis
160
186
  code-intel list # List indexed repos
@@ -168,15 +194,17 @@ code-intel clean [path] # Remove index data
168
194
 
169
195
  | Method | Endpoint | Description |
170
196
  |--------|----------|-------------|
171
- | `GET` | `/api/v1/health` | Server status + graph size |
197
+ | `GET` | `/api/v1/health` | Server status, graph size, watcher state |
172
198
  | `GET` | `/api/v1/repos` | List indexed repos |
173
199
  | `GET` | `/api/v1/graph/:repo` | Full graph (nodes + edges) |
174
- | `POST` | `/api/v1/search` | BM25 text search |
200
+ | `POST` | `/api/v1/search` | BM25 / hybrid text + vector search |
175
201
  | `POST` | `/api/v1/vector-search` | Semantic vector search |
176
202
  | `GET` | `/api/v1/vector-status` | Vector index ready/building status |
177
203
  | `GET` | `/api/v1/nodes/:id` | Node detail (callers, callees, imports, etc.) |
178
204
  | `POST` | `/api/v1/blast-radius` | Impact analysis |
179
- | `POST` | `/api/v1/cypher` | Cypher query (routed to LadybugDB) |
205
+ | `POST` | `/api/v1/query` | Execute GQL query; 408 on timeout with partial results |
206
+ | `POST` | `/api/v1/query/explain` | Return query plan without executing |
207
+ | `GET` | `/api/v1/source` | File content with ±20 lines context; path-traversal protected |
180
208
  | `POST` | `/api/v1/grep` | Regex search in file content |
181
209
  | `GET` | `/api/v1/flows` | List detected flows |
182
210
  | `GET` | `/api/v1/clusters` | List clusters |
@@ -190,7 +218,7 @@ code-intel clean [path] # Remove index data
190
218
  |------|-------------|
191
219
  | `repos` | List all indexed repositories |
192
220
  | `overview` | Repository summary: total nodes/edges + full breakdown by kind |
193
- | `search` | BM25 keyword search across all symbols |
221
+ | `search` | BM25 / hybrid keyword + semantic search across all symbols |
194
222
  | `inspect` | 360° view of a symbol: definition, callers, callees, imports, heritage, members, cluster |
195
223
  | `blast_radius` | Impact analysis: traverse call/import graph to find all affected symbols |
196
224
  | `file_symbols` | List all symbols defined in a file, ordered by line number |
@@ -199,8 +227,9 @@ code-intel clean [path] # Remove index data
199
227
  | `routes` | List all HTTP route handler mappings detected in the codebase |
200
228
  | `clusters` | List detected code clusters with member counts and top symbols |
201
229
  | `flows` | List detected execution flows with entry points and steps |
230
+ | `query` | Execute a GQL query (`FIND`, `TRAVERSE`, `PATH`, `COUNT GROUP BY`); returns nodes/edges/groups + executionTimeMs |
202
231
  | `detect_changes` | Git-diff impact analysis: maps changed lines to graph symbols |
203
- | `raw_query` | Execute a simplified Cypher-like graph query |
232
+ | `raw_query` | _(deprecated use `query`)_ Simplified Cypher-like graph query |
204
233
  | `group_list` | List all configured repository groups |
205
234
  | `group_sync` | Extract contracts and detect cross-repo provider→consumer links |
206
235
  | `group_contracts` | Inspect extracted contracts and confidence-ranked cross-repo links |