codegraph-cli 2.1.1__tar.gz → 2.1.3__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 (75) hide show
  1. codegraph_cli-2.1.3/PKG-INFO +431 -0
  2. codegraph_cli-2.1.3/README.md +366 -0
  3. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/__init__.py +1 -1
  4. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/agents.py +59 -3
  5. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/chat_agent.py +58 -11
  6. codegraph_cli-2.1.3/codegraph_cli/cli.py +851 -0
  7. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/cli_chat.py +200 -95
  8. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/cli_diagnose.py +13 -2
  9. codegraph_cli-2.1.3/codegraph_cli/cli_docs.py +207 -0
  10. codegraph_cli-2.1.3/codegraph_cli/cli_explore.py +1053 -0
  11. codegraph_cli-2.1.3/codegraph_cli/cli_export.py +941 -0
  12. codegraph_cli-2.1.3/codegraph_cli/cli_groups.py +33 -0
  13. codegraph_cli-2.1.3/codegraph_cli/cli_health.py +316 -0
  14. codegraph_cli-2.1.3/codegraph_cli/cli_history.py +213 -0
  15. codegraph_cli-2.1.3/codegraph_cli/cli_onboard.py +380 -0
  16. codegraph_cli-2.1.3/codegraph_cli/cli_quickstart.py +256 -0
  17. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/cli_refactor.py +17 -3
  18. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/cli_setup.py +12 -12
  19. codegraph_cli-2.1.3/codegraph_cli/cli_suggestions.py +90 -0
  20. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/cli_test.py +17 -3
  21. codegraph_cli-2.1.3/codegraph_cli/cli_tui.py +210 -0
  22. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/cli_v2.py +24 -4
  23. codegraph_cli-2.1.3/codegraph_cli/cli_watch.py +158 -0
  24. codegraph_cli-2.1.3/codegraph_cli/cli_workflows.py +255 -0
  25. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/codegen_agent.py +15 -1
  26. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/config.py +18 -5
  27. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/context_manager.py +117 -15
  28. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/crew_agents.py +29 -10
  29. codegraph_cli-2.1.3/codegraph_cli/crew_chat.py +302 -0
  30. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/crew_tools.py +31 -4
  31. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/embeddings.py +95 -5
  32. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/llm.py +42 -55
  33. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/project_context.py +64 -1
  34. codegraph_cli-2.1.3/codegraph_cli/rag.py +463 -0
  35. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/security_scanner.py +39 -1
  36. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/storage.py +310 -14
  37. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/vector_store.py +126 -22
  38. codegraph_cli-2.1.3/codegraph_cli.egg-info/PKG-INFO +431 -0
  39. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli.egg-info/SOURCES.txt +13 -0
  40. codegraph_cli-2.1.3/codegraph_cli.egg-info/entry_points.txt +2 -0
  41. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli.egg-info/requires.txt +13 -1
  42. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/pyproject.toml +15 -3
  43. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/tests/test_agents.py +20 -5
  44. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/tests/test_cli.py +48 -48
  45. codegraph_cli-2.1.3/tests/test_cli_workflows.py +242 -0
  46. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/tests/test_vector_store.py +3 -3
  47. codegraph_cli-2.1.1/PKG-INFO +0 -364
  48. codegraph_cli-2.1.1/README.md +0 -309
  49. codegraph_cli-2.1.1/codegraph_cli/cli.py +0 -336
  50. codegraph_cli-2.1.1/codegraph_cli/crew_chat.py +0 -163
  51. codegraph_cli-2.1.1/codegraph_cli/rag.py +0 -200
  52. codegraph_cli-2.1.1/codegraph_cli.egg-info/PKG-INFO +0 -364
  53. codegraph_cli-2.1.1/codegraph_cli.egg-info/entry_points.txt +0 -2
  54. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/LICENSE +0 -0
  55. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/bug_detector.py +0 -0
  56. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/chat_session.py +0 -0
  57. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/config_manager.py +0 -0
  58. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/diff_engine.py +0 -0
  59. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/graph_export.py +0 -0
  60. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/models.py +0 -0
  61. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/models_v2.py +0 -0
  62. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/orchestrator.py +0 -0
  63. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/parser.py +0 -0
  64. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/performance_analyzer.py +0 -0
  65. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/refactor_agent.py +0 -0
  66. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/templates/graph_interactive.html +0 -0
  67. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/testgen_agent.py +0 -0
  68. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli/validation_engine.py +0 -0
  69. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli.egg-info/dependency_links.txt +0 -0
  70. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/codegraph_cli.egg-info/top_level.txt +0 -0
  71. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/setup.cfg +0 -0
  72. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/tests/test_bug_detector.py +0 -0
  73. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/tests/test_parser.py +0 -0
  74. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/tests/test_security_scanner.py +0 -0
  75. {codegraph_cli-2.1.1 → codegraph_cli-2.1.3}/tests/test_storage.py +0 -0
