import { type Dialect } from './dialects.js'; import type { TrackerSourceConfig } from './types.js'; export type SourceFormat = 'issue-per-file' | 'document'; /** `format` defaults from the shape of `path` when the config omits it: a `.md` FILE is a * `document` source (many issues, one file — ZTB-4); anything else is a DIRECTORY of * one-issue-per-file markdown (today's only implemented shape). */ export declare function inferSourceFormat(path: string): SourceFormat; export interface ResolvedSource { /** Absolute path this source resolves to: a DIRECTORY of one-issue-per-file markdown for * `issue-per-file`, or the single markdown FILE itself for `document` (ZTB-4). The field name * stays `dir` for compatibility with existing callers, but for a `document` source it names a * file, not a directory — `MarkdownBackend` dispatches on `format` to pick the right class * (`MarkdownSource` vs `DocumentSource`, backends/documentSource.ts) rather than ever * `mkdirSync`-ing it. */ dir: string; format: SourceFormat; readonly: boolean; /** The `--source` selector for this source (ZTB-33): the config's `name` when declared, else the * declared `path` string verbatim, else `'default'` for the one implicit source (no `sources` * config). Matching also accepts the source dir's basename — see markdownBackend's * `selectSources`. Purely a routing label; it never changes which issues a source holds. */ name: string; /** This source's resolved dir equals today's implicit `markdownStoreDir()` — it gets the * worktree board-index/trunk union machinery (ZTB-3 makes that machinery user-addressable; * it isn't new). At most one entry is ever the default; a `document` source (a FILE path) can * never equal the default directory, so this is always false for one. */ isDefault: boolean; /** Present iff the entry declares a `dialect` (docs/DIALECTS.md): the resolved dialect object * (named ones looked up in the registry here, fail-closed) and its display name. A dialect * source is always `readonly` — enforced in `resolveSources`, not left to the caller. */ dialect?: Dialect; dialectName?: string; /** Old id -> current native id, recorded when a dialect lens was MATERIALIZED (`ztrack import`, * docs/DIALECTS.md WP6). Consumed through `sourceAliasMap` below — never read inline. */ aliases?: Record; } /** The one merged old-id -> native-id view over every declared source's `aliases` (recorded at * materialize time). First declaration wins on a (pathological) cross-source key collision — * the same declared-order determinism `MarkdownBackend.sourceOf` uses for duplicate ids. */ export declare function sourceAliasMap(sources: readonly ResolvedSource[]): Map; /** One-hop alias resolution for USER-TYPED ids at a CLI boundary (`ztrack check KQ3` after the * materialization renamed it to KQ-3). Loads the config itself so a call site that never touches * config (cliCheck) stays that way; any load/resolve failure means "no aliases", never an error * — this is routing sugar, and the caller's own path will surface the real config problem. */ export declare function resolveIdAliases(projectRoot: string, ids: readonly string[]): string[]; /** Resolve the declared `sources` list (or the implicit default when absent) into absolute * entries. `sources` absent is BYTE-IDENTICAL to today: one implicit issue-per-file source at * `markdownStoreDir(projectRoot)`. Both formats are implemented (issue-per-file always; the * `document` read path since ZTB-4 — see backends/documentSource.ts; write-back is ZTB-4 dev/09). */ export declare function resolveSources(projectRoot: string, config: { sources?: TrackerSourceConfig[]; }): ResolvedSource[];