From 4238c033fbbbf3d022130ae2f2903bf6eb8be4db Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Sat, 2 May 2026 02:42:26 +0200 Subject: [PATCH] =?UTF-8?q?chore(sf):=20final=20minor=20cleanup=20?= =?UTF-8?q?=E2=80=94=20auto-post-unit=20+=20milestone-framing-check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- src/resources/extensions/sf/auto-post-unit.ts | 1 + .../extensions/sf/milestone-framing-check.ts | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/resources/extensions/sf/auto-post-unit.ts b/src/resources/extensions/sf/auto-post-unit.ts index 814314d2d..83b84967d 100644 --- a/src/resources/extensions/sf/auto-post-unit.ts +++ b/src/resources/extensions/sf/auto-post-unit.ts @@ -87,6 +87,7 @@ import { } from "./sf-db.js"; import { deriveState } from "./state.js"; import { parseUnitId } from "./unit-id.js"; +import { isAwaitingUserInput } from "./user-input-boundary.js"; import { resolveUokFlags } from "./uok/flags.js"; import { UokGateRunner } from "./uok/gate-runner.js"; import { writeTurnGitTransaction } from "./uok/gitops.js"; diff --git a/src/resources/extensions/sf/milestone-framing-check.ts b/src/resources/extensions/sf/milestone-framing-check.ts index 8cc805e14..fb419ff08 100644 --- a/src/resources/extensions/sf/milestone-framing-check.ts +++ b/src/resources/extensions/sf/milestone-framing-check.ts @@ -251,18 +251,15 @@ function titlesOverlap(a: string, b: string): boolean { } /** - * Minimal synchronous readdirSync wrapper to enable overriding in tests - * and to keep the try/catch tidy in the caller. + * List milestone subdirectory names under /milestones/. + * Returns empty array when the directory does not exist or cannot be read. */ -function await_readdirSync(sfDir: string): { readdirSync: string[] } { - const { readdirSync: rds } = require("node:fs") as typeof import("node:fs"); +function listMilestoneDirs(sfDir: string): string[] { const milestonesDir = join(sfDir, "milestones"); - if (!existsSync(milestonesDir)) return { readdirSync: [] }; + if (!existsSync(milestonesDir)) return []; try { - return { - readdirSync: rds(milestonesDir, { withFileTypes: false }) as string[], - }; + return readdirSync(milestonesDir, { withFileTypes: false }) as string[]; } catch { - return { readdirSync: [] }; + return []; } }