@skaile/workspaces 6.16.0 → 6.17.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 +18 -0
- package/dist/{agent-file-refresh-76NNFB4W.js → agent-file-refresh-RZWE25KN.js} +33 -33
- package/dist/{agent-file-refresh-76NNFB4W.js.map → agent-file-refresh-RZWE25KN.js.map} +1 -1
- package/dist/ai-sdk.js +4 -4
- package/dist/{asset-feeds-ON7FYHHF.js → asset-feeds-W4A2UFNX.js} +16 -16
- package/dist/{asset-feeds-ON7FYHHF.js.map → asset-feeds-W4A2UFNX.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +3 -3
- package/dist/asset-manager/history.js +3 -3
- package/dist/asset-manager/index.js +8 -8
- package/dist/asset-manager/installer.js +7 -7
- package/dist/asset-manager/renderers.js +4 -4
- package/dist/bridge/harnesses/claude-sdk.js +7 -7
- package/dist/bridge/harnesses/codex.js +7 -7
- package/dist/bridge/harnesses/continue.js +8 -8
- package/dist/bridge/harnesses/echo.js +3 -3
- package/dist/bridge/harnesses/gemini.js +6 -6
- package/dist/bridge/harnesses/goose.js +8 -8
- package/dist/bridge/harnesses/omp.js +5 -5
- package/dist/bridge/harnesses/opencode.js +9 -9
- package/dist/bridge/harnesses/qwen.js +6 -6
- package/dist/bridge/index.js +13 -13
- package/dist/{chunk-BTMSHGN3.js → chunk-2QNDAGYL.js} +4 -4
- package/dist/{chunk-BTMSHGN3.js.map → chunk-2QNDAGYL.js.map} +1 -1
- package/dist/{chunk-2ZDZJ7XQ.js → chunk-3O3HWR23.js} +3 -3
- package/dist/{chunk-2ZDZJ7XQ.js.map → chunk-3O3HWR23.js.map} +1 -1
- package/dist/{chunk-G5SUWZEU.js → chunk-3ZY6W7CL.js} +4 -3
- package/dist/chunk-3ZY6W7CL.js.map +1 -0
- package/dist/{chunk-2JUCWMIS.js → chunk-4BVE6JTM.js} +9 -9
- package/dist/{chunk-2JUCWMIS.js.map → chunk-4BVE6JTM.js.map} +1 -1
- package/dist/{chunk-Z23I2JA6.js → chunk-4CVRFWEY.js} +5 -5
- package/dist/{chunk-Z23I2JA6.js.map → chunk-4CVRFWEY.js.map} +1 -1
- package/dist/{chunk-PPSSDUN6.js → chunk-4YVQGPZ5.js} +3 -3
- package/dist/{chunk-PPSSDUN6.js.map → chunk-4YVQGPZ5.js.map} +1 -1
- package/dist/{chunk-ETGC2MEM.js → chunk-52HUF3DF.js} +3 -3
- package/dist/{chunk-ETGC2MEM.js.map → chunk-52HUF3DF.js.map} +1 -1
- package/dist/{chunk-Z7HLX4V2.js → chunk-57B4DG3Y.js} +4 -4
- package/dist/{chunk-Z7HLX4V2.js.map → chunk-57B4DG3Y.js.map} +1 -1
- package/dist/{chunk-WW22FS74.js → chunk-5L3UCHBK.js} +9 -9
- package/dist/{chunk-WW22FS74.js.map → chunk-5L3UCHBK.js.map} +1 -1
- package/dist/{chunk-72DYHOO2.js → chunk-6CTRJADR.js} +5 -5
- package/dist/{chunk-72DYHOO2.js.map → chunk-6CTRJADR.js.map} +1 -1
- package/dist/{chunk-3LAJJURV.js → chunk-6O7KIJUW.js} +5 -5
- package/dist/{chunk-3LAJJURV.js.map → chunk-6O7KIJUW.js.map} +1 -1
- package/dist/{chunk-EGKCKWWE.js → chunk-6PWQJMHM.js} +3 -3
- package/dist/{chunk-EGKCKWWE.js.map → chunk-6PWQJMHM.js.map} +1 -1
- package/dist/{chunk-7IW5E6LB.js → chunk-7D46CRUU.js} +12 -12
- package/dist/{chunk-7IW5E6LB.js.map → chunk-7D46CRUU.js.map} +1 -1
- package/dist/{chunk-IG4YQ7ER.js → chunk-7IKAKXMZ.js} +3 -3
- package/dist/{chunk-IG4YQ7ER.js.map → chunk-7IKAKXMZ.js.map} +1 -1
- package/dist/{chunk-4ZNKEDYH.js → chunk-AS4SKSXJ.js} +5 -5
- package/dist/{chunk-4ZNKEDYH.js.map → chunk-AS4SKSXJ.js.map} +1 -1
- package/dist/{chunk-6KV34G6A.js → chunk-AVB7NLO6.js} +6 -6
- package/dist/{chunk-6KV34G6A.js.map → chunk-AVB7NLO6.js.map} +1 -1
- package/dist/{chunk-MG6QD7GE.js → chunk-DG7OEBLI.js} +6 -6
- package/dist/{chunk-MG6QD7GE.js.map → chunk-DG7OEBLI.js.map} +1 -1
- package/dist/{chunk-4X5WXQV7.js → chunk-DTIR5W6G.js} +3 -3
- package/dist/{chunk-4X5WXQV7.js.map → chunk-DTIR5W6G.js.map} +1 -1
- package/dist/{chunk-PRB67LCK.js → chunk-E2VPBB7C.js} +11 -11
- package/dist/{chunk-PRB67LCK.js.map → chunk-E2VPBB7C.js.map} +1 -1
- package/dist/{chunk-NAQXDTF3.js → chunk-EFCRBVHL.js} +3 -3
- package/dist/{chunk-NAQXDTF3.js.map → chunk-EFCRBVHL.js.map} +1 -1
- package/dist/{chunk-ZII54C3E.js → chunk-F6EPGAES.js} +122 -50
- package/dist/chunk-F6EPGAES.js.map +1 -0
- package/dist/{chunk-VFEZUSB6.js → chunk-FURORBXE.js} +4 -4
- package/dist/{chunk-VFEZUSB6.js.map → chunk-FURORBXE.js.map} +1 -1
- package/dist/{chunk-BRAOB37W.js → chunk-GXW4B5SE.js} +51 -17
- package/dist/chunk-GXW4B5SE.js.map +1 -0
- package/dist/{chunk-SX54OQQT.js → chunk-HTQLI3OI.js} +4 -4
- package/dist/{chunk-SX54OQQT.js.map → chunk-HTQLI3OI.js.map} +1 -1
- package/dist/{chunk-TYK752MU.js → chunk-HZU5JW2F.js} +3 -3
- package/dist/{chunk-TYK752MU.js.map → chunk-HZU5JW2F.js.map} +1 -1
- package/dist/{chunk-NJ6UCY2B.js → chunk-I46MAK4H.js} +3 -3
- package/dist/{chunk-NJ6UCY2B.js.map → chunk-I46MAK4H.js.map} +1 -1
- package/dist/{chunk-PD42JZWI.js → chunk-K7IV5FY4.js} +2 -2
- package/dist/{chunk-PD42JZWI.js.map → chunk-K7IV5FY4.js.map} +1 -1
- package/dist/{chunk-2SSG5B24.js → chunk-KNOABDPY.js} +4 -4
- package/dist/{chunk-2SSG5B24.js.map → chunk-KNOABDPY.js.map} +1 -1
- package/dist/{chunk-P6FJDT35.js → chunk-LZ6C4YMX.js} +3 -3
- package/dist/{chunk-P6FJDT35.js.map → chunk-LZ6C4YMX.js.map} +1 -1
- package/dist/{chunk-TW5AP6IF.js → chunk-MZEZCRSO.js} +5 -5
- package/dist/{chunk-TW5AP6IF.js.map → chunk-MZEZCRSO.js.map} +1 -1
- package/dist/{chunk-3UYKT62L.js → chunk-N2XZSIJW.js} +244 -19
- package/dist/chunk-N2XZSIJW.js.map +1 -0
- package/dist/{chunk-65SOXO7I.js → chunk-NZAUPFIM.js} +11 -11
- package/dist/{chunk-65SOXO7I.js.map → chunk-NZAUPFIM.js.map} +1 -1
- package/dist/{chunk-OD4N5O7V.js → chunk-OLGQHP4R.js} +3 -3
- package/dist/{chunk-OD4N5O7V.js.map → chunk-OLGQHP4R.js.map} +1 -1
- package/dist/{chunk-RPRMD7XV.js → chunk-OMV4ROIO.js} +4 -4
- package/dist/{chunk-RPRMD7XV.js.map → chunk-OMV4ROIO.js.map} +1 -1
- package/dist/{chunk-H3PY5DFL.js → chunk-PC54LSZP.js} +3 -3
- package/dist/{chunk-H3PY5DFL.js.map → chunk-PC54LSZP.js.map} +1 -1
- package/dist/{chunk-U2WPJHRA.js → chunk-QZS7E3DY.js} +4 -4
- package/dist/{chunk-U2WPJHRA.js.map → chunk-QZS7E3DY.js.map} +1 -1
- package/dist/{chunk-S3UOZBGE.js → chunk-SOAQP4BI.js} +3 -3
- package/dist/{chunk-S3UOZBGE.js.map → chunk-SOAQP4BI.js.map} +1 -1
- package/dist/{chunk-FPG36VC4.js → chunk-UIAGUME5.js} +6 -6
- package/dist/{chunk-FPG36VC4.js.map → chunk-UIAGUME5.js.map} +1 -1
- package/dist/{chunk-NNJQQYHY.js → chunk-URN4G32O.js} +2 -2
- package/dist/{chunk-NNJQQYHY.js.map → chunk-URN4G32O.js.map} +1 -1
- package/dist/{chunk-CU5WY6HN.js → chunk-VAO3XYN3.js} +3 -3
- package/dist/{chunk-CU5WY6HN.js.map → chunk-VAO3XYN3.js.map} +1 -1
- package/dist/{chunk-QUIK7L3Z.js → chunk-WNT54WWX.js} +9 -9
- package/dist/{chunk-QUIK7L3Z.js.map → chunk-WNT54WWX.js.map} +1 -1
- package/dist/{chunk-T65N4CIZ.js → chunk-XHWBSC53.js} +4 -4
- package/dist/{chunk-T65N4CIZ.js.map → chunk-XHWBSC53.js.map} +1 -1
- package/dist/{chunk-KDRA6FYE.js → chunk-YKN5S7PO.js} +9 -9
- package/dist/{chunk-KDRA6FYE.js.map → chunk-YKN5S7PO.js.map} +1 -1
- package/dist/{chunk-TVRL3IPZ.js → chunk-ZEUBZV7L.js} +3 -3
- package/dist/{chunk-TVRL3IPZ.js.map → chunk-ZEUBZV7L.js.map} +1 -1
- package/dist/{chunk-U7P22GEB.js → chunk-ZHI3YMGQ.js} +4 -4
- package/dist/{chunk-U7P22GEB.js.map → chunk-ZHI3YMGQ.js.map} +1 -1
- package/dist/{chunk-6M44OQKH.js → chunk-ZKLXJV37.js} +9 -9
- package/dist/{chunk-6M44OQKH.js.map → chunk-ZKLXJV37.js.map} +1 -1
- package/dist/{claude-code-VL6UM7BZ.js → claude-code-K3QSXJ35.js} +4 -4
- package/dist/{claude-code-VL6UM7BZ.js.map → claude-code-K3QSXJ35.js.map} +1 -1
- package/dist/cli/index.js +115 -90
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/serve-preflight.d.ts +38 -0
- package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
- package/dist/cli/src/commands/serve.d.ts +7 -6
- package/dist/cli/src/commands/serve.d.ts.map +1 -1
- package/dist/connectors/config.js +2 -2
- package/dist/connectors/index.js +16 -16
- package/dist/{connectors-7EPJRVLJ.js → connectors-SBV254SC.js} +19 -19
- package/dist/{connectors-7EPJRVLJ.js.map → connectors-SBV254SC.js.map} +1 -1
- package/dist/core/index.js +3 -3
- package/dist/core/runtime-assets.js +2 -2
- package/dist/core/src/model-endpoint-config.d.ts +12 -0
- package/dist/core/src/model-endpoint-config.d.ts.map +1 -0
- package/dist/core/src/workspace-config.d.ts +6 -0
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/workspace-config.js +1 -1
- package/dist/deploy/index.js +4 -4
- package/dist/{ensure-sources-CI3JQJST.js → ensure-sources-URRZB56T.js} +22 -22
- package/dist/{ensure-sources-CI3JQJST.js.map → ensure-sources-URRZB56T.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/schema.d.ts +2 -2
- package/dist/factory-assets/connectors/flow/engine.js +4 -4
- package/dist/factory-assets/connectors/flow/run-flow.js +17 -17
- 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/{flows-6XQAYQS4.js → flows-YGBWX46B.js} +6 -6
- package/dist/{flows-6XQAYQS4.js.map → flows-YGBWX46B.js.map} +1 -1
- package/dist/{helpers-26MR5QPO.js → helpers-5FFJORMD.js} +22 -22
- package/dist/{helpers-26MR5QPO.js.map → helpers-5FFJORMD.js.map} +1 -1
- package/dist/library/index.js +4 -4
- package/dist/{library-publish-F3AKF66O.js → library-publish-AW4525ZC.js} +39 -39
- package/dist/{library-publish-F3AKF66O.js.map → library-publish-AW4525ZC.js.map} +1 -1
- package/dist/model-endpoint/index.js +7 -7
- package/dist/model-endpoint/src/server.d.ts.map +1 -1
- package/dist/model-endpoint/src/transform.d.ts +49 -0
- package/dist/model-endpoint/src/transform.d.ts.map +1 -0
- package/dist/model-endpoint/src/types.d.ts +13 -0
- package/dist/model-endpoint/src/types.d.ts.map +1 -1
- package/dist/{open-library-FVV6GG4I.js → open-library-C254HCNL.js} +25 -25
- package/dist/{open-library-FVV6GG4I.js.map → open-library-C254HCNL.js.map} +1 -1
- package/dist/{open-registry-VX2BVMS5.js → open-registry-FI6EO2PN.js} +8 -8
- package/dist/{open-registry-VX2BVMS5.js.map → open-registry-FI6EO2PN.js.map} +1 -1
- package/dist/{paths-PIWSSUUG.js → paths-FYPFJ437.js} +6 -6
- package/dist/{paths-PIWSSUUG.js.map → paths-FYPFJ437.js.map} +1 -1
- package/dist/plugin-registry/index.js +1 -1
- package/dist/plugin-registry/src/context.d.ts +6 -0
- package/dist/plugin-registry/src/context.d.ts.map +1 -1
- package/dist/plugin-registry/src/index.d.ts +4 -3
- package/dist/plugin-registry/src/index.d.ts.map +1 -1
- package/dist/plugin-registry/src/internal.d.ts.map +1 -1
- package/dist/plugin-registry/src/model-transform.d.ts +15 -0
- package/dist/plugin-registry/src/model-transform.d.ts.map +1 -0
- package/dist/plugin-registry/src/registry.d.ts +5 -5
- package/dist/plugin-registry/src/registry.d.ts.map +1 -1
- package/dist/plugin-registry/src/targets.d.ts +17 -2
- package/dist/plugin-registry/src/targets.d.ts.map +1 -1
- package/dist/{plugin-store-MVTW6G7J.js → plugin-store-ITA3IADY.js} +7 -7
- package/dist/{plugin-store-MVTW6G7J.js.map → plugin-store-ITA3IADY.js.map} +1 -1
- package/dist/{project-GFQP4TW6.js → project-7XU7YX3Q.js} +35 -35
- package/dist/{project-GFQP4TW6.js.map → project-7XU7YX3Q.js.map} +1 -1
- package/dist/resolver/index.js +3 -3
- package/dist/runner/composition-content.js +5 -5
- package/dist/runner/index.js +26 -26
- package/dist/runner/src/external-mcp.d.ts +32 -7
- package/dist/runner/src/external-mcp.d.ts.map +1 -1
- package/dist/runner/src/model-endpoint-discovery.d.ts +18 -0
- package/dist/runner/src/model-endpoint-discovery.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +8 -8
- package/dist/sdk/bridge.js +13 -13
- package/dist/sdk/core.js +3 -3
- package/dist/sdk/flow.js +4 -4
- package/dist/sdk/index.js +26 -26
- package/dist/sdk/resolver.js +3 -3
- package/dist/sdk/runner.js +26 -26
- package/dist/sdk/transport/ws/server.js +4 -4
- package/dist/sdk/transport/ws.js +4 -4
- package/dist/sdk/transport.js +4 -4
- package/dist/{serve-preflight-XJS5OZML.js → serve-preflight-A43HQQXD.js} +81 -25
- package/dist/serve-preflight-A43HQQXD.js.map +1 -0
- package/dist/{setup-BFEBJLYF.js → setup-WD7XTLDA.js} +23 -23
- package/dist/{setup-BFEBJLYF.js.map → setup-WD7XTLDA.js.map} +1 -1
- package/dist/{skills-OCG7B5CL.js → skills-XH6OG32W.js} +5 -5
- package/dist/{skills-OCG7B5CL.js.map → skills-XH6OG32W.js.map} +1 -1
- package/dist/{source-P6JPZYWP.js → source-25TTNBDK.js} +37 -37
- package/dist/{source-P6JPZYWP.js.map → source-25TTNBDK.js.map} +1 -1
- package/dist/{source-manifest-publish-XBFHEURV.js → source-manifest-publish-QJTPZQBN.js} +39 -39
- package/dist/{source-manifest-publish-XBFHEURV.js.map → source-manifest-publish-QJTPZQBN.js.map} +1 -1
- package/dist/transport/index.js +4 -4
- package/dist/transport/ws/server.js +4 -4
- package/dist/transport/ws.js +4 -4
- package/dist/tui/index.js +26 -26
- package/dist/workspace-plugin/adapters/mcp.js +19 -19
- 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-3UYKT62L.js.map +0 -1
- package/dist/chunk-BRAOB37W.js.map +0 -1
- package/dist/chunk-G5SUWZEU.js.map +0 -1
- package/dist/chunk-ZII54C3E.js.map +0 -1
- package/dist/serve-preflight-XJS5OZML.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { pluginRegistry } from './chunk-
|
|
2
|
-
import { readPluginsLockSlice } from './chunk-
|
|
1
|
+
import { pluginRegistry } from './chunk-3ZY6W7CL.js';
|
|
2
|
+
import { readPluginsLockSlice } from './chunk-ZHI3YMGQ.js';
|
|
3
3
|
import path, { join, resolve } from 'path';
|
|
4
4
|
import pc from 'picocolors';
|
|
5
5
|
import { pathToFileURL } from 'url';
|
|
@@ -362,5 +362,5 @@ async function loadDeclaredPluginsOnce(projectDir) {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
export { condensePluginFailure, ensurePluginsLoaded, loadDeclaredPlugins, loadPlugins, npmSpecError, pluginFailureReasons, projectRelativeFileSpec, reconcilePlugins, resolveFileSpec, rollbackPluginStore, specName };
|
|
365
|
-
//# sourceMappingURL=chunk-
|
|
366
|
-
//# sourceMappingURL=chunk-
|
|
365
|
+
//# sourceMappingURL=chunk-XHWBSC53.js.map
|
|
366
|
+
//# sourceMappingURL=chunk-XHWBSC53.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/plugin-store/paths.ts","../cli/src/plugin-store/spec.ts","../cli/src/plugin-store/load.ts","../cli/src/plugin-store/reconcile.ts","../cli/src/plugin-store/index.ts"],"names":["existsSync","readFileSync","join","resolvePath"],"mappings":";;;;;;;;AAWO,SAAS,WAAW,U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the project-local plugin store.\n *\n * The store is a self-contained npm workspace owned by the CLI under\n * `<projectDir>/.skaile/plugins/`. Only `resolvePluginEntry` reads the filesystem.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\n\n/** `<projectDir>/.skaile/plugins` — the store root. */\nexport function pluginsDir(projectDir: string): string {\n return join(projectDir, \".skaile\", \"plugins\");\n}\n\n/** `<store>/package.json` — generated, never user-edited. */\nexport function pluginsPkgJson(projectDir: string): string {\n return join(pluginsDir(projectDir), \"package.json\");\n}\n\n/** `<store>/node_modules` — where reconciled plugin packages land. */\nexport function nodeModulesDir(projectDir: string): string {\n return join(pluginsDir(projectDir), \"node_modules\");\n}\n\n/** `<store>/.reconcile-hash` — SHA of plugins-list + lock slice; skip reinstall when unchanged. */\nexport function reconcileHashFile(projectDir: string): string {\n return join(pluginsDir(projectDir), \".reconcile-hash\");\n}\n\n/** Pick the file an `exports` target points at, preferring the ESM-friendly conditions. */\nfunction exportsTarget(target: unknown): string | undefined {\n if (typeof target === \"string\") return target;\n if (Array.isArray(target)) {\n for (const t of target) {\n const hit = exportsTarget(t);\n if (hit) return hit;\n }\n return undefined;\n }\n if (target && typeof target === \"object\") {\n const map = target as Record<string, unknown>;\n for (const cond of [\"import\", \"node\", \"default\", \"require\"]) {\n if (cond in map) {\n const hit = exportsTarget(map[cond]);\n if (hit) return hit;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Absolute path to a plugin package's entry file under the store's\n * `node_modules`, resolved from its `package.json` (`exports[\".\"]`, then\n * `module`, then `main`, then `index.js`). Node's ESM loader rejects directory\n * imports, so the entry must be a file; `import()` of the result works inside\n * compiled binaries via `pathToFileURL`.\n *\n * @throws When the package is not installed or declares no resolvable entry.\n */\nexport function resolvePluginEntry(projectDir: string, pkgName: string): string {\n const pkgDir = join(nodeModulesDir(projectDir), pkgName);\n const pkgJsonPath = join(pkgDir, \"package.json\");\n if (!existsSync(pkgJsonPath)) {\n throw new Error(`package \"${pkgName}\" is not installed in ${nodeModulesDir(projectDir)}`);\n }\n const pkg = JSON.parse(readFileSync(pkgJsonPath, \"utf8\")) as {\n exports?: unknown;\n module?: string;\n main?: string;\n };\n let rel: string | undefined;\n if (pkg.exports !== undefined) {\n const root =\n typeof pkg.exports === \"object\" && pkg.exports !== null && !Array.isArray(pkg.exports)\n ? ((pkg.exports as Record<string, unknown>)[\".\"] ?? pkg.exports)\n : pkg.exports;\n rel = exportsTarget(root);\n }\n rel ??= pkg.module ?? pkg.main ?? \"index.js\";\n const entry = resolve(pkgDir, rel);\n if (!existsSync(entry)) {\n throw new Error(`package \"${pkgName}\" entry ${rel} does not exist`);\n }\n return entry;\n}\n","/**\n * Parse npm package specifiers from the `plugins:` list into name + range.\n *\n * The leading `@` of a scope is NOT a separator: the first `@` at a non-zero\n * index splits the package name (which never holds an `@`) from its range, so a\n * range may hold one itself (`foo@npm:bar@1.0.0`, `foo@file:/a@b/dir`).\n * \"@skaile/provider-fly@^0.1.0\" → { name: \"@skaile/provider-fly\", range: \"^0.1.0\" }\n * \"@skaile/connector-redis\" → { name: \"@skaile/connector-redis\", range: \"*\" }\n * \"lodash@^4\" → { name: \"lodash\", range: \"^4\" }\n */\nimport path from \"node:path\";\n\n/** A parsed plugin specifier: package name plus a semver range (`\"*\"` when omitted). */\nexport interface PluginSpec {\n name: string;\n range: string;\n}\n\n/**\n * Parse a single plugin specifier into `{ name, range }`.\n *\n * @param spec - An npm specifier, e.g. `\"@skaile/provider-fly@^0.1.0\"` or `\"lodash\"`.\n * @returns The package name and semver range (range defaults to `\"*\"`).\n * @throws Error when the specifier is empty.\n */\nexport function parseSpec(spec: string): PluginSpec {\n const trimmed = spec.trim();\n if (!trimmed) throw new Error(\"parseSpec: empty specifier\");\n\n // Find the version-separating `@` — the first one that is not the scope `@`\n // at index 0. A bare `@scope/name` has its only `@` at index 0 (no range).\n const at = trimmed.indexOf(\"@\", 1);\n if (at <= 0) {\n return { name: trimmed, range: \"*\" };\n }\n const name = trimmed.slice(0, at);\n const range = trimmed.slice(at + 1);\n return { name, range: range.length > 0 ? range : \"*\" };\n}\n\n/** Convenience: just the package name of a specifier. */\nexport function specName(spec: string): string {\n return parseSpec(spec).name;\n}\n\n/** A package name as the registry and `package.json` keys hold it (legacy uppercase included). */\nconst PACKAGE_NAME = /^(?:@[A-Za-z0-9][A-Za-z0-9._~-]*\\/)?[A-Za-z0-9][A-Za-z0-9._~-]*$/;\n\n/**\n * The refusal for a specifier that does not start with a package name, or `undefined` when it\n * does: `name`, `@scope/name`, or `name@<any range>` (`name@^1`, `name@npm:other@1`,\n * `name@github:user/repo`, `name@git+https://...`, `name@https://...tgz`, `name@file:/abs/dir`).\n * A range may hold a space (`name@>=0.1.0 <1`); an empty range (`name@`) is refused.\n * A bare path, a `file:` URL, a `github:` / `git+` / `https:` source or `user/repo` has no name:\n * the package manager would send it to the registry or key `package.json` by the URL, and fail\n * late (p1737). Such a source is installed under its package name, `<name>@<spec>`.\n */\nexport function npmSpecError(spec: string): string | undefined {\n const trimmed = spec.trim();\n if (trimmed !== \"\" && !/@file:$/i.test(trimmed)) {\n // Only the name is checked for white space (PACKAGE_NAME has none): an npm range may hold a\n // space (`>=0.1.0 <1`) and the package manager takes it as one argument.\n const at = trimmed.indexOf(\"@\", 1);\n const nameEnd = at > 0 ? at : trimmed.length;\n if (PACKAGE_NAME.test(trimmed.slice(0, nameEnd))) {\n if (at > 0 && trimmed.slice(at + 1).trim() === \"\") {\n return (\n `plugin spec '${trimmed}' has an empty version range after '@'. ` +\n `Write ${trimmed.slice(0, at)} for any version, or ${trimmed.slice(0, at)}@<range>, for example @1.2.0.`\n );\n }\n return undefined;\n }\n }\n return (\n `plugin spec '${spec}' is not an npm package name. Give an npm name with an optional version ` +\n \"range, for example @scope/name@1.2.0, or write <name>@<spec> for a git, URL or local source, \" +\n \"for example name@github:user/repo or name@file:/path/to/dir.\"\n );\n}\n\n/** The folder a `file:` range names, or `undefined` for any other spec or an absolute / URL target. */\nfunction relativeFileTarget(spec: string): { head: string; target: string } | undefined {\n const trimmed = spec.trim();\n const at = trimmed.indexOf(\"@\", 1);\n if (at <= 0) return undefined;\n const range = trimmed.slice(at + 1);\n if (!/^file:/i.test(range)) return undefined;\n const target = range.slice(\"file:\".length);\n if (\n target === \"\" ||\n target.startsWith(\"//\") ||\n path.isAbsolute(target) ||\n /^[A-Za-z]:[\\\\/]/.test(target)\n ) {\n return undefined;\n }\n return { head: trimmed.slice(0, at), target };\n}\n\n/**\n * The form of a spec to write into `skaile.yaml`. A relative `file:` range is typed relative to\n * `cwd`; `skaile.yaml` is committed and read on other machines, so it holds the folder relative\n * to the project instead (`name@file:./plugins/x`, `name@file:../x`), never a machine path\n * (p1737). Any other spec is returned as written.\n */\nexport function projectRelativeFileSpec(spec: string, cwd: string, projectDir: string): string {\n const parts = relativeFileTarget(spec);\n if (!parts) return spec;\n const rel = path.relative(path.resolve(projectDir), path.resolve(cwd, parts.target));\n if (path.isAbsolute(rel)) return `${parts.head}@file:${rel}`;\n const posix = rel.split(path.sep).join(\"/\") || \".\";\n return `${parts.head}@file:${posix.startsWith(\"..\") || posix === \".\" ? posix : `./${posix}`}`;\n}\n\n/**\n * The form of a spec to hand to the package manager. It runs in `.skaile/plugins/`, so a\n * project-relative `file:` range is resolved to an absolute path against `projectDir` here, and\n * only here (p1737). Any other spec is returned as written.\n */\nexport function resolveFileSpec(spec: string, projectDir: string): string {\n const parts = relativeFileTarget(spec);\n if (!parts) return spec;\n return `${parts.head}@file:${path.resolve(projectDir, parts.target)}`;\n}\n","/**\n * Runtime plugin loader: dynamic-import each reconciled plugin and let it\n * self-register into the `pluginRegistry`.\n *\n * Each plugin specifier resolves to an absolute path under the store's\n * `node_modules`; we import it via a `file://` URL so the import works inside\n * `bun --compile` binaries (which bundle only the literal-string switches, but\n * can still execute a `file://` import against the unpacked store on disk).\n * Failures are caught per-plugin so one broken plugin never aborts the rest.\n */\n\nimport { pathToFileURL } from \"node:url\";\nimport { type PluginRegistry, pluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { resolvePluginEntry } from \"./paths.js\";\nimport { parseSpec } from \"./spec.js\";\n\n/** Options for {@link loadPlugins}. */\nexport interface LoadOptions {\n log?: Logger;\n}\n\n/** Result of a load pass: which specs registered and which failed. */\nexport interface LoadResult {\n loaded: string[];\n failed: { spec: string; error: string; reason: string }[];\n}\n\n/** The self-registration entrypoint a plugin module is expected to export. */\ntype PluginModule = { register?: (registry: PluginRegistry) => void };\n\n/**\n * Load and register each plugin in `plugins` into `registry`.\n *\n * @param projectDir - Project root holding `.skaile/plugins/node_modules`.\n * @param plugins - The `skaile.yaml` `plugins:` list (npm specifiers).\n * @param registry - Registry to register into. Defaults to the process-wide `pluginRegistry`.\n * @param opts - Optional logger.\n * @returns Loaded specs + per-plugin failures (never throws).\n */\nexport async function loadPlugins(\n projectDir: string,\n plugins: string[],\n registry: PluginRegistry = pluginRegistry,\n opts: LoadOptions = {},\n): Promise<LoadResult> {\n const loaded: string[] = [];\n const failed: { spec: string; error: string; reason: string }[] = [];\n\n for (const spec of plugins) {\n try {\n const { name } = parseSpec(spec);\n const entry = resolvePluginEntry(projectDir, name);\n const mod = (await import(pathToFileURL(entry).href)) as PluginModule;\n if (typeof mod.register !== \"function\") {\n throw new Error(`plugin \"${name}\" does not export a register() function`);\n }\n mod.register(registry);\n loaded.push(spec);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n failed.push({ spec, error: `failed to load plugin \"${spec}\": ${message}`, reason: message });\n opts.log?.warn(`plugin load failed: ${spec}`, { error: message });\n }\n }\n\n return { loaded, failed };\n}\n","/**\n * Reconcile the project-local plugin store (`<projectDir>/.skaile/plugins/`).\n *\n * The reconciler is hash-skipped: it computes a SHA-256 over the sorted plugin\n * list plus the lock file's `plugins` slice and compares it to the stored\n * `.reconcile-hash`. On a match it returns with zero further I/O; otherwise it\n * regenerates the store's `package.json` and runs `bun install` against it.\n *\n * The install step is injectable (`InstallFn`) so tests stay hermetic — they\n * pass a fake installer that records calls and writes a stub `node_modules`.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { existsSync, mkdirSync, readFileSync, rmdirSync, rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { readPluginsLockSlice } from \"@skaile/workspaces/core\";\nimport { nodeModulesDir, pluginsDir, pluginsPkgJson, reconcileHashFile } from \"./paths.js\";\nimport { parseSpec, resolveFileSpec } from \"./spec.js\";\n\n/** How `InstallFn` may treat the store's lock: `frozen` forbids lock changes. */\nexport interface InstallOptions {\n /**\n * `false` when the spec list changed since the last `package.json`, so the\n * lock has to change too. Defaults to `true` (frozen when a lock exists).\n */\n frozen?: boolean;\n}\n\n/**\n * Installs the store's dependencies. Returns `ok: false` (never throws) on a\n * failed install so the reconciler can surface the captured `output`.\n */\nexport type InstallFn = (\n pluginsDir: string,\n opts?: InstallOptions,\n) => Promise<{ ok: boolean; output: string }>;\n\n/** Options for {@link reconcilePlugins}. */\nexport interface ReconcileOptions {\n /** Injectable installer. Defaults to a real `bun install` of the store. */\n runInstall?: InstallFn;\n /**\n * Lock slice to fold into the reconcile-hash. Defaults to\n * `readPluginsLockSlice(projectDir)` so a lock edit invalidates the hash.\n */\n lockSlice?: unknown;\n}\n\n/** Result of a reconcile pass. */\nexport interface ReconcileResult {\n changed: boolean;\n reason: \"no-plugins\" | \"up-to-date\" | \"reconciled\";\n}\n\n/** Run a command to completion, capturing stdout+stderr. `started: false` when it cannot spawn. */\nasync function runCapture(\n args: string[],\n cwd: string,\n): Promise<{ started: boolean; code: number; output: string }> {\n const { portableSpawn } = await import(\"@skaile/workspaces/core\");\n const proc = portableSpawn(args, { cwd });\n const chunks: string[] = [];\n const decoder = new TextDecoder();\n const pump = async (stream: ReadableStream<Uint8Array>) => {\n const reader = stream.getReader();\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n if (value) chunks.push(decoder.decode(value, { stream: true }));\n }\n };\n await Promise.all([pump(proc.stdout), pump(proc.stderr)]);\n const code = await proc.exited;\n // `portableSpawn` reports a spawn error (ENOENT) as exit -1 with no pid.\n return { started: proc.pid !== -1, code, output: chunks.join(\"\") };\n}\n\n/**\n * The default real installer: `bun install` inside the store directory, or\n * `npm install` when `bun` is not on PATH. Frozen only when a lock exists and\n * the spec list did not change (`opts.frozen !== false`): a changed list has to\n * rewrite the lock, which a frozen install refuses.\n */\nexport const defaultInstall: InstallFn = async (dir, opts = {}) => {\n const hasBunLock = existsSync(`${dir}/bun.lock`) || existsSync(`${dir}/bun.lockb`);\n const hasNpmLock = existsSync(`${dir}/package-lock.json`);\n const frozen = opts.frozen !== false;\n\n const bunArgs =\n frozen && (hasBunLock || hasNpmLock)\n ? [\"bun\", \"install\", \"--frozen-lockfile\"]\n : [\"bun\", \"install\"];\n const withBun = await runCapture(bunArgs, dir);\n if (withBun.started) return { ok: withBun.code === 0, output: withBun.output };\n\n const npmArgs =\n frozen && hasNpmLock\n ? [\"npm\", \"ci\", \"--ignore-scripts\", \"--no-audit\", \"--no-fund\"]\n : [\"npm\", \"install\", \"--ignore-scripts\", \"--no-audit\", \"--no-fund\"];\n const withNpm = await runCapture(npmArgs, dir);\n if (withNpm.started) return { ok: withNpm.code === 0, output: withNpm.output };\n return {\n ok: false,\n output:\n \"neither bun nor npm found on PATH; plugin install needs one of them (https://bun.sh or https://nodejs.org)\",\n };\n};\n\n/**\n * Generate the store's `package.json` from the plugin specs. Returns the\n * previous file content (`undefined` when there was none) and whether the\n * dependency set changed.\n */\nfunction writePackageJson(\n projectDir: string,\n plugins: string[],\n): { previous: string | undefined; depsChanged: boolean; removedDep: boolean } {\n const dependencies: Record<string, string> = {};\n for (const spec of plugins) {\n const { name, range } = parseSpec(resolveFileSpec(spec, projectDir));\n dependencies[name] = range;\n }\n const pkg = {\n name: \"skaile-project-plugins\",\n private: true,\n dependencies,\n };\n const file = pluginsPkgJson(projectDir);\n const previous = existsSync(file) ? readFileSync(file, \"utf8\") : undefined;\n let before: Record<string, string> | undefined;\n try {\n before = previous === undefined ? undefined : JSON.parse(previous).dependencies;\n } catch {\n before = undefined;\n }\n const sortedJson = (d: Record<string, string> | undefined) =>\n JSON.stringify(Object.entries(d ?? {}).sort(([a], [b]) => a.localeCompare(b)));\n const depsChanged = before === undefined || sortedJson(before) !== sortedJson(dependencies);\n // A plugin the list no longer names: the package manager prunes a registry package, but not a\n // `file:` one and not what a failed install left, so the caller rebuilds `node_modules`.\n const removedDep = Object.keys(before ?? {}).some((name) => !(name in dependencies));\n mkdirSync(pluginsDir(projectDir), { recursive: true });\n writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\\n`);\n return { previous, depsChanged, removedDep };\n}\n\n/** Whether `node_modules` holds a `package.json` for every declared plugin (by package name). */\nfunction allPluginsInstalled(projectDir: string, plugins: string[]): boolean {\n return plugins.every((spec) => {\n const { name } = parseSpec(resolveFileSpec(spec, projectDir));\n return existsSync(join(nodeModulesDir(projectDir), name, \"package.json\"));\n });\n}\n\n/**\n * Reconcile the plugin store for a project.\n *\n * @param projectDir - Project root containing `skaile.yaml` / `skaile.lock.yaml`.\n * @param plugins - The `skaile.yaml` `plugins:` list (npm specifiers).\n * @param opts - Optional injectable installer + lock slice override.\n * @returns Whether the store changed and why.\n */\nexport async function reconcilePlugins(\n projectDir: string,\n plugins: string[],\n opts: ReconcileOptions = {},\n): Promise<ReconcileResult> {\n if (plugins.length === 0) {\n return { changed: false, reason: \"no-plugins\" };\n }\n\n const lockSlice = opts.lockSlice ?? readPluginsLockSlice(projectDir);\n const wantHash = createHash(\"sha256\")\n .update(\n JSON.stringify({\n plugins: plugins.map((spec) => resolveFileSpec(spec, projectDir)).sort(),\n lock: lockSlice,\n }),\n )\n .digest(\"hex\");\n\n const hashFile = reconcileHashFile(projectDir);\n if (existsSync(hashFile)) {\n const have = readFileSync(hashFile, \"utf8\").trim();\n // The hash only says what was installed where it was written. A clone or a copied store comes\n // with the hash but without `node_modules`; trust the hash only while every declared package\n // is on disk.\n if (have === wantHash && allPluginsInstalled(projectDir, plugins)) {\n return { changed: false, reason: \"up-to-date\" };\n }\n }\n\n const { previous, depsChanged, removedDep } = writePackageJson(projectDir, plugins);\n if (removedDep) rmSync(nodeModulesDir(projectDir), { recursive: true, force: true });\n\n const install = opts.runInstall ?? defaultInstall;\n const result = await install(pluginsDir(projectDir), { frozen: !depsChanged });\n if (!result.ok) {\n // A failed install must not leave the spec behind: the next reconcile\n // would compare against it and treat the store as already changed.\n if (previous === undefined) rmSync(pluginsPkgJson(projectDir), { force: true });\n else writeFileSync(pluginsPkgJson(projectDir), previous);\n throw new Error(`plugin install failed:\\n${result.output}`);\n }\n\n writeFileSync(hashFile, wantHash);\n return { changed: true, reason: \"reconciled\" };\n}\n\n/**\n * Put the store back to `previousPlugins` after `plugin install` failed past\n * the reconcile (the plugin installed but does not load). Best effort: a\n * failing reinstall is swallowed, the store is then rebuilt by the next\n * reconcile because the hash no longer matches the declared list.\n *\n * With no previous plugins every generated file of the store goes away\n * (`package.json`, hash, lock file and `node_modules`), so the store keeps\n * neither the rejected spec nor its installed package.\n */\nexport async function rollbackPluginStore(\n projectDir: string,\n previousPlugins: string[],\n opts: ReconcileOptions = {},\n): Promise<void> {\n if (previousPlugins.length === 0) {\n const dir = pluginsDir(projectDir);\n rmSync(pluginsPkgJson(projectDir), { force: true });\n rmSync(reconcileHashFile(projectDir), { force: true });\n rmSync(nodeModulesDir(projectDir), { recursive: true, force: true });\n for (const lock of [\"bun.lock\", \"bun.lockb\", \"package-lock.json\"]) {\n rmSync(join(dir, lock), { force: true });\n }\n try {\n // The folder goes when nothing else of the user's is in it.\n rmdirSync(dir);\n } catch {\n // not empty, or already gone\n }\n return;\n }\n try {\n await reconcilePlugins(projectDir, previousPlugins, opts);\n } catch {\n // the next reconcile retries\n }\n}\n","/**\n * The project-local plugin store: reconcile (`<projectDir>/.skaile/plugins/`)\n * then load the reconciled plugins into the `pluginRegistry`.\n *\n * `ensurePluginsLoaded` is the single entrypoint commands wire in. It is a\n * guarded no-op when `plugins` is empty/undefined — zero overhead for the\n * common case where no project declares `plugins:` in `skaile.yaml`.\n */\n\nimport { resolve as resolvePath } from \"node:path\";\nimport { type PluginRegistry, pluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport pc from \"picocolors\";\nimport { type LoadResult, loadPlugins } from \"./load.js\";\nimport { type ReconcileOptions, reconcilePlugins } from \"./reconcile.js\";\nimport { specName } from \"./spec.js\";\n\nexport type { LoadResult } from \"./load.js\";\nexport { loadPlugins } from \"./load.js\";\nexport type { ReconcileOptions } from \"./reconcile.js\";\nexport { reconcilePlugins, rollbackPluginStore } from \"./reconcile.js\";\nexport { npmSpecError, projectRelativeFileSpec, resolveFileSpec, specName } from \"./spec.js\";\n\n/** Options for {@link ensurePluginsLoaded}. */\nexport interface EnsurePluginsOptions extends ReconcileOptions {\n log?: Logger;\n}\n\n/**\n * Reconcile the plugin store then load each plugin into `registry`.\n *\n * No-op (returns immediately) when `plugins` is empty/undefined, so the common\n * no-plugins path costs nothing.\n *\n * @param projectDir - Project root.\n * @param plugins - The `skaile.yaml` `plugins:` list (may be undefined).\n * @param registry - Registry to register into. Defaults to `pluginRegistry`.\n * @param opts - Injectable installer / lock slice + optional logger.\n * @returns The load result, or an empty result when there are no plugins.\n */\nexport async function ensurePluginsLoaded(\n projectDir: string,\n plugins: string[] | undefined,\n registry: PluginRegistry = pluginRegistry,\n opts: EnsurePluginsOptions = {},\n): Promise<LoadResult> {\n if (!plugins || plugins.length === 0) {\n return { loaded: [], failed: [] };\n }\n await reconcilePlugins(projectDir, plugins, opts);\n return loadPlugins(projectDir, plugins, registry, { log: opts.log });\n}\n\n/**\n * The installer's output of a failed `plugin install` is a dump (bun's banner, resolver\n * progress, then the `error:` lines). A load warning keeps the first line and the cause of it\n * (p1113); `skaile plugin install <spec>` prints the whole output.\n *\n * bun: the last `error:` line. npm: its `code` line and the first detail line after it\n * (`E404: 404 Not Found - GET …`), never the trailing `A complete log of this run can be found\n * in: …` pointer (p1272).\n */\nexport function condensePluginFailure(reason: string): string {\n const lines = reason\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter((l) => l !== \"\");\n const [first, ...rest] = lines;\n if (!reason.startsWith(\"plugin install failed\") || first === undefined || rest.length === 0) {\n return reason;\n }\n const head = first.replace(/:$/, \"\");\n const npmPrefix = /^npm (ERR!|error)\\s*/i;\n const npmLines = rest\n .filter((l) => npmPrefix.test(l) && !/^npm \\S+\\s+A complete log of this run\\b/i.test(l))\n .map((l) => l.replace(npmPrefix, \"\"))\n .filter((l) => l !== \"\");\n const codeLine = npmLines.find((l) => /^code\\s+\\S+/i.test(l));\n if (codeLine) {\n const code = codeLine.replace(/^code\\s+/i, \"\");\n const detail = npmLines.find((l) => l !== codeLine && !/^code\\s/i.test(l));\n return `${head}: npm ${code}${detail ? `: ${detail}` : \"\"}`;\n }\n const causes = rest.filter(\n (l) => /^error\\b/i.test(l) || (npmPrefix.test(l) && !/A complete log of this run\\b/i.test(l)),\n );\n const cause =\n causes.at(-1) ?? rest.filter((l) => !/A complete log of this run\\b/i.test(l)).at(-1);\n return `${head}: ${cause ?? rest.at(-1)}`;\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\/]/g, \"\\\\$&\");\n}\n\n/**\n * Split the output of one failed install of the whole plugin store into one reason per plugin\n * (p1272): the package manager runs once for every spec, so its output names the plugins that\n * failed. A plugin gets the line that names it (also its URL-encoded form `@scope%2fname`); a\n * plugin the output never names says it was not installed and which plugin the install stopped\n * at. With one plugin, or when the output names none (no `bun` and no `npm`), every plugin keeps\n * the whole condensed reason.\n */\nexport function pluginFailureReasons(\n reason: string,\n specs: readonly string[],\n): Map<string, string> {\n const out = new Map<string, string>();\n const condensed = condensePluginFailure(reason);\n if (specs.length < 2 || !reason.startsWith(\"plugin install failed\")) return out;\n const lines = reason\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter((l) => l !== \"\" && !/A complete log of this run\\b/i.test(l));\n const names = specs.map((spec) => {\n try {\n return specName(spec);\n } catch {\n return spec;\n }\n });\n const mentions = (text: string, name: string): boolean => {\n const forms = [name, name.replace(\"/\", \"%2f\"), name.replace(\"/\", \"%2F\")];\n return forms.some((f) =>\n new RegExp(`(?<![\\\\w@.-])(?<!@[\\\\w.~-]+/)${escapeRegExp(f)}(?![\\\\w-]|\\\\.\\\\w)`).test(text),\n );\n };\n const cause = /\\berror\\b|\\bE[A-Z0-9]{3,}\\b|\\b404\\b|notarget|failed to resolve/i;\n const named: string[] = [];\n specs.forEach((spec, i) => {\n const name = names[i] as string;\n const line = mentions(condensed, name)\n ? condensed.replace(/^plugin install failed:\\s*/, \"\")\n : lines.filter((l) => mentions(l, name) && cause.test(l)).at(-1);\n if (line === undefined) return;\n named.push(name);\n out.set(spec, `plugin install failed: ${line.replace(/^(npm\\s+)?(ERR!|error:?)\\s*/i, \"\")}`);\n });\n if (named.length === 0) return new Map();\n specs.forEach((spec, i) => {\n if (!out.has(spec)) {\n out.set(\n spec,\n `plugin install failed: ${names[i]} was not installed, the install stopped at ${named.join(\", \")}`,\n );\n }\n });\n return out;\n}\n\n/** One `! plugin <name> failed to load: <reason>` line on stderr (stdout carries a run's answer). */\nfunction warnPluginFailed(spec: string, reason: string): void {\n let name = spec;\n try {\n name = specName(spec);\n } catch {\n /* a spec that does not parse is named as written */\n }\n process.stderr.write(\n ` ${pc.yellow(\"!\")} plugin ${name} failed to load: ${condensePluginFailure(reason)}\\n`,\n );\n}\n\n/**\n * Reconcile + load the `plugins:` of the project's `skaile.yaml` into the process registry, so a\n * plugin's harness is known to `run`, `repl` and `config set harness`. A plugin that fails to\n * reconcile or load is skipped (its harness stays unknown, the command goes on) and named in one\n * `! plugin <name> failed to load: <reason>` line on stderr. An unreadable config is not this\n * function's to report: the command reads it again and says so.\n */\nexport function loadDeclaredPlugins(projectDir: string): Promise<void> {\n // A plugin registers once per process: a second `register()` is a duplicate.\n const key = resolvePath(projectDir);\n let pending = declaredPluginLoads.get(key);\n if (!pending) {\n pending = loadDeclaredPluginsOnce(projectDir);\n declaredPluginLoads.set(key, pending);\n }\n return pending;\n}\n\nconst declaredPluginLoads = new Map<string, Promise<void>>();\n\nasync function loadDeclaredPluginsOnce(projectDir: string): Promise<void> {\n let plugins: string[] | undefined;\n try {\n const { resolveSkWorkspaceConfig } = await import(\"@skaile/workspaces/core\");\n plugins = resolveSkWorkspaceConfig(projectDir).plugins;\n } catch {\n return;\n }\n if (!plugins || plugins.length === 0) return;\n try {\n const result = await ensurePluginsLoaded(projectDir, plugins, pluginRegistry);\n for (const f of result.failed) warnPluginFailed(f.spec, f.reason);\n } catch (err) {\n // The store could not be reconciled: no plugin was loaded.\n const reason = err instanceof Error ? err.message : String(err);\n const reasons = pluginFailureReasons(reason, plugins);\n for (const spec of plugins) warnPluginFailed(spec, reasons.get(spec) ?? reason);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../cli/src/plugin-store/paths.ts","../cli/src/plugin-store/spec.ts","../cli/src/plugin-store/load.ts","../cli/src/plugin-store/reconcile.ts","../cli/src/plugin-store/index.ts"],"names":["existsSync","readFileSync","join","resolvePath"],"mappings":";;;;;;;;AAWO,SAAS,WAAW,UAAA,EAA4B;AACrD,EAAA,OAAO,IAAA,CAAK,UAAA,EAAY,SAAA,EAAW,SAAS,CAAA;AAC9C;AAGO,SAAS,eAAe,UAAA,EAA4B;AACzD,EAAA,OAAO,IAAA,CAAK,UAAA,CAAW,UAAU,CAAA,EAAG,cAAc,CAAA;AACpD;AAGO,SAAS,eAAe,UAAA,EAA4B;AACzD,EAAA,OAAO,IAAA,CAAK,UAAA,CAAW,UAAU,CAAA,EAAG,cAAc,CAAA;AACpD;AAGO,SAAS,kBAAkB,UAAA,EAA4B;AAC5D,EAAA,OAAO,IAAA,CAAK,UAAA,CAAW,UAAU,CAAA,EAAG,iBAAiB,CAAA;AACvD;AAGA,SAAS,cAAc,MAAA,EAAqC;AAC1D,EAAA,IAAI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CAAA;AAC3E,IAAA,OAAA,GAAU,wBAAA,CAAyB,UAAU,CAAA,CAAE,OAAA;AAAA,EACjD,CAAA,CAAA,MAAQ;AACN,IAAA;AAAA,EACF;AACA,EAAA,IAAI,CAAC,OAAA,IAAW,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG;AACtC,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,MAAM,mBAAA,CAAoB,UAAA,EAAY,SAAS,cAAc,CAAA;AAC5E,IAAA,KAAA,MAAW,KAAK,MAAA,CAAO,MAAA,mBAAyB,CAAA,CAAE,IAAA,EAAM,EAAE,MAAM,CAAA;AAAA,EAClE,SAAS,GAAA,EAAK;AAEZ,IAAA,MAAM,SAAS,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AAC9D,IAAA,MAAM,OAAA,GAAU,oBAAA,CAAqB,MAAA,EAAQ,OAAO,CAAA;AACpD,IAAA,KAAA,MAAW,IAAA,IAAQ,SAAS,gBAAA,CAAiB,IAAA,EAAM,QAAQ,GAAA,CAAI,IAAI,KAAK,MAAM,CAAA;AAAA,EAChF;AACF","file":"chunk-XHWBSC53.js","sourcesContent":["/**\n * Pure path helpers for the project-local plugin store.\n *\n * The store is a self-contained npm workspace owned by the CLI under\n * `<projectDir>/.skaile/plugins/`. Only `resolvePluginEntry` reads the filesystem.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\n\n/** `<projectDir>/.skaile/plugins` — the store root. */\nexport function pluginsDir(projectDir: string): string {\n return join(projectDir, \".skaile\", \"plugins\");\n}\n\n/** `<store>/package.json` — generated, never user-edited. */\nexport function pluginsPkgJson(projectDir: string): string {\n return join(pluginsDir(projectDir), \"package.json\");\n}\n\n/** `<store>/node_modules` — where reconciled plugin packages land. */\nexport function nodeModulesDir(projectDir: string): string {\n return join(pluginsDir(projectDir), \"node_modules\");\n}\n\n/** `<store>/.reconcile-hash` — SHA of plugins-list + lock slice; skip reinstall when unchanged. */\nexport function reconcileHashFile(projectDir: string): string {\n return join(pluginsDir(projectDir), \".reconcile-hash\");\n}\n\n/** Pick the file an `exports` target points at, preferring the ESM-friendly conditions. */\nfunction exportsTarget(target: unknown): string | undefined {\n if (typeof target === \"string\") return target;\n if (Array.isArray(target)) {\n for (const t of target) {\n const hit = exportsTarget(t);\n if (hit) return hit;\n }\n return undefined;\n }\n if (target && typeof target === \"object\") {\n const map = target as Record<string, unknown>;\n for (const cond of [\"import\", \"node\", \"default\", \"require\"]) {\n if (cond in map) {\n const hit = exportsTarget(map[cond]);\n if (hit) return hit;\n }\n }\n }\n return undefined;\n}\n\n/**\n * Absolute path to a plugin package's entry file under the store's\n * `node_modules`, resolved from its `package.json` (`exports[\".\"]`, then\n * `module`, then `main`, then `index.js`). Node's ESM loader rejects directory\n * imports, so the entry must be a file; `import()` of the result works inside\n * compiled binaries via `pathToFileURL`.\n *\n * @throws When the package is not installed or declares no resolvable entry.\n */\nexport function resolvePluginEntry(projectDir: string, pkgName: string): string {\n const pkgDir = join(nodeModulesDir(projectDir), pkgName);\n const pkgJsonPath = join(pkgDir, \"package.json\");\n if (!existsSync(pkgJsonPath)) {\n throw new Error(`package \"${pkgName}\" is not installed in ${nodeModulesDir(projectDir)}`);\n }\n const pkg = JSON.parse(readFileSync(pkgJsonPath, \"utf8\")) as {\n exports?: unknown;\n module?: string;\n main?: string;\n };\n let rel: string | undefined;\n if (pkg.exports !== undefined) {\n const root =\n typeof pkg.exports === \"object\" && pkg.exports !== null && !Array.isArray(pkg.exports)\n ? ((pkg.exports as Record<string, unknown>)[\".\"] ?? pkg.exports)\n : pkg.exports;\n rel = exportsTarget(root);\n }\n rel ??= pkg.module ?? pkg.main ?? \"index.js\";\n const entry = resolve(pkgDir, rel);\n if (!existsSync(entry)) {\n throw new Error(`package \"${pkgName}\" entry ${rel} does not exist`);\n }\n return entry;\n}\n","/**\n * Parse npm package specifiers from the `plugins:` list into name + range.\n *\n * The leading `@` of a scope is NOT a separator: the first `@` at a non-zero\n * index splits the package name (which never holds an `@`) from its range, so a\n * range may hold one itself (`foo@npm:bar@1.0.0`, `foo@file:/a@b/dir`).\n * \"@skaile/provider-fly@^0.1.0\" → { name: \"@skaile/provider-fly\", range: \"^0.1.0\" }\n * \"@skaile/connector-redis\" → { name: \"@skaile/connector-redis\", range: \"*\" }\n * \"lodash@^4\" → { name: \"lodash\", range: \"^4\" }\n */\nimport path from \"node:path\";\n\n/** A parsed plugin specifier: package name plus a semver range (`\"*\"` when omitted). */\nexport interface PluginSpec {\n name: string;\n range: string;\n}\n\n/**\n * Parse a single plugin specifier into `{ name, range }`.\n *\n * @param spec - An npm specifier, e.g. `\"@skaile/provider-fly@^0.1.0\"` or `\"lodash\"`.\n * @returns The package name and semver range (range defaults to `\"*\"`).\n * @throws Error when the specifier is empty.\n */\nexport function parseSpec(spec: string): PluginSpec {\n const trimmed = spec.trim();\n if (!trimmed) throw new Error(\"parseSpec: empty specifier\");\n\n // Find the version-separating `@` — the first one that is not the scope `@`\n // at index 0. A bare `@scope/name` has its only `@` at index 0 (no range).\n const at = trimmed.indexOf(\"@\", 1);\n if (at <= 0) {\n return { name: trimmed, range: \"*\" };\n }\n const name = trimmed.slice(0, at);\n const range = trimmed.slice(at + 1);\n return { name, range: range.length > 0 ? range : \"*\" };\n}\n\n/** Convenience: just the package name of a specifier. */\nexport function specName(spec: string): string {\n return parseSpec(spec).name;\n}\n\n/** A package name as the registry and `package.json` keys hold it (legacy uppercase included). */\nconst PACKAGE_NAME = /^(?:@[A-Za-z0-9][A-Za-z0-9._~-]*\\/)?[A-Za-z0-9][A-Za-z0-9._~-]*$/;\n\n/**\n * The refusal for a specifier that does not start with a package name, or `undefined` when it\n * does: `name`, `@scope/name`, or `name@<any range>` (`name@^1`, `name@npm:other@1`,\n * `name@github:user/repo`, `name@git+https://...`, `name@https://...tgz`, `name@file:/abs/dir`).\n * A range may hold a space (`name@>=0.1.0 <1`); an empty range (`name@`) is refused.\n * A bare path, a `file:` URL, a `github:` / `git+` / `https:` source or `user/repo` has no name:\n * the package manager would send it to the registry or key `package.json` by the URL, and fail\n * late (p1737). Such a source is installed under its package name, `<name>@<spec>`.\n */\nexport function npmSpecError(spec: string): string | undefined {\n const trimmed = spec.trim();\n if (trimmed !== \"\" && !/@file:$/i.test(trimmed)) {\n // Only the name is checked for white space (PACKAGE_NAME has none): an npm range may hold a\n // space (`>=0.1.0 <1`) and the package manager takes it as one argument.\n const at = trimmed.indexOf(\"@\", 1);\n const nameEnd = at > 0 ? at : trimmed.length;\n if (PACKAGE_NAME.test(trimmed.slice(0, nameEnd))) {\n if (at > 0 && trimmed.slice(at + 1).trim() === \"\") {\n return (\n `plugin spec '${trimmed}' has an empty version range after '@'. ` +\n `Write ${trimmed.slice(0, at)} for any version, or ${trimmed.slice(0, at)}@<range>, for example @1.2.0.`\n );\n }\n return undefined;\n }\n }\n return (\n `plugin spec '${spec}' is not an npm package name. Give an npm name with an optional version ` +\n \"range, for example @scope/name@1.2.0, or write <name>@<spec> for a git, URL or local source, \" +\n \"for example name@github:user/repo or name@file:/path/to/dir.\"\n );\n}\n\n/** The folder a `file:` range names, or `undefined` for any other spec or an absolute / URL target. */\nfunction relativeFileTarget(spec: string): { head: string; target: string } | undefined {\n const trimmed = spec.trim();\n const at = trimmed.indexOf(\"@\", 1);\n if (at <= 0) return undefined;\n const range = trimmed.slice(at + 1);\n if (!/^file:/i.test(range)) return undefined;\n const target = range.slice(\"file:\".length);\n if (\n target === \"\" ||\n target.startsWith(\"//\") ||\n path.isAbsolute(target) ||\n /^[A-Za-z]:[\\\\/]/.test(target)\n ) {\n return undefined;\n }\n return { head: trimmed.slice(0, at), target };\n}\n\n/**\n * The form of a spec to write into `skaile.yaml`. A relative `file:` range is typed relative to\n * `cwd`; `skaile.yaml` is committed and read on other machines, so it holds the folder relative\n * to the project instead (`name@file:./plugins/x`, `name@file:../x`), never a machine path\n * (p1737). Any other spec is returned as written.\n */\nexport function projectRelativeFileSpec(spec: string, cwd: string, projectDir: string): string {\n const parts = relativeFileTarget(spec);\n if (!parts) return spec;\n const rel = path.relative(path.resolve(projectDir), path.resolve(cwd, parts.target));\n if (path.isAbsolute(rel)) return `${parts.head}@file:${rel}`;\n const posix = rel.split(path.sep).join(\"/\") || \".\";\n return `${parts.head}@file:${posix.startsWith(\"..\") || posix === \".\" ? posix : `./${posix}`}`;\n}\n\n/**\n * The form of a spec to hand to the package manager. It runs in `.skaile/plugins/`, so a\n * project-relative `file:` range is resolved to an absolute path against `projectDir` here, and\n * only here (p1737). Any other spec is returned as written.\n */\nexport function resolveFileSpec(spec: string, projectDir: string): string {\n const parts = relativeFileTarget(spec);\n if (!parts) return spec;\n return `${parts.head}@file:${path.resolve(projectDir, parts.target)}`;\n}\n","/**\n * Runtime plugin loader: dynamic-import each reconciled plugin and let it\n * self-register into the `pluginRegistry`.\n *\n * Each plugin specifier resolves to an absolute path under the store's\n * `node_modules`; we import it via a `file://` URL so the import works inside\n * `bun --compile` binaries (which bundle only the literal-string switches, but\n * can still execute a `file://` import against the unpacked store on disk).\n * Failures are caught per-plugin so one broken plugin never aborts the rest.\n */\n\nimport { pathToFileURL } from \"node:url\";\nimport { type PluginRegistry, pluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { resolvePluginEntry } from \"./paths.js\";\nimport { parseSpec } from \"./spec.js\";\n\n/** Options for {@link loadPlugins}. */\nexport interface LoadOptions {\n log?: Logger;\n}\n\n/** Result of a load pass: which specs registered and which failed. */\nexport interface LoadResult {\n loaded: string[];\n failed: { spec: string; error: string; reason: string }[];\n}\n\n/** The self-registration entrypoint a plugin module is expected to export. */\ntype PluginModule = { register?: (registry: PluginRegistry) => void };\n\n/**\n * Load and register each plugin in `plugins` into `registry`.\n *\n * @param projectDir - Project root holding `.skaile/plugins/node_modules`.\n * @param plugins - The `skaile.yaml` `plugins:` list (npm specifiers).\n * @param registry - Registry to register into. Defaults to the process-wide `pluginRegistry`.\n * @param opts - Optional logger.\n * @returns Loaded specs + per-plugin failures (never throws).\n */\nexport async function loadPlugins(\n projectDir: string,\n plugins: string[],\n registry: PluginRegistry = pluginRegistry,\n opts: LoadOptions = {},\n): Promise<LoadResult> {\n const loaded: string[] = [];\n const failed: { spec: string; error: string; reason: string }[] = [];\n\n for (const spec of plugins) {\n try {\n const { name } = parseSpec(spec);\n const entry = resolvePluginEntry(projectDir, name);\n const mod = (await import(pathToFileURL(entry).href)) as PluginModule;\n if (typeof mod.register !== \"function\") {\n throw new Error(`plugin \"${name}\" does not export a register() function`);\n }\n mod.register(registry);\n loaded.push(spec);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n failed.push({ spec, error: `failed to load plugin \"${spec}\": ${message}`, reason: message });\n opts.log?.warn(`plugin load failed: ${spec}`, { error: message });\n }\n }\n\n return { loaded, failed };\n}\n","/**\n * Reconcile the project-local plugin store (`<projectDir>/.skaile/plugins/`).\n *\n * The reconciler is hash-skipped: it computes a SHA-256 over the sorted plugin\n * list plus the lock file's `plugins` slice and compares it to the stored\n * `.reconcile-hash`. On a match it returns with zero further I/O; otherwise it\n * regenerates the store's `package.json` and runs `bun install` against it.\n *\n * The install step is injectable (`InstallFn`) so tests stay hermetic — they\n * pass a fake installer that records calls and writes a stub `node_modules`.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { existsSync, mkdirSync, readFileSync, rmdirSync, rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { readPluginsLockSlice } from \"@skaile/workspaces/core\";\nimport { nodeModulesDir, pluginsDir, pluginsPkgJson, reconcileHashFile } from \"./paths.js\";\nimport { parseSpec, resolveFileSpec } from \"./spec.js\";\n\n/** How `InstallFn` may treat the store's lock: `frozen` forbids lock changes. */\nexport interface InstallOptions {\n /**\n * `false` when the spec list changed since the last `package.json`, so the\n * lock has to change too. Defaults to `true` (frozen when a lock exists).\n */\n frozen?: boolean;\n}\n\n/**\n * Installs the store's dependencies. Returns `ok: false` (never throws) on a\n * failed install so the reconciler can surface the captured `output`.\n */\nexport type InstallFn = (\n pluginsDir: string,\n opts?: InstallOptions,\n) => Promise<{ ok: boolean; output: string }>;\n\n/** Options for {@link reconcilePlugins}. */\nexport interface ReconcileOptions {\n /** Injectable installer. Defaults to a real `bun install` of the store. */\n runInstall?: InstallFn;\n /**\n * Lock slice to fold into the reconcile-hash. Defaults to\n * `readPluginsLockSlice(projectDir)` so a lock edit invalidates the hash.\n */\n lockSlice?: unknown;\n}\n\n/** Result of a reconcile pass. */\nexport interface ReconcileResult {\n changed: boolean;\n reason: \"no-plugins\" | \"up-to-date\" | \"reconciled\";\n}\n\n/** Run a command to completion, capturing stdout+stderr. `started: false` when it cannot spawn. */\nasync function runCapture(\n args: string[],\n cwd: string,\n): Promise<{ started: boolean; code: number; output: string }> {\n const { portableSpawn } = await import(\"@skaile/workspaces/core\");\n const proc = portableSpawn(args, { cwd });\n const chunks: string[] = [];\n const decoder = new TextDecoder();\n const pump = async (stream: ReadableStream<Uint8Array>) => {\n const reader = stream.getReader();\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n if (value) chunks.push(decoder.decode(value, { stream: true }));\n }\n };\n await Promise.all([pump(proc.stdout), pump(proc.stderr)]);\n const code = await proc.exited;\n // `portableSpawn` reports a spawn error (ENOENT) as exit -1 with no pid.\n return { started: proc.pid !== -1, code, output: chunks.join(\"\") };\n}\n\n/**\n * The default real installer: `bun install` inside the store directory, or\n * `npm install` when `bun` is not on PATH. Frozen only when a lock exists and\n * the spec list did not change (`opts.frozen !== false`): a changed list has to\n * rewrite the lock, which a frozen install refuses.\n */\nexport const defaultInstall: InstallFn = async (dir, opts = {}) => {\n const hasBunLock = existsSync(`${dir}/bun.lock`) || existsSync(`${dir}/bun.lockb`);\n const hasNpmLock = existsSync(`${dir}/package-lock.json`);\n const frozen = opts.frozen !== false;\n\n const bunArgs =\n frozen && (hasBunLock || hasNpmLock)\n ? [\"bun\", \"install\", \"--frozen-lockfile\"]\n : [\"bun\", \"install\"];\n const withBun = await runCapture(bunArgs, dir);\n if (withBun.started) return { ok: withBun.code === 0, output: withBun.output };\n\n const npmArgs =\n frozen && hasNpmLock\n ? [\"npm\", \"ci\", \"--ignore-scripts\", \"--no-audit\", \"--no-fund\"]\n : [\"npm\", \"install\", \"--ignore-scripts\", \"--no-audit\", \"--no-fund\"];\n const withNpm = await runCapture(npmArgs, dir);\n if (withNpm.started) return { ok: withNpm.code === 0, output: withNpm.output };\n return {\n ok: false,\n output:\n \"neither bun nor npm found on PATH; plugin install needs one of them (https://bun.sh or https://nodejs.org)\",\n };\n};\n\n/**\n * Generate the store's `package.json` from the plugin specs. Returns the\n * previous file content (`undefined` when there was none) and whether the\n * dependency set changed.\n */\nfunction writePackageJson(\n projectDir: string,\n plugins: string[],\n): { previous: string | undefined; depsChanged: boolean; removedDep: boolean } {\n const dependencies: Record<string, string> = {};\n for (const spec of plugins) {\n const { name, range } = parseSpec(resolveFileSpec(spec, projectDir));\n dependencies[name] = range;\n }\n const pkg = {\n name: \"skaile-project-plugins\",\n private: true,\n dependencies,\n };\n const file = pluginsPkgJson(projectDir);\n const previous = existsSync(file) ? readFileSync(file, \"utf8\") : undefined;\n let before: Record<string, string> | undefined;\n try {\n before = previous === undefined ? undefined : JSON.parse(previous).dependencies;\n } catch {\n before = undefined;\n }\n const sortedJson = (d: Record<string, string> | undefined) =>\n JSON.stringify(Object.entries(d ?? {}).sort(([a], [b]) => a.localeCompare(b)));\n const depsChanged = before === undefined || sortedJson(before) !== sortedJson(dependencies);\n // A plugin the list no longer names: the package manager prunes a registry package, but not a\n // `file:` one and not what a failed install left, so the caller rebuilds `node_modules`.\n const removedDep = Object.keys(before ?? {}).some((name) => !(name in dependencies));\n mkdirSync(pluginsDir(projectDir), { recursive: true });\n writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\\n`);\n return { previous, depsChanged, removedDep };\n}\n\n/** Whether `node_modules` holds a `package.json` for every declared plugin (by package name). */\nfunction allPluginsInstalled(projectDir: string, plugins: string[]): boolean {\n return plugins.every((spec) => {\n const { name } = parseSpec(resolveFileSpec(spec, projectDir));\n return existsSync(join(nodeModulesDir(projectDir), name, \"package.json\"));\n });\n}\n\n/**\n * Reconcile the plugin store for a project.\n *\n * @param projectDir - Project root containing `skaile.yaml` / `skaile.lock.yaml`.\n * @param plugins - The `skaile.yaml` `plugins:` list (npm specifiers).\n * @param opts - Optional injectable installer + lock slice override.\n * @returns Whether the store changed and why.\n */\nexport async function reconcilePlugins(\n projectDir: string,\n plugins: string[],\n opts: ReconcileOptions = {},\n): Promise<ReconcileResult> {\n if (plugins.length === 0) {\n return { changed: false, reason: \"no-plugins\" };\n }\n\n const lockSlice = opts.lockSlice ?? readPluginsLockSlice(projectDir);\n const wantHash = createHash(\"sha256\")\n .update(\n JSON.stringify({\n plugins: plugins.map((spec) => resolveFileSpec(spec, projectDir)).sort(),\n lock: lockSlice,\n }),\n )\n .digest(\"hex\");\n\n const hashFile = reconcileHashFile(projectDir);\n if (existsSync(hashFile)) {\n const have = readFileSync(hashFile, \"utf8\").trim();\n // The hash only says what was installed where it was written. A clone or a copied store comes\n // with the hash but without `node_modules`; trust the hash only while every declared package\n // is on disk.\n if (have === wantHash && allPluginsInstalled(projectDir, plugins)) {\n return { changed: false, reason: \"up-to-date\" };\n }\n }\n\n const { previous, depsChanged, removedDep } = writePackageJson(projectDir, plugins);\n if (removedDep) rmSync(nodeModulesDir(projectDir), { recursive: true, force: true });\n\n const install = opts.runInstall ?? defaultInstall;\n const result = await install(pluginsDir(projectDir), { frozen: !depsChanged });\n if (!result.ok) {\n // A failed install must not leave the spec behind: the next reconcile\n // would compare against it and treat the store as already changed.\n if (previous === undefined) rmSync(pluginsPkgJson(projectDir), { force: true });\n else writeFileSync(pluginsPkgJson(projectDir), previous);\n throw new Error(`plugin install failed:\\n${result.output}`);\n }\n\n writeFileSync(hashFile, wantHash);\n return { changed: true, reason: \"reconciled\" };\n}\n\n/**\n * Put the store back to `previousPlugins` after `plugin install` failed past\n * the reconcile (the plugin installed but does not load). Best effort: a\n * failing reinstall is swallowed, the store is then rebuilt by the next\n * reconcile because the hash no longer matches the declared list.\n *\n * With no previous plugins every generated file of the store goes away\n * (`package.json`, hash, lock file and `node_modules`), so the store keeps\n * neither the rejected spec nor its installed package.\n */\nexport async function rollbackPluginStore(\n projectDir: string,\n previousPlugins: string[],\n opts: ReconcileOptions = {},\n): Promise<void> {\n if (previousPlugins.length === 0) {\n const dir = pluginsDir(projectDir);\n rmSync(pluginsPkgJson(projectDir), { force: true });\n rmSync(reconcileHashFile(projectDir), { force: true });\n rmSync(nodeModulesDir(projectDir), { recursive: true, force: true });\n for (const lock of [\"bun.lock\", \"bun.lockb\", \"package-lock.json\"]) {\n rmSync(join(dir, lock), { force: true });\n }\n try {\n // The folder goes when nothing else of the user's is in it.\n rmdirSync(dir);\n } catch {\n // not empty, or already gone\n }\n return;\n }\n try {\n await reconcilePlugins(projectDir, previousPlugins, opts);\n } catch {\n // the next reconcile retries\n }\n}\n","/**\n * The project-local plugin store: reconcile (`<projectDir>/.skaile/plugins/`)\n * then load the reconciled plugins into the `pluginRegistry`.\n *\n * `ensurePluginsLoaded` is the single entrypoint commands wire in. It is a\n * guarded no-op when `plugins` is empty/undefined — zero overhead for the\n * common case where no project declares `plugins:` in `skaile.yaml`.\n */\n\nimport { resolve as resolvePath } from \"node:path\";\nimport { type PluginRegistry, pluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport pc from \"picocolors\";\nimport { type LoadResult, loadPlugins } from \"./load.js\";\nimport { type ReconcileOptions, reconcilePlugins } from \"./reconcile.js\";\nimport { specName } from \"./spec.js\";\n\nexport type { LoadResult } from \"./load.js\";\nexport { loadPlugins } from \"./load.js\";\nexport type { ReconcileOptions } from \"./reconcile.js\";\nexport { reconcilePlugins, rollbackPluginStore } from \"./reconcile.js\";\nexport { npmSpecError, projectRelativeFileSpec, resolveFileSpec, specName } from \"./spec.js\";\n\n/** Options for {@link ensurePluginsLoaded}. */\nexport interface EnsurePluginsOptions extends ReconcileOptions {\n log?: Logger;\n}\n\n/**\n * Reconcile the plugin store then load each plugin into `registry`.\n *\n * No-op (returns immediately) when `plugins` is empty/undefined, so the common\n * no-plugins path costs nothing.\n *\n * @param projectDir - Project root.\n * @param plugins - The `skaile.yaml` `plugins:` list (may be undefined).\n * @param registry - Registry to register into. Defaults to `pluginRegistry`.\n * @param opts - Injectable installer / lock slice + optional logger.\n * @returns The load result, or an empty result when there are no plugins.\n */\nexport async function ensurePluginsLoaded(\n projectDir: string,\n plugins: string[] | undefined,\n registry: PluginRegistry = pluginRegistry,\n opts: EnsurePluginsOptions = {},\n): Promise<LoadResult> {\n if (!plugins || plugins.length === 0) {\n return { loaded: [], failed: [] };\n }\n await reconcilePlugins(projectDir, plugins, opts);\n return loadPlugins(projectDir, plugins, registry, { log: opts.log });\n}\n\n/**\n * The installer's output of a failed `plugin install` is a dump (bun's banner, resolver\n * progress, then the `error:` lines). A load warning keeps the first line and the cause of it\n * (p1113); `skaile plugin install <spec>` prints the whole output.\n *\n * bun: the last `error:` line. npm: its `code` line and the first detail line after it\n * (`E404: 404 Not Found - GET …`), never the trailing `A complete log of this run can be found\n * in: …` pointer (p1272).\n */\nexport function condensePluginFailure(reason: string): string {\n const lines = reason\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter((l) => l !== \"\");\n const [first, ...rest] = lines;\n if (!reason.startsWith(\"plugin install failed\") || first === undefined || rest.length === 0) {\n return reason;\n }\n const head = first.replace(/:$/, \"\");\n const npmPrefix = /^npm (ERR!|error)\\s*/i;\n const npmLines = rest\n .filter((l) => npmPrefix.test(l) && !/^npm \\S+\\s+A complete log of this run\\b/i.test(l))\n .map((l) => l.replace(npmPrefix, \"\"))\n .filter((l) => l !== \"\");\n const codeLine = npmLines.find((l) => /^code\\s+\\S+/i.test(l));\n if (codeLine) {\n const code = codeLine.replace(/^code\\s+/i, \"\");\n const detail = npmLines.find((l) => l !== codeLine && !/^code\\s/i.test(l));\n return `${head}: npm ${code}${detail ? `: ${detail}` : \"\"}`;\n }\n const causes = rest.filter(\n (l) => /^error\\b/i.test(l) || (npmPrefix.test(l) && !/A complete log of this run\\b/i.test(l)),\n );\n const cause =\n causes.at(-1) ?? rest.filter((l) => !/A complete log of this run\\b/i.test(l)).at(-1);\n return `${head}: ${cause ?? rest.at(-1)}`;\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\/]/g, \"\\\\$&\");\n}\n\n/**\n * Split the output of one failed install of the whole plugin store into one reason per plugin\n * (p1272): the package manager runs once for every spec, so its output names the plugins that\n * failed. A plugin gets the line that names it (also its URL-encoded form `@scope%2fname`); a\n * plugin the output never names says it was not installed and which plugin the install stopped\n * at. With one plugin, or when the output names none (no `bun` and no `npm`), every plugin keeps\n * the whole condensed reason.\n */\nexport function pluginFailureReasons(\n reason: string,\n specs: readonly string[],\n): Map<string, string> {\n const out = new Map<string, string>();\n const condensed = condensePluginFailure(reason);\n if (specs.length < 2 || !reason.startsWith(\"plugin install failed\")) return out;\n const lines = reason\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter((l) => l !== \"\" && !/A complete log of this run\\b/i.test(l));\n const names = specs.map((spec) => {\n try {\n return specName(spec);\n } catch {\n return spec;\n }\n });\n const mentions = (text: string, name: string): boolean => {\n const forms = [name, name.replace(\"/\", \"%2f\"), name.replace(\"/\", \"%2F\")];\n return forms.some((f) =>\n new RegExp(`(?<![\\\\w@.-])(?<!@[\\\\w.~-]+/)${escapeRegExp(f)}(?![\\\\w-]|\\\\.\\\\w)`).test(text),\n );\n };\n const cause = /\\berror\\b|\\bE[A-Z0-9]{3,}\\b|\\b404\\b|notarget|failed to resolve/i;\n const named: string[] = [];\n specs.forEach((spec, i) => {\n const name = names[i] as string;\n const line = mentions(condensed, name)\n ? condensed.replace(/^plugin install failed:\\s*/, \"\")\n : lines.filter((l) => mentions(l, name) && cause.test(l)).at(-1);\n if (line === undefined) return;\n named.push(name);\n out.set(spec, `plugin install failed: ${line.replace(/^(npm\\s+)?(ERR!|error:?)\\s*/i, \"\")}`);\n });\n if (named.length === 0) return new Map();\n specs.forEach((spec, i) => {\n if (!out.has(spec)) {\n out.set(\n spec,\n `plugin install failed: ${names[i]} was not installed, the install stopped at ${named.join(\", \")}`,\n );\n }\n });\n return out;\n}\n\n/** One `! plugin <name> failed to load: <reason>` line on stderr (stdout carries a run's answer). */\nfunction warnPluginFailed(spec: string, reason: string): void {\n let name = spec;\n try {\n name = specName(spec);\n } catch {\n /* a spec that does not parse is named as written */\n }\n process.stderr.write(\n ` ${pc.yellow(\"!\")} plugin ${name} failed to load: ${condensePluginFailure(reason)}\\n`,\n );\n}\n\n/**\n * Reconcile + load the `plugins:` of the project's `skaile.yaml` into the process registry, so a\n * plugin's harness is known to `run`, `repl` and `config set harness`. A plugin that fails to\n * reconcile or load is skipped (its harness stays unknown, the command goes on) and named in one\n * `! plugin <name> failed to load: <reason>` line on stderr. An unreadable config is not this\n * function's to report: the command reads it again and says so.\n */\nexport function loadDeclaredPlugins(projectDir: string): Promise<void> {\n // A plugin registers once per process: a second `register()` is a duplicate.\n const key = resolvePath(projectDir);\n let pending = declaredPluginLoads.get(key);\n if (!pending) {\n pending = loadDeclaredPluginsOnce(projectDir);\n declaredPluginLoads.set(key, pending);\n }\n return pending;\n}\n\nconst declaredPluginLoads = new Map<string, Promise<void>>();\n\nasync function loadDeclaredPluginsOnce(projectDir: string): Promise<void> {\n let plugins: string[] | undefined;\n try {\n const { resolveSkWorkspaceConfig } = await import(\"@skaile/workspaces/core\");\n plugins = resolveSkWorkspaceConfig(projectDir).plugins;\n } catch {\n return;\n }\n if (!plugins || plugins.length === 0) return;\n try {\n const result = await ensurePluginsLoaded(projectDir, plugins, pluginRegistry);\n for (const f of result.failed) warnPluginFailed(f.spec, f.reason);\n } catch (err) {\n // The store could not be reconciled: no plugin was loaded.\n const reason = err instanceof Error ? err.message : String(err);\n const reasons = pluginFailureReasons(reason, plugins);\n for (const spec of plugins) warnPluginFailed(spec, reasons.get(spec) ?? reason);\n }\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { openLibrary } from './chunk-
|
|
2
|
-
import { getKindRegistry } from './chunk-
|
|
3
|
-
import { S, logErr, logWarn, logOk, logInfo } from './chunk-
|
|
1
|
+
import { openLibrary } from './chunk-57B4DG3Y.js';
|
|
2
|
+
import { getKindRegistry } from './chunk-QZS7E3DY.js';
|
|
3
|
+
import { S, logErr, logWarn, logOk, logInfo } from './chunk-5L3UCHBK.js';
|
|
4
4
|
import { parseFlowDefinition } from './chunk-JRN5QF4C.js';
|
|
5
|
-
import { resolveBinding, UnknownCompositionKindError } from './chunk-
|
|
6
|
-
import { filesEntryPaths, resolveIndexPath, LocalIndex, assetRootProblem, stampManifestPublisher, upsertManifestAsset } from './chunk-
|
|
5
|
+
import { resolveBinding, UnknownCompositionKindError } from './chunk-AS4SKSXJ.js';
|
|
6
|
+
import { filesEntryPaths, resolveIndexPath, LocalIndex, assetRootProblem, stampManifestPublisher, upsertManifestAsset } from './chunk-OMV4ROIO.js';
|
|
7
7
|
import { SEMVER_RE, invalidSemverMessage, parseManifestFile, requiresSyntaxErrors, flowFileNameError } from './chunk-QUPZKTF3.js';
|
|
8
|
-
import { checkAsset, assetPathProblem } from './chunk-
|
|
9
|
-
import { matchPin } from './chunk-
|
|
8
|
+
import { checkAsset, assetPathProblem } from './chunk-ZHI3YMGQ.js';
|
|
9
|
+
import { matchPin } from './chunk-GXW4B5SE.js';
|
|
10
10
|
import { globalSkaileDir } from './chunk-L5VSIPQD.js';
|
|
11
11
|
import { SKAILE_MANIFEST_FILENAME, manifestTextPublisherProblems, loadSkPublishManifest, listAssetFiles, expandManifestFiles, listLibrarySymlinks, librarySymlinkMessage, isNonAssetPath, isLibraryManifestAtAssetRoot } from './chunk-PMXTBWFD.js';
|
|
12
12
|
import { readAssetBody, parseFrontmatter } from './chunk-2MTRRK37.js';
|
|
@@ -1369,5 +1369,5 @@ function warnUntrackedAssetFiles(libPath) {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
|
|
1371
1371
|
export { DEFAULT_VERSION, DOMAIN_REMOVED_HINT, MANIFEST_GLOBS, assetEntryRef, assetNamespace, bareName, checkAssetFile, checkAssetFileFull, checkComposeKinds, composeRefContext, declaredVersion, deviceLogin, duplicateAssetMessage, exitOnEmptyAsset, exitOnLibrarySymlinks, exitOnManifestPathProblems, exitOnManifestPublisherProblems, exitOnRootSkillExtraAssets, exitOnRootSkillLibrary, findAssetManifestFile, findEntryManifestFile, formatNamespaceAvailability, getAccessToken, getStoreIdentity, hasStoredAuth, indexLibrary, invalidSemverText, libraryAssetRefusals, loadStoreAuthConfig, logout, manifestDependencyProblems, manifestEntryFilesRefusals, manifestEntryNameProblems, manifestEntryRenames, manifestEntryRootRefusals, manifestFilesProblems, manifestKindOfFile, manifestNamespaces, manifestParseErrorText, manifestParseFailureLine, manifestPublisherProblems, manifestRequiresProblems, manifestRootProblems, manifestVersionMismatchMessage, plannedRefs, preflightNamespace, publishToStore, readOnlyLibraryAt, refFor, registerLibraryAsset, registeredAssetKeys, rejectRemovedDomainOption, removedDomainOption, renameFileFix, reportLibrarySymlinks, requireValidPublisherOrExit, resolveLibraryPublisherDetailed, rootLevelAssetFileProblem, rootSkillExtraAssetProblems, runAssetChecks, unheldRequiresOfFile, unresolvedManifestDependencies, warnIgnoredDomainFiles, warnLegacyBundleFiles, warnLibraryNameFallback, warnUntrackedAssetFiles };
|
|
1372
|
-
//# sourceMappingURL=chunk-
|
|
1373
|
-
//# sourceMappingURL=chunk-
|
|
1372
|
+
//# sourceMappingURL=chunk-YKN5S7PO.js.map
|
|
1373
|
+
//# sourceMappingURL=chunk-YKN5S7PO.js.map
|