/** * Comment-preserving editor for skaile.yaml files. * * Uses the `yaml` library's Document API to parse into an AST that retains * comments, blank lines, and formatting. Mutations are applied to the AST * and serialized back — untouched sections remain byte-identical. * * Usage: * * import { WorkspaceYamlEditor } from '@skaile/workspaces/core' * * const editor = WorkspaceYamlEditor.load('/project/skaile.yaml') * editor.setAgentConfig('default', { driver: 'claude-sdk', model: 'claude-sonnet-4-6' }) * editor.setSource({ url: 'https://github.com/skaile-ai/ai-assets' }) * editor.save() */ import { Document } from "yaml"; import type { AgentConfigProfile, ConnectorDeclaration, McpServerDeclaration, OverrideEntry, SourceEntry, StoreEntry } from "./workspace-config.js"; /** * Comment-preserving editor for `skaile.yaml` files. * Uses the `yaml` library's Document AST so untouched sections remain byte-identical. * Create with `WorkspaceYamlEditor.load(filePath)` or `WorkspaceYamlEditor.create(filePath)`. * @docLink packages/core/workspace-config#workspace-yaml-editor */ export declare class WorkspaceYamlEditor { readonly path: string; private doc; private constructor(); /** Load an existing skaile.yaml file. */ static load(filePath: string): WorkspaceYamlEditor; /** Create a new empty document (for use when no file exists yet). */ static create(filePath: string): WorkspaceYamlEditor; /** Write the document back to disk, preserving comments and formatting. */ save(): void; /** Return the serialized YAML string without writing to disk. */ toString(): string; /** Get a top-level scalar field (name, description). */ get(key: "name" | "description"): string | undefined; /** Set a top-level scalar field. */ set(key: "name" | "description", value: string): void; /** * Get an agent config profile by name (usually "default"). * Reads from `agent-config` (canonical YAML key). */ getAgentConfig(profile?: string): AgentConfigProfile | undefined; /** * Set fields on an agent config profile. Merges with existing values — * only the provided fields are overwritten. */ setAgentConfig(profile: string, values: Partial): void; /** * Delete a field from an agent config profile. */ deleteAgentConfigField(profile: string, field: string): void; private _getAgentConfigSection; /** Get all connectors. */ getConnectors(): ConnectorDeclaration[]; /** Add or update a connector by id. */ setConnector(connector: ConnectorDeclaration): void; /** Remove a connector by id. */ removeConnector(id: string): boolean; /** * Add or replace an mcp server entry, matched by `id`. * Mirrors {@link setConnector}: an existing entry with the same `id` is * replaced in place; otherwise the declaration is appended. */ setMcpServer(mcp: McpServerDeclaration): void; /** * Append a dependency ref to `dependencies:`, deduped by exact ref string. * * @param ref - Canonical dependency ref (e.g. `skill:@skaile/foo#1.0.0`). * @returns `true` when the ref was newly added, `false` when it was already present. */ addDependency(ref: string): boolean; /** Get all `plugins:` specifiers. */ getPlugins(): string[]; /** * Add a plugin specifier to `plugins:`, deduped by package name. * If an entry with the same package name exists it is replaced (so a version * bump re-pins in place); otherwise the spec is appended. * * @param spec - npm specifier, e.g. `"@skaile/provider-fly@^0.1.0"`. * @param nameOf - Extracts the package name from a spec (caller passes `parseSpec`-derived names). * @returns `true` when an existing entry was replaced, `false` when appended. */ addPlugin(spec: string, nameOf: (s: string) => string): boolean; /** * Remove the `plugins:` entry whose package name matches `name`. * * @param name - Package name to remove (e.g. `"@skaile/provider-fly"`). * @param nameOf - Extracts the package name from a spec. * @returns `true` when an entry was removed. */ removePlugin(name: string, nameOf: (s: string) => string): boolean; /** Get all source entries (`{url, pin?}`). */ getSources(): SourceEntry[]; /** * Add or update a source entry, matched by `url`. * If an entry with the same url exists, it is replaced. */ setSource(entry: SourceEntry): void; /** Remove a source entry by url. Returns true when an entry was removed. */ removeSource(url: string): boolean; /** Get all store entries (`{url}`). */ getStores(): StoreEntry[]; /** Add or update a store entry, matched by `url`. */ setStore(entry: StoreEntry): void; /** Remove a store entry by url. Returns true when an entry was removed. */ removeStore(url: string): boolean; /** Get all override entries (`{ref, source, reason}`). */ getOverrides(): OverrideEntry[]; /** Add or update an override entry, matched by `ref`. */ setOverride(entry: OverrideEntry): void; /** Remove an override entry by ref. Returns true when an entry was removed. */ removeOverride(ref: string): boolean; /** Get the underlying yaml Document for advanced manipulation. */ get document(): Document; } //# sourceMappingURL=workspace-yaml-editor.d.ts.map