@vohongtho.infotech/code-intel 0.4.0 → 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,15 +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
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
13
18
  - **AI-Generated Symbol Summaries** — optional `--summarize` flag generates 1-2 sentence summaries per symbol via OpenAI, Anthropic, or Ollama; cached by code hash
14
19
  - **Hybrid Search (BM25 + Vector RRF)** — Reciprocal Rank Fusion of keyword + semantic search; `searchMode: 'bm25' | 'vector' | 'hybrid'` in response
15
20
  - **Semantic Vector Search** — embeddings via `all-MiniLM-L6-v2`; enriched with summaries when available
16
21
  - **Code AI Chat** — grounded assistant that cites source files in every answer
17
22
  - **File Watcher & Auto-Reindex** — `code-intel watch` detects file saves and patches the live graph within ~1 second; WebSocket push notifies connected clients
18
23
  - **Code Health** — `code-intel health` reports dead code, circular dependencies (Tarjan SCC), god nodes, orphan files, and a 0–100 health score
19
- - **HTTP API** — REST endpoints for graph, search, inspect, blast radius, flows, health
24
+ - **HTTP API** — REST endpoints for graph, search, inspect, blast radius, flows, query, source, health
20
25
  - **MCP Server** — Model Context Protocol integration for LLM tooling
21
- - **CLI** — analyze, serve, watch, search, inspect, impact, health commands with animated progress bars and spinners
26
+ - **CLI** — analyze, serve, watch, query, search, inspect, impact, health commands with animated progress bars and spinners
22
27
  - **Multi-language** — TypeScript, JavaScript, Python, Java, Go, C, C++, C#, Rust, PHP, Ruby, Swift, Kotlin, Dart (14 languages via tree-sitter AST)
23
28
  - **Incremental Analysis** — `--incremental` re-parses only changed files; 10k-file repo / 3 changes: 288ms
24
29
  - **Parallel Analysis** — `--parallel` runs parse + resolve phases on worker threads for large repos
@@ -64,6 +69,8 @@ npm run build
64
69
  | **Filters** | Toggle node/edge types, set focus depth |
65
70
  | **Files** | Recursive file tree with search filter and file icons |
66
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 |
67
74
  | **Code AI** | Chat with grounded answers citing source file locations |
68
75
 
69
76
  ### Search Modes
@@ -113,6 +120,7 @@ code-intel-platform/
113
120
  | `resolve` | Resolve imports → edges, build call graph (O(log n) lookup), detect heritage (extends/implements) |
114
121
  | `cluster` | Directory-based community detection, add cluster nodes |
115
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 |
116
124
 
117
125
  Each phase reports live progress to the CLI via animated `█░` progress bars.
118
126
 
@@ -157,11 +165,22 @@ Sensitive data (passwords, tokens, API keys, emails, etc.) is automatically mask
157
165
  code-intel analyze [path] # Analyze and persist graph
158
166
  code-intel analyze --incremental # Re-parse only changed files (git diff / mtime)
159
167
  code-intel analyze --parallel # Use worker threads (faster on multi-core)
168
+ code-intel analyze --summarize # Generate AI summaries after analysis
160
169
  code-intel analyze --skills # Emit per-cluster SKILL.md files
161
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)
162
172
  code-intel mcp [path] # Start MCP server (stdio)
163
173
  code-intel setup # Register MCP server in editor config (one-time)
164
- 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
165
184
  code-intel inspect <symbol> # Inspect a symbol
166
185
  code-intel impact <symbol> # Blast radius analysis
167
186
  code-intel list # List indexed repos
@@ -175,15 +194,17 @@ code-intel clean [path] # Remove index data
175
194
 
176
195
  | Method | Endpoint | Description |
177
196
  |--------|----------|-------------|
178
- | `GET` | `/api/v1/health` | Server status + graph size |
197
+ | `GET` | `/api/v1/health` | Server status, graph size, watcher state |
179
198
  | `GET` | `/api/v1/repos` | List indexed repos |
180
199
  | `GET` | `/api/v1/graph/:repo` | Full graph (nodes + edges) |
181
- | `POST` | `/api/v1/search` | BM25 text search |
200
+ | `POST` | `/api/v1/search` | BM25 / hybrid text + vector search |
182
201
  | `POST` | `/api/v1/vector-search` | Semantic vector search |
183
202
  | `GET` | `/api/v1/vector-status` | Vector index ready/building status |
184
203
  | `GET` | `/api/v1/nodes/:id` | Node detail (callers, callees, imports, etc.) |
185
204
  | `POST` | `/api/v1/blast-radius` | Impact analysis |
186
- | `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 |
187
208
  | `POST` | `/api/v1/grep` | Regex search in file content |
188
209
  | `GET` | `/api/v1/flows` | List detected flows |
189
210
  | `GET` | `/api/v1/clusters` | List clusters |
@@ -197,7 +218,7 @@ code-intel clean [path] # Remove index data
197
218
  |------|-------------|
198
219
  | `repos` | List all indexed repositories |
199
220
  | `overview` | Repository summary: total nodes/edges + full breakdown by kind |
200
- | `search` | BM25 keyword search across all symbols |
221
+ | `search` | BM25 / hybrid keyword + semantic search across all symbols |
201
222
  | `inspect` | 360° view of a symbol: definition, callers, callees, imports, heritage, members, cluster |
202
223
  | `blast_radius` | Impact analysis: traverse call/import graph to find all affected symbols |
203
224
  | `file_symbols` | List all symbols defined in a file, ordered by line number |
@@ -206,8 +227,9 @@ code-intel clean [path] # Remove index data
206
227
  | `routes` | List all HTTP route handler mappings detected in the codebase |
207
228
  | `clusters` | List detected code clusters with member counts and top symbols |
208
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 |
209
231
  | `detect_changes` | Git-diff impact analysis: maps changed lines to graph symbols |
210
- | `raw_query` | Execute a simplified Cypher-like graph query |
232
+ | `raw_query` | _(deprecated use `query`)_ Simplified Cypher-like graph query |
211
233
  | `group_list` | List all configured repository groups |
212
234
  | `group_sync` | Extract contracts and detect cross-repo provider→consumer links |
213
235
  | `group_contracts` | Inspect extracted contracts and confidence-ranked cross-repo links |