@skaile/workspaces 5.9.0 → 5.11.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 +145 -0
- package/README.md +12 -0
- package/dist/{asset-feeds-XMKKUUK6.js → asset-feeds-CXGQIDFR.js} +19 -19
- package/dist/{asset-feeds-XMKKUUK6.js.map → asset-feeds-CXGQIDFR.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +8 -8
- package/dist/asset-manager/index.js +14 -14
- package/dist/asset-manager/installer.js +10 -10
- package/dist/asset-manager/renderers.js +9 -9
- package/dist/asset-manager/src/index.d.ts +400 -35
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/install-agent.d.ts +3 -1
- package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
- package/dist/asset-manager/src/install-instances.d.ts +31 -1
- package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts +43 -3
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/asset-manager/src/renderers.d.ts +4 -5
- package/dist/asset-manager/src/renderers.d.ts.map +1 -1
- package/dist/bridge/drivers/claude-sdk.js +11 -11
- package/dist/bridge/drivers/codex.js +11 -11
- package/dist/bridge/drivers/continue.js +10 -10
- package/dist/bridge/drivers/echo.js +2 -2
- package/dist/bridge/drivers/gemini.js +7 -7
- package/dist/bridge/drivers/goose.js +10 -10
- package/dist/bridge/drivers/omp.js +19 -3
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +10 -10
- package/dist/bridge/drivers/qwen.js +7 -7
- package/dist/bridge/index.js +12 -12
- package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
- package/dist/{chunk-4MQS7CAF.js → chunk-2F5AWQX5.js} +437 -175
- package/dist/chunk-2F5AWQX5.js.map +1 -0
- package/dist/{chunk-UM7RIAHO.js → chunk-3SM2DL2T.js} +8 -8
- package/dist/{chunk-UM7RIAHO.js.map → chunk-3SM2DL2T.js.map} +1 -1
- package/dist/{chunk-5NNNV76P.js → chunk-47U4GZ4M.js} +2 -2
- package/dist/{chunk-5NNNV76P.js.map → chunk-47U4GZ4M.js.map} +1 -1
- package/dist/{chunk-TTRYE6AC.js → chunk-4A4OD24G.js} +9 -9
- package/dist/{chunk-TTRYE6AC.js.map → chunk-4A4OD24G.js.map} +1 -1
- package/dist/{chunk-ZTBAYUDY.js → chunk-6O2X3GPW.js} +2 -2
- package/dist/{chunk-ZTBAYUDY.js.map → chunk-6O2X3GPW.js.map} +1 -1
- package/dist/{chunk-JAKOMFC6.js → chunk-ALEYHUC5.js} +114 -46
- package/dist/chunk-ALEYHUC5.js.map +1 -0
- package/dist/{chunk-QVNRCDTV.js → chunk-BNMZVPYA.js} +7 -7
- package/dist/chunk-BNMZVPYA.js.map +1 -0
- package/dist/{chunk-2FRUUDZY.js → chunk-CAHB6MHA.js} +5 -5
- package/dist/{chunk-2FRUUDZY.js.map → chunk-CAHB6MHA.js.map} +1 -1
- package/dist/{chunk-GKMZ6THE.js → chunk-CJERAGFY.js} +44 -33
- package/dist/chunk-CJERAGFY.js.map +1 -0
- package/dist/{chunk-CKQEIY43.js → chunk-COH6FQAG.js} +4 -4
- package/dist/{chunk-CKQEIY43.js.map → chunk-COH6FQAG.js.map} +1 -1
- package/dist/{chunk-UO7WPLDY.js → chunk-CPWLNZGJ.js} +3 -3
- package/dist/{chunk-UO7WPLDY.js.map → chunk-CPWLNZGJ.js.map} +1 -1
- package/dist/{chunk-MGGFBZWA.js → chunk-D3B36CYC.js} +4 -3
- package/dist/chunk-D3B36CYC.js.map +1 -0
- package/dist/{chunk-UMVKJM4Q.js → chunk-DALV4HHP.js} +18 -3
- package/dist/chunk-DALV4HHP.js.map +1 -0
- package/dist/{chunk-IMKSM5NL.js → chunk-DZMNFCWB.js} +1447 -199
- package/dist/chunk-DZMNFCWB.js.map +1 -0
- package/dist/{chunk-GB7WDMH2.js → chunk-EDYHEMJA.js} +4 -4
- package/dist/{chunk-GB7WDMH2.js.map → chunk-EDYHEMJA.js.map} +1 -1
- package/dist/{chunk-YSHVQGUS.js → chunk-FH7W6TJ4.js} +164 -41
- package/dist/chunk-FH7W6TJ4.js.map +1 -0
- package/dist/{chunk-W5DWWE4Y.js → chunk-G4FFOV3N.js} +4 -4
- package/dist/{chunk-W5DWWE4Y.js.map → chunk-G4FFOV3N.js.map} +1 -1
- package/dist/{chunk-2LWYNQK7.js → chunk-GCHPUTA3.js} +3 -3
- package/dist/{chunk-2LWYNQK7.js.map → chunk-GCHPUTA3.js.map} +1 -1
- package/dist/{chunk-JZ5EHBPI.js → chunk-GV4DZ6MT.js} +20 -4
- package/dist/chunk-GV4DZ6MT.js.map +1 -0
- package/dist/{chunk-S53LOR7B.js → chunk-HCEVNYSH.js} +3 -3
- package/dist/{chunk-S53LOR7B.js.map → chunk-HCEVNYSH.js.map} +1 -1
- package/dist/{chunk-EF7NPDDU.js → chunk-HZXUXHIV.js} +31 -17
- package/dist/chunk-HZXUXHIV.js.map +1 -0
- package/dist/{chunk-IR33D6EP.js → chunk-IER3KIPH.js} +5 -5
- package/dist/{chunk-IR33D6EP.js.map → chunk-IER3KIPH.js.map} +1 -1
- package/dist/{chunk-Y7QA2OLD.js → chunk-J4RBUFGM.js} +22 -20
- package/dist/chunk-J4RBUFGM.js.map +1 -0
- package/dist/{chunk-J7U3PIOE.js → chunk-M3B6EIJD.js} +4 -4
- package/dist/{chunk-J7U3PIOE.js.map → chunk-M3B6EIJD.js.map} +1 -1
- package/dist/{chunk-DNZYOKOJ.js → chunk-MZG34MBZ.js} +3 -3
- package/dist/{chunk-DNZYOKOJ.js.map → chunk-MZG34MBZ.js.map} +1 -1
- package/dist/{chunk-V2DXZYBB.js → chunk-NWDSLXOX.js} +3 -3
- package/dist/{chunk-V2DXZYBB.js.map → chunk-NWDSLXOX.js.map} +1 -1
- package/dist/{chunk-36AFURKZ.js → chunk-PBBPZYVG.js} +61 -12
- package/dist/chunk-PBBPZYVG.js.map +1 -0
- package/dist/{chunk-P67WJVP4.js → chunk-PQFHMQHQ.js} +10 -9
- package/dist/chunk-PQFHMQHQ.js.map +1 -0
- package/dist/{chunk-UAROCOXF.js → chunk-QVFAS5IO.js} +3 -3
- package/dist/{chunk-UAROCOXF.js.map → chunk-QVFAS5IO.js.map} +1 -1
- package/dist/{chunk-K3CVFRVS.js → chunk-QZNJOHN6.js} +3 -3
- package/dist/{chunk-K3CVFRVS.js.map → chunk-QZNJOHN6.js.map} +1 -1
- package/dist/{chunk-FVJK4QWM.js → chunk-R7NHYEJF.js} +4 -4
- package/dist/{chunk-FVJK4QWM.js.map → chunk-R7NHYEJF.js.map} +1 -1
- package/dist/{chunk-GXLQLPE5.js → chunk-RYYLMBA2.js} +5 -5
- package/dist/{chunk-GXLQLPE5.js.map → chunk-RYYLMBA2.js.map} +1 -1
- package/dist/{chunk-Y4N2NUZD.js → chunk-S3O3GKB7.js} +4 -4
- package/dist/{chunk-Y4N2NUZD.js.map → chunk-S3O3GKB7.js.map} +1 -1
- package/dist/{chunk-GTILM2CI.js → chunk-SBSA3IQA.js} +43 -12
- package/dist/chunk-SBSA3IQA.js.map +1 -0
- package/dist/{chunk-4PTSR4UU.js → chunk-T42WRQ4O.js} +3 -3
- package/dist/{chunk-4PTSR4UU.js.map → chunk-T42WRQ4O.js.map} +1 -1
- package/dist/{chunk-MR5HBOUF.js → chunk-T7CTHHG7.js} +3 -3
- package/dist/{chunk-MR5HBOUF.js.map → chunk-T7CTHHG7.js.map} +1 -1
- package/dist/{chunk-FZNG4V4J.js → chunk-TCHRMVTO.js} +4 -4
- package/dist/{chunk-FZNG4V4J.js.map → chunk-TCHRMVTO.js.map} +1 -1
- package/dist/{chunk-LAMCXQGA.js → chunk-VLTQGE2E.js} +75 -25
- package/dist/chunk-VLTQGE2E.js.map +1 -0
- package/dist/{chunk-7AI3Q5AQ.js → chunk-WSBKB4CJ.js} +71 -24
- package/dist/chunk-WSBKB4CJ.js.map +1 -0
- package/dist/{chunk-CGT45WN7.js → chunk-X77SUM4P.js} +3 -3
- package/dist/{chunk-CGT45WN7.js.map → chunk-X77SUM4P.js.map} +1 -1
- package/dist/{chunk-SCOT677Q.js → chunk-XDKH7XSA.js} +5 -5
- package/dist/{chunk-SCOT677Q.js.map → chunk-XDKH7XSA.js.map} +1 -1
- package/dist/{chunk-QVEKLSEH.js → chunk-XUSALIEI.js} +6 -6
- package/dist/{chunk-QVEKLSEH.js.map → chunk-XUSALIEI.js.map} +1 -1
- package/dist/{chunk-FYXZRVID.js → chunk-Y3HTGHJC.js} +3 -3
- package/dist/{chunk-FYXZRVID.js.map → chunk-Y3HTGHJC.js.map} +1 -1
- package/dist/chunk-YOH2L76X.js +505 -0
- package/dist/chunk-YOH2L76X.js.map +1 -0
- package/dist/{chunk-B6GIW55K.js → chunk-ZCAJZ4B2.js} +7 -4
- package/dist/chunk-ZCAJZ4B2.js.map +1 -0
- package/dist/{chunk-BTE2V4IW.js → chunk-ZPWTOUTK.js} +76 -7
- package/dist/{chunk-BTE2V4IW.js.map → chunk-ZPWTOUTK.js.map} +1 -1
- package/dist/cli/index.js +1034 -794
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts +8 -5
- package/dist/cli/src/commands/catalog.d.ts.map +1 -1
- package/dist/cli/src/commands/diff.d.ts +4 -2
- package/dist/cli/src/commands/diff.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 +34 -2
- package/dist/cli/src/commands/library-index.d.ts.map +1 -1
- package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
- package/dist/cli/src/commands/manage.d.ts +12 -5
- package/dist/cli/src/commands/manage.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
- package/dist/cli/src/commands/outdated.d.ts +7 -5
- package/dist/cli/src/commands/outdated.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts +13 -8
- 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/source.d.ts +30 -1
- 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.d.ts.map +1 -1
- package/dist/cli/src/commands/why.d.ts +1 -0
- package/dist/cli/src/commands/why.d.ts.map +1 -1
- package/dist/cli/src/helpers.d.ts +12 -0
- package/dist/cli/src/helpers.d.ts.map +1 -1
- package/dist/cli/src/skill-checks.d.ts +57 -4
- package/dist/cli/src/skill-checks.d.ts.map +1 -1
- package/dist/connectors/config.js +5 -5
- package/dist/connectors/index.js +16 -16
- package/dist/{connectors-C7UQ73BK.js → connectors-4QWAKPHB.js} +19 -19
- package/dist/{connectors-C7UQ73BK.js.map → connectors-4QWAKPHB.js.map} +1 -1
- package/dist/core/index.js +7 -7
- package/dist/core/logging.js +1 -1
- package/dist/core/manifest.js +2 -2
- package/dist/core/models.js +1 -1
- package/dist/core/publish-manifest.js +2 -2
- package/dist/core/ref.js +1 -1
- package/dist/core/runtime-assets.js +5 -5
- package/dist/core/src/index.d.ts +2 -1
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/lock.d.ts +6 -2
- package/dist/core/src/lock.d.ts.map +1 -1
- package/dist/core/src/logging/sinks/sqlite-runtime.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/models.d.ts +22 -6
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/src/publish-manifest.d.ts +29 -3
- package/dist/core/src/publish-manifest.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/requirements.d.ts +26 -0
- package/dist/core/src/requirements.d.ts.map +1 -0
- package/dist/core/src/walker.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +22 -1
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/src/workspace-yaml-editor.d.ts +4 -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 +7 -7
- package/dist/discovery/index.js +5 -5
- package/dist/discovery/src/builtin-providers.d.ts.map +1 -1
- package/dist/discovery/src/discover-manifest.d.ts.map +1 -1
- package/dist/discovery/src/discover.d.ts.map +1 -1
- package/dist/discovery/src/source-config.d.ts.map +1 -1
- package/dist/discovery/src/tree-entries.d.ts.map +1 -1
- package/dist/{ensure-sources-SRC2DVR5.js → ensure-sources-2RONZKCU.js} +17 -17
- package/dist/{ensure-sources-SRC2DVR5.js.map → ensure-sources-2RONZKCU.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +16 -16
- package/dist/factory-assets/connectors/deploy.js +16 -16
- package/dist/factory-assets/connectors/devserver.js +16 -16
- package/dist/factory-assets/connectors/flow/adapter.js +16 -16
- package/dist/factory-assets/connectors/flow/contract/normalize.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/contract.js +1 -1
- package/dist/factory-assets/connectors/flow/engine.js +9 -9
- package/dist/factory-assets/connectors/flow/run-flow.js +18 -18
- package/dist/factory-assets/connectors/flow.js +16 -16
- package/dist/factory-assets/connectors/git.js +16 -16
- package/dist/factory-assets/connectors/gmail.js +16 -16
- package/dist/factory-assets/connectors/googledrive.js +16 -16
- package/dist/factory-assets/connectors/local.js +16 -16
- package/dist/factory-assets/connectors/mattermost.js +16 -16
- package/dist/factory-assets/connectors/memory.js +16 -16
- package/dist/factory-assets/connectors/minio.js +16 -16
- package/dist/factory-assets/connectors/postgres.js +16 -16
- package/dist/factory-assets/connectors/s3.js +16 -16
- package/dist/factory-assets/connectors/sharepoint.js +16 -16
- package/dist/factory-assets/connectors/sqlite.js +16 -16
- package/dist/factory-assets/connectors/static-server.js +16 -16
- package/dist/factory-assets/connectors/tunnel.js +16 -16
- package/dist/factory-assets/connectors/webdav.js +16 -16
- package/dist/factory-assets/connectors/xstate-store.js +16 -16
- package/dist/factory-assets/connectors/xstate.js +16 -16
- package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +9 -3
- package/dist/factory-assets/skills/authoring-skaile-manifests/references/dependency-standard.md +4 -2
- package/dist/{flows-CBYRSAGS.js → flows-EQF2CH4U.js} +12 -12
- package/dist/{flows-CBYRSAGS.js.map → flows-EQF2CH4U.js.map} +1 -1
- package/dist/{helpers-XAEKCZKT.js → helpers-CFK6YP6R.js} +17 -17
- package/dist/{helpers-XAEKCZKT.js.map → helpers-CFK6YP6R.js.map} +1 -1
- package/dist/library/index.js +11 -11
- package/dist/library/install.js +3 -3
- package/dist/library/src/index.d.ts +2 -1
- package/dist/library/src/index.d.ts.map +1 -1
- package/dist/library/src/local/library-dir.d.ts +68 -0
- package/dist/library/src/local/library-dir.d.ts.map +1 -0
- package/dist/library/src/local/library-manager.d.ts +10 -1
- package/dist/library/src/local/library-manager.d.ts.map +1 -1
- package/dist/library/src/local/library.d.ts +2 -2
- package/dist/library/src/local/library.d.ts.map +1 -1
- package/dist/library/src/local/local-catalog-source.d.ts +9 -0
- package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
- package/dist/library/src/manifest-writer.d.ts +55 -4
- package/dist/library/src/manifest-writer.d.ts.map +1 -1
- package/dist/library/src/remote/cache.d.ts +18 -1
- package/dist/library/src/remote/cache.d.ts.map +1 -1
- package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
- package/dist/library/src/remote/rest-catalog-source.d.ts.map +1 -1
- package/dist/library/src/sync/git-driver.d.ts +7 -6
- package/dist/library/src/sync/git-driver.d.ts.map +1 -1
- package/dist/{library-publish-VJSWMOLH.js → library-publish-53UTB3MB.js} +151 -42
- package/dist/library-publish-53UTB3MB.js.map +1 -0
- package/dist/open-library-BOSPJVID.js +40 -0
- package/dist/{open-library-DB2PNL2X.js.map → open-library-BOSPJVID.js.map} +1 -1
- package/dist/open-registry-4FI7HKET.js +32 -0
- package/dist/{open-registry-ZUZJ7MS7.js.map → open-registry-4FI7HKET.js.map} +1 -1
- package/dist/paths-SUS4S4YT.js +22 -0
- package/dist/{paths-FQ64OLJG.js.map → paths-SUS4S4YT.js.map} +1 -1
- package/dist/{plugin-store-MPAMD5OT.js → plugin-store-AGQDMING.js} +9 -9
- package/dist/{plugin-store-MPAMD5OT.js.map → plugin-store-AGQDMING.js.map} +1 -1
- package/dist/project-I55A4O2T.js +41 -0
- package/dist/{project-I6NX3NFB.js.map → project-I55A4O2T.js.map} +1 -1
- package/dist/resolver/index.js +8 -8
- package/dist/runner/index.js +30 -30
- package/dist/runner/src/agent.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/usage-limit-turn-hold.d.ts +51 -0
- package/dist/runner/src/usage-limit-turn-hold.d.ts.map +1 -0
- package/dist/sdk/asset-manager.js +14 -14
- package/dist/sdk/bridge.js +12 -12
- package/dist/sdk/core.js +7 -7
- package/dist/sdk/flow.js +9 -9
- package/dist/sdk/index.js +30 -30
- package/dist/sdk/resolver.js +8 -8
- package/dist/sdk/runner.js +30 -30
- package/dist/{setup-B7JUHYJW.js → setup-7DQJKHUI.js} +22 -22
- package/dist/{setup-B7JUHYJW.js.map → setup-7DQJKHUI.js.map} +1 -1
- package/dist/{skills-TVO26Y4V.js → skills-NUEN5NDX.js} +13 -13
- package/dist/{skills-TVO26Y4V.js.map → skills-NUEN5NDX.js.map} +1 -1
- package/dist/source-G2LV5LVD.js +41 -0
- package/dist/{source-PJBMDCKX.js.map → source-G2LV5LVD.js.map} +1 -1
- package/dist/{source-manifest-publish-LLJWXGID.js → source-manifest-publish-6RM7SWLZ.js} +24 -24
- package/dist/{source-manifest-publish-LLJWXGID.js.map → source-manifest-publish-6RM7SWLZ.js.map} +1 -1
- package/dist/tui/index.js +61 -41
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/src/repl.d.ts.map +1 -1
- package/dist/types/manifests.js +1 -1
- package/dist/types/src/manifests/agent.d.ts +2 -0
- package/dist/types/src/manifests/agent.d.ts.map +1 -1
- package/dist/types/src/manifests/contract.d.ts +2 -0
- package/dist/types/src/manifests/contract.d.ts.map +1 -1
- package/dist/types/src/manifests/index.d.ts +3 -3
- package/dist/types/src/manifests/index.d.ts.map +1 -1
- package/dist/types/src/manifests/preset.d.ts +1 -1
- package/dist/types/src/manifests/prompt.d.ts +2 -0
- package/dist/types/src/manifests/prompt.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +23 -23
- package/dist/workspace-plugin/adapters/omp.js +14 -14
- package/dist/workspace-plugin/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-36AFURKZ.js.map +0 -1
- package/dist/chunk-4MQS7CAF.js.map +0 -1
- package/dist/chunk-7AI3Q5AQ.js.map +0 -1
- package/dist/chunk-B6GIW55K.js.map +0 -1
- package/dist/chunk-EF7NPDDU.js.map +0 -1
- package/dist/chunk-GKMZ6THE.js.map +0 -1
- package/dist/chunk-GTILM2CI.js.map +0 -1
- package/dist/chunk-IMKSM5NL.js.map +0 -1
- package/dist/chunk-JAKOMFC6.js.map +0 -1
- package/dist/chunk-JZ5EHBPI.js.map +0 -1
- package/dist/chunk-LAMCXQGA.js.map +0 -1
- package/dist/chunk-MGGFBZWA.js.map +0 -1
- package/dist/chunk-P67WJVP4.js.map +0 -1
- package/dist/chunk-QVNRCDTV.js.map +0 -1
- package/dist/chunk-UMVKJM4Q.js.map +0 -1
- package/dist/chunk-Y7QA2OLD.js.map +0 -1
- package/dist/chunk-YSHVQGUS.js.map +0 -1
- package/dist/chunk-ZAOGFXDO.js +0 -112
- package/dist/chunk-ZAOGFXDO.js.map +0 -1
- package/dist/library-publish-VJSWMOLH.js.map +0 -1
- package/dist/open-library-DB2PNL2X.js +0 -40
- package/dist/open-registry-ZUZJ7MS7.js +0 -32
- package/dist/paths-FQ64OLJG.js +0 -22
- package/dist/project-I6NX3NFB.js +0 -41
- package/dist/source-PJBMDCKX.js +0 -41
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { readManifestSourceConfig, discoverAssetsInTree, barePublisher, createDefaultKindRegistry, sharesItsFolder, SEMVER_RE, parseManifestFile } from './chunk-
|
|
2
|
-
import { installFromManifest, assertSafeManifestPath } from './chunk-
|
|
3
|
-
import { PresetManifestSchema } from './chunk-
|
|
4
|
-
import { defaultLibraryDir, resolveLibraryDir, GLOBAL_INSTALL_DIR_NAME, readLock, buildLibraryLockEntries, writeLock, mergeLockFile, buildLockFile, ManifestYamlEditor } from './chunk-
|
|
5
|
-
import { getGlobalCacheDir, storeManifestSlug, resolveSourcePublisher } from './chunk-
|
|
1
|
+
import { readManifestSourceConfig, discoverAssetsInTree, barePublisher, createDefaultKindRegistry, sharesItsFolder, SEMVER_RE, parseManifestFile } from './chunk-J4RBUFGM.js';
|
|
2
|
+
import { installFromManifest, assertSafeManifestPath } from './chunk-COH6FQAG.js';
|
|
3
|
+
import { PresetManifestSchema } from './chunk-ZCAJZ4B2.js';
|
|
4
|
+
import { defaultLibraryDir, resolveLibraryDir, GLOBAL_INSTALL_DIR_NAME, readLock, buildLibraryLockEntries, writeLock, mergeLockFile, buildLockFile, ManifestYamlEditor } from './chunk-PBBPZYVG.js';
|
|
5
|
+
import { getGlobalCacheDir, storeManifestSlug, resolveSourcePublisher } from './chunk-ALEYHUC5.js';
|
|
6
6
|
import { userConfigPath, globalSkaileDir, mergeLegacyEntriesInto, migrateLegacyDir, globalCacheRoot } from './chunk-L5VSIPQD.js';
|
|
7
|
-
import { encodeSkaileManifest, loadSkPublishManifest, SKAILE_MANIFEST_FILENAME } from './chunk-
|
|
8
|
-
import { scanDirectory } from './chunk-
|
|
9
|
-
import { parseAssetRef, assetRefToStr } from './chunk-
|
|
7
|
+
import { encodeSkaileManifest, loadSkPublishManifest, SKAILE_MANIFEST_FILENAME } from './chunk-ZPWTOUTK.js';
|
|
8
|
+
import { scanDirectory } from './chunk-SBSA3IQA.js';
|
|
9
|
+
import { parseAssetRef, assetRefToStr } from './chunk-BNMZVPYA.js';
|
|
10
10
|
import { __export } from './chunk-NSBPE2FW.js';
|
|
11
|
-
import * as
|
|
11
|
+
import * as fs11 from 'fs';
|
|
12
12
|
import { existsSync, mkdirSync, symlinkSync, copyFileSync, cpSync } from 'fs';
|
|
13
|
-
import * as
|
|
13
|
+
import * as path16 from 'path';
|
|
14
14
|
import { resolve, relative, sep, join, dirname } from 'path';
|
|
15
15
|
import { stringify, parse, parseDocument } from 'yaml';
|
|
16
16
|
import * as z3 from 'zod';
|
|
@@ -103,10 +103,10 @@ var SkaileConfigSchema = z3.object({
|
|
|
103
103
|
library: LibraryConfigSchema.optional()
|
|
104
104
|
});
|
|
105
105
|
function defaultIndexPath() {
|
|
106
|
-
return
|
|
106
|
+
return path16.join(globalSkaileDir(), "index.db");
|
|
107
107
|
}
|
|
108
108
|
function resolveIndexPath() {
|
|
109
|
-
if (process.env.SKAILE_INDEX_PATH) return
|
|
109
|
+
if (process.env.SKAILE_INDEX_PATH) return path16.resolve(process.env.SKAILE_INDEX_PATH);
|
|
110
110
|
return defaultIndexPath();
|
|
111
111
|
}
|
|
112
112
|
function getConfigDefaults() {
|
|
@@ -117,12 +117,12 @@ function getConfigDefaults() {
|
|
|
117
117
|
}
|
|
118
118
|
var CONFIG_FILENAME = "config.yaml";
|
|
119
119
|
function projectConfigPath(projectDir) {
|
|
120
|
-
return
|
|
120
|
+
return path16.join(projectDir, ".skaile", CONFIG_FILENAME);
|
|
121
121
|
}
|
|
122
122
|
function loadConfigFile(filePath) {
|
|
123
|
-
if (!
|
|
123
|
+
if (!fs11.existsSync(filePath)) return null;
|
|
124
124
|
try {
|
|
125
|
-
const content =
|
|
125
|
+
const content = fs11.readFileSync(filePath, "utf-8");
|
|
126
126
|
const raw = parse(content);
|
|
127
127
|
if (!raw || typeof raw !== "object") return null;
|
|
128
128
|
return SkaileConfigSchema.partial().parse(raw);
|
|
@@ -170,11 +170,11 @@ function resolveConfig(opts) {
|
|
|
170
170
|
return resolved;
|
|
171
171
|
}
|
|
172
172
|
function saveConfig(filePath, config) {
|
|
173
|
-
const dir =
|
|
174
|
-
if (!
|
|
175
|
-
|
|
173
|
+
const dir = path16.dirname(filePath);
|
|
174
|
+
if (!fs11.existsSync(dir)) {
|
|
175
|
+
fs11.mkdirSync(dir, { recursive: true });
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
fs11.writeFileSync(filePath, stringify(config, { indent: 2 }), "utf-8");
|
|
178
178
|
}
|
|
179
179
|
var KnowledgeManifestSchema = z3.looseObject({
|
|
180
180
|
name: z3.string().optional(),
|
|
@@ -200,11 +200,11 @@ function validateKnowledge(data) {
|
|
|
200
200
|
|
|
201
201
|
// library/src/knowledge/knowledge-kind-provider.ts
|
|
202
202
|
function collectDirRecursive(baseDir, relativeDir) {
|
|
203
|
-
const full =
|
|
204
|
-
if (!
|
|
203
|
+
const full = path16.join(baseDir, relativeDir);
|
|
204
|
+
if (!fs11.existsSync(full) || !fs11.statSync(full).isDirectory()) return [];
|
|
205
205
|
const results = [];
|
|
206
|
-
for (const entry of
|
|
207
|
-
const rel =
|
|
206
|
+
for (const entry of fs11.readdirSync(full, { withFileTypes: true })) {
|
|
207
|
+
const rel = path16.posix.join(relativeDir, entry.name);
|
|
208
208
|
if (entry.isDirectory()) {
|
|
209
209
|
results.push(...collectDirRecursive(baseDir, rel));
|
|
210
210
|
} else if (entry.isFile()) {
|
|
@@ -231,8 +231,8 @@ var knowledgeKindProvider = {
|
|
|
231
231
|
return validateKnowledge(data);
|
|
232
232
|
},
|
|
233
233
|
defaultFileFilter(manifestPath) {
|
|
234
|
-
const dir =
|
|
235
|
-
const manifestName =
|
|
234
|
+
const dir = path16.dirname(manifestPath);
|
|
235
|
+
const manifestName = path16.basename(manifestPath);
|
|
236
236
|
const files = [manifestName];
|
|
237
237
|
files.push(...collectDirRecursive(dir, "documents"));
|
|
238
238
|
files.sort();
|
|
@@ -311,30 +311,30 @@ var assignments = sqliteTable("assignments", {
|
|
|
311
311
|
assignedAt: text("assigned_at").notNull()
|
|
312
312
|
});
|
|
313
313
|
function isClone(dir) {
|
|
314
|
-
return
|
|
314
|
+
return fs11.existsSync(path16.join(dir, ".git"));
|
|
315
315
|
}
|
|
316
316
|
function getSidecarRoot() {
|
|
317
317
|
const home = globalSkaileDir();
|
|
318
|
-
const sidecars =
|
|
319
|
-
const legacy =
|
|
318
|
+
const sidecars = path16.join(home, "sidecars");
|
|
319
|
+
const legacy = path16.join(home, "sources");
|
|
320
320
|
mergeLegacyEntriesInto(getGlobalCacheDir(), legacy, isClone);
|
|
321
321
|
mergeLegacyEntriesInto(sidecars, legacy, (p) => !isClone(p));
|
|
322
322
|
return sidecars;
|
|
323
323
|
}
|
|
324
324
|
function resolveSidecarPaths(slug) {
|
|
325
325
|
const rootDir = getSidecarRoot();
|
|
326
|
-
const sidecarDir =
|
|
326
|
+
const sidecarDir = path16.join(rootDir, slug);
|
|
327
327
|
return {
|
|
328
328
|
rootDir,
|
|
329
329
|
sidecarDir,
|
|
330
|
-
manifestFile:
|
|
331
|
-
readmeFile:
|
|
332
|
-
lockFile:
|
|
330
|
+
manifestFile: path16.join(sidecarDir, "skaile.manifest.yaml"),
|
|
331
|
+
readmeFile: path16.join(sidecarDir, "README.md"),
|
|
332
|
+
lockFile: path16.join(sidecarDir, "skaile.manifest.lock.json")
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
335
|
function deriveSlug(sourceConfig, sourcePath, existingSlugs) {
|
|
336
336
|
const fromConfig = sourceConfig && typeof sourceConfig.name === "string" ? sourceConfig.name : void 0;
|
|
337
|
-
const base = fromConfig && fromConfig.length > 0 ? slugify(fromConfig) : slugify(
|
|
337
|
+
const base = fromConfig && fromConfig.length > 0 ? slugify(fromConfig) : slugify(path16.basename(sourcePath || "")) || "unnamed-source";
|
|
338
338
|
const taken = new Set(existingSlugs);
|
|
339
339
|
if (!taken.has(base)) return base;
|
|
340
340
|
for (let i = 2; i < 1e3; i++) {
|
|
@@ -345,9 +345,9 @@ function deriveSlug(sourceConfig, sourcePath, existingSlugs) {
|
|
|
345
345
|
}
|
|
346
346
|
function listSidecarSlugsOnDisk() {
|
|
347
347
|
const root = getSidecarRoot();
|
|
348
|
-
if (!
|
|
348
|
+
if (!fs11.existsSync(root)) return [];
|
|
349
349
|
const out = [];
|
|
350
|
-
for (const entry of
|
|
350
|
+
for (const entry of fs11.readdirSync(root, { withFileTypes: true })) {
|
|
351
351
|
if (!entry.isDirectory()) continue;
|
|
352
352
|
if (entry.name.startsWith(".")) continue;
|
|
353
353
|
out.push(entry.name);
|
|
@@ -360,28 +360,28 @@ function slugify(input) {
|
|
|
360
360
|
|
|
361
361
|
// library/src/local/store-paths.ts
|
|
362
362
|
function getStoreRoot() {
|
|
363
|
-
return
|
|
363
|
+
return path16.join(globalSkaileDir(), "store");
|
|
364
364
|
}
|
|
365
365
|
function getStoreManifestsDir() {
|
|
366
|
-
return
|
|
366
|
+
return path16.join(getStoreRoot(), "manifests");
|
|
367
367
|
}
|
|
368
368
|
function curatedManifestOverlay(sourceUrl) {
|
|
369
|
-
const file =
|
|
370
|
-
return
|
|
369
|
+
const file = path16.join(getStoreManifestsDir(), `${storeManifestSlug(sourceUrl)}.yaml`);
|
|
370
|
+
return fs11.existsSync(file) ? file : void 0;
|
|
371
371
|
}
|
|
372
372
|
function migratedMarkerPath() {
|
|
373
|
-
return
|
|
373
|
+
return path16.join(getStoreRoot(), ".migrated");
|
|
374
374
|
}
|
|
375
375
|
function collectSidecarMigrationCandidates(sidecarRoot) {
|
|
376
376
|
const candidates = [];
|
|
377
|
-
if (
|
|
378
|
-
for (const entry of
|
|
377
|
+
if (fs11.existsSync(sidecarRoot)) {
|
|
378
|
+
for (const entry of fs11.readdirSync(sidecarRoot, { withFileTypes: true })) {
|
|
379
379
|
if (!entry.isDirectory()) continue;
|
|
380
380
|
if (entry.name.startsWith(".")) continue;
|
|
381
|
-
const sidecarDir =
|
|
382
|
-
const current =
|
|
383
|
-
const legacy =
|
|
384
|
-
const src =
|
|
381
|
+
const sidecarDir = path16.join(sidecarRoot, entry.name);
|
|
382
|
+
const current = path16.join(sidecarDir, "skaile.manifest.yaml");
|
|
383
|
+
const legacy = path16.join(sidecarDir, ".skaile-source.yaml");
|
|
384
|
+
const src = fs11.existsSync(current) ? current : fs11.existsSync(legacy) ? legacy : void 0;
|
|
385
385
|
if (src) candidates.push({ src, slug: entry.name });
|
|
386
386
|
}
|
|
387
387
|
}
|
|
@@ -390,10 +390,10 @@ function collectSidecarMigrationCandidates(sidecarRoot) {
|
|
|
390
390
|
function moveSidecarManifests(candidates, manifestsDir) {
|
|
391
391
|
let migrated = 0;
|
|
392
392
|
for (const { src, slug } of candidates) {
|
|
393
|
-
const dest =
|
|
394
|
-
if (
|
|
393
|
+
const dest = path16.join(manifestsDir, `${slug}.yaml`);
|
|
394
|
+
if (fs11.existsSync(dest)) continue;
|
|
395
395
|
try {
|
|
396
|
-
|
|
396
|
+
fs11.renameSync(src, dest);
|
|
397
397
|
migrated++;
|
|
398
398
|
} catch (err) {
|
|
399
399
|
process.stderr.write(
|
|
@@ -405,11 +405,11 @@ function moveSidecarManifests(candidates, manifestsDir) {
|
|
|
405
405
|
return migrated;
|
|
406
406
|
}
|
|
407
407
|
function initStoreGitRepo(storeRoot) {
|
|
408
|
-
if (
|
|
408
|
+
if (fs11.existsSync(path16.join(storeRoot, ".git"))) return;
|
|
409
409
|
try {
|
|
410
410
|
spawnSync("git", ["init", "--quiet"], { cwd: storeRoot, stdio: "ignore" });
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
fs11.writeFileSync(
|
|
412
|
+
path16.join(storeRoot, ".gitignore"),
|
|
413
413
|
"# Remote-store cache \u2014 local to this machine.\nremote-cache/\n",
|
|
414
414
|
"utf8"
|
|
415
415
|
);
|
|
@@ -419,14 +419,14 @@ function initStoreGitRepo(storeRoot) {
|
|
|
419
419
|
function migrateSidecarsToStoreIfNeeded() {
|
|
420
420
|
const storeRoot = getStoreRoot();
|
|
421
421
|
const marker = migratedMarkerPath();
|
|
422
|
-
if (
|
|
422
|
+
if (fs11.existsSync(marker)) return { migrated: 0, storeRoot };
|
|
423
423
|
const sidecarRoot = getSidecarRoot();
|
|
424
424
|
const manifestsDir = getStoreManifestsDir();
|
|
425
425
|
const candidates = collectSidecarMigrationCandidates(sidecarRoot);
|
|
426
|
-
|
|
426
|
+
fs11.mkdirSync(manifestsDir, { recursive: true });
|
|
427
427
|
const migrated = moveSidecarManifests(candidates, manifestsDir);
|
|
428
428
|
initStoreGitRepo(storeRoot);
|
|
429
|
-
|
|
429
|
+
fs11.writeFileSync(marker, (/* @__PURE__ */ new Date()).toISOString(), "utf8");
|
|
430
430
|
return { migrated, storeRoot };
|
|
431
431
|
}
|
|
432
432
|
|
|
@@ -507,7 +507,7 @@ async function librariesPresent(client) {
|
|
|
507
507
|
return rs.rows.length > 0;
|
|
508
508
|
}
|
|
509
509
|
function slugify2(p) {
|
|
510
|
-
const base =
|
|
510
|
+
const base = path16.basename(p) || "lib";
|
|
511
511
|
return base.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-|-$/g, "") || "lib";
|
|
512
512
|
}
|
|
513
513
|
async function runLibrariesMigration(client) {
|
|
@@ -671,23 +671,23 @@ async function purgeOrphanedAssetDefinitions(client) {
|
|
|
671
671
|
await client.execute(`PRAGMA user_version = ${ORPHAN_PURGE_VERSION}`);
|
|
672
672
|
}
|
|
673
673
|
function assertNoLegacyLibDb(newDbPath) {
|
|
674
|
-
if (
|
|
675
|
-
const parent =
|
|
674
|
+
if (fs11.existsSync(newDbPath)) return;
|
|
675
|
+
const parent = path16.dirname(newDbPath);
|
|
676
676
|
const skaileHome = globalSkaileDir();
|
|
677
|
-
const defaultIndexPath2 =
|
|
677
|
+
const defaultIndexPath2 = path16.join(skaileHome, "index.db");
|
|
678
678
|
const candidates = [];
|
|
679
|
-
if (
|
|
680
|
-
candidates.push(
|
|
679
|
+
if (path16.basename(newDbPath) === "index.db") {
|
|
680
|
+
candidates.push(path16.join(parent, "lib.db"));
|
|
681
681
|
}
|
|
682
682
|
if (newDbPath === defaultIndexPath2) {
|
|
683
|
-
candidates.push(
|
|
684
|
-
candidates.push(
|
|
683
|
+
candidates.push(path16.join(skaileHome, "libraries", "lib.db"));
|
|
684
|
+
candidates.push(path16.join(skaileHome, "library", "lib.db"));
|
|
685
685
|
}
|
|
686
|
-
if (
|
|
687
|
-
candidates.push(
|
|
686
|
+
if (path16.basename(parent) === "libraries") {
|
|
687
|
+
candidates.push(path16.join(path16.dirname(parent), "library", "lib.db"));
|
|
688
688
|
}
|
|
689
689
|
for (const legacy of candidates) {
|
|
690
|
-
if (!
|
|
690
|
+
if (!fs11.existsSync(legacy)) continue;
|
|
691
691
|
throw new Error(
|
|
692
692
|
`Found legacy index database at ${legacy}. The lib.db \u2192 index.db relocation ran for one release and has been removed. Move the file manually to ${newDbPath} (and any -wal / -shm siblings), then retry.`
|
|
693
693
|
);
|
|
@@ -846,26 +846,26 @@ var LocalIndex = class {
|
|
|
846
846
|
let dbPath;
|
|
847
847
|
if (typeof optionsOrDir === "string") {
|
|
848
848
|
dir = optionsOrDir;
|
|
849
|
-
dbPath =
|
|
849
|
+
dbPath = path16.join(dir, "index.db");
|
|
850
850
|
} else if (optionsOrDir?.indexPath) {
|
|
851
851
|
dbPath = optionsOrDir.indexPath;
|
|
852
852
|
dir = optionsOrDir.libraryDir ?? resolveLibraryDir();
|
|
853
853
|
this._kindRegistry = optionsOrDir.kindRegistry;
|
|
854
854
|
} else if (optionsOrDir?.libraryDir) {
|
|
855
855
|
dir = optionsOrDir.libraryDir;
|
|
856
|
-
dbPath =
|
|
856
|
+
dbPath = path16.join(dir, "index.db");
|
|
857
857
|
this._kindRegistry = optionsOrDir.kindRegistry;
|
|
858
858
|
} else {
|
|
859
859
|
dir = resolveLibraryDir();
|
|
860
860
|
dbPath = resolveIndexPath();
|
|
861
861
|
this._kindRegistry = optionsOrDir?.kindRegistry;
|
|
862
862
|
}
|
|
863
|
-
if (!
|
|
864
|
-
|
|
863
|
+
if (!fs11.existsSync(dir)) {
|
|
864
|
+
fs11.mkdirSync(dir, { recursive: true });
|
|
865
865
|
}
|
|
866
|
-
const dbParent =
|
|
867
|
-
if (!
|
|
868
|
-
|
|
866
|
+
const dbParent = path16.dirname(dbPath);
|
|
867
|
+
if (!fs11.existsSync(dbParent)) {
|
|
868
|
+
fs11.mkdirSync(dbParent, { recursive: true });
|
|
869
869
|
}
|
|
870
870
|
this.libraryDir = dir;
|
|
871
871
|
this.dbPath = dbPath;
|
|
@@ -990,7 +990,7 @@ var LocalIndex = class {
|
|
|
990
990
|
* Delete this library's cached asset defs whose ref is not in `keepRefs`.
|
|
991
991
|
* Makes a sync authoritative: a def re-keyed under a new publisher (e.g.
|
|
992
992
|
* `@skills/x` → `@acme/x`) leaves no stale duplicate behind. Returns the
|
|
993
|
-
*
|
|
993
|
+
* ids of the rows removed.
|
|
994
994
|
*
|
|
995
995
|
* Not on the IAssetIndex interface — used by catalog sources.
|
|
996
996
|
*/
|
|
@@ -1004,7 +1004,7 @@ var LocalIndex = class {
|
|
|
1004
1004
|
and(eq(assetDefinitions.libraryId, libraryId), eq(assetDefinitions.id, id))
|
|
1005
1005
|
).run();
|
|
1006
1006
|
}
|
|
1007
|
-
return stale
|
|
1007
|
+
return stale;
|
|
1008
1008
|
}
|
|
1009
1009
|
async getAssetDef(ref) {
|
|
1010
1010
|
const db = await this.ensureDb();
|
|
@@ -1085,7 +1085,7 @@ var LocalIndex = class {
|
|
|
1085
1085
|
* @returns The created Instance plus its on-disk install path.
|
|
1086
1086
|
*/
|
|
1087
1087
|
async install(manifest, opts) {
|
|
1088
|
-
const libraryRoot = opts?.libraryRoot ??
|
|
1088
|
+
const libraryRoot = opts?.libraryRoot ?? path16.join(this.libraryDir, GLOBAL_INSTALL_DIR_NAME);
|
|
1089
1089
|
const { installPath } = await installFromManifest({
|
|
1090
1090
|
manifest,
|
|
1091
1091
|
libraryRoot,
|
|
@@ -1206,6 +1206,113 @@ var LocalIndex = class {
|
|
|
1206
1206
|
return (await db.select().from(assignments).where(eq(assignments.instanceId, instanceId)).all()).map(rowToAssignment);
|
|
1207
1207
|
}
|
|
1208
1208
|
};
|
|
1209
|
+
var UNREGISTERED_FILE = ".unregistered-libraries";
|
|
1210
|
+
function libraryDirMissing(lib) {
|
|
1211
|
+
try {
|
|
1212
|
+
return !fs11.statSync(lib.path).isDirectory();
|
|
1213
|
+
} catch {
|
|
1214
|
+
return true;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
function missingLibraryDirMessage(lib) {
|
|
1218
|
+
return `library "${lib.name}" is registered but its directory ${lib.path} is missing - run skaile library init ${lib.name} --path <dir> or skaile library remove ${lib.name}`;
|
|
1219
|
+
}
|
|
1220
|
+
function realDir(dir) {
|
|
1221
|
+
try {
|
|
1222
|
+
return fs11.realpathSync(dir);
|
|
1223
|
+
} catch {
|
|
1224
|
+
return path16.resolve(dir);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
function unregisteredLibraryNames() {
|
|
1228
|
+
try {
|
|
1229
|
+
return new Set(
|
|
1230
|
+
fs11.readFileSync(path16.join(resolveLibraryDir(), UNREGISTERED_FILE), "utf8").split("\n").map((l) => l.trim()).filter(Boolean)
|
|
1231
|
+
);
|
|
1232
|
+
} catch {
|
|
1233
|
+
return /* @__PURE__ */ new Set();
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
function markLibraryUnregistered(lib) {
|
|
1237
|
+
if (realDir(path16.dirname(lib.path)) !== realDir(resolveLibraryDir())) return;
|
|
1238
|
+
const known = unregisteredLibraryNames();
|
|
1239
|
+
const add = [.../* @__PURE__ */ new Set([lib.name, path16.basename(lib.path)])].filter((n) => !known.has(n));
|
|
1240
|
+
if (add.length === 0) return;
|
|
1241
|
+
fs11.mkdirSync(resolveLibraryDir(), { recursive: true });
|
|
1242
|
+
fs11.appendFileSync(
|
|
1243
|
+
path16.join(resolveLibraryDir(), UNREGISTERED_FILE),
|
|
1244
|
+
`${add.join("\n")}
|
|
1245
|
+
`,
|
|
1246
|
+
"utf8"
|
|
1247
|
+
);
|
|
1248
|
+
}
|
|
1249
|
+
function clearLibraryUnregistered(lib) {
|
|
1250
|
+
const known = unregisteredLibraryNames();
|
|
1251
|
+
if (known.size === 0) return;
|
|
1252
|
+
const drop = /* @__PURE__ */ new Set([lib.name]);
|
|
1253
|
+
if (realDir(path16.dirname(lib.path)) === realDir(resolveLibraryDir())) {
|
|
1254
|
+
drop.add(path16.basename(lib.path));
|
|
1255
|
+
}
|
|
1256
|
+
const keep = [...known].filter((n) => !drop.has(n));
|
|
1257
|
+
if (keep.length === known.size) return;
|
|
1258
|
+
const file = path16.join(resolveLibraryDir(), UNREGISTERED_FILE);
|
|
1259
|
+
if (keep.length === 0) fs11.rmSync(file, { force: true });
|
|
1260
|
+
else fs11.writeFileSync(file, `${keep.join("\n")}
|
|
1261
|
+
`, "utf8");
|
|
1262
|
+
}
|
|
1263
|
+
var RENAMED_FILE = ".renamed-libraries";
|
|
1264
|
+
function readRenames() {
|
|
1265
|
+
const out = /* @__PURE__ */ new Map();
|
|
1266
|
+
try {
|
|
1267
|
+
for (const line of fs11.readFileSync(path16.join(resolveLibraryDir(), RENAMED_FILE), "utf8").split("\n")) {
|
|
1268
|
+
const [from, to] = line.split(" ").map((s) => s.trim());
|
|
1269
|
+
if (from && to && from !== to) out.set(from, to);
|
|
1270
|
+
}
|
|
1271
|
+
} catch {
|
|
1272
|
+
}
|
|
1273
|
+
return out;
|
|
1274
|
+
}
|
|
1275
|
+
function writeRenames(renames) {
|
|
1276
|
+
const file = path16.join(resolveLibraryDir(), RENAMED_FILE);
|
|
1277
|
+
if (renames.size === 0) {
|
|
1278
|
+
fs11.rmSync(file, { force: true });
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
1281
|
+
fs11.mkdirSync(resolveLibraryDir(), { recursive: true });
|
|
1282
|
+
fs11.writeFileSync(
|
|
1283
|
+
file,
|
|
1284
|
+
`${[...renames].map(([from, to]) => `${from} ${to}`).join("\n")}
|
|
1285
|
+
`,
|
|
1286
|
+
"utf8"
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
function recordLibraryRename(from, to) {
|
|
1290
|
+
if (from === to) return;
|
|
1291
|
+
const renames = readRenames();
|
|
1292
|
+
for (const [k, v] of renames) if (v === from) renames.set(k, to);
|
|
1293
|
+
renames.delete(to);
|
|
1294
|
+
renames.set(from, to);
|
|
1295
|
+
for (const [k, v] of renames) if (k === v) renames.delete(k);
|
|
1296
|
+
writeRenames(renames);
|
|
1297
|
+
}
|
|
1298
|
+
function renamedLibraryName(name) {
|
|
1299
|
+
return readRenames().get(name);
|
|
1300
|
+
}
|
|
1301
|
+
function clearLibraryRenamed(name) {
|
|
1302
|
+
const renames = readRenames();
|
|
1303
|
+
if (renames.delete(name)) writeRenames(renames);
|
|
1304
|
+
}
|
|
1305
|
+
function dropLibraryRenamesTo(name) {
|
|
1306
|
+
const renames = readRenames();
|
|
1307
|
+
let changed = false;
|
|
1308
|
+
for (const [from, to] of renames) {
|
|
1309
|
+
if (to === name) {
|
|
1310
|
+
renames.delete(from);
|
|
1311
|
+
changed = true;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
if (changed) writeRenames(renames);
|
|
1315
|
+
}
|
|
1209
1316
|
|
|
1210
1317
|
// library/src/user-library.ts
|
|
1211
1318
|
var LIBRARY_BACKENDS = ["local", "git"];
|
|
@@ -1242,7 +1349,7 @@ function git(cwd, args) {
|
|
|
1242
1349
|
return spawnSync("git", args, { cwd, encoding: "utf-8" });
|
|
1243
1350
|
}
|
|
1244
1351
|
function isGitRepo(libPath) {
|
|
1245
|
-
return existsSync(
|
|
1352
|
+
return existsSync(path16.join(libPath, ".git"));
|
|
1246
1353
|
}
|
|
1247
1354
|
function spawnGit(cwd, args, action) {
|
|
1248
1355
|
const r = git(cwd, args);
|
|
@@ -1312,6 +1419,31 @@ function headCommit(cwd) {
|
|
|
1312
1419
|
const r = git(cwd, ["rev-parse", "--verify", "--quiet", "HEAD"]);
|
|
1313
1420
|
return r.status === 0 ? r.stdout.trim() : void 0;
|
|
1314
1421
|
}
|
|
1422
|
+
function rebaseInProgress(cwd) {
|
|
1423
|
+
for (const entry of ["rebase-merge", "rebase-apply"]) {
|
|
1424
|
+
const p = git(cwd, ["rev-parse", "--git-path", entry]);
|
|
1425
|
+
if (p.status === 0 && existsSync(path16.resolve(cwd, p.stdout.trim()))) return true;
|
|
1426
|
+
}
|
|
1427
|
+
return false;
|
|
1428
|
+
}
|
|
1429
|
+
var REBASE_IN_PROGRESS = "rebase in progress; finish it with git rebase --continue";
|
|
1430
|
+
var MERGE_IN_PROGRESS = "merge in progress; resolve the conflicts, then git commit";
|
|
1431
|
+
function mergeInProgress(cwd) {
|
|
1432
|
+
const head = git(cwd, ["rev-parse", "--git-path", "MERGE_HEAD"]);
|
|
1433
|
+
if (head.status === 0 && existsSync(path16.resolve(cwd, head.stdout.trim()))) return true;
|
|
1434
|
+
const unmerged = git(cwd, ["ls-files", "--unmerged"]);
|
|
1435
|
+
return unmerged.status === 0 && unmerged.stdout.trim() !== "";
|
|
1436
|
+
}
|
|
1437
|
+
function assertLibraryDir(lib) {
|
|
1438
|
+
if (libraryDirMissing(lib)) {
|
|
1439
|
+
throw new LibrarySyncError(missingLibraryDirMessage(lib), "library_dir_missing");
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
function assertNoRebase(lib) {
|
|
1443
|
+
assertLibraryDir(lib);
|
|
1444
|
+
if (rebaseInProgress(lib.path)) throw new LibrarySyncError(REBASE_IN_PROGRESS, "remote_error");
|
|
1445
|
+
if (mergeInProgress(lib.path)) throw new LibrarySyncError(MERGE_IN_PROGRESS, "remote_error");
|
|
1446
|
+
}
|
|
1315
1447
|
function ok(r, action) {
|
|
1316
1448
|
if (r.status !== 0) {
|
|
1317
1449
|
throw new LibrarySyncError(
|
|
@@ -1328,6 +1460,13 @@ var GitSyncDriver = class {
|
|
|
1328
1460
|
backend = "git";
|
|
1329
1461
|
async status(lib) {
|
|
1330
1462
|
const cfg = gitCfg(lib);
|
|
1463
|
+
if (libraryDirMissing(lib)) {
|
|
1464
|
+
return {
|
|
1465
|
+
reachable: false,
|
|
1466
|
+
localChanges: { added: [], modified: [], deleted: [] },
|
|
1467
|
+
notes: [missingLibraryDirMessage(lib)]
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1331
1470
|
const porcelain = git(lib.path, ["status", "--porcelain"]);
|
|
1332
1471
|
if (porcelain.status !== 0) {
|
|
1333
1472
|
return {
|
|
@@ -1369,6 +1508,7 @@ var GitSyncDriver = class {
|
|
|
1369
1508
|
};
|
|
1370
1509
|
}
|
|
1371
1510
|
async pull(lib, opts) {
|
|
1511
|
+
assertNoRebase(lib);
|
|
1372
1512
|
const cfg = gitCfg(lib);
|
|
1373
1513
|
const args = ["pull", "--ff-only", "origin", cfg.branch];
|
|
1374
1514
|
if (opts?.rebase) args.splice(1, 1, "--rebase");
|
|
@@ -1398,6 +1538,14 @@ var GitSyncDriver = class {
|
|
|
1398
1538
|
]
|
|
1399
1539
|
};
|
|
1400
1540
|
}
|
|
1541
|
+
if (/would be overwritten by (merge|checkout)|unstaged changes|uncommitted changes|commit your changes or stash/i.test(
|
|
1542
|
+
r.stderr
|
|
1543
|
+
)) {
|
|
1544
|
+
throw new LibrarySyncError(
|
|
1545
|
+
`uncommitted changes in ${lib.name}; commit or stash them first`,
|
|
1546
|
+
"remote_error"
|
|
1547
|
+
);
|
|
1548
|
+
}
|
|
1401
1549
|
throw new LibrarySyncError(`git pull failed: ${r.stderr.trim()}`, "remote_error");
|
|
1402
1550
|
}
|
|
1403
1551
|
const upstream = `refs/remotes/origin/${cfg.branch}`;
|
|
@@ -1411,11 +1559,27 @@ var GitSyncDriver = class {
|
|
|
1411
1559
|
`library "${lib.name}" has ownership=${lib.ownership}; use \`propose\` instead`
|
|
1412
1560
|
);
|
|
1413
1561
|
}
|
|
1562
|
+
assertNoRebase(lib);
|
|
1414
1563
|
const cfg = gitCfg(lib);
|
|
1415
1564
|
const args = ["push", "origin", cfg.branch];
|
|
1416
1565
|
if (opts?.force) args.push("--force-with-lease");
|
|
1566
|
+
const countRef = "refs/skaile/push-base";
|
|
1567
|
+
const trackingRef = `refs/remotes/origin/${cfg.branch}`;
|
|
1568
|
+
git(lib.path, ["update-ref", "-d", countRef]);
|
|
1569
|
+
const fetched = spawnSync(
|
|
1570
|
+
"git",
|
|
1571
|
+
["fetch", "--quiet", "origin", `+refs/heads/${cfg.branch}:${countRef}`],
|
|
1572
|
+
{
|
|
1573
|
+
cwd: lib.path,
|
|
1574
|
+
encoding: "utf-8",
|
|
1575
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
1576
|
+
}
|
|
1577
|
+
);
|
|
1578
|
+
const remoteHasNoBranch = /couldn't find remote ref/i.test(fetched.stderr ?? "");
|
|
1579
|
+
const baseRef = fetched.status === 0 || remoteHasNoBranch ? countRef : trackingRef;
|
|
1417
1580
|
const local = `refs/heads/${cfg.branch}`;
|
|
1418
|
-
const pushed = countCommits(lib.path,
|
|
1581
|
+
const pushed = countCommits(lib.path, `${baseRef}..${local}`) ?? countCommits(lib.path, local) ?? 0;
|
|
1582
|
+
git(lib.path, ["update-ref", "-d", countRef]);
|
|
1419
1583
|
const pushRes = git(lib.path, args);
|
|
1420
1584
|
if (pushRes.status !== 0 && /non-fast-forward|fetch first|updates were rejected/i.test(pushRes.stderr)) {
|
|
1421
1585
|
throw new LibrarySyncError(
|
|
@@ -1433,6 +1597,7 @@ var GitSyncDriver = class {
|
|
|
1433
1597
|
`propose requires ownership=contributor; got ${lib.ownership}`
|
|
1434
1598
|
);
|
|
1435
1599
|
}
|
|
1600
|
+
assertLibraryDir(lib);
|
|
1436
1601
|
const cfg = gitCfg(lib);
|
|
1437
1602
|
const branch = opts.branch ?? `skaile/${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:.TZ]/g, "").slice(0, 14)}`;
|
|
1438
1603
|
const remotes = ok(git(lib.path, ["remote"]), "remote-list").split("\n");
|
|
@@ -1528,7 +1693,13 @@ function rowToLibrary2(row) {
|
|
|
1528
1693
|
};
|
|
1529
1694
|
}
|
|
1530
1695
|
var LIBRARY_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
1696
|
+
var MAX_LIBRARY_NAME_LENGTH = 64;
|
|
1531
1697
|
function assertValidLibraryName(name) {
|
|
1698
|
+
if (name.length > MAX_LIBRARY_NAME_LENGTH) {
|
|
1699
|
+
throw new Error(
|
|
1700
|
+
`Invalid library name (${name.length} characters): at most ${MAX_LIBRARY_NAME_LENGTH} characters.`
|
|
1701
|
+
);
|
|
1702
|
+
}
|
|
1532
1703
|
if (!LIBRARY_NAME_PATTERN.test(name)) {
|
|
1533
1704
|
throw new Error(
|
|
1534
1705
|
`Invalid library name "${name}": use letters, digits, "_" or "-", starting with a letter or digit.`
|
|
@@ -1573,6 +1744,8 @@ var LibraryManager = class {
|
|
|
1573
1744
|
createdAt: now,
|
|
1574
1745
|
updatedAt: now
|
|
1575
1746
|
}).run();
|
|
1747
|
+
clearLibraryUnregistered({ name: input.name, path: input.path });
|
|
1748
|
+
clearLibraryRenamed(input.name);
|
|
1576
1749
|
return this.requireLibrary(id);
|
|
1577
1750
|
}
|
|
1578
1751
|
async listLibraries() {
|
|
@@ -1593,6 +1766,19 @@ var LibraryManager = class {
|
|
|
1593
1766
|
if (!lib) throw new UserLibraryNotFoundError(nameOrId);
|
|
1594
1767
|
return lib;
|
|
1595
1768
|
}
|
|
1769
|
+
/**
|
|
1770
|
+
* {@link requireLibrary}, then refuse a library whose registered directory is gone: one line
|
|
1771
|
+
* that names the path and the two ways out. For every verb that reads or writes the files.
|
|
1772
|
+
*
|
|
1773
|
+
* @throws LibrarySyncError (`library_dir_missing`) when the directory does not exist.
|
|
1774
|
+
*/
|
|
1775
|
+
async requireLibraryDir(nameOrId) {
|
|
1776
|
+
const lib = await this.requireLibrary(nameOrId);
|
|
1777
|
+
if (libraryDirMissing(lib)) {
|
|
1778
|
+
throw new LibrarySyncError(missingLibraryDirMessage(lib), "library_dir_missing");
|
|
1779
|
+
}
|
|
1780
|
+
return lib;
|
|
1781
|
+
}
|
|
1596
1782
|
async updateLibrary(nameOrId, patch) {
|
|
1597
1783
|
const lib = await this.requireLibrary(nameOrId);
|
|
1598
1784
|
if (patch.name !== void 0 && patch.name !== lib.name) assertValidLibraryName(patch.name);
|
|
@@ -1610,6 +1796,9 @@ var LibraryManager = class {
|
|
|
1610
1796
|
if (patch.isDefault !== void 0) updates.isDefault = patch.isDefault;
|
|
1611
1797
|
if (patch.lastSyncAt !== void 0) updates.lastSyncAt = patch.lastSyncAt.toISOString();
|
|
1612
1798
|
await db.update(libraries).set(updates).where(eq(libraries.id, lib.id)).run();
|
|
1799
|
+
if (patch.name !== void 0 && patch.name !== lib.name) {
|
|
1800
|
+
recordLibraryRename(lib.name, patch.name);
|
|
1801
|
+
}
|
|
1613
1802
|
return this.requireLibrary(lib.id);
|
|
1614
1803
|
}
|
|
1615
1804
|
/**
|
|
@@ -1635,9 +1824,11 @@ var LibraryManager = class {
|
|
|
1635
1824
|
async removeLibrary(nameOrId, opts = {}) {
|
|
1636
1825
|
const lib = await this.requireLibrary(nameOrId);
|
|
1637
1826
|
await this.lib.removeSource(lib.id);
|
|
1638
|
-
if (opts.purge &&
|
|
1639
|
-
|
|
1827
|
+
if (opts.purge && fs11.existsSync(lib.path)) {
|
|
1828
|
+
fs11.rmSync(lib.path, { recursive: true, force: true });
|
|
1640
1829
|
}
|
|
1830
|
+
dropLibraryRenamesTo(lib.name);
|
|
1831
|
+
if (!opts.purge) markLibraryUnregistered(lib);
|
|
1641
1832
|
}
|
|
1642
1833
|
/**
|
|
1643
1834
|
* Idempotently ensure a `personal` library exists at `<librariesDir>/personal`.
|
|
@@ -1652,8 +1843,8 @@ var LibraryManager = class {
|
|
|
1652
1843
|
(l) => l.isDefault && (l.ownership === "owner" || l.ownership === "contributor")
|
|
1653
1844
|
);
|
|
1654
1845
|
if (writableDefault) return { library: writableDefault, created: false };
|
|
1655
|
-
const personalPath =
|
|
1656
|
-
|
|
1846
|
+
const personalPath = path16.join(librariesDir, "personal");
|
|
1847
|
+
fs11.mkdirSync(personalPath, { recursive: true });
|
|
1657
1848
|
const lib = await this.addLibrary({
|
|
1658
1849
|
name: "personal",
|
|
1659
1850
|
path: personalPath,
|
|
@@ -1684,7 +1875,7 @@ function describeSyncError(err) {
|
|
|
1684
1875
|
return parts.join(": ");
|
|
1685
1876
|
}
|
|
1686
1877
|
function scanLibraryRoot(rootPath, registry, scanOpts) {
|
|
1687
|
-
const fallbackPublisher = resolveSourcePublisher(rootPath) ?? (
|
|
1878
|
+
const fallbackPublisher = resolveSourcePublisher(rootPath) ?? (path16.basename(rootPath) || "unknown");
|
|
1688
1879
|
const opts = {
|
|
1689
1880
|
registry,
|
|
1690
1881
|
sidecarManifestFile: scanOpts?.sidecarManifestFile,
|
|
@@ -1783,7 +1974,9 @@ var LocalCatalogSource = class {
|
|
|
1783
1974
|
async sync(syncOpts) {
|
|
1784
1975
|
const result = this.scan(syncOpts);
|
|
1785
1976
|
const exclude = syncOpts?.exclude;
|
|
1786
|
-
const
|
|
1977
|
+
const only = syncOpts?.only;
|
|
1978
|
+
const kept = exclude ? result.assets.filter((a) => !exclude(a)) : result.assets;
|
|
1979
|
+
const assets = only ? kept.filter((a) => only.has(a.ref)) : kept;
|
|
1787
1980
|
let assetsUpdated = 0;
|
|
1788
1981
|
const errors = [];
|
|
1789
1982
|
const softDepsByRef = /* @__PURE__ */ new Map();
|
|
@@ -1835,8 +2028,11 @@ var LocalCatalogSource = class {
|
|
|
1835
2028
|
);
|
|
1836
2029
|
}
|
|
1837
2030
|
const keepRefs = assets.map((a) => a.ref);
|
|
1838
|
-
|
|
1839
|
-
|
|
2031
|
+
let pruned = [];
|
|
2032
|
+
if (!syncOpts?.only && result.assets.length > 0) {
|
|
2033
|
+
pruned = await this.library.pruneAssetDefs(this.sourceId, keepRefs);
|
|
2034
|
+
}
|
|
2035
|
+
return { assetsFound: assets.length, assetsUpdated, errors, advisories, pruned };
|
|
1840
2036
|
}
|
|
1841
2037
|
};
|
|
1842
2038
|
function defToCatalogAsset(def) {
|
|
@@ -1913,7 +2109,7 @@ function installLibraryAsset(opts) {
|
|
|
1913
2109
|
}
|
|
1914
2110
|
function authoringLibraries(libs) {
|
|
1915
2111
|
const newRoot = getGlobalCacheDir();
|
|
1916
|
-
const legacyRoot =
|
|
2112
|
+
const legacyRoot = path16.join(globalSkaileDir(), "sources");
|
|
1917
2113
|
return libs.filter((l) => !l.path.startsWith(newRoot) && !l.path.startsWith(legacyRoot));
|
|
1918
2114
|
}
|
|
1919
2115
|
async function scanAuthoringLibraries(index, registry) {
|
|
@@ -1975,21 +2171,21 @@ var SidecarGit = class {
|
|
|
1975
2171
|
* @docLink packages/library/concepts#sidecar-git
|
|
1976
2172
|
*/
|
|
1977
2173
|
async ensureInitialized() {
|
|
1978
|
-
if (!
|
|
1979
|
-
|
|
2174
|
+
if (!fs11.existsSync(this.rootDir)) {
|
|
2175
|
+
fs11.mkdirSync(this.rootDir, { recursive: true });
|
|
1980
2176
|
}
|
|
1981
|
-
const gitDir =
|
|
1982
|
-
const freshRepo = !
|
|
2177
|
+
const gitDir = path16.join(this.rootDir, ".git");
|
|
2178
|
+
const freshRepo = !fs11.existsSync(gitDir);
|
|
1983
2179
|
if (freshRepo) {
|
|
1984
2180
|
const init = this.spawn(["init", "-b", "main"]);
|
|
1985
2181
|
if (init.exitCode !== 0) {
|
|
1986
2182
|
throw new Error(`git init failed: ${init.stderr || init.stdout}`);
|
|
1987
2183
|
}
|
|
1988
2184
|
}
|
|
1989
|
-
const attrsPath =
|
|
1990
|
-
if (!
|
|
1991
|
-
const readmePath =
|
|
1992
|
-
if (!
|
|
2185
|
+
const attrsPath = path16.join(this.rootDir, ".gitattributes");
|
|
2186
|
+
if (!fs11.existsSync(attrsPath)) fs11.writeFileSync(attrsPath, GITATTRIBUTES, "utf-8");
|
|
2187
|
+
const readmePath = path16.join(this.rootDir, "README.md");
|
|
2188
|
+
if (!fs11.existsSync(readmePath)) fs11.writeFileSync(readmePath, ROOT_README, "utf-8");
|
|
1993
2189
|
if (!this.hasGlobalGitConfig("user.name")) {
|
|
1994
2190
|
this.spawn(["config", "user.name", FALLBACK_USER_NAME]);
|
|
1995
2191
|
}
|
|
@@ -2014,8 +2210,8 @@ var SidecarGit = class {
|
|
|
2014
2210
|
*/
|
|
2015
2211
|
async commit(slug, message, opts) {
|
|
2016
2212
|
if (opts?.skip) return;
|
|
2017
|
-
const slugDir =
|
|
2018
|
-
if (
|
|
2213
|
+
const slugDir = path16.join(this.rootDir, slug);
|
|
2214
|
+
if (fs11.existsSync(slugDir)) {
|
|
2019
2215
|
this.spawn(["add", "--", slug]);
|
|
2020
2216
|
} else {
|
|
2021
2217
|
this.spawn(["add", "-A"]);
|
|
@@ -2075,11 +2271,11 @@ ${result.stderr}`;
|
|
|
2075
2271
|
};
|
|
2076
2272
|
function migrateWorkspaceConfig(dir, opts) {
|
|
2077
2273
|
const filename = opts?.filename ?? "skaile.yaml";
|
|
2078
|
-
const filePath =
|
|
2079
|
-
if (!
|
|
2274
|
+
const filePath = path16.join(dir, filename);
|
|
2275
|
+
if (!fs11.existsSync(filePath)) {
|
|
2080
2276
|
return { migrated: false, version: 1, warnings: ["No skaile.yaml found"] };
|
|
2081
2277
|
}
|
|
2082
|
-
const content =
|
|
2278
|
+
const content = fs11.readFileSync(filePath, "utf-8");
|
|
2083
2279
|
const raw = parse(content);
|
|
2084
2280
|
if (!raw || typeof raw !== "object") {
|
|
2085
2281
|
return { migrated: false, version: 1, warnings: ["Invalid YAML content"] };
|
|
@@ -2111,7 +2307,7 @@ function migrateWorkspaceConfig(dir, opts) {
|
|
|
2111
2307
|
} else {
|
|
2112
2308
|
doc.set("version", 2);
|
|
2113
2309
|
}
|
|
2114
|
-
|
|
2310
|
+
fs11.writeFileSync(filePath, doc.toString(), "utf-8");
|
|
2115
2311
|
}
|
|
2116
2312
|
return {
|
|
2117
2313
|
migrated: !opts?.dryRun,
|
|
@@ -2300,8 +2496,8 @@ function resolveTemplate(template, context) {
|
|
|
2300
2496
|
});
|
|
2301
2497
|
return { value: result, hasSecret: false };
|
|
2302
2498
|
}
|
|
2303
|
-
function setNestedValue(obj,
|
|
2304
|
-
const parts =
|
|
2499
|
+
function setNestedValue(obj, path18, value) {
|
|
2500
|
+
const parts = path18.split(".");
|
|
2305
2501
|
let current = obj;
|
|
2306
2502
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
2307
2503
|
const key = parts[i];
|
|
@@ -2906,8 +3102,8 @@ function deepEqual(a, b) {
|
|
|
2906
3102
|
function defaultCatalogCacheDir() {
|
|
2907
3103
|
const home = globalSkaileDir();
|
|
2908
3104
|
return migrateLegacyDir(
|
|
2909
|
-
|
|
2910
|
-
|
|
3105
|
+
path16.join(globalCacheRoot(), "catalog"),
|
|
3106
|
+
path16.join(home, "catalog-cache")
|
|
2911
3107
|
);
|
|
2912
3108
|
}
|
|
2913
3109
|
var INDEX_FILE = "index.json";
|
|
@@ -2916,11 +3112,13 @@ var CatalogCache = class {
|
|
|
2916
3112
|
dir;
|
|
2917
3113
|
ttlMs;
|
|
2918
3114
|
nowFn;
|
|
3115
|
+
scopePrefix;
|
|
2919
3116
|
index = null;
|
|
2920
3117
|
constructor(opts) {
|
|
2921
3118
|
this.dir = opts.dir ?? defaultCatalogCacheDir();
|
|
2922
3119
|
this.ttlMs = opts.ttlMs;
|
|
2923
3120
|
this.nowFn = opts.now ?? Date.now;
|
|
3121
|
+
this.scopePrefix = opts.scope === void 0 ? "" : `${scopeHash(opts.scope)}|`;
|
|
2924
3122
|
this.ensureDir();
|
|
2925
3123
|
}
|
|
2926
3124
|
// ── public: resolve cache ───────────────────────────────────────────────
|
|
@@ -2931,8 +3129,7 @@ var CatalogCache = class {
|
|
|
2931
3129
|
* regardless of `fetchedAt`.
|
|
2932
3130
|
*/
|
|
2933
3131
|
getResolve(ref) {
|
|
2934
|
-
const
|
|
2935
|
-
const entry = idx.resolve[ref];
|
|
3132
|
+
const entry = this.lookupResolve(ref);
|
|
2936
3133
|
if (!entry) return null;
|
|
2937
3134
|
if (this.ttlMs === 0) return entry;
|
|
2938
3135
|
if (this.nowFn() - entry.fetchedAt > this.ttlMs) return null;
|
|
@@ -2942,21 +3139,40 @@ var CatalogCache = class {
|
|
|
2942
3139
|
* Return a stale resolve-cache entry regardless of TTL — for stale-while-revalidate.
|
|
2943
3140
|
*/
|
|
2944
3141
|
getResolveStale(ref) {
|
|
2945
|
-
|
|
2946
|
-
return idx.resolve[ref] ?? null;
|
|
3142
|
+
return this.lookupResolve(ref);
|
|
2947
3143
|
}
|
|
2948
|
-
/**
|
|
3144
|
+
/**
|
|
3145
|
+
* Persist a resolve-cache entry (use `null` to negatively cache misses). A found asset
|
|
3146
|
+
* is stored under its canonical ref and shared by every catalog; a miss is only true
|
|
3147
|
+
* of this catalog, so it is stored under the catalog scope.
|
|
3148
|
+
*/
|
|
2949
3149
|
setResolve(ref, value) {
|
|
2950
3150
|
const idx = this.loadIndex();
|
|
2951
|
-
|
|
3151
|
+
const entry = { fetchedAt: this.nowFn(), value };
|
|
3152
|
+
if (value === null) {
|
|
3153
|
+
idx.resolve[this.scopePrefix + ref] = entry;
|
|
3154
|
+
} else {
|
|
3155
|
+
idx.resolve[ref] = entry;
|
|
3156
|
+
if (this.scopePrefix) delete idx.resolve[this.scopePrefix + ref];
|
|
3157
|
+
}
|
|
2952
3158
|
this.writeIndex(idx);
|
|
2953
3159
|
}
|
|
3160
|
+
/**
|
|
3161
|
+
* A shared hit, else this catalog's own miss. An unscoped entry holding `null` was
|
|
3162
|
+
* written before misses were scoped and may belong to another catalog: ignore it.
|
|
3163
|
+
*/
|
|
3164
|
+
lookupResolve(ref) {
|
|
3165
|
+
const idx = this.loadIndex();
|
|
3166
|
+
const shared = idx.resolve[ref];
|
|
3167
|
+
if (shared && shared.value !== null) return shared;
|
|
3168
|
+
return idx.resolve[this.scopePrefix + ref] ?? null;
|
|
3169
|
+
}
|
|
2954
3170
|
// ── public: list cache ──────────────────────────────────────────────────
|
|
2955
3171
|
/**
|
|
2956
3172
|
* Return a fresh list-cache entry for `filter`, or `null` if absent / stale.
|
|
2957
3173
|
*/
|
|
2958
3174
|
getList(filter) {
|
|
2959
|
-
const key = filterKey(filter);
|
|
3175
|
+
const key = this.scopePrefix + filterKey(filter);
|
|
2960
3176
|
const idx = this.loadIndex();
|
|
2961
3177
|
const entry = idx.list[key];
|
|
2962
3178
|
if (!entry) return null;
|
|
@@ -2966,13 +3182,13 @@ var CatalogCache = class {
|
|
|
2966
3182
|
}
|
|
2967
3183
|
/** Return a stale list-cache entry regardless of TTL — for stale-while-revalidate. */
|
|
2968
3184
|
getListStale(filter) {
|
|
2969
|
-
const key = filterKey(filter);
|
|
3185
|
+
const key = this.scopePrefix + filterKey(filter);
|
|
2970
3186
|
const idx = this.loadIndex();
|
|
2971
3187
|
return idx.list[key] ?? null;
|
|
2972
3188
|
}
|
|
2973
3189
|
/** Persist a list-cache entry. */
|
|
2974
3190
|
setList(filter, items) {
|
|
2975
|
-
const key = filterKey(filter);
|
|
3191
|
+
const key = this.scopePrefix + filterKey(filter);
|
|
2976
3192
|
const idx = this.loadIndex();
|
|
2977
3193
|
idx.list[key] = { fetchedAt: this.nowFn(), items };
|
|
2978
3194
|
this.writeIndex(idx);
|
|
@@ -2980,22 +3196,22 @@ var CatalogCache = class {
|
|
|
2980
3196
|
// ── public: tarball cache ───────────────────────────────────────────────
|
|
2981
3197
|
/** Absolute path where a tarball with `sha256` would be cached. */
|
|
2982
3198
|
tarballPath(sha256) {
|
|
2983
|
-
return
|
|
3199
|
+
return path16.join(this.dir, TARBALL_DIR, `${sha256}.tgz`);
|
|
2984
3200
|
}
|
|
2985
3201
|
/** Read a cached tarball from disk if present, otherwise `null`. */
|
|
2986
3202
|
readTarball(sha256) {
|
|
2987
3203
|
const p = this.tarballPath(sha256);
|
|
2988
|
-
if (!
|
|
2989
|
-
return
|
|
3204
|
+
if (!fs11.existsSync(p)) return null;
|
|
3205
|
+
return fs11.readFileSync(p);
|
|
2990
3206
|
}
|
|
2991
3207
|
/** Persist a tarball blob to disk (atomic write). */
|
|
2992
3208
|
writeTarball(sha256, bytes) {
|
|
2993
|
-
const dir =
|
|
2994
|
-
if (!
|
|
3209
|
+
const dir = path16.join(this.dir, TARBALL_DIR);
|
|
3210
|
+
if (!fs11.existsSync(dir)) fs11.mkdirSync(dir, { recursive: true });
|
|
2995
3211
|
const finalPath = this.tarballPath(sha256);
|
|
2996
3212
|
const tmpPath = `${finalPath}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
2997
|
-
|
|
2998
|
-
|
|
3213
|
+
fs11.writeFileSync(tmpPath, bytes);
|
|
3214
|
+
fs11.renameSync(tmpPath, finalPath);
|
|
2999
3215
|
}
|
|
3000
3216
|
// ── public: invalidation ────────────────────────────────────────────────
|
|
3001
3217
|
/**
|
|
@@ -3014,9 +3230,9 @@ var CatalogCache = class {
|
|
|
3014
3230
|
*/
|
|
3015
3231
|
invalidateEverything() {
|
|
3016
3232
|
this.invalidateAll();
|
|
3017
|
-
const tarballDir =
|
|
3018
|
-
if (
|
|
3019
|
-
|
|
3233
|
+
const tarballDir = path16.join(this.dir, TARBALL_DIR);
|
|
3234
|
+
if (fs11.existsSync(tarballDir)) {
|
|
3235
|
+
fs11.rmSync(tarballDir, { recursive: true, force: true });
|
|
3020
3236
|
}
|
|
3021
3237
|
}
|
|
3022
3238
|
/** Return whether `ttlMs` is zero (air-gapped mode). */
|
|
@@ -3025,22 +3241,22 @@ var CatalogCache = class {
|
|
|
3025
3241
|
}
|
|
3026
3242
|
// ── private ─────────────────────────────────────────────────────────────
|
|
3027
3243
|
ensureDir() {
|
|
3028
|
-
if (!
|
|
3029
|
-
const tarballDir =
|
|
3030
|
-
if (!
|
|
3244
|
+
if (!fs11.existsSync(this.dir)) fs11.mkdirSync(this.dir, { recursive: true });
|
|
3245
|
+
const tarballDir = path16.join(this.dir, TARBALL_DIR);
|
|
3246
|
+
if (!fs11.existsSync(tarballDir)) fs11.mkdirSync(tarballDir, { recursive: true });
|
|
3031
3247
|
}
|
|
3032
3248
|
indexPath() {
|
|
3033
|
-
return
|
|
3249
|
+
return path16.join(this.dir, INDEX_FILE);
|
|
3034
3250
|
}
|
|
3035
3251
|
loadIndex() {
|
|
3036
3252
|
if (this.index) return this.index;
|
|
3037
3253
|
const p = this.indexPath();
|
|
3038
|
-
if (!
|
|
3254
|
+
if (!fs11.existsSync(p)) {
|
|
3039
3255
|
this.index = { version: 1, resolve: {}, list: {} };
|
|
3040
3256
|
return this.index;
|
|
3041
3257
|
}
|
|
3042
3258
|
try {
|
|
3043
|
-
const raw = JSON.parse(
|
|
3259
|
+
const raw = JSON.parse(fs11.readFileSync(p, "utf-8"));
|
|
3044
3260
|
if (raw && typeof raw === "object" && raw.version === 1) {
|
|
3045
3261
|
this.index = {
|
|
3046
3262
|
version: 1,
|
|
@@ -3058,8 +3274,8 @@ var CatalogCache = class {
|
|
|
3058
3274
|
this.index = idx;
|
|
3059
3275
|
const p = this.indexPath();
|
|
3060
3276
|
const tmp = `${p}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
3061
|
-
|
|
3062
|
-
|
|
3277
|
+
fs11.writeFileSync(tmp, JSON.stringify(idx, null, 2), "utf-8");
|
|
3278
|
+
fs11.renameSync(tmp, p);
|
|
3063
3279
|
}
|
|
3064
3280
|
};
|
|
3065
3281
|
function filterKey(filter) {
|
|
@@ -3072,6 +3288,9 @@ function filterKey(filter) {
|
|
|
3072
3288
|
}
|
|
3073
3289
|
return Object.keys(norm).length === 0 ? "__all__" : JSON.stringify(norm);
|
|
3074
3290
|
}
|
|
3291
|
+
function scopeHash(scope) {
|
|
3292
|
+
return crypto.createHash("sha256").update(scope.replace(/\/+$/, "")).digest("hex").slice(0, 16);
|
|
3293
|
+
}
|
|
3075
3294
|
function sha256Hex(bytes) {
|
|
3076
3295
|
const h = crypto.createHash("sha256");
|
|
3077
3296
|
h.update(bytes);
|
|
@@ -3124,6 +3343,7 @@ var RemoteCatalogSource = class {
|
|
|
3124
3343
|
this.cache = opts.cache ?? new CatalogCache({
|
|
3125
3344
|
dir: opts.cacheDir,
|
|
3126
3345
|
ttlMs: this.cacheTtlMs,
|
|
3346
|
+
scope: this.baseUrl,
|
|
3127
3347
|
now: opts.now
|
|
3128
3348
|
});
|
|
3129
3349
|
}
|
|
@@ -3564,6 +3784,7 @@ var RestCatalogSource = class {
|
|
|
3564
3784
|
this.cache = opts.cache ?? new CatalogCache({
|
|
3565
3785
|
dir: opts.cacheDir,
|
|
3566
3786
|
ttlMs: this.cacheTtlMs,
|
|
3787
|
+
scope: this.baseUrl,
|
|
3567
3788
|
now: opts.now
|
|
3568
3789
|
});
|
|
3569
3790
|
}
|
|
@@ -3894,7 +4115,7 @@ var defaultFetch2 = async (url, init) => {
|
|
|
3894
4115
|
});
|
|
3895
4116
|
};
|
|
3896
4117
|
function discoveredToAssetEntry(asset, repoPublisher, inheritPublisher) {
|
|
3897
|
-
const root =
|
|
4118
|
+
const root = path16.posix.dirname(asset.relativePath.replace(/\\/g, "/"));
|
|
3898
4119
|
const entry = {
|
|
3899
4120
|
kind: asset.kind,
|
|
3900
4121
|
name: asset.name,
|
|
@@ -3911,22 +4132,22 @@ function discoveredToAssetEntry(asset, repoPublisher, inheritPublisher) {
|
|
|
3911
4132
|
}
|
|
3912
4133
|
function writeCuratedManifest(input) {
|
|
3913
4134
|
const manifestPath = input.manifestFile;
|
|
3914
|
-
if (
|
|
4135
|
+
if (fs11.existsSync(manifestPath) && !input.force) {
|
|
3915
4136
|
return { wrote: false, manifestPath, assetCount: 0 };
|
|
3916
4137
|
}
|
|
3917
4138
|
const publisher = input.publisher.startsWith("@") ? input.publisher.slice(1) : input.publisher;
|
|
3918
4139
|
const inheritPublisher = input.inheritPublisher ?? false;
|
|
3919
4140
|
const assets = input.assets.map((a) => discoveredToAssetEntry(a, publisher, inheritPublisher)).sort((a, b) => `${a.kind}:${a.name}`.localeCompare(`${b.kind}:${b.name}`));
|
|
3920
4141
|
const manifest = { publisher, assets };
|
|
3921
|
-
|
|
3922
|
-
|
|
4142
|
+
fs11.mkdirSync(path16.dirname(manifestPath), { recursive: true });
|
|
4143
|
+
fs11.writeFileSync(manifestPath, encodeSkaileManifest(manifest), "utf-8");
|
|
3923
4144
|
return { wrote: true, manifestPath, assetCount: assets.length };
|
|
3924
4145
|
}
|
|
3925
4146
|
function openManifest(libraryPath) {
|
|
3926
|
-
const dir =
|
|
3927
|
-
const file =
|
|
3928
|
-
if (!
|
|
3929
|
-
|
|
4147
|
+
const dir = path16.resolve(libraryPath);
|
|
4148
|
+
const file = path16.join(dir, SKAILE_MANIFEST_FILENAME);
|
|
4149
|
+
if (!fs11.existsSync(file)) {
|
|
4150
|
+
fs11.mkdirSync(dir, { recursive: true });
|
|
3930
4151
|
return { editor: ManifestYamlEditor.create(file), created: true };
|
|
3931
4152
|
}
|
|
3932
4153
|
const editor = ManifestYamlEditor.load(file);
|
|
@@ -3938,16 +4159,16 @@ function assertManifestEditable(libraryPath) {
|
|
|
3938
4159
|
openManifest(libraryPath);
|
|
3939
4160
|
}
|
|
3940
4161
|
function conflictingAssetRoot(libraryPath, kind, name, root) {
|
|
3941
|
-
const existing = loadSkPublishManifest(
|
|
4162
|
+
const existing = loadSkPublishManifest(path16.resolve(libraryPath))?.assets?.find(
|
|
3942
4163
|
(a) => a.kind === kind && a.name === name
|
|
3943
4164
|
);
|
|
3944
4165
|
return existingRootConflict(libraryPath, existing, root);
|
|
3945
4166
|
}
|
|
3946
4167
|
function existingRootConflict(libraryPath, existing, root) {
|
|
3947
4168
|
if (!existing?.root || existing.source) return void 0;
|
|
3948
|
-
const existingAbs =
|
|
3949
|
-
if (existingAbs ===
|
|
3950
|
-
const stat =
|
|
4169
|
+
const existingAbs = path16.resolve(libraryPath, existing.root);
|
|
4170
|
+
if (existingAbs === path16.resolve(libraryPath, root)) return void 0;
|
|
4171
|
+
const stat = fs11.statSync(existingAbs, { throwIfNoEntry: false });
|
|
3951
4172
|
return stat?.isDirectory() ? existing.root : void 0;
|
|
3952
4173
|
}
|
|
3953
4174
|
function upsertManifestAsset(libraryPath, input) {
|
|
@@ -3981,8 +4202,8 @@ function upsertManifestAsset(libraryPath, input) {
|
|
|
3981
4202
|
function missingRootAssets(libraryPath, manifest) {
|
|
3982
4203
|
return (manifest.assets ?? []).filter((a) => {
|
|
3983
4204
|
if (a.source || manifest.source || !a.root) return false;
|
|
3984
|
-
const dir =
|
|
3985
|
-
return !(
|
|
4205
|
+
const dir = path16.resolve(libraryPath, a.root);
|
|
4206
|
+
return !(fs11.existsSync(dir) && fs11.statSync(dir).isDirectory());
|
|
3986
4207
|
});
|
|
3987
4208
|
}
|
|
3988
4209
|
function pruneMissingRootAssets(libraryPath) {
|
|
@@ -4021,18 +4242,19 @@ function setManifestPublisher(libraryPath, publisher) {
|
|
|
4021
4242
|
editor.save();
|
|
4022
4243
|
return true;
|
|
4023
4244
|
}
|
|
4024
|
-
async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
|
|
4245
|
+
async function syncManifestWithDisk(libraryPath, defaultPublisher, registry, opts = {}) {
|
|
4025
4246
|
stampManifestPublisher(libraryPath, defaultPublisher);
|
|
4026
4247
|
const knownKinds = new Set(registry.getAllKinds());
|
|
4027
4248
|
const unknownKind = pruneUnknownKindAssets(libraryPath, knownKinds);
|
|
4028
4249
|
const removed = pruneMissingRootAssets(libraryPath);
|
|
4029
4250
|
const skipped = [];
|
|
4251
|
+
const failed = [];
|
|
4030
4252
|
const publisher = loadSkPublishManifest(libraryPath)?.publisher ?? defaultPublisher;
|
|
4031
4253
|
const scanned = await scanDirectory(libraryPath, publisher, {
|
|
4032
4254
|
knownKinds,
|
|
4033
4255
|
keepDuplicates: true
|
|
4034
4256
|
});
|
|
4035
|
-
const rootOf = (e) =>
|
|
4257
|
+
const rootOf = (e) => path16.relative(libraryPath, path16.dirname(e.source)) || e.name;
|
|
4036
4258
|
const copiesOf = /* @__PURE__ */ new Map();
|
|
4037
4259
|
for (const e of scanned) {
|
|
4038
4260
|
const key = `${e.kind}:${e.name}`;
|
|
@@ -4045,6 +4267,9 @@ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
|
|
|
4045
4267
|
);
|
|
4046
4268
|
if (copies.length > 1 && !claimed) unclaimed.add(key);
|
|
4047
4269
|
}
|
|
4270
|
+
const listedAtStart = new Set(
|
|
4271
|
+
(loadSkPublishManifest(libraryPath)?.assets ?? []).map((a) => `${a.kind}:${a.name}`)
|
|
4272
|
+
);
|
|
4048
4273
|
for (const e of scanned) {
|
|
4049
4274
|
if (!isParsable(e.source)) {
|
|
4050
4275
|
skipped.push({
|
|
@@ -4052,7 +4277,7 @@ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
|
|
|
4052
4277
|
name: e.name,
|
|
4053
4278
|
reason: "unparsable",
|
|
4054
4279
|
detail: "manifest file could not be parsed",
|
|
4055
|
-
file:
|
|
4280
|
+
file: path16.relative(libraryPath, e.source)
|
|
4056
4281
|
});
|
|
4057
4282
|
continue;
|
|
4058
4283
|
}
|
|
@@ -4062,7 +4287,7 @@ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
|
|
|
4062
4287
|
name: e.name,
|
|
4063
4288
|
reason: "invalid-version",
|
|
4064
4289
|
detail: `version "${e.version}" is not valid semver`,
|
|
4065
|
-
file:
|
|
4290
|
+
file: path16.relative(libraryPath, e.source)
|
|
4066
4291
|
});
|
|
4067
4292
|
continue;
|
|
4068
4293
|
}
|
|
@@ -4077,10 +4302,23 @@ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
|
|
|
4077
4302
|
name: e.name,
|
|
4078
4303
|
reason: "duplicate",
|
|
4079
4304
|
detail: conflict,
|
|
4080
|
-
file:
|
|
4305
|
+
file: path16.relative(libraryPath, e.source)
|
|
4081
4306
|
});
|
|
4082
4307
|
continue;
|
|
4083
4308
|
}
|
|
4309
|
+
const findings = opts.check?.(e) ?? [];
|
|
4310
|
+
const known = listedAtStart.has(`${e.kind}:${e.name}`);
|
|
4311
|
+
const inManifest = known || !(findings.length > 0 && !e.version);
|
|
4312
|
+
if (findings.length > 0) {
|
|
4313
|
+
failed.push({
|
|
4314
|
+
kind: e.kind,
|
|
4315
|
+
name: e.name,
|
|
4316
|
+
file: path16.relative(libraryPath, e.source),
|
|
4317
|
+
findings,
|
|
4318
|
+
inManifest
|
|
4319
|
+
});
|
|
4320
|
+
}
|
|
4321
|
+
if (!inManifest) continue;
|
|
4084
4322
|
upsertManifestAsset(libraryPath, {
|
|
4085
4323
|
kind: e.kind,
|
|
4086
4324
|
name: e.name,
|
|
@@ -4088,11 +4326,35 @@ async function syncManifestWithDisk(libraryPath, defaultPublisher, registry) {
|
|
|
4088
4326
|
version: e.version
|
|
4089
4327
|
});
|
|
4090
4328
|
}
|
|
4091
|
-
return { removed, unknownKind, skipped };
|
|
4329
|
+
return { removed, unknownKind, skipped, failed };
|
|
4330
|
+
}
|
|
4331
|
+
async function scanUnlistedAssets(libraryPath, publisher, registry) {
|
|
4332
|
+
const manifest = loadSkPublishManifest(libraryPath);
|
|
4333
|
+
if (!manifest || manifest.source) return [];
|
|
4334
|
+
const entries = manifest.assets ?? [];
|
|
4335
|
+
const roots = entries.flatMap(
|
|
4336
|
+
(a) => a.root && !a.source ? [path16.resolve(libraryPath, a.root)] : []
|
|
4337
|
+
);
|
|
4338
|
+
const scanned = await scanDirectory(libraryPath, manifest.publisher ?? publisher, {
|
|
4339
|
+
knownKinds: new Set(registry.getAllKinds()),
|
|
4340
|
+
keepDuplicates: true
|
|
4341
|
+
});
|
|
4342
|
+
const out = [];
|
|
4343
|
+
for (const e of scanned) {
|
|
4344
|
+
const file = path16.resolve(e.source);
|
|
4345
|
+
if (roots.some((r) => file === r || file.startsWith(r + path16.sep))) continue;
|
|
4346
|
+
const registered = entries.find((a) => a.kind === e.kind && a.name === e.name && a.root);
|
|
4347
|
+
out.push({
|
|
4348
|
+
entry: e,
|
|
4349
|
+
root: path16.relative(libraryPath, path16.dirname(e.source)) || e.name,
|
|
4350
|
+
...registered?.root ? { registeredAt: registered.root } : {}
|
|
4351
|
+
});
|
|
4352
|
+
}
|
|
4353
|
+
return out;
|
|
4092
4354
|
}
|
|
4093
4355
|
function isParsable(file) {
|
|
4094
4356
|
try {
|
|
4095
|
-
return parseManifestFile(file,
|
|
4357
|
+
return parseManifestFile(file, fs11.readFileSync(file, "utf-8")).ok;
|
|
4096
4358
|
} catch {
|
|
4097
4359
|
return false;
|
|
4098
4360
|
}
|
|
@@ -4149,33 +4411,33 @@ function parseWorkspaceV2(raw) {
|
|
|
4149
4411
|
return WorkspaceConfigV2Schema.parse(raw);
|
|
4150
4412
|
}
|
|
4151
4413
|
function loadWorkspaceV2(dir, filename = "skaile.yaml") {
|
|
4152
|
-
const filePath =
|
|
4153
|
-
if (!
|
|
4154
|
-
const content =
|
|
4414
|
+
const filePath = path16.join(dir, filename);
|
|
4415
|
+
if (!fs11.existsSync(filePath)) return null;
|
|
4416
|
+
const content = fs11.readFileSync(filePath, "utf-8");
|
|
4155
4417
|
const raw = parse(content);
|
|
4156
4418
|
if (!raw || typeof raw !== "object") return null;
|
|
4157
4419
|
return parseWorkspaceV2(raw);
|
|
4158
4420
|
}
|
|
4159
4421
|
function saveWorkspaceV2(dir, v2, filename = "skaile.yaml") {
|
|
4160
|
-
const filePath =
|
|
4422
|
+
const filePath = path16.join(dir, filename);
|
|
4161
4423
|
let existing = {};
|
|
4162
|
-
if (
|
|
4163
|
-
const content =
|
|
4424
|
+
if (fs11.existsSync(filePath)) {
|
|
4425
|
+
const content = fs11.readFileSync(filePath, "utf-8");
|
|
4164
4426
|
existing = parse(content) ?? {};
|
|
4165
4427
|
}
|
|
4166
4428
|
existing.version = 2;
|
|
4167
4429
|
if (v2.library !== void 0) existing.library = v2.library;
|
|
4168
4430
|
if (v2.presets_applied !== void 0) existing.presets_applied = v2.presets_applied;
|
|
4169
|
-
if (!
|
|
4170
|
-
|
|
4431
|
+
if (!fs11.existsSync(dir)) {
|
|
4432
|
+
fs11.mkdirSync(dir, { recursive: true });
|
|
4171
4433
|
}
|
|
4172
|
-
|
|
4434
|
+
fs11.writeFileSync(filePath, stringify(existing, { indent: 2 }), "utf-8");
|
|
4173
4435
|
}
|
|
4174
4436
|
var LOCK_FILENAME = "skaile.lock.yaml";
|
|
4175
4437
|
function loadLockFile(dir) {
|
|
4176
|
-
const filePath =
|
|
4177
|
-
if (!
|
|
4178
|
-
const content =
|
|
4438
|
+
const filePath = path16.join(dir, LOCK_FILENAME);
|
|
4439
|
+
if (!fs11.existsSync(filePath)) return null;
|
|
4440
|
+
const content = fs11.readFileSync(filePath, "utf-8");
|
|
4179
4441
|
const raw = parse(content);
|
|
4180
4442
|
if (raw !== null && !("assignments" in raw) && "subscriptions" in raw) {
|
|
4181
4443
|
const legacySubs = raw.subscriptions;
|
|
@@ -4191,11 +4453,11 @@ function loadLockFile(dir) {
|
|
|
4191
4453
|
return LockFileSchema.parse(raw);
|
|
4192
4454
|
}
|
|
4193
4455
|
function saveLockFile(dir, lock) {
|
|
4194
|
-
const filePath =
|
|
4195
|
-
if (!
|
|
4196
|
-
|
|
4456
|
+
const filePath = path16.join(dir, LOCK_FILENAME);
|
|
4457
|
+
if (!fs11.existsSync(dir)) {
|
|
4458
|
+
fs11.mkdirSync(dir, { recursive: true });
|
|
4197
4459
|
}
|
|
4198
|
-
|
|
4460
|
+
fs11.writeFileSync(
|
|
4199
4461
|
filePath,
|
|
4200
4462
|
`# Auto-generated by skaile. Do not edit manually.
|
|
4201
4463
|
${stringify(lock, { indent: 2 })}`,
|
|
@@ -4212,14 +4474,14 @@ function createEmptyLockFile() {
|
|
|
4212
4474
|
};
|
|
4213
4475
|
}
|
|
4214
4476
|
function detectWorkspaceVersion(dir, filename = "skaile.yaml") {
|
|
4215
|
-
const filePath =
|
|
4216
|
-
if (!
|
|
4217
|
-
const content =
|
|
4477
|
+
const filePath = path16.join(dir, filename);
|
|
4478
|
+
if (!fs11.existsSync(filePath)) return null;
|
|
4479
|
+
const content = fs11.readFileSync(filePath, "utf-8");
|
|
4218
4480
|
const raw = parse(content);
|
|
4219
4481
|
if (!raw || typeof raw !== "object") return null;
|
|
4220
4482
|
return raw.version === 2 ? 2 : 1;
|
|
4221
4483
|
}
|
|
4222
4484
|
|
|
4223
|
-
export { AssignmentNotFoundError, CatalogCache, CatalogConfigSchema, CatalogHttpError, DuplicateAssignmentError, DuplicateLibraryNameError, GitSyncDriver, InstanceHasConsumersError, InstanceNotFoundError, InterpolationError, KnowledgeManifestSchema, LIBRARY_BACKENDS, LIBRARY_OWNERSHIPS, LOCAL_CATALOG_URL, LibraryConfigSchema, LibraryError, LibraryInstanceRefSchema, LibraryManager, LibrarySectionSchema, LibrarySyncError, LocalCatalogSource, LocalIndex, LocalSyncDriver, LockAssignmentSchema, LockFileSchema, OfflineError, OperationNotPermittedError, PIN_POLICIES, PinPolicySchema, PresetAppliedSchema, PresetExpandedSchema, RemoteCatalogSource, RequiresEdgeSchema, RestCatalogSource, SidecarGit, SkaileConfigSchema, SourceNotFoundError, TarballHashMismatchError, UserLibraryNotFoundError, WorkspaceConfigV2Schema, applyNonStructuralUpgrade, applyPreset, applyPresetFromData, assertManifestEditable, assertValidLibraryName, classifyRef, cloneOrInitGitRepo, conflictingAssetRoot, createEmptyLockFile, curatedManifestOverlay, deriveSlug, detectChanges, detectNestedPresetRefs, detectWorkspaceVersion, ensureGitRepo, evaluateUpgrade, extractLibraryInstanceId, extractReferencedKeys, filterKey, getConfigDefaults, getDefaultValue, getSidecarRoot, getStoreManifestsDir, getStoreRoot, hasInterpolationTokens, installLibraryAsset, interpolate, isGitRepo, isLocalCatalogUrl, isSecretPlaceholder, knowledgeKindProvider, listSidecarSlugsOnDisk, loadLockFile, loadWorkspaceV2, migrateSidecarsToStoreIfNeeded, migrateWorkspaceConfig, missingRootAssets, parsePreset, parsePresetYaml, parseWorkspaceV2, projectConfigPath, pruneMissingRootAssets, queryInstancePickerChoices, resolveAllItems, resolveConfig, resolveIndexPath, resolveItem, resolvePin, resolveSidecarPaths, saveConfig, saveLockFile, saveWorkspaceV2, scanAuthoringLibraries, scanLibraryRoot, setManifestPublisher, setOriginUrl, sha256Hex, stampManifestPublisher, storeSecrets, syncManifestWithDisk, trackOriginBranch, trpcGetUrl, upsertManifestAsset, validateAllPlaceholders, validateKnowledge, validateNestingDepth, validatePlaceholder, writeCuratedManifest };
|
|
4224
|
-
//# sourceMappingURL=chunk-
|
|
4225
|
-
//# sourceMappingURL=chunk-
|
|
4485
|
+
export { AssignmentNotFoundError, CatalogCache, CatalogConfigSchema, CatalogHttpError, DuplicateAssignmentError, DuplicateLibraryNameError, GitSyncDriver, InstanceHasConsumersError, InstanceNotFoundError, InterpolationError, KnowledgeManifestSchema, LIBRARY_BACKENDS, LIBRARY_OWNERSHIPS, LOCAL_CATALOG_URL, LibraryConfigSchema, LibraryError, LibraryInstanceRefSchema, LibraryManager, LibrarySectionSchema, LibrarySyncError, LocalCatalogSource, LocalIndex, LocalSyncDriver, LockAssignmentSchema, LockFileSchema, OfflineError, OperationNotPermittedError, PIN_POLICIES, PinPolicySchema, PresetAppliedSchema, PresetExpandedSchema, RemoteCatalogSource, RequiresEdgeSchema, RestCatalogSource, SidecarGit, SkaileConfigSchema, SourceNotFoundError, TarballHashMismatchError, UserLibraryNotFoundError, WorkspaceConfigV2Schema, applyNonStructuralUpgrade, applyPreset, applyPresetFromData, assertManifestEditable, assertValidLibraryName, classifyRef, cloneOrInitGitRepo, conflictingAssetRoot, createEmptyLockFile, curatedManifestOverlay, deriveSlug, detectChanges, detectNestedPresetRefs, detectWorkspaceVersion, ensureGitRepo, evaluateUpgrade, extractLibraryInstanceId, extractReferencedKeys, filterKey, getConfigDefaults, getDefaultValue, getSidecarRoot, getStoreManifestsDir, getStoreRoot, hasInterpolationTokens, installLibraryAsset, interpolate, isGitRepo, isLocalCatalogUrl, isSecretPlaceholder, knowledgeKindProvider, libraryDirMissing, listSidecarSlugsOnDisk, loadLockFile, loadWorkspaceV2, markLibraryUnregistered, migrateSidecarsToStoreIfNeeded, migrateWorkspaceConfig, missingLibraryDirMessage, missingRootAssets, parsePreset, parsePresetYaml, parseWorkspaceV2, projectConfigPath, pruneMissingRootAssets, queryInstancePickerChoices, recordLibraryRename, renamedLibraryName, resolveAllItems, resolveConfig, resolveIndexPath, resolveItem, resolvePin, resolveSidecarPaths, saveConfig, saveLockFile, saveWorkspaceV2, scanAuthoringLibraries, scanLibraryRoot, scanUnlistedAssets, setManifestPublisher, setOriginUrl, sha256Hex, stampManifestPublisher, storeSecrets, syncManifestWithDisk, trackOriginBranch, trpcGetUrl, unregisteredLibraryNames, upsertManifestAsset, validateAllPlaceholders, validateKnowledge, validateNestingDepth, validatePlaceholder, writeCuratedManifest };
|
|
4486
|
+
//# sourceMappingURL=chunk-2F5AWQX5.js.map
|
|
4487
|
+
//# sourceMappingURL=chunk-2F5AWQX5.js.map
|