import type { RequestType } from './artifact-prerequisites.js'; import { type RequestTypeSource } from './request-artifact-metadata.js'; import { type RequestArtifactRole } from './request-artifact-service.js'; export type RequestTypeChange = { readonly from: RequestType; readonly fromSource: RequestTypeSource; readonly to: RequestType; }; export type RetagImpact = { /** Paths the new type demands and the old one did not. */ readonly added: ReadonlyArray; /** Paths the old type demanded and the new one does not. */ readonly removed: ReadonlyArray; /** Everything the new type's table demands that is not on disk, added or not. */ readonly missing: ReadonlyArray; }; export type RetagRequestArtifactOptions = { projectRoot: string; role: RequestArtifactRole; requestId: string; requestType: RequestType; /** * Required. Omitting it made `showRequestArtifact` resolve the first session * holding a matching rid, so a WRITE verb could mutate an artifact nobody * named. A write has to say which one. */ sessionId: string; clock?: () => string; }; export type RetagRequestArtifactResult = { role: RequestArtifactRole; requestId: string; sessionId: string; path: string; change: RequestTypeChange; impact: RetagImpact; /** The durable line appended to the artifact body; see `appendRetagNote`. */ note: string; content: string; }; /** * Rewrite the artifact's type, changing the line the READER would take. * `extractMetadata` scans every top-level `- type:` line and keeps the last * usable one, so the writer targets the last line regardless of validity: if the * last is a placeholder and an earlier one is real, the rewrite lands on the * placeholder, which then becomes the usable one — the same line the reader * picks up either way. With no such line at all (the shape a hand-written * carrier has) one is inserted into the metadata block. * * The one other change it makes: lines are split on `\r?\n` and rejoined with * `\n`, so a CRLF body comes back LF-terminated. Reproduced by an independent * reviewer; named rather than implied. */ export declare function setRequestTypeInBody(markdown: string, requestType: RequestType): string; /** * The durable record of a retag, appended rather than rewritten so a later retag * — or a transition's own `- transition note` — leaves every earlier one intact. * * It exists because the type line itself is overwritten and the difference it * makes is not cosmetic: retagging down (`feature` → `chore`) stops nine * artifacts being demanded. Without a line like this the only visible trace of * that would be the envelope of the run that did it, and the artifact tree lives * under a gitignored directory. Same idiom as `updateStatusBlock`'s note. */ export declare function appendRetagNote(markdown: string, change: RequestTypeChange, timestamp: string): string; export declare function retagRequestArtifact(options: RetagRequestArtifactOptions): Promise; /** The envelope lines a retag reports, so the change is not silent. */ export declare function describeRetag(result: RetagRequestArtifactResult): string[];