@skaile/workspaces 6.1.0 → 6.3.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 (406) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/ai-sdk.d.ts +2 -0
  3. package/dist/ai-sdk.js +111 -0
  4. package/dist/ai-sdk.js.map +1 -0
  5. package/dist/{asset-feeds-HJFV7UPW.js → asset-feeds-3YO2352Y.js} +26 -26
  6. package/dist/{asset-feeds-HJFV7UPW.js.map → asset-feeds-3YO2352Y.js.map} +1 -1
  7. package/dist/asset-manager/catalog-deployer.js +10 -10
  8. package/dist/asset-manager/fragments.js +1 -1
  9. package/dist/asset-manager/index.js +18 -18
  10. package/dist/asset-manager/installer.js +13 -13
  11. package/dist/asset-manager/renderers.js +11 -11
  12. package/dist/asset-manager/src/index.d.ts +149 -16
  13. package/dist/asset-manager/src/index.d.ts.map +1 -1
  14. package/dist/asset-manager/src/installer.d.ts +9 -0
  15. package/dist/asset-manager/src/installer.d.ts.map +1 -1
  16. package/dist/asset-manager/src/renderers.d.ts +7 -0
  17. package/dist/asset-manager/src/renderers.d.ts.map +1 -1
  18. package/dist/bridge/harnesses/claude-sdk.js +16 -15
  19. package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
  20. package/dist/bridge/harnesses/codex.js +25 -17
  21. package/dist/bridge/harnesses/codex.js.map +1 -1
  22. package/dist/bridge/harnesses/continue.js +15 -14
  23. package/dist/bridge/harnesses/continue.js.map +1 -1
  24. package/dist/bridge/harnesses/echo.js +5 -4
  25. package/dist/bridge/harnesses/echo.js.map +1 -1
  26. package/dist/bridge/harnesses/gemini.js +11 -10
  27. package/dist/bridge/harnesses/goose.js +15 -14
  28. package/dist/bridge/harnesses/goose.js.map +1 -1
  29. package/dist/bridge/harnesses/omp.js +16 -8
  30. package/dist/bridge/harnesses/omp.js.map +1 -1
  31. package/dist/bridge/harnesses/opencode.js +15 -14
  32. package/dist/bridge/harnesses/opencode.js.map +1 -1
  33. package/dist/bridge/harnesses/qwen.js +11 -10
  34. package/dist/bridge/harnesses/qwen.js.map +1 -1
  35. package/dist/bridge/index.js +21 -19
  36. package/dist/bridge/src/ai-sdk.d.ts +46 -0
  37. package/dist/bridge/src/ai-sdk.d.ts.map +1 -0
  38. package/dist/bridge/src/harness-model-check.d.ts +15 -0
  39. package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
  40. package/dist/bridge/src/harnesses/_subprocess-cli.d.ts.map +1 -1
  41. package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
  42. package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
  43. package/dist/bridge/src/index.d.ts +2 -1
  44. package/dist/bridge/src/index.d.ts.map +1 -1
  45. package/dist/bridge/src/provider-registry-load.d.ts +30 -0
  46. package/dist/bridge/src/provider-registry-load.d.ts.map +1 -0
  47. package/dist/bridge/src/runner-private-env.d.ts +7 -0
  48. package/dist/bridge/src/runner-private-env.d.ts.map +1 -1
  49. package/dist/{chunk-SVTMNSPI.js → chunk-2TFKXSB5.js} +5 -5
  50. package/dist/{chunk-SVTMNSPI.js.map → chunk-2TFKXSB5.js.map} +1 -1
  51. package/dist/{chunk-NB7SYQYP.js → chunk-32FYVSSW.js} +9 -28
  52. package/dist/chunk-32FYVSSW.js.map +1 -0
  53. package/dist/{chunk-QAKUD6QN.js → chunk-4QRJBY2P.js} +3 -3
  54. package/dist/{chunk-QAKUD6QN.js.map → chunk-4QRJBY2P.js.map} +1 -1
  55. package/dist/{chunk-XFIEVEU7.js → chunk-6OHZUUR7.js} +5 -4
  56. package/dist/chunk-6OHZUUR7.js.map +1 -0
  57. package/dist/{chunk-ILLTBKDJ.js → chunk-6UP2EDFN.js} +4 -313
  58. package/dist/chunk-6UP2EDFN.js.map +1 -0
  59. package/dist/{chunk-ZDLUQLI6.js → chunk-6WH2WE4B.js} +15 -5
  60. package/dist/chunk-6WH2WE4B.js.map +1 -0
  61. package/dist/{chunk-HPMQRAIF.js → chunk-72NT2TJU.js} +8 -7
  62. package/dist/chunk-72NT2TJU.js.map +1 -0
  63. package/dist/{chunk-E572OHGY.js → chunk-76FLBODK.js} +4 -3
  64. package/dist/chunk-76FLBODK.js.map +1 -0
  65. package/dist/{chunk-5Y2KGB4H.js → chunk-7MV3NHPT.js} +35 -9
  66. package/dist/chunk-7MV3NHPT.js.map +1 -0
  67. package/dist/{chunk-QEULL4Q3.js → chunk-7QG2WRSN.js} +77 -18
  68. package/dist/chunk-7QG2WRSN.js.map +1 -0
  69. package/dist/{chunk-6YR4ALVX.js → chunk-7RH6E332.js} +7 -7
  70. package/dist/{chunk-6YR4ALVX.js.map → chunk-7RH6E332.js.map} +1 -1
  71. package/dist/{chunk-BBBCJSSU.js → chunk-7TSNR5H5.js} +4 -4
  72. package/dist/{chunk-BBBCJSSU.js.map → chunk-7TSNR5H5.js.map} +1 -1
  73. package/dist/{chunk-3GMOPFWH.js → chunk-AMJ6KEV7.js} +4 -4
  74. package/dist/{chunk-3GMOPFWH.js.map → chunk-AMJ6KEV7.js.map} +1 -1
  75. package/dist/{chunk-X3YGUKCG.js → chunk-BPTWWKGF.js} +3 -3
  76. package/dist/{chunk-X3YGUKCG.js.map → chunk-BPTWWKGF.js.map} +1 -1
  77. package/dist/{chunk-Z7ZEZZB6.js → chunk-C5HFK34M.js} +3 -3
  78. package/dist/chunk-C5HFK34M.js.map +1 -0
  79. package/dist/{chunk-EJPMNDTP.js → chunk-COUJOTAJ.js} +3 -3
  80. package/dist/{chunk-EJPMNDTP.js.map → chunk-COUJOTAJ.js.map} +1 -1
  81. package/dist/{chunk-J72MO2WA.js → chunk-DU26AVK2.js} +10 -9
  82. package/dist/chunk-DU26AVK2.js.map +1 -0
  83. package/dist/{chunk-YLLVSR2U.js → chunk-E5NQRHEB.js} +30 -7
  84. package/dist/chunk-E5NQRHEB.js.map +1 -0
  85. package/dist/{chunk-XGULGQA3.js → chunk-ELSGFI3I.js} +5 -4
  86. package/dist/chunk-ELSGFI3I.js.map +1 -0
  87. package/dist/{chunk-IHFGPHCT.js → chunk-EQNIBBB6.js} +49 -25
  88. package/dist/chunk-EQNIBBB6.js.map +1 -0
  89. package/dist/{chunk-BFMYYNDT.js → chunk-F3D25RGM.js} +11 -3
  90. package/dist/chunk-F3D25RGM.js.map +1 -0
  91. package/dist/{chunk-GNZBFSRB.js → chunk-H622YULS.js} +5 -4
  92. package/dist/chunk-H622YULS.js.map +1 -0
  93. package/dist/{chunk-FKQNBCDW.js → chunk-HDVLBEEX.js} +4 -4
  94. package/dist/{chunk-FKQNBCDW.js.map → chunk-HDVLBEEX.js.map} +1 -1
  95. package/dist/{chunk-AATHJRKL.js → chunk-HGOJEVHY.js} +4 -4
  96. package/dist/{chunk-AATHJRKL.js.map → chunk-HGOJEVHY.js.map} +1 -1
  97. package/dist/{chunk-CEKW3KXP.js → chunk-HH2H2ZV7.js} +18 -15
  98. package/dist/chunk-HH2H2ZV7.js.map +1 -0
  99. package/dist/{chunk-ZFUZ5AKM.js → chunk-HTGTNN2B.js} +3 -3
  100. package/dist/{chunk-ZFUZ5AKM.js.map → chunk-HTGTNN2B.js.map} +1 -1
  101. package/dist/{chunk-LSSYC5IC.js → chunk-IZQOO6MN.js} +2 -2
  102. package/dist/{chunk-LSSYC5IC.js.map → chunk-IZQOO6MN.js.map} +1 -1
  103. package/dist/{chunk-VMVDAZLA.js → chunk-J5JRGBKK.js} +108 -19
  104. package/dist/chunk-J5JRGBKK.js.map +1 -0
  105. package/dist/{chunk-7LP7RCZI.js → chunk-JGH7NB47.js} +5 -5
  106. package/dist/{chunk-7LP7RCZI.js.map → chunk-JGH7NB47.js.map} +1 -1
  107. package/dist/{chunk-RHN5MRQO.js → chunk-JMIKGAUA.js} +27 -5
  108. package/dist/chunk-JMIKGAUA.js.map +1 -0
  109. package/dist/{chunk-HWNK3F3X.js → chunk-KGHYXXXV.js} +588 -76
  110. package/dist/chunk-KGHYXXXV.js.map +1 -0
  111. package/dist/{chunk-7HX6FNKL.js → chunk-KIPCBIFJ.js} +41 -56
  112. package/dist/chunk-KIPCBIFJ.js.map +1 -0
  113. package/dist/{chunk-ZBHZLWV3.js → chunk-KPKGWXUJ.js} +4 -4
  114. package/dist/{chunk-ZBHZLWV3.js.map → chunk-KPKGWXUJ.js.map} +1 -1
  115. package/dist/{chunk-ABFPSVIS.js → chunk-LD6O6QKU.js} +31 -7
  116. package/dist/chunk-LD6O6QKU.js.map +1 -0
  117. package/dist/{chunk-AZ2H6R5I.js → chunk-LEJQAX7G.js} +74 -39
  118. package/dist/chunk-LEJQAX7G.js.map +1 -0
  119. package/dist/{chunk-ZAELRYKS.js → chunk-MD3FUZS3.js} +3 -3
  120. package/dist/{chunk-ZAELRYKS.js.map → chunk-MD3FUZS3.js.map} +1 -1
  121. package/dist/{chunk-NUA33BYO.js → chunk-MYXFR27L.js} +42 -15
  122. package/dist/chunk-MYXFR27L.js.map +1 -0
  123. package/dist/{chunk-KUQAJVYT.js → chunk-PHAMYCZH.js} +142 -28
  124. package/dist/chunk-PHAMYCZH.js.map +1 -0
  125. package/dist/{chunk-NOA6EJXE.js → chunk-PKE3PXOK.js} +3 -3
  126. package/dist/{chunk-NOA6EJXE.js.map → chunk-PKE3PXOK.js.map} +1 -1
  127. package/dist/{chunk-RDTLPOPD.js → chunk-PL52CI4U.js} +4 -4
  128. package/dist/{chunk-RDTLPOPD.js.map → chunk-PL52CI4U.js.map} +1 -1
  129. package/dist/{chunk-VYVTEMAW.js → chunk-PNUM7GUY.js} +3 -3
  130. package/dist/{chunk-VYVTEMAW.js.map → chunk-PNUM7GUY.js.map} +1 -1
  131. package/dist/{chunk-DIGFA7Z5.js → chunk-Q7CU5GQO.js} +13 -5
  132. package/dist/chunk-Q7CU5GQO.js.map +1 -0
  133. package/dist/chunk-QFFMFZIR.js +32 -0
  134. package/dist/chunk-QFFMFZIR.js.map +1 -0
  135. package/dist/{chunk-HMISULVD.js → chunk-QK7AG5AV.js} +4 -4
  136. package/dist/{chunk-HMISULVD.js.map → chunk-QK7AG5AV.js.map} +1 -1
  137. package/dist/{chunk-2LAPHLDH.js → chunk-QTLUZUF2.js} +45 -35
  138. package/dist/chunk-QTLUZUF2.js.map +1 -0
  139. package/dist/{chunk-4MUDQCBP.js → chunk-RFQONXET.js} +3 -3
  140. package/dist/{chunk-4MUDQCBP.js.map → chunk-RFQONXET.js.map} +1 -1
  141. package/dist/{chunk-AITJ7ELM.js → chunk-ROVZCGTN.js} +59 -23
  142. package/dist/chunk-ROVZCGTN.js.map +1 -0
  143. package/dist/{chunk-LSI2IVFT.js → chunk-RXGPFAMN.js} +4 -3
  144. package/dist/chunk-RXGPFAMN.js.map +1 -0
  145. package/dist/chunk-S6KZHPR4.js +315 -0
  146. package/dist/chunk-S6KZHPR4.js.map +1 -0
  147. package/dist/{chunk-EX3GLAL6.js → chunk-TGV2EWGL.js} +5 -5
  148. package/dist/{chunk-EX3GLAL6.js.map → chunk-TGV2EWGL.js.map} +1 -1
  149. package/dist/{chunk-QSYQOTWN.js → chunk-TO5SSMRI.js} +58 -5
  150. package/dist/chunk-TO5SSMRI.js.map +1 -0
  151. package/dist/{chunk-Z3VKUWAX.js → chunk-TSTRH4SM.js} +3 -3
  152. package/dist/{chunk-Z3VKUWAX.js.map → chunk-TSTRH4SM.js.map} +1 -1
  153. package/dist/{chunk-5J4NPGFM.js → chunk-U3SXCVR7.js} +5 -5
  154. package/dist/{chunk-5J4NPGFM.js.map → chunk-U3SXCVR7.js.map} +1 -1
  155. package/dist/{chunk-IRYKRKVQ.js → chunk-URCJIV7T.js} +3 -3
  156. package/dist/{chunk-IRYKRKVQ.js.map → chunk-URCJIV7T.js.map} +1 -1
  157. package/dist/{chunk-ASWTQQ7E.js → chunk-V5BPDB4J.js} +3 -3
  158. package/dist/{chunk-ASWTQQ7E.js.map → chunk-V5BPDB4J.js.map} +1 -1
  159. package/dist/{chunk-ADPM6AYF.js → chunk-VSX2G7LA.js} +3 -3
  160. package/dist/{chunk-ADPM6AYF.js.map → chunk-VSX2G7LA.js.map} +1 -1
  161. package/dist/{chunk-4FVIT5DI.js → chunk-VUWRGMT6.js} +3 -3
  162. package/dist/{chunk-4FVIT5DI.js.map → chunk-VUWRGMT6.js.map} +1 -1
  163. package/dist/{chunk-ZHGKAZJ7.js → chunk-XBQTXGY4.js} +56 -8
  164. package/dist/chunk-XBQTXGY4.js.map +1 -0
  165. package/dist/{chunk-UI745XC3.js → chunk-XEVFSDIF.js} +13 -7
  166. package/dist/chunk-XEVFSDIF.js.map +1 -0
  167. package/dist/{chunk-S2XHGWQC.js → chunk-Y3I4KGLX.js} +44 -15
  168. package/dist/chunk-Y3I4KGLX.js.map +1 -0
  169. package/dist/{chunk-COYF6IG2.js → chunk-YW4ASEUP.js} +5 -5
  170. package/dist/{chunk-COYF6IG2.js.map → chunk-YW4ASEUP.js.map} +1 -1
  171. package/dist/{chunk-DGTI65OC.js → chunk-ZEH4WFEG.js} +17 -11
  172. package/dist/chunk-ZEH4WFEG.js.map +1 -0
  173. package/dist/{claude-code-RE46FJXI.js → claude-code-EUKDGOOO.js} +5 -5
  174. package/dist/{claude-code-RE46FJXI.js.map → claude-code-EUKDGOOO.js.map} +1 -1
  175. package/dist/cli/index.js +350 -141
  176. package/dist/cli/index.js.map +1 -1
  177. package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
  178. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  179. package/dist/cli/src/commands/config.d.ts.map +1 -1
  180. package/dist/cli/src/commands/diff.d.ts.map +1 -1
  181. package/dist/cli/src/commands/harness.d.ts.map +1 -1
  182. package/dist/cli/src/commands/integration.d.ts.map +1 -1
  183. package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
  184. package/dist/cli/src/commands/library-index.d.ts +8 -1
  185. package/dist/cli/src/commands/library-index.d.ts.map +1 -1
  186. package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
  187. package/dist/cli/src/commands/outdated.d.ts.map +1 -1
  188. package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
  189. package/dist/cli/src/commands/project.d.ts.map +1 -1
  190. package/dist/cli/src/commands/providers.d.ts.map +1 -1
  191. package/dist/cli/src/commands/rebuild.d.ts.map +1 -1
  192. package/dist/cli/src/commands/run.d.ts.map +1 -1
  193. package/dist/cli/src/commands/serve-preflight.d.ts +31 -1
  194. package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
  195. package/dist/cli/src/commands/serve.d.ts +10 -0
  196. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  197. package/dist/cli/src/commands/source-manifest-publish.d.ts.map +1 -1
  198. package/dist/cli/src/commands/source-manifest.d.ts +19 -7
  199. package/dist/cli/src/commands/source-manifest.d.ts.map +1 -1
  200. package/dist/cli/src/commands/validate-instances.d.ts.map +1 -1
  201. package/dist/cli/src/commands/validate.d.ts.map +1 -1
  202. package/dist/cli/src/commands/why.d.ts.map +1 -1
  203. package/dist/cli/src/config-checks.d.ts +23 -5
  204. package/dist/cli/src/config-checks.d.ts.map +1 -1
  205. package/dist/cli/src/harness-error.d.ts +12 -1
  206. package/dist/cli/src/harness-error.d.ts.map +1 -1
  207. package/dist/cli/src/helpers.d.ts +18 -8
  208. package/dist/cli/src/helpers.d.ts.map +1 -1
  209. package/dist/cli/src/plugin-store/index.d.ts +10 -1
  210. package/dist/cli/src/plugin-store/index.d.ts.map +1 -1
  211. package/dist/cli/src/plugin-store/spec.d.ts +8 -0
  212. package/dist/cli/src/plugin-store/spec.d.ts.map +1 -1
  213. package/dist/cli/src/skill-checks.d.ts +2 -2
  214. package/dist/cli/src/skill-checks.d.ts.map +1 -1
  215. package/dist/connectors/config.js +5 -5
  216. package/dist/connectors/index.js +24 -22
  217. package/dist/connectors/src/connector-manager.d.ts.map +1 -1
  218. package/dist/connectors-XYPE2DCQ.js +50 -0
  219. package/dist/{connectors-7THEF7YA.js.map → connectors-XYPE2DCQ.js.map} +1 -1
  220. package/dist/core/framework.js +1 -1
  221. package/dist/core/index.js +9 -9
  222. package/dist/core/manifest.js +2 -2
  223. package/dist/core/models.js +1 -1
  224. package/dist/core/provider-registry-credentials.js +2 -2
  225. package/dist/core/provider-registry.js +1 -1
  226. package/dist/core/publish-manifest.js +3 -3
  227. package/dist/core/ref.js +1 -1
  228. package/dist/core/runtime-assets.js +5 -5
  229. package/dist/core/src/framework.d.ts +5 -3
  230. package/dist/core/src/framework.d.ts.map +1 -1
  231. package/dist/core/src/index.d.ts +2 -1
  232. package/dist/core/src/index.d.ts.map +1 -1
  233. package/dist/core/src/lock.d.ts +12 -0
  234. package/dist/core/src/lock.d.ts.map +1 -1
  235. package/dist/core/src/manifest.d.ts +15 -0
  236. package/dist/core/src/manifest.d.ts.map +1 -1
  237. package/dist/core/src/models.d.ts +7 -0
  238. package/dist/core/src/models.d.ts.map +1 -1
  239. package/dist/core/src/provider-registry.d.ts +6 -0
  240. package/dist/core/src/provider-registry.d.ts.map +1 -1
  241. package/dist/core/src/workspace-config.d.ts +10 -1
  242. package/dist/core/src/workspace-config.d.ts.map +1 -1
  243. package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
  244. package/dist/core/workspace-config.js +4 -4
  245. package/dist/deploy/index.js +9 -9
  246. package/dist/discovery/index.js +5 -5
  247. package/dist/discovery/src/parse-manifest.d.ts.map +1 -1
  248. package/dist/{ensure-sources-IH7CHSJF.js → ensure-sources-IN3VKHUA.js} +37 -21
  249. package/dist/ensure-sources-IN3VKHUA.js.map +1 -0
  250. package/dist/factory-assets/connectors/box.js +24 -22
  251. package/dist/factory-assets/connectors/deploy.js +24 -22
  252. package/dist/factory-assets/connectors/devserver.js +24 -22
  253. package/dist/factory-assets/connectors/flow/adapter.js +24 -22
  254. package/dist/factory-assets/connectors/flow/engine.js +10 -10
  255. package/dist/factory-assets/connectors/flow/run-flow.d.ts.map +1 -1
  256. package/dist/factory-assets/connectors/flow/run-flow.js +26 -24
  257. package/dist/factory-assets/connectors/flow.js +24 -22
  258. package/dist/factory-assets/connectors/git.js +24 -22
  259. package/dist/factory-assets/connectors/gmail.js +24 -22
  260. package/dist/factory-assets/connectors/googledrive.js +24 -22
  261. package/dist/factory-assets/connectors/local.js +24 -22
  262. package/dist/factory-assets/connectors/mattermost.js +24 -22
  263. package/dist/factory-assets/connectors/memory.js +24 -22
  264. package/dist/factory-assets/connectors/minio.js +24 -22
  265. package/dist/factory-assets/connectors/postgres.js +24 -22
  266. package/dist/factory-assets/connectors/s3.js +24 -22
  267. package/dist/factory-assets/connectors/sharepoint.js +24 -22
  268. package/dist/factory-assets/connectors/sqlite.js +24 -22
  269. package/dist/factory-assets/connectors/static-server.js +24 -22
  270. package/dist/factory-assets/connectors/tunnel.js +24 -22
  271. package/dist/factory-assets/connectors/webdav.js +24 -22
  272. package/dist/factory-assets/connectors/xstate-store.js +24 -22
  273. package/dist/factory-assets/connectors/xstate.js +24 -22
  274. package/dist/flows-QAO63TDV.js +26 -0
  275. package/dist/{flows-4JZQ3XFK.js.map → flows-QAO63TDV.js.map} +1 -1
  276. package/dist/helpers-HDVGCF3M.js +54 -0
  277. package/dist/{helpers-JNMK3FC2.js.map → helpers-HDVGCF3M.js.map} +1 -1
  278. package/dist/library/index.js +14 -14
  279. package/dist/library/install.js +5 -5
  280. package/dist/library/src/index.d.ts +1 -1
  281. package/dist/library/src/index.d.ts.map +1 -1
  282. package/dist/library/src/install/index.d.ts +1 -1
  283. package/dist/library/src/install/index.d.ts.map +1 -1
  284. package/dist/library/src/install/install-from-manifest.d.ts +13 -0
  285. package/dist/library/src/install/install-from-manifest.d.ts.map +1 -1
  286. package/dist/library/src/install/source-fetch-github.d.ts.map +1 -1
  287. package/dist/library/src/manifest-writer.d.ts.map +1 -1
  288. package/dist/library/src/remote/remote-catalog-source.d.ts +3 -1
  289. package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
  290. package/dist/library/src/remote/rest-catalog-source.d.ts +3 -2
  291. package/dist/library/src/remote/rest-catalog-source.d.ts.map +1 -1
  292. package/dist/{library-publish-I3UWXAHI.js → library-publish-62OWCNB5.js} +56 -55
  293. package/dist/library-publish-62OWCNB5.js.map +1 -0
  294. package/dist/model-endpoint/index.js +13 -12
  295. package/dist/model-endpoint/src/openai-chat.d.ts +7 -2
  296. package/dist/model-endpoint/src/openai-chat.d.ts.map +1 -1
  297. package/dist/model-endpoint/src/openai-shared.d.ts +8 -0
  298. package/dist/model-endpoint/src/openai-shared.d.ts.map +1 -1
  299. package/dist/model-endpoint/src/server.d.ts.map +1 -1
  300. package/dist/model-endpoint/src/types.d.ts +1 -1
  301. package/dist/model-endpoint/src/types.d.ts.map +1 -1
  302. package/dist/model-endpoint/src/usage-cost.d.ts +23 -0
  303. package/dist/model-endpoint/src/usage-cost.d.ts.map +1 -0
  304. package/dist/open-library-TZ7OSDEJ.js +58 -0
  305. package/dist/{open-library-NKKUJLWA.js.map → open-library-TZ7OSDEJ.js.map} +1 -1
  306. package/dist/open-registry-RLZKTJG3.js +32 -0
  307. package/dist/{open-registry-BYAXSHUI.js.map → open-registry-RLZKTJG3.js.map} +1 -1
  308. package/dist/paths-D6LBQETQ.js +22 -0
  309. package/dist/{paths-UKWE35XS.js.map → paths-D6LBQETQ.js.map} +1 -1
  310. package/dist/plugin-store-A5J4TLCH.js +23 -0
  311. package/dist/{plugin-store-ABE35NRX.js.map → plugin-store-A5J4TLCH.js.map} +1 -1
  312. package/dist/project-4AVRES3M.js +88 -0
  313. package/dist/{project-BIPK47JK.js.map → project-4AVRES3M.js.map} +1 -1
  314. package/dist/resolver/index.js +10 -10
  315. package/dist/runner/index.js +41 -39
  316. package/dist/runner/src/capability-roundtrip.d.ts +7 -6
  317. package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
  318. package/dist/runner/src/serve.d.ts +6 -5
  319. package/dist/runner/src/serve.d.ts.map +1 -1
  320. package/dist/sdk/asset-manager.js +18 -18
  321. package/dist/sdk/bridge.js +21 -19
  322. package/dist/sdk/core.js +9 -9
  323. package/dist/sdk/flow.js +10 -10
  324. package/dist/sdk/index.js +41 -39
  325. package/dist/sdk/index.js.map +1 -1
  326. package/dist/sdk/resolver.js +10 -10
  327. package/dist/sdk/runner.js +41 -39
  328. package/dist/sdk/transport/ws/server.js +10 -10
  329. package/dist/sdk/transport/ws.js +10 -10
  330. package/dist/sdk/transport.js +10 -10
  331. package/dist/{serve-preflight-FLTIBTEX.js → serve-preflight-H2AYMGJ6.js} +65 -35
  332. package/dist/serve-preflight-H2AYMGJ6.js.map +1 -0
  333. package/dist/{setup-AG6NFHSN.js → setup-NSPQD4V4.js} +33 -31
  334. package/dist/setup-NSPQD4V4.js.map +1 -0
  335. package/dist/skills-B533SRVZ.js +26 -0
  336. package/dist/{skills-UQYUHVKO.js.map → skills-B533SRVZ.js.map} +1 -1
  337. package/dist/source-VTECABUO.js +87 -0
  338. package/dist/{source-ASEHI2XS.js.map → source-VTECABUO.js.map} +1 -1
  339. package/dist/source-fetch-github-RWHV4I5Z.js +4 -0
  340. package/dist/{source-fetch-github-ST4MFL3D.js.map → source-fetch-github-RWHV4I5Z.js.map} +1 -1
  341. package/dist/{source-manifest-publish-IEVV3W6J.js → source-manifest-publish-YORI42MN.js} +56 -56
  342. package/dist/source-manifest-publish-YORI42MN.js.map +1 -0
  343. package/dist/transport/index.js +10 -10
  344. package/dist/transport/ws/server.js +10 -10
  345. package/dist/transport/ws.js +10 -10
  346. package/dist/tui/index.js +49 -40
  347. package/dist/tui/index.js.map +1 -1
  348. package/dist/tui/src/repl.d.ts.map +1 -1
  349. package/dist/types/manifests.js +1 -1
  350. package/dist/types/src/manifests/index.d.ts +1 -1
  351. package/dist/types/src/manifests/index.d.ts.map +1 -1
  352. package/dist/types/src/manifests/scaffold-body.d.ts +2 -0
  353. package/dist/types/src/manifests/scaffold-body.d.ts.map +1 -1
  354. package/dist/workspace-plugin/adapters/mcp.js +31 -29
  355. package/dist/workspace-plugin/adapters/omp.js +15 -15
  356. package/dist/workspace-plugin/index.js +2 -2
  357. package/package.json +27 -1
  358. package/dist/chunk-2LAPHLDH.js.map +0 -1
  359. package/dist/chunk-5Y2KGB4H.js.map +0 -1
  360. package/dist/chunk-7HX6FNKL.js.map +0 -1
  361. package/dist/chunk-ABFPSVIS.js.map +0 -1
  362. package/dist/chunk-AITJ7ELM.js.map +0 -1
  363. package/dist/chunk-AZ2H6R5I.js.map +0 -1
  364. package/dist/chunk-BFMYYNDT.js.map +0 -1
  365. package/dist/chunk-CEKW3KXP.js.map +0 -1
  366. package/dist/chunk-DGTI65OC.js.map +0 -1
  367. package/dist/chunk-DIGFA7Z5.js.map +0 -1
  368. package/dist/chunk-E572OHGY.js.map +0 -1
  369. package/dist/chunk-GNZBFSRB.js.map +0 -1
  370. package/dist/chunk-HPMQRAIF.js.map +0 -1
  371. package/dist/chunk-HWNK3F3X.js.map +0 -1
  372. package/dist/chunk-IHFGPHCT.js.map +0 -1
  373. package/dist/chunk-ILLTBKDJ.js.map +0 -1
  374. package/dist/chunk-J72MO2WA.js.map +0 -1
  375. package/dist/chunk-KUQAJVYT.js.map +0 -1
  376. package/dist/chunk-LSI2IVFT.js.map +0 -1
  377. package/dist/chunk-NB7SYQYP.js.map +0 -1
  378. package/dist/chunk-NUA33BYO.js.map +0 -1
  379. package/dist/chunk-QEULL4Q3.js.map +0 -1
  380. package/dist/chunk-QSYQOTWN.js.map +0 -1
  381. package/dist/chunk-RHN5MRQO.js.map +0 -1
  382. package/dist/chunk-S2XHGWQC.js.map +0 -1
  383. package/dist/chunk-UI745XC3.js.map +0 -1
  384. package/dist/chunk-VMVDAZLA.js.map +0 -1
  385. package/dist/chunk-XFIEVEU7.js.map +0 -1
  386. package/dist/chunk-XGULGQA3.js.map +0 -1
  387. package/dist/chunk-YLLVSR2U.js.map +0 -1
  388. package/dist/chunk-Z7ZEZZB6.js.map +0 -1
  389. package/dist/chunk-ZDLUQLI6.js.map +0 -1
  390. package/dist/chunk-ZHGKAZJ7.js.map +0 -1
  391. package/dist/connectors-7THEF7YA.js +0 -48
  392. package/dist/ensure-sources-IH7CHSJF.js.map +0 -1
  393. package/dist/flows-4JZQ3XFK.js +0 -26
  394. package/dist/helpers-JNMK3FC2.js +0 -38
  395. package/dist/library-publish-I3UWXAHI.js.map +0 -1
  396. package/dist/open-library-NKKUJLWA.js +0 -42
  397. package/dist/open-registry-BYAXSHUI.js +0 -32
  398. package/dist/paths-UKWE35XS.js +0 -22
  399. package/dist/plugin-store-ABE35NRX.js +0 -23
  400. package/dist/project-BIPK47JK.js +0 -86
  401. package/dist/serve-preflight-FLTIBTEX.js.map +0 -1
  402. package/dist/setup-AG6NFHSN.js.map +0 -1
  403. package/dist/skills-UQYUHVKO.js +0 -26
  404. package/dist/source-ASEHI2XS.js +0 -85
  405. package/dist/source-fetch-github-ST4MFL3D.js +0 -4
  406. package/dist/source-manifest-publish-IEVV3W6J.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../asset-manager/src/renderers.ts"],"names":["stringifyYaml"],"mappings":";;;;;;AA6GA,SAAS,YAAY,IAAA,EAAoB;AACvC,EAAA,IAAI;AACF,IAAA,IAAI,UAAU,IAAI,CAAA,CAAE,cAAA,EAAe,aAAc,IAAI,CAAA;AAAA,EACvD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;AAQA,SAAS,UAAA,CACP,QAAA,EACA,OAAA,EACA,aAAA,EACA,SACA,OAAA,EACM;AACN,EAAA,MAAM,GAAA,GAAM,QAAA,CAAS,aAAA,EAAe,QAAQ,CAAA;AAC5C,EAAA,OAAA,CAAQ,KAAK,GAAG,CAAA;AAChB,EAAA,WAAA,CAAY,QAAQ,CAAA;AACpB,EAAA,IAAI,UAAA,CAAW,QAAQ,CAAA,EAAG;AACxB,IAAA,IAAI;AACF,MAAA,IAAI,YAAA,CAAa,QAAA,EAAU,OAAO,CAAA,KAAM,OAAA,EAAS;AAAA,IACnD,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACA,EAAA,SAAA,CAAU,QAAQ,QAAQ,CAAA,EAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AAChD,EAAA,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A,CAAI,CAAA,kBAAA,EAAqB,CAAC,CAAA,CAAE,CAAA;AAC5D,EAAA,KAAA,MAAW,KAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,CAAA,QAAA,EAAW,CAAC,CAAA,CAAE,CAAA;AACnD,EAAA,OAAO,MAAA;AACT;AAUO,IAAM,eAAA,GAAiD;AAAA,EAC5D,aAAA,EAAe,kBAAA;AAAA,EACf,GAAA,EAAK,WAAA;AAAA,EACL,KAAA,EAAO;AACT;AASO,SAAS,4BAA4B,aAAA,EAAgC;AAC1E,EAAA,OAAO,aAAA,IAAiB,eAAA;AAC1B;AAQO,SAAS,gBAAA,CACd,aAAA,EACA,cAAA,EACA,SAAA,EACU;AACV,EAAA,QAAQ,aAAA;AAAe,IACrB,KAAK,aAAA;AACH,MAAA,OAAO,CAAC,IAAA,CAAK,cAAA,EAAgB,CAAA,EAAG,SAAS,KAAK,CAAC,CAAA;AAAA,IACjD,KAAK,OAAA;AACH,MAAA,OAAO;AAAA,QACL,IAAA,CAAK,cAAA,EAAgB,CAAA,EAAG,SAAS,CAAA,KAAA,CAAO,CAAA;AAAA,QACxC,KAAK,OAAA,CAAQ,cAAc,GAAG,kBAAA,EAAoB,CAAA,EAAG,SAAS,CAAA,GAAA,CAAK;AAAA,OACrE;AAAA,IACF,KAAK,KAAA;AACH,MAAA,OAAO;AAAA,QACL,IAAA,CAAK,cAAA,EAAgB,SAAA,EAAW,YAAY,CAAA;AAAA,QAC5C,IAAA,CAAK,cAAA,EAAgB,SAAA,EAAW,SAAS,CAAA;AAAA,QACzC,IAAA,CAAK,cAAA,EAAgB,CAAA,EAAG,SAAS,CAAA,GAAA,CAAK;AAAA,OACxC;AAAA,IACF;AACE,MAAA,OAAO,EAAC;AAAA;AAEd","file":"chunk-LD6O6QKU.js","sourcesContent":["/**\n * Framework-specific renderers for GitAgent packages.\n *\n * Each renderer transforms a parsed GitAgent package (agent.yaml + SOUL.md + RULES.md)\n * into the native file format that the target agent framework natively reads.\n *\n * Only harnesses with a full bridge harness (runtime execution) are included:\n * claude-code → .claude/agents/<name>.md (YAML frontmatter + markdown body)\n * omp → .omp/agents/<name>/ (directory with agent.yaml + SOUL.md)\n * codex → .codex/agents/<name>.toml (TOML)\n *\n * Removed (no bridge harness): cursor, roo, github-copilot, gemini, amp.\n * Add them back when a bridge harness is implemented.\n */\n\nimport {\n chmodSync,\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n unlinkSync,\n writeFileSync,\n} from \"node:fs\";\nimport { basename, dirname, join, normalize, relative, resolve } from \"node:path\";\nimport { buildAgentPromptSections } from \"@skaile/workspaces/core\";\nimport {\n ANTHROPIC_MODEL_ALIASES,\n type AgentLifecycle,\n type AgentManifest,\n normalizeAnthropicModel,\n} from \"@skaile/workspaces/types/manifests\";\nimport { stringify as stringifyYaml } from \"yaml\";\nimport type { AbilityRef, ContractRef } from \"./fragments.js\";\n\n// ── Types ─────────────────────────────────��───────────────────────────────────\n\nexport type { AgentManifest };\n\n/**\n * All data an {@link AgentRenderer} needs to produce a native agent definition file.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport interface AgentRenderInput {\n /** Parsed `agent.yaml` manifest for the GitAgent being rendered. */\n manifest: AgentManifest;\n /** Raw content of `SOUL.md`, or `null` if absent. */\n soul: string | null;\n /** Raw content of `RULES.md`, or `null` if absent. */\n rules: string | null;\n /** Raw content of `DUTIES.md`, or `null` if absent. */\n duties: string | null;\n /** Agent name used as the output filename and frontmatter `name` field. */\n agentName: string;\n /** Resolved absolute path to the framework's agent deploy directory (e.g. `.claude/agents/`). */\n agentDeployDir: string;\n /** Absolute path to the workspace root. */\n workspaceRoot: string;\n /** Resolved ability refs — installed skills referenced in the `## Installed Abilities` section. */\n abilityRefs: AbilityRef[];\n /** Resolved contract refs — installed in the skills dir, listed in the `## Contracts` section. */\n contractRefs: ContractRef[];\n /** Resolved framework fragment markdown blocks (agent-mode, handoff, skill-discovery, etc.). */\n frameworkFragments: string[];\n /** Per-project prompt extension markdown blocks loaded from `skaile.yaml` `agent.prompt-extensions`. */\n promptExtensions: string[];\n /** `standing` (long-running identity) or `role` (short-lived, callable). */\n lifecycle: AgentLifecycle;\n /** Names of the skills the agent composes (`composes[{kind: skill}]`), as installed. */\n skills: string[];\n /** Names of the MCP servers the agent's `mcp-server` slots are bound to. */\n mcpServers: string[];\n /**\n * Absolute path of the agent's source directory (where `agent.yaml` lives). The omp renderer\n * copies the local `composes` directories out of it.\n */\n srcDir?: string;\n}\n\n/**\n * Result returned by every {@link AgentRenderer}.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport interface AgentRenderResult {\n /** Paths to files/dirs rendered, relative to `workspaceRoot`. */\n created: string[];\n /** The subset of `created` whose bytes differ from what was on disk before (new or edited); an identical rewrite is skipped. */\n changed: string[];\n /** Non-fatal warnings (e.g. experimental feature notices). */\n warnings: string[];\n}\n\n/**\n * A function that transforms an {@link AgentRenderInput} into framework-native agent definition files.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport type AgentRenderer = (input: AgentRenderInput) => AgentRenderResult;\n\n// ── Helpers ───────────────────────────────────────────────────────────────────\n\n/**\n * Unlink a symlink (dangling or not) at a path skaile is about to write. `writeFileSync` follows\n * a link, so the write would land in the file the link points at: the user's own file, outside\n * the project (p1060). The link is replaced by the rendered file instead.\n */\nfunction dropSymlink(path: string): void {\n try {\n if (lstatSync(path).isSymbolicLink()) unlinkSync(path);\n } catch {\n // nothing at the path: the write creates it\n }\n}\n\n/**\n * Write an agent definition file. Agents are compiled artifacts — they must\n * reflect the current canonical source — but a file that already holds exactly\n * these bytes is left untouched (mtime included), so a repeat install is a no-op.\n * `created` lists every rendered path; `changed` only those that were (re)written.\n */\nfunction writeAgent(\n filePath: string,\n content: string,\n workspaceRoot: string,\n created: string[],\n changed: string[],\n): void {\n const rel = relative(workspaceRoot, filePath);\n created.push(rel);\n dropSymlink(filePath);\n if (existsSync(filePath)) {\n try {\n if (readFileSync(filePath, \"utf-8\") === content) return;\n } catch {\n // unreadable (e.g. a directory in the way): fall through to the write\n }\n }\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, content, \"utf-8\");\n changed.push(rel);\n}\n\n/**\n * Build the full agent system prompt body baked into the framework-native agent file.\n *\n * This is the sole source of the agent's system prompt body. Agent identity is rendered at install time; the harness reads it natively at runtime.\n * The rendered output ends up in .claude/agents/<name>.md, .omp/agents/<name>/SOUL.md,\n * .codex/agents/<name>.toml and is read natively by the framework on every agent invocation.\n *\n * Section order is owned by the shared builder (`buildAgentPromptSections` in\n * core, the same one the runner assembles its system prompt with):\n * soul → `<MEMORY>` → framework fragments → `## Constraints` (RULES) →\n * `## Duties` → `## Installed Abilities` → `## Contracts` → composed inline\n * blocks → prompt extensions.\n */\nfunction buildMarkdownBody(\n soul: string | null,\n rules: string | null,\n duties: string | null,\n abilityRefs: AbilityRef[],\n contractRefs: ContractRef[],\n frameworkFragments: string[],\n promptExtensions: string[],\n): string {\n const sections = buildAgentPromptSections({\n soul,\n constraints: rules,\n duties,\n abilities: abilityRefs,\n contracts: contractRefs,\n frameworkFragments,\n promptExtensions,\n });\n return `${sections.map((s) => s.text).join(\"\\n\\n\")}\\n`;\n}\n\n/** Escape a string for use as a TOML multi-line basic string (triple-quote). */\nfunction toTomlMultilineString(s: string): string {\n // Replace \"\"\" with \\\\\"\"\" to avoid breaking the TOML literal\n return s.replace(/\"\"\"/g, '\\\\\"\\\\\"\\\\\"');\n}\n\n/**\n * The manifest's `model` as a harness other than Claude Code can take it: the Claude Code\n * aliases (`inherit`, `opus`, `sonnet`, `haiku`) name no model of another harness' provider, so a\n * `preferred` that is one of them is dropped (the harness starts the agent on its own default) and\n * so is a `fallback` entry that is. Any other selector (`provider/model`, a full id, `@role`) is\n * the author's choice and is passed through. `undefined` when nothing is left.\n */\nfunction harnessModel(model: AgentManifest[\"model\"]): AgentManifest[\"model\"] | undefined {\n if (!model) return undefined;\n const claudeOnly = (m: string): boolean =>\n (ANTHROPIC_MODEL_ALIASES as readonly string[]).includes(m);\n const { preferred, fallback, ...rest } = model;\n const kept: NonNullable<AgentManifest[\"model\"]> = { ...rest };\n if (preferred && !claudeOnly(preferred)) kept.preferred = preferred;\n const fallbacks = (fallback ?? []).filter((m) => !claudeOnly(m));\n if (fallbacks.length > 0) kept.fallback = fallbacks;\n return Object.keys(kept).length > 0 ? kept : undefined;\n}\n\n/** Directory entries that are never part of an asset (build and OS leftovers). */\nconst COPY_SKIP = new Set([\".git\", \".DS_Store\", \"node_modules\", \"__pycache__\"]);\n\n/** Copy a file or directory tree byte for byte; a file that already holds these bytes is left alone. */\nfunction copyTree(from: string, to: string, workspaceRoot: string, changed: string[]): void {\n const stat = lstatSync(from);\n if (stat.isSymbolicLink()) return;\n if (stat.isDirectory()) {\n for (const name of readdirSync(from)) {\n if (COPY_SKIP.has(name) || name.endsWith(\".pyc\")) continue;\n copyTree(join(from, name), join(to, name), workspaceRoot, changed);\n }\n return;\n }\n if (!stat.isFile()) return;\n const bytes = readFileSync(from);\n dropSymlink(to);\n // A script keeps its exec bit: a copy that loses it shows as a mode change in `git status` (p1657).\n const executable = (stat.mode & 0o111) !== 0;\n if (existsSync(to)) {\n try {\n if (bytes.equals(readFileSync(to))) {\n if (executable && (lstatSync(to).mode & 0o100) === 0) chmodSync(to, stat.mode & 0o777);\n return;\n }\n } catch {\n // unreadable (e.g. a directory in the way): fall through to the write\n }\n }\n mkdirSync(dirname(to), { recursive: true });\n writeFileSync(to, bytes);\n if (executable) chmodSync(to, stat.mode & 0o777);\n changed.push(relative(workspaceRoot, to));\n}\n\n/**\n * Make the `composes` of an omp `agent.yaml` resolvable from where it is written: every local ref\n * (`./rules-local/house-rules`) is copied next to the `agent.yaml`, at the path the ref names, and a\n * local ref that climbs out of the agent directory (`../shared/rules`) is copied to\n * `composes/<name>` and rewritten to that path. Catalog refs (`skill:@pub/name`) are kept as written.\n */\nfunction bundleLocalComposes(\n composes: NonNullable<AgentManifest[\"composes\"]>,\n srcDir: string | undefined,\n destDir: string,\n workspaceRoot: string,\n changed: string[],\n warnings: string[],\n): NonNullable<AgentManifest[\"composes\"]> {\n if (!srcDir) return composes;\n return composes.map((item) => {\n if (!item.ref.startsWith(\"./\") && !item.ref.startsWith(\"../\")) return item;\n const from = resolve(srcDir, item.ref);\n if (!existsSync(from)) {\n warnings.push(`compose ref ${item.ref} not found at ${from}: not copied into ${destDir}`);\n return item;\n }\n const rel = normalize(item.ref);\n const inside = !rel.startsWith(\"..\");\n const target = inside ? rel : join(\"composes\", basename(from));\n copyTree(from, join(destDir, target), workspaceRoot, changed);\n return inside ? item : { ...item, ref: `./${target}` };\n });\n}\n\n// ── Claude Code ────────────��──────────────────────────────────────────────────\n// Format: .claude/agents/<name>.md\n// Sub-agent support: automatic (description-based) + @-mention\n// Required frontmatter: name, description\n//\n// Installation → runtime handoff:\n// skaile install (claudeCodeRenderer) creates the .md file from GitAgent source\n// ClaudeSdkHarness.startQuery() passes options.agent = agentName to the SDK query\n// The SDK reads .claude/agents/<agentName>.md to get model, tools, and system prompt\n// This is equivalent to running: claude --agent <agentName>\n\n/**\n * Render a GitAgent to Claude Code's `.claude/agents/<name>.md` format.\n *\n * Writes YAML frontmatter (name, description, model, tools, skills, mcpServers,\n * maxTurns, background) followed by the enriched system prompt body. `skills`\n * lists the composed skills, `mcpServers` the MCP servers the agent's\n * `mcp-server` slots are bound to, and `background: true` marks a `role`\n * instance whose `runtime.background` is set. Always overwrites to reflect\n * current source.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const claudeCodeRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n lifecycle,\n skills,\n mcpServers,\n}) => {\n const created: string[] = [];\n const changed: string[] = [];\n const warnings: string[] = [];\n\n const frontmatter: Record<string, unknown> = {\n name: agentName,\n description: manifest.description ?? `${agentName} agent`,\n };\n\n // Model: map to Claude Code's model field. Accepts aliases (sonnet/opus/haiku/inherit)\n // or a full Anthropic ID. Unrecognized values (e.g. legacy `claude-opus-4`) are\n // coerced to the matching family alias so the agent still loads.\n if (manifest.model?.preferred) {\n const raw = manifest.model.preferred;\n const normalized = normalizeAnthropicModel(raw);\n if (normalized !== raw) {\n warnings.push(\n `agent ${agentName}: model \"${raw}\" is not a valid Claude model ID; normalized to alias \"${normalized}\". Update agent.yaml.`,\n );\n }\n frontmatter.model = normalized;\n }\n\n // Tool restrictions\n if (manifest.tools?.allowed?.length) {\n frontmatter.tools = manifest.tools.allowed.join(\", \");\n }\n if (manifest.tools?.denied?.length) {\n frontmatter.disallowedTools = manifest.tools.denied.join(\", \");\n }\n\n if (skills.length > 0) frontmatter.skills = skills;\n if (mcpServers.length > 0) frontmatter.mcpServers = mcpServers;\n\n // Runtime\n if (manifest.runtime?.max_turns) {\n frontmatter.maxTurns = manifest.runtime.max_turns;\n }\n if (lifecycle === \"role\" && manifest.runtime?.background === true) {\n frontmatter.background = true;\n }\n\n // Metadata pass-through for Claude Code-specific fields\n if (manifest.metadata?.color) frontmatter.color = manifest.metadata.color;\n if (manifest.metadata?.effort) frontmatter.effort = manifest.metadata.effort;\n if (manifest.metadata?.isolation) frontmatter.isolation = manifest.metadata.isolation;\n\n const body = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n const content = `---\\n${stringifyYaml(frontmatter).trim()}\\n---\\n\\n${body}`;\n const filePath = join(agentDeployDir, `${agentName}.md`);\n writeAgent(filePath, content, workspaceRoot, created, changed);\n\n return { created, changed, warnings };\n};\n\n// ── OpenAI Codex ──────────────────────────────────────────────────────────────\n// Format: .codex/agents/<name>.toml\n// Sub-agent support: explicit user request only (not automatic)\n// Required fields: name, description, developer_instructions\n\n/**\n * Tools that change the workspace or run commands. Codex has no per-agent tool\n * allowlist; the closest per-agent control is `sandbox_mode`, so an agent whose\n * declared tool surface contains none of these is rendered `read-only`.\n */\nconst MUTATING_TOOLS = [\"Write\", \"Edit\", \"MultiEdit\", \"NotebookEdit\", \"Bash\"] as const;\n\n/** `read-only` when the manifest's tool surface cannot mutate anything, else `undefined` (inherit). */\nfunction codexSandboxMode(tools: AgentManifest[\"tools\"]): \"read-only\" | undefined {\n const allowed = tools?.allowed ?? [];\n const denied = new Set(tools?.denied ?? []);\n if (allowed.length > 0) {\n return allowed.some((t) => !denied.has(t) && (MUTATING_TOOLS as readonly string[]).includes(t))\n ? undefined\n : \"read-only\";\n }\n // No allowlist: everything not denied is available.\n return MUTATING_TOOLS.every((t) => denied.has(t)) ? \"read-only\" : undefined;\n}\n\n/** Directory (next to `agents/`) holding each Codex agent's markdown identity, one file per agent. */\nexport const CODEX_IDENTITY_DIR = \"skaile-agents\";\n\n/**\n * Render a GitAgent to OpenAI Codex's `.codex/agents/<name>.toml` format.\n *\n * Produces a TOML file with `name`, `description`, `model`, `sandbox_mode` and\n * `developer_instructions`. `sandbox_mode = \"read-only\"` is the per-agent tool\n * restriction: it is emitted when the manifest's `tools` leave the agent no way\n * to write or run commands (Codex has no per-tool allowlist). Triple-quoted\n * TOML multi-line strings are escaped to avoid syntax errors.\n *\n * Also writes the agent's identity as `.codex/skaile-agents/<name>.md`, which\n * the Codex harness combines with the session's runtime prompt (one file per\n * agent, so several instances never overwrite each other).\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const codexRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n}) => {\n const created: string[] = [];\n const changed: string[] = [];\n const warnings: string[] = [];\n\n const instructions = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n const escaped = toTomlMultilineString(instructions);\n\n const lines: string[] = [\n `name = ${JSON.stringify(agentName)}`,\n `description = ${JSON.stringify(manifest.description ?? `${agentName} agent`)}`,\n ];\n // A Claude Code alias (`sonnet`) names no Codex model: leave `model` out and Codex uses its own.\n const model = harnessModel(manifest.model)?.preferred;\n if (model) lines.push(`model = ${JSON.stringify(model)}`);\n const sandboxMode = codexSandboxMode(manifest.tools);\n if (sandboxMode) lines.push(`sandbox_mode = ${JSON.stringify(sandboxMode)}`);\n lines.push(`developer_instructions = \"\"\"`, escaped.trim(), `\"\"\"`);\n\n const content = `${lines.join(\"\\n\")}\\n`;\n const filePath = join(agentDeployDir, `${agentName}.toml`);\n writeAgent(filePath, content, workspaceRoot, created, changed);\n\n // Write the full agent identity as markdown for the Codex harness to read at runtime.\n // The harness combines this with the session's dynamic content (resources, context)\n // and passes the result via model_instructions_file.\n const agentMdPath = join(dirname(agentDeployDir), CODEX_IDENTITY_DIR, `${agentName}.md`);\n writeAgent(agentMdPath, instructions, workspaceRoot, created, changed);\n\n return { created, changed, warnings };\n};\n\n// ── oh-my-pi ─��────────────��────────────────────────────────��─────────────────\n// Format: .omp/agents/<name>/ (directory with agent.yaml + SOUL.md + RULES.md)\n// oh-my-pi reads GitAgent directories natively via PI_CODING_AGENT_DIR.\n// The renderer copies/enriches the source directory rather than flattening to .md.\n//\n// Installation → runtime handoff:\n// skaile install (ompRenderer) creates .omp/agents/<name>/ from GitAgent source\n// OmpHarness._start() sets env.PI_CODING_AGENT_DIR = agentDir in the child process\n// omp reads SOUL.md/RULES.md/knowledge/ from that directory natively on startup\n//\n// Note: REPL mode can bypass the install step — agentDir can point directly to the\n// GitAgent source directory, and omp will read it natively via PI_CODING_AGENT_DIR.\n// The rendered .omp/agents/ copy is only needed when the source is not accessible\n// from the project cwd (e.g. different repo, remote workspace).\n\n/**\n * Render a GitAgent to oh-my-pi's `.omp/agents/<name>/` directory format.\n *\n * Writes `agent.yaml` (resolved model/tools/delegation plus the 0.2\n * declaration — `composes` verbatim, `lifecycle`, `io`, `memory`, `triggers`,\n * `capabilities`) and an enriched `SOUL.md` that includes fragments and\n * extensions. omp reads this directory natively via the `PI_CODING_AGENT_DIR`\n * environment variable.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const ompRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n lifecycle,\n srcDir,\n}) => {\n const created: string[] = [];\n const changed: string[] = [];\n const warnings: string[] = [];\n\n const destDir = join(agentDeployDir, agentName);\n\n // Write agent.yaml with tools resolved\n const agentYaml: Record<string, unknown> = {\n spec_version: manifest.spec_version ?? \"0.2\",\n name: agentName,\n version: manifest.version ?? \"1.0.0\",\n description: manifest.description ?? `${agentName} agent`,\n lifecycle,\n };\n // The model: omp takes provider-prefixed full IDs and `@role` selectors, and resolves the\n // family aliases it knows (verified live 2026-09-20 against omp v18.1.10 through\n // teamclaude.postxl.com: `--model anthropic/opus` produced\n // `model_change {\"model\":\"anthropic/claude-opus-5\",\"resolvedModelIsFallback\":false}`).\n // The Claude Code aliases the manifest writes (`sonnet`, `haiku`, `opus`, `inherit`) name no\n // model of an omp deployment on another provider, so they are left out and omp starts the agent\n // on its own default. Any other selector is passed through verbatim: it is not checked here, and\n // not coerced by `normalizeAnthropicModel`, which would substitute a different model on any\n // provider but Anthropic (see `resolveManifestModel` in `@skaile/workspaces/bridge`).\n const model = harnessModel(manifest.model);\n if (model) agentYaml.model = model;\n if (manifest.tools) agentYaml.tools = manifest.tools;\n if (manifest.delegation) agentYaml.delegation = manifest.delegation;\n if (manifest.runtime) agentYaml.runtime = manifest.runtime;\n if (manifest.io) agentYaml.io = manifest.io;\n if (manifest.memory) agentYaml.memory = manifest.memory;\n if (manifest.triggers?.length) agentYaml.triggers = manifest.triggers;\n if (manifest.capabilities?.length) agentYaml.capabilities = manifest.capabilities;\n if (manifest.composes?.length) {\n agentYaml.composes = bundleLocalComposes(\n manifest.composes,\n srcDir,\n destDir,\n workspaceRoot,\n changed,\n warnings,\n );\n }\n if (manifest.tags?.length) agentYaml.tags = manifest.tags;\n if (manifest.metadata) agentYaml.metadata = manifest.metadata;\n\n writeAgent(join(destDir, \"agent.yaml\"), stringifyYaml(agentYaml), workspaceRoot, [], changed);\n\n // Write SOUL.md (enriched with fragments and extensions, like other renderers)\n const enrichedSoul = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n writeAgent(join(destDir, \"SOUL.md\"), enrichedSoul, workspaceRoot, [], changed);\n\n // omp lists the agents it can spawn from flat `.omp/agents/<name>.md` files only (verified live\n // against omp 18.12.5: a `<name>/agent.yaml` directory is not listed, a flat file is), so the\n // directory above carries the full GitAgent package and this file is what omp loads.\n const frontmatter: Record<string, unknown> = {\n name: agentName,\n description: manifest.description ?? `${agentName} agent`,\n };\n if (manifest.tools?.allowed?.length) frontmatter.tools = manifest.tools.allowed.join(\", \");\n const selector = model?.preferred;\n if (selector) frontmatter.model = selector;\n writeAgent(\n join(agentDeployDir, `${agentName}.md`),\n `---\\n${stringifyYaml(frontmatter).trim()}\\n---\\n\\n${enrichedSoul}`,\n workspaceRoot,\n created,\n changed,\n );\n\n created.push(relative(workspaceRoot, destDir));\n return { created, changed, warnings };\n};\n\n// ── Renderer registry ──────────────────────────────���──────────────────────────\n\nexport type Log = (msg: string) => void;\nconst noop: Log = () => {};\n\n/**\n * Render an agent to framework-native format via the renderer registry.\n *\n * Shared by both the simple deploy path (`deployAsset`) and the enriched scaffold path (agents layer).\n *\n * @param input - Full render input including manifest, SOUL/RULES text, and resolved refs.\n * @param harnessTarget - Agent framework ID to look up in {@link AGENT_RENDERERS}.\n * @param log - Optional logger callback for progress messages.\n * @returns Object with `created` file paths and `warnings` list.\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport function renderAgentToFramework(\n input: AgentRenderInput,\n harnessTarget: string,\n log: Log = noop,\n): AgentRenderResult {\n const renderer = AGENT_RENDERERS[harnessTarget];\n if (!renderer) {\n return {\n created: [],\n changed: [],\n warnings: [`No renderer for framework \"${harnessTarget}\"`],\n };\n }\n const result = renderer(input);\n for (const c of result.created) log(` rendered agent: ${c}`);\n for (const w of result.warnings) log(` warn: ${w}`);\n return result;\n}\n\n/**\n * Registry mapping framework IDs to their {@link AgentRenderer} functions.\n *\n * Only harnesses with a full bridge harness are registered. Add new entries\n * when a bridge harness is implemented in `workspaces/bridge/src/harnesses/`.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const AGENT_RENDERERS: Record<string, AgentRenderer> = {\n \"claude-code\": claudeCodeRenderer,\n omp: ompRenderer,\n codex: codexRenderer,\n};\n\n/**\n * Returns `true` if the given harness target supports file-based sub-agent installation.\n *\n * @param harnessTarget - Agent framework ID to check.\n * @returns `true` when `harnessTarget` has a registered entry in {@link AGENT_RENDERERS}.\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport function harnessTargetSupportsAgents(harnessTarget: string): boolean {\n return harnessTarget in AGENT_RENDERERS;\n}\n\n/**\n * The files the renderer of `harnessTarget` writes for the agent `agentName` into the agent deploy\n * directory `agentDeployDir` (`.claude/agents`, `.codex/agents`, `.omp/agents`): what `add\n * --dry-run` lists (p1621). Files a `composes:` of local refs adds to omp are not listed. Empty\n * for a harness target without an agent renderer.\n */\nexport function agentRenderFiles(\n harnessTarget: string,\n agentDeployDir: string,\n agentName: string,\n): string[] {\n switch (harnessTarget) {\n case \"claude-code\":\n return [join(agentDeployDir, `${agentName}.md`)];\n case \"codex\":\n return [\n join(agentDeployDir, `${agentName}.toml`),\n join(dirname(agentDeployDir), CODEX_IDENTITY_DIR, `${agentName}.md`),\n ];\n case \"omp\":\n return [\n join(agentDeployDir, agentName, \"agent.yaml\"),\n join(agentDeployDir, agentName, \"SOUL.md\"),\n join(agentDeployDir, `${agentName}.md`),\n ];\n default:\n return [];\n }\n}\n"]}
