/** * Domain declaration writer (spec 17, part B). * * `scanDomains` reads first-class `domain "" { ... }` declarations and * `dql doctor` warns when a used domain has no such declaration — but until now * there was no way to AUTHOR one. This module emits a `domain` declaration in * the EXACT format the parser (`parseDomainDecl`) + `scanDomains` accept, and * resolves the canonical on-disk location for it. * * Convention (matches `scanDomains` + the "domain-first folders" test): * domains//domain.dql ← when a domain folder exists or is chosen * domains//domain.dql ← created if absent (the writer makes the dir) * * A domain authored here is `name`, `owner`, `boundedContext`, `sourceSystems`, * `description`. `reviewCadence` is included with a sensible default so the * doctor's "missing reviewCadence" warning is also satisfied. */ /** A domain authored through the writer (spec 17, part B). */ export interface DomainInput { name: string; /** Stable dot-qualified package id. Defaults to the normalized name for compatibility. */ id?: string; parent?: string; owner?: string; businessOwner?: string; boundedContext?: string; sourceSystems?: string[]; primaryTerms?: string[]; tags?: string[]; businessOutcome?: string; description?: string; inScope?: string[]; outOfScope?: string[]; dbtGroups?: string[]; dbtPaths?: string[]; dbtTags?: string[]; semanticDomains?: string[]; semanticTags?: string[]; /** Compatibility entity export ids; prefer structured v3 interfaces for new policy. */ exports?: string[]; /** Optional review cadence; defaults to "quarterly" so doctor stays quiet. */ reviewCadence?: string; /** Existing project-relative source path. Used for legacy flat declarations. */ sourcePath?: string; } export interface WrittenDomain { /** Project-relative path of the written `domain.dql`. */ path: string; /** Absolute path on disk. */ absPath: string; /** The folder slug under `domains/`. */ slug: string; } /** Normalize a domain name/id into a folder slug under `domains/`. */ export declare function domainFolderSlug(value: string): string; /** * Render a first-class `domain` declaration that `scanDomains` reads back. The * field order + syntax mirror the parser's accepted set so a round-trip is * lossless for the authored fields. */ export declare function renderDomainDeclaration(domain: DomainInput): string; /** * Resolve the canonical `domains//domain.dql` path for a domain. Honors an * EXISTING `domain.dql` anywhere under `domains//` (so a PUT/DELETE finds * the file `scanDomains` actually read), else falls back to the canonical path. */ export declare function resolveDomainDeclPath(projectRoot: string, nameOrSlug: string): { absPath: string; relativePath: string; slug: string; }; /** * Write (create or overwrite) a first-class domain declaration. Returns the path * written. The folder is created so subsequent block authoring can place blocks * under `domains//blocks/`. */ export declare function writeDomainDeclaration(projectRoot: string, domain: DomainInput): WrittenDomain; /** * Delete a domain declaration file. Returns true when a file was removed. Only * the declaration `.dql` is removed — authored blocks/terms under the folder are * left untouched. */ export declare function deleteDomainDeclaration(projectRoot: string, nameOrSlug: string): boolean; //# sourceMappingURL=domain-writer.d.ts.map