@myop/cli 0.1.16 β†’ 0.1.18

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 +304 -299
  2. package/package.json +1 -1
package/dist/myop-cli.js CHANGED
@@ -2,15 +2,15 @@
2
2
  import F from "ora";
3
3
  import { select as Ie, Separator as me } from "@inquirer/prompts";
4
4
  import { Command as We, Option as ce } from "commander";
5
- import { execSync as re } from "child_process";
5
+ import { execSync as re, spawn as Ge } from "child_process";
6
6
  import Z from "path";
7
7
  import A from "fs";
8
8
  import fe from "crypto";
9
- import Ge from "http";
10
- import { URL as je, URLSearchParams as Pe } from "url";
11
- import Ye from "open";
12
- import Ke from "os";
13
- const Xe = `
9
+ import Ye from "http";
10
+ import { URL as je, URLSearchParams as _e } from "url";
11
+ import Ke from "open";
12
+ import Xe from "os";
13
+ const Qe = `
14
14
  Usage: myop [OPTIONS] COMMAND [ARGS]...
15
15
 
16
16
  A powerful command-line interface for managing your Myop projects.
@@ -52,7 +52,7 @@ Examples:
52
52
  verbose: !1
53
53
  },
54
54
  myopConfig: null
55
- }, _e = {
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.",
@@ -64,7 +64,7 @@ Examples:
64
64
  }
65
65
  process.exit();
66
66
  }
67
- }, Qe = (e) => {
67
+ }, Ze = (e) => {
68
68
  const o = Z.join(d.executionPath, e);
69
69
  console.info(`reading config file from: ${o}`);
70
70
  const n = A.readFileSync(o, "utf8"), a = JSON.parse(n);
@@ -97,36 +97,36 @@ Examples:
97
97
  },
98
98
  action: () => {
99
99
  }
100
- }, Ze = {
100
+ }, qe = {
101
101
  name: "πŸ‘‹ Quit",
102
102
  value: "quit",
103
103
  description: "Quit and continue coding.",
104
104
  action: () => {
105
105
  process.exit();
106
106
  }
107
- }, qe = {
107
+ }, et = {
108
108
  name: "🟒 Create new component",
109
109
  value: "-",
110
110
  disabled: "(not available yet)"
111
- }, et = {
111
+ }, tt = {
112
112
  name: "πŸ”΅ Create new experience",
113
113
  value: "-",
114
114
  disabled: "(not available yet)"
115
- }, tt = {
115
+ }, ot = {
116
116
  name: "🟑 Create new skin",
117
117
  value: "-",
118
118
  disabled: "(not available yet)"
119
- }, ot = {
119
+ }, nt = {
120
120
  name: "πŸ”΄ Create new flow",
121
121
  value: "-",
122
122
  disabled: "(not available yet)"
123
- }, nt = {
123
+ }, st = {
124
124
  name: "πŸ†• Define new custom Myop message",
125
125
  value: "generateMyopMessage",
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
- }, st = [nt, qe, et, tt, ot];
129
- function rt(e, o, n, a) {
128
+ }, rt = [st, et, tt, ot, nt];
129
+ function it(e, o, n, a) {
130
130
  return `<!DOCTYPE html>
131
131
  <html lang="en">
132
132
  <head>
@@ -217,26 +217,26 @@ ${a}
217
217
  </html>`;
218
218
  }
219
219
  async function ke() {
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");
220
+ const e = await import("fs"), o = await import("path"), { exec: n } = await import("child_process"), a = await import("http"), { createHash: f } = await import("node:crypto");
221
221
  let c;
222
222
  if (import.meta.url.startsWith("file://")) {
223
- const s = import.meta.url.slice(7);
224
- c = o.default.dirname(s);
223
+ const t = new URL(import.meta.url).pathname, r = process.platform === "win32" && t.startsWith("/") ? t.slice(1) : t;
224
+ c = o.default.dirname(r);
225
225
  } else
226
226
  c = o.default.dirname(import.meta.url);
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;
227
+ const m = o.default.join(c, "commands", "dev", "management-website"), w = e.default.readFileSync(o.default.join(m, "styles.css"), "utf-8"), I = e.default.readFileSync(o.default.join(m, "app.js"), "utf-8"), u = 9292, y = 9293, S = "./dist";
228
+ let j = !1, v = !1;
229
229
  const k = /* @__PURE__ */ new Map(), z = d.program.getOptionValue("config") || "./myop.config.json";
230
- let v, E, h = !1;
230
+ let x, 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", E = t.componentName || t.name || null, h = t.HMR === !0, h && console.log("πŸ”₯ HMR enabled");
233
+ x = 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
  }
