@skaile/workspaces 6.9.1 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/ai-sdk.js +8 -8
- package/dist/{asset-feeds-PANNQPEE.js → asset-feeds-UG3PG423.js} +22 -22
- package/dist/{asset-feeds-PANNQPEE.js.map → asset-feeds-UG3PG423.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +8 -8
- package/dist/asset-manager/history.js +8 -8
- package/dist/asset-manager/index.js +14 -14
- package/dist/asset-manager/installer.js +9 -9
- package/dist/asset-manager/renderers.js +8 -8
- package/dist/asset-manager/src/harness-switch-state.d.ts +30 -0
- package/dist/asset-manager/src/harness-switch-state.d.ts.map +1 -0
- package/dist/asset-manager/src/index.d.ts +49 -12
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/mcp-config.d.ts +6 -0
- package/dist/asset-manager/src/mcp-config.d.ts.map +1 -1
- package/dist/bridge/codex-app-server.js +1 -2
- package/dist/bridge/harnesses/claude-sdk.js +11 -11
- package/dist/bridge/harnesses/codex.js +15 -1926
- package/dist/bridge/harnesses/codex.js.map +1 -1
- package/dist/bridge/harnesses/continue.js +11 -11
- package/dist/bridge/harnesses/echo.js +3 -3
- package/dist/bridge/harnesses/gemini.js +6 -6
- package/dist/bridge/harnesses/goose.js +11 -11
- package/dist/bridge/harnesses/omp.js +26 -9
- package/dist/bridge/harnesses/omp.js.map +1 -1
- package/dist/bridge/harnesses/opencode.js +11 -11
- package/dist/bridge/harnesses/qwen.js +6 -6
- package/dist/bridge/index.js +17 -16
- package/dist/bridge/src/harness-model-check.d.ts +5 -4
- package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/codex.d.ts +13 -0
- package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/omp.d.ts +11 -0
- package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
- package/dist/bridge/src/index.d.ts +1 -0
- package/dist/bridge/src/index.d.ts.map +1 -1
- package/dist/{chunk-SME3PK4L.js → chunk-2D6HZAO5.js} +8 -8
- package/dist/{chunk-SME3PK4L.js.map → chunk-2D6HZAO5.js.map} +1 -1
- package/dist/chunk-2MUUPRIG.js +688 -0
- package/dist/chunk-2MUUPRIG.js.map +1 -0
- package/dist/{chunk-TMQFOJ6F.js → chunk-2PVYDAFN.js} +3 -3
- package/dist/{chunk-TMQFOJ6F.js.map → chunk-2PVYDAFN.js.map} +1 -1
- package/dist/{chunk-S47KU4YB.js → chunk-2U67XYZM.js} +3 -3
- package/dist/{chunk-S47KU4YB.js.map → chunk-2U67XYZM.js.map} +1 -1
- package/dist/{chunk-PLVM6OIV.js → chunk-375HN3FD.js} +18 -14
- package/dist/chunk-375HN3FD.js.map +1 -0
- package/dist/{chunk-VEIWFS7Z.js → chunk-4I4SBOCS.js} +345 -88
- package/dist/chunk-4I4SBOCS.js.map +1 -0
- package/dist/{chunk-PBEDRYHP.js → chunk-4Z4RULWQ.js} +48 -28
- package/dist/{chunk-PBEDRYHP.js.map → chunk-4Z4RULWQ.js.map} +1 -1
- package/dist/{chunk-MPO5CQUZ.js → chunk-5JBMYZNA.js} +3 -3
- package/dist/{chunk-MPO5CQUZ.js.map → chunk-5JBMYZNA.js.map} +1 -1
- package/dist/{chunk-EMSU6L7K.js → chunk-5KQFR4D7.js} +6 -6
- package/dist/{chunk-EMSU6L7K.js.map → chunk-5KQFR4D7.js.map} +1 -1
- package/dist/{chunk-KNY356I3.js → chunk-5KSGZP3E.js} +11 -4
- package/dist/chunk-5KSGZP3E.js.map +1 -0
- package/dist/{chunk-IISEBVMA.js → chunk-5P7LTPBR.js} +5 -5
- package/dist/{chunk-IISEBVMA.js.map → chunk-5P7LTPBR.js.map} +1 -1
- package/dist/{chunk-2UKNI2HJ.js → chunk-6O7VDKX3.js} +2 -2
- package/dist/{chunk-2UKNI2HJ.js.map → chunk-6O7VDKX3.js.map} +1 -1
- package/dist/{chunk-FZTHL6SK.js → chunk-7DUOKE73.js} +27 -33
- package/dist/chunk-7DUOKE73.js.map +1 -0
- package/dist/{chunk-V5KG6CCV.js → chunk-7HRZACI4.js} +7 -2
- package/dist/chunk-7HRZACI4.js.map +1 -0
- package/dist/{chunk-U3FI4DVT.js → chunk-7K73MCI6.js} +7 -5
- package/dist/chunk-7K73MCI6.js.map +1 -0
- package/dist/{chunk-BDAXHJC5.js → chunk-BCID52M5.js} +6 -6
- package/dist/{chunk-BDAXHJC5.js.map → chunk-BCID52M5.js.map} +1 -1
- package/dist/{chunk-FZO64PLQ.js → chunk-BNLXZXZN.js} +81 -8
- package/dist/chunk-BNLXZXZN.js.map +1 -0
- package/dist/{chunk-ZUROGXJM.js → chunk-C5UKYTTD.js} +13 -23
- package/dist/chunk-C5UKYTTD.js.map +1 -0
- package/dist/{chunk-LYVLDGML.js → chunk-CG63XGVV.js} +3 -3
- package/dist/{chunk-LYVLDGML.js.map → chunk-CG63XGVV.js.map} +1 -1
- package/dist/{chunk-4ROXSQEG.js → chunk-CJO3XKO7.js} +4 -4
- package/dist/{chunk-4ROXSQEG.js.map → chunk-CJO3XKO7.js.map} +1 -1
- package/dist/{chunk-OSABUEWA.js → chunk-CVUMZTNO.js} +4 -4
- package/dist/{chunk-OSABUEWA.js.map → chunk-CVUMZTNO.js.map} +1 -1
- package/dist/{chunk-E675QKFG.js → chunk-DOMRBOJZ.js} +5 -5
- package/dist/{chunk-E675QKFG.js.map → chunk-DOMRBOJZ.js.map} +1 -1
- package/dist/{chunk-GTAHU4N4.js → chunk-EB2LKPI6.js} +4 -4
- package/dist/{chunk-GTAHU4N4.js.map → chunk-EB2LKPI6.js.map} +1 -1
- package/dist/{chunk-GZL6RN4Z.js → chunk-FXBKBOI5.js} +169 -49
- package/dist/chunk-FXBKBOI5.js.map +1 -0
- package/dist/{chunk-J45JCYS4.js → chunk-GA4GUDTL.js} +4 -4
- package/dist/{chunk-J45JCYS4.js.map → chunk-GA4GUDTL.js.map} +1 -1
- package/dist/{chunk-RZRJTCP2.js → chunk-HE3TZYNG.js} +4 -4
- package/dist/{chunk-RZRJTCP2.js.map → chunk-HE3TZYNG.js.map} +1 -1
- package/dist/chunk-HLFLET7S.js +2443 -0
- package/dist/chunk-HLFLET7S.js.map +1 -0
- package/dist/{chunk-WEPTGUR4.js → chunk-HQUF6O4B.js} +27 -56
- package/dist/chunk-HQUF6O4B.js.map +1 -0
- package/dist/{chunk-QIV7H3GJ.js → chunk-IMO4EHND.js} +5 -5
- package/dist/{chunk-QIV7H3GJ.js.map → chunk-IMO4EHND.js.map} +1 -1
- package/dist/{chunk-TUOHA6BM.js → chunk-IOXFT5D7.js} +3 -3
- package/dist/{chunk-TUOHA6BM.js.map → chunk-IOXFT5D7.js.map} +1 -1
- package/dist/{chunk-CPMLMNI5.js → chunk-JDZUQFN7.js} +4 -4
- package/dist/{chunk-CPMLMNI5.js.map → chunk-JDZUQFN7.js.map} +1 -1
- package/dist/{chunk-7TF5MNFK.js → chunk-KE5HDORU.js} +2 -2
- package/dist/{chunk-7TF5MNFK.js.map → chunk-KE5HDORU.js.map} +1 -1
- package/dist/{chunk-PTJTOPE5.js → chunk-KOI7QFDH.js} +3 -3
- package/dist/{chunk-PTJTOPE5.js.map → chunk-KOI7QFDH.js.map} +1 -1
- package/dist/{chunk-NDBHEOIA.js → chunk-KRL53RZB.js} +8 -8
- package/dist/{chunk-NDBHEOIA.js.map → chunk-KRL53RZB.js.map} +1 -1
- package/dist/{chunk-7QYBKUAS.js → chunk-LKBRBVVS.js} +3 -3
- package/dist/{chunk-7QYBKUAS.js.map → chunk-LKBRBVVS.js.map} +1 -1
- package/dist/{chunk-USSP43U3.js → chunk-LQWOU7S2.js} +3 -3
- package/dist/{chunk-USSP43U3.js.map → chunk-LQWOU7S2.js.map} +1 -1
- package/dist/{chunk-4KPQ6ILH.js → chunk-MEU2HHGV.js} +18 -9
- package/dist/chunk-MEU2HHGV.js.map +1 -0
- package/dist/{chunk-QC5BYUED.js → chunk-MS2IXLTC.js} +4 -4
- package/dist/{chunk-QC5BYUED.js.map → chunk-MS2IXLTC.js.map} +1 -1
- package/dist/{chunk-Q5SSRVD5.js → chunk-NCJSYU6A.js} +16 -14
- package/dist/chunk-NCJSYU6A.js.map +1 -0
- package/dist/{chunk-5J6N6LHL.js → chunk-NFFBYG2W.js} +3 -3
- package/dist/{chunk-5J6N6LHL.js.map → chunk-NFFBYG2W.js.map} +1 -1
- package/dist/{chunk-7UCPGQCW.js → chunk-NTFP2XF4.js} +10 -10
- package/dist/chunk-NTFP2XF4.js.map +1 -0
- package/dist/{chunk-KVTV4LT2.js → chunk-PSPFWTJI.js} +4 -4
- package/dist/{chunk-KVTV4LT2.js.map → chunk-PSPFWTJI.js.map} +1 -1
- package/dist/{chunk-YPTDPN2B.js → chunk-PTXQMTCG.js} +3 -3
- package/dist/{chunk-YPTDPN2B.js.map → chunk-PTXQMTCG.js.map} +1 -1
- package/dist/{chunk-X5SGUBUV.js → chunk-QBJQ426X.js} +3 -3
- package/dist/{chunk-X5SGUBUV.js.map → chunk-QBJQ426X.js.map} +1 -1
- package/dist/{chunk-QBUJTVMY.js → chunk-R3ZNAPBV.js} +3 -3
- package/dist/{chunk-QBUJTVMY.js.map → chunk-R3ZNAPBV.js.map} +1 -1
- package/dist/{chunk-RP3ML3QD.js → chunk-RTFH2QR2.js} +3 -3
- package/dist/{chunk-RP3ML3QD.js.map → chunk-RTFH2QR2.js.map} +1 -1
- package/dist/{chunk-5KWQMCH7.js → chunk-RZ5R6GDJ.js} +5 -5
- package/dist/{chunk-5KWQMCH7.js.map → chunk-RZ5R6GDJ.js.map} +1 -1
- package/dist/{chunk-MDCI4RSG.js → chunk-RZL4TOK3.js} +20 -6
- package/dist/chunk-RZL4TOK3.js.map +1 -0
- package/dist/{chunk-LMADWO4Q.js → chunk-SBAUZ7XH.js} +4 -4
- package/dist/{chunk-LMADWO4Q.js.map → chunk-SBAUZ7XH.js.map} +1 -1
- package/dist/{chunk-AQTAULXT.js → chunk-SKG6G4HO.js} +108 -44
- package/dist/chunk-SKG6G4HO.js.map +1 -0
- package/dist/{chunk-HQAPUPBE.js → chunk-V2VDTQ7A.js} +3 -3
- package/dist/{chunk-HQAPUPBE.js.map → chunk-V2VDTQ7A.js.map} +1 -1
- package/dist/{chunk-GNUA7XT2.js → chunk-VS6XC5JE.js} +3 -3
- package/dist/{chunk-GNUA7XT2.js.map → chunk-VS6XC5JE.js.map} +1 -1
- package/dist/{chunk-5J6JWGY4.js → chunk-WDG5IVEA.js} +3 -3
- package/dist/{chunk-5J6JWGY4.js.map → chunk-WDG5IVEA.js.map} +1 -1
- package/dist/{chunk-XB4XHGIE.js → chunk-XWCV2A2F.js} +4 -4
- package/dist/{chunk-XB4XHGIE.js.map → chunk-XWCV2A2F.js.map} +1 -1
- package/dist/{chunk-UWD7YBDR.js → chunk-ZLDAPZIX.js} +4 -4
- package/dist/{chunk-UWD7YBDR.js.map → chunk-ZLDAPZIX.js.map} +1 -1
- package/dist/{claude-code-ILZ46SLO.js → claude-code-CMFGCDMX.js} +5 -5
- package/dist/{claude-code-ILZ46SLO.js.map → claude-code-CMFGCDMX.js.map} +1 -1
- package/dist/cli/index.js +322 -196
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts.map +1 -1
- package/dist/cli/src/commands/config.d.ts.map +1 -1
- package/dist/cli/src/commands/connector.d.ts.map +1 -1
- package/dist/cli/src/commands/harness-preflight.d.ts +3 -1
- package/dist/cli/src/commands/harness-preflight.d.ts.map +1 -1
- package/dist/cli/src/commands/harness.d.ts.map +1 -1
- package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/library-index.d.ts +3 -3
- package/dist/cli/src/commands/library-index.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate-files.d.ts +8 -0
- package/dist/cli/src/commands/migrate-files.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate-harness.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate-providers.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate.d.ts.map +1 -1
- package/dist/cli/src/commands/outdated.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/run.d.ts.map +1 -1
- package/dist/cli/src/commands/serve-preflight.d.ts +7 -5
- package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
- package/dist/cli/src/commands/serve.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/validate.d.ts.map +1 -1
- package/dist/cli/src/config-checks.d.ts +50 -12
- package/dist/cli/src/config-checks.d.ts.map +1 -1
- package/dist/cli/src/ensure-sources.d.ts.map +1 -1
- package/dist/cli/src/harness-error.d.ts +7 -0
- package/dist/cli/src/harness-error.d.ts.map +1 -1
- package/dist/cli/src/helpers.d.ts.map +1 -1
- package/dist/connectors/config.js +5 -5
- package/dist/connectors/index.js +20 -19
- package/dist/connectors/src/index.d.ts +1 -1
- package/dist/connectors/src/index.d.ts.map +1 -1
- package/dist/connectors/src/managed-gitconfig.d.ts +12 -0
- package/dist/connectors/src/managed-gitconfig.d.ts.map +1 -1
- package/dist/{connectors-KTRUUKWG.js → connectors-P5M2D4MH.js} +23 -22
- package/dist/{connectors-KTRUUKWG.js.map → connectors-P5M2D4MH.js.map} +1 -1
- package/dist/core/index.js +7 -7
- package/dist/core/logging.js +1 -1
- package/dist/core/manifest.js +2 -2
- package/dist/core/models.js +1 -1
- package/dist/core/publish-manifest.js +3 -3
- package/dist/core/ref.js +1 -1
- package/dist/core/runtime-assets.js +5 -5
- package/dist/core/src/index.d.ts +2 -2
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/lock.d.ts +7 -1
- package/dist/core/src/lock.d.ts.map +1 -1
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +28 -0
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/run-state-ignore.d.ts +5 -3
- package/dist/core/src/run-state-ignore.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/workspace-config.js +4 -4
- package/dist/deploy/index.js +7 -7
- package/dist/discovery/index.js +4 -4
- package/dist/{ensure-sources-5QWKUIUD.js → ensure-sources-MOGLBEUF.js} +31 -29
- package/dist/ensure-sources-MOGLBEUF.js.map +1 -0
- package/dist/factory-assets/connectors/box.js +20 -19
- package/dist/factory-assets/connectors/deploy.js +20 -19
- package/dist/factory-assets/connectors/devserver.js +20 -19
- package/dist/factory-assets/connectors/flow/adapter.js +20 -19
- package/dist/factory-assets/connectors/flow/engine.js +8 -8
- package/dist/factory-assets/connectors/flow/run-flow.js +22 -21
- package/dist/factory-assets/connectors/flow.js +20 -19
- package/dist/factory-assets/connectors/git/exec.d.ts +7 -0
- package/dist/factory-assets/connectors/git/exec.d.ts.map +1 -1
- package/dist/factory-assets/connectors/git/repo.d.ts.map +1 -1
- package/dist/factory-assets/connectors/git.js +20 -19
- package/dist/factory-assets/connectors/gmail/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/gmail.js +20 -19
- package/dist/factory-assets/connectors/googledrive.js +20 -19
- package/dist/factory-assets/connectors/local.js +20 -19
- package/dist/factory-assets/connectors/mattermost.js +20 -19
- package/dist/factory-assets/connectors/memory.js +20 -19
- package/dist/factory-assets/connectors/minio/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/minio.js +20 -19
- package/dist/factory-assets/connectors/postgres/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/postgres.js +20 -19
- package/dist/factory-assets/connectors/s3/driver.d.ts.map +1 -1
- package/dist/factory-assets/connectors/s3.js +20 -19
- package/dist/factory-assets/connectors/sharepoint.js +20 -19
- package/dist/factory-assets/connectors/sqlite/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/sqlite.js +20 -19
- package/dist/factory-assets/connectors/static-server.js +20 -19
- package/dist/factory-assets/connectors/tunnel.js +20 -19
- package/dist/factory-assets/connectors/webdav.js +20 -19
- package/dist/factory-assets/connectors/xstate-store.js +20 -19
- package/dist/factory-assets/connectors/xstate.js +20 -19
- package/dist/{flows-UCP6ZUYS.js → flows-J64L5MGJ.js} +12 -12
- package/dist/{flows-UCP6ZUYS.js.map → flows-J64L5MGJ.js.map} +1 -1
- package/dist/{helpers-INS4B7OQ.js → helpers-JL5AEGDT.js} +28 -26
- package/dist/{helpers-INS4B7OQ.js.map → helpers-JL5AEGDT.js.map} +1 -1
- package/dist/library/index.js +10 -10
- package/dist/library/install.js +4 -4
- package/dist/library/src/index.d.ts +2 -2
- package/dist/library/src/index.d.ts.map +1 -1
- package/dist/library/src/library.d.ts +6 -2
- package/dist/library/src/library.d.ts.map +1 -1
- package/dist/library/src/local/db.d.ts.map +1 -1
- package/dist/library/src/local/library.d.ts +10 -3
- package/dist/library/src/local/library.d.ts.map +1 -1
- package/dist/library/src/local/local-catalog-source.d.ts +0 -9
- package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
- package/dist/library/src/local/schema.d.ts +27 -20
- package/dist/library/src/local/schema.d.ts.map +1 -1
- package/dist/library/src/manifest-writer.d.ts +13 -0
- package/dist/library/src/manifest-writer.d.ts.map +1 -1
- package/dist/library/src/remote/index.d.ts +1 -1
- package/dist/library/src/remote/index.d.ts.map +1 -1
- package/dist/library/src/remote/remote-catalog-source.d.ts +6 -0
- package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
- package/dist/library/src/sync/git-driver.d.ts.map +1 -1
- package/dist/{library-publish-AZTYRASL.js → library-publish-DZNNZNMB.js} +49 -50
- package/dist/library-publish-DZNNZNMB.js.map +1 -0
- package/dist/model-endpoint/index.js +10 -10
- package/dist/open-library-OJREQ22B.js +61 -0
- package/dist/{open-library-3HMXYGUF.js.map → open-library-OJREQ22B.js.map} +1 -1
- package/dist/{open-registry-BHBHQMBA.js → open-registry-OEU6QUK2.js} +14 -14
- package/dist/{open-registry-BHBHQMBA.js.map → open-registry-OEU6QUK2.js.map} +1 -1
- package/dist/paths-PXBWY532.js +22 -0
- package/dist/{paths-77PXOXZY.js.map → paths-PXBWY532.js.map} +1 -1
- package/dist/{plugin-store-XQP2CRYH.js → plugin-store-ZC3EGZ3D.js} +10 -10
- package/dist/{plugin-store-XQP2CRYH.js.map → plugin-store-ZC3EGZ3D.js.map} +1 -1
- package/dist/{project-HVNPK2ZF.js → project-52UABBD5.js} +45 -46
- package/dist/{project-HVNPK2ZF.js.map → project-52UABBD5.js.map} +1 -1
- package/dist/resolver/index.js +8 -8
- package/dist/runner/index.js +35 -35
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +14 -14
- package/dist/sdk/bridge.js +17 -16
- package/dist/sdk/core.js +7 -7
- package/dist/sdk/flow.js +8 -8
- package/dist/sdk/index.js +35 -35
- package/dist/sdk/resolver.js +8 -8
- package/dist/sdk/runner.js +35 -35
- package/dist/sdk/transport/ws/server.js +8 -8
- package/dist/sdk/transport/ws.js +8 -8
- package/dist/sdk/transport.js +8 -8
- package/dist/{serve-preflight-NHZOKHIC.js → serve-preflight-HOQ7CGYR.js} +30 -30
- package/dist/{serve-preflight-NHZOKHIC.js.map → serve-preflight-HOQ7CGYR.js.map} +1 -1
- package/dist/{setup-EX7Z7XRN.js → setup-JIDZ372C.js} +29 -27
- package/dist/setup-JIDZ372C.js.map +1 -0
- package/dist/{skills-DE2BDQ6G.js → skills-5D4KDVPJ.js} +13 -13
- package/dist/{skills-DE2BDQ6G.js.map → skills-5D4KDVPJ.js.map} +1 -1
- package/dist/{source-URRPRGMZ.js → source-P6ZFSSZZ.js} +47 -46
- package/dist/{source-URRPRGMZ.js.map → source-P6ZFSSZZ.js.map} +1 -1
- package/dist/{source-manifest-publish-ZWRYRJ2U.js → source-manifest-publish-Y36FHVDS.js} +49 -48
- package/dist/source-manifest-publish-Y36FHVDS.js.map +1 -0
- package/dist/transport/index.js +8 -8
- package/dist/transport/src/ws/server.d.ts.map +1 -1
- package/dist/transport/ws/server.js +8 -8
- package/dist/transport/ws.js +8 -8
- package/dist/tui/index.js +35 -35
- package/dist/workspace-plugin/adapters/mcp.js +27 -26
- package/dist/workspace-plugin/adapters/omp.js +14 -14
- package/dist/workspace-plugin/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-4KPQ6ILH.js.map +0 -1
- package/dist/chunk-7UCPGQCW.js.map +0 -1
- package/dist/chunk-AQTAULXT.js.map +0 -1
- package/dist/chunk-BLBXOG5Q.js +0 -299
- package/dist/chunk-BLBXOG5Q.js.map +0 -1
- package/dist/chunk-C324IAXI.js +0 -160
- package/dist/chunk-C324IAXI.js.map +0 -1
- package/dist/chunk-DJSGQW2Q.js +0 -334
- package/dist/chunk-DJSGQW2Q.js.map +0 -1
- package/dist/chunk-FZO64PLQ.js.map +0 -1
- package/dist/chunk-FZTHL6SK.js.map +0 -1
- package/dist/chunk-GYPPVANR.js +0 -357
- package/dist/chunk-GYPPVANR.js.map +0 -1
- package/dist/chunk-GZL6RN4Z.js.map +0 -1
- package/dist/chunk-KNY356I3.js.map +0 -1
- package/dist/chunk-LOO5CB5M.js +0 -12
- package/dist/chunk-LOO5CB5M.js.map +0 -1
- package/dist/chunk-MDCI4RSG.js.map +0 -1
- package/dist/chunk-PLVM6OIV.js.map +0 -1
- package/dist/chunk-Q5SSRVD5.js.map +0 -1
- package/dist/chunk-U3FI4DVT.js.map +0 -1
- package/dist/chunk-V5KG6CCV.js.map +0 -1
- package/dist/chunk-VEIWFS7Z.js.map +0 -1
- package/dist/chunk-WEPTGUR4.js.map +0 -1
- package/dist/chunk-ZUROGXJM.js.map +0 -1
- package/dist/ensure-sources-5QWKUIUD.js.map +0 -1
- package/dist/library-publish-AZTYRASL.js.map +0 -1
- package/dist/open-library-3HMXYGUF.js +0 -59
- package/dist/paths-77PXOXZY.js +0 -22
- package/dist/setup-EX7Z7XRN.js.map +0 -1
- package/dist/source-manifest-publish-ZWRYRJ2U.js.map +0 -1
|
@@ -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":";;;;;;;;;;;;;;;;;;;AAkDA,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;AAEA,EAAA,MAAM,UAAA,GAA4B,kBAAA;AAAA,IAC3BA,KAAA,CAAA,IAAA,CAAUA,KAAA,CAAA,OAAA,CAAQ,UAAU,CAAA,EAAG,yBAAyB;AAAA,GAC/D;AACA,EAAA,MAAM,KAAA,GAAQ,WAAW,IAAA,CAAK,CAAC,MAAM,gBAAA,CAAiB,CAAA,EAAG,GAAG,CAAC,CAAA;AAC7D,EAAA,MAAM,KAAA,GAAQ,CAAC,KAAA,GAAQ,kBAAA,CAAmB,KAAK,IAAA,CAAK,MAAA,IAAU,IAAI,CAAA,GAAI,MAAA;AACtE,EAAA,MAAM,MAAA,GAAS,KAAA,IAAS,KAAA,IAAS,KAAA,GAAQ,KAAA,GAAQ,MAAA;AACjD,EAAA,MAAM,MAAM,KAAA,GAAQ,KAAA,CAAM,MAAO,MAAA,EAAQ,GAAA,IAAO,mBAAmB,GAAG,CAAA;AACtE,EAAA,MAAM,IAAA,GAAO,gBAAgB,GAAG,CAAA;AAChC,EAAA,MAAM,IAAA,GAAO,eAAA,CAAgB,cAAA,CAAe,GAAG,CAAC,CAAA;AAChD,EAAA,OAAO;AAAA,IACL,GAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAA;AAAA,IACA,YAAA,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AAa,CAAA,CACrB,WAAA,CAAY,iDAAiD,CAAA,CAC7D,MAAA,CAAO,CAAC,IAAA,KAAiB;AACxB,IAAA,MAAA;AAAA,MACE;AAAA,KAEF;AACA,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB,CAAC,CAAA;AAEH,EAAA,GAAA,CACG,OAAA,CAAQ,eAAe,CAAA,CACvB,WAAA,CAAY,sDAAsD,CAAA,CAClE,MAAA,CAAO,CAAC,IAAA,KAAiB;AACxB,IAAA,MAAA;AAAA,MACE;AAAA,KAEF;AACA,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB,CAAC,CAAA;AAGH,EAAA,yBAAA,CAA0B,GAAG,CAAA;AAE7B,EAAA,OAAO,GAAA;AACT","file":"chunk-7DUOKE73.js","sourcesContent":["/**\n * `skaile source manifest …` — curated `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 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 // Like `source list` / `check` / `add`: the project is `projectDir` itself, no parent search (p1860).\n const registered: SourceEntry[] = readProjectSources(\n path.join(path.resolve(projectDir), 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 discardUnclonedSourceDir,\n getGlobalCacheDir,\n getRepoCommit,\n missingPinMessage,\n globalCacheRoot,\n globalSkaileDir,\n isSameRemote,\n isSourceCloned,\n priorSourceCacheKeys,\n resolveSkWorkspaceConfig,\n resolveSourcePublisher,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n unpublishedCommitAdvice,\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, logNoProject, 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 scheme = (url[1] ?? \"\").toLowerCase();\n // A `file://` path with `.`, `..` or `//` segments is the one repository its folded path\n // names: `file:///a/r1/../remotes/x.git` is `file:///a/remotes/x.git` (p1856).\n if (scheme === \"file\" && url[2] === \"\" && /(?:^|\\/)\\.\\.?(?:\\/|$)|\\/\\//.test(url[3] ?? \"\")) {\n return `file://${path.posix.normalize(url[3] ?? \"\")}`;\n }\n const authority = url[2] ?? \"\";\n const at = authority.lastIndexOf(\"@\");\n const host = authority.slice(at + 1).toLowerCase();\n return `${scheme}://${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\n/**\n * `projectDir` when it holds its own `skaile.yaml`, else `undefined`. Like `list`, `check` and\n * `add`, the `source` commands never search parent directories (p1860).\n */\nfunction projectRootOf(projectDir: string): string | undefined {\n const dir = path.resolve(projectDir);\n return existsSync(path.join(dir, workspaceConfigFilename())) ? dir : undefined;\n}\n\n/** The `skaile.yaml` path of `projectDir`; stops with the `No skaile.yaml found` lines when it has none. */\nfunction requireProjectYamlPath(projectDir: string): string {\n const root = projectRootOf(projectDir);\n if (!root) {\n logNoProject(projectDir);\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/**\n * Labels of the sources `projectDir`'s `skaile.yaml` declares whose clone is not in the cache\n * (`cache clean --global`, a failed clone). Empty outside a project. Never reads the network.\n */\nexport function uncachedSources(projectDir: string): string[] {\n const root = projectRootOf(projectDir);\n if (!root) return [];\n const sources = readProjectSources(path.join(root, workspaceConfigFilename()));\n return sources\n .filter((s) => !isSourceCloned(sourceClonePath(sourceCacheKey(s.url))))\n .map((s) => sourceLabel(s, sources));\n}\n\n/**\n * Drop the library rows of source clones whose folder is gone. A clone is cache, so its row goes\n * with it (`cache clean --global`); the next `source sync` that clones it registers it again.\n * Rows of libraries registered by hand never count: only a reader row inside the clone cache.\n */\nexport async function dropVanishedSourceRows(): Promise<number> {\n const cloneRoots = [getGlobalCacheDir(), path.join(globalSkaileDir(), \"sources\")].map((d) =>\n path.resolve(d),\n );\n const { manager, close } = await openLibraryManager();\n try {\n let dropped = 0;\n for (const l of await manager.listLibraries()) {\n const at = path.resolve(l.path);\n if (l.ownership !== \"reader\" || !cloneRoots.some((r) => at.startsWith(r + path.sep)))\n continue;\n if (existsSync(at)) continue;\n await manager.removeLibrary(l.name, { purge: false });\n dropped++;\n }\n return dropped;\n } finally {\n close();\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 * A fresh clone whose remote HEAD names a branch the remote lacks has no commit checked out and\n * an empty tree. When the remote has exactly one branch, check it out; with several,\n * or none that can be told apart, return the problem line. `undefined` when a commit is checked\n * out, and for a remote with no branch at all (an empty repository, filled later).\n */\nfunction repairUnbornClone(dest: string): string | undefined {\n const git = (...args: string[]) =>\n spawnSync(\"git\", [\"-C\", dest, ...args], { stdio: \"pipe\", encoding: \"utf8\" });\n if (git(\"rev-parse\", \"--verify\", \"-q\", \"HEAD\").status === 0) return undefined;\n const branches = git(\"for-each-ref\", \"--format=%(refname:short)\", \"refs/remotes/origin\")\n .stdout.split(\"\\n\")\n .map((b) => b.trim())\n .filter((b) => b !== \"\" && b !== \"origin/HEAD\" && b !== \"origin\");\n if (branches.length === 0) return undefined;\n const only = branches[0];\n if (branches.length === 1 && only) {\n const name = only.replace(/^origin\\//, \"\");\n if (git(\"checkout\", \"-q\", \"-B\", name, only).status === 0) return undefined;\n }\n return `the remote HEAD names a branch that does not exist; pass --pin <branch> (${branches\n .map((b) => b.replace(/^origin\\//, \"\"))\n .join(\", \")})`;\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 (!isSourceCloned(dest)) discardUnclonedSourceDir(dest);\n if (entry.pin && (opts.force || !isSourceCloned(dest))) {\n // Say so before git does: its own line (`Remote branch x not found in upstream origin`) names no branch to use.\n const missing = missingPinMessage(entry.url, entry.pin);\n if (missing) {\n logErr(missing);\n process.exit(1);\n }\n }\n if (isSourceCloned(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 const unborn = clone.status === 0 ? repairUnbornClone(dest) : undefined;\n if (clone.status !== 0 || unborn) {\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(unborn ? `${entry.url}: ${unborn}` : `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 // The declaration is authoritative: a clone whose `origin` was pointed elsewhere\n // fetches from the declared url again, as `install` does.\n spawnSync(\"git\", [\"-C\", dest, \"remote\", \"set-url\", \"origin\", entry.url], { stdio: \"pipe\" });\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}${unpublishedCommitAdvice(dest)}` };\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 cannot give its assets a publisher, or `undefined`: none is\n * declared anywhere, or the one its `skaile.manifest.yaml` names breaks the grammar of\n * `--publisher`. The walk is the one `add`, `install` and `check` run, so what it refuses here\n * they would skip later.\n */\nasync function publisherProblem(entry: SourceEntry, dest: string): Promise<string | 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 ...(entry.publisher ? { publisher: entry.publisher.replace(/^@/, \"\") } : {}),\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|publisher \".*\" is invalid/.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 and its indexed assets are shared by every project that declares the\n // source, so they keep the publisher the first indexer recorded. A project that declares\n // another `--publisher` sees its own one: `AssetManager.scopeLibraryIndex` re-labels the\n // assets for it and leaves what other projects see alone (p1822).\n const cfg = added.backendConfig;\n const recorded = \"url\" in cfg ? cfg.publisher : undefined;\n const publisher = existing || legacyRow ? recorded : entry.publisher;\n const lib = added;\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 = projectRootOf(projectDir);\n if (!root) return [];\n const sources = readProjectSources(path.join(root, workspaceConfigFilename()));\n const cached = sources.filter((s) => isSourceCloned(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 = projectRootOf(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 = path.resolve(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 (!isSourceCloned(dest)) {\n discardUnclonedSourceDir(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 const unborn = clone.status === 0 ? repairUnbornClone(dest) : undefined;\n if (clone.status !== 0 || unborn) {\n rmSync(dest, { recursive: true, force: true });\n discardUnclonedSourceDir(dest);\n const missing =\n clone.status !== 0 && entry.pin ? missingPinMessage(entry.url, entry.pin) : undefined;\n logWarn(\n unborn ? `${slug}: ${unborn}` : `${slug}: ${missing ?? \"git clone failed\"}, skipping.`,\n );\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 = path.resolve(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\n/**\n * The refusal for a `source add` URL that is the remote of a library registered by hand\n * (`library init --git`, `library init --reader`): its assets are already searchable, and a\n * source of the same repository would register a second, read-only library of the same\n * content (p499). `undefined` for any other URL. The reader row of a source clone never counts:\n * it lives in the clone cache and is the source itself.\n */\nexport async function remoteOfRegisteredLibrary(url: string): Promise<string | undefined> {\n const cloneRoots = [getGlobalCacheDir(), path.join(globalSkaileDir(), \"sources\")].map((d) =>\n path.resolve(d),\n );\n const { manager, close } = await openLibraryManager();\n try {\n const lib = (await manager.listLibraries()).find((l) => {\n const remote = \"url\" in l.backendConfig ? l.backendConfig.url : undefined;\n if (typeof remote !== \"string\" || !isSameRemote(remote, url)) return false;\n const at = path.resolve(l.path);\n return !cloneRoots.some((root) => at.startsWith(root + path.sep));\n });\n return lib\n ? `${url} is the remote of the library \"${lib.name}\"; it needs no source — \\`skaile library list\\` shows it and its assets are already searchable.`\n : undefined;\n } finally {\n close();\n }\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 .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\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 projectDir: string;\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 ownLibrary = await remoteOfRegisteredLibrary(url);\n if (ownLibrary) {\n logErr(ownLibrary);\n process.exitCode = 1;\n return;\n }\n const yamlPath = requireProjectYamlPath(opts.projectDir);\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 = isSourceCloned(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 .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (opts: { json?: boolean; projectDir: string }) => {\n const yamlPath = requireProjectYamlPath(opts.projectDir);\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 = isSourceCloned(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 .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (key: string, opts: { projectDir: string }) => {\n const yamlPath = requireProjectYamlPath(opts.projectDir);\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: isSourceCloned(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 .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (key: string, opts: { purge: boolean; force?: boolean; projectDir: string }) => {\n const yamlPath = requireProjectYamlPath(opts.projectDir);\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 .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(\n async (\n key: string | undefined,\n opts: { dev?: boolean; all?: boolean; verbose?: boolean; projectDir: string },\n ) => {\n const yamlPath = requireProjectYamlPath(opts.projectDir);\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 (!isSourceCloned(dest)) {\n const broken = existsSync(dest) && readdirSync(dest).length > 0;\n ensureClone(entry);\n if (broken) logInfo(`${slug}: the clone folder held no git checkout; replaced it.`);\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"]}
|
|
@@ -125,6 +125,11 @@ function parseAssetRef(s) {
|
|
|
125
125
|
if (pin !== void 0 && !isValidPin(pin)) rejectFloatingPin(s, pin);
|
|
126
126
|
return { kind, name, publisher, pin };
|
|
127
127
|
}
|
|
128
|
+
if (trimmed.endsWith("#") && SCOPED_REF_RE.test(trimmed.replace(/#+$/, ""))) {
|
|
129
|
+
throw new Error(
|
|
130
|
+
`empty version after # in asset ref "${s}" \u2014 write \`#<version>\` (like #1.4.0 or #^1.4) or drop the #`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
128
133
|
const scoped = SCOPE_PREFIX_RE.exec(trimmed);
|
|
129
134
|
if (scoped) {
|
|
130
135
|
const candidate = scoped[1].trim();
|
|
@@ -205,5 +210,5 @@ function repositoryToRaw(r) {
|
|
|
205
210
|
}
|
|
206
211
|
|
|
207
212
|
export { ASSET_NAME_HINT, PUBLISHER_HINT, assetRefProblem, assetRefToDep, assetRefToStr, depToStr, entryFromRaw, entryToRaw, isValidAssetName, isValidPublisher, parseAssetRef, parseAssetRefLoose, parseDep, repositoryFromRaw, repositoryToRaw, slugifyAssetName };
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
209
|
-
//# sourceMappingURL=chunk-
|
|
213
|
+
//# sourceMappingURL=chunk-7HRZACI4.js.map
|
|
214
|
+
//# sourceMappingURL=chunk-7HRZACI4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../core/src/models.ts"],"names":[],"mappings":";;;A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","sourcesContent":["/**\n * Pure data models — no I/O, no side effects.\n */\n\nimport semver from \"semver\";\n\n/**\n * Discriminator for catalog entries and asset references.\n * Used in asset ref strings (e.g. `'skill:my-skill'`, `'agent:my-agent'`).\n *\n * Any string: the provider registry (`@skaile/workspaces/discovery`\n * `AssetKindRegistry`) is the only authority on which kinds exist — a kind exists\n * iff a provider is registered for it.\n * @docLink packages/core/concepts#asset-kind\n */\nexport type AssetKind = string;\n\n// ── Dependency ────────────────────────────────────────────────────────────────\n\n/**\n * Declared dependency on another catalog asset.\n * @docLink packages/core/concepts#dependency\n */\nexport interface Dependency {\n /** Asset kind (e.g. \"skill\", \"agent\", \"contract\"). */\n kind: string;\n /** Asset name within that kind. */\n name: string;\n /** Canonical publisher namespace (when known). Absent: the declaring asset's own publisher. */\n publisher?: string;\n /** Version pin (`#<version>` or legacy `@<version>` suffix), when the declaration carried one. */\n pin?: string;\n}\n\n// `[kind:]@<publisher>/<name>[#<pin>]`, with the legacy npm-style `@<version>` suffix on the\n// name. Lenient on the name (the strict grammar runs later, at resolution).\nconst SCOPED_DEP_RE = /^(?:([a-z][a-z0-9-]*):)?@([^/\\s]+)\\/([^#\\s]+?)(?:#(.+))?$/;\n\n/**\n * Parse a dependency string: `\"kind:name\"`, a bare `\"name\"` (kind defaults to `\"skill\"`), or\n * a publisher-qualified `\"kind:@publisher/name[#pin]\"` / `\"@publisher/name[#pin]\"`. The\n * qualified forms fill `publisher` (and `pin`); the other forms leave it absent so the dep\n * resolves under the declaring asset's own publisher.\n *\n * @param s - Dependency string, e.g. `\"skill:use-exa\"`, `\"use-exa\"` or `\"skill:@acme/use-exa#^1.0.0\"`\n * @returns Parsed `{ kind, name, publisher?, pin? }` dependency object\n * @docLink packages/core/concepts#parse-dep\n */\nexport function parseDep(s: string): Dependency {\n const trimmed = s.trim();\n const scoped = SCOPED_DEP_RE.exec(trimmed);\n if (scoped) {\n let name = scoped[3];\n let pin = scoped[4]?.trim() || undefined;\n const at = name.indexOf(\"@\");\n if (at > 0) {\n pin ??= name.slice(at + 1) || undefined;\n name = name.slice(0, at);\n }\n const dep: Dependency = { kind: scoped[1] ?? \"skill\", name, publisher: scoped[2] };\n if (pin) dep.pin = pin;\n return dep;\n }\n const i = trimmed.indexOf(\":\");\n if (i !== -1) {\n const kind = trimmed.slice(0, i).trim();\n const name = trimmed.slice(i + 1).trim();\n return { kind, name };\n }\n return { kind: \"skill\", name: trimmed };\n}\n\n/**\n * Serialize a Dependency back to its string form: `\"kind:name\"`, or\n * `\"kind:@publisher/name[#pin]\"` when it names a publisher.\n *\n * @param d - Dependency to serialize\n * @returns String in `\"kind:name\"` / `\"kind:@publisher/name[#pin]\"` format\n * @docLink packages/core/concepts#dep-to-str\n */\nexport function depToStr(d: Dependency): string {\n const pin = d.pin ? `#${d.pin}` : \"\";\n return d.publisher ? `${d.kind}:@${d.publisher}/${d.name}${pin}` : `${d.kind}:${d.name}${pin}`;\n}\n\n// ── CatalogEntry ──────────────────────────────────────────────────────────────\n\n/**\n * A resolved catalog entry describing an installable asset.\n * Produced by manifest parsers and stored in the catalog YAML.\n * @docLink packages/core/concepts#catalog-entry\n */\nexport interface CatalogEntry {\n /** Unique asset name within its kind. */\n name: string;\n /** Asset kind discriminator. */\n kind: AssetKind;\n /** Short description of what this asset does. */\n description: string;\n /** Absolute path to manifest file */\n source: string;\n /** Canonical publisher namespace this asset belongs to (formerly `repository`). */\n publisher?: string;\n /**\n * Canonical ref (`kind:@publisher/name#version`) the CLI prints for this entry.\n * Set by the asset manager where `publisher` is not the real publisher (a\n * clone-sourced entry carries its clone key there); absent → derived from\n * `publisher` + `version`.\n */\n canonicalRef?: string;\n /**\n * `\"<org>/<repo>\"` coordinate the asset came from. Absent → the asset groups\n * directly under its publisher (local library with no git remote, or a\n * non-GitHub source).\n */\n repo?: string;\n /**\n * Claude plugin (from `.claude-plugin/marketplace.json` / `plugin.json`\n * membership) this asset belongs to, or absent when no plugin lists it.\n * Display-only — groups assets in the manage TUI; never part of identity or\n * the install layout.\n */\n plugin?: string;\n /** Semantic version string (may be empty if not declared in the manifest). */\n version: string;\n /** Skills, agents, or other assets this entry depends on. */\n requires: Dependency[];\n /** Asset refs this entry pulls in (presets: the asset items; flows: `requires`). */\n dependencies: string[];\n /** Presets only: instance items (`library://`, placeholder, connector/mcp) a dependency expansion skips; absent when none. */\n skippedItems?: number;\n /**\n * Kind-specific metadata extracted from the manifest frontmatter.\n * Used by MCP servers to carry default config (transport, command, args, env, url, headers)\n * so that `mcp:name` dependency refs resolve to a runnable declaration without\n * requiring verbose inline config in `skaile.yaml`.\n */\n metadata?: Record<string, unknown>;\n /** Curated facet, surfaced as a badge in the manage TUI (not a tree axis). */\n category?: string;\n /** Store-listing keywords (manifest `assets[].keywords`, else frontmatter). */\n keywords?: string[];\n /** Store-listing license (manifest `assets[].license`, else repo-level default). */\n license?: string;\n /** Store-listing homepage (manifest `assets[].homepage`, else repo-level default). */\n homepage?: string;\n}\n\n/**\n * Construct a CatalogEntry from a raw deserialized record (e.g. from catalog.yaml).\n *\n * @param d - Raw object with loosely typed fields\n * @returns Normalized CatalogEntry\n * @docLink packages/core/concepts#entry-from-raw\n */\nexport function entryFromRaw(d: Record<string, unknown>): CatalogEntry {\n const rawDeps = d.dependencies;\n const deps = Array.isArray(rawDeps) ? (rawDeps as string[]).filter(Boolean) : [];\n const entry: CatalogEntry = {\n name: String(d.name ?? \"\"),\n kind: String(d.kind ?? \"skill\") as AssetKind,\n description: String(d.description ?? \"\"),\n source: String(d.source ?? \"\"),\n publisher: d.publisher != null ? String(d.publisher) : undefined,\n repo: d.repo != null ? String(d.repo) : undefined,\n plugin: d.plugin != null ? String(d.plugin) : undefined,\n version: String(d.version ?? \"\"),\n requires: Array.isArray(d.requires)\n ? (d.requires as string[]).filter(Boolean).map(parseDep)\n : [],\n dependencies: deps,\n };\n if (d.metadata != null && typeof d.metadata === \"object\" && !Array.isArray(d.metadata)) {\n entry.metadata = d.metadata as Record<string, unknown>;\n }\n if (d.category != null) entry.category = String(d.category);\n if (Array.isArray(d.keywords)) {\n entry.keywords = (d.keywords as unknown[]).filter((k): k is string => typeof k === \"string\");\n }\n if (d.license != null) entry.license = String(d.license);\n if (d.homepage != null) entry.homepage = String(d.homepage);\n return entry;\n}\n\n/**\n * Serialize a CatalogEntry to a plain record suitable for YAML/JSON persistence.\n *\n * @param e - CatalogEntry to serialize\n * @returns Plain object with string-serialized requires and dependencies\n * @docLink packages/core/concepts#entry-to-raw\n */\nexport function entryToRaw(e: CatalogEntry): Record<string, unknown> {\n const raw: Record<string, unknown> = {\n name: e.name,\n kind: e.kind,\n description: e.description,\n source: e.source,\n publisher: e.publisher,\n repo: e.repo,\n version: e.version,\n ...(e.plugin != null ? { plugin: e.plugin } : {}),\n requires: e.requires.map(depToStr),\n dependencies: e.dependencies,\n };\n if (e.metadata) raw.metadata = e.metadata;\n if (e.category != null) raw.category = e.category;\n if (e.keywords && e.keywords.length > 0) raw.keywords = e.keywords;\n if (e.license != null) raw.license = e.license;\n if (e.homepage != null) raw.homepage = e.homepage;\n return raw;\n}\n\n// ── AssetRef ─────────────────────────────────────────────────────────────────\n\n/**\n * A parsed asset reference: `kind:@<publisher>/name[#pin]`.\n *\n * `publisher` is the canonical, GitHub-shaped publisher namespace (≤39 chars,\n * alphanumeric+hyphen). `pin` is a SemVer constraint, exact SHA, or absent.\n * Floating refs (`main`, `latest`, `HEAD`) are rejected at parse time.\n *\n * Produced by `parseAssetRef`; consumed by `resolveAsset` and `resolveAll`.\n * @docLink packages/core/concepts#asset-ref\n */\nexport interface AssetRef {\n kind: string;\n name: string;\n /** Canonical publisher namespace. Optional only for ambiguity-resolution\n * during migration; new manifests require it. */\n publisher?: string;\n /** SemVer constraint (^1.4.0, ~1.4, 1.x, exact 1.4.0), 40-char SHA, or undefined. */\n pin?: string;\n}\n\nconst SHA_RE = /^[0-9a-f]{40}$/i;\n\n// Scoped grammar: `kind:@publisher/name[#version]`. The publisher sub-pattern is\n// GitHub-shaped (1-39 chars, alphanumeric + single hyphens, no leading/trailing or\n// double hyphen); `@` is the scope sigil and `#` the version sigil. `name` is\n// intentionally permissive (`[^/#\\s]+` — only the structural separators are\n// forbidden); floating-ref rejection stays in `isValidPin`, so `#main`/`#latest`\n// match here and fail there with a clear message.\nconst SCOPED_REF_RE =\n /^(?:([a-z][a-z0-9-]*):)?@([A-Za-z0-9](?:[A-Za-z0-9]|-(?!-)){0,37}[A-Za-z0-9]|[A-Za-z0-9])\\/([^/#\\s]+)(?:#(.+))?$/;\n\n// Canonical asset-name grammar: lowercase kebab-case (npm-style, scope-free) —\n// `a-z` / `0-9` segments joined by single hyphens, 1-64 characters, no leading/trailing hyphen,\n// no uppercase, spaces, dots, or underscores. Names become directory names,\n// lock keys, and CLI args, so the constraint is intentionally narrow.\nconst ASSET_NAME_RE = /^(?=.{1,64}$)[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n// Diagnostic-only matcher: a ref carrying a `kind:@publisher/` scope prefix,\n// capturing whatever follows (sans `#pin`) as the candidate name. Used solely\n// to tell \"missing publisher\" apart from \"malformed name\" when the strict\n// grammar above fails (e.g. a space in the name).\nconst SCOPE_PREFIX_RE = /^(?:[a-z][a-z0-9-]*:)?@[^/\\s]+\\/([^#]+?)(?:#.*)?$/;\n\n/** Human-readable statement of the canonical asset-name rule. */\nexport const ASSET_NAME_HINT =\n 'names must be lowercase kebab-case (a-z, 0-9, single hyphens; at most 64 characters; e.g. \"cli-concept\")';\n\n/**\n * True when `name` is a canonical asset name: lowercase kebab-case, scope-free.\n *\n * This is the single source of truth for asset-name validity — `parseAssetRef`\n * enforces it, and `skaile validate` reports violations across a repo tree.\n * @docLink packages/core/concepts#is-valid-asset-name\n */\nexport function isValidAssetName(name: string): boolean {\n return ASSET_NAME_RE.test(name);\n}\n\n// The one publisher slug: 1-39 chars, lowercase letters and digits, single `-`\n// inside, no leading/trailing hyphen. The lowercase form of the publisher grammar of\n// `SCOPED_REF_RE`, so every publisher accepted here also parses in a\n// `kind:@<publisher>/name` ref.\nconst PUBLISHER_RE = /^[a-z0-9](?:[a-z0-9]|-(?!-)){0,37}[a-z0-9]$|^[a-z0-9]$/;\n\n/** Human-readable statement of the publisher rule, shared by every command that checks one. */\nexport const PUBLISHER_HINT =\n 'publishers must be a bare name of 1-39 characters: lowercase letters, digits and single hyphens inside (like \"acme\" or \"my-lib\"), with no @, /, #, dots, underscores or spaces and no leading or trailing hyphen';\n\n/**\n * True when `publisher` is a valid bare publisher slug (see {@link PUBLISHER_HINT}).\n * The one rule behind `library create --publisher`, `library set <lib> publisher=`,\n * `asset import --publisher`, `library index`, `validate` and the publish plan; the\n * caller strips a leading `@` first.\n */\nexport function isValidPublisher(publisher: string): boolean {\n return PUBLISHER_RE.test(publisher);\n}\n\n/**\n * Coerce an arbitrary string into a canonical asset name (lowercase kebab-case).\n *\n * For **third-party sources we don't control**, an upstream asset may carry a\n * human-styled identity (`\"Complex App\"`, `\"CLI_Concept\"`). The canonical grammar\n * (`isValidAssetName`) rejects those, so the ingestion boundary slugifies them to\n * a valid identity rather than crashing: Unicode is folded to ASCII, the result is\n * lowercased, every run of non-`[a-z0-9]` becomes a single hyphen, and\n * leading/trailing hyphens are trimmed. The transform is idempotent and a no-op on\n * already-canonical names.\n *\n * This is intentionally **lossy** — the pretty original is not part of identity.\n * Callers that want to preserve it for display must stash it themselves (e.g. on\n * `CatalogEntry.metadata.displayName`). Authoring-time validation (`skaile validate`)\n * still uses `isValidAssetName` on raw frontmatter, so first-party typos surface there.\n *\n * @throws When `raw` contains no `[a-z0-9]` character (nothing to slugify).\n * @docLink packages/core/concepts#slugify-asset-name\n */\nexport function slugifyAssetName(raw: string): string {\n const slug = raw\n .normalize(\"NFKD\")\n .replace(/[\\u0300-\\u036f]/g, \"\") // strip combining accents\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 64)\n .replace(/-+$/, \"\");\n if (!slug) {\n throw new Error(`cannot derive a canonical asset name from \"${raw}\" — ${ASSET_NAME_HINT}.`);\n }\n return slug;\n}\n\n/** True when `pin` is a SemVer constraint, exact SemVer, 40-char SHA or a commit pseudo-version. */\nfunction isValidPin(pin: string): boolean {\n if (SHA_RE.test(pin)) return true;\n // `search` lists a version-less source asset as `0.0.0-sha.<commit>`; a commit that starts\n // with `0` and has only digits (`0809848`) is not valid SemVer, yet it is the version printed.\n if (/^0\\.0\\.0-sha\\.[0-9a-f]{7,40}$/.test(pin)) return true;\n if (semver.valid(pin)) return true;\n if (semver.validRange(pin)) return true;\n return false;\n}\n\n/** Throw the canonical non-canonical-pin error for a ref `s` carrying `pin`. */\nfunction rejectFloatingPin(s: string, pin: string): never {\n throw new Error(\n `non-canonical pin \"${pin}\" in \"${s}\" — pin must be a SemVer ` +\n \"constraint (1.4.0, ^1.4, ~1.4, 1.x), a 40-char SHA, or absent. \" +\n \"Floating refs (main/latest/HEAD) are not allowed.\",\n );\n}\n\n/** Throw the canonical malformed-name error for a ref `s` carrying `name`. */\nfunction rejectInvalidName(s: string, name: string): never {\n throw new Error(\n `invalid asset name \"${name}\" in ref \"${s}\" — ${ASSET_NAME_HINT}. ` +\n \"Run the `migrate-skaile-manifest` skill on legacy manifests.\",\n );\n}\n\n/**\n * Parse a canonical asset reference string into an `AssetRef` object.\n *\n * Grammar: `kind:@<publisher>/name[#version]`\n * \"skill:@skaile-ai/audit\" → { kind: \"skill\", name: \"audit\", publisher: \"skaile-ai\" }\n * \"skill:@skaile-ai/audit#^1.4.0\" → { …, pin: \"^1.4.0\" }\n * \"skill:@skaile-ai/audit#<40-sha>\" → { …, pin: \"<40-sha>\" }\n *\n * `@` is the scope sigil and `#` the version sigil. `<publisher>` is GitHub-shaped\n * (≤39 chars, alphanumeric+hyphen, no leading/trailing or double hyphen). `pin`\n * accepts a SemVer constraint (`^`, `~`, `x`, exact), a 40-char SHA, or is absent.\n * Floating refs (`main`/`latest`/`HEAD`/anything non-canonical) are parse-time errors.\n *\n * The shorthand `mcp:` is normalized to `mcp-server:`. `kind` defaults to `\"skill\"`.\n *\n * @param s - Asset reference string\n * @returns Parsed `AssetRef`\n * @throws When the ref matches no grammar, the publisher is malformed, or the pin\n * is a floating ref.\n * @docLink packages/core/concepts#parse-asset-ref\n */\nexport function parseAssetRef(s: string): AssetRef {\n const trimmed = s.trim();\n const m = SCOPED_REF_RE.exec(trimmed);\n if (m) {\n const kindRaw = m[1] ?? \"skill\";\n const kind = kindRaw === \"mcp\" ? \"mcp-server\" : kindRaw;\n const publisher = m[2];\n const name = m[3];\n const pin = m[4]?.trim() || undefined;\n if (!isValidAssetName(name)) rejectInvalidName(s, name);\n if (pin !== undefined && !isValidPin(pin)) rejectFloatingPin(s, pin);\n return { kind, name, publisher, pin };\n }\n\n // `kind:@pub/name#` carries a `#` and no version: the ref parses without it, so say that, not\n // that the publisher is wrong (the strict grammar above needs at least one character after `#`).\n if (trimmed.endsWith(\"#\") && SCOPED_REF_RE.test(trimmed.replace(/#+$/, \"\"))) {\n throw new Error(\n `empty version after # in asset ref \"${s}\" — write \\`#<version>\\` (like #1.4.0 or #^1.4) or drop the #`,\n );\n }\n\n // The strict grammar failed. If the ref nonetheless carries a `@publisher/`\n // scope and the fault is the name (e.g. an embedded space), surface a\n // name-specific error rather than the misleading \"publisher required\" — the\n // publisher is plainly present. A *valid* captured name means the publisher\n // itself is malformed, so fall through to the publisher error below.\n const scoped = SCOPE_PREFIX_RE.exec(trimmed);\n if (scoped) {\n const candidate = scoped[1].trim();\n if (!isValidAssetName(candidate)) rejectInvalidName(s, candidate);\n // The name is fine, so the publisher is the fault: name the rule, not \"publisher required\".\n const publisher = /^(?:[a-z][a-z0-9-]*:)?@([^/\\s]+)\\//.exec(trimmed)?.[1];\n if (publisher !== undefined) {\n throw new Error(`invalid publisher \"${publisher}\" in asset ref \"${s}\" — ${PUBLISHER_HINT}`);\n }\n }\n\n throw new Error(\n `publisher required in asset ref \"${s}\" — use \\`kind:@<publisher>/name\\`. ` +\n \"Run the `migrate-skaile-manifest` skill on legacy manifests.\",\n );\n}\n\n/** Options of {@link assetRefProblem}. */\nexport interface AssetRefProblemOptions {\n /**\n * Accept an entry without a `@publisher/` scope (`name`, `kind:name`): the form a SKILL.md\n * `requires:` takes for an asset of the same publisher. A preset item or a manifest\n * dependency always names its publisher.\n */\n allowBare?: boolean;\n /** `true` for a registered asset kind (`mcp` is read as `mcp-server`); omitted: any kind passes. */\n isKnownKind?: (kind: string) => boolean;\n}\n\n/**\n * The one syntax check for an asset ref written in a manifest (`requires:`, `dependencies:`,\n * a preset `items[].ref`): the publisher follows the publisher slug rule, the name the asset\n * name rule, the pin the pin rule and the kind is a registered one. Returns the reason the ref\n * is wrong, `undefined` when it is well-formed. `add` refuses the same refs, so `validate`,\n * `library index` and the publish plan can no longer pass what `add` rejects (p135).\n */\nexport function assetRefProblem(\n ref: string,\n opts: AssetRefProblemOptions = {},\n): string | undefined {\n const t = ref.trim();\n if (t === \"\") return \"the ref is empty\";\n const m = /^(?:([^:@#\\s/]+):)?(.*)$/.exec(t);\n const kind = m?.[1];\n const rest = m?.[2] ?? t;\n if (kind !== undefined && opts.isKnownKind) {\n if (!opts.isKnownKind(kind === \"mcp\" ? \"mcp-server\" : kind)) return `unknown kind \"${kind}\"`;\n }\n if (rest.startsWith(\"@\")) {\n const slash = rest.indexOf(\"/\");\n const publisher = slash < 0 ? rest.slice(1) : rest.slice(1, slash);\n const name = slash < 0 ? \"\" : rest.slice(slash + 1).split(\"#\")[0]!;\n if (!isValidPublisher(publisher)) return `publisher \"${publisher}\" — ${PUBLISHER_HINT}`;\n if (name === \"\") return `no asset name after the publisher \"@${publisher}/\"`;\n try {\n parseAssetRef(t);\n } catch (err) {\n return err instanceof Error ? err.message : String(err);\n }\n return undefined;\n }\n if (!opts.allowBare) return \"publisher required — use `kind:@<publisher>/name`\";\n if (!isValidAssetName(rest)) return `invalid asset name \"${rest}\" — ${ASSET_NAME_HINT}`;\n return undefined;\n}\n\n/**\n * Parse a ref for identity matching, tolerating a non-canonical pin. A lock key\n * can pin a content-sha pseudo-version (`#0.0.0-sha.<hash>`) that\n * {@link parseAssetRef} rejects; matchers only need the version-agnostic\n * `kind/publisher/name`, so drop the pin and retry before giving up.\n *\n * @returns The parsed ref (its `pin` empty when the pin was dropped), or `null`.\n */\nexport function parseAssetRefLoose(ref: string): AssetRef | null {\n try {\n return parseAssetRef(ref);\n } catch {\n const hash = ref.indexOf(\"#\");\n if (hash < 0) return null;\n try {\n return parseAssetRef(ref.slice(0, hash));\n } catch {\n return null;\n }\n }\n}\n\n/**\n * Serialize an AssetRef back to its canonical string form.\n *\n * Emits the scope form `kind:@publisher/name[#pin]` when `publisher` is present,\n * and the bare `kind:name[#pin]` form for transitive refs that inherit it.\n *\n * @param ref - AssetRef to serialize\n * @returns String in `\"kind:@publisher/name[#pin]\"` (or bare `\"kind:name[#pin]\"`) format\n * @docLink packages/core/concepts#asset-ref-to-str\n */\nexport function assetRefToStr(ref: AssetRef): string {\n const scope = ref.publisher ? `@${ref.publisher}/${ref.name}` : ref.name;\n return `${ref.kind}:${scope}${ref.pin ? `#${ref.pin}` : \"\"}`;\n}\n\n/**\n * Convert an AssetRef to a simple Dependency, dropping the repository and pin qualifiers.\n *\n * @param ref - Full asset reference (may include repository and pin)\n * @returns Dependency with only kind and name\n * @docLink packages/core/concepts#asset-ref-to-dep\n */\nexport function assetRefToDep(ref: AssetRef): Dependency {\n // Grammar-agnostic — drops publisher/pin, so the scope-sigil change doesn't touch it.\n return { kind: ref.kind, name: ref.name };\n}\n\n// ── Lock File ────────────────────────────────────────────────────────────────\n\n/** A path/sha256 pair recorded for one file inside a locked asset. */\nexport interface LockFileEntry {\n path: string;\n sha256: string;\n}\n\n/**\n * Library-origin marker on a {@link LockEntry}: the asset was resolved from a\n * registered library (a local authoring place) rather than a git source/store.\n */\nexport interface LockLibraryOrigin {\n /** Name of the library the asset was resolved from. */\n name: string;\n /** Library version of the asset at lock time. */\n version: string;\n /** Content hash recorded in the library index at lock time; absent when the library was never indexed. */\n sha256?: string;\n /**\n * Remote URL of the library at lock time, recorded for a git-backed library only. The name is\n * machine-local; when it is not registered on another machine, `install --locked` and `check`\n * match a registered library by this URL instead. Optional: locks without it resolve by name\n * as before.\n */\n url?: string;\n /**\n * Set by `skaile asset install`: the files were copied or linked straight into\n * the project, not deployed from a `skaile.yaml` dependency. `skaile install`\n * leaves such an entry and its files alone instead of reconciling them away.\n */\n installed?: \"copy\" | \"link\";\n}\n\n/**\n * Per-asset entry in the lock file (v3 schema).\n * Keyed in `LockFile.assets` by canonical ref (`<kind>:@<publisher>/<name>#<version>`).\n * Source-origin entries carry `source` + `files`; library-origin entries carry\n * `library` instead (no `source`, empty `files`). Both fields are additive, so\n * lock files written before library origin existed still load unchanged.\n * @docLink packages/core/api-reference#lock-entry\n */\nexport interface LockEntry {\n /** Composite sha256 over sorted `<path>:<sha256>\\n` rows (library-origin: the library's hash, `\"\"` when unknown). */\n sha256: string;\n /** Resolved upstream source + commit. Absent for library-origin entries. */\n source?: { url: string; commit: string };\n /** Files that constitute the asset. Empty for library-origin entries. */\n files: LockFileEntry[];\n /** True when an `overrides[]` entry pinned this resolution. */\n override_applied: boolean;\n /** Set when the asset was resolved from a registered library. */\n library?: LockLibraryOrigin;\n /**\n * Agents only: the files the harness rendering of the asset occupies, project-relative\n * (`.claude/agents/captain.md`), with the sha256 of the bytes `install` wrote. An agent is\n * rendered, not copied, so it has no source file to compare with; `check`, `doctor` and\n * `outdated` compare the deployed file with these hashes and `install` restores it. Absent\n * for every other kind and for locks written before this field existed.\n */\n rendered?: LockFileEntry[];\n /**\n * Agents only: the files of the agent's `../` compose folders as the project cache holds them\n * (`.skaile/cache/agents/<name>/composes/<folder>/…`), project-relative, with sha256. The\n * folders are part of the lock: `install` keeps these bytes whatever the library holds now and\n * only `update` copies the library's. Absent when the agent composes nothing outside its own\n * folder and for locks written before this field existed.\n */\n composed?: LockFileEntry[];\n /**\n * Library-origin assets copied into a harness folder (not agents): the files the deploy wrote,\n * relative to the deployed folder, with the sha256 of those bytes. A library records one hash\n * for the whole asset, so this is what names a hand-edited file after the library moved on\n * (p1641). Absent for other origins and for locks written before this field existed.\n */\n copied?: LockFileEntry[];\n /**\n * Store-resolved assets only: the assets this one requires, as `kind:@publisher/name`, as\n * the store's catalog row lists them. The deployed copy of such an asset cannot say them (a\n * 0.1 `agent.yaml` names its skills by bare name), yet `why`, the `remove` guard and the\n * prune of orphans need them, as they use a library or source asset's own manifest.\n * Absent when the store listed none and for every other origin.\n */\n requires?: string[];\n /**\n * Store-resolved assets only: `\"store\"` when a store's catalog (not a `sources:` entry, not a\n * library) supplied the asset. `check`, `doctor`, `outdated`, `diff` and `install --locked`\n * then judge the entry from the lock, with the store unreachable and its cache cold. Absent\n * for every other origin and for locks written before this field existed; such a store entry\n * reads as before and gets the field on the next `install` or `update` that reaches the store.\n */\n origin?: \"store\";\n /** Store-resolved assets only: the catalog URL that supplied the asset (see {@link origin}). */\n store?: string;\n}\n\n/** Per-source-URL entry in `LockFile.sources`. */\nexport interface LockSourceEntry {\n url: string;\n commit: string;\n}\n\n/**\n * Full skaile.lock.yaml structure (v4 schema).\n * @docLink packages/core/api-reference#lock-file\n */\nexport interface LockFile {\n /**\n * Lock file schema version: always written as 4. A lock written as 3 (before the version\n * stopped depending on the origins in the lock) still loads.\n */\n schema_version: 3 | 4;\n /** ISO timestamp of when the lock was generated. */\n locked_at: string;\n /** Resolved assets keyed by canonical ref `<kind>:@<publisher>/<name>#<version>`. */\n assets: Record<string, LockEntry>;\n /** Every source URL that contributed at least one resolved asset. */\n sources: LockSourceEntry[];\n /**\n * Resolved plugin packages (from `skaile.yaml` `plugins:`), keyed by package\n * name. The plugin-store reconciler reads this slice into its reconcile-hash\n * so a lock change reinstalls even when the manifest list is unchanged.\n */\n plugins?: Record<string, LockPluginEntry>;\n /**\n * Canonical refs of the `preset:` dependencies that `install` / `add` expanded into the\n * assets above (`preset:@publisher/name#version`, nested presets included). A preset is\n * never locked as an asset, so this is the only offline trace that a declared preset\n * resolved: `check` reports a declared preset that is neither listed here nor held by a\n * local library or source. Absent when no preset was expanded.\n */\n presets?: string[];\n}\n\n/** One pinned plugin package in the lock file's `plugins` slice. */\nexport interface LockPluginEntry {\n /** Resolved exact version (e.g. \"0.1.3\"). */\n version: string;\n /** Package integrity hash (e.g. \"sha512-...\"); may be empty until populated from bun's output. */\n integrity: string;\n}\n\n// ── Repository ───────────────────────────────────────────────────────────────\n\ntype RepositoryKind = \"local\" | \"github\";\n\n/**\n * A registered asset repository (local path or cloned GitHub repo).\n * Stored in the catalog; consumed by `repo-manager` for cloning and scanning.\n * @docLink packages/core/concepts#repository\n */\nexport interface Repository {\n /** Logical repository name. */\n name: string;\n /** Storage kind: \"local\" for paths, \"github\" for remote URLs. */\n kind: RepositoryKind;\n /** Absolute path (local) or remote URL (github). */\n path: string;\n /** Active branch. */\n branch: string;\n /** Upstream fork URL (for fork-based workflows). */\n upstream?: string;\n}\n\n/**\n * Construct a `Repository` from a raw deserialized record.\n *\n * @param d - Raw object from YAML/JSON\n * @returns Normalized `Repository`\n * @docLink packages/core/concepts#repository-from-raw\n */\nexport function repositoryFromRaw(d: Record<string, unknown>): Repository {\n return {\n name: String(d.name ?? \"\"),\n kind: String(d.kind ?? \"local\") as RepositoryKind,\n path: String(d.path ?? \"\"),\n branch: String(d.branch ?? \"main\"),\n upstream: d.upstream != null ? String(d.upstream) : undefined,\n };\n}\n\n/**\n * Serialize a `Repository` to a plain record for YAML/JSON persistence.\n * Omits the `branch` field when it equals `\"main\"` to keep serialized output clean.\n *\n * @param r - Repository to serialize\n * @returns Plain object suitable for YAML/JSON\n * @docLink packages/core/concepts#repository-to-raw\n */\nexport function repositoryToRaw(r: Repository): Record<string, unknown> {\n const d: Record<string, unknown> = {\n name: r.name,\n kind: r.kind,\n path: r.path,\n };\n if (r.branch !== \"main\") d.branch = r.branch;\n if (r.upstream != null) d.upstream = r.upstream;\n return d;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { decodeBearerFromHeader, tokensEqual } from './chunk-32NA4TVC.js';
|
|
2
|
-
import { listenWithProbe } from './chunk-
|
|
2
|
+
import { listenWithProbe } from './chunk-MEU2HHGV.js';
|
|
3
3
|
import { createServer } from 'http';
|
|
4
4
|
import { WebSocketServer } from 'ws';
|
|
5
5
|
|
|
@@ -133,7 +133,8 @@ var WebSocketServerTransport = class {
|
|
|
133
133
|
this.sendRaw({
|
|
134
134
|
type: "error",
|
|
135
135
|
message: `Invalid session_init: ${reason}`,
|
|
136
|
-
fatal: false
|
|
136
|
+
fatal: false,
|
|
137
|
+
category: "validation"
|
|
137
138
|
});
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
@@ -146,7 +147,8 @@ var WebSocketServerTransport = class {
|
|
|
146
147
|
this.sendRaw({
|
|
147
148
|
type: "error",
|
|
148
149
|
message: `Invalid message: ${err instanceof Error ? err.message : String(err)}`,
|
|
149
|
-
fatal: false
|
|
150
|
+
fatal: false,
|
|
151
|
+
category: "validation"
|
|
150
152
|
});
|
|
151
153
|
}
|
|
152
154
|
});
|
|
@@ -256,5 +258,5 @@ var WebSocketServerTransport = class {
|
|
|
256
258
|
};
|
|
257
259
|
|
|
258
260
|
export { WebSocketServerTransport };
|
|
259
|
-
//# sourceMappingURL=chunk-
|
|
260
|
-
//# sourceMappingURL=chunk-
|
|
261
|
+
//# sourceMappingURL=chunk-7K73MCI6.js.map
|
|
262
|
+
//# sourceMappingURL=chunk-7K73MCI6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../transport/src/ws/server.ts"],"names":[],"mappings":";;;;;AAiDA,IAAM,oBAAA,GAAuB,GAAA;AAC7B,IAAM,wBAAA,GAA2B,CAAA;AAkBjC,SAAS,yBAAyB,GAAA,EAA6C;AAC7E,EAAA,IAAI,GAAA,CAAI,IAAA,KAAS,cAAA,EAAgB,OAAO,6BAAA;AAExC,EAAA,MAAM,WAAW,GAAA,CAAI,QAAA;AACrB,EAAA,IAAI,CAA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AAiC;AACzC,IAAA,IAAA,CAAK,eAAA,CAAgB,IAAI,OAAO,CAAA;AAChC,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,CAAK,eAAA,CAAgB,OAAO,OAAO,CAAA;AAAA,IACrC,CAAA;AAAA,EACF;AAAA,EAEA,aAAa,OAAA,EAAiC;AAC5C,IAAA,IAAA,CAAK,kBAAA,CAAmB,IAAI,OAAO,CAAA;AACnC,IAAA,OAAO,MAAM;AACX,MAAA,IAAA,CAAK,kBAAA,CAAmB,OAAO,OAAO,CAAA;AAAA,IACxC,CAAA;AAAA,EACF;AAAA,EAEA,IAAI,SAAA,GAAqB;AACvB,IAAA,OAAO,KAAK,YAAA,KAAiB,IAAA;AAAA,EAC/B;AAAA;AAAA,EAGA,IAAI,SAAA,GAAgC;AAClC,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,UAAA,EAAY,OAAA,EAAQ;AACtC,IAAA,OAAO,OAAO,IAAA,KAAS,QAAA,IAAY,IAAA,GAAO,KAAK,IAAA,GAAO,MAAA;AAAA,EACxD;AAAA,EAEQ,QAAQ,IAAA,EAAqB;AACnC,IAAA,IAAI;AACF,MAAA,MAAM,SAAS,IAAA,CAAK,YAAA;AACpB,MAAA,IAAI,MAAA,IAAU,MAAA,CAAO,UAAA,KAAe,CAAA,EAAG;AACrC,QAAA,MAAA,CAAO,IAAA,CAAK,IAAA,CAAK,SAAA,CAAU,IAAI,CAAC,CAAA;AAAA,MAClC;AAAA,IACF,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF;AACF","file":"chunk-7K73MCI6.js","sourcesContent":["/**\n * WebSocketServerTransport — `ws`-based WebSocket server.\n *\n * Accepts one client at a time. Implements ServerTransport from @skaile/workspaces/types.\n * Built on the `ws` package + `node:http`, both of which run under Node and Bun.\n */\n\nimport { createServer, type Server as HttpServer } from \"node:http\";\nimport { listenWithProbe } from \"@skaile/workspaces/core\";\nimport type { AgentCommand, AgentEvent, ServerTransport } from \"@skaile/workspaces/types\";\nimport { type WebSocket, WebSocketServer } from \"ws\";\nimport { decodeBearerFromHeader, tokensEqual } from \"./auth.js\";\n\n/** @deprecated Moved to `@skaile/workspaces/core`, where `portIsHeld` replaces it. */\nexport { needsWildcardProbe } from \"@skaile/workspaces/core\";\n\n/**\n * Options for {@link WebSocketServerTransport}.\n *\n * @param port - TCP port to bind to; `0` picks a free port (read it back via `boundPort`).\n * @param onLog - Optional callback for internal log lines (client connect/disconnect events).\n * @param host - Address to bind. Default: every interface (Node's unspecified address).\n * `127.0.0.1` accepts local clients only.\n * @param authToken - When set, every upgrade must present this token via the\n * `skaile-bearer.<base64url>` subprotocol or the handshake is rejected with\n * HTTP 401. When unset, no auth is enforced (back-compatible default).\n * @param onListening - Called once the socket is bound, with the address a client\n * connects to (`url`) and whether it needs a token. For a plain-text ready line\n * (the `onLog` record carries the port only inside a log sentence).\n * @param heartbeatMs - Interval in milliseconds between pings to the active\n * client. Default: 30 000.\n * @param maxMissedPongs - Heartbeat ticks the client may go without a pong (or\n * any inbound frame) before its socket is terminated, so a client lost behind a\n * dead path (no FIN) fires `onDisconnect` instead of swallowing every event\n * sent to it. Default: 2, i.e. detection within 3 x `heartbeatMs`. `0` turns\n * the heartbeat off. Every WebSocket client answers pings on its own.\n *\n * @docLink packages/transport/dev-guide#websocket-server-transport\n */\nexport interface WebSocketServerOptions {\n port: number;\n host?: string;\n onLog?: (line: string) => void;\n authToken?: string;\n onListening?: (info: { url: string; port: number; tokenRequired: boolean }) => void;\n heartbeatMs?: number;\n maxMissedPongs?: number;\n}\n\nconst DEFAULT_HEARTBEAT_MS = 30_000;\nconst DEFAULT_MAX_MISSED_PONGS = 2;\n\n/**\n * Shape-validate a `session_init` frame at ingress before forwarding to the\n * runner. Protocol v3 requires the deterministic bootstrap envelope to carry\n * an identity tuple, a semver-shaped `protocolVersion`, a resolved config\n * object, and a `credentials` map keyed by `mounts` / `connectors`. Frames\n * that fail the guard are rejected on the wire so the runner never sees a\n * malformed boot envelope.\n *\n * Returns `null` when the frame is well-formed, or a human-readable reason\n * when it should be rejected.\n *\n * Spec: `_devlog/specs/2026-05-10-deterministic-session-bootstrap.md`\n * § \"SessionInitCommand schema\".\n *\n * @internal\n */\nfunction validateSessionInitShape(cmd: Record<string, unknown>): string | null {\n if (cmd.type !== \"session_init\") return \"type must be 'session_init'\";\n\n const identity = cmd.identity as Record<string, unknown> | undefined;\n if (!identity || typeof identity !== \"object\" || Array.isArray(identity)) {\n return \"identity must be an object\";\n }\n if (typeof identity.containerId !== \"string\") return \"identity.containerId must be a string\";\n if (typeof identity.sessionId !== \"string\") return \"identity.sessionId must be a string\";\n if (typeof identity.projectId !== \"string\") return \"identity.projectId must be a string\";\n\n const protocolVersion = cmd.protocolVersion as Record<string, unknown> | undefined;\n if (!protocolVersion || typeof protocolVersion !== \"object\" || Array.isArray(protocolVersion)) {\n return \"protocolVersion must be an object\";\n }\n if (typeof protocolVersion.major !== \"number\") return \"protocolVersion.major must be a number\";\n if (typeof protocolVersion.minor !== \"number\") return \"protocolVersion.minor must be a number\";\n if (typeof protocolVersion.patch !== \"number\") return \"protocolVersion.patch must be a number\";\n\n if (\n !cmd.resolvedConfig ||\n typeof cmd.resolvedConfig !== \"object\" ||\n Array.isArray(cmd.resolvedConfig)\n ) {\n return \"resolvedConfig must be an object\";\n }\n\n if (!cmd.credentials || typeof cmd.credentials !== \"object\" || Array.isArray(cmd.credentials)) {\n return \"credentials must be an object\";\n }\n\n return null;\n}\n\n/**\n * `ServerTransport` implementation backed by the `ws` package on top of a\n * `node:http` server.\n *\n * Enforces a single-client policy: if a new connection arrives while a client is\n * already connected, the stale connection is closed with code 4001 and replaced.\n * Incoming frames are parsed as JSON `AgentCommand` messages and fanned out to\n * registered `onCommand` handlers; outgoing `AgentEvent` objects are JSON-serialised\n * before sending. Call `listen()` to start accepting connections and `close()` to\n * shut down cleanly — `close()` terminates the active socket immediately rather\n * than keeping the event loop alive.\n *\n * @example\n * ```ts\n * const server = new WebSocketServerTransport({ port: 8080 });\n * await server.listen();\n * server.onCommand((cmd) => console.log(cmd));\n * server.send({ type: 'agent_end' });\n * await server.close();\n * ```\n *\n * @docLink packages/transport/dev-guide#websocket-server-transport\n */\nexport class WebSocketServerTransport implements ServerTransport {\n private httpServer: HttpServer | null = null;\n private wss: WebSocketServer | null = null;\n private activeClient: WebSocket | null = null;\n private readonly port: number;\n private readonly log: (line: string) => void;\n private readonly host?: string;\n private readonly authToken?: string;\n private readonly heartbeatMs: number;\n private readonly maxMissedPongs: number;\n\n private readonly onListening: WebSocketServerOptions[\"onListening\"];\n private readonly commandHandlers = new Set<(command: AgentCommand) => void>();\n private readonly connectHandlers = new Set<() => void>();\n private readonly disconnectHandlers = new Set<() => void>();\n\n constructor(options: WebSocketServerOptions) {\n this.port = options.port;\n this.log = options.onLog ?? console.log;\n this.host = options.host;\n this.authToken = options.authToken;\n this.onListening = options.onListening;\n this.heartbeatMs = options.heartbeatMs ?? DEFAULT_HEARTBEAT_MS;\n this.maxMissedPongs = options.maxMissedPongs ?? DEFAULT_MAX_MISSED_PONGS;\n }\n\n /** Start the server and accept connections. */\n async listen(): Promise<void> {\n const httpServer = createServer((_req, res) => {\n res.writeHead(200, { \"content-type\": \"text/plain\" });\n res.end(\"skaile agent server\");\n });\n // When an auth token is configured, reject the upgrade at handshake time\n // (HTTP 401) unless the client presents the matching bearer subprotocol.\n // Rejecting here — before `connection` — keeps unauthenticated sockets from\n // ever reaching the command handlers.\n const expected = this.authToken;\n const wss = new WebSocketServer({\n server: httpServer,\n verifyClient: expected\n ? (info, cb) => {\n const presented = decodeBearerFromHeader(info.req.headers[\"sec-websocket-protocol\"]);\n if (presented !== null && tokensEqual(presented, expected)) {\n cb(true);\n } else {\n this.log(\"[ws-server] rejecting unauthenticated upgrade\");\n cb(false, 401, \"Unauthorized\");\n }\n }\n : undefined,\n });\n wss.on(\"connection\", (ws) => this.handleConnection(ws));\n // `ws` re-emits the http server's errors on `wss`; unhandled during the bind,\n // that throws before the reject below runs and `listen()` hangs. Scoped to the\n // bind so a post-startup server error still surfaces loudly.\n const swallowBindError = () => {};\n wss.on(\"error\", swallowBindError);\n this.httpServer = httpServer;\n this.wss = wss;\n\n try {\n await listenWithProbe(httpServer, this.port, this.host);\n } catch (err) {\n wss.close();\n this.wss = null;\n this.httpServer = null;\n if (err instanceof Error && \"code\" in err && err.code === \"EADDRINUSE\") {\n const where = this.host ? `${this.host}:${this.port}` : `port ${this.port}`;\n throw Object.assign(\n new Error(\n `${where} is already in use: another process listens there. Pick another port.`,\n ),\n { code: \"EADDRINUSE\" },\n );\n }\n throw err;\n } finally {\n wss.off(\"error\", swallowBindError);\n }\n\n const addr = httpServer.address();\n const boundPort = typeof addr === \"object\" && addr ? addr.port : this.port;\n const bind = this.host ?? \"all interfaces\";\n this.log(\n `[ws-server] listening on port ${boundPort} (${bind}; ${this.authToken ? \"token required\" : \"no authentication\"})`,\n );\n // A wildcard bind is reachable on loopback; that is the URL worth printing.\n const urlHost =\n !this.host || this.host === \"0.0.0.0\" || this.host === \"::\"\n ? \"127.0.0.1\"\n : this.host.includes(\":\") && !this.host.startsWith(\"[\")\n ? `[${this.host}]`\n : this.host;\n this.onListening?.({\n url: `ws://${urlHost}:${boundPort}`,\n port: boundPort,\n tokenRequired: this.authToken !== undefined,\n });\n }\n\n private handleConnection(ws: WebSocket): void {\n if (this.activeClient) {\n // Close the stale connection instead of rejecting the new one.\n // This handles the race where waitForWsReady's probe hasn't\n // fully disconnected before the real gateway client connects.\n this.log(\"[ws-server] replacing previous connection\");\n try {\n this.activeClient.close(4001, \"Replaced by new connection\");\n } catch {\n // already closed\n }\n }\n this.log(\"[ws-server] client connected\");\n this.activeClient = ws;\n for (const handler of this.connectHandlers) {\n handler();\n }\n\n const stopHeartbeat = this.startHeartbeat(ws);\n\n ws.on(\"message\", (data) => {\n try {\n const parsed = JSON.parse(String(data)) as Record<string, unknown>;\n // Protocol v3: shape-validate `session_init` at ingress so the\n // runner never receives a malformed boot envelope. Other command\n // shapes pass through unchanged — invalid `AgentCommand`s surface\n // through the existing per-command handlers in serve.ts.\n if (parsed && typeof parsed === \"object\" && parsed.type === \"session_init\") {\n const reason = validateSessionInitShape(parsed);\n if (reason !== null) {\n this.log(`[ws-server] rejecting invalid session_init: ${reason}`);\n this.sendRaw({\n type: \"error\",\n message: `Invalid session_init: ${reason}`,\n fatal: false,\n category: \"validation\",\n });\n return;\n }\n }\n const cmd = parsed as unknown as AgentCommand;\n for (const handler of this.commandHandlers) {\n handler(cmd);\n }\n } catch (err) {\n this.sendRaw({\n type: \"error\",\n message: `Invalid message: ${err instanceof Error ? err.message : String(err)}`,\n fatal: false,\n category: \"validation\",\n });\n }\n });\n\n ws.on(\"close\", () => {\n stopHeartbeat();\n this.log(\"[ws-server] client disconnected\");\n if (this.activeClient === ws) {\n this.activeClient = null;\n for (const handler of this.disconnectHandlers) {\n handler();\n }\n }\n });\n }\n\n /**\n * Ping `ws` every {@link heartbeatMs}; terminate it after\n * {@link maxMissedPongs} unanswered ticks. `terminate()` makes `ws` emit\n * `close`, which runs the normal disconnect path. Returns the stop function.\n */\n private startHeartbeat(ws: WebSocket): () => void {\n if (this.maxMissedPongs <= 0) return () => {};\n let missed = 0;\n const markAlive = () => {\n missed = 0;\n };\n ws.on(\"pong\", markAlive);\n ws.on(\"message\", markAlive);\n const timer = setInterval(() => {\n if (ws.readyState !== ws.OPEN) return;\n if (missed >= this.maxMissedPongs) {\n this.log(\n `[ws-server] no pong for ${missed} heartbeats of ${this.heartbeatMs}ms; terminating client`,\n );\n clearInterval(timer);\n ws.terminate();\n return;\n }\n missed++;\n try {\n ws.ping();\n } catch {\n // socket closing underneath us; the close event cleans up\n }\n }, this.heartbeatMs);\n timer.unref?.();\n return () => clearInterval(timer);\n }\n\n /**\n * Stop the server.\n *\n * Terminates the active socket immediately — otherwise a still-connected\n * client would keep the event loop alive and block process shutdown.\n */\n async close(): Promise<void> {\n try {\n this.activeClient?.terminate();\n } catch {\n // already closed\n }\n this.activeClient = null;\n this.wss?.close();\n this.wss = null;\n const httpServer = this.httpServer;\n this.httpServer = null;\n if (httpServer) {\n httpServer.closeAllConnections();\n await new Promise<void>((resolve) => httpServer.close(() => resolve()));\n }\n }\n\n send(event: AgentEvent): void {\n this.sendRaw(event);\n }\n\n onCommand(handler: (command: AgentCommand) => void): () => void {\n this.commandHandlers.add(handler);\n return () => {\n this.commandHandlers.delete(handler);\n };\n }\n\n onConnect(handler: () => void): () => void {\n this.connectHandlers.add(handler);\n return () => {\n this.connectHandlers.delete(handler);\n };\n }\n\n onDisconnect(handler: () => void): () => void {\n this.disconnectHandlers.add(handler);\n return () => {\n this.disconnectHandlers.delete(handler);\n };\n }\n\n get connected(): boolean {\n return this.activeClient !== null;\n }\n\n /** The port actually bound by `listen()` (resolves `port: 0`); `undefined` when not listening. */\n get boundPort(): number | undefined {\n const addr = this.httpServer?.address();\n return typeof addr === \"object\" && addr ? addr.port : undefined;\n }\n\n private sendRaw(data: unknown): void {\n try {\n const client = this.activeClient;\n if (client && client.readyState === 1) {\n client.send(JSON.stringify(data));\n }\n } catch {\n // Silently ignore send failures\n }\n }\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SubprocessCliHarness, extractText, extractCost, extractTokens } from './chunk-
|
|
1
|
+
import { SubprocessCliHarness, extractText, extractCost, extractTokens } from './chunk-5JBMYZNA.js';
|
|
2
2
|
import { getStaticModels, fetchProviderModels } from './chunk-3AIEJSQR.js';
|
|
3
3
|
import { HARNESS_BINARIES } from './chunk-WWSRIT3J.js';
|
|
4
|
-
import { resolveEnvHarnessSession, bindSingleProviderEntry, resolveRegistryBinding } from './chunk-
|
|
5
|
-
import { getBridgeLogger, registryHarnessConfig } from './chunk-
|
|
6
|
-
import { BUILTIN_HARNESS_CATALOG, entryCredentialValue } from './chunk-
|
|
4
|
+
import { resolveEnvHarnessSession, bindSingleProviderEntry, resolveRegistryBinding } from './chunk-RTFH2QR2.js';
|
|
5
|
+
import { getBridgeLogger, registryHarnessConfig } from './chunk-NFFBYG2W.js';
|
|
6
|
+
import { BUILTIN_HARNESS_CATALOG, entryCredentialValue } from './chunk-KE5HDORU.js';
|
|
7
7
|
import { getProviderPreset } from './chunk-6UP2EDFN.js';
|
|
8
8
|
import * as z from 'zod';
|
|
9
9
|
|
|
@@ -186,5 +186,5 @@ var geminiHarnessTarget = {
|
|
|
186
186
|
};
|
|
187
187
|
|
|
188
188
|
export { GeminiFamilyHarness, GeminiHarness, geminiHarnessTarget };
|
|
189
|
-
//# sourceMappingURL=chunk-
|
|
190
|
-
//# sourceMappingURL=chunk-
|
|
189
|
+
//# sourceMappingURL=chunk-BCID52M5.js.map
|
|
190
|
+
//# sourceMappingURL=chunk-BCID52M5.js.map
|