import { type FeaturePattern, type ParseError } from "@cosmicdrift/kumiko-framework/engine"; export type AuthoringStyle = "canonical" | "legacy"; export type CorpusWarning = { /** Repo-relative path to the file that triggered the warning. */ readonly sourcePath: string; /** Human-readable explanation. Currently only "parser-throw" but * kept open-ended so future builders can add more (e.g. * "duplicate-id", "no-feature-name"). */ readonly message: string; }; export type FewShotEntry = { /** Stable id derived from the path (`samples/recipes/basic-entity`). */ readonly id: string; /** Repo-relative path to the feature-file. */ readonly sourcePath: string; /** Repo-relative path to the workspace package.json (for description lookup). */ readonly packageJsonPath: string | undefined; /** Workspace name (`@cosmicdrift/kumiko-sample-basic-entity`). */ readonly packageName: string | undefined; /** English description from package.json. */ readonly description: string | undefined; /** Feature name from `defineFeature("...", ...)`. Undefined if the * parser couldn't read it (rare — implies a non-feature file got * picked up). */ readonly featureName: string | undefined; /** Pattern-categories present in this feature, deduplicated. Useful * as topic-tags for retrieval ("show me cross-cutting examples"). */ readonly tags: readonly string[]; /** Counts per pattern-kind — quick stats without scanning the * patterns array. */ readonly patternsByKind: Readonly>; /** All parsed patterns. Same shape the parser emits. */ readonly patterns: readonly FeaturePattern[]; /** Errors the parser raised. Empty for canonical-form features. */ readonly parseErrors: readonly ParseError[]; /** `canonical` (clean parse) or `legacy` (parser couldn't read it * fully — Factory-style / identifier-refs). */ readonly authoringStyle: AuthoringStyle; /** Raw source text — kept verbatim so the LLM can train on the * exact byte-form, including comments + whitespace. */ readonly rawSource: string; }; export type FewShotCorpus = { /** ISO-instant when the corpus was generated. */ readonly generatedAt: string; /** Total entry count, broken down by authoringStyle for quick stats. */ readonly totals: { readonly all: number; readonly canonical: number; readonly legacy: number; }; readonly entries: readonly FewShotEntry[]; /** Files that were discovered but couldn't be turned into entries. * Surfaces parser crashes + duplicate-id collisions instead of * swallowing them — the regenerate-script reports these to the user * and the drift-test asserts the count stays constant. */ readonly warnings: readonly CorpusWarning[]; }; export type BuildFewShotCorpusOptions = { /** Repo root — used for relative-path output and security guards. */ readonly repoRoot: string; /** Folders to scan recursively. Defaults to samples/* + bundled-features. */ readonly scanRoots?: readonly string[]; }; export declare function buildFewShotCorpus(options: BuildFewShotCorpusOptions): FewShotCorpus; /** * Stable id from the source path. Drops the leading `samples/` or * `packages/` prefix and the trailing `/src/feature.ts` suffix so the * id reads like the canonical short name (`basic-entity`, * `bundled-features/auth-email-password`). */ export declare function pathToId(sourcePath: string): string;