code-compass-cli 0.1.0__tar.gz → 0.1.1__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_compass_cli-0.1.1/PKG-INFO +741 -0
- code_compass_cli-0.1.1/README.md +696 -0
- code_compass_cli-0.1.1/code_compass_cli.egg-info/PKG-INFO +741 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/pyproject.toml +1 -1
- code_compass_cli-0.1.0/PKG-INFO +0 -46
- code_compass_cli-0.1.0/README.md +0 -1
- code_compass_cli-0.1.0/code_compass_cli.egg-info/PKG-INFO +0 -46
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/SUBMISSION.md +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/code_compass_cli.egg-info/SOURCES.txt +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/code_compass_cli.egg-info/dependency_links.txt +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/code_compass_cli.egg-info/entry_points.txt +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/code_compass_cli.egg-info/requires.txt +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/code_compass_cli.egg-info/top_level.txt +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/docs/ARCHITECTURE.md +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/docs/README.md +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/docs/SETUP.md +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/requirements.txt +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/setup.cfg +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/setup.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/__init__.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/__pycache__/__init__.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/cli/__init__.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/cli/__pycache__/__init__.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/cli/__pycache__/main.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/cli/main.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/docs/__init__.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/docs/__pycache__/__init__.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/docs/__pycache__/doc_generator.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/docs/doc_generator.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/quality/__init__.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/quality/__pycache__/__init__.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/quality/__pycache__/analyzer.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/quality/analyzer.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/query/__init__.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/query/__pycache__/__init__.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/query/__pycache__/copilot_query.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/query/copilot_query.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/scanner/__init__.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/scanner/__pycache__/__init__.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/scanner/__pycache__/repo_scanner.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/scanner/repo_scanner.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/visualizer/__init__.py +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/visualizer/__pycache__/__init__.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/visualizer/__pycache__/flow_tracer.cpython-313.pyc +0 -0
- {code_compass_cli-0.1.0 → code_compass_cli-0.1.1}/src/visualizer/flow_tracer.py +0 -0
|
@@ -0,0 +1,741 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code-compass-cli
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A Python CLI tool for intelligent code analysis and navigation
|
|
5
|
+
Home-page: https://github.com/techwhiz/code-compass
|
|
6
|
+
Author: CodeCompass Team
|
|
7
|
+
Author-email: CodeCompass Team <support@codecompass.dev>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/techwhiz/code-compass
|
|
10
|
+
Project-URL: Documentation, https://github.com/techwhiz/code-compass#readme
|
|
11
|
+
Project-URL: Repository, https://github.com/techwhiz/code-compass
|
|
12
|
+
Project-URL: Bug Tracker, https://github.com/techwhiz/code-compass/issues
|
|
13
|
+
Keywords: code-analysis,code-navigation,code-quality,static-analysis,cli,python,security,performance
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Natural Language :: English
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Classifier: Topic :: Utilities
|
|
29
|
+
Requires-Python: >=3.7
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
Requires-Dist: click>=8.1.0
|
|
32
|
+
Requires-Dist: rich>=13.0.0
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=3.0; extra == "dev"
|
|
36
|
+
Requires-Dist: flake8>=4.0; extra == "dev"
|
|
37
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy>=0.950; extra == "dev"
|
|
39
|
+
Provides-Extra: docs
|
|
40
|
+
Requires-Dist: sphinx>=4.0; extra == "docs"
|
|
41
|
+
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
|
|
42
|
+
Dynamic: author
|
|
43
|
+
Dynamic: home-page
|
|
44
|
+
Dynamic: requires-python
|
|
45
|
+
|
|
46
|
+
# CodeCompass CLI
|
|
47
|
+
|
|
48
|
+
<div align="center">
|
|
49
|
+
|
|
50
|
+
[](https://www.python.org/downloads/)
|
|
51
|
+
[](LICENSE)
|
|
52
|
+
[](https://github.com/techwhiz/code-compass)
|
|
53
|
+
|
|
54
|
+
A powerful Python CLI tool for intelligent code analysis, navigation, and documentation. Navigate and understand your codebase with ease using natural language queries, execution flow tracing, and comprehensive code quality analysis.
|
|
55
|
+
|
|
56
|
+
[Features](#features) • [Installation](#installation) • [Quick Start](#quick-start) • [Documentation](#documentation) • [Contributing](#contributing)
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Overview
|
|
63
|
+
|
|
64
|
+
CodeCompass is an intelligent code analysis and navigation CLI tool designed to help developers quickly understand, analyze, and document their codebases. Whether you're onboarding to a new project, performing code reviews, or optimizing performance, CodeCompass provides powerful tools to navigate and inspect code efficiently.
|
|
65
|
+
|
|
66
|
+
### Key Benefits
|
|
67
|
+
|
|
68
|
+
- 🔍 **Quick Navigation**: Scan and visualize repository structures instantly
|
|
69
|
+
- 🤖 **AI-Powered Q&A**: Ask natural language questions about your code
|
|
70
|
+
- 🛡️ **Security Analysis**: Detect vulnerabilities, exposed secrets, and XSS risks
|
|
71
|
+
- ⚡ **Performance Insights**: Identify N+1 queries, nested loops, and bottlenecks
|
|
72
|
+
- 📊 **Code Quality Metrics**: Catch code smells, duplicates, and design issues
|
|
73
|
+
- 🔄 **Execution Flow Tracing**: Visualize function call chains and dependencies
|
|
74
|
+
- 📚 **Auto Documentation**: Generate comprehensive project documentation
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Features
|
|
79
|
+
|
|
80
|
+
### 1. **Repository Scanner** (`scan`)
|
|
81
|
+
Quickly scan and visualize your entire repository structure with a beautiful tree view.
|
|
82
|
+
|
|
83
|
+
- Displays directory tree with file counts
|
|
84
|
+
- Intelligent exclusion of build artifacts, virtual environments, and cache directories
|
|
85
|
+
- Supports projects of any size
|
|
86
|
+
- Real-time progress feedback
|
|
87
|
+
|
|
88
|
+
### 2. **AI-Powered Query Engine** (`query`)
|
|
89
|
+
Ask natural language questions about your codebase and get intelligent results.
|
|
90
|
+
|
|
91
|
+
- Function/class definition search
|
|
92
|
+
- Import and dependency analysis
|
|
93
|
+
- Keyword-based code search
|
|
94
|
+
- General code queries with smart routing
|
|
95
|
+
- Supports 14+ programming languages (Python, JavaScript, TypeScript, Java, C++, Go, Rust, PHP, Ruby, Swift, Kotlin, and more)
|
|
96
|
+
|
|
97
|
+
### 3. **Code Quality Analyzer** (`analyze`)
|
|
98
|
+
Comprehensive static analysis with three categories of findings:
|
|
99
|
+
|
|
100
|
+
**Security Issues**
|
|
101
|
+
- SQL injection detection
|
|
102
|
+
- Exposed API keys and secrets
|
|
103
|
+
- XSS vulnerabilities
|
|
104
|
+
- Hardcoded credentials
|
|
105
|
+
|
|
106
|
+
**Performance Issues**
|
|
107
|
+
- N+1 query pattern detection
|
|
108
|
+
- Inefficient loop identification
|
|
109
|
+
- Nested loop warnings
|
|
110
|
+
|
|
111
|
+
**Code Smells**
|
|
112
|
+
- Long function detection (30+ lines)
|
|
113
|
+
- Large class identification (50+ lines)
|
|
114
|
+
- Duplicate code detection
|
|
115
|
+
- Code structure violations
|
|
116
|
+
|
|
117
|
+
### 4. **Execution Flow Tracer** (`trace`)
|
|
118
|
+
Visualize execution paths and function call chains with dependency mapping.
|
|
119
|
+
|
|
120
|
+
- Entry point-based flow visualization
|
|
121
|
+
- Multi-level call chain tracing
|
|
122
|
+
- File and line number references
|
|
123
|
+
- Not-found detection for incomplete chains
|
|
124
|
+
|
|
125
|
+
### 5. **Documentation Generator** (`gendocs`)
|
|
126
|
+
Auto-generate comprehensive project documentation from your codebase.
|
|
127
|
+
|
|
128
|
+
- Project README generation
|
|
129
|
+
- Architecture documentation
|
|
130
|
+
- Setup and installation guides
|
|
131
|
+
- Module and function documentation
|
|
132
|
+
- Generates files to `docs/` directory
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Installation
|
|
137
|
+
|
|
138
|
+
### Prerequisites
|
|
139
|
+
|
|
140
|
+
- Python 3.7 or higher
|
|
141
|
+
- pip (Python package manager)
|
|
142
|
+
- GitHub Copilot CLI (for enhanced query capabilities)
|
|
143
|
+
|
|
144
|
+
### Via pipx
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
pipx install code-compass-cli
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Verify Installation
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
codecompass --version
|
|
154
|
+
codecompass --help
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Quick Start
|
|
160
|
+
|
|
161
|
+
### Basic Usage
|
|
162
|
+
|
|
163
|
+
CodeCompass is invoked via the `codecompass` command with five main subcommands:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Display all available commands
|
|
167
|
+
codecompass --help
|
|
168
|
+
|
|
169
|
+
# Show version
|
|
170
|
+
codecompass --version
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Usage Examples
|
|
176
|
+
|
|
177
|
+
### 1. Scan Repository Structure
|
|
178
|
+
|
|
179
|
+
Analyze the structure of your project and visualize the directory tree.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Scan current directory
|
|
183
|
+
codecompass scan
|
|
184
|
+
|
|
185
|
+
# Scan a specific directory
|
|
186
|
+
codecompass scan /path/to/project
|
|
187
|
+
|
|
188
|
+
# Scan a subdirectory
|
|
189
|
+
codecompass scan ./src
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Output Example:**
|
|
193
|
+
```
|
|
194
|
+
╭───────────────────────────────────╮
|
|
195
|
+
│ CodeCompass Repository Scan │
|
|
196
|
+
╰───────────────────────────────────╯
|
|
197
|
+
Path: /home/user/myproject
|
|
198
|
+
Files found: 42
|
|
199
|
+
Directories: 12
|
|
200
|
+
|
|
201
|
+
📁 myproject
|
|
202
|
+
├── 📂 src
|
|
203
|
+
│ ├── 🐍 main.py
|
|
204
|
+
│ ├── 🐍 utils.py
|
|
205
|
+
│ └── 📂 modules
|
|
206
|
+
│ └── 🐍 handler.py
|
|
207
|
+
├── 📂 tests
|
|
208
|
+
│ ├── 🐍 test_main.py
|
|
209
|
+
│ └── 🐍 test_utils.py
|
|
210
|
+
├── 📝 README.md
|
|
211
|
+
└── 📋 requirements.txt
|
|
212
|
+
|
|
213
|
+
✓ Scan completed successfully
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### 2. Query Code with Natural Language
|
|
219
|
+
|
|
220
|
+
Ask questions about your codebase in plain English.
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Find functions or classes
|
|
224
|
+
codecompass query "find the main function"
|
|
225
|
+
codecompass query "where is the User class defined"
|
|
226
|
+
|
|
227
|
+
# Search for imports and dependencies
|
|
228
|
+
codecompass query "what imports are used for database"
|
|
229
|
+
codecompass query "find all Flask dependencies"
|
|
230
|
+
|
|
231
|
+
# General code search
|
|
232
|
+
codecompass query "locate authentication handler"
|
|
233
|
+
codecompass query "search for error handling code"
|
|
234
|
+
|
|
235
|
+
# Search in specific directory
|
|
236
|
+
codecompass query "find API endpoints" ./src/api
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Output Example:**
|
|
240
|
+
```
|
|
241
|
+
╭────────────────────╮
|
|
242
|
+
│ CodeCompass Query │
|
|
243
|
+
╰────────────────────╯
|
|
244
|
+
Query: find the database handler
|
|
245
|
+
Path: .
|
|
246
|
+
|
|
247
|
+
✓ Results found:
|
|
248
|
+
|
|
249
|
+
[1] src/db/handler.py (Function/Class definition)
|
|
250
|
+
Keyword: handler
|
|
251
|
+
Definitions:
|
|
252
|
+
function at line 15
|
|
253
|
+
DatabaseHandler
|
|
254
|
+
def __init__(self, config: Dict)...
|
|
255
|
+
function at line 23
|
|
256
|
+
execute_query
|
|
257
|
+
def execute_query(self, sql: str)...
|
|
258
|
+
|
|
259
|
+
Found 1 file(s) with relevant code content.
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
### 3. Analyze Code Quality
|
|
265
|
+
|
|
266
|
+
Detect security vulnerabilities, performance issues, and code smells.
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Analyze current directory
|
|
270
|
+
codecompass analyze
|
|
271
|
+
|
|
272
|
+
# Analyze specific path
|
|
273
|
+
codecompass analyze /path/to/project
|
|
274
|
+
|
|
275
|
+
# Analyze a single file's directory
|
|
276
|
+
codecompass analyze ./src
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Output Example:**
|
|
280
|
+
```
|
|
281
|
+
╭─────────────────────────────────╮
|
|
282
|
+
│ CodeCompass Quality Analysis │
|
|
283
|
+
╰─────────────────────────────────╯
|
|
284
|
+
Path: .
|
|
285
|
+
|
|
286
|
+
Analysis Results:
|
|
287
|
+
🔴 Critical: 2
|
|
288
|
+
🟡 Warnings: 5
|
|
289
|
+
🔵 Info: 12
|
|
290
|
+
Total Issues: 19
|
|
291
|
+
|
|
292
|
+
━ CRITICAL ISSUES ━
|
|
293
|
+
|
|
294
|
+
1. SECURITY [bold red]SQL Injection Risk[/bold red]
|
|
295
|
+
📄 src/db.py:45
|
|
296
|
+
query(f"SELECT * FROM users WHERE id={user_id}")
|
|
297
|
+
💡 Suggestion: Use parameterized queries/prepared statements
|
|
298
|
+
|
|
299
|
+
2. SECURITY [bold red]Exposed Secret[/bold red]
|
|
300
|
+
📄 src/config.py:12
|
|
301
|
+
api_key = "sk_live_abc123xyz789"
|
|
302
|
+
💡 Suggestion: Move secrets to environment variables
|
|
303
|
+
|
|
304
|
+
━ WARNINGS ━
|
|
305
|
+
|
|
306
|
+
1. PERFORMANCE [yellow]Potential N+1 Query Problem[/yellow]
|
|
307
|
+
📄 src/service.py:78
|
|
308
|
+
for user in users: ...
|
|
309
|
+
💡 Suggestion: Consider using batch queries or joins
|
|
310
|
+
|
|
311
|
+
...
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
### 4. Trace Execution Flow
|
|
317
|
+
|
|
318
|
+
Visualize how functions call each other and trace execution paths.
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# Trace a function from current directory
|
|
322
|
+
codecompass trace "main"
|
|
323
|
+
|
|
324
|
+
# Trace a method in a specific path
|
|
325
|
+
codecompass trace "database_query" ./src
|
|
326
|
+
|
|
327
|
+
# Trace a class method
|
|
328
|
+
codecompass trace "User.authenticate"
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**Output Example:**
|
|
332
|
+
```
|
|
333
|
+
╭────────────────────────────╮
|
|
334
|
+
│ CodeCompass Flow Trace │
|
|
335
|
+
╰────────────────────────────╯
|
|
336
|
+
Entry Point: handle_request
|
|
337
|
+
Path: .
|
|
338
|
+
|
|
339
|
+
✓ Execution flow traced:
|
|
340
|
+
|
|
341
|
+
handle_request
|
|
342
|
+
├── validate_input
|
|
343
|
+
│ ├── check_type
|
|
344
|
+
│ └── check_length
|
|
345
|
+
├── process_data
|
|
346
|
+
│ ├── parse_json
|
|
347
|
+
│ └── transform
|
|
348
|
+
└── save_result
|
|
349
|
+
└── write_database
|
|
350
|
+
└── execute_query
|
|
351
|
+
|
|
352
|
+
Total function calls: 8
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
### 5. Generate Documentation
|
|
358
|
+
|
|
359
|
+
Automatically create comprehensive project documentation.
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Generate documentation for current project
|
|
363
|
+
codecompass gendocs
|
|
364
|
+
|
|
365
|
+
# Generate documentation for specific path
|
|
366
|
+
codecompass gendocs /path/to/project
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**Output Example:**
|
|
370
|
+
```
|
|
371
|
+
╭──────────────────────────────────────╮
|
|
372
|
+
│ CodeCompass Documentation Generator │
|
|
373
|
+
╰──────────────────────────────────────╯
|
|
374
|
+
Path: .
|
|
375
|
+
|
|
376
|
+
Generating documentation...
|
|
377
|
+
|
|
378
|
+
✓ Documentation generated successfully!
|
|
379
|
+
|
|
380
|
+
Generated Files:
|
|
381
|
+
✓ README.md (2,450 bytes)
|
|
382
|
+
✓ ARCHITECTURE.md (5,120 bytes)
|
|
383
|
+
✓ SETUP.md (1,890 bytes)
|
|
384
|
+
|
|
385
|
+
📁 Location: /home/user/myproject/docs
|
|
386
|
+
|
|
387
|
+
File Descriptions:
|
|
388
|
+
• README.md
|
|
389
|
+
Project overview, features, and quick start guide
|
|
390
|
+
• ARCHITECTURE.md
|
|
391
|
+
Detailed architecture, module descriptions, and data flow diagrams
|
|
392
|
+
• SETUP.md
|
|
393
|
+
Installation instructions for different operating systems
|
|
394
|
+
|
|
395
|
+
Next Steps:
|
|
396
|
+
• Review the generated documentation in: docs/
|
|
397
|
+
• Use the documentation for onboarding and reference
|
|
398
|
+
• Share with team members for project understanding
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Requirements
|
|
404
|
+
|
|
405
|
+
### Core Dependencies
|
|
406
|
+
|
|
407
|
+
- **click** (≥8.1.0) - Command-line interface toolkit
|
|
408
|
+
- **rich** (≥13.0.0) - Beautiful terminal output and formatting
|
|
409
|
+
|
|
410
|
+
### Optional Dependencies
|
|
411
|
+
|
|
412
|
+
**Development:**
|
|
413
|
+
```
|
|
414
|
+
pytest>=7.0
|
|
415
|
+
pytest-cov>=3.0
|
|
416
|
+
flake8>=4.0
|
|
417
|
+
black>=22.0
|
|
418
|
+
mypy>=0.950
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**Documentation:**
|
|
422
|
+
```
|
|
423
|
+
sphinx>=4.0
|
|
424
|
+
sphinx-rtd-theme>=1.0
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### System Requirements
|
|
428
|
+
|
|
429
|
+
- **Operating System**: Linux, macOS, or Windows
|
|
430
|
+
- **Python**: 3.7, 3.8, 3.9, 3.10, 3.11, or 3.12
|
|
431
|
+
- **Disk Space**: ~50MB for installation
|
|
432
|
+
|
|
433
|
+
### GitHub Copilot CLI Integration
|
|
434
|
+
|
|
435
|
+
For enhanced query capabilities, install [GitHub Copilot CLI](https://github.com/cli/cli):
|
|
436
|
+
|
|
437
|
+
```bash
|
|
438
|
+
# macOS
|
|
439
|
+
brew install gh
|
|
440
|
+
|
|
441
|
+
# Linux (Ubuntu/Debian)
|
|
442
|
+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
|
|
443
|
+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
|
444
|
+
sudo apt update
|
|
445
|
+
sudo apt install gh
|
|
446
|
+
|
|
447
|
+
# Windows
|
|
448
|
+
choco install gh
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## Configuration
|
|
454
|
+
|
|
455
|
+
CodeCompass works out of the box with sensible defaults. No configuration file is required.
|
|
456
|
+
|
|
457
|
+
### Customization Options
|
|
458
|
+
|
|
459
|
+
You can customize behavior through command-line flags:
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
# Limit files displayed in tree output
|
|
463
|
+
codecompass scan --max-files 200
|
|
464
|
+
|
|
465
|
+
# Specify analysis depth
|
|
466
|
+
codecompass analyze --depth 5
|
|
467
|
+
|
|
468
|
+
# Set output format (future versions)
|
|
469
|
+
codecompass query "find main" --format json
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## Output Formats
|
|
475
|
+
|
|
476
|
+
All commands produce beautifully formatted terminal output using the Rich library:
|
|
477
|
+
|
|
478
|
+
- **Colors and Styling**: Syntax highlighting and semantic coloring for readability
|
|
479
|
+
- **Tables and Trees**: Structured visualization of hierarchical data
|
|
480
|
+
- **Progress Indicators**: Real-time feedback for long-running operations
|
|
481
|
+
- **Status Symbols**: Clear indicators (✓, ✗, ⚠, 🔴, etc.) for quick scanning
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
## Common Use Cases
|
|
486
|
+
|
|
487
|
+
### 1. Onboarding to a New Project
|
|
488
|
+
```bash
|
|
489
|
+
codecompass scan
|
|
490
|
+
codecompass query "what are the main entry points"
|
|
491
|
+
codecompass gendocs
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### 2. Security Audit
|
|
495
|
+
```bash
|
|
496
|
+
codecompass analyze
|
|
497
|
+
# Look for critical and warning issues
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### 3. Performance Review
|
|
501
|
+
```bash
|
|
502
|
+
codecompass analyze
|
|
503
|
+
# Focus on performance category issues
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### 4. Understanding Complex Functions
|
|
507
|
+
```bash
|
|
508
|
+
codecompass trace "function_name"
|
|
509
|
+
codecompass query "what does this function do"
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
### 5. Dependency Analysis
|
|
513
|
+
```bash
|
|
514
|
+
codecompass query "find all imports from database module"
|
|
515
|
+
codecompass query "where is this dependency used"
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
## Contributing
|
|
521
|
+
|
|
522
|
+
We welcome contributions! Please follow these guidelines:
|
|
523
|
+
|
|
524
|
+
### Getting Started
|
|
525
|
+
|
|
526
|
+
1. **Fork the Repository**
|
|
527
|
+
```bash
|
|
528
|
+
git clone https://github.com/YOUR_USERNAME/code-compass.git
|
|
529
|
+
cd code-compass
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
2. **Create a Virtual Environment**
|
|
533
|
+
```bash
|
|
534
|
+
python -m venv venv
|
|
535
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
3. **Install Development Dependencies**
|
|
539
|
+
```bash
|
|
540
|
+
pip install -e ".[dev]"
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### Development Workflow
|
|
544
|
+
|
|
545
|
+
1. **Create a Feature Branch**
|
|
546
|
+
```bash
|
|
547
|
+
git checkout -b feature/your-feature-name
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
2. **Make Your Changes**
|
|
551
|
+
- Follow the existing code style
|
|
552
|
+
- Add docstrings to functions and classes
|
|
553
|
+
- Keep functions focused and testable
|
|
554
|
+
- Add type hints where appropriate
|
|
555
|
+
|
|
556
|
+
3. **Run Tests**
|
|
557
|
+
```bash
|
|
558
|
+
pytest
|
|
559
|
+
pytest --cov=src # With coverage
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
4. **Format Code**
|
|
563
|
+
```bash
|
|
564
|
+
black src/ tests/
|
|
565
|
+
flake8 src/ tests/
|
|
566
|
+
mypy src/
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
5. **Commit Your Changes**
|
|
570
|
+
```bash
|
|
571
|
+
git add .
|
|
572
|
+
git commit -m "feat: description of your feature"
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
6. **Push and Create a Pull Request**
|
|
576
|
+
```bash
|
|
577
|
+
git push origin feature/your-feature-name
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### Contribution Areas
|
|
581
|
+
|
|
582
|
+
- **Bug Fixes**: Fix issues and improve stability
|
|
583
|
+
- **New Features**: Add support for more languages, analysis types, or query capabilities
|
|
584
|
+
- **Documentation**: Improve README, inline comments, or usage examples
|
|
585
|
+
- **Performance**: Optimize analysis speed and reduce memory usage
|
|
586
|
+
- **Testing**: Increase test coverage and add edge case tests
|
|
587
|
+
|
|
588
|
+
### Code Style
|
|
589
|
+
|
|
590
|
+
- Follow PEP 8 conventions
|
|
591
|
+
- Use meaningful variable names
|
|
592
|
+
- Add docstrings to all public functions
|
|
593
|
+
- Keep functions under 30 lines when possible
|
|
594
|
+
- Use type hints for better code clarity
|
|
595
|
+
|
|
596
|
+
### Pull Request Process
|
|
597
|
+
|
|
598
|
+
1. Update documentation if needed
|
|
599
|
+
2. Add tests for new functionality
|
|
600
|
+
3. Ensure all tests pass: `pytest`
|
|
601
|
+
4. Ensure code is formatted: `black src/`
|
|
602
|
+
5. Submit PR with clear description of changes
|
|
603
|
+
|
|
604
|
+
### Reporting Issues
|
|
605
|
+
|
|
606
|
+
When reporting bugs, please include:
|
|
607
|
+
- Python version and OS
|
|
608
|
+
- CodeCompass version
|
|
609
|
+
- Steps to reproduce
|
|
610
|
+
- Expected vs actual behavior
|
|
611
|
+
- Relevant code snippets or error messages
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
## Project Structure
|
|
616
|
+
|
|
617
|
+
```
|
|
618
|
+
code-compass/
|
|
619
|
+
├── src/
|
|
620
|
+
│ ├── cli/
|
|
621
|
+
│ │ └── main.py # CLI entry point
|
|
622
|
+
│ ├── scanner/
|
|
623
|
+
│ │ └── repo_scanner.py # Repository scanning
|
|
624
|
+
│ ├── query/
|
|
625
|
+
│ │ └── copilot_query.py # Natural language queries
|
|
626
|
+
│ ├── quality/
|
|
627
|
+
│ │ └── analyzer.py # Code quality analysis
|
|
628
|
+
│ ├── visualizer/
|
|
629
|
+
│ │ └── flow_tracer.py # Execution flow visualization
|
|
630
|
+
│ └── docs/
|
|
631
|
+
│ └── doc_generator.py # Documentation generation
|
|
632
|
+
├── tests/ # Test suite
|
|
633
|
+
├── docs/ # Generated documentation
|
|
634
|
+
├── pyproject.toml # Project configuration
|
|
635
|
+
├── setup.py # Setup script
|
|
636
|
+
├── requirements.txt # Dependencies
|
|
637
|
+
└── README.md # This file
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
---
|
|
641
|
+
|
|
642
|
+
## Supported Languages
|
|
643
|
+
|
|
644
|
+
CodeCompass can analyze code in the following languages:
|
|
645
|
+
|
|
646
|
+
- Python (.py)
|
|
647
|
+
- JavaScript (.js, .jsx)
|
|
648
|
+
- TypeScript (.ts, .tsx)
|
|
649
|
+
- Java (.java)
|
|
650
|
+
- C/C++ (.c, .cpp, .h)
|
|
651
|
+
- PHP (.php)
|
|
652
|
+
- Ruby (.rb)
|
|
653
|
+
- Go (.go)
|
|
654
|
+
- Rust (.rs)
|
|
655
|
+
- SQL (.sql)
|
|
656
|
+
- Swift (.swift)
|
|
657
|
+
- Kotlin (.kt)
|
|
658
|
+
- And more...
|
|
659
|
+
|
|
660
|
+
---
|
|
661
|
+
|
|
662
|
+
## Limitations
|
|
663
|
+
|
|
664
|
+
- **Analysis Scope**: Currently analyzes code structure and patterns; does not execute code
|
|
665
|
+
- **Language Features**: Pattern matching may not catch all edge cases in dynamic languages
|
|
666
|
+
- **Performance**: Very large codebases (100,000+ files) may take longer to analyze
|
|
667
|
+
- **Dependencies**: External dependency analysis is limited to import statements
|
|
668
|
+
|
|
669
|
+
---
|
|
670
|
+
|
|
671
|
+
## Troubleshooting
|
|
672
|
+
|
|
673
|
+
### Common Issues
|
|
674
|
+
|
|
675
|
+
**"Command not found: codecompass"**
|
|
676
|
+
- Ensure you've installed the package: `pip install code-compass-cli`
|
|
677
|
+
- Check that it's in your PATH: `which codecompass`
|
|
678
|
+
- Try reinstalling: `pip install --force-reinstall code-compass-cli`
|
|
679
|
+
|
|
680
|
+
**"Permission denied" errors**
|
|
681
|
+
- Run with appropriate permissions: `sudo pip install ...` (not recommended)
|
|
682
|
+
- Use a virtual environment instead: `python -m venv venv && source venv/bin/activate`
|
|
683
|
+
|
|
684
|
+
**No results from queries**
|
|
685
|
+
- Try broader search terms
|
|
686
|
+
- Check file extensions are supported
|
|
687
|
+
- Ensure files aren't in excluded directories (venv, .git, etc.)
|
|
688
|
+
|
|
689
|
+
**Slow analysis on large projects**
|
|
690
|
+
- Exclude unnecessary directories
|
|
691
|
+
- Consider analyzing subdirectories separately
|
|
692
|
+
- Check for disk I/O bottlenecks
|
|
693
|
+
|
|
694
|
+
---
|
|
695
|
+
|
|
696
|
+
## License
|
|
697
|
+
|
|
698
|
+
CodeCompass is released under the **MIT License**. See [LICENSE](LICENSE) file for details.
|
|
699
|
+
|
|
700
|
+
---
|
|
701
|
+
|
|
702
|
+
## Roadmap
|
|
703
|
+
|
|
704
|
+
Future versions will include:
|
|
705
|
+
|
|
706
|
+
- 🚀 **Interactive Mode**: REPL for continuous querying
|
|
707
|
+
- 📊 **JSON Export**: Machine-readable output formats
|
|
708
|
+
- 🔗 **Integration APIs**: Integration with IDEs and CI/CD pipelines
|
|
709
|
+
- 🌐 **Multi-Repository Support**: Analyze across multiple repos
|
|
710
|
+
- 🤖 **ML-Based Analysis**: Machine learning for smarter insights
|
|
711
|
+
- ⚙️ **Configuration Files**: Support for .codecompass config files
|
|
712
|
+
- 🧪 **Test Coverage**: Automatic test coverage analysis
|
|
713
|
+
|
|
714
|
+
---
|
|
715
|
+
|
|
716
|
+
## Support
|
|
717
|
+
|
|
718
|
+
For questions, bug reports, or feature requests:
|
|
719
|
+
|
|
720
|
+
- 📝 **Issues**: [GitHub Issues](https://github.com/techwhiz/code-compass/issues)
|
|
721
|
+
- 💬 **Discussions**: [GitHub Discussions](https://github.com/techwhiz/code-compass/discussions)
|
|
722
|
+
- 📧 **Email**: support@codecompass.dev
|
|
723
|
+
|
|
724
|
+
---
|
|
725
|
+
|
|
726
|
+
## Acknowledgments
|
|
727
|
+
|
|
728
|
+
Built with:
|
|
729
|
+
- [Click](https://click.palletsprojects.com/) - CLI framework
|
|
730
|
+
- [Rich](https://rich.readthedocs.io/) - Terminal output
|
|
731
|
+
- [Python AST](https://docs.python.org/3/library/ast.html) - Code analysis
|
|
732
|
+
|
|
733
|
+
---
|
|
734
|
+
|
|
735
|
+
<div align="center">
|
|
736
|
+
|
|
737
|
+
Made with ❤️ by the CodeCompass Team
|
|
738
|
+
|
|
739
|
+
[⭐ Star us on GitHub](https://github.com/techwhiz/code-compass) | [🐛 Report Issues](https://github.com/techwhiz/code-compass/issues) | [💡 Request Features](https://github.com/techwhiz/code-compass/discussions)
|
|
740
|
+
|
|
741
|
+
</div>
|