feat(daily-prep): persist last prep run to a log file and serve it via GetLastPrepLog

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-06-04 09:39:11 +02:00
parent 3a40e39fc8
commit 4d82079cac
4 changed files with 48 additions and 1 deletions

View File

@@ -39,6 +39,10 @@ public sealed class PrimeRunner : IPrimeRunner
var success = false;
try
{
var logPath = DailyPrepPrompt.LogPath();
try { if (File.Exists(logPath)) File.Delete(logPath); } catch { /* best effort */ }
await using var logWriter = new LogWriter(logPath);
await _broadcaster.PrepStartedAsync();
var cwd = Paths.AppDataRoot();
@@ -62,7 +66,11 @@ public sealed class PrimeRunner : IPrimeRunner
arguments: args,
prompt: prompt,
workingDirectory: cwd,
onStdoutLine: line => _broadcaster.PrepLineAsync(line),
onStdoutLine: async line =>
{
await logWriter.WriteLineAsync(line);
await _broadcaster.PrepLineAsync(line);
},
ct: timeoutCts.Token);
success = result.IsSuccess;