/** * Sidecar path resolver — locations under `~/.skaile/sidecars/` (PR-3 § D.1). * * `~/.skaile/sidecars/` is a single git repo containing one subdirectory per * registered sidecar. Each subdirectory carries the local-overlay manifest * (`skaile.manifest.yaml`), a provenance README, and a lock file. * * Path resolution honors the `SKAILE_HOME` env var (defaults to `~/.skaile`) * mirroring the style used by `SKAILE_LIBRARIES_DIR` (which already overrides * the library checkouts dir). Setting `SKAILE_HOME` is the recommended hook * for test isolation: a single env var moves the sidecar root, the libraries * dir (when not separately overridden), and the catalog cache together. * * @docLink packages/library/concepts#sidecar-paths */ import type { SourceConfig } from "@skaile/workspaces/discovery"; /** * Resolved sidecar paths for a given slug. All paths are absolute. * * @docLink packages/library/concepts#sidecar-paths */ export interface SidecarPaths { /** Root sidecar directory, `~/.skaile/sidecars` (or `$SKAILE_HOME/sidecars`). */ rootDir: string; /** Per-source sidecar dir: `/`. */ sidecarDir: string; /** Manifest file: `/skaile.manifest.yaml`. */ manifestFile: string; /** Provenance README: `/README.md`. */ readmeFile: string; /** Lock file: `/skaile.manifest.lock.json`. */ lockFile: string; } /** * Sidecar root: `$SKAILE_HOME/sidecars` (default `~/.skaile/sidecars`). Renamed * from the old `~/.skaile/sources` (which collided with the clone cache). On first * call it migrates the legacy `~/.skaile/sources` namespace by splitting it: source * clones (own `.git`) are claimed by the clone cache (`getGlobalCacheDir`), and the * remainder — the sidecar git repo (root `.git`, `README.md`, `.gitattributes`, * slug subdirs) — moves here. Authored content: a failed move leaves the legacy * entry in place rather than masking it. * * Does **not** create the directory — callers (e.g. `SidecarGit.ensureInitialized`) * are responsible for materialising it. * * @returns Absolute path to `~/.skaile/sidecars` (or env override) * @docLink packages/library/concepts#sidecar-paths */ export declare function getSidecarRoot(): string; /** * Resolve all sidecar paths for a given slug. * * @param slug - Sidecar slug (subdirectory name under `~/.skaile/sidecars/`) * @returns Bundle of all relevant absolute paths * @docLink packages/library/concepts#sidecar-paths */ export declare function resolveSidecarPaths(slug: string): SidecarPaths; /** * Derive a sidecar slug from a source config + source path, applying * collision resolution against the set of slugs already in use. * * Derivation order (per PR-3 § D.1): * 1. `name:` field of the upstream source config (if non-empty) * 2. `path.basename(sourcePath)` (fallback) * * Collision suffix: `-2`, `-3`, ... appended until unique against * `existingSlugs`. * * Empty/dot/segmented basenames fall through to `unnamed-source`. * * @param sourceConfig - Validated source config (may be `undefined`) * @param sourcePath - Filesystem path of the source repo * @param existingSlugs - Slugs already in use under the sidecar root * @returns A unique, slugified directory name * @docLink packages/library/concepts#derive-slug */ export declare function deriveSlug(sourceConfig: SourceConfig | undefined | null, sourcePath: string, existingSlugs: Iterable): string; /** * List the slugs currently present on disk under {@link getSidecarRoot}. * * Returns an empty array when the root directory doesn't exist yet (first * sidecar). Non-directory entries (e.g. the root `README.md`, * `.gitattributes`) are filtered out. * * @returns Lexically sorted list of slug directory names * @docLink packages/library/concepts#sidecar-paths */ export declare function listSidecarSlugsOnDisk(): string[]; //# sourceMappingURL=sidecar-paths.d.ts.map