@mmapp/react-compiler 0.1.0-alpha.12 → 0.1.0-alpha.13

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/index.js CHANGED
@@ -16576,6 +16576,20 @@ async function init(options) {
16576
16576
  console.error(`[mmrc] Error: Directory already exists: ${blueprintDir}`);
16577
16577
  process.exit(1);
16578
16578
  }
16579
+ try {
16580
+ const pkgPath = require.resolve("@mmapp/react-compiler/package.json");
16581
+ const { version } = require(pkgPath);
16582
+ console.log(`[mmrc] v${version}`);
16583
+ } catch {
16584
+ try {
16585
+ const { readFileSync: readFileSync11 } = require("fs");
16586
+ const { resolve: resolve7, dirname: dirname4 } = require("path");
16587
+ const pkg = JSON.parse(readFileSync11(resolve7(__dirname, "../../package.json"), "utf-8"));
16588
+ console.log(`[mmrc] v${pkg.version}`);
16589
+ } catch {
16590
+ console.log(`[mmrc]`);
16591
+ }
16592
+ }
16579
16593
  console.log(`[mmrc] Creating blueprint: ${name}
16580
16594
  `);
16581
16595
  (0, import_fs10.mkdirSync)((0, import_path8.join)(blueprintDir, "models"), { recursive: true });
@@ -19270,63 +19284,67 @@ async function main() {
19270
19284
  force: true,
19271
19285
  version: getFlag("--engine-version") ?? "latest"
19272
19286
  });
19273
- if (!installed.path) {
19274
- console.error("[mmrc] Could not obtain a working engine binary.");
19275
- process.exit(1);
19287
+ if (installed.path) {
19288
+ resolution = installed;
19276
19289
  }
19277
- resolution = installed;
19278
19290
  }
