@skaile/workspaces 5.9.0 → 5.10.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 (296) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/dist/{asset-feeds-XMKKUUK6.js → asset-feeds-ELEBTNUS.js} +18 -18
  3. package/dist/{asset-feeds-XMKKUUK6.js.map → asset-feeds-ELEBTNUS.js.map} +1 -1
  4. package/dist/asset-manager/catalog-deployer.js +8 -8
  5. package/dist/asset-manager/index.js +14 -14
  6. package/dist/asset-manager/installer.js +10 -10
  7. package/dist/asset-manager/renderers.js +9 -9
  8. package/dist/asset-manager/src/index.d.ts +300 -36
  9. package/dist/asset-manager/src/index.d.ts.map +1 -1
  10. package/dist/asset-manager/src/install-agent.d.ts +3 -1
  11. package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
  12. package/dist/asset-manager/src/install-instances.d.ts +31 -1
  13. package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
  14. package/dist/asset-manager/src/installer.d.ts +20 -0
  15. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  16. package/dist/asset-manager/src/renderers.d.ts +4 -5
  17. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  18. package/dist/bridge/drivers/claude-sdk.js +11 -11
  19. package/dist/bridge/drivers/codex.js +11 -11
  20. package/dist/bridge/drivers/continue.js +10 -10
  21. package/dist/bridge/drivers/echo.js +2 -2
  22. package/dist/bridge/drivers/gemini.js +7 -7
  23. package/dist/bridge/drivers/goose.js +10 -10
  24. package/dist/bridge/drivers/omp.js +3 -3
  25. package/dist/bridge/drivers/opencode.js +10 -10
  26. package/dist/bridge/drivers/qwen.js +7 -7
  27. package/dist/bridge/index.js +12 -12
  28. package/dist/{chunk-36AFURKZ.js → chunk-2FMEGSBN.js} +38 -11
  29. package/dist/chunk-2FMEGSBN.js.map +1 -0
  30. package/dist/{chunk-IMKSM5NL.js → chunk-2JMLDZLP.js} +1069 -182
  31. package/dist/chunk-2JMLDZLP.js.map +1 -0
  32. package/dist/{chunk-B6GIW55K.js → chunk-32XKCNCL.js} +6 -3
  33. package/dist/chunk-32XKCNCL.js.map +1 -0
  34. package/dist/{chunk-4MQS7CAF.js → chunk-3BEY4WK3.js} +371 -175
  35. package/dist/chunk-3BEY4WK3.js.map +1 -0
  36. package/dist/{chunk-FYXZRVID.js → chunk-3KHYGOEY.js} +3 -3
  37. package/dist/{chunk-FYXZRVID.js.map → chunk-3KHYGOEY.js.map} +1 -1
  38. package/dist/{chunk-CGT45WN7.js → chunk-3MKPZZRE.js} +3 -3
  39. package/dist/{chunk-CGT45WN7.js.map → chunk-3MKPZZRE.js.map} +1 -1
  40. package/dist/{chunk-QVNRCDTV.js → chunk-4OV5DSBB.js} +4 -4
  41. package/dist/chunk-4OV5DSBB.js.map +1 -0
  42. package/dist/{chunk-GKMZ6THE.js → chunk-4P3KTUZH.js} +33 -33
  43. package/dist/chunk-4P3KTUZH.js.map +1 -0
  44. package/dist/{chunk-ZTBAYUDY.js → chunk-5QI2JYJC.js} +2 -2
  45. package/dist/{chunk-ZTBAYUDY.js.map → chunk-5QI2JYJC.js.map} +1 -1
  46. package/dist/{chunk-EF7NPDDU.js → chunk-6HHE63CO.js} +31 -17
  47. package/dist/chunk-6HHE63CO.js.map +1 -0
  48. package/dist/{chunk-TTRYE6AC.js → chunk-7CR6HT2X.js} +8 -8
  49. package/dist/{chunk-TTRYE6AC.js.map → chunk-7CR6HT2X.js.map} +1 -1
  50. package/dist/{chunk-FZNG4V4J.js → chunk-7I5VRVDP.js} +3 -3
  51. package/dist/{chunk-FZNG4V4J.js.map → chunk-7I5VRVDP.js.map} +1 -1
  52. package/dist/{chunk-P67WJVP4.js → chunk-CLTHEKHR.js} +10 -9
  53. package/dist/chunk-CLTHEKHR.js.map +1 -0
  54. package/dist/{chunk-UMVKJM4Q.js → chunk-DALV4HHP.js} +18 -3
  55. package/dist/chunk-DALV4HHP.js.map +1 -0
  56. package/dist/{chunk-IR33D6EP.js → chunk-FRPBSUFH.js} +5 -5
  57. package/dist/{chunk-IR33D6EP.js.map → chunk-FRPBSUFH.js.map} +1 -1
  58. package/dist/{chunk-W5DWWE4Y.js → chunk-G54USEUP.js} +4 -4
  59. package/dist/{chunk-W5DWWE4Y.js.map → chunk-G54USEUP.js.map} +1 -1
  60. package/dist/{chunk-Y7QA2OLD.js → chunk-GEWAIQZ5.js} +24 -20
  61. package/dist/chunk-GEWAIQZ5.js.map +1 -0
  62. package/dist/{chunk-GB7WDMH2.js → chunk-GFCXNFTW.js} +4 -4
  63. package/dist/{chunk-GB7WDMH2.js.map → chunk-GFCXNFTW.js.map} +1 -1
  64. package/dist/{chunk-5NNNV76P.js → chunk-HJ5MCB3L.js} +2 -2
  65. package/dist/{chunk-5NNNV76P.js.map → chunk-HJ5MCB3L.js.map} +1 -1
  66. package/dist/{chunk-2LWYNQK7.js → chunk-HOHUEKES.js} +3 -3
  67. package/dist/{chunk-2LWYNQK7.js.map → chunk-HOHUEKES.js.map} +1 -1
  68. package/dist/{chunk-UM7RIAHO.js → chunk-IJHH4DSW.js} +8 -8
  69. package/dist/{chunk-UM7RIAHO.js.map → chunk-IJHH4DSW.js.map} +1 -1
  70. package/dist/{chunk-BTE2V4IW.js → chunk-IXWODEED.js} +40 -7
  71. package/dist/chunk-IXWODEED.js.map +1 -0
  72. package/dist/{chunk-K3CVFRVS.js → chunk-JFXQEVLF.js} +3 -3
  73. package/dist/{chunk-K3CVFRVS.js.map → chunk-JFXQEVLF.js.map} +1 -1
  74. package/dist/{chunk-JAKOMFC6.js → chunk-JZCSNEHK.js} +77 -31
  75. package/dist/chunk-JZCSNEHK.js.map +1 -0
  76. package/dist/{chunk-CKQEIY43.js → chunk-MVQ3Q2HM.js} +4 -4
  77. package/dist/{chunk-CKQEIY43.js.map → chunk-MVQ3Q2HM.js.map} +1 -1
  78. package/dist/{chunk-LAMCXQGA.js → chunk-NRDSGLCQ.js} +31 -24
  79. package/dist/chunk-NRDSGLCQ.js.map +1 -0
  80. package/dist/{chunk-V2DXZYBB.js → chunk-NWDSLXOX.js} +3 -3
  81. package/dist/{chunk-V2DXZYBB.js.map → chunk-NWDSLXOX.js.map} +1 -1
  82. package/dist/{chunk-MR5HBOUF.js → chunk-OBVJ7RPW.js} +3 -3
  83. package/dist/{chunk-MR5HBOUF.js.map → chunk-OBVJ7RPW.js.map} +1 -1
  84. package/dist/{chunk-J7U3PIOE.js → chunk-OOWHXOK6.js} +4 -4
  85. package/dist/{chunk-J7U3PIOE.js.map → chunk-OOWHXOK6.js.map} +1 -1
  86. package/dist/{chunk-YSHVQGUS.js → chunk-PE36IF2D.js} +119 -30
  87. package/dist/chunk-PE36IF2D.js.map +1 -0
  88. package/dist/{chunk-S53LOR7B.js → chunk-QG3HOJEK.js} +3 -3
  89. package/dist/{chunk-S53LOR7B.js.map → chunk-QG3HOJEK.js.map} +1 -1
  90. package/dist/{chunk-2FRUUDZY.js → chunk-SBFW3CJH.js} +5 -5
  91. package/dist/{chunk-2FRUUDZY.js.map → chunk-SBFW3CJH.js.map} +1 -1
  92. package/dist/{chunk-UAROCOXF.js → chunk-SX5U422E.js} +3 -3
  93. package/dist/{chunk-UAROCOXF.js.map → chunk-SX5U422E.js.map} +1 -1
  94. package/dist/{chunk-QVEKLSEH.js → chunk-TH4CTXHX.js} +6 -6
  95. package/dist/{chunk-QVEKLSEH.js.map → chunk-TH4CTXHX.js.map} +1 -1
  96. package/dist/{chunk-JZ5EHBPI.js → chunk-TRSQP3JD.js} +3 -3
  97. package/dist/{chunk-JZ5EHBPI.js.map → chunk-TRSQP3JD.js.map} +1 -1
  98. package/dist/{chunk-FVJK4QWM.js → chunk-V5TZH4GF.js} +4 -4
  99. package/dist/{chunk-FVJK4QWM.js.map → chunk-V5TZH4GF.js.map} +1 -1
  100. package/dist/{chunk-GXLQLPE5.js → chunk-V7PQZOBR.js} +5 -5
  101. package/dist/{chunk-GXLQLPE5.js.map → chunk-V7PQZOBR.js.map} +1 -1
  102. package/dist/{chunk-DNZYOKOJ.js → chunk-VLXDXRRX.js} +3 -3
  103. package/dist/{chunk-DNZYOKOJ.js.map → chunk-VLXDXRRX.js.map} +1 -1
  104. package/dist/{chunk-Y4N2NUZD.js → chunk-WBYDAL6X.js} +4 -4
  105. package/dist/{chunk-Y4N2NUZD.js.map → chunk-WBYDAL6X.js.map} +1 -1
  106. package/dist/{chunk-SCOT677Q.js → chunk-XCNK4UE5.js} +5 -5
  107. package/dist/{chunk-SCOT677Q.js.map → chunk-XCNK4UE5.js.map} +1 -1
  108. package/dist/{chunk-GTILM2CI.js → chunk-Y34MSWEZ.js} +43 -12
  109. package/dist/chunk-Y34MSWEZ.js.map +1 -0
  110. package/dist/{chunk-4PTSR4UU.js → chunk-Y63UQZ7P.js} +3 -3
  111. package/dist/{chunk-4PTSR4UU.js.map → chunk-Y63UQZ7P.js.map} +1 -1
  112. package/dist/chunk-YBQONMH2.js +465 -0
  113. package/dist/chunk-YBQONMH2.js.map +1 -0
  114. package/dist/{chunk-7AI3Q5AQ.js → chunk-Z2K6BGUR.js} +71 -24
  115. package/dist/chunk-Z2K6BGUR.js.map +1 -0
  116. package/dist/{chunk-UO7WPLDY.js → chunk-ZGQTS3Y4.js} +3 -3
  117. package/dist/{chunk-UO7WPLDY.js.map → chunk-ZGQTS3Y4.js.map} +1 -1
  118. package/dist/cli/index.js +910 -717
  119. package/dist/cli/index.js.map +1 -1
  120. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  121. package/dist/cli/src/commands/catalog.d.ts +8 -5
  122. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  123. package/dist/cli/src/commands/diff.d.ts +3 -1
  124. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  125. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  126. package/dist/cli/src/commands/library-index.d.ts +34 -2
  127. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  128. package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
  129. package/dist/cli/src/commands/manage.d.ts +6 -5
  130. package/dist/cli/src/commands/manage.d.ts.map +1 -1
  131. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
  132. package/dist/cli/src/commands/outdated.d.ts +7 -5
  133. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  134. package/dist/cli/src/commands/project.d.ts +11 -8
  135. package/dist/cli/src/commands/project.d.ts.map +1 -1
  136. package/dist/cli/src/commands/source.d.ts +30 -1
  137. package/dist/cli/src/commands/source.d.ts.map +1 -1
  138. package/dist/cli/src/commands/update.d.ts.map +1 -1
  139. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  140. package/dist/cli/src/commands/why.d.ts.map +1 -1
  141. package/dist/cli/src/skill-checks.d.ts +47 -2
  142. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  143. package/dist/connectors/config.js +5 -5
  144. package/dist/connectors/index.js +15 -15
  145. package/dist/{connectors-C7UQ73BK.js → connectors-OXP2JBGI.js} +18 -18
  146. package/dist/{connectors-C7UQ73BK.js.map → connectors-OXP2JBGI.js.map} +1 -1
  147. package/dist/core/index.js +7 -7
  148. package/dist/core/logging.js +1 -1
  149. package/dist/core/manifest.js +2 -2
  150. package/dist/core/models.js +1 -1
  151. package/dist/core/publish-manifest.js +2 -2
  152. package/dist/core/ref.js +1 -1
  153. package/dist/core/runtime-assets.js +5 -5
  154. package/dist/core/src/index.d.ts +2 -1
  155. package/dist/core/src/index.d.ts.map +1 -1
  156. package/dist/core/src/lock.d.ts +5 -2
  157. package/dist/core/src/lock.d.ts.map +1 -1
  158. package/dist/core/src/logging/sinks/sqlite-runtime.d.ts.map +1 -1
  159. package/dist/core/src/manifest.d.ts.map +1 -1
  160. package/dist/core/src/models.d.ts +21 -5
  161. package/dist/core/src/models.d.ts.map +1 -1
  162. package/dist/core/src/publish-manifest.d.ts +19 -3
  163. package/dist/core/src/publish-manifest.d.ts.map +1 -1
  164. package/dist/core/src/repo-manager.d.ts.map +1 -1
  165. package/dist/core/src/requirements.d.ts +26 -0
  166. package/dist/core/src/requirements.d.ts.map +1 -0
  167. package/dist/core/src/walker.d.ts.map +1 -1
  168. package/dist/core/src/workspace-config.d.ts +18 -0
  169. package/dist/core/src/workspace-config.d.ts.map +1 -1
  170. package/dist/core/src/workspace-yaml-editor.d.ts +4 -1
  171. package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
  172. package/dist/core/workspace-config.js +4 -4
  173. package/dist/deploy/index.js +7 -7
  174. package/dist/discovery/index.js +5 -5
  175. package/dist/discovery/src/builtin-providers.d.ts.map +1 -1
  176. package/dist/discovery/src/discover-manifest.d.ts.map +1 -1
  177. package/dist/discovery/src/discover.d.ts.map +1 -1
  178. package/dist/discovery/src/source-config.d.ts.map +1 -1
  179. package/dist/discovery/src/tree-entries.d.ts.map +1 -1
  180. package/dist/{ensure-sources-SRC2DVR5.js → ensure-sources-5ISVIA4T.js} +17 -17
  181. package/dist/{ensure-sources-SRC2DVR5.js.map → ensure-sources-5ISVIA4T.js.map} +1 -1
  182. package/dist/factory-assets/connectors/box.js +15 -15
  183. package/dist/factory-assets/connectors/deploy.js +15 -15
  184. package/dist/factory-assets/connectors/devserver.js +15 -15
  185. package/dist/factory-assets/connectors/flow/adapter.js +15 -15
  186. package/dist/factory-assets/connectors/flow/engine.js +8 -8
  187. package/dist/factory-assets/connectors/flow/run-flow.js +17 -17
  188. package/dist/factory-assets/connectors/flow.js +15 -15
  189. package/dist/factory-assets/connectors/git.js +15 -15
  190. package/dist/factory-assets/connectors/gmail.js +15 -15
  191. package/dist/factory-assets/connectors/googledrive.js +15 -15
  192. package/dist/factory-assets/connectors/local.js +15 -15
  193. package/dist/factory-assets/connectors/mattermost.js +15 -15
  194. package/dist/factory-assets/connectors/memory.js +15 -15
  195. package/dist/factory-assets/connectors/minio.js +15 -15
  196. package/dist/factory-assets/connectors/postgres.js +15 -15
  197. package/dist/factory-assets/connectors/s3.js +15 -15
  198. package/dist/factory-assets/connectors/sharepoint.js +15 -15
  199. package/dist/factory-assets/connectors/sqlite.js +15 -15
  200. package/dist/factory-assets/connectors/static-server.js +15 -15
  201. package/dist/factory-assets/connectors/tunnel.js +15 -15
  202. package/dist/factory-assets/connectors/webdav.js +15 -15
  203. package/dist/factory-assets/connectors/xstate-store.js +15 -15
  204. package/dist/factory-assets/connectors/xstate.js +15 -15
  205. package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +9 -3
  206. package/dist/{flows-CBYRSAGS.js → flows-HMSE76PO.js} +12 -12
  207. package/dist/{flows-CBYRSAGS.js.map → flows-HMSE76PO.js.map} +1 -1
  208. package/dist/{helpers-XAEKCZKT.js → helpers-X6URBGSF.js} +17 -17
  209. package/dist/{helpers-XAEKCZKT.js.map → helpers-X6URBGSF.js.map} +1 -1
  210. package/dist/library/index.js +11 -11
  211. package/dist/library/install.js +3 -3
  212. package/dist/library/src/index.d.ts +2 -1
  213. package/dist/library/src/index.d.ts.map +1 -1
  214. package/dist/library/src/local/library-dir.d.ts +42 -0
  215. package/dist/library/src/local/library-dir.d.ts.map +1 -0
  216. package/dist/library/src/local/library-manager.d.ts +10 -1
  217. package/dist/library/src/local/library-manager.d.ts.map +1 -1
  218. package/dist/library/src/local/library.d.ts +2 -2
  219. package/dist/library/src/local/library.d.ts.map +1 -1
  220. package/dist/library/src/local/local-catalog-source.d.ts +9 -0
  221. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  222. package/dist/library/src/manifest-writer.d.ts +55 -4
  223. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  224. package/dist/library/src/remote/cache.d.ts +18 -1
  225. package/dist/library/src/remote/cache.d.ts.map +1 -1
  226. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  227. package/dist/library/src/remote/rest-catalog-source.d.ts.map +1 -1
  228. package/dist/library/src/sync/git-driver.d.ts +5 -6
  229. package/dist/library/src/sync/git-driver.d.ts.map +1 -1
  230. package/dist/{library-publish-VJSWMOLH.js → library-publish-OS3JDW4S.js} +123 -41
  231. package/dist/library-publish-OS3JDW4S.js.map +1 -0
  232. package/dist/open-library-4QSUORI6.js +40 -0
  233. package/dist/{open-library-DB2PNL2X.js.map → open-library-4QSUORI6.js.map} +1 -1
  234. package/dist/open-registry-VCKS3MP5.js +32 -0
  235. package/dist/{open-registry-ZUZJ7MS7.js.map → open-registry-VCKS3MP5.js.map} +1 -1
  236. package/dist/paths-BVO56A25.js +22 -0
  237. package/dist/{paths-FQ64OLJG.js.map → paths-BVO56A25.js.map} +1 -1
  238. package/dist/{plugin-store-MPAMD5OT.js → plugin-store-X7GPWGBG.js} +9 -9
  239. package/dist/{plugin-store-MPAMD5OT.js.map → plugin-store-X7GPWGBG.js.map} +1 -1
  240. package/dist/{project-I6NX3NFB.js → project-PAXP46RD.js} +20 -20
  241. package/dist/{project-I6NX3NFB.js.map → project-PAXP46RD.js.map} +1 -1
  242. package/dist/resolver/index.js +8 -8
  243. package/dist/runner/index.js +29 -29
  244. package/dist/runner/src/agent.d.ts.map +1 -1
  245. package/dist/sdk/asset-manager.js +14 -14
  246. package/dist/sdk/bridge.js +12 -12
  247. package/dist/sdk/core.js +7 -7
  248. package/dist/sdk/flow.js +8 -8
  249. package/dist/sdk/index.js +29 -29
  250. package/dist/sdk/resolver.js +8 -8
  251. package/dist/sdk/runner.js +29 -29
  252. package/dist/{setup-B7JUHYJW.js → setup-BV55VHWC.js} +22 -22
  253. package/dist/{setup-B7JUHYJW.js.map → setup-BV55VHWC.js.map} +1 -1
  254. package/dist/{skills-TVO26Y4V.js → skills-EDFUCJPX.js} +13 -13
  255. package/dist/{skills-TVO26Y4V.js.map → skills-EDFUCJPX.js.map} +1 -1
  256. package/dist/source-E4VAT5RZ.js +41 -0
  257. package/dist/{source-PJBMDCKX.js.map → source-E4VAT5RZ.js.map} +1 -1
  258. package/dist/{source-manifest-publish-LLJWXGID.js → source-manifest-publish-CLEE6TNH.js} +23 -23
  259. package/dist/{source-manifest-publish-LLJWXGID.js.map → source-manifest-publish-CLEE6TNH.js.map} +1 -1
  260. package/dist/tui/index.js +29 -29
  261. package/dist/types/manifests.js +1 -1
  262. package/dist/types/src/manifests/agent.d.ts +2 -0
  263. package/dist/types/src/manifests/agent.d.ts.map +1 -1
  264. package/dist/types/src/manifests/contract.d.ts +2 -0
  265. package/dist/types/src/manifests/contract.d.ts.map +1 -1
  266. package/dist/types/src/manifests/index.d.ts +3 -3
  267. package/dist/types/src/manifests/index.d.ts.map +1 -1
  268. package/dist/types/src/manifests/prompt.d.ts +2 -0
  269. package/dist/types/src/manifests/prompt.d.ts.map +1 -1
  270. package/dist/workspace-plugin/adapters/mcp.js +22 -22
  271. package/dist/workspace-plugin/adapters/omp.js +14 -14
  272. package/dist/workspace-plugin/index.js +2 -2
  273. package/package.json +1 -1
  274. package/dist/chunk-36AFURKZ.js.map +0 -1
  275. package/dist/chunk-4MQS7CAF.js.map +0 -1
  276. package/dist/chunk-7AI3Q5AQ.js.map +0 -1
  277. package/dist/chunk-B6GIW55K.js.map +0 -1
  278. package/dist/chunk-BTE2V4IW.js.map +0 -1
  279. package/dist/chunk-EF7NPDDU.js.map +0 -1
  280. package/dist/chunk-GKMZ6THE.js.map +0 -1
  281. package/dist/chunk-GTILM2CI.js.map +0 -1
  282. package/dist/chunk-IMKSM5NL.js.map +0 -1
  283. package/dist/chunk-JAKOMFC6.js.map +0 -1
  284. package/dist/chunk-LAMCXQGA.js.map +0 -1
  285. package/dist/chunk-P67WJVP4.js.map +0 -1
  286. package/dist/chunk-QVNRCDTV.js.map +0 -1
  287. package/dist/chunk-UMVKJM4Q.js.map +0 -1
  288. package/dist/chunk-Y7QA2OLD.js.map +0 -1
  289. package/dist/chunk-YSHVQGUS.js.map +0 -1
  290. package/dist/chunk-ZAOGFXDO.js +0 -112
  291. package/dist/chunk-ZAOGFXDO.js.map +0 -1
  292. package/dist/library-publish-VJSWMOLH.js.map +0 -1
  293. package/dist/open-library-DB2PNL2X.js +0 -40
  294. package/dist/open-registry-ZUZJ7MS7.js +0 -32
  295. package/dist/paths-FQ64OLJG.js +0 -22
  296. package/dist/source-PJBMDCKX.js +0 -41
