/** * `skaile preset apply` — pure core: reverse a `.preset.yaml` snapshot back into * a workspace's `skaile.yaml` sections (the inverse of `preset export`). * * These helpers are I/O- and prompt-free so they can be unit-tested in * isolation. The Commander action in `preset-cmd.ts` owns file reads, the * interactive prompting for non-secret inputs, the editor writes, and the * post-apply install. */ import type { ConnectorDeclaration, McpServerDeclaration, SourceEntry } from "@skaile/workspaces/core"; import type { Placeholder, PresetManifest } from "@skaile/workspaces/types/manifests"; /** The workspace sections produced by reversing a preset's items. */ export interface WorkspaceItems { /** Bare dependency refs, copied verbatim from non-connector/mcp items. */ dependencies: string[]; /** Connector declarations rebuilt from `connector:` items. */ connectors: ConnectorDeclaration[]; /** MCP server declarations rebuilt from `mcp:` items. */ mcpServers: McpServerDeclaration[]; /** Git sources the deps resolve from — registered before install. */ sources: SourceEntry[]; /** Secret placeholder keys the user must export as env vars before running. */ envVarsToSet: string[]; } /** Rejection message for nested preset refs (unsupported by v1 apply). */ export declare const NESTED_PRESET_UNSUPPORTED = "nested presets are not supported by `preset apply` yet"; /** * Resolve one placeholder to the value that lands in `skaile.yaml`. * * A secret placeholder NEVER yields its raw value — it resolves to an * `env:` indirection reference so the credential stays out of the file. * A non-secret placeholder resolves to the provided literal (or its declared * default); a required non-secret placeholder with neither throws. * * @param placeholder - The placeholder definition from the preset item. * @param providedValue - Value supplied via `--input`/prompt, or `undefined`. * @returns `{ envRef }` for secrets, `{ value }` for resolved literals. * @throws When a required non-secret placeholder has no value and no default. */ export declare function resolvePlaceholderValue(placeholder: Placeholder, providedValue: string | undefined): { value: string; } | { envRef: string; }; /** * Reverse a preset's items into additive `skaile.yaml` sections. * * Items are classified by **`id` presence** (export writes one on connector/mcp * items, never on deps), so a bare `mcp:excel` shorthand stays a dependency. * Secret tokens resolve to `env:` refs (collected into `envVarsToSet`). * * @param preset - The validated preset manifest. * @param values - Resolved non-secret input values, keyed by placeholder key. * @returns The workspace sections plus the secret env-var keys to set. * @throws When a required non-secret placeholder is unresolved, or a nested * preset ref is encountered (unsupported by apply). */ export declare function presetItemsToWorkspace(preset: PresetManifest, values: Record): WorkspaceItems; //# sourceMappingURL=preset-apply.d.ts.map