@skaile/workspaces 1.4.0 → 1.5.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.
Files changed (196) hide show
  1. package/CHANGELOG.md +273 -0
  2. package/dist/app-sdk/index.js +241 -55
  3. package/dist/app-sdk/index.js.map +1 -1
  4. package/dist/app-sdk/src/app.d.ts +55 -4
  5. package/dist/app-sdk/src/app.d.ts.map +1 -1
  6. package/dist/app-sdk/src/connection-params.d.ts +117 -0
  7. package/dist/app-sdk/src/connection-params.d.ts.map +1 -0
  8. package/dist/app-sdk/src/index.d.ts +3 -2
  9. package/dist/app-sdk/src/index.d.ts.map +1 -1
  10. package/dist/app-sdk/src/transport.d.ts +9 -0
  11. package/dist/app-sdk/src/transport.d.ts.map +1 -1
  12. package/dist/app-sdk/src/ws-transport.d.ts +18 -2
  13. package/dist/app-sdk/src/ws-transport.d.ts.map +1 -1
  14. package/dist/{asset-feeds-NG5TKB3V.js → asset-feeds-T35ELX2O.js} +9 -9
  15. package/dist/{asset-feeds-NG5TKB3V.js.map → asset-feeds-T35ELX2O.js.map} +1 -1
  16. package/dist/asset-manager/index.js +11 -6
  17. package/dist/asset-manager/installer.js +5 -5
  18. package/dist/asset-manager/src/index.d.ts.map +1 -1
  19. package/dist/{chunk-BE5KTS2L.js → chunk-2DWXGUZA.js} +2 -2
  20. package/dist/{chunk-BE5KTS2L.js.map → chunk-2DWXGUZA.js.map} +1 -1
  21. package/dist/{chunk-XBG2YDQQ.js → chunk-2ZMO4CFG.js} +3 -3
  22. package/dist/{chunk-XBG2YDQQ.js.map → chunk-2ZMO4CFG.js.map} +1 -1
  23. package/dist/{chunk-X57AMTAH.js → chunk-3CHARYD4.js} +16 -7
  24. package/dist/chunk-3CHARYD4.js.map +1 -0
  25. package/dist/{chunk-LCTRCWBK.js → chunk-6NR2BEIY.js} +4 -4
  26. package/dist/{chunk-LCTRCWBK.js.map → chunk-6NR2BEIY.js.map} +1 -1
  27. package/dist/{chunk-AAGD2J4H.js → chunk-BGIC25VK.js} +11 -9
  28. package/dist/chunk-BGIC25VK.js.map +1 -0
  29. package/dist/{chunk-JZPEEMIM.js → chunk-CNSNN7N6.js} +5 -5
  30. package/dist/{chunk-JZPEEMIM.js.map → chunk-CNSNN7N6.js.map} +1 -1
  31. package/dist/{chunk-GWDZW44L.js → chunk-DMG6NJH7.js} +4 -4
  32. package/dist/{chunk-GWDZW44L.js.map → chunk-DMG6NJH7.js.map} +1 -1
  33. package/dist/{chunk-HWTQ6HPO.js → chunk-FDE7XRQA.js} +56 -8
  34. package/dist/chunk-FDE7XRQA.js.map +1 -0
  35. package/dist/{chunk-26YCXWCU.js → chunk-HY33RMEA.js} +3 -3
  36. package/dist/{chunk-26YCXWCU.js.map → chunk-HY33RMEA.js.map} +1 -1
  37. package/dist/chunk-J5TI55E7.js +203 -0
  38. package/dist/chunk-J5TI55E7.js.map +1 -0
  39. package/dist/chunk-JIDKX7GC.js +122 -0
  40. package/dist/chunk-JIDKX7GC.js.map +1 -0
  41. package/dist/{chunk-BDUANIAR.js → chunk-KEQ4GLVM.js} +3 -3
  42. package/dist/{chunk-BDUANIAR.js.map → chunk-KEQ4GLVM.js.map} +1 -1
  43. package/dist/{chunk-DNFIKRO6.js → chunk-KMY7HVQ6.js} +3 -3
  44. package/dist/{chunk-DNFIKRO6.js.map → chunk-KMY7HVQ6.js.map} +1 -1
  45. package/dist/{chunk-B6SSXVF2.js → chunk-MZV6WCF3.js} +81 -49
  46. package/dist/chunk-MZV6WCF3.js.map +1 -0
  47. package/dist/{chunk-DZCK7GRW.js → chunk-P4VHQA4N.js} +22 -6
  48. package/dist/chunk-P4VHQA4N.js.map +1 -0
  49. package/dist/{chunk-OSCJRUKM.js → chunk-RDYOU6N6.js} +2 -2
  50. package/dist/{chunk-OSCJRUKM.js.map → chunk-RDYOU6N6.js.map} +1 -1
  51. package/dist/{chunk-77OXU44H.js → chunk-RSYV7XEN.js} +13 -7
  52. package/dist/chunk-RSYV7XEN.js.map +1 -0
  53. package/dist/{chunk-OUWNTFDG.js → chunk-UQKYT4V6.js} +38 -6
  54. package/dist/chunk-UQKYT4V6.js.map +1 -0
  55. package/dist/chunk-WYGXYGJH.js +688 -0
  56. package/dist/chunk-WYGXYGJH.js.map +1 -0
  57. package/dist/{chunk-TJRWGMD2.js → chunk-ZBZQC5R7.js} +3 -3
  58. package/dist/{chunk-TJRWGMD2.js.map → chunk-ZBZQC5R7.js.map} +1 -1
  59. package/dist/cli/index.js +259 -192
  60. package/dist/cli/index.js.map +1 -1
  61. package/dist/cli/src/commands/catalog.d.ts +18 -0
  62. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  63. package/dist/cli/src/commands/library-cmd.d.ts +2 -2
  64. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  65. package/dist/cli/src/commands/library-publish.d.ts +53 -0
  66. package/dist/cli/src/commands/library-publish.d.ts.map +1 -0
  67. package/dist/cli/src/commands/preset-cmd.d.ts +6 -0
  68. package/dist/cli/src/commands/preset-cmd.d.ts.map +1 -1
  69. package/dist/cli/src/commands/preset-export.d.ts +10 -1
  70. package/dist/cli/src/commands/preset-export.d.ts.map +1 -1
  71. package/dist/cli/src/commands/project.d.ts.map +1 -1
  72. package/dist/cli/src/commands/publish-core.d.ts +75 -0
  73. package/dist/cli/src/commands/publish-core.d.ts.map +1 -0
  74. package/dist/cli/src/commands/run.d.ts.map +1 -1
  75. package/dist/cli/src/commands/source-manifest-publish.d.ts +82 -0
  76. package/dist/cli/src/commands/source-manifest-publish.d.ts.map +1 -0
  77. package/dist/cli/src/commands/source-manifest.d.ts +65 -6
  78. package/dist/cli/src/commands/source-manifest.d.ts.map +1 -1
  79. package/dist/cli/src/commands/source.d.ts +13 -0
  80. package/dist/cli/src/commands/source.d.ts.map +1 -1
  81. package/dist/cli/src/commands/store.d.ts.map +1 -1
  82. package/dist/cli/src/driver-error.d.ts +12 -0
  83. package/dist/cli/src/driver-error.d.ts.map +1 -0
  84. package/dist/cli/src/open-library.d.ts +4 -0
  85. package/dist/cli/src/open-library.d.ts.map +1 -1
  86. package/dist/cli/src/store-auth.d.ts +42 -0
  87. package/dist/cli/src/store-auth.d.ts.map +1 -0
  88. package/dist/cli/src/store-client.d.ts +20 -22
  89. package/dist/cli/src/store-client.d.ts.map +1 -1
  90. package/dist/cli/src/store-publisher.d.ts +91 -0
  91. package/dist/cli/src/store-publisher.d.ts.map +1 -0
  92. package/dist/connectors/config.js +5 -5
  93. package/dist/connectors/index.js +6 -6
  94. package/dist/core/index.js +4 -4
  95. package/dist/core/publish-manifest.js +1 -1
  96. package/dist/core/runtime-assets.js +3 -3
  97. package/dist/core/src/cache-paths.d.ts +17 -0
  98. package/dist/core/src/cache-paths.d.ts.map +1 -1
  99. package/dist/core/src/index.d.ts +2 -2
  100. package/dist/core/src/index.d.ts.map +1 -1
  101. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  102. package/dist/core/src/repo-manager.d.ts +13 -2
  103. package/dist/core/src/repo-manager.d.ts.map +1 -1
  104. package/dist/core/src/walker.d.ts +10 -0
  105. package/dist/core/src/walker.d.ts.map +1 -1
  106. package/dist/core/workspace-config.js +2 -2
  107. package/dist/deploy/index.js +4 -4
  108. package/dist/discovery/index.js +2 -2
  109. package/dist/discovery/src/discover-manifest.d.ts.map +1 -1
  110. package/dist/discovery/src/discover.d.ts +17 -4
  111. package/dist/discovery/src/discover.d.ts.map +1 -1
  112. package/dist/discovery/src/index.d.ts +1 -1
  113. package/dist/discovery/src/index.d.ts.map +1 -1
  114. package/dist/discovery/src/reference-lint.d.ts +7 -0
  115. package/dist/discovery/src/reference-lint.d.ts.map +1 -1
  116. package/dist/discovery/src/source-config.d.ts +28 -0
  117. package/dist/discovery/src/source-config.d.ts.map +1 -1
  118. package/dist/discovery/src/tree-entries.d.ts.map +1 -1
  119. package/dist/{ensure-sources-CHC7X7AJ.js → ensure-sources-QDVFUIUP.js} +14 -9
  120. package/dist/ensure-sources-QDVFUIUP.js.map +1 -0
  121. package/dist/factory-assets/connectors/box.js +6 -6
  122. package/dist/factory-assets/connectors/deploy.js +6 -6
  123. package/dist/factory-assets/connectors/devserver.js +6 -6
  124. package/dist/factory-assets/connectors/flow/adapter.js +6 -6
  125. package/dist/factory-assets/connectors/flow/engine.js +4 -4
  126. package/dist/factory-assets/connectors/flow/run-flow.js +7 -7
  127. package/dist/factory-assets/connectors/flow.js +6 -6
  128. package/dist/factory-assets/connectors/git.js +6 -6
  129. package/dist/factory-assets/connectors/gmail.js +6 -6
  130. package/dist/factory-assets/connectors/googledrive.js +6 -6
  131. package/dist/factory-assets/connectors/local.js +6 -6
  132. package/dist/factory-assets/connectors/mattermost.js +6 -6
  133. package/dist/factory-assets/connectors/memory.js +6 -6
  134. package/dist/factory-assets/connectors/minio.js +6 -6
  135. package/dist/factory-assets/connectors/postgres.js +6 -6
  136. package/dist/factory-assets/connectors/s3.js +6 -6
  137. package/dist/factory-assets/connectors/sharepoint.js +6 -6
  138. package/dist/factory-assets/connectors/sqlite.js +6 -6
  139. package/dist/factory-assets/connectors/static-server.js +6 -6
  140. package/dist/factory-assets/connectors/tunnel.js +6 -6
  141. package/dist/factory-assets/connectors/webdav.js +6 -6
  142. package/dist/factory-assets/connectors/xstate-store.js +6 -6
  143. package/dist/factory-assets/connectors/xstate.js +6 -6
  144. package/dist/{flows-CGOCUNO6.js → flows-MRVXTYWC.js} +3 -3
  145. package/dist/{flows-CGOCUNO6.js.map → flows-MRVXTYWC.js.map} +1 -1
  146. package/dist/{helpers-GWG4CYYC.js → helpers-TF7GCBRQ.js} +14 -9
  147. package/dist/{helpers-GWG4CYYC.js.map → helpers-TF7GCBRQ.js.map} +1 -1
  148. package/dist/library/index.js +6 -6
  149. package/dist/library/install.js +4 -4
  150. package/dist/library/src/index.d.ts +2 -2
  151. package/dist/library/src/index.d.ts.map +1 -1
  152. package/dist/library/src/local/local-catalog-source.d.ts +12 -1
  153. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  154. package/dist/library/src/sync/manifest-writeback.d.ts +36 -0
  155. package/dist/library/src/sync/manifest-writeback.d.ts.map +1 -1
  156. package/dist/library-publish-K5IBE44D.js +249 -0
  157. package/dist/library-publish-K5IBE44D.js.map +1 -0
  158. package/dist/{open-library-37PXN6MK.js → open-library-4HMIDK3N.js} +13 -13
  159. package/dist/{open-library-37PXN6MK.js.map → open-library-4HMIDK3N.js.map} +1 -1
  160. package/dist/{paths-UVOHWUPY.js → paths-P3DWFUPS.js} +7 -7
  161. package/dist/{paths-UVOHWUPY.js.map → paths-P3DWFUPS.js.map} +1 -1
  162. package/dist/{plugin-store-EIMVEH3O.js → plugin-store-S7OMGI7N.js} +6 -6
  163. package/dist/{plugin-store-EIMVEH3O.js.map → plugin-store-S7OMGI7N.js.map} +1 -1
  164. package/dist/runner/index.js +8 -8
  165. package/dist/runner/src/agent.d.ts.map +1 -1
  166. package/dist/sdk/asset-manager.js +11 -6
  167. package/dist/sdk/core.js +4 -4
  168. package/dist/sdk/flow.js +4 -4
  169. package/dist/sdk/index.js +8 -8
  170. package/dist/sdk/runner.js +8 -8
  171. package/dist/{setup-DINVR6ZQ.js → setup-2CCS63L6.js} +6 -6
  172. package/dist/{setup-DINVR6ZQ.js.map → setup-2CCS63L6.js.map} +1 -1
  173. package/dist/source-LOAM7IIQ.js +30 -0
  174. package/dist/{source-RXAHIGMD.js.map → source-LOAM7IIQ.js.map} +1 -1
  175. package/dist/source-manifest-publish-TGVZ6KMC.js +228 -0
  176. package/dist/source-manifest-publish-TGVZ6KMC.js.map +1 -0
  177. package/dist/tui/index.js +8 -8
  178. package/dist/workspace-plugin/adapters/mcp.js +1 -1
  179. package/dist/workspace-plugin/adapters/omp.js +3 -3
  180. package/dist/workspace-plugin/index.js +1 -1
  181. package/package.json +1 -1
  182. package/dist/chunk-77OXU44H.js.map +0 -1
  183. package/dist/chunk-AAGD2J4H.js.map +0 -1
  184. package/dist/chunk-B6SSXVF2.js.map +0 -1
  185. package/dist/chunk-BJHZHNKR.js +0 -93
  186. package/dist/chunk-BJHZHNKR.js.map +0 -1
  187. package/dist/chunk-DZCK7GRW.js.map +0 -1
  188. package/dist/chunk-HWTQ6HPO.js.map +0 -1
  189. package/dist/chunk-OUWNTFDG.js.map +0 -1
  190. package/dist/chunk-QM2TT2PJ.js +0 -385
  191. package/dist/chunk-QM2TT2PJ.js.map +0 -1
  192. package/dist/chunk-X57AMTAH.js.map +0 -1
  193. package/dist/ensure-sources-CHC7X7AJ.js.map +0 -1
  194. package/dist/source-RXAHIGMD.js +0 -30
  195. package/dist/store-client-T3F663YG.js +0 -15
  196. package/dist/store-client-T3F663YG.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../asset-manager/src/index.ts"],"names":["parseYaml","stringifyYaml"],"mappings":";;;;;;;;;;;;;;AA2FO,SAAS,iBAAiB,GAAA,EAAqB;AACpD,EAAA,OAAO,IACJ,IAAA,EAAK,CACL,QAAQ,eAAA,EAAiB,aAAa,EACtC,OAAA,CAAQ,eAAA,EAAiB,EAAE,CAAA,CAC3B,OAAA,CAAQ,WAAW,EAAE,CAAA,CACrB,QAAQ,MAAA,EAAQ,EAAE,EAClB,WAAA,EAAY;AACjB;AAGA,IAAM,UAAA,GAAqC;AAAA,EACzC,KAAA,EAAO,UAAA;AAAA,EACP,KAAA,EAAO,UAAA;AAAA,EACP,MAAA,EAAQ,WAAA;AAAA,EACR,YAAA,EAAc,QAAA;AAAA,EACd,SAAA,EAAW,cAAA;AAAA,EACX,MAAA,EAAQ,WAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAQA,SAAS,iBAAA,CAAkB,MAAc,KAAA,EAA8C;AACrF,EAAA,MAAM,KAAA,GAAQ,WAAW,IAAI,CAAA;AAC7B,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,CAAC,MAAM,CAAA,CAAE,QAAA,CAAS,KAAK,CAAC,CAAA;AAC/C,IAAA,IAAI,KAAK,OAAO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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-X57AMTAH.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 mkdirSync,\n readdirSync,\n readFileSync,\n rmSync,\n unlinkSync,\n writeFileSync,\n} from \"node:fs\";\nimport { dirname, join, resolve, sep } from \"node:path\";\nimport type {\n AiComponent,\n AssetRef,\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 assetRefToStr,\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 globalCacheRoot,\n globalSkaileDir,\n isDeployed,\n migrateLegacyDir,\n parseAssetRef,\n parseRequires,\n readLinks,\n readLock,\n resolveAll,\n resolveAsset,\n resolveGlobalBackends,\n resolveGlobalSkWorkspaceConfig,\n resolveRuntimeAssets,\n resolveSkWorkspaceConfig,\n savePatch,\n scanRepo,\n SKAILE_YAML_DEFAULT,\n sourceCacheKey,\n sourceShortName,\n verifyLock,\n writeLock,\n} from \"@skaile/workspaces/core\";\nimport type { ResolveResult } from \"@skaile/workspaces/core\";\nimport type { AssetDefinition, AssetFetcher } from \"@skaile/workspaces/library\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\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/**\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 */\nexport function 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/** Primary manifest filename for each asset kind (the deploy entry point). */\nconst 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\n/**\n * Pick a candidate's primary manifest file from its `files[]`. Fixed-name kinds\n * (skill/agent/contract/…) match their `MD_BY_KIND` basename; `prompt` and\n * `flow` use their `<name>.prompt.md` / `<name>.flow.{yaml,json}` suffixes\n * (these have no fixed basename, so an exact-name match alone would miss them).\n */\nfunction matchManifestPath(kind: string, paths: readonly string[]): string | undefined {\n const exact = MD_BY_KIND[kind];\n if (exact) {\n const hit = paths.find((p) => p.endsWith(exact));\n if (hit) return hit;\n }\n if (kind === \"prompt\") return paths.find((p) => p.endsWith(\".prompt.md\"));\n if (kind === \"flow\") {\n return paths.find((p) => p.endsWith(\".flow.yaml\") || p.endsWith(\".flow.json\"));\n }\n return undefined;\n}\n\n/**\n * Asset kinds that are never deployed to a driver target as files — bundles\n * resolve to their members, mcp-servers are wired at session startup, and the\n * mixin kinds are resolved at session creation. Store bytes are not staged for\n * these (mirrors the skip set in `deployAll`).\n */\nexport const NON_DEPLOYABLE_KINDS = new Set([\n \"bundle\",\n \"mcp-server\",\n \"persona\",\n \"ruleset\",\n \"knowledge\",\n]);\n\n/**\n * Longest common leading directory prefix across `paths` (slash-joined, no\n * trailing slash). Mirrors the prefix-strip `installFromManifest` flat mode\n * applies, so a staged asset's manifest can be located deterministically.\n */\nfunction commonDirPrefix(paths: readonly string[]): string {\n if (paths.length === 0) return \"\";\n const dirs = paths.map((p) => p.split(\"/\").slice(0, -1));\n let common = dirs[0]!;\n for (let i = 1; i < dirs.length && common.length > 0; i++) {\n const segs = dirs[i]!;\n let n = 0;\n while (n < common.length && n < segs.length && common[n] === segs[n]) n++;\n common = common.slice(0, n);\n }\n return common.join(\"/\");\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 a canonical asset ref, so this delegates to the one ref\n * parser; `AssetRef.pin` is exposed as `version` so the callers' destructuring is\n * unchanged. Stays total — callers rely on `{}`-then-`continue`, but `parseAssetRef`\n * throws, so a genuinely malformed key is caught and returned as `{}`.\n *\n * A **content-sha pseudo-version** key (`#0.0.0-sha.<hash>`, the version every\n * manifest-less source gets) fails `parseAssetRef`'s canonical-pin check. Dropping\n * it to `{}` would strip the identity, so the install reconcile / state machine\n * could never act on such an asset (it silently survives a remove-from-yaml). Fall\n * back to parsing the bare identity, keeping the raw pin as `version`.\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 // Reuse the shared pin-tolerant parse for the identity; keep the raw pin.\n const loose = parseRefLoose(key);\n if (!loose) return {};\n const hash = key.indexOf(\"#\");\n return {\n publisher: loose.publisher,\n kind: loose.kind,\n name: loose.name,\n version: hash < 0 ? undefined : key.slice(hash + 1),\n };\n }\n}\n\n/**\n * Bare asset name of a soft-dep target ref (`@pub/name@ver` → `name`); splits the\n * version off the *last* `@` since the leading one is the scope sigil. The\n * present-check matches on this bare name only (under-reports — the safe direction).\n */\nexport function softDepName(ref: string): string {\n const at = ref.lastIndexOf(\"@\");\n const base = at > 0 ? ref.slice(0, at) : ref;\n const slash = base.lastIndexOf(\"/\");\n return slash >= 0 ? base.slice(slash + 1) : base;\n}\n\n/**\n * Build a **version-less** dep ref (`kind:@publisher/name`) for the `skaile add`\n * suggestion. Omits the version: a manifest-less source resolves under a content-sha\n * pin the index's frontmatter version never matches, so a pinned ref is unaddable.\n */\nfunction depRefFromDef(def: {\n kind: string;\n publisher: string;\n name: string;\n version: string;\n}): string | undefined {\n const publisher = def.publisher.replace(/^@/, \"\");\n if (!publisher) return undefined;\n return assetRefToStr({ kind: def.kind, name: def.name, publisher });\n}\n\n/**\n * Parse a ref for identity matching, tolerating a non-canonical pin. A lock ref\n * can pin a content-sha pseudo-version (`#0.0.0-sha.<hash>`) that `parseAssetRef`\n * rejects; the matchers below only need the version-agnostic `kind/publisher/name`,\n * so drop the pin and retry before giving up.\n */\nfunction parseRefLoose(ref: string): ReturnType<typeof parseAssetRef> | null {\n try {\n return parseAssetRef(ref);\n } catch {\n const hash = ref.indexOf(\"#\");\n if (hash < 0) return null;\n try {\n return parseAssetRef(ref.slice(0, hash));\n } catch {\n return null;\n }\n }\n}\n\n/**\n * Parse a ref for lookup, tolerating a **missing publisher** (`kind:name`, the\n * shape `listDeployed` emits and the strict `parseAssetRef` rejects). Returns\n * `null` when neither kind nor name is recoverable. Unlike {@link parseRefLoose}\n * (publisher-required, only strips a `#pin`), this keeps the publisher optional.\n *\n * @internal Exported for unit tests; not part of the stable public surface.\n */\nexport function parseRefTolerant(ref: string): AssetRef | null {\n try {\n return parseAssetRef(ref);\n } catch {\n const colon = ref.indexOf(\":\");\n if (colon < 0) return null;\n let kind = ref.slice(0, colon).trim();\n // Mirror parseAssetRef's shorthand so a bare `mcp:name` matches `mcp-server` entries.\n if (kind === \"mcp\") kind = \"mcp-server\";\n const hash = ref.indexOf(\"#\", colon);\n const name = ref.slice(colon + 1, hash < 0 ? undefined : hash).trim();\n if (!kind || !name) return null;\n return { kind, name, publisher: undefined };\n }\n}\n\n/**\n * Find the cached AssetDefinition(s) for an input ref. Tries an exact id match\n * first (canonical refs), then falls back to a name (+publisher/kind when the\n * ref carries them) match so `kind:name` / `kind:@pub/name` inputs resolve. The\n * fallback is version-agnostic, so a lock ref pinned at a content-sha\n * pseudo-version still matches the index def stored under a canonical semver.\n */\nfunction matchDefsForRef<T extends { id: string; kind: string; name: string; publisher: string }>(\n defs: T[],\n ref: string,\n): T[] {\n const exact = defs.filter((d) => d.id === ref);\n if (exact.length > 0) return exact;\n const parsed = parseRefLoose(ref);\n if (!parsed) return [];\n const wantPub = parsed.publisher?.replace(/^@/, \"\");\n return defs.filter(\n (d) =>\n d.name === parsed.name &&\n d.kind === parsed.kind &&\n (wantPub === undefined || d.publisher.replace(/^@/, \"\") === wantPub),\n );\n}\n\n/**\n * Reconciliation state of a declared dependency relative to the lock + disk.\n * `invalid` flags a `dependencies:` entry that isn't a parseable canonical ref —\n * surfaced (not silently dropped) so a `skaile.yaml` typo is visible.\n */\nexport type DeclaredState = \"declared\" | \"installed\" | \"drift\" | \"invalid\";\n\n/**\n * A top-level dependency declared in `skaile.yaml`, annotated with its\n * reconciliation {@link DeclaredState}. Transitive (lock-only) deps are never\n * included — {@link AssetManager.listDeclared} walks the declared set only.\n */\nexport interface DeclaredAsset {\n /** The canonical declared ref exactly as written in `skaile.yaml`. */\n ref: string;\n kind: string;\n name: string;\n state: DeclaredState;\n}\n\n/**\n * A global declared dependency from `~/.skaile/skaile.yaml`, reconciled against\n * **one** backend's global deploy dir. The same ref yields one entry per global\n * backend (see {@link AssetManager.globalState}) so an asset can read `installed`\n * for `claude-code` and `drift`/`declared` for `codex` simultaneously.\n */\nexport interface BackendDeclaredAsset extends DeclaredAsset {\n /** The global backend this state was reconciled against. */\n backend: DriverTarget;\n}\n\n/**\n * A body-link soft-dependency edge: asset `from` references target `to` in its\n * body (not its typed `requires`). `toRef` is the parseable `skaile add` ref when\n * the target is in the index, omitted otherwise. Surfaced read-only — never\n * auto-installed (see {@link AssetManager.softDepsOf} / {@link AssetManager.reportSoftDeps}).\n */\nexport interface SoftDepEdge {\n from: string;\n to: string;\n toRef?: string;\n}\n\n/**\n * A soft-dependency target that would be left orphaned by removing some assets:\n * it is still present in the project, came in as `from`'s soft dependency, and\n * nothing else still needs it (neither a soft-dep nor a typed `requires`).\n * Report-only — {@link AssetManager.orphanedSoftDepsAfterRemoving} never removes\n * it; the caller prompts (default No). `targetRef` is the parseable `skaile\n * remove` ref when the target is in the index.\n */\nexport interface OrphanedSoftDep {\n from: string;\n target: string;\n targetRef?: string;\n}\n\n/**\n * Thrown by {@link AssetManager.listDeclared} when the project has no\n * `skaile.yaml`. The CLI maps this to a `skaile init` hint.\n */\nexport class MissingManifestError extends Error {\n constructor(readonly projectDir: string) {\n super(`No skaile.yaml in ${projectDir}.`);\n this.name = \"MissingManifestError\";\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`, the manager operates in **global cross-backend** mode: config\n * SSOT, lock, cache, and history root at `~/.skaile` (not the project), the\n * `dependencies:` manifest edits target `~/.skaile/skaile.yaml`, and deploy\n * fans out to every backend in {@link backends}. When `false` (default),\n * everything is project-scoped against the single {@link driverTarget}.\n */\n global?: boolean;\n /**\n * Global-mode backend set the deploy fans out to. When omitted in global mode,\n * resolved from `~/.skaile/skaile.yaml` `global_backends:` else auto-detection\n * (`resolveGlobalBackends`). Ignored in project mode. A `--backend` filter\n * narrows this to a subset.\n */\n backends?: DriverTarget[];\n /**\n * Catalog read-protocol fetcher used to resolve store-published assets. When\n * omitted, one is built per call from the configured stores\n * (`RemoteCatalogSource`). Injected mainly by tests to stay network-free.\n */\n storeFetcher?: StoreFetcher;\n /**\n * Byte fetcher used to fetch a store asset's files at its pinned commit before\n * deploy. When omitted, the production GitHub fetcher is used. Injected by\n * tests to stay network-free.\n */\n assetFetcher?: AssetFetcher;\n /**\n * Overrides the global `catalog.url` used as a store fallback when the project\n * declares no `stores:`. Pass `\"\"` to disable the fallback entirely. When\n * omitted, the URL is read from `~/.skaile/config.yaml` (`resolveConfig`).\n */\n catalogUrl?: string;\n /**\n * Overrides the index SQLite path read by {@link AssetManager.reportSoftDeps}\n * (default `~/.skaile/index.db` via `resolveIndexPath`). Injected by tests to\n * read a seeded index without touching the user's real one.\n */\n indexPath?: string;\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. */\nexport const 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 /** Explicit global-backend override (global mode only); else auto-resolved. */\n private readonly backendsOverride?: DriverTarget[];\n /** Injected catalog fetcher (tests / custom); falls back to a built one. */\n private readonly injectedStoreFetcher?: StoreFetcher;\n /** Injected byte fetcher for store staging; falls back to GitHub. */\n private readonly injectedAssetFetcher?: AssetFetcher;\n /** Injected global catalog URL override for the no-project-store fallback. */\n private readonly catalogUrlOverride?: string;\n /** Injected index SQLite path override (tests); else the default index.db. */\n private readonly indexPathOverride?: string;\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 this.backendsOverride = opts.backends;\n this.injectedStoreFetcher = opts.storeFetcher;\n this.injectedAssetFetcher = opts.assetFetcher;\n this.catalogUrlOverride = opts.catalogUrl;\n this.indexPathOverride = opts.indexPath;\n }\n\n /**\n * Root for this manager's **state** — config SSOT, lock, cache, history.\n * `~/.skaile` in global mode (the cross-backend SSOT), else the project dir.\n * Deploy dirs are unaffected; they come from `DRIVER_TARGETS[target]`.\n */\n private get stateRoot(): string {\n return this.global ? globalSkaileDir() : this.projectDir;\n }\n\n /**\n * The backends a global deploy fans out to: the explicit `backends` override\n * (a `--backend` filter), else `resolveGlobalBackends()`. In project mode this\n * is exactly `[driverTarget]`, so the shared fan-out loop degenerates to the\n * single-target path.\n */\n private targetBackends(): DriverTarget[] {\n if (!this.global) return [this.driverTarget];\n if (this.backendsOverride && this.backendsOverride.length > 0) return this.backendsOverride;\n return resolveGlobalBackends();\n }\n\n private get storeCacheDir(): string {\n if (this.global) return join(globalCacheRoot(), \"store\");\n return migrateLegacyDir(\n join(this.projectDir, \".skaile\", \"cache\", \"store\"),\n join(this.projectDir, \".skaile\", \"store-cache\"),\n );\n }\n\n private get reposDir(): string {\n if (this.global) return join(globalCacheRoot(), \"sources\");\n return migrateLegacyDir(\n join(this.projectDir, \".skaile\", \"cache\", \"sources\"),\n join(this.projectDir, \".skaile\", \"repos\"),\n );\n }\n\n /**\n * Project-scoped cache dirs rooted at `.skaile/cache/` (`store`, `sources`)\n * relative to `projectDir`. Reading is a side effect: it triggers lazy\n * migration of the legacy `.skaile/{store-cache,repos}` dirs.\n */\n get projectCacheDirs(): { store: string; sources: string } {\n return { store: this.storeCacheDir, sources: this.reposDir };\n }\n\n private get lockPath(): string {\n return join(this.stateRoot, \"skaile.lock.yaml\");\n }\n\n private get patchDir(): string {\n return join(this.projectDir, \".skaile\", \"patches\");\n }\n\n /** Deploy options for one backend. In global mode, `driverTarget` is the\n * fan-out target (not the constructor's `driverTarget`, which is project-only). */\n private deployOptsFor(target: DriverTarget, link?: boolean): DeployOptions {\n return { driverTarget: target, global: this.global, cwd: this.projectDir, link: link === true };\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 // Global mode reads ONLY the user-scope SSOT (`~/.skaile/skaile.yaml`) so a\n // project's deps never leak into a global fan-out (and vice versa).\n const config = this.global\n ? resolveGlobalSkWorkspaceConfig()\n : 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 // Source clones live in the global clone cache (cache/sources); the slug is\n // the cache key for ensureRepo. getGlobalCacheDir() migrates legacy roots.\n const sourcesDir = getGlobalCacheDir();\n const repositories: Record<string, SourceDeclaration> = {};\n for (const s of sources) {\n const slug = sourceCacheKey(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 // Unknown source — deployable store assets are routed via staged bytes\n // before reaching here, so this branch now only hits non-deployable store\n // kinds (e.g. mcp-server), which deployAll skips. Fall back to first 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 // Resolve a concrete manifest file (suffix-aware for prompt/flow), falling\n // back to the first file — never the clone dir, which deploy can't copy as a\n // single asset (cpSync without recursive throws on a directory).\n const mdRel =\n matchManifestPath(\n c.kind,\n c.files.map((f) => f.path),\n ) ?? c.files[0]?.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 // ── Store fetch-then-deploy ────────────────────────────────────────────\n\n /** A candidate's stable identity key (`<publisher>/<kind>:<name>@<version>`). */\n private candidateKey(c: ProvenanceCandidate): string {\n return `${c.publisher}/${c.kind}:${c.name}@${c.version}`;\n }\n\n /**\n * Resolve `deps`, falling back to the global `catalog.url` store when the\n * project declares no store and the first pass leaves something missing.\n *\n * The first pass uses the project stores only, so locally-resolvable refs\n * never trigger a network probe. The fallback retry is best-effort: any error\n * (offline, store down) keeps the first pass's result rather than regressing.\n */\n private async resolveWithStores(\n deps: string[],\n opts: {\n provenanceIndex: ReturnType<typeof buildProvenanceIndex>;\n overrides: OverrideEntry[];\n stores: StoreEntry[];\n },\n ): Promise<ResolveResult> {\n const first = await resolveAll(deps, {\n provenanceIndex: opts.provenanceIndex,\n overrides: opts.overrides,\n stores: opts.stores,\n storeFetcher: this.storeFetcherFor(opts.stores),\n projectDir: this.projectDir,\n });\n if (first.missing.length === 0) return first;\n\n const fallback = await this.globalStoreFallback(opts.stores);\n if (fallback.length === 0) return first;\n\n const stores = [...opts.stores, ...fallback];\n try {\n const retry = await resolveAll(deps, {\n provenanceIndex: opts.provenanceIndex,\n overrides: opts.overrides,\n stores,\n storeFetcher: this.storeFetcherFor(stores),\n projectDir: this.projectDir,\n });\n // Monotone: same provenanceIndex + overrides, only more stores added —\n // resolution can gain deps but never lose one, so fewer-missing wins.\n return retry.missing.length < first.missing.length ? retry : first;\n } catch {\n return first;\n }\n }\n\n /** The catalog fetcher to use: an injected one, else built from `stores`. */\n private storeFetcherFor(stores: StoreEntry[]): StoreFetcher | undefined {\n return this.injectedStoreFetcher ?? this.buildStoreFetcher(stores);\n }\n\n /**\n * The global `catalog.url` as a single-store fallback, or `[]` when no\n * project store should be synthesized — `local` sentinel, already-declared,\n * or no URL. Honours an explicit `catalogUrl` injection (`\"\"` disables it).\n */\n private async globalStoreFallback(projectStores: StoreEntry[]): Promise<StoreEntry[]> {\n let url = this.catalogUrlOverride;\n if (url === undefined) {\n try {\n const { resolveConfig } = await import(\"@skaile/workspaces/library\");\n url = resolveConfig({ projectDir: this.projectDir }).catalog.url;\n } catch {\n return [];\n }\n }\n if (!url || url.trim().toLowerCase() === \"local\") return [];\n if (projectStores.some((s) => normalizeRepoUrl(s.url) === normalizeRepoUrl(url!))) return [];\n return [{ url }];\n }\n\n /**\n * Build deployable catalog entries from resolved candidates. Store-resolved\n * candidates (no local clone bytes) are fetched + SHA-verified into the\n * project store-cache first, then their entry points at the staged bytes so\n * the existing copy-deploy path works. Source-backed candidates keep the\n * clone-relative entry.\n */\n private async buildCatalogEntries(\n resolved: ProvenanceCandidate[],\n repositories: Record<string, SourceDeclaration>,\n ): Promise<CatalogEntry[]> {\n const staged = await this.stageStoreAssets(resolved, repositories);\n const entries: CatalogEntry[] = [];\n for (const c of resolved) {\n const stagedPath = staged.get(this.candidateKey(c));\n const entry = stagedPath\n ? this.stagedCandidateToEntry(c, stagedPath)\n : this.candidateToCatalogEntry(c, repositories);\n if (entry) entries.push(entry);\n }\n return entries;\n }\n\n /**\n * Fetch + SHA-verify the bytes of every store-resolved deployable candidate\n * into `.skaile/cache/store/`, reusing the same verified-fetch path the\n * pointer-only `library.install` uses (`installFromManifest` flat mode).\n *\n * @returns Map of candidate key → staged primary-manifest path.\n */\n private async stageStoreAssets(\n resolved: ProvenanceCandidate[],\n repositories: Record<string, SourceDeclaration>,\n ): Promise<Map<string, string>> {\n const staged = new Map<string, string>();\n let installFromManifest:\n | typeof import(\"@skaile/workspaces/library\").installFromManifest\n | undefined;\n\n for (const c of resolved) {\n if (NON_DEPLOYABLE_KINDS.has(c.kind)) continue;\n if (!c.files || c.files.length === 0 || !c.sourceUrl || !c.commit) continue;\n if (this.candidateHasLocalBytes(c, repositories)) continue;\n\n if (!installFromManifest) {\n ({ installFromManifest } = await import(\"@skaile/workspaces/library\"));\n }\n const targetDir = join(this.storeCacheDir, c.publisher, c.kind, c.name, c.version);\n // Per-file paths in c.files are attacker-controlled but validated by\n // installFromManifest before any fetch/write (rejects abs / `..`); this\n // outer guard only asserts the staging dir stays inside the cache root.\n const cacheRoot = resolve(this.storeCacheDir);\n if (!resolve(targetDir).startsWith(cacheRoot + sep)) {\n throw new Error(`unsafe store-cache path for ${this.candidateKey(c)}`);\n }\n const manifest: InstallManifest = {\n ref: `${c.kind}:@${c.publisher}/${c.name}#${c.version}`,\n source: { url: c.sourceUrl, commitSha: c.commit },\n files: c.files,\n sha256: c.sha256,\n kind: c.kind,\n // tier = catalog storage hint (S3/CDN); flat-mode verified fetch pulls\n // from source.url@commit and ignores it, so \"\" is inert.\n tier: \"\",\n };\n const { installPath } = await installFromManifest({\n manifest,\n libraryRoot: this.storeCacheDir,\n targetDir,\n fetcher: this.injectedAssetFetcher,\n });\n staged.set(this.candidateKey(c), join(installPath, this.stagedManifestRel(c)));\n }\n return staged;\n }\n\n /** Repo-relative path of a candidate's primary manifest (un-stripped). */\n private primaryManifestRel(c: ProvenanceCandidate): string | undefined {\n const paths = (c.files ?? []).map((f) => f.path);\n // Last resort: a kind with no manifest convention falls back to the first\n // file so deploy still has a concrete source rather than crashing.\n return matchManifestPath(c.kind, paths) ?? paths[0];\n }\n\n /**\n * The primary-manifest path relative to a staged asset dir. Takes the kind's\n * manifest (e.g. `SKILL.md`), then strips the same common-dir prefix\n * `installFromManifest` flat mode removed on write.\n */\n private stagedManifestRel(c: ProvenanceCandidate): string {\n const paths = (c.files ?? []).map((f) => f.path);\n const mdRel = this.primaryManifestRel(c) ?? \"\";\n const root = commonDirPrefix(paths);\n return root && mdRel.startsWith(`${root}/`) ? mdRel.slice(root.length + 1) : mdRel;\n }\n\n /**\n * `true` when a candidate's primary manifest is present on a local source\n * clone — its `sourceUrl` matches a registered source AND the manifest file\n * exists on disk at the expected path. A URL match alone is not enough: a\n * store can pin a different commit (or a subtree not bundled) of a repo that\n * is also a registered source, in which case the bytes must be fetched from\n * the store rather than read from the clone. (Only the primary manifest is\n * probed — a partially-cloned source is deployed as-is, matching the existing\n * clone-deploy path.)\n */\n private candidateHasLocalBytes(\n c: ProvenanceCandidate,\n repositories: Record<string, SourceDeclaration>,\n ): boolean {\n if (!c.sourceUrl) return false;\n const rel = this.primaryManifestRel(c);\n for (const [slug, decl] of Object.entries(repositories)) {\n if (decl.url === undefined || decl.url !== c.sourceUrl) continue;\n const dir = this.resolveRepoDir(decl, slug);\n if (!dir) continue;\n if (existsSync(rel ? join(dir, rel) : dir)) return true;\n }\n return false;\n }\n\n /** Build a copy-deploy catalog entry pointing at staged store bytes. */\n private stagedCandidateToEntry(c: ProvenanceCandidate, stagedManifestPath: string): CatalogEntry {\n const entry: CatalogEntry = {\n name: c.name,\n kind: c.kind as CatalogEntry[\"kind\"],\n description: c.description ?? \"\",\n source: stagedManifestPath,\n // Real publisher (never a clone slug) → deployAsset copies rather than\n // symlinking the ephemeral store-cache dir.\n publisher: c.publisher,\n version: c.version,\n requires: [],\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 * @param opts.link - When `true`, symlink local-path assets instead of copying them\n * (the author dev-loop). Machine-local / not for committing; a no-op for\n * store/factory sources. Defaults to copy.\n * @returns {@link InstallResult} summarising what was deployed, what was missing, and any collisions.\n */\n async install(opts?: { locked?: boolean; link?: 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 this.resolveWithStores(dependencies, {\n provenanceIndex,\n overrides,\n stores,\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 (fetching store bytes) and deploy.\n // Fan out to every target backend (one in project mode; the resolved\n // global set in `--global` mode) — same lock, one staged byte set.\n const entries = await this.buildCatalogEntries(resolved, repositories);\n const deployed = [\n ...new Set(\n this.targetBackends().flatMap((t) =>\n deployAll(entries, repositories, patches, this.deployOptsFor(t, opts?.link)),\n ),\n ),\n ];\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) => [sourceCacheKey(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 // Must match the canonical lock-key format from buildLockFile (core/lock.ts):\n // `<kind>:@<publisher>/<name>#<version>`. A different shape here made every\n // locked asset miss the set → wrongly \"removed\" (undeployed) then redeployed.\n const resolvedRefs = new Set(\n resolved.map((c) => `${c.kind}:@${c.publisher}/${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 for (const t of this.targetBackends()) removeAsset(kind, name, this.deployOptsFor(t));\n removed.push(ref);\n } else {\n // Surface the skip — an unparseable lock key means a stale asset can't\n // be reconciled away and would silently survive a remove-from-yaml.\n console.warn(`skaile: cannot reconcile unparseable lock key \"${ref}\" — left in place.`);\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 = sourceCacheKey(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 = sourceCacheKey(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 = sourceCacheKey(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 // Keep the publisher label slash-free (repo name), not the full cache key.\n publisher: sourceShortName(entry.source.url),\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 = [\n ...new Set(\n this.targetBackends().flatMap((t) =>\n deployAll(resolved, repositories, patches, this.deployOptsFor(t)),\n ),\n ),\n ];\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 * @param opts - Optional deploy options.\n * @param opts.link - When `true`, symlink local-path assets instead of copying them\n * (the author dev-loop). Machine-local / not for committing; a no-op for\n * store/factory sources. Defaults to copy.\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, opts?: { link?: boolean }): 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, overridesApplied } = await this.resolveWithStores([ref], {\n provenanceIndex,\n overrides,\n stores,\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 = await this.buildCatalogEntries(resolved, repositories);\n const deployed = [\n ...new Set(\n this.targetBackends().flatMap((t) =>\n deployAll(entries, repositories, patches, this.deployOptsFor(t, opts?.link)),\n ),\n ),\n ];\n\n // Add to skaile.yaml dependencies (canonical ref string). Global mode routes\n // this to the user-scope SSOT (`~/.skaile/skaile.yaml`).\n this.addDependencyToConfig(ref);\n\n // Keep the lock in sync — else a later remove-from-yaml + install has no\n // entry to diff against and the asset orphans. Merge (superset-write, never\n // drops existing entries or the plugins slice), not a full rewrite.\n const fresh = buildLockFile(resolved, overridesApplied);\n const prev = this.tryReadLock();\n if (prev) {\n const sources = new Map(prev.sources.map((s) => [s.url, s]));\n for (const s of fresh.sources) sources.set(s.url, s);\n writeLock(this.lockPath, {\n ...fresh,\n assets: { ...prev.assets, ...fresh.assets },\n sources: [...sources.values()].sort((a, b) => a.url.localeCompare(b.url)),\n // buildLockFile never emits a plugins slice — preserve the reconciler's.\n plugins: prev.plugins,\n });\n } else {\n writeLock(this.lockPath, fresh);\n }\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 * Report the body-link **soft dependencies** of the given assets that are not\n * already present in the project.\n *\n * Looks up each ref's persisted `softDeps` in the local index\n * (`~/.skaile/index.db`, populated by `skaile source sync`) and returns the\n * edges whose target is neither a declared dependency nor deployed on disk. It\n * does **not** install anything and never touches the resolver / lock /\n * reconcile path: callers surface the result as a hint, the user opts in with\n * a follow-up `skaile add`. Inspects exactly the passed `refs` — soft deps of\n * their transitively-deployed dependencies are not surfaced here.\n *\n * Opening the index runs its idempotent migrations, so this is not a pure\n * read — but it is **best-effort**: any failure (legacy/corrupt index, a\n * removed-backend guard) yields `[]`, so it can never fail a primary `add`\n * that already succeeded.\n *\n * @param refs - Asset refs to inspect (canonical, `kind:@pub/name`, or `kind:name`).\n * @returns One edge per absent soft-dep target (deduped by target). `toRef` is\n * the parseable `skaile add` ref, omitted when the target isn't in the index.\n */\n async reportSoftDeps(\n refs: string[],\n ): Promise<Array<{ from: string; to: string; toRef?: string }>> {\n if (refs.length === 0) return [];\n return this.withIndexDefs(\n (allDefs) => this.collectSoftDeps(allDefs, refs, true),\n [] as SoftDepEdge[],\n );\n }\n\n /**\n * All body-link soft dependencies of the given assets — present or not.\n *\n * Unlike {@link reportSoftDeps} (which filters to *absent* targets so it can\n * nudge a follow-up `skaile add`), this returns the asset's full inferred\n * soft-dep set for display surfaces (`skaile info` / `tree` / `why`). Read-only\n * and best-effort: any index failure yields `[]`. Targets are deduped.\n *\n * @param refs - Asset refs to inspect (canonical, `kind:@pub/name`, or `kind:name`).\n * @returns One {@link SoftDepEdge} per soft-dep target. `toRef` is the parseable\n * ref, omitted when the target isn't in the index.\n */\n async softDepsOf(refs: string[]): Promise<SoftDepEdge[]> {\n if (refs.length === 0) return [];\n return this.withIndexDefs((allDefs) => this.collectSoftDeps(allDefs, refs, false), []);\n }\n\n /**\n * Reverse lookup: refs (canonical ids) of cached assets whose persisted\n * `softDeps` include `targetRef`. Scans the whole index, not just present\n * assets. Read-only and best-effort (`[]` on any index failure).\n *\n * @param targetRef - Canonical soft-dep target ref (`<publisher>/<name>@<version>`).\n * @returns Def ids that declare `targetRef` as a soft dependency.\n */\n async softDepDependents(targetRef: string): Promise<string[]> {\n return this.withIndexDefs(\n (allDefs) => allDefs.filter((d) => d.softDeps?.includes(targetRef)).map((d) => d.id),\n [],\n );\n }\n\n /**\n * Compute which soft-dependency targets would be left **orphaned** by removing\n * `refs`: targets still present in the project that came in as one of `refs`'\n * soft dependencies and that **nothing else still needs** — neither another\n * present asset's soft-dep ({@link softDepDependents}) nor a typed `requires`.\n *\n * Pure read — never removes anything. The CLI / manage surfaces each result as\n * a prompt (default No) so the user opts in to an extra `skaile remove`. Safe to\n * call before or after the primary remove: assets being removed are excluded\n * from the \"needed by others\" scan, so a soft target referenced only by the\n * removed asset is still reported as an orphan.\n *\n * @param refs - Asset refs being removed (canonical, `kind:@pub/name`, or `kind:name`).\n * @returns One {@link OrphanedSoftDep} per orphaned target (deduped).\n */\n async orphanedSoftDepsAfterRemoving(refs: string[]): Promise<OrphanedSoftDep[]> {\n if (refs.length === 0) return [];\n return this.withIndexDefs((allDefs) => {\n const byId = new Map(allDefs.map((d) => [d.id, d]));\n const present = this.presentRefNames();\n\n // Bare names of the assets being removed — excluded from \"needed by others\".\n const removedNames = new Set<string>();\n for (const ref of refs) {\n for (const def of matchDefsForRef(allDefs, ref)) removedNames.add(def.name);\n try {\n removedNames.add(parseAssetRef(ref).name);\n } catch {}\n }\n\n // Names still needed by a *surviving* present asset (soft-dep or typed requires).\n const neededByOthers = new Set<string>();\n for (const presentRef of this.presentRefs()) {\n for (const def of matchDefsForRef(allDefs, presentRef)) {\n if (removedNames.has(def.name)) continue;\n for (const to of def.softDeps ?? []) neededByOthers.add(softDepName(to));\n // parseRequires keeps the `@pub/` scope on the name — normalize to the\n // same bare-name basis the present-check uses.\n for (const req of parseRequires(def.manifest)) neededByOthers.add(softDepName(req.name));\n }\n }\n\n // A present soft target is flagged even when directly declared in\n // skaile.yaml: with no install-provenance tracking we can't tell \"added for\n // the removed asset\" from \"wanted standalone\", so we report the fact (no\n // surviving referrer) and let the user decide — never auto-remove.\n const out: OrphanedSoftDep[] = [];\n const seen = new Set<string>();\n for (const ref of refs) {\n for (const def of matchDefsForRef(allDefs, ref)) {\n for (const to of def.softDeps ?? []) {\n const targetName = softDepName(to);\n if (!present.has(targetName)) continue; // not in the project — nothing to orphan\n if (removedNames.has(targetName)) continue; // also being removed\n if (neededByOthers.has(targetName)) continue; // something else still needs it\n if (seen.has(to)) continue;\n seen.add(to);\n const targetDef = byId.get(to);\n out.push({\n from: def.id,\n target: to,\n targetRef: targetDef ? depRefFromDef(targetDef) : undefined,\n });\n }\n }\n }\n return out;\n }, []);\n }\n\n /**\n * Open the local index, run `fn` against its cached asset defs, and close it.\n * Best-effort: no index (user never ran `source sync`), a missing file, or any\n * open/guard failure yields `fallback` — so a read surface can never throw or\n * create an empty `index.db` as a side effect.\n */\n private async withIndexDefs<T>(fn: (defs: AssetDefinition[]) => T, fallback: T): Promise<T> {\n try {\n const { LocalIndex, resolveIndexPath } = await import(\"@skaile/workspaces/library\");\n const indexPath = this.indexPathOverride ?? resolveIndexPath();\n if (!existsSync(indexPath)) return fallback;\n const index = new LocalIndex({ indexPath });\n try {\n return fn(await index.listAssetDefs());\n } finally {\n index.close();\n }\n } catch {\n return fallback;\n }\n }\n\n /**\n * Build soft-dep edges for `refs` from cached defs. With `onlyAbsent`, targets\n * already present in the project are skipped (the `reportSoftDeps` nudge); else\n * the full inferred set is returned (the `softDepsOf` display). Deduped by target.\n */\n private collectSoftDeps(\n allDefs: AssetDefinition[],\n refs: string[],\n onlyAbsent: boolean,\n ): SoftDepEdge[] {\n const present = onlyAbsent ? this.presentRefNames() : null;\n const byId = new Map(allDefs.map((d) => [d.id, d]));\n const out: SoftDepEdge[] = [];\n const seen = new Set<string>();\n for (const ref of refs) {\n for (const def of matchDefsForRef(allDefs, ref)) {\n for (const to of def.softDeps ?? []) {\n if (present?.has(softDepName(to))) continue;\n if (seen.has(to)) continue;\n seen.add(to);\n const targetDef = byId.get(to);\n out.push({ from: def.id, to, toRef: targetDef ? depRefFromDef(targetDef) : undefined });\n }\n }\n }\n return out;\n }\n\n /**\n * Names of assets already in the project — declared deps + deployed on disk.\n * Bare name only (see {@link softDepName}): a same-named asset of a different\n * publisher/kind counts as present, so the report under-reports rather than\n * nags about something already installed.\n */\n private presentRefNames(): Set<string> {\n const names = new Set<string>();\n for (const ref of this.presentRefs()) {\n try {\n names.add(parseAssetRef(ref).name);\n } catch {}\n }\n return names;\n }\n\n /**\n * Present asset refs — declared `skaile.yaml` deps (canonical refs as written)\n * plus deployed assets as `kind:name`. Used by the soft-dep present-check and\n * the orphan \"needed by others\" scan.\n */\n private presentRefs(): string[] {\n const refs: string[] = [];\n try {\n for (const ref of resolveSkWorkspaceConfig(this.projectDir).dependencies ?? [])\n refs.push(ref);\n } catch {}\n for (const e of this.listDeployed()) refs.push(`${e.kind}:${e.name}`);\n return refs;\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 // Undeploy from every target backend; \"found\" if any backend had it.\n let ok = false;\n for (const t of this.targetBackends()) {\n if (removeAsset(parsed.kind, parsed.name, this.deployOptsFor(t))) ok = true;\n }\n if (ok) {\n const depRef = `${parsed.kind}:${parsed.name}`;\n this.removeDependencyFromConfig(parsed);\n this.pruneLockEntry(parsed);\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 /**\n * Drop every lock entry matching a removed asset's identity, version-agnostic so\n * a content-sha pseudo-version key is pruned too. Symmetric with {@link add}'s\n * lock-merge — stops a stale entry reporting a phantom \"removed\" on next install.\n */\n private pruneLockEntry(parsed: { kind: string; name: string; publisher?: string }): void {\n const lock = this.tryReadLock();\n if (!lock) return;\n let changed = false;\n for (const key of Object.keys(lock.assets)) {\n const id = parseCanonicalLockKey(key);\n if (\n id.kind === parsed.kind &&\n id.name === parsed.name &&\n (!parsed.publisher || id.publisher === parsed.publisher)\n ) {\n delete lock.assets[key];\n changed = true;\n }\n }\n if (changed) writeLock(this.lockPath, lock);\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 * On-disk root + config slug for every declared (and the implicit factory)\n * source that has a local clone. Companion to {@link search}: callers that\n * need to relate a scanned entry back to its source root (e.g. to stamp\n * `DOMAIN.md`-derived domain grouping) can't recover the root from the flat\n * {@link CatalogEntry} list `search` returns.\n */\n searchRepoRoots(): { repoName: string; root: string }[] {\n const { repositories } = this.loadConfig();\n const out: { repoName: string; root: string }[] = [];\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = this.resolveRepoDir(decl, name);\n if (repoDir) out.push({ repoName: name, root: repoDir });\n }\n return out;\n }\n\n /**\n * Look up a single asset's full catalog entry.\n *\n * Accepts a bare `kind:name` ref (no publisher) in addition to the fully-qualified\n * `kind:@publisher/name` form — {@link listDeployed} emits publisher-less refs and\n * {@link doctor} passes them straight to this method.\n *\n * @param ref - Asset ref in `kind:name`, `kind:@publisher/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 = parseRefTolerant(ref);\n if (!parsed) return null;\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 * List the **declared** top-level dependencies from `skaile.yaml`, each tagged\n * with a reconciliation {@link DeclaredState}:\n *\n * - `declared` — in `skaile.yaml`, not yet resolved into the lock.\n * - `installed` — declared + locked, and (for deployable kinds) materialized on\n * disk. Non-deployable kinds ({@link NON_DEPLOYABLE_KINDS}) count as installed\n * once locked — they are wired at session start, never written to the target dir.\n * - `drift` — declared + locked but the deployed files are missing on disk.\n * - `invalid` — the `dependencies:` entry isn't a parseable canonical ref. Only\n * surfaced in the unfiltered listing (a `kind` filter can't classify it).\n *\n * Transitive (lock-only) deps are excluded by construction — only the declared\n * set is walked, so a lock entry with no matching `dependencies:` ref never shows.\n *\n * @param kind - Filter by asset kind. Omit to return all kinds.\n * @returns One {@link DeclaredAsset} per declared dep (after the optional kind filter).\n * @throws {MissingManifestError} when the project has no `skaile.yaml`.\n * @throws {Error} with a `migrate-skaile-manifest` hint on legacy `repositories:` / `ai_resources:` keys.\n */\n listDeclared(kind?: string): DeclaredAsset[] {\n if (!existsSync(join(this.projectDir, SKAILE_YAML_DEFAULT))) {\n throw new MissingManifestError(this.projectDir);\n }\n // resolveSkWorkspaceConfig runs the canonical normalizer (throws on legacy\n // keys) — used directly rather than loadConfig() to avoid the latter's\n // repositories-map build + getGlobalCacheDir() migration side effects on a read.\n const dependencies = resolveSkWorkspaceConfig(this.projectDir).dependencies ?? [];\n const lock = this.tryReadLock();\n const lockKeys = lock ? Object.keys(lock.assets).map(parseCanonicalLockKey) : [];\n\n const out: DeclaredAsset[] = [];\n for (const ref of dependencies) {\n let parsed: ReturnType<typeof parseAssetRef>;\n try {\n parsed = parseAssetRef(ref);\n } catch {\n // An unparseable ref has no kind to match a filter against; surface it\n // as `invalid` in the unfiltered listing rather than dropping it silently.\n if (!kind) out.push({ ref, kind: \"\", name: ref, state: \"invalid\" });\n continue;\n }\n if (kind && parsed.kind !== kind) continue;\n\n // A declared ref need not carry a publisher; match on kind+name and, when\n // present, the publisher — the lock key is always fully canonical.\n const locked = lockKeys.some(\n (k) =>\n k.kind === parsed.kind &&\n k.name === parsed.name &&\n (!parsed.publisher || k.publisher === parsed.publisher),\n );\n\n let state: DeclaredState;\n if (!locked) {\n state = \"declared\";\n } else if (NON_DEPLOYABLE_KINDS.has(parsed.kind)) {\n state = \"installed\";\n } else {\n const onDisk = isDeployed(\n parsed.kind as AiComponent,\n parsed.name,\n this.driverTarget,\n this.global,\n this.projectDir,\n );\n state = onDisk ? \"installed\" : \"drift\";\n }\n out.push({ ref, kind: parsed.kind, name: parsed.name, state });\n }\n return out;\n }\n\n /**\n * Per-backend reconciliation of the **global** declared deps\n * (`~/.skaile/skaile.yaml`) against each global backend's deploy dir. The\n * global twin of {@link listDeclared}: the same `declared` / `installed` /\n * `drift` / `invalid` vocabulary, but one row **per (ref, backend)** so an\n * asset can be `installed` for `claude-code` and `drift`/`declared` for\n * `codex` at once.\n *\n * Reads the SSOT + the global lock (`~/.skaile/skaile.lock.yaml`) — construct\n * the manager with `global: true`. Unlike `listDeclared`, a missing SSOT is\n * **not** an error: it yields an empty list (a fresh machine has no globals).\n *\n * @param opts.backend - Reconcile against this one backend only (the\n * `--backend` filter); omit for every backend in {@link targetBackends}.\n * @param opts.kind - Filter by asset kind.\n * @returns One {@link BackendDeclaredAsset} per declared dep × backend.\n * @throws {Error} on legacy keys in `~/.skaile/skaile.yaml` (migration hint).\n */\n globalState(opts?: { backend?: DriverTarget; kind?: string }): BackendDeclaredAsset[] {\n const dependencies = resolveGlobalSkWorkspaceConfig().dependencies ?? [];\n const lock = this.tryReadLock();\n const lockKeys = lock ? Object.keys(lock.assets).map(parseCanonicalLockKey) : [];\n const backends = opts?.backend ? [opts.backend] : this.targetBackends();\n\n const out: BackendDeclaredAsset[] = [];\n for (const ref of dependencies) {\n let parsed: ReturnType<typeof parseAssetRef>;\n try {\n parsed = parseAssetRef(ref);\n } catch {\n if (!opts?.kind) {\n for (const backend of backends)\n out.push({ ref, kind: \"\", name: ref, state: \"invalid\", backend });\n }\n continue;\n }\n if (opts?.kind && parsed.kind !== opts.kind) continue;\n\n const locked = lockKeys.some(\n (k) =>\n k.kind === parsed.kind &&\n k.name === parsed.name &&\n (!parsed.publisher || k.publisher === parsed.publisher),\n );\n\n for (const backend of backends) {\n let state: DeclaredState;\n if (!locked) {\n state = \"declared\";\n } else if (NON_DEPLOYABLE_KINDS.has(parsed.kind)) {\n state = \"installed\";\n } else {\n const onDisk = isDeployed(parsed.kind as AiComponent, parsed.name, backend, true);\n state = onDisk ? \"installed\" : \"drift\";\n }\n out.push({ ref, kind: parsed.kind, name: parsed.name, state, backend });\n }\n }\n return out;\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 ? sourceCacheKey(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 // Exact lock-key hit, else a version-agnostic match on the `kind:@pub/name`\n // prefix — the lock can pin a content-sha pseudo-version, so a bare\n // `kind:@pub/name` ref would otherwise never find its locked entry.\n const bare = (s: string) => (s.includes(\"#\") ? s.slice(0, s.indexOf(\"#\")) : s);\n const key = lock.assets[ref]\n ? ref\n : Object.keys(lock.assets).find((k) => bare(k) === bare(ref));\n if (!key) 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 [key, \"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 = sourceCacheKey(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 ?? sourceShortName(src.url),\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 this.resolveWithStores(dependencies, {\n provenanceIndex,\n overrides,\n stores,\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/cache/sources/`, and `skaile.lock.yaml` — effectively resetting the\n * workspace 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/, cache/sources/, 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 /**\n * Add a dependency ref to the manifest `dependencies:` if not already present.\n * Project mode edits `<projectDir>/skaile.yaml`; global mode edits the\n * user-scope SSOT `~/.skaile/skaile.yaml`, **bootstrapping** the file (and its\n * parent dir) when absent so `skaile add --global` works on a fresh machine.\n */\n private addDependencyToConfig(ref: string): void {\n const configPath = join(this.stateRoot, \"skaile.yaml\");\n if (!existsSync(configPath)) {\n if (!this.global) return; // project mode never bootstraps a manifest\n mkdirSync(this.stateRoot, { recursive: true });\n writeFileSync(configPath, stringifyYaml({ dependencies: [ref] }, { lineWidth: 120 }));\n return;\n }\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 /**\n * Remove a dependency ref from the manifest `dependencies:`. Targets the same\n * file as {@link addDependencyToConfig} (`~/.skaile/skaile.yaml` in global mode).\n */\n private removeDependencyFromConfig(target: {\n kind: string;\n name: string;\n publisher?: string;\n }): void {\n const configPath = join(this.stateRoot, \"skaile.yaml\");\n if (!existsSync(configPath)) return;\n const raw = parseYaml(readFileSync(configPath, \"utf8\")) ?? {};\n if (!Array.isArray(raw.dependencies)) return;\n // Match by parsed identity, not by an exact string: `add` stores deps\n // publisher-qualified (`skill:@pub/name`) while a remove caller only knows\n // `kind:name`, so an `indexOf` of the bare key never matched. When both\n // sides carry a publisher they must agree; otherwise fall back to kind+name.\n const wantPub = target.publisher?.replace(/^@/, \"\");\n const idx = raw.dependencies.findIndex((dep: unknown) => {\n if (typeof dep !== \"string\") return false;\n const p = parseRefLoose(dep);\n if (!p || p.kind !== target.kind || p.name !== target.name) return false;\n const havePub = p.publisher?.replace(/^@/, \"\");\n return wantPub === undefined || havePub === undefined || havePub === wantPub;\n });\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 +0,0 @@