19279
- console.log(`[mmrc] Starting local engine: ${resolution.path} (${resolution.source})`);
19280
- const { spawn: spawnProcess } = require("child_process");
19281
- engineProcess = spawnProcess(resolution.path, [], {
19282
- stdio: ["ignore", "pipe", "pipe"],
19283
- env: {
19284
- ...process.env,
19285
- DATABASE_URL: `sqlite://${process.cwd()}/dev.db`,
19286
- JWT_SECRET: "dev-secret-mmrc-local",
19287
- PORT: String(apiPort),
19288
- RUST_LOG: "mm_api=info,mm_storage=info"
19289
- }
19290
- });
19291
- if (engineProcess.stdout) {
19292
- engineProcess.stdout.on("data", (data) => {
19293
- for (const line of data.toString().split("\n").filter(Boolean)) {
19294
- console.log(` [engine] ${line}`);
19291
+ if (!resolution.path) {
19292
+ console.log("[mmrc] No local engine binary available.");
19293
+ console.log("[mmrc] Dev server will connect to a remote API or start in-memory mode.");
19294
+ console.log("[mmrc] (For full local mode: `mmrc engine install` or `mmrc engine build`)\n");
19295
+ } else {
19296
+ console.log(`[mmrc] Starting local engine: ${resolution.path} (${resolution.source})`);
19297
+ const { spawn: spawnProcess } = require("child_process");
19298
+ engineProcess = spawnProcess(resolution.path, [], {
19299
+ stdio: ["ignore", "pipe", "pipe"],
19300
+ env: {
19301
+ ...process.env,
19302
+ DATABASE_URL: `sqlite://${process.cwd()}/dev.db`,
19303
+ JWT_SECRET: "dev-secret-mmrc-local",
19304
+ PORT: String(apiPort),
19305
+ RUST_LOG: "mm_api=info,mm_storage=info"
19295
19306
  }
19296
19307
  });
19297
- }
19298
- if (engineProcess.stderr) {
19299
- engineProcess.stderr.on("data", (data) => {
19300
- for (const line of data.toString().split("\n").filter(Boolean)) {
19301
- console.error(` [engine] ${line}`);
19302
- }
19308
+ if (engineProcess.stdout) {
19309
+ engineProcess.stdout.on("data", (data) => {
19310
+ for (const line of data.toString().split("\n").filter(Boolean)) {
19311
+ console.log(` [engine] ${line}`);
19312
+ }
19313
+ });
19314
+ }
19315
+ if (engineProcess.stderr) {
19316
+ engineProcess.stderr.on("data", (data) => {
19317
+ for (const line of data.toString().split("\n").filter(Boolean)) {
19318
+ console.error(` [engine] ${line}`);
19319
+ }
19320
+ });
19321
+ }
19322
+ engineProcess.on("error", (err) => {
19323
+ console.error(`[mmrc] Engine failed to start: ${err.message}`);
19324
+ process.exit(1);
19303
19325
  });
19304
- }
19305
- engineProcess.on("error", (err) => {
19306
- console.error(`[mmrc] Engine failed to start: ${err.message}`);
19307
- process.exit(1);
19308
- });
19309
- const healthUrl = `http://localhost:${apiPort}/health`;
19310
- let healthy = false;
19311
- for (let i = 0; i < 30; i++) {
19312
- try {
19313
- const res = await fetch(healthUrl, { signal: AbortSignal.timeout(500) });
19314
- if (res.ok) {
19315
- healthy = true;
19316
- break;
19326
+ const healthUrl = `http://localhost:${apiPort}/health`;
19327
+ let healthy = false;
19328
+ for (let i = 0; i < 30; i++) {
19329
+ try {
19330
+ const res = await fetch(healthUrl, { signal: AbortSignal.timeout(500) });
19331
+ if (res.ok) {
19332
+ healthy = true;
19333
+ break;
19334
+ }
19335
+ } catch {
19317
19336
  }
19318
- } catch {
19337
+ await new Promise((r) => setTimeout(r, 500));
19319
19338
  }
19320
- await new Promise((r) => setTimeout(r, 500));
19321
- }
19322
- if (!healthy) {
19323
- console.error("[mmrc] Engine failed to become healthy within 15s.");
19324
- engineProcess.kill();
19325
- process.exit(1);
19339
+ if (!healthy) {
19340
+ console.error("[mmrc] Engine failed to become healthy within 15s.");
19341
+ engineProcess.kill();
19342
+ process.exit(1);
19343
+ }
19344
+ console.log(`[mmrc] Engine healthy at http://localhost:${apiPort}`);
19326
19345
  }
19327
- console.log(`[mmrc] Engine healthy at http://localhost:${apiPort}`);
19328
19346
  }
19329
- const apiUrl = isLocal ? `http://localhost:${apiPort}/api/v1` : explicitApiUrl;
19347
+ const apiUrl = engineProcess ? `http://localhost:${apiPort}/api/v1` : explicitApiUrl || "auto";
19330
19348
  const { createDevServer: createDevServer2 } = await Promise.resolve().then(() => (init_dev_server(), dev_server_exports));
19331
19349
  const server = await createDevServer2({
19332
19350
  port,
@@ -363,63 +363,67 @@ async function main() {
363
363
  force: true,
364
364
  version: getFlag("--engine-version") ?? "latest"
365
365
  });
366
- if (!installed.path) {
367
- console.error("[mmrc] Could not obtain a working engine binary.");
368
- process.exit(1);
366
+ if (installed.path) {
367
+ resolution = installed;
369
368
  }
370
- resolution = installed;
371
369
  }
372
- console.log(`[mmrc] Starting local engine: ${resolution.path} (${resolution.source})`);
373
- const { spawn: spawnProcess } = __require("child_process");
374
- engineProcess = spawnProcess(resolution.path, [], {
375
- stdio: ["ignore", "pipe", "pipe"],
376
- env: {
377
- ...process.env,
378
- DATABASE_URL: `sqlite://${process.cwd()}/dev.db`,
379
- JWT_SECRET: "dev-secret-mmrc-local",
380
- PORT: String(apiPort),
381
- RUST_LOG: "mm_api=info,mm_storage=info"
382
- }
383
- });
384
- if (engineProcess.stdout) {
385
- engineProcess.stdout.on("data", (data) => {
386
- for (const line of data.toString().split("\n").filter(Boolean)) {
387
- console.log(` [engine] ${line}`);
370
+ if (!resolution.path) {
371
+ console.log("[mmrc] No local engine binary available.");
372
+ console.log("[mmrc] Dev server will connect to a remote API or start in-memory mode.");
373
+ console.log("[mmrc] (For full local mode: `mmrc engine install` or `mmrc engine build`)\n");
374
+ } else {
375
+ console.log(`[mmrc] Starting local engine: ${resolution.path} (${resolution.source})`);
376
+ const { spawn: spawnProcess } = __require("child_process");
377
+ engineProcess = spawnProcess(resolution.path, [], {
378
+ stdio: ["ignore", "pipe", "pipe"],
379
+ env: {
380
+ ...process.env,
381
+ DATABASE_URL: `sqlite://${process.cwd()}/dev.db`,
382
+ JWT_SECRET: "dev-secret-mmrc-local",
383
+ PORT: String(apiPort),
384
+ RUST_LOG: "mm_api=info,mm_storage=info"
388
385
  }
389
386
  });
390
- }
391
- if (engineProcess.stderr) {
392
- engineProcess.stderr.on("data", (data) => {
393
- for (const line of data.toString().split("\n").filter(Boolean)) {
394
- console.error(` [engine] ${line}`);
395
- }
387
+ if (engineProcess.stdout) {
388
+ engineProcess.stdout.on("data", (data) => {
389
+ for (const line of data.toString().split("\n").filter(Boolean)) {
390
+ console.log(` [engine] ${line}`);
391
+ }
392
+ });
393
+ }
394
+ if (engineProcess.stderr) {
395
+ engineProcess.stderr.on("data", (data) => {
396
+ for (const line of data.toString().split("\n").filter(Boolean)) {
397
+ console.error(` [engine] ${line}`);
398
+ }
399
+ });
400
+ }
401
+ engineProcess.on("error", (err) => {
402
+ console.error(`[mmrc] Engine failed to start: ${err.message}`);
403
+ process.exit(1);
396
404
  });
397
- }
398
- engineProcess.on("error", (err) => {
399
- console.error(`[mmrc] Engine failed to start: ${err.message}`);
400
- process.exit(1);
401
- });
402
- const healthUrl = `http://localhost:${apiPort}/health`;
403
- let healthy = false;
404
- for (let i = 0; i < 30; i++) {
405
- try {
406
- const res = await fetch(healthUrl, { signal: AbortSignal.timeout(500) });
407
- if (res.ok) {
408
- healthy = true;
409
- break;
405
+ const healthUrl = `http://localhost:${apiPort}/health`;
406
+ let healthy = false;
407
+ for (let i = 0; i < 30; i++) {
408
+ try {
409
+ const res = await fetch(healthUrl, { signal: AbortSignal.timeout(500) });
410
+ if (res.ok) {
411
+ healthy = true;
412
+ break;
413
+ }
414
+ } catch {
410
415
  }
411
- } catch {
416
+ await new Promise((r) => setTimeout(r, 500));
412
417
  }
413
- await new Promise((r) => setTimeout(r, 500));
414
- }
415
- if (!healthy) {
416
- console.error("[mmrc] Engine failed to become healthy within 15s.");
417
- engineProcess.kill();
418
- process.exit(1);
418
+ if (!healthy) {
419
+ console.error("[mmrc] Engine failed to become healthy within 15s.");
420
+ engineProcess.kill();
421
+ process.exit(1);
422
+ }
423
+ console.log(`[mmrc] Engine healthy at http://localhost:${apiPort}`);
419
424
  }
420
- console.log(`[mmrc] Engine healthy at http://localhost:${apiPort}`);
421
425
  }
422
- const apiUrl = isLocal ? `http://localhost:${apiPort}/api/v1` : explicitApiUrl;
426
+ const apiUrl = engineProcess ? `http://localhost:${apiPort}/api/v1` : explicitApiUrl || "auto";
423
427
  const { createDevServer } = await import("../dev-server.mjs");
424
428
  const server = await createDevServer({
425
429
  port,
@@ -560,7 +564,7 @@ async function main() {
560
564
  console.error('[mmrc] Error: name is required\n Usage: mmrc init <name> [--description "..."] [--icon "..."] [--author "..."]');
561
565
  process.exit(1);
562
566
  }
563
- const { init } = await import("../init-2CRSUGV5.mjs");
567
+ const { init } = await import("../init-DY6SJDRX.mjs");
564
568
  await init({
565
569
  name,
566
570
  description: getFlag("--description"),
@@ -0,0 +1,438 @@
1
+ import {
2
+ __require
3
+ } from "./chunk-CIESM3BP.mjs";
4
+
5
+ // src/cli/init.ts
6
+ import { mkdirSync, writeFileSync, existsSync } from "fs";
7
+ import { join } from "path";
8
+ import { execSync } from "child_process";
9
+ function toTitleCase(slug) {
10
+ return slug.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
11
+ }
12
+ function toPascalCase(slug) {
13
+ return slug.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
14
+ }
15
+ function generatePackageJson(name) {
16
+ return JSON.stringify(
17
+ {
18
+ name: `@mmapp/blueprint-${name}`,
19
+ version: "0.1.0",
20
+ private: true,
21
+ type: "module",
22
+ scripts: {
23
+ build: "mmrc build --src . --out dist",
24
+ dev: "mmrc dev --src . --port 5199",
25
+ deploy: "mmrc deploy --build --src ."
26
+ },
27
+ dependencies: {
28
+ "@mmapp/react": "^0.1.0-alpha.1",
29
+ "react": "^18.0.0",
30
+ "react-dom": "^18.0.0"
31
+ },
32
+ devDependencies: {
33
+ "typescript": "^5.5.0",
34
+ "@types/react": "^18.0.0",
35
+ "@types/react-dom": "^18.0.0",
36
+ "vite": "^6.0.0",
37
+ "@mmapp/react-compiler": "^0.1.0-alpha.1"
38
+ }
39
+ },
40
+ null,
41
+ 2
42
+ );
43
+ }
44
+ function generateMmConfig(name, opts) {
45
+ const title = toTitleCase(name);
46
+ const desc = opts.description ?? `${title} blueprint.`;
47
+ const icon = opts.icon ?? "box";
48
+ const author = opts.author ?? "MindMatrix";
49
+ return `import { defineBlueprint } from '@mmapp/react';
50
+
51
+ export default defineBlueprint({
52
+ slug: '${name}',
53
+ name: '${title}',
54
+ version: '1.0.0',
55
+ description: '${desc}',
56
+ author: '${author}',
57
+ icon: '${icon}',
58
+ mode: 'infer',
59
+ defaultRuntime: 'collaborative',
60
+
61
+ models: [
62
+ 'models/item',
63
+ ],
64
+
65
+ routes: [
66
+ { path: '/', view: 'app/page', label: 'Home' },
67
+ ],
68
+
69
+ dependencies: [],
70
+ });
71
+ `;
72
+ }
73
+ function generateModel(name) {
74
+ const modelSlug = `${name}-item`;
75
+ const pascal = toPascalCase(name);
76
+ return `/**
77
+ * ${pascal} Item \u2014 data model with lifecycle states.
78
+ *
79
+ * States: draft \u2192 active \u2192 archived
80
+ */
81
+
82
+ import { defineModel } from '@mmapp/react';
83
+
84
+ export interface ${pascal}ItemFields {
85
+ title: string;
86
+ description: string;
87
+ priority: 'low' | 'medium' | 'high';
88
+ createdAt: number;
89
+ }
90
+
91
+ export default defineModel({
92
+ slug: '${modelSlug}',
93
+ version: '1.0.0',
94
+ category: ['model', '${name}'],
95
+
96
+ fields: {
97
+ title: { type: 'string', required: true },
98
+ description: { type: 'string', default: '' },
99
+ priority: { type: 'string', default: 'medium', enum: ['low', 'medium', 'high'] },
100
+ createdAt: { type: 'number', default: 0 },
101
+ },
102
+
103
+ states: {
104
+ draft: {
105
+ type: 'initial',
106
+ onEnter: [
107
+ { id: 'set-created', type: 'set_field', mode: 'auto', config: { field: 'createdAt', expression: 'NOW()' } },
108
+ ],
109
+ },
110
+ active: {
111
+ onEnter: [
112
+ { id: 'log-activated', type: 'log_event', mode: 'auto', config: { event: '${modelSlug}.activated' } },
113
+ ],
114
+ },
115
+ archived: {
116
+ type: 'end',
117
+ },
118
+ },
119
+
120
+ transitions: {
121
+ activate: {
122
+ from: 'draft',
123
+ to: 'active',
124
+ description: 'Publish this item',
125
+ },
126
+ archive: {
127
+ from: 'active',
128
+ to: 'archived',
129
+ description: 'Archive this item',
130
+ },
131
+ },
132
+ });
133
+ `;
134
+ }
135
+ function generateTsconfig() {
136
+ return JSON.stringify(
137
+ {
138
+ compilerOptions: {
139
+ target: "ES2020",
140
+ module: "ESNext",
141
+ moduleResolution: "bundler",
142
+ jsx: "react-jsx",
143
+ strict: true,
144
+ esModuleInterop: true,
145
+ skipLibCheck: true,
146
+ forceConsistentCasingInFileNames: true,
147
+ declaration: false,
148
+ noEmit: true
149
+ },
150
+ include: ["**/*.ts", "**/*.tsx"],
151
+ exclude: ["node_modules", "dist"]
152
+ },
153
+ null,
154
+ 2
155
+ );
156
+ }
157
+ function generateLayout(name) {
158
+ const title = toTitleCase(name);
159
+ return `/**
160
+ * @workflow slug="${name}-layout" version="1.0.0" category="view"
161
+ *
162
+ * Root layout with sidebar navigation.
163
+ */
164
+
165
+ import {
166
+ Row,
167
+ Stack,
168
+ Slot,
169
+ Text,
170
+ Icon,
171
+ Button,
172
+ Divider,
173
+ } from '@mmapp/react/atoms';
174
+ import { useRouter } from '@mmapp/react';
175
+
176
+ export default function Layout({ children }: { children: React.ReactNode }) {
177
+ const router = useRouter();
178
+
179
+ return (
180
+ <Row gap={0} height="100vh" overflow="hidden">
181
+ {/* Sidebar */}
182
+ <Stack
183
+ width={240}
184
+ borderRight="1px solid token:border"
185
+ height="100vh"
186
+ background="token:surface"
187
+ >
188
+ <Row padding={12} gap={8} align="center" borderBottom="1px solid token:border">
189
+ <Icon name="box" size={20} color="token:primary" />
190
+ <Text variant="label" size="sm" value="${title}" />
191
+ </Row>
192
+
193
+ <Stack padding={8} gap={4}>
194
+ <Button variant="ghost" onPress={() => router.push('/')}>
195
+ <Row gap={8} align="center">
196
+ <Icon name="home" size={16} />
197
+ <Text size="sm" value="Home" />
198
+ </Row>
199
+ </Button>
200
+ <Button variant="ghost" onPress={() => router.push('/settings')}>
201
+ <Row gap={8} align="center">
202
+ <Icon name="settings" size={16} />
203
+ <Text size="sm" value="Settings" />
204
+ </Row>
205
+ </Button>
206
+ </Stack>
207
+
208
+ <Divider />
209
+ <Stack flex={1} />
210
+ <Row padding={12}>
211
+ <Text variant="muted" size="xs" value="v1.0.0" />
212
+ </Row>
213
+ </Stack>
214
+
215
+ {/* Main content */}
216
+ <Stack flex={1} overflow="auto">
217
+ {children}
218
+ </Stack>
219
+ </Row>
220
+ );
221
+ }
222
+ `;
223
+ }
224
+ function generatePage(name) {
225
+ const title = toTitleCase(name);
226
+ const pascal = toPascalCase(name);
227
+ return `/**
228
+ * @workflow slug="${name}-home" version="1.0.0" category="page"
229
+ *
230
+ * Index page \u2014 lists items with create and search.
231
+ */
232
+
233
+ import { useState } from 'react';
234
+ import itemModel from '../models/item';
235
+ import {
236
+ useQuery, useMutation, useRouter,
237
+ Stack, Row, Text, Button, Icon, Card, Show, TextInput, Badge,
238
+ } from '@mmapp/react';
239
+
240
+ const PRIORITY_COLORS: Record<string, string> = {
241
+ high: 'token:error',
242
+ medium: 'token:warning',
243
+ low: 'token:success',
244
+ };
245
+
246
+ export default function ${pascal}Home() {
247
+ const { data: items, loading } = useQuery(itemModel);
248
+ const mutation = useMutation(itemModel);
249
+ const router = useRouter();
250
+ const [search, setSearch] = useState('');
251
+
252
+ const activeItems = items.filter(i => i.state !== 'archived');
253
+ const filtered = activeItems.filter(i =>
254
+ i.fields.title.toLowerCase().includes(search.toLowerCase())
255
+ );
256
+
257
+ const handleCreate = async () => {
258
+ await mutation.create({ title: 'New Item', priority: 'medium' });
259
+ };
260
+
261
+ return (
262
+ <Stack gap={24} padding={24}>
263
+ {/* Header */}
264
+ <Row justify="space-between" align="center">
265
+ <Stack gap={4}>
266
+ <Text variant="h3" weight="bold" value="${title}" />
267
+ <Text variant="muted" size="sm" value={\`\${activeItems.length} items\`} />
268
+ </Stack>
269
+ <Button variant="primary" onPress={handleCreate}>
270
+ <Row gap={6} align="center">
271
+ <Icon name="plus" size={16} />
272
+ <Text value="Add Item" />
273
+ </Row>
274
+ </Button>
275
+ </Row>
276
+
277
+ {/* Search */}
278
+ <TextInput
279
+ value={search}
280
+ onChange={setSearch}
281
+ placeholder="Search items..."
282
+ />
283
+
284
+ {/* Loading */}
285
+ <Show when={loading}>
286
+ <Card padding={32}>
287
+ <Stack align="center">
288
+ <Text variant="muted" value="Loading..." />
289
+ </Stack>
290
+ </Card>
291
+ </Show>
292
+
293
+ {/* Empty state */}
294
+ <Show when={!loading && filtered.length === 0}>
295
+ <Card padding={32}>
296
+ <Stack align="center" gap={12}>
297
+ <Icon name="inbox" size={40} color="token:muted" />
298
+ <Text variant="muted" value="No items yet" />
299
+ <Button variant="outline" onPress={handleCreate}>
300
+ <Text value="Create your first item" />
301
+ </Button>
302
+ </Stack>
303
+ </Card>
304
+ </Show>
305
+
306
+ {/* Item list */}
307
+ <Show when={!loading && filtered.length > 0}>
308
+ <Stack gap={4}>
309
+ {filtered.map((item: any) => (
310
+ <Card key={item.id} padding={12}>
311
+ <Row align="center" gap={12}>
312
+ <Stack flex={1} gap={2}>
313
+ <Text weight="medium" value={item.fields.title} />
314
+ <Show when={!!item.fields.description}>
315
+ <Text size="sm" variant="muted" value={item.fields.description} />
316
+ </Show>
317
+ </Stack>
318
+ <Badge value={item.fields.priority} />
319
+ <Badge value={item.state} variant={item.state === 'active' ? 'success' : 'default'} />
320
+ </Row>
321
+ </Card>
322
+ ))}
323
+ </Stack>
324
+ </Show>
325
+ </Stack>
326
+ );
327
+ }
328
+ `;
329
+ }
330
+ function generateGitignore() {
331
+ return `node_modules
332
+ dist
333
+ dev.db
334
+ .env
335
+ .env.local
336
+ .env.*.local
337
+ *.log
338
+ .DS_Store
339
+ `;
340
+ }
341
+ function isInsideGitRepo(dir) {
342
+ try {
343
+ execSync("git rev-parse --git-dir", { cwd: dir, stdio: "pipe" });
344
+ return true;
345
+ } catch {
346
+ return false;
347
+ }
348
+ }
349
+ function scaffoldGit(dir) {
350
+ if (isInsideGitRepo(dir)) {
351
+ return "Skipped git init (inside existing repo)";
352
+ }
353
+ try {
354
+ execSync("git init", { cwd: dir, stdio: "pipe" });
355
+ execSync("git add -A", { cwd: dir, stdio: "pipe" });
356
+ execSync('git commit -m "Initial commit from mmrc init"', { cwd: dir, stdio: "pipe" });
357
+ return "Initialized git repository";
358
+ } catch (e) {
359
+ return `Git init failed: ${e.message}`;
360
+ }
361
+ }
362
+ async function init(options) {
363
+ const { name } = options;
364
+ if (!/^[a-z][a-z0-9-]*$/.test(name)) {
365
+ console.error(`[mmrc] Error: Blueprint name must be lowercase alphanumeric with hyphens (got "${name}")`);
366
+ process.exit(1);
367
+ }
368
+ const cwd = process.cwd();
369
+ const packagesDir = existsSync(join(cwd, "packages")) ? join(cwd, "packages") : cwd;
370
+ const blueprintDir = join(packagesDir, `blueprint-${name}`);
371
+ if (existsSync(blueprintDir)) {
372
+ console.error(`[mmrc] Error: Directory already exists: ${blueprintDir}`);
373
+ process.exit(1);
374
+ }
375
+ try {
376
+ const pkgPath = __require.resolve("@mmapp/react-compiler/package.json");
377
+ const { version } = __require(pkgPath);
378
+ console.log(`[mmrc] v${version}`);
379
+ } catch {
380
+ try {
381
+ const { readFileSync } = __require("fs");
382
+ const { resolve, dirname } = __require("path");
383
+ const pkg = JSON.parse(readFileSync(resolve(__dirname, "../../package.json"), "utf-8"));
384
+ console.log(`[mmrc] v${pkg.version}`);
385
+ } catch {
386
+ console.log(`[mmrc]`);
387
+ }
388
+ }
389
+ console.log(`[mmrc] Creating blueprint: ${name}
390
+ `);
391
+ mkdirSync(join(blueprintDir, "models"), { recursive: true });
392
+ mkdirSync(join(blueprintDir, "app"), { recursive: true });
393
+ const { generateMmrcConfig } = await import("./config-RVLNOB24.mjs");
394
+ const files = [
395
+ ["package.json", generatePackageJson(name)],
396
+ ["tsconfig.json", generateTsconfig()],
397
+ ["mm.config.ts", generateMmConfig(name, options)],
398
+ ["mmrc.config.ts", generateMmrcConfig()],
399
+ [".gitignore", generateGitignore()],
400
+ ["models/item.ts", generateModel(name)],
401
+ ["app/layout.tsx", generateLayout(name)],
402
+ ["app/page.tsx", generatePage(name)]
403
+ ];
404
+ for (const [relPath, content] of files) {
405
+ const fullPath = join(blueprintDir, relPath);
406
+ writeFileSync(fullPath, content, "utf-8");
407
+ console.log(` + ${relPath}`);
408
+ }
409
+ const gitMessage = scaffoldGit(blueprintDir);
410
+ console.log(` ${gitMessage}`);
411
+ console.log(`
412
+ [mmrc] Installing dependencies...`);
413
+ const { execSync: execSync2 } = __require("child_process");
414
+ try {
415
+ const usesPnpm = existsSync(join(cwd, "pnpm-lock.yaml")) || existsSync(join(cwd, "pnpm-workspace.yaml"));
416
+ const usesYarn = existsSync(join(cwd, "yarn.lock"));
417
+ const pm = usesPnpm ? "pnpm" : usesYarn ? "yarn" : "npm";
418
+ execSync2(`${pm} install`, { cwd: blueprintDir, stdio: "inherit" });
419
+ console.log(`[mmrc] Dependencies installed with ${pm}`);
420
+ } catch (e) {
421
+ console.warn(`[mmrc] Warning: Could not auto-install dependencies. Run 'npm install' manually in the project directory.`);
422
+ }
423
+ const title = toTitleCase(name);
424
+ const relDir = blueprintDir.startsWith(cwd) ? blueprintDir.slice(cwd.length + 1) : blueprintDir;
425
+ console.log(`
426
+ [mmrc] Blueprint "${title}" created at:
427
+ ${blueprintDir}
428
+
429
+ Next steps:
430
+ 1. cd ${relDir}
431
+ 2. mmrc dev # Start dev server with live preview
432
+ `);
433
+ }
434
+ export {
435
+ init,
436
+ isInsideGitRepo,
437
+ scaffoldGit
438
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmapp/react-compiler",
3
- "version": "0.1.0-alpha.12",
3
+ "version": "0.1.0-alpha.13",
4
4
  "description": "Babel plugin + Vite integration for compiling React workflows to Pure Form IR",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -66,7 +66,7 @@
66
66
  "@babel/plugin-syntax-typescript": "^7.24.0",
67
67
  "@babel/traverse": "^7.24.0",
68
68
  "@babel/types": "^7.24.0",
69
- "@mmapp/player-core": "^0.1.0-alpha.12",
69
+ "@mmapp/player-core": "^0.1.0-alpha.13",
70
70
  "glob": "^10.3.10"
71
71
  },
72
72
  "peerDependencies": {