@mmapp/react-compiler 0.1.0-alpha.7 → 0.1.0-alpha.9

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 (95) hide show
  1. package/dist/auth-3UK75242.mjs +17 -0
  2. package/dist/babel/index.d.mts +2 -2
  3. package/dist/babel/index.d.ts +2 -2
  4. package/dist/babel/index.js +27 -31
  5. package/dist/babel/index.mjs +1 -1
  6. package/dist/chunk-7T6Q5KAA.mjs +7506 -0
  7. package/dist/chunk-ABYPKRSB.mjs +215 -0
  8. package/dist/chunk-BZEXUPDH.mjs +175 -0
  9. package/dist/chunk-J3M4GUS7.mjs +161 -0
  10. package/dist/chunk-JRGFBWTN.mjs +2918 -0
  11. package/dist/chunk-R2DD5GTY.mjs +186 -0
  12. package/dist/chunk-UDDTWG5J.mjs +734 -0
  13. package/dist/chunk-VLTKQDJ3.mjs +244 -0
  14. package/dist/chunk-WVYY32LD.mjs +939 -0
  15. package/dist/chunk-XDVM4YHX.mjs +3450 -0
  16. package/dist/cli/index.js +4372 -3240
  17. package/dist/cli/index.mjs +77 -179
  18. package/dist/codemod/cli.js +1 -1
  19. package/dist/codemod/cli.mjs +1 -1
  20. package/dist/codemod/index.d.mts +3 -3
  21. package/dist/codemod/index.d.ts +3 -3
  22. package/dist/codemod/index.js +1 -1
  23. package/dist/codemod/index.mjs +1 -1
  24. package/dist/deploy-YAJGW6II.mjs +9 -0
  25. package/dist/dev-server-CrQ041KP.d.mts +79 -0
  26. package/dist/dev-server-CrQ041KP.d.ts +79 -0
  27. package/dist/dev-server.d.mts +2 -2
  28. package/dist/dev-server.d.ts +2 -2
  29. package/dist/dev-server.js +1240 -120
  30. package/dist/dev-server.mjs +4 -4
  31. package/dist/envelope-ChEkuHij.d.mts +265 -0
  32. package/dist/envelope-ChEkuHij.d.ts +265 -0
  33. package/dist/envelope.d.mts +2 -2
  34. package/dist/envelope.d.ts +2 -2
  35. package/dist/envelope.js +27 -31
  36. package/dist/envelope.mjs +2 -2
  37. package/dist/index-CEKyyazf.d.mts +104 -0
  38. package/dist/index-CEKyyazf.d.ts +104 -0
  39. package/dist/index.d.mts +8 -8
  40. package/dist/index.d.ts +8 -8
  41. package/dist/index.js +1512 -600
  42. package/dist/index.mjs +8 -8
  43. package/dist/init-7FJENUDK.mjs +407 -0
  44. package/dist/project-compiler-ZB4RUYVL.mjs +10 -0
  45. package/dist/project-decompiler-U55HQUHW.mjs +7 -0
  46. package/dist/pull-KOL2QAYQ.mjs +109 -0
  47. package/dist/seed-KOGEPGOJ.mjs +154 -0
  48. package/dist/server-VW6UPCHO.mjs +277 -0
  49. package/dist/testing/index.d.mts +8 -8
  50. package/dist/testing/index.d.ts +8 -8
  51. package/dist/testing/index.js +27 -31
  52. package/dist/testing/index.mjs +1 -1
  53. package/dist/verify-OQDEQYMS.mjs +1833 -0
  54. package/dist/vite/index.d.mts +1 -1
  55. package/dist/vite/index.d.ts +1 -1
  56. package/dist/vite/index.js +27 -31
  57. package/dist/vite/index.mjs +2 -2
  58. package/examples/authentication/main.workflow.tsx +1 -1
  59. package/examples/authentication/mm.config.ts +1 -1
  60. package/examples/authentication/pages/LoginPage.tsx +2 -2
  61. package/examples/authentication/pages/SignupPage.tsx +2 -2
  62. package/examples/counter.workflow.tsx +1 -1
  63. package/examples/dashboard.workflow.tsx +1 -1
  64. package/examples/invoice-approval/actions/invoice.server.ts +1 -1
  65. package/examples/invoice-approval/main.workflow.tsx +1 -1
  66. package/examples/invoice-approval/mm.config.ts +1 -1
  67. package/examples/invoice-approval/pages/InvoiceDetailPage.tsx +1 -1
  68. package/examples/invoice-approval/pages/InvoiceFormPage.tsx +1 -1
  69. package/examples/invoice-approval/pages/InvoiceListPage.tsx +1 -1
  70. package/examples/todo-app.workflow.tsx +1 -1
  71. package/examples/uber-app/actions/matching.server.ts +1 -1
  72. package/examples/uber-app/actions/notifications.server.ts +1 -1
  73. package/examples/uber-app/actions/payments.server.ts +1 -1
  74. package/examples/uber-app/actions/pricing.server.ts +1 -1
  75. package/examples/uber-app/app/admin/analytics.tsx +2 -2
  76. package/examples/uber-app/app/admin/fleet.tsx +2 -2
  77. package/examples/uber-app/app/admin/surge-pricing.tsx +2 -2
  78. package/examples/uber-app/app/driver/dashboard.tsx +2 -2
  79. package/examples/uber-app/app/driver/earnings.tsx +2 -2
  80. package/examples/uber-app/app/driver/navigation.tsx +2 -2
  81. package/examples/uber-app/app/driver/ride-acceptance.tsx +2 -2
  82. package/examples/uber-app/app/rider/home.tsx +2 -2
  83. package/examples/uber-app/app/rider/payment-methods.tsx +2 -2
  84. package/examples/uber-app/app/rider/ride-history.tsx +2 -2
  85. package/examples/uber-app/app/rider/ride-tracking.tsx +2 -2
  86. package/examples/uber-app/components/DriverCard.tsx +1 -1
  87. package/examples/uber-app/components/MapView.tsx +3 -3
  88. package/examples/uber-app/components/RatingStars.tsx +2 -2
  89. package/examples/uber-app/components/RideCard.tsx +1 -1
  90. package/examples/uber-app/mm.config.ts +1 -1
  91. package/examples/uber-app/workflows/dispute-resolution.workflow.tsx +2 -2
  92. package/examples/uber-app/workflows/driver-onboarding.workflow.tsx +2 -2
  93. package/examples/uber-app/workflows/payment-processing.workflow.tsx +2 -2
  94. package/examples/uber-app/workflows/ride-request.workflow.tsx +2 -2
  95. package/package.json +7 -14
