/** * Template registry — SSoT lookup surface over * {@link ./manifest-data.ts | TEMPLATE_MANIFEST_ENTRIES}. * * Replaces the scattered per-domain resolvers * (`getCleoTemplatesDir`, `getWorkflowTemplatesDir`, `resolveAgentTemplates`) * with a single typed registry consumers can query by id, kind, or installed * status. The legacy resolvers remain in place as `@deprecated` shims; T9879 * rewires their last callers and removes them. * * The registry performs a fail-fast existence check at module load: * every entry's `sourcePath` must resolve to a real file in the monorepo * checkout. If any one is missing the registry throws synchronously, which * fails the dev build and CI immediately — preventing a class of "template * silently vanished" regressions. The check is skipped when the registry * runs from a published npm install (no `pnpm-workspace.yaml` reachable), * since the file layout there is flat and only a subset of templates ship. * * @task T9877 * @epic T9874 * @saga T9855 */ import type { TemplateKind, TemplateManifestEntry } from '@cleocode/contracts'; /** * Return the immutable list of every template entry CLEO ships. * * @returns Frozen array of {@link TemplateManifestEntry}. */ export declare function getTemplateManifest(): readonly TemplateManifestEntry[]; /** * Look up a single template entry by its stable `id`. * * @param id - Kebab-case identifier declared in * {@link ./manifest-data.ts | TEMPLATE_MANIFEST_ENTRIES}. * @returns The matching entry, or `undefined` when no entry has that id. */ export declare function getTemplateById(id: string): TemplateManifestEntry | undefined; /** * Return every template entry of the given `kind`. * * @param kind - Category discriminator from `@cleocode/contracts`. * @returns Frozen array of matching entries (empty when none registered). */ export declare function getTemplatesByKind(kind: TemplateKind): readonly TemplateManifestEntry[]; /** * Result of an {@link getInstalledStatus} probe — the absolute path the * registry resolved and whether the file currently exists there. */ export interface InstalledStatus { /** `true` when `path` exists on disk. */ installed: boolean; /** Absolute path the registry computed for the install target. */ path: string; } /** * Probe whether a template's `installPath` currently exists under * `projectRoot`. The probe is a simple `fs.existsSync` — content is NOT * compared and an existing file at the path is considered "installed" * regardless of whether it was written by CLEO. * * @param id - Template id from {@link getTemplateById}. * @param projectRoot - Absolute path to the project root to probe. * @returns Status with the resolved path and the existence flag. * * @throws When `id` is not a registered template entry, or `projectRoot` * is not an absolute path. */ export declare function getInstalledStatus(id: string, projectRoot: string): InstalledStatus; /** * Resolve an entry's `sourcePath` to an absolute filesystem path, handling * both monorepo source checkout AND installed-npm-package layouts. * * Resolution order (first hit wins): * 1. Monorepo workspace root (detected via `pnpm-workspace.yaml`) joined * with the entry's repo-relative `sourcePath`. * 2. Workspace package resolution against the owning npm package * (`@cleocode/core`, `@cleocode/agents`, `@cleocode/skills`) — covers * installed-package layouts where the templates live alongside the * compiled `dist/` directory. * 3. Relative walk anchored on this module's compiled location — final * fallback for environments where neither `pnpm-workspace.yaml` nor * `require.resolve` succeeds. * * @param entry - A template manifest entry. * @returns Absolute path to the source file. * * @throws When no candidate path exists on disk — surfaces as a single * clear error rather than letting downstream `fs.readFile` fail with * an opaque ENOENT. * * @public * @task T9879 */ export declare function resolveSourcePathAbsolute(entry: TemplateManifestEntry): string; //# sourceMappingURL=registry.d.ts.map