/** * Orphan cleanup for service codegen. * * Service generation is opt-out (#81): every project `kind: object` schema * gets a `ServiceBase.php` (regenerated wholesale, no user content) * and a `Service.php` (sinh-1-lần userFile, may contain hand code). * * When a schema flips from `kind: object` → `kind: pivot`, gets renamed, * removed, opted out via `options.service: false`, or hidden, the * previously-emitted base service stays on disk forever and pollutes * Composer autoload (a class file with no backing schema = mystery code * for the next dev to inherit). * * This module mirrors the existing pivot YAML cleanup pattern * (`RemoveOrphanAutoPivots` in the Go layer): scan known service * directories, diff against the current generation's expected output set, * delete the orphan base files. Editable `*Service.php` files are NEVER * deleted — they may contain hand-written user code — instead a console * warning is printed so the user can decide whether to clean up by hand. */ import type { GeneratedFile, PhpConfig } from './types.js'; export interface ServiceCleanupResult { /** Absolute paths to `*ServiceBase.php` files that were deleted. */ prunedBases: string[]; /** Absolute paths to `*Service.php` files that look orphan but are * preserved (may contain user code). Caller should print a warning. */ warnedEditables: string[]; } /** * Apply service cleanup only while this target is managed by Omnify. * A globally disabled service layer is a migration boundary: existing bases * must remain available until the host application removes its inheritance. */ export declare function pruneOrphanServiceFilesIfEnabled(configDir: string, config: PhpConfig, generated: readonly GeneratedFile[]): ServiceCleanupResult; /** * Delete orphan `*ServiceBase.php` files; flag orphan editable services * for warning. Pure-ish: takes the generated file list (= source of * truth for "what should exist") and the resolved PhpConfig (= where to * look). Filesystem mutations are limited to `unlinkSync` on base files * that are demonstrably absent from the generated set. */ export declare function pruneOrphanServiceFiles(configDir: string, config: PhpConfig, generated: readonly GeneratedFile[]): ServiceCleanupResult;