codegraph-cli 2.1.0__py3-none-any.whl → 2.1.2__py3-none-any.whl
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/__init__.py +1 -1
- codegraph_cli/agents.py +59 -3
- codegraph_cli/chat_agent.py +58 -11
- codegraph_cli/cli.py +569 -54
- codegraph_cli/cli_chat.py +204 -94
- codegraph_cli/cli_diagnose.py +13 -2
- codegraph_cli/cli_docs.py +207 -0
- codegraph_cli/cli_explore.py +1053 -0
- codegraph_cli/cli_export.py +941 -0
- codegraph_cli/cli_groups.py +33 -0
- codegraph_cli/cli_health.py +316 -0
- codegraph_cli/cli_history.py +213 -0
- codegraph_cli/cli_onboard.py +380 -0
- codegraph_cli/cli_quickstart.py +256 -0
- codegraph_cli/cli_refactor.py +17 -3
- codegraph_cli/cli_setup.py +12 -12
- codegraph_cli/cli_suggestions.py +90 -0
- codegraph_cli/cli_test.py +17 -3
- codegraph_cli/cli_tui.py +210 -0
- codegraph_cli/cli_v2.py +24 -4
- codegraph_cli/cli_watch.py +158 -0
- codegraph_cli/cli_workflows.py +255 -0
- codegraph_cli/codegen_agent.py +15 -1
- codegraph_cli/config.py +18 -5
- codegraph_cli/context_manager.py +117 -15
- codegraph_cli/crew_agents.py +32 -8
- codegraph_cli/crew_chat.py +146 -13
- codegraph_cli/crew_tools.py +30 -2
- codegraph_cli/embeddings.py +95 -5
- codegraph_cli/llm.py +42 -55
- codegraph_cli/project_context.py +64 -1
- codegraph_cli/rag.py +282 -19
- codegraph_cli/storage.py +310 -14
- codegraph_cli/vector_store.py +110 -8
- {codegraph_cli-2.1.0.dist-info → codegraph_cli-2.1.2.dist-info}/METADATA +75 -21
- codegraph_cli-2.1.2.dist-info/RECORD +55 -0
- codegraph_cli-2.1.2.dist-info/entry_points.txt +2 -0
- codegraph_cli-2.1.0.dist-info/RECORD +0 -43
- codegraph_cli-2.1.0.dist-info/entry_points.txt +0 -2
- {codegraph_cli-2.1.0.dist-info → codegraph_cli-2.1.2.dist-info}/WHEEL +0 -0
- {codegraph_cli-2.1.0.dist-info → codegraph_cli-2.1.2.dist-info}/licenses/LICENSE +0 -0
- {codegraph_cli-2.1.0.dist-info → codegraph_cli-2.1.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"""Documentation and cheat sheet generator for CodeGraph CLI."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from rich.panel import Panel
|
|
10
|
+
|
|
11
|
+
console = Console()
|
|
12
|
+
|
|
13
|
+
docs_app = typer.Typer(help="📚 Documentation and guides")
|
|
14
|
+
|
|
15
|
+
CHEATSHEET_CONTENT = """\
|
|
16
|
+
# CodeGraph CLI — Cheat Sheet
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
```bash
|
|
20
|
+
cg quickstart # Setup and index in 30 seconds
|
|
21
|
+
cg init # Alias for quickstart
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Most Used Commands
|
|
25
|
+
```bash
|
|
26
|
+
cg search "query" # Find code semantically
|
|
27
|
+
cg chat start # Interactive Q&A about code
|
|
28
|
+
cg v2 generate "desc" # Generate new code
|
|
29
|
+
cg v2 review <file> # AI code review
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Aliases (shortcuts)
|
|
33
|
+
```bash
|
|
34
|
+
cg find "query" # Same as cg search
|
|
35
|
+
cg ask # Same as cg chat start
|
|
36
|
+
cg gen "description" # Same as cg v2 generate
|
|
37
|
+
cg fix <path> # Same as cg v2 diagnose fix
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Project Management
|
|
41
|
+
```bash
|
|
42
|
+
cg index <path> # Index a project
|
|
43
|
+
cg list-projects # List all indexed projects
|
|
44
|
+
cg load-project <name> # Switch active project
|
|
45
|
+
cg delete-project <name> # Delete a project
|
|
46
|
+
cg tree # Show project structure
|
|
47
|
+
cg tree --full # Show with functions/classes
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Code Analysis
|
|
51
|
+
```bash
|
|
52
|
+
cg search "query" # Semantic code search
|
|
53
|
+
cg impact <symbol> # Impact analysis
|
|
54
|
+
cg graph <symbol> # Show dependency graph
|
|
55
|
+
cg rag-context "query" # View RAG context
|
|
56
|
+
cg health dashboard # Project health report
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Code Improvement
|
|
60
|
+
```bash
|
|
61
|
+
cg v2 review <file> # AI code review
|
|
62
|
+
cg v2 review <file> --llm # With LLM deep analysis
|
|
63
|
+
cg v2 refactor rename <old> <new> # Rename symbol safely
|
|
64
|
+
cg v2 refactor extract-function <file> <start> <end> <name>
|
|
65
|
+
cg v2 diagnose check <path> # Scan for errors
|
|
66
|
+
cg v2 diagnose fix <path> # Auto-fix errors
|
|
67
|
+
cg v2 test unit <symbol> # Generate unit tests
|
|
68
|
+
cg v2 test integration "flow" # Generate integration tests
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Code Generation
|
|
72
|
+
```bash
|
|
73
|
+
cg v2 generate "description" # Generate code
|
|
74
|
+
cg v2 generate "desc" --file ctx.py # With context file
|
|
75
|
+
cg v2 generate "desc" --output out/ # Output to directory
|
|
76
|
+
cg v2 generate "desc" --preview # Preview only
|
|
77
|
+
cg v2 generate "desc" --auto-apply # Skip confirmation
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Workflows
|
|
81
|
+
```bash
|
|
82
|
+
cg review-and-fix <file> # Review → diagnose → fix
|
|
83
|
+
cg review-and-fix <file> --apply # Auto-apply fixes
|
|
84
|
+
cg full-analysis <symbol> # Impact + graph + RAG
|
|
85
|
+
cg full-analysis <symbol> --export # With HTML export
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Chat Mode
|
|
89
|
+
```bash
|
|
90
|
+
cg chat start # Start chat session
|
|
91
|
+
cg chat start --crew # Multi-agent mode
|
|
92
|
+
cg chat start --new # Force new session
|
|
93
|
+
cg chat list # List sessions
|
|
94
|
+
cg chat delete <id> # Delete a session
|
|
95
|
+
cg chat export <id> # Export conversation
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Chat Commands (inside chat)
|
|
99
|
+
- `/exit` — Exit and save session
|
|
100
|
+
- `/clear` — Clear conversation history
|
|
101
|
+
- `/new` — Start fresh session
|
|
102
|
+
- `/help` — Show available commands
|
|
103
|
+
- `/apply` — Apply pending code proposal
|
|
104
|
+
- `/preview` — Preview pending changes
|
|
105
|
+
- `/rollback` — Rollback a file (crew mode)
|
|
106
|
+
- `/backups` — List file backups (crew mode)
|
|
107
|
+
|
|
108
|
+
## Watch Mode
|
|
109
|
+
```bash
|
|
110
|
+
cg watch # Watch current dir for changes
|
|
111
|
+
cg watch ./src # Watch specific directory
|
|
112
|
+
cg watch --interval 5 # Set debounce interval
|
|
113
|
+
cg watch --full # Full re-index on changes
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## History & Undo
|
|
117
|
+
```bash
|
|
118
|
+
cg undo # Undo last change
|
|
119
|
+
cg undo --steps 3 # Undo multiple steps
|
|
120
|
+
cg redo # Redo undone change
|
|
121
|
+
cg history show # Show change history
|
|
122
|
+
cg history clear # Clear history
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Configuration
|
|
126
|
+
```bash
|
|
127
|
+
cg config setup # Interactive setup wizard
|
|
128
|
+
cg config set-llm <provider> # Quick switch LLM
|
|
129
|
+
cg config set-llm groq -k KEY # Set Groq with API key
|
|
130
|
+
cg config show-llm # Show current LLM config
|
|
131
|
+
cg config unset-llm # Reset LLM config
|
|
132
|
+
cg config set-embedding <model> # Set embedding model
|
|
133
|
+
cg config show-embedding # Show embedding config
|
|
134
|
+
cg config unset-embedding # Reset to hash embeddings
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Debug Tools
|
|
138
|
+
```bash
|
|
139
|
+
cg debug-embed "text" # Debug embedding output
|
|
140
|
+
cg debug-rag "query" # Debug RAG retrieval
|
|
141
|
+
cg debug-context "query" # Show LLM context assembly
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Graph Export
|
|
145
|
+
```bash
|
|
146
|
+
cg export-graph # Export full graph as HTML
|
|
147
|
+
cg export-graph <symbol> # Focus on symbol
|
|
148
|
+
cg export-graph --format dot # Export as Graphviz DOT
|
|
149
|
+
cg export-graph -o graph.html # Specify output file
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Tips
|
|
153
|
+
- Use `cg <command> --help` for detailed options
|
|
154
|
+
- Watch mode: `cg watch` for auto-reindexing
|
|
155
|
+
- Health dashboard: `cg health dashboard` for quick overview
|
|
156
|
+
- Support NO_COLOR env var for plain output
|
|
157
|
+
"""
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
@docs_app.command("cheatsheet")
|
|
161
|
+
def cheatsheet(
|
|
162
|
+
output: str = typer.Option(
|
|
163
|
+
"cg-cheatsheet.md",
|
|
164
|
+
"--output",
|
|
165
|
+
"-o",
|
|
166
|
+
help="Output filename for the cheat sheet.",
|
|
167
|
+
),
|
|
168
|
+
):
|
|
169
|
+
"""📚 Generate command cheat sheet as a Markdown file.
|
|
170
|
+
|
|
171
|
+
Example:
|
|
172
|
+
cg cheatsheet
|
|
173
|
+
cg cheatsheet --output my-guide.md
|
|
174
|
+
"""
|
|
175
|
+
output_path = Path(output)
|
|
176
|
+
output_path.write_text(CHEATSHEET_CONTENT)
|
|
177
|
+
console.print(f"[green]✓[/green] Cheat sheet created: [bold]{output_path}[/bold]")
|
|
178
|
+
console.print(f"[dim]Open with: cat {output_path}[/dim]")
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
@docs_app.command("learn")
|
|
182
|
+
def learn():
|
|
183
|
+
"""🎓 Interactive learning guide.
|
|
184
|
+
|
|
185
|
+
Example:
|
|
186
|
+
cg learn
|
|
187
|
+
"""
|
|
188
|
+
console.print()
|
|
189
|
+
console.print(
|
|
190
|
+
Panel.fit(
|
|
191
|
+
"[bold cyan]🎓 CodeGraph Learning Path[/bold cyan]\n\n"
|
|
192
|
+
"[bold]Beginner (5 min)[/bold]\n"
|
|
193
|
+
" 1. cg quickstart\n"
|
|
194
|
+
" 2. cg search 'your query'\n"
|
|
195
|
+
" 3. cg chat start\n\n"
|
|
196
|
+
"[bold]Intermediate (15 min)[/bold]\n"
|
|
197
|
+
" 4. cg impact <symbol>\n"
|
|
198
|
+
" 5. cg v2 review <file>\n"
|
|
199
|
+
" 6. cg v2 generate 'description'\n\n"
|
|
200
|
+
"[bold]Advanced (30 min)[/bold]\n"
|
|
201
|
+
" 7. cg chat start --crew\n"
|
|
202
|
+
" 8. cg v2 refactor rename <old> <new>\n"
|
|
203
|
+
" 9. cg health dashboard\n\n"
|
|
204
|
+
"Run [cyan]cg cheatsheet[/cyan] for full reference",
|
|
205
|
+
border_style="blue",
|
|
206
|
+
)
|
|
207
|
+
)
|