import { type HygieneCommonOptions } from "../shared.js"; export interface CleanupWorkflowAdvanceOptions extends HygieneCommonOptions { /** * Days since last update. Items in workflow that haven't been * touched for this long are eligible for the advance. Default 30. */ staleDays?: number; /** * Required. Workflow command name to execute (case-insensitive). * Resolved against the item's active workflow. E.g. "Submit", * "Approve", "Reject". The cleanup task fails the item if its * workflow doesn't expose this command. */ commandName: string; /** Comment recorded with the workflow execution (audit trail). */ comments?: string; /** Content root to scope. Default `/sitecore/content`. */ root?: string; /** Cap on items advanced. Default 100. */ maxAdvances?: number; /** Restrict by workflow state name (e.g. "Draft"). */ fromState?: string; index?: string; limit?: number; includeSystem?: boolean; pageParallelism?: number; concurrency?: number; exclude?: string[]; since?: string; whatIf?: boolean; allowWrite?: boolean; baseline?: boolean; output?: string; format?: "json" | "csv" | "markdown"; } export interface WorkflowAdvanceAction { itemId: string; path: string; workflowName: string | null; fromState: string | null; toState: string | null; commandUsed: string; status: "advanced" | "what-if" | "failed" | "skipped-no-command"; error?: string; } /** * Advance items stuck in a workflow state by executing the chosen * workflow command. Soft counterpart to `audit stale-workflow list`. * * Strategy: * 1. Use search to enumerate items under `--root`, filtered by * `updatedDate < now - --stale-days`. * 2. For each candidate, fetch its `ItemWorkflow` to confirm it's * in a non-final state. Optionally filter by `--from-state`. * 3. Resolve `--command-name` against the item's workflow * (`getWorkflowCommands`); pick the first command whose * `displayName` matches case-insensitively. * 4. Call `executeWorkflowCommand`. Capture nextStateId for the * report. * * Safety rails: * - `--max-advances` caps the blast radius (default 100). * - `--what-if` reports the plan without executing. * - `--allow-write` (or env `allowWrite`) required outside `--what-if`. * - `--command-name` is required. There is no "auto-advance to * next state" default — workflows can be arbitrary, and silently * picking a command could approve content prematurely. * * Notes: * - The Authoring API's `executeWorkflowCommand` doesn't reveal * which commands are valid in the current state. We try the * requested command and surface the API's success/failure verbatim. * - Workflow command lookups are cached per-workflow within one * run (avoid N round trips for the same workflow's commands). */ export declare const runCleanupWorkflowAdvance: (options: CleanupWorkflowAdvanceOptions) => Promise;