diff --git a/backend/app/modules/impl_tracker/domain/entities.py b/backend/app/modules/impl_tracker/domain/entities.py index e69de29..cb3db3f 100644 --- a/backend/app/modules/impl_tracker/domain/entities.py +++ b/backend/app/modules/impl_tracker/domain/entities.py @@ -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] diff --git a/backend/app/modules/impl_tracker/infrastructure/code_scanner.py b/backend/app/modules/impl_tracker/infrastructure/code_scanner.py new file mode 100644 index 0000000..d759725 --- /dev/null +++ b/backend/app/modules/impl_tracker/infrastructure/code_scanner.py @@ -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, + ) diff --git a/backend/app/modules/impl_tracker/infrastructure/llm_client.py b/backend/app/modules/impl_tracker/infrastructure/llm_client.py new file mode 100644 index 0000000..477a9af --- /dev/null +++ b/backend/app/modules/impl_tracker/infrastructure/llm_client.py @@ -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