import { type HygieneCommonOptions } from "../shared.js"; /** * Inbound-reference kinds we currently surface. * * - `primary-template`: items whose `_template` is the target. These * are the items that would lose their template definition outright * if the target were deleted — usually the dominant blocker. * * - `base-template`: templates whose `_basetemplates` contains the * target through any depth of inheritance. Deleting the target * orphans every inheritor's inherited fields/sections. * * - `insert-options`: Standard-Values items whose `__masters` * contains the target. Deleting the target removes an entry from * the parent template's Insert Options menu — content authors * lose the ability to create that child type. * * - `branch-source`: items (typically other templates / branch * definitions) whose `__source` contains the target. Deleting * breaks the "New from Branch" flow for that branch. * * - `datasource-template`: Rendering items whose `Datasource * Template` field designates the target as the type new * datasources must conform to. Deleting breaks the rendering's * "Create Local Datasource" flow in Pages / Experience Editor. * * Lower-priority kinds intentionally not covered yet (track separately): * - Custom droplist/treelist fields whose `Source=` value resolves * to the target's path. Requires per-field-definition scan. * - Generic ID-bearing fields that happen to hold the target's GUID * in their value. Use `audit references --to ` for a * broader content-text scan when this audit returns nothing. */ export type TemplateReferenceKind = "primary-template" | "base-template" | "insert-options" | "branch-source" | "datasource-template"; export interface AuditTemplateDependenciesOptions extends HygieneCommonOptions { /** Target template ID — GUID in any standard form ({…}, dashes, flat). Required. */ templateId?: string; /** Override the search index. */ index?: string; /** Cap on number of references per kind. Default 5000. */ limit?: number; /** Skip a reference kind by name. Use to scope big tenants. */ skip?: TemplateReferenceKind[]; /** * Suppress the audit's own report. Used by cleanup tasks that call * this audit as a pre-flight check and surface blockers in their own * combined report rather than as a separate audit record. Default * false — direct CLI / MCP callers always see the audit report. */ silent?: boolean; } export interface TemplateDependencyReport { itemId: string; path: string | null; name: string; templateId: string | null; templateName: string | null; /** Why this item references the target template. */ referenceKind: TemplateReferenceKind; } /** * Inverse of `audit dead-templates`: for a given template, list every * item in the tenant that points at it — primary template, inheritor, * insert-options host, branch source. Use this to triage what's * blocking a template delete *before* calling `cleanup dead-templates` * or running an ad-hoc delete. * * `audit dead-templates` answers "is X safe to delete?" in aggregate. * This answers "what specifically points at X?" with an actionable * list grouped by reference kind. */ export declare const runAuditTemplateDependencies: (options: AuditTemplateDependenciesOptions) => Promise;