@@ -1,16 +1,16 @@
1
- import { readManifestSourceConfig, discoverAssetsInTree, barePublisher, createDefaultKindRegistry, sharesItsFolder, SEMVER_RE, parseManifestFile } from './chunk-Y7QA2OLD.js';
2
- import { installFromManifest, assertSafeManifestPath } from './chunk-CKQEIY43.js';
3
- import { PresetManifestSchema } from './chunk-B6GIW55K.js';
4
- import { defaultLibraryDir, resolveLibraryDir, GLOBAL_INSTALL_DIR_NAME, readLock, buildLibraryLockEntries, writeLock, mergeLockFile, buildLockFile, ManifestYamlEditor } from './chunk-36AFURKZ.js';
5
- import { getGlobalCacheDir, storeManifestSlug, resolveSourcePublisher } from './chunk-JAKOMFC6.js';
1
+ import { readManifestSourceConfig, discoverAssetsInTree, barePublisher, createDefaultKindRegistry, sharesItsFolder, SEMVER_RE, parseManifestFile } from './chunk-GEWAIQZ5.js';
2
+ import { installFromManifest, assertSafeManifestPath } from './chunk-MVQ3Q2HM.js';
3
+ import { PresetManifestSchema } from './chunk-32XKCNCL.js';
4
+ import { defaultLibraryDir, resolveLibraryDir, GLOBAL_INSTALL_DIR_NAME, readLock, buildLibraryLockEntries, writeLock, mergeLockFile, buildLockFile, ManifestYamlEditor } from './chunk-2FMEGSBN.js';
5
+ import { getGlobalCacheDir, storeManifestSlug, resolveSourcePublisher } from './chunk-JZCSNEHK.js';
6
6
  import { userConfigPath, globalSkaileDir, mergeLegacyEntriesInto, migrateLegacyDir, globalCacheRoot } from './chunk-L5VSIPQD.js';
