import { z } from 'zod'; import type { TrackerBackendName } from './types.js'; /** One declared markdown source (ZTB-3). `path` is project-root-relative: a DIRECTORY of * one-issue-per-file markdown (`issue-per-file`), or a single markdown FILE decomposed into many * issues by its id-bearing headings (`document` — ZTB-4; see src/documentParser.ts). `format` * defaults from the shape of `path` when omitted: a `.md` file → `document`, anything else → * `issue-per-file`. `readonly: true` marks a source ztrack may read but never write — writes * routed at it (by the target record's `origin.path`) are rejected. A `document` source, even * when not `readonly: true`, only ever accepts a narrow `body`/title splice into an issue's * recorded span (ZTB-4 dev/09 — see backends/documentSource.ts); every wider write (status, * assignee, labels, reparent, comment, delete, create) still fails closed, naming the file. */ declare const TrackerSourceConfigSchema: z.ZodObject<{ path: z.ZodString; format: z.ZodOptional>; readonly: z.ZodOptional; dialect: z.ZodOptional; idPattern: z.ZodString; status: z.ZodUnion; label: z.ZodString; vocabulary: z.ZodRecord; }, z.core.$strict>, z.ZodObject<{ at: z.ZodLiteral<"checkbox">; vocabulary: z.ZodObject<{ checked: z.ZodString; unchecked: z.ZodString; }, z.core.$strict>; }, z.core.$strict>]>; hierarchy: z.ZodEnum<{ flat: "flat"; "heading-nesting": "heading-nesting"; }>; }, z.core.$strict>]>>; aliases: z.ZodOptional>; name: z.ZodOptional; }, z.core.$strict>; export declare const TrackerConfigSchema: z.ZodObject<{ backend: z.ZodOptional; local: z.ZodOptional; database: z.ZodOptional; store: z.ZodOptional; }, z.core.$strict>>; sources: z.ZodOptional>; readonly: z.ZodOptional; dialect: z.ZodOptional; idPattern: z.ZodString; status: z.ZodUnion; label: z.ZodString; vocabulary: z.ZodRecord; }, z.core.$strict>, z.ZodObject<{ at: z.ZodLiteral<"checkbox">; vocabulary: z.ZodObject<{ checked: z.ZodString; unchecked: z.ZodString; }, z.core.$strict>; }, z.core.$strict>]>; hierarchy: z.ZodEnum<{ flat: "flat"; "heading-nesting": "heading-nesting"; }>; }, z.core.$strict>]>>; aliases: z.ZodOptional>; name: z.ZodOptional; }, z.core.$strict>>>; board: z.ZodOptional>; sync: z.ZodOptional; repo: z.ZodString; policy: z.ZodOptional>; }, z.core.$strict>>; evidence: z.ZodOptional>; dir: z.ZodOptional; }, z.core.$strict>>; relevance: z.ZodOptional>; validation: z.ZodOptional; installedFrom: z.ZodOptional; }, z.core.$strict>>; organization: z.ZodOptional; externalBrowseUrls: z.ZodOptional>; caseTypeLabels: z.ZodOptional>; grammar: z.ZodOptional; slotAliases: z.ZodOptional>>; }, z.core.$strict>>; check: z.ZodOptional & z.core.$partial, z.ZodNumber>>; profiles: z.ZodOptional>; verify: z.ZodOptional>; matchLabels: z.ZodOptional>; inspect: z.ZodOptional; categories: z.ZodOptional & z.core.$partial, z.ZodNumber>>; }, z.core.$strict>>>; }, z.core.$strict>>; lint: z.ZodOptional>>; }, z.core.$strict>>; }, z.core.$strict>>; }, z.core.$strict>; /** The validated on-disk shape, exactly as `TrackerConfigSchema` accepts it — including the loose * `backend?: string`. This is `TrackerConfigSchema.parse()`'s return type: the RAW, pre-coercion * shape. `loadTrackerConfig` (config.ts) is the only place that turns this into the loaded * `TrackerConfig` below by coercing `backend`. */ export type RawTrackerConfig = z.infer; /** One declared markdown source, derived from the same schema `sources[]` validates against. */ export type TrackerSourceConfig = z.infer; /** * The LOADED config shape returned by `loadTrackerConfig` (config.ts) and consumed by every * feature reader. Identical to `RawTrackerConfig` in every field except `backend`: raw `backend` * is an optional loose string (see the comment above `TrackerConfigSchema`); `loadTrackerConfig` * coerces it to the closed `TrackerBackendName` union (`raw.backend === 'local' ? 'local' : * 'markdown'`) before returning, so every consumer past that point can rely on a required, * closed-enum `backend`. This is the ONE authored delta on top of the schema-derived shape — * everything else flows straight from `TrackerConfigSchema` with no second copy. */ export type TrackerConfig = Omit & { backend: TrackerBackendName; }; export declare const KNOWN_KEYS: Record; export declare function nearestKey(key: string, candidates: string[]): string | undefined; /** Validate the parsed JSON against the full `TrackerConfig` shape and return the typed, validated * result. Throws a single Error naming every offending key (unrecognized or otherwise) — each * caller (config.ts `loadTrackerConfig`, importDriver.ts `applyRegister`) prefixes it with the * config path; the top-level catch (cli.ts) reports it and exits nonzero. * * ZTB-26 dev/03: this used to be `assertValidTrackerConfigShape(raw): void`, which discarded * `result.data` on success — forcing every caller back to its OWN unvalidated * `JSON.parse(...) as TrackerConfig` cast just to get a typed value. That cast was the untyped * config-read hatch this AC closes (importDriver.ts `applyRegister` blindly rewrote a config file * it never actually validated). Returning the parsed, typed data removes the need for the cast * entirely. */ export declare function parseTrackerConfig(raw: unknown): RawTrackerConfig; export {};