/** * Composable library + catalog configuration. * * Resolution order (later wins): * 1. Built-in defaults * 2. User-level: ~/.skaile/config.yaml * 3. Project-level: /.skaile/config.yaml * 4. Explicit overrides (API callers) * * This is separate from the workspace config (skaile.yaml) which describes * what assets are in a project. config.yaml configures library/catalog * behaviour globally or per-project. * * @docLink packages/library/api-reference#config */ import { resolveLibraryDir, skaileHomeDir } from "@skaile/workspaces/core"; import * as z from "zod"; /** * Sentinel value for `catalog.url` that disables the remote catalog entirely * and routes the CLI to use {@link LocalCatalogSource} bound to a source * registered via `skaile source add `. * * Used by users who want to stay strictly on local sources (air-gapped repos, * private development without a hosted catalog). See Task 2.7 in * `_devlog/plans/2026-05-06-asset-store-phase-2-remote-anonymous.md`. * * @docLink packages/library/api-reference#config */ export declare const LOCAL_CATALOG_URL: "local"; /** * Type-narrowing predicate for the `local` sentinel value of `catalog.url`. * * Tolerates surrounding whitespace and any letter casing — a user-edited * config with `catalog.url: " Local "` is treated identically to `local`. * Anything else (including non-strings) returns `false`. * * @docLink packages/library/api-reference#config */ export declare function isLocalCatalogUrl(url: string): url is typeof LOCAL_CATALOG_URL; /** * Zod schema for the `catalog:` section of config.yaml. * * `url` accepts either a valid http(s) URL or the literal sentinel * {@link LOCAL_CATALOG_URL} ("local", case-insensitive, whitespace-tolerant). * The sentinel branch normalises to lower-case "local" so downstream code * compares via strict equality. Remote-only consumers such as * `skaile update --catalog-only` reject the sentinel explicitly. * * @docLink packages/library/api-reference#config */ export declare const CatalogConfigSchema: z.ZodObject<{ url: z.ZodOptional>]>>; cache_ttl: z.ZodOptional; framing: z.ZodOptional>; }, z.core.$strip>; /** * Zod schema for the `library:` section of config.yaml. * * @docLink packages/library/api-reference#config */ export declare const LibraryConfigSchema: z.ZodObject<{ dir: z.ZodOptional; pin_policy: z.ZodOptional>; }, z.core.$strip>; /** * Zod schema for the full config.yaml document. * * @docLink packages/library/api-reference#config */ export declare const SkaileConfigSchema: z.ZodObject<{ catalog: z.ZodOptional>]>>; cache_ttl: z.ZodOptional; framing: z.ZodOptional>; }, z.core.$strip>>; library: z.ZodOptional; pin_policy: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; /** * Catalog configuration parsed from `catalog:` in config.yaml. * * @docLink packages/library/api-reference#config */ export type CatalogConfig = z.infer; /** * Library configuration parsed from `library:` in config.yaml. * * @docLink packages/library/api-reference#config */ export type LibraryConfig = z.infer; /** * Full config.yaml document type. * * @docLink packages/library/api-reference#config */ export type SkaileConfig = z.infer; /** * Fully resolved config with all defaults applied. * * @docLink packages/library/api-reference#config */ export interface ResolvedSkaileConfig { catalog: { url: string; cache_ttl: number; framing: "trpc" | "rest"; }; library: { dir: string; pin_policy: "exact" | "minor-track" | "latest"; }; } /** * `~/.skaile` and the library checkouts dir, re-exported from * `@skaile/workspaces/core`, which owns the root policy so CLI discovery and * flow resolution share one definition without a module cycle. They stay * exported here because they are part of this package's public API. * * @docLink packages/library/api-reference#config */ export { resolveLibraryDir, skaileHomeDir }; /** * Resolve the absolute path to the local index SQLite file. * * `SKAILE_INDEX_PATH` overrides the default `~/.skaile/index.db`. * * @docLink packages/library/api-reference#config */ export declare function resolveIndexPath(): string; /** * Return the built-in default configuration values. * * @returns Default catalog URL (skaile.store), 24h TTL, and `~/.skaile/libraries` dir. * @docLink packages/library/api-reference#config */ export declare function getConfigDefaults(): ResolvedSkaileConfig; /** * Return the absolute path to the user-level config file (`~/.skaile/config.yaml`). * * @docLink packages/library/api-reference#config */ export declare function userConfigPath(): string; /** * Return the absolute path to the project-level config file (`.skaile/config.yaml`). * * @param projectDir - Absolute path to the project root. * @docLink packages/library/api-reference#config */ export declare function projectConfigPath(projectDir: string): string; /** * Options for {@link resolveConfig}. * * @docLink packages/library/api-reference#config */ export interface ResolveConfigOptions { /** Project directory (loads .skaile/config.yaml from here). */ projectDir?: string; /** Explicit overrides (highest priority). */ overrides?: Partial; /** Override the user config file path (testing). */ userConfigFile?: string; } /** * Resolve the effective library/catalog configuration. * * Merge order: defaults < user < project < overrides. * * @docLink packages/library/api-reference#config */ export declare function resolveConfig(opts?: ResolveConfigOptions): ResolvedSkaileConfig; /** * Save a config file (user or project level). * * @param filePath - Absolute path to write (e.g. from {@link userConfigPath}). * @param config - Partial config to persist as YAML. * @docLink packages/library/api-reference#config */ export declare function saveConfig(filePath: string, config: Partial): void; //# sourceMappingURL=config.d.ts.map