/** * Task Board — task definitions + ledger.jsonl state, folded into one view. * * Definitions (`### T-01 Title` + `- AC: … | Files: … | Test: …`) live in the * `## Tasks` section of spec.md (3.0), or in tasks.md for increments created * before 3.0. ledger.jsonl holds STATE (claim/done/release/block/skip events). * The board joins them: ledger wins; a task with no ledger events falls back to * its tasks.md checkbox/`**Status**` (legacy increments keep working). * * State is never written back into markdown: the ledger is the only store, and * `specweave task list` renders the board on demand. `renderTasksMd` remains * for `task render --write`, which refreshes a legacy tasks.md explicitly. * * @module core/tasks/task-board */ import { type Task } from '../../generators/spec/task-parser.js'; import { type FoldOptions, type TaskLedgerState, type LedgerFold } from './ledger.js'; export interface BoardTask extends Task { state: TaskLedgerState; /** Where the state came from. */ source: 'ledger' | 'tasks.md' | 'none'; } export interface TaskBoard { incrementDir: string; tasks: BoardTask[]; fold: LedgerFold; counts: { total: number; done: number; skipped: number; open: number; claimed: number; blocked: number; stale: number; }; /** Task headings in tasks.md the parser could not read (never silently dropped). */ warnings: string[]; } export declare const BOARD_BEGIN = ""; export declare const BOARD_END = ""; /** Numeric part of a task id for ordering (`T-007` → 7, `T-007a` → 7). */ export declare function taskIdNum(id: string): number; /** Letter suffix of a task id, lowercased (`T-007a` → 'a', `T-007` → ''). */ export declare function taskIdSuffix(id: string): string; /** Board order: by number, then by letter suffix (`T-001` < `T-001a` < `T-001b`). */ export declare function compareTaskIds(a: string, b: string): number; /** * Normalize a user-typed task id: `1`, `T1`, `t-01`, `t-1a` → the id in tasks.md. * Falls back to a case-insensitive exact match. */ export declare function normalizeTaskId(input: string, known: string[]): string | undefined; /** Load the board for an increment directory. */ export declare function loadTaskBoard(incrementDir: string, opts?: FoldOptions): TaskBoard; /** Files currently held by live claims (claimed or blocked, not stale). */ export declare function heldFiles(board: TaskBoard, exceptAgent?: string): Map; /** Task ids whose Files overlap with `task`'s Files among live claims of other agents. */ export declare function fileOverlaps(board: TaskBoard, task: BoardTask, agent?: string): string[]; /** Dependencies (legacy `**Dependencies**:`) not yet done/skipped. */ export declare function unmetDeps(board: TaskBoard, task: BoardTask): string[]; /** * First open task (T-id order) with all deps met and no Files overlap with live * claims. `skip` passes over tasks the caller cannot hand out (unfilled placeholders). */ export declare function nextTask(board: TaskBoard, agent?: string, skip?: (t: BoardTask) => boolean): BoardTask | undefined; export declare function normalizePath(p: string): string; /** One-line rendered state for a task. */ export declare function stateLine(state: TaskLedgerState): string; /** Markdown table of the board (also embedded in tasks.md between the SW:BOARD markers). */ export declare function renderBoardTable(board: TaskBoard): string; /** * Rewrite tasks.md from the board: one derived state line per task (inserted * after the field line, or replaced in place), legacy `**Status**: [ ]` * flipped to `[x] completed` for done tasks, and the SW:BOARD table refreshed. * Idempotent. Returns the new content (caller writes it). */ export declare function renderTasksMd(content: string, board: TaskBoard): string; /** Render + write a legacy tasks.md for an increment; no-op when tasks.md is absent. */ export declare function writeRenderedTasksMd(board: TaskBoard): boolean; //# sourceMappingURL=task-board.d.ts.map