@skaile/workspaces 1.0.0 → 1.1.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.
Files changed (171) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/dist/{asset-feeds-677S5NX7.js → asset-feeds-NIAABO6U.js} +11 -11
  3. package/dist/{asset-feeds-677S5NX7.js.map → asset-feeds-NIAABO6U.js.map} +1 -1
  4. package/dist/asset-manager/index.js +8 -8
  5. package/dist/asset-manager/installer.js +7 -7
  6. package/dist/asset-manager/src/index.d.ts +128 -0
  7. package/dist/asset-manager/src/index.d.ts.map +1 -1
  8. package/dist/bridge/drivers/claude-sdk.js +2 -2
  9. package/dist/bridge/drivers/codex.js +1 -1
  10. package/dist/bridge/drivers/continue.js +2 -2
  11. package/dist/bridge/drivers/echo.js +1 -1
  12. package/dist/bridge/drivers/gemini.js +3 -3
  13. package/dist/bridge/drivers/goose.js +2 -2
  14. package/dist/bridge/drivers/omp.js +1 -1
  15. package/dist/bridge/drivers/opencode.js +2 -2
  16. package/dist/bridge/drivers/qwen.js +3 -3
  17. package/dist/bridge/index.js +3 -3
  18. package/dist/{chunk-FLRHP3UC.js → chunk-35TLBMHX.js} +4 -4
  19. package/dist/{chunk-FLRHP3UC.js.map → chunk-35TLBMHX.js.map} +1 -1
  20. package/dist/{chunk-6VUP6XHK.js → chunk-52XHXSBN.js} +3 -3
  21. package/dist/{chunk-6VUP6XHK.js.map → chunk-52XHXSBN.js.map} +1 -1
  22. package/dist/{chunk-NXC6IEL4.js → chunk-5AGARSQT.js} +267 -261
  23. package/dist/chunk-5AGARSQT.js.map +1 -0
  24. package/dist/{chunk-WSQ5J7CE.js → chunk-B4IOSXRZ.js} +98 -49
  25. package/dist/chunk-B4IOSXRZ.js.map +1 -0
  26. package/dist/{chunk-EXNTTJGP.js → chunk-BCJL2UNH.js} +3 -3
  27. package/dist/{chunk-EXNTTJGP.js.map → chunk-BCJL2UNH.js.map} +1 -1
  28. package/dist/{chunk-W53D5Q52.js → chunk-BM37QD6U.js} +3 -3
  29. package/dist/{chunk-W53D5Q52.js.map → chunk-BM37QD6U.js.map} +1 -1
  30. package/dist/{chunk-PLQVAEM2.js → chunk-DMHVL5MC.js} +5 -5
  31. package/dist/{chunk-PLQVAEM2.js.map → chunk-DMHVL5MC.js.map} +1 -1
  32. package/dist/{chunk-K5JIAHDV.js → chunk-EE4NL25D.js} +29 -20
  33. package/dist/chunk-EE4NL25D.js.map +1 -0
  34. package/dist/{chunk-43JDPQJ4.js → chunk-G2X3THJV.js} +5 -5
  35. package/dist/{chunk-43JDPQJ4.js.map → chunk-G2X3THJV.js.map} +1 -1
  36. package/dist/{chunk-KSISPZV3.js → chunk-INUQVXUE.js} +2 -2
  37. package/dist/{chunk-KSISPZV3.js.map → chunk-INUQVXUE.js.map} +1 -1
  38. package/dist/{chunk-UTHEIPEY.js → chunk-KVZ6XKVN.js} +56 -14
  39. package/dist/chunk-KVZ6XKVN.js.map +1 -0
  40. package/dist/{chunk-SFVEHSCI.js → chunk-L3SLC3S4.js} +253 -14
  41. package/dist/chunk-L3SLC3S4.js.map +1 -0
  42. package/dist/{chunk-3KPNDTMR.js → chunk-MG6UIS7G.js} +3 -3
  43. package/dist/{chunk-3KPNDTMR.js.map → chunk-MG6UIS7G.js.map} +1 -1
  44. package/dist/{chunk-LKOMH3QC.js → chunk-OIGYDVCM.js} +3 -3
  45. package/dist/{chunk-LKOMH3QC.js.map → chunk-OIGYDVCM.js.map} +1 -1
  46. package/dist/{chunk-N5AE5SOC.js → chunk-QVE3ILCY.js} +2 -2
  47. package/dist/{chunk-N5AE5SOC.js.map → chunk-QVE3ILCY.js.map} +1 -1
  48. package/dist/{chunk-GYPA2Q7F.js → chunk-SHOKXRL4.js} +21 -4
  49. package/dist/chunk-SHOKXRL4.js.map +1 -0
  50. package/dist/{chunk-6AD3NS7R.js → chunk-U5J77IIZ.js} +4 -4
  51. package/dist/{chunk-6AD3NS7R.js.map → chunk-U5J77IIZ.js.map} +1 -1
  52. package/dist/{chunk-OYMSCV7T.js → chunk-UY5Q2NZH.js} +3 -3
  53. package/dist/{chunk-OYMSCV7T.js.map → chunk-UY5Q2NZH.js.map} +1 -1
  54. package/dist/{chunk-2D5YE3FL.js → chunk-VYIK5IE5.js} +85 -6
  55. package/dist/chunk-VYIK5IE5.js.map +1 -0
  56. package/dist/{chunk-DW5MIJK3.js → chunk-YI5OZ7QO.js} +2 -2
  57. package/dist/{chunk-DW5MIJK3.js.map → chunk-YI5OZ7QO.js.map} +1 -1
  58. package/dist/{chunk-XD7GYMAU.js → chunk-Z4EJOBEL.js} +7 -7
  59. package/dist/{chunk-XD7GYMAU.js.map → chunk-Z4EJOBEL.js.map} +1 -1
  60. package/dist/{chunk-2ZK7M2SG.js → chunk-ZUE2PIJ5.js} +3 -3
  61. package/dist/{chunk-2ZK7M2SG.js.map → chunk-ZUE2PIJ5.js.map} +1 -1
  62. package/dist/cli/index.js +190 -55
  63. package/dist/cli/index.js.map +1 -1
  64. package/dist/cli/src/commands/catalog.d.ts +18 -0
  65. package/dist/cli/src/commands/catalog.d.ts.map +1 -1
  66. package/dist/cli/src/commands/manage.d.ts.map +1 -1
  67. package/dist/cli/src/commands/tree.d.ts.map +1 -1
  68. package/dist/cli/src/commands/why.d.ts.map +1 -1
  69. package/dist/cli/src/helpers.d.ts +25 -0
  70. package/dist/cli/src/helpers.d.ts.map +1 -1
  71. package/dist/connectors/config.js +7 -7
  72. package/dist/connectors/index.js +8 -8
  73. package/dist/connectors/src/connector-registry.d.ts.map +1 -1
  74. package/dist/core/index.js +6 -6
  75. package/dist/core/runtime-assets.js +2 -2
  76. package/dist/core/src/index.d.ts +1 -1
  77. package/dist/core/src/index.d.ts.map +1 -1
  78. package/dist/core/src/repo-manager.d.ts +19 -1
  79. package/dist/core/src/repo-manager.d.ts.map +1 -1
  80. package/dist/core/src/walker.d.ts +7 -0
  81. package/dist/core/src/walker.d.ts.map +1 -1
  82. package/dist/core/workspace-config.js +1 -1
  83. package/dist/deploy/index.js +6 -6
  84. package/dist/discovery/index.js +1 -1
  85. package/dist/discovery/src/discover.d.ts.map +1 -1
  86. package/dist/discovery/src/index.d.ts +1 -1
  87. package/dist/discovery/src/index.d.ts.map +1 -1
  88. package/dist/discovery/src/reference-lint.d.ts +30 -0
  89. package/dist/discovery/src/reference-lint.d.ts.map +1 -1
  90. package/dist/discovery/src/tree-entries.d.ts.map +1 -1
  91. package/dist/{ensure-sources-OCMHK7LT.js → ensure-sources-MJYHZ77Y.js} +16 -9
  92. package/dist/ensure-sources-MJYHZ77Y.js.map +1 -0
  93. package/dist/factory-assets/connectors/box/CONNECTOR.md +33 -0
  94. package/dist/factory-assets/connectors/box/driver.d.ts +27 -0
  95. package/dist/factory-assets/connectors/box/driver.d.ts.map +1 -0
  96. package/dist/factory-assets/connectors/box.d.ts +2 -0
  97. package/dist/factory-assets/connectors/box.js +20 -0
  98. package/dist/factory-assets/connectors/box.js.map +1 -0
  99. package/dist/factory-assets/connectors/deploy.js +8 -8
  100. package/dist/factory-assets/connectors/devserver.js +8 -8
  101. package/dist/factory-assets/connectors/flow/adapter.js +8 -8
  102. package/dist/factory-assets/connectors/flow/engine.js +6 -6
  103. package/dist/factory-assets/connectors/flow/run-flow.js +9 -9
  104. package/dist/factory-assets/connectors/flow.js +8 -8
  105. package/dist/factory-assets/connectors/git.js +8 -8
  106. package/dist/factory-assets/connectors/gmail.js +8 -8
  107. package/dist/factory-assets/connectors/googledrive.js +8 -8
  108. package/dist/factory-assets/connectors/local.js +8 -8
  109. package/dist/factory-assets/connectors/mattermost.js +8 -8
  110. package/dist/factory-assets/connectors/memory.js +8 -8
  111. package/dist/factory-assets/connectors/minio.js +8 -8
  112. package/dist/factory-assets/connectors/postgres.js +8 -8
  113. package/dist/factory-assets/connectors/s3.js +8 -8
  114. package/dist/factory-assets/connectors/sharepoint.js +8 -8
  115. package/dist/factory-assets/connectors/sqlite.js +8 -8
  116. package/dist/factory-assets/connectors/static-server.js +8 -8
  117. package/dist/factory-assets/connectors/tunnel.js +8 -8
  118. package/dist/factory-assets/connectors/webdav.js +8 -8
  119. package/dist/factory-assets/connectors/xstate-store.js +8 -8
  120. package/dist/factory-assets/connectors/xstate.js +8 -8
  121. package/dist/factory-assets/skaile.manifest.yaml +4 -1
  122. package/dist/{flows-36PZESON.js → flows-4Z74KY2H.js} +3 -3
  123. package/dist/{flows-36PZESON.js.map → flows-4Z74KY2H.js.map} +1 -1
  124. package/dist/helpers-7KOVCMHW.js +22 -0
  125. package/dist/{helpers-F4NZ66VD.js.map → helpers-7KOVCMHW.js.map} +1 -1
  126. package/dist/library/index.js +8 -8
  127. package/dist/library/install.js +6 -6
  128. package/dist/library/src/library.d.ts +6 -0
  129. package/dist/library/src/library.d.ts.map +1 -1
  130. package/dist/library/src/local/db.d.ts.map +1 -1
  131. package/dist/library/src/local/library.d.ts +9 -0
  132. package/dist/library/src/local/library.d.ts.map +1 -1
  133. package/dist/library/src/local/local-catalog-source.d.ts +9 -0
  134. package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
  135. package/dist/library/src/local/schema.d.ts +19 -0
  136. package/dist/library/src/local/schema.d.ts.map +1 -1
  137. package/dist/open-library-PGTL332T.js +29 -0
  138. package/dist/{open-library-WRFYABFP.js.map → open-library-PGTL332T.js.map} +1 -1
  139. package/dist/{paths-EUNVMONC.js → paths-S7QNXYMB.js} +9 -9
  140. package/dist/{paths-EUNVMONC.js.map → paths-S7QNXYMB.js.map} +1 -1
  141. package/dist/{plugin-store-35KIMX6W.js → plugin-store-3DAVGKHN.js} +8 -8
  142. package/dist/{plugin-store-35KIMX6W.js.map → plugin-store-3DAVGKHN.js.map} +1 -1
  143. package/dist/runner/index.js +13 -13
  144. package/dist/runner/src/serve.d.ts.map +1 -1
  145. package/dist/sdk/asset-manager.js +8 -8
  146. package/dist/sdk/bridge.js +3 -3
  147. package/dist/sdk/core.js +6 -6
  148. package/dist/sdk/flow.js +6 -6
  149. package/dist/sdk/index.js +13 -13
  150. package/dist/sdk/runner.js +13 -13
  151. package/dist/{setup-HM6HATAC.js → setup-WBGDT2WY.js} +11 -11
  152. package/dist/{setup-HM6HATAC.js.map → setup-WBGDT2WY.js.map} +1 -1
  153. package/dist/{source-EZ5Y3CKP.js → source-FJXRQ2NU.js} +19 -13
  154. package/dist/{source-EZ5Y3CKP.js.map → source-FJXRQ2NU.js.map} +1 -1
  155. package/dist/{store-client-BUUF7BPK.js → store-client-YGDN4L2G.js} +9 -9
  156. package/dist/{store-client-BUUF7BPK.js.map → store-client-YGDN4L2G.js.map} +1 -1
  157. package/dist/tui/index.js +13 -13
  158. package/dist/workspace-plugin/adapters/mcp.js +2 -2
  159. package/dist/workspace-plugin/adapters/omp.js +3 -3
  160. package/dist/workspace-plugin/index.js +1 -1
  161. package/package.json +7 -1
  162. package/dist/chunk-2D5YE3FL.js.map +0 -1
  163. package/dist/chunk-GYPA2Q7F.js.map +0 -1
  164. package/dist/chunk-K5JIAHDV.js.map +0 -1
  165. package/dist/chunk-NXC6IEL4.js.map +0 -1
  166. package/dist/chunk-SFVEHSCI.js.map +0 -1
  167. package/dist/chunk-UTHEIPEY.js.map +0 -1
  168. package/dist/chunk-WSQ5J7CE.js.map +0 -1
  169. package/dist/ensure-sources-OCMHK7LT.js.map +0 -1
  170. package/dist/helpers-F4NZ66VD.js +0 -4
  171. package/dist/open-library-WRFYABFP.js +0 -23
