feat(voice-input-stub): Voice-Input-Stub via Web Speech API für TimeEntry descriptio [tsc:fail]

This commit is contained in:
Dennis (via Claude+Gemma) 2026-05-23 08:18:05 +02:00
parent 8248eb910f
commit 61d337844c
5 changed files with 243 additions and 1 deletions

View File

@ -7,6 +7,7 @@
"snippet-shortcuts", "snippet-shortcuts",
"smart-rounding-on-input", "smart-rounding-on-input",
"color-coded-customer-rows", "color-coded-customer-rows",
"time-entry-templates-page" "time-entry-templates-page",
"router-phase21"
] ]
} }

5
.phase22-state.json Normal file
View File

@ -0,0 +1,5 @@
{
"completed_features": [],
"current_feature": "voice-input-stub",
"started_at": "2026-05-23T08:17:40.778724"
}

View File

@ -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. 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<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTy Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, 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<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, 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<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, FastifyBaseLogger, FastifyTy

View File

@ -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<any>(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 (
<button
onClick={toggleListening}
disabled={!isSupported}
className={`
relative p-2 rounded-full transition-all duration-200
${isListening
? 'bg-red-500 text-white animate-pulse ring-4 ring-red-500/20'
: 'bg-slate-100 text-slate-600 hover:bg-slate-200 dark:bg-slate-800 dark:text-slate-400 dark:hover:bg-slate-700'
}
${className}
`}
title={isListening ? "Stoppen" : "Spracheingabe starten"}
>
{isListening ? (
<Loader2 className="w-5 h-5 animate-spin" />
) : (
<Mic className="w-5 h-5" />
)}
{!isSupported && (
<div className="absolute -top-1 -right-1 w-3 h-3 bg-red-500 rounded-full border-2 border-white dark:border-slate-900" />
)}
</button>
);
}

120
scripts/phase22_features.py Normal file
View File

@ -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()))