import { z } from "zod"; import { AihError } from "../errors.js"; /** * Project Framework Binding — the committed declaration schema (D7/D8). * * The declaration is the AUTHORITY (D7): it lives as one additive optional * `binding` field on the committed `.aih-config.json` marker. Machine caches * (checkouts, scan results, the lock) are DERIVED from it. Exactly ONE * methodology framework binds per project (D8): the shape is a single object * with a single framework id — there is no representation for co-enablement, and * every object in this subtree is `.strict()` so a smuggled second framework * (extra key, nested array, aliased ref) is REJECTED, never silently stripped. * * Identity is exact (D7): git records repository + an exact 40-char lowercase * commit SHA + a sha256 tree digest; npm records package + an exact version + * an SRI integrity. Refs, tags, and branch names are resolution inputs only and * can never appear as recorded identity. */ export declare const BINDING_SCHEMA_VERSION: 1; /** The supported methodology framework set. Unknown ids are rejected. */ export declare const FRAMEWORK_IDS: readonly ["ecc", "superpowers"]; export type FrameworkId = (typeof FRAMEWORK_IDS)[number]; /** W2 hosts exactly one CLI host; the enum keeps room for later hosts. */ export declare const BINDING_HOSTS: readonly ["claude"]; /** * The bare `owner/repo` branch of {@link isPlausibleGitRepository} — the one * identity form real git cannot take verbatim as a remote (it reads a bare slug * as a local path), so the scan-gate transport layer must map exactly this * shape to its canonical GitHub https remote. The character class admits no * whitespace, control character, `#`, or extra `/`, and a leading `-` on either * segment is rejected, so the predicate is safe standalone. */ export declare function isBareRepositorySlug(value: string): boolean; export declare const BindingFrameworkSchema: z.ZodObject<{ id: z.ZodEnum<{ ecc: "ecc"; superpowers: "superpowers"; }>; mode: z.ZodOptional>; host: z.ZodEnum<{ claude: "claude"; }>; features: z.ZodOptional>; }, z.core.$strict>; export declare const BindingGitSourceSchema: z.ZodObject<{ kind: z.ZodLiteral<"git">; repository: z.ZodString; commitSha: z.ZodString; treeDigest: z.ZodString; }, z.core.$strict>; export declare const BindingNpmSourceSchema: z.ZodObject<{ kind: z.ZodLiteral<"npm">; package: z.ZodString; exactVersion: z.ZodString; integrity: z.ZodString; }, z.core.$strict>; export declare const BindingSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"git">; repository: z.ZodString; commitSha: z.ZodString; treeDigest: z.ZodString; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"npm">; package: z.ZodString; exactVersion: z.ZodString; integrity: z.ZodString; }, z.core.$strict>], "kind">; export declare const BindingDeclarationSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; framework: z.ZodObject<{ id: z.ZodEnum<{ ecc: "ecc"; superpowers: "superpowers"; }>; mode: z.ZodOptional>; host: z.ZodEnum<{ claude: "claude"; }>; features: z.ZodOptional>; }, z.core.$strict>; source: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"git">; repository: z.ZodString; commitSha: z.ZodString; treeDigest: z.ZodString; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"npm">; package: z.ZodString; exactVersion: z.ZodString; integrity: z.ZodString; }, z.core.$strict>], "kind">; }, z.core.$strict>; export type BindingFramework = z.infer; export type BindingGitSource = z.infer; export type BindingNpmSource = z.infer; export type BindingSource = z.infer; export type BindingDeclaration = z.infer; /** Present-but-invalid committed declaration — a governance value that fails closed. */ export declare class BindingDeclarationError extends AihError { constructor(message: string); } /** D8 violation: a project already bound to a different methodology framework. */ export declare class BindingFrameworkConflictError extends AihError { constructor(message: string); } export declare function parseBindingDeclaration(value: unknown): BindingDeclaration; export declare function safeParseBindingDeclaration(value: unknown): z.ZodSafeParseResult; /** * The single D8 guard shared by every enforcement layer (schema is structural; * plan and provision each call this independently). Re-binding the SAME framework * is allowed; binding a DIFFERENT one over an existing binding fails closed. */ export declare function assertSingleMethodologyFramework(incoming: FrameworkId, existing: FrameworkId | undefined): void; /** * Read the committed binding declaration from `.aih-config.json`. The declaration * is the authority, so a present-but-invalid `binding` fails closed with a clear * {@link BindingDeclarationError} (mirrors the fail-closed baseline reader). * Absent marker / absent field / unparseable marker JSON => `undefined` (the * marker's own reader surfaces whole-file invalidity). */ export declare function readBindingDeclaration(root: string): BindingDeclaration | undefined;