|
@@ -44,6 +44,9 @@ export const statusCommand = new Command("status")
|
|
|
const failed = index.filter(
|
|
const failed = index.filter(
|
|
|
(ch) => ch.status === "audit-failed",
|
|
(ch) => ch.status === "audit-failed",
|
|
|
).length;
|
|
).length;
|
|
|
|
|
+ const degraded = index.filter(
|
|
|
|
|
+ (ch) => ch.status === "state-degraded",
|
|
|
|
|
+ ).length;
|
|
|
const totalWords = index.reduce((sum, ch) => sum + ch.wordCount, 0);
|
|
const totalWords = index.reduce((sum, ch) => sum + ch.wordCount, 0);
|
|
|
const avgWords = index.length > 0 ? Math.round(totalWords / index.length) : 0;
|
|
const avgWords = index.length > 0 ? Math.round(totalWords / index.length) : 0;
|
|
|
|
|
|
|
@@ -60,6 +63,7 @@ export const statusCommand = new Command("status")
|
|
|
approved,
|
|
approved,
|
|
|
pending,
|
|
pending,
|
|
|
failed,
|
|
failed,
|
|
|
|
|
+ degraded,
|
|
|
...(migrationHint ? { migrationHint } : {}),
|
|
...(migrationHint ? { migrationHint } : {}),
|
|
|
...(opts.chapters ? {
|
|
...(opts.chapters ? {
|
|
|
chapterList: index.map((ch) => ({
|
|
chapterList: index.map((ch) => ({
|
|
@@ -67,7 +71,9 @@ export const statusCommand = new Command("status")
|
|
|
title: ch.title,
|
|
title: ch.title,
|
|
|
status: ch.status,
|
|
status: ch.status,
|
|
|
wordCount: ch.wordCount,
|
|
wordCount: ch.wordCount,
|
|
|
- ...(ch.status === "audit-failed" ? { issues: ch.auditIssues } : {}),
|
|
|
|
|
|
|
+ ...(ch.status === "audit-failed" || ch.status === "state-degraded"
|
|
|
|
|
+ ? { issues: ch.auditIssues }
|
|
|
|
|
+ : {}),
|
|
|
})),
|
|
})),
|
|
|
} : {}),
|
|
} : {}),
|
|
|
});
|
|
});
|
|
@@ -78,7 +84,7 @@ export const statusCommand = new Command("status")
|
|
|
log(` Platform: ${book.platform} | Genre: ${book.genre}`);
|
|
log(` Platform: ${book.platform} | Genre: ${book.genre}`);
|
|
|
log(` Chapters: ${persistedChapterCount} / ${book.targetChapters}`);
|
|
log(` Chapters: ${persistedChapterCount} / ${book.targetChapters}`);
|
|
|
log(` Words: ${totalWords.toLocaleString()} (avg ${avgWords}/ch)`);
|
|
log(` Words: ${totalWords.toLocaleString()} (avg ${avgWords}/ch)`);
|
|
|
- log(` Approved: ${approved} | Pending: ${pending} | Failed: ${failed}`);
|
|
|
|
|
|
|
+ log(` Approved: ${approved} | Pending: ${pending} | Failed: ${failed} | Degraded: ${degraded}`);
|
|
|
if (migrationHint) {
|
|
if (migrationHint) {
|
|
|
log(` Migration: ${migrationHint}`);
|
|
log(` Migration: ${migrationHint}`);
|
|
|
}
|
|
}
|
|
@@ -86,9 +92,15 @@ export const statusCommand = new Command("status")
|
|
|
if (opts.chapters && index.length > 0) {
|
|
if (opts.chapters && index.length > 0) {
|
|
|
log("");
|
|
log("");
|
|
|
for (const ch of index) {
|
|
for (const ch of index) {
|
|
|
- const icon = ch.status === "approved" ? "+" : ch.status === "audit-failed" ? "!" : "~";
|
|
|
|
|
|
|
+ const icon = ch.status === "approved"
|
|
|
|
|
+ ? "+"
|
|
|
|
|
+ : ch.status === "audit-failed"
|
|
|
|
|
+ ? "!"
|
|
|
|
|
+ : ch.status === "state-degraded"
|
|
|
|
|
+ ? "x"
|
|
|
|
|
+ : "~";
|
|
|
log(` [${icon}] Ch.${ch.number} "${ch.title}" | ${formatLengthCount(ch.wordCount, countingMode)} | ${ch.status}`);
|
|
log(` [${icon}] Ch.${ch.number} "${ch.title}" | ${formatLengthCount(ch.wordCount, countingMode)} | ${ch.status}`);
|
|
|
- if (ch.status === "audit-failed" && ch.auditIssues.length > 0) {
|
|
|
|
|
|
|
+ if ((ch.status === "audit-failed" || ch.status === "state-degraded") && ch.auditIssues.length > 0) {
|
|
|
const criticals = ch.auditIssues.filter((i: string) => i.startsWith("[critical]"));
|
|
const criticals = ch.auditIssues.filter((i: string) => i.startsWith("[critical]"));
|
|
|
const warnings = ch.auditIssues.filter((i: string) => i.startsWith("[warning]"));
|
|
const warnings = ch.auditIssues.filter((i: string) => i.startsWith("[warning]"));
|
|
|
if (criticals.length > 0) {
|
|
if (criticals.length > 0) {
|
|
@@ -97,7 +109,13 @@ export const statusCommand = new Command("status")
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (warnings.length > 0) {
|
|
if (warnings.length > 0) {
|
|
|
- log(` + ${warnings.length} warning(s)`);
|
|
|
|
|
|
|
+ if (ch.status === "state-degraded") {
|
|
|
|
|
+ for (const issue of warnings) {
|
|
|
|
|
+ log(` ${issue}`);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log(` + ${warnings.length} warning(s)`);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|