mirror of
https://github.com/lWolvesl/claw-code.git
synced 2026-04-02 21:51:51 +08:00
Make the repository's primary source tree genuinely Python
The old tracked TypeScript snapshot has been removed from the repository history and the root directory is now a Python porting workspace. README and tests now describe and verify the Python-first layout instead of treating the exposed snapshot as the active source tree. A local archive can still exist outside Git, but the tracked repository now presents only the Python porting surface, related essay context, and OmX workflow artifacts. Constraint: Tracked history should collapse to a single commit while excluding the archived snapshot from Git Rejected: Keep the exposed TypeScript tree in tracked history under an archive path | user explicitly wanted only the Python porting repo state in Git Confidence: medium Scope-risk: broad Reversibility: messy Directive: Keep future tracked additions focused on the Python port itself; do not reintroduce the exposed snapshot into Git history Tested: python3 -m unittest discover -s tests -v; python3 -m src.main summary; git diff --check Not-tested: Behavioral parity with the original TypeScript system beyond the current Python workspace surface
This commit is contained in:
52
src/port_manifest.py
Normal file
52
src/port_manifest.py
Normal file
@@ -0,0 +1,52 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections import Counter
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from .models import Subsystem
|
||||
|
||||
DEFAULT_SRC_ROOT = Path(__file__).resolve().parent
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PortManifest:
|
||||
src_root: Path
|
||||
total_python_files: int
|
||||
top_level_modules: tuple[Subsystem, ...]
|
||||
|
||||
def to_markdown(self) -> str:
|
||||
lines = [
|
||||
f'Port root: `{self.src_root}`',
|
||||
f'Total Python files: **{self.total_python_files}**',
|
||||
'',
|
||||
'Top-level Python modules:',
|
||||
]
|
||||
for module in self.top_level_modules:
|
||||
lines.append(f'- `{module.name}` ({module.file_count} files) — {module.notes}')
|
||||
return '\n'.join(lines)
|
||||
|
||||
|
||||
def build_port_manifest(src_root: Path | None = None) -> PortManifest:
|
||||
root = src_root or DEFAULT_SRC_ROOT
|
||||
files = [path for path in root.rglob('*.py') if path.is_file()]
|
||||
counter = Counter(
|
||||
path.relative_to(root).parts[0] if len(path.relative_to(root).parts) > 1 else path.name
|
||||
for path in files
|
||||
if path.name != '__pycache__'
|
||||
)
|
||||
notes = {
|
||||
'__init__.py': 'package export surface',
|
||||
'main.py': 'CLI entrypoint',
|
||||
'port_manifest.py': 'workspace manifest generation',
|
||||
'query_engine.py': 'port orchestration summary layer',
|
||||
'commands.py': 'command backlog metadata',
|
||||
'tools.py': 'tool backlog metadata',
|
||||
'models.py': 'shared dataclasses',
|
||||
'task.py': 'task-level planning structures',
|
||||
}
|
||||
modules = tuple(
|
||||
Subsystem(name=name, path=f'src/{name}', file_count=count, notes=notes.get(name, 'Python port support module'))
|
||||
for name, count in counter.most_common()
|
||||
)
|
||||
return PortManifest(src_root=root, total_python_files=len(files), top_level_modules=modules)
|
||||
Reference in New Issue
Block a user