@xemahq/xema 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/runtime/runner/native-runner.d.ts +1 -0
- package/dist/runtime/runner/native-runner.d.ts.map +1 -1
- package/dist/runtime/runner/native-runner.js +16 -4
- package/dist/runtime/runner/native-runner.js.map +1 -1
- package/examples/01-local-monolith.yaml +18 -0
- package/examples/02-local-container-full.yaml +21 -0
- package/examples/03-byo-infra.yaml +17 -0
- package/examples/04-subset-knowledge.yaml +17 -0
- package/examples/05-appliance-helm.yaml +10 -0
- package/examples/README.md +19 -0
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ const serve_1 = require("./commands/serve");
|
|
|
19
19
|
const shell_1 = require("./commands/shell");
|
|
20
20
|
const status_1 = require("./commands/status");
|
|
21
21
|
const up_1 = require("./commands/up");
|
|
22
|
-
const CLI_VERSION = '0.2.
|
|
22
|
+
const CLI_VERSION = '0.2.2';
|
|
23
23
|
function buildProgram() {
|
|
24
24
|
const program = new commander_1.Command();
|
|
25
25
|
program
|
|
@@ -9,6 +9,7 @@ export declare class NativeRunner implements ServiceRunner {
|
|
|
9
9
|
private readonly noFork;
|
|
10
10
|
constructor(opts?: NativeRunnerOptions);
|
|
11
11
|
start(input: StartServiceInput): Promise<RunningService>;
|
|
12
|
+
private resolveServiceRoot;
|
|
12
13
|
private bootInProcess;
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=native-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-runner.d.ts","sourceRoot":"","sources":["../../../src/runtime/runner/native-runner.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAqB1B,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAU/B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,qBAAa,YAAa,YAAW,aAAa;IAChD,QAAQ,CAAC,IAAI,4BAA4B;IACzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;gBAErB,IAAI,GAAE,mBAAwB;IAYpC,KAAK,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"native-runner.d.ts","sourceRoot":"","sources":["../../../src/runtime/runner/native-runner.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAqB1B,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAU/B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,qBAAa,YAAa,YAAW,aAAa;IAChD,QAAQ,CAAC,IAAI,4BAA4B;IACzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;gBAErB,IAAI,GAAE,mBAAwB;IAYpC,KAAK,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC;IAwD9D,OAAO,CAAC,kBAAkB;YAaZ,aAAa;CA6B5B"}
|
|
@@ -26,10 +26,10 @@ class NativeRunner {
|
|
|
26
26
|
throw new Error(`${entry.name}: no servicePath (platform-substrate service) — not bootable natively. ` +
|
|
27
27
|
`Use the container substrate for this service.`);
|
|
28
28
|
}
|
|
29
|
-
const serviceRoot =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
throw new Error(`${entry.name} dist not found at ${
|
|
29
|
+
const serviceRoot = this.resolveServiceRoot(entry.servicePath);
|
|
30
|
+
if (!serviceRoot) {
|
|
31
|
+
const primary = (0, node_path_1.join)(this.monorepoRoot, entry.servicePath, 'dist', 'main.js');
|
|
32
|
+
throw new Error(`${entry.name} dist not found at ${primary}. Run \`pnpm --filter ${entry.name} build\` first.`);
|
|
33
33
|
}
|
|
34
34
|
const needsFork = (0, node_fs_1.existsSync)((0, node_path_1.join)(serviceRoot, 'prisma', 'schema.prisma'));
|
|
35
35
|
applyEnv(env);
|
|
@@ -54,6 +54,18 @@ class NativeRunner {
|
|
|
54
54
|
}
|
|
55
55
|
return this.bootInProcess(entry.name, serviceRoot, port, readinessTimeoutMs);
|
|
56
56
|
}
|
|
57
|
+
resolveServiceRoot(servicePath) {
|
|
58
|
+
const candidates = [
|
|
59
|
+
(0, node_path_1.join)(this.monorepoRoot, servicePath),
|
|
60
|
+
(0, node_path_1.join)(this.monorepoRoot, (0, node_path_1.dirname)(servicePath)),
|
|
61
|
+
];
|
|
62
|
+
for (const candidate of candidates) {
|
|
63
|
+
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(candidate, 'dist', 'main.js'))) {
|
|
64
|
+
return candidate;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
57
69
|
async bootInProcess(name, serviceRoot, port, readinessTimeoutMs) {
|
|
58
70
|
const appModulePath = (0, node_path_1.join)(serviceRoot, 'dist', 'app.module.js');
|
|
59
71
|
if (!(0, node_fs_1.existsSync)(appModulePath)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-runner.js","sourceRoot":"","sources":["../../../src/runtime/runner/native-runner.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"native-runner.js","sourceRoot":"","sources":["../../../src/runtime/runner/native-runner.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,yCAA0C;AAE1C,2DAA4D;AAC5D,oCAA4C;AAC5C,i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AAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAI,UAAkB;IAE5C,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAY,CAAC;IAC9C,OAAO,MAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Lowest-RAM local run — the memory-optimized single-process mode.
|
|
2
|
+
# All in-process-capable services share ONE Node process + ONE in-process
|
|
3
|
+
# registry + a SQLite KernelState file; NO etcd. Prisma-bound services that
|
|
4
|
+
# can't run in-process are fail-fast skip-logged (see plan §18).
|
|
5
|
+
# Run: cp examples/01-local-monolith.yaml xema.config.yaml && xema up
|
|
6
|
+
# Or simply: xema up --monolith (no config file needed)
|
|
7
|
+
edition: oss
|
|
8
|
+
app:
|
|
9
|
+
substrate: native # monolith is native-only
|
|
10
|
+
processModel: monolith # 1 process, SQLite, no etcd
|
|
11
|
+
include: [ all ]
|
|
12
|
+
infra:
|
|
13
|
+
# Native substrate assumes you already run infra (e.g. docker compose up).
|
|
14
|
+
# If you want the launcher to manage infra too, use the container substrate
|
|
15
|
+
# (see 02-local-container-full.yaml).
|
|
16
|
+
postgres: { mode: external, url: postgresql://postgres:postgres@127.0.0.1:5432 }
|
|
17
|
+
redis: { mode: external, url: redis://127.0.0.1:6379 }
|
|
18
|
+
keycloak: { mode: external, url: http://127.0.0.1:8180, realm: xema }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Full local stack in containers — the launcher brings up + bootstraps managed
|
|
2
|
+
# infra (Postgres DBs, object-store buckets), pulls content-addressed service
|
|
3
|
+
# images, and starts the frontend. Needs Docker or Podman.
|
|
4
|
+
# Run: cp examples/02-local-container-full.yaml xema.config.yaml && xema up
|
|
5
|
+
# Manage: xema status | xema logs <svc> -f | xema down [--purge]
|
|
6
|
+
edition: oss
|
|
7
|
+
app:
|
|
8
|
+
substrate: container
|
|
9
|
+
include: [ all ]
|
|
10
|
+
web: { enabled: true } # also start the host-shell frontend
|
|
11
|
+
infra:
|
|
12
|
+
postgres: { mode: managed }
|
|
13
|
+
redis: { mode: managed }
|
|
14
|
+
etcd: { mode: managed } # multi-process container substrate needs etcd
|
|
15
|
+
keycloak: { mode: managed }
|
|
16
|
+
objectStore: { mode: managed }
|
|
17
|
+
search: { mode: managed }
|
|
18
|
+
temporal: { mode: managed }
|
|
19
|
+
git: { mode: disabled }
|
|
20
|
+
secrets:
|
|
21
|
+
OPENCODE_SERVER_PASSWORD: { from: prompt }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Bring-your-own infrastructure — you already run Postgres, Keycloak and an
|
|
2
|
+
# S3-compatible object store elsewhere; the launcher injects their URLs and
|
|
3
|
+
# health-probes them, and manages only the components you didn't bring.
|
|
4
|
+
# external = pre-provisioned (give the URL); managed = launcher runs it;
|
|
5
|
+
# disabled = not run (optional components only).
|
|
6
|
+
edition: oss
|
|
7
|
+
app:
|
|
8
|
+
substrate: container
|
|
9
|
+
include: [ all ]
|
|
10
|
+
infra:
|
|
11
|
+
postgres: { mode: external, url: postgresql://app:secret@db.corp.internal:5432 }
|
|
12
|
+
keycloak: { mode: external, url: https://sso.corp/realms/xema, realm: xema }
|
|
13
|
+
objectStore: { mode: external, url: https://s3.corp.internal, bucketPrefix: xema-, secretRef: corp-s3 }
|
|
14
|
+
redis: { mode: managed }
|
|
15
|
+
etcd: { mode: managed }
|
|
16
|
+
search: { mode: managed }
|
|
17
|
+
temporal: { mode: disabled } # this install doesn't use durable workflows
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Run only a slice of the platform to save resources. `include` accepts tier
|
|
2
|
+
# names (kernel/system/base/platform) and/or explicit service names; the
|
|
3
|
+
# launcher auto-adds each selection's hard dependencies. `features` is the same,
|
|
4
|
+
# expressed as curated capability bundles.
|
|
5
|
+
edition: oss
|
|
6
|
+
app:
|
|
7
|
+
substrate: container
|
|
8
|
+
include: [ kernel, system, knowledge-base-api, search-api ]
|
|
9
|
+
exclude: [ mailops-api ]
|
|
10
|
+
# features: [ knowledge, workflows ] # alternative: pick capabilities
|
|
11
|
+
infra:
|
|
12
|
+
postgres: { mode: managed }
|
|
13
|
+
redis: { mode: managed }
|
|
14
|
+
etcd: { mode: managed }
|
|
15
|
+
keycloak: { mode: managed }
|
|
16
|
+
objectStore: { mode: managed }
|
|
17
|
+
search: { mode: managed }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Deploy to Kubernetes / an appliance via Helm. The launcher runs
|
|
2
|
+
# `helm upgrade --install` per service; Kubernetes owns lifecycle (rollout,
|
|
3
|
+
# restart, scaling). Infra (Postgres/etcd/...) is a cluster prerequisite, not
|
|
4
|
+
# managed by the launcher here. Env: XEMA_CHART_REPO, XEMA_NAMESPACE, KUBECONFIG.
|
|
5
|
+
# Equivalent CLI: xema serve --profile appliance
|
|
6
|
+
edition: oss
|
|
7
|
+
app:
|
|
8
|
+
substrate: helm
|
|
9
|
+
include: [ all ]
|
|
10
|
+
web: { enabled: true }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# `xema.config.yaml` examples
|
|
2
|
+
|
|
3
|
+
Copy one of these to `xema.config.yaml` (or `~/.xema/config.yaml`) and edit:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
cp examples/01-local-monolith.yaml xema.config.yaml
|
|
7
|
+
xema up
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
| File | Use case |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| [`01-local-monolith.yaml`](./01-local-monolith.yaml) | Lowest-RAM local run — one process, SQLite, no etcd (native + monolith). |
|
|
13
|
+
| [`02-local-container-full.yaml`](./02-local-container-full.yaml) | Full local stack in containers (everything + frontend). |
|
|
14
|
+
| [`03-byo-infra.yaml`](./03-byo-infra.yaml) | Bring-your-own Postgres / Keycloak / object store; launcher runs only the rest. |
|
|
15
|
+
| [`04-subset-knowledge.yaml`](./04-subset-knowledge.yaml) | Run only a slice (tiers / services) to save resources. |
|
|
16
|
+
| [`05-appliance-helm.yaml`](./05-appliance-helm.yaml) | Deploy to Kubernetes / an appliance via Helm. |
|
|
17
|
+
|
|
18
|
+
Precedence: `--config <path>` → `./xema.config.yaml` → `~/.xema/config.yaml` →
|
|
19
|
+
built-in defaults. Every value shown is the default unless noted.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/xema",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"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
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/cli.js",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/**/*",
|
|
12
|
-
"xema.config.example.yaml"
|
|
12
|
+
"xema.config.example.yaml",
|
|
13
|
+
"examples/**/*"
|
|
13
14
|
],
|
|
14
15
|
"publishConfig": {
|
|
15
16
|
"registry": "https://registry.npmjs.org/",
|