codedna 0.2.2__py3-none-any.whl → 0.2.3__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.
- codedna/__init__.py +1 -1
- codedna/cli.py +137 -0
- {codedna-0.2.2.dist-info → codedna-0.2.3.dist-info}/METADATA +1 -1
- {codedna-0.2.2.dist-info → codedna-0.2.3.dist-info}/RECORD +7 -7
- {codedna-0.2.2.dist-info → codedna-0.2.3.dist-info}/WHEEL +0 -0
- {codedna-0.2.2.dist-info → codedna-0.2.3.dist-info}/entry_points.txt +0 -0
- {codedna-0.2.2.dist-info → codedna-0.2.3.dist-info}/licenses/LICENSE +0 -0
codedna/__init__.py
CHANGED
codedna/cli.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import sys
|
|
5
6
|
from datetime import datetime
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
from typing import Optional
|
|
@@ -37,6 +38,18 @@ app = typer.Typer(
|
|
|
37
38
|
console = Console()
|
|
38
39
|
|
|
39
40
|
|
|
41
|
+
def _version_callback(value: bool) -> None:
|
|
42
|
+
"""--version bayrağı için callback."""
|
|
43
|
+
if value:
|
|
44
|
+
try:
|
|
45
|
+
from importlib.metadata import version as _v
|
|
46
|
+
ver = _v("codedna")
|
|
47
|
+
except Exception:
|
|
48
|
+
ver = "0.2.2"
|
|
49
|
+
console.print(f"codedna {ver}")
|
|
50
|
+
raise typer.Exit()
|
|
51
|
+
|
|
52
|
+
|
|
40
53
|
def _get_db(repo_path: Optional[Path] = None) -> Path:
|
|
41
54
|
"""Repo'ya özel veritabanı yolunu döndür."""
|
|
42
55
|
kok = repo_path or find_git_root() or Path.cwd()
|
|
@@ -106,6 +119,121 @@ def init(
|
|
|
106
119
|
# ---------------------------------------------------------------------------
|
|
107
120
|
# codedna scan
|
|
108
121
|
# ---------------------------------------------------------------------------
|
|
122
|
+
|
|
123
|
+
# ---------------------------------------------------------------------------
|
|
124
|
+
# codedna doctor
|
|
125
|
+
# ---------------------------------------------------------------------------
|
|
126
|
+
@app.command()
|
|
127
|
+
def doctor() -> None:
|
|
128
|
+
"""Sistem sağlık kontrolü — bağımlılıkları, auth, DB, hook kontrol eder."""
|
|
129
|
+
console.print()
|
|
130
|
+
console.print(
|
|
131
|
+
Panel.fit(
|
|
132
|
+
"[bold cyan]🧬 CodeDNA Doctor[/bold cyan]\n"
|
|
133
|
+
"[dim]Sistem sağlık kontrolü...[/dim]",
|
|
134
|
+
border_style="cyan",
|
|
135
|
+
)
|
|
136
|
+
)
|
|
137
|
+
console.print()
|
|
138
|
+
|
|
139
|
+
kontroller = []
|
|
140
|
+
|
|
141
|
+
# 1. Python versiyonu
|
|
142
|
+
py_ver = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
|
|
143
|
+
py_ok = sys.version_info >= (3, 10)
|
|
144
|
+
kontroller.append(("Python versiyonu", f"v{py_ver}", py_ok, f"v{py_ver} (>=3.10 gerekli)" if py_ok else f"v{py_ver} ESKI (>=3.10 gerekli)"))
|
|
145
|
+
|
|
146
|
+
# 2. Git kurulu mu
|
|
147
|
+
import shutil
|
|
148
|
+
git_var = shutil.which("git")
|
|
149
|
+
git_ok = git_var is not None
|
|
150
|
+
kontroller.append(("Git binary", git_var or "yok", git_ok, f"bulundu: {git_var}" if git_ok else "Git kurulu değil!"))
|
|
151
|
+
|
|
152
|
+
# 3. Tree-sitter
|
|
153
|
+
try:
|
|
154
|
+
import tree_sitter
|
|
155
|
+
ts_ok = True
|
|
156
|
+
try:
|
|
157
|
+
ts_msg = f"v{tree_sitter.__version__}"
|
|
158
|
+
except AttributeError:
|
|
159
|
+
# Yeni versiyonlarda __version__ yok, paketten al
|
|
160
|
+
try:
|
|
161
|
+
from importlib.metadata import version as _v
|
|
162
|
+
ts_msg = f"v{_v('tree-sitter')}"
|
|
163
|
+
except Exception:
|
|
164
|
+
ts_msg = "yüklü (versiyon bilinmiyor)"
|
|
165
|
+
except ImportError:
|
|
166
|
+
ts_ok = False
|
|
167
|
+
ts_msg = "yok"
|
|
168
|
+
kontroller.append(("Tree-sitter", ts_msg, ts_ok, ts_msg if ts_ok else "tree-sitter yüklü değil"))
|
|
169
|
+
|
|
170
|
+
# 4. FastAPI
|
|
171
|
+
try:
|
|
172
|
+
import fastapi
|
|
173
|
+
fa_ok = True
|
|
174
|
+
fa_msg = f"v{fastapi.__version__}"
|
|
175
|
+
except ImportError:
|
|
176
|
+
fa_ok = False
|
|
177
|
+
fa_msg = "yok"
|
|
178
|
+
kontroller.append(("FastAPI", fa_msg, fa_ok, fa_msg if fa_ok else "fastapi yüklü değil"))
|
|
179
|
+
|
|
180
|
+
# 5. Auth DB
|
|
181
|
+
try:
|
|
182
|
+
from codedna.auth import _auth_db
|
|
183
|
+
db_path = _auth_db()
|
|
184
|
+
db_ok = db_path.exists()
|
|
185
|
+
kontroller.append(("Auth veritabanı", str(db_path), db_ok, f"var ({db_path.stat().st_size} bytes)" if db_ok else "yok, codedna plan demo deneyin"))
|
|
186
|
+
except Exception as e:
|
|
187
|
+
kontroller.append(("Auth veritabanı", "hata", False, str(e)))
|
|
188
|
+
|
|
189
|
+
# 6. Plan
|
|
190
|
+
try:
|
|
191
|
+
from codedna.plan import get_current_plan
|
|
192
|
+
plan = get_current_plan()
|
|
193
|
+
plan_ok = True
|
|
194
|
+
kontroller.append(("Plan", plan.value.upper(), plan_ok, f"plan: {plan.value}"))
|
|
195
|
+
except Exception as e:
|
|
196
|
+
kontroller.append(("Plan", "hata", False, str(e)))
|
|
197
|
+
|
|
198
|
+
# 7. Git hook (eğer git repo'daysak)
|
|
199
|
+
try:
|
|
200
|
+
from codedna.git_hook import find_git_root
|
|
201
|
+
git_root = find_git_root()
|
|
202
|
+
if git_root:
|
|
203
|
+
hook_path = git_root / ".git" / "hooks" / "post-commit"
|
|
204
|
+
hook_ok = hook_path.exists()
|
|
205
|
+
kontroller.append(("Post-commit hook", str(hook_path) if hook_ok else "yok", hook_ok, "kurulmus" if hook_ok else "codedna init ile kurulabilir"))
|
|
206
|
+
else:
|
|
207
|
+
kontroller.append(("Post-commit hook", "—", True, "git repo disinda"))
|
|
208
|
+
except Exception as e:
|
|
209
|
+
kontroller.append(("Post-commit hook", "hata", False, str(e)))
|
|
210
|
+
|
|
211
|
+
# Tablo oluştur
|
|
212
|
+
tablo = Table(title="[bold]Sistem Durumu[/bold]", show_header=True, header_style="bold magenta", box=None)
|
|
213
|
+
tablo.add_column("Bileşen", style="cyan", no_wrap=True)
|
|
214
|
+
tablo.add_column("Durum", justify="center")
|
|
215
|
+
tablo.add_column("Detay", style="dim")
|
|
216
|
+
|
|
217
|
+
tum_ok = True
|
|
218
|
+
for ad, deger, ok, detay in kontroller:
|
|
219
|
+
if ok:
|
|
220
|
+
emoji = "[green]✓[/green]"
|
|
221
|
+
renk = "green"
|
|
222
|
+
else:
|
|
223
|
+
emoji = "[red]✗[/red]"
|
|
224
|
+
renk = "red"
|
|
225
|
+
tum_ok = False
|
|
226
|
+
tablo.add_row(ad, f"{emoji} [{renk}]{deger}[/{renk}]", detay)
|
|
227
|
+
|
|
228
|
+
console.print(tablo)
|
|
229
|
+
console.print()
|
|
230
|
+
if tum_ok:
|
|
231
|
+
console.print("[bold green]✓ Tüm sistem sağlıklı![/bold green]")
|
|
232
|
+
else:
|
|
233
|
+
console.print("[bold yellow]⚠ Bazı bileşenlerde sorun var. Yukarıdaki detaylara bakın.[/bold yellow]")
|
|
234
|
+
raise typer.Exit(1)
|
|
235
|
+
|
|
236
|
+
|
|
109
237
|
@app.command()
|
|
110
238
|
def scan(
|
|
111
239
|
repo: Optional[Path] = typer.Option(None, "--repo", "-r", help="Git repo dizini"),
|
|
@@ -1958,6 +2086,15 @@ def _risk_etiketi(yuzde: float) -> tuple[str, str]:
|
|
|
1958
2086
|
|
|
1959
2087
|
def main() -> None:
|
|
1960
2088
|
"""CLI giriş noktası."""
|
|
2089
|
+
# --version veya -V kontrolu (Typer'in tanimadigi)
|
|
2090
|
+
if "--version" in sys.argv or "-V" in sys.argv:
|
|
2091
|
+
try:
|
|
2092
|
+
from importlib.metadata import version as _v
|
|
2093
|
+
ver = _v("codedna")
|
|
2094
|
+
except Exception:
|
|
2095
|
+
ver = __version__ if "__version__" in globals() else "0.2.2"
|
|
2096
|
+
console.print(f"codedna {ver}")
|
|
2097
|
+
sys.exit(0)
|
|
1961
2098
|
app()
|
|
1962
2099
|
|
|
1963
2100
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codedna
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: AI Code Transparency Tool - detect AI-written code and measure developer understanding
|
|
5
5
|
Project-URL: Homepage, https://codedna.dev
|
|
6
6
|
Project-URL: Repository, https://github.com/natureco-official/codedna
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
codedna/__init__.py,sha256=
|
|
1
|
+
codedna/__init__.py,sha256=I93t4cw-PxxwVUEIk2pnYu5V9ej7UBy0wRoPrrwBJKE,93
|
|
2
2
|
codedna/ai_fingerprint.py,sha256=xUiBF3jSjTqtu1xGAhbBbDx6PktQ7u_8KcSEz78fSSU,8107
|
|
3
3
|
codedna/analyzer.py,sha256=GgKd_2TCC1ZmroV6RApj8LPGAZsvrgqw9zYWdz3c0bI,7490
|
|
4
4
|
codedna/api.py,sha256=-X4GlQtuCqLPxerMc96KqDDtLM7XOXGCz9Hfhd9kgCM,50828
|
|
5
5
|
codedna/auth.py,sha256=0rPQTRX7I-6Kxg3xzYfZSiZIYJ5b7ERgbHqj6yIzL5s,11917
|
|
6
6
|
codedna/bus_factor.py,sha256=mgI4rRufMJmrLqTKibbrbHa3HrTaZdV9U80BMUZNRCw,8007
|
|
7
|
-
codedna/cli.py,sha256=
|
|
7
|
+
codedna/cli.py,sha256=nJKSg2QbjQH5T3rmg1clzF_4wYfkptaaap4suTnH0_Y,77584
|
|
8
8
|
codedna/db.py,sha256=o2-kxPQRKnXkw_p-jeiwjH0ZJXvquFUwel75_Eh5z20,11098
|
|
9
9
|
codedna/git_hook.py,sha256=ZyLUStLFE94bKhMTMlDFkowisDPH1PS5wm7GBG6heEw,6382
|
|
10
10
|
codedna/interview.py,sha256=YVQeTx1zqdlRE1-Qe8IgLuEQz5-OwvesmMY3vTm-_xk,8661
|
|
@@ -20,8 +20,8 @@ codedna/integrations/__init__.py,sha256=f_K_JICrNyGALXzZ8YFCauWfZejOBJRlTeDTyX_2
|
|
|
20
20
|
codedna/integrations/github_bot.py,sha256=CdZ6VvqpkdGYrfgCoDI02vZka6ky231MwFgGcOfVVek,7841
|
|
21
21
|
codedna/integrations/jira.py,sha256=1SPcBjJ4SrHmnyimWpwM38jxnRh6BhQ-1rN5h1HF4W8,5334
|
|
22
22
|
codedna/integrations/lemonsqueezy.py,sha256=VtZq71YRHPfZzTiulQ4rWjks3lBLlPpke6XVRzRnha8,7611
|
|
23
|
-
codedna-0.2.
|
|
24
|
-
codedna-0.2.
|
|
25
|
-
codedna-0.2.
|
|
26
|
-
codedna-0.2.
|
|
27
|
-
codedna-0.2.
|
|
23
|
+
codedna-0.2.3.dist-info/METADATA,sha256=UZtlmRBoFpXplesjbd5Ww-fq8WbVVIpMWPNQz4x-c5I,18957
|
|
24
|
+
codedna-0.2.3.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
25
|
+
codedna-0.2.3.dist-info/entry_points.txt,sha256=0pXR9iZgAwjwYbEGO3MSrlmYcrhMw6QXntKqq5KjWgM,45
|
|
26
|
+
codedna-0.2.3.dist-info/licenses/LICENSE,sha256=-XHiSAtpzZ_2gcli9hDggy41vDYoZrAqvLhiJ_5L35I,1065
|
|
27
|
+
codedna-0.2.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|