/** * library-index.ts — index a user library's on-disk assets into the shared * `asset_definitions` index so `add` / `asset install` / `search --local` can * resolve them, plus publisher resolution for a freshly-created asset. * * A `library create`d asset is bytes on disk only until it is indexed; the * index is what every resolution path reads. Indexing reuses the same * `LocalCatalogSource.sync()` engine `source add`/`sync` run — a library is * scanned + upserted keyed by `library_id = lib.id`. * * @docLink cli/commands/library */ import type { Library, LocalIndex } from "@skaile/workspaces/library"; /** Discovery result surfaced by {@link indexLibrary}. */ export interface IndexLibraryResult { /** Assets discovered on disk under the library root. */ assetsFound: number; /** Assets upserted into `asset_definitions`. */ assetsUpdated: number; /** Fatal per-asset errors (never advisories). */ errors: string[]; } /** * Index a library's assets into the shared `asset_definitions` index. * * Runs `LocalCatalogSource.sync()` against the library's `path` keyed by * `library_id = lib.id`. Pass an already-open {@link LocalIndex} (e.g. the one * `openLibraryManager()` holds) to reuse the single connection — the caller then * owns closing it. With no `index` a fresh handle is opened and closed here. * Returns the sync counters so a caller can report `Indexed N asset(s)`. */ export declare function indexLibrary(lib: Library, index?: LocalIndex): Promise; /** * Resolve the publisher for an asset created inside a library. Never throws. * * Fallback chain (first hit wins): * 1. `opts.publisher` (an explicit `--publisher`), * 2. the domain's DOMAIN.md publisher when the asset sits under a domain * (`domain` names a first-level dir carrying a DOMAIN.md), * 3. the author's verified store identity (`githubLogin`, else `username`) * when signed in — the publisher they can actually publish under, * 4. the kebab-cased library name (e.g. `My Lib` → `my-lib`) as a last resort. * * Identity beats the library name because the library name is almost never a * namespace the author can publish; stamping it led to publishes that only * failed at the store. Passed in (not read here) to keep this pure + testable. * * @param lib - The target library. * @param opts - Optional explicit `--publisher`. * @param domain - Optional first-level directory the asset was placed under. * @param storeIdentity - The author's decoded store identity, or null when signed out. */ export declare function resolveLibraryPublisher(lib: Pick, opts: { publisher?: string; }, domain?: string, storeIdentity?: { username?: string; githubLogin?: string; } | null): string; //# sourceMappingURL=library-index.d.ts.map