@bpmnkit/cli 0.0.18 → 0.0.23

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/README.md CHANGED
@@ -6,6 +6,8 @@
6
6
  [![npm](https://img.shields.io/npm/v/@bpmnkit/cli?style=flat-square&color=6244d7)](https://www.npmjs.com/package/@bpmnkit/cli)
7
7
  [![license](https://img.shields.io/npm/l/@bpmnkit/cli?style=flat-square)](https://github.com/bpmnkit/monorepo/blob/main/LICENSE)
8
8
  [![typescript](https://img.shields.io/badge/TypeScript-strict-6244d7?style=flat-square&logo=typescript&logoColor=white)](https://github.com/bpmnkit/monorepo)
9
+ [![ai-assisted](https://img.shields.io/badge/AI--assisted-claude-8b5cf6?style=flat-square)](https://github.com/bpmnkit/monorepo)
10
+ [![experimental](https://img.shields.io/badge/status-experimental-f59e0b?style=flat-square)](https://github.com/bpmnkit/monorepo)
9
11
 
10
12
  [Website](https://bpmnkit.com) · [Documentation](https://docs.bpmnkit.com) · [GitHub](https://github.com/bpmnkit/monorepo) · [Changelog](https://github.com/bpmnkit/monorepo/blob/main/apps/cli/CHANGELOG.md)
11
13
  </div>
@@ -7,6 +7,8 @@ import { connectorGroup } from "./connector.js";
7
7
  import { lintGroup } from "./lint.js";
8
8
  import { pluginGroup } from "./plugin.js";
9
9
  import { profileGroup } from "./profile.js";
10
+ import { proxyGroup } from "./proxy.js";
11
+ import { reebeGroup } from "./reebe.js";
10
12
  import { computeRelations } from "./relations.js";
11
13
  import { settingsGroup } from "./settings.js";
12
14
  import { storyGroup } from "./story.js";
@@ -52,6 +54,8 @@ const workerGroup = {
52
54
  export const pinnedGroups = [
53
55
  askGroup,
54
56
  lintGroup,
57
+ proxyGroup,
58
+ reebeGroup,
55
59
  storyGroup,
56
60
  settingsGroup,
57
61
  testGroup,
@@ -0,0 +1,33 @@
1
+ import { startServer } from "@bpmnkit/proxy";
2
+ const startCmd = {
3
+ name: "start",
4
+ description: "Start the BPMN Kit proxy server (AI bridge + Camunda API proxy)",
5
+ flags: [
6
+ {
7
+ name: "port",
8
+ description: "Port to listen on",
9
+ type: "number",
10
+ default: 3033,
11
+ },
12
+ ],
13
+ examples: [
14
+ { description: "Start on default port (3033)", command: "casen proxy start" },
15
+ { description: "Start on a custom port", command: "casen proxy start --port 4000" },
16
+ ],
17
+ async run(ctx) {
18
+ const port = ctx.flags.port ?? 3033;
19
+ ctx.output.info(`Starting BPMN Kit proxy server on port ${port}...`);
20
+ startServer(port);
21
+ // Keep the CLI alive until the user presses Ctrl+C
22
+ await new Promise((resolve) => {
23
+ process.once("SIGINT", resolve);
24
+ process.once("SIGTERM", resolve);
25
+ });
26
+ },
27
+ };
28
+ export const proxyGroup = {
29
+ name: "proxy",
30
+ description: "Start the local AI bridge and Camunda API proxy server",
31
+ commands: [startCmd],
32
+ };
33
+ //# sourceMappingURL=proxy.js.map
@@ -0,0 +1,77 @@
1
+ import { spawn } from "node:child_process";
2
+ const startCmd = {
3
+ name: "start",
4
+ description: "Start the Reebe workflow engine (Zeebe-compatible REST API)",
5
+ flags: [
6
+ {
7
+ name: "port",
8
+ description: "HTTP port to listen on",
9
+ type: "number",
10
+ default: 8080,
11
+ },
12
+ {
13
+ name: "database-url",
14
+ description: "PostgreSQL database URL. Omit to use embedded SQLite (no external database required).",
15
+ type: "string",
16
+ placeholder: "postgres://user:pass@host/db",
17
+ },
18
+ {
19
+ name: "config",
20
+ description: "Path to config.toml",
21
+ type: "string",
22
+ default: "config.toml",
23
+ placeholder: "PATH",
24
+ },
25
+ ],
26
+ examples: [
27
+ {
28
+ description: "Start with embedded SQLite (no external database required)",
29
+ command: "casen reebe start",
30
+ },
31
+ {
32
+ description: "Start with PostgreSQL",
33
+ command: "casen reebe start --database-url postgres://user:pass@localhost/reebe",
34
+ },
35
+ { description: "Start on a custom port", command: "casen reebe start --port 9090" },
36
+ ],
37
+ async run(ctx) {
38
+ const port = ctx.flags.port ?? 8080;
39
+ const dbUrl = ctx.flags["database-url"];
40
+ const configPath = ctx.flags.config ?? "config.toml";
41
+ ctx.output.info(`Starting Reebe workflow engine on port ${port}...`);
42
+ ctx.output.info(dbUrl ? `Database: ${dbUrl}` : "Database: embedded SQLite");
43
+ ctx.output.info("Press Ctrl+C to stop\n");
44
+ const args = ["--port", String(port), "--config", configPath];
45
+ const env = { ...process.env, REEBE_PORT: String(port) };
46
+ if (dbUrl)
47
+ env.REEBE_DATABASE_URL = dbUrl;
48
+ await new Promise((resolve, reject) => {
49
+ const child = spawn("reebe-server", args, { stdio: "inherit", env });
50
+ child.on("error", (err) => {
51
+ const code = err.code;
52
+ if (code === "ENOENT") {
53
+ reject(new Error([
54
+ "reebe-server not found.",
55
+ "Build from source:",
56
+ " cargo install --path apps/reebe/crates/reebe-server",
57
+ ].join("\n")));
58
+ }
59
+ else {
60
+ reject(err);
61
+ }
62
+ });
63
+ child.on("close", (exitCode) => {
64
+ if (exitCode === 0 || exitCode === null)
65
+ resolve();
66
+ else
67
+ reject(new Error(`Reebe engine exited with code ${exitCode}`));
68
+ });
69
+ });
70
+ },
71
+ };
72
+ export const reebeGroup = {
73
+ name: "reebe",
74
+ description: "Start the Reebe workflow engine (drop-in Zeebe replacement, ~50 MB)",
75
+ commands: [startCmd],
76
+ };
77
+ //# sourceMappingURL=reebe.js.map
@@ -1,6 +1,6 @@
1
- import { readFile } from "node:fs/promises";
2
- import { Bpmn } from "@bpmnkit/core";
3
- import { Engine, runScenario } from "@bpmnkit/engine";
1
+ import { readFile, readdir } from "node:fs/promises";
2
+ import { dirname, extname, join } from "node:path";
3
+ import { runScenarioWasm } from "@bpmnkit/engine/wasm-runner";
4
4
  const testCmd = {
5
5
  name: "test",
6
6
  description: "Run scenario tests for a BPMN process file",
@@ -41,12 +41,26 @@ const testCmd = {
41
41
  ctx.output.info("No scenarios found.");
42
42
  return;
43
43
  }
44
- const defs = Bpmn.parse(bpmnXml);
45
- const engine = new Engine();
44
+ // Build a decision-ID → DMN XML map from all *.dmn files in the BPMN's directory.
45
+ const bpmnDir = dirname(bpmnPath);
46
+ const dirFiles = await readdir(bpmnDir).catch(() => []);
47
+ const decisionMap = new Map();
48
+ for (const file of dirFiles) {
49
+ if (extname(file).toLowerCase() !== ".dmn")
50
+ continue;
51
+ const dmnXml = await readFile(join(bpmnDir, file), "utf8").catch(() => null);
52
+ if (dmnXml === null)
53
+ continue;
54
+ for (const [, id] of dmnXml.matchAll(/<decision[^>]+\bid="([^"]+)"/g)) {
55
+ if (id)
56
+ decisionMap.set(id, dmnXml);
57
+ }
58
+ }
59
+ const getDecisionDmn = decisionMap.size > 0 ? (id) => decisionMap.get(id) ?? null : undefined;
46
60
  let passed = 0;
47
61
  let failed = 0;
48
62
  for (const scenario of scenarios) {
49
- const result = await runScenario(engine, defs, scenario);
63
+ const result = await runScenarioWasm(bpmnXml, scenario, getDecisionDmn);
50
64
  if (result.passed) {
51
65
  passed++;
52
66
  ctx.output.ok(`PASS ${scenario.name} (${result.durationMs}ms)`);
package/dist/run.js CHANGED
@@ -102,6 +102,15 @@ export async function run(argv) {
102
102
  process.exitCode = 1;
103
103
  return;
104
104
  }
105
+ // ── proxy / reebe: run start directly when no subcommand is given ────────
106
+ if ((group.name === "proxy" || group.name === "reebe") && positional.length === 1 && !wantHelp) {
107
+ const output = createOutputWriter(outputFormat, noColor);
108
+ const ctx = { positional: [], flags, output, getClient, getAdminClient };
109
+ const cmd = group.commands[0];
110
+ if (cmd)
111
+ await cmd.run(ctx);
112
+ return;
113
+ }
105
114
  // ── worker: treat positional[1] as the job type argument ─────────────────
106
115
  if (group.name === "worker" && positional.length >= 2 && !wantHelp) {
107
116
  const output = createOutputWriter(outputFormat, noColor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmnkit/cli",
3
- "version": "0.0.18",
3
+ "version": "0.0.23",
4
4
  "description": "Command-line interface for Camunda 8 — deploy, manage, and monitor processes from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,12 +15,13 @@
15
15
  "node": ">=20"
16
16
  },
17
17
  "dependencies": {
18
- "@bpmnkit/api": "0.0.13",
19
- "@bpmnkit/ascii": "0.0.16",
20
- "@bpmnkit/connector-gen": "0.0.8",
21
- "@bpmnkit/core": "0.0.16",
22
- "@bpmnkit/engine": "0.1.15",
23
- "@bpmnkit/profiles": "0.0.11"
18
+ "@bpmnkit/api": "0.0.16",
19
+ "@bpmnkit/connector-gen": "0.0.11",
20
+ "@bpmnkit/ascii": "0.0.20",
21
+ "@bpmnkit/core": "0.0.20",
22
+ "@bpmnkit/engine": "0.1.19",
23
+ "@bpmnkit/profiles": "0.0.14",
24
+ "@bpmnkit/proxy": "0.0.21"
24
25
  },
25
26
  "publishConfig": {
26
27
  "access": "public"