7
- import { encodeSkaileManifest, loadSkPublishManifest, SKAILE_MANIFEST_FILENAME } from './chunk-BTE2V4IW.js';
8
- import { scanDirectory } from './chunk-GTILM2CI.js';
9
- import { parseAssetRef, assetRefToStr } from './chunk-QVNRCDTV.js';
7
+ import { encodeSkaileManifest, loadSkPublishManifest, SKAILE_MANIFEST_FILENAME } from './chunk-IXWODEED.js';
8
+ import { scanDirectory } from './chunk-Y34MSWEZ.js';
9
+ import { parseAssetRef, assetRefToStr } from './chunk-4OV5DSBB.js';
10
10
  import { __export } from './chunk-NSBPE2FW.js';
11
- import * as fs10 from 'fs';
11
+ import * as fs11 from 'fs';
12
12
  import { existsSync, mkdirSync, symlinkSync, copyFileSync, cpSync } from 'fs';
13
- import * as path15 from 'path';
13
+ import * as path16 from 'path';
14
14
  import { resolve, relative, sep, join, dirname } from 'path';
15
15
  import { stringify, parse, parseDocument } from 'yaml';
16
16
  import * as z3 from 'zod';
@@ -103,10 +103,10 @@ var SkaileConfigSchema = z3.object({
103
103
  library: LibraryConfigSchema.optional()
104
104
  });
105
105
  function defaultIndexPath() {
106
- return path15.join(globalSkaileDir(), "index.db");
106
+ return path16.join(globalSkaileDir(), "index.db");
107
107
  }
108
108
  function resolveIndexPath() {
109
- if (process.env.SKAILE_INDEX_PATH) return path15.resolve(process.env.SKAILE_INDEX_PATH);
109
+ if (process.env.SKAILE_INDEX_PATH) return path16.resolve(process.env.SKAILE_INDEX_PATH);
110
110
  return defaultIndexPath();
111
111
  }