@@ -0,0 +1,154 @@
1
+ import "./chunk-CIESM3BP.mjs";
2
+
3
+ // src/cli/seed.ts
4
+ import { readFileSync } from "fs";
5
+ import { glob } from "glob";
6
+ var FIRST_NAMES = ["Alice", "Bob", "Charlie", "Diana", "Eve", "Frank", "Grace", "Henry"];
7
+ var LAST_NAMES = ["Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia", "Miller", "Davis"];
8
+ var COMPANIES = ["Acme Corp", "TechStart Inc", "GlobalTrade Ltd", "DataFlow Systems", "CloudPeak"];
9
+ var LOREM_WORDS = ["lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit", "sed", "do", "eiusmod", "tempor"];
10
+ var DOMAINS = ["example.com", "test.org", "demo.io", "sample.net"];
11
+ var _counter = 0;
12
+ function randomInt(min, max) {
13
+ return Math.floor(Math.random() * (max - min + 1)) + min;
14
+ }
15
+ function randomPick(arr) {
16
+ return arr[Math.floor(Math.random() * arr.length)];
17
+ }
18
+ function loremSentence(words = 5) {
19
+ const result = [];
20
+ for (let i = 0; i < words; i++) result.push(randomPick(LOREM_WORDS));
21
+ const s = result.join(" ");
22
+ return s.charAt(0).toUpperCase() + s.slice(1);
23
+ }
24
+ function generateFieldValue(field, index) {
25
+ if (field.default_value !== void 0 && field.default_value !== null) {
26
+ return field.default_value;
27
+ }
28
+ if (field.options && field.options.length > 0) {
29
+ return field.options[index % field.options.length].value;
30
+ }
31
+ const ft = (field.field_type ?? field.type ?? "text").toLowerCase();
32
+ switch (ft) {
33
+ case "text":
34
+ case "string":
35
+ case "textarea":
36
+ case "rich_text": {
37
+ const name = field.name.toLowerCase();
38
+ if (name.includes("email")) return `${randomPick(FIRST_NAMES).toLowerCase()}${++_counter}@${randomPick(DOMAINS)}`;
39
+ if (name.includes("name") && name.includes("first")) return randomPick(FIRST_NAMES);
40
+ if (name.includes("name") && name.includes("last")) return randomPick(LAST_NAMES);
41
+ if (name.includes("name") || name === "title") return `${randomPick(FIRST_NAMES)} ${randomPick(LAST_NAMES)}`;
42
+ if (name.includes("company") || name.includes("org")) return randomPick(COMPANIES);
43
+ if (name.includes("phone")) return `+1-555-${randomInt(100, 999)}-${randomInt(1e3, 9999)}`;
44
+ if (name.includes("url") || name.includes("website")) return `https://${randomPick(DOMAINS)}/${field.name}`;
45
+ if (name.includes("description") || name.includes("note") || name.includes("comment")) return loremSentence(randomInt(8, 15));
46
+ if (name.includes("address")) return `${randomInt(100, 9999)} ${loremSentence(2)} St`;
47
+ return loremSentence(randomInt(2, 5));
48
+ }
49
+ case "number":
50
+ case "numeric":
51
+ case "integer":
52
+ case "int": {
53
+ const name = field.name.toLowerCase();
54
+ if (name.includes("price") || name.includes("amount") || name.includes("cost") || name.includes("salary"))
55
+ return randomInt(1e3, 99999) / 100;
56
+ if (name.includes("age")) return randomInt(18, 65);
57
+ if (name.includes("quantity") || name.includes("count") || name.includes("qty")) return randomInt(1, 100);
58
+ if (name.includes("percent") || name.includes("rate")) return randomInt(1, 100);
59
+ return randomInt(1, 1e3);
60
+ }
61
+ case "currency":
62
+ case "decimal":
63
+ return randomInt(100, 999999) / 100;
64
+ case "boolean":
65
+ case "bool":
66
+ case "checkbox":
67
+ case "toggle":
68
+ return index % 2 === 0;
69
+ case "date":
70
+ case "datetime":
71
+ case "timestamptz": {
72
+ const d = /* @__PURE__ */ new Date();
73
+ d.setDate(d.getDate() - randomInt(0, 365));
74
+ return d.toISOString().split("T")[0];
75
+ }
76
+ case "select":
77
+ case "enum":
78
+ case "multi_select":
79
+ return field.options?.[index % (field.options?.length || 1)]?.value ?? "option_1";
80
+ case "email":
81
+ return `${randomPick(FIRST_NAMES).toLowerCase()}${++_counter}@${randomPick(DOMAINS)}`;
82
+ case "url":
83
+ return `https://${randomPick(DOMAINS)}/${field.name}`;
84
+ case "json":
85
+ case "object":
86
+ return {};
87
+ case "array":
88
+ return [];
89
+ default:
90
+ return loremSentence(3);
91
+ }
92
+ }
93
+ function generateInstanceData(fields, index) {
94
+ const data = {};
95
+ for (const field of fields) {
96
+ if (field.name === "id" || field.name === "created_at" || field.name === "updated_at") continue;
97
+ data[field.name] = generateFieldValue(field, index);
98
+ }
99
+ return data;
100
+ }
101
+ async function seedInstances(options) {
102
+ const dir = options.dir ?? "dist/workflows";
103
+ const count = options.count ?? 7;
104
+ const result = { created: 0, definitions: 0, errors: [] };
105
+ const files = await glob(`${dir}/**/*.workflow.json`);
106
+ if (files.length === 0) return result;
107
+ for (const file of files) {
108
+ let def;
109
+ try {
110
+ def = JSON.parse(readFileSync(file, "utf-8"));
111
+ } catch {
112
+ continue;
113
+ }
114
+ if (!def.slug || !def.fields || def.fields.length === 0) continue;
115
+ const startState = def.states?.find((s) => s.state_type === "START")?.name ?? def.states?.[0]?.name ?? "initial";
116
+ let defCreated = 0;
117
+ for (let i = 0; i < count; i++) {
118
+ const stateData = generateInstanceData(def.fields, i);
119
+ try {
120
+ const resp = await fetch(`${options.apiUrl}/workflow/instances`, {
121
+ method: "POST",
122
+ headers: {
123
+ "Content-Type": "application/json",
124
+ "Authorization": `Bearer ${options.token}`
125
+ },
126
+ body: JSON.stringify({
127
+ definition_slug: def.slug,
128
+ initial_state: startState,
129
+ state_data: stateData
130
+ })
131
+ });
132
+ if (resp.ok) {
133
+ defCreated++;
134
+ } else {
135
+ const errText = await resp.text().catch(() => resp.statusText);
136
+ result.errors.push(`${def.slug}[${i}]: ${resp.status} ${errText}`);
137
+ }
138
+ } catch (e) {
139
+ result.errors.push(`${def.slug}[${i}]: ${e instanceof Error ? e.message : String(e)}`);
140
+ }
141
+ }
142
+ if (defCreated > 0) {
143
+ result.definitions++;
144
+ result.created += defCreated;
145
+ console.log(` [seed] ${def.slug}: ${defCreated} instances created`);
146
+ }
147
+ }
148
+ return result;
149
+ }
150
+ export {
151
+ generateFieldValue,
152
+ generateInstanceData,
153
+ seedInstances
154
+ };
@@ -0,0 +1,277 @@
1
+ import {
2
+ __require
3
+ } from "./chunk-CIESM3BP.mjs";
4
+
5
+ // src/cli/server.ts
6
+ import { existsSync, readFileSync, writeFileSync } from "fs";
7
+ import { resolve } from "path";
8
+ var BINARY_SEARCH_PATHS = [
9
+ "engine/target/release/mm-server",
10
+ "engine/target/debug/mm-server",
11
+ "mm-core/target/release/mm-server",
12
+ "mm-core/target/debug/mm-server",
13
+ "target/release/mm-server",
14
+ "target/debug/mm-server"
15
+ ];
16
+ function findServerBinary(explicitPath) {
17
+ if (explicitPath) {
18
+ return existsSync(explicitPath) ? explicitPath : null;
19
+ }
20
+ for (const rel of BINARY_SEARCH_PATHS) {
21
+ const abs = resolve(process.cwd(), rel);
22
+ if (existsSync(abs)) return abs;
23
+ }
24
+ try {
25
+ const { execSync } = __require("child_process");
26
+ const result = execSync("which mm-server 2>/dev/null || which mm-api 2>/dev/null", {
27
+ encoding: "utf-8",
28
+ timeout: 5e3
29
+ }).trim();
30
+ if (result) return result;
31
+ } catch {
32
+ }
33
+ return null;
34
+ }
35
+ async function serverStart(options) {
36
+ const binary = findServerBinary(options.binary);
37
+ if (!binary) {
38
+ console.error("[mmrc] Error: MindMatrix server binary not found.\n");
39
+ console.error("To get the server binary, choose one of:");
40
+ console.error("");
41
+ console.error(" 1. Build from source:");
42
+ console.error(" cd engine && cargo build --release -p mm-api");
43
+ console.error("");
44
+ console.error(" 2. Docker:");
45
+ console.error(" docker pull mindmatrix/mm-server:latest");
46
+ console.error(" docker run -p 4200:4200 mindmatrix/mm-server:latest");
47
+ console.error("");
48
+ console.error(" 3. Download from releases:");
49
+ console.error(" https://github.com/mindmatrix/mm-server/releases");
50
+ console.error("");
51
+ console.error(" 4. Specify path directly:");
52
+ console.error(" mmrc server start --binary /path/to/mm-server");
53
+ process.exit(1);
54
+ }
55
+ console.log(`[mmrc] Starting server: ${binary}`);
56
+ const args = [];
57
+ const configPath = options.config ?? findConfigFile();
58
+ if (configPath) {
59
+ args.push("--config", configPath);
60
+ console.log(`[mmrc] Config: ${configPath}`);
61
+ }
62
+ if (options.port) {
63
+ process.env.PORT = String(options.port);
64
+ console.log(`[mmrc] Port: ${options.port}`);
65
+ }
66
+ if (options.migrate) {
67
+ console.log("[mmrc] Running migrations...");
68
+ process.env.MM_RUN_MIGRATIONS = "true";
69
+ }
70
+ const { spawn } = __require("child_process");
71
+ const child = spawn(binary, args, {
72
+ stdio: "inherit",
73
+ env: { ...process.env, MM_CONFIG_PATH: configPath ?? "" }
74
+ });
75
+ child.on("error", (err) => {
76
+ console.error(`[mmrc] Failed to start server: ${err.message}`);
77
+ process.exit(1);
78
+ });
79
+ child.on("exit", (code) => {
80
+ process.exit(code ?? 0);
81
+ });
82
+ const forward = (signal) => {
83
+ process.on(signal, () => child.kill(signal));
84
+ };
85
+ forward("SIGINT");
86
+ forward("SIGTERM");
87
+ }
88
+ async function serverMigrate(options) {
89
+ const apiUrl = options.apiUrl ?? "http://localhost:4200";
90
+ try {
91
+ console.log(`[mmrc] Requesting migration on ${apiUrl}...`);
92
+ const res = await fetch(`${apiUrl}/api/v1/admin/migrate`, {
93
+ method: "POST",
94
+ headers: { "Content-Type": "application/json" }
95
+ });
96
+ if (res.ok) {
97
+ const data = await res.json();
98
+ console.log(`[mmrc] Migration complete: ${JSON.stringify(data)}`);
99
+ return;
100
+ }
101
+ if (res.status !== 404) {
102
+ console.warn(`[mmrc] Migration request failed: ${res.status}`);
103
+ }
104
+ } catch {
105
+ }
106
+ const binary = findServerBinary();
107
+ if (!binary) {
108
+ console.error("[mmrc] Error: Server not running and binary not found.");
109
+ console.error(" Start the server first: mmrc server start");
110
+ console.error(" Or build from source: cd engine && cargo build --release -p mm-api");
111
+ process.exit(1);
112
+ }
113
+ console.log(`[mmrc] Running migrations via ${binary}...`);
114
+ const { execSync } = __require("child_process");
115
+ try {
116
+ const configPath = options.config ?? findConfigFile();
117
+ const env = { ...process.env, MM_RUN_MIGRATIONS: "true" };
118
+ if (configPath) env.MM_CONFIG_PATH = configPath;
119
+ execSync(`${binary} --migrate-only`, { stdio: "inherit", env });
120
+ console.log("[mmrc] Migrations complete.");
121
+ } catch (e) {
122
+ console.error(`[mmrc] Migration failed: ${e.message}`);
123
+ process.exit(1);
124
+ }
125
+ }
126
+ function serverInit(options) {
127
+ const output = options.output ?? "mm-server.toml";
128
+ const mode = options.mode ?? "standalone";
129
+ const db = options.db ?? "$env:DATABASE_URL";
130
+ if (existsSync(output) && output !== "/dev/stdout") {
131
+ console.error(`[mmrc] Error: ${output} already exists. Use --output to specify a different path.`);
132
+ process.exit(1);
133
+ }
134
+ const content = generateServerToml(mode, db);
135
+ writeFileSync(output, content, "utf-8");
136
+ console.log(`[mmrc] Generated ${output} (mode: ${mode})`);
137
+ console.log(`[mmrc] Edit the file, then run: mmrc server start`);
138
+ }
139
+ function generateServerToml(mode = "standalone", db = "$env:DATABASE_URL") {
140
+ const lines = [];
141
+ lines.push(`# MindMatrix Server Configuration`);
142
+ lines.push(`# Generated by: mmrc server init --mode ${mode}`);
143
+ lines.push(`# Docs: https://docs.mindmatrix.dev/server/configuration`);
144
+ lines.push(`#`);
145
+ lines.push(`# Environment variables can be referenced as $env:VAR_NAME`);
146
+ lines.push(``);
147
+ lines.push(`[server]`);
148
+ lines.push(`# Server mode: "standalone" (all-in-one), "gateway" (API + routing), "worker" (action execution)`);
149
+ lines.push(`mode = "${mode}"`);
150
+ lines.push(`# Listen port (also configurable via PORT env var)`);
151
+ lines.push(`port = 4200`);
152
+ lines.push(`# Bind address`);
153
+ lines.push(`host = "0.0.0.0"`);
154
+ lines.push(``);
155
+ lines.push(`[database]`);
156
+ lines.push(`# PostgreSQL connection URL`);
157
+ lines.push(`url = "${db}"`);
158
+ lines.push(`# Connection pool size`);
159
+ lines.push(`max_connections = 10`);
160
+ lines.push(``);
161
+ lines.push(`[auth]`);
162
+ lines.push(`# JWT signing secret (also configurable via JWT_SECRET env var)`);
163
+ lines.push(`jwt_secret = "$env:JWT_SECRET"`);
164
+ lines.push(``);
165
+ lines.push(`[telemetry]`);
166
+ lines.push(`# Log output format: "pretty" (human-readable) or "json" (structured)`);
167
+ lines.push(`log_format = "pretty"`);
168
+ lines.push(`# Log level filter (RUST_LOG syntax)`);
169
+ lines.push(`log_level = "mm_api=info,mm_storage=info,mm_engine=info"`);
170
+ lines.push(`# OpenTelemetry OTLP endpoint (optional \u2014 enables distributed tracing)`);
171
+ lines.push(`# otlp_endpoint = "http://localhost:4317"`);
172
+ lines.push(``);
173
+ if (mode === "gateway") {
174
+ lines.push(`[gateway]`);
175
+ lines.push(`# Worker pool for routing action execution`);
176
+ lines.push(`pool = "default"`);
177
+ lines.push(`# Maximum concurrent actions per worker`);
178
+ lines.push(`max_concurrent = 16`);
179
+ lines.push(`# Worker heartbeat interval`);
180
+ lines.push(`heartbeat = "30s"`);
181
+ lines.push(``);
182
+ }
183
+ if (mode !== "standalone") {
184
+ lines.push(`[redis]`);
185
+ lines.push(`# Redis URL for cross-instance communication`);
186
+ lines.push(`url = "$env:REDIS_URL"`);
187
+ lines.push(``);
188
+ }
189
+ lines.push(`[secrets]`);
190
+ lines.push(`# Secret provider: "env" (environment variables) or "vault" (HashiCorp Vault)`);
191
+ lines.push(`provider = "env"`);
192
+ lines.push(``);
193
+ lines.push(`# \u2500\u2500 Services \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
194
+ lines.push(`# Register external services for action routing.`);
195
+ lines.push(`# Each [[services]] block declares a service that can handle workflow actions.`);
196
+ lines.push(`#`);
197
+ lines.push(`# [[services]]`);
198
+ lines.push(`# name = "email"`);
199
+ lines.push(`# type = "webhook"`);
200
+ lines.push(`# url = "https://hooks.example.com/email"`);
201
+ lines.push(`# actions = ["send_email", "send_sms"]`);
202
+ lines.push(`# [services.labels]`);
203
+ lines.push(`# tier = "essential"`);
204
+ lines.push(``);
205
+ return lines.join("\n");
206
+ }
207
+ async function serverStatus(options) {
208
+ const apiUrl = options.apiUrl ?? "http://localhost:4200";
209
+ console.log(`[mmrc] Checking server at ${apiUrl}...`);
210
+ try {
211
+ const res = await fetch(`${apiUrl}/health`, { signal: AbortSignal.timeout(5e3) });
212
+ if (!res.ok) {
213
+ const result2 = {
214
+ reachable: true,
215
+ status: `unhealthy (HTTP ${res.status})`
216
+ };
217
+ console.log(`[mmrc] Server: ${result2.status}`);
218
+ return result2;
219
+ }
220
+ const data = await res.json();
221
+ const result = {
222
+ reachable: true,
223
+ status: data.status ?? "ok",
224
+ version: data.version,
225
+ uptime: data.uptime,
226
+ database: data.database ?? data.db ?? void 0
227
+ };
228
+ console.log(`[mmrc] Server: ${result.status}`);
229
+ if (result.version) console.log(`[mmrc] Version: ${result.version}`);
230
+ if (result.uptime) console.log(`[mmrc] Uptime: ${result.uptime}`);
231
+ if (result.database) console.log(`[mmrc] Database: ${result.database}`);
232
+ return result;
233
+ } catch (e) {
234
+ const error = e.message;
235
+ const result = { reachable: false, error };
236
+ console.error(`[mmrc] Server unreachable: ${error}`);
237
+ console.error(`[mmrc] Is the server running? Try: mmrc server start`);
238
+ return result;
239
+ }
240
+ }
241
+ function serverConfig(options) {
242
+ const configPath = options.config ?? findConfigFile();
243
+ if (!configPath) {
244
+ console.log("[mmrc] No mm-server.toml found.");
245
+ console.log("[mmrc] Generate one with: mmrc server init");
246
+ return;
247
+ }
248
+ console.log(`[mmrc] Config file: ${configPath}
249
+ `);
250
+ const raw = readFileSync(configPath, "utf-8");
251
+ const resolved = raw.replace(/\$env:(\w+)/g, (_match, varName) => {
252
+ const val = process.env[varName];
253
+ return val ? `${val} # \u2190 $env:${varName}` : `(unset) # \u2190 $env:${varName}`;
254
+ });
255
+ console.log(resolved);
256
+ }
257
+ function findConfigFile() {
258
+ const candidates = [
259
+ "mm-server.toml",
260
+ "engine/mm-server.toml",
261
+ "mm-core/mm-server.toml"
262
+ ];
263
+ for (const c of candidates) {
264
+ const abs = resolve(process.cwd(), c);
265
+ if (existsSync(abs)) return abs;
266
+ }
267
+ return null;
268
+ }
269
+ export {
270
+ findServerBinary,
271
+ generateServerToml,
272
+ serverConfig,
273
+ serverInit,
274
+ serverMigrate,
275
+ serverStart,
276
+ serverStatus
277
+ };
@@ -1,5 +1,5 @@
1
- import * as _mindmatrix_player_core from '@mindmatrix/player-core';
2
- import { IRWorkflowDefinition } from '@mindmatrix/player-core';
1
+ import * as _mmapp_player_core from '@mmapp/player-core';
2
+ import { IRWorkflowDefinition } from '@mmapp/player-core';
3
3
 
4
4
  interface CompileOptions {
5
5
  /** Compilation mode. Default: 'infer' */
@@ -39,7 +39,7 @@ declare function compileRaw(code: string, options?: CompileOptions): {
39
39
  /**
40
40
  * Mock blueprint context for testing workflow components.
41
41
  *
42
- * Provides the minimal context shape that @mindmatrix/react hooks expect.
42
+ * Provides the minimal context shape that @mmapp/react hooks expect.
43
43
  * Does NOT render React — this is a data-only mock for unit testing IR output.
44
44
  */
45
45
  interface MockBlueprintProviderProps {
@@ -99,9 +99,9 @@ declare function createMockWorkflowContext(props?: MockWorkflowProviderProps): {
99
99
  /**
100
100
  * Convenience: compile + extract specific parts of the IR.
101
101
  */
102
- declare function extractFields(code: string, options?: CompileOptions): _mindmatrix_player_core.IRFieldDefinition[];
103
- declare function extractStates(code: string, options?: CompileOptions): _mindmatrix_player_core.IRStateDefinition[];
104
- declare function extractTransitions(code: string, options?: CompileOptions): _mindmatrix_player_core.IRTransitionDefinition[];
102
+ declare function extractFields(code: string, options?: CompileOptions): _mmapp_player_core.IRFieldDefinition[];
103
+ declare function extractStates(code: string, options?: CompileOptions): _mmapp_player_core.IRStateDefinition[];
104
+ declare function extractTransitions(code: string, options?: CompileOptions): _mmapp_player_core.IRTransitionDefinition[];
105
105
 
106
106
  /**
107
107
  * IR Snapshot Utilities — snapshot and compare compiled IR for regression testing.
@@ -111,7 +111,7 @@ declare function extractTransitions(code: string, options?: CompileOptions): _mi
111
111
  * toMatchIR() matcher.
112
112
  *
113
113
  * Usage:
114
- * import { snapshotIR, installIRMatchers } from '@mindmatrix/react-compiler/testing';
114
+ * import { snapshotIR, installIRMatchers } from '@mmapp/react-compiler/testing';
115
115
  *
116
116
  * // In vitest setup or test file:
117
117
  * installIRMatchers();
@@ -203,7 +203,7 @@ interface IRMatcher {
203
203
  * Install the toMatchIR() custom matcher into vitest's expect.
204
204
  *
205
205
  * Call this once in your test setup file or at the top of a test file:
206
- * import { installIRMatchers } from '@mindmatrix/react-compiler/testing';
206
+ * import { installIRMatchers } from '@mmapp/react-compiler/testing';
207
207
  * installIRMatchers();
208
208
  */
209
209
  declare function installIRMatchers(): void;
@@ -1,5 +1,5 @@
1
- import * as _mindmatrix_player_core from '@mindmatrix/player-core';
2
- import { IRWorkflowDefinition } from '@mindmatrix/player-core';
1
+ import * as _mmapp_player_core from '@mmapp/player-core';
2
+ import { IRWorkflowDefinition } from '@mmapp/player-core';
3
3
 
4
4
  interface CompileOptions {
5
5
  /** Compilation mode. Default: 'infer' */
@@ -39,7 +39,7 @@ declare function compileRaw(code: string, options?: CompileOptions): {
39
39
  /**
40
40
  * Mock blueprint context for testing workflow components.
41
41
  *
42
- * Provides the minimal context shape that @mindmatrix/react hooks expect.
42
+ * Provides the minimal context shape that @mmapp/react hooks expect.
43
43
  * Does NOT render React — this is a data-only mock for unit testing IR output.
44
44
  */
45
45
  interface MockBlueprintProviderProps {
@@ -99,9 +99,9 @@ declare function createMockWorkflowContext(props?: MockWorkflowProviderProps): {
99
99
  /**
100
100
  * Convenience: compile + extract specific parts of the IR.
101
101
  */
102
- declare function extractFields(code: string, options?: CompileOptions): _mindmatrix_player_core.IRFieldDefinition[];
103
- declare function extractStates(code: string, options?: CompileOptions): _mindmatrix_player_core.IRStateDefinition[];
104
- declare function extractTransitions(code: string, options?: CompileOptions): _mindmatrix_player_core.IRTransitionDefinition[];
102
+ declare function extractFields(code: string, options?: CompileOptions): _mmapp_player_core.IRFieldDefinition[];
103
+ declare function extractStates(code: string, options?: CompileOptions): _mmapp_player_core.IRStateDefinition[];
104
+ declare function extractTransitions(code: string, options?: CompileOptions): _mmapp_player_core.IRTransitionDefinition[];
105
105
 
106
106
  /**
107
107
  * IR Snapshot Utilities — snapshot and compare compiled IR for regression testing.
@@ -111,7 +111,7 @@ declare function extractTransitions(code: string, options?: CompileOptions): _mi
111
111
  * toMatchIR() matcher.
112
112
  *
113
113
  * Usage:
114
- * import { snapshotIR, installIRMatchers } from '@mindmatrix/react-compiler/testing';
114
+ * import { snapshotIR, installIRMatchers } from '@mmapp/react-compiler/testing';
115
115
  *
116
116
  * // In vitest setup or test file:
117
117
  * installIRMatchers();
@@ -203,7 +203,7 @@ interface IRMatcher {
203
203
  * Install the toMatchIR() custom matcher into vitest's expect.
204
204
  *
205
205
  * Call this once in your test setup file or at the top of a test file:
206
- * import { installIRMatchers } from '@mindmatrix/react-compiler/testing';
206
+ * import { installIRMatchers } from '@mmapp/react-compiler/testing';
207
207
  * installIRMatchers();
208
208
  */
209
209
  declare function installIRMatchers(): void;