import { type HygieneCommonOptions } from "../shared.js"; export interface CleanupWorkflowApplyOptions extends HygieneCommonOptions { /** * Workflow ref — GUID, content-tree path, or display/item name. * Required. Same resolution as `scai content workflow apply` / * `scai content workflow get`. */ workflow: string; /** * Optional target state ref (GUID or state name). Defaults to the * workflow's `__Initial state`. */ state?: string; /** * Optional template filter. Accepts a Sitecore template GUID or * absolute content-tree path (e.g. * `/sitecore/templates/Foundation/Article`). When set, only items * whose `_template` matches are attached. Unset = every item under * `--root` is eligible (subject to the other filters). */ template?: string; /** * When true, overwrite the assignment on items already attached to * any workflow. Default false — items already on a workflow are * skipped with status `skipped-already-attached` so the verb defaults * to a safe backfill. */ reattach?: boolean; /** * Optional stale-days filter — only items not updated for at least * this many days are eligible. Unset = no recency filter. */ staleDays?: number; /** Content root to scope. Default `/sitecore/content`. */ root?: string; /** Cap on items attached per run. Default 100. */ maxApplies?: number; /** Cap on items inspected. Default 5000. */ limit?: number; /** Override the search index. */ index?: string; /** Include `/sitecore/system` results. Off by default. */ includeSystem?: boolean; pageParallelism?: number; concurrency?: number; exclude?: string[]; since?: string; whatIf?: boolean; allowWrite?: boolean; baseline?: boolean; output?: string; format?: "json" | "csv" | "markdown"; } export type WorkflowApplyActionStatus = "applied" | "what-if" | "failed" | "skipped-already-attached" | "skipped-template-mismatch"; export interface WorkflowApplyAction { itemId: string; path: string; templateId: string | null; workflowItemId: string; workflowName: string; stateItemId: string; stateName: string; status: WorkflowApplyActionStatus; /** Workflow currently attached, when present and we're not reattaching. */ existingWorkflowId?: string | null; /** State currently attached, when present and we're not reattaching. */ existingStateId?: string | null; error?: string; } /** * Bulk-attach a workflow to items under `--root`, writing `__Workflow` * and `__Workflow state` directly via `setItemWorkflowState`. Bypasses * the workflow engine: submit/validation actions on the target state * do NOT fire — this is a raw field write, the same one used by * `scai content workflow apply ` for the single-item case. * * Strategy: * 1. Resolve `--workflow` to a `WorkflowDefinitionDetail`. Resolve * `--state` (or fall back to the workflow's `__Initial state`). * 2. Optionally resolve `--template` (path → GUID via search) for * the `_template` filter clause. * 3. Enumerate items under `--root` via the search index, applying * template / system / staleness filters in-stream. * 4. For each candidate, fetch its `ItemWorkflow`. If already * attached to the target workflow + state, skip (idempotent). If * attached to any workflow and `--reattach` is false, skip with * `skipped-already-attached`. Otherwise call * `setItemWorkflowState({ workflowId, stateId })`. * * Safety: * - `--max-applies` caps the blast radius (default 100). * - `--what-if` reports the plan without mutating. * - `--allow-write` (or `allowWrite` opt) required outside `--what-if`. * - `--reattach` defaults off so the verb is safe to run against * mixed content — items already on a workflow stay put. */ export declare const runCleanupWorkflowApply: (options: CleanupWorkflowApplyOptions) => Promise;