import { Logger } from "../../shared/logger.js"; import type { AuthoringApiClient } from "../api/client.js"; import { type RecipeTenantOptions } from "./shared.js"; /** * `scai provision recipe prune-defaults` — remove the SXA Headless OOTB content * that ships with every fresh site under `Available Renderings`, * `Headless Variants`, the per-site `Data` bucket, and the per-site * `Presentation/Styles` bucket. Registry installs ship their own * renderings, variants, datasources, and styles; the OOTB folders just * noise up the authoring tree. Folder parents are preserved (we keep * using `Available Renderings`, `Headless Variants`, `Data`, and * `Styles` ourselves) — only the named child folders are removed. * `Tags` under `Data` is left alone because authors typically populate * it. * * Idempotent by design: each target is `getItem`-ed first, so a missing * path is a clean skip rather than an error. Re-runs after a successful * prune produce zero deletions. The deletion call itself also tolerates * a "not found" / "may have been deleted by another user" response from * the Authoring API — that race shows up when a parallel prune (or an * author) removed the item between getItem and deleteItem. */ declare const DEFAULT_PRUNE_TARGETS: { /** * `Available Renderings` children to remove. SXA ships six default * sections; we keep `FEaaS` (the Forms-as-a-Service rendering bucket) * and `Forms` (the Sitecore Forms bucket) because they're not yet * superseded by registry-side recipes. */ readonly availableRenderings: readonly ["Media", "Navigation", "Page Content", "Page Structure"]; /** * `Headless Variants` children to remove. SXA ships variants for each * default rendering; registry-side recipes emit their own variants * under `/
//` so * the OOTB siblings just clutter the tree. */ readonly headlessVariants: readonly ["Image", "LinkList", "Navigation", "PageContent", "Promo", "RichText", "Title"]; /** * `Data` children to remove. SXA seeds these datasource buckets per * site; registry recipes carry their own datasources, so the OOTB * folders are pure clutter. `Tags` is intentionally omitted — * authors populate it during normal content work. */ readonly contentItems: readonly ["Images", "Link Lists", "Navigation Filters", "Promos", "Texts"]; /** * `Presentation/Styles` children to remove. SXA seeds a set of * default style buckets per site (Spacing, Add Highlight, ...). * Registry installs ship their own styles; the OOTB siblings are * pure clutter. Names use Title Case to match the literal Sitecore * item names — `getItem({ path })` is path-literal, so a casing or * spacing mismatch makes the target report as `missing` rather than * delete the wrong thing. Adjust on first `--what-if` run if any * name doesn't match a real OOTB folder on the target tenant. */ readonly presentationStyles: readonly ["Spacing", "Add Highlight", "Content Alignment", "Background Color", "Background Layout", "Navigation", "Link List", "Rich Text", "Promo", "Image", "Common", "Container"]; }; export type PruneGroup = keyof typeof DEFAULT_PRUNE_TARGETS; export type PruneActionStatus = "deleted" | "missing" | "would-delete"; export interface PruneAction { group: PruneGroup; path: string; status: PruneActionStatus; itemId?: string; } export interface RecipePruneDefaultsOptions extends RecipeTenantOptions { /** Override `headlessVariantsRoot` from the env profile. */ headlessVariantsRoot?: string; /** Override `availableRenderingsRoot` from the env profile. */ availableRenderingsRoot?: string; /** Override `contentItemsRoot` from the env profile. */ contentItemsRoot?: string; /** Override `presentationStylesRoot` from the env profile. */ presentationStylesRoot?: string; /** Print the deletions without applying them. */ whatIf?: boolean; /** Bypass the env profile's `allowWrite` gate. */ allowWrite?: boolean; } export interface RecipePruneDefaultsResult { environment: string; whatIf: boolean; actions: PruneAction[]; summary: { deleted: number; missing: number; wouldDelete: number; }; } interface PruneCoreOptions { client: AuthoringApiClient; availableRenderingsRoot: string; headlessVariantsRoot: string; contentItemsRoot: string; presentationStylesRoot: string; whatIf: boolean; logger?: Logger; } /** * Pure(ish) deletion loop — exposed for unit tests so they can drive * the deletion contract against a fake `AuthoringApiClient` without * threading a full sitecoreai.cli.json through `resolveTenant`. */ export declare const pruneDefaultsAgainstClient: (options: PruneCoreOptions) => Promise; export declare const runRecipePruneDefaults: (options: RecipePruneDefaultsOptions) => Promise; export {};