codegraph-cli 2.1.2__tar.gz → 2.1.4__tar.gz

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.
Files changed (68) hide show
  1. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/PKG-INFO +119 -63
  2. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/README.md +118 -62
  3. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/__init__.py +1 -1
  4. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_explore.py +16 -10
  5. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/crew_agents.py +4 -4
  6. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/crew_chat.py +14 -4
  7. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/crew_tools.py +10 -3
  8. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/security_scanner.py +39 -1
  9. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/vector_store.py +17 -15
  10. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli.egg-info/PKG-INFO +119 -63
  11. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/pyproject.toml +1 -1
  12. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/tests/test_agents.py +20 -5
  13. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/tests/test_cli.py +1 -1
  14. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/LICENSE +0 -0
  15. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/agents.py +0 -0
  16. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/bug_detector.py +0 -0
  17. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/chat_agent.py +0 -0
  18. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/chat_session.py +0 -0
  19. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli.py +0 -0
  20. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_chat.py +0 -0
  21. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_diagnose.py +0 -0
  22. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_docs.py +0 -0
  23. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_export.py +0 -0
  24. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_groups.py +0 -0
  25. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_health.py +0 -0
  26. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_history.py +0 -0
  27. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_onboard.py +0 -0
  28. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_quickstart.py +0 -0
  29. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_refactor.py +0 -0
  30. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_setup.py +0 -0
  31. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_suggestions.py +0 -0
  32. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_test.py +0 -0
  33. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_tui.py +0 -0
  34. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_v2.py +0 -0
  35. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_watch.py +0 -0
  36. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/cli_workflows.py +0 -0
  37. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/codegen_agent.py +0 -0
  38. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/config.py +0 -0
  39. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/config_manager.py +0 -0
  40. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/context_manager.py +0 -0
  41. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/diff_engine.py +0 -0
  42. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/embeddings.py +0 -0
  43. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/graph_export.py +0 -0
  44. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/llm.py +0 -0
  45. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/models.py +0 -0
  46. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/models_v2.py +0 -0
  47. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/orchestrator.py +0 -0
  48. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/parser.py +0 -0
  49. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/performance_analyzer.py +0 -0
  50. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/project_context.py +0 -0
  51. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/rag.py +0 -0
  52. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/refactor_agent.py +0 -0
  53. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/storage.py +0 -0
  54. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/templates/graph_interactive.html +0 -0
  55. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/testgen_agent.py +0 -0
  56. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli/validation_engine.py +0 -0
  57. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli.egg-info/SOURCES.txt +0 -0
  58. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli.egg-info/dependency_links.txt +0 -0
  59. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli.egg-info/entry_points.txt +0 -0
  60. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli.egg-info/requires.txt +0 -0
  61. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/codegraph_cli.egg-info/top_level.txt +0 -0
  62. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/setup.cfg +0 -0
  63. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/tests/test_bug_detector.py +0 -0
  64. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/tests/test_cli_workflows.py +0 -0
  65. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/tests/test_parser.py +0 -0
  66. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/tests/test_security_scanner.py +0 -0
  67. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/tests/test_storage.py +0 -0
  68. {codegraph_cli-2.1.2 → codegraph_cli-2.1.4}/tests/test_vector_store.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codegraph-cli
3
- Version: 2.1.2
3
+ Version: 2.1.4
4
4
  Summary: AI-powered code intelligence CLI with multi-agent analysis, impact graphs, and conversational coding.
5
5
  Author-email: Ali Nasir <muhammadalinasir00786@gmail.com>
6
6
  License: MIT
@@ -69,7 +69,7 @@ Dynamic: license-file
69
69
 
70
70
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
71
71
  [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org)
