feat(impl_tracker): add domain entities and infrastructure — code scanner, LLM client stub
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
09167cfe82
commit
e523d5b31c
|
|
@ -0,0 +1,18 @@
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class ImplProgress:
|
||||||
|
module_id: str
|
||||||
|
percentage: float # 0-100
|
||||||
|
source: str # auto, llm, manual
|
||||||
|
evaluated_at: datetime
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class CodeStructure:
|
||||||
|
root_path: str
|
||||||
|
directories: list[str]
|
||||||
|
files: list[str]
|
||||||
|
matched_modules: list[str]
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from app.modules.impl_tracker.domain.entities import CodeStructure
|
||||||
|
from app.modules.scanner.domain.entities import ScanResult
|
||||||
|
|
||||||
|
|
||||||
|
def scan_code_directory(code_dir: str, scan_result: ScanResult) -> CodeStructure:
|
||||||
|
root = Path(code_dir)
|
||||||
|
if not root.is_dir():
|
||||||
|
return CodeStructure(root_path=code_dir, directories=[], files=[], matched_modules=[])
|
||||||
|
|
||||||
|
directories = []
|
||||||
|
files = []
|
||||||
|
for p in sorted(root.rglob("*")):
|
||||||
|
rel = str(p.relative_to(root))
|
||||||
|
if p.is_dir():
|
||||||
|
directories.append(rel)
|
||||||
|
elif p.is_file():
|
||||||
|
files.append(rel)
|
||||||
|
|
||||||
|
# Match modules by checking if code_root from CodebaseAlignment exists
|
||||||
|
matched = []
|
||||||
|
for alignment in scan_result.codebase_alignments:
|
||||||
|
code_root = alignment.code_root
|
||||||
|
if (root / code_root).exists():
|
||||||
|
matched.append(alignment.module_id)
|
||||||
|
|
||||||
|
return CodeStructure(
|
||||||
|
root_path=code_dir,
|
||||||
|
directories=directories,
|
||||||
|
files=files,
|
||||||
|
matched_modules=matched,
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
class LlmClient:
|
||||||
|
def evaluate_module(self, module_design: str, module_code: str) -> float:
|
||||||
|
"""Stub: returns 0.0. Real implementation would call LLM API."""
|
||||||
|
return 0.0
|
||||||
Loading…
Reference in New Issue
Block a user