1
- {"version":3,"sources":["../cli/src/ensure-sources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,gBAAgB,GAAA,EAAqB;AAC5C,EAAA,OAAY,IAAA,CAAA,IAAA,CAAK,iBAAA,EAAkB,EAAG,GAAG,CAAA;AAC3C;AASA,SAAS,kBAAA,CAAmB,UAAkB,KAAA,EAAsC;AAClF,EAAA,IAAI;AACF,IAAA,OAAO,mBAAA,CAAoB,IAAA,CAAK,QAAQ,CAAA,CAAE,UAAA,EAAW;AAAA,EACvD,SAAS,GAAA,EAAK;AACZ,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,MAAA,CAAO,CAAA,eAAA,EAAkB,QAAQ,CAAA,EAAA,EAAK,GAAA,YAAe,KAAA,GAAQ,IAAI,OAAA,GAAU,MAAA,CAAO,GAAG,CAAC,CAAA,CAAE,CAAA;AAAA,IAC1F;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAMA,SAAS,kBAAA,CAAmB,KAAA,EAAoB,KAAA,EAAgB,MAAA,EAA4B;AAC1F,EAAA,MAAM,GAAA,GAAM,cAAA,CAAe,KAAA,CAAM,GAAG,CAAA;AACpC,EAAA,MAAM,IAAA,GAAO,eAAA,CAAgB,KAAA,CAAM,GAAG,CAAA;AACtC,EAAA,MAAM,IAAA,GAAO,gBAAgB,GAAG,CAAA;AAChC,EAAA,IAAI,UAAA,CAAW,IAAI,CAAA,EAAG;AACpB,IAAA,MAAA,CAAO,MAAA,CAAO,KAAK,IAAI,CAAA;AACvB,IAAA;AAAA,EACF;AACA,EAAA,SAAA,CAAe,aAAQ,IAAI,CAAA,EAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AACjD,EAAA,MAAM,IAAA,GAAO,CAAC,OA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EAAA,MAAM,KAAA,GAAQ,KAAK,KAAA,IAAS,KAAA;AAC5B,EAAA,MAAM,OAAA,GAAU,kBAAA,CAAmB,QAAA,EAAU,KAAK,CAAA;AAClD,EAAA,IAAI,OAAA,KAAY,MAAM,OAAO,MAAA;AAC7B,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,MAAA;AAEjC,EAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,IAAA,kBAAA,CAAmB,KAAA,EAAO,OAAO,MAAM,CAAA;AAAA,EACzC;AAEA,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,iBAAA,CAAkB,MAAM,CAAA;AAAA,EAC1B;AAEA,EAAA,OAAO,MAAA;AACT","file":"ensure-sources-CHC7X7AJ.js","sourcesContent":["/**\n * ensure-sources.ts — hydrate the `~/.skaile/cache/sources/` clone cache from a\n * project's `skaile.yaml` `sources:` entries.\n *\n * Called by `skaile init` (idempotent: no-op when no sources declared) and\n * `skaile install` so checking out a project pulls its source clones onto\n * the local machine.\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, mkdirSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport {\n getGlobalCacheDir,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n WorkspaceYamlEditor,\n} from \"@skaile/workspaces/core\";\nimport { logErr, logInfo, logOk } from \"./helpers.ts\";\n\nfunction sourceClonePath(key: string): string {\n return path.join(getGlobalCacheDir(), key);\n}\n\nexport interface EnsureResult {\n cloned: string[];\n cached: string[];\n failed: string[];\n}\n\n/** Load `sources:` from a project's `skaile.yaml`, or `null` when unavailable. */\nfunction loadProjectSources(yamlPath: string, quiet: boolean): SourceEntry[] | null {\n try {\n return WorkspaceYamlEditor.load(yamlPath).getSources();\n } catch (err) {\n if (!quiet) {\n logErr(`Could not read ${yamlPath}: ${err instanceof Error ? err.message : String(err)}`);\n }\n return null;\n }\n}\n\n/**\n * Hydrate a single source entry into `result`: skip when already cached,\n * otherwise clone and record success/failure. Mutates `result` in place.\n */\nfunction hydrateSourceEntry(entry: SourceEntry, quiet: boolean, result: EnsureResult): void {\n const key = sourceCacheKey(entry.url);\n const slug = sourceShortName(entry.url);\n const dest = sourceClonePath(key);\n if (existsSync(dest)) {\n result.cached.push(slug);\n return;\n }\n mkdirSync(path.dirname(dest), { recursive: true });\n const args = [\"clone\", entry.url, dest];\n if (entry.pin) args.splice(1, 0, \"--branch\", entry.pin);\n const clone = spawnSync(\"git\", args, { stdio: quiet ? \"pipe\" : \"inherit\" });\n if (clone.status !== 0) {\n result.failed.push(slug);\n if (quiet) {\n logErr(`git clone failed for ${entry.url}`);\n }\n return;\n }\n result.cloned.push(slug);\n}\n\n/** Log a full-hydrate summary of cloned + reused-cached entries. */\nfunction logHydrateSummary(result: EnsureResult): void {\n for (const n of result.cloned) logOk(`Cloned source \"${n}\".`);\n if (result.cached.length > 0) {\n logInfo(`Reused cached clones: ${result.cached.join(\", \")}`);\n }\n}\n\n/**\n * Walk `projectDir/skaile.yaml` `sources:` and clone any entries whose\n * clone directory does not yet exist under `~/.skaile/cache/sources/`. Existing\n * clones are left untouched — this is hydration, not sync.\n *\n * Quiet by default: when `quiet: true` the helper only prints failures.\n * On full hydrate (`quiet: false`) it logs each cloned/cached entry.\n */\nexport function ensureSourcesCloned(\n projectDir: string,\n opts: { quiet?: boolean } = {},\n): EnsureResult {\n const result: EnsureResult = { cloned: [], cached: [], failed: [] };\n const yamlPath = path.join(projectDir, \"skaile.yaml\");\n if (!existsSync(yamlPath)) return result;\n\n const quiet = opts.quiet ?? false;\n const sources = loadProjectSources(yamlPath, quiet);\n if (sources === null) return result;\n if (sources.length === 0) return result;\n\n for (const entry of sources) {\n hydrateSourceEntry(entry, quiet, result);\n }\n\n if (!quiet) {\n logHydrateSummary(result);\n }\n\n return result;\n}\n"]}
@@ -1,30 +0,0 @@
1
- export { autoSyncForSearch, findCacheKeyCollision, indexingHadFailures, legacySourceConfigHint, makeSourceCommand, normalizeSourceUrl, sourceClonePath, sourceMatchesKey, syncProjectSources } from './chunk-QM2TT2PJ.js';
2
- import './chunk-77OXU44H.js';
3
- import './chunk-DNFIKRO6.js';
4
- import './chunk-HWTQ6HPO.js';
5
- import './chunk-B6SSXVF2.js';
6
- import './chunk-JXT46QFC.js';
7
- import './chunk-UKJMQZV6.js';
8
- import './chunk-R7FOF242.js';
9
- import './chunk-4N5XR5DQ.js';
10
- import './chunk-X57AMTAH.js';
11
- import './chunk-LCTRCWBK.js';
12
- import './chunk-CGYEHQOX.js';
13
- import './chunk-26YCXWCU.js';
14
- import './chunk-ZAP2BDHG.js';
15
- import './chunk-TJRWGMD2.js';
16
- import './chunk-OUWNTFDG.js';
17
- import './chunk-DZCK7GRW.js';
18
- import './chunk-BQCGFPHW.js';
19
- import './chunk-GEEW6SY2.js';
20
- import './chunk-F3HNW354.js';
21
- import './chunk-MENCWIHW.js';
22
- import './chunk-K5GBV4SA.js';
23
- import './chunk-JB35MVBN.js';
24
- import './chunk-KTBKW2FI.js';
25
- import './chunk-UQ6LFBPZ.js';
26
- import './chunk-IEX5YV4R.js';
27
- import './chunk-IRORTHGA.js';
28
- import './chunk-NSBPE2FW.js';
29
- //# sourceMappingURL=source-RXAHIGMD.js.map
30
- //# sourceMappingURL=source-RXAHIGMD.js.map
@@ -1,15 +0,0 @@
1
- export { clearStoreTokens, getStoreConfig, isStoreAuthenticated, saveStoreTokens, storeFetch } from './chunk-BJHZHNKR.js';
2
- import './chunk-26YCXWCU.js';
3
- import './chunk-ZAP2BDHG.js';
4
- import './chunk-TJRWGMD2.js';
5
- import './chunk-OUWNTFDG.js';
6
- import './chunk-DZCK7GRW.js';
7
- import './chunk-BQCGFPHW.js';
8
- import './chunk-GEEW6SY2.js';
9
- import './chunk-F3HNW354.js';
10
- import './chunk-MENCWIHW.js';
11
- import './chunk-K5GBV4SA.js';
12
- import './chunk-JB35MVBN.js';
13
- import './chunk-NSBPE2FW.js';
14
- //# sourceMappingURL=store-client-T3F663YG.js.map
15
- //# sourceMappingURL=store-client-T3F663YG.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"store-client-T3F663YG.js"}