export type ComponentId = "pi" | "forge-plugin" | "forge-cli"; export interface SeenState { pi: string | null; forgePlugin: string | null; forgeCli: string | null; prevPi: string | null; prevForgePlugin: string | null; prevForgeCli: string | null; lastShownFromPi: string | null; lastShownFromForgePlugin: string | null; lastShownFromForgeCli: string | null; lastShownAt: number; } export interface ChangelogEntry { version: string; date: string | null; sections: { name: string; bullets: string[]; }[]; rawBody: string; } export interface ChangeSummary { component: ComponentId; label: string; fromVersion: string | null; toVersion: string; totalChanges: number; byCategory: Map; entries: ChangelogEntry[]; } declare function defaultCacheDir(): string; declare function cachePath(cacheDir: string): string; export declare function emptySeenState(): SeenState; export declare function readSeenState(cacheDir: string): Promise; export declare function writeSeenState(cacheDir: string, state: SeenState): Promise; export declare function semverGt(a: string, b: string): boolean; /** * Parse a Keep-a-Changelog–style markdown body into per-version entries. * Tolerates pi's `### New Features` overview sections (which precede the * standard `### Added`/`### Fixed` sections) and the `[Unreleased]` block. */ export declare function parseChangelog(markdown: string): ChangelogEntry[]; /** * Reduce a list of changelog entries down to the ones strictly newer than * `from`, up to and including `to`. When `from` is null, returns only the * `to` entry (first-install case — don't dump the whole history). */ export declare function entriesBetween(entries: ChangelogEntry[], from: string | null, to: string): ChangelogEntry[]; declare function normalizeCategory(name: string): string; export declare function summarizeEntries(entries: ChangelogEntry[]): { total: number; byCategory: Map; }; export interface ChangelogSources { pi: string | null; forgePlugin: string | null; forgeCli: string | null; } export declare function resolveChangelogPaths(pkgRoot: string): ChangelogSources; export interface CurrentVersions { pi: string; forgePlugin: string; forgeCli: string; } export type Baseline = "seen" | "prev" | "lastShown"; export interface ComputeOptions { sources: ChangelogSources; current: CurrentVersions; seen: SeenState; /** Which baseline to diff `current` against: * - "seen" (default): auto-dismiss check at session_start. * - "prev": /whats-new replay after auto-dismiss. * - "lastShown": /whats-new replay after explicit dismiss — uses the * `from` versions frozen at the most recent panel-mount so the * last-shown set remains viewable forever. */ baseline?: Baseline; } export declare function computeSummaries(opts: ComputeOptions): ChangeSummary[]; declare function formatVersionRange(from: string | null, to: string): string; declare function formatCategoryBreakdown(byCategory: Map): string; export declare function renderSummaryPanel(summaries: ChangeSummary[]): string; export declare function renderComponentDetail(summary: ChangeSummary): string; export interface WhatsNewRuntime { pkgRoot: string; current: CurrentVersions; cacheDir?: string; } /** * Compute the startup summary and, when present, update the seen state * so subsequent sessions don't replay. Returns the rendered string (or * null when there's nothing to show). * * The `prev*` fields in the seen state preserve the prior baseline so * /whats-new can re-render until the user explicitly dismisses. */ export declare function computeAndPersistStartupPanel(rt: WhatsNewRuntime): Promise<{ rendered: string; summaries: ChangeSummary[]; } | null>; /** * Re-compute summaries against the `prev*` baseline (so users can replay * the panel after auto-dismiss). When `componentArg` matches one of the * three component IDs, returns that component's full detail view instead. */ export declare function computeWhatsNewView(rt: WhatsNewRuntime, componentArg: string | null): Promise; /** * Clear the `prev*` baseline so /whats-new stops replaying past changes. * Current `seen` values are left untouched. */ export declare function dismissWhatsNew(rt: WhatsNewRuntime): Promise; export declare const __test__: { defaultCacheDir: typeof defaultCacheDir; cachePath: typeof cachePath; normalizeCategory: typeof normalizeCategory; formatCategoryBreakdown: typeof formatCategoryBreakdown; formatVersionRange: typeof formatVersionRange; }; export {};