/** * `skaile source …` — manage github sources for the current project. * * A *source* is a third-party github repo of AI assets. The project's * `skaile.yaml` `sources:` array is the source of truth for which sources * this project uses. The clone itself lives at * `~/.skaile/cache/sources////` (machine-global cache, shared * across projects, URL-keyed so cross-org repos never collide), and the manifest is * mirrored into `~/.skaile/index.db` (machine-global manifest cache). * * @docLink cli/commands/source */ import { type SourceEntry } from "@skaile/workspaces/core"; import { Command } from "commander"; /** * Clone dir for one source cache key (`//`). Exported for the * cache-path regression test. Callers pass `sourceCacheKey(url)`. */ export declare function sourceClonePath(key: string): string; /** * Whether a manifest-cache refresh actually failed to index something. Keyed on * `errors`, NOT on `assetsUpdated < assetsFound`: the discovery walk counts * presets (and other intentionally-not-cataloged kinds) toward `assetsFound` but * never upserts them, so a source shipping a `.preset.yaml` would otherwise read * as a partial failure — false `! N asset(s) failed to index` + exit 1 — with * zero real errors. */ export declare function indexingHadFailures(result: { errors: string[]; }): boolean; /** * A clone that ships only the legacy `.skaile-source.yaml` (no * `skaile.manifest.yaml`) has its declared `publisher_default` silently ignored * — discovery only reads `skaile.manifest.yaml`, so publisher resolution falls * back to the first path segment. Surface a hint so the author can fix it. */ export declare function legacySourceConfigHint(dest: string): string | undefined; /** * Normalize a `source add` argument into a clonable git URL. Full URLs and * scp-style (`git@host:…`) specs pass through unchanged; an `owner/repo` * shorthand and a bare repo name expand to GitHub over SSH — a bare name * defaults to the `skaile-ai` org (`git@github.com:skaile-ai/.git`). */ export declare function normalizeSourceUrl(input: string): string; /** * Match a stored source against a user-supplied key. Mirrors the shortcut * expansion `source add` applies (`normalizeSourceUrl`) so any form that `add` * accepted — bare name, `owner/repo`, `.git`-suffixed, full URL — also resolves * at `sync`/`show`/`remove` time, not just the raw stored URL or derived slug. */ export declare function sourceMatchesKey(entry: SourceEntry, key: string): boolean; /** * Find an already-registered source that maps to the same cache key as `url` * but is stored under a *different* URL string (e.g. the `.git`-suffixed or * scp form of the same remote). Two such entries would fight over one clone * dir, so `source add` rejects the ambiguity. Returns the colliding entry, or * `undefined` when the URL is unique or only matches an exact-string duplicate * (which `setSource` updates in place). */ export declare function findCacheKeyCollision(sources: SourceEntry[], url: string): SourceEntry | undefined; export declare function readProjectSources(yamlPath: string): SourceEntry[]; /** * Clone the source if its clone directory does not yet exist. When `force` is * set, the existing clone is replaced by a fresh checkout. Returns true when a * clone happened. The cache slug is derived from the URL. * * A `--force` re-clone moves the old clone aside first and only deletes it once * the fresh clone succeeds — so a failed re-clone restores the previous clone * rather than leaving the source registered with no cache behind it. */ export declare function ensureClone(entry: SourceEntry, opts?: { force?: boolean; }): boolean; /** * Auto-sync hook for `skaile search` on an unsynced workspace. Clones/pulls and * re-indexes every source declared in the project's `skaile.yaml`, then returns * whether the manifest cache may have changed (caller re-queries on `true`). * * Unlike `source sync`, this degrades gracefully — a clone/pull/index failure is * logged and skipped (never `process.exit`) so a failed auto-sync falls back to * the "run sync first" hint rather than killing the search. Returns `false` * (silently, no announce) when no sources are declared. Callers must guard * air-gapped mode themselves — this always touches the network. */ export declare function autoSyncForSearch(projectDir: string): Promise; /** * Clone-or-pull every source declared in the project's `skaile.yaml`, then * refresh its manifest cache. Shared by `autoSyncForSearch` and `skaile update` * (the latter offers it behind a confirm) so a re-deploy can see upstream * commits — `update` re-deploys against the local source cache, which is * otherwise frozen at the commit captured when the source was first cloned. * * Graceful by design: a clone/pull/index failure for one source is logged and * skipped (never `process.exit`), so a single bad remote can't abort the run. * Existing clones are advanced with `git pull --ff-only` (no `--depth=1`, unlike * the installer's `pullRepo`, so it fast-forwards instead of tripping the * shallow-divergence path). Returns a count summary for the caller to report. */ export declare function syncProjectSources(projectDir: string, opts?: { dev?: boolean; }): Promise<{ total: number; synced: number; failed: number; }>; export declare function makeSourceCommand(): Command; //# sourceMappingURL=source.d.ts.map