@myop/cli 0.1.55 β 0.1.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/myop-cli.js +114 -112
- package/package.json +1 -1
package/dist/myop-cli.js
CHANGED
|
@@ -13,40 +13,42 @@ import It from "http";
|
|
|
13
13
|
import { URL as it, URLSearchParams as rt } from "url";
|
|
14
14
|
import Ot from "open";
|
|
15
15
|
import at from "os";
|
|
16
|
-
const kt = `
|
|
17
|
-
Usage: myop [OPTIONS] COMMAND
|
|
16
|
+
const kt = "0.1.56", Rt = `
|
|
17
|
+
Usage: myop [OPTIONS] [COMMAND]
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Myop CLI - Remote UI Made Easy
|
|
20
20
|
|
|
21
21
|
Options:
|
|
22
|
-
-h, --help
|
|
23
|
-
-v, --
|
|
24
|
-
--config
|
|
22
|
+
-h, --help Show this help message and exit
|
|
23
|
+
-v, --verbose Enable verbose output
|
|
24
|
+
-c, --config <path> Path to myop.config.json (default: ./myop.config.json)
|
|
25
|
+
-m, --monorepo Monorepo mode: serve multiple components
|
|
26
|
+
--ci CI mode: output status as JSON, no prompts
|
|
27
|
+
--version Show CLI version
|
|
25
28
|
|
|
26
29
|
Commands:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
create Create a new Myop component (interactive)
|
|
31
|
+
dev Start dev server with file watching and HMR
|
|
32
|
+
push [componentId] Upload component to Myop platform
|
|
33
|
+
pull [componentId] Download component HTML from Myop platform
|
|
34
|
+
list [--org <orgId>] Browse, search, and batch pull/push components
|
|
35
|
+
login Authenticate with Myop (opens browser)
|
|
36
|
+
logout Clear stored credentials
|
|
37
|
+
whoami Show current authenticated user
|
|
38
|
+
train Install AI skills for coding assistants
|
|
39
|
+
mcp Configure MCP server for your IDE
|
|
34
40
|
|
|
35
|
-
|
|
36
|
-
https://docs.mycli.dev
|
|
41
|
+
Run without a command to open the interactive menu.
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
https://github.com/username/mycli
|
|
40
|
-
|
|
41
|
-
Version: 1.0.0
|
|
43
|
+
Version: ${kt}
|
|
42
44
|
|
|
43
45
|
Examples:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
myop create
|
|
47
|
+
myop dev
|
|
48
|
+
myop dev -m
|
|
49
|
+
myop push
|
|
50
|
+
myop pull <componentId>
|
|
51
|
+
myop list
|
|
50
52
|
`, v = {
|
|
51
53
|
program: null,
|
|
52
54
|
executionPath: "",
|
|
@@ -67,7 +69,7 @@ Examples:
|
|
|
67
69
|
}
|
|
68
70
|
process.exit();
|
|
69
71
|
}
|
|
70
|
-
},
|
|
72
|
+
}, Nt = (o) => {
|
|
71
73
|
const t = R.join(v.executionPath, o);
|
|
72
74
|
console.info(`reading config file from: ${t}`);
|
|
73
75
|
const e = P.readFileSync(t, "utf8"), n = JSON.parse(e);
|
|
@@ -100,36 +102,36 @@ Examples:
|
|
|
100
102
|
},
|
|
101
103
|
action: () => {
|
|
102
104
|
}
|
|
103
|
-
},
|
|
105
|
+
}, _t = {
|
|
104
106
|
name: "π Quit",
|
|
105
107
|
value: "quit",
|
|
106
108
|
description: "Quit and continue coding.",
|
|
107
109
|
action: () => {
|
|
108
110
|
process.exit();
|
|
109
111
|
}
|
|
110
|
-
},
|
|
112
|
+
}, Tt = {
|
|
111
113
|
name: "π’ Create new component",
|
|
112
114
|
value: "-",
|
|
113
115
|
disabled: "(not available yet)"
|
|
114
|
-
},
|
|
116
|
+
}, Ft = {
|
|
115
117
|
name: "π΅ Create new experience",
|
|
116
118
|
value: "-",
|
|
117
119
|
disabled: "(not available yet)"
|
|
118
|
-
},
|
|
120
|
+
}, jt = {
|
|
119
121
|
name: "π‘ Create new skin",
|
|
120
122
|
value: "-",
|
|
121
123
|
disabled: "(not available yet)"
|
|
122
|
-
},
|
|
124
|
+
}, At = {
|
|
123
125
|
name: "π΄ Create new flow",
|
|
124
126
|
value: "-",
|
|
125
127
|
disabled: "(not available yet)"
|
|
126
|
-
},
|
|
128
|
+
}, Dt = {
|
|
127
129
|
name: "π Define new custom Myop message",
|
|
128
130
|
value: "generateMyopMessage",
|
|
129
131
|
description: "οΈHelp you creates the right structure for a new Myop message, including types and handlers.",
|
|
130
132
|
disabled: "(not available yet)"
|
|
131
|
-
},
|
|
132
|
-
function
|
|
133
|
+
}, Lt = [Dt, Tt, Ft, jt, At];
|
|
134
|
+
function Ut(o, t, e, n) {
|
|
133
135
|
return `<!DOCTYPE html>
|
|
134
136
|
<html lang="en">
|
|
135
137
|
<head>
|
|
@@ -219,19 +221,19 @@ ${n}
|
|
|
219
221
|
</body>
|
|
220
222
|
</html>`;
|
|
221
223
|
}
|
|
222
|
-
function
|
|
224
|
+
function Ht(o) {
|
|
223
225
|
return o.includes("esbuild") && o.includes("another platform");
|
|
224
226
|
}
|
|
225
|
-
function
|
|
227
|
+
function Bt(o) {
|
|
226
228
|
return o.includes("ERR_MODULE_NOT_FOUND") && o.includes("esbuild");
|
|
227
229
|
}
|
|
228
|
-
function
|
|
230
|
+
function Jt() {
|
|
229
231
|
console.error(`
|
|
230
232
|
β esbuild platform mismatch detected!`), console.error(" Your node_modules contains esbuild binaries for a different OS."), console.error(`
|
|
231
233
|
This usually happens when node_modules is copied between different`), console.error(` operating systems (e.g., Windows β Mac, or Mac β Linux).
|
|
232
234
|
`);
|
|
233
235
|
}
|
|
234
|
-
function
|
|
236
|
+
function zt(o) {
|
|
235
237
|
return new Promise((t) => {
|
|
236
238
|
console.log(`π§ Attempting to fix: removing node_modules and reinstalling...
|
|
237
239
|
`);
|
|
@@ -261,8 +263,8 @@ async function pt(o, t, e, n, s = {}) {
|
|
|
261
263
|
hasTriedInstall: r = !1,
|
|
262
264
|
onRetry: p
|
|
263
265
|
} = s, m = ((o == null ? void 0 : o.message) || "") + (t || "") + (e || "");
|
|
264
|
-
return !i &&
|
|
265
|
-
`), p(), { handled: !0, hasTriedPlatformFix: !0, hasTriedInstall: r }) : { handled: !0, hasTriedPlatformFix: !0, hasTriedInstall: r }) : !r &&
|
|
266
|
+
return !i && Ht(m) ? (Jt(), await zt(n) && p ? (console.log(`π Retrying build...
|
|
267
|
+
`), p(), { handled: !0, hasTriedPlatformFix: !0, hasTriedInstall: r }) : { handled: !0, hasTriedPlatformFix: !0, hasTriedInstall: r }) : !r && Bt(m) ? (console.log("π¦ Missing dependencies detected, running npm install..."), new Promise((l) => {
|
|
266
268
|
n("npm install", (d, w, x) => {
|
|
267
269
|
if (d) {
|
|
268
270
|
console.error("β Failed to install dependencies:", d.message), x && console.error(x), l({ handled: !0, hasTriedPlatformFix: i, hasTriedInstall: !0 });
|
|
@@ -614,7 +616,7 @@ Sec-WebSocket-Accept: ${S}\r
|
|
|
614
616
|
return;
|
|
615
617
|
}
|
|
616
618
|
if (y.length === 0) {
|
|
617
|
-
a.writeHead(200, { "Content-Type": "text/html" }), a.end(
|
|
619
|
+
a.writeHead(200, { "Content-Type": "text/html" }), a.end(Ut(l, d, p, m));
|
|
618
620
|
return;
|
|
619
621
|
}
|
|
620
622
|
if (y[0] !== "view") {
|
|
@@ -1235,7 +1237,7 @@ ve(A, "STATUS", {
|
|
|
1235
1237
|
stopped: { icon: "β ", color: "gray", label: "Stopped" }
|
|
1236
1238
|
});
|
|
1237
1239
|
let He = A;
|
|
1238
|
-
async function
|
|
1240
|
+
async function Wt(o) {
|
|
1239
1241
|
const { spawn: t, exec: e } = await import("child_process"), n = await import("path"), s = o.map((d) => ({
|
|
1240
1242
|
name: d.name,
|
|
1241
1243
|
path: d.path,
|
|
@@ -1290,11 +1292,11 @@ async function zt(o) {
|
|
|
1290
1292
|
p("http://localhost:9292");
|
|
1291
1293
|
}, 2e3);
|
|
1292
1294
|
}
|
|
1293
|
-
const
|
|
1295
|
+
const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1294
1296
|
__proto__: null,
|
|
1295
1297
|
devCommand: Ce,
|
|
1296
|
-
monorepoDevCommand:
|
|
1297
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1298
|
+
monorepoDevCommand: Wt
|
|
1299
|
+
}, Symbol.toStringTag, { value: "Module" })), Yt = "https://cloud.myop.dev";
|
|
1298
1300
|
async function mt(o, t) {
|
|
1299
1301
|
const e = await fetch(o, {
|
|
1300
1302
|
headers: { Authorization: `Bearer ${t}` }
|
|
@@ -1317,7 +1319,7 @@ async function $e(o, t, e, n) {
|
|
|
1317
1319
|
t
|
|
1318
1320
|
);
|
|
1319
1321
|
}
|
|
1320
|
-
async function
|
|
1322
|
+
async function Gt(o, t, e, n) {
|
|
1321
1323
|
let s = 0;
|
|
1322
1324
|
const i = /* @__PURE__ */ new Set();
|
|
1323
1325
|
for (const r of n) {
|
|
@@ -1341,7 +1343,7 @@ async function Yt(o, t, e, n) {
|
|
|
1341
1343
|
}
|
|
1342
1344
|
return s;
|
|
1343
1345
|
}
|
|
1344
|
-
async function
|
|
1346
|
+
async function Kt(o, t, e) {
|
|
1345
1347
|
const n = await mt(`${o}/export`, t);
|
|
1346
1348
|
pe(e, "manifest.json", n);
|
|
1347
1349
|
let s = 0, i = 0;
|
|
@@ -1361,10 +1363,10 @@ async function Gt(o, t, e) {
|
|
|
1361
1363
|
}
|
|
1362
1364
|
return { manifest: n, fileCount: s, errorCount: i };
|
|
1363
1365
|
}
|
|
1364
|
-
function
|
|
1366
|
+
function Qt() {
|
|
1365
1367
|
v.program.command("export").description("Export components as static JSON for self-hosting").option("-k, --api-key <key>", "Myop API key (or set MYOP_API_KEY env var)").option("-o, --output <dir>", "Output directory", "./myop-static").option("-u, --url <url>", "Myop API URL (or set MYOP_API_URL env var)").option("--releases <json>", "JSON array of releases for incremental sync (from webhook payload)").option("--component <id>", "Single component ID for incremental sync").option("--env <env>", "Environment for single component sync (used with --component)").action(async (o) => {
|
|
1366
1368
|
var i;
|
|
1367
|
-
const t = o.apiKey || process.env.MYOP_API_KEY, e = o.url || process.env.MYOP_API_URL ||
|
|
1369
|
+
const t = o.apiKey || process.env.MYOP_API_KEY, e = o.url || process.env.MYOP_API_URL || Yt, n = o.output || process.env.OUTPUT_DIR || "./myop-static";
|
|
1368
1370
|
t || (console.error("Error: API key required. Use --api-key or set MYOP_API_KEY env var."), console.error("Create one at: Dashboard > Rollout Settings > Self-Hosting > API Keys"), process.exit(1));
|
|
1369
1371
|
let s = null;
|
|
1370
1372
|
if (o.releases)
|
|
@@ -1377,7 +1379,7 @@ function Kt() {
|
|
|
1377
1379
|
if (s) {
|
|
1378
1380
|
const r = z(`Incremental export: ${s.length} component(s)...`).start();
|
|
1379
1381
|
try {
|
|
1380
|
-
const p = await
|
|
1382
|
+
const p = await Gt(e, t, n, s);
|
|
1381
1383
|
r.succeed(`Incremental export done. ${p} file(s) written to ${n}/`);
|
|
1382
1384
|
} catch (p) {
|
|
1383
1385
|
r.fail(`Export failed: ${p.message}`), process.exit(1);
|
|
@@ -1385,7 +1387,7 @@ function Kt() {
|
|
|
1385
1387
|
} else {
|
|
1386
1388
|
const r = z(`Full export from ${e}...`).start();
|
|
1387
1389
|
try {
|
|
1388
|
-
const { manifest: p, fileCount: m, errorCount: l } = await
|
|
1390
|
+
const { manifest: p, fileCount: m, errorCount: l } = await Kt(e, t, n), d = ((i = p.components) == null ? void 0 : i.length) || 0;
|
|
1389
1391
|
r.succeed(
|
|
1390
1392
|
`Full export done. ${m} file(s) from ${d} component(s) written to ${n}/`
|
|
1391
1393
|
), l > 0 && console.warn(` ${l} file(s) failed.`);
|
|
@@ -1397,7 +1399,7 @@ function Kt() {
|
|
|
1397
1399
|
});
|
|
1398
1400
|
}
|
|
1399
1401
|
const Be = R.join(at.homedir(), ".myop"), ue = R.join(Be, "credentials.json");
|
|
1400
|
-
function
|
|
1402
|
+
function Zt() {
|
|
1401
1403
|
P.existsSync(Be) || P.mkdirSync(Be, { recursive: !0, mode: 448 });
|
|
1402
1404
|
}
|
|
1403
1405
|
function Ye() {
|
|
@@ -1411,7 +1413,7 @@ function Ye() {
|
|
|
1411
1413
|
}
|
|
1412
1414
|
}
|
|
1413
1415
|
function ut(o) {
|
|
1414
|
-
|
|
1416
|
+
Zt();
|
|
1415
1417
|
const t = {
|
|
1416
1418
|
...o,
|
|
1417
1419
|
savedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -1428,7 +1430,7 @@ function ft() {
|
|
|
1428
1430
|
return console.error("Failed to clear credentials:", o.message), !1;
|
|
1429
1431
|
}
|
|
1430
1432
|
}
|
|
1431
|
-
function
|
|
1433
|
+
function qt(o) {
|
|
1432
1434
|
if (!o || !o.expiresAt)
|
|
1433
1435
|
return !0;
|
|
1434
1436
|
const t = 5 * 60 * 1e3, e = new Date(o.expiresAt).getTime();
|
|
@@ -1441,19 +1443,19 @@ function Pe() {
|
|
|
1441
1443
|
userId: o.userId
|
|
1442
1444
|
} : null;
|
|
1443
1445
|
}
|
|
1444
|
-
const le = process.env.MYOP_MCP_URL || "https://mcp.myop.dev", xe = 19284, Ge = `http://localhost:${xe}/callback`,
|
|
1445
|
-
function
|
|
1446
|
+
const le = process.env.MYOP_MCP_URL || "https://mcp.myop.dev", xe = 19284, Ge = `http://localhost:${xe}/callback`, Xt = "myop-cli";
|
|
1447
|
+
function eo() {
|
|
1446
1448
|
return We.randomBytes(32).toString("base64url");
|
|
1447
1449
|
}
|
|
1448
|
-
function
|
|
1450
|
+
function to(o) {
|
|
1449
1451
|
return We.createHash("sha256").update(o).digest("base64url");
|
|
1450
1452
|
}
|
|
1451
|
-
async function
|
|
1453
|
+
async function oo() {
|
|
1452
1454
|
const o = await fetch(`${le}/oauth/register`, {
|
|
1453
1455
|
method: "POST",
|
|
1454
1456
|
headers: { "Content-Type": "application/json" },
|
|
1455
1457
|
body: JSON.stringify({
|
|
1456
|
-
client_name:
|
|
1458
|
+
client_name: Xt,
|
|
1457
1459
|
redirect_uris: [Ge],
|
|
1458
1460
|
grant_types: ["authorization_code", "refresh_token"],
|
|
1459
1461
|
response_types: ["code"]
|
|
@@ -1631,7 +1633,7 @@ function Se(o, t, e, n = null) {
|
|
|
1631
1633
|
</body>
|
|
1632
1634
|
</html>`;
|
|
1633
1635
|
}
|
|
1634
|
-
function
|
|
1636
|
+
function no(o) {
|
|
1635
1637
|
return new Promise((t, e) => {
|
|
1636
1638
|
const n = It.createServer((s, i) => {
|
|
1637
1639
|
const r = new it(s.url, `http://localhost:${xe}`);
|
|
@@ -1679,7 +1681,7 @@ function oo(o) {
|
|
|
1679
1681
|
}, 5 * 60 * 1e3);
|
|
1680
1682
|
});
|
|
1681
1683
|
}
|
|
1682
|
-
async function
|
|
1684
|
+
async function so(o, t, e) {
|
|
1683
1685
|
const n = await fetch(`${le}/oauth/token`, {
|
|
1684
1686
|
method: "POST",
|
|
1685
1687
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
@@ -1697,7 +1699,7 @@ async function no(o, t, e) {
|
|
|
1697
1699
|
}
|
|
1698
1700
|
return n.json();
|
|
1699
1701
|
}
|
|
1700
|
-
async function
|
|
1702
|
+
async function io(o, t) {
|
|
1701
1703
|
const e = await fetch(`${le}/oauth/token`, {
|
|
1702
1704
|
method: "POST",
|
|
1703
1705
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
@@ -1713,7 +1715,7 @@ async function so(o, t) {
|
|
|
1713
1715
|
}
|
|
1714
1716
|
return e.json();
|
|
1715
1717
|
}
|
|
1716
|
-
async function
|
|
1718
|
+
async function ro(o) {
|
|
1717
1719
|
var s, i, r;
|
|
1718
1720
|
const t = await fetch(`${le}/mcp`, {
|
|
1719
1721
|
method: "POST",
|
|
@@ -1745,17 +1747,17 @@ async function me() {
|
|
|
1745
1747
|
const o = z("Starting authentication...").start();
|
|
1746
1748
|
try {
|
|
1747
1749
|
o.text = "Registering OAuth client...";
|
|
1748
|
-
const e = (await
|
|
1750
|
+
const e = (await oo()).client_id, n = eo(), s = to(n), i = We.randomBytes(16).toString("hex");
|
|
1749
1751
|
o.text = "Waiting for authorization...";
|
|
1750
|
-
const r =
|
|
1752
|
+
const r = no(i), p = new it(`${le}/oauth/authorize`);
|
|
1751
1753
|
p.searchParams.set("response_type", "code"), p.searchParams.set("client_id", e), p.searchParams.set("redirect_uri", Ge), p.searchParams.set("code_challenge", s), p.searchParams.set("code_challenge_method", "S256"), p.searchParams.set("state", i), o.stop(), console.log(`
|
|
1752
1754
|
π Opening browser for authentication...`), console.log("If the browser does not open, visit:"), console.log(` ${p.toString()}
|
|
1753
1755
|
`), await Ot(p.toString());
|
|
1754
1756
|
const m = await r;
|
|
1755
1757
|
o.start("Exchanging authorization code...");
|
|
1756
|
-
const l = await
|
|
1758
|
+
const l = await so(m, e, n);
|
|
1757
1759
|
o.text = "Getting user info...";
|
|
1758
|
-
const d = await
|
|
1760
|
+
const d = await ro(l.access_token), w = {
|
|
1759
1761
|
accessToken: l.access_token,
|
|
1760
1762
|
refreshToken: l.refresh_token,
|
|
1761
1763
|
expiresAt: new Date(Date.now() + l.expires_in * 1e3).toISOString(),
|
|
@@ -1776,7 +1778,7 @@ async function gt() {
|
|
|
1776
1778
|
}
|
|
1777
1779
|
ft(), console.log(`β
Logged out (was: ${o.userEmail})`);
|
|
1778
1780
|
}
|
|
1779
|
-
function
|
|
1781
|
+
function ao(o) {
|
|
1780
1782
|
var e, n;
|
|
1781
1783
|
const t = (o == null ? void 0 : o.message) || "";
|
|
1782
1784
|
return t.includes("ECONNREFUSED") || t.includes("ENOTFOUND") || t.includes("ETIMEDOUT") || t.includes("fetch failed") || t.includes("network") || (o == null ? void 0 : o.code) === "ECONNREFUSED" || ((e = o == null ? void 0 : o.cause) == null ? void 0 : e.code) === "ECONNREFUSED" || ((n = o == null ? void 0 : o.cause) == null ? void 0 : n.code) === "ENOTFOUND";
|
|
@@ -1786,12 +1788,12 @@ async function Ke() {
|
|
|
1786
1788
|
if (!o)
|
|
1787
1789
|
return console.log(`Not logged in. Starting authentication...
|
|
1788
1790
|
`), await me();
|
|
1789
|
-
if (!
|
|
1791
|
+
if (!qt(o))
|
|
1790
1792
|
return o;
|
|
1791
1793
|
if (o.refreshToken) {
|
|
1792
1794
|
const t = z("Refreshing access token...").start();
|
|
1793
1795
|
try {
|
|
1794
|
-
const e = await
|
|
1796
|
+
const e = await io(
|
|
1795
1797
|
o.refreshToken,
|
|
1796
1798
|
o.clientId
|
|
1797
1799
|
);
|
|
@@ -1802,7 +1804,7 @@ async function Ke() {
|
|
|
1802
1804
|
expiresAt: new Date(Date.now() + e.expires_in * 1e3).toISOString()
|
|
1803
1805
|
}, ut(o), t.succeed("Token refreshed"), o;
|
|
1804
1806
|
} catch (e) {
|
|
1805
|
-
if (
|
|
1807
|
+
if (ao(e))
|
|
1806
1808
|
throw t.fail("Network error during token refresh"), e;
|
|
1807
1809
|
return t.warn("Token refresh failed, please log in again"), ft(), await me();
|
|
1808
1810
|
}
|
|
@@ -1814,29 +1816,29 @@ function Me() {
|
|
|
1814
1816
|
return le;
|
|
1815
1817
|
}
|
|
1816
1818
|
const Z = "@myop/cli", De = process.platform === "win32";
|
|
1817
|
-
function
|
|
1819
|
+
function lo() {
|
|
1818
1820
|
try {
|
|
1819
1821
|
return Q("npm config get registry", { encoding: "utf-8" }).trim() || "https://registry.npmjs.org/";
|
|
1820
1822
|
} catch {
|
|
1821
1823
|
return "https://registry.npmjs.org/";
|
|
1822
1824
|
}
|
|
1823
1825
|
}
|
|
1824
|
-
function
|
|
1826
|
+
function co() {
|
|
1825
1827
|
try {
|
|
1826
1828
|
return Q("npm config get prefix", { encoding: "utf-8" }).trim();
|
|
1827
1829
|
} catch {
|
|
1828
1830
|
return null;
|
|
1829
1831
|
}
|
|
1830
1832
|
}
|
|
1831
|
-
async function
|
|
1833
|
+
async function po() {
|
|
1832
1834
|
try {
|
|
1833
|
-
const o =
|
|
1835
|
+
const o = lo().replace(/\/$/, ""), t = await fetch(`${o}/${Z}/latest`);
|
|
1834
1836
|
return t.ok ? (await t.json()).version : null;
|
|
1835
1837
|
} catch {
|
|
1836
1838
|
return null;
|
|
1837
1839
|
}
|
|
1838
1840
|
}
|
|
1839
|
-
function
|
|
1841
|
+
function mo(o, t) {
|
|
1840
1842
|
const e = o.split(".").map(Number), n = t.split(".").map(Number);
|
|
1841
1843
|
for (let s = 0; s < Math.max(e.length, n.length); s++) {
|
|
1842
1844
|
const i = e[s] || 0, r = n[s] || 0;
|
|
@@ -1845,12 +1847,12 @@ function po(o, t) {
|
|
|
1845
1847
|
}
|
|
1846
1848
|
return 0;
|
|
1847
1849
|
}
|
|
1848
|
-
async function
|
|
1850
|
+
async function uo(o) {
|
|
1849
1851
|
const t = z({
|
|
1850
1852
|
text: "Checking for updates...",
|
|
1851
1853
|
color: "cyan"
|
|
1852
|
-
}).start(), e = await
|
|
1853
|
-
if (t.stop(), !e ||
|
|
1854
|
+
}).start(), e = await po();
|
|
1855
|
+
if (t.stop(), !e || mo(e, o) <= 0)
|
|
1854
1856
|
return !1;
|
|
1855
1857
|
console.log(`
|
|
1856
1858
|
π¦ New version available: ${o} β ${e}
|
|
@@ -1874,7 +1876,7 @@ async function mo(o) {
|
|
|
1874
1876
|
const s = z({
|
|
1875
1877
|
text: `Updating ${Z} to v${e}...`,
|
|
1876
1878
|
color: "green"
|
|
1877
|
-
}).start(), i = `npm install -g ${Z}@latest`, r =
|
|
1879
|
+
}).start(), i = `npm install -g ${Z}@latest`, r = co();
|
|
1878
1880
|
try {
|
|
1879
1881
|
Q(i, { stdio: "pipe" }), s.succeed(`Updated to v${e}`);
|
|
1880
1882
|
} catch {
|
|
@@ -1924,7 +1926,7 @@ Please run myop again to use the new version.
|
|
|
1924
1926
|
return !1;
|
|
1925
1927
|
}
|
|
1926
1928
|
const Je = R.join(at.homedir(), ".myop"), ze = R.join(Je, "preferences.json");
|
|
1927
|
-
function
|
|
1929
|
+
function fo() {
|
|
1928
1930
|
P.existsSync(Je) || P.mkdirSync(Je, { recursive: !0, mode: 448 });
|
|
1929
1931
|
}
|
|
1930
1932
|
function ht() {
|
|
@@ -1937,20 +1939,20 @@ function ht() {
|
|
|
1937
1939
|
return {};
|
|
1938
1940
|
}
|
|
1939
1941
|
}
|
|
1940
|
-
function
|
|
1941
|
-
|
|
1942
|
+
function go(o) {
|
|
1943
|
+
fo();
|
|
1942
1944
|
const e = { ...ht(), ...o };
|
|
1943
1945
|
P.writeFileSync(ze, JSON.stringify(e, null, 2), {
|
|
1944
1946
|
mode: 384
|
|
1945
1947
|
});
|
|
1946
1948
|
}
|
|
1947
|
-
function
|
|
1949
|
+
function ho() {
|
|
1948
1950
|
return ht().defaultOrganization || null;
|
|
1949
1951
|
}
|
|
1950
1952
|
function Le({ id: o, name: t }) {
|
|
1951
|
-
|
|
1953
|
+
go({ defaultOrganization: { id: o, name: t } });
|
|
1952
1954
|
}
|
|
1953
|
-
async function
|
|
1955
|
+
async function yo(o, t, e, n = {}) {
|
|
1954
1956
|
var p, m, l;
|
|
1955
1957
|
const s = await fetch(`${o}/mcp`, {
|
|
1956
1958
|
method: "POST",
|
|
@@ -1978,7 +1980,7 @@ async function ho(o, t, e, n = {}) {
|
|
|
1978
1980
|
throw new Error(`No content returned from ${e}`);
|
|
1979
1981
|
return JSON.parse(r);
|
|
1980
1982
|
}
|
|
1981
|
-
const
|
|
1983
|
+
const wo = (o) => new Promise((t) => setTimeout(t, o));
|
|
1982
1984
|
function re(o) {
|
|
1983
1985
|
var e, n;
|
|
1984
1986
|
const t = (o == null ? void 0 : o.message) || "";
|
|
@@ -1989,12 +1991,12 @@ function ae(o) {
|
|
|
1989
1991
|
This usually happens in sandboxed environments (Claude Web, containers)`), console.error(` where outbound HTTP is restricted.
|
|
1990
1992
|
`), console.error(" [MYOP_MCP_FALLBACK] Use Myop MCP tools instead:"), console.error(o === "push" ? " - Use the upload_component MCP tool with htmlContent parameter" : o === "pull" ? " - Use the get_component MCP tool" : " - Use list_organizations + list_components MCP tools"), console.error(" - Do NOT use presigned URL / curl flow β same network restrictions apply"), console.error("");
|
|
1991
1993
|
}
|
|
1992
|
-
const
|
|
1994
|
+
const vo = () => {
|
|
1993
1995
|
let o = new URL(import.meta.url).pathname;
|
|
1994
1996
|
process.platform === "win32" && o.startsWith("/") && (o = o.slice(1));
|
|
1995
1997
|
const t = R.dirname(o);
|
|
1996
1998
|
return R.join(t, "skills");
|
|
1997
|
-
},
|
|
1999
|
+
}, So = (o) => {
|
|
1998
2000
|
try {
|
|
1999
2001
|
const t = R.join(o, "package.json");
|
|
2000
2002
|
if (!P.existsSync(t)) return [];
|
|
@@ -2004,11 +2006,11 @@ const wo = () => {
|
|
|
2004
2006
|
return [];
|
|
2005
2007
|
}
|
|
2006
2008
|
}, Qe = async (o) => {
|
|
2007
|
-
const t =
|
|
2009
|
+
const t = vo();
|
|
2008
2010
|
if (!P.existsSync(t))
|
|
2009
2011
|
return console.info("Skills source directory not found, skipping skills installation"), { success: !1 };
|
|
2010
2012
|
try {
|
|
2011
|
-
const e =
|
|
2013
|
+
const e = So(o), n = ["myop-cli", "myop-component"], s = [
|
|
2012
2014
|
{ deps: ["@myop/react", "react"], skill: "myop-react-host" },
|
|
2013
2015
|
{ deps: ["@myop/vue", "vue"], skill: "myop-vue-host" },
|
|
2014
2016
|
{ deps: ["@myop/angular", "@angular/core"], skill: "myop-angular-host" },
|
|
@@ -2057,7 +2059,7 @@ const Ee = (o = !1) => {
|
|
|
2057
2059
|
verbose: t
|
|
2058
2060
|
};
|
|
2059
2061
|
try {
|
|
2060
|
-
return v.myopConfig =
|
|
2062
|
+
return v.myopConfig = Nt(v.options.configPath), { configFound: !0 };
|
|
2061
2063
|
} catch (e) {
|
|
2062
2064
|
if (o) {
|
|
2063
2065
|
console.info(`
|
|
@@ -2077,11 +2079,11 @@ const Ee = (o = !1) => {
|
|
|
2077
2079
|
};
|
|
2078
2080
|
[
|
|
2079
2081
|
new Ue(),
|
|
2080
|
-
...
|
|
2082
|
+
...Lt
|
|
2081
2083
|
];
|
|
2082
|
-
const
|
|
2084
|
+
const xo = "0.1.56";
|
|
2083
2085
|
v.program = new Pt();
|
|
2084
|
-
v.program.name("@myop/cli").description("Myop CLI - Remote UI Made Easy").version(
|
|
2086
|
+
v.program.name("@myop/cli").description("Myop CLI - Remote UI Made Easy").version(xo);
|
|
2085
2087
|
v.program.addOption(new fe("-c, --config <value>", "myop.config.json file location").default("./myop.config.json", "./myop.config.json"));
|
|
2086
2088
|
v.program.addOption(new fe("-h, --help", "Show helpful information"));
|
|
2087
2089
|
v.program.addOption(new fe("-v, --verbose", "Enables verbose output mode for the command-line interface (CLI)."));
|
|
@@ -2325,7 +2327,7 @@ v.program.command("list").description("Browse and pull/push remote components").
|
|
|
2325
2327
|
[MYOP_AUTH_REQUIRED] Run 'myop login' to authenticate,`), console.error(` or use the setup_cli_auth MCP tool to set up credentials automatically.
|
|
2326
2328
|
`)), process.exit(1);
|
|
2327
2329
|
}
|
|
2328
|
-
const s = Me(), i = (g, u) =>
|
|
2330
|
+
const s = Me(), i = (g, u) => yo(s, n.accessToken, g, u);
|
|
2329
2331
|
let r = z("Loading organizations...").start(), p;
|
|
2330
2332
|
try {
|
|
2331
2333
|
const g = await i("list_organizations");
|
|
@@ -2340,7 +2342,7 @@ v.program.command("list").description("Browse and pull/push remote components").
|
|
|
2340
2342
|
const g = p.find((u) => u.id === o.org || u._id === o.org);
|
|
2341
2343
|
g || (console.error(`Organization "${o.org}" not found. Available:`), p.forEach((u) => console.log(` ${u.id || u._id} ${u.name}`)), process.exit(1)), m = g.id || g._id, l = g.name, Le({ id: m, name: l });
|
|
2342
2344
|
} else {
|
|
2343
|
-
const g =
|
|
2345
|
+
const g = ho();
|
|
2344
2346
|
if (g && p.find((u) => (u.id || u._id) === g.id))
|
|
2345
2347
|
m = g.id, l = g.name;
|
|
2346
2348
|
else if (p.length === 1)
|
|
@@ -2766,7 +2768,7 @@ v.program.command("mcp").description("Configure Myop MCP server for your AI codi
|
|
|
2766
2768
|
console.log(` ${d}`);
|
|
2767
2769
|
console.log(""), process.exit(0);
|
|
2768
2770
|
});
|
|
2769
|
-
const
|
|
2771
|
+
const $o = () => {
|
|
2770
2772
|
try {
|
|
2771
2773
|
Q("git --version", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
2772
2774
|
} catch {
|
|
@@ -2800,7 +2802,7 @@ const xo = () => {
|
|
|
2800
2802
|
}
|
|
2801
2803
|
}, ne = async (o = !1, t = !1) => {
|
|
2802
2804
|
var d, w, x;
|
|
2803
|
-
const e = Pe(), n = !!(e != null && e.email), s = ((d = v.myopConfig) == null ? void 0 : d.name) || ((w = v.myopConfig) == null ? void 0 : w.componentName), i = (x = v.myopConfig) == null ? void 0 : x.componentId, r =
|
|
2805
|
+
const e = Pe(), n = !!(e != null && e.email), s = ((d = v.myopConfig) == null ? void 0 : d.name) || ((w = v.myopConfig) == null ? void 0 : w.componentName), i = (x = v.myopConfig) == null ? void 0 : x.componentId, r = $o();
|
|
2804
2806
|
console.log(`
|
|
2805
2807
|
βββββββββββββββββββββββββββββββββββββββββββββββββββ`), console.log("β β"), console.log("β Welcome to Myop CLI - Remote UI Made Easy β"), console.log("β β"), console.log(`βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
2806
2808
|
`), o && s ? (console.log(` Component: ${s}`), i ? (console.log(` ID: ${i}`), console.log(` Dashboard: https://dashboard.myop.dev/dashboard/2.0/component/${i}`)) : console.log(" ID: (not yet pushed)")) : console.log(" Component: No myop.config.json found"), console.log(` User: ${n ? e.email : "Not logged in"}`), r != null && r.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")) : r != null && r.notARepo ? console.log(" Changes: Not a git repository") : r && (r.insertions > 0 || r.deletions > 0) ? console.log(` Changes: ${r.files} file${r.files !== 1 ? "s" : ""} | \x1B[32m+${r.insertions}\x1B[0m \x1B[31m-${r.deletions}\x1B[0m`) : r && console.log(" Changes: No uncommitted changes"), console.log("");
|
|
@@ -2864,7 +2866,7 @@ const xo = () => {
|
|
|
2864
2866
|
}
|
|
2865
2867
|
switch (l) {
|
|
2866
2868
|
case "init":
|
|
2867
|
-
await
|
|
2869
|
+
await Mo();
|
|
2868
2870
|
break;
|
|
2869
2871
|
case "sync":
|
|
2870
2872
|
console.log(`
|
|
@@ -2898,14 +2900,14 @@ Pushing component...
|
|
|
2898
2900
|
case "exit":
|
|
2899
2901
|
process.exit(0);
|
|
2900
2902
|
}
|
|
2901
|
-
}, be = ".myop-monorepo.json",
|
|
2903
|
+
}, be = ".myop-monorepo.json", bo = () => {
|
|
2902
2904
|
try {
|
|
2903
2905
|
const o = P.readFileSync(be, "utf-8");
|
|
2904
2906
|
return JSON.parse(o);
|
|
2905
2907
|
} catch {
|
|
2906
2908
|
return null;
|
|
2907
2909
|
}
|
|
2908
|
-
},
|
|
2910
|
+
}, Co = (o) => {
|
|
2909
2911
|
try {
|
|
2910
2912
|
const t = {
|
|
2911
2913
|
selectedComponents: o,
|
|
@@ -2914,7 +2916,7 @@ Pushing component...
|
|
|
2914
2916
|
P.writeFileSync(be, JSON.stringify(t, null, 2));
|
|
2915
2917
|
} catch {
|
|
2916
2918
|
}
|
|
2917
|
-
},
|
|
2919
|
+
}, Po = async () => {
|
|
2918
2920
|
const o = Pe(), t = !!(o != null && o.email);
|
|
2919
2921
|
console.log(`
|
|
2920
2922
|
βββββββββββββββββββββββββββββββββββββββββββββββββββ`), console.log("β β"), console.log("β Myop CLI - Monorepo Mode β"), console.log("β β"), console.log(`βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
@@ -2922,7 +2924,7 @@ Pushing component...
|
|
|
2922
2924
|
const e = z("Scanning for components...").start(), n = Ze(".");
|
|
2923
2925
|
e.stop(), n.length === 0 && (console.log(` β οΈ No myop.config.json files found in this directory or subdirectories.
|
|
2924
2926
|
`), console.log(" Run `myop` without -m flag to initialize a single component.\n"), process.exit(0));
|
|
2925
|
-
const s =
|
|
2927
|
+
const s = bo(), i = (s == null ? void 0 : s.selectedComponents) || [], r = i.length > 0;
|
|
2926
2928
|
console.log(` Found ${n.length} component${n.length > 1 ? "s" : ""}:
|
|
2927
2929
|
`), n.forEach((w, x) => {
|
|
2928
2930
|
const $ = w.componentId ? "β
" : "βͺ", g = w.componentId ? w.componentId.substring(0, 8) + "..." : "(not pushed)";
|
|
@@ -2952,14 +2954,14 @@ Pushing component...
|
|
|
2952
2954
|
}
|
|
2953
2955
|
m.length === 0 && (console.log(`
|
|
2954
2956
|
β οΈ No components selected.
|
|
2955
|
-
`), process.exit(0)), p || (
|
|
2957
|
+
`), process.exit(0)), p || (Co(m), console.log(`
|
|
2956
2958
|
πΎ Selection saved to ${be}`));
|
|
2957
2959
|
const l = n.filter((w) => m.includes(w.path));
|
|
2958
2960
|
console.log(`π Starting dev mode for ${l.length} component${l.length > 1 ? "s" : ""}...
|
|
2959
2961
|
`);
|
|
2960
|
-
const { monorepoDevCommand: d } = await Promise.resolve().then(() =>
|
|
2962
|
+
const { monorepoDevCommand: d } = await Promise.resolve().then(() => Vt);
|
|
2961
2963
|
await d(l);
|
|
2962
|
-
},
|
|
2964
|
+
}, Mo = async () => {
|
|
2963
2965
|
const { input: o, select: t } = await import("@inquirer/prompts"), e = await import("fs"), n = await import("path"), s = n.default.basename(process.cwd());
|
|
2964
2966
|
let i, r;
|
|
2965
2967
|
try {
|
|
@@ -3231,8 +3233,8 @@ dist/
|
|
|
3231
3233
|
}
|
|
3232
3234
|
};
|
|
3233
3235
|
v.program.command("default", { isDefault: !0 }).action(async () => {
|
|
3234
|
-
if (v.program.getOptionValue("help") && (console.log(
|
|
3235
|
-
await
|
|
3236
|
+
if (v.program.getOptionValue("help") && (console.log(Rt), process.exit()), v.program.getOptionValue("monorepo")) {
|
|
3237
|
+
await Po();
|
|
3236
3238
|
return;
|
|
3237
3239
|
}
|
|
3238
3240
|
if (v.program.getOptionValue("ci")) {
|
|
@@ -3267,10 +3269,10 @@ v.program.command("default", { isDefault: !0 }).action(async () => {
|
|
|
3267
3269
|
color: "green"
|
|
3268
3270
|
}).start();
|
|
3269
3271
|
const s = Ee();
|
|
3270
|
-
await
|
|
3272
|
+
await wo(500), n.stop();
|
|
3271
3273
|
const i = v.program.version();
|
|
3272
|
-
await
|
|
3274
|
+
await uo(i) || await ne(s.configFound);
|
|
3273
3275
|
});
|
|
3274
|
-
|
|
3276
|
+
Qt();
|
|
3275
3277
|
v.program.parse(process.argv);
|
|
3276
3278
|
v.program.opts();
|