Skip to content

Commit fa966e4

Browse files
author
Sorra
authored
Merge pull request #926 from TheWizardsCode/wl-0MMMFYJTO0B4H4UV-doctor-fixes
Doctor: auto-fix common status/stage mismatches (WL-0MMMFYJTO0B4H4UV)
2 parents 7c3d7ba + 6e6e5ec commit fa966e4

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/commands/doctor.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,28 @@ export default function register(ctx: PluginContext): void {
211211
// fall back to hard-coded default
212212
}
213213

214+
// Auto-fix rules for common incompatible status/stage combos
215+
for (const f of findings) {
216+
try {
217+
const ctx = (f && (f as any).context) || {};
218+
// completed + (in_progress|intake_complete|idea) -> completed + in_review
219+
if (f.type === 'incompatible-status-stage' && ctx.status === 'completed' && (ctx.stage === 'in_progress' || ctx.stage === 'intake_complete' || ctx.stage === 'idea')) {
220+
const current = (f.proposedFix && typeof f.proposedFix === 'object') ? (f.proposedFix as Record<string, unknown>) : {};
221+
(f as any).proposedFix = Object.assign({}, current, { stage: 'in_review' });
222+
(f as any).safe = true;
223+
}
224+
225+
// deleted + in_progress -> deleted + done
226+
if (f.type === 'incompatible-status-stage' && ctx.status === 'deleted' && ctx.stage === 'in_progress') {
227+
const current = (f.proposedFix && typeof f.proposedFix === 'object') ? (f.proposedFix as Record<string, unknown>) : {};
228+
(f as any).proposedFix = Object.assign({}, current, { stage: 'done' });
229+
(f as any).safe = true;
230+
}
231+
} catch (e) {
232+
// ignore
233+
}
234+
}
235+
214236
// Normalize certain findings: if an invalid/empty stage can be safely defaulted, mark safe
215237
for (const f of findings) {
216238
try {

0 commit comments

Comments
 (0)