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:
instructkr
2026-03-31 05:38:29 -07:00
commit 507c2460b9
92 changed files with 3984 additions and 0 deletions

58
src/commands.py Normal file
View File

@@ -0,0 +1,58 @@
from __future__ import annotations
import json
from functools import lru_cache
from pathlib import Path
from .models import PortingBacklog, PortingModule
SNAPSHOT_PATH = Path(__file__).resolve().parent / 'reference_data' / 'commands_snapshot.json'
@lru_cache(maxsize=1)
def load_command_snapshot() -> tuple[PortingModule, ...]:
raw_entries = json.loads(SNAPSHOT_PATH.read_text())
return tuple(
PortingModule(
name=entry['name'],
responsibility=entry['responsibility'],
source_hint=entry['source_hint'],
status='mirrored',
)
for entry in raw_entries
)
PORTED_COMMANDS = load_command_snapshot()
def build_command_backlog() -> PortingBacklog:
return PortingBacklog(title='Command surface', modules=list(PORTED_COMMANDS))
def command_names() -> list[str]:
return [module.name for module in PORTED_COMMANDS]
def get_command(name: str) -> PortingModule | None:
needle = name.lower()
for module in PORTED_COMMANDS:
if module.name.lower() == needle:
return module
return None
def find_commands(query: str, limit: int = 20) -> list[PortingModule]:
needle = query.lower()
matches = [module for module in PORTED_COMMANDS if needle in module.name.lower() or needle in module.source_hint.lower()]
return matches[:limit]
def render_command_index(limit: int = 20, query: str | None = None) -> str:
modules = find_commands(query, limit) if query else list(PORTED_COMMANDS[:limit])
lines = [f'Command entries: {len(PORTED_COMMANDS)}', '']
if query:
lines.append(f'Filtered by: {query}')
lines.append('')
lines.extend(f'- {module.name}{module.source_hint}' for module in modules)
return '\n'.join(lines)