@skaile/workspaces 1.4.0 → 1.6.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 +326 -0
- package/dist/app-sdk/index.js +241 -55
- package/dist/app-sdk/index.js.map +1 -1
- package/dist/app-sdk/src/app.d.ts +55 -4
- package/dist/app-sdk/src/app.d.ts.map +1 -1
- package/dist/app-sdk/src/connection-params.d.ts +117 -0
- package/dist/app-sdk/src/connection-params.d.ts.map +1 -0
- package/dist/app-sdk/src/index.d.ts +3 -2
- package/dist/app-sdk/src/index.d.ts.map +1 -1
- package/dist/app-sdk/src/transport.d.ts +9 -0
- package/dist/app-sdk/src/transport.d.ts.map +1 -1
- package/dist/app-sdk/src/ws-transport.d.ts +18 -2
- package/dist/app-sdk/src/ws-transport.d.ts.map +1 -1
- package/dist/{asset-feeds-NG5TKB3V.js → asset-feeds-T35ELX2O.js} +9 -9
- package/dist/{asset-feeds-NG5TKB3V.js.map → asset-feeds-T35ELX2O.js.map} +1 -1
- package/dist/asset-manager/index.js +11 -6
- package/dist/asset-manager/installer.js +5 -5
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/{chunk-BE5KTS2L.js → chunk-2DWXGUZA.js} +2 -2
- package/dist/{chunk-BE5KTS2L.js.map → chunk-2DWXGUZA.js.map} +1 -1
- package/dist/{chunk-XBG2YDQQ.js → chunk-2ZMO4CFG.js} +3 -3
- package/dist/{chunk-XBG2YDQQ.js.map → chunk-2ZMO4CFG.js.map} +1 -1
- package/dist/{chunk-X57AMTAH.js → chunk-3CHARYD4.js} +16 -7
- package/dist/chunk-3CHARYD4.js.map +1 -0
- package/dist/{chunk-LCTRCWBK.js → chunk-6NR2BEIY.js} +4 -4
- package/dist/{chunk-LCTRCWBK.js.map → chunk-6NR2BEIY.js.map} +1 -1
- package/dist/{chunk-JZPEEMIM.js → chunk-BEO6KN7P.js} +5 -5
- package/dist/{chunk-JZPEEMIM.js.map → chunk-BEO6KN7P.js.map} +1 -1
- package/dist/{chunk-AAGD2J4H.js → chunk-CBA2XIBF.js} +33 -15
- package/dist/chunk-CBA2XIBF.js.map +1 -0
- package/dist/{chunk-GWDZW44L.js → chunk-DMG6NJH7.js} +4 -4
- package/dist/{chunk-GWDZW44L.js.map → chunk-DMG6NJH7.js.map} +1 -1
- package/dist/{chunk-HWTQ6HPO.js → chunk-FDE7XRQA.js} +56 -8
- package/dist/chunk-FDE7XRQA.js.map +1 -0
- package/dist/{chunk-26YCXWCU.js → chunk-HY33RMEA.js} +3 -3
- package/dist/{chunk-26YCXWCU.js.map → chunk-HY33RMEA.js.map} +1 -1
- package/dist/chunk-J5TI55E7.js +203 -0
- package/dist/chunk-J5TI55E7.js.map +1 -0
- package/dist/chunk-JIDKX7GC.js +122 -0
- package/dist/chunk-JIDKX7GC.js.map +1 -0
- package/dist/{chunk-BDUANIAR.js → chunk-KEQ4GLVM.js} +3 -3
- package/dist/{chunk-BDUANIAR.js.map → chunk-KEQ4GLVM.js.map} +1 -1
- package/dist/{chunk-DNFIKRO6.js → chunk-KMY7HVQ6.js} +3 -3
- package/dist/{chunk-DNFIKRO6.js.map → chunk-KMY7HVQ6.js.map} +1 -1
- package/dist/{chunk-B6SSXVF2.js → chunk-MZV6WCF3.js} +81 -49
- package/dist/chunk-MZV6WCF3.js.map +1 -0
- package/dist/{chunk-DZCK7GRW.js → chunk-P4VHQA4N.js} +22 -6
- package/dist/chunk-P4VHQA4N.js.map +1 -0
- package/dist/{chunk-OSCJRUKM.js → chunk-RDYOU6N6.js} +2 -2
- package/dist/{chunk-OSCJRUKM.js.map → chunk-RDYOU6N6.js.map} +1 -1
- package/dist/{chunk-77OXU44H.js → chunk-RSYV7XEN.js} +13 -7
- package/dist/chunk-RSYV7XEN.js.map +1 -0
- package/dist/{chunk-OUWNTFDG.js → chunk-UQKYT4V6.js} +38 -6
- package/dist/chunk-UQKYT4V6.js.map +1 -0
- package/dist/chunk-WYGXYGJH.js +688 -0
- package/dist/chunk-WYGXYGJH.js.map +1 -0
- package/dist/{chunk-TJRWGMD2.js → chunk-ZBZQC5R7.js} +3 -3
- package/dist/{chunk-TJRWGMD2.js.map → chunk-ZBZQC5R7.js.map} +1 -1
- package/dist/cli/index.js +259 -192
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts +18 -0
- package/dist/cli/src/commands/catalog.d.ts.map +1 -1
- package/dist/cli/src/commands/library-cmd.d.ts +2 -2
- package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/library-publish.d.ts +53 -0
- package/dist/cli/src/commands/library-publish.d.ts.map +1 -0
- package/dist/cli/src/commands/preset-cmd.d.ts +6 -0
- package/dist/cli/src/commands/preset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/preset-export.d.ts +10 -1
- package/dist/cli/src/commands/preset-export.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/publish-core.d.ts +75 -0
- package/dist/cli/src/commands/publish-core.d.ts.map +1 -0
- package/dist/cli/src/commands/run.d.ts.map +1 -1
- package/dist/cli/src/commands/source-manifest-publish.d.ts +82 -0
- package/dist/cli/src/commands/source-manifest-publish.d.ts.map +1 -0
- package/dist/cli/src/commands/source-manifest.d.ts +65 -6
- package/dist/cli/src/commands/source-manifest.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts +13 -0
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/store.d.ts.map +1 -1
- package/dist/cli/src/driver-error.d.ts +12 -0
- package/dist/cli/src/driver-error.d.ts.map +1 -0
- package/dist/cli/src/open-library.d.ts +4 -0
- package/dist/cli/src/open-library.d.ts.map +1 -1
- package/dist/cli/src/store-auth.d.ts +42 -0
- package/dist/cli/src/store-auth.d.ts.map +1 -0
- package/dist/cli/src/store-client.d.ts +20 -22
- package/dist/cli/src/store-client.d.ts.map +1 -1
- package/dist/cli/src/store-publisher.d.ts +91 -0
- package/dist/cli/src/store-publisher.d.ts.map +1 -0
- package/dist/connectors/config.js +5 -5
- package/dist/connectors/index.js +6 -6
- package/dist/core/index.js +4 -4
- package/dist/core/publish-manifest.js +1 -1
- package/dist/core/runtime-assets.js +3 -3
- package/dist/core/src/cache-paths.d.ts +17 -0
- package/dist/core/src/cache-paths.d.ts.map +1 -1
- package/dist/core/src/index.d.ts +2 -2
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/publish-manifest.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +13 -2
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/walker.d.ts +10 -0
- package/dist/core/src/walker.d.ts.map +1 -1
- package/dist/core/workspace-config.js +2 -2
- package/dist/deploy/index.js +4 -4
- package/dist/discovery/index.js +2 -2
- package/dist/discovery/src/discover-manifest.d.ts.map +1 -1
- package/dist/discovery/src/discover.d.ts +17 -4
- package/dist/discovery/src/discover.d.ts.map +1 -1
- package/dist/discovery/src/index.d.ts +1 -1
- package/dist/discovery/src/index.d.ts.map +1 -1
- package/dist/discovery/src/reference-lint.d.ts +7 -0
- package/dist/discovery/src/reference-lint.d.ts.map +1 -1
- package/dist/discovery/src/source-config.d.ts +28 -0
- 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-CHC7X7AJ.js → ensure-sources-QDVFUIUP.js} +14 -9
- package/dist/ensure-sources-QDVFUIUP.js.map +1 -0
- package/dist/factory-assets/connectors/box.js +6 -6
- package/dist/factory-assets/connectors/deploy.js +6 -6
- package/dist/factory-assets/connectors/devserver.js +6 -6
- package/dist/factory-assets/connectors/flow/adapter.js +6 -6
- package/dist/factory-assets/connectors/flow/engine.js +4 -4
- package/dist/factory-assets/connectors/flow/run-flow.js +7 -7
- package/dist/factory-assets/connectors/flow.js +6 -6
- package/dist/factory-assets/connectors/git.js +6 -6
- package/dist/factory-assets/connectors/gmail.js +6 -6
- package/dist/factory-assets/connectors/googledrive.js +6 -6
- package/dist/factory-assets/connectors/local.js +6 -6
- package/dist/factory-assets/connectors/mattermost.js +6 -6
- package/dist/factory-assets/connectors/memory.js +6 -6
- package/dist/factory-assets/connectors/minio.js +6 -6
- package/dist/factory-assets/connectors/postgres.js +6 -6
- package/dist/factory-assets/connectors/s3.js +6 -6
- package/dist/factory-assets/connectors/sharepoint.js +6 -6
- package/dist/factory-assets/connectors/sqlite.js +6 -6
- package/dist/factory-assets/connectors/static-server.js +6 -6
- package/dist/factory-assets/connectors/tunnel.js +6 -6
- package/dist/factory-assets/connectors/webdav.js +6 -6
- package/dist/factory-assets/connectors/xstate-store.js +6 -6
- package/dist/factory-assets/connectors/xstate.js +6 -6
- package/dist/{flows-CGOCUNO6.js → flows-MRVXTYWC.js} +3 -3
- package/dist/{flows-CGOCUNO6.js.map → flows-MRVXTYWC.js.map} +1 -1
- package/dist/{helpers-GWG4CYYC.js → helpers-TF7GCBRQ.js} +14 -9
- package/dist/{helpers-GWG4CYYC.js.map → helpers-TF7GCBRQ.js.map} +1 -1
- package/dist/library/index.js +6 -6
- package/dist/library/install.js +4 -4
- package/dist/library/src/index.d.ts +2 -2
- package/dist/library/src/index.d.ts.map +1 -1
- package/dist/library/src/local/local-catalog-source.d.ts +12 -1
- package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
- package/dist/library/src/sync/manifest-writeback.d.ts +36 -0
- package/dist/library/src/sync/manifest-writeback.d.ts.map +1 -1
- package/dist/library-publish-K5IBE44D.js +249 -0
- package/dist/library-publish-K5IBE44D.js.map +1 -0
- package/dist/{open-library-37PXN6MK.js → open-library-4HMIDK3N.js} +13 -13
- package/dist/{open-library-37PXN6MK.js.map → open-library-4HMIDK3N.js.map} +1 -1
- package/dist/{paths-UVOHWUPY.js → paths-P3DWFUPS.js} +7 -7
- package/dist/{paths-UVOHWUPY.js.map → paths-P3DWFUPS.js.map} +1 -1
- package/dist/{plugin-store-EIMVEH3O.js → plugin-store-S7OMGI7N.js} +6 -6
- package/dist/{plugin-store-EIMVEH3O.js.map → plugin-store-S7OMGI7N.js.map} +1 -1
- package/dist/runner/index.js +8 -8
- package/dist/runner/src/agent.d.ts.map +1 -1
- package/dist/runner/src/capability-registry.d.ts +21 -2
- package/dist/runner/src/capability-registry.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +11 -6
- package/dist/sdk/core.js +4 -4
- package/dist/sdk/flow.js +4 -4
- package/dist/sdk/index.js +8 -8
- package/dist/sdk/runner.js +8 -8
- package/dist/{setup-DINVR6ZQ.js → setup-2CCS63L6.js} +6 -6
- package/dist/{setup-DINVR6ZQ.js.map → setup-2CCS63L6.js.map} +1 -1
- package/dist/source-LOAM7IIQ.js +30 -0
- package/dist/{source-RXAHIGMD.js.map → source-LOAM7IIQ.js.map} +1 -1
- package/dist/source-manifest-publish-TGVZ6KMC.js +228 -0
- package/dist/source-manifest-publish-TGVZ6KMC.js.map +1 -0
- package/dist/tui/index.js +8 -8
- package/dist/workspace-plugin/adapters/mcp.js +1 -1
- package/dist/workspace-plugin/adapters/omp.js +3 -3
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-77OXU44H.js.map +0 -1
- package/dist/chunk-AAGD2J4H.js.map +0 -1
- package/dist/chunk-B6SSXVF2.js.map +0 -1
- package/dist/chunk-BJHZHNKR.js +0 -93
- package/dist/chunk-BJHZHNKR.js.map +0 -1
- package/dist/chunk-DZCK7GRW.js.map +0 -1
- package/dist/chunk-HWTQ6HPO.js.map +0 -1
- package/dist/chunk-OUWNTFDG.js.map +0 -1
- package/dist/chunk-QM2TT2PJ.js +0 -385
- package/dist/chunk-QM2TT2PJ.js.map +0 -1
- package/dist/chunk-X57AMTAH.js.map +0 -1
- package/dist/ensure-sources-CHC7X7AJ.js.map +0 -1
- package/dist/source-RXAHIGMD.js +0 -30
- package/dist/store-client-T3F663YG.js +0 -15
- package/dist/store-client-T3F663YG.js.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { autoSyncForSearch, ensureClone, findCacheKeyCollision, indexingHadFailures, legacySourceConfigHint, makeSourceCommand, normalizeSourceUrl, readProjectSources, sourceClonePath, sourceMatchesKey, syncProjectSources } from './chunk-WYGXYGJH.js';
|
|
2
|
+
import './chunk-RSYV7XEN.js';
|
|
3
|
+
import './chunk-KMY7HVQ6.js';
|
|
4
|
+
import './chunk-4N5XR5DQ.js';
|
|
5
|
+
import './chunk-3CHARYD4.js';
|
|
6
|
+
import './chunk-FDE7XRQA.js';
|
|
7
|
+
import './chunk-MZV6WCF3.js';
|
|
8
|
+
import './chunk-JXT46QFC.js';
|
|
9
|
+
import './chunk-UKJMQZV6.js';
|
|
10
|
+
import './chunk-R7FOF242.js';
|
|
11
|
+
import './chunk-6NR2BEIY.js';
|
|
12
|
+
import './chunk-CGYEHQOX.js';
|
|
13
|
+
import './chunk-HY33RMEA.js';
|
|
14
|
+
import './chunk-ZAP2BDHG.js';
|
|
15
|
+
import './chunk-ZBZQC5R7.js';
|
|
16
|
+
import './chunk-UQKYT4V6.js';
|
|
17
|
+
import './chunk-P4VHQA4N.js';
|
|
18
|
+
import './chunk-BQCGFPHW.js';
|
|
19
|
+
import './chunk-GEEW6SY2.js';
|
|
20
|
+
import './chunk-F3HNW354.js';
|
|
21
|
+
import './chunk-MENCWIHW.js';
|
|
22
|
+
import './chunk-K5GBV4SA.js';
|
|
23
|
+
import './chunk-JB35MVBN.js';
|
|
24
|
+
import './chunk-KTBKW2FI.js';
|
|
25
|
+
import './chunk-UQ6LFBPZ.js';
|
|
26
|
+
import './chunk-IEX5YV4R.js';
|
|
27
|
+
import './chunk-IRORTHGA.js';
|
|
28
|
+
import './chunk-NSBPE2FW.js';
|
|
29
|
+
//# sourceMappingURL=source-LOAM7IIQ.js.map
|
|
30
|
+
//# sourceMappingURL=source-LOAM7IIQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"source-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"source-LOAM7IIQ.js"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { makeHttpPublisherClient, refFor, publishToStore, bareName } from './chunk-JIDKX7GC.js';
|
|
2
|
+
import { isStoreAuthenticated } from './chunk-J5TI55E7.js';
|
|
3
|
+
import { sourceClonePath, resolveSourceArg } from './chunk-WYGXYGJH.js';
|
|
4
|
+
import './chunk-RSYV7XEN.js';
|
|
5
|
+
import { logErr, S, logInfo, logOk, logWarn } from './chunk-KMY7HVQ6.js';
|
|
6
|
+
import './chunk-4N5XR5DQ.js';
|
|
7
|
+
import './chunk-3CHARYD4.js';
|
|
8
|
+
import './chunk-FDE7XRQA.js';
|
|
9
|
+
import './chunk-MZV6WCF3.js';
|
|
10
|
+
import './chunk-JXT46QFC.js';
|
|
11
|
+
import './chunk-UKJMQZV6.js';
|
|
12
|
+
import './chunk-R7FOF242.js';
|
|
13
|
+
import './chunk-6NR2BEIY.js';
|
|
14
|
+
import './chunk-CGYEHQOX.js';
|
|
15
|
+
import './chunk-HY33RMEA.js';
|
|
16
|
+
import './chunk-ZAP2BDHG.js';
|
|
17
|
+
import './chunk-ZBZQC5R7.js';
|
|
18
|
+
import { sourceCacheKey } from './chunk-UQKYT4V6.js';
|
|
19
|
+
import { decodeSkaileManifest, encodeSkaileManifest } from './chunk-P4VHQA4N.js';
|
|
20
|
+
import './chunk-BQCGFPHW.js';
|
|
21
|
+
import './chunk-GEEW6SY2.js';
|
|
22
|
+
import './chunk-F3HNW354.js';
|
|
23
|
+
import './chunk-MENCWIHW.js';
|
|
24
|
+
import './chunk-K5GBV4SA.js';
|
|
25
|
+
import './chunk-JB35MVBN.js';
|
|
26
|
+
import './chunk-KTBKW2FI.js';
|
|
27
|
+
import './chunk-UQ6LFBPZ.js';
|
|
28
|
+
import './chunk-IEX5YV4R.js';
|
|
29
|
+
import './chunk-IRORTHGA.js';
|
|
30
|
+
import './chunk-NSBPE2FW.js';
|
|
31
|
+
import { spawnSync } from 'child_process';
|
|
32
|
+
import { mkdirSync, writeFileSync, rmSync, existsSync, readFileSync } from 'fs';
|
|
33
|
+
import { homedir } from 'os';
|
|
34
|
+
import { dirname, join } from 'path';
|
|
35
|
+
|
|
36
|
+
var SIDECAR_MANIFEST_FILENAME = "skaile.manifest.yaml";
|
|
37
|
+
function normalizePublishedManifest(manifest, namespace) {
|
|
38
|
+
const assets = (manifest.assets ?? []).map((a) => {
|
|
39
|
+
const { publisher: _drop, ...rest } = a;
|
|
40
|
+
return rest;
|
|
41
|
+
});
|
|
42
|
+
return { ...manifest, publisher: namespace, assets };
|
|
43
|
+
}
|
|
44
|
+
function settingsFile() {
|
|
45
|
+
const root = process.env.SKAILE_HOME ?? join(homedir(), ".skaile");
|
|
46
|
+
return join(root, "settings.json");
|
|
47
|
+
}
|
|
48
|
+
function readSettings() {
|
|
49
|
+
const file = settingsFile();
|
|
50
|
+
if (!existsSync(file)) return {};
|
|
51
|
+
try {
|
|
52
|
+
return JSON.parse(readFileSync(file, "utf-8"));
|
|
53
|
+
} catch {
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function getSidecarRepo(slug) {
|
|
58
|
+
const settings = readSettings();
|
|
59
|
+
return settings.sidecarRepos?.[slug]?.repo;
|
|
60
|
+
}
|
|
61
|
+
function saveSidecarRepo(slug, repo) {
|
|
62
|
+
const file = settingsFile();
|
|
63
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
64
|
+
const settings = readSettings();
|
|
65
|
+
const sidecarRepos = { ...settings.sidecarRepos ?? {} };
|
|
66
|
+
sidecarRepos[slug] = { ...sidecarRepos[slug] ?? {}, repo };
|
|
67
|
+
settings.sidecarRepos = sidecarRepos;
|
|
68
|
+
writeFileSync(file, JSON.stringify(settings, null, 2), "utf-8");
|
|
69
|
+
}
|
|
70
|
+
function git(spawn, cwd, args) {
|
|
71
|
+
const res = spawn("git", ["-C", cwd, ...args], { encoding: "utf-8" });
|
|
72
|
+
if (res.status !== 0) {
|
|
73
|
+
const stderr = (res.stderr ?? "").toString().trim();
|
|
74
|
+
throw new Error(`git ${args.join(" ")} failed: ${stderr || `exit ${res.status}`}`);
|
|
75
|
+
}
|
|
76
|
+
return (res.stdout ?? "").toString().trim();
|
|
77
|
+
}
|
|
78
|
+
function pushSidecarManifest(opts) {
|
|
79
|
+
const spawn = opts.spawn ?? spawnSync;
|
|
80
|
+
const cloneDir = `${sourceClonePath(sourceCacheKey(opts.sidecarRepoUrl))}-sidecar-push`;
|
|
81
|
+
rmSync(cloneDir, { recursive: true, force: true });
|
|
82
|
+
mkdirSync(dirname(cloneDir), { recursive: true });
|
|
83
|
+
try {
|
|
84
|
+
const cloneRes = spawn("git", ["clone", "--depth", "1", opts.sidecarRepoUrl, cloneDir], {
|
|
85
|
+
encoding: "utf-8"
|
|
86
|
+
});
|
|
87
|
+
if (cloneRes.status !== 0) {
|
|
88
|
+
const stderr = (cloneRes.stderr ?? "").toString().trim();
|
|
89
|
+
throw new Error(
|
|
90
|
+
`git clone ${opts.sidecarRepoUrl} failed: ${stderr || `exit ${cloneRes.status}`}`
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
writeFileSync(join(cloneDir, SIDECAR_MANIFEST_FILENAME), opts.manifestText, "utf-8");
|
|
94
|
+
git(spawn, cloneDir, ["add", SIDECAR_MANIFEST_FILENAME]);
|
|
95
|
+
const commitRes = spawn(
|
|
96
|
+
"git",
|
|
97
|
+
[
|
|
98
|
+
"-C",
|
|
99
|
+
cloneDir,
|
|
100
|
+
"-c",
|
|
101
|
+
"user.email=publish@skaile.store",
|
|
102
|
+
"-c",
|
|
103
|
+
"user.name=skaile",
|
|
104
|
+
"commit",
|
|
105
|
+
"-m",
|
|
106
|
+
"chore(sidecar): publish curated manifest"
|
|
107
|
+
],
|
|
108
|
+
{ encoding: "utf-8" }
|
|
109
|
+
);
|
|
110
|
+
if (commitRes.status !== 0) {
|
|
111
|
+
const out = `${commitRes.stdout ?? ""}${commitRes.stderr ?? ""}`;
|
|
112
|
+
if (!/nothing to commit/i.test(out)) {
|
|
113
|
+
throw new Error(`git commit failed: ${out.trim() || `exit ${commitRes.status}`}`);
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
git(spawn, cloneDir, ["push", "origin", "HEAD"]);
|
|
117
|
+
}
|
|
118
|
+
return { commitSha: git(spawn, cloneDir, ["rev-parse", "HEAD"]) };
|
|
119
|
+
} finally {
|
|
120
|
+
rmSync(cloneDir, { recursive: true, force: true });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function runPublish(arg, opts, client, spawn = spawnSync) {
|
|
124
|
+
const injected = client !== void 0;
|
|
125
|
+
const pub = client ?? makeHttpPublisherClient();
|
|
126
|
+
const { url, slug, manifestFile } = resolveSourceArg(arg, opts.projectDir);
|
|
127
|
+
if (!existsSync(manifestFile)) {
|
|
128
|
+
logErr(
|
|
129
|
+
`No curated manifest for "${slug}" at ${S.dim(manifestFile)} \u2014 run \`skaile source manifest init\` first.`
|
|
130
|
+
);
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
const { manifest, diagnostics } = decodeSkaileManifest(readFileSync(manifestFile, "utf-8"));
|
|
134
|
+
if (diagnostics.some((d) => d.severity === "error")) {
|
|
135
|
+
for (const d of diagnostics.filter((x) => x.severity === "error")) {
|
|
136
|
+
logErr(`${d.code}: ${d.message}`);
|
|
137
|
+
}
|
|
138
|
+
logErr(
|
|
139
|
+
"The curated manifest has errors \u2014 fix them with `skaile source manifest edit` / `verify` before publishing."
|
|
140
|
+
);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
const authed = injected || isStoreAuthenticated();
|
|
144
|
+
if (!opts.dryRun && !authed) {
|
|
145
|
+
logErr("Not signed in \u2014 run `skaile store login` first.");
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
let namespace;
|
|
149
|
+
if (opts.as) namespace = opts.as;
|
|
150
|
+
else if (authed) namespace = (await pub.me()).username;
|
|
151
|
+
else namespace = "<your store username>";
|
|
152
|
+
const normalized = normalizePublishedManifest(manifest, namespace);
|
|
153
|
+
const publishedText = encodeSkaileManifest(normalized);
|
|
154
|
+
const wouldBeRefs = (normalized.assets ?? []).map(
|
|
155
|
+
(a) => refFor(a.kind, namespace, a.name, a.version ?? normalized.version)
|
|
156
|
+
);
|
|
157
|
+
if (opts.dryRun) {
|
|
158
|
+
const sidecar = opts.sidecarRepo ?? getSidecarRepo(slug) ?? "<none \u2014 pass --sidecar-repo>";
|
|
159
|
+
logInfo(`Publish plan for ${S.bold(slug)}:`);
|
|
160
|
+
logInfo(` namespace: ${namespace}`);
|
|
161
|
+
logInfo(` sidecar repo: ${sidecar}`);
|
|
162
|
+
logInfo(` source ref: ${opts.ref ?? "main"}`);
|
|
163
|
+
logInfo(` would publish ${wouldBeRefs.length} asset(s):`);
|
|
164
|
+
for (const r of wouldBeRefs) logInfo(` ${r}`);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const sidecarRepoUrl = opts.sidecarRepo ?? getSidecarRepo(slug);
|
|
168
|
+
if (!sidecarRepoUrl) {
|
|
169
|
+
logErr(
|
|
170
|
+
`No sidecar repo associated with this source. Pass ${S.cmd("--sidecar-repo https://github.com/<you>/<repo>")} \u2014 it must be a PUBLIC GitHub repo you own; the curated manifest is committed there and the store pins to that commit.`
|
|
171
|
+
);
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
if (opts.sidecarRepo) saveSidecarRepo(slug, sidecarRepoUrl);
|
|
175
|
+
const { commitSha } = pushSidecarManifest({ sidecarRepoUrl, manifestText: publishedText, spawn });
|
|
176
|
+
logOk(`Pushed curated manifest to ${S.dim(sidecarRepoUrl)} @ ${commitSha.slice(0, 10)}.`);
|
|
177
|
+
const sourceRef = opts.ref ?? "main";
|
|
178
|
+
const { published } = await publishToStore({
|
|
179
|
+
sourceUrl: url,
|
|
180
|
+
ref: sourceRef,
|
|
181
|
+
sidecar: { url: sidecarRepoUrl, ref: commitSha },
|
|
182
|
+
manifest: normalized,
|
|
183
|
+
client: pub
|
|
184
|
+
});
|
|
185
|
+
if (published.length > 0) {
|
|
186
|
+
logInfo(`Consumers can now install them with \`skaile add ${published[0]}\`.`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
async function runYank(arg, opts, client) {
|
|
190
|
+
const injected = client !== void 0;
|
|
191
|
+
const pub = client ?? makeHttpPublisherClient();
|
|
192
|
+
const { url, slug } = resolveSourceArg(arg, opts.projectDir);
|
|
193
|
+
if (!injected && !isStoreAuthenticated()) {
|
|
194
|
+
logErr("Not signed in \u2014 run `skaile store login` first.");
|
|
195
|
+
process.exit(1);
|
|
196
|
+
}
|
|
197
|
+
const rows = await pub.sourcesList();
|
|
198
|
+
const source = rows.find((r) => r.url === url);
|
|
199
|
+
if (!source) {
|
|
200
|
+
logErr(`Source "${slug}" is not registered in the store \u2014 nothing to yank.`);
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
const targetName = opts.asset ? bareName(opts.asset) : void 0;
|
|
204
|
+
const candidates = (await pub.sourceCandidates(source.id)).filter(
|
|
205
|
+
(c) => c.published && (!targetName || c.name === targetName)
|
|
206
|
+
);
|
|
207
|
+
if (candidates.length === 0) {
|
|
208
|
+
logWarn("No published assets matched \u2014 nothing to yank.");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const yanked = [];
|
|
212
|
+
for (const c of candidates) {
|
|
213
|
+
try {
|
|
214
|
+
await pub.assetUnpublish(c.id);
|
|
215
|
+
yanked.push(`${c.kind}:${c.name}`);
|
|
216
|
+
} catch (err) {
|
|
217
|
+
logWarn(
|
|
218
|
+
`Failed to yank ${c.kind}:${c.name}: ${err instanceof Error ? err.message : String(err)}`
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
logOk(`Yanked ${yanked.length} asset(s):`);
|
|
223
|
+
for (const r of yanked) logInfo(` ${r}`);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export { getSidecarRepo, normalizePublishedManifest, pushSidecarManifest, runPublish, runYank, saveSidecarRepo };
|
|
227
|
+
//# sourceMappingURL=source-manifest-publish-TGVZ6KMC.js.map
|
|
228
|
+
//# sourceMappingURL=source-manifest-publish-TGVZ6KMC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../cli/src/commands/source-manifest-publish.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,IAAM,yBAAA,GAA4B,sBAAA;AAW3B,SAAS,0BAAA,CACd,UACA,SAAA,EACmB;AACnB,EAAA,MAAM,UAAU,QAAA,CAAS,MAAA,IAAU,EAAC,EAAG,GAAA,CAAI,CAAC,CAAA,KAAM;AAChD,IAAA,MAAM,EAAE,SAAA,EAAW,KAAA,EAAO,GAAG,MAAK,GAAI,CAAA;AACtC,IAAA,OAAO,IAAA;AAAA,EACT,CAAC,CAAA;AACD,EAAA,OAAO,EAAE,GAAG,QAAA,EAAU,SAAA,EAAW,WAAW,MAAA,EAAO;AACrD;AAWA,SAAS,YAAA,GAAuB;AAC9B,EAAA,MAAM,OAAO,OAAA,CAAQ,GAAA,CAAI,eAAe,IAAA,CAAK,OAAA,IAAW,SAAS,CAAA;AACjE,EAAA,OAAO,IAAA,CAAK,MAAM,eAAe,CAAA;AACnC;AAEA,SAAS,YAAA,GAAoC;AAC3C,EAAA,MAAM,OAAO,YAAA,EAAa;AAC1B,EAAA,IAAI,CAAC,UAAA,CAAW,IAAI,CAAA,SAAU,EAAC;AAC/B,EAAA,IAAI;AACF,IAAA,OAAO,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EAC/C,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAC;AAAA,EACV;AACF;AAMO,SAAS,eAAe,IAAA,EAAkC;AAC/D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M,CAAA,UAAA,CAAY,CAAA;AACzC,EAAA,KAAA,MAAW,CAAA,IAAK,MAAA,EAAQ,OAAA,CAAQ,CAAA,EAAA,EAAK,CAAC,CAAA,CAAE,CAAA;AAC1C","file":"source-manifest-publish-TGVZ6KMC.js","sourcesContent":["/**\n * `skaile source manifest publish` / `yank` — the curator-publish flow. Takes a\n * locally-curated sidecar manifest (over a foreign public GitHub repo) and:\n *\n * 1. Pushes the curated `skaile.manifest.yaml` to the curator's OWN public\n * \"sidecar\" repo (bytes stay in the foreign source; the sidecar holds only\n * the manifest pointing at it).\n * 2. Registers the foreign source + the sidecar (url + pinned commit) with the\n * store, syncs it, and publishes each curated asset.\n *\n * `yank` is the inverse: unpublish each currently-published asset of the source.\n *\n * The store REST surface is reached through the injectable {@link PublisherClient}\n * (default HTTP client); git side-effects go through an injectable `spawn`. Both\n * seams keep the pure helpers + orchestration unit/integration-testable without a\n * live store or a real remote.\n *\n * @docLink cli/commands/source#manifest-publish\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport {\n decodeSkaileManifest,\n encodeSkaileManifest,\n type SkPublishManifest,\n sourceCacheKey,\n} from \"@skaile/workspaces/core\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\nimport { makeHttpPublisherClient, type PublisherClient } from \"../store-publisher.ts\";\nimport { isStoreAuthenticated } from \"../store-client.ts\";\nimport { bareName, publishToStore, refFor } from \"./publish-core.ts\";\nimport { sourceClonePath } from \"./source.ts\";\nimport { resolveSourceArg } from \"./source-manifest.ts\";\n\n/** The fixed filename a sidecar repo carries at its root. */\nconst SIDECAR_MANIFEST_FILENAME = \"skaile.manifest.yaml\";\n\n/** Injectable spawn contract — the subset of `spawnSync` these helpers use. */\ntype SpawnLike = typeof spawnSync;\n\n/**\n * Return a copy of `manifest` normalized for publication under `namespace`:\n * the top-level `publisher` is set to `namespace` and every per-asset\n * `publisher` override is removed so all assets inherit the top-level one.\n * Pure — the input is not mutated.\n */\nexport function normalizePublishedManifest(\n manifest: SkPublishManifest,\n namespace: string,\n): SkPublishManifest {\n const assets = (manifest.assets ?? []).map((a) => {\n const { publisher: _drop, ...rest } = a;\n return rest;\n });\n return { ...manifest, publisher: namespace, assets };\n}\n\n// ── Sidecar-repo association (~/.skaile/settings.json) ────────────────────────\n\n/**\n * Path to the user settings file — the same `~/.skaile/settings.json` the store\n * client reads tokens from. Resolves the `.skaile` root exactly as `getStoreRoot`\n * does (`SKAILE_HOME` when set — it IS the `.skaile` dir — else `~/.skaile`), so\n * the sidecar association lives beside the store manifests under one convention\n * and tests isolate through the same `SKAILE_HOME` seam.\n */\nfunction settingsFile(): string {\n const root = process.env.SKAILE_HOME ?? join(homedir(), \".skaile\");\n return join(root, \"settings.json\");\n}\n\nfunction readSettings(): Record<string, any> {\n const file = settingsFile();\n if (!existsSync(file)) return {};\n try {\n return JSON.parse(readFileSync(file, \"utf-8\"));\n } catch {\n return {};\n }\n}\n\n/**\n * The sidecar repo URL previously associated with a source `slug`, if any.\n * Reads `settings.sidecarRepos?.[slug]?.repo`.\n */\nexport function getSidecarRepo(slug: string): string | undefined {\n const settings = readSettings();\n return settings.sidecarRepos?.[slug]?.repo;\n}\n\n/**\n * Persist the sidecar repo URL for a source `slug`, preserving every other\n * settings key. Stored as an object (`{ repo }`) so a `path` (or other fields)\n * can be added later without a schema migration.\n */\nexport function saveSidecarRepo(slug: string, repo: string): void {\n const file = settingsFile();\n mkdirSync(dirname(file), { recursive: true });\n const settings = readSettings();\n const sidecarRepos = { ...(settings.sidecarRepos ?? {}) };\n sidecarRepos[slug] = { ...(sidecarRepos[slug] ?? {}), repo };\n settings.sidecarRepos = sidecarRepos;\n writeFileSync(file, JSON.stringify(settings, null, 2), \"utf-8\");\n}\n\n// ── Sidecar push ──────────────────────────────────────────────────────────────\n\n/**\n * Run a git command in `cwd` via the injected spawn, throwing with the captured\n * stderr on failure. Returns trimmed stdout.\n */\nfunction git(spawn: SpawnLike, cwd: string, args: string[]): string {\n const res = spawn(\"git\", [\"-C\", cwd, ...args], { encoding: \"utf-8\" });\n if (res.status !== 0) {\n const stderr = (res.stderr ?? \"\").toString().trim();\n throw new Error(`git ${args.join(\" \")} failed: ${stderr || `exit ${res.status}`}`);\n }\n return (res.stdout ?? \"\").toString().trim();\n}\n\n/**\n * Clone the curator's sidecar repo, write the curated manifest at its root, and\n * commit + push. Returns the pushed commit sha (used to pin the store source).\n *\n * Idempotent re-publish: when the manifest is unchanged `git commit` fails with\n * \"nothing to commit\" — we swallow that and return the current HEAD so a no-op\n * re-run still yields a valid pin. Any push/auth failure surfaces as a thrown\n * Error carrying git's stderr.\n */\nexport function pushSidecarManifest(opts: {\n sidecarRepoUrl: string;\n manifestText: string;\n spawn?: SpawnLike;\n}): { commitSha: string } {\n const spawn = opts.spawn ?? spawnSync;\n // Dedicated dir next to the source clone cache; wipe any stale clone first so\n // a re-publish always starts from a clean shallow checkout of the remote.\n const cloneDir = `${sourceClonePath(sourceCacheKey(opts.sidecarRepoUrl))}-sidecar-push`;\n rmSync(cloneDir, { recursive: true, force: true });\n mkdirSync(dirname(cloneDir), { recursive: true });\n\n // The clone is scratch — always remove it afterwards (success or failure) so a\n // failed push never leaves a stale checkout in the cache dir.\n try {\n const cloneRes = spawn(\"git\", [\"clone\", \"--depth\", \"1\", opts.sidecarRepoUrl, cloneDir], {\n encoding: \"utf-8\",\n });\n if (cloneRes.status !== 0) {\n const stderr = (cloneRes.stderr ?? \"\").toString().trim();\n throw new Error(\n `git clone ${opts.sidecarRepoUrl} failed: ${stderr || `exit ${cloneRes.status}`}`,\n );\n }\n\n writeFileSync(join(cloneDir, SIDECAR_MANIFEST_FILENAME), opts.manifestText, \"utf-8\");\n git(spawn, cloneDir, [\"add\", SIDECAR_MANIFEST_FILENAME]);\n\n // Fixed bot identity via -c so the commit succeeds regardless of the curator's\n // git config (the sidecar push is a machine action, not authored work).\n const commitRes = spawn(\n \"git\",\n [\n \"-C\",\n cloneDir,\n \"-c\",\n \"user.email=publish@skaile.store\",\n \"-c\",\n \"user.name=skaile\",\n \"commit\",\n \"-m\",\n \"chore(sidecar): publish curated manifest\",\n ],\n { encoding: \"utf-8\" },\n );\n if (commitRes.status !== 0) {\n const out = `${commitRes.stdout ?? \"\"}${commitRes.stderr ?? \"\"}`;\n // Nothing changed → idempotent re-publish; keep the existing HEAD.\n if (!/nothing to commit/i.test(out)) {\n throw new Error(`git commit failed: ${out.trim() || `exit ${commitRes.status}`}`);\n }\n } else {\n // `push origin HEAD` (not a bare `push`) so a fresh sidecar repo with an\n // unborn/renamed default branch still gets its branch created on the remote.\n git(spawn, cloneDir, [\"push\", \"origin\", \"HEAD\"]);\n }\n\n return { commitSha: git(spawn, cloneDir, [\"rev-parse\", \"HEAD\"]) };\n } finally {\n rmSync(cloneDir, { recursive: true, force: true });\n }\n}\n\n// ── Orchestration ───────────────────────────────────────────────────────────\n\n/**\n * `source manifest publish <src>` — publish a curated sidecar manifest to the\n * store. See the module header for the full flow. Store calls go through\n * `client` (default HTTP); git side-effects through `spawn` (default\n * `spawnSync`). The auth gate is enforced only for the default HTTP client so\n * injected fakes bypass it.\n */\nexport async function runPublish(\n arg: string,\n opts: {\n projectDir: string;\n as?: string;\n sidecarRepo?: string;\n ref?: string;\n dryRun?: boolean;\n },\n client?: PublisherClient,\n spawn: SpawnLike = spawnSync,\n): Promise<void> {\n const injected = client !== undefined;\n const pub = client ?? makeHttpPublisherClient();\n\n const { url, slug, manifestFile } = resolveSourceArg(arg, opts.projectDir);\n\n if (!existsSync(manifestFile)) {\n logErr(\n `No curated manifest for \"${slug}\" at ${S.dim(manifestFile)} — ` +\n \"run `skaile source manifest init` first.\",\n );\n process.exit(1);\n }\n\n const { manifest, diagnostics } = decodeSkaileManifest(readFileSync(manifestFile, \"utf-8\"));\n if (diagnostics.some((d) => d.severity === \"error\")) {\n for (const d of diagnostics.filter((x) => x.severity === \"error\")) {\n logErr(`${d.code}: ${d.message}`);\n }\n logErr(\n \"The curated manifest has errors — fix them with `skaile source manifest edit` / \" +\n \"`verify` before publishing.\",\n );\n process.exit(1);\n }\n\n // A real publish makes store calls (+ `me()` when `--as` is omitted), so it\n // needs a token. `--dry-run` is an offline preview: never gate it on auth.\n const authed = injected || isStoreAuthenticated();\n if (!opts.dryRun && !authed) {\n logErr(\"Not signed in — run `skaile store login` first.\");\n process.exit(1);\n }\n\n // Namespace: `--as` wins; else the signed-in username. In an unauthenticated\n // dry-run we cannot call `me()`, so show a placeholder in the offline plan.\n let namespace: string;\n if (opts.as) namespace = opts.as;\n else if (authed) namespace = (await pub.me()).username;\n else namespace = \"<your store username>\";\n\n const normalized = normalizePublishedManifest(manifest, namespace);\n const publishedText = encodeSkaileManifest(normalized);\n\n const wouldBeRefs = (normalized.assets ?? []).map((a) =>\n refFor(a.kind, namespace, a.name, a.version ?? normalized.version),\n );\n\n if (opts.dryRun) {\n const sidecar = opts.sidecarRepo ?? getSidecarRepo(slug) ?? \"<none — pass --sidecar-repo>\";\n logInfo(`Publish plan for ${S.bold(slug)}:`);\n logInfo(` namespace: ${namespace}`);\n logInfo(` sidecar repo: ${sidecar}`);\n logInfo(` source ref: ${opts.ref ?? \"main\"}`);\n logInfo(` would publish ${wouldBeRefs.length} asset(s):`);\n for (const r of wouldBeRefs) logInfo(` ${r}`);\n return;\n }\n\n const sidecarRepoUrl = opts.sidecarRepo ?? getSidecarRepo(slug);\n if (!sidecarRepoUrl) {\n logErr(\n \"No sidecar repo associated with this source. Pass \" +\n `${S.cmd(\"--sidecar-repo https://github.com/<you>/<repo>\")} — it must be a ` +\n \"PUBLIC GitHub repo you own; the curated manifest is committed there and the \" +\n \"store pins to that commit.\",\n );\n process.exit(1);\n }\n if (opts.sidecarRepo) saveSidecarRepo(slug, sidecarRepoUrl);\n\n const { commitSha } = pushSidecarManifest({ sidecarRepoUrl, manifestText: publishedText, spawn });\n logOk(`Pushed curated manifest to ${S.dim(sidecarRepoUrl)} @ ${commitSha.slice(0, 10)}.`);\n\n // The FOREIGN repo's ref to ingest (branch/sha). Defaults to `main`.\n const sourceRef = opts.ref ?? \"main\";\n\n const { published } = await publishToStore({\n sourceUrl: url,\n ref: sourceRef,\n sidecar: { url: sidecarRepoUrl, ref: commitSha },\n manifest: normalized,\n client: pub,\n });\n\n if (published.length > 0) {\n logInfo(`Consumers can now install them with \\`skaile add ${published[0]}\\`.`);\n }\n}\n\n/**\n * `source manifest yank <src>` — unpublish the source's published assets (all,\n * or the single asset matching `opts.asset`'s name). Auth-gated like publish.\n */\nexport async function runYank(\n arg: string,\n opts: { projectDir: string; asset?: string },\n client?: PublisherClient,\n): Promise<void> {\n const injected = client !== undefined;\n const pub = client ?? makeHttpPublisherClient();\n\n const { url, slug } = resolveSourceArg(arg, opts.projectDir);\n\n if (!injected && !isStoreAuthenticated()) {\n logErr(\"Not signed in — run `skaile store login` first.\");\n process.exit(1);\n }\n\n const rows = await pub.sourcesList();\n const source = rows.find((r) => r.url === url);\n if (!source) {\n logErr(`Source \"${slug}\" is not registered in the store — nothing to yank.`);\n process.exit(1);\n }\n\n // Optionally narrow to a single asset by name (accept a bare name or a ref).\n const targetName = opts.asset ? bareName(opts.asset) : undefined;\n const candidates = (await pub.sourceCandidates(source.id)).filter(\n (c) => c.published && (!targetName || c.name === targetName),\n );\n if (candidates.length === 0) {\n logWarn(\"No published assets matched — nothing to yank.\");\n return;\n }\n\n const yanked: string[] = [];\n for (const c of candidates) {\n try {\n await pub.assetUnpublish(c.id);\n yanked.push(`${c.kind}:${c.name}`);\n } catch (err) {\n logWarn(\n `Failed to yank ${c.kind}:${c.name}: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n\n logOk(`Yanked ${yanked.length} asset(s):`);\n for (const r of yanked) logInfo(` ${r}`);\n}\n"]}
|
package/dist/tui/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createAgentSession } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
import { createAgentSession } from '../chunk-CBA2XIBF.js';
|
|
2
|
+
import '../chunk-RDYOU6N6.js';
|
|
3
3
|
import '../chunk-X5YPJV4N.js';
|
|
4
4
|
import '../chunk-O7SG5PC2.js';
|
|
5
5
|
import '../chunk-7QBNJTTQ.js';
|
|
@@ -14,18 +14,18 @@ import '../chunk-BMQKMOQY.js';
|
|
|
14
14
|
import '../chunk-GAH4YRCI.js';
|
|
15
15
|
import '../chunk-TNSCHS4I.js';
|
|
16
16
|
import '../chunk-LV2HPH3C.js';
|
|
17
|
-
import '../chunk-
|
|
18
|
-
import { loadConnectorDeclarations } from '../chunk-
|
|
17
|
+
import '../chunk-DMG6NJH7.js';
|
|
18
|
+
import { loadConnectorDeclarations } from '../chunk-KEQ4GLVM.js';
|
|
19
19
|
import '../chunk-6E6PKKAD.js';
|
|
20
20
|
import '../chunk-4N5XR5DQ.js';
|
|
21
21
|
import '../chunk-DEYYRFQU.js';
|
|
22
22
|
import '../chunk-IFGTRL2I.js';
|
|
23
23
|
import '../chunk-PK7Q7MC7.js';
|
|
24
|
-
import { resolveSettings } from '../chunk-
|
|
24
|
+
import { resolveSettings } from '../chunk-HY33RMEA.js';
|
|
25
25
|
import '../chunk-ZAP2BDHG.js';
|
|
26
|
-
import '../chunk-
|
|
27
|
-
import { resolveAgentDir } from '../chunk-
|
|
28
|
-
import '../chunk-
|
|
26
|
+
import '../chunk-ZBZQC5R7.js';
|
|
27
|
+
import { resolveAgentDir } from '../chunk-UQKYT4V6.js';
|
|
28
|
+
import '../chunk-P4VHQA4N.js';
|
|
29
29
|
import '../chunk-BQCGFPHW.js';
|
|
30
30
|
import '../chunk-GEEW6SY2.js';
|
|
31
31
|
import '../chunk-F3HNW354.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flowList, flowShow, flowListSessions, flowGetSession, flowFindFlowForSession } from '../../chunk-
|
|
1
|
+
import { flowList, flowShow, flowListSessions, flowGetSession, flowFindFlowForSession } from '../../chunk-2DWXGUZA.js';
|
|
2
2
|
import { sessionList, sessionGet } from '../../chunk-R6O6YWU7.js';
|
|
3
3
|
import { skillList, skillListDomains, skillShow, skillSearch, skillCheckRequirements, skillGetPreamble } from '../../chunk-KY5NY7LB.js';
|
|
4
4
|
import '../../chunk-XCBG2KDC.js';
|
|
@@ -74,7 +74,7 @@ function buildOmpToolSet(plugin) {
|
|
|
74
74
|
description: "List all available flow definitions from ai-assets.",
|
|
75
75
|
parameters: {},
|
|
76
76
|
handler: async () => {
|
|
77
|
-
const { flowList } = await import('../../flows-
|
|
77
|
+
const { flowList } = await import('../../flows-MRVXTYWC.js');
|
|
78
78
|
return (await flowList(plugin.projectDir)).content[0].text;
|
|
79
79
|
}
|
|
80
80
|
},
|
|
@@ -83,7 +83,7 @@ function buildOmpToolSet(plugin) {
|
|
|
83
83
|
description: "List past flow run sessions for this workspace.",
|
|
84
84
|
parameters: {},
|
|
85
85
|
handler: async () => {
|
|
86
|
-
const { flowListSessions } = await import('../../flows-
|
|
86
|
+
const { flowListSessions } = await import('../../flows-MRVXTYWC.js');
|
|
87
87
|
return (await flowListSessions(plugin.projectDir)).content[0].text;
|
|
88
88
|
}
|
|
89
89
|
},
|
|
@@ -201,7 +201,7 @@ async function handleSlashCommand(plugin, group, args) {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
async function handleFlowCommand(plugin, sub, rest) {
|
|
204
|
-
const { flowList, flowShow, flowListSessions, flowGetSession } = await import('../../flows-
|
|
204
|
+
const { flowList, flowShow, flowListSessions, flowGetSession } = await import('../../flows-MRVXTYWC.js');
|
|
205
205
|
if (!sub || sub === "list") return (await flowList(plugin.projectDir)).content[0].text;
|
|
206
206
|
if (sub === "show" && rest[0])
|
|
207
207
|
return (await flowShow(plugin.projectDir, rest[0])).content[0].text;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { PluginStore, WorkspacePlugin, buildClaudePluginFiles, resolveProjectDir } from '../chunk-
|
|
1
|
+
export { PluginStore, WorkspacePlugin, buildClaudePluginFiles, resolveProjectDir } from '../chunk-RDYOU6N6.js';
|
|
2
2
|
export { err, ok, okJson } from '../chunk-X5YPJV4N.js';
|
|
3
3
|
import '../chunk-JB35MVBN.js';
|
|
4
4
|
import '../chunk-NSBPE2FW.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skaile/workspaces",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Skaile workspaces runtime — types, core, bridge, runner, store, connectors, and supporting layers as one publishable package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "bun@1.3.9",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/open-registry.ts","../cli/src/open-library.ts"],"names":["source"],"mappings":";;;;;;AA2BO,SAAS,kBAAA,GAAwC;AACtD,EAAA,MAAM,WAAW,qBAAA,EAAsB;AACvC,EAAA,QAAA,CAAS,SAAS,gBAAgB,CAAA;AAClC,EAAA,QAAA,CAAS,SAAS,qBAAqB,CAAA;AACvC,EAAA,OAAO,QAAA;AACT;;;ACTA,eAAsB,WAAA,GAAc;AAClC,EAAA,IAAI;AACF,IAAA,MAAM,EAAE,UAAA,EAAW,GAAI,MAAM,OAAO,oBAA4B,CAAA;AAChE,IAAA,OAAO,IAAI,UAAA,CAAW,EAAE,YAAA,EAAc,kBAAA,IAAsB,CAAA;AAAA,EAC9D,SAAS,GAAA,EAAK;AACZ,IAAA,MAAA,CAAO,CAAA,2BAAA,EAA8B,eAAe,KAAA,GAAQ,GAAA,CAAI,UAAU,MAAA,CAAO,GAAG,CAAC,CAAA,CAAE,CAAA;AACvF,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AACF;AAqBA,eAAsB,kBAAkB,IAAA,EAQtC;AACA,EAAA,MAAM,EAAE,eAAe,mBAAA,EAAqB,i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CAAI,OAAA,CAAQ,SAAA,GAAY,GAAA;AAC3C,EAAA,MAAM,SACJ,GAAA,CAAI,OAAA,CAAQ,OAAA,KAAY,MAAA,GACpB,IAAI,iBAAA,CAAkB,EAAE,OAAA,EAAS,UAAA,EAAY,CAAA,GAC7C,IAAI,oBAAoB,EAAE,OAAA,EAAS,YAAY,CAAA;AACrD,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,MAAM;AAAA,EAAC,CAAA,EAAE;AACnC;AASA,eAAsB,kBAAA,GAInB;AACD,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,MAAM,OAAO,oBAA4B,CAAA;AACpE,EAAA,MAAM,OAAA,GAAU,MAAM,WAAA,EAAY;AAClC,EAAA,MAAM,OAAA,GAAU,IAAI,cAAA,CAAe,OAAO,CAAA;AAC1C,EAAA,OAAO,EAAE,OAAA,EAAS,OAAA,EAAS,OAAO,MAAM,OAAA,CAAQ,OAAM,EAAE;AAC1D","file":"chunk-77OXU44H.js","sourcesContent":["/**\n * open-registry.ts — shared helper to create a full AssetKindRegistry.\n *\n * Bootstraps the registry with all built-in providers (9 core + preset)\n * from @skaile/discovery, plus the extension kind providers (flow from\n * @skaile/workspaces/factory-assets/connectors/flow/engine, knowledge from @skaile/library).\n *\n * This is the single registration point for the CLI. All code paths\n * that need a registry (source sync, lib-status, etc.) should use this.\n */\n\nimport type { AssetKindRegistry } from \"@skaile/workspaces/discovery\";\nimport { createDefaultRegistry } from \"@skaile/workspaces/discovery\";\nimport { flowKindProvider } from \"@skaile/workspaces/factory-assets/connectors/flow/engine\";\nimport { knowledgeKindProvider } from \"@skaile/workspaces/library\";\n\n/**\n * Create a fully-configured AssetKindRegistry with all known providers.\n *\n * Registers:\n * - 9 core kinds (skill, agent, connector, mount, mcp-server, contract, prompt, persona, ruleset)\n * - preset (composition entity)\n * - flow (extension, from @skaile/workspaces/factory-assets/connectors/flow/engine)\n * - knowledge (extension, from @skaile/library)\n *\n * @returns An unfrozen registry (auto-freezes on first read)\n */\nexport function createFullRegistry(): AssetKindRegistry {\n const registry = createDefaultRegistry();\n registry.register(flowKindProvider);\n registry.register(knowledgeKindProvider);\n return registry;\n}\n","/**\n * open-library.ts — shared helpers to open the LocalIndex and the configured\n * Catalog source.\n *\n * Lazy-loads the `@skaile/workspaces/library` subpath and returns the\n * LocalIndex instance (backed by `@libsql/client`; runs on Node and Bun).\n * The catalog-source helper reads\n * `~/.skaile/config.yaml` (and project-level overlay if `projectDir` is given)\n * to decide between {@link RemoteCatalogSource} (default — points at\n * `https://skaile.store`) and a {@link LocalCatalogSource} bound to the most\n * recent local library registered via `skaile source add`.\n */\n\nimport { logErr } from \"./helpers.ts\";\nimport { createFullRegistry } from \"./open-registry.ts\";\n\n/**\n * Open the LocalIndex with the full kind registry. Exits with code 1\n * if the library directory cannot be created.\n *\n * @returns A `LocalIndex` instance ready for use.\n * @docLink cli/dev-guide#open-library\n */\nexport async function openLibrary() {\n try {\n const { LocalIndex } = await import(\"@skaile/workspaces/library\");\n return new LocalIndex({ kindRegistry: createFullRegistry() });\n } catch (err) {\n logErr(`Could not open LocalIndex: ${err instanceof Error ? err.message : String(err)}`);\n process.exit(1);\n }\n}\n\n/**\n * Resolve the configured **remote** Catalog source for the CLI.\n *\n * Reads `~/.skaile/config.yaml` (plus the optional project-level overlay) and\n * returns a {@link RemoteCatalogSource} pointing at `catalog.url` (default:\n * `https://skaile.store`). The `cache_ttl: 0` config flag flips the source\n * into air-gapped mode: network reads are disabled, only `skaile update`\n * performs refreshes.\n *\n * **Local-mode rejection.** If the resolved config has `catalog.url: local`\n * this helper throws — callers wanting the dispatched local-or-remote source\n * must use {@link resolveCatalogSource}. Remote-only consumers like\n * `skaile update --catalog-only` rely on this strict behaviour.\n *\n * @param opts - Project directory (overlays project config) and explicit overrides.\n * @returns A configured {@link RemoteCatalogSource}.\n * @throws When `catalog.url` is the `local` sentinel.\n * @docLink cli/dev-guide#open-library\n */\nexport async function openCatalogSource(opts?: {\n projectDir?: string;\n baseUrlOverride?: string;\n /** Override the user-config path for tests. */\n userConfigFile?: string;\n}): Promise<\n | import(\"@skaile/workspaces/library\").RemoteCatalogSource\n | import(\"@skaile/workspaces/library\").RestCatalogSource\n> {\n const { resolveConfig, RemoteCatalogSource, RestCatalogSource, isLocalCatalogUrl } = await import(\n \"@skaile/workspaces/library\"\n );\n const cfg = resolveConfig({\n projectDir: opts?.projectDir,\n userConfigFile: opts?.userConfigFile,\n });\n const baseUrl = opts?.baseUrlOverride ?? cfg.catalog.url;\n if (isLocalCatalogUrl(baseUrl)) {\n throw new Error(\n \"catalog.url is set to 'local' — remote catalog is disabled. \" +\n \"Use `skaile source add <path>` + `skaile source sync` for local sources, \" +\n \"or set `catalog.url: https://skaile.store` in ~/.skaile/config.yaml.\",\n );\n }\n const cacheTtlMs = cfg.catalog.cache_ttl * 1000;\n if (cfg.catalog.framing === \"rest\") {\n return new RestCatalogSource({ baseUrl, cacheTtlMs });\n }\n return new RemoteCatalogSource({ baseUrl, cacheTtlMs });\n}\n\n/**\n * Resolved catalog source plus a close handle for releasing any underlying\n * resources (e.g. the `LocalIndex` SQLite connection in local mode).\n *\n * Callers MUST invoke `close()` when done — typically in a `finally` block.\n * For remote-mode sources `close()` is a no-op, but the contract is uniform\n * so consumers don't have to branch.\n *\n * @docLink cli/dev-guide#open-library\n */\nexport interface ResolvedCatalogSource {\n /** The {@link ICatalogSource} ready for use. */\n source: import(\"@skaile/workspaces/library\").ICatalogSource;\n /** Release any underlying resources (SQLite handle in local mode). */\n close(): void;\n}\n\n/**\n * Resolve the configured Catalog source — local or remote — based on\n * `~/.skaile/config.yaml`.\n *\n * Dispatch:\n * - `catalog.url: local` → opens {@link LocalIndex}, picks the most recently\n * registered local library whose `path` still exists on disk, and returns a\n * {@link LocalCatalogSource} bound to that library. Throws if no usable\n * local library is registered.\n * - any URL → returns {@link RemoteCatalogSource} (same as\n * {@link openCatalogSource}).\n *\n * The returned `close()` releases the underlying `LocalIndex` SQLite handle\n * in local mode (no-op in remote mode). Callers MUST invoke it — typically in\n * a `finally` block — to satisfy `library/CLAUDE.md` § \"Notes for Consumers\".\n *\n * @param opts - Project directory (overlays project config) and explicit overrides.\n * @returns A `ResolvedCatalogSource` carrying the source and a close handle.\n * @throws When `local` is configured but no usable local library is registered.\n * @docLink cli/dev-guide#open-library\n */\nexport async function resolveCatalogSource(opts?: {\n projectDir?: string;\n baseUrlOverride?: string;\n /** Override the user-config path for tests. */\n userConfigFile?: string;\n}): Promise<ResolvedCatalogSource> {\n const {\n resolveConfig,\n RemoteCatalogSource,\n RestCatalogSource,\n LocalCatalogSource,\n isLocalCatalogUrl,\n } = await import(\"@skaile/workspaces/library\");\n const cfg = resolveConfig({\n projectDir: opts?.projectDir,\n userConfigFile: opts?.userConfigFile,\n });\n const baseUrl = opts?.baseUrlOverride ?? cfg.catalog.url;\n\n if (isLocalCatalogUrl(baseUrl)) {\n const fs = await import(\"node:fs\");\n const library = await openLibrary();\n try {\n const sources = await library.listSources();\n type LibraryRow = (typeof sources)[number];\n // Type-narrow: `path` is required for local libraries after the filter.\n const usable = sources\n .filter(\n (s): s is LibraryRow & { path: string } =>\n s.backend === \"local\" && typeof s.path === \"string\" && s.path.length > 0,\n )\n .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());\n\n if (usable.length === 0) {\n throw new Error(\n \"catalog.url is set to 'local' but no local library is registered. \" +\n \"Run `skaile source add <path>` first, then `skaile source sync`.\",\n );\n }\n\n // Prefer the most recently added library whose path still exists.\n const present = usable.find((s) => fs.existsSync(s.path));\n if (!present) {\n const head = usable[0];\n throw new Error(\n `catalog.url is set to 'local' but every registered local library has a missing path on disk. ` +\n `Most recent: ${head.path} (library ${head.id}). ` +\n `Re-register with \\`skaile source add <existing-path>\\` or run \\`skaile source list\\` to inspect.`,\n );\n }\n\n const source = new LocalCatalogSource(\n library,\n present.id,\n present.path,\n createFullRegistry(),\n );\n return { source, close: () => library.close() };\n } catch (err) {\n // Release the handle on any failure during dispatch — otherwise the\n // SQLite WAL state leaks for the lifetime of the process.\n library.close();\n throw err;\n }\n }\n\n const cacheTtlMs = cfg.catalog.cache_ttl * 1000;\n const source =\n cfg.catalog.framing === \"rest\"\n ? new RestCatalogSource({ baseUrl, cacheTtlMs })\n : new RemoteCatalogSource({ baseUrl, cacheTtlMs });\n return { source, close: () => {} };\n}\n\n/**\n * Open the LibraryManager bound to the active LocalIndex.\n * Caller owns lifetime — must call `close()` (returned helper closes the\n * underlying LocalIndex).\n *\n * @docLink cli/dev-guide#open-library\n */\nexport async function openLibraryManager(): Promise<{\n manager: import(\"@skaile/workspaces/library\").LibraryManager;\n library: import(\"@skaile/workspaces/library\").LocalIndex;\n close: () => void;\n}> {\n const { LibraryManager } = await import(\"@skaile/workspaces/library\");\n const library = await openLibrary();\n const manager = new LibraryManager(library);\n return { manager, library, close: () => library.close() };\n}\n"]}
|