112
112
  function getConfigDefaults() {
@@ -117,12 +117,12 @@ function getConfigDefaults() {
117
117
  }
118
118
  var CONFIG_FILENAME = "config.yaml";
119
119
  function projectConfigPath(projectDir) {
120
- return path15.join(projectDir, ".skaile", CONFIG_FILENAME);
120
+ return path16.join(projectDir, ".skaile", CONFIG_FILENAME);
121
121
  }
122
122
  function loadConfigFile(filePath) {
123
- if (!fs10.existsSync(filePath)) return null;
123
+ if (!fs11.existsSync(filePath)) return null;
124
124
  try {
125
- const content = fs10.readFileSync(filePath, "utf-8");
125
+ const content = fs11.readFileSync(filePath, "utf-8");
126
126
  const raw = parse(content);
127
127
  if (!raw || typeof raw !== "object") return null;
128
128
  return SkaileConfigSchema.partial().parse(raw);
@@ -170,11 +170,11 @@ function resolveConfig(opts) {
170
170
  return resolved;
171
171
  }
172
172
  function saveConfig(filePath, config) {
173
- const dir = path15.dirname(filePath);
174
- if (!fs10.existsSync(dir)) {
175
- fs10.mkdirSync(dir, { recursive: true });
173
+ const dir = path16.dirname(filePath);
174
+ if (!fs11.existsSync(dir)) {
175
+ fs11.mkdirSync(dir, { recursive: true });
176
176
  }
177
- fs10.writeFileSync(filePath, stringify(config, { indent: 2 }), "utf-8");
177
+ fs11.writeFileSync(filePath, stringify(config, { indent: 2 }), "utf-8");
178
178
  }
179
179
  var KnowledgeManifestSchema = z3.looseObject({
180
180
  name: z3.string().optional(),
@@ -200,11 +200,11 @@ function validateKnowledge(data) {
200
200
 
201
201
  // library/src/knowledge/knowledge-kind-provider.ts
202
202
  function collectDirRecursive(baseDir, relativeDir) {
203
- const full = path15.join(baseDir, relativeDir);
204
- if (!fs10.existsSync(full) || !fs10.statSync(full).isDirectory()) return [];
203
+ const full = path16.join(baseDir, relativeDir);
204
+ if (!fs11.existsSync(full) || !fs11.statSync(full).isDirectory()) return [];
205
205
  const results = [];
206
- for (const entry of fs10.readdirSync(full, { withFileTypes: true })) {
207
- const rel = path15.posix.join(relativeDir, entry.name);
206
+ for (const entry of fs11.readdirSync(full, { withFileTypes: true })) {
207
+ const rel = path16.posix.join(relativeDir, entry.name);
208
208
  if (entry.isDirectory()) {
209
209
  results.push(...collectDirRecursive(baseDir, rel));
210
210
  } else if (entry.isFile()) {
@@ -231,8 +231,8 @@ var knowledgeKindProvider = {
231
231
  return validateKnowledge(data);
232
232
  },
233
233
  defaultFileFilter(manifestPath) {
234
- const dir = path15.dirname(manifestPath);
235
- const manifestName = path15.basename(manifestPath);
234
+ const dir = path16.dirname(manifestPath);
235
+ const manifestName = path16.basename(manifestPath);
236
236
  const files = [manifestName];
237
237
  files.push(...collectDirRecursive(dir, "documents"));
238
238
  files.sort();
@@ -311,30 +311,30 @@ var assignments = sqliteTable("assignments", {
311
311
  assignedAt: text("assigned_at").notNull()
312
312
  });
313
313
  function isClone(dir) {
314
- return fs10.existsSync(path15.join(dir, ".git"));
314
+ return fs11.existsSync(path16.join(dir, ".git"));
315
315
  }
316
316
  function getSidecarRoot() {
317
317
  const home = globalSkaileDir();
318
- const sidecars = path15.join(home, "sidecars");
319
- const legacy = path15.join(home, "sources");
318
+ const sidecars = path16.join(home, "sidecars");
319
+ const legacy = path16.join(home, "sources");
320
320
  mergeLegacyEntriesInto(getGlobalCacheDir(), legacy, isClone);
321
321
  mergeLegacyEntriesInto(sidecars, legacy, (p) => !isClone(p));
322
322
  return sidecars;
323
323
  }
324
324
  function resolveSidecarPaths(slug) {
325
325
  const rootDir = getSidecarRoot();
326
- const sidecarDir = path15.join(rootDir, slug);
326
+ const sidecarDir = path16.join(rootDir, slug);
327
327
  return {
328
328
  rootDir,
329
329
  sidecarDir,
330
- manifestFile: path15.join(sidecarDir, "skaile.manifest.yaml"),
331
- readmeFile: path15.join(sidecarDir, "README.md"),
332
- lockFile: path15.join(sidecarDir, "skaile.manifest.lock.json")
330
+ manifestFile: path16.join(sidecarDir, "skaile.manifest.yaml"),
331
+ readmeFile: path16.join(sidecarDir, "README.md"),
332
+ lockFile: path16.join(sidecarDir, "skaile.manifest.lock.json")
333
333
  };
334
334
  }
335
335
  function deriveSlug(sourceConfig, sourcePath, existingSlugs) {
336
336
  const fromConfig = sourceConfig && typeof sourceConfig.name === "string" ? sourceConfig.name : void 0;
337
- const base = fromConfig && fromConfig.length > 0 ? slugify(fromConfig) : slugify(path15.basename(sourcePath || "")) || "unnamed-source";
337
+ const base = fromConfig && fromConfig.length > 0 ? slugify(fromConfig) : slugify(path16.basename(sourcePath || "")) || "unnamed-source";
338
338
  const taken = new Set(existingSlugs);
339
339
  if (!taken.has(base)) return base;
340
340
  for (let i = 2; i < 1e3; i++) {
@@ -345,9 +345,9 @@ function deriveSlug(sourceConfig, sourcePath, existingSlugs) {
345
345
  }
346
346
  function listSidecarSlugsOnDisk() {
347
347
  const root = getSidecarRoot();
348
- if (!fs10.existsSync(root)) return [];
348
+ if (!fs11.existsSync(root)) return [];
349
349
  const out = [];
350
- for (const entry of fs10.readdirSync(root, { withFileTypes: true })) {
350
+ for (const entry of fs11.readdirSync(root, { withFileTypes: true })) {
351
351
  if (!entry.isDirectory()) continue;
352
352
  if (entry.name.startsWith(".")) continue;
353
353
  out.push(entry.name);
@@ -360,28 +360,28 @@ function slugify(input) {
360
360
 
361
361
  // library/src/local/store-paths.ts
362
362
  function getStoreRoot() {
363
- return path15.join(globalSkaileDir(), "store");
363
+ return path16.join(globalSkaileDir(), "store");
364
364
  }
365
365
  function getStoreManifestsDir() {
366
- return path15.join(getStoreRoot(), "manifests");
366
+ return path16.join(getStoreRoot(), "manifests");
367
367
  }
368
368
  function curatedManifestOverlay(sourceUrl) {
369
- const file = path15.join(getStoreManifestsDir(), `${storeManifestSlug(sourceUrl)}.yaml`);
370
- return fs10.existsSync(file) ? file : void 0;
369
+ const file = path16.join(getStoreManifestsDir(), `${storeManifestSlug(sourceUrl)}.yaml`);
370
+ return fs11.existsSync(file) ? file : void 0;
371
371
  }
372
372
  function migratedMarkerPath() {
373
- return path15.join(getStoreRoot(), ".migrated");
373
+ return path16.join(getStoreRoot(), ".migrated");
374
374
  }
375
375
  function collectSidecarMigrationCandidates(sidecarRoot) {
376
376
  const candidates = [];
377
- if (fs10.existsSync(sidecarRoot)) {
378
- for (const entry of fs10.readdirSync(sidecarRoot, { withFileTypes: true })) {
377
+ if (fs11.existsSync(sidecarRoot)) {
378
+ for (const entry of fs11.readdirSync(sidecarRoot, { withFileTypes: true })) {
379
379
  if (!entry.isDirectory()) continue;
380
380
  if (entry.name.startsWith(".")) continue;
381
- const sidecarDir = path15.join(sidecarRoot, entry.name);
382
- const current = path15.join(sidecarDir, "skaile.manifest.yaml");
383
- const legacy = path15.join(sidecarDir, ".skaile-source.yaml");
384
- const src = fs10.existsSync(current) ? current : fs10.existsSync(legacy) ? legacy : void 0;
381
+ const sidecarDir = path16.join(sidecarRoot, entry.name);
382
+ const current = path16.join(sidecarDir, "skaile.manifest.yaml");
383
+ const legacy = path16.join(sidecarDir, ".skaile-source.yaml");
384
+ const src = fs11.existsSync(current) ? current : fs11.existsSync(legacy) ? legacy : void 0;
385
385
  if (src) candidates.push({ src, slug: entry.name });
386
386
  }
387
387
  }
@@ -390,10 +390,10 @@ function collectSidecarMigrationCandidates(sidecarRoot) {
390
390
  function moveSidecarManifests(candidates, manifestsDir) {
391
391
  let migrated = 0;
392
392
  for (const { src, slug } of candidates) {
393
- const dest = path15.join(manifestsDir, `${slug}.yaml`);
394
- if (fs10.existsSync(dest)) continue;
393
+ const dest = path16.join(manifestsDir, `${slug}.yaml`);
394
+ if (fs11.existsSync(dest)) continue;
395
395
  try {
396
- fs10.renameSync(src, dest);
396
+ fs11.renameSync(src, dest);
397
397
  migrated++;
398
398
  } catch (err) {
399
399
  process.stderr.write(
@@ -405,11 +405,11 @@ function moveSidecarManifests(candidates, manifestsDir) {
405
405
  return migrated;
406
406
  }
407
407
  function initStoreGitRepo(storeRoot) {
408
- if (fs10.existsSync(path15.join(storeRoot, ".git"))) return;
408
+ if (fs11.existsSync(path16.join(storeRoot, ".git"))) return;
409
409
  try {
410
410
  spawnSync("git", ["init", "--quiet"], { cwd: storeRoot, stdio: "ignore" });
411
- fs10.writeFileSync(
412
- path15.join(storeRoot, ".gitignore"),
411
+ fs11.writeFileSync(
412
+ path16.join(storeRoot, ".gitignore"),
413
413
  "# Remote-store cache \u2014 local to this machine.\nremote-cache/\n",
414
414
  "utf8"
415
415
  );
@@ -419,14 +419,14 @@ function initStoreGitRepo(storeRoot) {
419
419
  function migrateSidecarsToStoreIfNeeded() {
420
420
  const storeRoot = getStoreRoot();
421
421
  const marker = migratedMarkerPath();
422
- if (fs10.existsSync(marker)) return { migrated: 0, storeRoot };
422
+ if (fs11.existsSync(marker)) return { migrated: 0, storeRoot };
423
423
  const sidecarRoot = getSidecarRoot();
424
424
  const manifestsDir = getStoreManifestsDir();
425
425
  const candidates = collectSidecarMigrationCandidates(sidecarRoot);
426
- fs10.mkdirSync(manifestsDir, { recursive: true });
426
+ fs11.mkdirSync(manifestsDir, { recursive: true });
427
427
  const migrated = moveSidecarManifests(candidates, manifestsDir);
428
428
  initStoreGitRepo(storeRoot);
429
- fs10.writeFileSync(marker, (/* @__PURE__ */ new Date()).toISOString(), "utf8");
429
+ fs11.writeFileSync(marker, (/* @__PURE__ */ new Date()).toISOString(), "utf8");
430
430
  return { migrated, storeRoot };
431
431
  }
432
432
 
@@ -507,7 +507,7 @@ async function librariesPresent(client) {
507
507
  return rs.rows.length > 0;
508
508
  }
509
509
  function slugify2(p) {
510
- const base = path15.basename(p) || "lib";
510
+ const base = path16.basename(p) || "lib";
511
511
  return base.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-|-$/g, "") || "lib";
512
512
  }
513
513
  async function runLibrariesMigration(client) {
@@ -671,23 +671,23 @@ async function purgeOrphanedAssetDefinitions(client) {
671
671
  await client.execute(`PRAGMA user_version = ${ORPHAN_PURGE_VERSION}`);
672
672
  }
673
673
  function assertNoLegacyLibDb(newDbPath) {
674
- if (fs10.existsSync(newDbPath)) return;
675
- const parent = path15.dirname(newDbPath);
674
+ if (fs11.existsSync(newDbPath)) return;
675
+ const parent = path16.dirname(newDbPath);
676
676
  const skaileHome = globalSkaileDir();
677
- const defaultIndexPath2 = path15.join(skaileHome, "index.db");
677
+ const defaultIndexPath2 = path16.join(skaileHome, "index.db");
678
678
  const candidates = [];
679
- if (path15.basename(newDbPath) === "index.db") {
680
- candidates.push(path15.join(parent, "lib.db"));
679
+ if (path16.basename(newDbPath) === "index.db") {
680
+ candidates.push(path16.join(parent, "lib.db"));
681
681
  }
682
682
  if (newDbPath === defaultIndexPath2) {
683
- candidates.push(path15.join(skaileHome, "libraries", "lib.db"));
684
- candidates.push(path15.join(skaileHome, "library", "lib.db"));
683
+ candidates.push(path16.join(skaileHome, "libraries", "lib.db"));
684
+ candidates.push(path16.join(skaileHome, "library", "lib.db"));
685
685
  }
686
- if (path15.basename(parent) === "libraries") {
687
- candidates.push(path15.join(path15.dirname(parent), "library", "lib.db"));
686
+ if (path16.basename(parent) === "libraries") {
687
+ candidates.push(path16.join(path16.dirname(parent), "library", "lib.db"));
688
688
  }
689
689
  for (const legacy of candidates) {
690
- if (!fs10.existsSync(legacy)) continue;
690
+ if (!fs11.existsSync(legacy)) continue;
691
691
  throw new Error(
692
692
  `Found legacy index database at ${legacy}. The lib.db \u2192 index.db relocation ran for one release and has been removed. Move the file manually to ${newDbPath} (and any -wal / -shm siblings), then retry.`
693
693
  );
@@ -846,26 +846,26 @@ var LocalIndex = class {
846
846
  let dbPath;
847
847
  if (typeof optionsOrDir === "string") {
848
848
  dir = optionsOrDir;
849
- dbPath = path15.join(dir, "index.db");
849
+ dbPath = path16.join(dir, "index.db");
850
850
  } else if (optionsOrDir?.indexPath) {
851
851
  dbPath = optionsOrDir.indexPath;
852
852
  dir = optionsOrDir.libraryDir ?? resolveLibraryDir();
853
853
  this._kindRegistry = optionsOrDir.kindRegistry;
854
854
  } else if (optionsOrDir?.libraryDir) {
855
855
  dir = optionsOrDir.libraryDir;
856
- dbPath = path15.join(dir, "index.db");
856
+ dbPath = path16.join(dir, "index.db");
857
857
  this._kindRegistry = optionsOrDir.kindRegistry;
858
858
  } else {
859
859
  dir = resolveLibraryDir();
860
860
  dbPath = resolveIndexPath();
861
861
  this._kindRegistry = optionsOrDir?.kindRegistry;
862
862
  }
863
- if (!fs10.existsSync(dir)) {
864
- fs10.mkdirSync(dir, { recursive: true });
863
+ if (!fs11.existsSync(dir)) {
864
+ fs11.mkdirSync(dir, { recursive: true });
865
865
  }
866
- const dbParent = path15.dirname(dbPath);
867
- if (!fs10.existsSync(dbParent)) {
868
- fs10.mkdirSync(dbParent, { recursive: true });
866
+ const dbParent = path16.dirname(dbPath);
867
+ if (!fs11.existsSync(dbParent)) {
868
+ fs11.mkdirSync(dbParent, { recursive: true });
869
869
  }
870
870
  this.libraryDir = dir;
871
871
  this.dbPath = dbPath;
@@ -990,7 +990,7 @@ var LocalIndex = class {
990
990
  * Delete this library's cached asset defs whose ref is not in `keepRefs`.
991
991
  * Makes a sync authoritative: a def re-keyed under a new publisher (e.g.
992
992
  * `@skills/x` → `@acme/x`) leaves no stale duplicate behind. Returns the
993
- * number of rows removed.
993
+ * ids of the rows removed.
994
994
  *
995
995
  * Not on the IAssetIndex interface — used by catalog sources.
996
996
  */
@@ -1004,7 +1004,7 @@ var LocalIndex = class {
1004
1004
  and(eq(assetDefinitions.libraryId, libraryId), eq(assetDefinitions.id, id))
1005
1005
  ).run();
1006
1006
  }
1007
- return stale.length;
1007
+ return stale;
1008
1008
  }
1009
1009
  async getAssetDef(ref) {
1010
1010
  const db = await this.ensureDb();
@@ -1085,7 +1085,7 @@ var LocalIndex = class {
1085
1085
  * @returns The created Instance plus its on-disk install path.
1086
1086
  */
1087
1087
  async install(manifest, opts) {
1088
- const libraryRoot = opts?.libraryRoot ?? path15.join(this.libraryDir, GLOBAL_INSTALL_DIR_NAME);
1088
+ const libraryRoot = opts?.libraryRoot ?? path16.join(this.libraryDir, GLOBAL_INSTALL_DIR_NAME);
1089
1089
  const { installPath } = await installFromManifest({
1090
1090
  manifest,
1091
1091
  libraryRoot,
@@ -1206,6 +1206,60 @@ var LocalIndex = class {
1206
1206
  return (await db.select().from(assignments).where(eq(assignments.instanceId, instanceId)).all()).map(rowToAssignment);
1207
1207
  }
1208
1208
  };
1209
+ var UNREGISTERED_FILE = ".unregistered-libraries";
1210
+ function libraryDirMissing(lib) {
1211
+ try {
1212
+ return !fs11.statSync(lib.path).isDirectory();
1213
+ } catch {
1214
+ return true;
1215
+ }
1216
+ }
1217
+ function missingLibraryDirMessage(lib) {
1218
+ return `library "${lib.name}" is registered but its directory ${lib.path} is missing - run skaile library init ${lib.name} --path <dir> or skaile library remove ${lib.name}`;
1219
+ }
1220
+ function realDir(dir) {
1221
+ try {
1222
+ return fs11.realpathSync(dir);
1223
+ } catch {
1224
+ return path16.resolve(dir);
1225
+ }
1226
+ }
1227
+ function unregisteredLibraryNames() {
1228
+ try {
1229
+ return new Set(
1230
+ fs11.readFileSync(path16.join(resolveLibraryDir(), UNREGISTERED_FILE), "utf8").split("\n").map((l) => l.trim()).filter(Boolean)
1231
+ );
1232
+ } catch {
1233
+ return /* @__PURE__ */ new Set();
1234
+ }
1235
+ }
1236
+ function markLibraryUnregistered(lib) {
1237
+ if (realDir(path16.dirname(lib.path)) !== realDir(resolveLibraryDir())) return;
1238
+ const known = unregisteredLibraryNames();
1239
+ const add = [.../* @__PURE__ */ new Set([lib.name, path16.basename(lib.path)])].filter((n) => !known.has(n));
1240
+ if (add.length === 0) return;
1241
+ fs11.mkdirSync(resolveLibraryDir(), { recursive: true });
1242
+ fs11.appendFileSync(
1243
+ path16.join(resolveLibraryDir(), UNREGISTERED_FILE),
1244
+ `${add.join("\n")}
1245
+ `,
1246
+ "utf8"
1247
+ );
1248
+ }
1249
+ function clearLibraryUnregistered(lib) {
1250
+ const known = unregisteredLibraryNames();
1251
+ if (known.size === 0) return;
1252
+ const drop = /* @__PURE__ */ new Set([lib.name]);
1253
+ if (realDir(path16.dirname(lib.path)) === realDir(resolveLibraryDir())) {
1254
+ drop.add(path16.basename(lib.path));
1255
+ }
1256
+ const keep = [...known].filter((n) => !drop.has(n));
1257
+ if (keep.length === known.size) return;
1258
+ const file = path16.join(resolveLibraryDir(), UNREGISTERED_FILE);
1259
+ if (keep.length === 0) fs11.rmSync(file, { force: true });
1260
+ else fs11.writeFileSync(file, `${keep.join("\n")}
1261
+ `, "utf8");
1262
+ }
1209
1263
 
1210
1264
  // library/src/user-library.ts
1211
1265
  var LIBRARY_BACKENDS = ["local", "git"];
@@ -1242,7 +1296,7 @@ function git(cwd, args) {
1242
1296
  return spawnSync("git", args, { cwd, encoding: "utf-8" });
1243
1297
  }
1244
1298
  function isGitRepo(libPath) {
1245
- return existsSync(path15.join(libPath, ".git"));
1299
+ return existsSync(path16.join(libPath, ".git"));
1246
1300
  }
1247
1301
  function spawnGit(cwd, args, action) {
1248
1302
  const r = git(cwd, args);
@@ -1312,6 +1366,23 @@ function headCommit(cwd) {
1312
1366
  const r = git(cwd, ["rev-parse", "--verify", "--quiet", "HEAD"]);
1313
1367
  return r.status === 0 ? r.stdout.trim() : void 0;
1314
1368
  }
1369
+ function rebaseInProgress(cwd) {
1370
+ for (const entry of ["rebase-merge", "rebase-apply"]) {
1371
+ const p = git(cwd, ["rev-parse", "--git-path", entry]);
1372
+ if (p.status === 0 && existsSync(path16.resolve(cwd, p.stdout.trim()))) return true;
1373
+ }
1374
+ return false;
1375
+ }
1376
+ var REBASE_IN_PROGRESS = "rebase in progress; finish it with git rebase --continue";
1377
+ function assertLibraryDir(lib) {
1378
+ if (libraryDirMissing(lib)) {
1379
+ throw new LibrarySyncError(missingLibraryDirMessage(lib), "library_dir_missing");
1380
+ }
1381
+ }
1382
+ function assertNoRebase(lib) {
1383
+ assertLibraryDir(lib);
1384
+ if (rebaseInProgress(lib.path)) throw new LibrarySyncError(REBASE_IN_PROGRESS, "remote_error");
1385
+ }
1315
1386
  function ok(r, action) {
1316
1387
  if (r.status !== 0) {
1317
1388
  throw new LibrarySyncError(
@@ -1328,6 +1399,13 @@ var GitSyncDriver = class {
1328
1399
  backend = "git";
1329
1400
  async status(lib) {
1330
1401
  const cfg = gitCfg(lib);
1402
+ if (libraryDirMissing(lib)) {
1403
+ return {
1404
+ reachable: false,
1405
+ localChanges: { added: [], modified: [], deleted: [] },
1406
+ notes: [missingLibraryDirMessage(lib)]
1407
+ };
1408
+ }
1331
1409
  const porcelain = git(lib.path, ["status", "--porcelain"]);
1332
1410
  if (porcelain.status !== 0) {
1333
1411
  return {
@@ -1369,6 +1447,7 @@ var GitSyncDriver = class {
1369
1447
  };
1370
1448
  }
1371
1449
  async pull(lib, opts) {
1450
+ assertNoRebase(lib);
1372
1451
  const cfg = gitCfg(lib);
1373
1452
  const args = ["pull", "--ff-only", "origin", cfg.branch];
1374
1453
  if (opts?.rebase) args.splice(1, 1, "--rebase");
@@ -1398,6 +1477,14 @@ var GitSyncDriver = class {
1398
1477
  ]
1399
1478
  };
1400
1479
  }
1480
+ if (/would be overwritten by (merge|checkout)|unstaged changes|uncommitted changes|commit your changes or stash/i.test(
1481
+ r.stderr
1482
+ )) {
1483
+ throw new LibrarySyncError(
1484
+ `uncommitted changes in ${lib.name}; commit or stash them first`,
1485
+ "remote_error"
1486
+ );
1487
+ }
1401
1488
  throw new LibrarySyncError(`git pull failed: ${r.stderr.trim()}`, "remote_error");
1402
1489
  }
1403
1490
  const upstream = `refs/remotes/origin/${cfg.branch}`;
@@ -1411,11 +1498,27 @@ var GitSyncDriver = class {
1411
1498
  `library "${lib.name}" has ownership=${lib.ownership}; use \`propose\` instead`
1412
1499
  );
1413
1500
  }
1501
+ assertNoRebase(lib);
1414
1502
  const cfg = gitCfg(lib);
1415
1503
  const args = ["push", "origin", cfg.branch];
1416
1504
  if (opts?.force) args.push("--force-with-lease");
1505
+ const countRef = "refs/skaile/push-base";
1506
+ const trackingRef = `refs/remotes/origin/${cfg.branch}`;
1507
+ git(lib.path, ["update-ref", "-d", countRef]);
1508
+ const fetched = spawnSync(
1509
+ "git",
1510
+ ["fetch", "--quiet", "origin", `+refs/heads/${cfg.branch}:${countRef}`],
1511
+ {
1512
+ cwd: lib.path,
1513
+ encoding: "utf-8",
1514
+ env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
1515
+ }
1516
+ );
1517
+ const remoteHasNoBranch = /couldn't find remote ref/i.test(fetched.stderr ?? "");
1518
+ const baseRef = fetched.status === 0 || remoteHasNoBranch ? countRef : trackingRef;
1417
1519
  const local = `refs/heads/${cfg.branch}`;
1418
- const pushed = countCommits(lib.path, `refs/remotes/origin/${cfg.branch}..${local}`) ?? countCommits(lib.path, local) ?? 0;
1520
+ const pushed = countCommits(lib.path, `${baseRef}..${local}`) ?? countCommits(lib.path, local) ?? 0;
1521
+ git(lib.path, ["update-ref", "-d", countRef]);
1419
1522
  const pushRes = git(lib.path, args);
1420
1523
  if (pushRes.status !== 0 && /non-fast-forward|fetch first|updates were rejected/i.test(pushRes.stderr)) {
1421
1524
  throw new LibrarySyncError(
@@ -1433,6 +1536,7 @@ var GitSyncDriver = class {
1433
1536
  `propose requires ownership=contributor; got ${lib.ownership}`
1434
1537
  );
1435
1538
  }
1539
+ assertLibraryDir(lib);
1436
1540
  const cfg = gitCfg(lib);
1437
1541
  const branch = opts.branch ?? `skaile/${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:.TZ]/g, "").slice(0, 14)}`;
1438
1542
  const remotes = ok(git(lib.path, ["remote"]), "remote-list").split("\n");
@@ -1528,7 +1632,13 @@ function rowToLibrary2(row) {
1528
1632
  };
1529
1633
  }
1530
1634
  var LIBRARY_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
1635
+ var MAX_LIBRARY_NAME_LENGTH = 64;
1531
1636
  function assertValidLibraryName(name) {
1637
+ if (name.length > MAX_LIBRARY_NAME_LENGTH) {
1638
+ throw new Error(
1639
+ `Invalid library name (${name.length} characters): at most ${MAX_LIBRARY_NAME_LENGTH} characters.`
1640
+ );
1641
+ }
1532
1642
  if (!LIBRARY_NAME_PATTERN.test(name)) {
1533
1643
  throw new Error(
1534
1644
  `Invalid library name "${name}": use letters, digits, "_" or "-", starting with a letter or digit.`
@@ -1573,6 +1683,7 @@ var LibraryManager = class {
1573
1683
  createdAt: now,
1574
1684
  updatedAt: now
1575
1685
  }).run();
1686
+ clearLibraryUnregistered({ name: input.name, path: input.path });
1576
1687
  return this.requireLibrary(id);
1577
1688
  }
1578
1689
  async listLibraries() {
@@ -1593,6 +1704,19 @@ var LibraryManager = class {
1593
1704
  if (!lib) throw new UserLibraryNotFoundError(nameOrId);
1594
1705
  return lib;
1595
1706
  }
1707
+ /**
1708
+ * {@link requireLibrary}, then refuse a library whose registered directory is gone: one line
1709
+ * that names the path and the two ways out. For every verb that reads or writes the files.
1710
+ *
1711
+ * @throws LibrarySyncError (`library_dir_missing`) when the directory does not exist.
1712
+ */
1713
+ async requireLibraryDir(nameOrId) {
1714
+ const lib = await this.requireLibrary(nameOrId);
1715
+ if (libraryDirMissing(lib)) {
1716
+ throw new LibrarySyncError(missingLibraryDirMessage(lib), "library_dir_missing");
1717
+ }
1718
+ return lib;
1719
+ }
1596
1720
  async updateLibrary(nameOrId, patch) {
1597
1721
  const lib = await this.requireLibrary(nameOrId);
1598
1722
  if (patch.name !== void 0 && patch.name !== lib.name) assertValidLibraryName(patch.name);
@@ -1635,9 +1759,10 @@ var LibraryManager = class {
1635
1759
  async removeLibrary(nameOrId, opts = {}) {
1636
1760
  const lib = await this.requireLibrary(nameOrId);
1637
1761
  await this.lib.removeSource(lib.id);
1638
- if (opts.purge && fs10.existsSync(lib.path)) {
1639
- fs10.rmSync(lib.path, { recursive: true, force: true });
1762
+ if (opts.purge && fs11.existsSync(lib.path)) {
1763
+ fs11.rmSync(lib.path, { recursive: true, force: true });
1640
1764
  }
1765
+ if (!opts.purge) markLibraryUnregistered(lib);
1641
1766
  }
1642
1767
  /**
1643
1768
  * Idempotently ensure a `personal` library exists at `<librariesDir>/personal`.
@@ -1652,8 +1777,8 @@ var LibraryManager = class {
1652
1777
  (l) => l.isDefault && (l.ownership === "owner" || l.ownership === "contributor")
1653
1778
  );
1654
1779
  if (writableDefault) return { library: writableDefault, created: false };
1655
- const personalPath = path15.join(librariesDir, "personal");
1656
- fs10.mkdirSync(personalPath, { recursive: true });
1780
+ const personalPath = path16.join(librariesDir, "personal");
1781
+ fs11.mkdirSync(personalPath, { recursive: true });
1657
1782
  const lib = await this.addLibrary({
1658
1783
  name: "personal",
1659
1784
  path: personalPath,
@@ -1684,7 +1809,7 @@ function describeSyncError(err) {
1684
1809
  return parts.join(": ");
1685
1810
  }
1686
1811
  function scanLibraryRoot(rootPath, registry, scanOpts) {
1687
- const fallbackPublisher = resolveSourcePublisher(rootPath) ?? (path15.basename(rootPath) || "unknown");
1812
+ const fallbackPublisher = resolveSourcePublisher(rootPath) ?? (path16.basename(rootPath) || "unknown");
1688
1813
  const opts = {
1689
1814
  registry,
1690
1815
  sidecarManifestFile: scanOpts?.sidecarManifestFile,
@@ -1783,7 +1908,9 @@ var LocalCatalogSource = class {
1783
1908
  async sync(syncOpts) {
1784
1909
  const result = this.scan(syncOpts);
1785
1910
  const exclude = syncOpts?.exclude;
1786
- const assets = exclude ? result.assets.filter((a) => !exclude(a)) : result.assets;
1911
+ const only = syncOpts?.only;
1912
+ const kept = exclude ? result.assets.filter((a) => !exclude(a)) : result.assets;
1913
+ const assets = only ? kept.filter((a) => only.has(a.ref)) : kept;
1787
1914
  let assetsUpdated = 0;
1788
1915
  const errors = [];
1789
1916
  const softDepsByRef = /* @__PURE__ */ new Map();
@@ -1835,8 +1962,11 @@ var LocalCatalogSource = class {
1835
1962
  );
1836
1963
  }
1837
1964
  const keepRefs = assets.map((a) => a.ref);
1838
- if (result.assets.length > 0) await this.library.pruneAssetDefs(this.sourceId, keepRefs);
1839
- return { assetsFound: assets.length, assetsUpdated, errors, advisories };
1965
+ let pruned = [];
1966
+ if (!syncOpts?.only && result.assets.length > 0) {
1967
+ pruned = await this.library.pruneAssetDefs(this.sourceId, keepRefs);
1968
+ }
1969
+ return { assetsFound: assets.length, assetsUpdated, errors, advisories, pruned };
1840
1970
  }
1841
1971
  };
1842
1972
  function defToCatalogAsset(def) {
@@ -1913,7 +2043,7 @@ function installLibraryAsset(opts) {
1913
2043
  }
1914
2044
  function authoringLibraries(libs) {
1915
2045
  const newRoot = getGlobalCacheDir();
1916
- const legacyRoot = path15.join(globalSkaileDir(), "sources");
2046
+ const legacyRoot = path16.join(globalSkaileDir(), "sources");
1917
2047
  return libs.filter((l) => !l.path.startsWith(newRoot) && !l.path.startsWith(legacyRoot));
1918
2048
  }
1919
2049
  async function scanAuthoringLibraries(index, registry) {
@@ -1975,21 +2105,21 @@ var SidecarGit = class {
1975
2105
  * @docLink packages/library/concepts#sidecar-git
1976
2106
  */
1977
2107
  async ensureInitialized() {
1978
- if (!fs10.existsSync(this.rootDir)) {
1979
- fs10.mkdirSync(this.rootDir, { recursive: true });
2108
+ if (!fs11.existsSync(this.rootDir)) {
2109
+ fs11.mkdirSync(this.rootDir, { recursive: true });
1980
2110
  }
1981
- const gitDir = path15.join(this.rootDir, ".git");
1982
- const freshRepo = !fs10.existsSync(gitDir);
2111
+ const gitDir = path16.join(this.rootDir, ".git");
2112
+ const freshRepo = !fs11.existsSync(gitDir);
1983
2113
  if (freshRepo) {
1984
2114
  const init = this.spawn(["init", "-b", "main"]);
1985
2115
  if (init.exitCode !== 0) {
1986
2116
  throw new Error(`git init failed: ${init.stderr || init.stdout}`);
1987
2117
  }
1988
2118
  }
1989
- const attrsPath = path15.join(this.rootDir, ".gitattributes");
1990
- if (!fs10.existsSync(attrsPath)) fs10.writeFileSync(attrsPath, GITATTRIBUTES, "utf-8");
1991
- const readmePath = path15.join(this.rootDir, "README.md");
1992
- if (!fs10.existsSync(readmePath)) fs10.writeFileSync(readmePath, ROOT_README, "utf-8");
2119
+ const attrsPath = path16.join(this.rootDir, ".gitattributes");
2120
+ if (!fs11.existsSync(attrsPath)) fs11.writeFileSync(attrsPath, GITATTRIBUTES, "utf-8");
2121
+ const readmePath = path16.join(this.rootDir, "README.md");
2122
+ if (!fs11.existsSync(readmePath)) fs11.writeFileSync(readmePath, ROOT_README, "utf-8");
1993
2123
  if (!this.hasGlobalGitConfig("user.name")) {
1994
2124
  this.spawn(["config", "user.name", FALLBACK_USER_NAME]);
1995
2125
  }
@@ -2014,8 +2144,8 @@ var SidecarGit = class {
2014
2144
  */
2015
2145
  async commit(slug, message, opts) {
2016
2146
  if (opts?.skip) return;
2017
- const slugDir = path15.join(this.rootDir, slug);
2018
- if (fs10.existsSync(slugDir)) {
2147
+ const slugDir = path16.join(this.rootDir, slug);
2148
+ if (fs11.existsSync(slugDir)) {
2019
2149
  this.spawn(["add", "--", slug]);
2020
2150
  } else {
2021
2151
  this.spawn(["add", "-A"]);
@@ -2075,11 +2205,11 @@ ${result.stderr}`;
2075
2205
  };
2076
2206
  function migrateWorkspaceConfig(dir, opts) {
2077
2207
  const filename = opts?.filename ?? "skaile.yaml";
2078
- const filePath = path15.join(dir, filename);
2079
- if (!fs10.existsSync(filePath)) {
2208
+ const filePath = path16.join(dir, filename);
2209
+ if (!fs11.existsSync(filePath)) {
2080
2210
  return { migrated: false, version: 1, warnings: ["No skaile.yaml found"] };
2081
2211
  }
2082
- const content = fs10.readFileSync(filePath, "utf-8");
2212
+ const content = fs11.readFileSync(filePath, "utf-8");
2083
2213
  const raw = parse(content);
2084
2214
  if (!raw || typeof raw !== "object") {
2085
2215
  return { migrated: false, version: 1, warnings: ["Invalid YAML content"] };
@@ -2111,7 +2241,7 @@ function migrateWorkspaceConfig(dir, opts) {
2111
2241
  } else {
2112
2242
  doc.set("version", 2);
2113
2243
  }
2114
- fs10.writeFileSync(filePath, doc.toString(), "utf-8");
2244
+ fs11.writeFileSync(filePath, doc.toString(), "utf-8");
2115
2245
  }
2116
2246
  return {
2117
2247
  migrated: !opts?.dryRun,
@@ -2300,8 +2430,8 @@ function resolveTemplate(template, context) {
2300
2430
  });
2301
2431
  return { value: result, hasSecret: false };
2302
2432
  }
2303
- function setNestedValue(obj, path17, value) {
2304
- const parts = path17.split(".");
2433
+ function setNestedValue(obj, path18, value) {
2434
+ const parts = path18.split(".");
2305
2435
  let current = obj;
2306
2436
  for (let i = 0; i < parts.length - 1; i++) {
2307
2437
  const key = parts[i];
@@ -2906,8 +3036,8 @@ function deepEqual(a, b) {
2906
3036
  function defaultCatalogCacheDir() {
2907
3037
  const home = globalSkaileDir();
2908
3038
  return migrateLegacyDir(
2909
- path15.join(globalCacheRoot(), "catalog"),
2910
- path15.join(home, "catalog-cache")
3039
+ path16.join(globalCacheRoot(), "catalog"),
3040
+ path16.join(home, "catalog-cache")
2911
3041
  );
2912
3042
  }
2913
3043
  var INDEX_FILE = "index.json";
@@ -2916,11 +3046,13 @@ var CatalogCache = class {
2916
3046
  dir;
2917
3047
  ttlMs;
2918
3048
  nowFn;
3049
+ scopePrefix;
2919
3050
  index = null;
2920
3051
  constructor(opts) {
2921
3052
  this.dir = opts.dir ?? defaultCatalogCacheDir();
2922
3053
  this.ttlMs = opts.ttlMs;
2923
3054
  this.nowFn = opts.now ?? Date.now;
3055
+ this.scopePrefix = opts.scope === void 0 ? "" : `${scopeHash(opts.scope)}|`;
2924
3056
  this.ensureDir();
2925
3057
  }
2926
3058
  // ── public: resolve cache ───────────────────────────────────────────────
@@ -2931,8 +3063,7 @@ var CatalogCache = class {
2931
3063
  * regardless of `fetchedAt`.
2932
3064
  */
2933
3065
  getResolve(ref) {
2934
- const idx = this.loadIndex();
2935
- const entry = idx.resolve[ref];
3066
+ const entry = this.lookupResolve(ref);
2936
3067
  if (!entry) return null;
2937
3068
  if (this.ttlMs === 0) return entry;
2938
3069
  if (this.nowFn() - entry.fetchedAt > this.ttlMs) return null;
@@ -2942,21 +3073,40 @@ var CatalogCache = class {
2942
3073
  * Return a stale resolve-cache entry regardless of TTL — for stale-while-revalidate.
2943
3074
  */
2944
3075
  getResolveStale(ref) {
2945
- const idx = this.loadIndex();
2946
- return idx.resolve[ref] ?? null;
3076
+ return this.lookupResolve(ref);
2947
3077
  }
2948
- /** Persist a resolve-cache entry (use `null` to negatively cache misses). */
3078
+ /**
3079
+ * Persist a resolve-cache entry (use `null` to negatively cache misses). A found asset
3080
+ * is stored under its canonical ref and shared by every catalog; a miss is only true
3081
+ * of this catalog, so it is stored under the catalog scope.
3082
+ */
2949
3083
  setResolve(ref, value) {
2950
3084
  const idx = this.loadIndex();
2951
- idx.resolve[ref] = { fetchedAt: this.nowFn(), value };
3085
+ const entry = { fetchedAt: this.nowFn(), value };
3086
+ if (value === null) {
3087
+ idx.resolve[this.scopePrefix + ref] = entry;
3088
+ } else {
3089
+ idx.resolve[ref] = entry;
3090
+ if (this.scopePrefix) delete idx.resolve[this.scopePrefix + ref];
3091
+ }
2952
3092
  this.writeIndex(idx);
2953
3093
  }
3094
+ /**
3095
+ * A shared hit, else this catalog's own miss. An unscoped entry holding `null` was
3096
+ * written before misses were scoped and may belong to another catalog: ignore it.
3097
+ */
3098
+ lookupResolve(ref) {
3099
+ const idx = this.loadIndex();
3100
+ const shared = idx.resolve[ref];
3101
+ if (shared && shared.value !== null) return shared;
3102
+ return idx.resolve[this.scopePrefix + ref] ?? null;
3103
+ }
2954
3104
  // ── public: list cache ──────────────────────────────────────────────────
2955
3105
  /**
2956
3106
  * Return a fresh list-cache entry for `filter`, or `null` if absent / stale.
2957
3107
  */
2958
3108
  getList(filter) {
2959
- const key = filterKey(filter);
3109
+ const key = this.scopePrefix + filterKey(filter);
2960
3110
  const idx = this.loadIndex();
2961
3111
  const entry = idx.list[key];
2962
3112
  if (!entry) return null;
@@ -2966,13 +3116,13 @@ var CatalogCache = class {
2966
3116
  }
2967
3117
  /** Return a stale list-cache entry regardless of TTL — for stale-while-revalidate. */
2968
3118
  getListStale(filter) {
2969
- const key = filterKey(filter);
3119
+ const key = this.scopePrefix + filterKey(filter);
2970
3120
  const idx = this.loadIndex();
2971
3121
  return idx.list[key] ?? null;
2972
3122
  }
2973
3123
  /** Persist a list-cache entry. */
2974
3124
  setList(filter, items) {
2975
- const key = filterKey(filter);
3125
+ const key = this.scopePrefix + filterKey(filter);
2976
3126
  const idx = this.loadIndex();
2977
3127
  idx.list[key] = { fetchedAt: this.nowFn(), items };
2978
3128
  this.writeIndex(idx);
@@ -2980,22 +3130,22 @@ var CatalogCache = class {
2980
3130
  // ── public: tarball cache ───────────────────────────────────────────────
2981
3131
  /** Absolute path where a tarball with `sha256` would be cached. */
2982
3132
  tarballPath(sha256) {
2983
- return path15.join(this.dir, TARBALL_DIR, `${sha256}.tgz`);
3133
+ return path16.join(this.dir, TARBALL_DIR, `${sha256}.tgz`);
2984
3134
  }
2985
3135
  /** Read a cached tarball from disk if present, otherwise `null`. */
2986
3136
  readTarball(sha256) {
2987
3137
  const p = this.tarballPath(sha256);
2988
- if (!fs10.existsSync(p)) return null;
2989
- return fs10.readFileSync(p);
3138
+ if (!fs11.existsSync(p)) return null;
3139
+ return fs11.readFileSync(p);
2990
3140
  }
2991
3141
  /** Persist a tarball blob to disk (atomic write). */
2992
3142
  writeTarball(sha256, bytes) {
2993
- const dir = path15.join(this.dir, TARBALL_DIR);
2994
- if (!fs10.existsSync(dir)) fs10.mkdirSync(dir, { recursive: true });
3143
+ const dir = path16.join(this.dir, TARBALL_DIR);
3144
+ if (!fs11.existsSync(dir)) fs11.mkdirSync(dir, { recursive: true });
2995
3145
  const finalPath = this.tarballPath(sha256);
2996
3146
  const tmpPath = `${finalPath}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
2997
- fs10.writeFileSync(tmpPath, bytes);
2998
- fs10.renameSync(tmpPath, finalPath);
3147
+ fs11.writeFileSync(tmpPath, bytes);
3148
+ fs11.renameSync(tmpPath, finalPath);
2999
3149
  }
3000
3150
  // ── public: invalidation ────────────────────────────────────────────────
3001
3151
  /**
@@ -3014,9 +3164,9 @@ var CatalogCache = class {
3014
3164
  */
3015
3165
  invalidateEverything() {
3016
3166
  this.invalidateAll();
3017
- const tarballDir = path15.join(this.dir, TARBALL_DIR);
3018
- if (fs10.existsSync(tarballDir)) {
3019
- fs10.rmSync(tarballDir, { recursive: true, force: true });
3167
+ const tarballDir = path16.join(this.dir, TARBALL_DIR);
3168
+ if (fs11.existsSync(tarballDir)) {
3169
+ fs11.rmSync(tarballDir, { recursive: true, force: true });
3020
3170
  }
3021
3171
  }
3022
3172
  /** Return whether `ttlMs` is zero (air-gapped mode). */
@@ -3025,22 +3175,22 @@ var CatalogCache = class {
3025
3175
  }
3026
3176
  // ── private ─────────────────────────────────────────────────────────────
3027
3177
  ensureDir() {
3028
- if (!fs10.existsSync(this.dir)) fs10.mkdirSync(this.dir, { recursive: true });
3029
- const tarballDir = path15.join(this.dir, TARBALL_DIR);
3030
- if (!fs10.existsSync(tarballDir)) fs10.mkdirSync(tarballDir, { recursive: true });
3178
+ if (!fs11.existsSync(this.dir)) fs11.mkdirSync(this.dir, { recursive: true });
3179
+ const tarballDir = path16.join(this.dir, TARBALL_DIR);
3180
+ if (!fs11.existsSync(tarballDir)) fs11.mkdirSync(tarballDir, { recursive: true });
3031
3181
  }
3032
3182
  indexPath() {
3033
- return path15.join(this.dir, INDEX_FILE);
3183
+ return path16.join(this.dir, INDEX_FILE);
3034
3184
  }
3035
3185
  loadIndex() {
3036
3186
  if (this.index) return this.index;
3037
3187
  const p = this.indexPath();
3038
- if (!fs10.existsSync(p)) {
3188
+ if (!fs11.existsSync(p)) {
3039
3189
  this.index = { version: 1, resolve: {}, list: {} };
3040
3190
  return this.index;
3041
3191
  }
3042
3192
  try {
3043
- const raw = JSON.parse(fs10.readFileSync(p, "utf-8"));
3193
+ const raw = JSON.parse(fs11.readFileSync(p, "utf-8"));
3044
3194
  if (raw && typeof raw === "object" && raw.version === 1) {
3045
3195
  this.index = {
3046
3196
  version: 1,
@@ -3058,8 +3208,8 @@ var CatalogCache = class {
3058
3208
  this.index = idx;
3059
3209
  const p = this.indexPath();
3060
3210
  const tmp = `${p}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
3061
- fs10.writeFileSync(tmp, JSON.stringify(idx, null, 2), "utf-8");
3062
- fs10.renameSync(tmp, p);
3211
+ fs11.writeFileSync(tmp, JSON.stringify(idx, null, 2), "utf-8");
3212
+ fs11.renameSync(tmp, p);
3063
3213
  }
3064
3214
  };
3065
3215
  function filterKey(filter) {
@@ -3072,6 +3222,9 @@ function filterKey(filter) {
3072
3222
  }
3073
3223
  return Object.keys(norm).length === 0 ? "__all__" : JSON.stringify(norm);
3074
3224
  }
3225
+ function scopeHash(scope) {
3226
+ return crypto.createHash("sha256").update(scope.replace(/\/+$/, "")).digest("hex").slice(0, 16);
3227
+ }
3075
3228
  function sha256Hex(bytes) {
3076
3229
  const h = crypto.createHash("sha256");
3077
3230
  h.update(bytes);
@@ -3124,6 +3277,7 @@ var RemoteCatalogSource = class {
3124
3277
  this.cache = opts.cache ?? new CatalogCache({
3125
3278
  dir: opts.cacheDir,
3126
3279
  ttlMs: this.cacheTtlMs,
3280
+ scope: this.baseUrl,
3127
3281
  now: opts.now
3128
3282
  });
3129
3283
  }
@@ -3564,6 +3718,7 @@ var RestCatalogSource = class {
3564
3718
  this.cache = opts.cache ?? new CatalogCache({
3565
3719
  dir: opts.cacheDir,
3566
3720
  ttlMs: this.cacheTtlMs,
3721
+ scope: this.baseUrl,
3567
3722
  now: opts.now
3568
3723
  });
3569
3724
  }
@@ -3894,7 +4049,7 @@ var defaultFetch2 = async (url, init) => {
3894
4049
  });
3895
4050
  };
3896
4051
  function discoveredToAssetEntry(asset, repoPublisher, inheritPublisher) {
3897
- const root = path15.posix.dirname(asset.relativePath.replace(/\\/g, "/"));
4052
+ const root = path16.posix.dirname(asset.relativePath.replace(/\\/g, "/"));
3898
4053
  const entry = {
3899
4054
  kind: asset.kind,
3900
4055
  name: asset.name,
@@ -3911,22 +4066,22 @@ function discoveredToAssetEntry(asset, repoPublisher, inheritPublisher) {
3911
4066
  }
3912
4067
  function writeCuratedManifest(input) {
3913
4068
  const manifestPath = input.manifestFile;
3914
- if (fs10.existsSync(manifestPath) && !input.force) {
4069
+ if (fs11.existsSync(manifestPath) && !input.force) {
3915
4070
  return { wrote: false, manifestPath, assetCount: 0 };
3916
4071
  }
3917
4072
  const publisher = input.publisher.startsWith("@") ? input.publisher.slice(1) : input.publisher;
3918
4073
  const inheritPublisher = input.inheritPublisher ?? false;
3919
4074
  const assets = input.assets.map((a) => discoveredToAssetEntry(a, publisher, inheritPublisher)).sort((a, b) => `${a.kind}:${a.name}`.localeCompare(`${b.kind}:${b.name}`));
3920
4075
  const manifest = { publisher, assets };
3921
- fs10.mkdirSync(path15.dirname(manifestPath), { recursive: true });
3922
- fs10.writeFileSync(manifestPath, encodeSkaileManifest(manifest), "utf-8");
4076
+ fs11.mkdirSync(path16.dirname(manifestPath), { recursive: true });
4077
+ fs11.writeFileSync(manifestPath, encodeSkaileManifest(manifest), "utf-8");
3923
4078
  return { wrote: true, manifestPath, assetCount: assets.length };
3924
4079
  }
3925
4080
  function openManifest(libraryPath) {
3926
- const dir = path15.resolve(libraryPath);
3927
- const file = path15.join(dir, SKAILE_MANIFEST_FILENAME);
3928
- if (!fs10.existsSync(file)) {
3929
- fs10.mkdirSync(dir, { recursive: true });
4081
+ const dir = path16.resolve(libraryPath);
4082
+ const file = path16.join(dir, SKAILE_MANIFEST_FILENAME);
4083
+ if (!fs11.existsSync(file)) {
4084
+ fs11.mkdirSync(dir, { recursive: true });
3930
4085
  return { editor: ManifestYamlEditor.create(file), created: true };
3931
4086
  }
3932
4087
  const editor = ManifestYamlEditor.load(file);
@@ -3938,16 +4093,16 @@ function assertManifestEditable(libraryPath) {
3938
4093
  openManifest(libraryPath);
3939
4094
  }
3940
4095
  function conflictingAssetRoot(libraryPath, kind, name, root) {
3941
- const existing = loadSkPublishManifest(path15.resolve(libraryPath))?.assets?.find(
4096
+ const existing = loadSkPublishManifest(path16.resolve(libraryPath))?.assets?.find(
3942
4097
  (a) => a.kind === kind && a.name === name
3943
4098
  );
3944
4099
  return existingRootConflict(libraryPath, existing, root);
3945
4100
  }
3946
4101
  function existingRootConflict(libraryPath, existing, root) {
3947
4102
  if (!existing?.root || existing.source) return void 0;
3948
- const existingAbs = path15.resolve(libraryPath, existing.root);
3949
- if (existingAbs === path15.resolve(libraryPath, root)) return void 0;
3950
- const stat = fs10.statSync(existingAbs, { throwIfNoEntry: false });
4103
+ const existingAbs = path16.resolve(libraryPath, existing.root);
4104
+ if (existingAbs === path16.resolve(libraryPath, root)) return void 0;
4105
+ const stat = fs11.statSync(existingAbs, { throwIfNoEntry: false });
3951
4106
  return stat?.isDirectory() ? existing.root : void 0;
3952
4107
  }
3953
4108
  function upsertManifestAsset(libraryPath, input) {
@@ -3981,8 +4136,8 @@ function upsertManifestAsset(libraryPath, input) {
3981
4136
  function missingRootAssets(libraryPath, manifest) {
3982
4137
  return (manifest.assets ?? []).filter((a) => {
3983
4138
  if (a.source || manifest.source || !a.root) return false;
3984
- const dir = path15.resolve(libraryPath, a.root);
3985
- return !(fs10.existsSync(dir) && fs10.statSync(dir).isDirectory());
4139
+ const dir = path16.resolve(libraryPath, a.root);
4140
+ return !(fs11.existsSync(dir) && fs11.statSync(dir).isDirectory());
3986
4141
  });
3987
4142
  }
3988
4143
  function pruneMissingRootAssets(libraryPath) {
@@ -4021,18 +4176,19 @@ function setManifestPublisher(libraryPath, publisher) {
4021
4176
  editor.save();
4022
4177
  return true;
4023
4178
  }
4024
- async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
4179
+ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry, opts = {}) {
4025
4180
  stampManifestPublisher(libraryPath, defaultPublisher);
4026
4181
  const knownKinds = new Set(registry.getAllKinds());
4027
4182
  const unknownKind = pruneUnknownKindAssets(libraryPath, knownKinds);
4028
4183
  const removed = pruneMissingRootAssets(libraryPath);
4029
4184
  const skipped = [];
4185
+ const failed = [];
4030
4186
  const publisher = loadSkPublishManifest(libraryPath)?.publisher ?? defaultPublisher;
4031
4187
  const scanned = await scanDirectory(libraryPath, publisher, {
4032
4188
  knownKinds,
4033
4189
  keepDuplicates: true
4034
4190
  });
4035
- const rootOf = (e) => path15.relative(libraryPath, path15.dirname(e.source)) || e.name;
4191
+ const rootOf = (e) => path16.relative(libraryPath, path16.dirname(e.source)) || e.name;
4036
4192
  const copiesOf = /* @__PURE__ */ new Map();
4037
4193
  for (const e of scanned) {
4038
4194
  const key = `${e.kind}:${e.name}`;
@@ -4045,6 +4201,9 @@ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
4045
4201
  );
4046
4202
  if (copies.length > 1 && !claimed) unclaimed.add(key);
4047
4203
  }
4204
+ const listedAtStart = new Set(
4205
+ (loadSkPublishManifest(libraryPath)?.assets ?? []).map((a) => `${a.kind}:${a.name}`)
4206
+ );
4048
4207
  for (const e of scanned) {
4049
4208
  if (!isParsable(e.source)) {
4050
4209
  skipped.push({
@@ -4052,7 +4211,7 @@ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
4052
4211
  name: e.name,
4053
4212
  reason: "unparsable",
4054
4213
  detail: "manifest file could not be parsed",
4055
- file: path15.relative(libraryPath, e.source)
4214
+ file: path16.relative(libraryPath, e.source)
4056
4215
  });
4057
4216
  continue;
4058
4217
  }
@@ -4062,7 +4221,7 @@ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
4062
4221
  name: e.name,
4063
4222
  reason: "invalid-version",
4064
4223
  detail: `version "${e.version}" is not valid semver`,
4065
- file: path15.relative(libraryPath, e.source)
4224
+ file: path16.relative(libraryPath, e.source)
4066
4225
  });
4067
4226
  continue;
4068
4227
  }
@@ -4077,10 +4236,23 @@ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
4077
4236
  name: e.name,
4078
4237
  reason: "duplicate",
4079
4238
  detail: conflict,
4080
- file: path15.relative(libraryPath, e.source)
4239
+ file: path16.relative(libraryPath, e.source)
4081
4240
  });
4082
4241
  continue;
4083
4242
  }
4243
+ const findings = opts.check?.(e) ?? [];
4244
+ const known = listedAtStart.has(`${e.kind}:${e.name}`);
4245
+ const inManifest = known || !(findings.length > 0 && !e.version);
4246
+ if (findings.length > 0) {
4247
+ failed.push({
4248
+ kind: e.kind,
4249
+ name: e.name,
4250
+ file: path16.relative(libraryPath, e.source),
4251
+ findings,
4252
+ inManifest
4253
+ });
4254
+ }
4255
+ if (!inManifest) continue;
4084
4256
  upsertManifestAsset(libraryPath, {
4085
4257
  kind: e.kind,
4086
4258
  name: e.name,
@@ -4088,11 +4260,35 @@ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
4088
4260
  version: e.version
4089
4261
  });
4090
4262
  }
4091
- return { removed, unknownKind, skipped };
4263
+ return { removed, unknownKind, skipped, failed };
4264
+ }
4265
+ async function scanUnlistedAssets(libraryPath, publisher, registry) {
4266
+ const manifest = loadSkPublishManifest(libraryPath);
4267
+ if (!manifest || manifest.source) return [];
4268
+ const entries = manifest.assets ?? [];
4269
+ const roots = entries.flatMap(
4270
+ (a) => a.root && !a.source ? [path16.resolve(libraryPath, a.root)] : []
4271
+ );
4272
+ const scanned = await scanDirectory(libraryPath, manifest.publisher ?? publisher, {
4273
+ knownKinds: new Set(registry.getAllKinds()),
4274
+ keepDuplicates: true
4275
+ });
4276
+ const out = [];
4277
+ for (const e of scanned) {
4278
+ const file = path16.resolve(e.source);
4279
+ if (roots.some((r) => file === r || file.startsWith(r + path16.sep))) continue;
4280
+ const registered = entries.find((a) => a.kind === e.kind && a.name === e.name && a.root);
4281
+ out.push({
4282
+ entry: e,
4283
+ root: path16.relative(libraryPath, path16.dirname(e.source)) || e.name,
4284
+ ...registered?.root ? { registeredAt: registered.root } : {}
4285
+ });
4286
+ }
4287
+ return out;
4092
4288
  }
4093
4289
  function isParsable(file) {
4094
4290
  try {
4095
- return parseManifestFile(file, fs10.readFileSync(file, "utf-8")).ok;
4291
+ return parseManifestFile(file, fs11.readFileSync(file, "utf-8")).ok;
4096
4292
  } catch {
4097
4293
  return false;
4098
4294
  }
@@ -4149,33 +4345,33 @@ function parseWorkspaceV2(raw) {
4149
4345
  return WorkspaceConfigV2Schema.parse(raw);
4150
4346
  }
4151
4347
  function loadWorkspaceV2(dir, filename = "skaile.yaml") {
4152
- const filePath = path15.join(dir, filename);
4153
- if (!fs10.existsSync(filePath)) return null;
4154
- const content = fs10.readFileSync(filePath, "utf-8");
4348
+ const filePath = path16.join(dir, filename);
4349
+ if (!fs11.existsSync(filePath)) return null;
4350
+ const content = fs11.readFileSync(filePath, "utf-8");
4155
4351
  const raw = parse(content);
4156
4352
  if (!raw || typeof raw !== "object") return null;
4157
4353
  return parseWorkspaceV2(raw);
4158
4354
  }
4159
4355
  function saveWorkspaceV2(dir, v2, filename = "skaile.yaml") {
4160
- const filePath = path15.join(dir, filename);
4356
+ const filePath = path16.join(dir, filename);
4161
4357
  let existing = {};
4162
- if (fs10.existsSync(filePath)) {
4163
- const content = fs10.readFileSync(filePath, "utf-8");
4358
+ if (fs11.existsSync(filePath)) {
4359
+ const content = fs11.readFileSync(filePath, "utf-8");
4164
4360
  existing = parse(content) ?? {};
4165
4361
  }
4166
4362
  existing.version = 2;
4167
4363
  if (v2.library !== void 0) existing.library = v2.library;
4168
4364
  if (v2.presets_applied !== void 0) existing.presets_applied = v2.presets_applied;
4169
- if (!fs10.existsSync(dir)) {
4170
- fs10.mkdirSync(dir, { recursive: true });
4365
+ if (!fs11.existsSync(dir)) {
4366
+ fs11.mkdirSync(dir, { recursive: true });
4171
4367
  }
4172
- fs10.writeFileSync(filePath, stringify(existing, { indent: 2 }), "utf-8");
4368
+ fs11.writeFileSync(filePath, stringify(existing, { indent: 2 }), "utf-8");
4173
4369
  }
4174
4370
  var LOCK_FILENAME = "skaile.lock.yaml";
4175
4371
  function loadLockFile(dir) {
4176
- const filePath = path15.join(dir, LOCK_FILENAME);
4177
- if (!fs10.existsSync(filePath)) return null;
4178
- const content = fs10.readFileSync(filePath, "utf-8");
4372
+ const filePath = path16.join(dir, LOCK_FILENAME);
4373
+ if (!fs11.existsSync(filePath)) return null;
4374
+ const content = fs11.readFileSync(filePath, "utf-8");
4179
4375
  const raw = parse(content);
4180
4376
  if (raw !== null && !("assignments" in raw) && "subscriptions" in raw) {
4181
4377
  const legacySubs = raw.subscriptions;
@@ -4191,11 +4387,11 @@ function loadLockFile(dir) {
4191
4387
  return LockFileSchema.parse(raw);
4192
4388
  }
4193
4389
  function saveLockFile(dir, lock) {
4194
- const filePath = path15.join(dir, LOCK_FILENAME);
4195
- if (!fs10.existsSync(dir)) {
4196
- fs10.mkdirSync(dir, { recursive: true });
4390
+ const filePath = path16.join(dir, LOCK_FILENAME);
4391
+ if (!fs11.existsSync(dir)) {
4392
+ fs11.mkdirSync(dir, { recursive: true });
4197
4393
  }
4198
- fs10.writeFileSync(
4394
+ fs11.writeFileSync(
4199
4395
  filePath,
4200
4396
  `# Auto-generated by skaile. Do not edit manually.
4201
4397
  ${stringify(lock, { indent: 2 })}`,
@@ -4212,14 +4408,14 @@ function createEmptyLockFile() {
4212
4408
  };
4213
4409
  }
4214
4410
  function detectWorkspaceVersion(dir, filename = "skaile.yaml") {
4215
- const filePath = path15.join(dir, filename);
4216
- if (!fs10.existsSync(filePath)) return null;
4217
- const content = fs10.readFileSync(filePath, "utf-8");
4411
+ const filePath = path16.join(dir, filename);
4412
+ if (!fs11.existsSync(filePath)) return null;
4413
+ const content = fs11.readFileSync(filePath, "utf-8");
4218
4414
  const raw = parse(content);
4219
4415
  if (!raw || typeof raw !== "object") return null;
4220
4416
  return raw.version === 2 ? 2 : 1;
4221
4417
  }
4222
4418
 
4223
- export { AssignmentNotFoundError, CatalogCache, CatalogConfigSchema, CatalogHttpError, DuplicateAssignmentError, DuplicateLibraryNameError, GitSyncDriver, InstanceHasConsumersError, InstanceNotFoundError, InterpolationError, KnowledgeManifestSchema, LIBRARY_BACKENDS, LIBRARY_OWNERSHIPS, LOCAL_CATALOG_URL, LibraryConfigSchema, LibraryError, LibraryInstanceRefSchema, LibraryManager, LibrarySectionSchema, LibrarySyncError, LocalCatalogSource, LocalIndex, LocalSyncDriver, LockAssignmentSchema, LockFileSchema, OfflineError, OperationNotPermittedError, PIN_POLICIES, PinPolicySchema, PresetAppliedSchema, PresetExpandedSchema, RemoteCatalogSource, RequiresEdgeSchema, RestCatalogSource, SidecarGit, SkaileConfigSchema, SourceNotFoundError, TarballHashMismatchError, UserLibraryNotFoundError, WorkspaceConfigV2Schema, applyNonStructuralUpgrade, applyPreset, applyPresetFromData, assertManifestEditable, assertValidLibraryName, classifyRef, cloneOrInitGitRepo, conflictingAssetRoot, createEmptyLockFile, curatedManifestOverlay, deriveSlug, detectChanges, detectNestedPresetRefs, detectWorkspaceVersion, ensureGitRepo, evaluateUpgrade, extractLibraryInstanceId, extractReferencedKeys, filterKey, getConfigDefaults, getDefaultValue, getSidecarRoot, getStoreManifestsDir, getStoreRoot, hasInterpolationTokens, installLibraryAsset, interpolate, isGitRepo, isLocalCatalogUrl, isSecretPlaceholder, knowledgeKindProvider, listSidecarSlugsOnDisk, loadLockFile, loadWorkspaceV2, migrateSidecarsToStoreIfNeeded, migrateWorkspaceConfig, missingRootAssets, parsePreset, parsePresetYaml, parseWorkspaceV2, projectConfigPath, pruneMissingRootAssets, queryInstancePickerChoices, resolveAllItems, resolveConfig, resolveIndexPath, resolveItem, resolvePin, resolveSidecarPaths, saveConfig, saveLockFile, saveWorkspaceV2, scanAuthoringLibraries, scanLibraryRoot, setManifestPublisher, setOriginUrl, sha256Hex, stampManifestPublisher, storeSecrets, syncManifestWithDisk, trackOriginBranch, trpcGetUrl, upsertManifestAsset, validateAllPlaceholders, validateKnowledge, validateNestingDepth, validatePlaceholder, writeCuratedManifest };
4224
- //# sourceMappingURL=chunk-4MQS7CAF.js.map
4225
- //# sourceMappingURL=chunk-4MQS7CAF.js.map
4419
+ export { AssignmentNotFoundError, CatalogCache, CatalogConfigSchema, CatalogHttpError, DuplicateAssignmentError, DuplicateLibraryNameError, GitSyncDriver, InstanceHasConsumersError, InstanceNotFoundError, InterpolationError, KnowledgeManifestSchema, LIBRARY_BACKENDS, LIBRARY_OWNERSHIPS, LOCAL_CATALOG_URL, LibraryConfigSchema, LibraryError, LibraryInstanceRefSchema, LibraryManager, LibrarySectionSchema, LibrarySyncError, LocalCatalogSource, LocalIndex, LocalSyncDriver, LockAssignmentSchema, LockFileSchema, OfflineError, OperationNotPermittedError, PIN_POLICIES, PinPolicySchema, PresetAppliedSchema, PresetExpandedSchema, RemoteCatalogSource, RequiresEdgeSchema, RestCatalogSource, SidecarGit, SkaileConfigSchema, SourceNotFoundError, TarballHashMismatchError, UserLibraryNotFoundError, WorkspaceConfigV2Schema, applyNonStructuralUpgrade, applyPreset, applyPresetFromData, assertManifestEditable, assertValidLibraryName, classifyRef, cloneOrInitGitRepo, conflictingAssetRoot, createEmptyLockFile, curatedManifestOverlay, deriveSlug, detectChanges, detectNestedPresetRefs, detectWorkspaceVersion, ensureGitRepo, evaluateUpgrade, extractLibraryInstanceId, extractReferencedKeys, filterKey, getConfigDefaults, getDefaultValue, getSidecarRoot, getStoreManifestsDir, getStoreRoot, hasInterpolationTokens, installLibraryAsset, interpolate, isGitRepo, isLocalCatalogUrl, isSecretPlaceholder, knowledgeKindProvider, libraryDirMissing, listSidecarSlugsOnDisk, loadLockFile, loadWorkspaceV2, markLibraryUnregistered, migrateSidecarsToStoreIfNeeded, migrateWorkspaceConfig, missingLibraryDirMessage, missingRootAssets, parsePreset, parsePresetYaml, parseWorkspaceV2, projectConfigPath, pruneMissingRootAssets, queryInstancePickerChoices, resolveAllItems, resolveConfig, resolveIndexPath, resolveItem, resolvePin, resolveSidecarPaths, saveConfig, saveLockFile, saveWorkspaceV2, scanAuthoringLibraries, scanLibraryRoot, scanUnlistedAssets, setManifestPublisher, setOriginUrl, sha256Hex, stampManifestPublisher, storeSecrets, syncManifestWithDisk, trackOriginBranch, trpcGetUrl, unregisteredLibraryNames, upsertManifestAsset, validateAllPlaceholders, validateKnowledge, validateNestingDepth, validatePlaceholder, writeCuratedManifest };
4420
+ //# sourceMappingURL=chunk-3BEY4WK3.js.map
4421
+ //# sourceMappingURL=chunk-3BEY4WK3.js.map