@vohongtho.infotech/code-intel 0.4.0 → 0.6.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.6.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,19 @@ 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
20
- - **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
24
+ - **HTTP API** — REST endpoints for graph, search, inspect, blast radius, flows, query, source, health
25
+ - **MCP Server** — Model Context Protocol integration for LLM tooling with 6 new reasoning tools (`explain_relationship`, `pr_impact`, `similar_symbols`, `health_report`, `suggest_tests`, `cluster_summary`), pagination, and tool-chaining hints
26
+ - **Security Module** — `SecretScanner` for hardcoded secrets detection; `VulnerabilityDetector` for SQL injection, XSS, SSRF, path traversal, and command injection (CWE-tagged)
27
+ - **CLI** — analyze, serve, watch, query, search, inspect, impact, health commands with animated progress bars and spinners
22
28
  - **Multi-language** — TypeScript, JavaScript, Python, Java, Go, C, C++, C#, Rust, PHP, Ruby, Swift, Kotlin, Dart (14 languages via tree-sitter AST)
23
29
  - **Incremental Analysis** — `--incremental` re-parses only changed files; 10k-file repo / 3 changes: 288ms
24
30
  - **Parallel Analysis** — `--parallel` runs parse + resolve phases on worker threads for large repos
@@ -64,6 +70,8 @@ npm run build
64
70
  | **Filters** | Toggle node/edge types, set focus depth |
65
71
  | **Files** | Recursive file tree with search filter and file icons |
66
72
  | **Graph Canvas** | Force-directed graph, click nodes to inspect, hover to highlight neighbors |
73
+ | **Source Preview** | Syntax-highlighted source code at the exact symbol line; resizable panel; "Open in editor" button |
74
+ | **Query Console** | GQL editor with keyword highlighting, run button (`Ctrl+Enter`), sortable results table, query history |
67
75
  | **Code AI** | Chat with grounded answers citing source file locations |
68
76
 
69
77
  ### Search Modes
@@ -113,6 +121,7 @@ code-intel-platform/
113
121
  | `resolve` | Resolve imports → edges, build call graph (O(log n) lookup), detect heritage (extends/implements) |
114
122
  | `cluster` | Directory-based community detection, add cluster nodes |
115
123
  | `flow` | Detect entry points, trace execution flows |
124
+ | `summarize` | _(opt-in)_ Generate 1–2 sentence AI summaries via OpenAI, Anthropic, or Ollama; skips unchanged nodes |
116
125
 
117
126
  Each phase reports live progress to the CLI via animated `█░` progress bars.
118
127
 
@@ -157,11 +166,22 @@ Sensitive data (passwords, tokens, API keys, emails, etc.) is automatically mask
157
166
  code-intel analyze [path] # Analyze and persist graph
158
167
  code-intel analyze --incremental # Re-parse only changed files (git diff / mtime)
159
168
  code-intel analyze --parallel # Use worker threads (faster on multi-core)
169
+ code-intel analyze --summarize # Generate AI summaries after analysis
160
170
  code-intel analyze --skills # Emit per-cluster SKILL.md files
161
171
  code-intel serve [path] -p 4747 # Analyze + start HTTP server
172
+ code-intel watch [path] -p 4747 # HTTP server + file watcher (auto-reindex on save)
162
173
  code-intel mcp [path] # Start MCP server (stdio)
163
174
  code-intel setup # Register MCP server in editor config (one-time)
164
- code-intel search <query> [path] # Text search
175
+ code-intel query "<gql>" # Run a GQL query (FIND / TRAVERSE / PATH / COUNT GROUP BY)
176
+ code-intel query "<gql>" --format table|json|csv
177
+ code-intel query --save <name> "<gql>" # Save a named query
178
+ code-intel query --run <name> # Run a saved query
179
+ code-intel query --list # List saved queries
180
+ code-intel health [path] # Code health: dead code, cycles, god nodes, orphans, score
181
+ code-intel health --dead-code # List dead-code symbols
182
+ code-intel health --cycles # List circular dependency cycles
183
+ code-intel health --json # Machine-readable output
184
+ code-intel search <query> # Text search
165
185
  code-intel inspect <symbol> # Inspect a symbol
166
186
  code-intel impact <symbol> # Blast radius analysis
167
187
  code-intel list # List indexed repos
@@ -175,15 +195,17 @@ code-intel clean [path] # Remove index data
175
195
 
176
196
  | Method | Endpoint | Description |
177
197
  |--------|----------|-------------|
178
- | `GET` | `/api/v1/health` | Server status + graph size |
198
+ | `GET` | `/api/v1/health` | Server status, graph size, watcher state |
179
199
  | `GET` | `/api/v1/repos` | List indexed repos |
180
200
  | `GET` | `/api/v1/graph/:repo` | Full graph (nodes + edges) |
181
- | `POST` | `/api/v1/search` | BM25 text search |
201
+ | `POST` | `/api/v1/search` | BM25 / hybrid text + vector search |
182
202
  | `POST` | `/api/v1/vector-search` | Semantic vector search |
183
203
  | `GET` | `/api/v1/vector-status` | Vector index ready/building status |
184
204
  | `GET` | `/api/v1/nodes/:id` | Node detail (callers, callees, imports, etc.) |
185
205
  | `POST` | `/api/v1/blast-radius` | Impact analysis |
186
- | `POST` | `/api/v1/cypher` | Cypher query (routed to LadybugDB) |
206
+ | `POST` | `/api/v1/query` | Execute GQL query; 408 on timeout with partial results |
207
+ | `POST` | `/api/v1/query/explain` | Return query plan without executing |
208
+ | `GET` | `/api/v1/source` | File content with ±20 lines context; path-traversal protected |
187
209
  | `POST` | `/api/v1/grep` | Regex search in file content |
188
210
  | `GET` | `/api/v1/flows` | List detected flows |
189
211
  | `GET` | `/api/v1/clusters` | List clusters |
@@ -197,7 +219,7 @@ code-intel clean [path] # Remove index data
197
219
  |------|-------------|
198
220
  | `repos` | List all indexed repositories |
199
221
  | `overview` | Repository summary: total nodes/edges + full breakdown by kind |
200
- | `search` | BM25 keyword search across all symbols |
222
+ | `search` | BM25 / hybrid keyword + semantic search across all symbols |
201
223
  | `inspect` | 360° view of a symbol: definition, callers, callees, imports, heritage, members, cluster |
202
224
  | `blast_radius` | Impact analysis: traverse call/import graph to find all affected symbols |
203
225
  | `file_symbols` | List all symbols defined in a file, ordered by line number |
@@ -206,8 +228,9 @@ code-intel clean [path] # Remove index data
206
228
  | `routes` | List all HTTP route handler mappings detected in the codebase |
207
229
  | `clusters` | List detected code clusters with member counts and top symbols |
208
230
  | `flows` | List detected execution flows with entry points and steps |
231
+ | `query` | Execute a GQL query (`FIND`, `TRAVERSE`, `PATH`, `COUNT GROUP BY`); returns nodes/edges/groups + executionTimeMs |
209
232
  | `detect_changes` | Git-diff impact analysis: maps changed lines to graph symbols |
210
- | `raw_query` | Execute a simplified Cypher-like graph query |
233
+ | `raw_query` | _(deprecated use `query`)_ Simplified Cypher-like graph query |
211
234
  | `group_list` | List all configured repository groups |
212
235
  | `group_sync` | Extract contracts and detect cross-repo provider→consumer links |
213
236
  | `group_contracts` | Inspect extracted contracts and confidence-ranked cross-repo links |