/** * Close-pending markers: increments whose last task a Claude Code session * finished through the CLI, and that are not closed yet. * * `specweave task done` / `task skip` writes one when the board turns * all-terminal, into a file of the session it ran in * (`~/.specweave/close-pending/.json`; Claude Code sets * that variable for every shell command and passes the same id to hooks as * `session_id`). The file lives under the user's home, not the project, so a * session that ran the command in a sibling worktree is still found, and no * two sessions ever write the same file. The Stop hook reminds that session * once to verify and close, then drops the entry. Entries also go once the * increment is closed, gets open tasks again, or is older than * CLOSE_PENDING_MAX_AGE_MS (pickup's "/sw:done" hint covers it from then on). * Without a session id (Codex, a plain terminal) nothing is written: those * tools get the close instruction from the command output and AGENTS.md. * * The hook supervisor (plugins/specweave/hooks/run.mjs) checks only whether * this session's file exists, so it is deleted once empty. * Every function here is best-effort: bookkeeping must never fail a command. * * @module core/increment/close-pending */ /** Folder under `~/.specweave/`; run.mjs checks the same path. */ export declare const CLOSE_PENDING_DIR = "close-pending"; /** After a day the finishing session is gone; pickup takes over. */ export declare const CLOSE_PENDING_MAX_AGE_MS: number; export interface ClosePendingEntry { /** Project root whose `.specweave/increments/` this is. */ root: string; /** Increment folder name. */ id: string; /** When the last task turned done or skipped. */ at: string; } /** Entries keyed by `\n`. */ export type ClosePending = Record; /** This session's marker file, or null when the id is not path-safe. */ export declare function closePendingFile(session: string, home?: string): string | null; /** The steps that close an increment, in the order the loop runs them. */ export declare function closeChain(id: string): string; /** The Claude Code session a CLI command runs in, if any. */ export declare function currentSessionId(env?: NodeJS.ProcessEnv): string | undefined; /** Closed for good, including the legacy spellings metadata reads normalize. */ export declare function isClosedStatus(status: unknown): boolean; export declare function readClosePending(session: string): ClosePending; /** Record that `session` finished every task of `id` under `root`, so its Stop reminds it to close. */ export declare function markClosePending(root: string, id: string, session: string | undefined, now?: Date): void; /** * Drop entries, re-reading first and keeping any entry re-marked since it was * read (a different `at`). Returns false when the file could not be updated. */ export declare function removeClosePending(session: string, read: ClosePending, keys: string[]): boolean; //# sourceMappingURL=close-pending.d.ts.map