import type { WorkspaceSource } from '../compiler.js'; import { type Branding } from '../branding.js'; import { type LikeC4PreparationDiagnostic } from './likec4-prepare.js'; import type { GitChangeOverlay } from './likec4-export.js'; import { type LikeC4ProjectDefinition, type PreparedLikeC4ProjectView } from './likec4-project.js'; /** * A LikeC4 project definition to a generated project, with no filesystem * (ADR 0156). `yarramate-likec4 export-project` reads the definition and * the files it names from disk, runs this, and writes what comes back; * `yarramate/tools` reads them from a store and hands the files to whoever * asked. The checks between preparation and export (deployment nodes, * dynamic steps, duplicate view identities) live here so both callers * refuse the same definitions with the same diagnostics. */ export interface LikeC4ProjectExportInput { /** The `yarramate/likec4-project/v1` document. */ readonly project: WorkspaceSource; /** The workspace's compiler sources: profiles, patterns, documents. */ readonly sources: readonly WorkspaceSource[]; /** * The mapping, kind mapping and projections the definition names, by the * path written in the definition (relative to its directory). `undefined` * for one the caller cannot find is reported as YMLC110. */ readonly readReference: (path: string) => WorkspaceSource | undefined; /** `check` refuses relationships the mapping does not cover; `export` does not. */ readonly requireMappedRelationships: boolean; /** The git-derived review overlay, when the CLI derived one. */ readonly gitChange?: GitChangeOverlay; /** * The host's branding (#546, ADR 0158): the model banner and the project * name in `likec4.config.json`. The marker file and its digests are * machinery and keep their names. */ readonly branding?: Branding; } export interface LikeC4ProjectExported { readonly ok: true; readonly project: LikeC4ProjectDefinition; readonly views: readonly PreparedLikeC4ProjectView[]; /** The `model.likec4` text. */ readonly modelSource: string; readonly projectIdentity: string; readonly mappingIdentity: string; readonly kindMappingIdentity?: string; /** Every source that fed the export, for the marker's input digests. */ readonly inputs: readonly WorkspaceSource[]; /** Echoed from the input so `generatedProjectFiles` names the project for it. */ readonly branding?: Branding; } export type LikeC4ProjectExportResult = LikeC4ProjectExported | { readonly ok: false; readonly diagnostics: readonly LikeC4PreparationDiagnostic[]; }; export declare const exportLikeC4ProjectFromSources: (input: LikeC4ProjectExportInput) => LikeC4ProjectExportResult; export declare const GENERATED_FILE_NAMES: readonly ['likec4.config.json', 'model.likec4', 'specification.likec4']; /** The ownership marker's fields, minus the digests this module computes. */ export interface GeneratedProjectOwnership { readonly format: 'yarramate/likec4-generated-project/v2'; readonly project: string; readonly mapping: string; readonly kindMapping?: string; readonly views: readonly { readonly id?: string; readonly projection: string; readonly comparison?: { readonly from: string; readonly to: string; }; }[]; } export declare const ownershipOf: (exported: LikeC4ProjectExported) => GeneratedProjectOwnership; export declare const inputDigestsOf: (inputs: readonly WorkspaceSource[]) => Readonly>; export declare const projectNameOf: (projectIdentity: string, branding?: Branding) => string; /** * The four files a generated project holds, exactly as the CLI writes them * under its output directory: the config, the model, the specification the * package ships, and the `yarramate.generated.json` marker with every * digest the freshness check reads back. */ export declare const generatedProjectFiles: (exported: LikeC4ProjectExported) => readonly WorkspaceSource[]; /** Whether a source is a project definition rather than a projection. */ export declare const isLikeC4ProjectDefinition: (source: string) => boolean;