237
- const M = async () => {
238
- if (v !== "DEV" && v !== "NEW")
239
- return v;
237
+ const $ = async () => {
238
+ if (x !== "DEV" && x !== "NEW")
239
+ return x;
240
240
  try {
241
241
  const t = ((await new Promise((l, p) => {
242
242
  const g = {
@@ -245,9 +245,9 @@ async function ke() {
245
245
  path: "/_list",
246
246
  method: "GET",
247
247
  timeout: 1e3
248
- }, O = a.default.request(g, (P) => {
248
+ }, M = a.default.request(g, (_) => {
249
249
  let H = "";
250
- P.on("data", (L) => H += L), P.on("end", () => {
250
+ _.on("data", (L) => H += L), _.on("end", () => {
251
251
  try {
252
252
  l(JSON.parse(H));
253
253
  } catch {
@@ -255,9 +255,9 @@ async function ke() {
255
255
  }
256
256
  });
257
257
  });
258
- O.on("error", () => l({ components: [] })), O.on("timeout", () => {
259
- O.destroy(), l({ components: [] });
260
- }), O.end();
258
+ M.on("error", () => l({ components: [] })), M.on("timeout", () => {
259
+ M.destroy(), l({ components: [] });
260
+ }), M.end();
261
261
  })).components || []).map(([l]) => l).filter((l) => l === "DEV" || l === "NEW" || /^DEV\d+$/.test(l) || /^NEW\d+$/.test(l));
262
262
  if (t.length === 0)
263
263
  return "DEV1";
@@ -283,9 +283,9 @@ async function ke() {
283
283
  ".svg": "image/svg+xml",
284
284
  ".ico": "image/x-icon"
285
285
  }[t] || "application/octet-stream";
286
- }, C = /* @__PURE__ */ new Map(), q = [], Ae = 50, D = [], V = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map(), De = (s, t, r) => {
286
+ }, b = /* @__PURE__ */ new Map(), q = [], Ae = 50, D = [], V = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map(), De = (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 i = s.url.split("/_hmr/")[1], l = s.headers["sec-websocket-key"], p = f("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
@@ -307,19 +307,19 @@ Sec-WebSocket-Accept: ${p}\r
307
307
  s.on("data", (i) => r += i), s.on("end", () => {
308
308
  try {
309
309
  const { componentId: i, distPath: l, componentName: p } = JSON.parse(r);
310
- C.set(i, { path: l, name: p || null });
310
+ b.set(i, { path: l, name: p || null });
311
311
  const g = p ? ` (${p})` : "";
312
- console.log(`βœ… Registered: ${i}${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,
312
+ console.log(`βœ… Registered: ${i}${g} -> ${l}`), t.writeHead(200), t.end(JSON.stringify({ success: !0, registered: Array.from(b.keys()) }));
313
+ const M = Array.from(b.entries()).map(([_, H]) => ({
314
+ id: _,
315
315
  path: H.path,
316
316
  name: H.name
317
317
  }));
318
- D.forEach((P) => {
318
+ D.forEach((_) => {
319
319
  try {
320
- P.write(`data: ${JSON.stringify({
320
+ _.write(`data: ${JSON.stringify({
321
321
  type: "components",
322
- components: O
322
+ components: M
323
323
  })}
324
324
 
325
325
  `);
@@ -335,8 +335,8 @@ Sec-WebSocket-Accept: ${p}\r
335
335
  s.on("data", (i) => r += i), s.on("end", () => {
336
336
  try {
337
337
  const { componentId: i } = JSON.parse(r);
338
- C.delete(i), console.log(`❌ Unregistered: ${i}`), t.writeHead(200), t.end(JSON.stringify({ success: !0 }));
339
- const l = Array.from(C.entries()).map(([p, g]) => ({
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, g]) => ({
340
340
  id: p,
341
341
  path: g.path,
342
342
  name: g.name
@@ -356,57 +356,57 @@ Sec-WebSocket-Accept: ${p}\r
356
356
  t.writeHead(400), t.end(JSON.stringify({ error: i.message }));
357
357
  }
358
358
  });
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" })));
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
360
  }), ee = a.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:${f}`), i = r.pathname, l = i.split("/").filter((_) => _);
365
+ const r = new URL(s.url, `http://localhost:${u}`), i = r.pathname, l = i.split("/").filter((P) => P);
366
366
  if (i.startsWith("/consume")) {
367
- const _ = r.searchParams.get("id");
368
- if (!_) {
367
+ const P = r.searchParams.get("id");
368
+ if (!P) {
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 = C.get(_), J = R ? R.path : null, Oe = (W) => {
373
- let $ = "Unknown", T = "Unknown";
372
+ const R = b.get(P), J = R ? R.path : null, Oe = (W) => {
373
+ let C = "Unknown", T = "Unknown";
374
374
  if (s.headers.referer || s.headers.referrer) {
375
- const I = s.headers.referer || s.headers.referrer;
375
+ const O = s.headers.referer || s.headers.referrer;
376
376
  try {
377
- const G = new URL(I);
378
- $ = G.origin, T = G.hostname || G.origin;
377
+ const G = new URL(O);
378
+ C = G.origin, T = G.hostname || G.origin;
379
379
  } catch {
380
- $ = I, T = I;
380
+ C = O, T = O;
381
381
  }
382
382
  } else if (s.headers.origin)
383
383
  try {
384
- const I = new URL(s.headers.origin);
385
- $ = I.origin, T = I.hostname || I.origin;
384
+ const O = new URL(s.headers.origin);
385
+ C = O.origin, T = O.hostname || O.origin;
386
386
  } catch {
387
- $ = s.headers.origin, T = s.headers.origin;
387
+ C = s.headers.origin, T = s.headers.origin;
388
388
  }
389
389
  else if (s.socket.remoteAddress) {
390
- const I = s.socket.remoteAddress;
391
- I === "::1" || I === "::ffff:127.0.0.1" ? ($ = "localhost", T = "localhost (direct)") : ($ = I, T = I.replace("::ffff:", ""));
390
+ const O = s.socket.remoteAddress;
391
+ O === "::1" || O === "::ffff:127.0.0.1" ? (C = "localhost", T = "localhost (direct)") : (C = O, T = O.replace("::ffff:", ""));
392
392
  }
393
- const pe = s.headers.referer || s.headers.referrer || $, ne = {
393
+ const pe = s.headers.referer || s.headers.referrer || C, ne = {
394
394
  type: "request",
395
- componentId: _,
395
+ componentId: P,
396
396
  timestamp: Date.now(),
397
397
  servedLocally: W,
398
398
  referrer: pe,
399
- origin: $,
399
+ origin: C,
400
400
  originLabel: T
401
401
  };
402
- V.has($) || (V.set($, {
403
- url: $,
402
+ V.has(C) || (V.set(C, {
403
+ url: C,
404
404
  label: T,
405
405
  firstSeen: Date.now(),
406
406
  requestCount: 0
407
- }), D.forEach((I) => {
407
+ }), D.forEach((O) => {
408
408
  try {
409
- I.write(`data: ${JSON.stringify({
409
+ O.write(`data: ${JSON.stringify({
410
410
  type: "origins",
411
411
  origins: Array.from(V.values())
412
412
  })}
@@ -415,10 +415,10 @@ Sec-WebSocket-Accept: ${p}\r
415
415
  } catch {
416
416
  }
417
417
  }));
418
- const Ve = V.get($);
419
- Ve.requestCount++, D.forEach((I) => {
418
+ const Ve = V.get(C);
419
+ Ve.requestCount++, D.forEach((O) => {
420
420
  try {
421
- I.write(`data: ${JSON.stringify({
421
+ O.write(`data: ${JSON.stringify({
422
422
  type: "origins",
423
423
  origins: Array.from(V.values())
424
424
  })}
@@ -426,9 +426,9 @@ Sec-WebSocket-Accept: ${p}\r
426
426
  `);
427
427
  } catch {
428
428
  }
429
- }), q.push(ne), q.length > Ae && q.shift(), D.forEach((I) => {
429
+ }), q.push(ne), q.length > Ae && q.shift(), D.forEach((O) => {
430
430
  try {
431
- I.write(`data: ${JSON.stringify(ne)}
431
+ O.write(`data: ${JSON.stringify(ne)}
432
432
 
433
433
  `);
434
434
  } catch {
@@ -437,15 +437,15 @@ Sec-WebSocket-Accept: ${p}\r
437
437
  };
438
438
  if (J) {
439
439
  const W = o.default.join(J, "index.html");
440
- e.default.readFile(W, "utf-8", ($, T) => {
441
- if ($) {
440
+ e.default.readFile(W, "utf-8", (C, T) => {
441
+ if (C) {
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)}`, ne = {
446
446
  item: {
447
- name: _,
448
- id: _,
447
+ name: P,
448
+ id: P,
449
449
  consume_variant: [
450
450
  {
451
451
  id: pe,
@@ -459,21 +459,21 @@ Sec-WebSocket-Accept: ${p}\r
459
459
  ]
460
460
  }
461
461
  };
462
- console.log(`βœ… Serving consume JSON for: ${_}`), Oe(!0), t.writeHead(200, {
462
+ console.log(`βœ… Serving consume JSON for: ${P}`), Oe(!0), t.writeHead(200, {
463
463
  "Content-Type": "application/json",
464
464
  "Access-Control-Allow-Origin": "*"
465
465
  }), t.end(JSON.stringify(ne, null, 2));
466
466
  });
467
467
  } else {
468
- console.log(`πŸ“‘ Proxying consume request to cloud.myop.dev for: ${_}`);
468
+ console.log(`πŸ“‘ Proxying consume request to cloud.myop.dev for: ${P}`);
469
469
  const W = `https://cloud.myop.dev/consume${r.search}`;
470
- Oe(!1), fetch(W).then(($) => $.text()).then(($) => {
470
+ Oe(!1), fetch(W).then((C) => C.text()).then((C) => {
471
471
  t.writeHead(200, {
472
472
  "Content-Type": "application/json",
473
473
  "Access-Control-Allow-Origin": "*"
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" }));
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" }));
477
477
  });
478
478
  }
479
479
  return;
@@ -485,14 +485,14 @@ Sec-WebSocket-Accept: ${p}\r
485
485
  Connection: "keep-alive",
486
486
  "Access-Control-Allow-Origin": "*"
487
487
  }), D.push(t);
488
- const _ = Array.from(C.entries()).map(([R, J]) => ({
488
+ const P = Array.from(b.entries()).map(([R, J]) => ({
489
489
  id: R,
490
490
  path: J.path,
491
491
  name: J.name
492
492
  }));
493
493
  t.write(`data: ${JSON.stringify({
494
494
  type: "components",
495
- components: _
495
+ components: P
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(rt(f, y, x, b));
515
+ t.writeHead(200, { "Content-Type": "text/html" }), t.end(it(u, y, w, I));
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], g = C.get(p);
526
+ const p = l[1], g = b.get(p);
527
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 = g.path, P = l.slice(2), H = P.length === 0 ? "index.html" : P.join("/"), L = o.default.join(O, H);
532
- console.log(`πŸ“₯ Request: ${s.url} -> ${L}`), e.default.readFile(L, (_, R) => {
533
- if (_) {
531
+ const M = g.path, _ = l.slice(2), H = _.length === 0 ? "index.html" : _.join("/"), L = o.default.join(M, H);
532
+ console.log(`πŸ“₯ Request: ${s.url} -> ${L}`), e.default.readFile(L, (P, R) => {
533
+ if (P) {
534
534
  console.log(`❌ File not found: ${L}`), t.writeHead(404, { "Content-Type": "text/plain" }), t.end("Not Found");
535
535
  return;
536
536
  }
@@ -542,8 +542,8 @@ Sec-WebSocket-Accept: ${p}\r
542
542
  });
543
543
  }), ve = () => new Promise((s, t) => {
544
544
  const r = JSON.stringify({
545
- componentId: v,
546
- distPath: o.default.resolve(N, w),
545
+ componentId: x,
546
+ distPath: o.default.resolve(N, S),
547
547
  componentName: E
548
548
  }), i = {
549
549
  hostname: "localhost",
@@ -556,13 +556,13 @@ Sec-WebSocket-Accept: ${p}\r
556
556
  }
557
557
  }, l = a.default.request(i, (p) => {
558
558
  let g = "";
559
- p.on("data", (O) => g += O), p.on("end", () => {
559
+ p.on("data", (M) => g += M), p.on("end", () => {
560
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
  }), He = () => new Promise((s, t) => {
565
- const r = JSON.stringify({ componentId: v }), i = {
565
+ const r = JSON.stringify({ componentId: x }), i = {
566
566
  hostname: "localhost",
567
567
  port: y,
568
568
  path: "/_unregister",
@@ -577,7 +577,7 @@ Sec-WebSocket-Accept: ${p}\r
577
577
  l.on("error", () => s()), l.write(r), l.end();
578
578
  }), Le = () => {
579
579
  if (!h) return;
580
- const s = o.default.join(w, "index.html");
580
+ const s = o.default.join(S, "index.html");
581
581
  try {
582
582
  let t = e.default.readFileSync(s, "utf-8");
583
583
  if (t.includes("<!-- MYOP HMR -->")) {
@@ -588,7 +588,7 @@ Sec-WebSocket-Accept: ${p}\r
588
588
  <!-- MYOP HMR -->
589
589
  <script>
590
590
  (function() {
591
- const componentId = '${v}';
591
+ const componentId = '${x}';
592
592
  const wsUrl = 'ws://localhost:${y}/_hmr/' + componentId;
593
593
  let ws;
594
594
  let reconnectAttempts = 0;
@@ -716,11 +716,11 @@ Sec-WebSocket-Accept: ${p}\r
716
716
  ]), i;
717
717
  }, Ue = () => {
718
718
  if (!h) return;
719
- const s = U.get(v);
719
+ const s = U.get(x);
720
720
  if (!s || s.size === 0)
721
721
  return;
722
722
  console.log(`πŸ”₯ Notifying ${s.size} HMR client(s)`);
723
- const t = o.default.join(w, "index.html");
723
+ const t = o.default.join(S, "index.html");
724
724
  try {
725
725
  let r = e.default.readFileSync(t, "utf-8");
726
726
  if (r.includes("<!-- MYOP HMR -->")) {
@@ -745,7 +745,7 @@ Sec-WebSocket-Accept: ${p}\r
745
745
  let xe = !1;
746
746
  const te = () => {
747
747
  if (j) {
748
- S = !0;
748
+ v = !0;
749
749
  return;
750
750
  }
751
751
  j = !0, console.log(`
@@ -761,7 +761,7 @@ Sec-WebSocket-Accept: ${p}\r
761
761
  console.error("❌ Build failed:", s.message), r && console.error(r);
762
762
  } else
763
763
  console.log("βœ… Build completed"), t && console.log(t), Le(), Ue();
764
- S && (S = !1, te());
764
+ v && (v = !1, te());
765
765
  });
766
766
  }, Se = /* @__PURE__ */ new Set(), be = (s) => {
767
767
  e.default.readdir(s, { withFileTypes: !0 }, (t, r) => {
@@ -785,8 +785,8 @@ Sec-WebSocket-Accept: ${p}\r
785
785
  const g = o.default.join(s, l);
786
786
  setTimeout(() => {
787
787
  try {
788
- const O = e.default.readFileSync(g, "utf-8"), P = k.get(g);
789
- O !== P && (k.set(g, O), console.log(`πŸ“ File changed: ${g}`), te());
788
+ const M = e.default.readFileSync(g, "utf-8"), _ = k.get(g);
789
+ M !== _ && (k.set(g, M), console.log(`πŸ“ File changed: ${g}`), te());
790
790
  } catch {
791
791
  }
792
792
  }, 50);
@@ -794,7 +794,7 @@ Sec-WebSocket-Accept: ${p}\r
794
794
  });
795
795
  }, Ce = () => {
796
796
  console.log(`
797
- πŸ”¨ Component: ${v}`), te(), be(N), console.log("πŸ‘€ Watching .js, .css, and .html files for changes..."), console.log(`Press Ctrl+C to stop
797
+ πŸ”¨ Component: ${x}`), te(), be(N), console.log("πŸ‘€ Watching .js, .css, and .html files for changes..."), console.log(`Press Ctrl+C to stop
798
798
  `);
799
799
  }, Be = () => new Promise((s) => {
800
800
  const t = {
@@ -815,10 +815,10 @@ Sec-WebSocket-Accept: ${p}\r
815
815
  let l = "";
816
816
  r.on("data", (p) => l += p), r.on("end", () => {
817
817
  try {
818
- const { componentId: p, distPath: g, componentName: O } = JSON.parse(l);
819
- C.set(p, { path: g, name: O || null });
820
- const P = O ? ` (${O})` : "";
821
- console.log(`βœ… Registered: ${p}${P} -> ${g}`), i.writeHead(200), i.end(JSON.stringify({ success: !0, registered: Array.from(C.keys()) }));
818
+ const { componentId: p, distPath: g, componentName: M } = JSON.parse(l);
819
+ b.set(p, { path: g, name: M || null });
820
+ const _ = M ? ` (${M})` : "";
821
+ console.log(`βœ… Registered: ${p}${_} -> ${g}`), i.writeHead(200), i.end(JSON.stringify({ success: !0, registered: Array.from(b.keys()) }));
822
822
  } catch (p) {
823
823
  i.writeHead(400), i.end(JSON.stringify({ error: p.message }));
824
824
  }
@@ -828,12 +828,12 @@ Sec-WebSocket-Accept: ${p}\r
828
828
  r.on("data", (p) => l += p), r.on("end", () => {
829
829
  try {
830
830
  const { componentId: p } = JSON.parse(l);
831
- C.delete(p), console.log(`❌ Unregistered: ${p}`), i.writeHead(200), i.end(JSON.stringify({ success: !0 }));
831
+ b.delete(p), console.log(`❌ Unregistered: ${p}`), i.writeHead(200), i.end(JSON.stringify({ success: !0 }));
832
832
  } catch (p) {
833
833
  i.writeHead(400), i.end(JSON.stringify({ error: p.message }));
834
834
  }
835
835
  });
836
- } else r.method === "GET" && r.url === "/_list" ? (i.writeHead(200), i.end(JSON.stringify({ components: Array.from(C.entries()) }))) : (i.writeHead(404), i.end(JSON.stringify({ error: "Not found" })));
836
+ } 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" })));
837
837
  });
838
838
  t.on("error", () => {
839
839
  s(!1);
@@ -841,13 +841,13 @@ Sec-WebSocket-Accept: ${p}\r
841
841
  console.log(`
842
842
  πŸ”„ Taking over as server...`), console.log(`πŸ“‘ Management server on port ${y}`), ee.on("error", () => {
843
843
  t.close(), s(!1);
844
- }), ee.listen(f, () => {
845
- console.log(`πŸ“‘ Main server running at http://localhost:${f}`), C.set(v, {
846
- path: o.default.resolve(N, w),
844
+ }), ee.listen(u, () => {
845
+ console.log(`πŸ“‘ Main server running at http://localhost:${u}`), b.set(x, {
846
+ path: o.default.resolve(N, S),
847
847
  name: E
848
848
  });
849
849
  const r = E ? ` (${E})` : "";
850
- console.log(`βœ… Registered component: ${v}${r}`), console.log(`πŸ“‘ Access at: http://localhost:${f}/view/${v}/`), s(!0);
850
+ console.log(`βœ… Registered component: ${x}${r}`), console.log(`πŸ“‘ Access at: http://localhost:${u}/view/${x}/`), s(!0);
851
851
  });
852
852
  });
853
853
  });
@@ -857,7 +857,7 @@ Sec-WebSocket-Accept: ${p}\r
857
857
  await Be() || (clearInterval(oe), console.log(`
858
858
  ⚠️ Server appears to be down, attempting to take over...`), await ze() ? console.log("βœ… Successfully took over as server") : (console.log("ℹ️ Another instance took over, re-registering..."), setTimeout(async () => {
859
859
  try {
860
- await ve(), console.log(`βœ… Re-registered component: ${v}`), $e();
860
+ await ve(), console.log(`βœ… Re-registered component: ${x}`), $e();
861
861
  } catch (r) {
862
862
  console.error("❌ Failed to re-register:", r.message);
863
863
  }
@@ -873,9 +873,9 @@ Sec-WebSocket-Accept: ${p}\r
873
873
  console.log(`
874
874
  πŸ”— Connecting to existing dev server...`);
875
875
  try {
876
- v = await M();
876
+ x = await $();
877
877
  const t = await ve();
878
- console.log(`βœ… Registered component: ${v}`), console.log(`πŸ“‘ Access at: http://localhost:${f}/view/${v}/`), console.log(`πŸ“‹ All registered components: ${t.registered.join(", ")}`), Ce(), $e();
878
+ console.log(`βœ… Registered component: ${x}`), console.log(`πŸ“‘ Access at: http://localhost:${u}/view/${x}/`), console.log(`πŸ“‹ All registered components: ${t.registered.join(", ")}`), Ce(), $e();
879
879
  } catch (t) {
880
880
  console.error("❌ Failed to register component:", t.message), process.exit(1);
881
881
  }
@@ -885,18 +885,18 @@ Sec-WebSocket-Accept: ${p}\r
885
885
  console.log(`
886
886
  πŸš€ Starting shared dev server...`), console.log(`πŸ“‘ Management server on port ${y}`), ee.on("error", (s) => {
887
887
  console.error("❌ Main server error:", s.message), process.exit(1);
888
- }), ee.listen(f, async () => {
889
- console.log(`πŸ“‘ Main server running at http://localhost:${f}`), (v === "DEV" || v === "NEW") && (v = "DEV1"), C.set(v, {
890
- path: o.default.resolve(N, w),
888
+ }), ee.listen(u, async () => {
889
+ console.log(`πŸ“‘ Main server running at http://localhost:${u}`), (x === "DEV" || x === "NEW") && (x = "DEV1"), b.set(x, {
890
+ path: o.default.resolve(N, S),
891
891
  name: E
892
892
  });
893
893
  const s = E ? ` (${E})` : "";
894
- console.log(`βœ… Registered component: ${v}${s}`), console.log(`πŸ“‘ Access at: http://localhost:${f}/view/${v}/`), Ce();
894
+ console.log(`βœ… Registered component: ${x}${s}`), console.log(`πŸ“‘ Access at: http://localhost:${u}/view/${x}/`), Ce();
895
895
  });
896
896
  });
897
897
  }
898
- const ue = Z.join(Ke.homedir(), ".myop"), Q = Z.join(ue, "credentials.json");
899
- function it() {
898
+ const ue = Z.join(Xe.homedir(), ".myop"), Q = Z.join(ue, "credentials.json");
899
+ function at() {
900
900
  A.existsSync(ue) || A.mkdirSync(ue, { recursive: !0, mode: 448 });
901
901
  }
902
902
  function he() {
@@ -910,7 +910,7 @@ function he() {
910
910
  }
911
911
  }
912
912
  function Te(e) {
913
- it();
913
+ at();
914
914
  const o = {
915
915
  ...e,
916
916
  savedAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -927,7 +927,7 @@ function Re() {
927
927
  return console.error("Failed to clear credentials:", e.message), !1;
928
928
  }
929
929
  }
930
- function at(e) {
930
+ function ct(e) {
931
931
  if (!e || !e.expiresAt)
932
932
  return !0;
933
933
  const o = 5 * 60 * 1e3, n = new Date(e.expiresAt).getTime();
@@ -940,19 +940,19 @@ function ye() {
940
940
  userId: e.userId
941
941
  } : null;
942
942
  }
943
- const Y = process.env.MYOP_MCP_URL || "https://mcp.myop.dev", ie = 19284, we = `http://localhost:${ie}/callback`, ct = "myop-cli";
944
- function lt() {
943
+ const Y = process.env.MYOP_MCP_URL || "https://mcp.myop.dev", ie = 19284, we = `http://localhost:${ie}/callback`, lt = "myop-cli";
944
+ function dt() {
945
945
  return fe.randomBytes(32).toString("base64url");
946
946
  }
947
- function dt(e) {
947
+ function pt(e) {
948
948
  return fe.createHash("sha256").update(e).digest("base64url");
949
949
  }
950
- async function pt() {
950
+ async function mt() {
951
951
  const e = await fetch(`${Y}/oauth/register`, {
952
952
  method: "POST",
953
953
  headers: { "Content-Type": "application/json" },
954
954
  body: JSON.stringify({
955
- client_name: ct,
955
+ client_name: lt,
956
956
  redirect_uris: [we],
957
957
  grant_types: ["authorization_code", "refresh_token"],
958
958
  response_types: ["code"]
@@ -965,7 +965,7 @@ async function pt() {
965
965
  return e.json();
966
966
  }
967
967
  function se(e, o, n, a = null) {
968
- const u = {
968
+ const f = {
969
969
  success: `<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="#4ade80" stroke-width="2">
970
970
  <circle cx="12" cy="12" r="10"/>
971
971
  <path d="M8 12l2.5 2.5L16 9"/>
@@ -982,7 +982,7 @@ function se(e, o, n, a = null) {
982
982
  success: { accent: "#4ade80", glow: "rgba(74, 222, 128, 0.1)" },
983
983
  error: { accent: "#f87171", glow: "rgba(248, 113, 113, 0.1)" },
984
984
  warning: { accent: "#fbbf24", glow: "rgba(251, 191, 36, 0.1)" }
985
- }, { accent: m, glow: x } = c[e] || c.error;
985
+ }, { accent: m, glow: w } = c[e] || c.error;
986
986
  return `<!DOCTYPE html>
987
987
  <html lang="en">
988
988
  <head>
@@ -1075,7 +1075,7 @@ function se(e, o, n, a = null) {
1075
1075
  display: inline-flex;
1076
1076
  align-items: center;
1077
1077
  gap: 8px;
1078
- background: ${x};
1078
+ background: ${w};
1079
1079
  border: 1px solid ${m}33;
1080
1080
  border-radius: 4px;
1081
1081
  padding: 10px 16px;
@@ -1113,7 +1113,7 @@ function se(e, o, n, a = null) {
1113
1113
  <body>
1114
1114
  <div class="container">
1115
1115
  <div class="icon">
1116
- ${u[e] || u.error}
1116
+ ${f[e] || f.error}
1117
1117
  </div>
1118
1118
  <h1>${o}</h1>
1119
1119
  <p class="message">${n}</p>
@@ -1130,22 +1130,22 @@ function se(e, o, n, a = null) {
1130
1130
  </body>
1131
1131
  </html>`;
1132
1132
  }
1133
- function mt(e) {
1133
+ function ut(e) {
1134
1134
  return new Promise((o, n) => {
1135
- const a = Ge.createServer((u, c) => {
1136
- const m = new je(u.url, `http://localhost:${ie}`);
1135
+ const a = Ye.createServer((f, c) => {
1136
+ const m = new je(f.url, `http://localhost:${ie}`);
1137
1137
  if (m.pathname === "/callback") {
1138
- const x = m.searchParams.get("code"), b = m.searchParams.get("state"), f = m.searchParams.get("error");
1139
- if (f) {
1138
+ const w = m.searchParams.get("code"), I = m.searchParams.get("state"), u = m.searchParams.get("error");
1139
+ if (u) {
1140
1140
  c.writeHead(200, { "Content-Type": "text/html" }), c.end(se(
1141
1141
  "error",
1142
1142
  "Authentication Failed",
1143
1143
  "Unable to complete the authentication process.",
1144
- f
1145
- )), a.close(), n(new Error(`OAuth error: ${f}`));
1144
+ u
1145
+ )), a.close(), n(new Error(`OAuth error: ${u}`));
1146
1146
  return;
1147
1147
  }
1148
- if (b !== e) {
1148
+ if (I !== e) {
1149
1149
  c.writeHead(400, { "Content-Type": "text/html" }), c.end(se(
1150
1150
  "warning",
1151
1151
  "Security Error",
@@ -1154,7 +1154,7 @@ function mt(e) {
1154
1154
  )), a.close(), n(new Error("State mismatch"));
1155
1155
  return;
1156
1156
  }
1157
- if (!x) {
1157
+ if (!w) {
1158
1158
  c.writeHead(400, { "Content-Type": "text/html" }), c.end(se(
1159
1159
  "error",
1160
1160
  "Missing Authorization Code",
@@ -1167,7 +1167,7 @@ function mt(e) {
1167
1167
  "success",
1168
1168
  "Authentication Successful",
1169
1169
  "You have been authenticated successfully. Return to the terminal to continue."
1170
- )), a.close(), o(x);
1170
+ )), a.close(), o(w);
1171
1171
  } else
1172
1172
  c.writeHead(404), c.end("Not found");
1173
1173
  });
@@ -1178,11 +1178,11 @@ function mt(e) {
1178
1178
  }, 5 * 60 * 1e3);
1179
1179
  });
1180
1180
  }
1181
- async function ut(e, o, n) {
1181
+ async function ft(e, o, n) {
1182
1182
  const a = await fetch(`${Y}/oauth/token`, {
1183
1183
  method: "POST",
1184
1184
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
1185
- body: new Pe({
1185
+ body: new _e({
1186
1186
  grant_type: "authorization_code",
1187
1187
  code: e,
1188
1188
  client_id: o,
@@ -1191,16 +1191,16 @@ async function ut(e, o, n) {
1191
1191
  })
1192
1192
  });
1193
1193
  if (!a.ok) {
1194
- const u = await a.json();
1195
- throw new Error(u.error_description || u.error || "Token exchange failed");
1194
+ const f = await a.json();
1195
+ throw new Error(f.error_description || f.error || "Token exchange failed");
1196
1196
  }
1197
1197
  return a.json();
1198
1198
  }
1199
- async function ft(e, o) {
1199
+ async function gt(e, o) {
1200
1200
  const n = await fetch(`${Y}/oauth/token`, {
1201
1201
  method: "POST",
1202
1202
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
1203
- body: new Pe({
1203
+ body: new _e({
1204
1204
  grant_type: "refresh_token",
1205
1205
  refresh_token: e,
1206
1206
  client_id: o
@@ -1212,8 +1212,8 @@ async function ft(e, o) {
1212
1212
  }
1213
1213
  return n.json();
1214
1214
  }
1215
- async function gt(e) {
1216
- var u, c, m;
1215
+ async function ht(e) {
1216
+ var f, c, m;
1217
1217
  const o = await fetch(`${Y}/mcp`, {
1218
1218
  method: "POST",
1219
1219
  headers: {
@@ -1235,7 +1235,7 @@ async function gt(e) {
1235
1235
  const n = await o.json();
1236
1236
  if (n.error)
1237
1237
  throw new Error(n.error.message);
1238
- const a = (m = (c = (u = n.result) == null ? void 0 : u.content) == null ? void 0 : c[0]) == null ? void 0 : m.text;
1238
+ const a = (m = (c = (f = n.result) == null ? void 0 : f.content) == null ? void 0 : c[0]) == null ? void 0 : m.text;
1239
1239
  if (a)
1240
1240
  return JSON.parse(a);
1241
1241
  throw new Error("Invalid response from whoami");
@@ -1244,25 +1244,25 @@ async function X() {
1244
1244
  const e = F("Starting authentication...").start();
1245
1245
  try {
1246
1246
  e.text = "Registering OAuth client...";
1247
- const n = (await pt()).client_id, a = lt(), u = dt(a), c = fe.randomBytes(16).toString("hex");
1247
+ const n = (await mt()).client_id, a = dt(), f = pt(a), c = fe.randomBytes(16).toString("hex");
1248
1248
  e.text = "Waiting for authorization...";
1249
- const m = mt(c), x = new je(`${Y}/oauth/authorize`);
1250
- 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(`
1251
- 🌐 Opening browser for authentication...`), console.log("If the browser does not open, visit:"), console.log(` ${x.toString()}
1252
- `), await Ye(x.toString());
1253
- const b = await m;
1249
+ const m = ut(c), w = new je(`${Y}/oauth/authorize`);
1250
+ w.searchParams.set("response_type", "code"), w.searchParams.set("client_id", n), w.searchParams.set("redirect_uri", we), w.searchParams.set("code_challenge", f), w.searchParams.set("code_challenge_method", "S256"), w.searchParams.set("state", c), e.stop(), console.log(`
1251
+ 🌐 Opening browser for authentication...`), console.log("If the browser does not open, visit:"), console.log(` ${w.toString()}
1252
+ `), await Ke(w.toString());
1253
+ const I = await m;
1254
1254
  e.start("Exchanging authorization code...");
1255
- const f = await ut(b, n, a);
1255
+ const u = await ft(I, n, a);
1256
1256
  e.text = "Getting user info...";
1257
- const y = await gt(f.access_token), w = {
1258
- accessToken: f.access_token,
1259
- refreshToken: f.refresh_token,
1260
- expiresAt: new Date(Date.now() + f.expires_in * 1e3).toISOString(),
1257
+ const y = await ht(u.access_token), S = {
1258
+ accessToken: u.access_token,
1259
+ refreshToken: u.refresh_token,
1260
+ expiresAt: new Date(Date.now() + u.expires_in * 1e3).toISOString(),
1261
1261
  clientId: n,
1262
1262
  userId: y.userId,
1263
1263
  userEmail: y.email
1264
1264
  };
1265
- return Te(w), e.succeed(`Authenticated as ${y.email}`), w;
1265
+ return Te(S), e.succeed(`Authenticated as ${y.email}`), S;
1266
1266
  } catch (o) {
1267
1267
  throw e.fail(`Authentication failed: ${o.message}`), o;
1268
1268
  }
@@ -1275,17 +1275,17 @@ async function Fe() {
1275
1275
  }
1276
1276
  Re(), console.log(`βœ… Logged out (was: ${e.userEmail})`);
1277
1277
  }
1278
- async function ht() {
1278
+ async function yt() {
1279
1279
  let e = he();
1280
1280
  if (!e)
1281
1281
  return console.log(`Not logged in. Starting authentication...
1282
1282
  `), await X();
1283
- if (!at(e))
1283
+ if (!ct(e))
1284
1284
  return e;
1285
1285
  if (e.refreshToken) {
1286
1286
  const o = F("Refreshing access token...").start();
1287
1287
  try {
1288
- const n = await ft(
1288
+ const n = await gt(
1289
1289
  e.refreshToken,
1290
1290
  e.clientId
1291
1291
  );
@@ -1302,11 +1302,11 @@ async function ht() {
1302
1302
  return console.log(`Session expired. Please log in again.
1303
1303
  `), await X();
1304
1304
  }
1305
- function yt() {
1305
+ function wt() {
1306
1306
  return Y;
1307
1307
  }
1308
1308
  const ae = "@myop/cli";
1309
- async function wt() {
1309
+ async function vt() {
1310
1310
  try {
1311
1311
  const e = await fetch(`https://registry.npmjs.org/${ae}/latest`);
1312
1312
  return e.ok ? (await e.json()).version : null;
@@ -1314,21 +1314,21 @@ async function wt() {
1314
1314
  return null;
1315
1315
  }
1316
1316
  }
1317
- function vt(e, o) {
1317
+ function xt(e, o) {
1318
1318
  const n = e.split(".").map(Number), a = o.split(".").map(Number);
1319
- for (let u = 0; u < Math.max(n.length, a.length); u++) {
1320
- const c = n[u] || 0, m = a[u] || 0;
1319
+ for (let f = 0; f < Math.max(n.length, a.length); f++) {
1320
+ const c = n[f] || 0, m = a[f] || 0;
1321
1321
  if (c > m) return 1;
1322
1322
  if (c < m) return -1;
1323
1323
  }
1324
1324
  return 0;
1325
1325
  }
1326
- async function xt(e) {
1326
+ async function St(e) {
1327
1327
  const o = F({
1328
1328
  text: "Checking for updates...",
1329
1329
  color: "cyan"
1330
- }).start(), n = await wt();
1331
- if (o.stop(), !n || vt(n, e) <= 0)
1330
+ }).start(), n = await vt();
1331
+ if (o.stop(), !n || xt(n, e) <= 0)
1332
1332
  return !1;
1333
1333
  console.log(`
1334
1334
  πŸ“¦ New version available: ${e} β†’ ${n}
@@ -1342,30 +1342,35 @@ async function xt(e) {
1342
1342
  { name: "No, continue with current version", value: !1 }
1343
1343
  ]
1344
1344
  });
1345
- } catch (u) {
1346
- throw u.name === "ExitPromptError" && (console.log(`
1345
+ } catch (f) {
1346
+ throw f.name === "ExitPromptError" && (console.log(`
1347
1347
 
1348
1348
  πŸ‘‹ Goodbye!
1349
- `), process.exit(0)), u;
1349
+ `), process.exit(0)), f;
1350
1350
  }
1351
1351
  if (a) {
1352
- const u = F({
1352
+ const f = F({
1353
1353
  text: `Updating ${ae} to v${n}...`,
1354
1354
  color: "green"
1355
1355
  }).start();
1356
1356
  try {
1357
- re(`npm install -g ${ae}@latest`, { stdio: "pipe" }), u.succeed(`Updated to v${n}`), console.log(`
1358
- Please restart the CLI to use the new version.
1359
- `), process.exit(0);
1357
+ return re(`npm install -g ${ae}@latest`, { stdio: "pipe" }), f.succeed(`Updated to v${n}`), console.log(`
1358
+ πŸ”„ Restarting with new version...
1359
+ `), Ge("myop", process.argv.slice(2), {
1360
+ stdio: "inherit",
1361
+ shell: !0
1362
+ }).on("close", (m) => {
1363
+ process.exit(m || 0);
1364
+ }), !0;
1360
1365
  } catch {
1361
- return u.fail("Update failed"), console.log(`
1366
+ return f.fail("Update failed"), console.log(`
1362
1367
  You can manually update by running: npm install -g ${ae}@latest
1363
1368
  `), !1;
1364
1369
  }
1365
1370
  }
1366
1371
  return !1;
1367
1372
  }
1368
- const St = (e) => new Promise((o) => setTimeout(o, e));
1373
+ const bt = (e) => new Promise((o) => setTimeout(o, e));
1369
1374
  d.executionPath = process.cwd();
1370
1375
  const le = (e = !1) => {
1371
1376
  const o = d.program.getOptionValue("verbose");
@@ -1375,7 +1380,7 @@ const le = (e = !1) => {
1375
1380
  verbose: o
1376
1381
  };
1377
1382
  try {
1378
- return d.myopConfig = Qe(d.options.configPath), { configFound: !0 };
1383
+ return d.myopConfig = Ze(d.options.configPath), { configFound: !0 };
1379
1384
  } catch (n) {
1380
1385
  if (e) {
1381
1386
  console.info(`
@@ -1395,11 +1400,11 @@ const le = (e = !1) => {
1395
1400
  };
1396
1401
  [
1397
1402
  new me(),
1398
- ...st
1403
+ ...rt
1399
1404
  ];
1400
- const bt = "0.1.16";
1405
+ const Ct = "0.1.18";
1401
1406
  d.program = new We();
1402
- d.program.name("@myop/cli").description("Myop CLI - Remote UI Made Easy").version(bt);
1407
+ d.program.name("@myop/cli").description("Myop CLI - Remote UI Made Easy").version(Ct);
1403
1408
  d.program.addOption(new ce("-c, --config <value>", "myop.config.json file location").default("./myop.config.json", "./myop.config.json"));
1404
1409
  d.program.addOption(new ce("-h, --help", "Show helpful information"));
1405
1410
  d.program.addOption(new ce("-v, --verbose", "Enables verbose output mode for the command-line interface (CLI)."));
@@ -1411,7 +1416,7 @@ d.program.command("remove").description("Remove Myop asset").argument("<type>",
1411
1416
  le(), console.info("removing ", e, o, d.options.configPath), e === "flow" && Ne._action(o), process.exit();
1412
1417
  });
1413
1418
  d.program.command("install").description("Install Myop assets").action(async () => {
1414
- le(), await _e.action();
1419
+ le(), await Pe.action();
1415
1420
  });
1416
1421
  d.program.command("login").description("Authenticate with Myop platform").action(async () => {
1417
1422
  try {
@@ -1429,15 +1434,15 @@ d.program.command("whoami").description("Show current authenticated user").actio
1429
1434
  e && e.email ? console.log(`Logged in as: ${e.email}`) : console.log("Not logged in. Run `myop login` to authenticate."), process.exit(0);
1430
1435
  });
1431
1436
  d.program.command("sync").description("Build and upload component to Myop platform").option("--skip-build", "Skip the build step").action(async (e) => {
1432
- var j, S, k, z, v, E;
1433
- const o = d.program.getOptionValue("config") || "./myop.config.json", n = await import("fs"), { execSync: a } = await import("child_process"), u = await import("path");
1437
+ var j, v, k, z, x, E;
1438
+ const o = d.program.getOptionValue("config") || "./myop.config.json", n = await import("fs"), { execSync: a } = await import("child_process"), f = await import("path");
1434
1439
  let c = {};
1435
1440
  if (n.existsSync(o))
1436
1441
  try {
1437
1442
  const h = n.readFileSync(o, "utf-8");
1438
1443
  c = JSON.parse(h);
1439
- const M = c.name || c.componentName;
1440
- console.log(`πŸ“‹ Found config: ${M || "Unnamed component"}`), c.componentId && console.log(` Component ID: ${c.componentId}`);
1444
+ const $ = c.name || c.componentName;
1445
+ console.log(`πŸ“‹ Found config: ${$ || "Unnamed component"}`), c.componentId && console.log(` Component ID: ${c.componentId}`);
1441
1446
  } catch (h) {
1442
1447
  console.error(`⚠️ Failed to parse ${o}:`, h.message);
1443
1448
  }
@@ -1447,26 +1452,26 @@ d.program.command("sync").description("Build and upload component to Myop platfo
1447
1452
  const h = F("Building project...").start();
1448
1453
  try {
1449
1454
  a("npm run build", { stdio: "pipe" }), h.succeed("Build completed");
1450
- } catch (M) {
1451
- h.fail("Build failed"), console.error(M.message), process.exit(1);
1455
+ } catch ($) {
1456
+ h.fail("Build failed"), console.error($.message), process.exit(1);
1452
1457
  }
1453
1458
  }
1454
1459
  const m = "./dist/index.html";
1455
1460
  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));
1456
- let x;
1461
+ let w;
1457
1462
  try {
1458
- x = await ht();
1463
+ w = await yt();
1459
1464
  } catch (h) {
1460
1465
  console.error("❌ Authentication failed:", h.message), process.exit(1);
1461
1466
  }
1462
- const b = yt();
1463
- let f = F("Requesting upload URL...").start(), y;
1467
+ const I = wt();
1468
+ let u = F("Requesting upload URL...").start(), y;
1464
1469
  try {
1465
- const h = await fetch(`${b}/mcp`, {
1470
+ const h = await fetch(`${I}/mcp`, {
1466
1471
  method: "POST",
1467
1472
  headers: {
1468
1473
  "Content-Type": "application/json",
1469
- Authorization: `Bearer ${x.accessToken}`
1474
+ Authorization: `Bearer ${w.accessToken}`
1470
1475
  },
1471
1476
  body: JSON.stringify({
1472
1477
  jsonrpc: "2.0",
@@ -1475,7 +1480,7 @@ d.program.command("sync").description("Build and upload component to Myop platfo
1475
1480
  params: {
1476
1481
  name: "upload_component",
1477
1482
  arguments: {
1478
- name: c.name || c.componentName || u.default.basename(process.cwd()),
1483
+ name: c.name || c.componentName || f.default.basename(process.cwd()),
1479
1484
  componentId: c.componentId || void 0,
1480
1485
  organization: c.organization || void 0
1481
1486
  }
@@ -1484,32 +1489,32 @@ d.program.command("sync").description("Build and upload component to Myop platfo
1484
1489
  });
1485
1490
  if (!h.ok)
1486
1491
  throw new Error(`Server returned ${h.status}`);
1487
- const M = await h.json();
1488
- if (M.error)
1489
- throw new Error(M.error.message);
1490
- const N = (k = (S = (j = M.result) == null ? void 0 : j.content) == null ? void 0 : S[0]) == null ? void 0 : k.text;
1492
+ const $ = await h.json();
1493
+ if ($.error)
1494
+ throw new Error($.error.message);
1495
+ const N = (k = (v = (j = $.result) == null ? void 0 : j.content) == null ? void 0 : v[0]) == null ? void 0 : k.text;
1491
1496
  if (y = JSON.parse(N), !y.success)
1492
1497
  throw new Error(y.error);
1493
- f.succeed("Upload URL obtained");
1498
+ u.succeed("Upload URL obtained");
1494
1499
  } catch (h) {
1495
- f.fail("Failed to get upload URL"), console.error(" ", h.message), process.exit(1);
1500
+ u.fail("Failed to get upload URL"), console.error(" ", h.message), process.exit(1);
1496
1501
  }
1497
- f = F("Uploading component...").start();
1502
+ u = F("Uploading component...").start();
1498
1503
  try {
1499
1504
  const h = n.readFileSync(m, "utf-8");
1500
- let M;
1505
+ let $;
1501
1506
  const N = y.curlCommand.match(/(?:"|\\")([^"\\]+(?:\\.[^"\\]*)*)(?:"|\\")$/);
1502
1507
  if (N)
1503
- M = N[1];
1508
+ $ = N[1];
1504
1509
  else {
1505
- const C = y.curlCommand.match(/(https:\/\/[^\s"\\]+)/);
1506
- if (C)
1507
- M = C[1];
1510
+ const b = y.curlCommand.match(/(https:\/\/[^\s"\\]+)/);
1511
+ if (b)
1512
+ $ = b[1];
1508
1513
  else
1509
1514
  throw new Error("Could not parse presigned URL from: " + y.curlCommand);
1510
1515
  }
1511
- console.info("Uploading to:", M.substring(0, 100) + "...");
1512
- const K = await fetch(M, {
1516
+ console.info("Uploading to:", $.substring(0, 100) + "...");
1517
+ const K = await fetch($, {
1513
1518
  method: "PUT",
1514
1519
  headers: {
1515
1520
  "Content-Type": "text/html"
@@ -1517,21 +1522,21 @@ d.program.command("sync").description("Build and upload component to Myop platfo
1517
1522
  body: h
1518
1523
  });
1519
1524
  if (!K.ok) {
1520
- const C = await K.text();
1521
- throw new Error(`Upload failed with status ${K.status}: ${C}`);
1525
+ const b = await K.text();
1526
+ throw new Error(`Upload failed with status ${K.status}: ${b}`);
1522
1527
  }
1523
- f.succeed("Component uploaded");
1528
+ u.succeed("Component uploaded");
1524
1529
  } catch (h) {
1525
- f.fail("Upload failed"), console.error(" ", h.message), h.cause && console.error(" Cause:", h.cause), process.exit(1);
1530
+ u.fail("Upload failed"), console.error(" ", h.message), h.cause && console.error(" Cause:", h.cause), process.exit(1);
1526
1531
  }
1527
- f = F("Confirming upload...").start();
1528
- let w;
1532
+ u = F("Confirming upload...").start();
1533
+ let S;
1529
1534
  try {
1530
- const h = await fetch(`${b}/mcp`, {
1535
+ const h = await fetch(`${I}/mcp`, {
1531
1536
  method: "POST",
1532
1537
  headers: {
1533
1538
  "Content-Type": "application/json",
1534
- Authorization: `Bearer ${x.accessToken}`
1539
+ Authorization: `Bearer ${w.accessToken}`
1535
1540
  },
1536
1541
  body: JSON.stringify({
1537
1542
  jsonrpc: "2.0",
@@ -1547,31 +1552,31 @@ d.program.command("sync").description("Build and upload component to Myop platfo
1547
1552
  });
1548
1553
  if (!h.ok)
1549
1554
  throw new Error(`Server returned ${h.status}`);
1550
- const M = await h.json();
1551
- if (M.error)
1552
- throw new Error(M.error.message);
1553
- const N = (E = (v = (z = M.result) == null ? void 0 : z.content) == null ? void 0 : v[0]) == null ? void 0 : E.text;
1554
- if (w = JSON.parse(N), !w.success)
1555
- throw new Error(w.error);
1556
- f.succeed("Upload confirmed");
1555
+ const $ = await h.json();
1556
+ if ($.error)
1557
+ throw new Error($.error.message);
1558
+ const N = (E = (x = (z = $.result) == null ? void 0 : z.content) == null ? void 0 : x[0]) == null ? void 0 : E.text;
1559
+ if (S = JSON.parse(N), !S.success)
1560
+ throw new Error(S.error);
1561
+ u.succeed("Upload confirmed");
1557
1562
  } catch (h) {
1558
- f.fail("Confirmation failed"), console.error(" ", h.message), process.exit(1);
1563
+ u.fail("Confirmation failed"), console.error(" ", h.message), process.exit(1);
1559
1564
  }
1560
- if (w.isNewComponent || !c.componentId) {
1561
- c.componentId = w.componentId, c.organization = w.orgId, c.name || (c.name = w.componentName);
1565
+ if (S.isNewComponent || !c.componentId) {
1566
+ c.componentId = S.componentId, c.organization = S.orgId, c.name || (c.name = S.componentName);
1562
1567
  try {
1563
1568
  n.writeFileSync(o, JSON.stringify(c, null, 2)), console.log(`
1564
1569
  πŸ“ Updated ${o} with componentId`);
1565
1570
  } catch (h) {
1566
1571
  console.log(`
1567
- ⚠️ Could not update ${o}: ${h.message}`), console.log(` Please add componentId: "${w.componentId}" manually`);
1572
+ ⚠️ Could not update ${o}: ${h.message}`), console.log(` Please add componentId: "${S.componentId}" manually`);
1568
1573
  }
1569
1574
  }
1570
1575
  console.log(`
1571
- βœ… Sync completed successfully!`), console.log(` Component: ${w.componentName}`), console.log(` Dashboard: ${w.dashboardUrl}`), process.exit(0);
1576
+ βœ… Sync completed successfully!`), console.log(` Component: ${S.componentName}`), console.log(` Dashboard: ${S.dashboardUrl}`), process.exit(0);
1572
1577
  });
1573
1578
  d.program.command("dev").description("Start development server with file watching").action(ke);
1574
- const Ct = () => {
1579
+ const $t = () => {
1575
1580
  try {
1576
1581
  re("git --version", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
1577
1582
  } catch {
@@ -1594,22 +1599,22 @@ const Ct = () => {
1594
1599
  deletions: 0
1595
1600
  };
1596
1601
  const o = e.split(`
1597
- `), n = o[o.length - 1], a = n.match(/(\d+) insertion/), u = n.match(/(\d+) deletion/), c = n.match(/(\d+) file/);
1602
+ `), n = o[o.length - 1], a = n.match(/(\d+) insertion/), f = n.match(/(\d+) deletion/), c = n.match(/(\d+) file/);
1598
1603
  return {
1599
1604
  files: c ? parseInt(c[1]) : 0,
1600
1605
  insertions: a ? parseInt(a[1]) : 0,
1601
- deletions: u ? parseInt(u[1]) : 0
1606
+ deletions: f ? parseInt(f[1]) : 0
1602
1607
  };
1603
1608
  } catch {
1604
1609
  return null;
1605
1610
  }
1606
1611
  }, B = async (e = !1, o = !1) => {
1607
- var y, w, j;
1608
- 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 = Ct();
1612
+ var y, S, j;
1613
+ const n = ye(), a = !!(n != null && n.email), f = ((y = d.myopConfig) == null ? void 0 : y.name) || ((S = d.myopConfig) == null ? void 0 : S.componentName), c = (j = d.myopConfig) == null ? void 0 : j.componentId, m = $t();
1609
1614
  console.log(`
1610
1615
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”`), console.log("β”‚ β”‚"), console.log("β”‚ Welcome to Myop CLI - Remote UI Made Easy β”‚"), console.log("β”‚ β”‚"), console.log(`β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1611
- `), 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("");
1612
- const b = [
1616
+ `), e && f ? (console.log(` Component: ${f}`), 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("");
1617
+ const I = [
1613
1618
  {
1614
1619
  emoji: "πŸš€",
1615
1620
  label: "Initialize new component",
@@ -1619,25 +1624,25 @@ const Ct = () => {
1619
1624
  },
1620
1625
  {
1621
1626
  emoji: "πŸ“¦",
1622
- label: u ? `Push "${u}"` : "Push component",
1627
+ label: f ? `Push "${f}"` : "Push component",
1623
1628
  value: "sync",
1624
1629
  help: "Builds project & uploads dist/index.html to Myop",
1625
1630
  disabled: e ? a ? !1 : "(login required)" : "(no config file)"
1626
1631
  },
1627
1632
  {
1628
1633
  emoji: "πŸ› οΈ ",
1629
- label: u ? `Start dev mode for "${u}"` : "Start dev mode",
1634
+ label: f ? `Start dev mode for "${f}"` : "Start dev mode",
1630
1635
  value: "dev",
1631
1636
  help: "Starts dev server with HMR for instant preview of changes",
1632
1637
  disabled: e ? !1 : "(no config file)"
1633
1638
  }
1634
- ].map((S) => ({
1635
- name: o && !S.disabled ? `${S.emoji} ${S.label}
1636
- ${S.help}` : `${S.emoji} ${S.label}`,
1637
- value: S.value,
1638
- disabled: S.disabled
1639
+ ].map((v) => ({
1640
+ name: o && !v.disabled ? `${v.emoji} ${v.label}
1641
+ ${v.help}` : `${v.emoji} ${v.label}`,
1642
+ value: v.value,
1643
+ disabled: v.disabled
1639
1644
  }));
1640
- b.push(
1645
+ I.push(
1641
1646
  new me(),
1642
1647
  {
1643
1648
  name: o && a ? `πŸ”“ Logout (${n.email})
@@ -1655,29 +1660,29 @@ const Ct = () => {
1655
1660
  value: "exit"
1656
1661
  }
1657
1662
  );
1658
- let f;
1663
+ let u;
1659
1664
  try {
1660
- f = await Ie({
1665
+ u = await Ie({
1661
1666
  message: "What would you like to do?",
1662
- choices: b
1667
+ choices: I
1663
1668
  });
1664
- } catch (S) {
1665
- throw S.name === "ExitPromptError" && (console.log(`
1669
+ } catch (v) {
1670
+ throw v.name === "ExitPromptError" && (console.log(`
1666
1671
 
1667
1672
  πŸ‘‹ Goodbye!
1668
- `), process.exit(0)), S;
1673
+ `), process.exit(0)), v;
1669
1674
  }
1670
- switch (f) {
1675
+ switch (u) {
1671
1676
  case "init":
1672
- await $t();
1677
+ await Mt();
1673
1678
  break;
1674
1679
  case "sync":
1675
1680
  console.log(`
1676
1681
  Running sync...
1677
1682
  `);
1678
- const { execSync: S } = await import("child_process");
1683
+ const { execSync: v } = await import("child_process");
1679
1684
  try {
1680
- S("node " + process.argv[1] + " sync", { stdio: "inherit" });
1685
+ v("node " + process.argv[1] + " sync", { stdio: "inherit" });
1681
1686
  } catch {
1682
1687
  }
1683
1688
  await B(!0, o);
@@ -1703,13 +1708,13 @@ Running sync...
1703
1708
  case "exit":
1704
1709
  process.exit(0);
1705
1710
  }
1706
- }, $t = async () => {
1707
- const { input: e, select: o } = await import("@inquirer/prompts"), n = await import("fs"), u = (await import("path")).default.basename(process.cwd());
1711
+ }, Mt = async () => {
1712
+ const { input: e, select: o } = await import("@inquirer/prompts"), n = await import("fs"), f = (await import("path")).default.basename(process.cwd());
1708
1713
  let c, m;
1709
1714
  try {
1710
1715
  c = await e({
1711
1716
  message: "Component name:",
1712
- default: u
1717
+ default: f
1713
1718
  }), m = await o({
1714
1719
  message: "Component type:",
1715
1720
  choices: [
@@ -1719,21 +1724,21 @@ Running sync...
1719
1724
  { name: "πŸ…°οΈ Angular", value: "angular", disabled: "(coming soon)" }
1720
1725
  ]
1721
1726
  });
1722
- } catch (f) {
1723
- throw f.name === "ExitPromptError" && (console.log(`
1727
+ } catch (u) {
1728
+ throw u.name === "ExitPromptError" && (console.log(`
1724
1729
 
1725
1730
  πŸ‘‹ Goodbye!
1726
- `), process.exit(0)), f;
1731
+ `), process.exit(0)), u;
1727
1732
  }
1728
- const x = {
1733
+ const w = {
1729
1734
  name: c,
1730
1735
  type: m,
1731
1736
  author: "@myop-cli"
1732
- }, b = d.program.getOptionValue("config") || "./myop.config.json";
1737
+ }, I = d.program.getOptionValue("config") || "./myop.config.json";
1733
1738
  try {
1734
- n.writeFileSync(b, JSON.stringify(x, null, 2)), console.log(`
1735
- βœ… Created ${b}`);
1736
- const f = {
1739
+ n.writeFileSync(I, JSON.stringify(w, null, 2)), console.log(`
1740
+ βœ… Created ${I}`);
1741
+ const u = {
1737
1742
  name: c.toLowerCase().replace(/\s+/g, "-"),
1738
1743
  version: "1.0.0",
1739
1744
  type: "module",
@@ -1745,7 +1750,7 @@ Running sync...
1745
1750
  esbuild: "^0.24.0"
1746
1751
  }
1747
1752
  };
1748
- 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';
1753
+ n.writeFileSync("package.json", JSON.stringify(u, 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';
1749
1754
  import fs from 'fs';
1750
1755
  import path from 'path';
1751
1756
 
@@ -1825,7 +1830,7 @@ fs.writeFileSync('dist/index.html', html);
1825
1830
  console.log('βœ… Built dist/index.html');
1826
1831
  console.log(\` Bundled \${jsFiles.length} JS modules, \${cssFiles.length} CSS files\`);
1827
1832
  `), console.log("βœ… Created build.js");
1828
- const w = `<!DOCTYPE html>
1833
+ const S = `<!DOCTYPE html>
1829
1834
  <html lang="en">
1830
1835
  <head>
1831
1836
  <meta charset="UTF-8">
@@ -1842,7 +1847,7 @@ console.log(\` Bundled \${jsFiles.length} JS modules, \${cssFiles.length} CSS
1842
1847
  </body>
1843
1848
  </html>
1844
1849
  `;
1845
- n.writeFileSync("index.html", w), console.log("βœ… Created index.html");
1850
+ n.writeFileSync("index.html", S), console.log("βœ… Created index.html");
1846
1851
  const j = `// ${c} - Entry Point
1847
1852
  import { init } from './modules/app.js';
1848
1853
  import { setupMyopInterface } from './modules/myop.js';
@@ -1853,7 +1858,7 @@ document.addEventListener('DOMContentLoaded', () => {
1853
1858
  });
1854
1859
  `;
1855
1860
  n.writeFileSync("src/index.js", j), console.log("βœ… Created src/index.js");
1856
- const S = `// ${c} - Main Application Logic
1861
+ const v = `// ${c} - Main Application Logic
1857
1862
 
1858
1863
  export function init() {
1859
1864
  console.log('${c} loaded');
@@ -1861,7 +1866,7 @@ export function init() {
1861
1866
  // Your component logic here
1862
1867
  }
1863
1868
  `;
1864
- 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
1869
+ n.writeFileSync("src/modules/app.js", v), console.log("βœ… Created src/modules/app.js"), n.writeFileSync("src/modules/myop.js", `// Myop Interface - Communication with host app
1865
1870
 
1866
1871
  export function setupMyopInterface() {
1867
1872
  // Called when host app sends data to this component
@@ -1882,7 +1887,7 @@ export function setupMyopInterface() {
1882
1887
  @import './main.css';
1883
1888
  `;
1884
1889
  n.writeFileSync("src/styles/index.css", z), console.log("βœ… Created src/styles/index.css");
1885
- const v = `/* ${c} - Main Styles */
1890
+ const x = `/* ${c} - Main Styles */
1886
1891
 
1887
1892
  * {
1888
1893
  box-sizing: border-box;
@@ -1911,49 +1916,49 @@ p {
1911
1916
  line-height: 1.5;
1912
1917
  }
1913
1918
  `;
1914
- n.writeFileSync("src/styles/main.css", v), console.log("βœ… Created src/styles/main.css"), console.log(`
1919
+ n.writeFileSync("src/styles/main.css", x), console.log("βœ… Created src/styles/main.css"), console.log(`
1915
1920
  πŸ“¦ Next steps:`), console.log(" 1. npm install"), console.log(" 2. npm run build"), console.log(` 3. myop sync
1916
- `), d.myopConfig = x, await B(!0);
1917
- } catch (f) {
1918
- console.error(`Failed to initialize component: ${f.message}`), process.exit(1);
1921
+ `), d.myopConfig = w, await B(!0);
1922
+ } catch (u) {
1923
+ console.error(`Failed to initialize component: ${u.message}`), process.exit(1);
1919
1924
  }
1920
1925
  };
1921
1926
  d.program.command("default", { isDefault: !0 }).action(async () => {
1922
- if (d.program.getOptionValue("help") && (console.log(Xe), process.exit()), d.program.getOptionValue("ci")) {
1923
- const c = await import("fs"), m = d.program.getOptionValue("config") || "./myop.config.json", x = d.program.version(), b = ye();
1924
- let f = { found: !1 };
1927
+ if (d.program.getOptionValue("help") && (console.log(Qe), process.exit()), d.program.getOptionValue("ci")) {
1928
+ const m = await import("fs"), w = d.program.getOptionValue("config") || "./myop.config.json", I = d.program.version(), u = ye();
1929
+ let y = { found: !1 };
1925
1930
  try {
1926
- if (c.existsSync(m)) {
1927
- const w = c.readFileSync(m, "utf-8"), j = JSON.parse(w);
1928
- f = {
1931
+ if (m.existsSync(w)) {
1932
+ const j = m.readFileSync(w, "utf-8"), v = JSON.parse(j);
1933
+ y = {
1929
1934
  found: !0,
1930
- path: m,
1931
- name: j.name || j.componentName || null,
1932
- componentId: j.componentId || null,
1933
- organization: j.organization || null
1935
+ path: w,
1936
+ name: v.name || v.componentName || null,
1937
+ componentId: v.componentId || null,
1938
+ organization: v.organization || null
1934
1939
  };
1935
1940
  }
1936
- } catch (w) {
1937
- f = { found: !1, error: w.message };
1941
+ } catch (j) {
1942
+ y = { found: !1, error: j.message };
1938
1943
  }
1939
- const y = {
1940
- version: x,
1941
- config: f,
1944
+ const S = {
1945
+ version: I,
1946
+ config: y,
1942
1947
  auth: {
1943
- loggedIn: !!(b != null && b.email),
1944
- email: (b == null ? void 0 : b.email) || null
1948
+ loggedIn: !!(u != null && u.email),
1949
+ email: (u == null ? void 0 : u.email) || null
1945
1950
  }
1946
1951
  };
1947
- console.log(JSON.stringify(y, null, 2)), process.exit(0);
1952
+ console.log(JSON.stringify(S, null, 2)), process.exit(0);
1948
1953
  }
1949
1954
  let n = F({
1950
1955
  text: "Loading Myop CLI...",
1951
1956
  color: "green"
1952
1957
  }).start();
1953
1958
  const a = le();
1954
- await St(500), n.stop();
1955
- const u = d.program.version();
1956
- await xt(u), await B(a.configFound);
1959
+ await bt(500), n.stop();
1960
+ const f = d.program.version();
1961
+ await St(f) || await B(a.configFound);
1957
1962
  });
1958
1963
  d.program.parse(process.argv);
1959
1964
  d.program.opts();