/** * Manifest Builder — scans a DQL project and produces a DQLManifest. * * This is the core compilation step: discovers all blocks, notebooks, * semantic layer definitions, extracts dependencies, builds lineage, * and optionally imports dbt manifest data. */ import type { DQLManifest } from './types.js'; /** * Filters applied to dbt manifest import to keep only the subgraph relevant * to this DQL project. Each entry is either a plain model name, `tag:`, * or `path:` (matched against the node's `path` / `original_file_path`). * * Semantics * - `anchors` extend the DQL-referenced tables set — upstream BFS will follow * from these as if DQL had queried them directly. * - `include` (if non-empty) narrows the considered set to models matching at * least one entry; upstream deps of those are still walked. * - `exclude` removes matching models from the final import even if they are * upstream of an anchor. */ export interface DbtImportFilters { anchors?: string[]; include?: string[]; exclude?: string[]; } export interface ManifestBuildOptions { /** Project root directory (must contain dql.config.json) */ projectRoot: string; /** DQL CLI version string */ dqlVersion?: string; /** Path to dbt manifest.json for import */ dbtManifestPath?: string; /** Path to a DataLex manifest JSON for optional datalex_contract validation */ datalexManifestPath?: string; /** * Max upstream hops to follow through the dbt DAG from DQL anchor tables. * undefined = follow all the way to raw sources (default). * 3 = stop 3 hops above the anchor tables. * Useful for very large dbt projects to limit imported node count. */ maxDbtHops?: number; /** * Total model threshold above which selective import is always used. * Defaults to 200. Projects with fewer models import everything. */ selectiveDbtThreshold?: number; /** * Selective dbt import filters. When omitted, falls back to `dbtImport` in * `dql.config.json`. Caller-supplied filters take precedence over config. */ dbtImportFilters?: DbtImportFilters; /** Additional directories to scan for .dql files */ extraBlockDirs?: string[]; /** Additional directories to scan for .dqlnb files */ extraNotebookDirs?: string[]; } /** * Enumerate every file whose contents could change the manifest output. * * Used by the cache layer to compute a fingerprint without building. Stays in * sync with `buildManifest`'s scan set: blocks, notebooks, semantic YAML, * `dql.config.json`, and (if present) the dbt `manifest.json`. * * Returns absolute paths, sorted. Does not read file contents. */ export declare function collectInputFiles(options: ManifestBuildOptions): string[]; export declare function buildManifest(options: ManifestBuildOptions): DQLManifest; interface ProjectConfig { project?: string; /** Git-owned OSS workspace layout. Skills may live in the surrounding dbt repo. */ layout?: { version?: number; mode?: string; skillsPath?: string; }; /** Manifest v3 is opt-in and only active with `modeling.mode: "dbt-first"`. */ manifestVersion?: 1 | 2 | 3; modeling?: { mode?: 'dbt-first'; }; semanticLayer?: { provider?: string; path?: string; projectPath?: string; }; dataDir?: string; /** Selective dbt import filters; merged into buildManifest options. */ dbtImport?: DbtImportFilters; /** * dbt integration — so commands can default to the right manifest path * without the user re-typing `--dbt-manifest` on every invocation. */ dbt?: { /** Path to the dbt project root (absolute, or relative to projectRoot) */ projectDir?: string; /** Path to the dbt manifest.json, relative to `projectDir`. Default: target/manifest.json */ manifestPath?: string; /** Directory containing dbt profiles.yml; used by runtime onboarding, never copied into the manifest. */ profilesDir?: string; /** Optional remote source provenance retained by dbt-first onboarding. */ repoUrl?: string; branch?: string; subPath?: string; }; /** Optional interop path to a DataLex compiler manifest. DQL itself does not require DataLex. */ datalex?: { /** Path to datalex-manifest.json, absolute or relative to projectRoot */ manifestPath?: string; }; /** * Optional `dql propose` conventions. Refines the convention-agnostic * classifier + bounded selection. All fields are optional; defaults apply. */ propose?: { /** Folders/tags that mean business (default ["marts","core","reporting"]). */ businessLayers?: string[]; /** Folders/tags that mean plumbing (default ["staging","intermediate","base"]). */ excludeLayers?: string[]; /** Max candidates generated per domain (default 8). */ maxPerDomain?: number; /** Minimum demand score a candidate needs to be selected (default 0). */ minScore?: number; /** Optional AI enrichment toggle (default "auto"). */ aiEnrichment?: 'auto' | 'on' | 'off'; }; } /** * Load `dql.config.json`. Exposed so CLI commands can read the same config * the manifest builder uses — no need for each command to re-implement parse. */ export declare function loadProjectConfig(projectRoot: string): ProjectConfig; /** * Resolve the absolute path to the configured dbt manifest.json (if any). * Honors explicit CLI flag first, then `dbt.projectDir + dbt.manifestPath` from * config, then the conventional `target/manifest.json` inside the project root. * Returns `null` if none of those exist. */ export declare function resolveDbtManifestPath(projectRoot: string, explicit?: string): string | null; /** * Resolve the absolute path to the configured DataLex manifest. * Honors explicit CLI flag first, then `datalex.manifestPath` from config, * then `/datalex-manifest.json`. */ export declare function resolveDataLexManifestPath(projectRoot: string, explicit?: string, loadedConfig?: ProjectConfig): string | null; export {}; //# sourceMappingURL=builder.d.ts.map