@@ -4,7 +4,7 @@ import { isValidAssetName, slugifyAssetName, parseAssetRef, assetRefToStr } from
4
4
  import { SUPPORTED_DRIVER_TARGETS, globalBackendRoot } from './chunk-MENCWIHW.js';
5
5
  import { existsSync, mkdirSync, renameSync, readdirSync, rmdirSync, readFileSync, writeFileSync, rmSync, lstatSync, symlinkSync, cpSync } from 'fs';
6
6
  import { homedir } from 'os';
7
- import { join, dirname, resolve, relative, parse as parse$1, basename } from 'path';
7
+ import { join, dirname, relative, resolve, parse as parse$1, basename } from 'path';
8
8
  import { parse, stringify } from 'yaml';
9
9
  import { spawnSync } from 'child_process';
10
10
  import semver from 'semver';
@@ -57,6 +57,265 @@ function __resetCacheMigrationMemo() {
57
57
  migratedWholeTree.clear();
58
58
  mergedEntries.clear();
59
59
  }
60
+ function fileSha256(p) {
61
+ return createHash("sha256").update(readFileSync(p)).digest("hex");
62
+ }
63
+ function compositeSha256(files) {
64
+ const lines = files.slice().sort((a, b) => a.path.localeCompare(b.path)).map((f) => `${f.path}:${f.sha256}
65
+ `).join("");
66
+ return createHash("sha256").update(lines).digest("hex");
67
+ }
68
+ function normalizeGithubOrg(org) {
69
+ return org.toLowerCase();
70
+ }
71
+ function publisherFromGithubUrl(url) {
72
+ const m = url.match(/github\.com[/:]([^/]+)\/[^/]+/);
73
+ return m ? normalizeGithubOrg(m[1]) : void 0;
74
+ }
75
+ function syntheticVersion(commit) {
76
+ return `0.0.0-sha.${commit.slice(0, 7)}`;
77
+ }
78
+ var KIND_DIRS = [
79
+ { dir: "skills", kind: "skill", mdName: "SKILL.md" },
80
+ { dir: "agents", kind: "agent", mdName: "AGENT.md" },
81
+ { dir: "bundles", kind: "bundle", mdName: "BUNDLE.md" },
82
+ { dir: "mcp-servers", kind: "mcp-server", mdName: "MCP.md" },
83
+ { dir: "connectors", kind: "connector", mdName: "CONNECTOR.md" },
84
+ { dir: "prompts", kind: "prompt", mdName: "PROMPT.md" },
85
+ { dir: "contracts", kind: "contract", mdName: "CONTRACT.md" }
86
+ ];
87
+ var MD_FILE_BY_KIND = Object.fromEntries(
88
+ KIND_DIRS.map((k) => [k.kind, k.mdName])
89
+ );
90
+ function buildProvenanceIndex(clones, _opts) {
91
+ const index = /* @__PURE__ */ new Map();
92
+ for (const clone of clones) walkOne(clone, index);
93
+ return index;
94
+ }
95
+ function walkOne(clone, index) {
96
+ const manifestPaths = findManifestFiles(clone.localPath);
97
+ if (manifestPaths.length === 0) {
98
+ walkFilenameConvention(clone, index);
99
+ return;
100
+ }
101
+ let produced = false;
102
+ for (const p of manifestPaths) {
103
+ if (walkWithManifest(clone, p, index)) produced = true;
104
+ }
105
+ if (!produced) walkFilenameConvention(clone, index);
106
+ }
107
+ function findManifestFiles(root) {
108
+ const found = [];
109
+ const walk = (dir) => {
110
+ if (!existsSync(dir)) return;
111
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
112
+ if (entry.name === ".git" || entry.name === "node_modules") continue;
113
+ const abs = join(dir, entry.name);
114
+ if (entry.isDirectory()) walk(abs);
115
+ else if (entry.isFile() && entry.name === SKAILE_MANIFEST_FILENAME) found.push(abs);
116
+ }
117
+ };
118
+ walk(root);
119
+ return found;
120
+ }
121
+ function walkWithManifest(clone, manifestPath, index) {
122
+ const { manifest } = decodeSkaileManifest(readFileSync(manifestPath, "utf8"));
123
+ const repoRoot = clone.localPath;
124
+ const manifestPublisher = manifest.publisher ?? publisherFromGithubUrl(clone.sourceUrl);
125
+ const manifestVersion = manifest.version ?? (clone.tag ? clone.tag.replace(/^v/, "") : void 0) ?? syntheticVersion(clone.commit);
126
+ const assets = manifest.assets ?? [];
127
+ if (assets.length === 0) return false;
128
+ for (const a of assets) {
129
+ const assetPublisher = a.publisher ?? manifestPublisher;
130
+ if (!assetPublisher) {
131
+ throw new Error(
132
+ `${clone.sourceUrl}: publisher must be declared in skaile.manifest.yaml (non-GitHub source URL \u2014 auto-derivation not available).`
133
+ );
134
+ }
135
+ const curatedSource = a.source ?? manifest.source;
136
+ const version = a.version ?? manifestVersion;
137
+ const name = canonicalAssetName(a.name);
138
+ const resolved = resolveAssetBytes(clone, repoRoot, a, curatedSource);
139
+ const { files } = resolved;
140
+ const candidate = {
141
+ publisher: assetPublisher,
142
+ kind: a.kind,
143
+ name,
144
+ version,
145
+ sourceUrl: resolved.sourceUrl,
146
+ commit: resolved.commit,
147
+ files,
148
+ sha256: a.sha256 ?? compositeSha256(files),
149
+ metadata: resolved.metadata,
150
+ deps: a.dependencies ?? manifestDeps(repoRoot, files, a.kind)
151
+ };
152
+ applyStoreListingMetadata(candidate, a, manifest, resolved.frontmatter);
153
+ push(index, `${assetPublisher}/${a.kind}:${name}`, candidate);
154
+ }
155
+ return true;
156
+ }
157
+ function canonicalAssetName(raw) {
158
+ if (isValidAssetName(raw)) return raw;
159
+ try {
160
+ return slugifyAssetName(raw);
161
+ } catch {
162
+ return raw;
163
+ }
164
+ }
165
+ function resolveAssetBytes(clone, repoRoot, a, curatedSource) {
166
+ if (curatedSource) {
167
+ return {
168
+ files: granularFiles(a) ?? [],
169
+ sourceUrl: curatedSource.url,
170
+ commit: curatedSource.commit ?? clone.commit
171
+ };
172
+ }
173
+ const files = expandAssetFiles(repoRoot, a);
174
+ verifyNameMatch(repoRoot, files, a.name, a.kind);
175
+ return {
176
+ files,
177
+ sourceUrl: clone.sourceUrl,
178
+ commit: clone.commit,
179
+ metadata: readMetadata(repoRoot, files, a.kind),
180
+ frontmatter: readContentFrontmatter(repoRoot, files, a.kind)
181
+ };
182
+ }
183
+ function applyStoreListingMetadata(candidate, a, manifest, frontmatter) {
184
+ const fmStr = (k) => typeof frontmatter?.[k] === "string" ? frontmatter[k] : void 0;
185
+ const fmArr = (k) => Array.isArray(frontmatter?.[k]) ? frontmatter[k].filter((x) => typeof x === "string") : void 0;
186
+ const description = a.description ?? fmStr("description");
187
+ const keywords = a.keywords ?? fmArr("keywords");
188
+ const category = a.category ?? fmStr("category");
189
+ const license = a.license ?? manifest.license;
190
+ const homepage = a.homepage ?? manifest.homepage;
191
+ if (description) candidate.description = description;
192
+ if (keywords && keywords.length > 0) candidate.keywords = keywords;
193
+ if (category) candidate.category = category;
194
+ if (license) candidate.license = license;
195
+ if (homepage) candidate.homepage = homepage;
196
+ }
197
+ function globFiles(a) {
198
+ if (!Array.isArray(a.files)) return void 0;
199
+ const strings = a.files.filter((f) => typeof f === "string");
200
+ return strings.length > 0 ? strings : void 0;
201
+ }
202
+ function granularFiles(a) {
203
+ if (!Array.isArray(a.files)) return void 0;
204
+ const granular = a.files.filter(
205
+ (f) => !!f && typeof f === "object" && "path" in f && "sha256" in f
206
+ );
207
+ return granular.length > 0 ? granular : void 0;
208
+ }
209
+ function expandAssetFiles(repoRoot, a) {
210
+ const out = [];
211
+ if (a.root) {
212
+ walkDirRecursive(join(repoRoot, a.root), repoRoot, out);
213
+ }
214
+ const globs = globFiles(a);
215
+ if (globs) {
216
+ const matches = fg.sync(globs, { cwd: repoRoot, onlyFiles: true, dot: false });
217
+ for (const rel of matches) {
218
+ out.push({ path: rel, sha256: fileSha256(join(repoRoot, rel)) });
219
+ }
220
+ }
221
+ const seen = /* @__PURE__ */ new Set();
222
+ return out.filter((f) => seen.has(f.path) ? false : (seen.add(f.path), true));
223
+ }
224
+ function walkDirRecursive(abs, root, out) {
225
+ if (!existsSync(abs)) return;
226
+ for (const entry of readdirSync(abs, { withFileTypes: true })) {
227
+ if (entry.name === ".git" || entry.name === "node_modules") continue;
228
+ const childAbs = join(abs, entry.name);
229
+ if (entry.isDirectory()) {
230
+ walkDirRecursive(childAbs, root, out);
231
+ } else if (entry.isFile()) {
232
+ out.push({ path: relative(root, childAbs), sha256: fileSha256(childAbs) });
233
+ }
234
+ }
235
+ }
236
+ var DIR_SCOPED_KINDS = /* @__PURE__ */ new Set([
237
+ "skill",
238
+ "agent",
239
+ "contract",
240
+ "mcp-server",
241
+ "connector",
242
+ "knowledge"
243
+ ]);
244
+ function walkFilenameConvention(clone, index) {
245
+ const publisher = publisherFromGithubUrl(clone.sourceUrl);
246
+ if (!publisher) {
247
+ throw new Error(
248
+ `${clone.sourceUrl}: publisher must be declared in skaile.manifest.yaml (non-GitHub source URL).`
249
+ );
250
+ }
251
+ const version = (clone.tag ? clone.tag.replace(/^v/, "") : void 0) ?? syntheticVersion(clone.commit);
252
+ for (const e of scanDirectory(clone.localPath, publisher)) {
253
+ const manifestAbs = e.source;
254
+ const files = [];
255
+ if (DIR_SCOPED_KINDS.has(e.kind)) {
256
+ walkDirRecursive(dirname(manifestAbs), clone.localPath, files);
257
+ } else {
258
+ files.push({ path: relative(clone.localPath, manifestAbs), sha256: fileSha256(manifestAbs) });
259
+ }
260
+ const candidate = {
261
+ publisher,
262
+ kind: e.kind,
263
+ name: e.name,
264
+ version,
265
+ sourceUrl: clone.sourceUrl,
266
+ commit: clone.commit,
267
+ files,
268
+ sha256: compositeSha256(files),
269
+ metadata: readMetadata(clone.localPath, files, e.kind),
270
+ deps: manifestDeps(clone.localPath, files, e.kind)
271
+ };
272
+ push(index, `${publisher}/${e.kind}:${e.name}`, candidate);
273
+ }
274
+ }
275
+ function verifyNameMatch(repoRoot, files, expectedName, kind) {
276
+ const mdName = MD_FILE_BY_KIND[kind];
277
+ if (!mdName) return;
278
+ const md = files.find((f) => f.path.endsWith(mdName));
279
+ if (!md) return;
280
+ const { data } = parseFrontmatter(readFileSync(join(repoRoot, md.path), "utf8"));
281
+ const declared = typeof data.name === "string" ? data.name : void 0;
282
+ if (declared && canonicalAssetName(declared) !== canonicalAssetName(expectedName)) {
283
+ throw new Error(
284
+ `name mismatch: ${mdName} says "${declared}", skaile.manifest.yaml says "${expectedName}" \u2014 index-time hard error.`
285
+ );
286
+ }
287
+ }
288
+ function readMetadata(repoRoot, files, kind) {
289
+ if (kind !== "mcp-server") return void 0;
290
+ const mcpMd = files.find((f) => f.path.endsWith("MCP.md"));
291
+ if (!mcpMd) return void 0;
292
+ const { data } = parseFrontmatter(readFileSync(join(repoRoot, mcpMd.path), "utf8"));
293
+ return data;
294
+ }
295
+ function readContentFrontmatter(repoRoot, files, kind) {
296
+ const mdName = MD_FILE_BY_KIND[kind];
297
+ if (!mdName) return void 0;
298
+ const md = files.find((f) => f.path.endsWith(mdName));
299
+ if (!md) return void 0;
300
+ try {
301
+ return parseFrontmatter(readFileSync(join(repoRoot, md.path), "utf8")).data;
302
+ } catch {
303
+ return void 0;
304
+ }
305
+ }
306
+ function manifestDeps(repoRoot, files, kind) {
307
+ const ext = kind === "bundle" ? [".bundle.yaml", "BUNDLE.md"] : kind === "flow" ? [".flow.yaml", ".flow.json"] : null;
308
+ if (!ext) return void 0;
309
+ const mf = files.find((f) => ext.some((e) => f.path.endsWith(e)));
310
+ return mf ? bundleDepRefs(join(repoRoot, mf.path)) : void 0;
311
+ }
312
+ function push(index, key, candidate) {
313
+ const arr = index.get(key) ?? [];
314
+ arr.push(candidate);
315
+ index.set(key, arr);
316
+ }
317
+
318
+ // core/src/repo-manager.ts
60
319
  function hasOwnGit(dir) {
61
320
  return existsSync(join(dir, ".git"));
62
321
  }
