/** * Task cards — a readable checklist folded from the ledger. * * A card is one line per task in the right tense with a link to the PR, * report or artifact behind it. Nothing new is stored: the ledger events * may carry `line` and `link` (see core/tasks/ledger.ts), and the fold * fills the gaps — the line falls back to the task title, the link to the * first PR URL, `log: ` or `HEAD ` found in the done evidence. * * The fold is shared with SpecWithCode through * tests/fixtures/cards/fold-fixture.json; change both together. * * @module core/tasks/cards */ import { type FoldOptions, type LedgerEvent, type TaskLedgerState, type TaskLedgerStatus } from './ledger.js'; export type CardState = 'todo' | 'doing' | 'waiting' | 'done' | 'skipped'; export interface Card { id: string; state: CardState; line: string; link: string | null; } export interface CardTaskDef { id: string; title: string; /** Pre-folded state (the task board adds the tasks.md fallback); default: the ledger fold. */ state?: TaskLedgerState; } export interface CardFoldOptions extends FoldOptions { /** `remote.origin.url`; a github.com origin turns `HEAD ` into a commit URL. */ origin?: string; } export declare const CARD_MARKS: Record; /** Ledger task status → card state. */ export declare function cardState(status: TaskLedgerStatus | undefined): CardState; /** `https://github.com//` for a github.com origin URL, else undefined. */ export declare function githubRepoUrl(origin: string | undefined): string | undefined; /** * A link derived from `done` evidence, in this order: * 1. the first GitHub PR URL (`https://github.com/o/r/pull/N`); * 2. a `log: ` token, as a path relative to the increment directory * (a `.specweave/increments//` prefix is stripped); * 3. `HEAD `: a commit URL when the origin is on github.com, else the sha. */ export declare function deriveLink(evidence: string | undefined, opts?: { origin?: string; }): string | null; /** * Fold ledger events and task definitions into cards: spec tasks first, in * their order, then ids that only the ledger knows (branch cards `C-NN`) in * the order they first appear. */ export declare function foldCards(tasks: CardTaskDef[], events: LedgerEvent[], opts?: CardFoldOptions): Card[]; /** Cards for an increment: its task board (spec.md or tasks.md) joined with ledger.jsonl. */ export declare function incrementCards(incrementDir: string, opts?: CardFoldOptions): Card[]; /** Header line, blank line, then ` [ (link)]` per card. */ export declare function renderChecklist(cards: Card[], header: string): string; /** `remote.origin.url` of the repository at `cwd`, if any. */ export declare function readOriginUrl(cwd: string): string | undefined; //# sourceMappingURL=cards.d.ts.map