@xemahq/xema 0.12.0 → 0.14.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 (335) hide show
  1. package/README.md +68 -20
  2. package/dist/assets/boot-graph.json +57 -15
  3. package/dist/assets/core/distribution.lock.json +668 -297
  4. package/dist/assets/core/images.lock.json +136 -136
  5. package/dist/assets/oss/distribution.lock.json +1532 -444
  6. package/dist/assets/oss/images.lock.json +423 -188
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +36 -1
  9. package/dist/cli.js.map +1 -1
  10. package/dist/commands/apply.d.ts.map +1 -1
  11. package/dist/commands/apply.js +1 -1
  12. package/dist/commands/apply.js.map +1 -1
  13. package/dist/commands/biome-dev.d.ts +3 -0
  14. package/dist/commands/biome-dev.d.ts.map +1 -0
  15. package/dist/commands/biome-dev.js +176 -0
  16. package/dist/commands/biome-dev.js.map +1 -0
  17. package/dist/commands/biome-validate.d.ts +10 -0
  18. package/dist/commands/biome-validate.d.ts.map +1 -0
  19. package/dist/commands/biome-validate.js +49 -0
  20. package/dist/commands/biome-validate.js.map +1 -0
  21. package/dist/commands/biome.d.ts.map +1 -1
  22. package/dist/commands/biome.js +359 -25
  23. package/dist/commands/biome.js.map +1 -1
  24. package/dist/commands/canopy.d.ts +3 -0
  25. package/dist/commands/canopy.d.ts.map +1 -0
  26. package/dist/commands/canopy.js +214 -0
  27. package/dist/commands/canopy.js.map +1 -0
  28. package/dist/commands/config.d.ts +3 -0
  29. package/dist/commands/config.d.ts.map +1 -0
  30. package/dist/commands/config.js +78 -0
  31. package/dist/commands/config.js.map +1 -0
  32. package/dist/commands/dev.d.ts.map +1 -1
  33. package/dist/commands/dev.js +71 -21
  34. package/dist/commands/dev.js.map +1 -1
  35. package/dist/commands/dist.js +1 -1
  36. package/dist/commands/dist.js.map +1 -1
  37. package/dist/commands/down.d.ts.map +1 -1
  38. package/dist/commands/down.js +40 -6
  39. package/dist/commands/down.js.map +1 -1
  40. package/dist/commands/import.d.ts.map +1 -1
  41. package/dist/commands/import.js +1 -1
  42. package/dist/commands/import.js.map +1 -1
  43. package/dist/commands/installation.d.ts +3 -0
  44. package/dist/commands/installation.d.ts.map +1 -0
  45. package/dist/commands/installation.js +101 -0
  46. package/dist/commands/installation.js.map +1 -0
  47. package/dist/commands/logs.d.ts.map +1 -1
  48. package/dist/commands/logs.js +6 -14
  49. package/dist/commands/logs.js.map +1 -1
  50. package/dist/commands/objects.d.ts.map +1 -1
  51. package/dist/commands/objects.js +85 -6
  52. package/dist/commands/objects.js.map +1 -1
  53. package/dist/commands/plan.d.ts.map +1 -1
  54. package/dist/commands/plan.js +1 -1
  55. package/dist/commands/plan.js.map +1 -1
  56. package/dist/commands/run.d.ts.map +1 -1
  57. package/dist/commands/run.js +61 -9
  58. package/dist/commands/run.js.map +1 -1
  59. package/dist/commands/serve.d.ts.map +1 -1
  60. package/dist/commands/serve.js +33 -13
  61. package/dist/commands/serve.js.map +1 -1
  62. package/dist/commands/shell.d.ts.map +1 -1
  63. package/dist/commands/shell.js +190 -6
  64. package/dist/commands/shell.js.map +1 -1
  65. package/dist/commands/source.d.ts +3 -0
  66. package/dist/commands/source.d.ts.map +1 -0
  67. package/dist/commands/source.js +120 -0
  68. package/dist/commands/source.js.map +1 -0
  69. package/dist/commands/status.d.ts.map +1 -1
  70. package/dist/commands/status.js +29 -3
  71. package/dist/commands/status.js.map +1 -1
  72. package/dist/commands/up.d.ts.map +1 -1
  73. package/dist/commands/up.js +55 -5
  74. package/dist/commands/up.js.map +1 -1
  75. package/dist/dev/env-defaults.d.ts.map +1 -1
  76. package/dist/dev/env-defaults.js +33 -11
  77. package/dist/dev/env-defaults.js.map +1 -1
  78. package/dist/dev/forked-worker.d.ts +15 -0
  79. package/dist/dev/forked-worker.d.ts.map +1 -1
  80. package/dist/dev/forked-worker.js +72 -14
  81. package/dist/dev/forked-worker.js.map +1 -1
  82. package/dist/dev/infra-preflight.d.ts +2 -1
  83. package/dist/dev/infra-preflight.d.ts.map +1 -1
  84. package/dist/dev/infra-preflight.js +10 -0
  85. package/dist/dev/infra-preflight.js.map +1 -1
  86. package/dist/dev/opa-policies.d.ts +3 -0
  87. package/dist/dev/opa-policies.d.ts.map +1 -0
  88. package/dist/dev/opa-policies.js +64 -0
  89. package/dist/dev/opa-policies.js.map +1 -0
  90. package/dist/lib/cli-errors.d.ts +7 -0
  91. package/dist/lib/cli-errors.d.ts.map +1 -0
  92. package/dist/lib/cli-errors.js +30 -0
  93. package/dist/lib/cli-errors.js.map +1 -0
  94. package/dist/lib/control-plane.d.ts.map +1 -1
  95. package/dist/lib/control-plane.js +5 -2
  96. package/dist/lib/control-plane.js.map +1 -1
  97. package/dist/lib/exit-codes.d.ts +3 -4
  98. package/dist/lib/exit-codes.d.ts.map +1 -1
  99. package/dist/lib/exit-codes.js +3 -4
  100. package/dist/lib/exit-codes.js.map +1 -1
  101. package/dist/lib/http-error.d.ts +2 -0
  102. package/dist/lib/http-error.d.ts.map +1 -0
  103. package/dist/lib/http-error.js +51 -0
  104. package/dist/lib/http-error.js.map +1 -0
  105. package/dist/lib/roster-profile.d.ts +10 -0
  106. package/dist/lib/roster-profile.d.ts.map +1 -0
  107. package/dist/lib/roster-profile.js +44 -0
  108. package/dist/lib/roster-profile.js.map +1 -0
  109. package/dist/runtime/biome-dev.d.ts +28 -0
  110. package/dist/runtime/biome-dev.d.ts.map +1 -0
  111. package/dist/runtime/biome-dev.js +131 -0
  112. package/dist/runtime/biome-dev.js.map +1 -0
  113. package/dist/runtime/biome-local-install.d.ts +29 -0
  114. package/dist/runtime/biome-local-install.d.ts.map +1 -0
  115. package/dist/runtime/biome-local-install.js +243 -0
  116. package/dist/runtime/biome-local-install.js.map +1 -0
  117. package/dist/runtime/biome-publish.d.ts +34 -0
  118. package/dist/runtime/biome-publish.d.ts.map +1 -0
  119. package/dist/runtime/biome-publish.js +214 -0
  120. package/dist/runtime/biome-publish.js.map +1 -0
  121. package/dist/runtime/biome-scaffold.d.ts +35 -0
  122. package/dist/runtime/biome-scaffold.d.ts.map +1 -0
  123. package/dist/runtime/biome-scaffold.js +153 -0
  124. package/dist/runtime/biome-scaffold.js.map +1 -0
  125. package/dist/runtime/biome-validate.d.ts +28 -0
  126. package/dist/runtime/biome-validate.d.ts.map +1 -0
  127. package/dist/runtime/biome-validate.js +450 -0
  128. package/dist/runtime/biome-validate.js.map +1 -0
  129. package/dist/runtime/boot-graph-loader.d.ts +1 -0
  130. package/dist/runtime/boot-graph-loader.d.ts.map +1 -1
  131. package/dist/runtime/boot-graph-loader.js +99 -7
  132. package/dist/runtime/boot-graph-loader.js.map +1 -1
  133. package/dist/runtime/canopy-refs.d.ts +8 -0
  134. package/dist/runtime/canopy-refs.d.ts.map +1 -0
  135. package/dist/runtime/canopy-refs.js +51 -0
  136. package/dist/runtime/canopy-refs.js.map +1 -0
  137. package/dist/runtime/canopy-replies.d.ts +14 -0
  138. package/dist/runtime/canopy-replies.d.ts.map +1 -0
  139. package/dist/runtime/canopy-replies.js +39 -0
  140. package/dist/runtime/canopy-replies.js.map +1 -0
  141. package/dist/runtime/capability-invoke.d.ts +35 -0
  142. package/dist/runtime/capability-invoke.d.ts.map +1 -0
  143. package/dist/runtime/capability-invoke.js +119 -0
  144. package/dist/runtime/capability-invoke.js.map +1 -0
  145. package/dist/runtime/config/dev-mode.d.ts +8 -0
  146. package/dist/runtime/config/dev-mode.d.ts.map +1 -0
  147. package/dist/runtime/config/dev-mode.js +84 -0
  148. package/dist/runtime/config/dev-mode.js.map +1 -0
  149. package/dist/runtime/config/init-presets.d.ts +1 -1
  150. package/dist/runtime/config/init-presets.d.ts.map +1 -1
  151. package/dist/runtime/config/init-presets.js +63 -11
  152. package/dist/runtime/config/init-presets.js.map +1 -1
  153. package/dist/runtime/config/loader.d.ts +1 -0
  154. package/dist/runtime/config/loader.d.ts.map +1 -1
  155. package/dist/runtime/config/loader.js +41 -5
  156. package/dist/runtime/config/loader.js.map +1 -1
  157. package/dist/runtime/config/schema.d.ts +27 -12
  158. package/dist/runtime/config/schema.d.ts.map +1 -1
  159. package/dist/runtime/config/schema.js +113 -8
  160. package/dist/runtime/config/schema.js.map +1 -1
  161. package/dist/runtime/config/sources-config.d.ts +14 -0
  162. package/dist/runtime/config/sources-config.d.ts.map +1 -0
  163. package/dist/runtime/config/sources-config.js +79 -0
  164. package/dist/runtime/config/sources-config.js.map +1 -0
  165. package/dist/runtime/distribution/compose.d.ts.map +1 -1
  166. package/dist/runtime/distribution/compose.js +3 -1
  167. package/dist/runtime/distribution/compose.js.map +1 -1
  168. package/dist/runtime/env-seeder.d.ts +5 -0
  169. package/dist/runtime/env-seeder.d.ts.map +1 -1
  170. package/dist/runtime/env-seeder.js +120 -17
  171. package/dist/runtime/env-seeder.js.map +1 -1
  172. package/dist/runtime/foreground.d.ts +4 -0
  173. package/dist/runtime/foreground.d.ts.map +1 -1
  174. package/dist/runtime/foreground.js +11 -0
  175. package/dist/runtime/foreground.js.map +1 -1
  176. package/dist/runtime/infra/infra-catalog.d.ts +1 -0
  177. package/dist/runtime/infra/infra-catalog.d.ts.map +1 -1
  178. package/dist/runtime/infra/infra-catalog.js +2 -1
  179. package/dist/runtime/infra/infra-catalog.js.map +1 -1
  180. package/dist/runtime/infra/infra-runner.d.ts +5 -0
  181. package/dist/runtime/infra/infra-runner.d.ts.map +1 -1
  182. package/dist/runtime/infra/infra-runner.js +82 -13
  183. package/dist/runtime/infra/infra-runner.js.map +1 -1
  184. package/dist/runtime/installation/compiler.d.ts +37 -0
  185. package/dist/runtime/installation/compiler.d.ts.map +1 -0
  186. package/dist/runtime/installation/compiler.js +190 -0
  187. package/dist/runtime/installation/compiler.js.map +1 -0
  188. package/dist/runtime/installation/contract.d.ts +125 -0
  189. package/dist/runtime/installation/contract.d.ts.map +1 -0
  190. package/dist/runtime/installation/contract.js +182 -0
  191. package/dist/runtime/installation/contract.js.map +1 -0
  192. package/dist/runtime/installation/diagnostics.d.ts +16 -0
  193. package/dist/runtime/installation/diagnostics.d.ts.map +1 -0
  194. package/dist/runtime/installation/diagnostics.js +21 -0
  195. package/dist/runtime/installation/diagnostics.js.map +1 -0
  196. package/dist/runtime/installation/diff.d.ts +17 -0
  197. package/dist/runtime/installation/diff.d.ts.map +1 -0
  198. package/dist/runtime/installation/diff.js +99 -0
  199. package/dist/runtime/installation/diff.js.map +1 -0
  200. package/dist/runtime/installation/format.d.ts +3 -0
  201. package/dist/runtime/installation/format.d.ts.map +1 -0
  202. package/dist/runtime/installation/format.js +22 -0
  203. package/dist/runtime/installation/format.js.map +1 -0
  204. package/dist/runtime/installation/from-current-config.d.ts +8 -0
  205. package/dist/runtime/installation/from-current-config.d.ts.map +1 -0
  206. package/dist/runtime/installation/from-current-config.js +75 -0
  207. package/dist/runtime/installation/from-current-config.js.map +1 -0
  208. package/dist/runtime/installation/index.d.ts +13 -0
  209. package/dist/runtime/installation/index.d.ts.map +1 -0
  210. package/dist/runtime/installation/index.js +29 -0
  211. package/dist/runtime/installation/index.js.map +1 -0
  212. package/dist/runtime/installation/lifecycle.d.ts +23 -0
  213. package/dist/runtime/installation/lifecycle.d.ts.map +1 -0
  214. package/dist/runtime/installation/lifecycle.js +70 -0
  215. package/dist/runtime/installation/lifecycle.js.map +1 -0
  216. package/dist/runtime/installation/serialization.d.ts +3 -0
  217. package/dist/runtime/installation/serialization.d.ts.map +1 -0
  218. package/dist/runtime/installation/serialization.js +39 -0
  219. package/dist/runtime/installation/serialization.js.map +1 -0
  220. package/dist/runtime/installation/state-store.d.ts +20 -0
  221. package/dist/runtime/installation/state-store.d.ts.map +1 -0
  222. package/dist/runtime/installation/state-store.js +257 -0
  223. package/dist/runtime/installation/state-store.js.map +1 -0
  224. package/dist/runtime/installation/status.d.ts +30 -0
  225. package/dist/runtime/installation/status.d.ts.map +1 -0
  226. package/dist/runtime/installation/status.js +138 -0
  227. package/dist/runtime/installation/status.js.map +1 -0
  228. package/dist/runtime/installation/support-bundle.d.ts +30 -0
  229. package/dist/runtime/installation/support-bundle.d.ts.map +1 -0
  230. package/dist/runtime/installation/support-bundle.js +130 -0
  231. package/dist/runtime/installation/support-bundle.js.map +1 -0
  232. package/dist/runtime/installation/validation.d.ts +8 -0
  233. package/dist/runtime/installation/validation.d.ts.map +1 -0
  234. package/dist/runtime/installation/validation.js +39 -0
  235. package/dist/runtime/installation/validation.js.map +1 -0
  236. package/dist/runtime/installation/validators/common.d.ts +4 -0
  237. package/dist/runtime/installation/validators/common.d.ts.map +1 -0
  238. package/dist/runtime/installation/validators/common.js +29 -0
  239. package/dist/runtime/installation/validators/common.js.map +1 -0
  240. package/dist/runtime/installation/validators/infrastructure.d.ts +4 -0
  241. package/dist/runtime/installation/validators/infrastructure.d.ts.map +1 -0
  242. package/dist/runtime/installation/validators/infrastructure.js +78 -0
  243. package/dist/runtime/installation/validators/infrastructure.js.map +1 -0
  244. package/dist/runtime/installation/validators/operational.d.ts +4 -0
  245. package/dist/runtime/installation/validators/operational.d.ts.map +1 -0
  246. package/dist/runtime/installation/validators/operational.js +126 -0
  247. package/dist/runtime/installation/validators/operational.js.map +1 -0
  248. package/dist/runtime/installation/validators/profile.d.ts +4 -0
  249. package/dist/runtime/installation/validators/profile.d.ts.map +1 -0
  250. package/dist/runtime/installation/validators/profile.js +78 -0
  251. package/dist/runtime/installation/validators/profile.js.map +1 -0
  252. package/dist/runtime/installation/validators/secrets.d.ts +4 -0
  253. package/dist/runtime/installation/validators/secrets.d.ts.map +1 -0
  254. package/dist/runtime/installation/validators/secrets.js +68 -0
  255. package/dist/runtime/installation/validators/secrets.js.map +1 -0
  256. package/dist/runtime/launch-plan-format.d.ts +3 -0
  257. package/dist/runtime/launch-plan-format.d.ts.map +1 -0
  258. package/dist/runtime/launch-plan-format.js +57 -0
  259. package/dist/runtime/launch-plan-format.js.map +1 -0
  260. package/dist/runtime/launch.d.ts +25 -3
  261. package/dist/runtime/launch.d.ts.map +1 -1
  262. package/dist/runtime/launch.js +264 -24
  263. package/dist/runtime/launch.js.map +1 -1
  264. package/dist/runtime/object-registry-client.d.ts +31 -0
  265. package/dist/runtime/object-registry-client.d.ts.map +1 -0
  266. package/dist/runtime/object-registry-client.js +54 -0
  267. package/dist/runtime/object-registry-client.js.map +1 -0
  268. package/dist/runtime/paths.d.ts +1 -0
  269. package/dist/runtime/paths.d.ts.map +1 -1
  270. package/dist/runtime/paths.js +2 -0
  271. package/dist/runtime/paths.js.map +1 -1
  272. package/dist/runtime/roster.d.ts +11 -4
  273. package/dist/runtime/roster.d.ts.map +1 -1
  274. package/dist/runtime/roster.js +78 -7
  275. package/dist/runtime/roster.js.map +1 -1
  276. package/dist/runtime/run-manifest.d.ts +23 -0
  277. package/dist/runtime/run-manifest.d.ts.map +1 -0
  278. package/dist/runtime/run-manifest.js +273 -0
  279. package/dist/runtime/run-manifest.js.map +1 -0
  280. package/dist/runtime/runner/container-runner.d.ts +6 -0
  281. package/dist/runtime/runner/container-runner.d.ts.map +1 -1
  282. package/dist/runtime/runner/container-runner.js +25 -6
  283. package/dist/runtime/runner/container-runner.js.map +1 -1
  284. package/dist/runtime/runner/docker-cli.d.ts +6 -1
  285. package/dist/runtime/runner/docker-cli.d.ts.map +1 -1
  286. package/dist/runtime/runner/docker-cli.js +47 -6
  287. package/dist/runtime/runner/docker-cli.js.map +1 -1
  288. package/dist/runtime/runner/native-runner.d.ts.map +1 -1
  289. package/dist/runtime/runner/native-runner.js +21 -14
  290. package/dist/runtime/runner/native-runner.js.map +1 -1
  291. package/dist/runtime/secrets/managed-local-store.d.ts +26 -0
  292. package/dist/runtime/secrets/managed-local-store.d.ts.map +1 -0
  293. package/dist/runtime/secrets/managed-local-store.js +202 -0
  294. package/dist/runtime/secrets/managed-local-store.js.map +1 -0
  295. package/dist/runtime/secrets/resolver.d.ts +23 -0
  296. package/dist/runtime/secrets/resolver.d.ts.map +1 -0
  297. package/dist/runtime/secrets/resolver.js +265 -0
  298. package/dist/runtime/secrets/resolver.js.map +1 -0
  299. package/dist/runtime/secrets/url-security.d.ts +3 -0
  300. package/dist/runtime/secrets/url-security.d.ts.map +1 -0
  301. package/dist/runtime/secrets/url-security.js +13 -0
  302. package/dist/runtime/secrets/url-security.js.map +1 -0
  303. package/dist/runtime/sources/credentials.d.ts.map +1 -1
  304. package/dist/runtime/sources/credentials.js +2 -1
  305. package/dist/runtime/sources/credentials.js.map +1 -1
  306. package/dist/runtime/sources/kinds/git.d.ts +6 -3
  307. package/dist/runtime/sources/kinds/git.d.ts.map +1 -1
  308. package/dist/runtime/sources/kinds/git.js +99 -22
  309. package/dist/runtime/sources/kinds/git.js.map +1 -1
  310. package/dist/runtime/sources/resolve-context.d.ts +7 -0
  311. package/dist/runtime/sources/resolve-context.d.ts.map +1 -0
  312. package/dist/runtime/sources/resolve-context.js +3 -0
  313. package/dist/runtime/sources/resolve-context.js.map +1 -0
  314. package/dist/runtime/sources/resolver.d.ts +2 -2
  315. package/dist/runtime/sources/resolver.d.ts.map +1 -1
  316. package/dist/runtime/sources/resolver.js +11 -5
  317. package/dist/runtime/sources/resolver.js.map +1 -1
  318. package/dist/runtime/store-client.d.ts +59 -0
  319. package/dist/runtime/store-client.d.ts.map +1 -0
  320. package/dist/runtime/store-client.js +71 -0
  321. package/dist/runtime/store-client.js.map +1 -0
  322. package/dist/runtime/supervisor.d.ts +6 -0
  323. package/dist/runtime/supervisor.d.ts.map +1 -1
  324. package/dist/runtime/supervisor.js +37 -5
  325. package/dist/runtime/supervisor.js.map +1 -1
  326. package/dist/runtime/waves.d.ts +1 -1
  327. package/dist/runtime/waves.d.ts.map +1 -1
  328. package/dist/runtime/waves.js +86 -19
  329. package/dist/runtime/waves.js.map +1 -1
  330. package/examples/01-local-native.yaml +4 -1
  331. package/examples/03-byo-infra.yaml +17 -7
  332. package/examples/05-appliance-helm.yaml +1 -1
  333. package/examples/06-biome-sources.yaml +4 -1
  334. package/package.json +6 -5
  335. package/xema.config.example.yaml +22 -18
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BiomeScaffoldNameError = exports.BiomeScaffoldExistsError = exports.DEFAULT_SCAFFOLD_TARGET = exports.DEFAULT_SCAFFOLD_SCOPE = exports.ScaffoldScope = exports.ScaffoldTarget = void 0;
4
+ exports.scaffoldBiome = scaffoldBiome;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const biome_1 = require("@xemahq/kernel-contracts/biome");
8
+ var ScaffoldTarget;
9
+ (function (ScaffoldTarget) {
10
+ ScaffoldTarget["Server"] = "server";
11
+ ScaffoldTarget["Web"] = "web";
12
+ })(ScaffoldTarget || (exports.ScaffoldTarget = ScaffoldTarget = {}));
13
+ var ScaffoldScope;
14
+ (function (ScaffoldScope) {
15
+ ScaffoldScope["Kernel"] = "kernel";
16
+ ScaffoldScope["System"] = "system";
17
+ ScaffoldScope["Base"] = "base";
18
+ ScaffoldScope["Platform"] = "platform";
19
+ })(ScaffoldScope || (exports.ScaffoldScope = ScaffoldScope = {}));
20
+ exports.DEFAULT_SCAFFOLD_SCOPE = ScaffoldScope.Platform;
21
+ exports.DEFAULT_SCAFFOLD_TARGET = ScaffoldTarget.Server;
22
+ const DEFAULT_PACKAGE_SCOPE = '@xema-biomes';
23
+ const DEFAULT_ENGINE_RANGE = '^1.0.0';
24
+ const BIOME_ID_RE = /^[a-z][a-z0-9-]*$/;
25
+ class BiomeScaffoldExistsError extends Error {
26
+ biomeDir;
27
+ constructor(biomeDir) {
28
+ super(`Refusing to scaffold: "${biomeDir}" already exists. ` +
29
+ 'Pick another name or remove the existing directory first.');
30
+ this.biomeDir = biomeDir;
31
+ this.name = 'BiomeScaffoldExistsError';
32
+ }
33
+ }
34
+ exports.BiomeScaffoldExistsError = BiomeScaffoldExistsError;
35
+ class BiomeScaffoldNameError extends Error {
36
+ constructor(name) {
37
+ super(`Invalid biome name "${name}" — expected lowercase kebab-case ` +
38
+ '(a leading letter, then letters/digits/dashes), e.g. "acme-tickets".');
39
+ this.name = 'BiomeScaffoldNameError';
40
+ }
41
+ }
42
+ exports.BiomeScaffoldNameError = BiomeScaffoldNameError;
43
+ function scaffoldBiome(options) {
44
+ const { name } = options;
45
+ if (!BIOME_ID_RE.test(name)) {
46
+ throw new BiomeScaffoldNameError(name);
47
+ }
48
+ const scope = options.scope ?? exports.DEFAULT_SCAFFOLD_SCOPE;
49
+ const target = options.target ?? exports.DEFAULT_SCAFFOLD_TARGET;
50
+ const parentDir = (0, node_path_1.resolve)(options.dir ?? process.cwd());
51
+ const biomeDir = (0, node_path_1.join)(parentDir, name);
52
+ if ((0, node_fs_1.existsSync)(biomeDir)) {
53
+ throw new BiomeScaffoldExistsError(biomeDir);
54
+ }
55
+ const displayName = humanizeBiomeName(name);
56
+ const description = options.description !== undefined && options.description.length > 0
57
+ ? options.description
58
+ : `${displayName} — a Xema biome.`;
59
+ const manifestObject = buildManifestObject({ name, displayName, description, scope, target });
60
+ const manifestJson = `${JSON.stringify(manifestObject, null, 2)}\n`;
61
+ const files = [];
62
+ const write = (relativePath, contents) => {
63
+ const absolute = (0, node_path_1.join)(biomeDir, relativePath);
64
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(absolute), { recursive: true });
65
+ (0, node_fs_1.writeFileSync)(absolute, contents, 'utf8');
66
+ files.push(relativePath);
67
+ };
68
+ write(biome_1.BIOME_MANIFEST_FILENAME, manifestJson);
69
+ write('README.md', renderReadme({ name, displayName, description, target }));
70
+ write((0, node_path_1.join)('skills', 'hello', 'SKILL.md'), renderSampleSkill(displayName));
71
+ if (target === ScaffoldTarget.Server) {
72
+ write((0, node_path_1.join)('api', name, 'README.md'), renderServiceReadme(name, displayName));
73
+ write((0, node_path_1.join)('api', name, 'index.ts'), renderServicePlaceholder(name));
74
+ }
75
+ else {
76
+ write((0, node_path_1.join)('web', 'README.md'), renderWebReadme(displayName));
77
+ }
78
+ const manifestPath = (0, node_path_1.join)(biomeDir, biome_1.BIOME_MANIFEST_FILENAME);
79
+ const manifest = (0, biome_1.parseBiomeManifest)(JSON.parse((0, node_fs_1.readFileSync)(manifestPath, 'utf8')));
80
+ return { biomeDir, manifestPath, files, manifest };
81
+ }
82
+ function buildManifestObject(input) {
83
+ const xemaBase = {
84
+ id: input.name,
85
+ displayName: input.displayName,
86
+ description: input.description,
87
+ scope: input.scope,
88
+ target: input.target,
89
+ engines: { xema: DEFAULT_ENGINE_RANGE },
90
+ requiresCapabilities: [],
91
+ exposesCapabilities: [],
92
+ };
93
+ const xema = input.target === ScaffoldTarget.Server
94
+ ? {
95
+ ...xemaBase,
96
+ ships: {
97
+ apis: [{ name: input.name, path: `./api/${input.name}` }],
98
+ },
99
+ }
100
+ : xemaBase;
101
+ return {
102
+ name: `${DEFAULT_PACKAGE_SCOPE}/${input.name}`,
103
+ version: '0.1.0',
104
+ xema,
105
+ };
106
+ }
107
+ function humanizeBiomeName(name) {
108
+ return name
109
+ .split('-')
110
+ .filter((part) => part.length > 0)
111
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
112
+ .join(' ');
113
+ }
114
+ function renderReadme(input) {
115
+ const structure = input.target === ScaffoldTarget.Server
116
+ ? `- \`xema-biome.json\` — the biome manifest (identity + what it ships).\n` +
117
+ `- \`api/${input.name}/\` — the biome's server (NestJS) service placeholder.\n` +
118
+ `- \`skills/\` — Skill bundles this biome ships (one folder per skill).`
119
+ : `- \`xema-biome.json\` — the biome manifest (identity + what it ships).\n` +
120
+ `- \`web/\` — the biome's web surface placeholder.\n` +
121
+ `- \`skills/\` — Skill bundles this biome ships (one folder per skill).`;
122
+ return (`# ${input.displayName}\n\n` +
123
+ `${input.description}\n\n` +
124
+ `## Structure\n\n${structure}\n\n` +
125
+ `## Publish\n\n` +
126
+ `\`\`\`sh\nxema biome publish . --registry <host> --dry-run\n\`\`\`\n`);
127
+ }
128
+ function renderSampleSkill(displayName) {
129
+ return (`---\n` +
130
+ `name: hello\n` +
131
+ `description: A sample skill shipped by the ${displayName} biome. Replace this with a real skill.\n` +
132
+ `---\n\n` +
133
+ `# hello\n\n` +
134
+ `This is a placeholder Skill bundle. \`SKILL.md\` is the only required file; ` +
135
+ `add \`reference/\`, \`scripts/\`, or \`assets/\` alongside it as needed.\n`);
136
+ }
137
+ function renderServiceReadme(name, displayName) {
138
+ return (`# ${displayName} API\n\n` +
139
+ `Server (NestJS) service placeholder for the \`${name}\` biome. The manifest's ` +
140
+ `\`ships.apis[].path\` points here (\`./api/${name}\`). Replace this placeholder ` +
141
+ `with a real service tree before publishing a runnable biome.\n`);
142
+ }
143
+ function renderServicePlaceholder(name) {
144
+ return (`// Placeholder entrypoint for the "${name}" biome API service.\n` +
145
+ `// Replace with a real NestJS bootstrap (see @xemahq/biome-api-sdk).\n\n` +
146
+ `export const BIOME_ID = '${name}';\n`);
147
+ }
148
+ function renderWebReadme(displayName) {
149
+ return (`# ${displayName} Web\n\n` +
150
+ `Web surface placeholder for the ${displayName} biome. Replace with a real ` +
151
+ `web bundle (see the host-shell web-biome framework).\n`);
152
+ }
153
+ //# sourceMappingURL=biome-scaffold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"biome-scaffold.js","sourceRoot":"","sources":["../../src/runtime/biome-scaffold.ts"],"names":[],"mappings":";;;AAwGA,sCA8CC;AAtJD,qCAA6E;AAC7E,yCAAmD;AAEnD,0DAIwC;AAexC,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,6BAAW,CAAA;AACb,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAUD,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;IACjB,8BAAa,CAAA;IACb,sCAAqB,CAAA;AACvB,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB;AAGY,QAAA,sBAAsB,GAAG,aAAa,CAAC,QAAQ,CAAC;AAEhD,QAAA,uBAAuB,GAAG,cAAc,CAAC,MAAM,CAAC;AAG7D,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAE7C,MAAM,oBA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AED,SAAS,wBAAwB,CAAC,IAAY;IAC5C,OAAO,CACL,sCAAsC,IAAI,wBAAwB;QAClE,0EAA0E;QAC1E,4BAA4B,IAAI,MAAM,CACvC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,WAAmB;IAC1C,OAAO,CACL,KAAK,WAAW,UAAU;QAC1B,mCAAmC,WAAW,8BAA8B;QAC5E,wDAAwD,CACzD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { type BiomeManifest } from '@xemahq/kernel-contracts/biome';
2
+ export declare enum BiomeDevCheck {
3
+ Manifest = "manifest",
4
+ Agents = "agents",
5
+ Contributions = "contributions",
6
+ Skills = "skills",
7
+ Workflows = "workflows"
8
+ }
9
+ export declare enum BiomeCheckStatus {
10
+ Passed = "passed",
11
+ Failed = "failed",
12
+ Skipped = "skipped"
13
+ }
14
+ export interface BiomeCheckResult {
15
+ readonly check: BiomeDevCheck;
16
+ readonly status: BiomeCheckStatus;
17
+ readonly summary: string;
18
+ readonly issues: readonly string[];
19
+ }
20
+ export interface BiomeValidationReport {
21
+ readonly biomeRoot: string;
22
+ readonly manifest?: BiomeManifest;
23
+ readonly results: readonly BiomeCheckResult[];
24
+ readonly passed: boolean;
25
+ readonly contributionCounts: ReadonlyMap<string, number>;
26
+ }
27
+ export declare function validateBiomeDir(biomeRoot: string): BiomeValidationReport;
28
+ //# sourceMappingURL=biome-validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"biome-validate.d.ts","sourceRoot":"","sources":["../../src/runtime/biome-validate.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,gCAAgC,CAAC;AAyCxC,oBAAY,aAAa;IACvB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,aAAa,kBAAkB;IAC/B,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAGD,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,MAAM,WAAW;IAEjB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAE9C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,QAAQ,CAAC,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1D;AAuBD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,qBAAqB,CAqCzE"}
@@ -0,0 +1,450 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BiomeCheckStatus = exports.BiomeDevCheck = void 0;
4
+ exports.validateBiomeDir = validateBiomeDir;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const workflow_1 = require("@xemahq/dsl/workflow");
8
+ const biome_1 = require("@xemahq/kernel-contracts/biome");
9
+ const capability_1 = require("@xemahq/kernel-contracts/capability");
10
+ const connector_1 = require("@xemahq/kernel-contracts/connector");
11
+ const contribution_1 = require("@xemahq/kernel-contracts/contribution");
12
+ const resource_1 = require("@xemahq/kernel-contracts/resource");
13
+ const widget_1 = require("@xemahq/kernel-contracts/widget");
14
+ var BiomeDevCheck;
15
+ (function (BiomeDevCheck) {
16
+ BiomeDevCheck["Manifest"] = "manifest";
17
+ BiomeDevCheck["Agents"] = "agents";
18
+ BiomeDevCheck["Contributions"] = "contributions";
19
+ BiomeDevCheck["Skills"] = "skills";
20
+ BiomeDevCheck["Workflows"] = "workflows";
21
+ })(BiomeDevCheck || (exports.BiomeDevCheck = BiomeDevCheck = {}));
22
+ var BiomeCheckStatus;
23
+ (function (BiomeCheckStatus) {
24
+ BiomeCheckStatus["Passed"] = "passed";
25
+ BiomeCheckStatus["Failed"] = "failed";
26
+ BiomeCheckStatus["Skipped"] = "skipped";
27
+ })(BiomeCheckStatus || (exports.BiomeCheckStatus = BiomeCheckStatus = {}));
28
+ const KIND_MANIFEST_SCHEMAS = new Map([
29
+ [contribution_1.ContributionKind.Capability, capability_1.CapabilityContributionManifestSchema],
30
+ [contribution_1.ContributionKind.ConnectorAdapter, connector_1.ConnectorAdapterContributionManifestSchema],
31
+ [contribution_1.ContributionKind.ResourceOwnership, resource_1.ResourceOwnershipContributionManifestSchema],
32
+ [contribution_1.ContributionKind.WidgetKind, widget_1.WidgetContributionManifestSchema],
33
+ ]);
34
+ const CONTRIBUTION_FILE_SUFFIX = '.contribution.json';
35
+ const WORKFLOW_EXTENSIONS = ['.yaml', '.yml'];
36
+ function validateBiomeDir(biomeRoot) {
37
+ const results = [];
38
+ const contributionCounts = new Map();
39
+ const manifestOutcome = checkManifest(biomeRoot);
40
+ results.push(manifestOutcome.result);
41
+ const manifest = manifestOutcome.manifest;
42
+ if (manifest === undefined) {
43
+ for (const check of [
44
+ BiomeDevCheck.Agents,
45
+ BiomeDevCheck.Contributions,
46
+ BiomeDevCheck.Skills,
47
+ BiomeDevCheck.Workflows,
48
+ ]) {
49
+ results.push({
50
+ check,
51
+ status: BiomeCheckStatus.Skipped,
52
+ summary: 'skipped — manifest failed to parse',
53
+ issues: [],
54
+ });
55
+ }
56
+ }
57
+ else {
58
+ results.push(checkAgents(biomeRoot, manifest));
59
+ results.push(checkContributions(biomeRoot, manifest, contributionCounts));
60
+ results.push(checkSkills(biomeRoot));
61
+ results.push(checkWorkflows(biomeRoot));
62
+ }
63
+ return {
64
+ biomeRoot,
65
+ ...(manifest !== undefined ? { manifest } : {}),
66
+ results,
67
+ passed: results.every((r) => r.status !== BiomeCheckStatus.Failed),
68
+ contributionCounts,
69
+ };
70
+ }
71
+ function checkManifest(biomeRoot) {
72
+ const manifestPath = (0, node_path_1.join)(biomeRoot, biome_1.BIOME_MANIFEST_FILENAME);
73
+ let manifest;
74
+ try {
75
+ manifest = (0, biome_1.parseBiomeManifest)(JSON.parse((0, node_fs_1.readFileSync)(manifestPath, 'utf8')));
76
+ }
77
+ catch (err) {
78
+ const detail = err instanceof Error ? err.message : String(err);
79
+ return {
80
+ result: {
81
+ check: BiomeDevCheck.Manifest,
82
+ status: BiomeCheckStatus.Failed,
83
+ summary: `${biome_1.BIOME_MANIFEST_FILENAME} is invalid`,
84
+ issues: [`${manifestPath}: ${detail}`],
85
+ },
86
+ };
87
+ }
88
+ const services = manifest.xema.target === 'server' ? (manifest.xema.ships?.apis ?? []).length : 0;
89
+ return {
90
+ result: {
91
+ check: BiomeDevCheck.Manifest,
92
+ status: BiomeCheckStatus.Passed,
93
+ summary: `"${manifest.xema.id}" v${manifest.version} (${manifest.xema.scope}, ` +
94
+ `${manifest.xema.target}${services > 0 ? `, ${String(services)} service(s)` : ''})`,
95
+ issues: [],
96
+ },
97
+ manifest,
98
+ };
99
+ }
100
+ function checkAgents(biomeRoot, manifest) {
101
+ if (manifest.xema.target !== 'server') {
102
+ return {
103
+ check: BiomeDevCheck.Agents,
104
+ status: BiomeCheckStatus.Skipped,
105
+ summary: 'skipped — web biomes ship no agents',
106
+ issues: [],
107
+ };
108
+ }
109
+ const declared = manifest.xema.agents ?? [];
110
+ const agentsDir = (0, node_path_1.join)(biomeRoot, (0, biome_1.contentKindToDir)('agents'));
111
+ const dirExists = (0, node_fs_1.existsSync)(agentsDir);
112
+ if (!dirExists) {
113
+ if (declared.length > 0) {
114
+ return {
115
+ check: BiomeDevCheck.Agents,
116
+ status: BiomeCheckStatus.Failed,
117
+ summary: 'agents[] declared but agents/ does not exist',
118
+ issues: [
119
+ `agents[] declares ${String(declared.length)} agent(s) but ${agentsDir} does not ` +
120
+ `exist — create agents/<slug>.md for each, or remove the agents[] block`,
121
+ ],
122
+ };
123
+ }
124
+ return {
125
+ check: BiomeDevCheck.Agents,
126
+ status: BiomeCheckStatus.Skipped,
127
+ summary: 'skipped — no agents/ directory',
128
+ issues: [],
129
+ };
130
+ }
131
+ const issues = [];
132
+ const onDiskSlugs = new Set();
133
+ for (const entry of (0, node_fs_1.readdirSync)(agentsDir)) {
134
+ if (entry.startsWith('.') || !entry.endsWith('.md')) {
135
+ continue;
136
+ }
137
+ if ((0, node_fs_1.statSync)((0, node_path_1.join)(agentsDir, entry)).isFile()) {
138
+ onDiskSlugs.add(entry.slice(0, -'.md'.length));
139
+ }
140
+ }
141
+ const declaredSlugs = new Set(declared.map((d) => d.slug));
142
+ for (const decl of declared) {
143
+ if (!onDiskSlugs.has(decl.slug)) {
144
+ issues.push(`declared agents[].slug="${decl.slug}" has no matching file at agents/${decl.slug}.md`);
145
+ }
146
+ }
147
+ for (const slug of onDiskSlugs) {
148
+ if (!declaredSlugs.has(slug)) {
149
+ issues.push(`agents/${slug}.md exists on disk but is not declared under agents[] — ` +
150
+ `add { "slug": "${slug}", "mode": "primary" | "subagent" }`);
151
+ }
152
+ }
153
+ for (const decl of declared) {
154
+ if (!onDiskSlugs.has(decl.slug)) {
155
+ continue;
156
+ }
157
+ const filePath = (0, node_path_1.join)(agentsDir, `${decl.slug}.md`);
158
+ const fm = readFrontmatter((0, node_fs_1.readFileSync)(filePath, 'utf8'));
159
+ if (fm === null) {
160
+ issues.push(`agents/${decl.slug}.md is missing YAML frontmatter (every agent .md must have one)`);
161
+ continue;
162
+ }
163
+ const mode = fm.get('mode');
164
+ if (mode === undefined) {
165
+ if (decl.mode !== 'primary') {
166
+ issues.push(`agents/${decl.slug}.md frontmatter has no "mode:" (treated as primary) but the ` +
167
+ `manifest declares mode="${decl.mode}" — add "mode: ${decl.mode}" to the frontmatter`);
168
+ }
169
+ }
170
+ else if (mode !== decl.mode) {
171
+ issues.push(`agents/${decl.slug}.md frontmatter mode="${mode}" does not match manifest mode="${decl.mode}"`);
172
+ }
173
+ const descriptionIssue = validateAgentDescription(decl.slug, fm.get('description'));
174
+ if (descriptionIssue !== null) {
175
+ issues.push(descriptionIssue);
176
+ }
177
+ }
178
+ if (issues.length > 0) {
179
+ return {
180
+ check: BiomeDevCheck.Agents,
181
+ status: BiomeCheckStatus.Failed,
182
+ summary: `agent declaration parity failed (${String(issues.length)} issue(s))`,
183
+ issues,
184
+ };
185
+ }
186
+ return {
187
+ check: BiomeDevCheck.Agents,
188
+ status: BiomeCheckStatus.Passed,
189
+ summary: `${String(declared.length)} declared = ${String(onDiskSlugs.size)} on disk (mode parity OK)`,
190
+ issues: [],
191
+ };
192
+ }
193
+ const DESCRIPTION_MIN_LENGTH = 40;
194
+ const BANNED_DESCRIPTION_OPENERS = [
195
+ /^\s*agent\s+(that|for|which|to)\b/i,
196
+ /^\s*an\s+agent\b/i,
197
+ /^\s*this\s+agent\b/i,
198
+ ];
199
+ function validateAgentDescription(slug, description) {
200
+ if (description === undefined) {
201
+ return (`agents/${slug}.md frontmatter is missing "description:" — opencode's task tool uses it ` +
202
+ `as the "when to use" surface for delegate routing`);
203
+ }
204
+ const trimmed = description.trim();
205
+ if (trimmed.length < DESCRIPTION_MIN_LENGTH) {
206
+ return (`agents/${slug}.md description is too short (${String(trimmed.length)} chars, min ` +
207
+ `${String(DESCRIPTION_MIN_LENGTH)}) — describe the situation to delegate in, not a label`);
208
+ }
209
+ for (const banned of BANNED_DESCRIPTION_OPENERS) {
210
+ if (banned.test(trimmed)) {
211
+ return (`agents/${slug}.md description starts with "Agent that…"-style boilerplate — ` +
212
+ `lead with the situation/output instead`);
213
+ }
214
+ }
215
+ return null;
216
+ }
217
+ function checkContributions(biomeRoot, manifest, counts) {
218
+ const issues = [];
219
+ const knownKinds = new Set(Object.values(contribution_1.ContributionKind));
220
+ let deepValidated = 0;
221
+ let shapeOnly = 0;
222
+ const validateEntry = (kind, rawManifest, sourceRef) => {
223
+ counts.set(kind, (counts.get(kind) ?? 0) + 1);
224
+ const schema = KIND_MANIFEST_SCHEMAS.get(kind);
225
+ if (schema === undefined) {
226
+ shapeOnly += 1;
227
+ return;
228
+ }
229
+ const parsed = schema.safeParse(rawManifest);
230
+ if (!parsed.success) {
231
+ issues.push(`${sourceRef}: invalid ${kind} contribution manifest — ` +
232
+ parsed.error.issues
233
+ .map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`)
234
+ .join('; '));
235
+ return;
236
+ }
237
+ deepValidated += 1;
238
+ };
239
+ const dirName = manifest.xema.contributions?.directory ?? 'contributions';
240
+ const contribDir = (0, node_path_1.join)(biomeRoot, dirName);
241
+ if ((0, node_fs_1.existsSync)(contribDir) && (0, node_fs_1.statSync)(contribDir).isDirectory()) {
242
+ for (const file of (0, node_fs_1.readdirSync)(contribDir).sort()) {
243
+ if (!file.endsWith(CONTRIBUTION_FILE_SUFFIX)) {
244
+ continue;
245
+ }
246
+ const filePath = (0, node_path_1.join)(contribDir, file);
247
+ const fileRef = (0, node_path_1.join)(dirName, file);
248
+ const kindFromName = [...knownKinds].find((k) => file.endsWith(`.${k}${CONTRIBUTION_FILE_SUFFIX}`));
249
+ if (kindFromName === undefined) {
250
+ issues.push(`${fileRef}: filename does not end in a known \`.<kind>${CONTRIBUTION_FILE_SUFFIX}\` — ` +
251
+ `no contribution parser would ingest it. Known kinds: ${[...knownKinds].sort().join(', ')}.`);
252
+ continue;
253
+ }
254
+ let parsed;
255
+ try {
256
+ parsed = JSON.parse((0, node_fs_1.readFileSync)(filePath, 'utf8'));
257
+ }
258
+ catch (err) {
259
+ issues.push(`${fileRef}: not valid JSON — ${err instanceof Error ? err.message : String(err)}`);
260
+ continue;
261
+ }
262
+ if (parsed.kind !== kindFromName) {
263
+ issues.push(`${fileRef}: \`kind\` must be "${kindFromName}" (the file suffix says so) — ` +
264
+ `got "${String(parsed.kind)}".`);
265
+ continue;
266
+ }
267
+ validateEntry(kindFromName, parsed.manifest, fileRef);
268
+ }
269
+ }
270
+ for (const entry of manifest.xema.contributions?.inline ?? []) {
271
+ validateEntry(entry.kind, entry.manifest, `${biome_1.BIOME_MANIFEST_FILENAME}#xema.contributions.inline[id=${entry.id}]`);
272
+ }
273
+ const total = [...counts.values()].reduce((a, b) => a + b, 0);
274
+ if (issues.length > 0) {
275
+ return {
276
+ check: BiomeDevCheck.Contributions,
277
+ status: BiomeCheckStatus.Failed,
278
+ summary: `${String(issues.length)} invalid contribution(s) of ${String(total)}`,
279
+ issues,
280
+ };
281
+ }
282
+ if (total === 0) {
283
+ return {
284
+ check: BiomeDevCheck.Contributions,
285
+ status: BiomeCheckStatus.Skipped,
286
+ summary: 'skipped — no contribution entries',
287
+ issues: [],
288
+ };
289
+ }
290
+ const byKind = [...counts.entries()].map(([k, n]) => `${k} ×${String(n)}`).join(', ');
291
+ return {
292
+ check: BiomeDevCheck.Contributions,
293
+ status: BiomeCheckStatus.Passed,
294
+ summary: `${String(total)} entr${total === 1 ? 'y' : 'ies'} (${byKind})` +
295
+ (shapeOnly > 0
296
+ ? ` — ${String(deepValidated)} schema-validated, ${String(shapeOnly)} envelope-only ` +
297
+ `(kind schema owned by the ingesting service)`
298
+ : ''),
299
+ issues: [],
300
+ };
301
+ }
302
+ function checkSkills(biomeRoot) {
303
+ const skillsDir = (0, node_path_1.join)(biomeRoot, (0, biome_1.contentKindToDir)('openCodeSkills'));
304
+ if (!(0, node_fs_1.existsSync)(skillsDir) || !(0, node_fs_1.statSync)(skillsDir).isDirectory()) {
305
+ return {
306
+ check: BiomeDevCheck.Skills,
307
+ status: BiomeCheckStatus.Skipped,
308
+ summary: 'skipped — no skills/ directory',
309
+ issues: [],
310
+ };
311
+ }
312
+ const skillFiles = [];
313
+ collectFilesNamed(skillsDir, 'SKILL.md', skillFiles);
314
+ if (skillFiles.length === 0) {
315
+ return {
316
+ check: BiomeDevCheck.Skills,
317
+ status: BiomeCheckStatus.Skipped,
318
+ summary: 'skipped — skills/ has no SKILL.md bundles',
319
+ issues: [],
320
+ };
321
+ }
322
+ const issues = [];
323
+ for (const file of skillFiles.sort()) {
324
+ const ref = (0, node_path_1.relative)(biomeRoot, file);
325
+ const fm = readFrontmatter((0, node_fs_1.readFileSync)(file, 'utf8'));
326
+ if (fm === null) {
327
+ issues.push(`${ref}: missing YAML frontmatter (SKILL.md requires \`name\` + \`description\`)`);
328
+ continue;
329
+ }
330
+ for (const field of ['name', 'description']) {
331
+ const value = fm.get(field);
332
+ if (value === undefined || value.trim().length === 0) {
333
+ issues.push(`${ref}: frontmatter is missing required \`${field}\``);
334
+ }
335
+ }
336
+ }
337
+ if (issues.length > 0) {
338
+ return {
339
+ check: BiomeDevCheck.Skills,
340
+ status: BiomeCheckStatus.Failed,
341
+ summary: `${String(issues.length)} skill bundle issue(s)`,
342
+ issues,
343
+ };
344
+ }
345
+ return {
346
+ check: BiomeDevCheck.Skills,
347
+ status: BiomeCheckStatus.Passed,
348
+ summary: `${String(skillFiles.length)} skill bundle(s) (frontmatter OK)`,
349
+ issues: [],
350
+ };
351
+ }
352
+ function checkWorkflows(biomeRoot) {
353
+ const workflowsDir = (0, node_path_1.join)(biomeRoot, (0, biome_1.contentKindToDir)('workflowConfig'), 'workflows');
354
+ if (!(0, node_fs_1.existsSync)(workflowsDir) || !(0, node_fs_1.statSync)(workflowsDir).isDirectory()) {
355
+ return {
356
+ check: BiomeDevCheck.Workflows,
357
+ status: BiomeCheckStatus.Skipped,
358
+ summary: 'skipped — no workflow-config/workflows/ directory',
359
+ issues: [],
360
+ };
361
+ }
362
+ const issues = [];
363
+ let count = 0;
364
+ const validateDir = (dir, reusable) => {
365
+ for (const file of (0, node_fs_1.readdirSync)(dir).sort()) {
366
+ const path = (0, node_path_1.join)(dir, file);
367
+ if (!(0, node_fs_1.statSync)(path).isFile() || !WORKFLOW_EXTENSIONS.some((ext) => file.endsWith(ext))) {
368
+ continue;
369
+ }
370
+ count += 1;
371
+ try {
372
+ const raw = (0, node_fs_1.readFileSync)(path, 'utf8');
373
+ if (reusable) {
374
+ (0, workflow_1.parseAndValidateReusableWorkflowYaml)(raw);
375
+ }
376
+ else {
377
+ (0, workflow_1.parseAndValidateWorkflowYaml)(raw);
378
+ }
379
+ }
380
+ catch (err) {
381
+ const detail = err instanceof Error ? err.message : String(err);
382
+ issues.push(`${(0, node_path_1.relative)(biomeRoot, path)}: ${detail}`);
383
+ }
384
+ }
385
+ };
386
+ validateDir(workflowsDir, false);
387
+ const reusableDir = (0, node_path_1.join)(workflowsDir, 'reusable');
388
+ if ((0, node_fs_1.existsSync)(reusableDir) && (0, node_fs_1.statSync)(reusableDir).isDirectory()) {
389
+ validateDir(reusableDir, true);
390
+ }
391
+ if (issues.length > 0) {
392
+ return {
393
+ check: BiomeDevCheck.Workflows,
394
+ status: BiomeCheckStatus.Failed,
395
+ summary: `${String(issues.length)} of ${String(count)} workflow(s) failed schema validation`,
396
+ issues,
397
+ };
398
+ }
399
+ if (count === 0) {
400
+ return {
401
+ check: BiomeDevCheck.Workflows,
402
+ status: BiomeCheckStatus.Skipped,
403
+ summary: 'skipped — workflows/ has no YAML documents',
404
+ issues: [],
405
+ };
406
+ }
407
+ return {
408
+ check: BiomeDevCheck.Workflows,
409
+ status: BiomeCheckStatus.Passed,
410
+ summary: `${String(count)} workflow(s) validated against the DSL schema`,
411
+ issues: [],
412
+ };
413
+ }
414
+ const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---/;
415
+ function readFrontmatter(raw) {
416
+ const match = FRONTMATTER_RE.exec(raw);
417
+ if (!match) {
418
+ return null;
419
+ }
420
+ const out = new Map();
421
+ for (const line of (match[1] ?? '').split(/\r?\n/)) {
422
+ const kv = /^\s*([A-Za-z][A-Za-z0-9_-]*)\s*:\s*(.*?)\s*$/.exec(line);
423
+ if (!kv) {
424
+ continue;
425
+ }
426
+ const key = kv[1];
427
+ let value = kv[2] ?? '';
428
+ const quote = value[0];
429
+ if (value.length >= 2 && (quote === '"' || quote === "'") && value.endsWith(quote)) {
430
+ value = value.slice(1, -1);
431
+ }
432
+ out.set(key, value);
433
+ }
434
+ return out;
435
+ }
436
+ function collectFilesNamed(dir, basename, out) {
437
+ for (const entry of (0, node_fs_1.readdirSync)(dir, { withFileTypes: true })) {
438
+ if (entry.name.startsWith('.') || entry.name === 'node_modules') {
439
+ continue;
440
+ }
441
+ const path = (0, node_path_1.join)(dir, entry.name);
442
+ if (entry.isDirectory()) {
443
+ collectFilesNamed(path, basename, out);
444
+ }
445
+ else if (entry.isFile() && entry.name === basename) {
446
+ out.push(path);
447
+ }
448
+ }
449
+ }
450
+ //# sourceMappingURL=biome-validate.js.map