import type { RequestArtifactRole, RequestArtifactState } from './request-artifact-service.js'; export { checkExpiredBackCompatCommitGate, type ExpiredBackCompatCommitGateOptions } from './backcompat-acceptance.js'; export type RequestType = 'feature' | 'bugfix' | 'refactor' | 'docs' | 'config' | 'chore'; export declare const VALID_REQUEST_TYPES: ReadonlyArray; export declare const DEFAULT_REQUEST_TYPE: RequestType; export declare function isRequestType(value: string): value is RequestType; export type ArtifactPrerequisite = { /** Relative path under `.peaks/_runtime//`. May contain `` placeholder. */ relativePath: string; /** Human-readable description of what this artifact represents. */ description: string; /** Optional content markers — when set, the file must contain ALL of these (case-insensitive substring). */ mustContain?: ReadonlyArray; /** * Optional content markers — when set, the file must contain AT LEAST ONE of * these (case-insensitive substring). Use this for escape-hatch patterns * (e.g. perf-baseline's "Results table" OR "N/A — no perf surface" stub). * `mustContain` and `mustContainAny` are independent: when both are set, * `mustContain` markers must all be present AND at least one `mustContainAny` * marker must be present. */ mustContainAny?: ReadonlyArray; /** * Slice 2.6.1.F: structural heading markers — when set, the file must * contain ALL of these as markdown headings (line beginning with `#`–`###` * followed by the marker, case-insensitive). This prevents a file from * passing the gate by simply mentioning the marker as prose. Use this for * section-anchored gates like the karpathy 4-guideline review. * Independent of `mustContain` / `mustContainAny`. */ headingMustContain?: ReadonlyArray; /** * The immediately previous location of this artifact. When * `relativePath` does not resolve on disk, the resolver tries this * path before reporting the prereq as missing. * * This field is a published surface, not just a private hint: * `verify-pipeline`'s `contractEvidencePaths()` * (`src/services/workflow/pipeline-verify-gate-support.ts`) reads it * to build its probe list, so it must keep meaning "the one path a * previous release wrote". Do not repurpose it as a general list — * add older tiers to `legacyRelativePaths` instead. * * Body checks (`mustContain` / `mustContainAny` / * `headingMustContain`) apply to whichever path resolved — the * gate does not distinguish which path served the file. That is * deliberate: a legacy hit must keep the gate open, or existing * sessions would fail the transition on upgrade. */ legacyRelativePath?: string; /** * Further, older locations, tried **in declared order** after * added this because the two audit artifacts have a two-release * `audit/security.md` (v2.12.0) and, behind it, the v2.11.x * `rd/security-review.md`. Three sessions on disk * the last of those, so the oldest tier still has to resolve. */ legacyRelativePaths?: ReadonlyArray; /** Back-compat window — a missing file warns instead of failing; see `prerequisite-checks.ts`. */ backCompat?: boolean; /** The release that CLOSES that window (e.g. `v2.14.0`); the warning code's suffix. */ backCompatUntil?: string; }; export type PrerequisiteCheckResult = { ok: boolean; missing: Array<{ path: string; description: string; kind: 'absent' | 'body'; }>; /** * Missing files inside a back-compat window (see * `ArtifactPrerequisite.backCompat`). NOT a failure — the gate does not throw * on these, so legacy callers keep working. They ARE reported: * `transitionRequestArtifact` copies the list onto its success result and * `peaks request transition` prints each one as an envelope warning, so a * soft-passed prerequisite is not read as a passed one. `code` is derived per * prerequisite (`prerequisite-checks.ts`), so it names which artifact. */ warnings: Array<{ path: string; code: string; message: string; expiredWindow?: string; }>; }; export type CheckPrerequisitesOptions = { projectRoot: string; /** * Durable scope of the artifact (the `.peaks/_runtime//` directory * the file lives in). The gate scans under `.peaks/_runtime///` * for prerequisite artifacts. */ sessionId: string; role: RequestArtifactRole; newState: RequestArtifactState; requestId: string; /** * Required, with no default. The `?? DEFAULT_REQUEST_TYPE` that used to sit in * `getPrerequisitesFor`'s signature let a caller silently select the `feature` * table by omitting an argument; a caller that wants the default now has to * write it, and the one place that legitimately substitutes it is the artifact * reader (`request-artifact-metadata.ts`), which labels the substitution. */ requestType: RequestType; /** * False for a caller that is not a state move — the retag command's impact * probe reads the table without transitioning anything, and the event stream * is read as a record of transitions. */ emitEvents?: boolean; }; export declare function getPrerequisitesFor(role: RequestArtifactRole, newState: RequestArtifactState, requestType: RequestType): ReadonlyArray; export declare function checkPrerequisites(options: CheckPrerequisitesOptions): Promise;