/** * Subscription helpers shared by `auden pull` (subscribe-on-pull) and any other * caller that records a repo's doc-bundle subscription. The subscription itself * is just `docs.bundles` in the repo `.auden/config.json` (see repo-config.ts); * `auden sync`'s docs phase reads it and keeps those bundles fresh. * * Kept free of citty/console so it unit-tests directly against a temp dir. */ import type { BundleSubscription } from './repo-config.js'; export type BundleChoice = { slug: string; name: string; }; /** A bundle the account owns, as `auden init`'s picker sees it. */ export type OfferedBundle = { id: string; slug: string; name: string; }; /** * Turn an `auden init` selection into the subscriptions to commit. * * **Empty input means the default guides bundle, not "none"** — that is the * whole point of offering subscription during onboarding. A fresh repo that * subscribes to nothing receives nothing once delivery is bundle-members-only * (`unified-item-sync-plan.md` → Approach), so an onboarding prompt whose * default is "no subscriptions" would hand every new user the exact broken state * `auden doctor` then complains about. Pressing enter is the common path and it * must land somewhere useful. * * The plan left "interactive selection vs default-subscribe-and-prune" open and * recommended interactive; this is interactive **with** the default pre-picked, * which is the same choice with a working enter key. * * Selections resolve to real ids because the listing is in hand — the committed * config gets `{id, slug}` from the start, so an `init` in a shared repo does not * write the ambiguous slug-only form the migration then has to upgrade. */ export declare function resolveInitSubscriptionSelection(input: string, offered: readonly OfferedBundle[], defaultSlug: string): BundleSubscription[]; /** * Record a subscription that already carries ids — `auden init`'s picker, which * has the bundle listing in hand. The slug-only sibling {@link subscribeBundles} * stays for callers that only know a name. */ export declare function subscribeBundleSelections(cwd: string, selections: BundleSubscription[]): Promise; /** * Parse an interactive selection line into slugs. Tokens are split on commas * and whitespace; a token that is a 1-based index into `choices` resolves to * that bundle's slug, anything else is treated as a literal slug. De-duplicated, * order preserved. */ export declare function parseSelectionInput(input: string, choices: BundleChoice[]): string[]; export type SubscribeResult = { ok: true; /** Full resulting subscription (existing ∪ added). */ subscribed: BundleSubscription[]; /** Slugs newly added this call (not already subscribed). */ added: string[]; /** True when a stray `token` key was stripped from the repo config on write. */ removedToken: boolean; } | { ok: false; reason: 'malformed-config' | 'home-collision' | 'write-failed'; message?: string; }; /** * Record a repo's subscription to `bundles`, additively — existing * subscriptions are never dropped. Writes when the set actually grows, or when a * stray `token` must be stripped from the committed config; otherwise the file * is left byte-for-byte untouched (no spurious git diff). Never throws — every * failure becomes an `ok:false` reason so the caller can warn without aborting * the surrounding command (a pull still succeeds even if the subscription can't * be recorded): * - `malformed-config` — the config exists but isn't valid JSON. * - `home-collision` — `cwd` is the home dir, where the repo config would be * the token store; we refuse rather than clobber the bearer token. * - `write-failed` — a filesystem error (read-only repo, race, etc.). */ export declare function subscribeBundles(cwd: string, bundles: string[]): Promise; //# sourceMappingURL=subscribe.d.ts.map