@skaile/workspaces 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/{asset-feeds-6R2C2NHB.js → asset-feeds-PCLTE2W5.js} +20 -12
- package/dist/asset-feeds-PCLTE2W5.js.map +1 -0
- package/dist/asset-manager/index.js +8 -8
- package/dist/asset-manager/installer.js +7 -7
- package/dist/{chunk-DVIIYYD5.js → chunk-2Q6OY3SU.js} +3 -3
- package/dist/{chunk-DVIIYYD5.js.map → chunk-2Q6OY3SU.js.map} +1 -1
- package/dist/{chunk-UQ5JY2GQ.js → chunk-52HINMW4.js} +3 -3
- package/dist/{chunk-UQ5JY2GQ.js.map → chunk-52HINMW4.js.map} +1 -1
- package/dist/{chunk-E5VRPYUX.js → chunk-56YT6CWS.js} +5 -5
- package/dist/{chunk-E5VRPYUX.js.map → chunk-56YT6CWS.js.map} +1 -1
- package/dist/{chunk-2VM62DX7.js → chunk-5DPQ766L.js} +4 -4
- package/dist/{chunk-2VM62DX7.js.map → chunk-5DPQ766L.js.map} +1 -1
- package/dist/{chunk-JLSK6HR4.js → chunk-6422UOMQ.js} +5 -5
- package/dist/{chunk-JLSK6HR4.js.map → chunk-6422UOMQ.js.map} +1 -1
- package/dist/{chunk-BKE2E5AC.js → chunk-7B3CL5JT.js} +7 -7
- package/dist/{chunk-BKE2E5AC.js.map → chunk-7B3CL5JT.js.map} +1 -1
- package/dist/{chunk-LFDZYCEO.js → chunk-BM7XANVN.js} +2 -2
- package/dist/chunk-BM7XANVN.js.map +1 -0
- package/dist/{chunk-W6TLIJG3.js → chunk-EOCKR5TN.js} +3 -3
- package/dist/{chunk-W6TLIJG3.js.map → chunk-EOCKR5TN.js.map} +1 -1
- package/dist/{chunk-FM2BJYX4.js → chunk-I3TERDTR.js} +2 -2
- package/dist/{chunk-FM2BJYX4.js.map → chunk-I3TERDTR.js.map} +1 -1
- package/dist/{chunk-N74UQJPN.js → chunk-KYC6JH75.js} +3 -3
- package/dist/{chunk-N74UQJPN.js.map → chunk-KYC6JH75.js.map} +1 -1
- package/dist/{chunk-4AGIEU7V.js → chunk-MAPRKFBD.js} +3 -3
- package/dist/{chunk-4AGIEU7V.js.map → chunk-MAPRKFBD.js.map} +1 -1
- package/dist/{chunk-WQRDLR3K.js → chunk-NAMD4AIK.js} +29 -7
- package/dist/{chunk-WQRDLR3K.js.map → chunk-NAMD4AIK.js.map} +1 -1
- package/dist/{chunk-5JAQVXPV.js → chunk-O2OHGE4S.js} +4 -4
- package/dist/{chunk-5JAQVXPV.js.map → chunk-O2OHGE4S.js.map} +1 -1
- package/dist/{chunk-7MANNJ3U.js → chunk-O4PANZI2.js} +5 -5
- package/dist/{chunk-7MANNJ3U.js.map → chunk-O4PANZI2.js.map} +1 -1
- package/dist/{chunk-H5YXL4KI.js → chunk-SAXDHVJZ.js} +3 -3
- package/dist/{chunk-H5YXL4KI.js.map → chunk-SAXDHVJZ.js.map} +1 -1
- package/dist/{chunk-4RSCLQYX.js → chunk-SKVUDDHE.js} +9 -9
- package/dist/{chunk-4RSCLQYX.js.map → chunk-SKVUDDHE.js.map} +1 -1
- package/dist/{chunk-PWXN2KHV.js → chunk-UAYAK7N4.js} +5 -5
- package/dist/{chunk-PWXN2KHV.js.map → chunk-UAYAK7N4.js.map} +1 -1
- package/dist/{chunk-DHN6VW4B.js → chunk-WEQN6EWW.js} +4 -4
- package/dist/{chunk-DHN6VW4B.js.map → chunk-WEQN6EWW.js.map} +1 -1
- package/dist/{chunk-VSLSRDQZ.js → chunk-XOBPOVFT.js} +3 -3
- package/dist/{chunk-VSLSRDQZ.js.map → chunk-XOBPOVFT.js.map} +1 -1
- package/dist/{chunk-QLHOORR7.js → chunk-ZGJE4ZDP.js} +2 -2
- package/dist/{chunk-QLHOORR7.js.map → chunk-ZGJE4ZDP.js.map} +1 -1
- package/dist/cli/index.js +196 -101
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/asset-feeds.d.ts +8 -1
- package/dist/cli/src/asset-feeds.d.ts.map +1 -1
- package/dist/cli/src/commands/manage.d.ts +33 -22
- package/dist/cli/src/commands/manage.d.ts.map +1 -1
- package/dist/connectors/config.js +7 -7
- package/dist/connectors/index.js +8 -8
- package/dist/connectors/src/fleet-health-gate.d.ts.map +1 -1
- package/dist/connectors/src/mount-placeholder.d.ts +8 -0
- package/dist/connectors/src/mount-placeholder.d.ts.map +1 -1
- package/dist/core/index.js +6 -6
- package/dist/core/manifest.js +2 -2
- package/dist/core/models.js +1 -1
- package/dist/core/publish-manifest.js +2 -2
- package/dist/core/runtime-assets.js +5 -5
- package/dist/core/src/index.d.ts +1 -1
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/models.d.ts +28 -0
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/workspace-config.js +4 -4
- package/dist/deploy/index.js +6 -6
- package/dist/discovery/index.js +4 -4
- package/dist/{ensure-sources-GYEQ65ET.js → ensure-sources-HMMEQEZC.js} +11 -11
- package/dist/{ensure-sources-GYEQ65ET.js.map → ensure-sources-HMMEQEZC.js.map} +1 -1
- package/dist/factory-assets/connectors/deploy.js +8 -8
- package/dist/factory-assets/connectors/devserver.js +8 -8
- package/dist/factory-assets/connectors/flow/adapter.js +8 -8
- package/dist/factory-assets/connectors/flow/engine.js +6 -6
- package/dist/factory-assets/connectors/flow/run-flow.js +9 -9
- package/dist/factory-assets/connectors/flow.js +8 -8
- package/dist/factory-assets/connectors/git.js +8 -8
- package/dist/factory-assets/connectors/gmail.js +8 -8
- package/dist/factory-assets/connectors/googledrive.js +8 -8
- package/dist/factory-assets/connectors/local.js +8 -8
- package/dist/factory-assets/connectors/mattermost.js +8 -8
- package/dist/factory-assets/connectors/memory.js +8 -8
- package/dist/factory-assets/connectors/minio.js +8 -8
- package/dist/factory-assets/connectors/postgres.js +8 -8
- package/dist/factory-assets/connectors/s3.js +8 -8
- package/dist/factory-assets/connectors/sharepoint.js +8 -8
- package/dist/factory-assets/connectors/sqlite.js +8 -8
- package/dist/factory-assets/connectors/static-server.js +8 -8
- package/dist/factory-assets/connectors/tunnel.js +8 -8
- package/dist/factory-assets/connectors/webdav.js +8 -8
- package/dist/factory-assets/connectors/xstate-store.js +8 -8
- package/dist/factory-assets/connectors/xstate.js +8 -8
- package/dist/{flows-TJUVSMRR.js → flows-O7OXGFIY.js} +3 -3
- package/dist/{flows-TJUVSMRR.js.map → flows-O7OXGFIY.js.map} +1 -1
- package/dist/library/index.js +9 -9
- package/dist/library/install.js +7 -7
- package/dist/open-library-5WWTBHQD.js +23 -0
- package/dist/{open-library-GPZUB7N3.js.map → open-library-5WWTBHQD.js.map} +1 -1
- package/dist/paths-UC3ZHLKC.js +15 -0
- package/dist/{paths-R6WA7PKV.js.map → paths-UC3ZHLKC.js.map} +1 -1
- package/dist/{plugin-store-TF7GECYJ.js → plugin-store-R2WLXRT3.js} +8 -8
- package/dist/{plugin-store-TF7GECYJ.js.map → plugin-store-R2WLXRT3.js.map} +1 -1
- package/dist/runner/index.js +10 -10
- package/dist/sdk/asset-manager.js +8 -8
- package/dist/sdk/core.js +6 -6
- package/dist/sdk/flow.js +6 -6
- package/dist/sdk/index.js +10 -10
- package/dist/sdk/runner.js +10 -10
- package/dist/{setup-YKL43RQJ.js → setup-BSDHVMR6.js} +8 -8
- package/dist/{setup-YKL43RQJ.js.map → setup-BSDHVMR6.js.map} +1 -1
- package/dist/store-client-4GKV4LOD.js +15 -0
- package/dist/{store-client-H7MHTZVU.js.map → store-client-4GKV4LOD.js.map} +1 -1
- package/dist/tui/index.js +10 -10
- package/dist/workspace-plugin/adapters/mcp.js +1 -1
- package/dist/workspace-plugin/adapters/omp.js +3 -3
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/asset-feeds-6R2C2NHB.js.map +0 -1
- package/dist/chunk-LFDZYCEO.js.map +0 -1
- package/dist/open-library-GPZUB7N3.js +0 -23
- package/dist/paths-R6WA7PKV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AAA,EAA6B;AAE3E,IAAA,MAAM,KAAA,GAAQ,SAAA,CAAU,IAAA,CAAK,UAAU,CAAA;AACvC,IAAA,IAAI,KAAA,CAAM,IAAI,CAAA,EAAG;AACf,MAAA,OAAO,WAAW,KAAA,CAAM,IAAI,CAAC,CAAA,GAAI,KAAA,CAAM,IAAI,CAAA,GAAI,IAAA;AAAA,IACjD;AAEA,IAAA,IAAI,KAAK,IAAA,EAAM;AACb,MAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,IAAA,CAAK,UAAA,EAAY,KAAK,IAAI,CAAA;AACnD,MAAA,OAAO,UAAA,CAAW,QAAQ,CAAA,GAAI,QAAA,GAAW,IAAA;AAAA,IAC3C;AAGA,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,IAAA,CAAK,QAAA,EAAU,IAAI,CAAA;AACrC,IAAA,IAAI,UAAA,CAAW,IAAI,CAAA,EAAG,OAAO,IAAA;AAE7B,IAAA,MAAM,UAAA,GAAa,IAAA,CAAK,iBAAA,EAAkB,EAAG,IAAI,CAAA;AACjD,IAAA,IAAI,WAAW,IAAA,CAAK,UAAA,EAAY,MAAM,CAAC,GAAG,OAAO,UAAA;AAEjD,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"chunk-BKE2E5AC.js","sourcesContent":["/**\n * @skaile/asset-manager — programmatic AI asset management API.\n *\n * Manages project-local repositories, dependency resolution, deployment,\n * lock files, patches, and contribution workflows.\n *\n * Usage:\n * import { AssetManager } from \"@skaile/workspaces/asset-manager\"\n * const am = new AssetManager({ projectDir: \"/path/to/project\" })\n * await am.install()\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport {\n existsSync,\n lstatSync,\n readdirSync,\n readFileSync,\n rmSync,\n unlinkSync,\n writeFileSync,\n} from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join, resolve } from \"node:path\";\nimport type {\n AiComponent,\n CatalogEntry,\n DriverTarget,\n LockFile,\n OverrideEntry,\n ProvenanceCandidate,\n SkWorkspaceConfig,\n SourceClone,\n SourceDeclaration,\n SourceEntry,\n StoreEntry,\n StoreFetcher,\n} from \"@skaile/workspaces/core\";\nimport {\n buildLockFile,\n buildProvenanceIndex,\n checkRepoStatus,\n applyPatch as coreApplyPatch,\n deployedBase,\n deployedDir,\n ensureRepo,\n extractForPatch,\n factoryAssetRoots,\n generatePatch,\n getGlobalCacheDir,\n getRepoCommit,\n isDeployed,\n parseAssetRef,\n readLinks,\n readLock,\n resolveAll,\n resolveAsset,\n resolveRuntimeAssets,\n resolveSkWorkspaceConfig,\n savePatch,\n scanRepo,\n verifyLock,\n writeLock,\n} from \"@skaile/workspaces/core\";\nimport { parse as parseYaml, stringify as stringifyYaml } from \"yaml\";\nimport { commitChanges } from \"./contrib.js\";\nimport type { HistoryEntry } from \"./history.js\";\nimport { appendHistory, clearHistory, getRecentHistory } from \"./history.js\";\nimport type { DeployOptions } from \"./installer.js\";\nimport { createScaffold, deployAll, removeAsset } from \"./installer.js\";\n\n/** Derive a cache slug from a source git URL (`<host>/<owner>/<repo>` → `<repo>`). */\nfunction sourceSlug(url: string): string {\n return (\n url\n .replace(/\\.git$/, \"\")\n .split(/[/:]/)\n .pop() ?? \"source\"\n );\n}\n\n/**\n * Normalize a git remote URL to a comparable identity so the same repo declared\n * in different syntaxes (`https://…`, `git@host:…`, trailing `/`, `.git` suffix,\n * case) compares equal. Used to dedupe the implicit factory source against an\n * explicit user declaration.\n */\nfunction normalizeRepoUrl(url: string): string {\n return url\n .trim()\n .replace(/^git@([^:]+):/, \"https://$1/\") // git@host:org/repo → https://host/org/repo\n .replace(/^[a-z]+:\\/\\//i, \"\") // drop scheme\n .replace(/\\.git$/i, \"\")\n .replace(/\\/+$/, \"\")\n .toLowerCase();\n}\n\n/**\n * Index lock entries by their `<kind>:<name>` suffix for deployed-asset lookup.\n * Only entries whose canonical key fully parses (kind, name, publisher, version)\n * are included.\n */\nfunction indexLockByKindName(\n lock: LockFile | null,\n): Map<string, { publisher: string; version: string; url: string }> {\n const lockByKindName = new Map<string, { publisher: string; version: string; url: string }>();\n for (const [key] of Object.entries(lock?.assets ?? {})) {\n const parsed = parseCanonicalLockKey(key);\n if (parsed.kind && parsed.name && parsed.publisher && parsed.version) {\n lockByKindName.set(`${parsed.kind}:${parsed.name}`, {\n publisher: parsed.publisher,\n version: parsed.version,\n url: lock!.assets[key]!.source.url,\n });\n }\n }\n return lockByKindName;\n}\n\n/** Derive an asset's sync status from its repository's live status. */\nfunction computeSyncStatus(repoStatus: RepoStatusInfo | undefined): string {\n if (!repoStatus) return \"unknown\";\n if (repoStatus.kind === \"local\") return \"local\";\n if (repoStatus.error) return \"error\";\n if (repoStatus.upToDate) return \"synced\";\n return \"outdated\";\n}\n\n/**\n * Group overview entries by domain, sort domains alphabetically, and sort\n * entries within each domain by kind then name.\n */\nfunction groupAndSortByDomain(entries: OverviewEntry[]): Map<string, OverviewEntry[]> {\n const byDomain = new Map<string, OverviewEntry[]>();\n for (const e of entries) {\n if (!byDomain.has(e.domain)) byDomain.set(e.domain, []);\n byDomain.get(e.domain)!.push(e);\n }\n\n const sorted = new Map<string, OverviewEntry[]>();\n for (const key of [...byDomain.keys()].sort()) {\n sorted.set(\n key,\n byDomain\n .get(key)!\n .sort((a, b) =>\n a.kind !== b.kind ? a.kind.localeCompare(b.kind) : a.name.localeCompare(b.name),\n ),\n );\n }\n return sorted;\n}\n\n/**\n * Parse a canonical lock key (`<kind>:@<publisher>/<name>#<version>`) into its\n * parts. The lock key is now a canonical asset ref, so this delegates to the one\n * ref parser; `AssetRef.pin` is exposed as `version` so the callers' destructuring\n * is unchanged. Stays total — callers rely on `{}`-then-`continue`, but\n * `parseAssetRef` throws, so a malformed key is caught and returned as `{}`.\n *\n * @internal Exported for unit tests; not part of the stable public surface.\n */\nexport function parseCanonicalLockKey(key: string): {\n publisher?: string;\n kind?: string;\n name?: string;\n version?: string;\n} {\n try {\n const ref = parseAssetRef(key);\n return {\n publisher: ref.publisher,\n kind: ref.kind,\n name: ref.name,\n version: ref.pin,\n };\n } catch {\n return {};\n }\n}\n\nexport type { HistoryEntry } from \"./history.js\";\nexport {\n appendHistory,\n clearHistory,\n getRecentHistory,\n loadHistory,\n} from \"./history.js\";\n// Re-export sub-modules\nexport type { DeployOptions } from \"./installer.js\";\nexport { createScaffold, deployAll, removeAsset } from \"./installer.js\";\nexport type { Log } from \"./renderers.js\";\nexport { renderAgentToFramework } from \"./renderers.js\";\n// Contrib helpers (commitChanges et al.) are still used internally by the\n// patch-submit flow but are no longer part of the public API surface — the\n// `skaile repo contrib *` command tree was removed on 2026-05-12.\n\n// ── Types ────────────────────────────────────────────────────────────────────\n\n/**\n * Metadata about a repository declared in `skaile.yaml`.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface RepoInfo {\n /** Repository name as declared in `skaile.yaml`. */\n name: string;\n /** How the repo is sourced: cloned from a URL, mounted from a local path, or symlinked via `skaile repo link`. */\n kind: \"local\" | \"remote\" | \"linked\";\n /** Remote URL (present when `kind === \"remote\"`). */\n url?: string;\n /** Filesystem path (present when `kind === \"local\"` or `kind === \"linked\"`). */\n path?: string;\n /** Git branch configured for this repository. */\n branch: string;\n /** Whether the repository has been cloned/resolved locally. */\n cloned: boolean;\n}\n\n/**\n * Live sync status for a repository.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface RepoStatusInfo {\n /** Repository name as declared in `skaile.yaml`. */\n name: string;\n /** How the repo is sourced. */\n kind: \"local\" | \"remote\" | \"linked\";\n /** Number of commits the local clone is behind the remote. */\n behind: number;\n /** `true` when the local clone matches the remote HEAD. */\n upToDate: boolean;\n /** Error message when status check failed. */\n error?: string;\n}\n\n/**\n * Result of a full `skaile install` or `skaile add` run.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface InstallResult {\n /** Asset refs (`kind:name`) successfully deployed in this run. */\n deployed: string[];\n /** Asset refs (`kind:name`) removed because they are no longer in the resolved set. */\n removed: string[];\n /** Asset refs that could not be resolved in any configured repository. */\n missing: string[];\n /** Whether `skaile.lock.yaml` was written or updated. */\n lockWritten: boolean;\n /**\n * npm packages installed as a side effect of resolving runtime asset peer\n * deps (connectors / mounts declared in skaile.yaml). Empty when nothing\n * needed installing or when the runtime-deps step was skipped.\n */\n npmInstalled?: string[];\n /**\n * npm packages that the runtime-deps step tried but failed to install.\n * Non-fatal — listed for telemetry and CLI reporting.\n */\n npmFailed?: string[];\n}\n\n/**\n * An installed asset whose source repository is behind the remote.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface OutdatedEntry {\n /** Asset kind (`skill`, `agent`, `prompt`, `flow`, `contract`). */\n kind: string;\n /** Asset name as registered in the catalog. */\n name: string;\n /** Repository that provides this asset. */\n publisher: string;\n /** Version string recorded in the lock file at install time. */\n currentVersion: string;\n /** Number of commits the local repository is behind the remote. */\n behind: number;\n}\n\n/**\n * A node in the resolved dependency tree (returned by `AssetManager.tree()`).\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface DependencyNode {\n /** Asset ref (`kind:name`) or `\"project\"` for the root node. */\n ref: string;\n /** Transitive dependencies resolved by this node. */\n children: DependencyNode[];\n}\n\n/**\n * A missing dependency detected by `AssetManager.doctor()`.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface DepIssue {\n /** Kind of the asset that has the unsatisfied requirement. */\n assetKind: string;\n /** Name of the asset that has the unsatisfied requirement. */\n assetName: string;\n /** Kind of the missing dependency. */\n depKind: string;\n /** Name of the missing dependency. */\n depName: string;\n /** `true` when the missing dependency exists in a configured repository but has not been installed. */\n inRepos: boolean;\n}\n\n/**\n * A single deployed asset shown in the workspace overview.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface OverviewEntry {\n /** Asset kind (`skill`, `agent`, `prompt`, `flow`, `contract`). */\n kind: string;\n /** Asset name. */\n name: string;\n /** Domain the asset belongs to (from the lock file; `\"unknown\"` when unresolvable). */\n domain: string;\n /** Repository that provides this asset. */\n publisher: string;\n /** Version string from the lock file. */\n version: string;\n /**\n * Sync status relative to the source repository.\n * - `\"synced\"` — local clone matches remote HEAD\n * - `\"outdated\"` — local clone is behind the remote\n * - `\"local\"` — sourced from a local path, no remote to compare\n * - `\"error\"` — status check failed\n * - `\"unknown\"` — repository not found or lock entry missing\n */\n syncStatus: string;\n}\n\n/**\n * Aggregated workspace overview returned by `AssetManager.overview()`.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface OverviewResult {\n /** Entries grouped by domain, sorted alphabetically. Each group is sorted by kind then name. */\n byDomain: Map<string, OverviewEntry[]>;\n /** Total number of deployed assets. */\n total: number;\n /** Sync status for each configured repository. */\n repos: RepoStatusInfo[];\n}\n\n// ── AssetManager ─────────────────────────────────────────────────────────────\n\n/**\n * Options for constructing an {@link AssetManager}.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface AssetManagerOptions {\n /** Absolute or relative path to the workspace root (must contain `skaile.yaml`). */\n projectDir: string;\n /**\n * Agent framework to target for asset deployment.\n * Determines which framework directories (``.claude/``, ``.omp/``, etc.) are used.\n * Defaults to `\"claude-code\"`.\n */\n driverTarget?: DriverTarget;\n /**\n * When `true`, assets are installed into the global Skaile cache rather than the\n * project workspace. Skips `skaile.yaml` dependency updates.\n */\n global?: boolean;\n}\n\n/** Canonical git URL identity for the bundled factory source. Never fetched —\n * the bytes live inside the package (`factory-assets/`); the URL is only the\n * match key the provenance walker and `candidateToCatalogEntry` key off. */\nconst FACTORY_SOURCE_URL = \"https://github.com/skaile-ai/ai-assets\";\n\n/**\n * Locate the built-in first-party skills/bundles shipped inside the package.\n *\n * Resolves through the shared {@link factoryAssetRoots} helper — the\n * `SKAILE_FACTORY_ASSETS_DIR` override layer (when set) ahead of the bundled\n * tree (in-repo source during dev, `dist/factory-assets/` after install), so a\n * container's override is honoured here identically to `serve`. Returns the\n * highest-precedence root that carries a `skaile.manifest.yaml` (the publication\n * manifest that names the source's publisher), or `null` when none qualifies —\n * the factory source is then simply not injected rather than erroring.\n */\nfunction resolveFactoryAssetsDir(): string | null {\n for (const dir of factoryAssetRoots()) {\n if (existsSync(join(dir, \"skaile.manifest.yaml\"))) return dir;\n }\n return null;\n}\n\n/** Read the declared `publisher` from a source's root `skaile.manifest.yaml`. */\nfunction readDeclaredPublisher(sourceDir: string): string | undefined {\n try {\n const raw = parseYaml(readFileSync(join(sourceDir, \"skaile.manifest.yaml\"), \"utf8\")) as {\n publisher?: unknown;\n } | null;\n return raw && typeof raw.publisher === \"string\" && raw.publisher.length > 0\n ? raw.publisher\n : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The bundled factory source `{ dir, publisher }`, or `null` when no usable\n * bundle is present. Resolved once per process — the package location and the\n * bundled `skaile.manifest.yaml` are immutable for the process lifetime, so the\n * `require.resolve` + `existsSync` probes + YAML parse run a single time rather\n * than on every `loadConfig()` call. `undefined` = not yet computed.\n */\nlet factorySourceCache: { dir: string; publisher: string } | null | undefined;\n\nfunction resolveFactorySource(): { dir: string; publisher: string } | null {\n if (factorySourceCache !== undefined) return factorySourceCache;\n const dir = resolveFactoryAssetsDir();\n const publisher = dir ? readDeclaredPublisher(dir) : undefined;\n factorySourceCache = dir && publisher ? { dir, publisher } : null;\n return factorySourceCache;\n}\n\n/**\n * Programmatic API for managing AI assets in a Skaile workspace.\n *\n * `AssetManager` wraps repository management, catalog search, asset installation,\n * lock-file tracking, patch workflows, and workspace diagnostics. The CLI delegates\n * all `skaile catalog`, `skaile repo`, `skaile install`, `skaile add`, and\n * `skaile init` commands to this class.\n *\n * @example\n * ```typescript\n * import { AssetManager } from \"@skaile/workspaces/asset-manager\";\n *\n * const am = new AssetManager({ projectDir: \"/my-project\" });\n *\n * // Install all dependencies declared in skaile.yaml\n * const result = await am.install();\n * console.log(`Deployed: ${result.deployed.join(\", \")}`);\n *\n * // Add a single skill (resolves transitive deps, updates skaile.yaml)\n * const deployed = am.add(\"skill:my-skill\");\n *\n * // Search the catalog\n * const skills = am.search(\"code review\", \"skill\");\n * ```\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport class AssetManager {\n /** Resolved absolute path to the workspace root. */\n readonly projectDir: string;\n /** Agent framework driver target used for all deploy operations. */\n readonly driverTarget: DriverTarget;\n /** Whether this instance operates in global-install mode. */\n readonly global: boolean;\n\n constructor(opts: AssetManagerOptions) {\n this.projectDir = resolve(opts.projectDir);\n this.driverTarget = opts.driverTarget ?? (\"claude-code\" as DriverTarget);\n this.global = opts.global ?? false;\n }\n\n private get reposDir(): string {\n return join(this.projectDir, \".skaile\", \"repos\");\n }\n\n private get lockPath(): string {\n return join(this.projectDir, \"skaile.lock.yaml\");\n }\n\n private get patchDir(): string {\n return join(this.projectDir, \".skaile\", \"patches\");\n }\n\n private get deployOpts(): DeployOptions {\n return { driverTarget: this.driverTarget, global: this.global, cwd: this.projectDir };\n }\n\n private loadConfig(): {\n repositories: Record<string, SourceDeclaration>;\n sources: SourceEntry[];\n stores: StoreEntry[];\n dependencies: string[];\n overrides: OverrideEntry[];\n patches: Record<string, string>;\n config: SkWorkspaceConfig;\n } {\n // resolveSkWorkspaceConfig runs the canonical normalizer and throws on\n // legacy keys (`repositories:` / `ai_resources:`) — propagate to the caller.\n const config = resolveSkWorkspaceConfig(this.projectDir);\n\n const sources = config.sources ?? [];\n const stores = config.stores ?? [];\n const dependencies = config.dependencies ?? [];\n const overrides = config.overrides ?? [];\n const patches = config.patches ?? {};\n\n // Internal install-pipeline map: slug (derived from the source URL) →\n // SourceDeclaration pointing at the machine-cache clone under\n // ~/.skaile/sources/<slug>/. The slug is also the cache key for ensureRepo.\n const skaileHome = process.env.SKAILE_HOME ?? join(homedir(), \".skaile\");\n const sourcesDir = join(skaileHome, \"sources\");\n const repositories: Record<string, SourceDeclaration> = {};\n for (const s of sources) {\n const slug = sourceSlug(s.url);\n if (repositories[slug]) continue;\n repositories[slug] = { path: join(sourcesDir, slug), url: s.url };\n }\n\n // Implicit built-in source: the first-party assets shipped inside the\n // package (`dist/factory-assets/`). Always available, zero config — keyed by\n // its declared publisher so refs (`kind:@<publisher>/name`) and `info`\n // resolve cleanly. Skipped when the user already declares the same source\n // explicitly (avoids duplicate catalog entries) or when no bundle is present.\n const factory = resolveFactorySource();\n const factoryUrl = normalizeRepoUrl(FACTORY_SOURCE_URL);\n const alreadyDeclared = Object.values(repositories).some(\n (d) => d.url !== undefined && normalizeRepoUrl(d.url) === factoryUrl,\n );\n if (factory && !alreadyDeclared && !repositories[factory.publisher]) {\n repositories[factory.publisher] = {\n path: factory.dir,\n url: FACTORY_SOURCE_URL,\n factory: true,\n };\n }\n\n return { repositories, sources, stores, dependencies, overrides, patches, config };\n }\n\n /** Build provenance-index clones from the resolved source declarations. */\n private buildClones(repositories: Record<string, SourceDeclaration>): SourceClone[] {\n const clones: SourceClone[] = [];\n for (const [slug, decl] of Object.entries(repositories)) {\n const localPath = this.resolveRepoDir(decl, slug);\n if (!localPath || !existsSync(localPath)) continue;\n const commit = getRepoCommit(localPath) ?? \"0\".repeat(40);\n clones.push({\n localPath,\n sourceUrl: decl.url ?? localPath,\n commit,\n tag: decl.branch,\n });\n }\n return clones;\n }\n\n /**\n * Bridge a resolved {@link ProvenanceCandidate} to a {@link CatalogEntry} for\n * the deploy pipeline. `source` is the absolute path to the asset's primary\n * manifest (or its directory) inside the clone; `publisher` is set to the\n * clone slug so `deployAll`'s repositories lookup resolves local-vs-remote.\n */\n private candidateToCatalogEntry(\n c: ProvenanceCandidate,\n repositories: Record<string, SourceDeclaration>,\n ): CatalogEntry | null {\n // Find the clone slug whose declaration URL matches the candidate's source.\n let slug: string | undefined;\n let cloneDir: string | undefined;\n for (const [s, decl] of Object.entries(repositories)) {\n if (decl.url === c.sourceUrl) {\n slug = s;\n cloneDir = this.resolveRepoDir(decl, s) ?? undefined;\n break;\n }\n }\n if (!cloneDir) {\n // Store-resolved or unknown source — fall back to the first source clone.\n const first = Object.entries(repositories)[0];\n if (first) {\n slug = first[0];\n cloneDir = this.resolveRepoDir(first[1], first[0]) ?? undefined;\n }\n }\n if (!cloneDir || !slug) return null;\n\n const MD_BY_KIND: Record<string, string> = {\n skill: \"SKILL.md\",\n agent: \"AGENT.md\",\n bundle: \"BUNDLE.md\",\n \"mcp-server\": \"MCP.md\",\n connector: \"CONNECTOR.md\",\n prompt: \"PROMPT.md\",\n contract: \"CONTRACT.md\",\n };\n const mdName = MD_BY_KIND[c.kind];\n const mdRel = c.files.find((f) => (mdName ? f.path.endsWith(mdName) : false))?.path;\n const source = mdRel ? join(cloneDir, mdRel) : cloneDir;\n\n const entry: CatalogEntry = {\n name: c.name,\n kind: c.kind as CatalogEntry[\"kind\"],\n description: c.description ?? \"\",\n source,\n publisher: slug,\n version: c.version,\n requires: [],\n // Manifest-declared deps are authoritative for the candidate's deps.\n dependencies: c.deps ?? [],\n metadata: c.metadata,\n };\n if (c.category != null) entry.category = c.category;\n if (c.keywords && c.keywords.length > 0) entry.keywords = c.keywords;\n if (c.license != null) entry.license = c.license;\n if (c.homepage != null) entry.homepage = c.homepage;\n return entry;\n }\n\n // ── Install / resolve ──────────────────────────────────────────────────\n\n /**\n * Install all dependencies declared in `skaile.yaml`.\n *\n * Steps: clone/pull repositories → resolve transitive dependencies → reconcile\n * (remove stale assets) → deploy new assets → write `skaile.lock.yaml` → record history.\n *\n * @param opts - Optional installation options.\n * @param opts.locked - When `true`, restore the exact versions recorded in the existing\n * lock file instead of resolving from source. Throws if no lock file is found.\n * @returns {@link InstallResult} summarising what was deployed, what was missing, and any collisions.\n */\n async install(opts?: { locked?: boolean }): Promise<InstallResult> {\n const { repositories, sources, stores, dependencies, overrides, patches } = this.loadConfig();\n\n if (opts?.locked) {\n return this.installLocked(repositories, patches);\n }\n\n // 1. Ensure all source clones are present/up to date.\n const cloneError = this.ensureSourceClones(repositories, sources);\n if (cloneError) return cloneError;\n\n // 2. Build the provenance index from the clones and resolve.\n const provenanceIndex = buildProvenanceIndex(this.buildClones(repositories), {\n projectDir: this.projectDir,\n });\n const { resolved, missing, overridesApplied } = await resolveAll(dependencies, {\n provenanceIndex,\n overrides,\n stores,\n storeFetcher: this.buildStoreFetcher(stores),\n projectDir: this.projectDir,\n });\n\n // 3. Reconcile: remove stale assets (in old lock but not in new resolved set).\n const removed = this.reconcileRemovedAssets(resolved);\n\n // 4. Map candidates to catalog entries and deploy.\n const entries = resolved\n .map((c) => this.candidateToCatalogEntry(c, repositories))\n .filter((e): e is CatalogEntry => e !== null);\n const deployed = deployAll(entries, repositories, patches, this.deployOpts);\n\n // 5. Write the v2 lock file.\n writeLock(this.lockPath, buildLockFile(resolved, overridesApplied));\n\n // 6. Record history.\n this.recordInstallHistory(deployed, removed);\n\n // 7. Install npm peer deps for any mount/connector declared in skaile.yaml.\n const { npmInstalled, npmFailed } = await this.installRuntimeAssetDeps();\n\n return { deployed, removed, missing, lockWritten: true, npmInstalled, npmFailed };\n }\n\n /**\n * Ensure all source clones are present/up to date. Returns an early\n * {@link InstallResult} describing the failed source on the first error, or\n * `null` when every clone succeeds.\n */\n private ensureSourceClones(\n repositories: Record<string, SourceDeclaration>,\n sources: SourceEntry[],\n ): InstallResult | null {\n const pinBySlug = new Map(sources.map((s) => [sourceSlug(s.url), s.pin]));\n for (const [name, decl] of Object.entries(repositories)) {\n try {\n ensureRepo(decl, name, this.reposDir, {\n projectDir: this.projectDir,\n pin: pinBySlug.get(name),\n });\n } catch (err) {\n return {\n deployed: [],\n removed: [],\n missing: [`source:${name} (${err instanceof Error ? err.message : String(err)})`],\n lockWritten: false,\n };\n }\n }\n return null;\n }\n\n /**\n * Remove stale assets — those recorded in the old lock but absent from the\n * newly resolved set. Returns the list of removed refs.\n */\n private reconcileRemovedAssets(resolved: ProvenanceCandidate[]): string[] {\n const oldLock = this.tryReadLock();\n const resolvedRefs = new Set(\n resolved.map((c) => `${c.publisher}/${c.kind}:${c.name}@${c.version}`),\n );\n const removed: string[] = [];\n if (oldLock) {\n for (const ref of Object.keys(oldLock.assets)) {\n if (!resolvedRefs.has(ref)) {\n const { kind, name } = parseCanonicalLockKey(ref);\n if (kind && name) {\n removeAsset(kind, name, this.deployOpts);\n removed.push(ref);\n }\n }\n }\n }\n return removed;\n }\n\n /** Append `add`/`remove` history entries for a completed install reconcile. */\n private recordInstallHistory(deployed: string[], removed: string[]): void {\n for (const ref of deployed) {\n appendHistory(this.projectDir, {\n ref,\n action: \"add\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n for (const ref of removed) {\n appendHistory(this.projectDir, {\n ref,\n action: \"remove\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n }\n\n /** Read the lock, returning null on a legacy v1 lock instead of throwing. */\n private tryReadLock(): LockFile | null {\n try {\n return readLock(this.lockPath);\n } catch {\n return null;\n }\n }\n\n /** Build a store fetcher from the configured stores, or undefined when none. */\n private buildStoreFetcher(stores: StoreEntry[]): StoreFetcher | undefined {\n if (stores.length === 0) return undefined;\n return {\n getInstallManifest: async (storeUrl, ref) => {\n const { RemoteCatalogSource, CatalogHttpError } = await import(\n \"@skaile/workspaces/library\"\n );\n const src = new RemoteCatalogSource({ baseUrl: storeUrl });\n try {\n const m = await src.getInstallManifest(ref);\n return {\n sourceUrl: m.source.url,\n commit: m.source.commitSha,\n sha256: m.sha256,\n files: m.files,\n };\n } catch (err) {\n if (err instanceof CatalogHttpError && err.status === 404) return null;\n throw err;\n }\n },\n getCanonicalDigest: async (storeUrl, ref) => {\n const { RemoteCatalogSource } = await import(\"@skaile/workspaces/library\");\n const src = new RemoteCatalogSource({ baseUrl: storeUrl });\n return src.getCanonicalDigest(ref);\n },\n };\n }\n\n /**\n * Resolve runtime assets and install any missing npm peer deps.\n *\n * - Required deps: installed via `bun add --optional`. Failure is recorded\n * in `npmFailed` but does not throw — install() proceeds so users get a\n * useful error message rather than a hung command.\n * - Optional deps: not installed automatically (would force every consumer\n * to pull every connector's deps). Future: add a flag to opt in.\n */\n private async installRuntimeAssetDeps(): Promise<{\n npmInstalled: string[];\n npmFailed: string[];\n }> {\n const npmInstalled: string[] = [];\n const npmFailed: string[] = [];\n let runtimeAssets: Awaited<ReturnType<typeof resolveRuntimeAssets>> | null = null;\n try {\n runtimeAssets = await resolveRuntimeAssets(this.projectDir);\n } catch {\n // Non-fatal — projects with no skaile.yaml or unresolvable factory-assets\n // simply have no runtime deps to install.\n return { npmInstalled, npmFailed };\n }\n\n const required = runtimeAssets.requiredNpmDeps.required;\n if (required.length === 0) return { npmInstalled, npmFailed };\n\n const { findMissingPackages, installNpmPackages } = await import(\n \"@skaile/workspaces/connectors\"\n );\n const missing = findMissingPackages(required, this.projectDir);\n if (missing.length === 0) return { npmInstalled, npmFailed };\n\n const result = await installNpmPackages(missing, this.projectDir);\n if (result.success) {\n npmInstalled.push(...missing);\n } else {\n npmFailed.push(...missing);\n }\n return { npmInstalled, npmFailed };\n }\n\n private installLocked(\n repositories: Record<string, SourceDeclaration>,\n patches: Record<string, string>,\n ): InstallResult {\n const lock = this.tryReadLock();\n if (!lock) {\n throw new Error(\"No lock file found. Run `skaile install` first.\");\n }\n\n // Ensure every contributing source clone exists at its pinned commit. Sources\n // are keyed by URL slug; the lock's `sources[]` carries the URL + commit.\n const declBySlug = new Map(Object.entries(repositories));\n for (const src of lock.sources) {\n const slug = sourceSlug(src.url);\n const decl = declBySlug.get(slug) ?? { url: src.url };\n ensureRepo(decl, slug, this.reposDir, { projectDir: this.projectDir, pin: src.commit });\n }\n\n // Resolve a source URL to its on-disk clone for verification.\n const resolveCloneDir = (sourceUrl: string): string | null => {\n const slug = sourceSlug(sourceUrl);\n const decl = declBySlug.get(slug) ?? { url: sourceUrl };\n return this.resolveRepoDir(decl, slug);\n };\n\n // Verify integrity against the v2 lock.\n const verification = verifyLock(lock, resolveCloneDir);\n if (!verification.ok) {\n const issues = [\n ...verification.drifted.map((r) => `drifted: ${r}`),\n ...verification.missing.map((r) => `missing: ${r}`),\n ];\n throw new Error(`Lock file verification failed:\\n ${issues.join(\"\\n \")}`);\n }\n\n // Rebuild catalog entries from the lock and deploy.\n const resolved: CatalogEntry[] = [];\n for (const [ref, entry] of Object.entries(lock.assets)) {\n const { publisher, kind, name } = parseCanonicalLockKey(ref);\n if (!publisher || !kind || !name) continue;\n const slug = sourceSlug(entry.source.url);\n const cloneDir = resolveCloneDir(entry.source.url) ?? join(this.reposDir, slug);\n const mdRel =\n entry.files.find((f) => /\\.(md|yaml)$/i.test(f.path))?.path ?? entry.files[0]?.path ?? \"\";\n resolved.push({\n name,\n kind: kind as CatalogEntry[\"kind\"],\n description: \"\",\n source: mdRel ? join(cloneDir, mdRel) : cloneDir,\n publisher: slug,\n version: entry.source.commit,\n requires: [],\n dependencies: [],\n });\n // Ensure the repositories map has an entry for deployAll's local/remote check.\n if (!repositories[slug]) repositories[slug] = { url: entry.source.url, path: cloneDir };\n }\n\n const deployed = deployAll(resolved, repositories, patches, this.deployOpts);\n return { deployed, removed: [], missing: [], lockWritten: false };\n }\n\n /**\n * Add a single asset (and its transitive dependencies) to the workspace.\n *\n * Resolves `ref`, deploys the asset and all requirements, then records the ref\n * in `skaile.yaml` `dependencies` so subsequent `skaile install` runs re-deploy it.\n *\n * @param ref - Asset ref in `kind:name` or `repo/kind:name` form (e.g. `skill:my-skill`).\n * @returns Array of asset refs that were deployed in this call.\n * @throws When the asset cannot be found in any configured repository.\n */\n async add(ref: string): Promise<string[]> {\n const { repositories, stores, overrides, patches } = this.loadConfig();\n const parsed = parseAssetRef(ref);\n\n // Ensure clones.\n for (const [name, decl] of Object.entries(repositories)) {\n try {\n ensureRepo(decl, name, this.reposDir, { projectDir: this.projectDir });\n } catch {}\n }\n\n const provenanceIndex = buildProvenanceIndex(this.buildClones(repositories), {\n projectDir: this.projectDir,\n });\n const { resolved, missing } = await resolveAll([ref], {\n provenanceIndex,\n overrides,\n stores,\n storeFetcher: this.buildStoreFetcher(stores),\n projectDir: this.projectDir,\n });\n if (resolved.length === 0) {\n throw new Error(\n `Asset not found: ${ref}${missing.length ? ` (missing: ${missing.join(\", \")})` : \"\"}`,\n );\n }\n\n const entries = resolved\n .map((c) => this.candidateToCatalogEntry(c, repositories))\n .filter((e): e is CatalogEntry => e !== null);\n const deployed = deployAll(entries, repositories, patches, this.deployOpts);\n\n // Add to skaile.yaml dependencies (canonical ref string).\n this.addDependencyToConfig(ref);\n\n for (const d of deployed) {\n appendHistory(this.projectDir, {\n ref: d,\n action: \"add\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n\n return deployed;\n }\n\n /**\n * Remove a deployed asset and unregister it from `skaile.yaml`.\n *\n * @param ref - Asset ref in `kind:name` form (e.g. `skill:my-skill`).\n * @returns `true` if the asset was found and removed, `false` if it was not deployed.\n */\n remove(ref: string): boolean {\n const parsed = parseAssetRef(ref);\n const ok = removeAsset(parsed.kind, parsed.name, this.deployOpts);\n if (ok) {\n const depRef = `${parsed.kind}:${parsed.name}`;\n this.removeDependencyFromConfig(depRef);\n\n appendHistory(this.projectDir, {\n ref: depRef,\n action: \"remove\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n return ok;\n }\n\n // ── Query ──────────────────────────────────────────────────────────────\n\n /**\n * Search the catalog across all configured repositories.\n *\n * @param query - Substring to match against entry names and descriptions (case-insensitive).\n * Omit to return all entries.\n * @param kind - Filter by asset kind (`\"skill\"`, `\"agent\"`, `\"prompt\"`, `\"flow\"`, `\"contract\"`).\n * Omit to return all kinds.\n * @returns Array of matching {@link CatalogEntry} objects from all accessible repositories.\n */\n search(query?: string, kind?: string): CatalogEntry[] {\n const { repositories } = this.loadConfig();\n let all: CatalogEntry[] = [];\n\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = this.resolveRepoDir(decl, name);\n if (!repoDir) continue;\n all = [...all, ...scanRepo(repoDir, name)];\n }\n\n if (kind) all = all.filter((e) => e.kind === kind);\n if (query) {\n const q = query.toLowerCase();\n all = all.filter(\n (e) => e.name.toLowerCase().includes(q) || e.description.toLowerCase().includes(q),\n );\n }\n return all;\n }\n\n /**\n * Look up a single asset's full catalog entry.\n *\n * @param ref - Asset ref in `kind:name` or `repo/kind:name` form.\n * @returns The matching {@link CatalogEntry}, or `null` when not found.\n */\n info(ref: string): CatalogEntry | null {\n const { repositories } = this.loadConfig();\n const parsed = parseAssetRef(ref);\n\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = this.resolveRepoDir(decl, name);\n if (!repoDir) continue;\n // Match on the entry's scanned (manifest) publisher, not the repo map key\n // (= URL slug). The two are unrelated identities under canonical schema.\n const entries = scanRepo(repoDir, name);\n const match = entries.find(\n (e) =>\n e.kind === parsed.kind &&\n e.name === parsed.name &&\n (!parsed.publisher || e.publisher === parsed.publisher),\n );\n if (match) return match;\n }\n return null;\n }\n\n /**\n * List all assets currently deployed in the workspace (or global cache).\n *\n * Scans the framework deploy directories rather than the lock file, so it\n * also returns assets that were installed manually or outside of `skaile install`.\n *\n * @param kind - Filter by asset kind. Omit to return all kinds.\n * @returns Shallow {@link CatalogEntry} objects (description and version will be empty).\n */\n listDeployed(kind?: string): CatalogEntry[] {\n // Bundles are dependency groups, not deployed as files — exclude from scan\n const kinds = (\n kind ? [kind] : [\"skill\", \"agent\", \"prompt\", \"flow\", \"contract\"]\n ) as AiComponent[];\n const result: CatalogEntry[] = [];\n const seen = new Set<string>();\n for (const k of kinds) {\n try {\n const base = deployedBase(k, this.driverTarget, this.global, this.projectDir);\n if (!existsSync(base)) continue;\n for (const item of readdirSync(base, { withFileTypes: true })) {\n // Directories and symlinks use the directory name directly (skills, omp agents, etc.)\n // Files use the stem without extension (claude-code agents → .md, codex agents → .toml,\n // prompts → .prompt.md, flows → .flow.yaml/.flow.json)\n let name: string;\n if (item.isDirectory() || item.isSymbolicLink()) {\n name = item.name;\n } else if (item.isFile()) {\n name = item.name\n .replace(/\\.prompt\\.md$/, \"\")\n .replace(/\\.flow\\.(yaml|json)$/, \"\")\n .replace(/\\.bundle\\.yaml$/, \"\")\n .replace(/\\.(md|toml|yaml|json)$/, \"\");\n } else {\n continue;\n }\n const key = `${k}:${name}`;\n if (seen.has(key)) continue;\n seen.add(key);\n result.push({\n name,\n kind: k as any,\n description: \"\",\n source: join(base, item.name),\n version: \"\",\n requires: [],\n dependencies: [],\n });\n }\n } catch {}\n }\n return result;\n }\n\n /**\n * Build an aggregated workspace overview with domain grouping and sync status.\n *\n * Combines deployed assets, lock file metadata, and live repository status\n * into a single structured result. Used by `skaile status`.\n *\n * @returns {@link OverviewResult} with entries grouped by domain and per-repo sync status.\n */\n overview(): OverviewResult {\n const { repositories } = this.loadConfig();\n const lock = this.tryReadLock();\n const deployed = this.listDeployed();\n\n const repoStatuses = this.buildRepoStatuses(repositories);\n const lockByKindName = indexLockByKindName(lock);\n\n // Build entries with publisher + sync info. Domain grouping is by publisher\n // now that the lock no longer records a project-local domain.\n const entries: OverviewEntry[] = [];\n for (const d of deployed) {\n const lockEntry = lockByKindName.get(`${d.kind}:${d.name}`);\n const publisher = lockEntry?.publisher ?? \"\";\n const version = lockEntry?.version ?? \"\";\n const slug = lockEntry ? sourceSlug(lockEntry.url) : \"\";\n const syncStatus = slug ? computeSyncStatus(repoStatuses.get(slug)) : \"unknown\";\n const domain = publisher || \"unknown\";\n entries.push({ kind: d.kind, name: d.name, domain, publisher, version, syncStatus });\n }\n\n return {\n byDomain: groupAndSortByDomain(entries),\n total: entries.length,\n repos: [...repoStatuses.values()],\n };\n }\n\n /** Collect live sync status for every configured repository, keyed by name. */\n private buildRepoStatuses(\n repositories: Record<string, SourceDeclaration>,\n ): Map<string, RepoStatusInfo> {\n const repoStatuses = new Map<string, RepoStatusInfo>();\n for (const [name, decl] of Object.entries(repositories)) {\n const status = checkRepoStatus(decl, name, this.reposDir);\n repoStatuses.set(name, {\n name,\n kind: status.kind,\n behind: status.behind,\n upToDate: status.upToDate,\n error: status.error,\n });\n }\n return repoStatuses;\n }\n\n /**\n * Build the resolved dependency tree from the lock file.\n *\n * @returns Root {@link DependencyNode} with `ref === \"project\"` whose children\n * are the directly-declared dependencies, each with their own transitive subtrees.\n * Returns a single node with `ref === \"(no lock file)\"` when no lock exists.\n */\n tree(): DependencyNode {\n const lock = this.tryReadLock();\n if (!lock) return { ref: \"(no lock file)\", children: [] };\n\n // v2 lock no longer records per-asset parent provenance — every locked asset\n // is shown as a direct child of the project (flat tree).\n return {\n ref: \"project\",\n children: Object.keys(lock.assets).map((ref) => ({ ref, children: [] })),\n };\n }\n\n /**\n * Explain why an asset is installed by tracing its dependency chain in the lock file.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Chain of refs from the asset back to `\"direct (skaile.yaml)\"`, or `[]` when\n * the asset is not in the lock file.\n */\n why(ref: string): string[] {\n const lock = this.tryReadLock();\n if (!lock) return [];\n if (!lock.assets[ref]) return []; // not in lock file\n // v2 lock no longer records a dep chain — every locked asset is reported as\n // directly declared. (Transitive provenance reconstruction is out of scope.)\n return [ref, \"direct (skaile.yaml)\"];\n }\n\n /**\n * List installed assets whose source repository is behind the remote.\n *\n * Only remote repositories (not local paths) are checked for staleness.\n *\n * @returns Array of {@link OutdatedEntry} objects, one per asset in a repository\n * that has commits not yet pulled locally.\n */\n outdated(): OutdatedEntry[] {\n const { repositories } = this.loadConfig();\n const lock = this.tryReadLock();\n if (!lock) return [];\n\n const result: OutdatedEntry[] = [];\n for (const src of lock.sources) {\n const slug = sourceSlug(src.url);\n const decl = repositories[slug];\n if (!decl || decl.path) continue; // skip unknown / local sources\n const status = checkRepoStatus(decl, slug, this.reposDir);\n if (status.behind <= 0) continue;\n for (const [ref, entry] of Object.entries(lock.assets)) {\n if (entry.source.url !== src.url) continue;\n const { publisher, kind, name, version } = parseCanonicalLockKey(ref);\n if (!kind || !name) continue;\n result.push({\n kind,\n name,\n publisher: publisher ?? slug,\n currentVersion: version ?? \"\",\n behind: status.behind,\n });\n }\n }\n return result;\n }\n\n /**\n * Produce a unified diff between the deployed asset and its catalog source.\n *\n * Useful for detecting manual edits to deployed files or verifying that a patch\n * was applied correctly.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Unified diff string, or `null` when there are no differences or the\n * asset is not deployed/resolvable.\n */\n diff(ref: string): string | null {\n const parsed = parseAssetRef(ref);\n const entry = this.info(ref);\n if (!entry) return null;\n\n const deployedPath = join(\n deployedBase(parsed.kind as AiComponent, this.driverTarget, this.global, this.projectDir),\n parsed.name,\n );\n if (!existsSync(deployedPath) || !existsSync(entry.source)) return null;\n\n const r = spawnSync(\"diff\", [\"-ruN\", entry.source, deployedPath], { encoding: \"utf8\" });\n return r.status === 1 ? r.stdout : null;\n }\n\n // ── Lock ───────────────────────────────────────────────────────────────\n\n /**\n * Resolve all declared dependencies and write (or overwrite) `skaile.lock.yaml`.\n *\n * Performs repository sync and full dependency resolution without deploying assets.\n * Use this to regenerate the lock file after manually editing `skaile.yaml`.\n *\n * @returns The written {@link LockFile} data.\n */\n async lock(): Promise<LockFile> {\n const { repositories, stores, dependencies, overrides } = this.loadConfig();\n\n for (const [name, decl] of Object.entries(repositories)) {\n try {\n ensureRepo(decl, name, this.reposDir, { projectDir: this.projectDir });\n } catch {}\n }\n\n const provenanceIndex = buildProvenanceIndex(this.buildClones(repositories), {\n projectDir: this.projectDir,\n });\n const { resolved, overridesApplied } = await resolveAll(dependencies, {\n provenanceIndex,\n overrides,\n stores,\n storeFetcher: this.buildStoreFetcher(stores),\n projectDir: this.projectDir,\n });\n const lockData = buildLockFile(resolved, overridesApplied);\n writeLock(this.lockPath, lockData);\n return lockData;\n }\n\n // ── Patch workflow ─────────────────────────────────────────────────────\n\n /**\n * Extract a deployed asset into a patch working directory for editing.\n *\n * Copies the deployed asset to `.skaile/patches/<kind>-<name>/` so changes\n * can be made there and then committed as a patch file via `patchCommit`.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Absolute path to the patch working directory.\n * @throws When the asset cannot be found in the catalog.\n */\n patch(ref: string): string {\n const entry = this.info(ref);\n if (!entry) throw new Error(`Asset not found: ${ref}`);\n return extractForPatch(entry, this.patchDir);\n }\n\n /**\n * Generate a `.patch` file from changes made in the patch working directory.\n *\n * Diffs the patch working directory against the original catalog source and\n * writes the result to `.skaile/patches/<kind>-<name>.patch`.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Absolute path to the generated `.patch` file.\n * @throws When the patch working directory does not exist or no differences are found.\n */\n patchCommit(ref: string): string {\n const parsed = parseAssetRef(ref);\n const entry = this.info(ref);\n if (!entry) throw new Error(`Asset not found: ${ref}`);\n\n const patchedDir = join(this.patchDir, `${parsed.kind}-${parsed.name}`);\n if (!existsSync(patchedDir)) {\n throw new Error(`No patch working dir found. Run \\`skaile patch ${ref}\\` first.`);\n }\n\n const originalDir = dirname(entry.source);\n const content = generatePatch(originalDir, patchedDir);\n if (!content) throw new Error(\"No differences found.\");\n\n const patchFile = join(this.patchDir, `${parsed.kind}-${parsed.name}.patch`);\n savePatch(patchFile, content);\n return patchFile;\n }\n\n /**\n * Apply the committed patch file to the repository clone and open a contribution branch.\n *\n * Applies `.skaile/patches/<kind>-<name>.patch` to the repository clone, creates a\n * `patch/<kind>-<name>` branch, and stages a commit — ready to push via `contribPush`.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @throws When the asset is not found, has no repository, or the patch file is missing.\n */\n patchSubmit(ref: string): void {\n const parsed = parseAssetRef(ref);\n const entry = this.info(ref);\n if (!entry?.publisher) throw new Error(`Asset not found or no publisher: ${ref}`);\n\n const { repositories } = this.loadConfig();\n const decl = repositories[entry.publisher];\n if (!decl?.url) throw new Error(\"Can only submit patches for remote sources.\");\n\n // Resolve through the same helper search/info use so patch + read agree on the clone dir.\n const repoDir = this.resolveRepoDir(decl, entry.publisher);\n if (!repoDir) throw new Error(`Repository clone not found for ${entry.publisher}.`);\n const branchName = `patch/${parsed.kind}-${parsed.name}`;\n\n // Apply patch to repo clone\n const patchFile = join(this.patchDir, `${parsed.kind}-${parsed.name}.patch`);\n if (!existsSync(patchFile)) throw new Error(\"No patch file. Run `skaile patch-commit` first.\");\n\n coreApplyPatch(repoDir, patchFile);\n commitChanges(repoDir, `fix: improve ${parsed.kind} ${parsed.name}`, branchName);\n }\n\n /**\n * Delete the patch working directory and patch file for an asset.\n *\n * @param ref - Asset ref in `kind:name` form.\n */\n patchRemove(ref: string): void {\n const parsed = parseAssetRef(ref);\n const patchFile = join(this.patchDir, `${parsed.kind}-${parsed.name}.patch`);\n const patchedDir = join(this.patchDir, `${parsed.kind}-${parsed.name}`);\n try {\n rmSync(patchFile);\n } catch {}\n try {\n rmSync(patchedDir, { recursive: true });\n } catch {}\n }\n\n // ── Doctor ─────────────────────────────────────────────────────────────\n\n /**\n * Scan deployed assets for unsatisfied transitive dependencies.\n *\n * For each deployed asset, checks that all entries in its `requires` list are\n * also deployed. Returns a list of issues with a flag indicating whether the\n * missing dependency can be resolved from a configured repository.\n *\n * @returns Array of {@link DepIssue} objects. An empty array means the workspace is healthy.\n */\n doctor(): DepIssue[] {\n const { repositories } = this.loadConfig();\n const deployed = this.listDeployed();\n const issues: DepIssue[] = [];\n\n for (const entry of deployed) {\n const full = this.info(`${entry.kind}:${entry.name}`);\n if (!full) continue;\n for (const req of full.requires) {\n if (\n !isDeployed(\n req.kind as AiComponent,\n req.name,\n this.driverTarget,\n this.global,\n this.projectDir,\n )\n ) {\n const inRepos =\n resolveAsset({ kind: req.kind, name: req.name }, repositories, this.reposDir) !== null;\n issues.push({\n assetKind: entry.kind,\n assetName: entry.name,\n depKind: req.kind,\n depName: req.name,\n inRepos,\n });\n }\n }\n }\n return issues;\n }\n\n // ── Scaffold ───────────────────────────────────────────────────────────\n\n /**\n * Create a minimal asset scaffold directory (delegates to {@link createScaffold}).\n *\n * @param name - Asset name (also used as the directory name).\n * @param kind - Asset kind: `skill` | `agent` | `bundle` | `flow` | `prompt` | `contract`.\n * @param destDir - Parent directory to create the asset in.\n * @returns `{ ok: true, path }` on success, `{ ok: false, path: errorMessage }` if the\n * directory already exists.\n */\n create(name: string, kind: string, destDir: string): { ok: boolean; path: string } {\n return createScaffold(name, kind, destDir);\n }\n\n // ── Contrib (REMOVED 2026-05-12) ───────────────────────────────────────\n //\n // The `contribChanges / contribDiff / contribCommit / contribPush /\n // contribCompare` methods were retired alongside `skaile repo contrib *`.\n // The refinement push-back workflow is being re-introduced in Phase 4 as\n // `skaile publish` + `skaile preset push` against the Library Source model.\n\n // ── History ────────────────────────────────────────────────────────────\n\n /**\n * Return recent asset action history entries, newest first.\n *\n * @param limit - Maximum number of entries to return. Defaults to `20`.\n * @returns Array of {@link HistoryEntry} objects in reverse-chronological order.\n */\n history(limit = 20): HistoryEntry[] {\n return getRecentHistory(this.projectDir, limit);\n }\n\n /**\n * Erase all asset action history for this workspace.\n */\n clearHistory(): void {\n clearHistory(this.projectDir);\n }\n\n // ── Clean ───────────────────────────────────────────────────────────────\n\n /**\n * Remove deployed assets tracked by the lock file and report unmanaged ones.\n *\n * With `opts.all`, also deletes `.skaile/history.yaml`, `.skaile/patches/`,\n * `.skaile/repos/`, and `skaile.lock.yaml` — effectively resetting the workspace\n * to a pre-install state.\n *\n * @param opts - Optional cleanup options.\n * @param opts.all - When `true`, remove all Skaile-managed state in addition to deployed assets.\n * @returns Object with `removed` (successfully cleaned refs), `skipped` (with reasons),\n * and `unmanaged` (deployed assets not in the lock file).\n */\n clean(opts?: { all?: boolean }): {\n removed: string[];\n skipped: Array<{ ref: string; reason: string }>;\n unmanaged: string[];\n } {\n const lock = this.tryReadLock();\n const skipped: Array<{ ref: string; reason: string }> = [];\n\n const removed = this.cleanLockedDeployedAssets(lock);\n const unmanaged = this.collectUnmanagedAssets(lock);\n\n if (opts?.all) this.removeAllManagedState();\n\n return { removed, skipped, unmanaged };\n }\n\n /**\n * Remove the deployed dir of every asset tracked by the lock; missing dirs\n * still count as removed. Returns the list of cleaned refs.\n */\n private cleanLockedDeployedAssets(lock: LockFile | null): string[] {\n const removed: string[] = [];\n if (!lock) return removed;\n for (const ref of Object.keys(lock.assets)) {\n const { kind, name } = parseCanonicalLockKey(ref);\n if (!kind || !name) continue;\n const dest = deployedDir(\n kind as AiComponent,\n name,\n this.driverTarget,\n this.global,\n this.projectDir,\n );\n\n try {\n const stat = lstatSync(dest);\n if (stat.isSymbolicLink()) unlinkSync(dest);\n else rmSync(dest, { recursive: true, force: true });\n removed.push(ref);\n } catch {\n // Already gone — count as removed\n removed.push(ref);\n }\n }\n return removed;\n }\n\n /**\n * Report deployed assets not tracked by the lock file. Deployed assets are\n * keyed by <kind>:<name>; lock canonical refs are mapped to that shape.\n */\n private collectUnmanagedAssets(lock: LockFile | null): string[] {\n const lockRefs = lock\n ? new Set(\n Object.keys(lock.assets).map((r) => {\n const p = parseCanonicalLockKey(r);\n return p.kind && p.name ? `${p.kind}:${p.name}` : r;\n }),\n )\n : new Set<string>();\n const unmanaged: string[] = [];\n const allDeployed = this.listDeployed();\n for (const d of allDeployed) {\n const ref = `${d.kind}:${d.name}`;\n if (!lockRefs.has(ref)) {\n unmanaged.push(ref);\n }\n }\n return unmanaged;\n }\n\n /** Delete all Skaile-managed state: history file, patches/, repos/, lock. */\n private removeAllManagedState(): void {\n // Delete history file\n const historyFile = join(this.projectDir, \".skaile\", \"history.yaml\");\n try {\n unlinkSync(historyFile);\n } catch {}\n\n // Remove patches dir\n try {\n rmSync(this.patchDir, { recursive: true, force: true });\n } catch {}\n\n // Remove repos dir\n try {\n rmSync(this.reposDir, { recursive: true, force: true });\n } catch {}\n\n // Remove lock file\n try {\n unlinkSync(this.lockPath);\n } catch {}\n }\n\n // ── Helpers ────────────────────────────────────────────────────────────\n\n /** Add a dependency ref to skaile.yaml if not already present. */\n private addDependencyToConfig(ref: string): void {\n if (this.global) return; // global installs don't modify skaile.yaml\n const configPath = join(this.projectDir, \"skaile.yaml\");\n if (!existsSync(configPath)) return;\n const raw = parseYaml(readFileSync(configPath, \"utf8\")) ?? {};\n if (!raw.dependencies) raw.dependencies = [];\n if (!raw.dependencies.includes(ref)) {\n raw.dependencies.push(ref);\n writeFileSync(configPath, stringifyYaml(raw, { lineWidth: 120 }));\n }\n }\n\n /** Remove a dependency ref from skaile.yaml. */\n private removeDependencyFromConfig(ref: string): void {\n if (this.global) return;\n const configPath = join(this.projectDir, \"skaile.yaml\");\n if (!existsSync(configPath)) return;\n const raw = parseYaml(readFileSync(configPath, \"utf8\")) ?? {};\n if (!raw.dependencies) return;\n const idx = raw.dependencies.indexOf(ref);\n if (idx !== -1) {\n raw.dependencies.splice(idx, 1);\n writeFileSync(configPath, stringifyYaml(raw, { lineWidth: 120 }));\n }\n }\n\n private resolveRepoDir(decl: SourceDeclaration, name: string): string | null {\n // Check links first\n const links = readLinks(this.projectDir);\n if (links[name]) {\n return existsSync(links[name]) ? links[name] : null;\n }\n\n if (decl.path) {\n const resolved = resolve(this.projectDir, decl.path);\n return existsSync(resolved) ? resolved : null;\n }\n\n // Check project-local symlink, then global cache\n const dest = join(this.reposDir, name);\n if (existsSync(dest)) return dest;\n\n const globalDest = join(getGlobalCacheDir(), name);\n if (existsSync(join(globalDest, \".git\"))) return globalDest;\n\n return null;\n }\n}\n\n// ── Agent install (renders GitAgent packages to framework-native files) ──\n\nexport { installAgent } from \"./install-agent.js\";\n\n// ── Renderers ─────────────────────────────────────────────────────────────\n\nexport type { AgentRenderer, AgentRenderInput, AgentRenderResult } from \"./renderers.js\";\nexport {\n AGENT_RENDERERS,\n claudeCodeRenderer,\n codexRenderer,\n driverTargetSupportsAgents,\n ompRenderer,\n} from \"./renderers.js\";\n\n// ── Fragments ─────────────────────────────────────────────────────────────\n\nexport type {\n AbilityRef,\n ConnectorRef,\n ContractRef,\n FragmentContext,\n FragmentId,\n} from \"./fragments.js\";\nexport { BUILT_IN_FRAGMENTS, loadPromptExtensions, resolveFragments } from \"./fragments.js\";\n"]}
|
|
1
|
+
{"version":3,"sources":["../asset-manager/src/index.ts"],"names":["parseYaml","stringifyYaml"],"mappings":";;;;;;;;;;;;;;AAwEA,SAAS,WAAW,GAAA,EAAqB;AACvC,EAAA,OACE,GAAA,CACG,QAAQ,QAAA,EAAU,EAAE,EACpB,KAAA,CAAM,M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KAAK,IAAA,EAAM;AACb,MAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,IAAA,CAAK,UAAA,EAAY,KAAK,IAAI,CAAA;AACnD,MAAA,OAAO,UAAA,CAAW,QAAQ,CAAA,GAAI,QAAA,GAAW,IAAA;AAAA,IAC3C;AAGA,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,IAAA,CAAK,QAAA,EAAU,IAAI,CAAA;AACrC,IAAA,IAAI,UAAA,CAAW,IAAI,CAAA,EAAG,OAAO,IAAA;AAE7B,IAAA,MAAM,UAAA,GAAa,IAAA,CAAK,iBAAA,EAAkB,EAAG,IAAI,CAAA;AACjD,IAAA,IAAI,WAAW,IAAA,CAAK,UAAA,EAAY,MAAM,CAAC,GAAG,OAAO,UAAA;AAEjD,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"chunk-7B3CL5JT.js","sourcesContent":["/**\n * @skaile/asset-manager — programmatic AI asset management API.\n *\n * Manages project-local repositories, dependency resolution, deployment,\n * lock files, patches, and contribution workflows.\n *\n * Usage:\n * import { AssetManager } from \"@skaile/workspaces/asset-manager\"\n * const am = new AssetManager({ projectDir: \"/path/to/project\" })\n * await am.install()\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport {\n existsSync,\n lstatSync,\n readdirSync,\n readFileSync,\n rmSync,\n unlinkSync,\n writeFileSync,\n} from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join, resolve } from \"node:path\";\nimport type {\n AiComponent,\n CatalogEntry,\n DriverTarget,\n LockFile,\n OverrideEntry,\n ProvenanceCandidate,\n SkWorkspaceConfig,\n SourceClone,\n SourceDeclaration,\n SourceEntry,\n StoreEntry,\n StoreFetcher,\n} from \"@skaile/workspaces/core\";\nimport {\n buildLockFile,\n buildProvenanceIndex,\n checkRepoStatus,\n applyPatch as coreApplyPatch,\n deployedBase,\n deployedDir,\n ensureRepo,\n extractForPatch,\n factoryAssetRoots,\n generatePatch,\n getGlobalCacheDir,\n getRepoCommit,\n isDeployed,\n parseAssetRef,\n readLinks,\n readLock,\n resolveAll,\n resolveAsset,\n resolveRuntimeAssets,\n resolveSkWorkspaceConfig,\n savePatch,\n scanRepo,\n verifyLock,\n writeLock,\n} from \"@skaile/workspaces/core\";\nimport { parse as parseYaml, stringify as stringifyYaml } from \"yaml\";\nimport { commitChanges } from \"./contrib.js\";\nimport type { HistoryEntry } from \"./history.js\";\nimport { appendHistory, clearHistory, getRecentHistory } from \"./history.js\";\nimport type { DeployOptions } from \"./installer.js\";\nimport { createScaffold, deployAll, removeAsset } from \"./installer.js\";\n\n/** Derive a cache slug from a source git URL (`<host>/<owner>/<repo>` → `<repo>`). */\nfunction sourceSlug(url: string): string {\n return (\n url\n .replace(/\\.git$/, \"\")\n .split(/[/:]/)\n .pop() ?? \"source\"\n );\n}\n\n/**\n * Normalize a git remote URL to a comparable identity so the same repo declared\n * in different syntaxes (`https://…`, `git@host:…`, trailing `/`, `.git` suffix,\n * case) compares equal. Used to dedupe the implicit factory source against an\n * explicit user declaration.\n */\nfunction normalizeRepoUrl(url: string): string {\n return url\n .trim()\n .replace(/^git@([^:]+):/, \"https://$1/\") // git@host:org/repo → https://host/org/repo\n .replace(/^[a-z]+:\\/\\//i, \"\") // drop scheme\n .replace(/\\.git$/i, \"\")\n .replace(/\\/+$/, \"\")\n .toLowerCase();\n}\n\n/**\n * Index lock entries by their `<kind>:<name>` suffix for deployed-asset lookup.\n * Only entries whose canonical key fully parses (kind, name, publisher, version)\n * are included.\n */\nfunction indexLockByKindName(\n lock: LockFile | null,\n): Map<string, { publisher: string; version: string; url: string }> {\n const lockByKindName = new Map<string, { publisher: string; version: string; url: string }>();\n for (const [key] of Object.entries(lock?.assets ?? {})) {\n const parsed = parseCanonicalLockKey(key);\n if (parsed.kind && parsed.name && parsed.publisher && parsed.version) {\n lockByKindName.set(`${parsed.kind}:${parsed.name}`, {\n publisher: parsed.publisher,\n version: parsed.version,\n url: lock!.assets[key]!.source.url,\n });\n }\n }\n return lockByKindName;\n}\n\n/** Derive an asset's sync status from its repository's live status. */\nfunction computeSyncStatus(repoStatus: RepoStatusInfo | undefined): string {\n if (!repoStatus) return \"unknown\";\n if (repoStatus.kind === \"local\") return \"local\";\n if (repoStatus.error) return \"error\";\n if (repoStatus.upToDate) return \"synced\";\n return \"outdated\";\n}\n\n/**\n * Group overview entries by domain, sort domains alphabetically, and sort\n * entries within each domain by kind then name.\n */\nfunction groupAndSortByDomain(entries: OverviewEntry[]): Map<string, OverviewEntry[]> {\n const byDomain = new Map<string, OverviewEntry[]>();\n for (const e of entries) {\n if (!byDomain.has(e.domain)) byDomain.set(e.domain, []);\n byDomain.get(e.domain)!.push(e);\n }\n\n const sorted = new Map<string, OverviewEntry[]>();\n for (const key of [...byDomain.keys()].sort()) {\n sorted.set(\n key,\n byDomain\n .get(key)!\n .sort((a, b) =>\n a.kind !== b.kind ? a.kind.localeCompare(b.kind) : a.name.localeCompare(b.name),\n ),\n );\n }\n return sorted;\n}\n\n/**\n * Parse a canonical lock key (`<kind>:@<publisher>/<name>#<version>`) into its\n * parts. The lock key is now a canonical asset ref, so this delegates to the one\n * ref parser; `AssetRef.pin` is exposed as `version` so the callers' destructuring\n * is unchanged. Stays total — callers rely on `{}`-then-`continue`, but\n * `parseAssetRef` throws, so a malformed key is caught and returned as `{}`.\n *\n * @internal Exported for unit tests; not part of the stable public surface.\n */\nexport function parseCanonicalLockKey(key: string): {\n publisher?: string;\n kind?: string;\n name?: string;\n version?: string;\n} {\n try {\n const ref = parseAssetRef(key);\n return {\n publisher: ref.publisher,\n kind: ref.kind,\n name: ref.name,\n version: ref.pin,\n };\n } catch {\n return {};\n }\n}\n\nexport type { HistoryEntry } from \"./history.js\";\nexport {\n appendHistory,\n clearHistory,\n getRecentHistory,\n loadHistory,\n} from \"./history.js\";\n// Re-export sub-modules\nexport type { DeployOptions } from \"./installer.js\";\nexport { createScaffold, deployAll, removeAsset } from \"./installer.js\";\nexport type { Log } from \"./renderers.js\";\nexport { renderAgentToFramework } from \"./renderers.js\";\n// Contrib helpers (commitChanges et al.) are still used internally by the\n// patch-submit flow but are no longer part of the public API surface — the\n// `skaile repo contrib *` command tree was removed on 2026-05-12.\n\n// ── Types ────────────────────────────────────────────────────────────────────\n\n/**\n * Metadata about a repository declared in `skaile.yaml`.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface RepoInfo {\n /** Repository name as declared in `skaile.yaml`. */\n name: string;\n /** How the repo is sourced: cloned from a URL, mounted from a local path, or symlinked via `skaile repo link`. */\n kind: \"local\" | \"remote\" | \"linked\";\n /** Remote URL (present when `kind === \"remote\"`). */\n url?: string;\n /** Filesystem path (present when `kind === \"local\"` or `kind === \"linked\"`). */\n path?: string;\n /** Git branch configured for this repository. */\n branch: string;\n /** Whether the repository has been cloned/resolved locally. */\n cloned: boolean;\n}\n\n/**\n * Live sync status for a repository.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface RepoStatusInfo {\n /** Repository name as declared in `skaile.yaml`. */\n name: string;\n /** How the repo is sourced. */\n kind: \"local\" | \"remote\" | \"linked\";\n /** Number of commits the local clone is behind the remote. */\n behind: number;\n /** `true` when the local clone matches the remote HEAD. */\n upToDate: boolean;\n /** Error message when status check failed. */\n error?: string;\n}\n\n/**\n * Result of a full `skaile install` or `skaile add` run.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface InstallResult {\n /** Asset refs (`kind:name`) successfully deployed in this run. */\n deployed: string[];\n /** Asset refs (`kind:name`) removed because they are no longer in the resolved set. */\n removed: string[];\n /** Asset refs that could not be resolved in any configured repository. */\n missing: string[];\n /** Whether `skaile.lock.yaml` was written or updated. */\n lockWritten: boolean;\n /**\n * npm packages installed as a side effect of resolving runtime asset peer\n * deps (connectors / mounts declared in skaile.yaml). Empty when nothing\n * needed installing or when the runtime-deps step was skipped.\n */\n npmInstalled?: string[];\n /**\n * npm packages that the runtime-deps step tried but failed to install.\n * Non-fatal — listed for telemetry and CLI reporting.\n */\n npmFailed?: string[];\n}\n\n/**\n * An installed asset whose source repository is behind the remote.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface OutdatedEntry {\n /** Asset kind (`skill`, `agent`, `prompt`, `flow`, `contract`). */\n kind: string;\n /** Asset name as registered in the catalog. */\n name: string;\n /** Repository that provides this asset. */\n publisher: string;\n /** Version string recorded in the lock file at install time. */\n currentVersion: string;\n /** Number of commits the local repository is behind the remote. */\n behind: number;\n}\n\n/**\n * A node in the resolved dependency tree (returned by `AssetManager.tree()`).\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface DependencyNode {\n /** Asset ref (`kind:name`) or `\"project\"` for the root node. */\n ref: string;\n /** Transitive dependencies resolved by this node. */\n children: DependencyNode[];\n}\n\n/**\n * A missing dependency detected by `AssetManager.doctor()`.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface DepIssue {\n /** Kind of the asset that has the unsatisfied requirement. */\n assetKind: string;\n /** Name of the asset that has the unsatisfied requirement. */\n assetName: string;\n /** Kind of the missing dependency. */\n depKind: string;\n /** Name of the missing dependency. */\n depName: string;\n /** `true` when the missing dependency exists in a configured repository but has not been installed. */\n inRepos: boolean;\n}\n\n/**\n * A single deployed asset shown in the workspace overview.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface OverviewEntry {\n /** Asset kind (`skill`, `agent`, `prompt`, `flow`, `contract`). */\n kind: string;\n /** Asset name. */\n name: string;\n /** Domain the asset belongs to (from the lock file; `\"unknown\"` when unresolvable). */\n domain: string;\n /** Repository that provides this asset. */\n publisher: string;\n /** Version string from the lock file. */\n version: string;\n /**\n * Sync status relative to the source repository.\n * - `\"synced\"` — local clone matches remote HEAD\n * - `\"outdated\"` — local clone is behind the remote\n * - `\"local\"` — sourced from a local path, no remote to compare\n * - `\"error\"` — status check failed\n * - `\"unknown\"` — repository not found or lock entry missing\n */\n syncStatus: string;\n}\n\n/**\n * Aggregated workspace overview returned by `AssetManager.overview()`.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface OverviewResult {\n /** Entries grouped by domain, sorted alphabetically. Each group is sorted by kind then name. */\n byDomain: Map<string, OverviewEntry[]>;\n /** Total number of deployed assets. */\n total: number;\n /** Sync status for each configured repository. */\n repos: RepoStatusInfo[];\n}\n\n// ── AssetManager ─────────────────────────────────────────────────────────────\n\n/**\n * Options for constructing an {@link AssetManager}.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface AssetManagerOptions {\n /** Absolute or relative path to the workspace root (must contain `skaile.yaml`). */\n projectDir: string;\n /**\n * Agent framework to target for asset deployment.\n * Determines which framework directories (``.claude/``, ``.omp/``, etc.) are used.\n * Defaults to `\"claude-code\"`.\n */\n driverTarget?: DriverTarget;\n /**\n * When `true`, assets are installed into the global Skaile cache rather than the\n * project workspace. Skips `skaile.yaml` dependency updates.\n */\n global?: boolean;\n}\n\n/** Canonical git URL identity for the bundled factory source. Never fetched —\n * the bytes live inside the package (`factory-assets/`); the URL is only the\n * match key the provenance walker and `candidateToCatalogEntry` key off. */\nconst FACTORY_SOURCE_URL = \"https://github.com/skaile-ai/ai-assets\";\n\n/**\n * Locate the built-in first-party skills/bundles shipped inside the package.\n *\n * Resolves through the shared {@link factoryAssetRoots} helper — the\n * `SKAILE_FACTORY_ASSETS_DIR` override layer (when set) ahead of the bundled\n * tree (in-repo source during dev, `dist/factory-assets/` after install), so a\n * container's override is honoured here identically to `serve`. Returns the\n * highest-precedence root that carries a `skaile.manifest.yaml` (the publication\n * manifest that names the source's publisher), or `null` when none qualifies —\n * the factory source is then simply not injected rather than erroring.\n */\nfunction resolveFactoryAssetsDir(): string | null {\n for (const dir of factoryAssetRoots()) {\n if (existsSync(join(dir, \"skaile.manifest.yaml\"))) return dir;\n }\n return null;\n}\n\n/** Read the declared `publisher` from a source's root `skaile.manifest.yaml`. */\nfunction readDeclaredPublisher(sourceDir: string): string | undefined {\n try {\n const raw = parseYaml(readFileSync(join(sourceDir, \"skaile.manifest.yaml\"), \"utf8\")) as {\n publisher?: unknown;\n } | null;\n return raw && typeof raw.publisher === \"string\" && raw.publisher.length > 0\n ? raw.publisher\n : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The bundled factory source `{ dir, publisher }`, or `null` when no usable\n * bundle is present. Resolved once per process — the package location and the\n * bundled `skaile.manifest.yaml` are immutable for the process lifetime, so the\n * `require.resolve` + `existsSync` probes + YAML parse run a single time rather\n * than on every `loadConfig()` call. `undefined` = not yet computed.\n */\nlet factorySourceCache: { dir: string; publisher: string } | null | undefined;\n\nfunction resolveFactorySource(): { dir: string; publisher: string } | null {\n if (factorySourceCache !== undefined) return factorySourceCache;\n const dir = resolveFactoryAssetsDir();\n const publisher = dir ? readDeclaredPublisher(dir) : undefined;\n factorySourceCache = dir && publisher ? { dir, publisher } : null;\n return factorySourceCache;\n}\n\n/**\n * Programmatic API for managing AI assets in a Skaile workspace.\n *\n * `AssetManager` wraps repository management, catalog search, asset installation,\n * lock-file tracking, patch workflows, and workspace diagnostics. The CLI delegates\n * all `skaile catalog`, `skaile repo`, `skaile install`, `skaile add`, and\n * `skaile init` commands to this class.\n *\n * @example\n * ```typescript\n * import { AssetManager } from \"@skaile/workspaces/asset-manager\";\n *\n * const am = new AssetManager({ projectDir: \"/my-project\" });\n *\n * // Install all dependencies declared in skaile.yaml\n * const result = await am.install();\n * console.log(`Deployed: ${result.deployed.join(\", \")}`);\n *\n * // Add a single skill (resolves transitive deps, updates skaile.yaml)\n * const deployed = am.add(\"skill:my-skill\");\n *\n * // Search the catalog\n * const skills = am.search(\"code review\", \"skill\");\n * ```\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport class AssetManager {\n /** Resolved absolute path to the workspace root. */\n readonly projectDir: string;\n /** Agent framework driver target used for all deploy operations. */\n readonly driverTarget: DriverTarget;\n /** Whether this instance operates in global-install mode. */\n readonly global: boolean;\n\n constructor(opts: AssetManagerOptions) {\n this.projectDir = resolve(opts.projectDir);\n this.driverTarget = opts.driverTarget ?? (\"claude-code\" as DriverTarget);\n this.global = opts.global ?? false;\n }\n\n private get reposDir(): string {\n return join(this.projectDir, \".skaile\", \"repos\");\n }\n\n private get lockPath(): string {\n return join(this.projectDir, \"skaile.lock.yaml\");\n }\n\n private get patchDir(): string {\n return join(this.projectDir, \".skaile\", \"patches\");\n }\n\n private get deployOpts(): DeployOptions {\n return { driverTarget: this.driverTarget, global: this.global, cwd: this.projectDir };\n }\n\n private loadConfig(): {\n repositories: Record<string, SourceDeclaration>;\n sources: SourceEntry[];\n stores: StoreEntry[];\n dependencies: string[];\n overrides: OverrideEntry[];\n patches: Record<string, string>;\n config: SkWorkspaceConfig;\n } {\n // resolveSkWorkspaceConfig runs the canonical normalizer and throws on\n // legacy keys (`repositories:` / `ai_resources:`) — propagate to the caller.\n const config = resolveSkWorkspaceConfig(this.projectDir);\n\n const sources = config.sources ?? [];\n const stores = config.stores ?? [];\n const dependencies = config.dependencies ?? [];\n const overrides = config.overrides ?? [];\n const patches = config.patches ?? {};\n\n // Internal install-pipeline map: slug (derived from the source URL) →\n // SourceDeclaration pointing at the machine-cache clone under\n // ~/.skaile/sources/<slug>/. The slug is also the cache key for ensureRepo.\n const skaileHome = process.env.SKAILE_HOME ?? join(homedir(), \".skaile\");\n const sourcesDir = join(skaileHome, \"sources\");\n const repositories: Record<string, SourceDeclaration> = {};\n for (const s of sources) {\n const slug = sourceSlug(s.url);\n if (repositories[slug]) continue;\n repositories[slug] = { path: join(sourcesDir, slug), url: s.url };\n }\n\n // Implicit built-in source: the first-party assets shipped inside the\n // package (`dist/factory-assets/`). Always available, zero config — keyed by\n // its declared publisher so refs (`kind:@<publisher>/name`) and `info`\n // resolve cleanly. Skipped when the user already declares the same source\n // explicitly (avoids duplicate catalog entries) or when no bundle is present.\n const factory = resolveFactorySource();\n const factoryUrl = normalizeRepoUrl(FACTORY_SOURCE_URL);\n const alreadyDeclared = Object.values(repositories).some(\n (d) => d.url !== undefined && normalizeRepoUrl(d.url) === factoryUrl,\n );\n if (factory && !alreadyDeclared && !repositories[factory.publisher]) {\n repositories[factory.publisher] = {\n path: factory.dir,\n url: FACTORY_SOURCE_URL,\n factory: true,\n };\n }\n\n return { repositories, sources, stores, dependencies, overrides, patches, config };\n }\n\n /** Build provenance-index clones from the resolved source declarations. */\n private buildClones(repositories: Record<string, SourceDeclaration>): SourceClone[] {\n const clones: SourceClone[] = [];\n for (const [slug, decl] of Object.entries(repositories)) {\n const localPath = this.resolveRepoDir(decl, slug);\n if (!localPath || !existsSync(localPath)) continue;\n const commit = getRepoCommit(localPath) ?? \"0\".repeat(40);\n clones.push({\n localPath,\n sourceUrl: decl.url ?? localPath,\n commit,\n tag: decl.branch,\n });\n }\n return clones;\n }\n\n /**\n * Bridge a resolved {@link ProvenanceCandidate} to a {@link CatalogEntry} for\n * the deploy pipeline. `source` is the absolute path to the asset's primary\n * manifest (or its directory) inside the clone; `publisher` is set to the\n * clone slug so `deployAll`'s repositories lookup resolves local-vs-remote.\n */\n private candidateToCatalogEntry(\n c: ProvenanceCandidate,\n repositories: Record<string, SourceDeclaration>,\n ): CatalogEntry | null {\n // Find the clone slug whose declaration URL matches the candidate's source.\n let slug: string | undefined;\n let cloneDir: string | undefined;\n for (const [s, decl] of Object.entries(repositories)) {\n if (decl.url === c.sourceUrl) {\n slug = s;\n cloneDir = this.resolveRepoDir(decl, s) ?? undefined;\n break;\n }\n }\n if (!cloneDir) {\n // Store-resolved or unknown source — fall back to the first source clone.\n const first = Object.entries(repositories)[0];\n if (first) {\n slug = first[0];\n cloneDir = this.resolveRepoDir(first[1], first[0]) ?? undefined;\n }\n }\n if (!cloneDir || !slug) return null;\n\n const MD_BY_KIND: Record<string, string> = {\n skill: \"SKILL.md\",\n agent: \"AGENT.md\",\n bundle: \"BUNDLE.md\",\n \"mcp-server\": \"MCP.md\",\n connector: \"CONNECTOR.md\",\n prompt: \"PROMPT.md\",\n contract: \"CONTRACT.md\",\n };\n const mdName = MD_BY_KIND[c.kind];\n const mdRel = c.files.find((f) => (mdName ? f.path.endsWith(mdName) : false))?.path;\n const source = mdRel ? join(cloneDir, mdRel) : cloneDir;\n\n const entry: CatalogEntry = {\n name: c.name,\n kind: c.kind as CatalogEntry[\"kind\"],\n description: c.description ?? \"\",\n source,\n publisher: slug,\n version: c.version,\n requires: [],\n // Manifest-declared deps are authoritative for the candidate's deps.\n dependencies: c.deps ?? [],\n metadata: c.metadata,\n };\n if (c.category != null) entry.category = c.category;\n if (c.keywords && c.keywords.length > 0) entry.keywords = c.keywords;\n if (c.license != null) entry.license = c.license;\n if (c.homepage != null) entry.homepage = c.homepage;\n return entry;\n }\n\n // ── Install / resolve ──────────────────────────────────────────────────\n\n /**\n * Install all dependencies declared in `skaile.yaml`.\n *\n * Steps: clone/pull repositories → resolve transitive dependencies → reconcile\n * (remove stale assets) → deploy new assets → write `skaile.lock.yaml` → record history.\n *\n * @param opts - Optional installation options.\n * @param opts.locked - When `true`, restore the exact versions recorded in the existing\n * lock file instead of resolving from source. Throws if no lock file is found.\n * @returns {@link InstallResult} summarising what was deployed, what was missing, and any collisions.\n */\n async install(opts?: { locked?: boolean }): Promise<InstallResult> {\n const { repositories, sources, stores, dependencies, overrides, patches } = this.loadConfig();\n\n if (opts?.locked) {\n return this.installLocked(repositories, patches);\n }\n\n // 1. Ensure all source clones are present/up to date.\n const cloneError = this.ensureSourceClones(repositories, sources);\n if (cloneError) return cloneError;\n\n // 2. Build the provenance index from the clones and resolve.\n const provenanceIndex = buildProvenanceIndex(this.buildClones(repositories), {\n projectDir: this.projectDir,\n });\n const { resolved, missing, overridesApplied } = await resolveAll(dependencies, {\n provenanceIndex,\n overrides,\n stores,\n storeFetcher: this.buildStoreFetcher(stores),\n projectDir: this.projectDir,\n });\n\n // 3. Reconcile: remove stale assets (in old lock but not in new resolved set).\n const removed = this.reconcileRemovedAssets(resolved);\n\n // 4. Map candidates to catalog entries and deploy.\n const entries = resolved\n .map((c) => this.candidateToCatalogEntry(c, repositories))\n .filter((e): e is CatalogEntry => e !== null);\n const deployed = deployAll(entries, repositories, patches, this.deployOpts);\n\n // 5. Write the v2 lock file.\n writeLock(this.lockPath, buildLockFile(resolved, overridesApplied));\n\n // 6. Record history.\n this.recordInstallHistory(deployed, removed);\n\n // 7. Install npm peer deps for any mount/connector declared in skaile.yaml.\n const { npmInstalled, npmFailed } = await this.installRuntimeAssetDeps();\n\n return { deployed, removed, missing, lockWritten: true, npmInstalled, npmFailed };\n }\n\n /**\n * Ensure all source clones are present/up to date. Returns an early\n * {@link InstallResult} describing the failed source on the first error, or\n * `null` when every clone succeeds.\n */\n private ensureSourceClones(\n repositories: Record<string, SourceDeclaration>,\n sources: SourceEntry[],\n ): InstallResult | null {\n const pinBySlug = new Map(sources.map((s) => [sourceSlug(s.url), s.pin]));\n for (const [name, decl] of Object.entries(repositories)) {\n try {\n ensureRepo(decl, name, this.reposDir, {\n projectDir: this.projectDir,\n pin: pinBySlug.get(name),\n });\n } catch (err) {\n return {\n deployed: [],\n removed: [],\n missing: [`source:${name} (${err instanceof Error ? err.message : String(err)})`],\n lockWritten: false,\n };\n }\n }\n return null;\n }\n\n /**\n * Remove stale assets — those recorded in the old lock but absent from the\n * newly resolved set. Returns the list of removed refs.\n */\n private reconcileRemovedAssets(resolved: ProvenanceCandidate[]): string[] {\n const oldLock = this.tryReadLock();\n const resolvedRefs = new Set(\n resolved.map((c) => `${c.publisher}/${c.kind}:${c.name}@${c.version}`),\n );\n const removed: string[] = [];\n if (oldLock) {\n for (const ref of Object.keys(oldLock.assets)) {\n if (!resolvedRefs.has(ref)) {\n const { kind, name } = parseCanonicalLockKey(ref);\n if (kind && name) {\n removeAsset(kind, name, this.deployOpts);\n removed.push(ref);\n }\n }\n }\n }\n return removed;\n }\n\n /** Append `add`/`remove` history entries for a completed install reconcile. */\n private recordInstallHistory(deployed: string[], removed: string[]): void {\n for (const ref of deployed) {\n appendHistory(this.projectDir, {\n ref,\n action: \"add\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n for (const ref of removed) {\n appendHistory(this.projectDir, {\n ref,\n action: \"remove\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n }\n\n /** Read the lock, returning null on a legacy v1 lock instead of throwing. */\n private tryReadLock(): LockFile | null {\n try {\n return readLock(this.lockPath);\n } catch {\n return null;\n }\n }\n\n /** Build a store fetcher from the configured stores, or undefined when none. */\n private buildStoreFetcher(stores: StoreEntry[]): StoreFetcher | undefined {\n if (stores.length === 0) return undefined;\n return {\n getInstallManifest: async (storeUrl, ref) => {\n const { RemoteCatalogSource, CatalogHttpError } = await import(\n \"@skaile/workspaces/library\"\n );\n const src = new RemoteCatalogSource({ baseUrl: storeUrl });\n try {\n const m = await src.getInstallManifest(ref);\n return {\n sourceUrl: m.source.url,\n commit: m.source.commitSha,\n sha256: m.sha256,\n files: m.files,\n };\n } catch (err) {\n if (err instanceof CatalogHttpError && err.status === 404) return null;\n throw err;\n }\n },\n getCanonicalDigest: async (storeUrl, ref) => {\n const { RemoteCatalogSource } = await import(\"@skaile/workspaces/library\");\n const src = new RemoteCatalogSource({ baseUrl: storeUrl });\n return src.getCanonicalDigest(ref);\n },\n };\n }\n\n /**\n * Resolve runtime assets and install any missing npm peer deps.\n *\n * - Required deps: installed via `bun add --optional`. Failure is recorded\n * in `npmFailed` but does not throw — install() proceeds so users get a\n * useful error message rather than a hung command.\n * - Optional deps: not installed automatically (would force every consumer\n * to pull every connector's deps). Future: add a flag to opt in.\n */\n private async installRuntimeAssetDeps(): Promise<{\n npmInstalled: string[];\n npmFailed: string[];\n }> {\n const npmInstalled: string[] = [];\n const npmFailed: string[] = [];\n let runtimeAssets: Awaited<ReturnType<typeof resolveRuntimeAssets>> | null = null;\n try {\n runtimeAssets = await resolveRuntimeAssets(this.projectDir);\n } catch {\n // Non-fatal — projects with no skaile.yaml or unresolvable factory-assets\n // simply have no runtime deps to install.\n return { npmInstalled, npmFailed };\n }\n\n const required = runtimeAssets.requiredNpmDeps.required;\n if (required.length === 0) return { npmInstalled, npmFailed };\n\n const { findMissingPackages, installNpmPackages } = await import(\n \"@skaile/workspaces/connectors\"\n );\n const missing = findMissingPackages(required, this.projectDir);\n if (missing.length === 0) return { npmInstalled, npmFailed };\n\n const result = await installNpmPackages(missing, this.projectDir);\n if (result.success) {\n npmInstalled.push(...missing);\n } else {\n npmFailed.push(...missing);\n }\n return { npmInstalled, npmFailed };\n }\n\n private installLocked(\n repositories: Record<string, SourceDeclaration>,\n patches: Record<string, string>,\n ): InstallResult {\n const lock = this.tryReadLock();\n if (!lock) {\n throw new Error(\"No lock file found. Run `skaile install` first.\");\n }\n\n // Ensure every contributing source clone exists at its pinned commit. Sources\n // are keyed by URL slug; the lock's `sources[]` carries the URL + commit.\n const declBySlug = new Map(Object.entries(repositories));\n for (const src of lock.sources) {\n const slug = sourceSlug(src.url);\n const decl = declBySlug.get(slug) ?? { url: src.url };\n ensureRepo(decl, slug, this.reposDir, { projectDir: this.projectDir, pin: src.commit });\n }\n\n // Resolve a source URL to its on-disk clone for verification.\n const resolveCloneDir = (sourceUrl: string): string | null => {\n const slug = sourceSlug(sourceUrl);\n const decl = declBySlug.get(slug) ?? { url: sourceUrl };\n return this.resolveRepoDir(decl, slug);\n };\n\n // Verify integrity against the v2 lock.\n const verification = verifyLock(lock, resolveCloneDir);\n if (!verification.ok) {\n const issues = [\n ...verification.drifted.map((r) => `drifted: ${r}`),\n ...verification.missing.map((r) => `missing: ${r}`),\n ];\n throw new Error(`Lock file verification failed:\\n ${issues.join(\"\\n \")}`);\n }\n\n // Rebuild catalog entries from the lock and deploy.\n const resolved: CatalogEntry[] = [];\n for (const [ref, entry] of Object.entries(lock.assets)) {\n const { publisher, kind, name } = parseCanonicalLockKey(ref);\n if (!publisher || !kind || !name) continue;\n const slug = sourceSlug(entry.source.url);\n const cloneDir = resolveCloneDir(entry.source.url) ?? join(this.reposDir, slug);\n const mdRel =\n entry.files.find((f) => /\\.(md|yaml)$/i.test(f.path))?.path ?? entry.files[0]?.path ?? \"\";\n resolved.push({\n name,\n kind: kind as CatalogEntry[\"kind\"],\n description: \"\",\n source: mdRel ? join(cloneDir, mdRel) : cloneDir,\n publisher: slug,\n version: entry.source.commit,\n requires: [],\n dependencies: [],\n });\n // Ensure the repositories map has an entry for deployAll's local/remote check.\n if (!repositories[slug]) repositories[slug] = { url: entry.source.url, path: cloneDir };\n }\n\n const deployed = deployAll(resolved, repositories, patches, this.deployOpts);\n return { deployed, removed: [], missing: [], lockWritten: false };\n }\n\n /**\n * Add a single asset (and its transitive dependencies) to the workspace.\n *\n * Resolves `ref`, deploys the asset and all requirements, then records the ref\n * in `skaile.yaml` `dependencies` so subsequent `skaile install` runs re-deploy it.\n *\n * @param ref - Asset ref in `kind:name` or `repo/kind:name` form (e.g. `skill:my-skill`).\n * @returns Array of asset refs that were deployed in this call.\n * @throws When the asset cannot be found in any configured repository.\n */\n async add(ref: string): Promise<string[]> {\n const { repositories, stores, overrides, patches } = this.loadConfig();\n const parsed = parseAssetRef(ref);\n\n // Ensure clones.\n for (const [name, decl] of Object.entries(repositories)) {\n try {\n ensureRepo(decl, name, this.reposDir, { projectDir: this.projectDir });\n } catch {}\n }\n\n const provenanceIndex = buildProvenanceIndex(this.buildClones(repositories), {\n projectDir: this.projectDir,\n });\n const { resolved, missing } = await resolveAll([ref], {\n provenanceIndex,\n overrides,\n stores,\n storeFetcher: this.buildStoreFetcher(stores),\n projectDir: this.projectDir,\n });\n if (resolved.length === 0) {\n throw new Error(\n `Asset not found: ${ref}${missing.length ? ` (missing: ${missing.join(\", \")})` : \"\"}`,\n );\n }\n\n const entries = resolved\n .map((c) => this.candidateToCatalogEntry(c, repositories))\n .filter((e): e is CatalogEntry => e !== null);\n const deployed = deployAll(entries, repositories, patches, this.deployOpts);\n\n // Add to skaile.yaml dependencies (canonical ref string).\n this.addDependencyToConfig(ref);\n\n for (const d of deployed) {\n appendHistory(this.projectDir, {\n ref: d,\n action: \"add\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n\n return deployed;\n }\n\n /**\n * Remove a deployed asset and unregister it from `skaile.yaml`.\n *\n * @param ref - Asset ref in `kind:name` form (e.g. `skill:my-skill`).\n * @returns `true` if the asset was found and removed, `false` if it was not deployed.\n */\n remove(ref: string): boolean {\n const parsed = parseAssetRef(ref);\n const ok = removeAsset(parsed.kind, parsed.name, this.deployOpts);\n if (ok) {\n const depRef = `${parsed.kind}:${parsed.name}`;\n this.removeDependencyFromConfig(depRef);\n\n appendHistory(this.projectDir, {\n ref: depRef,\n action: \"remove\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n return ok;\n }\n\n // ── Query ──────────────────────────────────────────────────────────────\n\n /**\n * Search the catalog across all configured repositories.\n *\n * @param query - Substring to match against entry names and descriptions (case-insensitive).\n * Omit to return all entries.\n * @param kind - Filter by asset kind (`\"skill\"`, `\"agent\"`, `\"prompt\"`, `\"flow\"`, `\"contract\"`).\n * Omit to return all kinds.\n * @returns Array of matching {@link CatalogEntry} objects from all accessible repositories.\n */\n search(query?: string, kind?: string): CatalogEntry[] {\n const { repositories } = this.loadConfig();\n let all: CatalogEntry[] = [];\n\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = this.resolveRepoDir(decl, name);\n if (!repoDir) continue;\n all = [...all, ...scanRepo(repoDir, name)];\n }\n\n if (kind) all = all.filter((e) => e.kind === kind);\n if (query) {\n const q = query.toLowerCase();\n all = all.filter(\n (e) => e.name.toLowerCase().includes(q) || e.description.toLowerCase().includes(q),\n );\n }\n return all;\n }\n\n /**\n * Look up a single asset's full catalog entry.\n *\n * @param ref - Asset ref in `kind:name` or `repo/kind:name` form.\n * @returns The matching {@link CatalogEntry}, or `null` when not found.\n */\n info(ref: string): CatalogEntry | null {\n const { repositories } = this.loadConfig();\n const parsed = parseAssetRef(ref);\n\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = this.resolveRepoDir(decl, name);\n if (!repoDir) continue;\n // Match on the entry's scanned (manifest) publisher, not the repo map key\n // (= URL slug). The two are unrelated identities under canonical schema.\n const entries = scanRepo(repoDir, name);\n const match = entries.find(\n (e) =>\n e.kind === parsed.kind &&\n e.name === parsed.name &&\n (!parsed.publisher || e.publisher === parsed.publisher),\n );\n if (match) return match;\n }\n return null;\n }\n\n /**\n * List all assets currently deployed in the workspace (or global cache).\n *\n * Scans the framework deploy directories rather than the lock file, so it\n * also returns assets that were installed manually or outside of `skaile install`.\n *\n * @param kind - Filter by asset kind. Omit to return all kinds.\n * @returns Shallow {@link CatalogEntry} objects (description and version will be empty).\n */\n listDeployed(kind?: string): CatalogEntry[] {\n // Bundles are dependency groups, not deployed as files — exclude from scan\n const kinds = (\n kind ? [kind] : [\"skill\", \"agent\", \"prompt\", \"flow\", \"contract\"]\n ) as AiComponent[];\n const result: CatalogEntry[] = [];\n const seen = new Set<string>();\n for (const k of kinds) {\n try {\n const base = deployedBase(k, this.driverTarget, this.global, this.projectDir);\n if (!existsSync(base)) continue;\n for (const item of readdirSync(base, { withFileTypes: true })) {\n // Directories and symlinks use the directory name directly (skills, omp agents, etc.)\n // Files use the stem without extension (claude-code agents → .md, codex agents → .toml,\n // prompts → .prompt.md, flows → .flow.yaml/.flow.json)\n let name: string;\n if (item.isDirectory() || item.isSymbolicLink()) {\n name = item.name;\n } else if (item.isFile()) {\n name = item.name\n .replace(/\\.prompt\\.md$/, \"\")\n .replace(/\\.flow\\.(yaml|json)$/, \"\")\n .replace(/\\.bundle\\.yaml$/, \"\")\n .replace(/\\.(md|toml|yaml|json)$/, \"\");\n } else {\n continue;\n }\n const key = `${k}:${name}`;\n if (seen.has(key)) continue;\n seen.add(key);\n result.push({\n name,\n kind: k as any,\n description: \"\",\n source: join(base, item.name),\n version: \"\",\n requires: [],\n dependencies: [],\n });\n }\n } catch {}\n }\n return result;\n }\n\n /**\n * Build an aggregated workspace overview with domain grouping and sync status.\n *\n * Combines deployed assets, lock file metadata, and live repository status\n * into a single structured result. Used by `skaile status`.\n *\n * @returns {@link OverviewResult} with entries grouped by domain and per-repo sync status.\n */\n overview(): OverviewResult {\n const { repositories } = this.loadConfig();\n const lock = this.tryReadLock();\n const deployed = this.listDeployed();\n\n const repoStatuses = this.buildRepoStatuses(repositories);\n const lockByKindName = indexLockByKindName(lock);\n\n // Build entries with publisher + sync info. Domain grouping is by publisher\n // now that the lock no longer records a project-local domain.\n const entries: OverviewEntry[] = [];\n for (const d of deployed) {\n const lockEntry = lockByKindName.get(`${d.kind}:${d.name}`);\n const publisher = lockEntry?.publisher ?? \"\";\n const version = lockEntry?.version ?? \"\";\n const slug = lockEntry ? sourceSlug(lockEntry.url) : \"\";\n const syncStatus = slug ? computeSyncStatus(repoStatuses.get(slug)) : \"unknown\";\n const domain = publisher || \"unknown\";\n entries.push({ kind: d.kind, name: d.name, domain, publisher, version, syncStatus });\n }\n\n return {\n byDomain: groupAndSortByDomain(entries),\n total: entries.length,\n repos: [...repoStatuses.values()],\n };\n }\n\n /** Collect live sync status for every configured repository, keyed by name. */\n private buildRepoStatuses(\n repositories: Record<string, SourceDeclaration>,\n ): Map<string, RepoStatusInfo> {\n const repoStatuses = new Map<string, RepoStatusInfo>();\n for (const [name, decl] of Object.entries(repositories)) {\n const status = checkRepoStatus(decl, name, this.reposDir);\n repoStatuses.set(name, {\n name,\n kind: status.kind,\n behind: status.behind,\n upToDate: status.upToDate,\n error: status.error,\n });\n }\n return repoStatuses;\n }\n\n /**\n * Build the resolved dependency tree from the lock file.\n *\n * @returns Root {@link DependencyNode} with `ref === \"project\"` whose children\n * are the directly-declared dependencies, each with their own transitive subtrees.\n * Returns a single node with `ref === \"(no lock file)\"` when no lock exists.\n */\n tree(): DependencyNode {\n const lock = this.tryReadLock();\n if (!lock) return { ref: \"(no lock file)\", children: [] };\n\n // v2 lock no longer records per-asset parent provenance — every locked asset\n // is shown as a direct child of the project (flat tree).\n return {\n ref: \"project\",\n children: Object.keys(lock.assets).map((ref) => ({ ref, children: [] })),\n };\n }\n\n /**\n * Explain why an asset is installed by tracing its dependency chain in the lock file.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Chain of refs from the asset back to `\"direct (skaile.yaml)\"`, or `[]` when\n * the asset is not in the lock file.\n */\n why(ref: string): string[] {\n const lock = this.tryReadLock();\n if (!lock) return [];\n if (!lock.assets[ref]) return []; // not in lock file\n // v2 lock no longer records a dep chain — every locked asset is reported as\n // directly declared. (Transitive provenance reconstruction is out of scope.)\n return [ref, \"direct (skaile.yaml)\"];\n }\n\n /**\n * List installed assets whose source repository is behind the remote.\n *\n * Only remote repositories (not local paths) are checked for staleness.\n *\n * @returns Array of {@link OutdatedEntry} objects, one per asset in a repository\n * that has commits not yet pulled locally.\n */\n outdated(): OutdatedEntry[] {\n const { repositories } = this.loadConfig();\n const lock = this.tryReadLock();\n if (!lock) return [];\n\n const result: OutdatedEntry[] = [];\n for (const src of lock.sources) {\n const slug = sourceSlug(src.url);\n const decl = repositories[slug];\n if (!decl || decl.path) continue; // skip unknown / local sources\n const status = checkRepoStatus(decl, slug, this.reposDir);\n if (status.behind <= 0) continue;\n for (const [ref, entry] of Object.entries(lock.assets)) {\n if (entry.source.url !== src.url) continue;\n const { publisher, kind, name, version } = parseCanonicalLockKey(ref);\n if (!kind || !name) continue;\n result.push({\n kind,\n name,\n publisher: publisher ?? slug,\n currentVersion: version ?? \"\",\n behind: status.behind,\n });\n }\n }\n return result;\n }\n\n /**\n * Produce a unified diff between the deployed asset and its catalog source.\n *\n * Useful for detecting manual edits to deployed files or verifying that a patch\n * was applied correctly.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Unified diff string, or `null` when there are no differences or the\n * asset is not deployed/resolvable.\n */\n diff(ref: string): string | null {\n const parsed = parseAssetRef(ref);\n const entry = this.info(ref);\n if (!entry) return null;\n\n const deployedPath = join(\n deployedBase(parsed.kind as AiComponent, this.driverTarget, this.global, this.projectDir),\n parsed.name,\n );\n if (!existsSync(deployedPath) || !existsSync(entry.source)) return null;\n\n const r = spawnSync(\"diff\", [\"-ruN\", entry.source, deployedPath], { encoding: \"utf8\" });\n return r.status === 1 ? r.stdout : null;\n }\n\n // ── Lock ───────────────────────────────────────────────────────────────\n\n /**\n * Resolve all declared dependencies and write (or overwrite) `skaile.lock.yaml`.\n *\n * Performs repository sync and full dependency resolution without deploying assets.\n * Use this to regenerate the lock file after manually editing `skaile.yaml`.\n *\n * @returns The written {@link LockFile} data.\n */\n async lock(): Promise<LockFile> {\n const { repositories, stores, dependencies, overrides } = this.loadConfig();\n\n for (const [name, decl] of Object.entries(repositories)) {\n try {\n ensureRepo(decl, name, this.reposDir, { projectDir: this.projectDir });\n } catch {}\n }\n\n const provenanceIndex = buildProvenanceIndex(this.buildClones(repositories), {\n projectDir: this.projectDir,\n });\n const { resolved, overridesApplied } = await resolveAll(dependencies, {\n provenanceIndex,\n overrides,\n stores,\n storeFetcher: this.buildStoreFetcher(stores),\n projectDir: this.projectDir,\n });\n const lockData = buildLockFile(resolved, overridesApplied);\n writeLock(this.lockPath, lockData);\n return lockData;\n }\n\n // ── Patch workflow ─────────────────────────────────────────────────────\n\n /**\n * Extract a deployed asset into a patch working directory for editing.\n *\n * Copies the deployed asset to `.skaile/patches/<kind>-<name>/` so changes\n * can be made there and then committed as a patch file via `patchCommit`.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Absolute path to the patch working directory.\n * @throws When the asset cannot be found in the catalog.\n */\n patch(ref: string): string {\n const entry = this.info(ref);\n if (!entry) throw new Error(`Asset not found: ${ref}`);\n return extractForPatch(entry, this.patchDir);\n }\n\n /**\n * Generate a `.patch` file from changes made in the patch working directory.\n *\n * Diffs the patch working directory against the original catalog source and\n * writes the result to `.skaile/patches/<kind>-<name>.patch`.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Absolute path to the generated `.patch` file.\n * @throws When the patch working directory does not exist or no differences are found.\n */\n patchCommit(ref: string): string {\n const parsed = parseAssetRef(ref);\n const entry = this.info(ref);\n if (!entry) throw new Error(`Asset not found: ${ref}`);\n\n const patchedDir = join(this.patchDir, `${parsed.kind}-${parsed.name}`);\n if (!existsSync(patchedDir)) {\n throw new Error(`No patch working dir found. Run \\`skaile patch ${ref}\\` first.`);\n }\n\n const originalDir = dirname(entry.source);\n const content = generatePatch(originalDir, patchedDir);\n if (!content) throw new Error(\"No differences found.\");\n\n const patchFile = join(this.patchDir, `${parsed.kind}-${parsed.name}.patch`);\n savePatch(patchFile, content);\n return patchFile;\n }\n\n /**\n * Apply the committed patch file to the repository clone and open a contribution branch.\n *\n * Applies `.skaile/patches/<kind>-<name>.patch` to the repository clone, creates a\n * `patch/<kind>-<name>` branch, and stages a commit — ready to push via `contribPush`.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @throws When the asset is not found, has no repository, or the patch file is missing.\n */\n patchSubmit(ref: string): void {\n const parsed = parseAssetRef(ref);\n const entry = this.info(ref);\n if (!entry?.publisher) throw new Error(`Asset not found or no publisher: ${ref}`);\n\n const { repositories } = this.loadConfig();\n const decl = repositories[entry.publisher];\n if (!decl?.url) throw new Error(\"Can only submit patches for remote sources.\");\n\n // Resolve through the same helper search/info use so patch + read agree on the clone dir.\n const repoDir = this.resolveRepoDir(decl, entry.publisher);\n if (!repoDir) throw new Error(`Repository clone not found for ${entry.publisher}.`);\n const branchName = `patch/${parsed.kind}-${parsed.name}`;\n\n // Apply patch to repo clone\n const patchFile = join(this.patchDir, `${parsed.kind}-${parsed.name}.patch`);\n if (!existsSync(patchFile)) throw new Error(\"No patch file. Run `skaile patch-commit` first.\");\n\n coreApplyPatch(repoDir, patchFile);\n commitChanges(repoDir, `fix: improve ${parsed.kind} ${parsed.name}`, branchName);\n }\n\n /**\n * Delete the patch working directory and patch file for an asset.\n *\n * @param ref - Asset ref in `kind:name` form.\n */\n patchRemove(ref: string): void {\n const parsed = parseAssetRef(ref);\n const patchFile = join(this.patchDir, `${parsed.kind}-${parsed.name}.patch`);\n const patchedDir = join(this.patchDir, `${parsed.kind}-${parsed.name}`);\n try {\n rmSync(patchFile);\n } catch {}\n try {\n rmSync(patchedDir, { recursive: true });\n } catch {}\n }\n\n // ── Doctor ─────────────────────────────────────────────────────────────\n\n /**\n * Scan deployed assets for unsatisfied transitive dependencies.\n *\n * For each deployed asset, checks that all entries in its `requires` list are\n * also deployed. Returns a list of issues with a flag indicating whether the\n * missing dependency can be resolved from a configured repository.\n *\n * @returns Array of {@link DepIssue} objects. An empty array means the workspace is healthy.\n */\n doctor(): DepIssue[] {\n const { repositories } = this.loadConfig();\n const deployed = this.listDeployed();\n const issues: DepIssue[] = [];\n\n for (const entry of deployed) {\n const full = this.info(`${entry.kind}:${entry.name}`);\n if (!full) continue;\n for (const req of full.requires) {\n if (\n !isDeployed(\n req.kind as AiComponent,\n req.name,\n this.driverTarget,\n this.global,\n this.projectDir,\n )\n ) {\n const inRepos =\n resolveAsset({ kind: req.kind, name: req.name }, repositories, this.reposDir) !== null;\n issues.push({\n assetKind: entry.kind,\n assetName: entry.name,\n depKind: req.kind,\n depName: req.name,\n inRepos,\n });\n }\n }\n }\n return issues;\n }\n\n // ── Scaffold ───────────────────────────────────────────────────────────\n\n /**\n * Create a minimal asset scaffold directory (delegates to {@link createScaffold}).\n *\n * @param name - Asset name (also used as the directory name).\n * @param kind - Asset kind: `skill` | `agent` | `bundle` | `flow` | `prompt` | `contract`.\n * @param destDir - Parent directory to create the asset in.\n * @returns `{ ok: true, path }` on success, `{ ok: false, path: errorMessage }` if the\n * directory already exists.\n */\n create(name: string, kind: string, destDir: string): { ok: boolean; path: string } {\n return createScaffold(name, kind, destDir);\n }\n\n // ── Contrib (REMOVED 2026-05-12) ───────────────────────────────────────\n //\n // The `contribChanges / contribDiff / contribCommit / contribPush /\n // contribCompare` methods were retired alongside `skaile repo contrib *`.\n // The refinement push-back workflow is being re-introduced in Phase 4 as\n // `skaile publish` + `skaile preset push` against the Library Source model.\n\n // ── History ────────────────────────────────────────────────────────────\n\n /**\n * Return recent asset action history entries, newest first.\n *\n * @param limit - Maximum number of entries to return. Defaults to `20`.\n * @returns Array of {@link HistoryEntry} objects in reverse-chronological order.\n */\n history(limit = 20): HistoryEntry[] {\n return getRecentHistory(this.projectDir, limit);\n }\n\n /**\n * Erase all asset action history for this workspace.\n */\n clearHistory(): void {\n clearHistory(this.projectDir);\n }\n\n // ── Clean ───────────────────────────────────────────────────────────────\n\n /**\n * Remove deployed assets tracked by the lock file and report unmanaged ones.\n *\n * With `opts.all`, also deletes `.skaile/history.yaml`, `.skaile/patches/`,\n * `.skaile/repos/`, and `skaile.lock.yaml` — effectively resetting the workspace\n * to a pre-install state.\n *\n * @param opts - Optional cleanup options.\n * @param opts.all - When `true`, remove all Skaile-managed state in addition to deployed assets.\n * @returns Object with `removed` (successfully cleaned refs), `skipped` (with reasons),\n * and `unmanaged` (deployed assets not in the lock file).\n */\n clean(opts?: { all?: boolean }): {\n removed: string[];\n skipped: Array<{ ref: string; reason: string }>;\n unmanaged: string[];\n } {\n const lock = this.tryReadLock();\n const skipped: Array<{ ref: string; reason: string }> = [];\n\n const removed = this.cleanLockedDeployedAssets(lock);\n const unmanaged = this.collectUnmanagedAssets(lock);\n\n if (opts?.all) this.removeAllManagedState();\n\n return { removed, skipped, unmanaged };\n }\n\n /**\n * Remove the deployed dir of every asset tracked by the lock; missing dirs\n * still count as removed. Returns the list of cleaned refs.\n */\n private cleanLockedDeployedAssets(lock: LockFile | null): string[] {\n const removed: string[] = [];\n if (!lock) return removed;\n for (const ref of Object.keys(lock.assets)) {\n const { kind, name } = parseCanonicalLockKey(ref);\n if (!kind || !name) continue;\n const dest = deployedDir(\n kind as AiComponent,\n name,\n this.driverTarget,\n this.global,\n this.projectDir,\n );\n\n try {\n const stat = lstatSync(dest);\n if (stat.isSymbolicLink()) unlinkSync(dest);\n else rmSync(dest, { recursive: true, force: true });\n removed.push(ref);\n } catch {\n // Already gone — count as removed\n removed.push(ref);\n }\n }\n return removed;\n }\n\n /**\n * Report deployed assets not tracked by the lock file. Deployed assets are\n * keyed by <kind>:<name>; lock canonical refs are mapped to that shape.\n */\n private collectUnmanagedAssets(lock: LockFile | null): string[] {\n const lockRefs = lock\n ? new Set(\n Object.keys(lock.assets).map((r) => {\n const p = parseCanonicalLockKey(r);\n return p.kind && p.name ? `${p.kind}:${p.name}` : r;\n }),\n )\n : new Set<string>();\n const unmanaged: string[] = [];\n const allDeployed = this.listDeployed();\n for (const d of allDeployed) {\n const ref = `${d.kind}:${d.name}`;\n if (!lockRefs.has(ref)) {\n unmanaged.push(ref);\n }\n }\n return unmanaged;\n }\n\n /** Delete all Skaile-managed state: history file, patches/, repos/, lock. */\n private removeAllManagedState(): void {\n // Delete history file\n const historyFile = join(this.projectDir, \".skaile\", \"history.yaml\");\n try {\n unlinkSync(historyFile);\n } catch {}\n\n // Remove patches dir\n try {\n rmSync(this.patchDir, { recursive: true, force: true });\n } catch {}\n\n // Remove repos dir\n try {\n rmSync(this.reposDir, { recursive: true, force: true });\n } catch {}\n\n // Remove lock file\n try {\n unlinkSync(this.lockPath);\n } catch {}\n }\n\n // ── Helpers ────────────────────────────────────────────────────────────\n\n /** Add a dependency ref to skaile.yaml if not already present. */\n private addDependencyToConfig(ref: string): void {\n if (this.global) return; // global installs don't modify skaile.yaml\n const configPath = join(this.projectDir, \"skaile.yaml\");\n if (!existsSync(configPath)) return;\n const raw = parseYaml(readFileSync(configPath, \"utf8\")) ?? {};\n if (!raw.dependencies) raw.dependencies = [];\n if (!raw.dependencies.includes(ref)) {\n raw.dependencies.push(ref);\n writeFileSync(configPath, stringifyYaml(raw, { lineWidth: 120 }));\n }\n }\n\n /** Remove a dependency ref from skaile.yaml. */\n private removeDependencyFromConfig(ref: string): void {\n if (this.global) return;\n const configPath = join(this.projectDir, \"skaile.yaml\");\n if (!existsSync(configPath)) return;\n const raw = parseYaml(readFileSync(configPath, \"utf8\")) ?? {};\n if (!raw.dependencies) return;\n const idx = raw.dependencies.indexOf(ref);\n if (idx !== -1) {\n raw.dependencies.splice(idx, 1);\n writeFileSync(configPath, stringifyYaml(raw, { lineWidth: 120 }));\n }\n }\n\n private resolveRepoDir(decl: SourceDeclaration, name: string): string | null {\n // Check links first\n const links = readLinks(this.projectDir);\n if (links[name]) {\n return existsSync(links[name]) ? links[name] : null;\n }\n\n if (decl.path) {\n const resolved = resolve(this.projectDir, decl.path);\n return existsSync(resolved) ? resolved : null;\n }\n\n // Check project-local symlink, then global cache\n const dest = join(this.reposDir, name);\n if (existsSync(dest)) return dest;\n\n const globalDest = join(getGlobalCacheDir(), name);\n if (existsSync(join(globalDest, \".git\"))) return globalDest;\n\n return null;\n }\n}\n\n// ── Agent install (renders GitAgent packages to framework-native files) ──\n\nexport { installAgent } from \"./install-agent.js\";\n\n// ── Renderers ─────────────────────────────────────────────────────────────\n\nexport type { AgentRenderer, AgentRenderInput, AgentRenderResult } from \"./renderers.js\";\nexport {\n AGENT_RENDERERS,\n claudeCodeRenderer,\n codexRenderer,\n driverTargetSupportsAgents,\n ompRenderer,\n} from \"./renderers.js\";\n\n// ── Fragments ─────────────────────────────────────────────────────────────\n\nexport type {\n AbilityRef,\n ConnectorRef,\n ContractRef,\n FragmentContext,\n FragmentId,\n} from \"./fragments.js\";\nexport { BUILT_IN_FRAGMENTS, loadPromptExtensions, resolveFragments } from \"./fragments.js\";\n"]}
|
|
@@ -157,5 +157,5 @@ function repositoryToRaw(r) {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
export { ASSET_KINDS, ASSET_NAME_HINT, INDIVIDUAL_KINDS, assetRefToDep, assetRefToStr, depToStr, entryFromRaw, entryToRaw, isValidAssetName, parseAssetRef, parseDep, repositoryFromRaw, repositoryToRaw };
|
|
160
|
-
//# sourceMappingURL=chunk-
|
|
161
|
-
//# sourceMappingURL=chunk-
|
|
160
|
+
//# sourceMappingURL=chunk-BM7XANVN.js.map
|
|
161
|
+
//# sourceMappingURL=chunk-BM7XANVN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../core/src/models.ts"],"names":[],"mappings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A,CAAA,EAAI,GAAA,CAAI,GAAG,CAAA,CAAA,GAAK,EAAE,CAAA,CAAA;AAC5D;AASO,SAAS,cAAc,GAAA,EAA2B;AAEvD,EAAA,OAAO,EAAE,IAAA,EAAM,GAAA,CAAI,IAAA,EAAM,IAAA,EAAM,IAAI,IAAA,EAAK;AAC1C;AAgKO,SAAS,kBAAkB,CAAA,EAAwC;AACxE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA,CAAO,CAAA,CAAE,IAAA,IAAQ,EAAE,CAAA;AAAA,IACzB,IAAA,EAAM,MAAA,CAAO,CAAA,CAAE,IAAA,IAAQ,OAAO,CAAA;AAAA,IAC9B,IAAA,EAAM,MAAA,CAAO,CAAA,CAAE,IAAA,IAAQ,EAAE,CAAA;AAAA,IACzB,MAAA,EAAQ,MAAA,CAAO,CAAA,CAAE,MAAA,IAAU,MAAM,CAAA;AAAA,IACjC,UAAU,CAAA,CAAE,QAAA,IAAY,OAAO,MAAA,CAAO,CAAA,CAAE,QAAQ,CAAA,GAAI;AAAA,GACtD;AACF;AAUO,SAAS,gBAAgB,CAAA,EAAwC;AACtE,EAAA,MAAM,CAAA,GAA6B;AAAA,IACjC,MAAM,CAAA,CAAE,IAAA;AAAA,IACR,MAAM,CAAA,CAAE,IAAA;AAAA,IACR,MAAM,CAAA,CAAE;AAAA,GACV;AACA,EAAA,IAAI,CAAA,CAAE,MAAA,KAAW,MAAA,EAAQ,CAAA,CAAE,SAAS,CAAA,CAAE,MAAA;AACtC,EAAA,IAAI,CAAA,CAAE,QAAA,IAAY,IAAA,EAAM,CAAA,CAAE,WAAW,CAAA,CAAE,QAAA;AACvC,EAAA,OAAO,CAAA;AACT","file":"chunk-BM7XANVN.js","sourcesContent":["/**\n * Pure data models — no I/O, no side effects.\n */\n\nimport semver from \"semver\";\n\n/**\n * Discriminator for catalog entries and asset references.\n * Used in asset ref strings (e.g. `'skill:my-skill'`, `'agent:my-agent'`).\n * @docLink packages/core/concepts#asset-kind\n */\nexport type AssetKind =\n | \"skill\"\n | \"agent\"\n | \"prompt\"\n | \"bundle\"\n | \"flow\"\n | \"contract\"\n | \"mcp-server\"\n | \"persona\" // identity fragment — replaces SOUL.md in composition\n | \"ruleset\" // behavioral constraints — replaces RULES.md in composition\n | \"knowledge\" // knowledge bundle directory\n | \"connector\"; // connector descriptor (CONNECTOR.md)\n\n/**\n * All valid AssetKind values as a readonly array.\n * @docLink packages/core/concepts#asset-kinds\n */\nexport const ASSET_KINDS: readonly AssetKind[] = [\n \"skill\",\n \"agent\",\n \"prompt\",\n \"bundle\",\n \"flow\",\n \"contract\",\n \"mcp-server\",\n \"persona\",\n \"ruleset\",\n \"knowledge\",\n \"connector\",\n];\n/**\n * Asset kinds that represent individually installable assets (excludes \"bundle\").\n * Note: persona, ruleset, and knowledge are valid AssetKind values but are not\n * individually installable — they are resolved at session creation time via the\n * mixin-resolver, not through the install/deploy pipeline.\n * @docLink packages/core/concepts#individual-kinds\n */\nexport const INDIVIDUAL_KINDS = [\n \"skill\",\n \"agent\",\n \"prompt\",\n \"flow\",\n \"contract\",\n \"mcp-server\",\n] as const satisfies AssetKind[];\n\n// ── Dependency ────────────────────────────────────────────────────────────────\n\n/**\n * Declared dependency on another catalog asset.\n * @docLink packages/core/concepts#dependency\n */\nexport interface Dependency {\n /** Asset kind (e.g. \"skill\", \"agent\", \"contract\"). */\n kind: string;\n /** Asset name within that kind. */\n name: string;\n /** Canonical publisher namespace (when known). */\n publisher?: string;\n}\n\n/**\n * Parse a `\"kind:name\"` dependency string, or a bare `\"name\"` (defaults kind to `\"skill\"`).\n *\n * @param s - Dependency string, e.g. `\"skill:use-exa\"` or `\"use-exa\"`\n * @returns Parsed `{ kind, name }` dependency object\n * @docLink packages/core/concepts#parse-dep\n */\nexport function parseDep(s: string): Dependency {\n const i = s.indexOf(\":\");\n if (i !== -1) {\n const kind = s.slice(0, i).trim();\n const name = s.slice(i + 1).trim();\n return { kind, name };\n }\n return { kind: \"skill\", name: s.trim() };\n}\n\n/**\n * Serialize a Dependency back to its `\"kind:name\"` string form.\n *\n * @param d - Dependency to serialize\n * @returns String in `\"kind:name\"` format\n * @docLink packages/core/concepts#dep-to-str\n */\nexport function depToStr(d: Dependency): string {\n return `${d.kind}:${d.name}`;\n}\n\n// ── CatalogEntry ──────────────────────────────────────────────────────────────\n\n/**\n * A resolved catalog entry describing an installable asset.\n * Produced by manifest parsers and stored in the catalog YAML.\n * @docLink packages/core/concepts#catalog-entry\n */\nexport interface CatalogEntry {\n /** Unique asset name within its kind. */\n name: string;\n /** Asset kind discriminator. */\n kind: AssetKind;\n /** Short description of what this asset does. */\n description: string;\n /** Absolute path to manifest file */\n source: string;\n /** Canonical publisher namespace this asset belongs to (formerly `repository`). */\n publisher?: string;\n /**\n * `\"<org>/<repo>\"` coordinate the asset came from. Absent → the asset groups\n * directly under its publisher (local library with no git remote, or a\n * non-GitHub source). Replaces the former derived `domain` axis.\n */\n repo?: string;\n /**\n * Navigational domain slug (from a sidecar `DOMAIN.md`), or absent when no\n * domain claims this asset. Display-only — groups assets under their publisher\n * in the manage TUI; never part of identity or the install layout.\n */\n domainSlug?: string;\n /** Semantic version string (may be empty if not declared in the manifest). */\n version: string;\n /** Skills, agents, or other assets this entry depends on. */\n requires: Dependency[];\n /** Bundle dependencies — asset refs to install (bundles only). */\n dependencies: string[];\n /**\n * Kind-specific metadata extracted from the manifest frontmatter.\n * Used by MCP servers to carry default config (transport, command, args, env, url, headers)\n * so that `mcp:name` dependency refs resolve to a runnable declaration without\n * requiring verbose inline config in `skaile.yaml`.\n */\n metadata?: Record<string, unknown>;\n /** Curated facet, surfaced as a badge in the manage TUI (not a tree axis). */\n category?: string;\n /** Store-listing keywords (manifest `assets[].keywords`, else frontmatter). */\n keywords?: string[];\n /** Store-listing license (manifest `assets[].license`, else repo-level default). */\n license?: string;\n /** Store-listing homepage (manifest `assets[].homepage`, else repo-level default). */\n homepage?: string;\n}\n\n/**\n * How the members of a domain relate — drives display affordances only, never\n * install behaviour. Single canonical spelling shared with the store\n * (`DomainRelation` enum) and forge contract.\n */\nexport type DomainRelation = \"additions\" | \"alternatives\" | \"sequence\";\n\n/**\n * Display-only metadata for a navigational domain (from a sidecar `DOMAIN.md`,\n * surfaced by the store's `catalog.listDomains`). Keyed by {@link CatalogEntry.domainSlug}.\n * A domain groups assets under their publisher for co-discovery; it is never\n * part of asset identity and never bulk-installs.\n */\nexport interface CatalogDomain {\n /** Stable slug — the join key to {@link CatalogEntry.domainSlug}. */\n slug: string;\n /** Human-readable title (may change without breaking the slug join). */\n title: string;\n /** Free-text description from the `DOMAIN.md` body. */\n description?: string;\n /** How members relate — drives sort + per-asset glyph, not installs. */\n relation?: DomainRelation;\n /** Display order among a publisher's domains (ascending). */\n order?: number;\n /** `kind:name` ref of the recommended member (alternatives domains). */\n recommendedRef?: string;\n /** Sidecar provenance — `\"<org>/<repo>\"` the `DOMAIN.md` was authored in. */\n sidecarSource?: string;\n}\n\n/**\n * Construct a CatalogEntry from a raw deserialized record (e.g. from catalog.yaml).\n *\n * @param d - Raw object with loosely typed fields\n * @returns Normalized CatalogEntry\n * @docLink packages/core/concepts#entry-from-raw\n */\nexport function entryFromRaw(d: Record<string, unknown>): CatalogEntry {\n const rawDeps = d.dependencies;\n const deps = Array.isArray(rawDeps) ? (rawDeps as string[]).filter(Boolean) : [];\n const entry: CatalogEntry = {\n name: String(d.name ?? \"\"),\n kind: String(d.kind ?? \"skill\") as AssetKind,\n description: String(d.description ?? \"\"),\n source: String(d.source ?? \"\"),\n publisher: d.publisher != null ? String(d.publisher) : undefined,\n // Read `repo`, falling back to the legacy `domain` key so a stale\n // catalog.yaml cache written before this release still groups sanely.\n // The cache self-heals on next write (entryToRaw stops writing `domain`).\n repo: d.repo != null ? String(d.repo) : d.domain != null ? String(d.domain) : undefined,\n domainSlug: d.domainSlug != null ? String(d.domainSlug) : undefined,\n version: String(d.version ?? \"\"),\n requires: Array.isArray(d.requires)\n ? (d.requires as string[]).filter(Boolean).map(parseDep)\n : [],\n dependencies: deps,\n };\n if (d.metadata != null && typeof d.metadata === \"object\" && !Array.isArray(d.metadata)) {\n entry.metadata = d.metadata as Record<string, unknown>;\n }\n if (d.category != null) entry.category = String(d.category);\n if (Array.isArray(d.keywords)) {\n entry.keywords = (d.keywords as unknown[]).filter((k): k is string => typeof k === \"string\");\n }\n if (d.license != null) entry.license = String(d.license);\n if (d.homepage != null) entry.homepage = String(d.homepage);\n return entry;\n}\n\n/**\n * Serialize a CatalogEntry to a plain record suitable for YAML/JSON persistence.\n *\n * @param e - CatalogEntry to serialize\n * @returns Plain object with string-serialized requires and dependencies\n * @docLink packages/core/concepts#entry-to-raw\n */\nexport function entryToRaw(e: CatalogEntry): Record<string, unknown> {\n const raw: Record<string, unknown> = {\n name: e.name,\n kind: e.kind,\n description: e.description,\n source: e.source,\n publisher: e.publisher,\n repo: e.repo,\n version: e.version,\n ...(e.domainSlug != null ? { domainSlug: e.domainSlug } : {}),\n requires: e.requires.map(depToStr),\n dependencies: e.dependencies,\n };\n if (e.metadata) raw.metadata = e.metadata;\n if (e.category != null) raw.category = e.category;\n if (e.keywords && e.keywords.length > 0) raw.keywords = e.keywords;\n if (e.license != null) raw.license = e.license;\n if (e.homepage != null) raw.homepage = e.homepage;\n return raw;\n}\n\n// ── AssetRef ─────────────────────────────────────────────────────────────────\n\n/**\n * A parsed asset reference: `kind:@<publisher>/name[#pin]`.\n *\n * `publisher` is the canonical, GitHub-shaped publisher namespace (≤39 chars,\n * alphanumeric+hyphen). `pin` is a SemVer constraint, exact SHA, or absent.\n * Floating refs (`main`, `latest`, `HEAD`) are rejected at parse time.\n *\n * Produced by `parseAssetRef`; consumed by `resolveAsset` and `resolveAll`.\n * @docLink packages/core/concepts#asset-ref\n */\nexport interface AssetRef {\n kind: string;\n name: string;\n /** Canonical publisher namespace. Optional only for ambiguity-resolution\n * during migration; new manifests require it. */\n publisher?: string;\n /** SemVer constraint (^1.4.0, ~1.4, 1.x, exact 1.4.0), 40-char SHA, or undefined. */\n pin?: string;\n}\n\nconst SHA_RE = /^[0-9a-f]{40}$/i;\n\n// Scoped grammar: `kind:@publisher/name[#version]`. The publisher sub-pattern is\n// GitHub-shaped (1-39 chars, alphanumeric + single hyphens, no leading/trailing or\n// double hyphen); `@` is the scope sigil and `#` the version sigil. `name` is\n// intentionally permissive (`[^/#\\s]+` — only the structural separators are\n// forbidden); floating-ref rejection stays in `isValidPin`, so `#main`/`#latest`\n// match here and fail there with a clear message.\nconst SCOPED_REF_RE =\n /^(?:([a-z][a-z0-9-]*):)?@([A-Za-z0-9](?:[A-Za-z0-9]|-(?!-)){0,37}[A-Za-z0-9]|[A-Za-z0-9])\\/([^/#\\s]+)(?:#(.+))?$/;\n\n// Canonical asset-name grammar: lowercase kebab-case (npm-style, scope-free) —\n// `a-z` / `0-9` segments joined by single hyphens, no leading/trailing hyphen,\n// no uppercase, spaces, dots, or underscores. Names become directory names,\n// lock keys, and CLI args, so the constraint is intentionally narrow.\nconst ASSET_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n// Diagnostic-only matcher: a ref carrying a `kind:@publisher/` scope prefix,\n// capturing whatever follows (sans `#pin`) as the candidate name. Used solely\n// to tell \"missing publisher\" apart from \"malformed name\" when the strict\n// grammar above fails (e.g. a space in the name).\nconst SCOPE_PREFIX_RE = /^(?:[a-z][a-z0-9-]*:)?@[^/\\s]+\\/([^#]+?)(?:#.*)?$/;\n\n/** Human-readable statement of the canonical asset-name rule. */\nexport const ASSET_NAME_HINT =\n 'names must be lowercase kebab-case (a-z, 0-9, single hyphens; e.g. \"cli-concept\")';\n\n/**\n * True when `name` is a canonical asset name: lowercase kebab-case, scope-free.\n *\n * This is the single source of truth for asset-name validity — `parseAssetRef`\n * enforces it, and `skaile validate` reports violations across a repo tree.\n * @docLink packages/core/concepts#is-valid-asset-name\n */\nexport function isValidAssetName(name: string): boolean {\n return ASSET_NAME_RE.test(name);\n}\n\n/** True when `pin` is a SemVer constraint, exact SemVer, or 40-char SHA. */\nfunction isValidPin(pin: string): boolean {\n if (SHA_RE.test(pin)) return true;\n if (semver.valid(pin)) return true;\n if (semver.validRange(pin)) return true;\n return false;\n}\n\n/** Throw the canonical non-canonical-pin error for a ref `s` carrying `pin`. */\nfunction rejectFloatingPin(s: string, pin: string): never {\n throw new Error(\n `non-canonical pin \"${pin}\" in \"${s}\" — pin must be a SemVer ` +\n \"constraint (1.4.0, ^1.4, ~1.4, 1.x), a 40-char SHA, or absent. \" +\n \"Floating refs (main/latest/HEAD) are not allowed.\",\n );\n}\n\n/** Throw the canonical malformed-name error for a ref `s` carrying `name`. */\nfunction rejectInvalidName(s: string, name: string): never {\n throw new Error(\n `invalid asset name \"${name}\" in ref \"${s}\" — ${ASSET_NAME_HINT}. ` +\n \"Run the `migrate-skaile-manifest` skill on legacy manifests.\",\n );\n}\n\n/**\n * Parse a canonical asset reference string into an `AssetRef` object.\n *\n * Grammar: `kind:@<publisher>/name[#version]`\n * \"skill:@skaile-ai/audit\" → { kind: \"skill\", name: \"audit\", publisher: \"skaile-ai\" }\n * \"skill:@skaile-ai/audit#^1.4.0\" → { …, pin: \"^1.4.0\" }\n * \"skill:@skaile-ai/audit#<40-sha>\" → { …, pin: \"<40-sha>\" }\n *\n * `@` is the scope sigil and `#` the version sigil. `<publisher>` is GitHub-shaped\n * (≤39 chars, alphanumeric+hyphen, no leading/trailing or double hyphen). `pin`\n * accepts a SemVer constraint (`^`, `~`, `x`, exact), a 40-char SHA, or is absent.\n * Floating refs (`main`/`latest`/`HEAD`/anything non-canonical) are parse-time errors.\n *\n * The shorthand `mcp:` is normalized to `mcp-server:`. `kind` defaults to `\"skill\"`.\n *\n * @param s - Asset reference string\n * @returns Parsed `AssetRef`\n * @throws When the ref matches no grammar, the publisher is malformed, or the pin\n * is a floating ref.\n * @docLink packages/core/concepts#parse-asset-ref\n */\nexport function parseAssetRef(s: string): AssetRef {\n const trimmed = s.trim();\n const m = SCOPED_REF_RE.exec(trimmed);\n if (m) {\n const kindRaw = m[1] ?? \"skill\";\n const kind = kindRaw === \"mcp\" ? \"mcp-server\" : kindRaw;\n const publisher = m[2];\n const name = m[3];\n const pin = m[4]?.trim() || undefined;\n if (!isValidAssetName(name)) rejectInvalidName(s, name);\n if (pin !== undefined && !isValidPin(pin)) rejectFloatingPin(s, pin);\n return { kind, name, publisher, pin };\n }\n\n // The strict grammar failed. If the ref nonetheless carries a `@publisher/`\n // scope and the fault is the name (e.g. an embedded space), surface a\n // name-specific error rather than the misleading \"publisher required\" — the\n // publisher is plainly present. A *valid* captured name means the publisher\n // itself is malformed, so fall through to the publisher error below.\n const scoped = SCOPE_PREFIX_RE.exec(trimmed);\n if (scoped) {\n const candidate = scoped[1].trim();\n if (!isValidAssetName(candidate)) rejectInvalidName(s, candidate);\n }\n\n throw new Error(\n `publisher required in asset ref \"${s}\" — use \\`kind:@<publisher>/name\\`. ` +\n \"Run the `migrate-skaile-manifest` skill on legacy manifests.\",\n );\n}\n\n/**\n * Serialize an AssetRef back to its canonical string form.\n *\n * Emits the scope form `kind:@publisher/name[#pin]` when `publisher` is present,\n * and the bare `kind:name[#pin]` form for transitive refs that inherit it.\n *\n * @param ref - AssetRef to serialize\n * @returns String in `\"kind:@publisher/name[#pin]\"` (or bare `\"kind:name[#pin]\"`) format\n * @docLink packages/core/concepts#asset-ref-to-str\n */\nexport function assetRefToStr(ref: AssetRef): string {\n const scope = ref.publisher ? `@${ref.publisher}/${ref.name}` : ref.name;\n return `${ref.kind}:${scope}${ref.pin ? `#${ref.pin}` : \"\"}`;\n}\n\n/**\n * Convert an AssetRef to a simple Dependency, dropping the repository and pin qualifiers.\n *\n * @param ref - Full asset reference (may include repository and pin)\n * @returns Dependency with only kind and name\n * @docLink packages/core/concepts#asset-ref-to-dep\n */\nexport function assetRefToDep(ref: AssetRef): Dependency {\n // Grammar-agnostic — drops publisher/pin, so the scope-sigil change doesn't touch it.\n return { kind: ref.kind, name: ref.name };\n}\n\n// ── Lock File ────────────────────────────────────────────────────────────────\n\n/** A path/sha256 pair recorded for one file inside a locked asset. */\nexport interface LockFileEntry {\n path: string;\n sha256: string;\n}\n\n/**\n * Per-asset entry in the lock file (v3 schema).\n * Keyed in `LockFile.assets` by canonical ref (`<kind>:@<publisher>/<name>#<version>`).\n * @docLink packages/core/api-reference#lock-entry\n */\nexport interface LockEntry {\n /** Composite sha256 over sorted `<path>:<sha256>\\n` rows. */\n sha256: string;\n /** Resolved upstream source + commit. */\n source: { url: string; commit: string };\n /** Files that constitute the asset. */\n files: LockFileEntry[];\n /** True when an `overrides[]` entry pinned this resolution. */\n override_applied: boolean;\n}\n\n/** Per-source-URL entry in `LockFile.sources`. */\nexport interface LockSourceEntry {\n url: string;\n commit: string;\n}\n\n/**\n * Full skaile.lock.yaml structure (v3 schema).\n * @docLink packages/core/api-reference#lock-file\n */\nexport interface LockFile {\n /** Lock file schema version. v3 is canonical. */\n schema_version: 3;\n /** ISO timestamp of when the lock was generated. */\n locked_at: string;\n /** Resolved assets keyed by canonical ref `<kind>:@<publisher>/<name>#<version>`. */\n assets: Record<string, LockEntry>;\n /** Every source URL that contributed at least one resolved asset. */\n sources: LockSourceEntry[];\n /**\n * Resolved plugin packages (from `skaile.yaml` `plugins:`), keyed by package\n * name. The plugin-store reconciler reads this slice into its reconcile-hash\n * so a lock change reinstalls even when the manifest list is unchanged.\n */\n plugins?: Record<string, LockPluginEntry>;\n}\n\n/** One pinned plugin package in the lock file's `plugins` slice. */\nexport interface LockPluginEntry {\n /** Resolved exact version (e.g. \"0.1.3\"). */\n version: string;\n /** Package integrity hash (e.g. \"sha512-...\"); may be empty until populated from bun's output. */\n integrity: string;\n}\n\n// ── AgentManifest ────────────────────────────────────────────────────────────\n\n/**\n * Agent package manifest — parsed from `agent.yaml` in an agent directory.\n * Defines the agent's identity, model preferences, capability requirements, and composition mixins.\n * @docLink packages/core/concepts#agent-manifest\n */\nexport interface AgentManifest {\n spec_version?: string;\n name?: string;\n version?: string;\n description?: string;\n model?: {\n preferred?: string;\n fallback?: string[];\n constraints?: { temperature?: number; max_tokens?: number };\n };\n tools?: {\n allowed?: string[];\n denied?: string[];\n };\n delegation?: { mode?: string };\n requires?: Array<{ name: string; source: string; version?: string; mount: string }>;\n tags?: string[];\n author?: string;\n metadata?: Record<string, unknown>;\n /**\n * @deprecated Use `persona`, `rules`, and `knowledge` mixin arrays instead.\n * This field is declared but was never resolved at runtime.\n */\n extends?: string;\n abilities?: string[];\n /**\n * Identity fragments to compose into the agent persona.\n * Each entry is a catalog ref (`persona:name@repo#pin`), a bare name\n * (defaults to kind \"persona\"), or a local path (`./my.persona.md`).\n * Resolved in order — concatenated with \\n\\n---\\n\\n separator.\n */\n persona?: string[];\n /**\n * Behavioral rule sets to compose into the agent's constraints.\n * Each entry is a catalog ref (`ruleset:name@repo#pin`), bare name,\n * or local path. All rules apply (union).\n */\n rules?: string[];\n /**\n * Knowledge bundles to compose into the agent's domain knowledge.\n * Each entry is a catalog ref (`knowledge:name@repo#pin`), bare name,\n * or local path to a knowledge directory. Loaded in declaration order.\n */\n knowledge?: string[];\n contracts?: string[];\n /**\n * v2 composition items. Each entry references an asset (skill, connector,\n * soul, ruleset, etc.) with binding semantics (discoverable, inline-live,\n * inline-snapshot). Resolved at session start via the composition module.\n */\n composes?: Array<{\n kind: string;\n ref: string;\n instance?: string;\n binding?: \"discoverable\" | \"inline-live\" | \"inline-snapshot\";\n }>;\n runtime?: {\n max_turns?: number;\n timeout?: number;\n [key: string]: unknown;\n };\n}\n\n// ── Repository ───────────────────────────────────────────────────────────────\n\ntype RepositoryKind = \"local\" | \"github\";\n\n/**\n * A registered asset repository (local path or cloned GitHub repo).\n * Stored in the catalog; consumed by `repo-manager` for cloning and scanning.\n * @docLink packages/core/concepts#repository\n */\nexport interface Repository {\n /** Logical repository name. */\n name: string;\n /** Storage kind: \"local\" for paths, \"github\" for remote URLs. */\n kind: RepositoryKind;\n /** Absolute path (local) or remote URL (github). */\n path: string;\n /** Active branch. */\n branch: string;\n /** Upstream fork URL (for fork-based workflows). */\n upstream?: string;\n}\n\n/**\n * Construct a `Repository` from a raw deserialized record.\n *\n * @param d - Raw object from YAML/JSON\n * @returns Normalized `Repository`\n * @docLink packages/core/concepts#repository-from-raw\n */\nexport function repositoryFromRaw(d: Record<string, unknown>): Repository {\n return {\n name: String(d.name ?? \"\"),\n kind: String(d.kind ?? \"local\") as RepositoryKind,\n path: String(d.path ?? \"\"),\n branch: String(d.branch ?? \"main\"),\n upstream: d.upstream != null ? String(d.upstream) : undefined,\n };\n}\n\n/**\n * Serialize a `Repository` to a plain record for YAML/JSON persistence.\n * Omits the `branch` field when it equals `\"main\"` to keep serialized output clean.\n *\n * @param r - Repository to serialize\n * @returns Plain object suitable for YAML/JSON\n * @docLink packages/core/concepts#repository-to-raw\n */\nexport function repositoryToRaw(r: Repository): Record<string, unknown> {\n const d: Record<string, unknown> = {\n name: r.name,\n kind: r.kind,\n path: r.path,\n };\n if (r.branch !== \"main\") d.branch = r.branch;\n if (r.upstream != null) d.upstream = r.upstream;\n return d;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { factoryAssetRoots } from './chunk-
|
|
1
|
+
import { factoryAssetRoots } from './chunk-5DPQ766L.js';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import path from 'path';
|
|
@@ -24,5 +24,5 @@ function aiResourceRoots() {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export { AI_RESOURCES, MONOREPO_ROOT, aiResourceRoots };
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-EOCKR5TN.js.map
|
|
28
|
+
//# sourceMappingURL=chunk-EOCKR5TN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/paths.ts"],"names":[],"mappings":";;;;;;AAMA,IAAM,WAAW,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA,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IAAA;AACV,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,CAAA,EAAA,EAAK;AAC1B,IAAA,IAAI,EAAA,CAAG,WAAW,IAAA,CAAK,IAAA,CAAK,KAAK,YAAY,CAAC,GAAG,OAAO,GAAA;AACxD,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAA;AAC/B,IAAA,IAAI,WAAW,GAAA,EAAK;AACpB,IAAA,GAAA,GAAM,MAAA;AAAA,EACR;AACA,EAAA,OAAO,IAAA;AACT;AAYO,IAAM,aAAA,GAA+B,iBAAiB,QAAQ;AAc9D,IAAM,YAAA,GACX,iBAAA,EAAkB,CAAE,CAAC,CAAA,IAAK,IAAA,CAAK,IAAA,CAAK,EAAA,CAAG,OAAA,EAAQ,EAAG,SAAA,EAAW,WAAW;AAoBnE,SAAS,eAAA,GAA4B;AAC1C,EAAA,MAAM,KAAA,GAAkB,CAAC,GAAG,iBAAA,EAAmB,CAAA;AAC/C,EAAA,KAAA,CAAM,IAAA,CAAK,KAAK,IAAA,CAAK,EAAA,CAAG,SAAQ,EAAG,SAAA,EAAW,WAAW,CAAC,CAAA;AAC1D,EAAA,OAAO,CAAC,GAAG,IAAI,GAAA,CAAI,KAAK,CAAC,CAAA,CAAE,MAAA,CAAO,CAAC,CAAA,KAAM,EAAA,CAAG,UAAA,CAAW,CAAC,CAAC,CAAA;AAC3D","file":"chunk-EOCKR5TN.js","sourcesContent":["import fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { factoryAssetRoots } from \"@skaile/workspaces/core\";\n\nconst __ownDir = path.dirname(fileURLToPath(import.meta.url));\n\n/**\n * Walk up from `from` looking for the monorepo marker (`biome.json`, the\n * repo-root shared tooling config). Returns the matching directory or `null`\n * when none is found within eight levels — the latter is the typical case when\n * `@skaile/workspaces` has been installed via `npm i` without a skaile-dev\n * workspace context. Used only to gate dev-only commands (e.g.\n * `serve --compile-test`); first-party content is located via\n * {@link aiResourceRoots}, not this.\n */\nfunction findMonorepoRoot(from: string): string | null {\n let dir = from;\n for (let i = 0; i < 8; i++) {\n if (fs.existsSync(path.join(dir, \"biome.json\"))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/**\n * Absolute path to the monorepo root, or `null` when the CLI is running\n * outside the skaile-dev workspace (typical for `npm i -g` installs).\n *\n * Consumers that only make sense inside the workspace (e.g.\n * `skaile serve --compile-test`) MUST check for `null` and report a\n * \"monorepo-only feature\" error before proceeding.\n *\n * @docLink cli/dev-guide#paths\n */\nexport const MONOREPO_ROOT: string | null = findMonorepoRoot(__ownDir);\n\n/**\n * Default content root used by path display and the `validate` command.\n *\n * The primary first-party `factory-assets/` root resolved through the shared\n * `factoryAssetRoots()` helper — the `SKAILE_FACTORY_ASSETS_DIR` override when\n * set, else the in-repo source during dev / bundled `dist/factory-assets/` after\n * `npm i`. Falls back to `~/.skaile/libraries/` — the user-library directory\n * managed by `skaile library add` — when the package cannot be located.\n * Consumers `fs.existsSync` first and degrade to \"no skills / flows discovered\".\n *\n * @docLink cli/dev-guide#paths\n */\nexport const AI_RESOURCES: string =\n factoryAssetRoots()[0] ?? path.join(os.homedir(), \".skaile\", \"libraries\");\n\n/**\n * All content roots that skill / flow discovery should walk, in priority order,\n * filtered to those that exist on disk and de-duplicated.\n *\n * - The first-party `factory-assets/` roots from the shared `factoryAssetRoots()`\n * helper — the `SKAILE_FACTORY_ASSETS_DIR` override layer (when set) ahead of\n * the bundled tree (in-repo source in dev, `dist/factory-assets/` after\n * install). No monorepo special-case.\n * - The user-library dir `~/.skaile/libraries/`.\n *\n * Order is significant: `findSkills` / flow discovery dedupe first-root-wins, so\n * the env override shadows the bundled tree on a name clash.\n *\n * This is the discovery surface used by `findSkills`, flow discovery, and the\n * completion resolvers.\n *\n * @docLink cli/dev-guide#paths\n */\nexport function aiResourceRoots(): string[] {\n const roots: string[] = [...factoryAssetRoots()];\n roots.push(path.join(os.homedir(), \".skaile\", \"libraries\"));\n return [...new Set(roots)].filter((r) => fs.existsSync(r));\n}\n"]}
|
|
@@ -68,5 +68,5 @@ async function flowFindFlowForSession(projectDir, runId) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export { flowFindFlowForSession, flowGetSession, flowList, flowListSessions, flowShow };
|
|
71
|
-
//# sourceMappingURL=chunk-
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
71
|
+
//# sourceMappingURL=chunk-I3TERDTR.js.map
|
|
72
|
+
//# sourceMappingURL=chunk-I3TERDTR.js.map
|