/** * Local template-file authoring helpers — the PURE half of the authoring loop * (scaffold → validate → publish). No network, no `process.exit`: * * • parse a `.yaml`/`.yml`/`.json` template off disk into a `WorkspaceYaml`, * • run the ONE shared validator (`validateTemplate` from * `@synap-core/workspace-templates`) against the bundled corpus, * • convert a parsed template into the `PackageDefinition` the CP wants, and * • adapt a backend `to-template` `PackageDefinition` back into the * `WorkspaceYaml` shape the validator reads (so the `--from-workspace` * publish path runs the SAME validator as a hand-authored file). * * Kept out of the command layer so it is unit-testable in isolation (the * validator is pure — a bad and a good template are trivial to assert). */ import { type WorkspaceYaml, type ValidateResult, type PackageDefinitionOutput } from "@synap-core/workspace-templates"; /** * Read + parse a local template file into a `WorkspaceYaml`. YAML's parser is a * JSON superset, so one path covers both `.yaml`/`.yml` and `.json`. Throws a * friendly Error (never `process.exit`) on unreadable / unparseable input. */ export declare function parseTemplateFile(filePath: string): WorkspaceYaml; /** * Validate ONE parsed template against the bundled corpus. Pure passthrough to * the shared validator — the ONE door, never a re-implementation. */ export declare function validateTemplateYaml(tpl: WorkspaceYaml): ValidateResult; /** * Convert a parsed local template into the `PackageDefinition` the CP publish * route accepts. Thin wrapper over the shared converter (same one `market * install` uses for the pod apply path). */ export declare function templateToPackageDefinition(tpl: WorkspaceYaml): PackageDefinitionOutput; /** * The subset of a backend `PackageDefinition` the publish/validate paths read. * Structurally matches `PackageDefinitionOutput` AND the backend `to-template` * output (both carry `_meta` + `workspaceName`), so either can flow through. */ export interface PackageDefinitionLike { _meta?: { slug?: string; icon?: string; color?: string; domain?: string; tags?: string[]; isPublic?: boolean; version?: string; }; workspaceName?: string; description?: string; profiles?: unknown[]; views?: unknown[]; entityLinks?: unknown[]; onboarding?: unknown; dependencies?: unknown[]; icon?: string; color?: string; domain?: string; [k: string]: unknown; } /** * Adapt a `PackageDefinition` (from the backend `to-template` door) into the * `WorkspaceYaml` shape `validateTemplate` reads, so the `--from-workspace` * publish path runs the SAME referential-integrity validator as a hand-authored * file rather than a second, drifting copy. */ export declare function packageDefinitionToYaml(def: PackageDefinitionLike): WorkspaceYaml; /** * Build the minimal VALID template YAML a `scaffold` writes — the smallest file * that passes `validateTemplate` AND the CP publish schema, for the author to * edit in place (create-then-configure: no wizard, no prompts). One workspace + * one profile + one property. */ export declare function scaffoldTemplateYaml(slug: string): string;