/** * `fromJSON` — convert the v1 JSON config shape to a v2 * {@link SteeringConfig}. * * Per the accepted ADR ("Design → File layout and loader behavior"): * JSON is not a first-class config format in v2. `fromJSON` exists so * `.pi/steering.json` files authored against the PoC shape can be * loaded programmatically — either as a library call (this module) * or via the `pi-steering import-json` CLI wrapping it. * * Scope: * * - Top-level v1 fields: `disable`, `defaultNoOverride`, `rules`. * - Rule fields: `name`, `tool`, `field`, `pattern` (stays a string — * v2 accepts `string | RegExp`), `requires`, `unless`, `reason`, * `noOverride`, `when.cwd` (string pattern). * * Rejected (throws): * * - Plugins (JSON can't express function-typed handlers). * - Observers (ditto — `onResult` is a function). * - Function-valued fields on rules (ditto). * - `when.` — plugin-registered predicates have no * JSON-expressible binding. * - `when.not` or `when.condition` (also function-shaped or recursive). * * Callers that hit one of the rejection cases should author the * offending rule / plugin directly in TypeScript; `fromJSON` is only * for the trivial pattern-string path. */ import type { SteeringConfig } from "./schema.ts"; /** * Error thrown when the input JSON uses a feature the v1 → v2 helper * can't represent. Carries a `path` pointing at the offending location * (e.g. `rules[2].when.branch`) so callers can point the user at the * rule to rewrite in TypeScript. */ export declare class FromJSONError extends Error { readonly path: string; constructor(message: string, path: string); } /** * Convert v1 JSON into a v2 {@link SteeringConfig}. * * The input is typed `unknown` deliberately — this helper accepts * whatever came out of `JSON.parse`, validates the shape, and throws * {@link FromJSONError} on anything it can't represent. */ export declare function fromJSON(json: unknown): SteeringConfig; //# sourceMappingURL=compat.d.ts.map