From 61d337844c1ddebfb2164283a0afeed5d2ca6f63 Mon Sep 17 00:00:00 2001 From: "Dennis (via Claude+Gemma)" Date: Sat, 23 May 2026 08:18:05 +0200 Subject: [PATCH] =?UTF-8?q?feat(voice-input-stub):=20Voice-Input-Stub=20vi?= =?UTF-8?q?a=20Web=20Speech=20API=20f=C3=BCr=20TimeEntry=20descriptio=20[t?= =?UTF-8?q?sc:fail]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .phase21-state.json | 3 +- .phase22-state.json | 5 ++ GENERATION_LOG.md | 24 +++++ apps/web/src/components/VoiceInput.tsx | 92 +++++++++++++++++++ scripts/phase22_features.py | 120 +++++++++++++++++++++++++ 5 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 .phase22-state.json create mode 100644 apps/web/src/components/VoiceInput.tsx create mode 100644 scripts/phase22_features.py diff --git a/.phase21-state.json b/.phase21-state.json index de7991f..0113f1d 100644 --- a/.phase21-state.json +++ b/.phase21-state.json @@ -7,6 +7,7 @@ "snippet-shortcuts", "smart-rounding-on-input", "color-coded-customer-rows", - "time-entry-templates-page" + "time-entry-templates-page", + "router-phase21" ] } \ No newline at end of file diff --git a/.phase22-state.json b/.phase22-state.json new file mode 100644 index 0000000..37b8ee5 --- /dev/null +++ b/.phase22-state.json @@ -0,0 +1,5 @@ +{ + "completed_features": [], + "current_feature": "voice-input-stub", + "started_at": "2026-05-23T08:17:40.778724" +} \ No newline at end of file diff --git a/GENERATION_LOG.md b/GENERATION_LOG.md index b4539ae..eab1e81 100644 --- a/GENERATION_LOG.md +++ b/GENERATION_LOG.md @@ -2586,3 +2586,27 @@ src/index.ts(27,25): error TS2769: No overload matches this call. Overload 2 of 3, '(plugin: FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. Type 'Promise' provides no match for the signature '(instance: FastifyInstance, FastifyBaseLogger, FastifyTy +- `08:16:43` **INFO** Committed feature router-phase21 +- `08:16:44` **INFO** Pushed: rc=0 + +## Phase-21 Run beendet (2026-05-23 08:16:44) + +- `08:16:44` **INFO** OK: 0, Attempted: 6, Total: 6 + +## 🚀 Phase-22 Codegen-Run gestartet (2026-05-23 08:17:40) + + +## Phase-3 Feature: voice-input-stub (2026-05-23 08:17:40) + +- `08:17:40` **INFO** Description: Voice-Input-Stub via Web Speech API für TimeEntry description +- `08:17:40` **INFO** Generating apps/web/src/components/VoiceInput.tsx (VoiceInput-Component. Mic-Button. Klick startet window.SpeechRecogniti…) +- `08:18:03` **INFO** wrote 2620 chars in 22.7s (attempt 1) +- `08:18:03` **INFO** Running tsc --noEmit on api… +- `08:18:05` **WARN** tsc errors: +src/index.ts(27,25): error TS2769: No overload matches this call. + Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. + Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. + Type 'Promise' provides no match for the signature '(instance: FastifyInstance, FastifyBaseLogger, FastifyTypeProvider>, opts: { ...; }, done: (err?: Error | undefined) => void): void'. + Overload 2 of 3, '(plugin: FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. + Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. + Type 'Promise' provides no match for the signature '(instance: FastifyInstance, FastifyBaseLogger, FastifyTy diff --git a/apps/web/src/components/VoiceInput.tsx b/apps/web/src/components/VoiceInput.tsx new file mode 100644 index 0000000..7aa3413 --- /dev/null +++ b/apps/web/src/components/VoiceInput.tsx @@ -0,0 +1,92 @@ +import React, { useState, useEffect, useRef } from 'react'; +import { Mic, MicOff, Loader2 } from 'lucide-react'; +import { toast } from 'sonner'; + +interface VoiceInputProps { + onTranscribed: (text: string) => void; + className?: string; +} + +export default function VoiceInput({ onTranscribed, className = "" }: VoiceInputProps) { + const [isListening, setIsListening] = useState(false); + const [isSupported, setIsSupported] = useState(true); + const recognitionRef = useRef(null); + + useEffect(() => { + const SpeechRecognition = (window as any).SpeechRecognition || (window as any).webkitSpeechRecognition; + + if (!SpeechRecognition) { + setIsSupported(false); + return; + } + + const recognition = new SpeechRecognition(); + recognition.lang = 'de-DE'; + recognition.interimResults = false; + recognition.continuous = false; + + recognition.onresult = (event: any) => { + const text = event.results[0][0].transcript; + onTranscribed(text); + setIsListening(false); + }; + + recognition.onerror = (event: any) => { + console.error('Speech recognition error:', event.error); + toast.error(`Spracherkennung Fehler: ${event.error}`); + setIsListening(false); + }; + + recognition.onend = () => { + setIsListening(false); + }; + + recognitionRef.current = recognition; + }, [onTranscribed]); + + const toggleListening = () => { + if (!isSupported) { + toast.error("Spracherkennung wird von diesem Browser nicht unterstützt."); + return; + } + + if (isListening) { + recognitionRef.current?.stop(); + setIsListening(false); + } else { + try { + recognitionRef.current?.start(); + setIsListening(true); + } catch (e) { + console.error(e); + setIsListening(false); + } + } + }; + + return ( + + ); +} \ No newline at end of file diff --git a/scripts/phase22_features.py b/scripts/phase22_features.py new file mode 100644 index 0000000..d3a34ad --- /dev/null +++ b/scripts/phase22_features.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 +"""Phase-22: voice-input-stub, screen-rec-attach, popout-tracker, project-favicons, ui-polish.""" + +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 / ".phase22-state.json" + +FEATURES: list[Feature] = [ + Feature( + name="voice-input-stub", + description="Voice-Input-Stub via Web Speech API für TimeEntry description", + files=[FileGen( + path="apps/web/src/components/VoiceInput.tsx", + purpose=( + "VoiceInput-Component. Mic-Button. Klick startet window.SpeechRecognition() (oder webkitSpeechRecognition). " + "On result: ruft onTranscribed(text). Toast wenn nicht supported. de-DE als lang." + ), + )], + ), + Feature( + name="popout-tracker", + description="Active-Timer als Popup-Window (window.open)", + files=[FileGen( + path="apps/web/src/components/ActiveTimer.tsx", + purpose=( + "ERWEITERT — behalte bestehende ActiveTimer. Füge 'Pop out'-Button: window.open('/tracker-popout', 'tracker', 'width=320,height=220'). " + "Plus neue Component PopoutTrackerView die kompakte Version zeigt." + ), + refs=["apps/web/src/components/ActiveTimer.tsx"], + )], + ), + Feature( + name="project-favicons", + description="Pro Project ein favicon (emoji oder initial)", + files=[FileGen( + path="apps/api/src/db/schema.ts", + purpose=( + "WICHTIG: BEHALTE ALLE bestehenden Tabellen und Spalten. Füge nur Spalte `icon: text('icon')` (nullable) zu projects. " + "BEHALTE: users, customers, projects (mit budgetHours, pinnedAt), projectTemplates, timeEntries (mit notes, externalLink), " + "timeEntryAttachments, timeEntryComments, appSettings (mit roundingMinutes), auditLog, documents, webhooks, savedViews, " + "apiKeys, passwordResetTokens, invitations." + ), + refs=["apps/api/src/db/schema.ts"], + ), FileGen( + path="apps/web/src/pages/Projects.tsx", + purpose=( + "ERWEITERT — füge Icon-Input zum Create-Form (emoji-Picker einfach: text-input mit max-length 2). " + "Zeige Icon vor name in Liste." + ), + refs=["apps/web/src/pages/Projects.tsx"], + )], + ), + Feature( + name="ui-polish", + description="Globale UI-Verbesserungen (hover-states, focus-rings, transition-all)", + files=[FileGen( + path="apps/web/src/index.css", + purpose=( + "ERWEITERT — behalte @tailwind setup + dark-mode-overrides. Füge globalen polish: " + "* { transition: colors 150ms } für sanftere theme-switches. " + "button:focus-visible { outline ring-2 ring-ember-500 outline-offset-2 }. " + "input:focus { ring-2 ring-ember-500 border-ember-500 }." + ), + refs=["apps/web/src/index.css"], + )], + ), + Feature( + name="screen-recording-attach-stub", + description="'Screen-Recording aufnehmen' Stub-Button (kein echtes recording)", + files=[FileGen( + path="apps/web/src/pages/TimeEntries.tsx", + purpose=( + "ERWEITERT — füge im Create-Form 'Screen-Recording'-Button (Camera-Icon). " + "Klick: useToast().info('Screen-Recording kommt in v2. Aktuell: upload manuell via Documents-Page'). " + "Behalte alles bestehende." + ), + refs=["apps/web/src/pages/TimeEntries.tsx"], + )], + ), +] + + +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-22 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-22 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()))