@myop/cli 0.1.13 β†’ 0.1.15

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 (2) hide show
  1. package/dist/myop-cli.js +334 -304
  2. package/package.json +2 -1
package/dist/myop-cli.js CHANGED
@@ -52,7 +52,7 @@ Examples:
52
52
  verbose: !1
53
53
  },
54
54
  myopConfig: null
55
- }, ke = {
55
+ }, Pe = {
56
56
  name: "πŸ“₯ Install Myop generated dependencies",
57
57
  value: "myopInstall",
58
58
  description: "Fetch and generates Myop dependencies. flows including components, refs and props.",
@@ -67,19 +67,19 @@ Examples:
67
67
  }, Xe = (e) => {
68
68
  const o = Z.join(d.executionPath, e);
69
69
  console.info(`reading config file from: ${o}`);
70
- const n = A.readFileSync(o, "utf8"), a = JSON.parse(n);
71
- return console.info("config file loaded, ", a), a;
70
+ const n = A.readFileSync(o, "utf8"), i = JSON.parse(n);
71
+ return console.info("config file loaded, ", i), i;
72
72
  }, ge = (e, o) => {
73
73
  const n = Z.join(d.executionPath, e);
74
74
  console.info(`writing config file to: ${n}`);
75
75
  try {
76
- const a = JSON.stringify(o, null, 2);
77
- A.writeFileSync(n, a), console.info(`config file updated ${a}`);
78
- } catch (a) {
79
- throw console.info(`error ${a} while writing to ${n}, JSON: ${o}`), console.log(`
80
- ⚠️ Failed write config file to ${n}, for more info use verbose flag`), a;
76
+ const i = JSON.stringify(o, null, 2);
77
+ A.writeFileSync(n, i), console.info(`config file updated ${i}`);
78
+ } catch (i) {
79
+ throw console.info(`error ${i} while writing to ${n}, JSON: ${o}`), console.log(`
80
+ ⚠️ Failed write config file to ${n}, for more info use verbose flag`), i;
81
81
  }
82
- }, Pe = {
82
+ }, ke = {
83
83
  name: "🌟 Add flow definition to your project",
84
84
  value: "addFlow",
85
85
  description: "Adds flow to yours myop.config.json",
@@ -88,7 +88,7 @@ Examples:
88
88
  },
89
89
  action: async () => {
90
90
  }
91
- }, _e = {
91
+ }, Ee = {
92
92
  name: "🚫 Remove flow definition from your project",
93
93
  value: "removeFlow",
94
94
  description: "Removes flow to yours myop.config.json",
@@ -126,7 +126,7 @@ Examples:
126
126
  description: "️Help you creates the right structure for a new Myop message, including types and handlers.",
127
127
  disabled: "(not available yet)"
128
128
  }, nt = [ot, Ze, qe, et, tt];
