@skaile/workspaces 6.3.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -1
- package/README.md +4 -0
- package/dist/ai-sdk.js +74 -32
- package/dist/ai-sdk.js.map +1 -1
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-3YO2352Y.js → asset-feeds-4I6Z4OI3.js} +21 -21
- package/dist/{asset-feeds-3YO2352Y.js.map → asset-feeds-4I6Z4OI3.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +7 -7
- package/dist/asset-manager/index.js +13 -13
- package/dist/asset-manager/installer.js +9 -9
- package/dist/asset-manager/renderers.js +8 -8
- package/dist/asset-manager/src/index.d.ts +156 -27
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/install-instances.d.ts +2 -0
- package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts +6 -0
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/bridge/harnesses/claude-sdk.js +23 -18
- package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
- package/dist/bridge/harnesses/codex.js +36 -34
- package/dist/bridge/harnesses/codex.js.map +1 -1
- package/dist/bridge/harnesses/continue.js +11 -12
- package/dist/bridge/harnesses/continue.js.map +1 -1
- package/dist/bridge/harnesses/echo.js +4 -5
- package/dist/bridge/harnesses/echo.js.map +1 -1
- package/dist/bridge/harnesses/gemini.js +8 -9
- package/dist/bridge/harnesses/goose.js +11 -12
- package/dist/bridge/harnesses/goose.js.map +1 -1
- package/dist/bridge/harnesses/omp.js +16 -11
- package/dist/bridge/harnesses/omp.js.map +1 -1
- package/dist/bridge/harnesses/opencode.js +11 -12
- package/dist/bridge/harnesses/opencode.js.map +1 -1
- package/dist/bridge/harnesses/qwen.js +8 -9
- package/dist/bridge/harnesses/qwen.js.map +1 -1
- package/dist/bridge/index.js +19 -20
- package/dist/bridge/src/ai-sdk.d.ts +5 -2
- package/dist/bridge/src/ai-sdk.d.ts.map +1 -1
- package/dist/bridge/src/codex/login-fallback.d.ts +39 -0
- package/dist/bridge/src/codex/login-fallback.d.ts.map +1 -0
- package/dist/bridge/src/error-classifier.d.ts +6 -0
- package/dist/bridge/src/error-classifier.d.ts.map +1 -1
- package/dist/bridge/src/harness-model-check.d.ts +11 -7
- package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/codex.d.ts +0 -6
- package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
- 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-XEVFSDIF.js → chunk-22ZX33H6.js} +6 -6
- package/dist/{chunk-XEVFSDIF.js.map → chunk-22ZX33H6.js.map} +1 -1
- package/dist/{chunk-KPKGWXUJ.js → chunk-23SG4JRV.js} +4 -4
- package/dist/{chunk-KPKGWXUJ.js.map → chunk-23SG4JRV.js.map} +1 -1
- package/dist/{chunk-MYXFR27L.js → chunk-2HS357RA.js} +77 -37
- package/dist/chunk-2HS357RA.js.map +1 -0
- package/dist/{chunk-7TSNR5H5.js → chunk-2IAWVUW3.js} +4 -4
- package/dist/{chunk-7TSNR5H5.js.map → chunk-2IAWVUW3.js.map} +1 -1
- package/dist/{chunk-6GWSDPBP.js → chunk-2M3VLKT2.js} +3 -3
- package/dist/{chunk-6GWSDPBP.js.map → chunk-2M3VLKT2.js.map} +1 -1
- package/dist/{chunk-PNUM7GUY.js → chunk-3DA74PLW.js} +3 -3
- package/dist/{chunk-PNUM7GUY.js.map → chunk-3DA74PLW.js.map} +1 -1
- package/dist/{chunk-7RH6E332.js → chunk-3KSLUVKB.js} +7 -7
- package/dist/{chunk-7RH6E332.js.map → chunk-3KSLUVKB.js.map} +1 -1
- package/dist/{chunk-6OHZUUR7.js → chunk-5DE3DGVR.js} +11 -5
- package/dist/chunk-5DE3DGVR.js.map +1 -0
- package/dist/{chunk-32FYVSSW.js → chunk-6EKQENAP.js} +6 -6
- package/dist/{chunk-32FYVSSW.js.map → chunk-6EKQENAP.js.map} +1 -1
- package/dist/{chunk-QK7AG5AV.js → chunk-6Y3SC7O4.js} +4 -4
- package/dist/{chunk-QK7AG5AV.js.map → chunk-6Y3SC7O4.js.map} +1 -1
- package/dist/{chunk-ROVZCGTN.js → chunk-7EMS2GZO.js} +40 -37
- package/dist/chunk-7EMS2GZO.js.map +1 -0
- package/dist/{chunk-COUJOTAJ.js → chunk-7H4GTP7V.js} +3 -3
- package/dist/{chunk-COUJOTAJ.js.map → chunk-7H4GTP7V.js.map} +1 -1
- package/dist/{chunk-VUWRGMT6.js → chunk-AFTZNR2W.js} +3 -3
- package/dist/{chunk-VUWRGMT6.js.map → chunk-AFTZNR2W.js.map} +1 -1
- package/dist/{chunk-JMIKGAUA.js → chunk-AVFRFGM2.js} +16 -6
- package/dist/chunk-AVFRFGM2.js.map +1 -0
- package/dist/{chunk-7MV3NHPT.js → chunk-B436SG5P.js} +42 -25
- package/dist/chunk-B436SG5P.js.map +1 -0
- package/dist/{chunk-ZEH4WFEG.js → chunk-B4BLJUYN.js} +69 -26
- package/dist/chunk-B4BLJUYN.js.map +1 -0
- package/dist/{chunk-LEJQAX7G.js → chunk-DNXPXJ3X.js} +82 -50
- package/dist/chunk-DNXPXJ3X.js.map +1 -0
- package/dist/{chunk-HDVLBEEX.js → chunk-E6UWI3TP.js} +3 -3
- package/dist/{chunk-HDVLBEEX.js.map → chunk-E6UWI3TP.js.map} +1 -1
- package/dist/{chunk-2TFKXSB5.js → chunk-EN5REMWV.js} +4 -4
- package/dist/{chunk-2TFKXSB5.js.map → chunk-EN5REMWV.js.map} +1 -1
- package/dist/{chunk-QFFMFZIR.js → chunk-EO7KGX6P.js} +4 -4
- package/dist/{chunk-QFFMFZIR.js.map → chunk-EO7KGX6P.js.map} +1 -1
- package/dist/{chunk-KIPCBIFJ.js → chunk-ETF6Q3R3.js} +23 -80
- package/dist/chunk-ETF6Q3R3.js.map +1 -0
- package/dist/{chunk-6WH2WE4B.js → chunk-G4NCSYWR.js} +9 -8
- package/dist/chunk-G4NCSYWR.js.map +1 -0
- package/dist/{chunk-JCPD4QRM.js → chunk-G5SYFFMD.js} +2 -2
- package/dist/{chunk-JCPD4QRM.js.map → chunk-G5SYFFMD.js.map} +1 -1
- package/dist/{chunk-Q7CU5GQO.js → chunk-HPA3RP5E.js} +4 -4
- package/dist/{chunk-Q7CU5GQO.js.map → chunk-HPA3RP5E.js.map} +1 -1
- package/dist/{chunk-KGHYXXXV.js → chunk-IS3NIZBX.js} +588 -133
- package/dist/chunk-IS3NIZBX.js.map +1 -0
- package/dist/{chunk-XBQTXGY4.js → chunk-IWKKTCXY.js} +98 -17
- package/dist/chunk-IWKKTCXY.js.map +1 -0
- package/dist/{chunk-HH2H2ZV7.js → chunk-J5JWLKLB.js} +35 -20
- package/dist/chunk-J5JWLKLB.js.map +1 -0
- package/dist/chunk-J6YPKMMY.js +83 -0
- package/dist/chunk-J6YPKMMY.js.map +1 -0
- package/dist/{chunk-TGV2EWGL.js → chunk-K4DHYTUM.js} +4 -4
- package/dist/{chunk-TGV2EWGL.js.map → chunk-K4DHYTUM.js.map} +1 -1
- package/dist/{chunk-72NT2TJU.js → chunk-KA2GLAPS.js} +7 -8
- package/dist/chunk-KA2GLAPS.js.map +1 -0
- package/dist/{chunk-VUJXZDCY.js → chunk-KSH5CFQS.js} +3 -3
- package/dist/{chunk-VUJXZDCY.js.map → chunk-KSH5CFQS.js.map} +1 -1
- package/dist/{chunk-BIRW3HOG.js → chunk-KSUT5KAE.js} +3 -3
- package/dist/{chunk-BIRW3HOG.js.map → chunk-KSUT5KAE.js.map} +1 -1
- package/dist/{chunk-AMJ6KEV7.js → chunk-KUADKMNX.js} +4 -4
- package/dist/{chunk-AMJ6KEV7.js.map → chunk-KUADKMNX.js.map} +1 -1
- package/dist/{chunk-TSTRH4SM.js → chunk-KYNCY3F3.js} +3 -3
- package/dist/{chunk-TSTRH4SM.js.map → chunk-KYNCY3F3.js.map} +1 -1
- package/dist/{chunk-V5BPDB4J.js → chunk-LE6QS4PG.js} +3 -3
- package/dist/{chunk-V5BPDB4J.js.map → chunk-LE6QS4PG.js.map} +1 -1
- package/dist/{chunk-6UP2EDFN.js → chunk-NSIOBKDX.js} +313 -4
- package/dist/chunk-NSIOBKDX.js.map +1 -0
- package/dist/{chunk-MD3FUZS3.js → chunk-OBZ5WQ32.js} +3 -3
- package/dist/{chunk-MD3FUZS3.js.map → chunk-OBZ5WQ32.js.map} +1 -1
- package/dist/{chunk-ELSGFI3I.js → chunk-OLHHN3NO.js} +31 -7
- package/dist/chunk-OLHHN3NO.js.map +1 -0
- package/dist/{chunk-JGH7NB47.js → chunk-S7DVT2BV.js} +4 -4
- package/dist/{chunk-JGH7NB47.js.map → chunk-S7DVT2BV.js.map} +1 -1
- package/dist/{chunk-PHAMYCZH.js → chunk-SN663FCA.js} +5 -5
- package/dist/{chunk-PHAMYCZH.js.map → chunk-SN663FCA.js.map} +1 -1
- package/dist/{serve-preflight-H2AYMGJ6.js → chunk-SRTWKZP2.js} +30 -61
- package/dist/chunk-SRTWKZP2.js.map +1 -0
- package/dist/{chunk-H622YULS.js → chunk-SZTHSPRC.js} +3 -4
- package/dist/chunk-SZTHSPRC.js.map +1 -0
- package/dist/{chunk-LD6O6QKU.js → chunk-T7HGEMNB.js} +4 -4
- package/dist/{chunk-LD6O6QKU.js.map → chunk-T7HGEMNB.js.map} +1 -1
- package/dist/{chunk-4QRJBY2P.js → chunk-TDPQOR3C.js} +2 -2
- package/dist/{chunk-4QRJBY2P.js.map → chunk-TDPQOR3C.js.map} +1 -1
- package/dist/{chunk-Y3I4KGLX.js → chunk-TGUMN5G7.js} +310 -175
- package/dist/chunk-TGUMN5G7.js.map +1 -0
- package/dist/{chunk-TO5SSMRI.js → chunk-THX5EE3K.js} +67 -19
- package/dist/chunk-THX5EE3K.js.map +1 -0
- package/dist/{chunk-QTLUZUF2.js → chunk-TNQLDEM6.js} +86 -34
- package/dist/chunk-TNQLDEM6.js.map +1 -0
- package/dist/{chunk-EQNIBBB6.js → chunk-TROEC2Z2.js} +34 -20
- package/dist/chunk-TROEC2Z2.js.map +1 -0
- package/dist/{chunk-E5NQRHEB.js → chunk-U6KRTCNA.js} +4 -4
- package/dist/{chunk-E5NQRHEB.js.map → chunk-U6KRTCNA.js.map} +1 -1
- package/dist/{chunk-J5JRGBKK.js → chunk-UMLCKKIA.js} +64 -32
- package/dist/chunk-UMLCKKIA.js.map +1 -0
- package/dist/{chunk-DU26AVK2.js → chunk-USVUS4DJ.js} +8 -8
- package/dist/{chunk-DU26AVK2.js.map → chunk-USVUS4DJ.js.map} +1 -1
- package/dist/{chunk-HGOJEVHY.js → chunk-UZET67SO.js} +4 -4
- package/dist/{chunk-HGOJEVHY.js.map → chunk-UZET67SO.js.map} +1 -1
- package/dist/{chunk-IZQOO6MN.js → chunk-V5KG6CCV.js} +2 -2
- package/dist/{chunk-IZQOO6MN.js.map → chunk-V5KG6CCV.js.map} +1 -1
- package/dist/{chunk-76FLBODK.js → chunk-VT6G5AJV.js} +10 -7
- package/dist/chunk-VT6G5AJV.js.map +1 -0
- package/dist/{chunk-URCJIV7T.js → chunk-W5KCAWGN.js} +3 -3
- package/dist/{chunk-URCJIV7T.js.map → chunk-W5KCAWGN.js.map} +1 -1
- package/dist/{chunk-YW4ASEUP.js → chunk-WFLQMAR5.js} +5 -5
- package/dist/{chunk-YW4ASEUP.js.map → chunk-WFLQMAR5.js.map} +1 -1
- package/dist/{chunk-RFQONXET.js → chunk-X44XKBZX.js} +3 -3
- package/dist/{chunk-RFQONXET.js.map → chunk-X44XKBZX.js.map} +1 -1
- package/dist/{chunk-BPTWWKGF.js → chunk-YBEJCQE5.js} +3 -3
- package/dist/{chunk-BPTWWKGF.js.map → chunk-YBEJCQE5.js.map} +1 -1
- package/dist/{chunk-PL52CI4U.js → chunk-YRC2EFOU.js} +4 -4
- package/dist/{chunk-PL52CI4U.js.map → chunk-YRC2EFOU.js.map} +1 -1
- package/dist/{chunk-7QG2WRSN.js → chunk-Z2X7UZEZ.js} +25 -8
- package/dist/chunk-Z2X7UZEZ.js.map +1 -0
- package/dist/{chunk-U3SXCVR7.js → chunk-ZUU2PLA3.js} +4 -4
- package/dist/{chunk-U3SXCVR7.js.map → chunk-ZUU2PLA3.js.map} +1 -1
- package/dist/{claude-code-EUKDGOOO.js → claude-code-JY6CYEG7.js} +4 -4
- package/dist/{claude-code-EUKDGOOO.js.map → claude-code-JY6CYEG7.js.map} +1 -1
- package/dist/cli/index.js +322 -162
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/cache.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/deploy.d.ts.map +1 -1
- package/dist/cli/src/commands/harness.d.ts +5 -4
- package/dist/cli/src/commands/harness.d.ts.map +1 -1
- package/dist/cli/src/commands/integration.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 +6 -0
- package/dist/cli/src/commands/library-index.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate-files.d.ts +3 -6
- package/dist/cli/src/commands/migrate-files.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate-harness.d.ts +4 -3
- package/dist/cli/src/commands/migrate-harness.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate.d.ts +2 -2
- package/dist/cli/src/commands/outdated.d.ts.map +1 -1
- package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/preset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts +7 -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 +21 -0
- 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-manifest.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts +8 -0
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/update.d.ts.map +1 -1
- package/dist/cli/src/commands/validate-instances.d.ts +6 -0
- package/dist/cli/src/commands/validate-instances.d.ts.map +1 -1
- package/dist/cli/src/commands/validate.d.ts.map +1 -1
- package/dist/cli/src/commands/verify.d.ts.map +1 -1
- package/dist/cli/src/config-checks.d.ts +8 -0
- 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/helpers.d.ts +13 -4
- package/dist/cli/src/helpers.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/index.d.ts +1 -1
- package/dist/cli/src/plugin-store/index.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/reconcile.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/spec.d.ts +20 -14
- package/dist/cli/src/plugin-store/spec.d.ts.map +1 -1
- package/dist/cli/src/setup.d.ts.map +1 -1
- package/dist/cli/src/skill-checks.d.ts +2 -0
- package/dist/cli/src/skill-checks.d.ts.map +1 -1
- package/dist/connectors/config.js +5 -5
- package/dist/connectors/index.js +23 -24
- package/dist/connectors/src/index.d.ts +2 -2
- package/dist/connectors/src/index.d.ts.map +1 -1
- package/dist/connectors/src/managed-gitconfig.d.ts +22 -0
- package/dist/connectors/src/managed-gitconfig.d.ts.map +1 -1
- package/dist/connectors/src/npm-installer.d.ts +11 -3
- package/dist/connectors/src/npm-installer.d.ts.map +1 -1
- package/dist/connectors-VLFOQNS6.js +49 -0
- package/dist/{connectors-XYPE2DCQ.js.map → connectors-VLFOQNS6.js.map} +1 -1
- package/dist/connectors-shared/index.js +2 -2
- package/dist/core/index.js +6 -6
- package/dist/core/manifest.js +2 -2
- package/dist/core/models.js +1 -1
- package/dist/core/publish-manifest.js +3 -3
- package/dist/core/ref.js +1 -1
- package/dist/core/runtime-assets.js +5 -5
- package/dist/core/src/agent-instances.d.ts +6 -0
- package/dist/core/src/agent-instances.d.ts.map +1 -1
- package/dist/core/src/config-key-diagnostics.d.ts +2 -1
- package/dist/core/src/config-key-diagnostics.d.ts.map +1 -1
- package/dist/core/src/index.d.ts +5 -5
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/lock.d.ts +20 -1
- package/dist/core/src/lock.d.ts.map +1 -1
- package/dist/core/src/manifest-yaml-editor.d.ts +4 -1
- package/dist/core/src/manifest-yaml-editor.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts +9 -3
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/models.d.ts +10 -0
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +11 -0
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/runtime-assets.d.ts +12 -1
- package/dist/core/src/runtime-assets.d.ts.map +1 -1
- package/dist/core/src/walker.d.ts +3 -0
- package/dist/core/src/walker.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +19 -2
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
- package/dist/core/workspace-config.js +4 -4
- package/dist/deploy/index.js +6 -6
- package/dist/discovery/index.js +5 -5
- package/dist/{ensure-sources-IN3VKHUA.js → ensure-sources-6O54DUQB.js} +31 -31
- package/dist/ensure-sources-6O54DUQB.js.map +1 -0
- package/dist/factory-assets/connectors/box.js +23 -24
- package/dist/factory-assets/connectors/deploy.js +23 -24
- package/dist/factory-assets/connectors/devserver.js +23 -24
- package/dist/factory-assets/connectors/flow/adapter.js +23 -24
- package/dist/factory-assets/connectors/flow/engine.js +7 -7
- package/dist/factory-assets/connectors/flow/run-flow.js +25 -26
- package/dist/factory-assets/connectors/flow.js +23 -24
- package/dist/factory-assets/connectors/git.js +23 -24
- package/dist/factory-assets/connectors/gmail.js +23 -24
- package/dist/factory-assets/connectors/googledrive.js +23 -24
- package/dist/factory-assets/connectors/local.js +23 -24
- package/dist/factory-assets/connectors/mattermost.js +23 -24
- package/dist/factory-assets/connectors/memory.js +23 -24
- package/dist/factory-assets/connectors/minio.js +23 -24
- package/dist/factory-assets/connectors/postgres.js +23 -24
- package/dist/factory-assets/connectors/s3.js +23 -24
- package/dist/factory-assets/connectors/sharepoint.js +23 -24
- package/dist/factory-assets/connectors/sqlite.js +23 -24
- package/dist/factory-assets/connectors/static-server.js +23 -24
- package/dist/factory-assets/connectors/tunnel.js +23 -24
- package/dist/factory-assets/connectors/webdav.js +23 -24
- package/dist/factory-assets/connectors/xstate-store.js +23 -24
- package/dist/factory-assets/connectors/xstate.js +23 -24
- package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +2 -1
- package/dist/{flows-QAO63TDV.js → flows-CIUPK7SB.js} +11 -11
- package/dist/{flows-QAO63TDV.js.map → flows-CIUPK7SB.js.map} +1 -1
- package/dist/{helpers-HDVGCF3M.js → helpers-YHDQHQEQ.js} +28 -29
- package/dist/{helpers-HDVGCF3M.js.map → helpers-YHDQHQEQ.js.map} +1 -1
- package/dist/library/index.js +10 -10
- package/dist/library/install.js +4 -4
- package/dist/library/src/manifest-writer.d.ts +9 -0
- package/dist/library/src/manifest-writer.d.ts.map +1 -1
- package/dist/library/src/remote/remote-catalog-source.d.ts +9 -0
- package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
- package/dist/library/src/remote/rest-catalog-source.d.ts +1 -0
- package/dist/library/src/remote/rest-catalog-source.d.ts.map +1 -1
- package/dist/{library-publish-62OWCNB5.js → library-publish-MUGUST43.js} +53 -53
- package/dist/{library-publish-62OWCNB5.js.map → library-publish-MUGUST43.js.map} +1 -1
- package/dist/model-endpoint/index.js +9 -10
- package/dist/open-library-BVQCB37E.js +57 -0
- package/dist/{open-library-TZ7OSDEJ.js.map → open-library-BVQCB37E.js.map} +1 -1
- package/dist/{open-registry-RLZKTJG3.js → open-registry-JCSIAKEC.js} +14 -14
- package/dist/{open-registry-RLZKTJG3.js.map → open-registry-JCSIAKEC.js.map} +1 -1
- package/dist/{paths-D6LBQETQ.js → paths-XLKCAFRZ.js} +9 -9
- package/dist/{paths-D6LBQETQ.js.map → paths-XLKCAFRZ.js.map} +1 -1
- package/dist/{plugin-store-A5J4TLCH.js → plugin-store-NGRUTCJI.js} +9 -9
- package/dist/{plugin-store-A5J4TLCH.js.map → plugin-store-NGRUTCJI.js.map} +1 -1
- package/dist/project-BGYMLAS6.js +88 -0
- package/dist/{project-4AVRES3M.js.map → project-BGYMLAS6.js.map} +1 -1
- package/dist/resolver/index.js +7 -7
- package/dist/runner/index.js +38 -39
- package/dist/runner/src/capability-roundtrip.d.ts +4 -1
- package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
- package/dist/runner/src/composition/resolve-instance.d.ts.map +1 -1
- package/dist/runner/src/composition/resolve.d.ts +6 -0
- package/dist/runner/src/composition/resolve.d.ts.map +1 -1
- package/dist/runner/src/credential-notice.d.ts +3 -2
- package/dist/runner/src/credential-notice.d.ts.map +1 -1
- package/dist/runner/src/resources.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +13 -13
- package/dist/sdk/bridge.js +19 -20
- package/dist/sdk/core.js +6 -6
- package/dist/sdk/flow.js +7 -7
- package/dist/sdk/index.js +38 -39
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.js +7 -7
- package/dist/sdk/runner.js +38 -39
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/transport/ws/server.js +7 -7
- package/dist/sdk/transport/ws.js +7 -7
- package/dist/sdk/transport.js +7 -7
- package/dist/sdk/types.js +1 -1
- package/dist/serve-preflight-GQY5DZX6.js +56 -0
- package/dist/serve-preflight-GQY5DZX6.js.map +1 -0
- package/dist/session/index.js +2 -2
- package/dist/{setup-NSPQD4V4.js → setup-2NWSKSCO.js} +34 -32
- package/dist/setup-2NWSKSCO.js.map +1 -0
- package/dist/{skills-B533SRVZ.js → skills-PXZOL2FZ.js} +12 -12
- package/dist/{skills-B533SRVZ.js.map → skills-PXZOL2FZ.js.map} +1 -1
- package/dist/source-XA3L4H6I.js +86 -0
- package/dist/{source-VTECABUO.js.map → source-XA3L4H6I.js.map} +1 -1
- package/dist/{source-manifest-publish-YORI42MN.js → source-manifest-publish-QEGMTS33.js} +50 -51
- package/dist/source-manifest-publish-QEGMTS33.js.map +1 -0
- package/dist/transport/index.js +7 -7
- package/dist/transport/ws/server.js +7 -7
- package/dist/transport/ws.js +7 -7
- package/dist/tui/index.js +38 -39
- package/dist/tui/index.js.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/manifests.js +1 -1
- package/dist/types/src/capabilities.d.ts +9 -1
- package/dist/types/src/capabilities.d.ts.map +1 -1
- package/dist/types/src/manifests/agent.d.ts +2 -2
- package/dist/types/src/manifests/agent.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +8 -8
- package/dist/workspace-plugin/adapters/mcp.js +30 -31
- package/dist/workspace-plugin/adapters/omp.js +14 -14
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-6OHZUUR7.js.map +0 -1
- package/dist/chunk-6UP2EDFN.js.map +0 -1
- package/dist/chunk-6WH2WE4B.js.map +0 -1
- package/dist/chunk-72NT2TJU.js.map +0 -1
- package/dist/chunk-76FLBODK.js.map +0 -1
- package/dist/chunk-7MV3NHPT.js.map +0 -1
- package/dist/chunk-7QG2WRSN.js.map +0 -1
- package/dist/chunk-ELSGFI3I.js.map +0 -1
- package/dist/chunk-EQNIBBB6.js.map +0 -1
- package/dist/chunk-H622YULS.js.map +0 -1
- package/dist/chunk-HH2H2ZV7.js.map +0 -1
- package/dist/chunk-J5JRGBKK.js.map +0 -1
- package/dist/chunk-JMIKGAUA.js.map +0 -1
- package/dist/chunk-KGHYXXXV.js.map +0 -1
- package/dist/chunk-KIPCBIFJ.js.map +0 -1
- package/dist/chunk-LEJQAX7G.js.map +0 -1
- package/dist/chunk-MYXFR27L.js.map +0 -1
- package/dist/chunk-QTLUZUF2.js.map +0 -1
- package/dist/chunk-ROVZCGTN.js.map +0 -1
- package/dist/chunk-S6KZHPR4.js +0 -315
- package/dist/chunk-S6KZHPR4.js.map +0 -1
- package/dist/chunk-TO5SSMRI.js.map +0 -1
- package/dist/chunk-XBQTXGY4.js.map +0 -1
- package/dist/chunk-Y3I4KGLX.js.map +0 -1
- package/dist/chunk-ZEH4WFEG.js.map +0 -1
- package/dist/connectors-XYPE2DCQ.js +0 -50
- package/dist/ensure-sources-IN3VKHUA.js.map +0 -1
- package/dist/open-library-TZ7OSDEJ.js +0 -58
- package/dist/project-4AVRES3M.js +0 -88
- package/dist/serve-preflight-H2AYMGJ6.js.map +0 -1
- package/dist/setup-NSPQD4V4.js.map +0 -1
- package/dist/source-VTECABUO.js +0 -87
- package/dist/source-manifest-publish-YORI42MN.js.map +0 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { unknownKeyWarnings, unknownHarnessErrors } from './chunk-J6YPKMMY.js';
|
|
2
|
+
import { checkAgentInstances } from './chunk-ETF6Q3R3.js';
|
|
3
|
+
import { loadDeclaredPlugins } from './chunk-THX5EE3K.js';
|
|
4
|
+
import { registeredAssetKeys, unresolvedManifestDependencies, warnIgnoredDomainFiles, warnLegacyBundleFiles, removedDomainOption, rejectRemovedDomainOption, reportLibrarySymlinks, composeRefContext, assetEntryRef, manifestPublisherProblems, manifestRootProblems, manifestFilesProblems, manifestEntryNameProblems, manifestRequiresProblems, checkAssetFile, findEntryManifestFile, declaredVersion, manifestVersionMismatchMessage, MANIFEST_GLOBS, manifestParseErrorText, checkAsset, invalidPublisherMessage, invalidSemverText, DEFAULT_VERSION } from './chunk-7EMS2GZO.js';
|
|
5
|
+
import { getKindRegistry } from './chunk-WFLQMAR5.js';
|
|
6
|
+
import { logErr, logInfo, logWarn, logOk } from './chunk-Z2X7UZEZ.js';
|
|
7
|
+
import { validateFlowVersions } from './chunk-W5KCAWGN.js';
|
|
8
|
+
import { loadFlow } from './chunk-X44XKBZX.js';
|
|
7
9
|
import { flowSkillVersionPins } from './chunk-7RGTAEG6.js';
|
|
8
|
-
import { missingRootAssets, assertManifestEditable, scanUnlistedAssets, UNLISTED_SCAN_SKIP_DIRS } from './chunk-
|
|
9
|
-
import { parseManifestFile } from './chunk-
|
|
10
|
-
import { resolveRuntimeAssets } from './chunk-
|
|
11
|
-
import { decodeSkaileYaml, localConnectorMountDir, symlinkEscapeOfProject, isInsideProject } from './chunk-
|
|
12
|
-
import { SKAILE_MANIFEST_FILENAME, loadSkPublishManifest, isNonAssetPath } from './chunk-
|
|
13
|
-
import { withYamlQuotingHint, readAssetBody } from './chunk-
|
|
14
|
-
import { parseAssetRef, isValidPublisher, isValidAssetName, ASSET_NAME_HINT } from './chunk-
|
|
10
|
+
import { missingRootAssets, assertManifestEditable, scanUnlistedAssets, UNLISTED_SCAN_SKIP_DIRS } from './chunk-TGUMN5G7.js';
|
|
11
|
+
import { parseManifestFile } from './chunk-22ZX33H6.js';
|
|
12
|
+
import { resolveRuntimeAssets } from './chunk-G4NCSYWR.js';
|
|
13
|
+
import { decodeSkaileYaml, localConnectorMountDir, symlinkEscapeOfProject, isInsideProject } from './chunk-IWKKTCXY.js';
|
|
14
|
+
import { SKAILE_MANIFEST_FILENAME, loadSkPublishManifest, isNonAssetPath } from './chunk-23SG4JRV.js';
|
|
15
|
+
import { withYamlQuotingHint, readAssetBody } from './chunk-AVFRFGM2.js';
|
|
16
|
+
import { parseAssetRef, isValidPublisher, isValidAssetName, ASSET_NAME_HINT } from './chunk-V5KG6CCV.js';
|
|
15
17
|
import { execFileSync } from 'child_process';
|
|
16
18
|
import fs from 'fs';
|
|
17
19
|
import path from 'path';
|
|
@@ -329,13 +331,20 @@ async function validateWorkspaceManifests(rootPath) {
|
|
|
329
331
|
logErr(`${relPath} [connectors] \u2014 ${d.code}: ${d.path ? `${d.path}: ` : ""}${d.message}`);
|
|
330
332
|
errors++;
|
|
331
333
|
}
|
|
334
|
+
for (const d of decoded.diagnostics) {
|
|
335
|
+
if (d.code !== "invalid_source_entry") continue;
|
|
336
|
+
logErr(`${relPath} \u2014 parse error: ${d.message}`);
|
|
337
|
+
errors++;
|
|
338
|
+
}
|
|
332
339
|
for (const d of decoded.diagnostics) {
|
|
333
340
|
if (d.code !== "legacy_key_rejected") continue;
|
|
334
341
|
logErr(relPath === "skaile.yaml" ? d.message : `${relPath} \u2014 ${d.message}`);
|
|
335
342
|
errors++;
|
|
336
343
|
}
|
|
337
344
|
for (const d of decoded.diagnostics) {
|
|
338
|
-
if (
|
|
345
|
+
if (!["deprecated_harness_key", "retired_agent_key", "harness_key_conflict"].includes(d.code)) {
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
339
348
|
const line = `${relPath} [agent-config] \u2014 ${d.code}: ${d.message}`;
|
|
340
349
|
if (d.severity === "error") {
|
|
341
350
|
logErr(line);
|
|
@@ -355,7 +364,11 @@ async function validateWorkspaceManifests(rootPath) {
|
|
|
355
364
|
decoded.config?.connectors ?? []
|
|
356
365
|
);
|
|
357
366
|
if ((decoded.config?.connectors ?? []).length > 0) {
|
|
358
|
-
|
|
367
|
+
await loadDeclaredPlugins(path.dirname(file));
|
|
368
|
+
const { listConnectors } = await import('./connectors/index.js');
|
|
369
|
+
const assets = await resolveRuntimeAssets(path.dirname(file), {
|
|
370
|
+
isDriverRegistered: (driver) => listConnectors().includes(driver)
|
|
371
|
+
});
|
|
359
372
|
if (!assets.warnings.some((w) => w.code === "repo_unavailable")) {
|
|
360
373
|
for (const w of assets.warnings) {
|
|
361
374
|
if (w.code !== "missing_driver" || !w.name) continue;
|
|
@@ -514,7 +527,7 @@ function readAssetVersion(c) {
|
|
|
514
527
|
return {
|
|
515
528
|
kind,
|
|
516
529
|
name: typeof data.name === "string" ? data.name : kind === "prompt" ? stem : dirName,
|
|
517
|
-
version: declaredVersion(data) ?? "",
|
|
530
|
+
version: res.ok ? declaredVersion(data) ?? DEFAULT_VERSION : "",
|
|
518
531
|
filePath: c.filePath
|
|
519
532
|
};
|
|
520
533
|
}
|
|
@@ -523,18 +536,19 @@ function readAssetVersion(c) {
|
|
|
523
536
|
parsed = parse(content);
|
|
524
537
|
} catch {
|
|
525
538
|
}
|
|
539
|
+
const version = parsed ? String(parsed.version ?? DEFAULT_VERSION) : "";
|
|
526
540
|
if (kind === "flow") {
|
|
527
541
|
return {
|
|
528
542
|
kind,
|
|
529
543
|
name: String(parsed?.id ?? fileName.replace(".flow.yaml", "")),
|
|
530
|
-
version
|
|
544
|
+
version,
|
|
531
545
|
filePath: c.filePath
|
|
532
546
|
};
|
|
533
547
|
}
|
|
534
548
|
return {
|
|
535
549
|
kind,
|
|
536
550
|
name: String(parsed?.name ?? dirName),
|
|
537
|
-
version
|
|
551
|
+
version,
|
|
538
552
|
filePath: c.filePath
|
|
539
553
|
};
|
|
540
554
|
}
|
|
@@ -892,5 +906,5 @@ function makeValidateCommand() {
|
|
|
892
906
|
}
|
|
893
907
|
|
|
894
908
|
export { makeValidateCommand, scanIdentities };
|
|
895
|
-
//# sourceMappingURL=chunk-
|
|
896
|
-
//# sourceMappingURL=chunk-
|
|
909
|
+
//# sourceMappingURL=chunk-TROEC2Z2.js.map
|
|
910
|
+
//# sourceMappingURL=chunk-TROEC2Z2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../cli/src/commands/validate.ts"],"names":["parseYaml","parsed","a","c"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqFA,IAAM,+BAAoC,IAAI,GAAA,CAAI,CAAC,SAAA,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A,MAAA,CAAO,CAAA,EAAG,KAAK,CAAA,sEAAA,CAAmE,CAAA;AAAA,IACpF;AAEA,IAAA,IAAI,MAAM,MAAA,GAAS,OAAA,CAAQ,SAAS,CAAA,EAAG,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EACvD,CAAC,CAAA;AAEH,EAAA,OAAO,GAAA;AACT","file":"chunk-TROEC2Z2.js","sourcesContent":["/**\n * Validate asset versions, changelogs, and manifest schemas across asset repos.\n */\n\nimport { execFileSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n ASSET_NAME_HINT,\n type ConnectorDeclaration,\n decodeSkaileYaml,\n isInsideProject,\n symlinkEscapeOfProject,\n isValidAssetName,\n isValidPublisher,\n loadSkPublishManifest,\n localConnectorMountDir,\n parseAssetRef,\n resolveRuntimeAssets,\n SKAILE_MANIFEST_FILENAME,\n readAssetBody,\n} from \"@skaile/workspaces/core\";\nimport {\n flowSkillVersionPins,\n loadFlow,\n} from \"@skaile/workspaces/factory-assets/connectors/flow/engine\";\nimport { parseManifestFile } from \"@skaile/workspaces/discovery\";\nimport { withYamlQuotingHint } from \"@skaile/workspaces/core/manifest\";\nimport { isNonAssetPath } from \"@skaile/workspaces/core/publish-manifest\";\nimport {\n assertManifestEditable,\n missingRootAssets,\n scanUnlistedAssets,\n UNLISTED_SCAN_SKIP_DIRS,\n} from \"@skaile/workspaces/library\";\nimport type { IAssetKindRegistry } from \"@skaile/workspaces/plugins\";\nimport type { FlowVersionNode } from \"@skaile/workspaces/resolver\";\nimport { validateFlowVersions } from \"@skaile/workspaces/resolver\";\nimport { Command } from \"commander\";\nimport { parse as parseYaml } from \"yaml\";\nimport { type ComposeRefContext, composeRefContext } from \"../agent-checks.ts\";\nimport { unknownHarnessErrors, unknownKeyWarnings } from \"../config-checks.ts\";\nimport { logErr, logInfo, logOk, logWarn } from \"../helpers.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\nimport { loadDeclaredPlugins } from \"../plugin-store/index.ts\";\nimport {\n checkAsset,\n checkAssetFile,\n DEFAULT_VERSION,\n declaredVersion,\n findEntryManifestFile,\n invalidSemverText,\n MANIFEST_GLOBS,\n manifestParseErrorText,\n} from \"../skill-checks.ts\";\nimport {\n manifestEntryNameProblems,\n invalidPublisherMessage,\n manifestFilesProblems,\n manifestPublisherProblems,\n manifestRootProblems,\n manifestRequiresProblems,\n registeredAssetKeys,\n rejectRemovedDomainOption,\n removedDomainOption,\n reportLibrarySymlinks,\n unresolvedManifestDependencies,\n warnIgnoredDomainFiles,\n warnLegacyBundleFiles,\n} from \"./library-index.ts\";\nimport { assetEntryRef, manifestVersionMismatchMessage } from \"./publish-core.ts\";\nimport { checkAgentInstances } from \"./validate-instances.ts\";\n\n// ---------------------------------------------------------------------------\n// Manifest schema validation (skaile validate [path])\n// ---------------------------------------------------------------------------\n\n// The manifest file patterns live in skill-checks.ts (`MANIFEST_GLOBS`): `library index` names\n// the kind of a file it cannot parse with the same table.\n\n/**\n * `.claude`, `.codex` and `.omp` hold the copies `skaile add` deploys for the harnesses (and\n * the harness's own state): a project `validate .` checks what the author owns, not the\n * deployed bytes of an asset published elsewhere (p853).\n */\nconst HARNESS_DIRS: ReadonlySet<string> = new Set([\".claude\", \".codex\", \".omp\"]);\n/** Directories to skip during tree walk. */\nconst SKIP_DIRS = new Set([\n \"node_modules\",\n \"dist\",\n \".git\",\n \".skaile\",\n \"__pycache__\",\n ...HARNESS_DIRS,\n]);\n\ninterface ManifestCandidate {\n filePath: string;\n kind: string;\n}\n\n/** Recursively walk a directory tree and find manifest candidates. */\nfunction findManifestCandidates(rootPath: string): ManifestCandidate[] {\n const candidates: ManifestCandidate[] = [];\n\n function walk(dir: string): void {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(dir, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (!SKIP_DIRS.has(entry.name)) walk(fullPath);\n } else if (entry.isFile()) {\n for (const glob of MANIFEST_GLOBS) {\n if (glob.pattern.test(fullPath)) {\n candidates.push({ filePath: fullPath, kind: glob.kind });\n break;\n }\n }\n }\n }\n }\n\n walk(rootPath);\n return candidates;\n}\n\n/**\n * Parse a single manifest candidate's bytes with the indexer's own parser\n * (`parseManifestFile`), so a manifest `library index` cannot parse — an empty\n * `SKILL.md`, no frontmatter, invalid YAML — is an error here too. On failure\n * the error is already logged; count it.\n */\nfunction parseManifestCandidate(\n c: ManifestCandidate,\n absRoot: string,\n): { kind: \"value\"; parsed: unknown; body?: string } | { kind: \"error\" } {\n const content = fs.readFileSync(c.filePath, \"utf-8\");\n const res = parseManifestFile(c.filePath, content);\n if (!res.ok) {\n logErr(\n `${path.relative(absRoot, c.filePath)} [${c.kind}] — ${manifestParseErrorText(res.reason)}`,\n );\n return { kind: \"error\" };\n }\n return {\n kind: \"value\",\n parsed: res.data,\n body: readAssetBody(c.filePath, content),\n };\n}\n\n/**\n * The library root a validated path belongs to: the nearest directory at or above `absRoot`\n * that holds a `skaile.yaml`, else `absRoot` itself.\n */\nfunction libraryRootOf(absRoot: string): string {\n for (let dir = absRoot; ; dir = path.dirname(dir)) {\n if (fs.existsSync(path.join(dir, SKAILE_MANIFEST_FILENAME))) return dir;\n if (path.dirname(dir) === dir) return absRoot;\n }\n}\n\n/**\n * Validate a single parsed manifest candidate against identity rules + the kind\n * registry. Returns the error/warning deltas this candidate contributes.\n */\nfunction validateManifestCandidate(\n c: ManifestCandidate,\n parsed: unknown,\n body: string | undefined,\n absRoot: string,\n registry: IAssetKindRegistry,\n strictConformance: boolean,\n composeRefs: ComposeRefContext,\n): { errors: number; warnings: number } {\n const relPath = path.relative(absRoot, c.filePath);\n let errors = 0;\n let warnings = 0;\n\n // The shared per-asset checks (also run by `library index` and the publish plan):\n // errors fail validate; advisories are warnings (exit code unchanged) unless\n // --strict-conformance escalates the agentskills.io conformance ones to errors.\n const dirName = path.basename(path.dirname(c.filePath)); // the manifest's folder\n const checked = checkAsset(\n c.kind,\n (parsed ?? {}) as Record<string, unknown>,\n body,\n dirName,\n registry,\n fs.readFileSync(c.filePath, \"utf-8\"),\n path.basename(c.filePath),\n { dir: path.dirname(c.filePath), libraryRoot: libraryRootOf(absRoot), composeRefs },\n );\n for (const f of checked.errors) {\n logErr(`${relPath} [${f.tag}] — ${f.text}`);\n errors++;\n }\n for (const f of checked.advisories) {\n const line = `${relPath} [${f.tag}] — ${f.text}`;\n // An untouched scaffold body is an error: a passing `validate` means the asset can be published.\n if ((f.conformance && strictConformance) || f.scaffoldBody) {\n logErr(line);\n errors++;\n } else {\n logWarn(line);\n warnings++;\n }\n }\n\n return { errors, warnings };\n}\n\n/**\n * The `kind:name` identity of every asset manifest under `root`, read quietly: a manifest\n * that does not parse holds no identity (its own validation reports the error).\n */\nexport function scanIdentities(root: string): Set<string> {\n const identities = new Set<string>();\n for (const c of findManifestCandidates(root)) {\n let parsed: unknown;\n try {\n const res = parseManifestFile(c.filePath, fs.readFileSync(c.filePath, \"utf-8\"));\n if (!res.ok) continue;\n parsed = res.data;\n } catch {\n continue;\n }\n if (parsed === null || typeof parsed !== \"object\") continue;\n const identity = (parsed as Record<string, unknown>)[c.kind === \"flow\" ? \"id\" : \"name\"];\n if (typeof identity === \"string\" && identity.length > 0)\n identities.add(`${c.kind}:${identity}`);\n }\n return identities;\n}\n\n/** Validate all manifest files in a directory tree using the kind registry. */\nexport function validateManifests(\n rootPath: string,\n strictConformance: boolean,\n registeredAssets: ReadonlySet<string> = new Set(),\n): { total: number; errors: number; warnings: number } {\n const absRoot = path.resolve(rootPath);\n if (!fs.existsSync(absRoot)) {\n logErr(`Path does not exist: ${absRoot}`);\n return { total: 0, errors: 1, warnings: 0 };\n }\n\n const registry: IAssetKindRegistry = getKindRegistry();\n const candidates = findManifestCandidates(absRoot);\n // Symlinks are refused with the text `library index` and the publish plan print (p520). In a\n // library (a `skaile.manifest.yaml` at the root) any symlink is refused, as `git add -A`\n // would publish it; elsewhere (a project) only those inside an asset folder or aliasing one.\n // A link elsewhere in a project is not refused: the connector real-path check judges a\n // `mountPath` link (p1332).\n const isLibrary = fs.existsSync(path.join(absRoot, SKAILE_MANIFEST_FILENAME));\n // A project's deployed harness folders (`add --link` makes `.claude/skills/x` a link to the\n // project's own `skills/x`) are not sources: they are skipped here as in the manifest walk.\n let errors = reportLibrarySymlinks(absRoot, {\n wholeTree: isLibrary,\n skipDirs: isLibrary ? undefined : HARNESS_DIRS,\n });\n let warnings = 0;\n\n // kind:name → directory of the first manifest seen; a second directory with the same\n // identity cannot be told apart by `add`/`publish` (and `library index` skips it).\n const seenIdentity = new Map<string, string>();\n // `composes:` refs resolve against the assets of the whole library (the scanned tree plus,\n // when `validate` got a sub-directory, its siblings under the enclosing library root) and the\n // registered libraries of its publisher: a ref no library holds fails `skaile add` (p415).\n const libraryRoot = libraryRootOf(absRoot);\n const composeRefs = composeRefContext(\n scanIdentities(libraryRoot),\n registeredAssets,\n loadSkPublishManifest(libraryRoot)?.publisher,\n );\n for (const c of candidates) {\n const parseResult = parseManifestCandidate(c, absRoot);\n if (parseResult.kind === \"error\") {\n errors++;\n continue;\n }\n\n const delta = validateManifestCandidate(\n c,\n parseResult.parsed,\n parseResult.body,\n absRoot,\n registry,\n strictConformance,\n composeRefs,\n );\n errors += delta.errors;\n warnings += delta.warnings;\n const obj = parseResult.parsed as Record<string, unknown> | null;\n const identity = obj && typeof obj === \"object\" ? obj[c.kind === \"flow\" ? \"id\" : \"name\"] : null;\n if (typeof identity === \"string\" && identity.length > 0) {\n const dir = path.dirname(c.filePath);\n const key = `${c.kind}:${identity}`;\n const first = seenIdentity.get(key);\n if (first === undefined) {\n seenIdentity.set(key, dir);\n } else if (first !== dir) {\n logErr(\n `${path.relative(absRoot, c.filePath)} [${c.kind}] — ${key} is also defined in ${path.relative(absRoot, first) || \".\"}; ` +\n \"two directories cannot share a kind and name (`skaile library index` keeps only the first).\",\n );\n errors++;\n }\n }\n }\n\n return { total: candidates.length, errors, warnings };\n}\n\n/** Recursively find every `skaile.yaml` / `*.skaile.yaml` workspace manifest. */\nfunction findWorkspaceManifests(rootPath: string): string[] {\n const out: string[] = [];\n function walk(dir: string): void {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(dir, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (!SKIP_DIRS.has(entry.name)) walk(full);\n } else if (entry.isFile() && /(^|\\.)skaile\\.yaml$/.test(entry.name)) {\n out.push(full);\n }\n }\n }\n walk(rootPath);\n return out;\n}\n\n/**\n * Validate the dependency refs and asset identities declared in every\n * `skaile.yaml` under a tree. This is the manifest-level mirror of the\n * per-file identity check: it parses each `dependencies[]` /\n * `overrides[].ref` through `parseAssetRef` (the exact code path that produced\n * the original \"publisher required …\" / \"invalid asset name …\" hard error) and\n * checks each `assets[].name` against the canonical name grammar.\n */\n/**\n * Collect every `[field, ref]` pair to validate from a workspace manifest:\n * each string in `dependencies[]` and each `overrides[].ref`.\n */\nfunction collectWorkspaceRefFields(parsed: Record<string, unknown>): Array<[string, string]> {\n const refFields: Array<[string, string]> = [];\n if (Array.isArray(parsed.dependencies)) {\n for (const d of parsed.dependencies) {\n if (typeof d === \"string\") refFields.push([\"dependencies\", d]);\n }\n }\n if (Array.isArray(parsed.overrides)) {\n for (const o of parsed.overrides) {\n const ref = (o as Record<string, unknown>)?.ref;\n if (typeof ref === \"string\") refFields.push([\"overrides.ref\", ref]);\n }\n }\n return refFields;\n}\n\n/** Parse each declared ref through `parseAssetRef`; returns the error count. */\nfunction validateWorkspaceRefs(refFields: Array<[string, string]>, relPath: string): number {\n let errors = 0;\n for (const [field, ref] of refFields) {\n try {\n const parsedRef = parseAssetRef(ref);\n // The library-side slug rule (`library index`, the publish plan) holds for a project's\n // `dependencies:` too: `add` cannot resolve such a ref, so `check` fails on it (p1080).\n const publisher = parsedRef.publisher?.replace(/^@/, \"\");\n if (publisher !== undefined && !isValidPublisher(publisher)) {\n logErr(`${relPath} [${field}] — ${ref}: ${invalidPublisherMessage(publisher)}`);\n errors++;\n }\n } catch (e) {\n logErr(`${relPath} [${field}] — ${e instanceof Error ? e.message : String(e)}`);\n errors++;\n }\n }\n return errors;\n}\n\n/** Validate `assets[].name` against the canonical name/ref grammar. */\nfunction validateWorkspaceAssets(parsed: Record<string, unknown>, relPath: string): number {\n if (!Array.isArray(parsed.assets)) return 0;\n let errors = 0;\n const topPublisher = typeof parsed.publisher === \"string\" ? parsed.publisher : undefined;\n for (const a of parsed.assets) {\n const asset = a as Record<string, unknown>;\n const name = asset?.name;\n const kind = typeof asset?.kind === \"string\" ? asset.kind : \"skill\";\n if (typeof name !== \"string\" || name.length === 0) continue;\n const publisher = typeof asset?.publisher === \"string\" ? asset.publisher : topPublisher;\n if (publisher !== undefined) {\n try {\n parseAssetRef(`${kind}:@${publisher}/${name}`);\n } catch (e) {\n logErr(`${relPath} [assets] — ${e instanceof Error ? e.message : String(e)}`);\n errors++;\n }\n } else if (!isValidAssetName(name)) {\n logErr(`${relPath} [assets] — invalid asset name \"${name}\" — ${ASSET_NAME_HINT}`);\n errors++;\n }\n }\n return errors;\n}\n\n/** `skaile.yaml` connector diagnostics that fail `validate` (the runner cannot mount it right). */\nconst CONNECTOR_ERROR_CODES: readonly string[] = [\n \"connector_missing_driver\",\n \"connector_missing_id\",\n \"connector_duplicate_id\",\n \"connector_invalid_access\",\n];\n\n/**\n * A `local` connector's `mountPath` is mounted read-write as given: one that does not exist\n * fails (`serve` refuses it too), one outside the project is a warning, one that reaches outside\n * through a symlink fails (p833).\n */\nfunction validateLocalConnectorMountPaths(\n projectDir: string,\n relPath: string,\n connectors: ReadonlyArray<ConnectorDeclaration>,\n): number {\n let errors = 0;\n for (const c of connectors) {\n if (c.driver !== \"local\" || c.mount) continue;\n const dir = localConnectorMountDir(c, projectDir);\n if (!dir) continue;\n const escapesTo = symlinkEscapeOfProject(dir, projectDir);\n if (!fs.existsSync(dir)) {\n logErr(\n `${relPath} [connectors] — connector_mount_path_missing: connectors.${c.id}.mountPath: ${dir} does not exist; create the directory or fix the path`,\n );\n errors++;\n } else if (escapesTo !== null) {\n logErr(\n `${relPath} [connectors] — connector_mount_path_symlink: connectors.${c.id}.mountPath: ${dir} is a symlink to ${escapesTo}, outside the project ${projectDir}; point mountPath at the real directory`,\n );\n errors++;\n } else if (!isInsideProject(dir, projectDir)) {\n logWarn(\n `${relPath} [connectors] — connectors.${c.id}.mountPath: ${dir} is outside the project ${projectDir}; the agent reads${c.access === \"read-write\" ? \" and writes\" : \"\"} there`,\n );\n }\n }\n return errors;\n}\n\nasync function validateWorkspaceManifests(rootPath: string): Promise<{\n total: number;\n errors: number;\n}> {\n const absRoot = path.resolve(rootPath);\n const files = findWorkspaceManifests(absRoot);\n let errors = 0;\n\n for (const file of files) {\n const relPath = path.relative(absRoot, file);\n let parsed: Record<string, unknown>;\n let text = \"\";\n try {\n text = fs.readFileSync(file, \"utf-8\");\n parsed = (parseYaml(text) ?? {}) as Record<string, unknown>;\n } catch (e) {\n const message = e instanceof Error ? e.message : String(e);\n logErr(`${relPath} — parse error: ${withYamlQuotingHint(message, text)}`);\n errors++;\n continue;\n }\n // A root that is no mapping, or a `dependencies:`/`sources:` of the wrong shape, is one\n // parse-error line, as `check` prints it (p1421, p1620).\n const unreadable = decodeSkaileYaml(text).diagnostics.find(\n (d) => d.code === \"non_object_root\" || d.code === \"invalid_value_shape\",\n );\n if (unreadable) {\n logErr(`${relPath} — parse error: ${unreadable.message}`);\n errors++;\n continue;\n }\n\n errors += validateWorkspaceRefs(collectWorkspaceRefFields(parsed), relPath);\n errors += validateWorkspaceAssets(parsed, relPath);\n for (const d of checkAgentInstances(path.dirname(file), parsed)) {\n const line = `${relPath} [agents] — ${d.code}: ${d.path ? `${d.path}: ` : \"\"}${d.message}`;\n if (d.severity === \"error\") {\n logErr(line);\n errors++;\n } else {\n logWarn(line);\n }\n }\n // A connector the runner cannot mount or mounts wrongly: no `driver` (or the old `adapter`\n // spelling), no `id`, a duplicate `id`, an `access` that is neither read-only nor read-write.\n const decoded = decodeSkaileYaml(fs.readFileSync(file, \"utf-8\"));\n for (const d of decoded.diagnostics) {\n if (!CONNECTOR_ERROR_CODES.includes(d.code)) continue;\n logErr(`${relPath} [connectors] — ${d.code}: ${d.path ? `${d.path}: ` : \"\"}${d.message}`);\n errors++;\n }\n // A `sources:` item with no url or a non-string publisher: `check`, `doctor` and `add` stop\n // on it, so `validate` must not call the file valid (p1620).\n for (const d of decoded.diagnostics) {\n if (d.code !== \"invalid_source_entry\") continue;\n logErr(`${relPath} — parse error: ${d.message}`);\n errors++;\n }\n // A key skaile.yaml no longer accepts (a legacy `provider:`): every command that reads the\n // file stops on it, so `validate` must not call the file valid (p1352).\n for (const d of decoded.diagnostics) {\n if (d.code !== \"legacy_key_rejected\") continue;\n logErr(relPath === \"skaile.yaml\" ? d.message : `${relPath} — ${d.message}`);\n errors++;\n }\n // The 5.x `driver` key of an agent-config profile: still read as `harness` until 7.0\n // (warning); setting both keys is an error. The retired `agent` key is ignored (warning).\n for (const d of decoded.diagnostics) {\n if (\n ![\"deprecated_harness_key\", \"retired_agent_key\", \"harness_key_conflict\"].includes(d.code)\n ) {\n continue;\n }\n const line = `${relPath} [agent-config] — ${d.code}: ${d.message}`;\n if (d.severity === \"error\") {\n logErr(line);\n errors++;\n } else {\n logWarn(line);\n }\n }\n // A mistyped key warns (p1474); a `harness:` no harness registers, plugins included, fails (p1022).\n for (const line of unknownKeyWarnings(decoded.diagnostics, relPath)) logWarn(line);\n for (const line of await unknownHarnessErrors(path.dirname(file), decoded.config, relPath)) {\n logErr(line);\n errors++;\n }\n errors += validateLocalConnectorMountPaths(\n path.dirname(file),\n relPath,\n decoded.config?.connectors ?? [],\n );\n // A `driver` no catalog entry provides: `serve` cannot mount it either. The text is the one\n // `serve` logs as `validation_warning`. An unreachable source (not cloned yet) may hold the\n // driver, so nothing is reported while one is missing.\n if ((decoded.config?.connectors ?? []).length > 0) {\n // A plugin's connector driver is known once the plugins are loaded, as `serve` loads them.\n await loadDeclaredPlugins(path.dirname(file));\n const { listConnectors } = await import(\"@skaile/workspaces/connectors\");\n const assets = await resolveRuntimeAssets(path.dirname(file), {\n isDriverRegistered: (driver) => listConnectors().includes(driver),\n });\n if (!assets.warnings.some((w) => w.code === \"repo_unavailable\")) {\n for (const w of assets.warnings) {\n if (w.code !== \"missing_driver\" || !w.name) continue;\n logErr(`${relPath} [connectors] — ${w.code}: ${w.message}`);\n errors++;\n }\n }\n }\n }\n\n return { total: files.length, errors };\n}\n\n/**\n * Check the library's publication manifest (`skaile.manifest.yaml` at the\n * validated root): every first-party `root:` must still exist. An entry whose\n * directory was deleted would otherwise stay publishable; the fix is\n * `skaile library index <lib>`, which drops it.\n */\nfunction validatePublishManifestRoots(rootPath: string): number {\n const absRoot = path.resolve(rootPath);\n const manifest = loadSkPublishManifest(absRoot);\n if (!manifest) return 0;\n const missing = missingRootAssets(absRoot, manifest);\n for (const a of missing) {\n logErr(\n `${SKAILE_MANIFEST_FILENAME} [assets] — ${assetEntryRef(a, manifest)}: root \"${a.root}\" does not exist. ` +\n \"Run `skaile library index <library>` to drop the entry, or restore the directory.\",\n );\n }\n return missing.length;\n}\n\n/**\n * An asset directory the library's manifest does not list is an error: `add` refuses it (`not\n * listed in its skaile.manifest.yaml`), the publish plan does not ship it, yet `git add -A`\n * commits its files. The fix is `skaile library index <lib>`, which lists it (p1193). A directory\n * that holds a kind + name the manifest already names elsewhere is the duplicate check's finding.\n * An asset that already fails its own check is not listed here: `library index` refuses it, so\n * \"run `library index`\" would send the author round in a circle; the check line names the real\n * fix (p871).\n */\nasync function validatePublishManifestUnlisted(rootPath: string): Promise<number> {\n const absRoot = path.resolve(rootPath);\n const manifest = loadSkPublishManifest(absRoot);\n if (!manifest) return 0;\n const registry = getKindRegistry();\n const libraryRoot = libraryRootOf(absRoot);\n const composeRefs = composeRefContext(\n scanIdentities(libraryRoot),\n await registeredAssetKeys(libraryRoot),\n manifest.publisher,\n );\n const unlisted = (\n await scanUnlistedAssets(\n absRoot,\n manifest.publisher ?? path.basename(absRoot),\n registry,\n UNLISTED_SCAN_SKIP_DIRS,\n )\n ).filter(\n (u) =>\n !u.registeredAt &&\n !u.parseFailure && // a file that does not parse has its own parse error\n checkAssetFile(u.entry.source, u.entry.kind, registry, absRoot, composeRefs).length === 0,\n );\n for (const u of unlisted) {\n logErr(\n `${path.relative(absRoot, u.entry.source)} [${u.entry.kind}] — ${u.entry.kind}:${u.entry.name} is on disk but not in ${SKAILE_MANIFEST_FILENAME}, so it is not published. ` +\n \"Run `skaile library index <library>` to list it, or delete the directory.\",\n );\n }\n return unlisted.length;\n}\n\n/**\n * Check every `assets[].dependencies` entry of the publication manifest with the\n * same syntax rule (and message) `library index` applies, so a malformed ref\n * fails `validate` instead of being silently dropped by the manifest decoder.\n */\nfunction validatePublishManifestRequires(rootPath: string): number {\n const problems = manifestRequiresProblems(path.resolve(rootPath));\n for (const p of problems) {\n logErr(\n `${SKAILE_MANIFEST_FILENAME} [assets] — ${p.asset}: ${p.message}. ` +\n \"Use the `kind:@<publisher>/name[#version]` form.\",\n );\n }\n return problems.length;\n}\n\n/**\n * Check the publisher of the publication manifest (top-level and every\n * `assets[].publisher`) against the one publisher slug rule `library create`, `library\n * index` and the publish plan apply, with the same message.\n */\nfunction validatePublishManifestPublisherSlugs(rootPath: string): number {\n const problems = manifestPublisherProblems(path.resolve(rootPath));\n for (const message of problems) logErr(message);\n return problems.length;\n}\n\n/**\n * Check every first-party `assets[].root` and `files:` entry of the publication manifest stays\n * inside the library and crosses no symlink ({@link manifestRootProblems},\n * {@link manifestFilesProblems}), the refusal `library index` and the publish plan print too: a\n * path outside the library is never found by `add` (p701, p1403), a missing file is no asset (p1404).\n */\nfunction validatePublishManifestRootPaths(rootPath: string): number {\n const problems = [\n ...manifestRootProblems(path.resolve(rootPath)),\n ...manifestFilesProblems(path.resolve(rootPath)),\n ...manifestEntryNameProblems(path.resolve(rootPath)),\n ];\n for (const message of problems) logErr(message);\n return problems.length;\n}\n\n/**\n * Parse the publication manifest the way `library index` and `library publish` open it, so a\n * `skaile.manifest.yaml` that does not parse fails `validate` too, with the file and line.\n * Without the file there is nothing to check.\n */\nfunction validatePublishManifestParses(rootPath: string): number {\n try {\n assertManifestEditable(path.resolve(rootPath));\n return 0;\n } catch (err) {\n logErr(err instanceof Error ? err.message : String(err));\n return 1;\n }\n}\n\n/**\n * Warn when a first-party `assets[].version` of the publication manifest differs\n * from the version in the asset's own manifest file. The file is the source of\n * truth — `skaile library index` rewrites the entry from it — so a hand-edited\n * manifest version is silently overwritten by the next index. Returns the warning count.\n */\nfunction validatePublishManifestVersions(rootPath: string): number {\n const absRoot = path.resolve(rootPath);\n const manifest = loadSkPublishManifest(absRoot);\n if (!manifest || manifest.source) return 0;\n let warnings = 0;\n for (const a of manifest.assets ?? []) {\n if (a.source || !a.version) continue;\n const file = findEntryManifestFile(absRoot, a);\n if (!file) continue;\n const res = parseManifestFile(file, fs.readFileSync(file, \"utf-8\"));\n if (!res.ok) continue; // reported by the per-file parse check\n const fileVersion = declaredVersion(res.data);\n if (fileVersion === undefined || fileVersion === a.version) continue;\n logWarn(\n manifestVersionMismatchMessage(\n assetEntryRef(a, manifest),\n a.version,\n toPosix(path.relative(absRoot, file)),\n fileVersion,\n ),\n );\n warnings++;\n }\n return warnings;\n}\n\n/**\n * Warn when a first-party asset file still carries a `metadata.publisher` that\n * differs from the publisher the manifest resolves for it (`assets[].publisher`,\n * else the top-level `publisher`). The manifest is the only source of an\n * asset's publisher; the file value is ignored by every resolver, so a stale\n * one only misleads the reader. Returns the warning count.\n */\nfunction validatePublishManifestPublishers(rootPath: string): number {\n const absRoot = path.resolve(rootPath);\n const manifest = loadSkPublishManifest(absRoot);\n if (!manifest || manifest.source) return 0;\n const bare = (p: string) => p.trim().replace(/^@/, \"\");\n let warnings = 0;\n for (const a of manifest.assets ?? []) {\n const resolved = a.publisher ?? manifest.publisher;\n if (a.source || !resolved) continue;\n const file = findEntryManifestFile(absRoot, a);\n if (!file) continue;\n const res = parseManifestFile(file, fs.readFileSync(file, \"utf-8\"));\n if (!res.ok) continue; // reported by the per-file parse check\n const meta = (res.data as Record<string, unknown>).metadata;\n const declared =\n meta !== null && typeof meta === \"object\"\n ? (meta as Record<string, unknown>).publisher\n : null;\n if (typeof declared !== \"string\" || bare(declared) === bare(resolved)) continue;\n logWarn(\n `${toPosix(path.relative(absRoot, file))} [publisher] — metadata.publisher \"${bare(declared)}\" differs from ` +\n `the manifest publisher \"${bare(resolved)}\" for ${assetEntryRef(a, manifest)}. The manifest wins and the ` +\n \"file value is ignored: delete `metadata.publisher` from the file, or set the publisher in \" +\n `${SKAILE_MANIFEST_FILENAME}.`,\n );\n warnings++;\n }\n return warnings;\n}\n\n/** Root-relative path prefixes excluded from version/changelog checks. */\nconst EXCLUDED_PATHS = [\"skaileup-shared/\", \"external/\", \"docs/\"];\n\n/** Normalise to forward slashes so prefix and set comparisons work on any OS. */\nfunction toPosix(p: string): string {\n return p.split(path.sep).join(\"/\");\n}\n\n/** True when a root-relative path sits under one of {@link EXCLUDED_PATHS}. */\nfunction isExcludedPath(relPath: string): boolean {\n const rel = toPosix(relPath);\n return EXCLUDED_PATHS.some((prefix) => rel.startsWith(prefix));\n}\n\ninterface AssetVersion {\n kind: \"skill\" | \"agent\" | \"flow\" | \"prompt\" | \"preset\" | \"contract\";\n name: string;\n version: string;\n filePath: string;\n}\n\n/** Manifest candidates whose kind carries a version `validate versions` checks. */\nconst VERSIONED_KINDS: Record<string, true> = {\n skill: true,\n agent: true,\n flow: true,\n prompt: true,\n preset: true,\n contract: true,\n};\n\n/**\n * Read one manifest candidate's identity and version. A manifest without a `version` reads as\n * {@link DEFAULT_VERSION}, as `validate`, `library index` and `add` read it (p1858); an unreadable\n * file has no version.\n */\nfunction readAssetVersion(c: ManifestCandidate): AssetVersion {\n const kind = c.kind as AssetVersion[\"kind\"];\n const fileName = path.basename(c.filePath);\n const dirName = path.basename(path.dirname(c.filePath));\n const content = fs.readFileSync(c.filePath, \"utf-8\");\n if (c.filePath.endsWith(\".md\")) {\n // The version `library index` records (top-level `version`, else `metadata.version`).\n const res = parseManifestFile(c.filePath, content);\n const data = res.ok ? (res.data as Record<string, unknown>) : {};\n const stem = fileName.replace(/\\.prompt\\.md$/, \"\");\n return {\n kind,\n name: typeof data.name === \"string\" ? data.name : kind === \"prompt\" ? stem : dirName,\n version: res.ok ? (declaredVersion(data) ?? DEFAULT_VERSION) : \"\",\n filePath: c.filePath,\n };\n }\n let parsed: Record<string, unknown> | null = null;\n try {\n parsed = parseYaml(content);\n } catch {\n // Reported by the default `skaile validate`; here the asset just has no readable version.\n }\n const version = parsed ? String(parsed.version ?? DEFAULT_VERSION) : \"\";\n if (kind === \"flow\") {\n return {\n kind,\n name: String(parsed?.id ?? fileName.replace(\".flow.yaml\", \"\")),\n version,\n filePath: c.filePath,\n };\n }\n return {\n kind,\n name: String(parsed?.name ?? dirName),\n version,\n filePath: c.filePath,\n };\n}\n\n/**\n * Walk `root` at any depth and collect the version of every skill, agent, flow, prompt,\n * preset and contract — the same tree walk the default `validate` uses, so a library laid out\n * as `<root>/<asset>/SKILL.md` is covered as well as `skills/<asset>/SKILL.md`.\n */\nfunction collectAssetVersions(root: string): AssetVersion[] {\n if (!fs.existsSync(root)) return [];\n const assets: AssetVersion[] = [];\n for (const c of findManifestCandidates(root)) {\n if (!VERSIONED_KINDS[c.kind]) continue;\n // Only the YAML flow form and `agent.yaml` / `AGENT.md` carry a readable version here.\n if (c.filePath.endsWith(\".flow.json\")) continue;\n if (isExcludedPath(path.relative(root, c.filePath))) continue;\n assets.push(readAssetVersion(c));\n }\n return assets;\n}\n\n/** Root-relative posix location of an asset file, for messages. */\nfunction assetLocation(a: AssetVersion, root: string): string {\n return toPosix(path.relative(root, a.filePath));\n}\n\n/**\n * Nearest ancestor directory of `assetRelPath` (root-relative, posix) that\n * holds a `CHANGELOG.md`, walking up from the asset's own directory to and\n * including `root`, never above it. Returns the changelog's root-relative\n * path, or `null` when no ancestor has one.\n */\nfunction findChangelogUnit(assetRelPath: string, root: string): string | null {\n let dir = path.posix.dirname(toPosix(assetRelPath));\n for (;;) {\n const candidate = dir === \".\" ? \"CHANGELOG.md\" : `${dir}/CHANGELOG.md`;\n if (fs.existsSync(path.join(root, candidate))) return candidate;\n if (dir === \".\") return null;\n dir = path.posix.dirname(dir);\n }\n}\n\n/** Outcome of {@link checkChangelogUnits}. All paths are root-relative posix. */\nexport interface ChangelogCheck {\n /** Changelog units whose `CHANGELOG.md` is among the modified files. */\n updated: string[];\n /** Changelog units covering a modified asset whose `CHANGELOG.md` is not modified. */\n stale: string[];\n /** Modified assets with no `CHANGELOG.md` in any ancestor up to the root. */\n orphans: string[];\n}\n\n/**\n * Group the modified asset files by their nearest-ancestor `CHANGELOG.md` and\n * report which units were updated alongside them. Assets under\n * {@link EXCLUDED_PATHS} are ignored.\n *\n * @param modifiedFiles - Changed paths relative to `root`.\n * @param root - The asset root (`ai-assets/`); the walk up never leaves it.\n */\nexport function checkChangelogUnits(modifiedFiles: string[], root: string): ChangelogCheck {\n const modified = new Set(modifiedFiles.map(toPosix));\n const assetPattern = /(SKILL\\.md|agent\\.yaml|\\.flow\\.yaml|\\.prompt\\.md)$/;\n const units = new Set<string>();\n const orphans: string[] = [];\n for (const f of modified) {\n if (!assetPattern.test(f) || isExcludedPath(f)) continue;\n const unit = findChangelogUnit(f, root);\n if (unit) units.add(unit);\n else orphans.push(f);\n }\n const updated = [...units].filter((u) => modified.has(u));\n const stale = [...units].filter((u) => !modified.has(u));\n return { updated, stale, orphans };\n}\n\n/** Extract version from file content using proper YAML parsing */\nfunction extractVersionFromContent(filePath: string, content: string): string | null {\n if (filePath.endsWith(\".yaml\")) {\n const parsed = parseYaml(content);\n return parsed?.version ?? null;\n }\n // SKILL.md / .prompt.md — YAML frontmatter\n const fmMatch = content.match(/^---\\n([\\s\\S]*?)\\n---/);\n if (!fmMatch) return null;\n const parsed = parseYaml(fmMatch[1]);\n return parsed?.metadata?.version ?? parsed?.version ?? null;\n}\n\n/** Check every asset has a present + semver-valid version. */\nfunction checkAssetVersions(\n assets: AssetVersion[],\n root: string,\n): { errors: number; warnings: number } {\n let errors = 0;\n const warnings = 0;\n for (const a of assets) {\n const location = assetLocation(a, root);\n if (!a.version) {\n logErr(`${a.kind}:${a.name} (${location}) — missing version`);\n errors++;\n continue;\n }\n const invalid = invalidSemverText(a.version);\n if (invalid) {\n logErr(`${a.kind}:${a.name} (${location}) — ${invalid}`);\n errors++;\n }\n }\n return { errors, warnings };\n}\n\n/** In --changed-only mode, warn when a changed asset's version was not bumped. */\nfunction checkVersionBumps(assets: AssetVersion[], root: string): number {\n let warnings = 0;\n for (const a of assets) {\n if (!a.version) continue; // already flagged above\n // `HEAD:./<path>` is relative to `root` (the cwd), not the repository top level.\n const relPath = toPosix(path.relative(root, a.filePath));\n try {\n const headContent = execFileSync(\"git\", [\"show\", `HEAD:./${relPath}`], {\n cwd: root,\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n const headVersion = extractVersionFromContent(a.filePath, headContent);\n if (headVersion && headVersion === a.version) {\n logWarn(\n `${a.kind}:${a.name} (${assetLocation(a, root)}) — file changed but version not bumped (${a.version})`,\n );\n warnings++;\n }\n } catch {\n // New file (no HEAD version) — that's fine\n }\n }\n return warnings;\n}\n\n/**\n * Validate flow node skill-version pins against the discovered skill versions.\n *\n * Flows are read through `loadFlow`, which normalizes legacy v1 documents into\n * the strict v2 shape — reading the authored YAML directly would miss every v2\n * pin, since those ride in `run.assets` rather than `node.data.version`.\n */\nfunction checkFlowVersionPins(\n assets: AssetVersion[],\n root: string,\n): { errors: number; warnings: number } {\n const flows = assets.filter((a) => a.kind === \"flow\");\n const skillVersionMap = new Map<string, string>();\n for (const a of assets.filter((a) => a.kind === \"skill\")) {\n skillVersionMap.set(a.name, a.version);\n }\n\n let errors = 0;\n let warnings = 0;\n for (const f of flows) {\n let pins: FlowVersionNode[];\n try {\n pins = flowSkillVersionPins(loadFlow(f.filePath));\n } catch (err) {\n // An unreadable flow is a gap in the check, not an absence of findings.\n // Report the path, not `f.name`: that id comes from a raw-YAML read that\n // falls back to the filename stem exactly when the file is unusable.\n logWarn(\n `flow:${f.name} (${path.relative(root, f.filePath)}) — could not be read: ` +\n `${err instanceof Error ? err.message : err}`,\n );\n warnings++;\n continue;\n }\n\n if (pins.length === 0) continue;\n const checks = validateFlowVersions(pins, skillVersionMap);\n for (const c of checks.filter((c) => !c.satisfied)) {\n logErr(\n `flow:${f.name} node ${c.nodeId} — wants ${c.requested}, found ${c.actual || \"(none)\"}`,\n );\n errors++;\n }\n }\n return { errors, warnings };\n}\n\n/**\n * Root of a `validate versions` / `validate changelog` run: the explicit `[path]`, else the\n * library the shell is in (the nearest directory at or above the cwd that holds\n * `skaile.manifest.yaml`), else the cwd itself, as plain `validate` reads it. The bundled\n * factory assets are never a default (p1194). Returns `null` after printing an error when\n * the path does not exist, or when the root holds no library (see {@link isCheckableRoot}).\n */\nfunction resolveCheckRoot(pathArg: string | undefined): string | null {\n let root = process.cwd();\n if (pathArg) {\n root = path.resolve(pathArg);\n if (!fs.existsSync(root)) {\n logErr(`Path does not exist: ${root}`);\n return null;\n }\n } else {\n for (let dir = root; ; dir = path.dirname(dir)) {\n if (fs.existsSync(path.join(dir, SKAILE_MANIFEST_FILENAME))) {\n root = dir;\n break;\n }\n if (path.dirname(dir) === dir) break;\n }\n }\n if (!isCheckableRoot(root)) {\n logErr(\n `Nothing to check in ${root}: no ${SKAILE_MANIFEST_FILENAME} and no versioned asset (skill, agent, flow, prompt, contract or preset) found. Run it in a library or pass the library directory.`,\n );\n return null;\n }\n return root;\n}\n\n/** Whether `root` is a library: it holds a library manifest or at least one versioned asset. */\nfunction isCheckableRoot(root: string): boolean {\n return (\n fs.existsSync(path.join(root, SKAILE_MANIFEST_FILENAME)) ||\n collectAssetVersions(root).length > 0\n );\n}\n\n/** `true` when `root` lies inside a git work tree. */\nfunction isInGitWorkTree(root: string): boolean {\n try {\n return (\n execFileSync(\"git\", [\"rev-parse\", \"--is-inside-work-tree\"], {\n cwd: root,\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim() === \"true\"\n );\n } catch {\n return false;\n }\n}\n\n/** `true` when the git work tree at `root` has at least one commit (`HEAD` resolves). */\nfunction hasCommit(root: string): boolean {\n try {\n execFileSync(\"git\", [\"rev-parse\", \"--verify\", \"--quiet\", \"HEAD\"], {\n cwd: root,\n stdio: [\"ignore\", \"ignore\", \"ignore\"],\n });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Run `git diff --name-only --relative <ref>` in `root` and return the changed paths\n * (relative to `root`), plus — with `untracked` — the new files git does not track yet.\n * No git work tree prints `<what> needs a git repository`; any other git failure — a bad\n * ref, no `git` — prints one `git diff failed in <root>: <first stderr line>` line. Both\n * return `null`; git's own usage text never reaches the terminal.\n *\n * @param what The command that needs git, for the message (`--changed-only`, `changelog`).\n */\nfunction changedFiles(\n root: string,\n ref: string,\n what: string,\n opts: { untracked?: boolean } = {},\n): string[] | null {\n if (!isInGitWorkTree(root)) {\n logErr(`${what} needs a git repository: ${root} is not inside a git work tree.`);\n return null;\n }\n if (ref === \"HEAD\" && !hasCommit(root)) {\n logErr(\n `${what} compares with the last commit, and ${root} has no commit yet. Commit the library first (\\`skaile library commit <name>\\`), then run it again.`,\n );\n return null;\n }\n try {\n const out = execFileSync(\n \"git\",\n [\"diff\", \"--name-only\", \"--relative\", \"--end-of-options\", ref],\n {\n cwd: root,\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n },\n );\n const changed = out.trim().split(\"\\n\").filter(Boolean);\n if (opts.untracked) {\n // New files git does not track yet (`--others` paths are relative to `root`).\n const fresh = execFileSync(\"git\", [\"ls-files\", \"--others\", \"--exclude-standard\"], {\n cwd: root,\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n changed.push(...fresh.trim().split(\"\\n\").filter(Boolean));\n }\n return changed;\n } catch (err) {\n const stderr = err instanceof Error && \"stderr\" in err ? String(err.stderr).trim() : \"\";\n const reason = (stderr || (err instanceof Error ? err.message : String(err))).split(\"\\n\")[0];\n logErr(`git diff failed in ${root}: ${reason}`);\n return null;\n }\n}\n\n/**\n * The directory whose files belong to `a`: the asset's own folder for a skill, agent, contract,\n * or a prompt/flow/preset that sits in a folder named after it — the folder `library create`\n * scaffolds. A single prompt/flow/preset file next to others is its own asset (`null`).\n */\nfunction assetOwnDir(a: AssetVersion): string | null {\n const dir = path.dirname(a.filePath);\n if ([\"skill\", \"agent\", \"contract\"].includes(a.kind) || path.basename(dir) === a.name) return dir;\n return null;\n}\n\n/**\n * `true` when `a` changed: its asset file, or any file under its folder that a deploy ships\n * (the lock hash covers them, minus the deploy ignore list), is among `changedAbs`.\n */\nfunction assetChanged(a: AssetVersion, changedAbs: ReadonlySet<string>): boolean {\n if (changedAbs.has(a.filePath)) return true;\n const dir = assetOwnDir(a);\n if (dir === null) return false;\n for (const f of changedAbs) {\n const rel = path.relative(dir, f);\n if (rel.startsWith(\"..\") || path.isAbsolute(rel)) continue;\n if (!isNonAssetPath(toPosix(rel))) return true;\n }\n return false;\n}\n\n/** Body of `skaile validate versions` — semver + bump + flow-pin checks. */\nfunction runVersionsCheck(\n pathArg: string | undefined,\n opts: { changedOnly?: boolean; strict?: boolean },\n): void {\n const root = resolveCheckRoot(pathArg);\n if (root === null) {\n process.exit(1);\n return;\n }\n let assets = collectAssetVersions(root);\n // A directory with no asset has nothing to check: `Checked 0 assets / All versions valid` would\n // read as a pass, so it fails as `validate` does for a path with no manifests (p1194).\n if (assets.length === 0) {\n logErr(\n `Nothing to check in ${root}: no versioned asset (skill, agent, flow, prompt, contract or preset) found. Pass the library directory.`,\n );\n process.exit(1);\n return;\n }\n\n // Filter to changed files only if requested\n if (opts.changedOnly) {\n const changed = changedFiles(root, \"HEAD\", \"--changed-only\", { untracked: true });\n if (changed === null) {\n process.exit(1);\n return;\n }\n const changedAbs = new Set(changed.map((f) => path.resolve(root, f)));\n assets = assets.filter((a) => assetChanged(a, changedAbs));\n }\n\n logInfo(`Checking versions in ${root}`);\n const versionCheck = checkAssetVersions(assets, root);\n let errors = versionCheck.errors;\n let warnings = versionCheck.warnings;\n\n // In --changed-only mode, check if version was actually bumped\n if (opts.changedOnly) {\n warnings += checkVersionBumps(assets, root);\n }\n\n const pinCheck = checkFlowVersionPins(assets, root);\n errors += pinCheck.errors;\n warnings += pinCheck.warnings;\n\n // Summary\n console.log();\n logInfo(`Checked ${assets.length} assets`);\n if (errors === 0 && warnings === 0) {\n logOk(\"All versions valid\");\n } else {\n if (errors > 0) logErr(`${errors} error(s)`);\n if (warnings > 0) logWarn(`${warnings} warning(s)`);\n }\n\n if (errors > 0 || (opts.strict && warnings > 0)) {\n process.exit(1);\n }\n}\n\n/**\n * Creates the `skaile validate` command group.\n *\n * Validates asset manifests, version fields, and changelogs in an asset\n * repository tree. Subcommands: default `validate [path]` (schema check),\n * `versions` (semver + flow pin validation), `changelog` (modified assets\n * must have an updated nearest-ancestor CHANGELOG.md).\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/validate#make-validate-command\n */\nexport function makeValidateCommand(): Command {\n const cmd = new Command(\"validate\").description(\n \"Validate asset manifests, versions, and changelogs\",\n );\n\n // Default action: skaile validate [path]\n cmd\n .argument(\"[path]\", \"Path to asset repo or directory to validate\", \".\")\n .option(\n \"--strict-conformance\",\n \"Treat Agent Skills (agentskills.io) standard findings as errors\",\n )\n .action(async (targetPath: string, opts: { strictConformance?: boolean }) => {\n const absPath = path.resolve(targetPath);\n if (fs.existsSync(absPath) && !fs.statSync(absPath).isDirectory()) {\n logErr(`${absPath} is not a directory: nothing to validate. Pass the library directory.`);\n process.exit(1);\n return;\n }\n logInfo(`Validating manifests in ${absPath}`);\n const { total, errors, warnings } = validateManifests(\n absPath,\n opts.strictConformance ?? false,\n await registeredAssetKeys(libraryRootOf(absPath)),\n );\n const ws = await validateWorkspaceManifests(absPath);\n const rootErrors = validatePublishManifestRoots(absPath);\n const slugErrors = validatePublishManifestPublisherSlugs(absPath);\n const rootPathErrors = validatePublishManifestRootPaths(absPath);\n const parseErrors = validatePublishManifestParses(absPath);\n const requiresErrors = validatePublishManifestRequires(absPath);\n const unlistedErrors = await validatePublishManifestUnlisted(absPath);\n const versionWarnings = validatePublishManifestVersions(absPath);\n const publisherWarnings = validatePublishManifestPublishers(absPath);\n // Advisory and offline: a dependency no registered library holds may live in a\n // library that is not registered on this machine.\n const dependencyProblems = await unresolvedManifestDependencies(absPath);\n for (const w of dependencyProblems) logWarn(w);\n const dependencyWarnings = dependencyProblems.length;\n const totalErrors =\n errors +\n ws.errors +\n rootErrors +\n slugErrors +\n rootPathErrors +\n parseErrors +\n requiresErrors +\n unlistedErrors;\n console.log();\n warnIgnoredDomainFiles(absPath);\n warnLegacyBundleFiles(absPath);\n logInfo(`Scanned ${total} asset manifest(s) and ${ws.total} skaile.yaml file(s)`);\n // Nothing scanned and no library manifest: a directory with nothing in it is not valid,\n // it is not validated (p745).\n if (\n total === 0 &&\n ws.total === 0 &&\n totalErrors === 0 &&\n !fs.existsSync(path.join(absPath, SKAILE_MANIFEST_FILENAME))\n ) {\n logErr(\n `Nothing to validate in ${absPath}: no asset manifest, skaile.yaml or ${SKAILE_MANIFEST_FILENAME} found.`,\n );\n process.exit(1);\n return;\n }\n const totalWarnings = warnings + versionWarnings + publisherWarnings + dependencyWarnings;\n if (totalWarnings > 0) logWarn(`${totalWarnings} warning(s)`);\n if (totalErrors === 0) {\n logOk(\"All manifests valid\");\n } else {\n logErr(`${totalErrors} validation error(s)`);\n process.exit(1);\n }\n });\n\n cmd\n .command(\"versions\")\n .description(\"Check version fields and flow version pins\")\n .argument(\"[path]\", \"Library or asset directory (default: the current library)\")\n .option(\"--changed-only\", \"Only check assets modified since last commit\")\n .option(\"--strict\", \"Exit 1 on warnings (for CI)\")\n .addOption(removedDomainOption())\n .action(\n (\n pathArg: string | undefined,\n opts: { changedOnly?: boolean; strict?: boolean; domain?: string },\n ) => {\n rejectRemovedDomainOption(opts);\n runVersionsCheck(pathArg, opts);\n },\n );\n\n cmd\n .command(\"changelog\")\n .description(\"Check that modified assets have an updated nearest CHANGELOG.md\")\n .argument(\"[path]\", \"Library or asset directory (default: the current library)\")\n .option(\"--base <ref>\", \"Git base ref for diff\", \"HEAD\")\n .action((pathArg: string | undefined, opts: { base: string }) => {\n const root = resolveCheckRoot(pathArg);\n if (root === null) {\n process.exit(1);\n return;\n }\n const modifiedFiles = changedFiles(root, opts.base, \"changelog\");\n if (modifiedFiles === null) {\n process.exit(1);\n return;\n }\n const { updated, stale, orphans } = checkChangelogUnits(modifiedFiles, root);\n\n if (updated.length + stale.length + orphans.length === 0) {\n logOk(\"No modified assets found\");\n return;\n }\n\n for (const unit of updated) logOk(`${unit} updated`);\n for (const unit of stale) logErr(`${unit} not updated (assets were modified)`);\n for (const asset of orphans) {\n logErr(`${asset} — no CHANGELOG.md in any ancestor directory up to the asset root`);\n }\n\n if (stale.length + orphans.length > 0) process.exit(1);\n });\n\n return cmd;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { compositeSha256 } from './chunk-
|
|
2
|
-
import { parseAssetRef } from './chunk-
|
|
1
|
+
import { compositeSha256 } from './chunk-23SG4JRV.js';
|
|
2
|
+
import { parseAssetRef } from './chunk-V5KG6CCV.js';
|
|
3
3
|
import { createHash } from 'crypto';
|
|
4
4
|
import { openSync, fstatSync, readSync, chmodSync, closeSync } from 'fs';
|
|
5
5
|
import { rm, mkdir, writeFile, chmod } from 'fs/promises';
|
|
@@ -146,5 +146,5 @@ async function installFlat(manifest, targetDir, fetcher) {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
export { assertSafeManifestPath, installFromManifest, isScriptBytes, longestCommonDirPrefix, restoreScriptModes };
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
150
|
-
//# sourceMappingURL=chunk-
|
|
149
|
+
//# sourceMappingURL=chunk-U6KRTCNA.js.map
|
|
150
|
+
//# sourceMappingURL=chunk-U6KRTCNA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../library/src/install/install-from-manifest.ts"],"names":[],"mappings":";;;;;;;AAiDO,SAAS,sBAAA,CAAuB,aAAqB,CAAA,EAAiB;AAC3E,EAAA,MAAM,MAAM,MAAa;AACvB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,yBAAA,EAA4B,CAAC,CAAA,CAAE,CAAA;AAAA,EACjD,CAAA;AACA,EAAA,IAAI,CAAC,CAAA,IAAK,CAAA,CAAE,MAAA,KAAW,GAAG,GAAA,EAAI;AAC9B,EAAA,IAAI,UAAA,CAAW,CAAC,CAAA,IAAK,CAAA,CAAE,UAAA,CAAW,GAAG,CAAA,IAAK,CAAA,CAAE,UAAA,CAAW,IAAI,CAAA,EAAG,GAAA,EAAI;AAClE,EAAA,MAAM,QAAA,GAAW,CAAA,CAAE,KAAA,CAAM,OAAO,CAAA;AAChC,EAAA,IAAI,SAAS,IAAA,CAAK,CAAC,MAAM,CAAA,KAAM,IAAI,GAAG,GAAA,EAAI;AAC1C,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,WAAA,EAAa,CAAC,CAAA;AACvC,EAAA,IAAI,QAAA,KAAa,eAAe,CAAC,QAAA,CAAS,WAAW,WAAA,GAAc,GAAG,GAAG,GAAA,EAAI;AAC/E;AAgBA,SAAS,sBAAA,CAAuB,MAAc,KAAA,EAAqB;AAIjE,EAAA,MAAM,cAAA,GAAiB,CAAC,GAAG,KAAK,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,CAAC,CAAA,GAAI,EAAI,CAAA;AACpE,EAAA,IAAI,CAAC,KAAA,IAAS,KAAA,CAAM,UAAA,CAAW,GAAG,KAAK,OAAA,CAAQ,IAAA,C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AM,CAAA,8BAAA,EAAiC,CAAA,CAAE,IAAI,CAAA,CAAE,CAAA;AACnE,IAAA,MAAM,MAAA,GAAS,WAAW,QAAQ,CAAA,CAAE,OAAO,GAAG,CAAA,CAAE,OAAO,KAAK,CAAA;AAC5D,IAAA,IAAI,MAAA,KAAW,EAAE,MAAA,EAAQ;AACvB,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,kBAAA,EAAqB,CAAA,CAAE,IAAI,cAAc,CAAA,CAAE,MAAM,CAAA,MAAA,EAAS,MAAM,CAAA,CAAE,CAAA;AAAA,IACpF;AACA,IAAA,MAAM,OAAA,GAAU,YAAY,CAAA,CAAE,IAAA,CAAK,MAAM,SAAA,CAAU,MAAA,GAAS,CAAC,CAAA,GAAI,CAAA,CAAE,IAAA;AAEnE,IAAA,sBAAA,CAAuB,QAAQ,OAAO,CAAA;AACtC,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,MAAA,EAAQ,OAAO,CAAA;AACjC,IAAA,MAAM,MAAM,OAAA,CAAQ,IAAI,GAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AAC9C,IAAA,MAAM,SAAA,CAAU,MAAM,GAAG,CAAA;AACzB,IAAA,IAAI,cAAc,GAAG,CAAA,EAAG,MAAM,KAAA,CAAM,MAAM,eAAe,CAAA;AAAA,EAC3D;AAEA,EAAA,OAAO,EAAE,aAAa,MAAA,EAAO;AAC/B","file":"chunk-E5NQRHEB.js","sourcesContent":["/**\n * Pointer-only install path.\n *\n * Given an {@link InstallManifest} (the Pointer Triple the Catalog hands\n * clients), this:\n *\n * 1. fetches the asset bytes directly from the upstream repo at the pinned\n * commit (via an injectable fetcher, default {@link fetchAssetFilesFromGitHub});\n * 2. verifies EVERY per-file SHA256 against `manifest.files[].sha256`;\n * 3. verifies the composite SHA256 rollup over the sorted\n * `<path>:<sha256>\\n` lines against `manifest.sha256`;\n * 4. writes the verified bytes under `<libraryRoot>/@<publisher>/<name>/<version>`.\n *\n * Any hash mismatch is a hard failure — bytes are not written if per-file\n * verification fails, and the composite check is the second gate.\n *\n * @docLink packages/library/concepts#install\n */\n\nimport { createHash } from \"node:crypto\";\nimport { chmodSync, closeSync, fstatSync, openSync, readSync } from \"node:fs\";\nimport { chmod, mkdir, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, join, resolve, sep } from \"node:path\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\n// Narrow module, not the `core` barrel: the barrel's chunks carry `import.meta`,\n// which breaks consumers that transpile this entry to CommonJS.\nimport { parseAssetRef } from \"../../../core/src/models.js\";\nimport { compositeSha256 } from \"../../../core/src/publish-manifest.js\";\n\n/**\n * Validate a single manifest-supplied file path against path traversal.\n *\n * `manifest.files[].path` comes off the network — the attacker controls the\n * entire manifest (and therefore every hash in it), so hash verification can\n * NEVER mitigate a malicious *destination*. A path like\n * `../../../../home/user/.bashrc` or an absolute path would escape\n * `installPath` and yield an arbitrary file write. Every path is checked\n * BEFORE any fetch or write happens; the first bad path aborts the entire\n * install with a hard throw.\n *\n * A path is rejected if ANY of:\n * - it is empty;\n * - it is absolute (`path.isAbsolute`) or has a leading slash;\n * - it contains a `..` segment;\n * - `path.resolve(installPath, p)` is not `installPath` itself and does not\n * start with `installPath + path.sep` (escapes the install dir).\n *\n * @throws An error matching `/unsafe path in manifest/` on the first bad path.\n */\nexport function assertSafeManifestPath(installPath: string, p: string): void {\n const bad = (): never => {\n throw new Error(`unsafe path in manifest: ${p}`);\n };\n if (!p || p.length === 0) bad();\n if (isAbsolute(p) || p.startsWith(\"/\") || p.startsWith(\"\\\\\")) bad();\n const segments = p.split(/[/\\\\]/);\n if (segments.some((s) => s === \"..\")) bad();\n const resolved = resolve(installPath, p);\n if (resolved !== installPath && !resolved.startsWith(installPath + sep)) bad();\n}\n\n/**\n * Validate one component (publisher / name / version) of the attacker-controlled\n * `manifest.ref`.\n *\n * `installPath` is built by joining these components onto `libraryRoot`. A\n * component containing a path separator or a `..` / leading-dot segment would\n * let `installPath` itself escape `libraryRoot` — yielding an arbitrary file\n * write AND, via the pre-write `rm(installPath, { recursive })`, an arbitrary\n * recursive delete. The per-file `assertSafeManifestPath` guard cannot catch\n * this: it only validates each `f.path` *relative to* `installPath`, never\n * `installPath` itself. Components must be plain identifier-like strings.\n *\n * @throws An error matching `/unsafe ref/` on a bad component.\n */\nfunction assertSafeRefComponent(kind: string, value: string): void {\n // Reject empty, leading-dot (covers `.` and `..`), path separators, and\n // ASCII control characters (NUL et al.) — fails a malformed segment fast\n // with a domain-specific error rather than a raw EINVAL deeper in.\n const hasControlChar = [...value].some((c) => c.charCodeAt(0) < 0x20);\n if (!value || value.startsWith(\".\") || /[/\\\\]/.test(value) || hasControlChar) {\n throw new Error(`unsafe ref ${kind} component in manifest: '${value}'`);\n }\n}\n\n/**\n * Longest common **directory** prefix across manifest paths, compared by whole\n * slash-delimited segments (never raw-string — so `app/` and `app-data/` never\n * collide). Each path's basename is excluded, so the result is always a\n * directory prefix and every path keeps a non-empty remainder after stripping.\n *\n * Used by flat mode to reproduce the platform pointer-installer's asset-rooting:\n * the store persists repo-root-relative paths (e.g. `skaile-platform/mcpo/xls/MCP.md`)\n * but the runner scans `.skaile/assets/<kind>/<name>/` for immediate-child files,\n * so this prefix is stripped from the WRITE path while the fetch keeps the full\n * repo path. Returns `''` when there is no common directory (a no-op strip).\n */\nexport function longestCommonDirPrefix(paths: readonly string[]): string {\n if (paths.length === 0) return \"\";\n const dirSegments = paths.map((p) => p.split(\"/\").slice(0, -1));\n let common = dirSegments[0]!;\n for (let i = 1; i < dirSegments.length && common.length > 0; i++) {\n const segs = dirSegments[i]!;\n let n = 0;\n while (n < common.length && n < segs.length && common[n] === segs[n]) n++;\n common = common.slice(0, n);\n }\n return common.join(\"/\");\n}\n\n/**\n * Whether `bytes` start a script (`#!`). A pointer manifest and GitHub's raw host carry no file\n * modes, while the library or clone the same asset comes from keeps its script executable, so a\n * shebang is what marks a file executable here (p1657).\n */\nexport function isScriptBytes(bytes: Uint8Array): boolean {\n return bytes.length >= 2 && bytes[0] === 0x23 && bytes[1] === 0x21;\n}\n\n/** The mode of an executable file written from store bytes. */\nconst EXECUTABLE_MODE = 0o755;\n\n/**\n * Make every file of `relPaths` under `root` that starts with `#!` executable. For bytes an\n * earlier install already wrote (a project store cache from before exec bits were kept), so a\n * restore from them deploys the same modes as a fresh fetch. A missing or unreadable file is\n * skipped.\n */\nexport function restoreScriptModes(root: string, relPaths: readonly string[]): void {\n for (const rel of relPaths) {\n let fd: number | undefined;\n try {\n fd = openSync(join(root, rel), \"r\");\n if ((fstatSync(fd).mode & 0o111) !== 0) continue;\n const head = Buffer.alloc(2);\n if (readSync(fd, head, 0, 2, 0) === 2 && isScriptBytes(head)) {\n chmodSync(join(root, rel), EXECUTABLE_MODE);\n }\n } catch {\n // Not readable or not a file: nothing to fix.\n } finally {\n if (fd !== undefined) closeSync(fd);\n }\n }\n}\n\n/**\n * Fetcher signature — fetches `{ path → Buffer }` for the requested paths at\n * a pinned upstream commit. {@link fetchAssetFilesFromGitHub} is the default\n * production implementation; tests inject a mock.\n */\nexport type AssetFetcher = (opts: {\n url: string;\n commitSha: string;\n paths: string[];\n}) => Promise<Record<string, Buffer>>;\n\n/**\n * Options for {@link installFromManifest}.\n */\nexport interface InstallOpts {\n /** The pointer-only install manifest from the Catalog. */\n manifest: InstallManifest;\n /** Filesystem root the asset is installed under (ref-derived mode). */\n libraryRoot: string;\n /**\n * Pluggable fetcher so tests can inject mock data. Defaults to\n * {@link fetchAssetFilesFromGitHub} in production.\n */\n fetcher?: AssetFetcher;\n /**\n * Flat-layout mode. When set, install-core reproduces the platform\n * pointer-installer's behavior: it ignores `libraryRoot`/ref-derivation, does\n * NOT parse `manifest.ref` and does NOT verify the composite sha256, strips\n * the longest-common-dir prefix from each path, per-file sha256-verifies, and\n * writes the stripped paths as immediate children of `targetDir` (what the\n * runner's `.skaile/assets/<kind>/<name>/` scan requires). `installPath` is\n * `targetDir`. Absent → unchanged ref-derived `@<pub>/name/version/<path>`\n * layout with composite verify.\n */\n targetDir?: string;\n}\n\n/**\n * Result of a successful {@link installFromManifest} call.\n */\nexport interface InstallResult {\n /** Absolute path the asset files were written to. */\n installPath: string;\n}\n\n/**\n * Fetch, verify, and write an asset's files per its {@link InstallManifest}.\n *\n * @throws An error matching `/hash mismatch/i` if any per-file SHA256 differs.\n * @throws An error matching `/composite hash mismatch/i` if the rollup differs.\n * @throws An error if the ref is malformed or the fetcher omits a file.\n */\nexport async function installFromManifest(opts: InstallOpts): Promise<InstallResult> {\n const { manifest, libraryRoot } = opts;\n const fetcher =\n opts.fetcher ?? (await import(\"./source-fetch-github.js\")).fetchAssetFilesFromGitHub;\n\n // Flat mode: reproduce the platform pointer-installer's asset-rooted layout.\n // No ref parse, no composite verify — the platform store may not satisfy a\n // ref-grammar or composite, and the runner only needs immediate-child files.\n if (opts.targetDir !== undefined) {\n return installFlat(manifest, opts.targetDir, fetcher);\n }\n\n // 1. Parse ref into install path: `skill:@x/git#1.0.0` → `<root>/@x/git/1.0.0`.\n // Done first so the C1 path-traversal guard can resolve against installPath\n // BEFORE any network fetch happens. The ref is attacker-controlled, so each\n // segment is further validated as a safe path component (H1) after parsing.\n // `parseAssetRef` is the single canonical grammar (`kind:@publisher/name#version`);\n // the legacy trailing-`@version` shape was removed in core and is rejected here.\n let parsed: ReturnType<typeof parseAssetRef>;\n try {\n parsed = parseAssetRef(manifest.ref);\n } catch (e) {\n throw new Error(`invalid ref: ${manifest.ref}: ${e instanceof Error ? e.message : String(e)}`);\n }\n const publisher = parsed.publisher;\n const name = parsed.name;\n const version = parsed.pin;\n if (!publisher) throw new Error(`invalid ref: ${manifest.ref} (missing publisher)`);\n if (!version) throw new Error(`invalid ref: ${manifest.ref} (missing version pin)`);\n assertSafeRefComponent(\"publisher\", publisher);\n assertSafeRefComponent(\"name\", name);\n assertSafeRefComponent(\"version\", version);\n const root = resolve(libraryRoot);\n const installPath = resolve(join(root, `@${publisher}`, name, version));\n // Defense in depth: even with the segment guards above, assert the built\n // installPath stays strictly inside libraryRoot before any write or `rm`.\n if (installPath !== root && !installPath.startsWith(root + sep)) {\n throw new Error(`unsafe install path: ref '${manifest.ref}' resolves outside the library root`);\n }\n\n // 2. [C1] Validate EVERY manifest path against traversal BEFORE fetching.\n // The attacker controls the manifest (and thus all hashes) — hashes verify\n // content, never destination. Reject the whole install on the first bad path.\n for (const f of manifest.files) {\n assertSafeManifestPath(installPath, f.path);\n }\n\n // 3. Fetch all files at the pinned commit.\n const paths = manifest.files.map((f) => f.path);\n const bytes = await fetcher({\n url: manifest.source.url,\n commitSha: manifest.source.commitSha,\n paths,\n });\n\n // 4. Verify per-file SHA256 — hard fail before writing anything. The path\n // key used to read from the fetcher result is re-guarded as defense in depth.\n for (const f of manifest.files) {\n assertSafeManifestPath(installPath, f.path);\n const buf = bytes[f.path];\n if (!buf) throw new Error(`fetcher returned no bytes for ${f.path}`);\n const actual = createHash(\"sha256\").update(buf).digest(\"hex\");\n if (actual !== f.sha256) {\n throw new Error(`hash mismatch for ${f.path}: expected ${f.sha256}, got ${actual}`);\n }\n }\n\n // 5. Verify composite SHA256 over the sorted `<path>:<sha256>\\n` lines.\n const actualComposite = compositeSha256(manifest.files);\n if (actualComposite !== manifest.sha256) {\n throw new Error(`composite hash mismatch: expected ${manifest.sha256}, got ${actualComposite}`);\n }\n\n // 6. [M1] Write all verified files. A failed install must leave NO partial\n // directory: any prior `installPath` is removed first (clean overwrite), and\n // a mid-loop write failure removes the partially-written tree before\n // rethrowing.\n await rm(installPath, { recursive: true, force: true });\n try {\n for (const f of manifest.files) {\n const target = join(installPath, f.path);\n await mkdir(dirname(target), { recursive: true });\n await writeFile(target, bytes[f.path]!);\n if (isScriptBytes(bytes[f.path]!)) await chmod(target, EXECUTABLE_MODE);\n }\n } catch (e) {\n await rm(installPath, { recursive: true, force: true }).catch(() => {});\n throw e;\n }\n\n return { installPath };\n}\n\n/**\n * Flat-layout install — the platform pointer-installer's behavior, made canonical\n * in install-core. Validates every path, fetches with the FULL repo paths, per-file\n * sha256-verifies, then strips the longest-common-dir prefix and writes each file\n * as `join(targetDir, path.slice(assetRoot.length + 1))` — immediate children of\n * `targetDir`. No ref parse, no composite check.\n */\nasync function installFlat(\n manifest: InstallManifest,\n targetDir: string,\n fetcher: AssetFetcher,\n): Promise<InstallResult> {\n const target = resolve(targetDir);\n\n // Gate every path before any fetch — the attacker controls the whole manifest.\n for (const f of manifest.files) {\n assertSafeManifestPath(target, f.path);\n }\n\n // Fetch keys off the FULL repo path (matches the upstream tree).\n const paths = manifest.files.map((f) => f.path);\n const bytes = await fetcher({\n url: manifest.source.url,\n commitSha: manifest.source.commitSha,\n paths,\n });\n\n // Strip the asset-root dir prefix from the WRITE path only — the fetch above\n // still keyed off the full repo path. Stripping removes leading whole segments\n // (never the basename), so a non-empty remainder always survives.\n const assetRoot = longestCommonDirPrefix(paths);\n\n for (const f of manifest.files) {\n const buf = bytes[f.path];\n if (!buf) throw new Error(`fetcher returned no bytes for ${f.path}`);\n const actual = createHash(\"sha256\").update(buf).digest(\"hex\");\n if (actual !== f.sha256) {\n throw new Error(`hash mismatch for ${f.path}: expected ${f.sha256}, got ${actual}`);\n }\n const relPath = assetRoot ? f.path.slice(assetRoot.length + 1) : f.path;\n // Re-guard the post-strip destination — it is what we actually write.\n assertSafeManifestPath(target, relPath);\n const dest = join(target, relPath);\n await mkdir(dirname(dest), { recursive: true });\n await writeFile(dest, buf);\n if (isScriptBytes(buf)) await chmod(dest, EXECUTABLE_MODE);\n }\n\n return { installPath: target };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../library/src/install/install-from-manifest.ts"],"names":[],"mappings":";;;;;;;AAiDO,SAAS,sBAAA,CAAuB,aAAqB,CAAA,EAAiB;AAC3E,EAAA,MAAM,MAAM,MAAa;AACvB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,yBAAA,EAA4B,CAAC,CAAA,CAAE,CAAA;AAAA,EACjD,CAAA;AACA,EAAA,IAAI,CAAC,CAAA,IA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CAAU,MAAA,GAAS,CAAC,CAAA,GAAI,CAAA,CAAE,IAAA;AAEnE,IAAA,sBAAA,CAAuB,QAAQ,OAAO,CAAA;AACtC,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,MAAA,EAAQ,OAAO,CAAA;AACjC,IAAA,MAAM,MAAM,OAAA,CAAQ,IAAI,GAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AAC9C,IAAA,MAAM,SAAA,CAAU,MAAM,GAAG,CAAA;AACzB,IAAA,IAAI,cAAc,GAAG,CAAA,EAAG,MAAM,KAAA,CAAM,MAAM,eAAe,CAAA;AAAA,EAC3D;AAEA,EAAA,OAAO,EAAE,aAAa,MAAA,EAAO;AAC/B","file":"chunk-U6KRTCNA.js","sourcesContent":["/**\n * Pointer-only install path.\n *\n * Given an {@link InstallManifest} (the Pointer Triple the Catalog hands\n * clients), this:\n *\n * 1. fetches the asset bytes directly from the upstream repo at the pinned\n * commit (via an injectable fetcher, default {@link fetchAssetFilesFromGitHub});\n * 2. verifies EVERY per-file SHA256 against `manifest.files[].sha256`;\n * 3. verifies the composite SHA256 rollup over the sorted\n * `<path>:<sha256>\\n` lines against `manifest.sha256`;\n * 4. writes the verified bytes under `<libraryRoot>/@<publisher>/<name>/<version>`.\n *\n * Any hash mismatch is a hard failure — bytes are not written if per-file\n * verification fails, and the composite check is the second gate.\n *\n * @docLink packages/library/concepts#install\n */\n\nimport { createHash } from \"node:crypto\";\nimport { chmodSync, closeSync, fstatSync, openSync, readSync } from \"node:fs\";\nimport { chmod, mkdir, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, join, resolve, sep } from \"node:path\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\n// Narrow module, not the `core` barrel: the barrel's chunks carry `import.meta`,\n// which breaks consumers that transpile this entry to CommonJS.\nimport { parseAssetRef } from \"../../../core/src/models.js\";\nimport { compositeSha256 } from \"../../../core/src/publish-manifest.js\";\n\n/**\n * Validate a single manifest-supplied file path against path traversal.\n *\n * `manifest.files[].path` comes off the network — the attacker controls the\n * entire manifest (and therefore every hash in it), so hash verification can\n * NEVER mitigate a malicious *destination*. A path like\n * `../../../../home/user/.bashrc` or an absolute path would escape\n * `installPath` and yield an arbitrary file write. Every path is checked\n * BEFORE any fetch or write happens; the first bad path aborts the entire\n * install with a hard throw.\n *\n * A path is rejected if ANY of:\n * - it is empty;\n * - it is absolute (`path.isAbsolute`) or has a leading slash;\n * - it contains a `..` segment;\n * - `path.resolve(installPath, p)` is not `installPath` itself and does not\n * start with `installPath + path.sep` (escapes the install dir).\n *\n * @throws An error matching `/unsafe path in manifest/` on the first bad path.\n */\nexport function assertSafeManifestPath(installPath: string, p: string): void {\n const bad = (): never => {\n throw new Error(`unsafe path in manifest: ${p}`);\n };\n if (!p || p.length === 0) bad();\n if (isAbsolute(p) || p.startsWith(\"/\") || p.startsWith(\"\\\\\")) bad();\n const segments = p.split(/[/\\\\]/);\n if (segments.some((s) => s === \"..\")) bad();\n const resolved = resolve(installPath, p);\n if (resolved !== installPath && !resolved.startsWith(installPath + sep)) bad();\n}\n\n/**\n * Validate one component (publisher / name / version) of the attacker-controlled\n * `manifest.ref`.\n *\n * `installPath` is built by joining these components onto `libraryRoot`. A\n * component containing a path separator or a `..` / leading-dot segment would\n * let `installPath` itself escape `libraryRoot` — yielding an arbitrary file\n * write AND, via the pre-write `rm(installPath, { recursive })`, an arbitrary\n * recursive delete. The per-file `assertSafeManifestPath` guard cannot catch\n * this: it only validates each `f.path` *relative to* `installPath`, never\n * `installPath` itself. Components must be plain identifier-like strings.\n *\n * @throws An error matching `/unsafe ref/` on a bad component.\n */\nfunction assertSafeRefComponent(kind: string, value: string): void {\n // Reject empty, leading-dot (covers `.` and `..`), path separators, and\n // ASCII control characters (NUL et al.) — fails a malformed segment fast\n // with a domain-specific error rather than a raw EINVAL deeper in.\n const hasControlChar = [...value].some((c) => c.charCodeAt(0) < 0x20);\n if (!value || value.startsWith(\".\") || /[/\\\\]/.test(value) || hasControlChar) {\n throw new Error(`unsafe ref ${kind} component in manifest: '${value}'`);\n }\n}\n\n/**\n * Longest common **directory** prefix across manifest paths, compared by whole\n * slash-delimited segments (never raw-string — so `app/` and `app-data/` never\n * collide). Each path's basename is excluded, so the result is always a\n * directory prefix and every path keeps a non-empty remainder after stripping.\n *\n * Used by flat mode to reproduce the platform pointer-installer's asset-rooting:\n * the store persists repo-root-relative paths (e.g. `skaile-platform/mcpo/xls/MCP.md`)\n * but the runner scans `.skaile/assets/<kind>/<name>/` for immediate-child files,\n * so this prefix is stripped from the WRITE path while the fetch keeps the full\n * repo path. Returns `''` when there is no common directory (a no-op strip).\n */\nexport function longestCommonDirPrefix(paths: readonly string[]): string {\n if (paths.length === 0) return \"\";\n const dirSegments = paths.map((p) => p.split(\"/\").slice(0, -1));\n let common = dirSegments[0]!;\n for (let i = 1; i < dirSegments.length && common.length > 0; i++) {\n const segs = dirSegments[i]!;\n let n = 0;\n while (n < common.length && n < segs.length && common[n] === segs[n]) n++;\n common = common.slice(0, n);\n }\n return common.join(\"/\");\n}\n\n/**\n * Whether `bytes` start a script (`#!`). A pointer manifest and GitHub's raw host carry no file\n * modes, while the library or clone the same asset comes from keeps its script executable, so a\n * shebang is what marks a file executable here (p1657).\n */\nexport function isScriptBytes(bytes: Uint8Array): boolean {\n return bytes.length >= 2 && bytes[0] === 0x23 && bytes[1] === 0x21;\n}\n\n/** The mode of an executable file written from store bytes. */\nconst EXECUTABLE_MODE = 0o755;\n\n/**\n * Make every file of `relPaths` under `root` that starts with `#!` executable. For bytes an\n * earlier install already wrote (a project store cache from before exec bits were kept), so a\n * restore from them deploys the same modes as a fresh fetch. A missing or unreadable file is\n * skipped.\n */\nexport function restoreScriptModes(root: string, relPaths: readonly string[]): void {\n for (const rel of relPaths) {\n let fd: number | undefined;\n try {\n fd = openSync(join(root, rel), \"r\");\n if ((fstatSync(fd).mode & 0o111) !== 0) continue;\n const head = Buffer.alloc(2);\n if (readSync(fd, head, 0, 2, 0) === 2 && isScriptBytes(head)) {\n chmodSync(join(root, rel), EXECUTABLE_MODE);\n }\n } catch {\n // Not readable or not a file: nothing to fix.\n } finally {\n if (fd !== undefined) closeSync(fd);\n }\n }\n}\n\n/**\n * Fetcher signature — fetches `{ path → Buffer }` for the requested paths at\n * a pinned upstream commit. {@link fetchAssetFilesFromGitHub} is the default\n * production implementation; tests inject a mock.\n */\nexport type AssetFetcher = (opts: {\n url: string;\n commitSha: string;\n paths: string[];\n}) => Promise<Record<string, Buffer>>;\n\n/**\n * Options for {@link installFromManifest}.\n */\nexport interface InstallOpts {\n /** The pointer-only install manifest from the Catalog. */\n manifest: InstallManifest;\n /** Filesystem root the asset is installed under (ref-derived mode). */\n libraryRoot: string;\n /**\n * Pluggable fetcher so tests can inject mock data. Defaults to\n * {@link fetchAssetFilesFromGitHub} in production.\n */\n fetcher?: AssetFetcher;\n /**\n * Flat-layout mode. When set, install-core reproduces the platform\n * pointer-installer's behavior: it ignores `libraryRoot`/ref-derivation, does\n * NOT parse `manifest.ref` and does NOT verify the composite sha256, strips\n * the longest-common-dir prefix from each path, per-file sha256-verifies, and\n * writes the stripped paths as immediate children of `targetDir` (what the\n * runner's `.skaile/assets/<kind>/<name>/` scan requires). `installPath` is\n * `targetDir`. Absent → unchanged ref-derived `@<pub>/name/version/<path>`\n * layout with composite verify.\n */\n targetDir?: string;\n}\n\n/**\n * Result of a successful {@link installFromManifest} call.\n */\nexport interface InstallResult {\n /** Absolute path the asset files were written to. */\n installPath: string;\n}\n\n/**\n * Fetch, verify, and write an asset's files per its {@link InstallManifest}.\n *\n * @throws An error matching `/hash mismatch/i` if any per-file SHA256 differs.\n * @throws An error matching `/composite hash mismatch/i` if the rollup differs.\n * @throws An error if the ref is malformed or the fetcher omits a file.\n */\nexport async function installFromManifest(opts: InstallOpts): Promise<InstallResult> {\n const { manifest, libraryRoot } = opts;\n const fetcher =\n opts.fetcher ?? (await import(\"./source-fetch-github.js\")).fetchAssetFilesFromGitHub;\n\n // Flat mode: reproduce the platform pointer-installer's asset-rooted layout.\n // No ref parse, no composite verify — the platform store may not satisfy a\n // ref-grammar or composite, and the runner only needs immediate-child files.\n if (opts.targetDir !== undefined) {\n return installFlat(manifest, opts.targetDir, fetcher);\n }\n\n // 1. Parse ref into install path: `skill:@x/git#1.0.0` → `<root>/@x/git/1.0.0`.\n // Done first so the C1 path-traversal guard can resolve against installPath\n // BEFORE any network fetch happens. The ref is attacker-controlled, so each\n // segment is further validated as a safe path component (H1) after parsing.\n // `parseAssetRef` is the single canonical grammar (`kind:@publisher/name#version`);\n // the legacy trailing-`@version` shape was removed in core and is rejected here.\n let parsed: ReturnType<typeof parseAssetRef>;\n try {\n parsed = parseAssetRef(manifest.ref);\n } catch (e) {\n throw new Error(`invalid ref: ${manifest.ref}: ${e instanceof Error ? e.message : String(e)}`);\n }\n const publisher = parsed.publisher;\n const name = parsed.name;\n const version = parsed.pin;\n if (!publisher) throw new Error(`invalid ref: ${manifest.ref} (missing publisher)`);\n if (!version) throw new Error(`invalid ref: ${manifest.ref} (missing version pin)`);\n assertSafeRefComponent(\"publisher\", publisher);\n assertSafeRefComponent(\"name\", name);\n assertSafeRefComponent(\"version\", version);\n const root = resolve(libraryRoot);\n const installPath = resolve(join(root, `@${publisher}`, name, version));\n // Defense in depth: even with the segment guards above, assert the built\n // installPath stays strictly inside libraryRoot before any write or `rm`.\n if (installPath !== root && !installPath.startsWith(root + sep)) {\n throw new Error(`unsafe install path: ref '${manifest.ref}' resolves outside the library root`);\n }\n\n // 2. [C1] Validate EVERY manifest path against traversal BEFORE fetching.\n // The attacker controls the manifest (and thus all hashes) — hashes verify\n // content, never destination. Reject the whole install on the first bad path.\n for (const f of manifest.files) {\n assertSafeManifestPath(installPath, f.path);\n }\n\n // 3. Fetch all files at the pinned commit.\n const paths = manifest.files.map((f) => f.path);\n const bytes = await fetcher({\n url: manifest.source.url,\n commitSha: manifest.source.commitSha,\n paths,\n });\n\n // 4. Verify per-file SHA256 — hard fail before writing anything. The path\n // key used to read from the fetcher result is re-guarded as defense in depth.\n for (const f of manifest.files) {\n assertSafeManifestPath(installPath, f.path);\n const buf = bytes[f.path];\n if (!buf) throw new Error(`fetcher returned no bytes for ${f.path}`);\n const actual = createHash(\"sha256\").update(buf).digest(\"hex\");\n if (actual !== f.sha256) {\n throw new Error(`hash mismatch for ${f.path}: expected ${f.sha256}, got ${actual}`);\n }\n }\n\n // 5. Verify composite SHA256 over the sorted `<path>:<sha256>\\n` lines.\n const actualComposite = compositeSha256(manifest.files);\n if (actualComposite !== manifest.sha256) {\n throw new Error(`composite hash mismatch: expected ${manifest.sha256}, got ${actualComposite}`);\n }\n\n // 6. [M1] Write all verified files. A failed install must leave NO partial\n // directory: any prior `installPath` is removed first (clean overwrite), and\n // a mid-loop write failure removes the partially-written tree before\n // rethrowing.\n await rm(installPath, { recursive: true, force: true });\n try {\n for (const f of manifest.files) {\n const target = join(installPath, f.path);\n await mkdir(dirname(target), { recursive: true });\n await writeFile(target, bytes[f.path]!);\n if (isScriptBytes(bytes[f.path]!)) await chmod(target, EXECUTABLE_MODE);\n }\n } catch (e) {\n await rm(installPath, { recursive: true, force: true }).catch(() => {});\n throw e;\n }\n\n return { installPath };\n}\n\n/**\n * Flat-layout install — the platform pointer-installer's behavior, made canonical\n * in install-core. Validates every path, fetches with the FULL repo paths, per-file\n * sha256-verifies, then strips the longest-common-dir prefix and writes each file\n * as `join(targetDir, path.slice(assetRoot.length + 1))` — immediate children of\n * `targetDir`. No ref parse, no composite check.\n */\nasync function installFlat(\n manifest: InstallManifest,\n targetDir: string,\n fetcher: AssetFetcher,\n): Promise<InstallResult> {\n const target = resolve(targetDir);\n\n // Gate every path before any fetch — the attacker controls the whole manifest.\n for (const f of manifest.files) {\n assertSafeManifestPath(target, f.path);\n }\n\n // Fetch keys off the FULL repo path (matches the upstream tree).\n const paths = manifest.files.map((f) => f.path);\n const bytes = await fetcher({\n url: manifest.source.url,\n commitSha: manifest.source.commitSha,\n paths,\n });\n\n // Strip the asset-root dir prefix from the WRITE path only — the fetch above\n // still keyed off the full repo path. Stripping removes leading whole segments\n // (never the basename), so a non-empty remainder always survives.\n const assetRoot = longestCommonDirPrefix(paths);\n\n for (const f of manifest.files) {\n const buf = bytes[f.path];\n if (!buf) throw new Error(`fetcher returned no bytes for ${f.path}`);\n const actual = createHash(\"sha256\").update(buf).digest(\"hex\");\n if (actual !== f.sha256) {\n throw new Error(`hash mismatch for ${f.path}: expected ${f.sha256}, got ${actual}`);\n }\n const relPath = assetRoot ? f.path.slice(assetRoot.length + 1) : f.path;\n // Re-guard the post-strip destination — it is what we actually write.\n assertSafeManifestPath(target, relPath);\n const dest = join(target, relPath);\n await mkdir(dirname(dest), { recursive: true });\n await writeFile(dest, buf);\n if (isScriptBytes(buf)) await chmod(dest, EXECUTABLE_MODE);\n }\n\n return { installPath: target };\n}\n"]}
|