@@ -277,7 +536,7 @@ function repoSlugFromGitRemote(rootDir) {
277
536
  const m = /github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?\/?$/.exec(r.stdout.trim());
278
537
  return m ? `${m[1]}/${m[2]}` : void 0;
279
538
  }
280
- function declaredPublisher(repoDir) {
539
+ function resolveSourcePublisher(repoDir) {
281
540
  const manifestPath = join(repoDir, SKAILE_MANIFEST_FILENAME);
282
541
  if (existsSync(manifestPath)) {
283
542
  try {
@@ -287,11 +546,12 @@ function declaredPublisher(repoDir) {
287
546
  } catch {
288
547
  }
289
548
  }
290
- return repoSlugFromGitRemote(repoDir)?.split("/")[0];
549
+ const org = repoSlugFromGitRemote(repoDir)?.split("/")[0];
550
+ return org ? normalizeGithubOrg(org) : void 0;
291
551
  }
292
552
  function scanRepo(repoDir, repoName) {
293
553
  const repo = repoSlugFromGitRemote(repoDir);
294
- const publisher = declaredPublisher(repoDir) ?? repoName;
554
+ const publisher = resolveSourcePublisher(repoDir) ?? repoName;
295
555
  return scanDirectory(repoDir, repoName).map((e) => ({
296
556
  ...e,
297
557
  publisher,
@@ -588,260 +848,6 @@ function checkRepoStatus(decl, name, reposDir, projectDir) {
588
848
  base.upToDate = base.behind === 0;
589
849
  return base;
590
850
  }
591
- function fileSha256(p) {
592
- return createHash("sha256").update(readFileSync(p)).digest("hex");
593
- }
594
- function compositeSha256(files) {
595
- const lines = files.slice().sort((a, b) => a.path.localeCompare(b.path)).map((f) => `${f.path}:${f.sha256}
596
- `).join("");
597
- return createHash("sha256").update(lines).digest("hex");
598
- }
599
- function publisherFromGithubUrl(url) {
600
- const m = url.match(/github\.com[/:]([^/]+)\/[^/]+/);
601
- return m?.[1];
602
- }
603
- function syntheticVersion(commit) {
604
- return `0.0.0-sha.${commit.slice(0, 7)}`;
605
- }
606
- var KIND_DIRS = [
607
- { dir: "skills", kind: "skill", mdName: "SKILL.md" },
608
- { dir: "agents", kind: "agent", mdName: "AGENT.md" },
609
- { dir: "bundles", kind: "bundle", mdName: "BUNDLE.md" },
610
- { dir: "mcp-servers", kind: "mcp-server", mdName: "MCP.md" },
611
- { dir: "connectors", kind: "connector", mdName: "CONNECTOR.md" },
612
- { dir: "prompts", kind: "prompt", mdName: "PROMPT.md" },
613
- { dir: "contracts", kind: "contract", mdName: "CONTRACT.md" }
614
- ];
615
- var MD_FILE_BY_KIND = Object.fromEntries(
616
- KIND_DIRS.map((k) => [k.kind, k.mdName])
617
- );
618
- function buildProvenanceIndex(clones, _opts) {
619
- const index = /* @__PURE__ */ new Map();
620
- for (const clone of clones) walkOne(clone, index);
621
- return index;
622
- }
623
- function walkOne(clone, index) {
624
- const manifestPaths = findManifestFiles(clone.localPath);
625
- if (manifestPaths.length === 0) {
626
- walkFilenameConvention(clone, index);
627
- return;
628
- }
629
- let produced = false;
630
- for (const p of manifestPaths) {
631
- if (walkWithManifest(clone, p, index)) produced = true;
632
- }
633
- if (!produced) walkFilenameConvention(clone, index);
634
- }
635
- function findManifestFiles(root) {
636
- const found = [];
637
- const walk = (dir) => {
638
- if (!existsSync(dir)) return;
639
- for (const entry of readdirSync(dir, { withFileTypes: true })) {
640
- if (entry.name === ".git" || entry.name === "node_modules") continue;
641
- const abs = join(dir, entry.name);
642
- if (entry.isDirectory()) walk(abs);
643
- else if (entry.isFile() && entry.name === SKAILE_MANIFEST_FILENAME) found.push(abs);
644
- }
645
- };
646
- walk(root);
647
- return found;
648
- }
649
- function walkWithManifest(clone, manifestPath, index) {
650
- const { manifest } = decodeSkaileManifest(readFileSync(manifestPath, "utf8"));
651
- const repoRoot = clone.localPath;
652
- const manifestPublisher = manifest.publisher ?? publisherFromGithubUrl(clone.sourceUrl);
653
- const manifestVersion = manifest.version ?? (clone.tag ? clone.tag.replace(/^v/, "") : void 0) ?? syntheticVersion(clone.commit);
654
- const assets = manifest.assets ?? [];
655
- if (assets.length === 0) return false;
656
- for (const a of assets) {
657
- const assetPublisher = a.publisher ?? manifestPublisher;
658
- if (!assetPublisher) {
659
- throw new Error(
660
- `${clone.sourceUrl}: publisher must be declared in skaile.manifest.yaml (non-GitHub source URL \u2014 auto-derivation not available).`
661
- );
662
- }
663
- const curatedSource = a.source ?? manifest.source;
664
- const version = a.version ?? manifestVersion;
665
- const name = canonicalAssetName(a.name);
666
- const resolved = resolveAssetBytes(clone, repoRoot, a, curatedSource);
667
- const { files } = resolved;
668
- const candidate = {
669
- publisher: assetPublisher,
670
- kind: a.kind,
671
- name,
672
- version,
673
- sourceUrl: resolved.sourceUrl,
674
- commit: resolved.commit,
675
- files,
676
- sha256: a.sha256 ?? compositeSha256(files),
677
- metadata: resolved.metadata,
678
- deps: a.dependencies ?? manifestDeps(repoRoot, files, a.kind)
679
- };
680
- applyStoreListingMetadata(candidate, a, manifest, resolved.frontmatter);
681
- push(index, `${assetPublisher}/${a.kind}:${name}`, candidate);
682
- }
683
- return true;
684
- }
685
- function canonicalAssetName(raw) {
686
- if (isValidAssetName(raw)) return raw;
687
- try {
688
- return slugifyAssetName(raw);
689
- } catch {
690
- return raw;
691
- }
692
- }
693
- function resolveAssetBytes(clone, repoRoot, a, curatedSource) {
694
- if (curatedSource) {
695
- return {
696
- files: granularFiles(a) ?? [],
697
- sourceUrl: curatedSource.url,
698
- commit: curatedSource.commit ?? clone.commit
699
- };
700
- }
701
- const files = expandAssetFiles(repoRoot, a);
702
- verifyNameMatch(repoRoot, files, a.name, a.kind);
703
- return {
704
- files,
705
- sourceUrl: clone.sourceUrl,
706
- commit: clone.commit,
707
- metadata: readMetadata(repoRoot, files, a.kind),
708
- frontmatter: readContentFrontmatter(repoRoot, files, a.kind)
709
- };
710
- }
711
- function applyStoreListingMetadata(candidate, a, manifest, frontmatter) {
712
- const fmStr = (k) => typeof frontmatter?.[k] === "string" ? frontmatter[k] : void 0;
713
- const fmArr = (k) => Array.isArray(frontmatter?.[k]) ? frontmatter[k].filter((x) => typeof x === "string") : void 0;
714
- const description = a.description ?? fmStr("description");
715
- const keywords = a.keywords ?? fmArr("keywords");
716
- const category = a.category ?? fmStr("category");
717
- const license = a.license ?? manifest.license;
718
- const homepage = a.homepage ?? manifest.homepage;
719
- if (description) candidate.description = description;
720
- if (keywords && keywords.length > 0) candidate.keywords = keywords;
721
- if (category) candidate.category = category;
722
- if (license) candidate.license = license;
723
- if (homepage) candidate.homepage = homepage;
724
- }
725
- function globFiles(a) {
726
- if (!Array.isArray(a.files)) return void 0;
727
- const strings = a.files.filter((f) => typeof f === "string");
728
- return strings.length > 0 ? strings : void 0;
729
- }
730
- function granularFiles(a) {
731
- if (!Array.isArray(a.files)) return void 0;
732
- const granular = a.files.filter(
733
- (f) => !!f && typeof f === "object" && "path" in f && "sha256" in f
734
- );
735
- return granular.length > 0 ? granular : void 0;
736
- }
737
- function expandAssetFiles(repoRoot, a) {
738
- const out = [];
739
- if (a.root) {
740
- walkDirRecursive(join(repoRoot, a.root), repoRoot, out);
741
- }
742
- const globs = globFiles(a);
743
- if (globs) {
744
- const matches = fg.sync(globs, { cwd: repoRoot, onlyFiles: true, dot: false });
745
- for (const rel of matches) {
746
- out.push({ path: rel, sha256: fileSha256(join(repoRoot, rel)) });
747
- }
748
- }
749
- const seen = /* @__PURE__ */ new Set();
750
- return out.filter((f) => seen.has(f.path) ? false : (seen.add(f.path), true));
751
- }
752
- function walkDirRecursive(abs, root, out) {
753
- if (!existsSync(abs)) return;
754
- for (const entry of readdirSync(abs, { withFileTypes: true })) {
755
- if (entry.name === ".git" || entry.name === "node_modules") continue;
756
- const childAbs = join(abs, entry.name);
757
- if (entry.isDirectory()) {
758
- walkDirRecursive(childAbs, root, out);
759
- } else if (entry.isFile()) {
760
- out.push({ path: relative(root, childAbs), sha256: fileSha256(childAbs) });
761
- }
762
- }
763
- }
764
- var DIR_SCOPED_KINDS = /* @__PURE__ */ new Set([
765
- "skill",
766
- "agent",
767
- "contract",
768
- "mcp-server",
769
- "connector",
770
- "knowledge"
771
- ]);
772
- function walkFilenameConvention(clone, index) {
773
- const publisher = publisherFromGithubUrl(clone.sourceUrl);
774
- if (!publisher) {
775
- throw new Error(
776
- `${clone.sourceUrl}: publisher must be declared in skaile.manifest.yaml (non-GitHub source URL).`
777
- );
778
- }
779
- const version = (clone.tag ? clone.tag.replace(/^v/, "") : void 0) ?? syntheticVersion(clone.commit);
780
- for (const e of scanDirectory(clone.localPath, publisher)) {
781
- const manifestAbs = e.source;
782
- const files = [];
783
- if (DIR_SCOPED_KINDS.has(e.kind)) {
784
- walkDirRecursive(dirname(manifestAbs), clone.localPath, files);
785
- } else {
786
- files.push({ path: relative(clone.localPath, manifestAbs), sha256: fileSha256(manifestAbs) });
787
- }
788
- const candidate = {
789
- publisher,
790
- kind: e.kind,
791
- name: e.name,
792
- version,
793
- sourceUrl: clone.sourceUrl,
794
- commit: clone.commit,
795
- files,
796
- sha256: compositeSha256(files),
797
- metadata: readMetadata(clone.localPath, files, e.kind),
798
- deps: manifestDeps(clone.localPath, files, e.kind)
799
- };
800
- push(index, `${publisher}/${e.kind}:${e.name}`, candidate);
801
- }
802
- }
803
- function verifyNameMatch(repoRoot, files, expectedName, kind) {
804
- const mdName = MD_FILE_BY_KIND[kind];
805
- if (!mdName) return;
806
- const md = files.find((f) => f.path.endsWith(mdName));
807
- if (!md) return;
808
- const { data } = parseFrontmatter(readFileSync(join(repoRoot, md.path), "utf8"));
809
- const declared = typeof data.name === "string" ? data.name : void 0;
810
- if (declared && canonicalAssetName(declared) !== canonicalAssetName(expectedName)) {
811
- throw new Error(
812
- `name mismatch: ${mdName} says "${declared}", skaile.manifest.yaml says "${expectedName}" \u2014 index-time hard error.`
813
- );
814
- }
815
- }
816
- function readMetadata(repoRoot, files, kind) {
817
- if (kind !== "mcp-server") return void 0;
818
- const mcpMd = files.find((f) => f.path.endsWith("MCP.md"));
819
- if (!mcpMd) return void 0;
820
- const { data } = parseFrontmatter(readFileSync(join(repoRoot, mcpMd.path), "utf8"));
821
- return data;
822
- }
823
- function readContentFrontmatter(repoRoot, files, kind) {
824
- const mdName = MD_FILE_BY_KIND[kind];
825
- if (!mdName) return void 0;
826
- const md = files.find((f) => f.path.endsWith(mdName));
827
- if (!md) return void 0;
828
- try {
829
- return parseFrontmatter(readFileSync(join(repoRoot, md.path), "utf8")).data;
830
- } catch {
831
- return void 0;
832
- }
833
- }
834
- function manifestDeps(repoRoot, files, kind) {
835
- const ext = kind === "bundle" ? [".bundle.yaml", "BUNDLE.md"] : kind === "flow" ? [".flow.yaml", ".flow.json"] : null;
836
- if (!ext) return void 0;
837
- const mf = files.find((f) => ext.some((e) => f.path.endsWith(e)));
838
- return mf ? bundleDepRefs(join(repoRoot, mf.path)) : void 0;
839
- }
840
- function push(index, key, candidate) {
841
- const arr = index.get(key) ?? [];
842
- arr.push(candidate);
843
- index.set(key, arr);
844
- }
845
851
 
846
852
  // core/src/workspace-config.ts
847
853
  var DEFAULT_RECIPE_ATTR = "default";
@@ -1775,6 +1781,6 @@ function resolveAgentDir(projectDir) {
1775
1781
  return resolve(projectDir, definition);
1776
1782
  }
1777
1783
 
1778
- export { COMPACTION_DEFAULTS, CanonicalRefConflictError, DEFAULT_RECIPE_ATTR, SKAILE_YAML_DEFAULT, SKAILE_YAML_SUFFIX, SK_WORKSPACE_DEFAULT_NAME, SK_WORKSPACE_SUFFIX, __resetCacheMigrationMemo, buildProvenanceIndex, checkRepoStatus, checkoutPin, cloneRepo, decodeSkaileYaml, deriveSingleMaterializedMcpDeclaration, encodeSkaileYaml, ensureRepo, findWorkspaceRoot, getGlobalCacheDir, getRepoCommit, globalCacheRoot, globalSkaileDir, isWorkspaceConfigFilename, linkRepo, listSkWorkspaceConfigs, loadMcpServerDeclarations, loadSkWorkspaceConfig, mergeLegacyEntriesInto, mergeSkWorkspaceConfigs, migrateLegacyDir, normalizeConfig, pullRepo, readLinks, resolveAgentDir, resolveAll, resolveAsset, resolveGlobalBackends, resolveGlobalSkWorkspaceConfig, resolveSkWorkspaceConfig, saveSkWorkspaceConfig, scanRepo, sourceCacheKey, sourceShortName, stageMaterializedSkills, unlinkRepo, validateAssetRecipeAttr, validateAssetRecipeFlake, workspaceConfigFilename, workspaceNameFromFilename, writeLinks };
1779
- //# sourceMappingURL=chunk-NXC6IEL4.js.map
1780
- //# sourceMappingURL=chunk-NXC6IEL4.js.map
1784
+ export { COMPACTION_DEFAULTS, CanonicalRefConflictError, DEFAULT_RECIPE_ATTR, SKAILE_YAML_DEFAULT, SKAILE_YAML_SUFFIX, SK_WORKSPACE_DEFAULT_NAME, SK_WORKSPACE_SUFFIX, __resetCacheMigrationMemo, buildProvenanceIndex, checkRepoStatus, checkoutPin, cloneRepo, decodeSkaileYaml, deriveSingleMaterializedMcpDeclaration, encodeSkaileYaml, ensureRepo, findWorkspaceRoot, getGlobalCacheDir, getRepoCommit, globalCacheRoot, globalSkaileDir, isWorkspaceConfigFilename, linkRepo, listSkWorkspaceConfigs, loadMcpServerDeclarations, loadSkWorkspaceConfig, mergeLegacyEntriesInto, mergeSkWorkspaceConfigs, migrateLegacyDir, normalizeConfig, pullRepo, readLinks, resolveAgentDir, resolveAll, resolveAsset, resolveGlobalBackends, resolveGlobalSkWorkspaceConfig, resolveSkWorkspaceConfig, resolveSourcePublisher, saveSkWorkspaceConfig, scanRepo, sourceCacheKey, sourceShortName, stageMaterializedSkills, unlinkRepo, validateAssetRecipeAttr, validateAssetRecipeFlake, workspaceConfigFilename, workspaceNameFromFilename, writeLinks };
1785
+ //# sourceMappingURL=chunk-5AGARSQT.js.map
1786
+ //# sourceMappingURL=chunk-5AGARSQT.js.map