129
- function st(e, o, n, a) {
129
+ function st(e, o, n, i) {
130
130
  return `<!DOCTYPE html>
131
131
  <html lang="en">
132
132
  <head>
@@ -211,26 +211,26 @@ ${n}
211
211
  // Inject PORT as a global variable for the app to use
212
212
  window.PORT = ${e};
213
213
 
214
- ${a}
214
+ ${i}
215
215
  <\/script>
216
216
  </body>
217
217
  </html>`;
218
218
  }
219
- async function Ne() {
220
- const e = await import("fs"), o = await import("path"), { exec: n } = await import("child_process"), a = await import("http"), { createHash: u } = await import("node:crypto");
219
+ async function _e() {
220
+ const e = await import("fs"), o = await import("path"), { exec: n } = await import("child_process"), i = await import("http"), { createHash: u } = await import("node:crypto");
221
221
  let c;
222
222
  if (import.meta.url.startsWith("file://")) {
223
223
  const s = import.meta.url.slice(7);
224
224
  c = o.default.dirname(s);
225
225
  } else
226
226
  c = o.default.dirname(import.meta.url);
227
- const m = o.default.join(c, "commands", "dev", "management-website"), S = e.default.readFileSync(o.default.join(m, "styles.css"), "utf-8"), x = e.default.readFileSync(o.default.join(m, "app.js"), "utf-8"), g = 9292, y = 9293, w = "./dist";
228
- let j = !1, $ = !1;
229
- const T = /* @__PURE__ */ new Map(), z = d.program.getOptionValue("config") || "./myop.config.json";
230
- let v, _, h = !1;
227
+ const m = o.default.join(c, "commands", "dev", "management-website"), x = e.default.readFileSync(o.default.join(m, "styles.css"), "utf-8"), b = e.default.readFileSync(o.default.join(m, "app.js"), "utf-8"), f = 9292, y = 9293, w = "./dist";
228
+ let j = !1, S = !1;
229
+ const N = /* @__PURE__ */ new Map(), z = d.program.getOptionValue("config") || "./myop.config.json";
230
+ let v, E, h = !1;
231
231
  try {
232
232
  const s = e.default.readFileSync(z, "utf-8"), t = JSON.parse(s);
233
- v = t.componentId || "DEV", _ = t.componentName || t.name || null, h = t.HMR === !0, h && console.log("πŸ”₯ HMR enabled");
233
+ v = t.componentId || "DEV", E = t.componentName || t.name || null, h = t.HMR === !0, h && console.log("πŸ”₯ HMR enabled");
234
234
  } catch (s) {
235
235
  console.error("❌ Error reading myop.config.json:", s.message), process.exit(1);
236
236
  }
@@ -239,15 +239,15 @@ async function Ne() {
239
239
  return v;
240
240
  try {
241
241
  const t = ((await new Promise((l, p) => {
242
- const f = {
242
+ const g = {
243
243
  hostname: "localhost",
244
244
  port: y,
245
245
  path: "/_list",
246
246
  method: "GET",
247
247
  timeout: 1e3
248
- }, O = a.default.request(f, (k) => {
248
+ }, O = i.default.request(g, (P) => {
249
249
  let H = "";
250
- k.on("data", (J) => H += J), k.on("end", () => {
250
+ P.on("data", (J) => H += J), P.on("end", () => {
251
251
  try {
252
252
  l(JSON.parse(H));
253
253
  } catch {
@@ -263,14 +263,14 @@ async function Ne() {
263
263
  return "DEV1";
264
264
  const r = t.map((l) => {
265
265
  if (l === "DEV" || l === "NEW") return 1;
266
- const p = l.match(/^DEV(\d+)$/), f = l.match(/^NEW(\d+)$/);
267
- return p ? parseInt(p[1], 10) : f ? parseInt(f[1], 10) : 0;
266
+ const p = l.match(/^DEV(\d+)$/), g = l.match(/^NEW(\d+)$/);
267
+ return p ? parseInt(p[1], 10) : g ? parseInt(g[1], 10) : 0;
268
268
  }).filter((l) => l > 0);
269
269
  return `DEV${Math.max(...r, 0) + 1}`;
270
270
  } catch {
271
271
  return "DEV1";
272
272
  }
273
- }, N = process.cwd(), K = (s) => {
273
+ }, _ = process.cwd(), K = (s) => {
274
274
  const t = o.default.extname(s).toLowerCase();
275
275
  return {
276
276
  ".html": "text/html",
@@ -283,9 +283,9 @@ async function Ne() {
283
283
  ".svg": "image/svg+xml",
284
284
  ".ico": "image/x-icon"
285
285
  }[t] || "application/octet-stream";
286
- }, b = /* @__PURE__ */ new Map(), q = [], Fe = 50, D = [], V = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map(), Ae = (s, t, r) => {
286
+ }, C = /* @__PURE__ */ new Map(), q = [], Fe = 50, D = [], V = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map(), Ae = (s, t, r) => {
287
287
  if (s.url.startsWith("/_hmr/")) {
288
- const i = s.url.split("/_hmr/")[1], l = s.headers["sec-websocket-key"], p = u("sha1").update(l + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11").digest("base64");
288
+ const a = s.url.split("/_hmr/")[1], l = s.headers["sec-websocket-key"], p = u("sha1").update(l + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11").digest("base64");
289
289
  t.write(
290
290
  `HTTP/1.1 101 Switching Protocols\r
291
291
  Upgrade: websocket\r
@@ -293,31 +293,31 @@ Connection: Upgrade\r
293
293
  Sec-WebSocket-Accept: ${p}\r
294
294
  \r
295
295
  `
296
- ), U.has(i) || U.set(i, /* @__PURE__ */ new Set()), U.get(i).add(t), console.log(`πŸ”Œ HMR client connected: ${i}`), t.on("close", () => {
297
- const f = U.get(i);
298
- f && (f.delete(t), f.size === 0 && U.delete(i)), console.log(`πŸ”Œ HMR client disconnected: ${i}`);
296
+ ), U.has(a) || U.set(a, /* @__PURE__ */ new Set()), U.get(a).add(t), console.log(`πŸ”Œ HMR client connected: ${a}`), t.on("close", () => {
297
+ const g = U.get(a);
298
+ g && (g.delete(t), g.size === 0 && U.delete(a)), console.log(`πŸ”Œ HMR client disconnected: ${a}`);
299
299
  }), t.on("error", () => {
300
- const f = U.get(i);
301
- f && f.delete(t);
300
+ const g = U.get(a);
301
+ g && g.delete(t);
302
302
  });
303
303
  }
304
- }, le = a.default.createServer((s, t) => {
304
+ }, le = i.default.createServer((s, t) => {
305
305
  if (t.setHeader("Content-Type", "application/json"), s.method === "POST" && s.url === "/_register") {
306
306
  let r = "";
307
- s.on("data", (i) => r += i), s.on("end", () => {
307
+ s.on("data", (a) => r += a), s.on("end", () => {
308
308
  try {
309
- const { componentId: i, distPath: l, componentName: p } = JSON.parse(r);
310
- b.set(i, { path: l, name: p || null });
311
- const f = p ? ` (${p})` : "";
312
- console.log(`βœ… Registered: ${i}${f} -> ${l}`), t.writeHead(200), t.end(JSON.stringify({ success: !0, registered: Array.from(b.keys()) }));
313
- const O = Array.from(b.entries()).map(([k, H]) => ({
314
- id: k,
309
+ const { componentId: a, distPath: l, componentName: p } = JSON.parse(r);
310
+ C.set(a, { path: l, name: p || null });
311
+ const g = p ? ` (${p})` : "";
312
+ console.log(`βœ… Registered: ${a}${g} -> ${l}`), t.writeHead(200), t.end(JSON.stringify({ success: !0, registered: Array.from(C.keys()) }));
313
+ const O = Array.from(C.entries()).map(([P, H]) => ({
314
+ id: P,
315
315
  path: H.path,
316
316
  name: H.name
317
317
  }));
318
- D.forEach((k) => {
318
+ D.forEach((P) => {
319
319
  try {
320
- k.write(`data: ${JSON.stringify({
320
+ P.write(`data: ${JSON.stringify({
321
321
  type: "components",
322
322
  components: O
323
323
  })}
@@ -326,20 +326,20 @@ Sec-WebSocket-Accept: ${p}\r
326
326
  } catch {
327
327
  }
328
328
  });
329
- } catch (i) {
330
- t.writeHead(400), t.end(JSON.stringify({ error: i.message }));
329
+ } catch (a) {
330
+ t.writeHead(400), t.end(JSON.stringify({ error: a.message }));
331
331
  }
332
332
  });
333
333
  } else if (s.method === "POST" && s.url === "/_unregister") {
334
334
  let r = "";
335
- s.on("data", (i) => r += i), s.on("end", () => {
335
+ s.on("data", (a) => r += a), s.on("end", () => {
336
336
  try {
337
- const { componentId: i } = JSON.parse(r);
338
- b.delete(i), console.log(`❌ Unregistered: ${i}`), t.writeHead(200), t.end(JSON.stringify({ success: !0 }));
339
- const l = Array.from(b.entries()).map(([p, f]) => ({
337
+ const { componentId: a } = JSON.parse(r);
338
+ C.delete(a), console.log(`❌ Unregistered: ${a}`), t.writeHead(200), t.end(JSON.stringify({ success: !0 }));
339
+ const l = Array.from(C.entries()).map(([p, g]) => ({
340
340
  id: p,
341
- path: f.path,
342
- name: f.name
341
+ path: g.path,
342
+ name: g.name
343
343
  }));
344
344
  D.forEach((p) => {
345
345
  try {
@@ -352,56 +352,56 @@ Sec-WebSocket-Accept: ${p}\r
352
352
  } catch {
353
353
  }
354
354
  });
355
- } catch (i) {
356
- t.writeHead(400), t.end(JSON.stringify({ error: i.message }));
355
+ } catch (a) {
356
+ t.writeHead(400), t.end(JSON.stringify({ error: a.message }));
357
357
  }
358
358
  });
359
- } else s.method === "GET" && s.url === "/_list" ? (t.writeHead(200), t.end(JSON.stringify({ components: Array.from(b.entries()) }))) : (t.writeHead(404), t.end(JSON.stringify({ error: "Not found" })));
360
- }), ee = a.default.createServer((s, t) => {
359
+ } else s.method === "GET" && s.url === "/_list" ? (t.writeHead(200), t.end(JSON.stringify({ components: Array.from(C.entries()) }))) : (t.writeHead(404), t.end(JSON.stringify({ error: "Not found" })));
360
+ }), ee = i.default.createServer((s, t) => {
361
361
  if (s.url.includes("..")) {
362
362
  t.writeHead(403, { "Content-Type": "text/plain" }), t.end("Forbidden");
363
363
  return;
364
364
  }
365
- const r = new URL(s.url, `http://localhost:${g}`), i = r.pathname, l = i.split("/").filter((P) => P);
366
- if (i.startsWith("/consume")) {
367
- const P = r.searchParams.get("id");
368
- if (!P) {
365
+ const r = new URL(s.url, `http://localhost:${f}`), a = r.pathname, l = a.split("/").filter((k) => k);
366
+ if (a.startsWith("/consume")) {
367
+ const k = r.searchParams.get("id");
368
+ if (!k) {
369
369
  t.writeHead(400, { "Content-Type": "application/json" }), t.end(JSON.stringify({ error: "Component ID required. Use /consume?id=<componentId>" }));
370
370
  return;
371
371
  }
372
- const R = b.get(P), L = R ? R.path : null, Me = (W) => {
373
- let C = "Unknown", E = "Unknown";
372
+ const R = C.get(k), L = R ? R.path : null, Me = (W) => {
373
+ let $ = "Unknown", T = "Unknown";
374
374
  if (s.headers.referer || s.headers.referrer) {
375
375
  const I = s.headers.referer || s.headers.referrer;
376
376
  try {
377
377
  const G = new URL(I);
378
- C = G.origin, E = G.hostname || G.origin;
378
+ $ = G.origin, T = G.hostname || G.origin;
379
379
  } catch {
380
- C = I, E = I;
380
+ $ = I, T = I;
381
381
  }
382
382
  } else if (s.headers.origin)
383
383
  try {
384
384
  const I = new URL(s.headers.origin);
385
- C = I.origin, E = I.hostname || I.origin;
385
+ $ = I.origin, T = I.hostname || I.origin;
386
386
  } catch {
387
- C = s.headers.origin, E = s.headers.origin;
387
+ $ = s.headers.origin, T = s.headers.origin;
388
388
  }
389
389
  else if (s.socket.remoteAddress) {
390
390
  const I = s.socket.remoteAddress;
391
- I === "::1" || I === "::ffff:127.0.0.1" ? (C = "localhost", E = "localhost (direct)") : (C = I, E = I.replace("::ffff:", ""));
391
+ I === "::1" || I === "::ffff:127.0.0.1" ? ($ = "localhost", T = "localhost (direct)") : ($ = I, T = I.replace("::ffff:", ""));
392
392
  }
393
- const pe = s.headers.referer || s.headers.referrer || C, oe = {
393
+ const pe = s.headers.referer || s.headers.referrer || $, oe = {
394
394
  type: "request",
395
- componentId: P,
395
+ componentId: k,
396
396
  timestamp: Date.now(),
397
397
  servedLocally: W,
398
398
  referrer: pe,
399
- origin: C,
400
- originLabel: E
399
+ origin: $,
400
+ originLabel: T
401
401
  };
402
- V.has(C) || (V.set(C, {
403
- url: C,
404
- label: E,
402
+ V.has($) || (V.set($, {
403
+ url: $,
404
+ label: T,
405
405
  firstSeen: Date.now(),
406
406
  requestCount: 0
407
407
  }), D.forEach((I) => {
@@ -415,7 +415,7 @@ Sec-WebSocket-Accept: ${p}\r
415
415
  } catch {
416
416
  }
417
417
  }));
418
- const ze = V.get(C);
418
+ const ze = V.get($);
419
419
  ze.requestCount++, D.forEach((I) => {
420
420
  try {
421
421
  I.write(`data: ${JSON.stringify({
@@ -437,15 +437,15 @@ Sec-WebSocket-Accept: ${p}\r
437
437
  };
438
438
  if (L) {
439
439
  const W = o.default.join(L, "index.html");
440
- e.default.readFile(W, "utf-8", (C, E) => {
441
- if (C) {
440
+ e.default.readFile(W, "utf-8", ($, T) => {
441
+ if ($) {
442
442
  console.log(`❌ File not found: ${W}`), t.writeHead(404, { "Content-Type": "application/json" }), t.end(JSON.stringify({ error: "index.html not found" }));
443
443
  return;
444
444
  }
445
445
  const pe = `dev-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, oe = {
446
446
  item: {
447
- name: P,
448
- id: P,
447
+ name: k,
448
+ id: k,
449
449
  consume_variant: [
450
450
  {
451
451
  id: pe,
@@ -453,46 +453,46 @@ Sec-WebSocket-Accept: ${p}\r
453
453
  loader: {
454
454
  type: "HTMLLoader",
455
455
  shadowRootMode: "localFrame",
456
- HTML: E
456
+ HTML: T
457
457
  }
458
458
  }
459
459
  ]
460
460
  }
461
461
  };
462
- console.log(`βœ… Serving consume JSON for: ${P}`), Me(!0), t.writeHead(200, {
462
+ console.log(`βœ… Serving consume JSON for: ${k}`), Me(!0), t.writeHead(200, {
463
463
  "Content-Type": "application/json",
464
464
  "Access-Control-Allow-Origin": "*"
465
465
  }), t.end(JSON.stringify(oe, null, 2));
466
466
  });
467
467
  } else {
468
- console.log(`πŸ“‘ Proxying consume request to cloud.myop.dev for: ${P}`);
468
+ console.log(`πŸ“‘ Proxying consume request to cloud.myop.dev for: ${k}`);
469
469
  const W = `https://cloud.myop.dev/consume${r.search}`;
470
- Me(!1), fetch(W).then((C) => C.text()).then((C) => {
470
+ Me(!1), fetch(W).then(($) => $.text()).then(($) => {
471
471
  t.writeHead(200, {
472
472
  "Content-Type": "application/json",
473
473
  "Access-Control-Allow-Origin": "*"
474
- }), t.end(C);
475
- }).catch((C) => {
476
- console.error(`❌ Proxy error: ${C.message}`), t.writeHead(502, { "Content-Type": "application/json" }), t.end(JSON.stringify({ error: "Failed to fetch from cloud.myop.dev" }));
474
+ }), t.end($);
475
+ }).catch(($) => {
476
+ console.error(`❌ Proxy error: ${$.message}`), t.writeHead(502, { "Content-Type": "application/json" }), t.end(JSON.stringify({ error: "Failed to fetch from cloud.myop.dev" }));
477
477
  });
478
478
  }
479
479
  return;
480
480
  }
481
- if (i === "/events") {
481
+ if (a === "/events") {
482
482
  t.writeHead(200, {
483
483
  "Content-Type": "text/event-stream",
484
484
  "Cache-Control": "no-cache",
485
485
  Connection: "keep-alive",
486
486
  "Access-Control-Allow-Origin": "*"
487
487
  }), D.push(t);
488
- const P = Array.from(b.entries()).map(([R, L]) => ({
488
+ const k = Array.from(C.entries()).map(([R, L]) => ({
489
489
  id: R,
490
490
  path: L.path,
491
491
  name: L.name
492
492
  }));
493
493
  t.write(`data: ${JSON.stringify({
494
494
  type: "components",
495
- components: P
495
+ components: k
496
496
  })}
497
497
 
498
498
  `), t.write(`data: ${JSON.stringify({
@@ -512,7 +512,7 @@ Sec-WebSocket-Accept: ${p}\r
512
512
  return;
513
513
  }
514
514
  if (l.length === 0) {
515
- t.writeHead(200, { "Content-Type": "text/html" }), t.end(st(g, y, S, x));
515
+ t.writeHead(200, { "Content-Type": "text/html" }), t.end(st(f, y, x, b));
516
516
  return;
517
517
  }
518
518
  if (l[0] !== "view") {
@@ -523,14 +523,14 @@ Sec-WebSocket-Accept: ${p}\r
523
523
  t.writeHead(400, { "Content-Type": "text/plain" }), t.end("Component ID required. Use /view/<componentId>/");
524
524
  return;
525
525
  }
526
- const p = l[1], f = b.get(p);
527
- if (!f) {
526
+ const p = l[1], g = C.get(p);
527
+ if (!g) {
528
528
  t.writeHead(404, { "Content-Type": "text/plain" }), t.end(`Component not found: ${p}`);
529
529
  return;
530
530
  }
531
- const O = f.path, k = l.slice(2), H = k.length === 0 ? "index.html" : k.join("/"), J = o.default.join(O, H);
532
- console.log(`πŸ“₯ Request: ${s.url} -> ${J}`), e.default.readFile(J, (P, R) => {
533
- if (P) {
531
+ const O = g.path, P = l.slice(2), H = P.length === 0 ? "index.html" : P.join("/"), J = o.default.join(O, H);
532
+ console.log(`πŸ“₯ Request: ${s.url} -> ${J}`), e.default.readFile(J, (k, R) => {
533
+ if (k) {
534
534
  console.log(`❌ File not found: ${J}`), t.writeHead(404, { "Content-Type": "text/plain" }), t.end("Not Found");
535
535
  return;
536
536
  }
@@ -543,9 +543,9 @@ Sec-WebSocket-Accept: ${p}\r
543
543
  }), ve = () => new Promise((s, t) => {
544
544
  const r = JSON.stringify({
545
545
  componentId: v,
546
- distPath: o.default.resolve(N, w),
547
- componentName: _
548
- }), i = {
546
+ distPath: o.default.resolve(_, w),
547
+ componentName: E
548
+ }), a = {
549
549
  hostname: "localhost",
550
550
  port: y,
551
551
  path: "/_register",
@@ -554,15 +554,15 @@ Sec-WebSocket-Accept: ${p}\r
554
554
  "Content-Type": "application/json",
555
555
  "Content-Length": Buffer.byteLength(r)
556
556
  }
557
- }, l = a.default.request(i, (p) => {
558
- let f = "";
559
- p.on("data", (O) => f += O), p.on("end", () => {
560
- p.statusCode === 200 ? s(JSON.parse(f)) : t(new Error(`Registration failed: ${p.statusCode}`));
557
+ }, l = i.default.request(a, (p) => {
558
+ let g = "";
559
+ p.on("data", (O) => g += O), p.on("end", () => {
560
+ p.statusCode === 200 ? s(JSON.parse(g)) : t(new Error(`Registration failed: ${p.statusCode}`));
561
561
  });
562
562
  });
563
563
  l.on("error", t), l.write(r), l.end();
564
564
  }), De = () => new Promise((s, t) => {
565
- const r = JSON.stringify({ componentId: v }), i = {
565
+ const r = JSON.stringify({ componentId: v }), a = {
566
566
  hostname: "localhost",
567
567
  port: y,
568
568
  path: "/_unregister",
@@ -571,7 +571,7 @@ Sec-WebSocket-Accept: ${p}\r
571
571
  "Content-Type": "application/json",
572
572
  "Content-Length": Buffer.byteLength(r)
573
573
  }
574
- }, l = a.default.request(i, (p) => {
574
+ }, l = i.default.request(a, (p) => {
575
575
  s();
576
576
  });
577
577
  l.on("error", () => s()), l.write(r), l.end();
@@ -581,8 +581,8 @@ Sec-WebSocket-Accept: ${p}\r
581
581
  try {
582
582
  let t = e.default.readFileSync(s, "utf-8");
583
583
  if (t.includes("<!-- MYOP HMR -->")) {
584
- const i = t.indexOf("<!-- MYOP HMR -->"), l = t.indexOf("<\/script>", i) + 9;
585
- t = t.slice(0, i) + t.slice(l);
584
+ const a = t.indexOf("<!-- MYOP HMR -->"), l = t.indexOf("<\/script>", a) + 9;
585
+ t = t.slice(0, a) + t.slice(l);
586
586
  }
587
587
  const r = `
588
588
  <!-- MYOP HMR -->
@@ -696,24 +696,24 @@ Sec-WebSocket-Accept: ${p}\r
696
696
  }
697
697
  }, Je = (s) => {
698
698
  const t = Buffer.from(s), r = t.length;
699
- let i;
700
- return r < 126 ? i = Buffer.concat([
699
+ let a;
700
+ return r < 126 ? a = Buffer.concat([
701
701
  Buffer.from([129, r]),
702
702
  // FIN + text frame, length
703
703
  t
704
- ]) : r < 65536 ? i = Buffer.concat([
704
+ ]) : r < 65536 ? a = Buffer.concat([
705
705
  Buffer.from([129, 126]),
706
706
  // FIN + text frame, extended length
707
707
  Buffer.from([r >> 8, r & 255]),
708
708
  // 16-bit length
709
709
  t
710
- ]) : i = Buffer.concat([
710
+ ]) : a = Buffer.concat([
711
711
  Buffer.from([129, 127]),
712
712
  // FIN + text frame, extended length
713
713
  Buffer.from([0, 0, 0, 0, r >> 24, r >> 16 & 255, r >> 8 & 255, r & 255]),
714
714
  // 64-bit length
715
715
  t
716
- ]), i;
716
+ ]), a;
717
717
  }, Le = () => {
718
718
  if (!h) return;
719
719
  const s = U.get(v);
@@ -724,13 +724,13 @@ Sec-WebSocket-Accept: ${p}\r
724
724
  try {
725
725
  let r = e.default.readFileSync(t, "utf-8");
726
726
  if (r.includes("<!-- MYOP HMR -->")) {
727
- const p = r.indexOf("<!-- MYOP HMR -->"), f = r.indexOf("<\/script>", p) + 9;
728
- r = r.slice(0, p) + r.slice(f);
727
+ const p = r.indexOf("<!-- MYOP HMR -->"), g = r.indexOf("<\/script>", p) + 9;
728
+ r = r.slice(0, p) + r.slice(g);
729
729
  }
730
- const i = JSON.stringify({
730
+ const a = JSON.stringify({
731
731
  type: "update",
732
732
  html: r
733
- }), l = Je(i);
733
+ }), l = Je(a);
734
734
  s.forEach((p) => {
735
735
  try {
736
736
  p.write(l);
@@ -743,37 +743,37 @@ Sec-WebSocket-Accept: ${p}\r
743
743
  }
744
744
  }, de = () => {
745
745
  if (j) {
746
- $ = !0;
746
+ S = !0;
747
747
  return;
748
748
  }
749
749
  j = !0, console.log(`
750
750
  πŸ”¨ Building...`), n("npm run build", (s, t, r) => {
751
- j = !1, s ? (console.error("❌ Build failed:", s.message), r && console.error(r)) : (console.log("βœ… Build completed"), t && console.log(t), He(), Le()), $ && ($ = !1, de());
751
+ j = !1, s ? (console.error("❌ Build failed:", s.message), r && console.error(r)) : (console.log("βœ… Build completed"), t && console.log(t), He(), Le()), S && (S = !1, de());
752
752
  });
753
- }, Se = /* @__PURE__ */ new Set(), xe = (s) => {
753
+ }, xe = /* @__PURE__ */ new Set(), Se = (s) => {
754
754
  e.default.readdir(s, { withFileTypes: !0 }, (t, r) => {
755
- t || (r.forEach((i) => {
756
- const l = o.default.join(s, i.name);
757
- if (i.isDirectory())
758
- i.name !== "node_modules" && i.name !== "dist" && !i.name.startsWith(".") && xe(l);
759
- else if (i.isFile()) {
760
- const p = o.default.extname(i.name);
755
+ t || (r.forEach((a) => {
756
+ const l = o.default.join(s, a.name);
757
+ if (a.isDirectory())
758
+ a.name !== "node_modules" && a.name !== "dist" && !a.name.startsWith(".") && Se(l);
759
+ else if (a.isFile()) {
760
+ const p = o.default.extname(a.name);
761
761
  if (p === ".js" || p === ".css" || p === ".html")
762
762
  try {
763
- const f = e.default.readFileSync(l, "utf-8");
764
- T.set(l, f);
763
+ const g = e.default.readFileSync(l, "utf-8");
764
+ N.set(l, g);
765
765
  } catch {
766
766
  }
767
767
  }
768
- }), Se.has(s) || (Se.add(s), e.default.watch(s, (i, l) => {
768
+ }), xe.has(s) || (xe.add(s), e.default.watch(s, (a, l) => {
769
769
  if (!l) return;
770
770
  const p = o.default.extname(l);
771
771
  if (p !== ".js" && p !== ".css" && p !== ".html") return;
772
- const f = o.default.join(s, l);
772
+ const g = o.default.join(s, l);
773
773
  setTimeout(() => {
774
774
  try {
775
- const O = e.default.readFileSync(f, "utf-8"), k = T.get(f);
776
- O !== k && (T.set(f, O), console.log(`πŸ“ File changed: ${f}`), de());
775
+ const O = e.default.readFileSync(g, "utf-8"), P = N.get(g);
776
+ O !== P && (N.set(g, O), console.log(`πŸ“ File changed: ${g}`), de());
777
777
  } catch {
778
778
  }
779
779
  }, 50);
@@ -781,7 +781,7 @@ Sec-WebSocket-Accept: ${p}\r
781
781
  });
782
782
  }, be = () => {
783
783
  console.log(`
784
- πŸ”¨ Component: ${v}`), de(), xe(N), console.log("πŸ‘€ Watching .js, .css, and .html files for changes..."), console.log(`Press Ctrl+C to stop
784
+ πŸ”¨ Component: ${v}`), de(), Se(_), console.log("πŸ‘€ Watching .js, .css, and .html files for changes..."), console.log(`Press Ctrl+C to stop
785
785
  `);
786
786
  }, Ue = () => new Promise((s) => {
787
787
  const t = {
@@ -790,24 +790,24 @@ Sec-WebSocket-Accept: ${p}\r
790
790
  path: "/_list",
791
791
  method: "GET",
792
792
  timeout: 1e3
793
- }, r = a.default.request(t, (i) => {
793
+ }, r = i.default.request(t, (a) => {
794
794
  s(!0);
795
795
  });
796
796
  r.on("error", () => s(!1)), r.on("timeout", () => {
797
797
  r.destroy(), s(!1);
798
798
  }), r.end();
799
799
  }), Be = () => new Promise((s) => {
800
- const t = a.default.createServer((r, i) => {
801
- if (i.setHeader("Content-Type", "application/json"), r.method === "POST" && r.url === "/_register") {
800
+ const t = i.default.createServer((r, a) => {
801
+ if (a.setHeader("Content-Type", "application/json"), r.method === "POST" && r.url === "/_register") {
802
802
  let l = "";
803
803
  r.on("data", (p) => l += p), r.on("end", () => {
804
804
  try {
805
- const { componentId: p, distPath: f, componentName: O } = JSON.parse(l);
806
- b.set(p, { path: f, name: O || null });
807
- const k = O ? ` (${O})` : "";
808
- console.log(`βœ… Registered: ${p}${k} -> ${f}`), i.writeHead(200), i.end(JSON.stringify({ success: !0, registered: Array.from(b.keys()) }));
805
+ const { componentId: p, distPath: g, componentName: O } = JSON.parse(l);
806
+ C.set(p, { path: g, name: O || null });
807
+ const P = O ? ` (${O})` : "";
808
+ console.log(`βœ… Registered: ${p}${P} -> ${g}`), a.writeHead(200), a.end(JSON.stringify({ success: !0, registered: Array.from(C.keys()) }));
809
809
  } catch (p) {
810
- i.writeHead(400), i.end(JSON.stringify({ error: p.message }));
810
+ a.writeHead(400), a.end(JSON.stringify({ error: p.message }));
811
811
  }
812
812
  });
813
813
  } else if (r.method === "POST" && r.url === "/_unregister") {
@@ -815,12 +815,12 @@ Sec-WebSocket-Accept: ${p}\r
815
815
  r.on("data", (p) => l += p), r.on("end", () => {
816
816
  try {
817
817
  const { componentId: p } = JSON.parse(l);
818
- b.delete(p), console.log(`❌ Unregistered: ${p}`), i.writeHead(200), i.end(JSON.stringify({ success: !0 }));
818
+ C.delete(p), console.log(`❌ Unregistered: ${p}`), a.writeHead(200), a.end(JSON.stringify({ success: !0 }));
819
819
  } catch (p) {
820
- i.writeHead(400), i.end(JSON.stringify({ error: p.message }));
820
+ a.writeHead(400), a.end(JSON.stringify({ error: p.message }));
821
821
  }
822
822
  });
823
- } else r.method === "GET" && r.url === "/_list" ? (i.writeHead(200), i.end(JSON.stringify({ components: Array.from(b.entries()) }))) : (i.writeHead(404), i.end(JSON.stringify({ error: "Not found" })));
823
+ } else r.method === "GET" && r.url === "/_list" ? (a.writeHead(200), a.end(JSON.stringify({ components: Array.from(C.entries()) }))) : (a.writeHead(404), a.end(JSON.stringify({ error: "Not found" })));
824
824
  });
825
825
  t.on("error", () => {
826
826
  s(!1);
@@ -828,13 +828,13 @@ Sec-WebSocket-Accept: ${p}\r
828
828
  console.log(`
829
829
  πŸ”„ Taking over as server...`), console.log(`πŸ“‘ Management server on port ${y}`), ee.on("error", () => {
830
830
  t.close(), s(!1);
831
- }), ee.listen(g, () => {
832
- console.log(`πŸ“‘ Main server running at http://localhost:${g}`), b.set(v, {
833
- path: o.default.resolve(N, w),
834
- name: _
831
+ }), ee.listen(f, () => {
832
+ console.log(`πŸ“‘ Main server running at http://localhost:${f}`), C.set(v, {
833
+ path: o.default.resolve(_, w),
834
+ name: E
835
835
  });
836
- const r = _ ? ` (${_})` : "";
837
- console.log(`βœ… Registered component: ${v}${r}`), console.log(`πŸ“‘ Access at: http://localhost:${g}/view/${v}/`), s(!0);
836
+ const r = E ? ` (${E})` : "";
837
+ console.log(`βœ… Registered component: ${v}${r}`), console.log(`πŸ“‘ Access at: http://localhost:${f}/view/${v}/`), s(!0);
838
838
  });
839
839
  });
840
840
  });
@@ -862,7 +862,7 @@ Sec-WebSocket-Accept: ${p}\r
862
862
  try {
863
863
  v = await M();
864
864
  const t = await ve();
865
- console.log(`βœ… Registered component: ${v}`), console.log(`πŸ“‘ Access at: http://localhost:${g}/view/${v}/`), console.log(`πŸ“‹ All registered components: ${t.registered.join(", ")}`), be(), Ce();
865
+ console.log(`βœ… Registered component: ${v}`), console.log(`πŸ“‘ Access at: http://localhost:${f}/view/${v}/`), console.log(`πŸ“‹ All registered components: ${t.registered.join(", ")}`), be(), Ce();
866
866
  } catch (t) {
867
867
  console.error("❌ Failed to register component:", t.message), process.exit(1);
868
868
  }
@@ -872,13 +872,13 @@ Sec-WebSocket-Accept: ${p}\r
872
872
  console.log(`
873
873
  πŸš€ Starting shared dev server...`), console.log(`πŸ“‘ Management server on port ${y}`), ee.on("error", (s) => {
874
874
  console.error("❌ Main server error:", s.message), process.exit(1);
875
- }), ee.listen(g, async () => {
876
- console.log(`πŸ“‘ Main server running at http://localhost:${g}`), (v === "DEV" || v === "NEW") && (v = "DEV1"), b.set(v, {
877
- path: o.default.resolve(N, w),
878
- name: _
875
+ }), ee.listen(f, async () => {
876
+ console.log(`πŸ“‘ Main server running at http://localhost:${f}`), (v === "DEV" || v === "NEW") && (v = "DEV1"), C.set(v, {
877
+ path: o.default.resolve(_, w),
878
+ name: E
879
879
  });
880
- const s = _ ? ` (${_})` : "";
881
- console.log(`βœ… Registered component: ${v}${s}`), console.log(`πŸ“‘ Access at: http://localhost:${g}/view/${v}/`), be();
880
+ const s = E ? ` (${E})` : "";
881
+ console.log(`βœ… Registered component: ${v}${s}`), console.log(`πŸ“‘ Access at: http://localhost:${f}/view/${v}/`), be();
882
882
  });
883
883
  });
884
884
  }
@@ -896,7 +896,7 @@ function he() {
896
896
  return console.info("Failed to read credentials:", e.message), null;
897
897
  }
898
898
  }
899
- function Te(e) {
899
+ function Ne(e) {
900
900
  rt();
901
901
  const o = {
902
902
  ...e,
@@ -907,7 +907,7 @@ function Te(e) {
907
907
  // Read/write for owner only
908
908
  });
909
909
  }
910
- function Ee() {
910
+ function Te() {
911
911
  try {
912
912
  return A.existsSync(Q) && A.unlinkSync(Q), !0;
913
913
  } catch (e) {
@@ -951,7 +951,7 @@ async function dt() {
951
951
  }
952
952
  return e.json();
953
953
  }
954
- function ne(e, o, n, a = null) {
954
+ function ne(e, o, n, i = null) {
955
955
  const u = {
956
956
  success: `<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="#4ade80" stroke-width="2">
957
957
  <circle cx="12" cy="12" r="10"/>
@@ -969,7 +969,7 @@ function ne(e, o, n, a = null) {
969
969
  success: { accent: "#4ade80", glow: "rgba(74, 222, 128, 0.1)" },
970
970
  error: { accent: "#f87171", glow: "rgba(248, 113, 113, 0.1)" },
971
971
  warning: { accent: "#fbbf24", glow: "rgba(251, 191, 36, 0.1)" }
972
- }, { accent: m, glow: S } = c[e] || c.error;
972
+ }, { accent: m, glow: x } = c[e] || c.error;
973
973
  return `<!DOCTYPE html>
974
974
  <html lang="en">
975
975
  <head>
@@ -1062,7 +1062,7 @@ function ne(e, o, n, a = null) {
1062
1062
  display: inline-flex;
1063
1063
  align-items: center;
1064
1064
  gap: 8px;
1065
- background: ${S};
1065
+ background: ${x};
1066
1066
  border: 1px solid ${m}33;
1067
1067
  border-radius: 4px;
1068
1068
  padding: 10px 16px;
@@ -1104,7 +1104,7 @@ function ne(e, o, n, a = null) {
1104
1104
  </div>
1105
1105
  <h1>${o}</h1>
1106
1106
  <p class="message">${n}</p>
1107
- ${a ? `<div class="details"><code>Error:</code> ${a}</div>` : ""}
1107
+ ${i ? `<div class="details"><code>Error:</code> ${i}</div>` : ""}
1108
1108
  <div class="hint">
1109
1109
  <span>Press</span>
1110
1110
  <kbd>⌘</kbd><kbd>W</kbd>
@@ -1119,54 +1119,54 @@ function ne(e, o, n, a = null) {
1119
1119
  }
1120
1120
  function pt(e) {
1121
1121
  return new Promise((o, n) => {
1122
- const a = We.createServer((u, c) => {
1122
+ const i = We.createServer((u, c) => {
1123
1123
  const m = new Ie(u.url, `http://localhost:${re}`);
1124
1124
  if (m.pathname === "/callback") {
1125
- const S = m.searchParams.get("code"), x = m.searchParams.get("state"), g = m.searchParams.get("error");
1126
- if (g) {
1125
+ const x = m.searchParams.get("code"), b = m.searchParams.get("state"), f = m.searchParams.get("error");
1126
+ if (f) {
1127
1127
  c.writeHead(200, { "Content-Type": "text/html" }), c.end(ne(
1128
1128
  "error",
1129
1129
  "Authentication Failed",
1130
1130
  "Unable to complete the authentication process.",
1131
- g
1132
- )), a.close(), n(new Error(`OAuth error: ${g}`));
1131
+ f
1132
+ )), i.close(), n(new Error(`OAuth error: ${f}`));
1133
1133
  return;
1134
1134
  }
1135
- if (x !== e) {
1135
+ if (b !== e) {
1136
1136
  c.writeHead(400, { "Content-Type": "text/html" }), c.end(ne(
1137
1137
  "warning",
1138
1138
  "Security Error",
1139
1139
  "State mismatch detected. This could indicate a CSRF attack. Please try authenticating again.",
1140
1140
  "state_mismatch"
1141
- )), a.close(), n(new Error("State mismatch"));
1141
+ )), i.close(), n(new Error("State mismatch"));
1142
1142
  return;
1143
1143
  }
1144
- if (!S) {
1144
+ if (!x) {
1145
1145
  c.writeHead(400, { "Content-Type": "text/html" }), c.end(ne(
1146
1146
  "error",
1147
1147
  "Missing Authorization Code",
1148
1148
  "No authorization code was received from the server.",
1149
1149
  "missing_code"
1150
- )), a.close(), n(new Error("No authorization code"));
1150
+ )), i.close(), n(new Error("No authorization code"));
1151
1151
  return;
1152
1152
  }
1153
1153
  c.writeHead(200, { "Content-Type": "text/html" }), c.end(ne(
1154
1154
  "success",
1155
1155
  "Authentication Successful",
1156
1156
  "You have been authenticated successfully. Return to the terminal to continue."
1157
- )), a.close(), o(S);
1157
+ )), i.close(), o(x);
1158
1158
  } else
1159
1159
  c.writeHead(404), c.end("Not found");
1160
1160
  });
1161
- a.listen(re, () => {
1161
+ i.listen(re, () => {
1162
1162
  console.info(`OAuth callback server listening on port ${re}`);
1163
1163
  }), setTimeout(() => {
1164
- a.close(), n(new Error("Authentication timed out"));
1164
+ i.close(), n(new Error("Authentication timed out"));
1165
1165
  }, 5 * 60 * 1e3);
1166
1166
  });
1167
1167
  }
1168
1168
  async function mt(e, o, n) {
1169
- const a = await fetch(`${Y}/oauth/token`, {
1169
+ const i = await fetch(`${Y}/oauth/token`, {
1170
1170
  method: "POST",
1171
1171
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
1172
1172
  body: new je({
@@ -1177,11 +1177,11 @@ async function mt(e, o, n) {
1177
1177
  code_verifier: n
1178
1178
  })
1179
1179
  });
1180
- if (!a.ok) {
1181
- const u = await a.json();
1180
+ if (!i.ok) {
1181
+ const u = await i.json();
1182
1182
  throw new Error(u.error_description || u.error || "Token exchange failed");
1183
1183
  }
1184
- return a.json();
1184
+ return i.json();
1185
1185
  }
1186
1186
  async function ut(e, o) {
1187
1187
  const n = await fetch(`${Y}/oauth/token`, {
@@ -1194,8 +1194,8 @@ async function ut(e, o) {
1194
1194
  })
1195
1195
  });
1196
1196
  if (!n.ok) {
1197
- const a = await n.json();
1198
- throw new Error(a.error_description || a.error || "Token refresh failed");
1197
+ const i = await n.json();
1198
+ throw new Error(i.error_description || i.error || "Token refresh failed");
1199
1199
  }
1200
1200
  return n.json();
1201
1201
  }
@@ -1222,34 +1222,34 @@ async function ft(e) {
1222
1222
  const n = await o.json();
1223
1223
  if (n.error)
1224
1224
  throw new Error(n.error.message);
1225
- const a = (m = (c = (u = n.result) == null ? void 0 : u.content) == null ? void 0 : c[0]) == null ? void 0 : m.text;
1226
- if (a)
1227
- return JSON.parse(a);
1225
+ const i = (m = (c = (u = n.result) == null ? void 0 : u.content) == null ? void 0 : c[0]) == null ? void 0 : m.text;
1226
+ if (i)
1227
+ return JSON.parse(i);
1228
1228
  throw new Error("Invalid response from whoami");
1229
1229
  }
1230
1230
  async function X() {
1231
1231
  const e = F("Starting authentication...").start();
1232
1232
  try {
1233
1233
  e.text = "Registering OAuth client...";
1234
- const n = (await dt()).client_id, a = ct(), u = lt(a), c = fe.randomBytes(16).toString("hex");
1234
+ const n = (await dt()).client_id, i = ct(), u = lt(i), c = fe.randomBytes(16).toString("hex");
1235
1235
  e.text = "Waiting for authorization...";
1236
- const m = pt(c), S = new Ie(`${Y}/oauth/authorize`);
1237
- S.searchParams.set("response_type", "code"), S.searchParams.set("client_id", n), S.searchParams.set("redirect_uri", we), S.searchParams.set("code_challenge", u), S.searchParams.set("code_challenge_method", "S256"), S.searchParams.set("state", c), e.stop(), console.log(`
1238
- 🌐 Opening browser for authentication...`), console.log("If the browser does not open, visit:"), console.log(` ${S.toString()}
1239
- `), await Ge(S.toString());
1240
- const x = await m;
1236
+ const m = pt(c), x = new Ie(`${Y}/oauth/authorize`);
1237
+ x.searchParams.set("response_type", "code"), x.searchParams.set("client_id", n), x.searchParams.set("redirect_uri", we), x.searchParams.set("code_challenge", u), x.searchParams.set("code_challenge_method", "S256"), x.searchParams.set("state", c), e.stop(), console.log(`
1238
+ 🌐 Opening browser for authentication...`), console.log("If the browser does not open, visit:"), console.log(` ${x.toString()}
1239
+ `), await Ge(x.toString());
1240
+ const b = await m;
1241
1241
  e.start("Exchanging authorization code...");
1242
- const g = await mt(x, n, a);
1242
+ const f = await mt(b, n, i);
1243
1243
  e.text = "Getting user info...";
1244
- const y = await ft(g.access_token), w = {
1245
- accessToken: g.access_token,
1246
- refreshToken: g.refresh_token,
1247
- expiresAt: new Date(Date.now() + g.expires_in * 1e3).toISOString(),
1244
+ const y = await ft(f.access_token), w = {
1245
+ accessToken: f.access_token,
1246
+ refreshToken: f.refresh_token,
1247
+ expiresAt: new Date(Date.now() + f.expires_in * 1e3).toISOString(),
1248
1248
  clientId: n,
1249
1249
  userId: y.userId,
1250
1250
  userEmail: y.email
1251
1251
  };
1252
- return Te(w), e.succeed(`Authenticated as ${y.email}`), w;
1252
+ return Ne(w), e.succeed(`Authenticated as ${y.email}`), w;
1253
1253
  } catch (o) {
1254
1254
  throw e.fail(`Authentication failed: ${o.message}`), o;
1255
1255
  }
@@ -1260,7 +1260,7 @@ async function Re() {
1260
1260
  console.log("Not currently logged in.");
1261
1261
  return;
1262
1262
  }
1263
- Ee(), console.log(`βœ… Logged out (was: ${e.userEmail})`);
1263
+ Te(), console.log(`βœ… Logged out (was: ${e.userEmail})`);
1264
1264
  }
1265
1265
  async function gt() {
1266
1266
  let e = he();
@@ -1281,9 +1281,9 @@ async function gt() {
1281
1281
  accessToken: n.access_token,
1282
1282
  refreshToken: n.refresh_token,
1283
1283
  expiresAt: new Date(Date.now() + n.expires_in * 1e3).toISOString()
1284
- }, Te(e), o.succeed("Token refreshed"), e;
1284
+ }, Ne(e), o.succeed("Token refreshed"), e;
1285
1285
  } catch {
1286
- return o.warn("Token refresh failed, please log in again"), Ee(), await X();
1286
+ return o.warn("Token refresh failed, please log in again"), Te(), await X();
1287
1287
  }
1288
1288
  }
1289
1289
  return console.log(`Session expired. Please log in again.
@@ -1302,9 +1302,9 @@ async function yt() {
1302
1302
  }
1303
1303
  }
1304
1304
  function wt(e, o) {
1305
- const n = e.split(".").map(Number), a = o.split(".").map(Number);
1306
- for (let u = 0; u < Math.max(n.length, a.length); u++) {
1307
- const c = n[u] || 0, m = a[u] || 0;
1305
+ const n = e.split(".").map(Number), i = o.split(".").map(Number);
1306
+ for (let u = 0; u < Math.max(n.length, i.length); u++) {
1307
+ const c = n[u] || 0, m = i[u] || 0;
1308
1308
  if (c > m) return 1;
1309
1309
  if (c < m) return -1;
1310
1310
  }
@@ -1317,15 +1317,25 @@ async function vt(e) {
1317
1317
  }).start(), n = await yt();
1318
1318
  if (o.stop(), !n || wt(n, e) <= 0)
1319
1319
  return !1;
1320
- if (console.log(`
1320
+ console.log(`
1321
1321
  πŸ“¦ New version available: ${e} β†’ ${n}
1322
- `), await Oe({
1323
- message: "Would you like to update now?",
1324
- choices: [
1325
- { name: "Yes, update now", value: !0 },
1326
- { name: "No, continue with current version", value: !1 }
1327
- ]
1328
- })) {
1322
+ `);
1323
+ let i;
1324
+ try {
1325
+ i = await Oe({
1326
+ message: "Would you like to update now?",
1327
+ choices: [
1328
+ { name: "Yes, update now", value: !0 },
1329
+ { name: "No, continue with current version", value: !1 }
1330
+ ]
1331
+ });
1332
+ } catch (u) {
1333
+ throw u.name === "ExitPromptError" && (console.log(`
1334
+
1335
+ πŸ‘‹ Goodbye!
1336
+ `), process.exit(0)), u;
1337
+ }
1338
+ if (i) {
1329
1339
  const u = F({
1330
1340
  text: `Updating ${ie} to v${n}...`,
1331
1341
  color: "green"
@@ -1342,7 +1352,7 @@ You can manually update by running: npm install -g ${ie}@latest
1342
1352
  }
1343
1353
  return !1;
1344
1354
  }
1345
- const St = (e) => new Promise((o) => setTimeout(o, e));
1355
+ const xt = (e) => new Promise((o) => setTimeout(o, e));
1346
1356
  d.executionPath = process.cwd();
1347
1357
  const ce = (e = !1) => {
1348
1358
  const o = d.program.getOptionValue("verbose");
@@ -1358,11 +1368,11 @@ const ce = (e = !1) => {
1358
1368
  console.info(`
1359
1369
  ⚠️ failed read config file from ${d.options.configPath}, trying to create new one`);
1360
1370
  try {
1361
- const a = {
1371
+ const i = {
1362
1372
  author: "@myop-cli",
1363
1373
  flows: []
1364
1374
  };
1365
- return ge(d.options.configPath, a), d.myopConfig = a, { configFound: !0 };
1375
+ return ge(d.options.configPath, i), d.myopConfig = i, { configFound: !0 };
1366
1376
  } catch {
1367
1377
  return console.info("Error details :", n), { configFound: !1, error: n };
1368
1378
  }
@@ -1374,21 +1384,21 @@ const ce = (e = !1) => {
1374
1384
  new me(),
1375
1385
  ...nt
1376
1386
  ];
1377
- const xt = "0.1.13";
1387
+ const St = "0.1.15";
1378
1388
  d.program = new Ve();
1379
- d.program.name("@myop/cli").description("Myop CLI - Remote UI Made Easy").version(xt);
1389
+ d.program.name("@myop/cli").description("Myop CLI - Remote UI Made Easy").version(St);
1380
1390
  d.program.addOption(new ae("-c, --config <value>", "myop.config.json file location").default("./myop.config.json", "./myop.config.json"));
1381
1391
  d.program.addOption(new ae("-h, --help", "Show helpful information"));
1382
1392
  d.program.addOption(new ae("-v, --verbose", "Enables verbose output mode for the command-line interface (CLI)."));
1383
1393
  d.program.addOption(new ae("--ci", "CI mode: print status info (version, config, auth) as JSON and exit without prompts"));
1384
1394
  d.program.command("add").description("Install Myop assets").addArgument("type").addArgument("id").action((e, o) => {
1385
- ce(!0), console.info("adding ", e, o, d.options.configPath), e === "flow" && Pe._action(o), process.exit();
1395
+ ce(!0), console.info("adding ", e, o, d.options.configPath), e === "flow" && ke._action(o), process.exit();
1386
1396
  });
1387
1397
  d.program.command("remove").description("Remove Myop asset").argument("<type>", "Myop asset type").argument("<id>", "Asset id").action((e, o) => {
1388
- ce(), console.info("removing ", e, o, d.options.configPath), e === "flow" && _e._action(o), process.exit();
1398
+ ce(), console.info("removing ", e, o, d.options.configPath), e === "flow" && Ee._action(o), process.exit();
1389
1399
  });
1390
1400
  d.program.command("install").description("Install Myop assets").action(async () => {
1391
- ce(), await ke.action();
1401
+ ce(), await Pe.action();
1392
1402
  });
1393
1403
  d.program.command("login").description("Authenticate with Myop platform").action(async () => {
1394
1404
  try {
@@ -1406,8 +1416,8 @@ d.program.command("whoami").description("Show current authenticated user").actio
1406
1416
  e && e.email ? console.log(`Logged in as: ${e.email}`) : console.log("Not logged in. Run `myop login` to authenticate."), process.exit(0);
1407
1417
  });
1408
1418
  d.program.command("sync").description("Build and upload component to Myop platform").option("--skip-build", "Skip the build step").action(async (e) => {
1409
- var j, $, T, z, v, _;
1410
- const o = d.program.getOptionValue("config") || "./myop.config.json", n = await import("fs"), { execSync: a } = await import("child_process"), u = await import("path");
1419
+ var j, S, N, z, v, E;
1420
+ const o = d.program.getOptionValue("config") || "./myop.config.json", n = await import("fs"), { execSync: i } = await import("child_process"), u = await import("path");
1411
1421
  let c = {};
1412
1422
  if (n.existsSync(o))
1413
1423
  try {
@@ -1423,27 +1433,27 @@ d.program.command("sync").description("Build and upload component to Myop platfo
1423
1433
  if (!e.skipBuild) {
1424
1434
  const h = F("Building project...").start();
1425
1435
  try {
1426
- a("npm run build", { stdio: "pipe" }), h.succeed("Build completed");
1436
+ i("npm run build", { stdio: "pipe" }), h.succeed("Build completed");
1427
1437
  } catch (M) {
1428
1438
  h.fail("Build failed"), console.error(M.message), process.exit(1);
1429
1439
  }
1430
1440
  }
1431
1441
  const m = "./dist/index.html";
1432
1442
  n.existsSync(m) || (console.error("❌ Error: ./dist/index.html not found"), console.log(" Make sure your build outputs to ./dist/index.html"), process.exit(1));
1433
- let S;
1443
+ let x;
1434
1444
  try {
1435
- S = await gt();
1445
+ x = await gt();
1436
1446
  } catch (h) {
1437
1447
  console.error("❌ Authentication failed:", h.message), process.exit(1);
1438
1448
  }
1439
- const x = ht();
1440
- let g = F("Requesting upload URL...").start(), y;
1449
+ const b = ht();
1450
+ let f = F("Requesting upload URL...").start(), y;
1441
1451
  try {
1442
- const h = await fetch(`${x}/mcp`, {
1452
+ const h = await fetch(`${b}/mcp`, {
1443
1453
  method: "POST",
1444
1454
  headers: {
1445
1455
  "Content-Type": "application/json",
1446
- Authorization: `Bearer ${S.accessToken}`
1456
+ Authorization: `Bearer ${x.accessToken}`
1447
1457
  },
1448
1458
  body: JSON.stringify({
1449
1459
  jsonrpc: "2.0",
@@ -1464,24 +1474,24 @@ d.program.command("sync").description("Build and upload component to Myop platfo
1464
1474
  const M = await h.json();
1465
1475
  if (M.error)
1466
1476
  throw new Error(M.error.message);
1467
- const N = (T = ($ = (j = M.result) == null ? void 0 : j.content) == null ? void 0 : $[0]) == null ? void 0 : T.text;
1468
- if (y = JSON.parse(N), !y.success)
1477
+ const _ = (N = (S = (j = M.result) == null ? void 0 : j.content) == null ? void 0 : S[0]) == null ? void 0 : N.text;
1478
+ if (y = JSON.parse(_), !y.success)
1469
1479
  throw new Error(y.error);
1470
- g.succeed("Upload URL obtained");
1480
+ f.succeed("Upload URL obtained");
1471
1481
  } catch (h) {
1472
- g.fail("Failed to get upload URL"), console.error(" ", h.message), process.exit(1);
1482
+ f.fail("Failed to get upload URL"), console.error(" ", h.message), process.exit(1);
1473
1483
  }
1474
- g = F("Uploading component...").start();
1484
+ f = F("Uploading component...").start();
1475
1485
  try {
1476
1486
  const h = n.readFileSync(m, "utf-8");
1477
1487
  let M;
1478
- const N = y.curlCommand.match(/(?:"|\\")([^"\\]+(?:\\.[^"\\]*)*)(?:"|\\")$/);
1479
- if (N)
1480
- M = N[1];
1488
+ const _ = y.curlCommand.match(/(?:"|\\")([^"\\]+(?:\\.[^"\\]*)*)(?:"|\\")$/);
1489
+ if (_)
1490
+ M = _[1];
1481
1491
  else {
1482
- const b = y.curlCommand.match(/(https:\/\/[^\s"\\]+)/);
1483
- if (b)
1484
- M = b[1];
1492
+ const C = y.curlCommand.match(/(https:\/\/[^\s"\\]+)/);
1493
+ if (C)
1494
+ M = C[1];
1485
1495
  else
1486
1496
  throw new Error("Could not parse presigned URL from: " + y.curlCommand);
1487
1497
  }
@@ -1494,21 +1504,21 @@ d.program.command("sync").description("Build and upload component to Myop platfo
1494
1504
  body: h
1495
1505
  });
1496
1506
  if (!K.ok) {
1497
- const b = await K.text();
1498
- throw new Error(`Upload failed with status ${K.status}: ${b}`);
1507
+ const C = await K.text();
1508
+ throw new Error(`Upload failed with status ${K.status}: ${C}`);
1499
1509
  }
1500
- g.succeed("Component uploaded");
1510
+ f.succeed("Component uploaded");
1501
1511
  } catch (h) {
1502
- g.fail("Upload failed"), console.error(" ", h.message), h.cause && console.error(" Cause:", h.cause), process.exit(1);
1512
+ f.fail("Upload failed"), console.error(" ", h.message), h.cause && console.error(" Cause:", h.cause), process.exit(1);
1503
1513
  }
1504
- g = F("Confirming upload...").start();
1514
+ f = F("Confirming upload...").start();
1505
1515
  let w;
1506
1516
  try {
1507
- const h = await fetch(`${x}/mcp`, {
1517
+ const h = await fetch(`${b}/mcp`, {
1508
1518
  method: "POST",
1509
1519
  headers: {
1510
1520
  "Content-Type": "application/json",
1511
- Authorization: `Bearer ${S.accessToken}`
1521
+ Authorization: `Bearer ${x.accessToken}`
1512
1522
  },
1513
1523
  body: JSON.stringify({
1514
1524
  jsonrpc: "2.0",
@@ -1527,12 +1537,12 @@ d.program.command("sync").description("Build and upload component to Myop platfo
1527
1537
  const M = await h.json();
1528
1538
  if (M.error)
1529
1539
  throw new Error(M.error.message);
1530
- const N = (_ = (v = (z = M.result) == null ? void 0 : z.content) == null ? void 0 : v[0]) == null ? void 0 : _.text;
1531
- if (w = JSON.parse(N), !w.success)
1540
+ const _ = (E = (v = (z = M.result) == null ? void 0 : z.content) == null ? void 0 : v[0]) == null ? void 0 : E.text;
1541
+ if (w = JSON.parse(_), !w.success)
1532
1542
  throw new Error(w.error);
1533
- g.succeed("Upload confirmed");
1543
+ f.succeed("Upload confirmed");
1534
1544
  } catch (h) {
1535
- g.fail("Confirmation failed"), console.error(" ", h.message), process.exit(1);
1545
+ f.fail("Confirmation failed"), console.error(" ", h.message), process.exit(1);
1536
1546
  }
1537
1547
  if (w.isNewComponent || !c.componentId) {
1538
1548
  c.componentId = w.componentId, c.organization = w.orgId, c.name || (c.name = w.componentName);
@@ -1547,7 +1557,7 @@ d.program.command("sync").description("Build and upload component to Myop platfo
1547
1557
  console.log(`
1548
1558
  βœ… Sync completed successfully!`), console.log(` Component: ${w.componentName}`), console.log(` Dashboard: ${w.dashboardUrl}`), process.exit(0);
1549
1559
  });
1550
- d.program.command("dev").description("Start development server with file watching").action(Ne);
1560
+ d.program.command("dev").description("Start development server with file watching").action(_e);
1551
1561
  const bt = () => {
1552
1562
  try {
1553
1563
  se("git --version", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
@@ -1571,10 +1581,10 @@ const bt = () => {
1571
1581
  deletions: 0
1572
1582
  };
1573
1583
  const o = e.split(`
1574
- `), n = o[o.length - 1], a = n.match(/(\d+) insertion/), u = n.match(/(\d+) deletion/), c = n.match(/(\d+) file/);
1584
+ `), n = o[o.length - 1], i = n.match(/(\d+) insertion/), u = n.match(/(\d+) deletion/), c = n.match(/(\d+) file/);
1575
1585
  return {
1576
1586
  files: c ? parseInt(c[1]) : 0,
1577
- insertions: a ? parseInt(a[1]) : 0,
1587
+ insertions: i ? parseInt(i[1]) : 0,
1578
1588
  deletions: u ? parseInt(u[1]) : 0
1579
1589
  };
1580
1590
  } catch {
@@ -1582,11 +1592,11 @@ const bt = () => {
1582
1592
  }
1583
1593
  }, B = async (e = !1, o = !1) => {
1584
1594
  var y, w, j;
1585
- const n = ye(), a = !!(n != null && n.email), u = ((y = d.myopConfig) == null ? void 0 : y.name) || ((w = d.myopConfig) == null ? void 0 : w.componentName), c = (j = d.myopConfig) == null ? void 0 : j.componentId, m = bt();
1595
+ const n = ye(), i = !!(n != null && n.email), u = ((y = d.myopConfig) == null ? void 0 : y.name) || ((w = d.myopConfig) == null ? void 0 : w.componentName), c = (j = d.myopConfig) == null ? void 0 : j.componentId, m = bt();
1586
1596
  console.log(`
1587
1597
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”`), console.log("β”‚ β”‚"), console.log("β”‚ Welcome to Myop CLI - Remote UI Made Easy β”‚"), console.log("β”‚ β”‚"), console.log(`β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1588
- `), e && u ? (console.log(` Component: ${u}`), c ? (console.log(` ID: ${c}`), console.log(` Dashboard: https://dashboard.myop.dev/dashboard/2.0/component/${c}`)) : console.log(" ID: (not yet pushed)")) : console.log(" Component: No myop.config.json found"), console.log(` User: ${a ? n.email : "Not logged in"}`), m != null && m.gitNotInstalled ? (console.log(" Changes: Git not installed"), console.log(" Install: https://git-scm.com/downloads"), console.log(" Mac: brew install git | Windows: https://gitforwindows.org")) : m != null && m.notARepo ? console.log(" Changes: Not a git repository") : m && (m.insertions > 0 || m.deletions > 0) ? console.log(` Changes: ${m.files} file${m.files !== 1 ? "s" : ""} | \x1B[32m+${m.insertions}\x1B[0m \x1B[31m-${m.deletions}\x1B[0m`) : m && console.log(" Changes: No uncommitted changes"), console.log("");
1589
- const x = [
1598
+ `), e && u ? (console.log(` Component: ${u}`), c ? (console.log(` ID: ${c}`), console.log(` Dashboard: https://dashboard.myop.dev/dashboard/2.0/component/${c}`)) : console.log(" ID: (not yet pushed)")) : console.log(" Component: No myop.config.json found"), console.log(` User: ${i ? n.email : "Not logged in"}`), m != null && m.gitNotInstalled ? (console.log(" Changes: Git not installed"), console.log(" Install: https://git-scm.com/downloads"), console.log(" Mac: brew install git | Windows: https://gitforwindows.org")) : m != null && m.notARepo ? console.log(" Changes: Not a git repository") : m && (m.insertions > 0 || m.deletions > 0) ? console.log(` Changes: ${m.files} file${m.files !== 1 ? "s" : ""} | \x1B[32m+${m.insertions}\x1B[0m \x1B[31m-${m.deletions}\x1B[0m`) : m && console.log(" Changes: No uncommitted changes"), console.log("");
1599
+ const b = [
1590
1600
  {
1591
1601
  emoji: "πŸš€",
1592
1602
  label: "Initialize new component",
@@ -1599,7 +1609,7 @@ const bt = () => {
1599
1609
  label: u ? `Push "${u}"` : "Push component",
1600
1610
  value: "sync",
1601
1611
  help: "Builds project & uploads dist/index.html to Myop",
1602
- disabled: e ? a ? !1 : "(login required)" : "(no config file)"
1612
+ disabled: e ? i ? !1 : "(login required)" : "(no config file)"
1603
1613
  },
1604
1614
  {
1605
1615
  emoji: "πŸ› οΈ ",
@@ -1608,19 +1618,19 @@ const bt = () => {
1608
1618
  help: "Starts dev server with HMR for instant preview of changes",
1609
1619
  disabled: e ? !1 : "(no config file)"
1610
1620
  }
1611
- ].map(($) => ({
1612
- name: o && !$.disabled ? `${$.emoji} ${$.label}
1613
- ${$.help}` : `${$.emoji} ${$.label}`,
1614
- value: $.value,
1615
- disabled: $.disabled
1621
+ ].map((S) => ({
1622
+ name: o && !S.disabled ? `${S.emoji} ${S.label}
1623
+ ${S.help}` : `${S.emoji} ${S.label}`,
1624
+ value: S.value,
1625
+ disabled: S.disabled
1616
1626
  }));
1617
- switch (x.push(
1627
+ b.push(
1618
1628
  new me(),
1619
1629
  {
1620
- name: o && a ? `πŸ”“ Logout (${n.email})
1621
- Clears stored credentials from this machine` : o && !a ? `πŸ” Login to Myop
1622
- Opens browser to authenticate with Myop` : a ? `πŸ”“ Logout (${n.email})` : "πŸ” Login to Myop",
1623
- value: a ? "logout" : "login"
1630
+ name: o && i ? `πŸ”“ Logout (${n.email})
1631
+ Clears stored credentials from this machine` : o && !i ? `πŸ” Login to Myop
1632
+ Opens browser to authenticate with Myop` : i ? `πŸ”“ Logout (${n.email})` : "πŸ” Login to Myop",
1633
+ value: i ? "logout" : "login"
1624
1634
  },
1625
1635
  {
1626
1636
  name: o ? "πŸ“– Hide help" : "πŸ“– Show help",
@@ -1631,10 +1641,20 @@ const bt = () => {
1631
1641
  name: "πŸ‘‹ Exit",
1632
1642
  value: "exit"
1633
1643
  }
1634
- ), await Oe({
1635
- message: "What would you like to do?",
1636
- choices: x
1637
- })) {
1644
+ );
1645
+ let f;
1646
+ try {
1647
+ f = await Oe({
1648
+ message: "What would you like to do?",
1649
+ choices: b
1650
+ });
1651
+ } catch (S) {
1652
+ throw S.name === "ExitPromptError" && (console.log(`
1653
+
1654
+ πŸ‘‹ Goodbye!
1655
+ `), process.exit(0)), S;
1656
+ }
1657
+ switch (f) {
1638
1658
  case "init":
1639
1659
  await Ct();
1640
1660
  break;
@@ -1642,22 +1662,22 @@ const bt = () => {
1642
1662
  console.log(`
1643
1663
  Running sync...
1644
1664
  `);
1645
- const { execSync: $ } = await import("child_process");
1665
+ const { execSync: S } = await import("child_process");
1646
1666
  try {
1647
- $("node " + process.argv[1] + " sync", { stdio: "inherit" });
1667
+ S("node " + process.argv[1] + " sync", { stdio: "inherit" });
1648
1668
  } catch {
1649
1669
  }
1650
1670
  await B(!0, o);
1651
1671
  break;
1652
1672
  case "dev":
1653
- await Ne();
1673
+ await _e();
1654
1674
  break;
1655
1675
  case "login":
1656
1676
  try {
1657
1677
  await X(), console.log(`
1658
1678
  `), await B(e, o);
1659
- } catch (T) {
1660
- console.error("Login failed:", T.message), await B(e, o);
1679
+ } catch (N) {
1680
+ console.error("Login failed:", N.message), await B(e, o);
1661
1681
  }
1662
1682
  break;
1663
1683
  case "logout":
@@ -1671,26 +1691,36 @@ Running sync...
1671
1691
  process.exit(0);
1672
1692
  }
1673
1693
  }, Ct = async () => {
1674
- const { input: e, select: o } = await import("@inquirer/prompts"), n = await import("fs"), u = (await import("path")).default.basename(process.cwd()), c = await e({
1675
- message: "Component name:",
1676
- default: u
1677
- }), m = await o({
1678
- message: "Component type:",
1679
- choices: [
1680
- { name: "πŸ“„ HTML", value: "html", description: "Plain HTML/JS/CSS component" },
1681
- { name: "βš›οΈ React", value: "react", disabled: "(coming soon)" },
1682
- { name: "πŸ’š Vue", value: "vue", disabled: "(coming soon)" },
1683
- { name: "πŸ…°οΈ Angular", value: "angular", disabled: "(coming soon)" }
1684
- ]
1685
- }), S = {
1694
+ const { input: e, select: o } = await import("@inquirer/prompts"), n = await import("fs"), u = (await import("path")).default.basename(process.cwd());
1695
+ let c, m;
1696
+ try {
1697
+ c = await e({
1698
+ message: "Component name:",
1699
+ default: u
1700
+ }), m = await o({
1701
+ message: "Component type:",
1702
+ choices: [
1703
+ { name: "πŸ“„ HTML", value: "html", description: "Plain HTML/JS/CSS component" },
1704
+ { name: "βš›οΈ React", value: "react", disabled: "(coming soon)" },
1705
+ { name: "πŸ’š Vue", value: "vue", disabled: "(coming soon)" },
1706
+ { name: "πŸ…°οΈ Angular", value: "angular", disabled: "(coming soon)" }
1707
+ ]
1708
+ });
1709
+ } catch (f) {
1710
+ throw f.name === "ExitPromptError" && (console.log(`
1711
+
1712
+ πŸ‘‹ Goodbye!
1713
+ `), process.exit(0)), f;
1714
+ }
1715
+ const x = {
1686
1716
  name: c,
1687
1717
  type: m,
1688
1718
  author: "@myop-cli"
1689
- }, x = d.program.getOptionValue("config") || "./myop.config.json";
1719
+ }, b = d.program.getOptionValue("config") || "./myop.config.json";
1690
1720
  try {
1691
- n.writeFileSync(x, JSON.stringify(S, null, 2)), console.log(`
1692
- βœ… Created ${x}`);
1693
- const g = {
1721
+ n.writeFileSync(b, JSON.stringify(x, null, 2)), console.log(`
1722
+ βœ… Created ${b}`);
1723
+ const f = {
1694
1724
  name: c.toLowerCase().replace(/\s+/g, "-"),
1695
1725
  version: "1.0.0",
1696
1726
  type: "module",
@@ -1702,7 +1732,7 @@ Running sync...
1702
1732
  esbuild: "^0.24.0"
1703
1733
  }
1704
1734
  };
1705
- n.writeFileSync("package.json", JSON.stringify(g, null, 2)), console.log("βœ… Created package.json"), n.mkdirSync("src/modules", { recursive: !0 }), n.mkdirSync("src/styles", { recursive: !0 }), n.writeFileSync("build.js", `import * as esbuild from 'esbuild';
1735
+ n.writeFileSync("package.json", JSON.stringify(f, null, 2)), console.log("βœ… Created package.json"), n.mkdirSync("src/modules", { recursive: !0 }), n.mkdirSync("src/styles", { recursive: !0 }), n.writeFileSync("build.js", `import * as esbuild from 'esbuild';
1706
1736
  import fs from 'fs';
1707
1737
  import path from 'path';
1708
1738
 
@@ -1810,7 +1840,7 @@ document.addEventListener('DOMContentLoaded', () => {
1810
1840
  });
1811
1841
  `;
1812
1842
  n.writeFileSync("src/index.js", j), console.log("βœ… Created src/index.js");
1813
- const $ = `// ${c} - Main Application Logic
1843
+ const S = `// ${c} - Main Application Logic
1814
1844
 
1815
1845
  export function init() {
1816
1846
  console.log('${c} loaded');
@@ -1818,7 +1848,7 @@ export function init() {
1818
1848
  // Your component logic here
1819
1849
  }
1820
1850
  `;
1821
- n.writeFileSync("src/modules/app.js", $), console.log("βœ… Created src/modules/app.js"), n.writeFileSync("src/modules/myop.js", `// Myop Interface - Communication with host app
1851
+ n.writeFileSync("src/modules/app.js", S), console.log("βœ… Created src/modules/app.js"), n.writeFileSync("src/modules/myop.js", `// Myop Interface - Communication with host app
1822
1852
 
1823
1853
  export function setupMyopInterface() {
1824
1854
  // Called when host app sends data to this component
@@ -1870,19 +1900,19 @@ p {
1870
1900
  `;
1871
1901
  n.writeFileSync("src/styles/main.css", v), console.log("βœ… Created src/styles/main.css"), console.log(`
1872
1902
  πŸ“¦ Next steps:`), console.log(" 1. npm install"), console.log(" 2. npm run build"), console.log(` 3. myop sync
1873
- `), d.myopConfig = S, await B(!0);
1874
- } catch (g) {
1875
- console.error(`Failed to initialize component: ${g.message}`), process.exit(1);
1903
+ `), d.myopConfig = x, await B(!0);
1904
+ } catch (f) {
1905
+ console.error(`Failed to initialize component: ${f.message}`), process.exit(1);
1876
1906
  }
1877
1907
  };
1878
1908
  d.program.command("default", { isDefault: !0 }).action(async () => {
1879
1909
  if (d.program.getOptionValue("help") && (console.log(Ke), process.exit()), d.program.getOptionValue("ci")) {
1880
- const c = await import("fs"), m = d.program.getOptionValue("config") || "./myop.config.json", S = d.program.version(), x = ye();
1881
- let g = { found: !1 };
1910
+ const c = await import("fs"), m = d.program.getOptionValue("config") || "./myop.config.json", x = d.program.version(), b = ye();
1911
+ let f = { found: !1 };
1882
1912
  try {
1883
1913
  if (c.existsSync(m)) {
1884
1914
  const w = c.readFileSync(m, "utf-8"), j = JSON.parse(w);
1885
- g = {
1915
+ f = {
1886
1916
  found: !0,
1887
1917
  path: m,
1888
1918
  name: j.name || j.componentName || null,
@@ -1891,14 +1921,14 @@ d.program.command("default", { isDefault: !0 }).action(async () => {
1891
1921
  };
1892
1922
  }
1893
1923
  } catch (w) {
1894
- g = { found: !1, error: w.message };
1924
+ f = { found: !1, error: w.message };
1895
1925
  }
1896
1926
  const y = {
1897
- version: S,
1898
- config: g,
1927
+ version: x,
1928
+ config: f,
1899
1929
  auth: {
1900
- loggedIn: !!(x != null && x.email),
1901
- email: (x == null ? void 0 : x.email) || null
1930
+ loggedIn: !!(b != null && b.email),
1931
+ email: (b == null ? void 0 : b.email) || null
1902
1932
  }
1903
1933
  };
1904
1934
  console.log(JSON.stringify(y, null, 2)), process.exit(0);
@@ -1907,10 +1937,10 @@ d.program.command("default", { isDefault: !0 }).action(async () => {
1907
1937
  text: "Loading Myop CLI...",
1908
1938
  color: "green"
1909
1939
  }).start();
1910
- const a = ce();
1911
- await St(500), n.stop();
1940
+ const i = ce();
1941
+ await xt(500), n.stop();
1912
1942
  const u = d.program.version();
1913
- await vt(u), await B(a.configFound);
1943
+ await vt(u), await B(i.configFound);
1914
1944
  });
1915
1945
  d.program.parse(process.argv);
1916
1946
  d.program.opts();