@magic5644/graph-it-live 1.9.8 → 1.10.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/docs/CLI.md CHANGED
@@ -18,6 +18,7 @@ The `graph-it` CLI gives you full access to the dependency analysis engine of Gr
18
18
  - [path](#path)
19
19
  - [check](#check)
20
20
  - [trace](#trace)
21
+ - [query](#query)
21
22
  - [tool](#tool)
22
23
  - [serve](#serve)
23
24
  - [install](#install)
@@ -128,13 +129,13 @@ All analysis commands support multiple output formats via `--format`:
128
129
 
129
130
  **Format availability per command:**
130
131
 
131
- | Format | scan | summary | explain | path | check | trace | tool |
132
- |--------|:----:|:-------:|:-------:|:----:|:-----:|:-----:|:----:|
133
- | `text` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
134
- | `json` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
135
- | `toon` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
136
- | `markdown` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
137
- | `mermaid` | — | — | — | ✓ | — | ✓ | — |
132
+ | Format | scan | summary | explain | path | check | trace | query | tool |
133
+ |--------|:----:|:-------:|:-------:|:----:|:-----:|:-----:|:-----:|:----:|
134
+ | `text` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
135
+ | `json` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
136
+ | `toon` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
137
+ | `markdown` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | ✓ |
138
+ | `mermaid` | — | — | — | ✓ | — | ✓ | — | — |
138
139
 
139
140
  **Examples:**
140
141
 
@@ -167,6 +168,8 @@ graph-it [options]
167
168
 
168
169
  | Command | Description |
169
170
  |--------|-------------|
171
+ | `/query` | Query the codebase with natural language (no quotes needed for multi-word questions) |
172
+ | `/wiki` | Generate a navigable markdown wiki from the call graph |
170
173
  | `/trace` | Run trace flow for a selected file and optional symbol |
171
174
  | `/path` | Set session workspace scope (directory) |
172
175
  | `/file` | Set active file context for context-aware commands |
@@ -609,9 +612,106 @@ graph-it trace src/mcp/mcpServer.ts#initializeServer --format json
609
612
 
610
613
  ---
611
614
 
615
+ ### query
616
+
617
+ Answer a natural language question about the codebase using the call graph. When an LLM API key is configured the answer is synthesised by the model; otherwise a heuristic fallback is used and a warning is printed to stderr.
618
+
619
+ ```
620
+ graph-it query "<question>" [options]
621
+ ```
622
+
623
+ **Arguments:**
624
+
625
+ | Argument | Description |
626
+ |----------|-------------|
627
+ | `<question>` | Natural language question about the codebase (max 1024 characters) |
628
+
629
+ **Options:**
630
+
631
+ | Option | Default | Description |
632
+ |--------|---------|-------------|
633
+ | `--workspace, -w` | auto-detected | Project root |
634
+ | `--depth <N>` | `2` | BFS depth for call graph traversal (1–5) |
635
+ | `--token-budget <N>` | `4000` | Max tokens for the subgraph context (500–16000) |
636
+ | `--format <fmt>` | `text` | Output format: `text`, `json`, `toon` |
637
+
638
+ **LLM configuration (environment variables):**
639
+
640
+ | Variable | Description |
641
+ |----------|-------------|
642
+ | `ANTHROPIC_API_KEY` | Use Anthropic (`claude-haiku-4-5`) |
643
+ | `OPENAI_API_KEY` | Use OpenAI-compatible provider |
644
+ | `OPENAI_BASE_URL` | Base URL for OpenAI-compatible endpoint |
645
+ | `OPENAI_MODEL` | Model name for OpenAI-compatible provider |
646
+
647
+ When neither key is set, the command falls back to a heuristic analysis and prints a notice to stderr.
648
+
649
+ **Examples:**
650
+
651
+ ```bash
652
+ graph-it query "how does Spider crawl files"
653
+ graph-it query "how does Spider crawl files" --format text
654
+ graph-it query "what calls CallGraphIndexer" --depth 3
655
+ graph-it query "explain the MCP server architecture" --token-budget 8000
656
+ graph-it query "what is the entry point for the CLI" --format json
657
+ ```
658
+
659
+ > **Breaking change:** `CallGraphIndexer` SCHEMA_VERSION was bumped from 2 to 3 alongside this feature. The index is automatically rebuilt on first use after upgrading.
660
+
661
+ ---
662
+
663
+ ### wiki
664
+
665
+ Generate a navigable markdown wiki from the call graph. Creates one article per source file with hub scores, symbol lists, caller/callee cross-links, and a grouped index — all with relative links only (portable, can be committed to the repo).
666
+
667
+ ```
668
+ graph-it wiki [options]
669
+ ```
670
+
671
+ **Options:**
672
+
673
+ | Option | Default | Description |
674
+ |--------|---------|-------------|
675
+ | `--output <dir>` | `wiki` | Output directory (relative to workspace root, or absolute) |
676
+ | `--top <N>` | `10` | Number of top hub files to list in the index (1–50) |
677
+ | `--format <fmt>` | `markdown` | Output summary format: `markdown`, `json`, `toon` |
678
+ | `--workspace, -w` | auto-detected | Project root |
679
+
680
+ **Examples:**
681
+
682
+ ```bash
683
+ graph-it wiki # write to ./wiki/
684
+ graph-it wiki --output docs/wiki # write to ./docs/wiki/
685
+ graph-it wiki --top 20 --format json # JSON summary, top 20 hubs
686
+ graph-it wiki --output /tmp/preview # absolute output path
687
+ ```
688
+
689
+ **Output structure:**
690
+
691
+ ```
692
+ wiki/
693
+ index.md # Grouped file index with hub scores
694
+ articles/
695
+ src_foo.ts.md # One article per source file
696
+ src_bar.ts.md
697
+ ...
698
+ ```
699
+
700
+ Each article contains:
701
+ - Hub score (0–100, higher = more depended-upon)
702
+ - Symbols (functions, classes, interfaces, types)
703
+ - Called by (callers from other files)
704
+ - Calls (callees in other files)
705
+ - All internal links are **relative** — safe to commit and view on any OS
706
+
707
+ > **REPL equivalent:** Use `/wiki` inside `graph-it` interactive mode.
708
+ > **MCP equivalent:** `graphitlive_generate_wiki` tool.
709
+
710
+ ---
711
+
612
712
  ### tool
613
713
 
614
- Invoke any of the 21 MCP analysis tools directly from the terminal — full MCP parity without a running server.
714
+ Invoke any of the 22 MCP analysis tools directly from the terminal — full MCP parity without a running server.
615
715
 
616
716
  ```
617
717
  graph-it tool <name> [--<param>=<value>...] [options]
@@ -624,7 +724,7 @@ graph-it tool --args '<json>' <name>
624
724
  | Argument | Description |
625
725
  |----------|-------------|
626
726
  | `<name>` | MCP tool name (see `--list`) |
627
- | `--list` | Print all 21 available tools with one-line descriptions |
727
+ | `--list` | Print all 22 available tools with one-line descriptions |
628
728
 
629
729
  **Options:**
630
730
 
@@ -666,6 +766,8 @@ Available MCP tools:
666
766
  generate_codemap AI-friendly structural overview of a file (TOON)
667
767
  query_call_graph BFS callers/callees via the SQLite call graph index
668
768
  scan_dead_code Workspace-wide scan for unused exported symbols
769
+ query_natural_language Answer a natural language question about the codebase (LLM or heuristic)
770
+ generate_wiki Generate a navigable markdown wiki from the call graph
669
771
  ```
670
772
 
671
773
  **Calling a tool with parameters:**
@@ -1103,6 +1205,54 @@ graph-it tool scan_dead_code --scopePath=/abs/path/to/src/utils/
1103
1205
 
1104
1206
  ---
1105
1207
 
1208
+ #### `query_natural_language`
1209
+
1210
+ **What it returns:** A natural language answer to a question about the codebase, grounded in a call graph subgraph. When an LLM key is configured the model synthesises the answer; otherwise a heuristic summary is returned.
1211
+
1212
+ **Parameters:**
1213
+
1214
+ | Parameter | Type | Default | Description |
1215
+ |-----------|------|---------|-------------|
1216
+ | `question` | string | — | Natural language question (max 1024 characters) |
1217
+ | `depth` | number | `2` | BFS depth for call graph traversal (1–5) |
1218
+ | `tokenBudget` | number | `4000` | Max tokens for subgraph context (500–16000) |
1219
+ | `fileFilter` | string | — | Glob pattern to restrict which files are included |
1220
+ | `outputFormat` | string | `toon` | Subgraph format passed to the LLM: `toon` or `json` |
1221
+
1222
+ ```bash
1223
+ graph-it tool query_natural_language --question="how does Spider crawl files"
1224
+ graph-it tool query_natural_language --question="what calls CallGraphIndexer" --depth=3
1225
+ graph-it tool query_natural_language --question="explain the MCP server" --tokenBudget=8000
1226
+ ```
1227
+
1228
+ **LLM configuration:**
1229
+ - `ANTHROPIC_API_KEY` → uses `claude-haiku-4-5`
1230
+ - `OPENAI_API_KEY` + `OPENAI_BASE_URL` + `OPENAI_MODEL` → uses OpenAI-compatible provider
1231
+ - No key set → heuristic fallback (warning printed to stderr)
1232
+
1233
+ > **Note:** The LLM calling this tool performs the synthesis — the tool returns a structured subgraph that the model interprets.
1234
+
1235
+ ---
1236
+
1237
+ #### `generate_wiki`
1238
+
1239
+ Generate a navigable markdown wiki from the call graph. One article per source file, hub scores, symbol lists, caller/callee cross-links, and a grouped index — all with relative links only.
1240
+
1241
+ | Parameter | Type | Default | Description |
1242
+ |-----------|------|---------|-------------|
1243
+ | `workspaceRoot` | string | configured workspace | Absolute path to workspace root |
1244
+ | `outputDir` | string | `wiki` | Output directory for wiki files |
1245
+ | `topHubsLimit` | number | `10` | Number of top hub files to list (1–50) |
1246
+ | `response_format` | string | `json` | Output summary format: `json`, `markdown`, or `toon` |
1247
+
1248
+ ```bash
1249
+ graph-it tool generate_wiki
1250
+ graph-it tool generate_wiki --outputDir=docs/wiki
1251
+ graph-it tool generate_wiki --topHubsLimit=20 --response_format=toon
1252
+ ```
1253
+
1254
+ ---
1255
+
1106
1256
  ## Advanced Analysis Workflows
1107
1257
 
1108
1258
  ### Pre-Refactor Safety Check
@@ -1233,12 +1383,12 @@ graph-it tool verify_dependency_usage \
1233
1383
 
1234
1384
  ## Tool Count: CLI vs MCP
1235
1385
 
1236
- The CLI exposes **21 tools** via `graph-it tool --list`, while the MCP server provides **22 tools** in total. This is by design:
1386
+ The CLI exposes **22 tools** via `graph-it tool --list`, while the MCP server provides **23 tools** in total. This is by design:
1237
1387
 
1238
1388
  | Context | Tool count | Notes |
1239
1389
  |---------|-----------|-------|
1240
- | `graph-it tool --list` | 21 | All analysis tools |
1241
- | MCP server (`graph-it serve`) | 22 | Same 21 + `set_workspace` |
1390
+ | `graph-it tool --list` | 22 | All analysis tools |
1391
+ | MCP server (`graph-it serve`) | 23 | Same 22 + `set_workspace` |
1242
1392
 
1243
1393
  The extra tool, `set_workspace`, is a **server management tool** — it tells a running MCP server instance which directory to analyze. In CLI context this is handled by the `--workspace` flag (or auto-detection from `cwd`), so it is intentionally excluded from the CLI tool list.
1244
1394
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@magic5644/graph-it-live",
3
3
  "displayName": "Graph-It-Live",
4
4
  "description": "AI-first dependency graph & code intelligence for VS Code. Visualize file imports, symbol call hierarchies, and cross-file call graphs. Detect circular dependencies, dead code, and breaking changes. Built-in MCP Server with 21 tools for GitHub Copilot, Cursor, Claude, Windsurf, and Antigravity. Generate AI-friendly codemaps. TypeScript, JavaScript, C#, Go, Java, Python, Rust, Vue, Svelte, GraphQL.",
5
- "version": "1.9.8",
5
+ "version": "1.10.0",
6
6
  "publisher": "magic5644",
7
7
  "author": {
8
8
  "name": "magic56"
@@ -1155,10 +1155,10 @@
1155
1155
  "eslint": "^10.5.0",
1156
1156
  "fast-check": "^4.8.0",
1157
1157
  "glob": "^13.0.6",
1158
- "globals": "^17.6.0",
1158
+ "globals": "^17.7.0",
1159
1159
  "mocha": "^11.7.6",
1160
1160
  "typescript": "^6.0.3",
1161
- "typescript-eslint": "^8.61.1",
1161
+ "typescript-eslint": "^8.62.0",
1162
1162
  "vitest": "^4.1.9"
1163
1163
  },
1164
1164
  "overrides": {