/** * `scai hygiene explain orphan-site ` — answer "what is left behind * for this site, and is any of it still referenced?" * * After a Sites-API site delete (or a subtree-removal mistake), folders * can survive under `/sitecore/templates/Project`, `/layout`, and the * media library with no active site pointing at them. `audit * site-residue` finds those orphan trees; but knowing an orphan is * *unreferenced* is what makes it safe to purge. This verb composes the * two: * * - `audit site-residue` — orphan tenant/site trees (run silent). * - `audit references` — inbound field references to each orphan * (run silent, once per orphan tree). * * The report flags every orphan that still has inbound references — * those need their referrers resolved before a * `cleanup site-residue purge` is safe. */ import { type SiteResidueKind } from "../audit/site-residue.js"; import { type HygieneCommonOptions } from "../shared.js"; export interface ExplainOrphanSiteOptions extends HygieneCommonOptions { /** Required. Site (or tenant) folder name to explain. */ site?: string; /** Override the search index. */ index?: string; /** Cap on inbound refs counted per orphan tree. */ limit?: number; /** * Suppress the printed report. The structured `ExplainOrphanSiteReport` * is still returned — set by non-CLI callers (the MCP `explain` tool) * that render the result themselves and must not write to stdout. */ silent?: boolean; } export interface OrphanSiteEntry { kind: SiteResidueKind; path: string; itemId: string; /** Descendant items in the orphan tree. */ descendantCount: number; /** Inbound field references to the orphan tree's root, from live content. */ inboundRefs: number; } export interface ExplainOrphanSiteReport { site: string; orphans: OrphanSiteEntry[]; } /** * Run `audit site-residue` for the named site, then `audit references` * against each orphan tree's root, and print one merged report. */ export declare const runExplainOrphanSite: (options: ExplainOrphanSiteOptions) => Promise;