@@ -1,15 +1,15 @@
1
- import { requireValidPublisherOrExit } from './chunk-AITJ7ELM.js';
2
- import { openLibraryManager } from './chunk-RDTLPOPD.js';
3
- import { logErr, logWarn, logInfo, logOk, S } from './chunk-QEULL4Q3.js';
4
- import { getKindRegistry, getKnownKinds } from './chunk-COYF6IG2.js';
5
- import { AssetManager } from './chunk-HWNK3F3X.js';
6
- import { getStoreManifestsDir, storeManifestFile, LocalCatalogSource, curatedManifestOverlay, writeCuratedManifest, commitStoreManifest } from './chunk-S2XHGWQC.js';
7
- import { computeDeterministicHash, discoverAssetsInTree } from './chunk-UI745XC3.js';
8
- import { WorkspaceYamlEditor } from './chunk-VMVDAZLA.js';
9
- import { findWorkspaceRoot, workspaceConfigFilename, sourceShortName, sourceCacheKey, getGlobalCacheDir, attachToBranch, resolveSourcePublisher, resolveSkWorkspaceConfig, priorSourceCacheKeys, buildProvenanceIndex, getRepoCommit } from './chunk-ZHGKAZJ7.js';
1
+ import { requireValidPublisherOrExit } from './chunk-ROVZCGTN.js';
2
+ import { openLibraryManager } from './chunk-PL52CI4U.js';
3
+ import { getKindRegistry, getKnownKinds } from './chunk-YW4ASEUP.js';
4
+ import { S, logErr, logWarn, logInfo, logOk } from './chunk-7QG2WRSN.js';
5
+ import { AssetManager } from './chunk-KGHYXXXV.js';
6
+ import { getStoreManifestsDir, storeManifestFile, LocalCatalogSource, curatedManifestOverlay, writeCuratedManifest, commitStoreManifest } from './chunk-Y3I4KGLX.js';
7
+ import { computeDeterministicHash, discoverAssetsInTree } from './chunk-XEVFSDIF.js';
8
+ import { WorkspaceYamlEditor } from './chunk-J5JRGBKK.js';
9
+ import { findWorkspaceRoot, workspaceConfigFilename, sourceShortName, sourceCacheKey, getGlobalCacheDir, attachToBranch, resolveSourcePublisher, resolveSkWorkspaceConfig, priorSourceCacheKeys, buildProvenanceIndex, getRepoCommit } from './chunk-XBQTXGY4.js';
10
10
  import { globalCacheRoot } from './chunk-L5VSIPQD.js';
