@xemahq/xema 0.2.4 → 0.4.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 (107) hide show
  1. package/LICENSE +176 -175
  2. package/README.md +117 -1
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +13 -1
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/biome.d.ts.map +1 -1
  7. package/dist/commands/biome.js +83 -6
  8. package/dist/commands/biome.js.map +1 -1
  9. package/dist/commands/dev.d.ts.map +1 -1
  10. package/dist/commands/dev.js +34 -10
  11. package/dist/commands/dev.js.map +1 -1
  12. package/dist/commands/doctor.d.ts +2 -0
  13. package/dist/commands/doctor.d.ts.map +1 -1
  14. package/dist/commands/doctor.js +48 -1
  15. package/dist/commands/doctor.js.map +1 -1
  16. package/dist/commands/down.d.ts.map +1 -1
  17. package/dist/commands/down.js +39 -5
  18. package/dist/commands/down.js.map +1 -1
  19. package/dist/commands/init.d.ts +3 -0
  20. package/dist/commands/init.d.ts.map +1 -0
  21. package/dist/commands/init.js +192 -0
  22. package/dist/commands/init.js.map +1 -0
  23. package/dist/commands/serve.d.ts.map +1 -1
  24. package/dist/commands/serve.js +13 -1
  25. package/dist/commands/serve.js.map +1 -1
  26. package/dist/commands/status.d.ts.map +1 -1
  27. package/dist/commands/status.js +30 -4
  28. package/dist/commands/status.js.map +1 -1
  29. package/dist/commands/up.d.ts.map +1 -1
  30. package/dist/commands/up.js +11 -0
  31. package/dist/commands/up.js.map +1 -1
  32. package/dist/runtime/config/init-presets.d.ts +37 -0
  33. package/dist/runtime/config/init-presets.d.ts.map +1 -0
  34. package/dist/runtime/config/init-presets.js +145 -0
  35. package/dist/runtime/config/init-presets.js.map +1 -0
  36. package/dist/runtime/config/schema.d.ts +27 -0
  37. package/dist/runtime/config/schema.d.ts.map +1 -1
  38. package/dist/runtime/config/schema.js +2 -0
  39. package/dist/runtime/config/schema.js.map +1 -1
  40. package/dist/runtime/launch.d.ts.map +1 -1
  41. package/dist/runtime/launch.js +22 -2
  42. package/dist/runtime/launch.js.map +1 -1
  43. package/dist/runtime/paths.d.ts +1 -0
  44. package/dist/runtime/paths.d.ts.map +1 -1
  45. package/dist/runtime/paths.js +27 -0
  46. package/dist/runtime/paths.js.map +1 -1
  47. package/dist/runtime/roster.d.ts +10 -2
  48. package/dist/runtime/roster.d.ts.map +1 -1
  49. package/dist/runtime/roster.js +50 -1
  50. package/dist/runtime/roster.js.map +1 -1
  51. package/dist/runtime/runner/helm-cli.d.ts +20 -0
  52. package/dist/runtime/runner/helm-cli.d.ts.map +1 -0
  53. package/dist/runtime/runner/helm-cli.js +58 -0
  54. package/dist/runtime/runner/helm-cli.js.map +1 -0
  55. package/dist/runtime/runner/helm-runner.d.ts +1 -2
  56. package/dist/runtime/runner/helm-runner.d.ts.map +1 -1
  57. package/dist/runtime/runner/helm-runner.js +11 -24
  58. package/dist/runtime/runner/helm-runner.js.map +1 -1
  59. package/dist/runtime/runner/native-runner.d.ts.map +1 -1
  60. package/dist/runtime/runner/native-runner.js +6 -5
  61. package/dist/runtime/runner/native-runner.js.map +1 -1
  62. package/dist/runtime/sources/credentials.d.ts +11 -0
  63. package/dist/runtime/sources/credentials.d.ts.map +1 -0
  64. package/dist/runtime/sources/credentials.js +68 -0
  65. package/dist/runtime/sources/credentials.js.map +1 -0
  66. package/dist/runtime/sources/kinds/distribution.d.ts +5 -0
  67. package/dist/runtime/sources/kinds/distribution.d.ts.map +1 -0
  68. package/dist/runtime/sources/kinds/distribution.js +33 -0
  69. package/dist/runtime/sources/kinds/distribution.js.map +1 -0
  70. package/dist/runtime/sources/kinds/git.d.ts +5 -0
  71. package/dist/runtime/sources/kinds/git.d.ts.map +1 -0
  72. package/dist/runtime/sources/kinds/git.js +70 -0
  73. package/dist/runtime/sources/kinds/git.js.map +1 -0
  74. package/dist/runtime/sources/kinds/workspace.d.ts +5 -0
  75. package/dist/runtime/sources/kinds/workspace.d.ts.map +1 -0
  76. package/dist/runtime/sources/kinds/workspace.js +24 -0
  77. package/dist/runtime/sources/kinds/workspace.js.map +1 -0
  78. package/dist/runtime/sources/manifest-walk.d.ts +22 -0
  79. package/dist/runtime/sources/manifest-walk.d.ts.map +1 -0
  80. package/dist/runtime/sources/manifest-walk.js +87 -0
  81. package/dist/runtime/sources/manifest-walk.js.map +1 -0
  82. package/dist/runtime/sources/resolver.d.ts +15 -0
  83. package/dist/runtime/sources/resolver.d.ts.map +1 -0
  84. package/dist/runtime/sources/resolver.js +75 -0
  85. package/dist/runtime/sources/resolver.js.map +1 -0
  86. package/dist/runtime/sources/schema.d.ts +101 -0
  87. package/dist/runtime/sources/schema.d.ts.map +1 -0
  88. package/dist/runtime/sources/schema.js +71 -0
  89. package/dist/runtime/sources/schema.js.map +1 -0
  90. package/dist/runtime/sources/types.d.ts +10 -0
  91. package/dist/runtime/sources/types.d.ts.map +1 -0
  92. package/dist/runtime/sources/types.js +3 -0
  93. package/dist/runtime/sources/types.js.map +1 -0
  94. package/dist/runtime/waves.d.ts +1 -0
  95. package/dist/runtime/waves.d.ts.map +1 -1
  96. package/dist/runtime/waves.js +19 -0
  97. package/dist/runtime/waves.js.map +1 -1
  98. package/examples/01-local-monolith.yaml +1 -1
  99. package/examples/02-local-container-full.yaml +1 -1
  100. package/examples/03-byo-infra.yaml +1 -1
  101. package/examples/05-appliance-helm.yaml +1 -1
  102. package/examples/06-biome-sources.yaml +51 -0
  103. package/package.json +5 -2
  104. package/dist/dev/dev-orchestrator.d.ts +0 -7
  105. package/dist/dev/dev-orchestrator.d.ts.map +0 -1
  106. package/dist/dev/dev-orchestrator.js +0 -367
  107. package/dist/dev/dev-orchestrator.js.map +0 -1
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SourcesConfigSchema = exports.SourceSpecSchema = exports.GitSourceSchema = exports.OciSourceSchema = exports.NpmSourceSchema = exports.DistributionSourceSchema = exports.WorkspaceSourceSchema = exports.SourceKind = void 0;
4
+ const zod_1 = require("zod");
5
+ var SourceKind;
6
+ (function (SourceKind) {
7
+ SourceKind["Workspace"] = "workspace";
8
+ SourceKind["Distribution"] = "distribution";
9
+ SourceKind["Npm"] = "npm";
10
+ SourceKind["Oci"] = "oci";
11
+ SourceKind["Git"] = "git";
12
+ })(SourceKind || (exports.SourceKind = SourceKind = {}));
13
+ const SourceBaseSchema = {
14
+ name: zod_1.z
15
+ .string()
16
+ .min(1)
17
+ .regex(/^[a-z][a-z0-9-]*$/, 'source name must be lowercase kebab-case'),
18
+ };
19
+ exports.WorkspaceSourceSchema = zod_1.z
20
+ .object({
21
+ ...SourceBaseSchema,
22
+ kind: zod_1.z.literal(SourceKind.Workspace),
23
+ root: zod_1.z.string().min(1).optional(),
24
+ })
25
+ .strict();
26
+ exports.DistributionSourceSchema = zod_1.z
27
+ .object({
28
+ ...SourceBaseSchema,
29
+ kind: zod_1.z.literal(SourceKind.Distribution),
30
+ edition: zod_1.z.string().min(1),
31
+ ref: zod_1.z.string().min(1).optional(),
32
+ })
33
+ .strict();
34
+ exports.NpmSourceSchema = zod_1.z
35
+ .object({
36
+ ...SourceBaseSchema,
37
+ kind: zod_1.z.literal(SourceKind.Npm),
38
+ registryUrl: zod_1.z.string().url().optional(),
39
+ scope: zod_1.z
40
+ .string()
41
+ .regex(/^@[a-z0-9][a-z0-9-]*$/, 'scope must look like @scope')
42
+ .optional(),
43
+ authTokenEnv: zod_1.z.string().min(1).optional(),
44
+ })
45
+ .strict();
46
+ exports.OciSourceSchema = zod_1.z
47
+ .object({
48
+ ...SourceBaseSchema,
49
+ kind: zod_1.z.literal(SourceKind.Oci),
50
+ registry: zod_1.z.string().min(1),
51
+ authTokenEnv: zod_1.z.string().min(1).optional(),
52
+ })
53
+ .strict();
54
+ exports.GitSourceSchema = zod_1.z
55
+ .object({
56
+ ...SourceBaseSchema,
57
+ kind: zod_1.z.literal(SourceKind.Git),
58
+ url: zod_1.z.string().regex(/^https?:\/\//, 'git url must be http(s)'),
59
+ ref: zod_1.z.string().min(1).optional(),
60
+ authTokenEnv: zod_1.z.string().min(1).optional(),
61
+ })
62
+ .strict();
63
+ exports.SourceSpecSchema = zod_1.z.discriminatedUnion('kind', [
64
+ exports.WorkspaceSourceSchema,
65
+ exports.DistributionSourceSchema,
66
+ exports.NpmSourceSchema,
67
+ exports.OciSourceSchema,
68
+ exports.GitSourceSchema,
69
+ ]);
70
+ exports.SourcesConfigSchema = zod_1.z.array(exports.SourceSpecSchema).default([]);
71
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/runtime/sources/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAyBxB,IAAY,UAWX;AAXD,WAAY,UAAU;IAEpB,qCAAuB,CAAA;IAEvB,2CAA6B,CAAA;IAE7B,yBAAW,CAAA;IAEX,yBAAW,CAAA;IAEX,yBAAW,CAAA;AACb,CAAC,EAXW,UAAU,0BAAV,UAAU,QAWrB;AAGD,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,OAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,KAAK,CAAC,mBAAmB,EAAE,0CAA0C,CAAC;CAC1E,CAAC;AAOW,QAAA,qBAAqB,GAAG,OAAC;KACnC,MAAM,CAAC;IACN,GAAG,gBAAgB;IACnB,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC;IACrC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACnC,CAAC;KACD,MAAM,EAAE,CAAC;AASC,QAAA,wBAAwB,GAAG,OAAC;KACtC,MAAM,CAAC;IACN,GAAG,gBAAgB;IACnB,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,OAAC,CAAC,MAAM,E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AC,CAAC,CAAC,QAAQ,EAAE;IACjC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC;KACD,MAAM,EAAE,CAAC;AAGC,QAAA,gBAAgB,GAAG,OAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC3D,6BAAqB;IACrB,gCAAwB;IACxB,uBAAe;IACf,uBAAe;IACf,uBAAe;CAChB,CAAC,CAAC;AASU,QAAA,mBAAmB,GAAG,OAAC,CAAC,KAAK,CAAC,wBAAgB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { CredentialResolver } from './credentials';
2
+ import type { LockIndex } from '../roster';
3
+ export interface SourceResolveContext {
4
+ readonly edition: string;
5
+ readonly usesImages: boolean;
6
+ readonly credentials: CredentialResolver;
7
+ readonly log?: (line: string) => void;
8
+ }
9
+ export type KindResolver<TSpec> = (spec: TSpec, ctx: SourceResolveContext) => LockIndex | null;
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/sources/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3C,MAAM,WAAW,oBAAoB;IAEnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC;IAEzC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AASD,MAAM,MAAM,YAAY,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,oBAAoB,KAAK,SAAS,GAAG,IAAI,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/sources/types.ts"],"names":[],"mappings":""}
@@ -5,6 +5,7 @@ export interface Wave {
5
5
  readonly tier: string;
6
6
  readonly members: readonly RosterEntry[];
7
7
  }
8
+ export declare function bootGraphHardClosure(seed: readonly string[], bootGraph: BootGraph, exists: (name: string) => boolean): string[];
8
9
  export declare function deriveWaves(roster: readonly RosterEntry[], bootGraph?: BootGraph): Wave[];
9
10
  export declare function findWaveOrderViolations(waves: readonly Wave[], bootGraph: BootGraph): Array<{
10
11
  service: string;
@@ -1 +1 @@
1
- {"version":3,"file":"waves.d.ts","sourceRoot":"","sources":["../../src/runtime/waves.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAY5C,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;CAC1C;AAYD,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,CA8BzF;AAQD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,SAAS,EAAE,SAAS,GACnB,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CA2CzF"}
1
+ {"version":3,"file":"waves.d.ts","sourceRoot":"","sources":["../../src/runtime/waves.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAY5C,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;CAC1C;AAUD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,MAAM,EAAE,CAiBV;AAYD,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,CA8BzF;AAQD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,SAAS,EAAE,SAAS,GACnB,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CA2CzF"}
@@ -1,7 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bootGraphHardClosure = bootGraphHardClosure;
3
4
  exports.deriveWaves = deriveWaves;
4
5
  exports.findWaveOrderViolations = findWaveOrderViolations;
6
+ function bootGraphHardClosure(seed, bootGraph, exists) {
7
+ const out = new Set(seed.filter(exists));
8
+ const queue = [...out];
9
+ while (queue.length > 0) {
10
+ const svc = queue.shift();
11
+ if (svc === undefined) {
12
+ break;
13
+ }
14
+ const node = bootGraph.services.get(svc);
15
+ for (const req of node?.startupRequires ?? []) {
16
+ if (exists(req) && !out.has(req)) {
17
+ out.add(req);
18
+ queue.push(req);
19
+ }
20
+ }
21
+ }
22
+ return [...out];
23
+ }
5
24
  const DEFAULT_TIER_RANK = {
6
25
  kernel: 0,
7
26
  system: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"waves.js","sourceRoot":"","sources":["../../src/runtime/waves.ts"],"names":[],"mappings":";;AA6BA,kCA8BC;AAQD,0DA8CC;AA7FD,MAAM,iBAAiB,GAAqC;IAC1D,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;IACX,IAAI,EAAE,CAAC;CACR,CAAC;AAGF,SAAgB,WAAW,CAAC,MAA8B,EAAE,SAAqB;IAC/E,MAAM,IAAI,GAAG,CAAC,IAAY,EAAU,EAAE;QACpC,MAAM,SAAS,GAAG,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAClC,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACpC,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,OAAO,MAAM,CAAC,gBAAgB,CAAC;IACjC,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAC;IAChD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QACl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,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAE9F,MAAM,UAAU,GAKX,EAAE,CAAC;IACR,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC5C,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,SAAS;YACX,CAAC;YACD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBAEvC,IAAI,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBACrC,SAAS;gBACX,CAAC;gBACD,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACvC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;oBAC1B,SAAS;gBACX,CAAC;gBACD,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACrC,UAAU,CAAC,IAAI,CAAC;wBACd,OAAO,EAAE,CAAC,CAAC,IAAI;wBACf,QAAQ,EAAE,GAAG;wBACb,WAAW,EAAE,IAAI,CAAC,IAAI;wBACtB,YAAY,EAAE,OAAO;qBACtB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -8,7 +8,7 @@ edition: oss
8
8
  app:
9
9
  substrate: native # monolith is native-only
10
10
  processModel: monolith # 1 process, SQLite, no etcd
11
- include: [ all ]
11
+ include: all
12
12
  infra:
13
13
  # Native substrate assumes you already run infra (e.g. docker compose up).
14
14
  # If you want the launcher to manage infra too, use the container substrate
@@ -6,7 +6,7 @@
6
6
  edition: oss
7
7
  app:
8
8
  substrate: container
9
- include: [ all ]
9
+ include: all
10
10
  web: { enabled: true } # also start the host-shell frontend
11
11
  infra:
12
12
  postgres: { mode: managed }
@@ -6,7 +6,7 @@
6
6
  edition: oss
7
7
  app:
8
8
  substrate: container
9
- include: [ all ]
9
+ include: all
10
10
  infra:
11
11
  postgres: { mode: external, url: postgresql://app:secret@db.corp.internal:5432 }
12
12
  keycloak: { mode: external, url: https://sso.corp/realms/xema, realm: xema }
@@ -6,5 +6,5 @@
6
6
  edition: oss
7
7
  app:
8
8
  substrate: helm
9
- include: [ all ]
9
+ include: all
10
10
  web: { enabled: true }
@@ -0,0 +1,51 @@
1
+ # Biome Source Registry — pull biomes from many origins (community, cultivars,
2
+ # a client's private registry/git, third-party) with per-source auth, while
3
+ # keeping local dev publish-free.
4
+ # Run: cp examples/06-biome-sources.yaml xema.config.yaml && xema dev
5
+ # Check sources + token presence first: xema doctor --sources
6
+ #
7
+ # Precedence (highest wins): workspace > other sources (declared order) > base
8
+ # So a `workspace` source (local working tree) ALWAYS wins in a monorepo — your
9
+ # edits run with NO publish (constraint C1). Tokens are referenced by env-var
10
+ # NAME, never inlined; export them or put them in ~/.xema/credentials.env.
11
+ edition: oss
12
+ app:
13
+ substrate: native # workspace + git sources are source, not images
14
+ include: all
15
+
16
+ sources:
17
+ # 1. WORKSPACE — local working-tree dirs. In a monorepo checkout this wins
18
+ # over every remote source, so `xema dev` runs your edits without a publish.
19
+ # `root` defaults to the auto-detected monorepo root.
20
+ - name: workspace
21
+ kind: workspace
22
+
23
+ # 2. DISTRIBUTION — a pinned edition lock (e.g. a cultivars edition). With no
24
+ # `ref` it reads the vendored/monorepo lock; a local path `ref` reads
25
+ # <ref>/<edition>/{distribution.lock,images.lock}.json.
26
+ - name: cultivars
27
+ kind: distribution
28
+ edition: cultivars
29
+
30
+ # 3. GIT — a client's OWN biome repo (one biome at the root or many nested —
31
+ # both are discovered by walking for xema-biome.json). Private repos name
32
+ # the env var holding their token; omit authTokenEnv for a public clone.
33
+ - name: acme-biomes
34
+ kind: git
35
+ url: https://github.com/acme/xema-biomes.git
36
+ ref: v2.1.0
37
+ authTokenEnv: GIT_TOKEN_ACME # export GIT_TOKEN_ACME=... (never inlined)
38
+
39
+ # 4. NPM — biome packages from any registry. INSTALL-TIME: these install into a
40
+ # running platform via `xema biome install` (the biome-fetcher path); they
41
+ # are not booted directly by `xema up`. Shown here for completeness.
42
+ - name: acme-npm
43
+ kind: npm
44
+ registryUrl: https://npm.pkg.github.com
45
+ scope: "@acme-biomes"
46
+ authTokenEnv: NPM_TOKEN_ACME
47
+
48
+ infra:
49
+ postgres: { mode: external, url: postgresql://postgres:postgres@127.0.0.1:5432 }
50
+ redis: { mode: external, url: redis://127.0.0.1:6379 }
51
+ keycloak: { mode: external, url: http://127.0.0.1:8180, realm: xema }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@xemahq/xema",
3
- "version": "0.2.4",
3
+ "version": "0.4.0",
4
+ "license": "Apache-2.0",
4
5
  "description": "Xema OS global CLI (plan v4.3 §6 Phase J). Single binary day-0 onboarding: `npm i -g @xemahq/xema && xema dev` boots the whole stack; `xema biome scaffold` / `install` / `publish` / `lint` author and ship biomes; `xema run <capability>` invokes through the local capability-router. Multi-platform: works without pnpm or any monorepo clone.",
5
6
  "type": "commonjs",
6
7
  "main": "dist/cli.js",
@@ -26,6 +27,7 @@
26
27
  "commander": "^12.1.0",
27
28
  "reflect-metadata": "0.2.2",
28
29
  "rxjs": "7.8.2",
30
+ "tsx": "^4.19.2",
29
31
  "yaml": "^2.6.1",
30
32
  "zod": "^4.3.6"
31
33
  },
@@ -50,7 +52,8 @@
50
52
  "dist/**/*.js"
51
53
  ],
52
54
  "assets": [
53
- "dist/**/*.json"
55
+ "dist/**/*.json",
56
+ "package.json"
54
57
  ],
55
58
  "targets": [
56
59
  "node20-macos-arm64",
@@ -1,7 +0,0 @@
1
- export interface DevOrchestratorOptions {
2
- readonly kernelPort?: number | undefined;
3
- readonly routerPort?: number | undefined;
4
- readonly skipPreflight?: boolean | undefined;
5
- }
6
- export declare function runDevOrchestrator(opts?: DevOrchestratorOptions): Promise<void>;
7
- //# sourceMappingURL=dev-orchestrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dev-orchestrator.d.ts","sourceRoot":"","sources":["../../src/dev/dev-orchestrator.ts"],"names":[],"mappings":"AAmMA,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAMzC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9C;AAsBD,wBAAsB,kBAAkB,CACtC,IAAI,GAAE,sBAA2B,GAChC,OAAO,CAAC,IAAI,CAAC,CA6Xf"}
@@ -1,367 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runDevOrchestrator = runDevOrchestrator;
4
- const node_fs_1 = require("node:fs");
5
- const node_os_1 = require("node:os");
6
- const node_path_1 = require("node:path");
7
- const service_registry_nest_1 = require("@xemahq/service-registry-nest");
8
- const env_defaults_1 = require("./env-defaults");
9
- const forked_worker_1 = require("./forked-worker");
10
- const infra_preflight_1 = require("./infra-preflight");
11
- const exit_codes_1 = require("../lib/exit-codes");
12
- const DEFAULT_KERNEL_PORT = env_defaults_1.PORT_MAP['xema-kernel-server'] ?? 7331;
13
- const DEFAULT_ROUTER_PORT = env_defaults_1.PORT_MAP['xema-capability-router'] ?? 7332;
14
- const FORKED_WORKER_READINESS_TIMEOUT_MS = 45_000;
15
- const FORKED_WORKER_EXEMPT = new Set([
16
- 'audit-log-api',
17
- 'authorization-api',
18
- 'capability-registry-api',
19
- 'user-hub-api',
20
- 'workspace-storage-pool-api',
21
- 'workspace-git-api',
22
- 'document-render-api',
23
- 'memory-api',
24
- 'skill-registry-api',
25
- 'project-registry-api',
26
- 'knowledge-base-api',
27
- 'activity-feed-api',
28
- 'xema-store-api',
29
- 'llm-registry-api',
30
- 'agent-session-api',
31
- 'artifact-store-api',
32
- 'workflow-engine-api',
33
- 'backlog-api',
34
- 'mcp-gateway-api',
35
- 'connector-gateway-api',
36
- 'biome-host-api',
37
- 'workspace-orchestrator-api',
38
- 'workload-runtime-api',
39
- ]);
40
- async function runDevOrchestrator(opts = {}) {
41
- const kernelPort = opts.kernelPort ??
42
- Number.parseInt(process.env.XEMA_DEV_PORT_KERNEL ?? String(DEFAULT_KERNEL_PORT), 10);
43
- const routerPort = opts.routerPort ??
44
- Number.parseInt(process.env.XEMA_DEV_PORT_ROUTER ?? String(DEFAULT_ROUTER_PORT), 10);
45
- if (!Number.isFinite(kernelPort) || !Number.isFinite(routerPort)) {
46
- (0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.ConfigurationError, `xema dev: invalid port numbers (kernel=${kernelPort}, router=${routerPort}).`);
47
- }
48
- const xemaHome = (0, node_path_1.join)((0, node_os_1.homedir)(), '.xema', 'dev');
49
- if (!(0, node_fs_1.existsSync)(xemaHome)) {
50
- (0, node_fs_1.mkdirSync)(xemaHome, { recursive: true });
51
- }
52
- const kernelStatePath = (0, node_path_1.join)(xemaHome, 'kernel-state.sqlite');
53
- process.env[service_registry_nest_1.SERVICE_REGISTRY_ADAPTER_ENV_VAR] =
54
- service_registry_nest_1.ServiceRegistryAdapterKind.InProcess;
55
- process.env.XEMA_KERNEL_STATE_FILE = kernelStatePath;
56
- process.env.XEMA_KERNEL_STATE_PROFILE = 'dev';
57
- const appliedDefaults = (0, env_defaults_1.applyDevEnvDefaults)();
58
- console.log('xema dev — single-binary composition (Phase J.3 forked-worker spawn loop)');
59
- console.log('-'.repeat(60));
60
- console.log(` KernelState : ${kernelStatePath}`);
61
- console.log(` Registry : ${service_registry_nest_1.ServiceRegistryAdapterKind.InProcess}`);
62
- console.log(` Env defaults : ${appliedDefaults.length} applied (user values preserved)`);
63
- console.log('');
64
- if (opts.skipPreflight !== true) {
65
- const report = await (0, infra_preflight_1.runInfraPreflight)();
66
- if (!report.allReachable) {
67
- const message = (0, infra_preflight_1.formatPreflightFailure)(report);
68
- console.error(message);
69
- (0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.MissingDependency);
70
- }
71
- console.log(` Pre-flight : OK (${report.results.length} infra dependencies reachable)`);
72
- console.log('');
73
- }
74
- else {
75
- console.log(' Pre-flight : SKIPPED (--skip-preflight)');
76
- console.log('');
77
- }
78
- const booted = [];
79
- const forked = [];
80
- const skippedFlat = [];
81
- const shutdown = async (signal) => {
82
- console.log('');
83
- console.log(`xema dev — received ${signal}; shutting down...`);
84
- for (const child of [...forked].reverse()) {
85
- try {
86
- await child.close();
87
- console.log(` closed ${child.name} (pid ${String(child.pid)})`);
88
- }
89
- catch (err) {
90
- const message = err instanceof Error ? err.message : String(err);
91
- console.error(` failed to close ${child.name}: ${message}`);
92
- }
93
- }
94
- for (const svc of [...booted].reverse()) {
95
- try {
96
- await svc.close();
97
- console.log(` closed ${svc.name}`);
98
- }
99
- catch (err) {
100
- const message = err instanceof Error ? err.message : String(err);
101
- console.error(` failed to close ${svc.name}: ${message}`);
102
- }
103
- }
104
- process.exit(exit_codes_1.XemaCliExitCode.Ok);
105
- };
106
- process.on('SIGINT', (sig) => {
107
- void shutdown(sig);
108
- });
109
- process.on('SIGTERM', (sig) => {
110
- void shutdown(sig);
111
- });
112
- const TOTAL_CANDIDATES = 29;
113
- const candidates = [
114
- {
115
- name: 'xema-kernel-server',
116
- port: kernelPort,
117
- siblingAppDir: '../../../xema-kernel-server',
118
- },
119
- {
120
- name: 'xema-capability-router',
121
- port: routerPort,
122
- siblingAppDir: '../../../xema-capability-router',
123
- },
124
- {
125
- name: 'catalog-api',
126
- port: portFor('catalog-api'),
127
- siblingAppDir: '../../../catalog-api',
128
- },
129
- {
130
- name: 'object-registry-api',
131
- port: portFor('object-registry-api'),
132
- siblingAppDir: '../../../object-registry-api',
133
- },
134
- {
135
- name: 'public-gateway-api',
136
- port: portFor('public-gateway-api'),
137
- siblingAppDir: '../../../public-gateway-api',
138
- },
139
- {
140
- name: 'audit-log-api',
141
- port: portFor('audit-log-api'),
142
- siblingAppDir: '../../../audit-log-api',
143
- },
144
- {
145
- name: 'authorization-api',
146
- port: portFor('authorization-api'),
147
- siblingAppDir: '../../../authorization-api',
148
- },
149
- {
150
- name: 'capability-registry-api',
151
- port: portFor('capability-registry-api'),
152
- siblingAppDir: '../../../capability-registry-api',
153
- },
154
- {
155
- name: 'user-hub-api',
156
- port: portFor('user-hub-api'),
157
- siblingAppDir: '../../../user-hub-api',
158
- },
159
- {
160
- name: 'workspace-storage-pool-api',
161
- port: portFor('workspace-storage-pool-api'),
162
- siblingAppDir: '../../../workspace-storage-pool-api',
163
- },
164
- {
165
- name: 'workspace-git-api',
166
- port: portFor('workspace-git-api'),
167
- siblingAppDir: '../../../workspace-git-api',
168
- },
169
- {
170
- name: 'document-render-api',
171
- port: portFor('document-render-api'),
172
- siblingAppDir: '../../../document-render-api',
173
- },
174
- {
175
- name: 'memory-api',
176
- port: portFor('memory-api'),
177
- siblingAppDir: '../../../memory-api',
178
- },
179
- {
180
- name: 'skill-registry-api',
181
- port: portFor('skill-registry-api'),
182
- siblingAppDir: '../../../skill-registry-api',
183
- },
184
- {
185
- name: 'project-registry-api',
186
- port: portFor('project-registry-api'),
187
- siblingAppDir: '../../../project-registry-api',
188
- },
189
- {
190
- name: 'knowledge-base-api',
191
- port: portFor('knowledge-base-api'),
192
- siblingAppDir: '../../../knowledge-base-api',
193
- },
194
- {
195
- name: 'activity-feed-api',
196
- port: portFor('activity-feed-api'),
197
- siblingAppDir: '../../../activity-feed-api',
198
- },
199
- {
200
- name: 'xema-store-api',
201
- port: portFor('xema-store-api'),
202
- siblingAppDir: '../../../xema-store-api',
203
- },
204
- {
205
- name: 'xema-shell-api',
206
- port: portFor('xema-shell-api'),
207
- siblingAppDir: '../../../xema-shell-api',
208
- },
209
- {
210
- name: 'llm-registry-api',
211
- port: portFor('llm-registry-api'),
212
- siblingAppDir: '../../../llm-registry-api',
213
- },
214
- {
215
- name: 'agent-session-api',
216
- port: portFor('agent-session-api'),
217
- siblingAppDir: '../../../agent-session-api',
218
- },
219
- {
220
- name: 'artifact-store-api',
221
- port: portFor('artifact-store-api'),
222
- siblingAppDir: '../../../artifact-store-api',
223
- },
224
- {
225
- name: 'workflow-engine-api',
226
- port: portFor('workflow-engine-api'),
227
- siblingAppDir: '../../../workflow-engine-api',
228
- },
229
- {
230
- name: 'backlog-api',
231
- port: portFor('backlog-api'),
232
- siblingAppDir: '../../../backlog-api',
233
- },
234
- {
235
- name: 'mcp-gateway-api',
236
- port: portFor('mcp-gateway-api'),
237
- siblingAppDir: '../../../mcp-gateway-api',
238
- },
239
- {
240
- name: 'connector-gateway-api',
241
- port: portFor('connector-gateway-api'),
242
- siblingAppDir: '../../../connector-gateway-api',
243
- },
244
- {
245
- name: 'biome-host-api',
246
- port: portFor('biome-host-api'),
247
- siblingAppDir: '../../../biome-host-api',
248
- },
249
- {
250
- name: 'workspace-orchestrator-api',
251
- port: portFor('workspace-orchestrator-api'),
252
- siblingAppDir: '../../../workspace-orchestrator-api',
253
- },
254
- {
255
- name: 'workload-runtime-api',
256
- port: portFor('workload-runtime-api'),
257
- siblingAppDir: '../../../workload-runtime-api',
258
- },
259
- ];
260
- for (const cand of candidates) {
261
- if (FORKED_WORKER_EXEMPT.has(cand.name)) {
262
- try {
263
- const child = await (0, forked_worker_1.spawnForkedWorker)({
264
- name: cand.name,
265
- port: cand.port,
266
- siblingAppDir: cand.siblingAppDir,
267
- readinessTimeoutMs: FORKED_WORKER_READINESS_TIMEOUT_MS,
268
- }, __dirname);
269
- forked.push(child);
270
- console.log(` forked ${cand.name.padEnd(28, ' ')} ${child.url} (pid ${String(child.pid)})`);
271
- }
272
- catch (err) {
273
- const message = err instanceof Error ? err.message : String(err);
274
- skippedFlat.push({ name: cand.name, reason: message });
275
- console.warn(` Skipping ${cand.name}: ${message}`);
276
- }
277
- continue;
278
- }
279
- try {
280
- const handle = await bootService(cand);
281
- booted.push(handle);
282
- console.log(` booted ${cand.name.padEnd(28, ' ')} ${handle.url}`);
283
- }
284
- catch (err) {
285
- const message = err instanceof Error ? err.message : String(err);
286
- skippedFlat.push({ name: cand.name, reason: message });
287
- console.warn(` Skipping ${cand.name}: ${message}`);
288
- }
289
- }
290
- console.log('');
291
- console.log('-'.repeat(60));
292
- const totalBooting = booted.length + forked.length;
293
- const pendingCount = TOTAL_CANDIDATES - candidates.length;
294
- console.log(`Booted ${booted.length}/${TOTAL_CANDIDATES} in-process` +
295
- ` + ${forked.length}/${TOTAL_CANDIDATES} forked-worker` +
296
- ` = ${totalBooting}/${TOTAL_CANDIDATES} total` +
297
- (skippedFlat.length > 0 ? `, skipped ${skippedFlat.length}` : '') +
298
- `, ${pendingCount} not yet wired.`);
299
- if (skippedFlat.length > 0) {
300
- console.log('Skipped this run:');
301
- for (const s of skippedFlat) {
302
- console.log(` - ${s.name}: ${s.reason}`);
303
- }
304
- }
305
- console.log('');
306
- if (totalBooting === 0) {
307
- (0, exit_codes_1.exitWith)(exit_codes_1.XemaCliExitCode.GenericError, 'xema dev: no services booted successfully. See skip reasons above.');
308
- }
309
- if (booted.length > 0) {
310
- console.log('In-process services:');
311
- for (const svc of booted) {
312
- console.log(` ${svc.name.padEnd(28, ' ')} ${svc.url}`);
313
- }
314
- }
315
- if (forked.length > 0) {
316
- console.log('Forked-worker services:');
317
- for (const svc of forked) {
318
- console.log(` ${svc.name.padEnd(28, ' ')} ${svc.url} (pid ${String(svc.pid)})`);
319
- }
320
- }
321
- console.log('');
322
- console.log('Press Ctrl+C to shut down.');
323
- await new Promise(() => {
324
- });
325
- }
326
- function portFor(serviceName) {
327
- const port = env_defaults_1.PORT_MAP[serviceName];
328
- if (port === undefined) {
329
- throw new Error(`dev-orchestrator: no PORT_MAP entry for "${serviceName}". ` +
330
- `Add it to env-defaults.ts PORT_MAP before wiring the service.`);
331
- }
332
- return port;
333
- }
334
- async function bootService(opts) {
335
- process.env.PORT = String(opts.port);
336
- process.env.SERVICE_PUBLIC_URL = `http://127.0.0.1:${String(opts.port)}`;
337
- const siblingDistDir = (0, node_path_1.resolve)(__dirname, opts.siblingAppDir, 'dist');
338
- const appModulePath = (0, node_path_1.resolve)(siblingDistDir, 'app.module.js');
339
- const mainModulePath = (0, node_path_1.resolve)(siblingDistDir, 'main.js');
340
- if (!(0, node_fs_1.existsSync)(appModulePath)) {
341
- throw new Error(`${opts.name} dist not found at ${appModulePath}. ` +
342
- `Run \`pnpm --filter ${opts.name} build\` first, or use \`pnpm refresh\`.`);
343
- }
344
- void mainModulePath;
345
- const bundle = requireCommonJs(appModulePath);
346
- if (typeof bundle.AppModule !== 'function' && typeof bundle.AppModule !== 'object') {
347
- throw new Error(`${opts.name} dist did not export an \`AppModule\` class ` +
348
- `from ${appModulePath}.`);
349
- }
350
- const nestCore = requireCommonJs(require.resolve('@nestjs/core'));
351
- const app = await nestCore.NestFactory.create(bundle.AppModule, {
352
- logger: ['error', 'warn', 'log'],
353
- abortOnError: false,
354
- });
355
- await app.listen(opts.port);
356
- const url = await app.getUrl();
357
- return {
358
- name: opts.name,
359
- url,
360
- close: () => app.close(),
361
- };
362
- }
363
- function requireCommonJs(modulePath) {
364
- const loaded = require(modulePath);
365
- return loaded;
366
- }
367
- //# sourceMappingURL=dev-orchestrator.js.map