import { type RawGuideFilePayload } from '@auden.to/protocol'; import type { DiscoveredGuideFile } from './discover.js'; /** * Convert a discovered guide file into the canonical `RawGuideFilePayload` * shape accepted by `POST /api/rules/import`. Throws if the resulting payload * fails schema validation — a CLI bug, not a user error, and it aborts the * caller's whole import rather than one file. * * That is only true because discovery drops what it cannot represent: a file * whose path is not a safe relative POSIX path never reaches here * (`discover.ts` → `makeDiscovered`). A new producer of `DiscoveredGuideFile` * that skips that check would turn one odd filename into a failed import. * * Skill member files ride along only when discovery scanned the skill * directory (`members` set, possibly `[]`); a payload without the field * leaves the server's member rows untouched. * * `expectedVersion` is the machine-local baseline for this file, when there is * one (`rules/guide-baseline.ts`). Passed in rather than looked up here so the * store is read once per import instead of once per file, and so this stays a * pure shape conversion. * * It is an **options object rather than a second positional argument** because * `files.map(buildRulePayload)` is the natural way to call this and `Array.map` * supplies the index as the second argument — which as a bare number would make * the first file of every import claim `expectedVersion: 0` and fail the schema. * Destructured off a number it is simply `undefined`, which is the correct * default. */ export declare function buildRulePayload(file: DiscoveredGuideFile, { expectedVersion }?: { expectedVersion?: number | undefined; }): RawGuideFilePayload; //# sourceMappingURL=payload.d.ts.map