72
- [![Version](https://img.shields.io/badge/version-2.1.1-blue.svg)](https://github.com/al1-nasir/codegraph-cli)
72
+ [![Version](https://img.shields.io/badge/version-2.1.2-blue.svg)](https://github.com/al1-nasir/codegraph-cli)
73
73
  [![CI](https://github.com/al1-nasir/codegraph-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/al1-nasir/codegraph-cli/actions/workflows/ci.yml)
74
74
 
75
75
  ---
@@ -83,8 +83,11 @@ Core capabilities:
83
83
  - **Semantic Search** — find code by meaning, not string matching
84
84
  - **Impact Analysis** — trace multi-hop dependencies before making changes
85
85
  - **Graph Visualization** — interactive HTML and Graphviz DOT exports
86
+ - **Browser-Based Explorer** — visual code navigation with Mermaid diagrams and AI explanations
86
87
  - **Conversational Chat** — natural language coding sessions with RAG context
87
88
  - **Multi-Agent System** — CrewAI-powered agents for code generation, refactoring, and analysis
89
+ - **DOCX Export** — generate professional project documentation with architecture diagrams
90
+ - **Auto Onboarding** — AI-generated README from your code graph
88
91
  - **File Rollback** — automatic backups before every file modification
89
92
 
90
93
  ---
@@ -142,7 +145,7 @@ cg config set-llm ollama
142
145
  ### 2. Index a project
143
146
 
144
147
  ```bash
145
- cg index /path/to/project --name myproject
148
+ cg project index /path/to/project --name myproject
146
149
  ```
147
150
 
148
151
  This parses the source tree using tree-sitter, builds a dependency graph in SQLite, and generates embeddings for semantic search.
@@ -150,11 +153,14 @@ This parses the source tree using tree-sitter, builds a dependency graph in SQLi
150
153
  ### 3. Use it
151
154
 
152
155
  ```bash
153
- cg search "authentication logic"
154
- cg impact UserService --hops 3
155
- cg graph process_payment --depth 2
156
+ cg analyze search "authentication logic"
157
+ cg analyze impact UserService --hops 3
158
+ cg analyze graph process_payment --depth 2
156
159
  cg chat start
157
- cg chat start --crew # multi-agent mode
160
+ cg chat start --crew # multi-agent mode
161
+ cg explore open # browser-based code explorer
162
+ cg onboard # auto-generate project README
163
+ cg export docx # export documentation to DOCX
158
164
  ```
159
165
 
160
166
  ---
@@ -209,44 +215,68 @@ cg index /path/to/project
209
215
 
210
216
  ## Commands
211
217
 
212
- ### Project Management
218
+ CodeGraph CLI organizes commands into logical groups:
219
+
220
+ ```
221
+ cg config — LLM, embedding, and setup configuration
222
+ cg project — Index, load, and manage project memories
223
+ cg analyze — Search, impact, graph, and RAG context
224
+ cg chat — Interactive chat with AI agents
225
+ cg explore — Visual code explorer in browser
226
+ cg export — Export project documentation
227
+ cg onboard — Auto-generate project README
228
+ ```
229
+
230
+ ### Configuration (`cg config`)
213
231
 
214
232
  ```bash
215
- cg index <path> [--name NAME] # parse and index a codebase
216
- cg list-projects # list all indexed projects
217
- cg load-project <name> # switch active project
218
- cg current-project # print active project name
219
- cg delete-project <name> # remove a project index
220
- cg merge-projects <src> <dst> # merge two project graphs
221
- cg unload-project # unload without deleting
233
+ cg config setup # interactive LLM setup wizard
234
+ cg config set-llm openrouter # switch LLM provider
235
+ cg config unset-llm # reset LLM config to defaults
236
+ cg config show-llm # show current LLM settings
237
+ cg config set-embedding jina-code # switch embedding model
238
+ cg config unset-embedding # reset to hash default
239
+ cg config show-embedding # show current embedding model
222
240
  ```
223
241
 
224
- ### Search and Analysis
242
+ ### Project Management (`cg project`)
225
243
 
226
244
  ```bash
227
- cg search <query> [--top-k N] # semantic search across the graph
228
- cg impact <symbol> [--hops N] # multi-hop dependency impact analysis
229
- cg graph <symbol> [--depth N] # ASCII dependency graph
230
- cg rag-context <query> [--top-k N] # raw RAG retrieval for debugging
245
+ cg project index <path> [--name NAME] # parse and index a codebase
246
+ cg project list # list all indexed projects
247
+ cg project load <name> # switch active project
248
+ cg project current # print active project name
249
+ cg project delete <name> # remove a project index
250
+ cg project merge <src> <dst> # merge two project graphs
251
+ cg project unload # unload without deleting
252
+ cg project init # quickstart wizard
253
+ cg project watch # auto-reindex on file changes
231
254
  ```
232
255
 
233
- ### Graph Export
256
+ ### Code Analysis (`cg analyze`)
234
257
 
235
258
  ```bash
236
- cg export-graph --format html # interactive vis.js visualization
237
- cg export-graph --format dot # Graphviz DOT format
238
- cg export-graph MyClass -f html -o out.html # focused subgraph
259
+ cg analyze search <query> [--top-k N] # semantic search across the graph
260
+ cg analyze impact <symbol> [--hops N] # multi-hop dependency impact analysis
261
+ cg analyze graph <symbol> [--depth N] # ASCII dependency graph
262
+ cg analyze export-graph --format html # interactive vis.js visualization
263
+ cg analyze export-graph --format dot # Graphviz DOT format
264
+ cg analyze rag-context <query> # raw RAG retrieval for debugging
265
+ cg analyze tree [--full] # directory tree of indexed project
266
+ cg analyze sync [--dry-run] # incremental index sync
267
+ cg analyze health # project health dashboard
239
268
  ```
240
269
 
241
- ### Interactive Chat
270
+ ### Interactive Chat (`cg chat`)
242
271
 
243
272
  ```bash
244
- cg chat start # start or resume a session
245
- cg chat start --new # force a new session
246
- cg chat start --crew # multi-agent mode (CrewAI)
247
- cg chat start -s <id> # resume a specific session
248
- cg chat list # list all sessions
249
- cg chat delete <id> # delete a session
273
+ cg chat start # start or resume a session
274
+ cg chat start --new # force a new session
275
+ cg chat start --crew # multi-agent mode (CrewAI)
276
+ cg chat start -s <id> # resume a specific session
277
+ cg chat list # list all sessions
278
+ cg chat delete <id> # delete a session
279
+ cg chat export <id> --format markdown # export session to file
250
280
  ```
251
281
 
252
282
  In-chat commands:
@@ -263,18 +293,31 @@ In-chat commands:
263
293
  | `/rollback <file>` | Crew | Restore a file from backup |
264
294
  | `/undo <file>` | Crew | Alias for rollback |
265
295
 
266
- ### Code Generation (v2)
296
+ ### Visual Explorer (`cg explore`)
297
+
298
+ ```bash
299
+ cg explore open # launch browser-based code explorer
300
+ cg explore open --port 9000 # use custom port
301
+ ```
302
+
303
+ Opens a local web UI with directory tree navigation, syntax-highlighted code, AI explanations, dependency graphs, and Mermaid diagrams.
304
+
305
+ ### Documentation Export (`cg export`)
306
+
307
+ ```bash
308
+ cg export docx # basic DOCX with structure + diagrams
309
+ cg export docx --enhanced # add AI-powered explanations
310
+ cg export docx --include-code # include source code listings
311
+ cg export docx --enhanced --depth files --include-code # full export
312
+ ```
313
+
314
+ ### Auto Onboarding
267
315
 
268
316
  ```bash
269
- cg v2 generate "add a REST endpoint for user deletion"
270
- cg v2 review src/auth.py --check-security
271
- cg v2 refactor rename-symbol OldName NewName
272
- cg v2 refactor extract-function target_fn 45 60
273
- cg v2 test unit process_payment
274
- cg v2 diagnose check src/
275
- cg v2 diagnose fix src/auth.py
276
- cg v2 rollback <file>
277
- cg v2 list-backups
317
+ cg onboard # print AI-generated README to stdout
318
+ cg onboard --save # save as ONBOARD.md in project dir
319
+ cg onboard -o README.md # save to specific file
320
+ cg onboard --no-llm # template-only, no LLM call
278
321
  ```
279
322
 
280
323
  ---
@@ -297,23 +340,31 @@ Every file modification automatically creates a timestamped backup in `~/.codegr
297
340
  ## Architecture
298
341
 
299
342
  ```
300
- CLI Layer (Typer)
343
+ CLI Layer (Typer + Rich)
344
+ |
345
+ +-- config ─────────> ConfigManager (TOML)
346
+ |
347
+ +-- project ────────> MCPOrchestrator ──> GraphStore (SQLite)
348
+ | | |
349
+ | +-- Parser +-- VectorStore (LanceDB)
350
+ | | (tree-sitter) |
351
+ | +-- RAGRetriever +-- Embeddings (configurable)
352
+ | +-- LLM Adapter hash | minilm | bge-base
353
+ | jina-code | qodo-1.5b
354
+ +-- analyze ────────> Search, Impact, Graph, Tree, Sync, Health
355
+ |
356
+ +-- chat ───────────> ChatAgent (standard mode)
357
+ | CrewChatAgent (--crew mode)
358
+ | +-- Coordinator Agent
359
+ | +-- File System Agent ──> 8 file operation tools
360
+ | +-- Code Gen Agent ─────> all 11 tools
361
+ | +-- Code Analysis Agent > 3 search/analysis tools
362
+ |
363
+ +-- explore ────────> Starlette + Uvicorn (browser UI)
301
364
  |
302
- +-- MCPOrchestrator ----------> GraphStore (SQLite)
303
- | | |
304
- | +-- Parser (tree-sitter) +-- VectorStore (LanceDB)
305
- | +-- RAGRetriever |
306
- | +-- LLM Adapter +-- Embeddings (configurable)
307
- | hash | minilm | bge-base
308
- | jina-code | qodo-1.5b
309
- +-- ChatAgent (standard mode)
365
+ +-- export ─────────> DOCX generator + Mermaid diagrams
310
366
  |
311
- +-- CrewChatAgent (--crew mode)
312
- |
313
- +-- Coordinator Agent
314
- +-- File System Agent -----> 8 file operation tools
315
- +-- Code Gen Agent --------> all 11 tools
316
- +-- Code Analysis Agent ---> 3 search/analysis tools
367
+ +-- onboard ────────> AI README generation from code graph
317
368
  ```
318
369
 
319
370
  **Embeddings**: Five models available via `cg config set-embedding`. Hash (default, zero-dependency) through Qodo-Embed-1-1.5B (best quality, 6 GB). Neural models use raw `transformers` + `torch` — no sentence-transformers overhead. Models are cached in `~/.codegraph/models/`.
@@ -330,20 +381,26 @@ CLI Layer (Typer)
330
381
 
331
382
  ```
332
383
  codegraph_cli/
333
- cli.py # main Typer application, all top-level commands
334
- cli_chat.py # interactive chat REPL with styled output
335
- cli_setup.py # setup wizard, set-llm, unset-llm, set-embedding
336
- cli_v2.py # v2 code generation commands
384
+ cli.py # main Typer application, command wiring
385
+ cli_groups.py # command group definitions (config, project, analyze)
386
+ cli_chat.py # interactive chat REPL with Rich output
387
+ cli_setup.py # setup wizard, set-llm, set-embedding
388
+ cli_explore.py # browser-based visual code explorer (Starlette)
389
+ cli_export.py # DOCX export with Mermaid diagrams
390
+ cli_onboard.py # AI-generated project README
391
+ cli_health.py # project health dashboard
392
+ cli_quickstart.py # quickstart / init wizard
393
+ cli_watch.py # auto-reindex on file changes
337
394
  config.py # loads config from TOML
338
395
  config_manager.py # TOML read/write, provider and embedding config
339
396
  llm.py # multi-provider LLM adapter
340
- parser.py # tree-sitter AST parsing
397
+ parser.py # tree-sitter AST parsing (Python, JS, TS)
341
398
  storage.py # SQLite graph store
342
399
  embeddings.py # configurable embedding engine (5 models)
343
400
  rag.py # RAG retriever
344
401
  vector_store.py # LanceDB vector store
345
402
  orchestrator.py # coordinates parsing, search, impact
346
- graph_export.py # DOT and HTML export
403
+ graph_export.py # DOT and HTML graph export
347
404
  project_context.py # unified file access layer
348
405
  crew_tools.py # 11 CrewAI tools (file ops + analysis)
349
406
  crew_agents.py # 4 specialized CrewAI agents
@@ -351,7 +408,6 @@ codegraph_cli/
351
408
  chat_agent.py # standard chat agent
352
409
  chat_session.py # session persistence
353
410
  models.py # core data models
354
- models_v2.py # v2 models (ChatSession, CodeProposal)
355
411
  templates/
356
412
  graph_interactive.html # vis.js graph template
357
413
  ```
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
6
  [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org)
7
- [![Version](https://img.shields.io/badge/version-2.1.1-blue.svg)](https://github.com/al1-nasir/codegraph-cli)
7
+ [![Version](https://img.shields.io/badge/version-2.1.2-blue.svg)](https://github.com/al1-nasir/codegraph-cli)
8
8
  [![CI](https://github.com/al1-nasir/codegraph-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/al1-nasir/codegraph-cli/actions/workflows/ci.yml)
9
9
 
10
10
  ---
@@ -18,8 +18,11 @@ Core capabilities:
18
18
  - **Semantic Search** — find code by meaning, not string matching
19
19
  - **Impact Analysis** — trace multi-hop dependencies before making changes
20
20
  - **Graph Visualization** — interactive HTML and Graphviz DOT exports
21
+ - **Browser-Based Explorer** — visual code navigation with Mermaid diagrams and AI explanations
21
22
  - **Conversational Chat** — natural language coding sessions with RAG context
22
23
  - **Multi-Agent System** — CrewAI-powered agents for code generation, refactoring, and analysis
24
+ - **DOCX Export** — generate professional project documentation with architecture diagrams
25
+ - **Auto Onboarding** — AI-generated README from your code graph
23
26
  - **File Rollback** — automatic backups before every file modification
24
27
 
25
28
  ---
@@ -77,7 +80,7 @@ cg config set-llm ollama
77
80
  ### 2. Index a project
78
81
 
79
82
  ```bash
80
- cg index /path/to/project --name myproject
83
+ cg project index /path/to/project --name myproject
81
84
  ```
82
85
 
83
86
  This parses the source tree using tree-sitter, builds a dependency graph in SQLite, and generates embeddings for semantic search.
@@ -85,11 +88,14 @@ This parses the source tree using tree-sitter, builds a dependency graph in SQLi
85
88
  ### 3. Use it
86
89
 
87
90
  ```bash
88
- cg search "authentication logic"
89
- cg impact UserService --hops 3
90
- cg graph process_payment --depth 2
91
+ cg analyze search "authentication logic"
92
+ cg analyze impact UserService --hops 3
93
+ cg analyze graph process_payment --depth 2
91
94
  cg chat start
92
- cg chat start --crew # multi-agent mode
95
+ cg chat start --crew # multi-agent mode
96
+ cg explore open # browser-based code explorer
97
+ cg onboard # auto-generate project README
98
+ cg export docx # export documentation to DOCX
93
99
  ```
94
100
 
95
101
  ---
@@ -144,44 +150,68 @@ cg index /path/to/project
144
150
 
145
151
  ## Commands
146
152
 
147
- ### Project Management
153
+ CodeGraph CLI organizes commands into logical groups:
154
+
155
+ ```
156
+ cg config — LLM, embedding, and setup configuration
157
+ cg project — Index, load, and manage project memories
158
+ cg analyze — Search, impact, graph, and RAG context
159
+ cg chat — Interactive chat with AI agents
160
+ cg explore — Visual code explorer in browser
161
+ cg export — Export project documentation
162
+ cg onboard — Auto-generate project README
163
+ ```
164
+
165
+ ### Configuration (`cg config`)
148
166
 
149
167
  ```bash
150
- cg index <path> [--name NAME] # parse and index a codebase
151
- cg list-projects # list all indexed projects
152
- cg load-project <name> # switch active project
153
- cg current-project # print active project name
154
- cg delete-project <name> # remove a project index
155
- cg merge-projects <src> <dst> # merge two project graphs
156
- cg unload-project # unload without deleting
168
+ cg config setup # interactive LLM setup wizard
169
+ cg config set-llm openrouter # switch LLM provider
170
+ cg config unset-llm # reset LLM config to defaults
171
+ cg config show-llm # show current LLM settings
172
+ cg config set-embedding jina-code # switch embedding model
173
+ cg config unset-embedding # reset to hash default
174
+ cg config show-embedding # show current embedding model
157
175
  ```
158
176
 
159
- ### Search and Analysis
177
+ ### Project Management (`cg project`)
160
178
 
161
179
  ```bash
162
- cg search <query> [--top-k N] # semantic search across the graph
163
- cg impact <symbol> [--hops N] # multi-hop dependency impact analysis
164
- cg graph <symbol> [--depth N] # ASCII dependency graph
165
- cg rag-context <query> [--top-k N] # raw RAG retrieval for debugging
180
+ cg project index <path> [--name NAME] # parse and index a codebase
181
+ cg project list # list all indexed projects
182
+ cg project load <name> # switch active project
183
+ cg project current # print active project name
184
+ cg project delete <name> # remove a project index
185
+ cg project merge <src> <dst> # merge two project graphs
186
+ cg project unload # unload without deleting
187
+ cg project init # quickstart wizard
188
+ cg project watch # auto-reindex on file changes
166
189
  ```
167
190
 
168
- ### Graph Export
191
+ ### Code Analysis (`cg analyze`)
169
192
 
170
193
  ```bash
171
- cg export-graph --format html # interactive vis.js visualization
172
- cg export-graph --format dot # Graphviz DOT format
173
- cg export-graph MyClass -f html -o out.html # focused subgraph
194
+ cg analyze search <query> [--top-k N] # semantic search across the graph
195
+ cg analyze impact <symbol> [--hops N] # multi-hop dependency impact analysis
196
+ cg analyze graph <symbol> [--depth N] # ASCII dependency graph
197
+ cg analyze export-graph --format html # interactive vis.js visualization
198
+ cg analyze export-graph --format dot # Graphviz DOT format
199
+ cg analyze rag-context <query> # raw RAG retrieval for debugging
200
+ cg analyze tree [--full] # directory tree of indexed project
201
+ cg analyze sync [--dry-run] # incremental index sync
202
+ cg analyze health # project health dashboard
174
203
  ```
175
204
 
176
- ### Interactive Chat
205
+ ### Interactive Chat (`cg chat`)
177
206
 
178
207
  ```bash
179
- cg chat start # start or resume a session
180
- cg chat start --new # force a new session
181
- cg chat start --crew # multi-agent mode (CrewAI)
182
- cg chat start -s <id> # resume a specific session
183
- cg chat list # list all sessions
184
- cg chat delete <id> # delete a session
208
+ cg chat start # start or resume a session
209
+ cg chat start --new # force a new session
210
+ cg chat start --crew # multi-agent mode (CrewAI)
211
+ cg chat start -s <id> # resume a specific session
212
+ cg chat list # list all sessions
213
+ cg chat delete <id> # delete a session
214
+ cg chat export <id> --format markdown # export session to file
185
215
  ```
186
216
 
187
217
  In-chat commands:
@@ -198,18 +228,31 @@ In-chat commands:
198
228
  | `/rollback <file>` | Crew | Restore a file from backup |
199
229
  | `/undo <file>` | Crew | Alias for rollback |
200
230
 
201
- ### Code Generation (v2)
231
+ ### Visual Explorer (`cg explore`)
232
+
233
+ ```bash
234
+ cg explore open # launch browser-based code explorer
235
+ cg explore open --port 9000 # use custom port
236
+ ```
237
+
238
+ Opens a local web UI with directory tree navigation, syntax-highlighted code, AI explanations, dependency graphs, and Mermaid diagrams.
239
+
240
+ ### Documentation Export (`cg export`)
241
+
242
+ ```bash
243
+ cg export docx # basic DOCX with structure + diagrams
244
+ cg export docx --enhanced # add AI-powered explanations
245
+ cg export docx --include-code # include source code listings
246
+ cg export docx --enhanced --depth files --include-code # full export
247
+ ```
248
+
249
+ ### Auto Onboarding
202
250
 
203
251
  ```bash
204
- cg v2 generate "add a REST endpoint for user deletion"
205
- cg v2 review src/auth.py --check-security
206
- cg v2 refactor rename-symbol OldName NewName
207
- cg v2 refactor extract-function target_fn 45 60
208
- cg v2 test unit process_payment
209
- cg v2 diagnose check src/
210
- cg v2 diagnose fix src/auth.py
211
- cg v2 rollback <file>
212
- cg v2 list-backups
252
+ cg onboard # print AI-generated README to stdout
253
+ cg onboard --save # save as ONBOARD.md in project dir
254
+ cg onboard -o README.md # save to specific file
255
+ cg onboard --no-llm # template-only, no LLM call
213
256
  ```
214
257
 
215
258
  ---
@@ -232,23 +275,31 @@ Every file modification automatically creates a timestamped backup in `~/.codegr
232
275
  ## Architecture
233
276
 
234
277
  ```
235
- CLI Layer (Typer)
278
+ CLI Layer (Typer + Rich)
279
+ |
280
+ +-- config ─────────> ConfigManager (TOML)
281
+ |
282
+ +-- project ────────> MCPOrchestrator ──> GraphStore (SQLite)
283
+ | | |
284
+ | +-- Parser +-- VectorStore (LanceDB)
285
+ | | (tree-sitter) |
286
+ | +-- RAGRetriever +-- Embeddings (configurable)
287
+ | +-- LLM Adapter hash | minilm | bge-base
288
+ | jina-code | qodo-1.5b
289
+ +-- analyze ────────> Search, Impact, Graph, Tree, Sync, Health
290
+ |
291
+ +-- chat ───────────> ChatAgent (standard mode)
292
+ | CrewChatAgent (--crew mode)
293
+ | +-- Coordinator Agent
294
+ | +-- File System Agent ──> 8 file operation tools
295
+ | +-- Code Gen Agent ─────> all 11 tools
296
+ | +-- Code Analysis Agent > 3 search/analysis tools
297
+ |
298
+ +-- explore ────────> Starlette + Uvicorn (browser UI)
236
299
  |
237
- +-- MCPOrchestrator ----------> GraphStore (SQLite)
238
- | | |
239
- | +-- Parser (tree-sitter) +-- VectorStore (LanceDB)
240
- | +-- RAGRetriever |
241
- | +-- LLM Adapter +-- Embeddings (configurable)
242
- | hash | minilm | bge-base
243
- | jina-code | qodo-1.5b
244
- +-- ChatAgent (standard mode)
300
+ +-- export ─────────> DOCX generator + Mermaid diagrams
245
301
  |
246
- +-- CrewChatAgent (--crew mode)
247
- |
248
- +-- Coordinator Agent
249
- +-- File System Agent -----> 8 file operation tools
250
- +-- Code Gen Agent --------> all 11 tools
251
- +-- Code Analysis Agent ---> 3 search/analysis tools
302
+ +-- onboard ────────> AI README generation from code graph
252
303
  ```
253
304
 
254
305
  **Embeddings**: Five models available via `cg config set-embedding`. Hash (default, zero-dependency) through Qodo-Embed-1-1.5B (best quality, 6 GB). Neural models use raw `transformers` + `torch` — no sentence-transformers overhead. Models are cached in `~/.codegraph/models/`.
@@ -265,20 +316,26 @@ CLI Layer (Typer)
265
316
 
266
317
  ```
267
318
  codegraph_cli/
268
- cli.py # main Typer application, all top-level commands
269
- cli_chat.py # interactive chat REPL with styled output
270
- cli_setup.py # setup wizard, set-llm, unset-llm, set-embedding
271
- cli_v2.py # v2 code generation commands
319
+ cli.py # main Typer application, command wiring
320
+ cli_groups.py # command group definitions (config, project, analyze)
321
+ cli_chat.py # interactive chat REPL with Rich output
322
+ cli_setup.py # setup wizard, set-llm, set-embedding
323
+ cli_explore.py # browser-based visual code explorer (Starlette)
324
+ cli_export.py # DOCX export with Mermaid diagrams
325
+ cli_onboard.py # AI-generated project README
326
+ cli_health.py # project health dashboard
327
+ cli_quickstart.py # quickstart / init wizard
328
+ cli_watch.py # auto-reindex on file changes
272
329
  config.py # loads config from TOML
273
330
  config_manager.py # TOML read/write, provider and embedding config
274
331
  llm.py # multi-provider LLM adapter
275
- parser.py # tree-sitter AST parsing
332
+ parser.py # tree-sitter AST parsing (Python, JS, TS)
276
333
  storage.py # SQLite graph store
277
334
  embeddings.py # configurable embedding engine (5 models)
278
335
  rag.py # RAG retriever
279
336
  vector_store.py # LanceDB vector store
280
337
  orchestrator.py # coordinates parsing, search, impact
281
- graph_export.py # DOT and HTML export
338
+ graph_export.py # DOT and HTML graph export
282
339
  project_context.py # unified file access layer
283
340
  crew_tools.py # 11 CrewAI tools (file ops + analysis)
284
341
  crew_agents.py # 4 specialized CrewAI agents
@@ -286,7 +343,6 @@ codegraph_cli/
286
343
  chat_agent.py # standard chat agent
287
344
  chat_session.py # session persistence
288
345
  models.py # core data models
289
- models_v2.py # v2 models (ChatSession, CodeProposal)
290
346
  templates/
291
347
  graph_interactive.html # vis.js graph template
292
348
  ```
@@ -1,4 +1,4 @@
1
1
  """CodeGraph CLI package."""
2
2
 
3
3
  __all__ = ["__version__"]
4
- __version__ = "2.1.2"
4
+ __version__ = "2.1.3"
@@ -1016,12 +1016,18 @@ def explore_open(
1016
1016
  store.close()
1017
1017
  raise typer.Exit(code=1)
1018
1018
 
1019
- server_app = _create_server(
1020
- store,
1021
- llm_provider=cfg.LLM_PROVIDER,
1022
- llm_model=cfg.LLM_MODEL,
1023
- llm_api_key=cfg.LLM_API_KEY,
1024
- )
1019
+ try:
1020
+ server_app = _create_server(
1021
+ store,
1022
+ llm_provider=cfg.LLM_PROVIDER,
1023
+ llm_model=cfg.LLM_MODEL,
1024
+ llm_api_key=cfg.LLM_API_KEY,
1025
+ )
1026
+ except ImportError:
1027
+ console.print("[red]The 'explore' feature requires starlette and uvicorn.[/red]")
1028
+ console.print("[dim]Install with: pip install codegraph-cli\\[explore][/dim]")
1029
+ store.close()
1030
+ raise typer.Exit(code=1)
1025
1031
 
1026
1032
  url = f"http://127.0.0.1:{actual_port}"
1027
1033
  console.print(f"\n[bold green]🌐 CodeGraph Explorer[/bold green]")
@@ -1040,10 +1046,10 @@ def explore_open(
1040
1046
  try:
1041
1047
  import uvicorn
1042
1048
  except ImportError:
1043
- raise ImportError(
1044
- "The 'explore' feature requires uvicorn.\n"
1045
- "Install with: pip install codegraph-cli[explore]"
1046
- )
1049
+ console.print("[red]The 'explore' feature requires uvicorn.[/red]")
1050
+ console.print("[dim]Install with: pip install codegraph-cli\\[explore][/dim]")
1051
+ store.close()
1052
+ raise typer.Exit(code=1)
1047
1053
  try:
1048
1054
  uvicorn.run(server_app, host="127.0.0.1", port=actual_port, log_level="warning")
1049
1055
  except KeyboardInterrupt:
@@ -36,7 +36,7 @@ def create_file_ops_agent(tools: list, llm, project_context: str = "") -> Agent:
36
36
  llm=llm,
37
37
  verbose=False,
38
38
  allow_delegation=False,
39
- max_iter=15,
39
+ max_iter=10,
40
40
  max_tokens=4096,
41
41
  )
42
42
 
@@ -69,7 +69,7 @@ def create_code_gen_agent(tools: list, llm, project_context: str = "") -> Agent:
69
69
  llm=llm,
70
70
  verbose=False,
71
71
  allow_delegation=False,
72
- max_iter=20,
72
+ max_iter=12,
73
73
  max_tokens=4096,
74
74
  )
75
75
 
@@ -98,7 +98,7 @@ def create_code_analysis_agent(tools: list, llm, project_context: str = "") -> A
98
98
  llm=llm,
99
99
  verbose=False,
100
100
  allow_delegation=False,
101
- max_iter=15,
101
+ max_iter=10,
102
102
  max_tokens=4096,
103
103
  )
104
104
 
@@ -142,6 +142,6 @@ def create_coordinator_agent(llm, project_context: str = "", tools: list = None)
142
142
  llm=llm,
143
143
  verbose=False,
144
144
  allow_delegation=True,
145
- max_iter=25,
145
+ max_iter=15,
146
146
  max_tokens=4096,
147
147
  )