/** * The CLI half of `unified-item-sync-plan.md` slice 0: write the account's * default guides bundle into this repo's committed subscription. * * **Why the server migration is not enough.** The subscription does not live in * the database — `readRepoDocsConfig` reads `docs.bundles` solely from the * committed `/.auden/config.json` (`repo-config.ts`), which no database * migration can reach. Enroll every guide in the default bundle server-side and * an existing checkout that does not *name* that bundle still subscribes to * nothing; once delivery is bundle-members-only its guides are retired, which is * the exact failure slice 0 exists to prevent. * * Two properties the plan asks for explicitly, both load-bearing: * * - **Safe to run repeatedly**, because it runs on the sync heartbeat rather than * as a one-shot. It is a no-op once the id is in the file. * - **Add, never replace.** A repo that already subscribes to other bundles keeps * every one of them; this appends at most one entry. * * Kept free of citty/console so it unit-tests directly against a temp dir — the * caller renders the outcome. */ /** The subset of a listed bundle this migration needs. */ export type ListedBundle = { id: string; slug: string; }; export type EnrollDefaultBundleOutcome = /** The default bundle is now named in the committed config; `wrote` is false when it already was. */ { status: 'subscribed'; slug: string; wrote: boolean; /** * A bearer token was found in the committed config and stripped. Surfaced * rather than swallowed: `writeRepoDocsBundles` returns this precisely so * a caller can tell the user to rotate a credential that may already be * in git history, and an automatic sync is the *most* likely place for it * to go unnoticed. Raised by Codex on PR #545. */ removedToken: boolean; } /** The account has no default guides bundle — nothing to subscribe to yet. */ | { status: 'no-default-bundle'; } /** The config exists but is not valid JSON; refuse rather than clobber it. */ | { status: 'malformed-config'; } /** A filesystem error. Never thrown — sync must not abort over this. */ | { status: 'write-failed'; message: string; }; /** * Find the account's default guides bundle in a bundle listing. * * Matching is by slug because that is the only stable handle a client has before * it has ever seen this account's bundles — the id is what we are trying to * *learn*. The lookup is against the caller's own bundles over an authenticated * request, so the user-scoped ambiguity that makes a committed slug wrong does * not apply here: there is exactly one account in the answer. */ export declare function findDefaultGuidesBundle(bundles: readonly ListedBundle[]): ListedBundle | null; /** * Ensure this repo's committed subscription names the account's default guides * bundle, by **id**. * * Returns rather than throws on every failure: this runs inside `auden sync`, and * a repo whose config cannot be written is a warning, not a reason to abandon the * sync that was actually asked for. */ export declare function enrollRepoInDefaultBundle(cwd: string, bundles: readonly ListedBundle[]): Promise; //# sourceMappingURL=enroll-default-bundle.d.ts.map