aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
169 lines • 5.6 kB
TypeScript
/**
* Contributor Frontmatter Validation
*
* Zod schemas for known contributor kinds (`status`, `research`). Schemas are
* keyed by kind so future consumers register their schema without forking the
* discovery module.
*
* @architecture @.aiwg/architecture/decisions/ADR-023-contributor-discovery-convention.md
* @issue #938
*/
import { z } from 'zod';
import type { ContributorKind } from './types.js';
/**
* `kind: status` frontmatter. Reports observed state of a framework/domain
* (phase, counts, dates). Fields beyond the base schema are descriptive only —
* no prescriptive `next:` arrays per ADR-023 §Output voice.
*/
export declare const StatusContributorSchema: z.ZodObject<{
domain: z.ZodString;
description: z.ZodString;
detect: z.ZodObject<{
glob: z.ZodArray<z.ZodString, "many">;
minCount: z.ZodOptional<z.ZodNumber>;
conditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
}, "strip", z.ZodTypeAny, {
glob: string[];
minCount?: number | undefined;
conditions?: Record<string, string> | undefined;
}, {
glob: string[];
minCount?: number | undefined;
conditions?: Record<string, string> | undefined;
}>;
} & {
kind: z.ZodLiteral<"status">;
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
type: z.ZodEnum<["string", "number", "date"]>;
source: z.ZodString;
regex: z.ZodOptional<z.ZodString>;
count: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "string" | "number" | "date";
source: string;
count?: string | undefined;
regex?: string | undefined;
}, {
type: "string" | "number" | "date";
source: string;
count?: string | undefined;
regex?: string | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
kind: "status";
description: string;
domain: string;
detect: {
glob: string[];
minCount?: number | undefined;
conditions?: Record<string, string> | undefined;
};
fields?: Record<string, {
type: "string" | "number" | "date";
source: string;
count?: string | undefined;
regex?: string | undefined;
}> | undefined;
}, {
kind: "status";
description: string;
domain: string;
detect: {
glob: string[];
minCount?: number | undefined;
conditions?: Record<string, string> | undefined;
};
fields?: Record<string, {
type: "string" | "number" | "date";
source: string;
count?: string | undefined;
regex?: string | undefined;
}> | undefined;
}>;
/**
* `kind: research` frontmatter. Configures research fan-out for a framework's
* domain — focus areas, source preferences, recency window.
*/
export declare const ResearchContributorSchema: z.ZodObject<{
domain: z.ZodString;
description: z.ZodString;
detect: z.ZodObject<{
glob: z.ZodArray<z.ZodString, "many">;
minCount: z.ZodOptional<z.ZodNumber>;
conditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
}, "strip", z.ZodTypeAny, {
glob: string[];
minCount?: number | undefined;
conditions?: Record<string, string> | undefined;
}, {
glob: string[];
minCount?: number | undefined;
conditions?: Record<string, string> | undefined;
}>;
} & {
kind: z.ZodLiteral<"research">;
sources: z.ZodOptional<z.ZodObject<{
preferred: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
preferred?: string[] | undefined;
exclude?: string[] | undefined;
}, {
preferred?: string[] | undefined;
exclude?: string[] | undefined;
}>>;
focus_areas: z.ZodArray<z.ZodString, "many">;
recency_default_months: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
kind: "research";
description: string;
domain: string;
detect: {
glob: string[];
minCount?: number | undefined;
conditions?: Record<string, string> | undefined;
};
focus_areas: string[];
sources?: {
preferred?: string[] | undefined;
exclude?: string[] | undefined;
} | undefined;
recency_default_months?: number | undefined;
}, {
kind: "research";
description: string;
domain: string;
detect: {
glob: string[];
minCount?: number | undefined;
conditions?: Record<string, string> | undefined;
};
focus_areas: string[];
sources?: {
preferred?: string[] | undefined;
exclude?: string[] | undefined;
} | undefined;
recency_default_months?: number | undefined;
}>;
/**
* Look up the zod schema for a kind. Throws if no schema is registered —
* unknown kinds must be deliberately added rather than silently accepted.
*/
export declare function getSchemaForKind(kind: ContributorKind): z.ZodType<unknown>;
/**
* List all registered kinds. Used by validate-metadata to scan for
* orphaned contributor files (kind in frontmatter but no schema registered).
*/
export declare function getRegisteredKinds(): string[];
/**
* Validate a parsed frontmatter object against its kind's schema. Returns
* either the typed data or an error with formatted issue messages.
*/
export declare function validateContributor(data: Record<string, unknown>): {
ok: true;
data: unknown;
} | {
ok: false;
errors: string[];
};
//# sourceMappingURL=validation.d.ts.map