code-guro 0.1.0__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.
- code_guro-0.1.0/PKG-INFO +303 -0
- code_guro-0.1.0/README.md +259 -0
- code_guro-0.1.0/pyproject.toml +81 -0
- code_guro-0.1.0/setup.cfg +4 -0
- code_guro-0.1.0/setup.py +4 -0
- code_guro-0.1.0/src/code_guro/__init__.py +4 -0
- code_guro-0.1.0/src/code_guro/analyzer.py +406 -0
- code_guro-0.1.0/src/code_guro/cli.py +311 -0
- code_guro-0.1.0/src/code_guro/config.py +193 -0
- code_guro-0.1.0/src/code_guro/config_test.py +129 -0
- code_guro-0.1.0/src/code_guro/errors.py +163 -0
- code_guro-0.1.0/src/code_guro/frameworks.py +411 -0
- code_guro-0.1.0/src/code_guro/frameworks_test.py +229 -0
- code_guro-0.1.0/src/code_guro/generator.py +715 -0
- code_guro-0.1.0/src/code_guro/html_converter.py +383 -0
- code_guro-0.1.0/src/code_guro/prompts.py +546 -0
- code_guro-0.1.0/src/code_guro/repl.py +221 -0
- code_guro-0.1.0/src/code_guro/utils.py +377 -0
- code_guro-0.1.0/src/code_guro/utils_test.py +206 -0
- code_guro-0.1.0/src/code_guro.egg-info/PKG-INFO +303 -0
- code_guro-0.1.0/src/code_guro.egg-info/SOURCES.txt +23 -0
- code_guro-0.1.0/src/code_guro.egg-info/dependency_links.txt +1 -0
- code_guro-0.1.0/src/code_guro.egg-info/entry_points.txt +2 -0
- code_guro-0.1.0/src/code_guro.egg-info/requires.txt +20 -0
- code_guro-0.1.0/src/code_guro.egg-info/top_level.txt +1 -0
code_guro-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code-guro
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A CLI tool to help non-technical product managers and AI-native builders understand codebases
|
|
5
|
+
Author-email: Nicola de Vera <nicola@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/nicoladevera/code-guro
|
|
8
|
+
Project-URL: Repository, https://github.com/nicoladevera/code-guro
|
|
9
|
+
Project-URL: Documentation, https://github.com/nicoladevera/code-guro#readme
|
|
10
|
+
Project-URL: Issues, https://github.com/nicoladevera/code-guro/issues
|
|
11
|
+
Keywords: cli,code-analysis,documentation,learning,ai
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Documentation
|
|
24
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
Requires-Dist: anthropic>=0.18.0
|
|
28
|
+
Requires-Dist: click>=8.0
|
|
29
|
+
Requires-Dist: rich>=13.0
|
|
30
|
+
Requires-Dist: gitpython>=3.1
|
|
31
|
+
Requires-Dist: tiktoken>=0.5.0
|
|
32
|
+
Requires-Dist: markdown>=3.4
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
38
|
+
Provides-Extra: enhanced
|
|
39
|
+
Requires-Dist: python-dotenv>=1.0; extra == "enhanced"
|
|
40
|
+
Requires-Dist: prompt_toolkit>=3.0; extra == "enhanced"
|
|
41
|
+
Requires-Dist: pygments>=2.15; extra == "enhanced"
|
|
42
|
+
Provides-Extra: all
|
|
43
|
+
Requires-Dist: code-guro[dev,enhanced]; extra == "all"
|
|
44
|
+
|
|
45
|
+
# Code Guro
|
|
46
|
+
|
|
47
|
+
A CLI tool to help non-technical product managers and AI-native builders understand codebases.
|
|
48
|
+
|
|
49
|
+
## Etymology
|
|
50
|
+
|
|
51
|
+
The name "Code Guro" is a play on two words:
|
|
52
|
+
- **"Guro"** - Tagalog (Filipino) word for "teacher"
|
|
53
|
+
- **"Guru"** - Expert or master in a particular field
|
|
54
|
+
|
|
55
|
+
This reflects the tool's purpose: to serve as both a teacher (guro) and expert guide (guru) for understanding code.
|
|
56
|
+
|
|
57
|
+
## Overview
|
|
58
|
+
|
|
59
|
+
Many product managers are now using AI coding agents (Claude Code, Cursor, etc.) to build functional prototypes and MVPs, but lack the programming background to truly understand the code that's generated. This creates hesitation when scaling products or bringing in users.
|
|
60
|
+
|
|
61
|
+
Code Guro analyzes a codebase and generates structured, beginner-friendly learning documentation. Unlike conversational AI tools that answer specific questions, Code Guro proactively creates a complete curriculum tailored to your specific codebase.
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install code-guro
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Requirements:**
|
|
70
|
+
- Python 3.8 or higher
|
|
71
|
+
- Internet connection (for Claude API calls)
|
|
72
|
+
- Claude API key from [console.anthropic.com](https://console.anthropic.com)
|
|
73
|
+
|
|
74
|
+
## Quick Start
|
|
75
|
+
|
|
76
|
+
### 1. Configure your API key
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
code-guro configure
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
You'll be prompted to enter your Claude API key. The key is stored securely in `~/.config/code-guro/config.json` with restricted file permissions.
|
|
83
|
+
|
|
84
|
+
Alternatively, you can set the `CLAUDE_API_KEY` or `ANTHROPIC_API_KEY` environment variable:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
export CLAUDE_API_KEY="your-api-key-here"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 2. Analyze a codebase
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Analyze current directory
|
|
94
|
+
code-guro analyze .
|
|
95
|
+
|
|
96
|
+
# Analyze a specific path
|
|
97
|
+
code-guro analyze /path/to/project
|
|
98
|
+
|
|
99
|
+
# Analyze from GitHub
|
|
100
|
+
code-guro analyze https://github.com/user/repo
|
|
101
|
+
|
|
102
|
+
# Generate HTML output (in addition to markdown)
|
|
103
|
+
code-guro analyze . --format html
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 3. Deep dive into specific files
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Explain a specific folder
|
|
110
|
+
code-guro explain ./src/auth
|
|
111
|
+
|
|
112
|
+
# Interactive mode for follow-up questions
|
|
113
|
+
code-guro explain ./src/auth --interactive
|
|
114
|
+
|
|
115
|
+
# Print explanation to console instead of file
|
|
116
|
+
code-guro explain ./src/auth --output console
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Output
|
|
120
|
+
|
|
121
|
+
Code Guro generates structured learning documentation in a `code-guro-output/` directory:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
code-guro-output/
|
|
125
|
+
├── 00-overview.md # Executive summary: what the app does, tech stack
|
|
126
|
+
├── 01-getting-oriented.md # File structure, extensions glossary, entry points
|
|
127
|
+
├── 02-architecture.md # Patterns, conventions, architectural decisions
|
|
128
|
+
├── 03-core-files.md # The 20% of files that matter most
|
|
129
|
+
├── 04-deep-dive-[module].md # Deep dives for each major module
|
|
130
|
+
├── 05-quality-analysis.md # What's good, what's risky, potential pitfalls
|
|
131
|
+
└── 06-next-steps.md # Suggested exploration paths, follow-up commands
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Each document includes:
|
|
135
|
+
- Beginner-friendly explanations
|
|
136
|
+
- Visual diagrams (Mermaid)
|
|
137
|
+
- Code snippets with inline comments
|
|
138
|
+
- Glossary of technical terms
|
|
139
|
+
|
|
140
|
+
## Commands
|
|
141
|
+
|
|
142
|
+
### `code-guro configure`
|
|
143
|
+
|
|
144
|
+
Set up your Claude API key for first-time use.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
code-guro configure
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### `code-guro analyze <path>`
|
|
151
|
+
|
|
152
|
+
Analyze a codebase and generate documentation.
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
code-guro analyze . # Current directory
|
|
156
|
+
code-guro analyze /path/to/project # Specific path
|
|
157
|
+
code-guro analyze https://github.com/user/repo # GitHub URL
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Options:**
|
|
161
|
+
- `--format [markdown|html]` - Output format (default: markdown)
|
|
162
|
+
|
|
163
|
+
### `code-guro explain <path>`
|
|
164
|
+
|
|
165
|
+
Get a detailed explanation of a specific file or folder.
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
code-guro explain ./src/auth # Analyze a folder
|
|
169
|
+
code-guro explain ./src/app.py # Analyze a single file
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Options:**
|
|
173
|
+
- `-i, --interactive` - Launch interactive Q&A mode
|
|
174
|
+
- `--output [file|console]` - Where to output (default: file)
|
|
175
|
+
|
|
176
|
+
### `code-guro --version`
|
|
177
|
+
|
|
178
|
+
Display the current version.
|
|
179
|
+
|
|
180
|
+
### `code-guro --help`
|
|
181
|
+
|
|
182
|
+
Show help information.
|
|
183
|
+
|
|
184
|
+
## Supported Frameworks
|
|
185
|
+
|
|
186
|
+
Code Guro provides enhanced context for these frameworks:
|
|
187
|
+
|
|
188
|
+
| Framework | Detection Method |
|
|
189
|
+
|-----------|-----------------|
|
|
190
|
+
| **Next.js** | `package.json` with "next", `next.config.js` |
|
|
191
|
+
| **React** | `package.json` with "react", `.jsx/.tsx` files |
|
|
192
|
+
| **Vue.js** | `package.json` with "vue", `.vue` files |
|
|
193
|
+
| **Django** | `requirements.txt` with "Django", `manage.py` |
|
|
194
|
+
| **Flask** | `requirements.txt` with "Flask", `app.py` patterns |
|
|
195
|
+
| **Express.js** | `package.json` with "express" |
|
|
196
|
+
| **Ruby on Rails** | `Gemfile` with "rails", `config/routes.rb` |
|
|
197
|
+
|
|
198
|
+
When a framework is detected, the documentation includes:
|
|
199
|
+
- Framework-specific architecture patterns
|
|
200
|
+
- Common conventions and best practices
|
|
201
|
+
- Known gotchas and pitfalls
|
|
202
|
+
|
|
203
|
+
## Cost Estimation
|
|
204
|
+
|
|
205
|
+
Code Guro estimates API costs before running analysis based on:
|
|
206
|
+
- Token count of files to analyze
|
|
207
|
+
- Current Claude API pricing (~$3/million input tokens, ~$15/million output tokens)
|
|
208
|
+
|
|
209
|
+
**Cost confirmation:**
|
|
210
|
+
- For estimates under $1.00: Proceeds automatically
|
|
211
|
+
- For estimates over $1.00: Asks for confirmation before continuing
|
|
212
|
+
|
|
213
|
+
Typical costs:
|
|
214
|
+
- Small project (10-50 files): $0.05 - $0.30
|
|
215
|
+
- Medium project (50-200 files): $0.30 - $1.00
|
|
216
|
+
- Large project (200+ files): $1.00 - $5.00
|
|
217
|
+
|
|
218
|
+
## Interactive Mode
|
|
219
|
+
|
|
220
|
+
The `--interactive` flag launches a conversational Q&A session:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
code-guro explain ./src/auth --interactive
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
You can ask questions like:
|
|
227
|
+
- "Why was this pattern used?"
|
|
228
|
+
- "What does this function do?"
|
|
229
|
+
- "How does this connect to the database?"
|
|
230
|
+
- "What would happen if I changed X?"
|
|
231
|
+
|
|
232
|
+
Type `exit` or `quit` to end the session. Your conversation is saved to `code-guro-output/explain-[path]-session.md`.
|
|
233
|
+
|
|
234
|
+
## Troubleshooting
|
|
235
|
+
|
|
236
|
+
### "No API key configured"
|
|
237
|
+
|
|
238
|
+
Run `code-guro configure` to set up your API key, or set the `CLAUDE_API_KEY` environment variable.
|
|
239
|
+
|
|
240
|
+
### "No internet connection detected"
|
|
241
|
+
|
|
242
|
+
Code Guro requires an internet connection for Claude API calls and GitHub cloning. Check your network connection.
|
|
243
|
+
|
|
244
|
+
### "Estimated cost exceeds $1.00"
|
|
245
|
+
|
|
246
|
+
For large codebases, you'll be asked to confirm before proceeding. You can:
|
|
247
|
+
- Enter `y` to continue
|
|
248
|
+
- Enter `n` to cancel
|
|
249
|
+
- Try analyzing a specific subdirectory instead
|
|
250
|
+
|
|
251
|
+
### "File too large to analyze"
|
|
252
|
+
|
|
253
|
+
Files larger than 1MB are skipped to avoid excessive API costs. This is typically fine since large files are often generated code, dependencies, or data files.
|
|
254
|
+
|
|
255
|
+
### GitHub clone failures
|
|
256
|
+
|
|
257
|
+
Ensure the repository URL is correct and the repository is public. Private repositories are not currently supported.
|
|
258
|
+
|
|
259
|
+
## Development
|
|
260
|
+
|
|
261
|
+
### Setup
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Clone the repository
|
|
265
|
+
git clone https://github.com/nicoladevera/code-guro.git
|
|
266
|
+
cd code-guro
|
|
267
|
+
|
|
268
|
+
# Create virtual environment
|
|
269
|
+
python3 -m venv venv
|
|
270
|
+
source venv/bin/activate
|
|
271
|
+
|
|
272
|
+
# Install in development mode
|
|
273
|
+
pip install -e ".[dev]"
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Running Tests
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
pytest
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Code Formatting
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
black src/
|
|
286
|
+
ruff check src/
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
MIT
|
|
292
|
+
|
|
293
|
+
## Contributing
|
|
294
|
+
|
|
295
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
296
|
+
|
|
297
|
+
## Acknowledgments
|
|
298
|
+
|
|
299
|
+
Built with:
|
|
300
|
+
- [Anthropic Claude API](https://www.anthropic.com/)
|
|
301
|
+
- [Click](https://click.palletsprojects.com/) - CLI framework
|
|
302
|
+
- [Rich](https://rich.readthedocs.io/) - Terminal formatting
|
|
303
|
+
- [tiktoken](https://github.com/openai/tiktoken) - Token counting
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Code Guro
|
|
2
|
+
|
|
3
|
+
A CLI tool to help non-technical product managers and AI-native builders understand codebases.
|
|
4
|
+
|
|
5
|
+
## Etymology
|
|
6
|
+
|
|
7
|
+
The name "Code Guro" is a play on two words:
|
|
8
|
+
- **"Guro"** - Tagalog (Filipino) word for "teacher"
|
|
9
|
+
- **"Guru"** - Expert or master in a particular field
|
|
10
|
+
|
|
11
|
+
This reflects the tool's purpose: to serve as both a teacher (guro) and expert guide (guru) for understanding code.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Many product managers are now using AI coding agents (Claude Code, Cursor, etc.) to build functional prototypes and MVPs, but lack the programming background to truly understand the code that's generated. This creates hesitation when scaling products or bringing in users.
|
|
16
|
+
|
|
17
|
+
Code Guro analyzes a codebase and generates structured, beginner-friendly learning documentation. Unlike conversational AI tools that answer specific questions, Code Guro proactively creates a complete curriculum tailored to your specific codebase.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install code-guro
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Requirements:**
|
|
26
|
+
- Python 3.8 or higher
|
|
27
|
+
- Internet connection (for Claude API calls)
|
|
28
|
+
- Claude API key from [console.anthropic.com](https://console.anthropic.com)
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### 1. Configure your API key
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
code-guro configure
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
You'll be prompted to enter your Claude API key. The key is stored securely in `~/.config/code-guro/config.json` with restricted file permissions.
|
|
39
|
+
|
|
40
|
+
Alternatively, you can set the `CLAUDE_API_KEY` or `ANTHROPIC_API_KEY` environment variable:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
export CLAUDE_API_KEY="your-api-key-here"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Analyze a codebase
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Analyze current directory
|
|
50
|
+
code-guro analyze .
|
|
51
|
+
|
|
52
|
+
# Analyze a specific path
|
|
53
|
+
code-guro analyze /path/to/project
|
|
54
|
+
|
|
55
|
+
# Analyze from GitHub
|
|
56
|
+
code-guro analyze https://github.com/user/repo
|
|
57
|
+
|
|
58
|
+
# Generate HTML output (in addition to markdown)
|
|
59
|
+
code-guro analyze . --format html
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. Deep dive into specific files
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Explain a specific folder
|
|
66
|
+
code-guro explain ./src/auth
|
|
67
|
+
|
|
68
|
+
# Interactive mode for follow-up questions
|
|
69
|
+
code-guro explain ./src/auth --interactive
|
|
70
|
+
|
|
71
|
+
# Print explanation to console instead of file
|
|
72
|
+
code-guro explain ./src/auth --output console
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Output
|
|
76
|
+
|
|
77
|
+
Code Guro generates structured learning documentation in a `code-guro-output/` directory:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
code-guro-output/
|
|
81
|
+
├── 00-overview.md # Executive summary: what the app does, tech stack
|
|
82
|
+
├── 01-getting-oriented.md # File structure, extensions glossary, entry points
|
|
83
|
+
├── 02-architecture.md # Patterns, conventions, architectural decisions
|
|
84
|
+
├── 03-core-files.md # The 20% of files that matter most
|
|
85
|
+
├── 04-deep-dive-[module].md # Deep dives for each major module
|
|
86
|
+
├── 05-quality-analysis.md # What's good, what's risky, potential pitfalls
|
|
87
|
+
└── 06-next-steps.md # Suggested exploration paths, follow-up commands
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Each document includes:
|
|
91
|
+
- Beginner-friendly explanations
|
|
92
|
+
- Visual diagrams (Mermaid)
|
|
93
|
+
- Code snippets with inline comments
|
|
94
|
+
- Glossary of technical terms
|
|
95
|
+
|
|
96
|
+
## Commands
|
|
97
|
+
|
|
98
|
+
### `code-guro configure`
|
|
99
|
+
|
|
100
|
+
Set up your Claude API key for first-time use.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
code-guro configure
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `code-guro analyze <path>`
|
|
107
|
+
|
|
108
|
+
Analyze a codebase and generate documentation.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
code-guro analyze . # Current directory
|
|
112
|
+
code-guro analyze /path/to/project # Specific path
|
|
113
|
+
code-guro analyze https://github.com/user/repo # GitHub URL
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Options:**
|
|
117
|
+
- `--format [markdown|html]` - Output format (default: markdown)
|
|
118
|
+
|
|
119
|
+
### `code-guro explain <path>`
|
|
120
|
+
|
|
121
|
+
Get a detailed explanation of a specific file or folder.
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
code-guro explain ./src/auth # Analyze a folder
|
|
125
|
+
code-guro explain ./src/app.py # Analyze a single file
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Options:**
|
|
129
|
+
- `-i, --interactive` - Launch interactive Q&A mode
|
|
130
|
+
- `--output [file|console]` - Where to output (default: file)
|
|
131
|
+
|
|
132
|
+
### `code-guro --version`
|
|
133
|
+
|
|
134
|
+
Display the current version.
|
|
135
|
+
|
|
136
|
+
### `code-guro --help`
|
|
137
|
+
|
|
138
|
+
Show help information.
|
|
139
|
+
|
|
140
|
+
## Supported Frameworks
|
|
141
|
+
|
|
142
|
+
Code Guro provides enhanced context for these frameworks:
|
|
143
|
+
|
|
144
|
+
| Framework | Detection Method |
|
|
145
|
+
|-----------|-----------------|
|
|
146
|
+
| **Next.js** | `package.json` with "next", `next.config.js` |
|
|
147
|
+
| **React** | `package.json` with "react", `.jsx/.tsx` files |
|
|
148
|
+
| **Vue.js** | `package.json` with "vue", `.vue` files |
|
|
149
|
+
| **Django** | `requirements.txt` with "Django", `manage.py` |
|
|
150
|
+
| **Flask** | `requirements.txt` with "Flask", `app.py` patterns |
|
|
151
|
+
| **Express.js** | `package.json` with "express" |
|
|
152
|
+
| **Ruby on Rails** | `Gemfile` with "rails", `config/routes.rb` |
|
|
153
|
+
|
|
154
|
+
When a framework is detected, the documentation includes:
|
|
155
|
+
- Framework-specific architecture patterns
|
|
156
|
+
- Common conventions and best practices
|
|
157
|
+
- Known gotchas and pitfalls
|
|
158
|
+
|
|
159
|
+
## Cost Estimation
|
|
160
|
+
|
|
161
|
+
Code Guro estimates API costs before running analysis based on:
|
|
162
|
+
- Token count of files to analyze
|
|
163
|
+
- Current Claude API pricing (~$3/million input tokens, ~$15/million output tokens)
|
|
164
|
+
|
|
165
|
+
**Cost confirmation:**
|
|
166
|
+
- For estimates under $1.00: Proceeds automatically
|
|
167
|
+
- For estimates over $1.00: Asks for confirmation before continuing
|
|
168
|
+
|
|
169
|
+
Typical costs:
|
|
170
|
+
- Small project (10-50 files): $0.05 - $0.30
|
|
171
|
+
- Medium project (50-200 files): $0.30 - $1.00
|
|
172
|
+
- Large project (200+ files): $1.00 - $5.00
|
|
173
|
+
|
|
174
|
+
## Interactive Mode
|
|
175
|
+
|
|
176
|
+
The `--interactive` flag launches a conversational Q&A session:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
code-guro explain ./src/auth --interactive
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
You can ask questions like:
|
|
183
|
+
- "Why was this pattern used?"
|
|
184
|
+
- "What does this function do?"
|
|
185
|
+
- "How does this connect to the database?"
|
|
186
|
+
- "What would happen if I changed X?"
|
|
187
|
+
|
|
188
|
+
Type `exit` or `quit` to end the session. Your conversation is saved to `code-guro-output/explain-[path]-session.md`.
|
|
189
|
+
|
|
190
|
+
## Troubleshooting
|
|
191
|
+
|
|
192
|
+
### "No API key configured"
|
|
193
|
+
|
|
194
|
+
Run `code-guro configure` to set up your API key, or set the `CLAUDE_API_KEY` environment variable.
|
|
195
|
+
|
|
196
|
+
### "No internet connection detected"
|
|
197
|
+
|
|
198
|
+
Code Guro requires an internet connection for Claude API calls and GitHub cloning. Check your network connection.
|
|
199
|
+
|
|
200
|
+
### "Estimated cost exceeds $1.00"
|
|
201
|
+
|
|
202
|
+
For large codebases, you'll be asked to confirm before proceeding. You can:
|
|
203
|
+
- Enter `y` to continue
|
|
204
|
+
- Enter `n` to cancel
|
|
205
|
+
- Try analyzing a specific subdirectory instead
|
|
206
|
+
|
|
207
|
+
### "File too large to analyze"
|
|
208
|
+
|
|
209
|
+
Files larger than 1MB are skipped to avoid excessive API costs. This is typically fine since large files are often generated code, dependencies, or data files.
|
|
210
|
+
|
|
211
|
+
### GitHub clone failures
|
|
212
|
+
|
|
213
|
+
Ensure the repository URL is correct and the repository is public. Private repositories are not currently supported.
|
|
214
|
+
|
|
215
|
+
## Development
|
|
216
|
+
|
|
217
|
+
### Setup
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Clone the repository
|
|
221
|
+
git clone https://github.com/nicoladevera/code-guro.git
|
|
222
|
+
cd code-guro
|
|
223
|
+
|
|
224
|
+
# Create virtual environment
|
|
225
|
+
python3 -m venv venv
|
|
226
|
+
source venv/bin/activate
|
|
227
|
+
|
|
228
|
+
# Install in development mode
|
|
229
|
+
pip install -e ".[dev]"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Running Tests
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
pytest
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Code Formatting
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
black src/
|
|
242
|
+
ruff check src/
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
MIT
|
|
248
|
+
|
|
249
|
+
## Contributing
|
|
250
|
+
|
|
251
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
252
|
+
|
|
253
|
+
## Acknowledgments
|
|
254
|
+
|
|
255
|
+
Built with:
|
|
256
|
+
- [Anthropic Claude API](https://www.anthropic.com/)
|
|
257
|
+
- [Click](https://click.palletsprojects.com/) - CLI framework
|
|
258
|
+
- [Rich](https://rich.readthedocs.io/) - Terminal formatting
|
|
259
|
+
- [tiktoken](https://github.com/openai/tiktoken) - Token counting
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "code-guro"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A CLI tool to help non-technical product managers and AI-native builders understand codebases"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Nicola de Vera", email = "nicola@example.com"}
|
|
13
|
+
]
|
|
14
|
+
keywords = ["cli", "code-analysis", "documentation", "learning", "ai"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.8",
|
|
23
|
+
"Programming Language :: Python :: 3.9",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Topic :: Documentation",
|
|
28
|
+
"Topic :: Software Development :: Documentation",
|
|
29
|
+
]
|
|
30
|
+
requires-python = ">=3.8"
|
|
31
|
+
dependencies = [
|
|
32
|
+
"anthropic>=0.18.0",
|
|
33
|
+
"click>=8.0",
|
|
34
|
+
"rich>=13.0",
|
|
35
|
+
"gitpython>=3.1",
|
|
36
|
+
"tiktoken>=0.5.0",
|
|
37
|
+
"markdown>=3.4",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
dev = [
|
|
42
|
+
"pytest>=7.0",
|
|
43
|
+
"pytest-cov>=4.0",
|
|
44
|
+
"black>=23.0",
|
|
45
|
+
"ruff>=0.1.0",
|
|
46
|
+
]
|
|
47
|
+
enhanced = [
|
|
48
|
+
"python-dotenv>=1.0",
|
|
49
|
+
"prompt_toolkit>=3.0",
|
|
50
|
+
"pygments>=2.15",
|
|
51
|
+
]
|
|
52
|
+
all = [
|
|
53
|
+
"code-guro[dev,enhanced]",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[project.scripts]
|
|
57
|
+
code-guro = "code_guro.cli:main"
|
|
58
|
+
|
|
59
|
+
[project.urls]
|
|
60
|
+
Homepage = "https://github.com/nicoladevera/code-guro"
|
|
61
|
+
Repository = "https://github.com/nicoladevera/code-guro"
|
|
62
|
+
Documentation = "https://github.com/nicoladevera/code-guro#readme"
|
|
63
|
+
Issues = "https://github.com/nicoladevera/code-guro/issues"
|
|
64
|
+
|
|
65
|
+
[tool.setuptools.packages.find]
|
|
66
|
+
where = ["src"]
|
|
67
|
+
|
|
68
|
+
[tool.pytest.ini_options]
|
|
69
|
+
testpaths = ["src", "tests"]
|
|
70
|
+
python_files = ["*test*.py", "test_*.py"]
|
|
71
|
+
addopts = "-v --tb=short"
|
|
72
|
+
|
|
73
|
+
[tool.black]
|
|
74
|
+
line-length = 100
|
|
75
|
+
target-version = ["py38"]
|
|
76
|
+
|
|
77
|
+
[tool.ruff]
|
|
78
|
+
line-length = 100
|
|
79
|
+
target-version = "py38"
|
|
80
|
+
select = ["E", "F", "W", "I", "UP", "B", "C4"]
|
|
81
|
+
ignore = ["E501"]
|
code_guro-0.1.0/setup.py
ADDED