11
- import { decodeSkaileManifest, encodeSkaileManifest } from './chunk-ZBHZLWV3.js';
12
- import { parseAssetRef } from './chunk-LSSYC5IC.js';
11
+ import { decodeSkaileManifest, encodeSkaileManifest } from './chunk-KPKGWXUJ.js';
12
+ import { parseAssetRef } from './chunk-IZQOO6MN.js';
13
13
  import { spawnSync } from 'child_process';
14
14
  import { existsSync, realpathSync, rmSync, renameSync, mkdirSync, statSync, readdirSync, rmdirSync, readFileSync, writeFileSync } from 'fs';
15
15
  import * as os from 'os';
@@ -22,11 +22,12 @@ function notWired(verb) {
22
22
  logErr(`${NOT_WIRED_MSG} (verb: source manifest ${verb})`);
23
23
  process.exit(2);
24
24
  }
25
- function resolveSourceArg(arg, projectDir) {
25
+ function resolveSourceArg(arg, projectDir, opts = {}) {
26
26
  const root = findWorkspaceRoot(projectDir);
27
27
  const registered = root ? readProjectSources(path2.join(root, workspaceConfigFilename())) : [];
28
28
  const match = registered.find((e) => sourceMatchesKey(e, arg));
29
- const bySlug = !match ? resolveByStoreSlug(arg) : void 0;
29
+ const found = !match ? resolveByStoreSlug(arg, opts.byName ?? true) : void 0;
30
+ const bySlug = found && "url" in found ? found : void 0;
30
31
  const url = match ? match.url : bySlug?.url ?? normalizeSourceUrl(arg);
31
32
  const slug = sourceShortName(url);
32
33
  const dest = sourceClonePath(sourceCacheKey(url));
@@ -35,16 +36,49 @@ function resolveSourceArg(arg, projectDir) {
35
36
  slug,
36
37
  dest,
37
38
  manifestFile: bySlug?.manifestFile ?? storeManifestPath(url),
38
- guessed: !match && !bySlug
39
+ guessed: !match && !bySlug,
40
+ ...found && "ambiguous" in found ? { ambiguous: found.ambiguous } : {}
39
41
  };
40
42
  }
41
- function resolveByStoreSlug(arg) {
42
- if (!/^[\w.-]+__[\w.-]+/.test(arg) || /[/:\\]/.test(arg)) return void 0;
43
- const manifestFile = path2.join(getStoreManifestsDir(), `${arg}.yaml`);
44
- if (!existsSync(manifestFile)) return void 0;
45
- const [host, owner, repo] = arg.split("__");
46
- const url = host && owner && repo ? `https://${host}/${owner}/${repo}` : arg;
47
- return { url, manifestFile };
43
+ function storeManifestSlugs() {
44
+ try {
45
+ return readdirSync(getStoreManifestsDir()).filter((f) => f.endsWith(".yaml")).map((f) => f.slice(0, -".yaml".length));
46
+ } catch {
47
+ return [];
48
+ }
49
+ }
50
+ function cloneOriginUrl(key) {
51
+ const dest = sourceClonePath(key);
52
+ if (!existsSync(dest)) return void 0;
53
+ const r = spawnSync("git", ["-C", dest, "remote", "get-url", "origin"], { encoding: "utf8" });
54
+ const out = r.status === 0 ? r.stdout.trim() : "";
55
+ return out || void 0;
56
+ }
57
+ function resolveByStoreSlug(arg, byName) {
58
+ if (!/^[\w.-]+$/.test(arg)) return void 0;
59
+ const slugs = storeManifestSlugs();
60
+ let slug = slugs.includes(arg) ? arg : void 0;
61
+ if (!slug && byName) {
62
+ const named = slugs.filter(
63
+ (s) => s.startsWith(`${arg}-`) && /^[0-9a-f]{8}$/.test(s.slice(arg.length + 1))
64
+ );
65
+ if (named.length === 1) slug = named[0];
66
+ else if (named.length > 1) return { ambiguous: [...named].sort() };
67
+ }
68
+ if (!slug) return void 0;
69
+ const manifestFile = path2.join(getStoreManifestsDir(), `${slug}.yaml`);
70
+ if (slug.includes("__")) {
71
+ const [host, owner, repo] = slug.split("__");
72
+ return { url: host && owner && repo ? `https://${host}/${owner}/${repo}` : slug, manifestFile };
73
+ }
74
+ const origin = cloneOriginUrl(slug);
75
+ return origin ? { url: origin, manifestFile } : void 0;
76
+ }
77
+ function missingManifestMessage(slug, manifestFile, ambiguous) {
78
+ if (ambiguous?.length) {
79
+ return `"${slug}" matches several curated manifests: ${ambiguous.join(", ")} \u2014 pass one of these slugs or the full source URL.`;
80
+ }
81
+ return `No curated manifest for "${slug}" at ${S.dim(manifestFile)} \u2014 run \`skaile source manifest init\` first.`;
48
82
  }
49
83
  function storeManifestPath(url) {
50
84
  return storeManifestFile(url);
@@ -63,7 +97,14 @@ function isTestFixtureAsset(relativePath) {
63
97
  }
64
98
  async function runInit(arg, opts) {
65
99
  const projectDir = path2.resolve(opts.projectDir);
66
- const { url, dest, manifestFile: target, guessed } = resolveSourceArg(arg, projectDir);
100
+ const {
101
+ url,
102
+ dest,
103
+ manifestFile: target,
104
+ guessed
105
+ } = resolveSourceArg(arg, projectDir, {
106
+ byName: false
107
+ });
67
108
  if (guessed && /^[\w.-]+$/.test(arg.trim().replace(/\.git$/, ""))) {
68
109
  logErr(
69
110
  `"${arg}" is not a git URL or an owner/repo shorthand. Use \`skaile source manifest init <owner>/<repo>\` or the full URL.`
@@ -146,11 +187,9 @@ function entryRef(entry) {
146
187
  }
147
188
  async function runRebuild(arg, opts) {
148
189
  const projectDir = path2.resolve(opts.projectDir);
149
- const { url, dest, slug, manifestFile: target } = resolveSourceArg(arg, projectDir);
190
+ const { url, dest, slug, manifestFile: target, ambiguous } = resolveSourceArg(arg, projectDir);
150
191
  if (!existsSync(target)) {
151
- logErr(
152
- `No curated manifest for "${slug}" at ${S.dim(target)} \u2014 run \`skaile source manifest init\` first.`
153
- );
192
+ logErr(missingManifestMessage(slug, target, ambiguous));
154
193
  process.exit(1);
155
194
  }
156
195
  const entry = { url };
@@ -234,11 +273,9 @@ async function runRebuild(arg, opts) {
234
273
  }
235
274
  async function runVerify(arg, opts) {
236
275
  const projectDir = path2.resolve(opts.projectDir);
237
- const { url, dest, slug, manifestFile: target } = resolveSourceArg(arg, projectDir);
276
+ const { url, dest, slug, manifestFile: target, ambiguous } = resolveSourceArg(arg, projectDir);
238
277
  if (!existsSync(target)) {
239
- logErr(
240
- `No curated manifest for "${slug}" at ${S.dim(target)} \u2014 run \`skaile source manifest init\` first.`
241
- );
278
+ logErr(missingManifestMessage(slug, target, ambiguous));
242
279
  process.exit(1);
243
280
  }
244
281
  ensureClone({ url });
@@ -309,11 +346,9 @@ function resolveEditorCommand(editorEnv, target) {
309
346
  }
310
347
  function runEdit(arg, opts, spawn = spawnSync) {
311
348
  const projectDir = path2.resolve(opts.projectDir);
312
- const { slug, manifestFile: target } = resolveSourceArg(arg, projectDir);
349
+ const { slug, manifestFile: target, ambiguous } = resolveSourceArg(arg, projectDir);
313
350
  if (!existsSync(target)) {
314
- logErr(
315
- `No curated manifest for "${slug}" at ${target}. Run \`skaile source manifest init\` first.`
316
- );
351
+ logErr(missingManifestMessage(slug, target, ambiguous));
317
352
  process.exit(1);
318
353
  }
319
354
  const { command, args } = resolveEditorCommand(process.env.VISUAL || process.env.EDITOR, target);
@@ -345,12 +380,12 @@ function addSourceManifestCommands(src) {
345
380
  ).option("-C, --project-dir <dir>", "Project directory", process.cwd()).option("--publisher <name>", "Override the publisher (--overwrite only)").option("--dev", "Include assets under the source's dev_paths", false).option("--overwrite", "Discard curation and re-scan the full inventory", false).action((arg, opts) => runRebuild(arg, opts));
346
381
  manifest.command("verify <src>").description("Verify hashes, deps, and schema (read-only)").option("-C, --project-dir <dir>", "Project directory", process.cwd()).option("--strict", "Fail on advisory checks (warnings force a nonzero exit)", false).action((arg, opts) => runVerify(arg, opts));
347
382
  manifest.command("publish <src>").description("Push the curated sidecar manifest and publish it to the store").option("-C, --project-dir <dir>", "Project directory", process.cwd()).option("--as <namespace>", "Publisher namespace (default: your store username)").option("--sidecar-repo <url>", "Public GitHub repo you own to hold the curated manifest").option("--ref <gitref>", "Foreign source ref to ingest (branch/sha; default: main)").option("--dry-run", "Print the publish plan without pushing or calling the store", false).action(async (arg, opts) => {
348
- const { runPublish } = await import('./source-manifest-publish-IEVV3W6J.js');
383
+ const { runPublish } = await import('./source-manifest-publish-YORI42MN.js');
349
384
  await runPublish(arg, opts);
350
385
  });
351
386
  manifest.command("propose <src>").description("Open a PR to upstream with the sidecar manifest").action(() => notWired("propose"));
352
387
  manifest.command("yank <src>").description("Retract the source's published assets from the store").option("-C, --project-dir <dir>", "Project directory", process.cwd()).option("--asset <ref>", "Yank only the asset matching this ref/name").action(async (arg, opts) => {
353
- const { runYank } = await import('./source-manifest-publish-IEVV3W6J.js');
388
+ const { runYank } = await import('./source-manifest-publish-YORI42MN.js');
354
389
  await runYank(arg, opts);
355
390
  });
356
391
  }
@@ -1037,6 +1072,6 @@ function makeSourceCommand() {
1037
1072
  return cmd;
1038
1073
  }
1039
1074
 
1040
- export { autoSyncForSearch, divergedSourceClones, ensureClone, findCacheKeyCollision, indexingHadFailures, legacySourceConfigHint, loadProjectEditor, localPathNotASource, makeSourceCommand, normalizeSourceUrl, pullSourceClone, readProjectSources, resolveSource, resolveSourceArg, restoreSourceReaders, sourceClonePath, sourceLabel, sourceMatchesKey, syncProjectSources };
1041
- //# sourceMappingURL=chunk-AZ2H6R5I.js.map
1042
- //# sourceMappingURL=chunk-AZ2H6R5I.js.map
1075
+ export { autoSyncForSearch, divergedSourceClones, ensureClone, findCacheKeyCollision, indexingHadFailures, legacySourceConfigHint, loadProjectEditor, localPathNotASource, makeSourceCommand, missingManifestMessage, normalizeSourceUrl, pullSourceClone, readProjectSources, resolveSource, resolveSourceArg, restoreSourceReaders, sourceClonePath, sourceLabel, sourceMatchesKey, syncProjectSources };
1076
+ //# sourceMappingURL=chunk-LEJQAX7G.js.map
1077
+ //# sourceMappingURL=chunk-LEJQAX7G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../cli/src/commands/source-manifest.ts","../cli/src/commands/source.ts"],"names":["path","existsSync","readdirSync","spawnSync","dest"],"mappings":";;;;;;;;;;;;;;;;;;;AAmDA,IAAM,aAAA,GACJ,2IAAA;AAGF,SAAS,SAAS,IAAA,EAAqB;AACrC,EAAA,MAAA,CAAO,CAAA,EAAG,aAAa,CAAA,wBAAA,EAA2B,IAAI,CAAA,CAAA,CAAG,CAAA;AACzD,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAChB;AAsBO,SAAS,gBAAA,CACd,GAAA,EACA,UAAA,EACA,IAAA,GAA6B,EAAC,EAQ9B;AACA,EAAA,MAAM,IAAA,GAAO,kBAAkB,UAAU,CAAA;AACzC,EAAA,MAAM,UAAA,GAA4B,OAC9B,kBAAA,CAAwBA,KAAA,CAAA,IAAA,CAAK,MAAM,uBAAA,EAAyB,CAAC,CAAA,GAC7D,EAAC;AACL,EAAA,MAAM,KAAA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skaile.manifest.yaml` lifecycle for a\n * source you do NOT own. `init` generates a curated manifest from a discovery\n * run and stores it OUTSIDE the source, under the local store catalog\n * (`~/.skaile/store/manifests/<slug>.yaml`); `edit` opens it in `$EDITOR` and\n * re-validates on save. `source add`/`sync` then apply it as a read overlay\n * (see `source.ts` `refreshManifestCache`).\n *\n * `rebuild` refreshes a curated manifest after an upstream change (merge by\n * default — curation is sacred; `--overwrite` re-scans). `verify` is a\n * read-only integrity check (paths, declared hashes, schema, dep refs).\n * `publish`/`propose`/`yank` remain stubs — they need the store publish\n * endpoint (`POST /sources/<id>/manifest`), which lands in a follow-up.\n *\n * @docLink cli/commands/source#manifest\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, readdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport {\n type AssetEntry,\n decodeSkaileManifest,\n encodeSkaileManifest,\n findWorkspaceRoot,\n parseAssetRef,\n resolveSourcePublisher,\n type SkPublishManifest,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n workspaceConfigFilename,\n} from \"@skaile/workspaces/core\";\nimport { computeDeterministicHash, discoverAssetsInTree } from \"@skaile/workspaces/discovery\";\nimport {\n commitStoreManifest,\n getStoreManifestsDir,\n storeManifestFile,\n writeCuratedManifest,\n} from \"@skaile/workspaces/library\";\nimport type { Command } from \"commander\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\nimport {\n ensureClone,\n normalizeSourceUrl,\n readProjectSources,\n sourceClonePath,\n sourceMatchesKey,\n} from \"./source.ts\";\n\nconst NOT_WIRED_MSG =\n \"`skaile source manifest *` is scaffolded but not yet wired. \" +\n \"Server-side endpoint (`POST /sources/<id>/manifest`) lands in a follow-up PR.\";\n\nfunction notWired(verb: string): never {\n logErr(`${NOT_WIRED_MSG} (verb: source manifest ${verb})`);\n process.exit(2);\n}\n\n/**\n * Resolve a `source manifest` argument into a `{ url, slug, dest }` triple.\n *\n * Resolution order:\n * 1. A key matching an already-registered project source (stored URL, cache\n * key, or short slug).\n * 2. A **store slug** whose manifest already exists in\n * `~/.skaile/store/manifests/`: the exact file name (`<host>__<owner>__<repo>` or the\n * `<repo>-<hash>` key of a non-GitHub URL), or — for the verbs that find a manifest, not\n * for `init` — the bare repo name of a non-GitHub URL (`srcA` for `srcA-e2d8fe81.yaml`,\n * p1691). This MUST be tried before bare-name expansion: a bare name like `cli` would\n * otherwise expand (via `normalizeSourceUrl`) to the skaile-ai org and a DIFFERENT slug\n * than the one `init` wrote (e.g. `larksuite`). The slug is the exact identifier `init`'s\n * next-step hint prints back.\n * 3. Otherwise a git URL / `owner/repo` / bare name via `normalizeSourceUrl`.\n *\n * The clone dir is the same URL-keyed cache `source add` uses.\n *\n * `ambiguous` lists the manifest slugs a bare name matched when it matched several.\n */\nexport function resolveSourceArg(\n arg: string,\n projectDir: string,\n opts: { byName?: boolean } = {},\n): {\n url: string;\n slug: string;\n dest: string;\n manifestFile: string;\n guessed: boolean;\n ambiguous?: string[];\n} {\n const root = findWorkspaceRoot(projectDir);\n const registered: SourceEntry[] = root\n ? readProjectSources(path.join(root, workspaceConfigFilename()))\n : [];\n const match = registered.find((e) => sourceMatchesKey(e, arg));\n const found = !match ? resolveByStoreSlug(arg, opts.byName ?? true) : undefined;\n const bySlug = found && \"url\" in found ? found : undefined;\n const url = match ? match.url : (bySlug?.url ?? normalizeSourceUrl(arg));\n const slug = sourceShortName(url); // human-facing label\n const dest = sourceClonePath(sourceCacheKey(url));\n return {\n url,\n slug,\n dest,\n manifestFile: bySlug?.manifestFile ?? storeManifestPath(url),\n guessed: !match && !bySlug,\n ...(found && \"ambiguous\" in found ? { ambiguous: found.ambiguous } : {}),\n };\n}\n\n/** The slugs (file names without `.yaml`) of the curated manifests in the store. */\nfunction storeManifestSlugs(): string[] {\n try {\n return readdirSync(getStoreManifestsDir())\n .filter((f) => f.endsWith(\".yaml\"))\n .map((f) => f.slice(0, -\".yaml\".length));\n } catch {\n return [];\n }\n}\n\n/** The origin URL of the clone a `<repo>-<hash>` key names, or `undefined` when none is there. */\nfunction cloneOriginUrl(key: string): string | undefined {\n const dest = sourceClonePath(key);\n if (!existsSync(dest)) return undefined;\n const r = spawnSync(\"git\", [\"-C\", dest, \"remote\", \"get-url\", \"origin\"], { encoding: \"utf8\" });\n const out = r.status === 0 ? r.stdout.trim() : \"\";\n return out || undefined;\n}\n\n/**\n * When `arg` names a curated manifest that exists on disk, recover the source URL and point at\n * that manifest file directly. `arg` is a store slug (`<host>__<owner>__<repo>`, or the\n * `<repo>-<hash>` key `init` gives a non-GitHub URL) or, with `byName`, the bare repo name of\n * such a manifest (`srcA` for `srcA-e2d8fe81.yaml`). A GitHub manifest is never found by its bare\n * repo name: `cli` means the skaile-ai repo, not `larksuite/cli`.\n * Returns `{ ambiguous }` when a bare name matches several, and `undefined` when the arg is no\n * slug or has no manifest (fall back to URL normalization).\n */\nfunction resolveByStoreSlug(\n arg: string,\n byName: boolean,\n): { url: string; manifestFile: string } | { ambiguous: string[] } | undefined {\n // A slug is our own encoding — no path/URL sigils. Anything URL/owner-repo shaped is not one.\n if (!/^[\\w.-]+$/.test(arg)) return undefined;\n const slugs = storeManifestSlugs();\n let slug: string | undefined = slugs.includes(arg) ? arg : undefined;\n if (!slug && byName) {\n // Only the `<repo>-<hash>` file of a non-GitHub URL: a bare name never picks one org's\n // `github.com__<org>__<repo>` manifest over the skaile-ai repo it expands to.\n const named = slugs.filter(\n (s) => s.startsWith(`${arg}-`) && /^[0-9a-f]{8}$/.test(s.slice(arg.length + 1)),\n );\n if (named.length === 1) slug = named[0];\n else if (named.length > 1) return { ambiguous: [...named].sort() };\n }\n if (!slug) return undefined;\n const manifestFile = path.join(getStoreManifestsDir(), `${slug}.yaml`);\n if (slug.includes(\"__\")) {\n // `<host>__<owner>__<repo>` → `https://<host>/<owner>/<repo>` — good enough to key the clone\n // dir + re-derive the same slug; the manifest file is what edit actually opens.\n const [host, owner, repo] = slug.split(\"__\");\n return { url: host && owner && repo ? `https://${host}/${owner}/${repo}` : slug, manifestFile };\n }\n // `<repo>-<hash>`: the hash hides the URL; the clone `init` made remembers it.\n const origin = cloneOriginUrl(slug);\n return origin ? { url: origin, manifestFile } : undefined;\n}\n\n/**\n * The `No curated manifest …` line of a verb that needs one. A bare name that matched several\n * manifests (`ambiguous`) is told to pick a slug or the URL instead.\n */\nexport function missingManifestMessage(\n slug: string,\n manifestFile: string,\n ambiguous?: readonly string[],\n): string {\n if (ambiguous?.length) {\n return (\n `\"${slug}\" matches several curated manifests: ${ambiguous.join(\", \")} — ` +\n \"pass one of these slugs or the full source URL.\"\n );\n }\n return (\n `No curated manifest for \"${slug}\" at ${S.dim(manifestFile)} — ` +\n \"run `skaile source manifest init` first.\"\n );\n}\n\n/**\n * Absolute path to a source's curated store manifest. Keyed by the\n * collision-free {@link storeManifestSlug} (`<host>__<owner>__<repo>`) so\n * `orgA/cli` and `orgB/cli` don't share `cli.yaml`.\n */\nfunction storeManifestPath(url: string): string {\n return storeManifestFile(url);\n}\n\n/**\n * Directory-name segments that mark a test-fixture tree. `init`/`rebuild` drop\n * any asset whose repo-relative root contains one of these as an exact path\n * SEGMENT. Repos routinely ship fixture \"skills\" under such dirs (e.g.\n * `scripts/skill-format-check/tests`, `internal/qualitygate/skillscan/testdata/skills/lark-demo`)\n * that are not real, publishable assets.\n */\nconst TEST_FIXTURE_SEGMENTS = new Set([\n \"tests\",\n \"test\",\n \"__tests__\",\n \"testdata\",\n \"fixtures\",\n \"__fixtures__\",\n]);\n\n/**\n * True when an asset's repo-relative `root` sits under a test-fixture directory\n * (see {@link TEST_FIXTURE_SEGMENTS}). Conservative, not repo-specific — finer\n * curation (keeping a genuine fixture asset) stays the user's job via `edit`.\n * `init`/`rebuild`-path only; the general discovery walk (`source add`) is\n * untouched.\n */\nfunction isTestFixtureAsset(relativePath: string): boolean {\n const segments = relativePath.replace(/\\\\/g, \"/\").split(\"/\");\n return segments.some((s) => TEST_FIXTURE_SEGMENTS.has(s));\n}\n\n/**\n * `source manifest init <src>` — clone (if needed), run discovery, and write a\n * curated `skaile.manifest.yaml` to `~/.skaile/store/manifests/<slug>.yaml`.\n */\nasync function runInit(\n arg: string,\n opts: { projectDir: string; publisher?: string; dev?: boolean; force?: boolean },\n): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n const {\n url,\n dest,\n manifestFile: target,\n guessed,\n } = resolveSourceArg(arg, projectDir, {\n byName: false,\n });\n // The same rule `source add` applies (p394): a bare name that is no registered source and no\n // store slug used to expand to a made-up `skaile-ai/<name>` repo and clone it over SSH.\n if (guessed && /^[\\w.-]+$/.test(arg.trim().replace(/\\.git$/, \"\"))) {\n logErr(\n `\"${arg}\" is not a git URL or an owner/repo shorthand. ` +\n \"Use `skaile source manifest init <owner>/<repo>` or the full URL.\",\n );\n process.exitCode = 1;\n return;\n }\n\n if (existsSync(target) && !opts.force) {\n logWarn(\n `A curated manifest already exists at ${S.dim(target)}. ` +\n \"Edit it with `skaile source manifest edit`, refresh it after an upstream \" +\n \"change with `skaile source manifest rebuild`, or pass --force to regenerate.\",\n );\n return;\n }\n\n const entry: SourceEntry = { url };\n ensureClone(entry);\n\n const { assets, errors } = discoverCuratableAssets(dest, opts.dev ?? false);\n\n const publisher = opts.publisher ?? resolveSourcePublisher(dest) ?? sourceShortName(url);\n\n const written = writeCuratedManifest({\n manifestFile: target,\n publisher,\n assets,\n force: opts.force,\n // Init: every asset inherits the top-level repo `publisher`. Do NOT stamp a\n // per-asset publisher — glob discovery here runs without the resolved\n // publisher, so each DiscoveredAsset.publisher is only the clone directory\n // name, which would clobber the intended org/`--publisher` default with\n // junk per-asset overrides.\n inheritPublisher: true,\n });\n\n if (!written.wrote) {\n logWarn(\n `Curated manifest already exists at ${S.dim(target)} — not overwritten. ` +\n \"Pass --force to regenerate.\",\n );\n return;\n }\n\n commitStoreManifest(\n target,\n `manifest init: ${sourceShortName(url)} (${written.assetCount} assets)`,\n );\n logOk(`Wrote curated manifest with ${written.assetCount} assets to ${S.dim(target)}.`);\n // `edit` takes the <src> the user passed (`resolveSourceArg` maps it back to this\n // manifest), but `source add` needs the URL: a bare name there is no source.\n logInfo(\n `Edit it with \\`skaile source manifest edit ${arg}\\`, then ` +\n `\\`skaile source add ${url}\\` to consume it.`,\n );\n if (errors.length > 0) {\n logWarn(`${errors.length} discovery error(s) — inspect the manifest before consuming.`);\n }\n}\n\n/**\n * Run discovery over a clone and drop the test-fixture assets (see\n * {@link isTestFixtureAsset}). Shared by `init` and `rebuild` so both paths\n * produce an identical inventory from the same tree.\n */\nfunction discoverCuratableAssets(\n dest: string,\n includeDev: boolean,\n): { assets: ReturnType<typeof discoverAssetsInTree>[\"assets\"]; errors: string[] } {\n const result = discoverAssetsInTree(dest, {\n registry: getKindRegistry(),\n includeDev,\n });\n const assets = result.assets.filter((a) => !isTestFixtureAsset(a.relativePath));\n return { assets, errors: result.errors.map((e) => `${e.path}: ${e.error}`) };\n}\n\n/**\n * Best-effort `git pull --ff-only` on an existing clone. Never throws: a pull\n * failure (offline, diverged, detached) is warned and the caller continues with\n * the clone as-is.\n */\nfunction pullCloneFfOnly(dest: string): void {\n const res = spawnSync(\"git\", [\"-C\", dest, \"pull\", \"--ff-only\"], { stdio: \"pipe\" });\n if (res.status !== 0) {\n logWarn(\n \"git pull --ff-only failed — continuing with the existing clone \" +\n \"(it may be behind upstream).\",\n );\n }\n}\n\n/**\n * Repo-relative `root` path for a manifest asset entry — the merge match key\n * between an existing curated entry and a freshly-discovered asset. `root:`\n * entries use their declared path; a `files:`-only entry (rare for a curated\n * sidecar) falls back to the entry's dirname of the first file, else the name.\n */\nfunction entryRootKey(entry: AssetEntry): string {\n if (entry.root) return entry.root.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n const files = entry.files;\n if (files && files.length > 0) {\n const first = typeof files[0] === \"string\" ? files[0] : files[0].path;\n const dir = path.posix.dirname(first.replace(/\\\\/g, \"/\"));\n return dir === \".\" ? entry.name : dir;\n }\n return entry.name;\n}\n\n/** Repo-relative `root` path a discovered asset maps to (matches init's writer). */\nfunction discoveredRootKey(relativePath: string): string {\n const dir = path.posix.dirname(relativePath.replace(/\\\\/g, \"/\"));\n return dir === \".\" ? path.posix.basename(relativePath.replace(/\\\\/g, \"/\")) : dir;\n}\n\n/** Human ref for reporting: `kind:name`. */\nfunction entryRef(entry: AssetEntry): string {\n return `${entry.kind}:${entry.name}`;\n}\n\n/**\n * `source manifest rebuild <src>` — refresh a curated manifest after the\n * upstream repo changed. MERGE is the default (curation is sacred); `--overwrite`\n * re-scans from scratch with `init --force` semantics.\n *\n * Merge algorithm (match by repo-relative `root` path):\n * - Existing entries whose root is STILL discovered → KEPT verbatim (all\n * hand-edits preserved).\n * - Existing entries whose root is GONE upstream → DROPPED (reported).\n * - Freshly-discovered assets not already in the manifest → NOT auto-added,\n * only REPORTED (a curated foreign sidecar must not silently absorb new\n * upstream skills). An asset the curator deliberately dropped stays dropped\n * because it is neither in the existing manifest nor re-added here.\n */\nasync function runRebuild(\n arg: string,\n opts: { projectDir: string; publisher?: string; dev?: boolean; overwrite?: boolean },\n): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n const { url, dest, slug, manifestFile: target, ambiguous } = resolveSourceArg(arg, projectDir);\n\n if (!existsSync(target)) {\n logErr(missingManifestMessage(slug, target, ambiguous));\n process.exit(1);\n }\n\n // Update the clone: clone if absent, else pull --ff-only (best-effort).\n const entry: SourceEntry = { url };\n const cloned = ensureClone(entry);\n if (!cloned) pullCloneFfOnly(dest);\n\n const { assets: freshAssets, errors } = discoverCuratableAssets(dest, opts.dev ?? false);\n\n if (opts.overwrite) {\n logWarn(\n \"--overwrite: replacing the curated manifest with a full fresh inventory. \" +\n \"All hand-curation (dropped assets, per-asset edits) is discarded.\",\n );\n const publisher = opts.publisher ?? resolveSourcePublisher(dest) ?? sourceShortName(url);\n const written = writeCuratedManifest({\n manifestFile: target,\n publisher,\n assets: freshAssets,\n force: true,\n inheritPublisher: true,\n });\n commitStoreManifest(\n target,\n `manifest rebuild --overwrite: ${slug} (${written.assetCount} assets)`,\n );\n logOk(\n `Rebuilt curated manifest with ${written.assetCount} assets to ${S.dim(target)} (overwrite).`,\n );\n if (errors.length > 0) {\n logWarn(`${errors.length} discovery error(s) — inspect the manifest before consuming.`);\n }\n return;\n }\n\n // MERGE (default). `--publisher` only applies to the full re-derive path.\n if (opts.publisher) {\n logWarn(\n \"--publisher is ignored in merge mode (the curated publisher is preserved). \" +\n \"Use --overwrite to re-derive the publisher from a full re-scan.\",\n );\n }\n\n // Read the existing curated manifest and keep it as the base.\n const { manifest: existing } = decodeSkaileManifest(readFileSync(target, \"utf-8\"));\n const existingEntries = existing.assets ?? [];\n\n // Index fresh discovery by repo-relative root path.\n const freshByRoot = new Map<string, (typeof freshAssets)[number]>();\n for (const a of freshAssets) freshByRoot.set(discoveredRootKey(a.relativePath), a);\n\n const kept: AssetEntry[] = [];\n const dropped: string[] = [];\n for (const e of existingEntries) {\n if (freshByRoot.has(entryRootKey(e))) kept.push(e);\n else dropped.push(entryRef(e));\n }\n\n // Fresh assets not already curated → report as available, do NOT add.\n const existingRoots = new Set(existingEntries.map(entryRootKey));\n const newlyAvailable: string[] = [];\n for (const a of freshAssets) {\n if (!existingRoots.has(discoveredRootKey(a.relativePath))) {\n newlyAvailable.push(`${a.kind}:${a.name}`);\n }\n }\n\n const changed = dropped.length > 0;\n if (dropped.length > 0) {\n logWarn(`removed (gone upstream): ${dropped.sort().join(\", \")}`);\n }\n if (newlyAvailable.length > 0) {\n logInfo(\n `${newlyAvailable.length} new upstream asset(s) available (not added): ` +\n `${newlyAvailable.sort().join(\", \")} — add with \\`skaile source manifest edit ${arg}\\` if wanted`,\n );\n }\n\n if (!changed) {\n logOk(\"already up to date\");\n if (errors.length > 0) {\n logWarn(`${errors.length} discovery error(s) — inspect the source before re-consuming.`);\n }\n return;\n }\n\n const merged: SkPublishManifest = { ...existing, assets: kept };\n writeFileSync(target, encodeSkaileManifest(merged), \"utf-8\");\n commitStoreManifest(\n target,\n `manifest rebuild: ${slug} (kept ${kept.length}, dropped ${dropped.length})`,\n );\n logOk(\n `Rebuilt curated manifest: kept ${kept.length}, dropped ${dropped.length} → ${S.dim(target)}.`,\n );\n if (errors.length > 0) {\n logWarn(`${errors.length} discovery error(s) — inspect the source before re-consuming.`);\n }\n}\n\n/**\n * `source manifest verify <src>` — READ-ONLY integrity check of a curated\n * manifest against its clone. Writes nothing. Exit 0 when no errors; with\n * `--strict`, any warning also forces a nonzero exit.\n *\n * Per-asset checks:\n * - `root`/`files` paths still exist upstream (missing → error).\n * - A declared `sha256` recomputes to the same deterministic hash (mismatch → error).\n * - Schema decode diagnostics map to errors/warnings.\n * - Dependency refs parse via `parseAssetRef` (malformed → warning).\n */\nasync function runVerify(\n arg: string,\n opts: { projectDir: string; strict?: boolean },\n): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n const { url, dest, slug, manifestFile: target, ambiguous } = resolveSourceArg(arg, projectDir);\n\n if (!existsSync(target)) {\n logErr(missingManifestMessage(slug, target, ambiguous));\n process.exit(1);\n }\n\n // Ensure a clone exists to verify paths/hashes against (best-effort; no pull).\n ensureClone({ url });\n\n const text = readFileSync(target, \"utf-8\");\n const { manifest, diagnostics } = decodeSkaileManifest(text);\n\n const errors: string[] = [];\n const warnings: string[] = [];\n\n // Schema diagnostics from the decoder.\n for (const d of diagnostics) {\n const line = `${d.code}: ${d.message}`;\n if (d.severity === \"error\") errors.push(line);\n else warnings.push(line);\n }\n\n const assets = manifest.assets ?? [];\n for (const entry of assets) {\n const ref = entryRef(entry);\n\n // Path existence: `root` dir and/or each `files[]` path.\n const relPaths: string[] = [];\n if (entry.root) relPaths.push(entry.root);\n if (entry.files) {\n for (const f of entry.files) relPaths.push(typeof f === \"string\" ? f : f.path);\n }\n if (relPaths.length === 0) relPaths.push(entry.name);\n for (const rel of relPaths) {\n if (!existsSync(path.join(dest, rel))) {\n errors.push(`${ref}: path not found upstream: ${rel}`);\n }\n }\n\n // Declared sha256 → recompute + compare, but ONLY for granular `files:`\n // entries. Discovery (`discover-manifest.ts`) anchors a `files:`-only entry\n // at the REPO ROOT and hashes the files VERBATIM as repo-relative strings\n // (the path is folded into the digest), so verify must hash the same way:\n // `assetRoot = dest`, files kept repo-relative — NOT rebased onto the root.\n // A `root:` entry cannot be verified this way (discovery hashes only the\n // per-kind filtered set, not the whole-dir walk), and the writer never emits\n // sha256 for `root:` entries, so skip the hash check for them.\n if (entry.sha256) {\n if (entry.files && entry.files.length > 0) {\n const hashFiles = entry.files.map((f) =>\n (typeof f === \"string\" ? f : f.path).replace(/\\\\/g, \"/\"),\n );\n const actual = computeDeterministicHash(dest, hashFiles);\n if (actual !== entry.sha256) {\n errors.push(\n `${ref}: sha256 mismatch (declared ${entry.sha256.slice(0, 12)}…, got ${actual.slice(0, 12)}…)`,\n );\n }\n } else {\n warnings.push(\n `${ref}: declared sha256 on a root:-mode entry is not verifiable (discovery hashes only the per-kind filtered set) — skipped`,\n );\n }\n }\n\n // Dependency refs parse.\n for (const dep of entry.dependencies ?? []) {\n try {\n parseAssetRef(dep);\n } catch (err) {\n warnings.push(\n `${ref}: malformed dependency \"${dep}\": ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n }\n\n for (const w of warnings) logWarn(w);\n for (const e of errors) logErr(e);\n\n if (errors.length === 0) {\n logOk(`verified ${assets.length} asset(s).`);\n } else {\n logErr(`${errors.length} issue(s).`);\n }\n\n const failStrict = opts.strict && warnings.length > 0;\n if (errors.length > 0 || failStrict) process.exit(1);\n}\n\n/**\n * Split a `$VISUAL`/`$EDITOR` value into `{ command, args }` and append the file\n * as the final arg. The env value is a full command line, not a bare binary —\n * `EDITOR=\"code --wait\"` must spawn `code` with `[\"--wait\", <file>]`, and\n * `EDITOR=code` (which returns before save) is the user's problem, not ours.\n * A whitespace split covers the common editors (`code --wait`, `code -w`,\n * `subl -w`, `vi`); paths with embedded spaces are not supported (rare for an\n * editor binary and out of scope). Falls back to `vi` when unset/empty.\n *\n * @docLink cli/commands/source#manifest-edit\n */\nexport function resolveEditorCommand(\n editorEnv: string | undefined,\n target: string,\n): { command: string; args: string[] } {\n const parts = (editorEnv ?? \"\").trim().split(/\\s+/).filter(Boolean);\n const [command, ...rest] = parts.length > 0 ? parts : [\"vi\"];\n return { command: command as string, args: [...rest, target] };\n}\n\n/** Minimal spawn contract runEdit needs — lets tests inject a fake. */\ntype SpawnLike = (\n command: string,\n args: string[],\n opts: { stdio: \"inherit\" },\n) => { status: number | null };\n\n/**\n * `source manifest edit <src>` — open the curated store manifest in `$EDITOR`\n * and re-validate on save. Warnings are surfaced but never hard-fail.\n *\n * `spawn` is injectable so tests can assert the argv without launching a real\n * editor; production passes the default `spawnSync`.\n */\nexport function runEdit(\n arg: string,\n opts: { projectDir: string },\n spawn: SpawnLike = spawnSync as unknown as SpawnLike,\n): void {\n const projectDir = path.resolve(opts.projectDir);\n const { slug, manifestFile: target, ambiguous } = resolveSourceArg(arg, projectDir);\n\n if (!existsSync(target)) {\n logErr(missingManifestMessage(slug, target, ambiguous));\n process.exit(1);\n }\n\n const { command, args } = resolveEditorCommand(process.env.VISUAL || process.env.EDITOR, target);\n const res = spawn(command, args, { stdio: \"inherit\" });\n if (res.status !== 0 && res.status !== null) {\n logErr(`Editor exited with status ${res.status}.`);\n process.exit(1);\n }\n\n commitStoreManifest(target, `manifest edit: ${slug}`);\n\n // Re-validate the saved file; surface diagnostics as warnings, don't hard-fail.\n const { diagnostics } = decodeSkaileManifest(readFileSync(target, \"utf-8\"));\n const errors = diagnostics.filter((d) => d.severity === \"error\");\n const warnings = diagnostics.filter((d) => d.severity !== \"error\");\n if (errors.length > 0) {\n for (const d of errors) logErr(`${d.code}: ${d.message}`);\n logWarn(\"Manifest has errors — fix them before `skaile source add` will consume it.\");\n } else if (warnings.length > 0) {\n for (const d of warnings) logWarn(`${d.code}: ${d.message}`);\n logOk(\"Saved (with warnings).\");\n } else {\n logOk(\"Saved.\");\n }\n}\n\n/**\n * Append the `manifest` sub-tree to a `source` command.\n *\n * Called from `makeSourceCommand()` in `source.ts`.\n */\nexport function addSourceManifestCommands(src: Command): void {\n // enablePositionalOptions so options on the leaf verb (`source manifest init\n // --publisher …`) route to that verb instead of being rejected by `manifest`.\n const manifest = src\n .command(\"manifest\")\n .description(\"Curated manifest lifecycle for a source\")\n .enablePositionalOptions();\n\n manifest\n .command(\"init <src>\")\n .description(\"Generate a curated manifest for a source (stored in the local store catalog)\")\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .option(\"--publisher <name>\", \"Override the publisher (default: source's GitHub org)\")\n .option(\"--dev\", \"Include assets under the source's dev_paths\", false)\n .option(\"--force\", \"Overwrite an existing curated manifest\", false)\n .action((arg, opts) => runInit(arg, opts));\n\n manifest\n .command(\"edit <src>\")\n .description(\"Open the curated manifest in $EDITOR and re-validate on save\")\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .action((arg, opts) => runEdit(arg, opts));\n\n manifest\n .command(\"rebuild <src>\")\n .description(\n \"Refresh a curated manifest after an upstream change (merge by default: \" +\n \"keeps curation, drops assets gone upstream, reports new ones without adding)\",\n )\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .option(\"--publisher <name>\", \"Override the publisher (--overwrite only)\")\n .option(\"--dev\", \"Include assets under the source's dev_paths\", false)\n .option(\"--overwrite\", \"Discard curation and re-scan the full inventory\", false)\n .action((arg, opts) => runRebuild(arg, opts));\n\n manifest\n .command(\"verify <src>\")\n .description(\"Verify hashes, deps, and schema (read-only)\")\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .option(\"--strict\", \"Fail on advisory checks (warnings force a nonzero exit)\", false)\n .action((arg, opts) => runVerify(arg, opts));\n\n manifest\n .command(\"publish <src>\")\n .description(\"Push the curated sidecar manifest and publish it to the store\")\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .option(\"--as <namespace>\", \"Publisher namespace (default: your store username)\")\n .option(\"--sidecar-repo <url>\", \"Public GitHub repo you own to hold the curated manifest\")\n .option(\"--ref <gitref>\", \"Foreign source ref to ingest (branch/sha; default: main)\")\n .option(\"--dry-run\", \"Print the publish plan without pushing or calling the store\", false)\n .action(async (arg, opts) => {\n const { runPublish } = await import(\"./source-manifest-publish.ts\");\n await runPublish(arg, opts);\n });\n\n manifest\n .command(\"propose <src>\")\n .description(\"Open a PR to upstream with the sidecar manifest\")\n .action(() => notWired(\"propose\"));\n\n manifest\n .command(\"yank <src>\")\n .description(\"Retract the source's published assets from the store\")\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .option(\"--asset <ref>\", \"Yank only the asset matching this ref/name\")\n .action(async (arg, opts) => {\n const { runYank } = await import(\"./source-manifest-publish.ts\");\n await runYank(arg, opts);\n });\n}\n","/**\n * `skaile source …` — manage github sources for the current project.\n *\n * A *source* is a third-party github repo of AI assets. The project's\n * `skaile.yaml` `sources:` array is the source of truth for which sources\n * this project uses. The clone itself lives at\n * `<cache root>/sources/<host>/<owner>/<repo>/` (`~/.skaile/cache` unless `SKAILE_HOME` or\n * `SKAILE_CACHE_DIR` moves it; machine-global cache, shared across projects, URL-keyed so\n * cross-org repos never collide), and the manifest is mirrored into `<skaile home>/index.db`\n * (machine-global manifest cache).\n *\n * @docLink cli/commands/source\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport {\n existsSync,\n mkdirSync,\n readdirSync,\n realpathSync,\n renameSync,\n rmdirSync,\n rmSync,\n statSync,\n} from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport {\n attachToBranch,\n buildProvenanceIndex,\n findWorkspaceRoot,\n getGlobalCacheDir,\n getRepoCommit,\n globalCacheRoot,\n priorSourceCacheKeys,\n resolveSkWorkspaceConfig,\n resolveSourcePublisher,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n WorkspaceYamlEditor,\n workspaceConfigFilename,\n} from \"@skaile/workspaces/core\";\nimport { AssetManager } from \"@skaile/workspaces/asset-manager\";\nimport { curatedManifestOverlay, LocalCatalogSource } from \"@skaile/workspaces/library\";\nimport * as p from \"@clack/prompts\";\nimport { Command } from \"commander\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\nimport { openLibraryManager } from \"../open-library.ts\";\nimport { getKindRegistry, getKnownKinds } from \"../open-registry.ts\";\nimport { requireValidPublisherOrExit } from \"./library-index.ts\";\nimport { addSourceManifestCommands } from \"./source-manifest.ts\";\n\n/**\n * Clone dir for one source cache key (`<host>/<owner>/<repo>`). Exported for the\n * cache-path regression test. Callers pass `sourceCacheKey(url)`.\n */\nexport function sourceClonePath(key: string): string {\n return path.join(getGlobalCacheDir(), key);\n}\n\nconst SKAILE_MANIFEST_FILENAME = \"skaile.manifest.yaml\";\nconst LEGACY_SOURCE_CONFIG_FILENAME = \".skaile-source.yaml\";\n\n/**\n * Whether a manifest-cache refresh actually failed to index something. Keyed on\n * `errors`, NOT on `assetsUpdated < assetsFound`: the discovery walk counts\n * presets (and other intentionally-not-cataloged kinds) toward `assetsFound` but\n * never upserts them, so a source shipping a `.preset.yaml` would otherwise read\n * as a partial failure — false `! N asset(s) failed to index` + exit 1 — with\n * zero real errors.\n */\nexport function indexingHadFailures(result: { errors: string[] }): boolean {\n return result.errors.length > 0;\n}\n\n/**\n * A clone that ships only the legacy `.skaile-source.yaml` (no\n * `skaile.manifest.yaml`) has its declared `publisher_default` silently ignored\n * — discovery only reads `skaile.manifest.yaml`, so publisher resolution falls\n * back to the first path segment. Surface a hint so the author can fix it.\n */\nexport function legacySourceConfigHint(dest: string): string | undefined {\n const hasLegacy = existsSync(path.join(dest, LEGACY_SOURCE_CONFIG_FILENAME));\n const hasManifest = existsSync(path.join(dest, SKAILE_MANIFEST_FILENAME));\n if (hasLegacy && !hasManifest) {\n return (\n `This source ships a legacy ${LEGACY_SOURCE_CONFIG_FILENAME} but no ` +\n `${SKAILE_MANIFEST_FILENAME}; its declared publisher is ignored and assets ` +\n `are published under their first path segment. Add a ${SKAILE_MANIFEST_FILENAME} ` +\n `(\\`skaile source manifest init\\`) to set the publisher and asset inventory.`\n );\n }\n return undefined;\n}\n\n/**\n * The one spelling of a full git URL or scp-style spec: trailing slashes dropped, scheme and\n * host in lower case (userinfo, path and a `.git` suffix stay as typed). `…/skillz.git/` and\n * `HTTPS://GitHub.com/o/skillz.git` are the source `…/skillz.git` already is (p891, p722).\n */\nfunction canonicalGitUrl(spec: string): string {\n const noSlash = spec.replace(/\\/+$/, \"\");\n const url = /^([a-z][a-z0-9+.-]*):\\/\\/([^/]*)(.*)$/i.exec(noSlash);\n if (url) {\n const authority = url[2] ?? \"\";\n const at = authority.lastIndexOf(\"@\");\n const host = authority.slice(at + 1).toLowerCase();\n return `${(url[1] ?? \"\").toLowerCase()}://${authority.slice(0, at + 1)}${host}${url[3] ?? \"\"}`;\n }\n const scp = /^(git@)([^:]+):(.*)$/.exec(noSlash);\n return scp ? `${scp[1]}${(scp[2] ?? \"\").toLowerCase()}:${scp[3] ?? \"\"}` : noSlash;\n}\n\n/**\n * Normalize a `source add` argument into a clonable git URL. Full URLs and\n * scp-style (`git@host:…`) specs keep their form but get the canonical spelling of\n * {@link canonicalGitUrl}; a local path (`/abs`, `./rel`,\n * `../rel`, `~/x`) becomes an absolute, normalised path so the same repo added from two\n * directories is one source and a clone never depends on the cwd; an `owner/repo`\n * shorthand and a bare repo name expand to GitHub over SSH — a bare name\n * defaults to the `skaile-ai` org (`git@github.com:skaile-ai/<name>.git`).\n */\nexport function normalizeSourceUrl(input: string): string {\n const s = input.trim();\n if (/^(?:https?|git|ssh|file):\\/\\//.test(s) || /^git@/.test(s)) return canonicalGitUrl(s);\n if (/^(?:\\/|\\.{1,2}(?:\\/|$)|~\\/)/.test(s)) {\n const abs = path.resolve(s.startsWith(\"~/\") ? path.join(os.homedir(), s.slice(2)) : s);\n // The same folder reached through a symlink (macOS `/var` → `/private/var`) is one source.\n try {\n return realpathSync(abs);\n } catch {\n return abs;\n }\n }\n const repo = s.replace(/\\.git$/, \"\");\n if (/^[\\w.-]+\\/[\\w.-]+$/.test(repo)) return `git@github.com:${repo}.git`;\n if (/^[\\w.-]+$/.test(repo)) return `git@github.com:skaile-ai/${repo}.git`;\n return s;\n}\n\n/**\n * Match a stored source against a user-supplied key. Mirrors the shortcut\n * expansion `source add` applies (`normalizeSourceUrl`) so any form that `add`\n * accepted — bare name, `owner/repo`, `.git`-suffixed, full URL — also resolves\n * at `sync`/`show`/`remove` time, not just the raw stored URL or derived slug.\n */\nexport function sourceMatchesKey(entry: SourceEntry, key: string): boolean {\n if (entry.url === key) return true;\n if (sourceCacheKey(entry.url) === key || sourceShortName(entry.url) === key) return true;\n return entry.url === normalizeSourceUrl(key);\n}\n\n/**\n * Name a source in output: its repo short name, or its clone-cache key when\n * another source in the project shares that short name (two `skillz` repos of\n * different owners). The key is unique per URL and `source show`/`remove` accept it.\n */\nexport function sourceLabel(entry: SourceEntry, all: readonly SourceEntry[]): string {\n const short = sourceShortName(entry.url);\n const shared = all.some((s) => s.url !== entry.url && sourceShortName(s.url) === short);\n return shared ? sourceCacheKey(entry.url) : short;\n}\n\n/** Outcome of {@link resolveSource}. */\nexport type SourceResolution =\n | { kind: \"one\"; entry: SourceEntry }\n | { kind: \"ambiguous\"; entries: SourceEntry[] }\n | { kind: \"none\" };\n\n/**\n * `true` for a source on this machine: an absolute path or a `file://` URL. The two spellings of\n * one repository share a clone-cache key and are one source (p618).\n */\nfunction isLocalSourceUrl(url: string): boolean {\n return url.startsWith(\"/\") || url.startsWith(\"file://\");\n}\n\n/**\n * Pick the one source `key` names. Exact forms win over names: the stored URL,\n * then the cache key, then the repo short name or a `source add` shortcut, then the other\n * spelling of a local repository (`file:///x/r.git` for a source added as `/x/r.git`). A\n * name that several sources share (`skillz` from two owners) is `ambiguous`\n * instead of silently picking the first.\n */\nexport function resolveSource(sources: readonly SourceEntry[], key: string): SourceResolution {\n const tiers: ((s: SourceEntry) => boolean)[] = [\n (s) => s.url === key,\n (s) => sourceCacheKey(s.url) === key,\n (s) => sourceShortName(s.url) === key || s.url === normalizeSourceUrl(key),\n (s) =>\n isLocalSourceUrl(key) &&\n isLocalSourceUrl(s.url) &&\n realLocalCacheKey(s.url) === realLocalCacheKey(normalizeSourceUrl(key)),\n ];\n for (const tier of tiers) {\n const hits = sources.filter(tier);\n if (hits.length === 1) return { kind: \"one\", entry: hits[0] };\n if (hits.length > 1) return { kind: \"ambiguous\", entries: hits };\n }\n return { kind: \"none\" };\n}\n\nfunction exitAmbiguousSource(key: string, entries: readonly SourceEntry[]): never {\n logErr(`\"${key}\" matches ${entries.length} sources; pass the URL of the one you mean:`);\n for (const e of entries) console.error(` ${e.url}`);\n process.exit(1);\n}\n\n/**\n * git's stderr as one line: every line but the `hint:` advice and the\n * `From <url>` / ` * branch …` fetch progress, joined by spaces. Keeps the\n * cause (`fatal: '<path>' does not appear to be a git repository`).\n */\nfunction pullFailureReason(stderr: string): string {\n return stderr\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter((l) => l !== \"\" && !/^(hint:|From |[*+=!-] )/.test(l))\n .join(\" \");\n}\n\n/** The advisory a reference lint raises for a file the asset filter leaves out. */\nconst FILTER_ADVISORY = \"not captured by the file filter\";\n\n/**\n * Print the advisories of one indexing run. The reference notes about files outside the asset\n * filter are one line with a count unless `verbose`; every other advisory stays on its own line\n * (p1031: a source such as ai-assets printed 77 of them on every sync).\n */\nfunction logAdvisories(advisories: readonly string[], verbose: boolean, slug?: string): void {\n const prefix = slug ? `${slug}: ` : \"\";\n const filtered = advisories.filter((a) => a.includes(FILTER_ADVISORY));\n for (const advisory of advisories) {\n if (verbose || !advisory.includes(FILTER_ADVISORY)) logInfo(`${prefix}${advisory}`);\n }\n if (!verbose && filtered.length > 0) {\n logInfo(\n `${prefix}${filtered.length} referenced file${filtered.length === 1 ? \"\" : \"s\"} outside the asset filter (pass --verbose to list them)`,\n );\n }\n}\n\n/**\n * Find an already-registered source that maps to the same cache key as `url`\n * but is stored under a *different* URL string (e.g. the `.git`-suffixed or\n * scp form of the same remote). Two such entries would fight over one clone\n * dir, so `source add` rejects the ambiguity. Returns the colliding entry, or\n * `undefined` when the URL is unique or only matches an exact-string duplicate\n * (which `setSource` updates in place).\n */\nexport function findCacheKeyCollision(\n sources: SourceEntry[],\n url: string,\n): SourceEntry | undefined {\n const key = realLocalCacheKey(url);\n return sources.find((s) => s.url !== url && realLocalCacheKey(s.url) === key);\n}\n\n/**\n * The clone-cache key of `url`; a repository on this machine is keyed by its real path, so a\n * symlinked spelling (`/var/x` for `/private/var/x`) is the same source (p618).\n */\nfunction realLocalCacheKey(url: string): string {\n const local = url.startsWith(\"file://\") ? url.slice(\"file://\".length) : url;\n if (local.startsWith(\"/\") && existsSync(local)) {\n try {\n return sourceCacheKey(realpathSync(local));\n } catch {\n // fall through to the spelling\n }\n }\n return sourceCacheKey(url);\n}\n\nfunction requireProjectYamlPath(): string {\n const root = findWorkspaceRoot(process.cwd());\n if (!root) {\n logErr(\n \"No skaile.yaml found in the current directory or any parent. \" + \"Run `skaile init` first.\",\n );\n process.exit(1);\n }\n return path.join(root, workspaceConfigFilename());\n}\n\n/**\n * Load `skaile.yaml` for a `source` command. A file that does not parse stops the command with\n * the one `<file> — parse error: <reason>` line `check` and `install` print: it is not \"no\n * sources\", and nothing is written to it (p1421).\n */\nexport function loadProjectEditor(yamlPath: string): WorkspaceYamlEditor {\n try {\n return WorkspaceYamlEditor.load(yamlPath);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n logErr(/ — parse error: /.test(message) ? message : `Could not read ${yamlPath}: ${message}`);\n process.exit(1);\n }\n}\n\nexport function readProjectSources(yamlPath: string): SourceEntry[] {\n if (!existsSync(yamlPath)) return [];\n try {\n return loadProjectEditor(yamlPath).getSources();\n } catch (err) {\n logErr(`Could not read ${yamlPath}: ${err instanceof Error ? err.message : String(err)}`);\n process.exit(1);\n }\n}\n\n/** Remove the empty `<owner>` / `<host>` directories a failed clone left under `sources/`. */\nfunction pruneEmptyCloneParents(dest: string): void {\n let dir = path.dirname(dest);\n while (path.basename(dir) !== \"sources\" && dir !== path.dirname(dir)) {\n try {\n if (readdirSync(dir).length > 0) return;\n rmdirSync(dir);\n } catch {\n return;\n }\n dir = path.dirname(dir);\n }\n}\n\n/**\n * Clone the source if its clone directory does not yet exist. When `force` is\n * set, the existing clone is replaced by a fresh checkout. Returns true when a\n * clone happened. The cache slug is derived from the URL.\n *\n * A `--force` re-clone moves the old clone aside first and only deletes it once\n * the fresh clone succeeds — so a failed re-clone restores the previous clone\n * rather than leaving the source registered with no cache behind it.\n */\nexport function ensureClone(entry: SourceEntry, opts: { force?: boolean } = {}): boolean {\n const dest = sourceClonePath(sourceCacheKey(entry.url));\n let backup: string | undefined;\n if (existsSync(dest)) {\n if (!opts.force) return false;\n backup = `${dest}.bak`;\n rmSync(backup, { recursive: true, force: true });\n renameSync(dest, backup);\n }\n mkdirSync(path.dirname(dest), { recursive: true });\n const args = [\"clone\", entry.url, dest];\n // `pin` may be a branch/tag; pass it as the clone branch when present.\n if (entry.pin) args.splice(1, 0, \"--branch\", entry.pin);\n const clone = spawnSync(\"git\", args, { stdio: \"inherit\" });\n if (clone.status !== 0) {\n if (backup) {\n rmSync(dest, { recursive: true, force: true });\n renameSync(backup, dest);\n } else {\n // Nothing was there before: leave no empty `<host>/<owner>/` directories behind.\n rmSync(dest, { recursive: true, force: true });\n pruneEmptyCloneParents(dest);\n }\n logErr(`git clone failed for ${entry.url}`);\n process.exit(1);\n }\n if (backup) rmSync(backup, { recursive: true, force: true });\n return true;\n}\n\n/**\n * Advance an existing clone with `git pull --ff-only`. `add` and\n * `install --locked` leave the shared clone on a detached HEAD at the locked\n * commit, where `git pull` refuses to run, so a detached clone is put back on\n * its branch first (the pin when it is a branch, else the remote's default).\n * An entry pinned to a tag or SHA has nothing to pull and counts as synced.\n * On failure `error` is one line: git's whole stderr minus `hint:` advice and fetch progress.\n */\nexport function pullSourceClone(\n dest: string,\n entry: SourceEntry,\n): { ok: true } | { ok: false; error: string } {\n if (!attachToBranch(dest, entry.pin) && entry.pin) return { ok: true };\n const pull = spawnSync(\"git\", [\"pull\", \"--ff-only\"], {\n cwd: dest,\n stdio: \"pipe\",\n encoding: \"utf8\",\n });\n if (pull.status === 0) return { ok: true };\n const reason = pullFailureReason(pull.stderr) || `git exited with status ${pull.status}`;\n return { ok: false, error: `git pull failed: ${reason}` };\n}\n\n/**\n * Library name for a new source row: the repo short name, or `<owner>-<repo>`\n * (then `<host>-<owner>-<repo>`) when another library already holds that name.\n * Rows are found by clone path, never by this name: `orgA/repo` and\n * `orgB/repo` share the short name `repo`.\n */\nfunction sourceLibraryName(url: string, libs: readonly { name: string }[]): string {\n const taken = new Set(libs.map((l) => l.name));\n // A repo may be named `my.repo`; `addLibrary` only accepts `[A-Za-z0-9_-]`\n // starting with a letter or digit, so every candidate is slugged first.\n const flat = (s: string) => s.replace(/[^A-Za-z0-9_-]+/g, \"-\").replace(/^[-_]+/, \"\") || \"source\";\n const short = flat(sourceShortName(url));\n if (!taken.has(short)) return short;\n const parts = sourceCacheKey(url).split(\"/\");\n const candidates =\n parts.length === 3\n ? [flat(`${parts[1]}-${parts[2]}`), flat(`${parts[0]}-${parts[1]}-${parts[2]}`)]\n : [];\n for (const c of candidates) if (!taken.has(c)) return c;\n let n = 2;\n while (taken.has(`${short}-${n}`)) n++;\n return `${short}-${n}`;\n}\n\n/**\n * Why a freshly cloned source has no publisher to give its assets, or `undefined`. A GitHub URL\n * derives it from the org and `--publisher` records it, so only another URL is walked: the walk\n * is the one `add`, `install` and `check` run, so what it refuses here they would skip later.\n */\nasync function publisherProblem(entry: SourceEntry, dest: string): Promise<string | undefined> {\n if (entry.publisher || /github\\.com[/:]/.test(entry.url)) return undefined;\n let problem: string | undefined;\n await buildProvenanceIndex(\n [\n {\n localPath: dest,\n sourceUrl: entry.url,\n commit: getRepoCommit(dest) ?? \"0\".repeat(40),\n tag: entry.pin,\n overlayManifestPath: curatedManifestOverlay(entry.url),\n },\n ],\n {\n knownKinds: getKnownKinds(),\n onSourceError: (_clone, err) => {\n const why = err instanceof Error ? err.message : String(err);\n if (/publisher must be declared/.test(why)) problem = why;\n },\n },\n );\n return problem;\n}\n\n/**\n * Refresh the machine-global manifest cache for `entry` by running discovery\n * and upserting AssetDefinitions into `<skaile home>/index.db`. Creates the\n * libraries-table cache row if missing (ownership: reader = cache state).\n */\nasync function refreshManifestCache(\n entry: SourceEntry,\n includeDev = false,\n): Promise<{\n assetsFound: number;\n assetsUpdated: number;\n errors: string[];\n advisories: string[];\n}> {\n const { manager, library, close } = await openLibraryManager();\n try {\n const dest = sourceClonePath(sourceCacheKey(entry.url));\n const libs = await manager.listLibraries();\n const existing = libs.find((l) => path.resolve(l.path) === path.resolve(dest));\n // A clone made under an older cache key (the bare last segment before the url hash; `.git`\n // kept for a `….git/` url) leaves its library row at the old path. The row is this source's:\n // point it at the new clone instead of adding a second row for the same source (`add` would\n // warn \"exists in 2 libraries\"). Found by the old clone path or by the url it records.\n const key = sourceCacheKey(entry.url);\n const priorDirs = priorSourceCacheKeys(entry.url).map((k) => path.resolve(sourceClonePath(k)));\n const legacyRow = existing\n ? undefined\n : libs.find(\n (l) =>\n l.ownership === \"reader\" &&\n (priorDirs.includes(path.resolve(l.path)) ||\n (\"url\" in l.backendConfig && sourceCacheKey(l.backendConfig.url) === key)),\n );\n if (legacyRow) {\n const legacyDir = path.resolve(legacyRow.path);\n await manager.updateLibrary(legacyRow.id, { path: dest });\n logInfo(\n `Moved the \"${legacyRow.name}\" library to the new clone ${dest}. ` +\n `The old clone ${legacyDir} is no longer used and can be deleted.`,\n );\n }\n const added =\n existing ??\n legacyRow ??\n (await manager.addLibrary({\n name: sourceLibraryName(entry.url, libs),\n path: dest,\n backend: \"git\",\n backendConfig: {\n url: entry.url,\n branch: entry.pin ?? \"main\",\n authHint: \"ssh\",\n ...(entry.publisher ? { publisher: entry.publisher } : {}),\n },\n ownership: \"reader\",\n }));\n // The library row records the publisher `source add --publisher` declared, so the\n // installer rescans the clone with the one the indexer used.\n const cfg = added.backendConfig;\n const recorded = \"url\" in cfg ? cfg.publisher : undefined;\n // The library row is machine-wide: a project whose entry declares no publisher leaves the\n // one another project recorded alone, and scans with it.\n const publisher = entry.publisher ?? recorded;\n const lib =\n entry.publisher === undefined || recorded === entry.publisher\n ? added\n : await manager.updateLibrary(added.id, {\n backendConfig: { ...added.backendConfig, publisher: entry.publisher },\n });\n // A `skaile source manifest init` curated manifest overrides the upstream repo's\n // raw glob discovery; `asset install` rescans with the same overlay.\n const catalog = new LocalCatalogSource(library, lib.id, dest, getKindRegistry(), {\n sidecarManifestFile: curatedManifestOverlay(entry.url),\n publisher,\n });\n const result = await catalog.sync({ includeDev });\n await library.syncSource(lib.id);\n return result;\n } finally {\n close();\n }\n}\n\n/**\n * Re-register the reader library of every source this project declares whose clone is cached\n * but whose library row is gone. The row is machine-wide: `source remove` in another project\n * drops it while this project's `sources:` still names the source, and `search` then finds\n * nothing until `update` runs (p757). Never touches the network; returns the sources restored.\n */\nexport async function restoreSourceReaders(projectDir: string): Promise<string[]> {\n const root = findWorkspaceRoot(projectDir);\n if (!root) return [];\n const sources = readProjectSources(path.join(root, workspaceConfigFilename()));\n const cached = sources.filter((s) => existsSync(sourceClonePath(sourceCacheKey(s.url))));\n if (cached.length === 0) return [];\n const { manager, close } = await openLibraryManager();\n let missing: SourceEntry[];\n try {\n const libs = await manager.listLibraries();\n missing = cached.filter(\n (s) =>\n !libs.some(\n (l) => path.resolve(l.path) === path.resolve(sourceClonePath(sourceCacheKey(s.url))),\n ),\n );\n } finally {\n close();\n }\n const restored: string[] = [];\n for (const entry of missing) {\n try {\n await refreshManifestCache(entry);\n restored.push(sourceLabel(entry, sources));\n } catch (err) {\n logWarn(\n `Could not re-register source \"${sourceLabel(entry, sources)}\": ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n return restored;\n}\n\n/**\n * Auto-sync hook for `skaile search` on an unsynced workspace. Clones/pulls and\n * re-indexes every source declared in the project's `skaile.yaml`, then returns\n * whether the manifest cache may have changed (caller re-queries on `true`).\n *\n * Unlike `source sync`, this degrades gracefully — a clone/pull/index failure is\n * logged and skipped (never `process.exit`) so a failed auto-sync falls back to\n * the \"run sync first\" hint rather than killing the search. Returns `false`\n * (silently, no announce) when no sources are declared. Callers must guard\n * air-gapped mode themselves — this always touches the network.\n */\nexport async function autoSyncForSearch(projectDir: string): Promise<boolean> {\n const root = findWorkspaceRoot(projectDir);\n if (!root) return false;\n if (readProjectSources(path.join(root, workspaceConfigFilename())).length === 0) return false;\n\n logInfo(\"sources not synced — syncing now…\");\n const { synced } = await syncProjectSources(projectDir);\n return synced > 0;\n}\n\n/**\n * Clone-or-pull every source declared in the project's `skaile.yaml`, then\n * refresh its manifest cache. Shared by `autoSyncForSearch` and `skaile update`\n * (the latter offers it behind a confirm) so a re-deploy can see upstream\n * commits — `update` re-deploys against the local source cache, which is\n * otherwise frozen at the commit captured when the source was first cloned.\n *\n * Graceful by design: a clone/pull/index failure for one source is logged and\n * skipped (never `process.exit`), so a single bad remote can't abort the run.\n * Existing clones are advanced with `git pull --ff-only` (no `--depth=1`, unlike\n * the installer's `pullRepo`, so it fast-forwards instead of tripping the\n * shallow-divergence path). Returns a count summary for the caller to report.\n */\nexport async function syncProjectSources(\n projectDir: string,\n opts: { dev?: boolean } = {},\n): Promise<{ total: number; synced: number; failed: number }> {\n const root = findWorkspaceRoot(projectDir) ?? projectDir;\n const sources = readProjectSources(path.join(root, workspaceConfigFilename()));\n let synced = 0;\n let failed = 0;\n for (const entry of sources) {\n const slug = sourceShortName(entry.url);\n const dest = sourceClonePath(sourceCacheKey(entry.url));\n try {\n // Quiet git — the sync is a preparatory step; keep progress bars out of\n // the foreground output (spinner / install result).\n if (!existsSync(dest)) {\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: \"ignore\" });\n if (clone.status !== 0) {\n logWarn(`${slug}: git clone failed, skipping.`);\n failed++;\n continue;\n }\n } else {\n const pull = pullSourceClone(dest, entry);\n if (!pull.ok) {\n logErr(`${slug}: ${pull.error}`);\n failed++;\n continue;\n }\n }\n const result = await refreshManifestCache(entry, opts.dev);\n for (const err of result.errors) logWarn(`${slug}: ${err}`);\n logAdvisories(result.advisories, false, slug);\n synced++;\n } catch (err) {\n logWarn(`${slug}: sync failed — ${err instanceof Error ? err.message : String(err)}`);\n failed++;\n }\n }\n return { total: sources.length, synced, failed };\n}\n\n/**\n * Short names of the project's source clones that hold commits their upstream lacks.\n * `update --no-sync` still re-deploys from such a clone, so it reports them the way\n * `source sync` does. A clone without an upstream (detached at a pin) never counts.\n */\nexport function divergedSourceClones(projectDir: string): string[] {\n const root = findWorkspaceRoot(projectDir) ?? projectDir;\n const diverged: string[] = [];\n for (const entry of readProjectSources(path.join(root, workspaceConfigFilename()))) {\n const dest = sourceClonePath(sourceCacheKey(entry.url));\n if (!existsSync(dest)) continue;\n const ahead = spawnSync(\"git\", [\"-C\", dest, \"rev-list\", \"--count\", \"@{upstream}..HEAD\"], {\n stdio: \"pipe\",\n encoding: \"utf8\",\n });\n if (ahead.status === 0 && Number(ahead.stdout.trim()) > 0) {\n diverged.push(sourceShortName(entry.url));\n }\n }\n return diverged;\n}\n\n/** Remove the libraries-table cache row and (optionally) the clone bytes. */\nasync function dropManifestCache(url: string, purgeClone: boolean): Promise<void> {\n const dest = sourceClonePath(sourceCacheKey(url));\n const { manager, close } = await openLibraryManager();\n try {\n // By clone path, not short name: another org's repo of the same name keeps its row.\n const dirs = [dest, ...priorSourceCacheKeys(url).map((k) => sourceClonePath(k))].map((d) =>\n path.resolve(d),\n );\n const existing = (await manager.listLibraries()).find((l) =>\n dirs.includes(path.resolve(l.path)),\n );\n if (existing) {\n await manager.removeLibrary(existing.name, { purge: false });\n }\n } finally {\n close();\n }\n if (purgeClone) {\n const dest = sourceClonePath(sourceCacheKey(url));\n if (existsSync(dest)) rmSync(dest, { recursive: true, force: true });\n }\n}\n\n/**\n * The refusal for a `source add` argument that names a directory on this machine which cannot be\n * cloned: a registered library (it is already searchable and needs no source) or a folder that\n * is not a git repository. `undefined` for a URL, a shorthand or a directory that is a git repo.\n */\nexport async function localPathNotASource(source: string): Promise<string | undefined> {\n const raw = source.trim().replace(/^file:\\/\\//, \"\");\n // The path rule of `normalizeSourceUrl`: a bare name is a shorthand, never a folder in the cwd.\n if (!/^(?:\\/|\\.{1,2}(?:\\/|$)|~\\/)/.test(raw)) return undefined;\n const dir = path.resolve(raw.startsWith(\"~/\") ? path.join(os.homedir(), raw.slice(2)) : raw);\n if (!existsSync(dir) || !statSync(dir).isDirectory()) return undefined;\n const real = realpathSync(dir);\n const { manager, close } = await openLibraryManager();\n try {\n const lib = (await manager.listLibraries()).find((l) => {\n try {\n return realpathSync(l.path) === real;\n } catch {\n return path.resolve(l.path) === dir;\n }\n });\n if (lib) {\n return `${dir} is the library \"${lib.name}\"; it needs no source — \\`skaile library list\\` shows it and its assets are already searchable.`;\n }\n } finally {\n close();\n }\n const git = spawnSync(\"git\", [\"-C\", dir, \"rev-parse\", \"--git-dir\"], { encoding: \"utf8\" });\n if (git.status !== 0) {\n return `${dir} is not a git repository. A source is a git repo: run \\`git init\\` and commit there, or register the folder as a library with \\`skaile library init <name> --path ${dir}\\`.`;\n }\n return undefined;\n}\n\nexport function makeSourceCommand(): Command {\n const cmd = new Command(\"source\").description(\n \"Manage github sources for the current project (recorded in skaile.yaml)\",\n );\n\n // ── source add ──────────────────────────────────────────────────────────\n cmd\n .command(\"add <source>\")\n .description(\n \"Clone a github repo and register it in this project's skaile.yaml. \" +\n \"<source> is a full git URL or an owner/repo shorthand (→ git@github.com:<owner>/<repo>.git).\",\n )\n .option(\"--name <slug>\", \"[deprecated] no-op — the source entry stores only the URL\")\n .option(\"--pin <ref>\", \"Pin a branch, tag, or 40-char SHA\")\n .option(\"--branch <branch>\", \"[deprecated] alias for --pin\")\n .option(\n \"--force\",\n \"Remove an existing clone and re-clone; also change the publisher of a registered URL\",\n false,\n )\n .option(\n \"--publisher <name>\",\n \"Publisher of the source's assets when its skaile.manifest.yaml declares none (required for a non-GitHub URL)\",\n )\n .option(\"--dev\", \"Also index dev-only assets under the source's dev_paths\", false)\n .option(\"--verbose\", \"List every referenced file outside the asset filter\", false)\n .action(\n async (\n source: string,\n opts: {\n name?: string;\n pin?: string;\n branch?: string;\n force?: boolean;\n publisher?: string;\n dev?: boolean;\n verbose?: boolean;\n },\n ) => {\n // A bare name used to expand to the `skaile-ai` org over SSH: a typo (or the slug\n // `source manifest init` printed) cloned a made-up repo. Say what to give instead.\n if (/^[\\w.-]+$/.test(source.trim().replace(/\\.git$/, \"\"))) {\n logErr(\n `\"${source}\" is not a git URL or an owner/repo shorthand. ` +\n \"Use `skaile source add <owner>/<repo>` or the full URL \" +\n \"(for a curated manifest: `skaile source add <the repo URL>`).\",\n );\n process.exitCode = 1;\n return;\n }\n const notASource = await localPathNotASource(source);\n if (notASource) {\n logErr(notASource);\n process.exitCode = 1;\n return;\n }\n let url = normalizeSourceUrl(source);\n const yamlPath = requireProjectYamlPath();\n\n // A different URL string that maps to the same cache key (e.g. the\n // `.git`-suffixed or scp form of an already-registered remote) would\n // fight over one clone dir. setSource only dedupes exact strings, so\n // reject the ambiguous collision here instead of silently shadowing.\n // The one exception is a repository on this machine: `/x/r.git` and `file:///x/r.git`\n // are one source, and the registered spelling stays (p618).\n const collision = findCacheKeyCollision(readProjectSources(yamlPath), url);\n if (collision && isLocalSourceUrl(collision.url) && isLocalSourceUrl(url)) {\n url = collision.url;\n } else if (collision) {\n logErr(\n `\"${url}\" maps to the same cache key (${sourceCacheKey(url)}) as ` +\n `already-registered \"${collision.url}\". Remove that source first ` +\n `(skaile source remove) or re-use its exact URL to update it.`,\n );\n process.exitCode = 1;\n return;\n }\n\n if (opts.name) {\n logWarn(\n \"the --name flag is deprecated; the source entry now stores only the URL \" +\n \"(the cache slug is derived from it).\",\n );\n }\n const pin = opts.pin ?? opts.branch;\n const slug = sourceShortName(url);\n const entry: SourceEntry = { url };\n if (pin) entry.pin = pin;\n if (opts.publisher) entry.publisher = requireValidPublisherOrExit(opts.publisher);\n\n // The publisher of a registered URL names every ref its assets carry: a different one\n // would re-key the source and break the refs declared under the old one (p722).\n const registered = readProjectSources(yamlPath).find((s) => s.url === url);\n // A source registered without `--publisher` has one too: the manifest's, else the GitHub\n // org of its URL. Compare what each choice resolves to in the clone, not the flag (p722).\n // The clone's `origin` may have been repointed (a mirror, `git remote set-url`), so the\n // org is read from the registered URL when the clone gives none: the guard compares\n // against the registered entry, never against whatever the clone says today.\n const clonedAt = sourceClonePath(sourceCacheKey(url));\n const urlOrg = registered\n ? /github\\.com[/:]([^/]+)\\/[^/]+/.exec(registered.url)?.[1]?.toLowerCase()\n : undefined;\n const publisherNow =\n registered && existsSync(clonedAt)\n ? resolveSourcePublisher(clonedAt, registered.publisher ?? urlOrg)\n : (registered?.publisher ?? urlOrg);\n const publisherThen =\n registered && entry.publisher !== undefined && existsSync(clonedAt)\n ? resolveSourcePublisher(clonedAt, entry.publisher)\n : entry.publisher;\n if (\n registered &&\n publisherNow !== undefined &&\n entry.publisher !== undefined &&\n publisherNow !== publisherThen &&\n !opts.force\n ) {\n let declared: string[] = [];\n try {\n declared = (resolveSkWorkspaceConfig(path.dirname(yamlPath)).dependencies ?? []).filter(\n (d) => d.includes(`@${publisherNow}/`),\n );\n } catch {\n // an unreadable skaile.yaml stops later; the refusal below still holds\n }\n logErr(\n `${url} is registered with publisher \"${publisherNow}\"${\n registered.publisher === undefined ? \" (from its manifest or GitHub org)\" : \"\"\n }; --publisher ` +\n `\"${entry.publisher}\" would change it${\n declared.length > 0 ? ` and break the declared ${declared.join(\", \")}` : \"\"\n }. Pass --force to change it, or skaile source remove it first.`,\n );\n process.exitCode = 1;\n return;\n }\n\n const dest = sourceClonePath(sourceCacheKey(url));\n const preexisting = existsSync(dest);\n // Clone/validate the repo BEFORE touching skaile.yaml — a failed clone\n // (repo not found, bad URL, network error) hard-exits in ensureClone, so\n // the entry is only ever recorded once the source is known-good.\n const cloned = ensureClone(entry, { force: opts.force });\n // A source with no publisher to give is skipped by every later command, so refuse it\n // here, before anything is recorded or indexed (a clone made by this call goes too).\n const noPublisher = await publisherProblem(entry, dest);\n if (noPublisher) {\n if (cloned && !preexisting) {\n rmSync(dest, { recursive: true, force: true });\n pruneEmptyCloneParents(dest);\n }\n logErr(noPublisher);\n process.exitCode = 1;\n return;\n }\n if (!cloned) {\n logOk(`Reusing cached clone at ${dest}`);\n } else if (preexisting) {\n logOk(`Re-cloned ${url} → ${dest}`);\n } else {\n logOk(`Cloned ${url} → ${dest}`);\n }\n\n const editor = loadProjectEditor(yamlPath);\n editor.setSource(entry);\n editor.save();\n\n const result = await refreshManifestCache(entry, opts.dev);\n const failed = indexingHadFailures(result);\n const indexedMsg = `Indexed ${result.assetsUpdated} of ${result.assetsFound} asset(s) from \"${slug}\".`;\n if (failed) {\n logWarn(indexedMsg);\n } else {\n logOk(indexedMsg);\n }\n for (const err of result.errors) logWarn(err);\n logAdvisories(result.advisories, opts.verbose === true);\n\n const legacyHint = legacySourceConfigHint(dest);\n if (legacyHint) logWarn(legacyHint);\n\n const where = path.relative(process.cwd(), yamlPath);\n if (failed) {\n // The entry IS recorded in skaile.yaml, but indexing did not fully\n // succeed — don't present it as a clean success.\n logWarn(\n `Source \"${slug}\" registered in ${where}, but ${result.errors.length} ` +\n `asset(s) failed to index (see above). Fix the cause, then re-run ` +\n `\\`skaile source sync ${slug}\\`.`,\n );\n process.exitCode = 1;\n } else {\n logOk(`Source \"${slug}\" registered in ${where}.`);\n }\n },\n );\n\n // ── source list ─────────────────────────────────────────────────────────\n cmd\n .command(\"list\")\n .description(\"List sources registered in this project's skaile.yaml\")\n .option(\"--json\", \"Output as JSON\")\n .action(async (opts: { json?: boolean }) => {\n const yamlPath = requireProjectYamlPath();\n const sources = readProjectSources(yamlPath);\n if (opts.json) return console.log(JSON.stringify(sources, null, 2));\n if (sources.length === 0) {\n logInfo(\"No sources in skaile.yaml. Run `skaile source add <git-url>` to register one.\");\n return;\n }\n console.log();\n console.log(S.heading(\" Sources\"));\n for (const s of sources) {\n const slug = sourceLabel(s, sources);\n const cached = existsSync(sourceClonePath(sourceCacheKey(s.url)))\n ? \"\"\n : S.warn(\" (not cached)\");\n console.log(` ${S.cmd(slug.padEnd(24))} ${S.dim(s.url)}${cached}`);\n }\n console.log(`\\n ${S.dim(`${sources.length} source(s)`)}\\n`);\n });\n\n // ── source show ─────────────────────────────────────────────────────────\n cmd\n .command(\"show <name-or-url>\")\n .description(\"Show details for a source (matched by URL or derived slug)\")\n .action(async (key: string) => {\n const yamlPath = requireProjectYamlPath();\n const all = readProjectSources(yamlPath);\n const resolved = resolveSource(all, key);\n if (resolved.kind === \"none\") {\n logErr(`No source matching \"${key}\" in ${yamlPath}.`);\n process.exit(1);\n }\n if (resolved.kind === \"ambiguous\") exitAmbiguousSource(key, resolved.entries);\n const entry = resolved.entry;\n const slug = sourceLabel(entry, all);\n const clonePath = sourceClonePath(sourceCacheKey(entry.url));\n console.log(\n JSON.stringify(\n {\n ...entry,\n slug,\n clonePath,\n cached: existsSync(clonePath),\n },\n null,\n 2,\n ),\n );\n });\n\n // ── source remove ───────────────────────────────────────────────────────\n cmd\n .command(\"remove <name-or-url>\")\n .description(\"Remove a source from this project's skaile.yaml (matched by URL or slug)\")\n .option(\n \"--purge\",\n `Also delete the cached clone from ${path.join(globalCacheRoot(), \"sources\")}${path.sep}`,\n false,\n )\n .option(\"--force\", \"Remove the source although a locked asset still comes from it\", false)\n .action(async (key: string, opts: { purge: boolean; force?: boolean }) => {\n const yamlPath = requireProjectYamlPath();\n const editor = loadProjectEditor(yamlPath);\n // Resolve to the stored URL (entries are keyed by url in the editor).\n const all = editor.getSources();\n const resolved = resolveSource(all, key);\n if (resolved.kind === \"none\") {\n logErr(`No source matching \"${key}\" in ${yamlPath}.`);\n process.exit(1);\n }\n if (resolved.kind === \"ambiguous\") exitAmbiguousSource(key, resolved.entries);\n const match = resolved.entry;\n const slug = sourceLabel(match, all);\n // A locked asset that comes from this source could not be restored or updated once the\n // source is gone: check, doctor and outdated would report it, install --locked would fail.\n const locked = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.dirname(yamlPath),\n }).lockedFromSource(match.url);\n if (locked.length > 0 && !opts.force) {\n logErr(\n `Source \"${slug}\" still supplies ${locked.length} locked asset(s): ${locked.join(\", \")}. ` +\n `Run \\`skaile remove\\` on them first, or pass --force to remove the source anyway.`,\n );\n process.exit(1);\n }\n editor.removeSource(match.url);\n editor.save();\n await dropManifestCache(match.url, opts.purge);\n logOk(\n opts.purge\n ? `Removed source \"${slug}\" and purged its clone.`\n : `Removed source \"${slug}\" from skaile.yaml (clone left in ${path.join(globalCacheRoot(), \"sources\")} — pass --purge to remove it, or run \\`skaile cache clean --global\\`).`,\n );\n });\n\n // ── source sync ─────────────────────────────────────────────────────────\n cmd\n .command(\"sync [name]\")\n .description(\"Pull upstream changes and refresh the manifest cache\")\n .option(\"--dev\", \"Also index dev-only assets under each source's dev_paths\", false)\n .option(\"--verbose\", \"List every referenced file outside the asset filter\", false)\n .option(\"--all\", \"Sync every source without prompting\", false)\n .action(\n async (\n key: string | undefined,\n opts: { dev?: boolean; all?: boolean; verbose?: boolean },\n ) => {\n const yamlPath = requireProjectYamlPath();\n const sources = readProjectSources(yamlPath);\n if (sources.length === 0) {\n logInfo(\"No sources in skaile.yaml.\");\n return;\n }\n\n let targets: SourceEntry[];\n if (key) {\n const resolved = resolveSource(sources, key);\n if (resolved.kind === \"ambiguous\") exitAmbiguousSource(key, resolved.entries);\n if (resolved.kind === \"none\") {\n logInfo(`No source matching \"${key}\".`);\n return;\n }\n targets = [resolved.entry];\n } else if (opts.all || sources.length === 1 || !process.stdin.isTTY) {\n // --all, a single source, or a non-interactive shell: sync everything.\n targets = sources;\n } else {\n const selected = await p.multiselect({\n message: \"Select sources to sync\",\n options: sources.map((s) => ({\n value: s.url,\n label: sourceShortName(s.url),\n hint: s.url,\n })),\n required: true,\n });\n if (p.isCancel(selected)) {\n p.cancel(\"Cancelled.\");\n return;\n }\n const picked = new Set(selected as string[]);\n targets = sources.filter((s) => picked.has(s.url));\n }\n for (const entry of targets) {\n const slug = sourceLabel(entry, sources);\n const dest = sourceClonePath(sourceCacheKey(entry.url));\n if (!existsSync(dest)) {\n ensureClone(entry);\n logOk(`${slug}: cloned to ${dest}.`);\n } else {\n const pull = pullSourceClone(dest, entry);\n if (!pull.ok) {\n logErr(`${slug}: ${pull.error}`);\n process.exitCode = 1;\n continue;\n }\n }\n const result = await refreshManifestCache(entry, opts.dev);\n const failed = indexingHadFailures(result);\n const indexedMsg = `${slug}: indexed ${result.assetsUpdated} of ${result.assetsFound} asset(s).`;\n if (failed) {\n logWarn(indexedMsg);\n process.exitCode = 1;\n } else {\n logOk(indexedMsg);\n }\n for (const err of result.errors) logWarn(`${slug}: ${err}`);\n logAdvisories(result.advisories, opts.verbose === true, slug);\n const legacyHint = legacySourceConfigHint(dest);\n if (legacyHint) logWarn(`${slug}: ${legacyHint}`);\n }\n },\n );\n\n // ── source patch / propose (stubs) ──────────────────────────────────────\n cmd\n .command(\"patch <ref>\")\n .description(\"Extract an asset for editing against the source\")\n .action((_ref: string) => {\n logErr(\n \"`skaile source patch` is scaffolded but not yet wired. \" +\n \"The patch flow lands in a follow-up PR.\",\n );\n process.exit(2);\n });\n\n cmd\n .command(\"propose <ref>\")\n .description(\"Open a PR with the patch against the source upstream\")\n .action((_ref: string) => {\n logErr(\n \"`skaile source propose` is scaffolded but not yet wired. \" +\n \"The propose flow lands in a follow-up PR.\",\n );\n process.exit(2);\n });\n\n // ── source manifest * ───────────────────────────────────────────────────\n addSourceManifestCommands(cmd);\n\n return cmd;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { err, okJson, ok } from './chunk-3MWQKQUB.js';
2
- import { buildConnectorListPayload } from './chunk-DGTI65OC.js';
2
+ import { buildConnectorListPayload } from './chunk-ZEH4WFEG.js';
3
3
  import { readFile } from 'fs/promises';
4
4
  import { join } from 'path';
5
5
 
@@ -117,5 +117,5 @@ async function connectorDescribe(manager, id) {
117
117
  }
118
118
 
119
119
  export { connectorDescribe, connectorExec, connectorList, connectorLoadSkill, connectorRead, connectorSearch, connectorWrite, mountList, mountRead, mountStatus, mountSync };
120
- //# sourceMappingURL=chunk-ZAELRYKS.js.map
121
- //# sourceMappingURL=chunk-ZAELRYKS.js.map
120
+ //# sourceMappingURL=chunk-MD3FUZS3.js.map
121
+ //# sourceMappingURL=chunk-MD3FUZS3.js.map