97 lines
3.6 KiB
Python
97 lines
3.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Phase-33: standalone components — Avatar, Divider, Pagination, ColorPicker."""
|
|
|
|
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 / ".phase33-state.json"
|
|
|
|
FEATURES: list[Feature] = [
|
|
Feature(
|
|
name="avatar-component",
|
|
description="Avatar mit Initial-Fallback",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/Avatar.tsx",
|
|
purpose=(
|
|
"Avatar-Component. Props: name (string), imageUrl?, size?: 'sm'|'md'|'lg' (default md), shape?: 'circle'|'square'. "
|
|
"Wenn imageUrl: <img>. Sonst: deterministisches BG-Color via name-hash + Initialen (1-2 Buchstaben). "
|
|
"Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="divider-component",
|
|
description="Divider horizontal/vertikal",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/Divider.tsx",
|
|
purpose=(
|
|
"Divider-Component. Props: orientation?: 'horizontal'|'vertical' (default horizontal), label?, className?. "
|
|
"Horizontal: border-t + optional centered label. Vertical: border-l h-full inline-block. Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="pagination-component",
|
|
description="Pagination mit Prev/Next + Page-Numbers",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/Pagination.tsx",
|
|
purpose=(
|
|
"Pagination-Component. Props: currentPage, totalPages, onPageChange(page). "
|
|
"Zeigt Prev-Button, Page-Numbers (max 7 visible mit ... dots), Next-Button. "
|
|
"Disabled prev/next at boundaries. Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="color-picker-component",
|
|
description="ColorPicker mit Preset-Swatches",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/ColorPicker.tsx",
|
|
purpose=(
|
|
"ColorPicker-Component. Props: value (hex string), onChange(hex). "
|
|
"Zeigt 10 Preset-Color-Swatches in Grid (Tailwind palette: red-500, orange-500, etc.). "
|
|
"Klick auf Swatch ruft onChange. Aktive zeigt Ring."
|
|
),
|
|
)],
|
|
),
|
|
]
|
|
|
|
|
|
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-33 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-33 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()))
|