Просмотр исходного кода

fix: unify CLI display status with persisted status values

ChapterPipelineResult.status now uses "ready-for-review"/"audit-failed"
matching what's saved to chapters/index.json, instead of the
mismatched "approved"/"needs-review".
Ma 7 месяцев назад
Родитель
Сommit
9b03bed50e

+ 2 - 2
packages/cli/src/commands/daemon.ts

@@ -42,7 +42,7 @@ export const upCommand = new Command("up")
         cooldownAfterChapterMs: config.daemon.cooldownAfterChapterMs,
         maxChaptersPerDay: config.daemon.maxChaptersPerDay,
         onChapterComplete: (bookId, chapter, status) => {
-          const icon = status === "approved" ? "+" : "!";
+          const icon = status === "ready-for-review" ? "+" : "!";
           log(`  [${icon}] ${bookId} Ch.${chapter} — ${status}`);
         },
         onError: (bookId, error) => {
@@ -90,7 +90,7 @@ export const downCommand = new Command("down")
       } catch {
         log(`Daemon (PID: ${pid}) not found. Cleaning up.`);
       }
-      await unlink(pidPath);
+      try { await unlink(pidPath); } catch { /* already cleaned up by daemon */ }
     } catch {
       log("No daemon running.");
     }

+ 2 - 2
packages/core/src/pipeline/runner.ts

@@ -40,7 +40,7 @@ export interface ChapterPipelineResult {
   readonly wordCount: number;
   readonly auditResult: AuditResult;
   readonly revised: boolean;
-  readonly status: "approved" | "needs-review";
+  readonly status: "ready-for-review" | "audit-failed";
 }
 
 // Atomic operation results
@@ -644,7 +644,7 @@ export class PipelineRunner {
       wordCount: finalWordCount,
       auditResult,
       revised,
-      status: auditResult.passed ? "approved" : "needs-review",
+      status: auditResult.passed ? "ready-for-review" : "audit-failed",
     };
   }
 

+ 1 - 1
packages/core/src/pipeline/scheduler.ts

@@ -201,7 +201,7 @@ export class Scheduler {
 
       const result = await this.pipeline.writeNextChapter(bookId, undefined, tempOverride);
 
-      if (result.status === "approved") {
+      if (result.status === "ready-for-review") {
         this.consecutiveFailures.delete(bookId);
         this.recordChapterWritten();