98 lines
3.6 KiB
Python
98 lines
3.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Phase-43: standalone components — DateInput, TimeInput, NumberInput, ColorSwatch."""
|
|
|
|
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 / ".phase43-state.json"
|
|
|
|
FEATURES: list[Feature] = [
|
|
Feature(
|
|
name="date-input-component",
|
|
description="DateInput mit ISO-Format",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/DateInput.tsx",
|
|
purpose=(
|
|
"DateInput-Component. Props: value (ISO-string), onChange(iso), label?, min?, max?, error?. "
|
|
"Native <input type=date> styled. Calendar-Icon links. "
|
|
"Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="time-input-component",
|
|
description="TimeInput für HH:MM",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/TimeInput.tsx",
|
|
purpose=(
|
|
"TimeInput-Component. Props: value (string HH:MM), onChange, label?, step? (default 60). "
|
|
"Native <input type=time> styled. Clock-Icon links. "
|
|
"Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="number-input-component",
|
|
description="NumberInput mit Stepper-Buttons",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/NumberInput.tsx",
|
|
purpose=(
|
|
"NumberInput-Component. Props: value (number), onChange(n), min?, max?, step? (default 1), unit?. "
|
|
"Input mit -/+ Buttons links/rechts. Clamp to min/max. "
|
|
"Optional unit-label (z.B. 'h', 'min') rechts. Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="color-swatch-component",
|
|
description="ColorSwatch (single color preview circle)",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/ColorSwatch.tsx",
|
|
purpose=(
|
|
"ColorSwatch-Component. Props: color (hex), size?: 'sm'|'md'|'lg', selected?, onClick?. "
|
|
"Kreis mit backgroundColor=color. Border, hover scale, optional ring wenn selected. "
|
|
"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-43 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-43 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()))
|