98 lines
3.9 KiB
Python
98 lines
3.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Phase-36: standalone form inputs — Input, Textarea, Select, SearchBox."""
|
|
|
|
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 / ".phase36-state.json"
|
|
|
|
FEATURES: list[Feature] = [
|
|
Feature(
|
|
name="input-component",
|
|
description="Input mit Label + Error-State",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/Input.tsx",
|
|
purpose=(
|
|
"Input-Component. Props: value, onChange, label?, error?, placeholder?, type?, leftIcon?, rightIcon?, disabled?. "
|
|
"Wrapper-div mit Label oben, Input mit optional Icons left/right (absolute positioned + Input padding), "
|
|
"Error-Text rot drunter wenn error. focus:ring-2 ring-blue-500, border-red-500 wenn error. Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="textarea-component",
|
|
description="Textarea mit auto-resize + char-count",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/Textarea.tsx",
|
|
purpose=(
|
|
"Textarea-Component. Props: value, onChange, label?, error?, placeholder?, rows? (default 4), maxLength?, autoResize?: boolean. "
|
|
"Wenn autoResize: useEffect setzt height = scrollHeight. Wenn maxLength: zeigt char-count rechts unten ({value.length}/{maxLength}). "
|
|
"Tailwind. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="select-component",
|
|
description="Select mit custom-styling",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/Select.tsx",
|
|
purpose=(
|
|
"Select-Component. Props: value, onChange, options (array {value, label, disabled?}), label?, placeholder?, error?, disabled?. "
|
|
"Native <select> styled mit Tailwind appearance-none + custom ChevronDown-Icon rechts (lucide-react). "
|
|
"Label oben + error rot drunter. Export default."
|
|
),
|
|
)],
|
|
),
|
|
Feature(
|
|
name="search-box-component",
|
|
description="SearchBox mit clear-button",
|
|
files=[FileGen(
|
|
path="apps/web/src/components/SearchBox.tsx",
|
|
purpose=(
|
|
"SearchBox-Component. Props: value, onChange, placeholder? (default 'Suchen...'), onClear?. "
|
|
"Input mit Search-Icon (lucide-react) links + X-Button rechts wenn value (klick → onChange('') und onClear?()). "
|
|
"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-36 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-36 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()))
|