@@ -0,0 +1,431 @@
1
+ Metadata-Version: 2.4
2
+ Name: codegraph-cli
3
+ Version: 2.1.3
4
+ Summary: AI-powered code intelligence CLI with multi-agent analysis, impact graphs, and conversational coding.
5
+ Author-email: Ali Nasir <muhammadalinasir00786@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/al1-nasir/codegraph-cli
8
+ Project-URL: Documentation, https://github.com/al1-nasir/codegraph-cli#readme
9
+ Project-URL: Repository, https://github.com/al1-nasir/codegraph-cli
10
+ Project-URL: Issues, https://github.com/al1-nasir/codegraph-cli/issues
11
+ Project-URL: Changelog, https://github.com/al1-nasir/codegraph-cli/blob/main/CHANGELOG.md
12
+ Keywords: code-analysis,code-intelligence,cli,ai,code-graph,rag,impact-analysis,refactoring,crewai,multi-agent
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Software Development :: Code Generators
16
+ Classifier: Topic :: Software Development :: Quality Assurance
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Environment :: Console
26
+ Requires-Python: >=3.9
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: requests>=2.31.0
30
+ Requires-Dist: typer<1.0.0,>=0.12.0
31
+ Requires-Dist: toml>=0.10.2
32
+ Requires-Dist: lancedb>=0.4.0
33
+ Requires-Dist: pyarrow>=14.0.0
34
+ Requires-Dist: tree-sitter>=0.24.0
35
+ Requires-Dist: tree-sitter-python>=0.23.0
36
+ Requires-Dist: tree-sitter-javascript>=0.23.0
37
+ Requires-Dist: tree-sitter-typescript>=0.23.0
38
+ Requires-Dist: rich>=13.0.0
39
+ Requires-Dist: python-docx>=1.0.0
40
+ Requires-Dist: pydantic>=2.0.0
41
+ Provides-Extra: crew
42
+ Requires-Dist: crewai>=0.80.0; extra == "crew"
43
+ Provides-Extra: explore
44
+ Requires-Dist: starlette>=0.27.0; extra == "explore"
45
+ Requires-Dist: uvicorn>=0.24.0; extra == "explore"
46
+ Provides-Extra: dev
47
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
48
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
49
+ Requires-Dist: pytest-mock>=3.11.0; extra == "dev"
50
+ Requires-Dist: build>=1.0.0; extra == "dev"
51
+ Requires-Dist: twine>=5.0.0; extra == "dev"
52
+ Provides-Extra: watch
53
+ Requires-Dist: watchdog>=3.0.0; extra == "watch"
54
+ Provides-Extra: embeddings
55
+ Requires-Dist: torch>=2.0.0; extra == "embeddings"
56
+ Requires-Dist: transformers<5.0.0,>=4.48.0; extra == "embeddings"
57
+ Provides-Extra: all
58
+ Requires-Dist: crewai>=0.80.0; extra == "all"
59
+ Requires-Dist: starlette>=0.27.0; extra == "all"
60
+ Requires-Dist: uvicorn>=0.24.0; extra == "all"
61
+ Requires-Dist: torch>=2.0.0; extra == "all"
62
+ Requires-Dist: transformers<5.0.0,>=4.48.0; extra == "all"
63
+ Requires-Dist: watchdog>=3.0.0; extra == "all"
64
+ Dynamic: license-file
65
+
66
+ # CodeGraph CLI
67
+
68
+ **Code intelligence from the terminal. Semantic search, impact analysis, multi-agent code generation, and conversational coding — all backed by your choice of LLM.**
69
+
70
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
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.2-blue.svg)](https://github.com/al1-nasir/codegraph-cli)
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
+
75
+ ---
76
+
77
+ ## Overview
78
+
79
+ CodeGraph CLI (`cg`) parses your codebase into a semantic graph, then exposes that graph through search, impact analysis, visualization, and a conversational interface. It supports six LLM providers and optionally runs a CrewAI multi-agent system that can read, write, patch, and rollback files autonomously.
80
+
81
+ Core capabilities:
82
+
83
+ - **Semantic Search** — find code by meaning, not string matching
84
+ - **Impact Analysis** — trace multi-hop dependencies before making changes
85
+ - **Graph Visualization** — interactive HTML and Graphviz DOT exports
86
+ - **Browser-Based Explorer** — visual code navigation with Mermaid diagrams and AI explanations
87
+ - **Conversational Chat** — natural language coding sessions with RAG context
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
91
+ - **File Rollback** — automatic backups before every file modification
92
+
93
+ ---
94
+
95
+ ## Installation
96
+
97
+ ```bash
98
+ pip install codegraph-cli
99
+ ```
100
+
101
+ With neural embedding models (semantic code search):
102
+
103
+ ```bash
104
+ pip install codegraph-cli[embeddings]
105
+ ```
106
+
107
+ With CrewAI multi-agent support:
108
+
109
+ ```bash
110
+ pip install codegraph-cli[crew]
111
+ ```
112
+
113
+ Everything:
114
+
115
+ ```bash
116
+ pip install codegraph-cli[all]
117
+ ```
118
+
119
+ For development:
120
+
121
+ ```bash
122
+ git clone https://github.com/al1-nasir/codegraph-cli.git
123
+ cd codegraph-cli
124
+ pip install -e ".[dev]"
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Quick Start
130
+
131
+ ### 1. Configure your LLM provider
132
+
133
+ ```bash
134
+ cg config setup
135
+ ```
136
+
137
+ This runs an interactive wizard that writes configuration to `~/.codegraph/config.toml`. Alternatively, switch providers directly:
138
+
139
+ ```bash
140
+ cg config set-llm openrouter
141
+ cg config set-llm groq
142
+ cg config set-llm ollama
143
+ ```
144
+
145
+ ### 2. Index a project
146
+
147
+ ```bash
148
+ cg project index /path/to/project --name myproject
149
+ ```
150
+
151
+ This parses the source tree using tree-sitter, builds a dependency graph in SQLite, and generates embeddings for semantic search.
152
+
153
+ ### 3. Use it
154
+
155
+ ```bash
156
+ cg analyze search "authentication logic"
157
+ cg analyze impact UserService --hops 3
158
+ cg analyze graph process_payment --depth 2
159
+ cg chat start
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
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Supported LLM Providers
169
+
170
+ | Provider | Type | Configuration |
171
+ |----------|------|---------------|
172
+ | Ollama | Local, free | `cg config set-llm ollama` |
173
+ | Groq | Cloud, free tier | `cg config set-llm groq` |
174
+ | OpenAI | Cloud | `cg config set-llm openai` |
175
+ | Anthropic | Cloud | `cg config set-llm anthropic` |
176
+ | Gemini | Cloud | `cg config set-llm gemini` |
177
+ | OpenRouter | Cloud, multi-model | `cg config set-llm openrouter` |
178
+
179
+ All configuration is stored in `~/.codegraph/config.toml`. No environment variables required.
180
+
181
+ ```bash
182
+ cg config show-llm # view current provider, model, and endpoint
183
+ cg config unset-llm # reset to defaults
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Embedding Models
189
+
190
+ CodeGraph supports configurable embedding models for semantic code search. Choose based on your hardware and quality needs:
191
+
192
+ | Model | Download | Dim | Quality | Command |
193
+ |-------|----------|-----|---------|---------|
194
+ | hash | 0 bytes | 256 | Keyword-only | `cg config set-embedding hash` |
195
+ | minilm | ~80 MB | 384 | Decent | `cg config set-embedding minilm` |
196
+ | bge-base | ~440 MB | 768 | Good | `cg config set-embedding bge-base` |
197
+ | jina-code | ~550 MB | 768 | Code-aware | `cg config set-embedding jina-code` |
198
+ | qodo-1.5b | ~6.2 GB | 1536 | Best | `cg config set-embedding qodo-1.5b` |
199
+
200
+ The default is `hash` (zero-dependency, no download). Neural models require the `[embeddings]` extra and are downloaded on first use from HuggingFace.
201
+
202
+ ```bash
203
+ cg config set-embedding jina-code # switch to a neural model
204
+ cg config show-embedding # view current model and all options
205
+ cg config unset-embedding # reset to hash default
206
+ ```
207
+
208
+ After changing the embedding model, re-index your project:
209
+
210
+ ```bash
211
+ cg index /path/to/project
212
+ ```
213
+
214
+ ---
215
+
216
+ ## Commands
217
+
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`)
231
+
232
+ ```bash
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
240
+ ```
241
+
242
+ ### Project Management (`cg project`)
243
+
244
+ ```bash
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
254
+ ```
255
+
256
+ ### Code Analysis (`cg analyze`)
257
+
258
+ ```bash
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
268
+ ```
269
+
270
+ ### Interactive Chat (`cg chat`)
271
+
272
+ ```bash
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
280
+ ```
281
+
282
+ In-chat commands:
283
+
284
+ | Command | Mode | Description |
285
+ |---------|------|-------------|
286
+ | `/help` | Both | Show available commands |
287
+ | `/clear` | Both | Clear conversation history |
288
+ | `/new` | Both | Start a fresh session |
289
+ | `/exit` | Both | Save and exit |
290
+ | `/apply` | Standard | Apply pending code proposal |
291
+ | `/preview` | Standard | Preview pending file changes |
292
+ | `/backups` | Crew | List all file backups |
293
+ | `/rollback <file>` | Crew | Restore a file from backup |
294
+ | `/undo <file>` | Crew | Alias for rollback |
295
+
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
315
+
316
+ ```bash
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
321
+ ```
322
+
323
+ ---
324
+
325
+ ## Multi-Agent System
326
+
327
+ When you run `cg chat start --crew`, CodeGraph launches a CrewAI pipeline with four specialized agents:
328
+
329
+ | Agent | Role | Tools |
330
+ |-------|------|-------|
331
+ | Project Coordinator | Routes tasks to the right specialist | Delegation only |
332
+ | File System Engineer | File I/O, directory traversal, backups | list_directory, read_file, write_file, patch_file, delete_file, rollback_file, file_tree |
333
+ | Senior Software Developer | Code generation, refactoring, bug fixes | All tools (file ops + code analysis) |
334
+ | Code Intelligence Analyst | Search, dependency tracing, explanations | search_code, grep, project_summary, read_file |
335
+
336
+ Every file modification automatically creates a timestamped backup in `~/.codegraph/backups/`. Files can be rolled back to any previous state via `/rollback` or `cg v2 rollback`.
337
+
338
+ ---
339
+
340
+ ## Architecture
341
+
342
+ ```
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)
364
+ |
365
+ +-- export ─────────> DOCX generator + Mermaid diagrams
366
+ |
367
+ +-- onboard ────────> AI README generation from code graph
368
+ ```
369
+
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/`.
371
+
372
+ **Parser**: tree-sitter grammars for Python, JavaScript, and TypeScript. Extracts modules, classes, functions, imports, and call relationships into a directed graph.
373
+
374
+ **Storage**: SQLite for the code graph (nodes + edges), LanceDB for vector embeddings. All data stored under `~/.codegraph/`.
375
+
376
+ **LLM Adapter**: Unified interface across six providers. For CrewAI, models are routed through LiteLLM. Configuration is read exclusively from `~/.codegraph/config.toml`.
377
+
378
+ ---
379
+
380
+ ## Project Structure
381
+
382
+ ```
383
+ codegraph_cli/
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
394
+ config.py # loads config from TOML
395
+ config_manager.py # TOML read/write, provider and embedding config
396
+ llm.py # multi-provider LLM adapter
397
+ parser.py # tree-sitter AST parsing (Python, JS, TS)
398
+ storage.py # SQLite graph store
399
+ embeddings.py # configurable embedding engine (5 models)
400
+ rag.py # RAG retriever
401
+ vector_store.py # LanceDB vector store
402
+ orchestrator.py # coordinates parsing, search, impact
403
+ graph_export.py # DOT and HTML graph export
404
+ project_context.py # unified file access layer
405
+ crew_tools.py # 11 CrewAI tools (file ops + analysis)
406
+ crew_agents.py # 4 specialized CrewAI agents
407
+ crew_chat.py # CrewAI orchestrator with rollback
408
+ chat_agent.py # standard chat agent
409
+ chat_session.py # session persistence
410
+ models.py # core data models
411
+ templates/
412
+ graph_interactive.html # vis.js graph template
413
+ ```
414
+
415
+ ---
416
+
417
+ ## Development
418
+
419
+ ```bash
420
+ git clone https://github.com/al1-nasir/codegraph-cli.git
421
+ cd codegraph-cli
422
+ python -m venv .venv && source .venv/bin/activate
423
+ pip install -e ".[dev,crew,embeddings]"
424
+ pytest
425
+ ```
426
+
427
+ ---
428
+
429
+ ## License
430
+
431
+ MIT. See [LICENSE](LICENSE).