/** * REQ-ID acceptance gate operations for `cleo req add|list|migrate`. * * Each operation reads/writes the `Task.acceptance` mixed array * (`(string | AcceptanceGate)[]`) via the DataAccessor without touching * any other task fields. * * @epic T760 * @task T782 */ import type { AcceptanceGate, AcceptanceItem } from '@cleocode/contracts'; import type { DataAccessor } from '../store/data-accessor.js'; /** Shape returned by `reqList`. */ export interface ReqListEntry { /** Zero-based index in the task's acceptance array. */ index: number; /** The REQ-ID (always present — strings are filtered out). */ req: string; /** Gate kind discriminant. */ kind: AcceptanceGate['kind']; /** Human-readable description. */ description: string; /** Advisory flag. */ advisory: boolean; } /** Proposal produced by `reqMigrate`. */ export interface MigrationProposal { /** Zero-based index in the original acceptance array. */ index: number; /** Original free-text string. */ original: string; /** Proposed gate (null means no heuristic matched — item is left as-is). */ proposed: AcceptanceGate | null; /** Auto-generated REQ-ID for the proposed gate. */ reqId: string | null; /** Short label for the matched heuristic ('test'|'file'|'lint'|'command'|'manual'). */ heuristic: string | null; } /** Result of `reqMigrate` with `apply: true`. */ export interface MigrationApplyResult { proposals: MigrationProposal[]; applied: number; } /** * Add a typed `AcceptanceGate` (with a REQ-ID) to a task's acceptance array. * * Validates the gate JSON against the Zod schema before writing. Rejects * duplicate REQ-IDs within the same task. * * @param projectRoot - Absolute path to project root * @param taskId - Target task ID * @param gate - Parsed `AcceptanceGate` object (already validated) * @param accessor - Optional pre-created accessor (for testing) * * @throws {CleoError} E_NOT_FOUND when the task does not exist * @throws {CleoError} E_VALIDATION when the REQ-ID already exists on the task * * @task T782 */ export declare function reqAdd(projectRoot: string, taskId: string, gate: AcceptanceGate, accessor?: DataAccessor): Promise<{ task: { id: string; acceptance: AcceptanceItem[]; }; }>; /** * List all REQ-ID–addressed acceptance gates on a task. * * Free-text strings (legacy) in the acceptance array are skipped because * they have no REQ-ID. Only structured `AcceptanceGate` items with a `req` * field are returned. * * @param projectRoot - Absolute path to project root * @param taskId - Target task ID * @param accessor - Optional pre-created accessor (for testing) * * @throws {CleoError} E_NOT_FOUND when the task does not exist * * @task T782 */ export declare function reqList(projectRoot: string, taskId: string, accessor?: DataAccessor): Promise<{ taskId: string; gates: ReqListEntry[]; }>; /** * Heuristic migrator: reads free-text acceptance strings and proposes typed * `AcceptanceGate` replacements. * * Without `apply: true` only proposals are returned. With `apply: true` the * matched strings are replaced in the task's acceptance array and the updated * array is persisted. * * Auto-generated REQ-IDs use the pattern `MIGRATED-001`, `MIGRATED-002`, etc. * Strings that already contain a structured gate (object items) are skipped. * * @param projectRoot - Absolute path to project root * @param taskId - Target task ID * @param apply - When true, writes the proposals back to the task * @param accessor - Optional pre-created accessor (for testing) * * @throws {CleoError} E_NOT_FOUND when the task does not exist * * @task T782 */ export declare function reqMigrate(projectRoot: string, taskId: string, apply: boolean, accessor?: DataAccessor): Promise<{ proposals: MigrationProposal[]; applied?: number; }>; /** * Validate a raw JSON string against the `acceptanceGateSchema` Zod schema. * * Returns the parsed `AcceptanceGate` on success or throws a `CleoError` * with exit code `E_VALIDATION` on failure. * * @param raw - Raw JSON string from `--gate` CLI flag * * @throws {CleoError} E_VALIDATION when JSON is malformed or schema invalid * * @task T782 */ export declare function parseGateJson(raw: string): AcceptanceGate; //# sourceMappingURL=req.d.ts.map