98 lines
3.7 KiB
Python
98 lines
3.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Phase-39: standalone components — FileUpload, ImageGallery, KeyValueList, CodeBlock."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import asyncio, datetime, json, sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
from phase2_features import Feature, FileGen, ROOT, log, log_section
|
|
from phase3_features import run_feature_v2
|
|
|
|
PHASE_STATE = ROOT / ".phase39-state.json"
|
|
|
|
FEATURES: list[Feature] = [
|
|
Feature(
|
|
name="file-upload-component",
|
|
description="FileUpload mit drag-and-drop",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/FileUpload.tsx",
|
|
purpose=(
|
|
"FileUpload-Component. Props: onFiles(files: File[]), accept?, multiple?, maxSizeMB?. "
|
|
"Dashed border + 'Drop files here or click'. onDragOver/onDrop/onClick → input file change. "
|
|
"Filter by accept + maxSize. Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="image-gallery-component",
|
|
description="ImageGallery mit Lightbox",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/ImageGallery.tsx",
|
|
purpose=(
|
|
"ImageGallery-Component. Props: images (array {url, alt?, caption?}), columns? (default 3). "
|
|
"Grid. Klick auf image öffnet Modal-Lightbox (full-screen) mit prev/next. Escape schließt. "
|
|
"Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="key-value-list-component",
|
|
description="KeyValueList für Detail-Views",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/KeyValueList.tsx",
|
|
purpose=(
|
|
"KeyValueList-Component. Props: items (array {key, value: ReactNode, copyable?}), layout?: 'horizontal'|'vertical'. "
|
|
"Horizontal: Grid 2 cols. Vertical: stacked. Wenn copyable: kleiner Copy-Icon button (lucide Copy). "
|
|
"Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="code-block-component",
|
|
description="CodeBlock mit syntax-color + copy",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/CodeBlock.tsx",
|
|
purpose=(
|
|
"CodeBlock-Component. Props: code (string), language?: string, showCopyButton? (default true). "
|
|
"<pre><code> in dunklem bg (zinc-900), text-zinc-100 mono. "
|
|
"Copy-Button oben-rechts. Optional Language-Label oben-links. Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
]
|
|
|
|
|
|
def load_state():
|
|
if PHASE_STATE.exists():
|
|
return json.loads(PHASE_STATE.read_text())
|
|
return {"completed_features": [], "current_feature": None, "started_at": datetime.datetime.now().isoformat()}
|
|
|
|
|
|
def save_state(state):
|
|
PHASE_STATE.write_text(json.dumps(state, indent=2))
|
|
|
|
|
|
async def main():
|
|
log_section("🚀 Phase-39 Codegen-Run gestartet")
|
|
state = load_state()
|
|
for feature in FEATURES:
|
|
if feature.name in state.get("completed_features", []):
|
|
continue
|
|
state["current_feature"] = feature.name; save_state(state)
|
|
try:
|
|
success = await run_feature_v2(feature)
|
|
state.setdefault("completed_features" if success else "attempted_features", []).append(feature.name)
|
|
save_state(state)
|
|
except Exception as e:
|
|
log(f"❌ {feature.name} crashed: {e}", level="ERROR")
|
|
state.setdefault("attempted_features", []).append(feature.name); save_state(state)
|
|
log_section("Phase-39 Run beendet")
|
|
log(f"OK: {len(state.get('completed_features', []))}, Attempted: {len(state.get('attempted_features', []))}, Total: {len(FEATURES)}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(asyncio.run(main()))
|