codegraph-cli 2.1.2__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.
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/PKG-INFO +119 -63
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/README.md +118 -62
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/__init__.py +1 -1
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/crew_agents.py +4 -4
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/crew_chat.py +14 -4
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/crew_tools.py +10 -3
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/security_scanner.py +39 -1
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/vector_store.py +17 -15
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli.egg-info/PKG-INFO +119 -63
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/pyproject.toml +1 -1
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/tests/test_agents.py +20 -5
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/tests/test_cli.py +1 -1
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/LICENSE +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/agents.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/bug_detector.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/chat_agent.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/chat_session.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_chat.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_diagnose.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_docs.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_explore.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_export.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_groups.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_health.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_history.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_onboard.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_quickstart.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_refactor.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_setup.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_suggestions.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_test.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_tui.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_v2.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_watch.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/cli_workflows.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/codegen_agent.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/config.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/config_manager.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/context_manager.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/diff_engine.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/embeddings.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/graph_export.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/llm.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/models.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/models_v2.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/orchestrator.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/parser.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/performance_analyzer.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/project_context.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/rag.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/refactor_agent.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/storage.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/templates/graph_interactive.html +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/testgen_agent.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli/validation_engine.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli.egg-info/SOURCES.txt +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli.egg-info/dependency_links.txt +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli.egg-info/entry_points.txt +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli.egg-info/requires.txt +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/codegraph_cli.egg-info/top_level.txt +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/setup.cfg +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/tests/test_bug_detector.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/tests/test_cli_workflows.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/tests/test_parser.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/tests/test_security_scanner.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/tests/test_storage.py +0 -0
- {codegraph_cli-2.1.2 → codegraph_cli-2.1.3}/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.
|
|
3
|
+
Version: 2.1.3
|
|
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)
|
|
71
71
|
[](https://www.python.org)
|
|
72
|
-
[](https://github.com/al1-nasir/codegraph-cli)
|
|
73
73
|
[](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
|
|
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
|
-
|
|
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
|
|
216
|
-
cg
|
|
217
|
-
cg
|
|
218
|
-
cg
|
|
219
|
-
cg
|
|
220
|
-
cg
|
|
221
|
-
cg
|
|
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
|
-
###
|
|
242
|
+
### Project Management (`cg project`)
|
|
225
243
|
|
|
226
244
|
```bash
|
|
227
|
-
cg
|
|
228
|
-
cg
|
|
229
|
-
cg
|
|
230
|
-
cg
|
|
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
|
-
###
|
|
256
|
+
### Code Analysis (`cg analyze`)
|
|
234
257
|
|
|
235
258
|
```bash
|
|
236
|
-
cg
|
|
237
|
-
cg
|
|
238
|
-
cg
|
|
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
|
|
245
|
-
cg chat start --new
|
|
246
|
-
cg chat start --crew
|
|
247
|
-
cg chat start -s <id>
|
|
248
|
-
cg chat list
|
|
249
|
-
cg chat delete <id>
|
|
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
|
-
###
|
|
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
|
|
270
|
-
cg
|
|
271
|
-
cg
|
|
272
|
-
cg
|
|
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
|
-
+--
|
|
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
|
-
+--
|
|
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,
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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)
|
|
6
6
|
[](https://www.python.org)
|
|
7
|
-
[](https://github.com/al1-nasir/codegraph-cli)
|
|
8
8
|
[](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
|
|
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
|
-
|
|
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
|
|
151
|
-
cg
|
|
152
|
-
cg
|
|
153
|
-
cg
|
|
154
|
-
cg
|
|
155
|
-
cg
|
|
156
|
-
cg
|
|
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
|
-
###
|
|
177
|
+
### Project Management (`cg project`)
|
|
160
178
|
|
|
161
179
|
```bash
|
|
162
|
-
cg
|
|
163
|
-
cg
|
|
164
|
-
cg
|
|
165
|
-
cg
|
|
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
|
-
###
|
|
191
|
+
### Code Analysis (`cg analyze`)
|
|
169
192
|
|
|
170
193
|
```bash
|
|
171
|
-
cg
|
|
172
|
-
cg
|
|
173
|
-
cg
|
|
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
|
|
180
|
-
cg chat start --new
|
|
181
|
-
cg chat start --crew
|
|
182
|
-
cg chat start -s <id>
|
|
183
|
-
cg chat list
|
|
184
|
-
cg chat delete <id>
|
|
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
|
-
###
|
|
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
|
|
205
|
-
cg
|
|
206
|
-
cg
|
|
207
|
-
cg
|
|
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
|
-
+--
|
|
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
|
-
+--
|
|
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,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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
|
```
|
|
@@ -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=
|
|
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=
|
|
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=
|
|
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=
|
|
145
|
+
max_iter=15,
|
|
146
146
|
max_tokens=4096,
|
|
147
147
|
)
|
|
@@ -45,10 +45,20 @@ class CrewChatAgent:
|
|
|
45
45
|
# ── Silence CrewAI / LiteLLM noise ────────────────
|
|
46
46
|
for logger_name in (
|
|
47
47
|
"crewai", "crewai.agents", "crewai.crews",
|
|
48
|
-
"crewai.tasks", "litellm", "
|
|
48
|
+
"crewai.tasks", "litellm", "litellm.proxy",
|
|
49
|
+
"litellm.litellm_core_utils", "litellm.utils",
|
|
50
|
+
"litellm.proxy.proxy_server", "httpx", "httpcore",
|
|
49
51
|
):
|
|
50
52
|
logging.getLogger(logger_name).setLevel(logging.CRITICAL)
|
|
51
53
|
os.environ.setdefault("CREWAI_TELEMETRY_OPT_OUT", "true")
|
|
54
|
+
# Suppress LiteLLM's fastapi proxy import spam
|
|
55
|
+
os.environ.setdefault("LITELLM_LOG", "ERROR")
|
|
56
|
+
try:
|
|
57
|
+
import litellm
|
|
58
|
+
litellm.suppress_debug_info = True
|
|
59
|
+
litellm.set_verbose = False
|
|
60
|
+
except ImportError:
|
|
61
|
+
pass
|
|
52
62
|
|
|
53
63
|
# ── Provider env vars for LiteLLM compatibility ───
|
|
54
64
|
if llm.api_key:
|
|
@@ -210,8 +220,8 @@ class CrewChatAgent:
|
|
|
210
220
|
"""Format conversation history for injection into task context.
|
|
211
221
|
|
|
212
222
|
Keeps the last 4 exchanges (8 messages). The most recent 2
|
|
213
|
-
exchanges are preserved in full; older ones are
|
|
214
|
-
~
|
|
223
|
+
exchanges are preserved in full (up to a cap); older ones are
|
|
224
|
+
compressed to ~400 chars each to stay within LLM context limits.
|
|
215
225
|
"""
|
|
216
226
|
if not self._history:
|
|
217
227
|
return ""
|
|
@@ -226,7 +236,7 @@ class CrewChatAgent:
|
|
|
226
236
|
content = msg["content"]
|
|
227
237
|
# Last 2 exchanges (4 msgs) get generous space; older ones compressed
|
|
228
238
|
is_recent = i >= total - 4
|
|
229
|
-
max_len =
|
|
239
|
+
max_len = 1500 if is_recent else 400
|
|
230
240
|
if len(content) > max_len:
|
|
231
241
|
content = content[:max_len] + "\n... (truncated)"
|
|
232
242
|
lines.append(f"[{role}]:\n{content}")
|