/** * What `aidlc roadmap view` shows, before any HTML (html-roadmap-view). * * `readView` is the only function here that touches the disk or git: it lists the primary * checkout's items, asks `pickNextAt` for the ready set, and resolves each instance's * folder, branch and the `origin` remote. `buildView` turns that into columns, marks and * links and is pure, so every board criterion is a test over in-memory items. * * Every link is relative to the directory the page is written to, so the page works from * `file://` wherever it lands, and nothing in it points off the page except GitHub * (AC-11). A link that cannot be made relative — another drive on Windows — is omitted * rather than written as an absolute `file://` URL. * * @module */ import { type Milestone, type MilestonesView } from './milestones.js'; import { type RoadmapItem, type RoadmapStatus } from './paths.js'; import { type PlainSummary } from './summary.js'; import type { RepoCoords } from './sync/body.js'; /** A `v*` tag and the date of the commit it points at. */ export interface Release { version: string; date: string; } /** What `aidlc metrics` knows about an instance. */ export interface InstanceFacts { template: string; trueCostMicroUsd: number | null; causedBugfixes: number; } /** * Three colours, three meanings, never the five states (roadmap-cards-revamp/AC-15): red is * work that is not done and could be picked up, grey is work on hold, green is done. */ export type SquareColour = 'red' | 'grey' | 'green'; export interface Square { ref: string; colour: SquareColour; /** An id no item carries. */ missing: boolean; /** A hold item that was declined, so it will never be done. */ declined: boolean; } /** Dependencies order: blocked, in progress, ready, parked, declined, done (roadmap-cards-revamp/AC-14). */ export type DepsGroup = 0 | 1 | 2 | 3 | 4 | 5; export interface HoldNote { kind: 'parked' | 'declined' | 'on hold'; reason: string | null; } export interface ItemLinks { item: string | null; instance: string | null; retrospective: string | null; pulls: string | null; } export interface ViewItem { /** `i`: position in the global order, and the suffix of every DOM id for it. */ ref: string; key: string; id: string | null; filename: string; status: RoadmapStatus; title: string; /** Backlog rank, or null when unranked, malformed, or not in backlog. */ rank: number | null; createdAt: string | null; /** Date of the last history entry. */ finishedAt: string | null; /** When the item entered its state: the last history date, else `created_at` (roadmap-view-readability/AC-17). */ since: string | null; depRefs: string[]; dependentRefs: string[]; blocked: boolean; ready: boolean; hold: HoldNote | null; summary: string | null; /** The body after the executive summary, as markdown; null when there is none. */ body: string | null; instanceName: string | null; links: ItemLinks; /** Title of the item's milestone; null when milestones are off or it is Unassigned (roadmap-milestones/AC-17). */ milestoneTitle: string | null; /** `## In plain words`, or a draft from the executive summary (roadmap-cards-revamp/AC-1, AC-2). */ plain: PlainSummary | null; /** The release that carried a done item (roadmap-cards-revamp/AC-8). */ release: Release | null; /** The instance's template. */ kind: string | null; trueCostMicroUsd: number | null; causedBugfixes: number; /** Days from `created_at` to the done date; done items only. */ ideaDays: number | null; /** What it needs, red first, then grey, then green. */ needs: Square[]; verdict: string; group: DepsGroup; } export interface RoadmapView { items: ViewItem[]; columns: Record; missing: { ref: string; id: string; dependentRefs: string[]; }[]; /** Every item in Dependencies order (roadmap-cards-revamp/AC-14). */ deps: string[]; /** The Milestones tab, by ref; null when the roadmap has no usable milestones file (roadmap-milestones/AC-14, AC-18). */ milestones: MilestonesView | null; generatedAt: string; } export interface ViewSources { /** Directory the page is written to; every file link is relative to it. */ outDir: string; /** `/.aidlc/state`. */ stateRoot: string; repo: RepoCoords | null; branchOf(instance: string): string | null; /** Backlog file names `roadmap next` would offer. */ ready: ReadonlySet; /** The roadmap's milestones; absent or null when it has none. */ milestones?: readonly Milestone[] | null; /** The release an instance's merge went out in, by its branch when it recorded one; absent without git. */ releaseOf?(branch: string | null, instance: string): Release | null; /** Template and cost of an instance; absent without metrics. */ factsOf?(instance: string): InstanceFacts | null; } /** * `depends_on` resolved to refs: duplicates and self-links dropped, an id no item carries * kept as a `m` ref, numbered in id order, so a typo still shows (html-roadmap-view/AC-27). */ export declare function resolveLinks(items: readonly { ref: string; key: string; deps: readonly string[]; }[]): { missing: { ref: string; id: string; }[]; links: Record; }; /** One verdict per item, by roadmap-cards-revamp/AC-13's rules in order, and its group. */ export declare function verdictOf(status: RoadmapStatus, hold: HoldNote | null, release: Release | null, needs: readonly Square[]): { verdict: string; group: DepsGroup; }; export declare function holdNote(reason: unknown): HoldNote; /** A relative, percent-encoded href from `fromDir` to `target`, or null when none exists. */ export declare function relativeHref(fromDir: string, target: string): string | null; /** GitHub's pull-request search for one head branch (AC-22). A branch link would 404 once merged. */ export declare function pullsUrl(repo: RepoCoords, branch: string): string; /** * `owner`/`name` from an `origin` URL, or null when it is not a GitHub repository (AC-23). * Accepts the https, scp-like ssh and `ssh://` forms, with or without `.git`. */ export declare function parseGitHubRemote(url: string): RepoCoords | null; /** Build the view. Pure: the same items and sources give the same view. */ export declare function buildView(items: readonly RoadmapItem[], sources: ViewSources, now: Date): RoadmapView; /** One release of the Shipped tab; `release` null is "Not in a release". */ export interface ShippedRelease { release: Release | null; refs: string[]; /** The sum over the items that have a cost; null when none has (roadmap-cards-revamp/AC-12). */ trueCostMicroUsd: number | null; } /** * Done items by release, newest first — releases sort by date, then version, descending — * and those with no release last (roadmap-cards-revamp/AC-9). Pure, and in the Board's done * order within a release. */ export declare function shippedReleases(view: RoadmapView): ShippedRelease[]; /** * The branch a merge commit's subject names, in every form this history uses: GitHub's * "from owner/" (or "owner:"), git's "Merge branch ''" with or * without "into", "Merge : what it did" and "merge: — what it did". * "Merge branch 'main' into " on the first-parent line is a branch that landed by * fast-forward, so it names ``. */ export declare function mergeBranch(subject: string): string | null; /** * Releases keyed by instance name, for an instance that recorded no branch: a merged * branch named `/-`, the name `aidlc start` gives, or a bare * ``. A name two branches share is left out rather than guessed. */ export declare function releasesByInstance(byBranch: ReadonlyMap): Map; export interface CommitLine { merge: boolean; date: string; tags: string[]; subject: string; } /** * Each merged branch's release, from first-parent history newest first: the last `v*` tag * seen walking back is the first tag at or after every older commit (roadmap-cards-revamp/AC-8). * A branch merged twice keeps its first merge. */ export declare function releasesByBranch(log: readonly CommitLine[]): Map; /** Releases from one `git log` of the tags' first-parent history; empty without git or tags. */ export declare function readReleases(cwd: string): Map; /** Template and true cost per instance from one `computeMetrics` pass; empty when it fails. */ export declare function readInstanceFacts(projectRoot: string): Map; /** `branch` from an instance's `instance.yaml`, or null. */ export declare function instanceBranch(stateRoot: string, instance: string): string | null; /** The `origin` remote as GitHub coordinates, or null — no remote, not GitHub, or no git. */ export declare function originCoords(cwd: string): RepoCoords | null; /** * Read the primary checkout's roadmap — the items `roadmap next` reads, from whichever * worktree this runs in (AC-8) — and build the view for a page written to `outFile`. */ export declare function readView(cwd: string, outFile: string, now: Date): RoadmapView; //# sourceMappingURL=view-model.d.ts.map