mcp-codebase-oracle 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.
- mcp_codebase_oracle-0.1.0/.gitignore +50 -0
- mcp_codebase_oracle-0.1.0/PKG-INFO +203 -0
- mcp_codebase_oracle-0.1.0/README.md +153 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/__init__.py +4 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/__main__.py +6 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/config.py +145 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/core/__init__.py +1 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/core/architecture_detector.py +252 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/core/complexity_analyzer.py +219 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/core/impact_analyzer.py +247 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/core/indexer.py +396 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/models/__init__.py +31 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/models/analysis.py +139 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/models/codebase.py +132 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/models/graph.py +270 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/models/metrics.py +81 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/models/relationships.py +47 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/models/symbols.py +111 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/parsers/__init__.py +46 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/parsers/base_parser.py +50 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/parsers/generic_parser.py +147 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/parsers/python_parser.py +278 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/prompts/__init__.py +1 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/resources/__init__.py +1 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/server.py +69 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/tools/__init__.py +1 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/tools/architecture_tools.py +170 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/tools/graph_tools.py +188 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/tools/impact_tools.py +194 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/tools/query_tools.py +252 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/tools/scan_tools.py +118 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/tools/visualization_tools.py +82 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/utils/__init__.py +1 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/utils/cache.py +95 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/utils/file_utils.py +236 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/utils/formatters.py +99 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/utils/git_utils.py +151 -0
- mcp_codebase_oracle-0.1.0/mcp_codebase_oracle/utils/mermaid.py +162 -0
- mcp_codebase_oracle-0.1.0/pyproject.toml +116 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg
|
|
7
|
+
*.egg-info/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
*.whl
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# uv
|
|
18
|
+
.python-version
|
|
19
|
+
|
|
20
|
+
# IDE
|
|
21
|
+
.vscode/
|
|
22
|
+
.idea/
|
|
23
|
+
*.swp
|
|
24
|
+
*.swo
|
|
25
|
+
*~
|
|
26
|
+
|
|
27
|
+
# OS
|
|
28
|
+
.DS_Store
|
|
29
|
+
Thumbs.db
|
|
30
|
+
|
|
31
|
+
# Testing
|
|
32
|
+
.pytest_cache/
|
|
33
|
+
htmlcov/
|
|
34
|
+
.coverage
|
|
35
|
+
.coverage.*
|
|
36
|
+
coverage.xml
|
|
37
|
+
|
|
38
|
+
# Type checking
|
|
39
|
+
.mypy_cache/
|
|
40
|
+
|
|
41
|
+
# Cache
|
|
42
|
+
.oracle_cache/
|
|
43
|
+
*.diskcache/
|
|
44
|
+
|
|
45
|
+
# Environment
|
|
46
|
+
.env
|
|
47
|
+
.env.local
|
|
48
|
+
|
|
49
|
+
# Ruff
|
|
50
|
+
.ruff_cache/
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-codebase-oracle
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 🔮 MCP sunucusu — Herhangi bir codebase'i analiz et, mimariyi çıkar, etki analizi yap
|
|
5
|
+
Project-URL: Homepage, https://github.com/mcp-codebase-oracle/mcp-codebase-oracle
|
|
6
|
+
Project-URL: Repository, https://github.com/mcp-codebase-oracle/mcp-codebase-oracle
|
|
7
|
+
Project-URL: Issues, https://github.com/mcp-codebase-oracle/mcp-codebase-oracle/issues
|
|
8
|
+
Author: MCP Codebase Oracle Contributors
|
|
9
|
+
License: MIT
|
|
10
|
+
Keywords: architecture,ast,code-intelligence,codebase-analysis,dependency-graph,impact-analysis,legacy-code,mcp
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: diskcache>=5.6
|
|
22
|
+
Requires-Dist: gitpython>=3.1
|
|
23
|
+
Requires-Dist: mcp[cli]>=1.2.0
|
|
24
|
+
Requires-Dist: networkx>=3.2
|
|
25
|
+
Requires-Dist: pathspec>=0.12
|
|
26
|
+
Requires-Dist: platformdirs>=4.0
|
|
27
|
+
Requires-Dist: rich>=13.0
|
|
28
|
+
Provides-Extra: all
|
|
29
|
+
Requires-Dist: mypy>=1.10; extra == 'all'
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'all'
|
|
31
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'all'
|
|
32
|
+
Requires-Dist: pytest>=8.0; extra == 'all'
|
|
33
|
+
Requires-Dist: ruff>=0.5; extra == 'all'
|
|
34
|
+
Requires-Dist: tree-sitter-javascript>=0.23; extra == 'all'
|
|
35
|
+
Requires-Dist: tree-sitter-python>=0.23; extra == 'all'
|
|
36
|
+
Requires-Dist: tree-sitter-typescript>=0.23; extra == 'all'
|
|
37
|
+
Requires-Dist: tree-sitter>=0.24; extra == 'all'
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
40
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
41
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
44
|
+
Provides-Extra: tree-sitter
|
|
45
|
+
Requires-Dist: tree-sitter-javascript>=0.23; extra == 'tree-sitter'
|
|
46
|
+
Requires-Dist: tree-sitter-python>=0.23; extra == 'tree-sitter'
|
|
47
|
+
Requires-Dist: tree-sitter-typescript>=0.23; extra == 'tree-sitter'
|
|
48
|
+
Requires-Dist: tree-sitter>=0.24; extra == 'tree-sitter'
|
|
49
|
+
Description-Content-Type: text/markdown
|
|
50
|
+
|
|
51
|
+
# 🔮 MCP Codebase Oracle
|
|
52
|
+
|
|
53
|
+
> **"Bu kodu kim yazdı, ne yapıyor anlamıyorum" sorusunu tarihe gömüyoruz.**
|
|
54
|
+
|
|
55
|
+
MCP Codebase Oracle, herhangi bir yazılım projesini analiz eden, mimari yapıyı çıkaran ve kod değişikliklerinin etkisini önceden gösteren bir **Model Context Protocol (MCP)** sunucusudur.
|
|
56
|
+
|
|
57
|
+
## ✨ Özellikler
|
|
58
|
+
|
|
59
|
+
| Özellik | Açıklama |
|
|
60
|
+
|---------|----------|
|
|
61
|
+
| 🏗️ **Mimari Tespit** | MVC, Layered, Hexagonal, Clean Architecture ve diğer pattern'leri otomatik tespit |
|
|
62
|
+
| 🕸️ **Bağımlılık Grafı** | Modüller, sınıflar ve fonksiyonlar arası ilişki haritası |
|
|
63
|
+
| 💥 **Etki Analizi** | "Bu kodu değiştirirsem ne bozulur?" sorusuna kesin cevap |
|
|
64
|
+
| 📊 **Karmaşıklık Metrikleri** | Cyclomatic, cognitive complexity ve maintainability index |
|
|
65
|
+
| 🔍 **Sembol Arama** | Fonksiyon, sınıf, değişken arama ve detay görüntüleme |
|
|
66
|
+
| 📖 **Kod Açıklama** | Dosya ve fonksiyon bazlı insan tarafından anlaşılır açıklamalar |
|
|
67
|
+
| 🎯 **Dead Code Tespiti** | Kullanılmayan kod parçalarını bulma |
|
|
68
|
+
| 🌊 **Görselleştirme** | Mermaid diyagramları ile grafik çıktılar |
|
|
69
|
+
|
|
70
|
+
## 🚀 Kurulum
|
|
71
|
+
|
|
72
|
+
### uv ile (önerilen)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Projeyi klonla
|
|
76
|
+
git clone https://github.com/mcp-codebase-oracle/mcp-codebase-oracle.git
|
|
77
|
+
cd mcp-codebase-oracle
|
|
78
|
+
|
|
79
|
+
# Bağımlılıkları kur
|
|
80
|
+
uv sync
|
|
81
|
+
|
|
82
|
+
# Çalıştır
|
|
83
|
+
uv run mcp-codebase-oracle
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### pip ile
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install mcp-codebase-oracle
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Docker ile
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
docker build -t mcp-codebase-oracle .
|
|
96
|
+
docker run -v /path/to/project:/project:ro mcp-codebase-oracle
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## ⚡ MCP İstemci Konfigürasyonu
|
|
100
|
+
|
|
101
|
+
### Claude Desktop
|
|
102
|
+
|
|
103
|
+
`claude_desktop_config.json` dosyasına ekle:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"mcpServers": {
|
|
108
|
+
"codebase-oracle": {
|
|
109
|
+
"command": "uv",
|
|
110
|
+
"args": [
|
|
111
|
+
"--directory", "/path/to/mcp-codebase-oracle",
|
|
112
|
+
"run", "mcp-codebase-oracle"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### VS Code (Copilot / Continue)
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"mcp.servers": {
|
|
124
|
+
"codebase-oracle": {
|
|
125
|
+
"command": "mcp-codebase-oracle",
|
|
126
|
+
"args": []
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 🔧 Kullanılabilir Tool'lar
|
|
133
|
+
|
|
134
|
+
### Tarama & İndeksleme
|
|
135
|
+
- `scan_project` — Proje tarama ve indeksleme
|
|
136
|
+
- `rescan_project` — Incremental güncelleme
|
|
137
|
+
- `get_project_summary` — Proje özeti
|
|
138
|
+
|
|
139
|
+
### Sorgulama
|
|
140
|
+
- `find_symbol` — Fonksiyon/sınıf/değişken arama
|
|
141
|
+
- `get_symbol_detail` — Sembol detayları
|
|
142
|
+
- `search_code` — Kod içi arama
|
|
143
|
+
- `get_file_overview` — Dosya yapı özeti
|
|
144
|
+
|
|
145
|
+
### Graf Analizi
|
|
146
|
+
- `get_dependency_graph` — Bağımlılık grafı
|
|
147
|
+
- `get_call_graph` — Fonksiyon çağrı grafı
|
|
148
|
+
- `get_class_hierarchy` — Sınıf hiyerarşisi
|
|
149
|
+
- `find_circular_dependencies` — Döngüsel bağımlılık tespiti
|
|
150
|
+
|
|
151
|
+
### Etki Analizi
|
|
152
|
+
- `analyze_impact` — Değişiklik etki analizi
|
|
153
|
+
- `what_if_delete` — Silme senaryosu
|
|
154
|
+
- `what_if_rename` — Yeniden adlandırma senaryosu
|
|
155
|
+
- `find_dead_code` — Kullanılmayan kod tespiti
|
|
156
|
+
|
|
157
|
+
### Mimari
|
|
158
|
+
- `detect_architecture` — Mimari pattern tespiti
|
|
159
|
+
- `get_module_coupling` — Modül bağlılık metrikleri
|
|
160
|
+
- `detect_code_smells` — Kod kokusu tespiti
|
|
161
|
+
|
|
162
|
+
### Açıklama & Görselleştirme
|
|
163
|
+
- `explain_file` — Dosya açıklama
|
|
164
|
+
- `explain_function` — Fonksiyon açıklama
|
|
165
|
+
- `generate_onboarding_guide` — Onboarding rehberi
|
|
166
|
+
- `generate_architecture_diagram` — Mimari diyagram
|
|
167
|
+
- `generate_dependency_matrix` — Bağımlılık matrisi
|
|
168
|
+
- `generate_hotspot_map` — Hotspot haritası
|
|
169
|
+
|
|
170
|
+
## 🗣️ Desteklenen Diller
|
|
171
|
+
|
|
172
|
+
| Dil | Parser | Durum |
|
|
173
|
+
|-----|--------|-------|
|
|
174
|
+
| Python | `ast` (native) | ✅ Tam destek |
|
|
175
|
+
| JavaScript/TypeScript | tree-sitter | 🔜 Yakında |
|
|
176
|
+
| Java | tree-sitter | 🔜 Yakında |
|
|
177
|
+
| Go | tree-sitter | 🔜 Yakında |
|
|
178
|
+
| Rust | tree-sitter | 🔜 Yakında |
|
|
179
|
+
| C# | tree-sitter | 🔜 Yakında |
|
|
180
|
+
| Diğerleri | regex (generic) | ⚡ Temel destek |
|
|
181
|
+
|
|
182
|
+
## 🛠️ Geliştirme
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Dev bağımlılıklarını kur
|
|
186
|
+
uv sync --extra dev
|
|
187
|
+
|
|
188
|
+
# Testleri çalıştır
|
|
189
|
+
uv run pytest -v
|
|
190
|
+
|
|
191
|
+
# Linting
|
|
192
|
+
uv run ruff check src/ tests/
|
|
193
|
+
|
|
194
|
+
# Type checking
|
|
195
|
+
uv run mypy src/
|
|
196
|
+
|
|
197
|
+
# MCP Inspector ile test
|
|
198
|
+
uv run mcp dev src/mcp_codebase_oracle/server.py
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## 📄 Lisans
|
|
202
|
+
|
|
203
|
+
MIT License — Detaylar için [LICENSE](LICENSE) dosyasına bakın.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# 🔮 MCP Codebase Oracle
|
|
2
|
+
|
|
3
|
+
> **"Bu kodu kim yazdı, ne yapıyor anlamıyorum" sorusunu tarihe gömüyoruz.**
|
|
4
|
+
|
|
5
|
+
MCP Codebase Oracle, herhangi bir yazılım projesini analiz eden, mimari yapıyı çıkaran ve kod değişikliklerinin etkisini önceden gösteren bir **Model Context Protocol (MCP)** sunucusudur.
|
|
6
|
+
|
|
7
|
+
## ✨ Özellikler
|
|
8
|
+
|
|
9
|
+
| Özellik | Açıklama |
|
|
10
|
+
|---------|----------|
|
|
11
|
+
| 🏗️ **Mimari Tespit** | MVC, Layered, Hexagonal, Clean Architecture ve diğer pattern'leri otomatik tespit |
|
|
12
|
+
| 🕸️ **Bağımlılık Grafı** | Modüller, sınıflar ve fonksiyonlar arası ilişki haritası |
|
|
13
|
+
| 💥 **Etki Analizi** | "Bu kodu değiştirirsem ne bozulur?" sorusuna kesin cevap |
|
|
14
|
+
| 📊 **Karmaşıklık Metrikleri** | Cyclomatic, cognitive complexity ve maintainability index |
|
|
15
|
+
| 🔍 **Sembol Arama** | Fonksiyon, sınıf, değişken arama ve detay görüntüleme |
|
|
16
|
+
| 📖 **Kod Açıklama** | Dosya ve fonksiyon bazlı insan tarafından anlaşılır açıklamalar |
|
|
17
|
+
| 🎯 **Dead Code Tespiti** | Kullanılmayan kod parçalarını bulma |
|
|
18
|
+
| 🌊 **Görselleştirme** | Mermaid diyagramları ile grafik çıktılar |
|
|
19
|
+
|
|
20
|
+
## 🚀 Kurulum
|
|
21
|
+
|
|
22
|
+
### uv ile (önerilen)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Projeyi klonla
|
|
26
|
+
git clone https://github.com/mcp-codebase-oracle/mcp-codebase-oracle.git
|
|
27
|
+
cd mcp-codebase-oracle
|
|
28
|
+
|
|
29
|
+
# Bağımlılıkları kur
|
|
30
|
+
uv sync
|
|
31
|
+
|
|
32
|
+
# Çalıştır
|
|
33
|
+
uv run mcp-codebase-oracle
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### pip ile
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install mcp-codebase-oracle
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Docker ile
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
docker build -t mcp-codebase-oracle .
|
|
46
|
+
docker run -v /path/to/project:/project:ro mcp-codebase-oracle
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## ⚡ MCP İstemci Konfigürasyonu
|
|
50
|
+
|
|
51
|
+
### Claude Desktop
|
|
52
|
+
|
|
53
|
+
`claude_desktop_config.json` dosyasına ekle:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"mcpServers": {
|
|
58
|
+
"codebase-oracle": {
|
|
59
|
+
"command": "uv",
|
|
60
|
+
"args": [
|
|
61
|
+
"--directory", "/path/to/mcp-codebase-oracle",
|
|
62
|
+
"run", "mcp-codebase-oracle"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### VS Code (Copilot / Continue)
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcp.servers": {
|
|
74
|
+
"codebase-oracle": {
|
|
75
|
+
"command": "mcp-codebase-oracle",
|
|
76
|
+
"args": []
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 🔧 Kullanılabilir Tool'lar
|
|
83
|
+
|
|
84
|
+
### Tarama & İndeksleme
|
|
85
|
+
- `scan_project` — Proje tarama ve indeksleme
|
|
86
|
+
- `rescan_project` — Incremental güncelleme
|
|
87
|
+
- `get_project_summary` — Proje özeti
|
|
88
|
+
|
|
89
|
+
### Sorgulama
|
|
90
|
+
- `find_symbol` — Fonksiyon/sınıf/değişken arama
|
|
91
|
+
- `get_symbol_detail` — Sembol detayları
|
|
92
|
+
- `search_code` — Kod içi arama
|
|
93
|
+
- `get_file_overview` — Dosya yapı özeti
|
|
94
|
+
|
|
95
|
+
### Graf Analizi
|
|
96
|
+
- `get_dependency_graph` — Bağımlılık grafı
|
|
97
|
+
- `get_call_graph` — Fonksiyon çağrı grafı
|
|
98
|
+
- `get_class_hierarchy` — Sınıf hiyerarşisi
|
|
99
|
+
- `find_circular_dependencies` — Döngüsel bağımlılık tespiti
|
|
100
|
+
|
|
101
|
+
### Etki Analizi
|
|
102
|
+
- `analyze_impact` — Değişiklik etki analizi
|
|
103
|
+
- `what_if_delete` — Silme senaryosu
|
|
104
|
+
- `what_if_rename` — Yeniden adlandırma senaryosu
|
|
105
|
+
- `find_dead_code` — Kullanılmayan kod tespiti
|
|
106
|
+
|
|
107
|
+
### Mimari
|
|
108
|
+
- `detect_architecture` — Mimari pattern tespiti
|
|
109
|
+
- `get_module_coupling` — Modül bağlılık metrikleri
|
|
110
|
+
- `detect_code_smells` — Kod kokusu tespiti
|
|
111
|
+
|
|
112
|
+
### Açıklama & Görselleştirme
|
|
113
|
+
- `explain_file` — Dosya açıklama
|
|
114
|
+
- `explain_function` — Fonksiyon açıklama
|
|
115
|
+
- `generate_onboarding_guide` — Onboarding rehberi
|
|
116
|
+
- `generate_architecture_diagram` — Mimari diyagram
|
|
117
|
+
- `generate_dependency_matrix` — Bağımlılık matrisi
|
|
118
|
+
- `generate_hotspot_map` — Hotspot haritası
|
|
119
|
+
|
|
120
|
+
## 🗣️ Desteklenen Diller
|
|
121
|
+
|
|
122
|
+
| Dil | Parser | Durum |
|
|
123
|
+
|-----|--------|-------|
|
|
124
|
+
| Python | `ast` (native) | ✅ Tam destek |
|
|
125
|
+
| JavaScript/TypeScript | tree-sitter | 🔜 Yakında |
|
|
126
|
+
| Java | tree-sitter | 🔜 Yakında |
|
|
127
|
+
| Go | tree-sitter | 🔜 Yakında |
|
|
128
|
+
| Rust | tree-sitter | 🔜 Yakında |
|
|
129
|
+
| C# | tree-sitter | 🔜 Yakında |
|
|
130
|
+
| Diğerleri | regex (generic) | ⚡ Temel destek |
|
|
131
|
+
|
|
132
|
+
## 🛠️ Geliştirme
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Dev bağımlılıklarını kur
|
|
136
|
+
uv sync --extra dev
|
|
137
|
+
|
|
138
|
+
# Testleri çalıştır
|
|
139
|
+
uv run pytest -v
|
|
140
|
+
|
|
141
|
+
# Linting
|
|
142
|
+
uv run ruff check src/ tests/
|
|
143
|
+
|
|
144
|
+
# Type checking
|
|
145
|
+
uv run mypy src/
|
|
146
|
+
|
|
147
|
+
# MCP Inspector ile test
|
|
148
|
+
uv run mcp dev src/mcp_codebase_oracle/server.py
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 📄 Lisans
|
|
152
|
+
|
|
153
|
+
MIT License — Detaylar için [LICENSE](LICENSE) dosyasına bakın.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"""Konfigürasyon yönetimi — environment variables ve default değerler."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from dataclasses import dataclass, field
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from platformdirs import user_cache_dir
|
|
10
|
+
|
|
11
|
+
from mcp_codebase_oracle import __app_name__
|
|
12
|
+
|
|
13
|
+
# Default exclude patterns (always excluded in addition to .gitignore)
|
|
14
|
+
DEFAULT_EXCLUDE_PATTERNS: list[str] = [
|
|
15
|
+
"node_modules",
|
|
16
|
+
".git",
|
|
17
|
+
"__pycache__",
|
|
18
|
+
".venv",
|
|
19
|
+
"venv",
|
|
20
|
+
".tox",
|
|
21
|
+
".mypy_cache",
|
|
22
|
+
".pytest_cache",
|
|
23
|
+
".ruff_cache",
|
|
24
|
+
"dist",
|
|
25
|
+
"build",
|
|
26
|
+
"*.egg-info",
|
|
27
|
+
".oracle_cache",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
# Language extension mapping
|
|
31
|
+
LANGUAGE_EXTENSIONS: dict[str, str] = {
|
|
32
|
+
".py": "python",
|
|
33
|
+
".pyi": "python",
|
|
34
|
+
".js": "javascript",
|
|
35
|
+
".jsx": "javascript",
|
|
36
|
+
".ts": "typescript",
|
|
37
|
+
".tsx": "typescript",
|
|
38
|
+
".java": "java",
|
|
39
|
+
".go": "go",
|
|
40
|
+
".rs": "rust",
|
|
41
|
+
".cs": "csharp",
|
|
42
|
+
".rb": "ruby",
|
|
43
|
+
".php": "php",
|
|
44
|
+
".swift": "swift",
|
|
45
|
+
".kt": "kotlin",
|
|
46
|
+
".scala": "scala",
|
|
47
|
+
".c": "c",
|
|
48
|
+
".cpp": "cpp",
|
|
49
|
+
".h": "c",
|
|
50
|
+
".hpp": "cpp",
|
|
51
|
+
".lua": "lua",
|
|
52
|
+
".r": "r",
|
|
53
|
+
".R": "r",
|
|
54
|
+
".sh": "shell",
|
|
55
|
+
".bash": "shell",
|
|
56
|
+
".zsh": "shell",
|
|
57
|
+
".yml": "yaml",
|
|
58
|
+
".yaml": "yaml",
|
|
59
|
+
".json": "json",
|
|
60
|
+
".toml": "toml",
|
|
61
|
+
".xml": "xml",
|
|
62
|
+
".html": "html",
|
|
63
|
+
".css": "css",
|
|
64
|
+
".scss": "scss",
|
|
65
|
+
".sql": "sql",
|
|
66
|
+
".md": "markdown",
|
|
67
|
+
".rst": "restructuredtext",
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# Supported parsable languages (languages with dedicated parsers)
|
|
71
|
+
PARSABLE_LANGUAGES: set[str] = {
|
|
72
|
+
"python",
|
|
73
|
+
# Future: "javascript", "typescript", "java", "go", "rust", "csharp"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@dataclass
|
|
78
|
+
class OracleConfig:
|
|
79
|
+
"""Ana konfigürasyon sınıfı — tüm ayarlar burada."""
|
|
80
|
+
|
|
81
|
+
# Cache directory (platform-specific default)
|
|
82
|
+
cache_dir: Path = field(default_factory=lambda: Path(user_cache_dir(__app_name__)))
|
|
83
|
+
|
|
84
|
+
# Maximum file size to parse (bytes) — default 5MB
|
|
85
|
+
max_file_size: int = 5 * 1024 * 1024
|
|
86
|
+
|
|
87
|
+
# Maximum number of files to index
|
|
88
|
+
max_files: int = 100_000
|
|
89
|
+
|
|
90
|
+
# Log level
|
|
91
|
+
log_level: str = "INFO"
|
|
92
|
+
|
|
93
|
+
# Extra exclude patterns (added to defaults)
|
|
94
|
+
extra_exclude_patterns: list[str] = field(default_factory=list)
|
|
95
|
+
|
|
96
|
+
# Git integration enabled
|
|
97
|
+
git_enabled: bool = True
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def exclude_patterns(self) -> list[str]:
|
|
101
|
+
"""Combine default and extra exclude patterns."""
|
|
102
|
+
return DEFAULT_EXCLUDE_PATTERNS + self.extra_exclude_patterns
|
|
103
|
+
|
|
104
|
+
@classmethod
|
|
105
|
+
def from_env(cls) -> OracleConfig:
|
|
106
|
+
"""Create config from environment variables with fallback to defaults."""
|
|
107
|
+
config = cls()
|
|
108
|
+
|
|
109
|
+
if cache_dir := os.getenv("ORACLE_CACHE_DIR"):
|
|
110
|
+
config.cache_dir = Path(cache_dir).expanduser()
|
|
111
|
+
|
|
112
|
+
if max_file_size := os.getenv("ORACLE_MAX_FILE_SIZE"):
|
|
113
|
+
config.max_file_size = int(max_file_size)
|
|
114
|
+
|
|
115
|
+
if max_files := os.getenv("ORACLE_MAX_FILES"):
|
|
116
|
+
config.max_files = int(max_files)
|
|
117
|
+
|
|
118
|
+
if log_level := os.getenv("ORACLE_LOG_LEVEL"):
|
|
119
|
+
config.log_level = log_level.upper()
|
|
120
|
+
|
|
121
|
+
if exclude := os.getenv("ORACLE_EXCLUDE_PATTERNS"):
|
|
122
|
+
config.extra_exclude_patterns = [p.strip() for p in exclude.split(",")]
|
|
123
|
+
|
|
124
|
+
if git_enabled := os.getenv("ORACLE_GIT_ENABLED"):
|
|
125
|
+
config.git_enabled = git_enabled.lower() in ("true", "1", "yes")
|
|
126
|
+
|
|
127
|
+
return config
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# Global config instance — lazy initialized
|
|
131
|
+
_config: OracleConfig | None = None
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def get_config() -> OracleConfig:
|
|
135
|
+
"""Get or create global config instance."""
|
|
136
|
+
global _config
|
|
137
|
+
if _config is None:
|
|
138
|
+
_config = OracleConfig.from_env()
|
|
139
|
+
return _config
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def reset_config() -> None:
|
|
143
|
+
"""Reset global config (useful for testing)."""
|
|
144
|
+
global _config
|
|
145
|
+
_config = None
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Çekirdek analiz motorları."""
|