figma2mobile-local 0.1.0 → 0.1.1
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/README.md +5 -3
- package/integrity.json +2 -2
- package/loader.cjs +32 -28
- package/main.obf.cjs +1 -1
- package/package.json +1 -1
- package/plugin/dist/code.js +1 -1
- package/plugin/src/ui.html +3 -303
package/README.md
CHANGED
|
@@ -280,9 +280,11 @@ code must ultimately run on the user's machine.
|
|
|
280
280
|
|
|
281
281
|
## License
|
|
282
282
|
|
|
283
|
-
**UNLICENSED — proprietary.**
|
|
284
|
-
derivative works
|
|
283
|
+
**UNLICENSED — proprietary.** This software is **not open source**, and no license is granted to
|
|
284
|
+
copy, modify, redistribute, or create derivative works from it. By installing and using it, you
|
|
285
|
+
agree to these terms. You are welcome to trust the package as-is, or to freely inspect it for
|
|
286
|
+
malware — either is fine.
|
|
285
287
|
|
|
286
288
|
---
|
|
287
289
|
|
|
288
|
-
Node ≥ 18. Build:
|
|
290
|
+
Node ≥ 18. Build: d98936a-20260730232046
|
package/integrity.json
CHANGED
package/loader.cjs
CHANGED
|
@@ -16,7 +16,7 @@ const path = require("node:path");
|
|
|
16
16
|
const crypto = require("node:crypto");
|
|
17
17
|
const readline = require("node:readline");
|
|
18
18
|
|
|
19
|
-
const BUILD_ID = "
|
|
19
|
+
const BUILD_ID = "d98936a-20260730232046"; // pack-npx.sh thay bang build id that
|
|
20
20
|
const ROOT = __dirname;
|
|
21
21
|
const BUNDLE = path.join(ROOT, "main.obf.cjs");
|
|
22
22
|
|
|
@@ -29,24 +29,25 @@ const sha256 = (file) =>
|
|
|
29
29
|
|
|
30
30
|
function readManifest() {
|
|
31
31
|
const p = path.join(ROOT, "integrity.json");
|
|
32
|
-
if (!fs.existsSync(p))
|
|
32
|
+
if (!fs.existsSync(p))
|
|
33
|
+
die("integrity.json missing — package broken, reinstall.");
|
|
33
34
|
let m;
|
|
34
35
|
try {
|
|
35
36
|
m = JSON.parse(fs.readFileSync(p, "utf8"));
|
|
36
37
|
} catch {
|
|
37
|
-
die("integrity.json
|
|
38
|
+
die("integrity.json unreadable — package broken.");
|
|
38
39
|
}
|
|
39
40
|
// Fingerprint: loader va bundle phai cung build (chong tro doi).
|
|
40
41
|
if (m.buildId !== BUILD_ID)
|
|
41
42
|
die(
|
|
42
|
-
`build mismatch: loader=${BUILD_ID} bundle=${m.buildId}. Loader
|
|
43
|
+
`build mismatch: loader=${BUILD_ID} bundle=${m.buildId}. Loader and bundle are from different builds — refusing to run.`,
|
|
43
44
|
);
|
|
44
45
|
// Integrity: bundle obfuscated khong bi sua.
|
|
45
|
-
if (!fs.existsSync(BUNDLE)) die("main.obf.cjs missing —
|
|
46
|
+
if (!fs.existsSync(BUNDLE)) die("main.obf.cjs missing — package broken.");
|
|
46
47
|
const got = sha256(BUNDLE);
|
|
47
48
|
if (m.bundleSha256 && got !== m.bundleSha256)
|
|
48
49
|
die(
|
|
49
|
-
`integrity fail: main.obf.cjs
|
|
50
|
+
`integrity fail: main.obf.cjs was modified (${got.slice(0, 12)} != ${String(m.bundleSha256).slice(0, 12)}).`,
|
|
50
51
|
);
|
|
51
52
|
return m;
|
|
52
53
|
}
|
|
@@ -89,7 +90,7 @@ function loadViaBytecode() {
|
|
|
89
90
|
process.stderr.write(
|
|
90
91
|
`[figma2mobile-local] bytecode unavailable (${
|
|
91
92
|
err?.message ? err.message : err
|
|
92
|
-
});
|
|
93
|
+
}); running obfuscated JS directly.\n`,
|
|
93
94
|
);
|
|
94
95
|
return false;
|
|
95
96
|
}
|
|
@@ -122,7 +123,7 @@ const AGENTS = [
|
|
|
122
123
|
file: path.join(home, ".claude.json"),
|
|
123
124
|
key: "mcpServers",
|
|
124
125
|
skills: path.join(home, ".claude", "skills"),
|
|
125
|
-
manual: `File: ~/.claude.json (
|
|
126
|
+
manual: `File: ~/.claude.json (or run: claude mcp add ${MCP_NAME} -- npx -y figma2mobile-local)`,
|
|
126
127
|
},
|
|
127
128
|
{
|
|
128
129
|
id: "cursor",
|
|
@@ -131,8 +132,7 @@ const AGENTS = [
|
|
|
131
132
|
file: path.join(home, ".cursor", "mcp.json"),
|
|
132
133
|
key: "mcpServers",
|
|
133
134
|
skills: null,
|
|
134
|
-
manual:
|
|
135
|
-
"File global: ~/.cursor/mcp.json (hoac per-project: .cursor/mcp.json)",
|
|
135
|
+
manual: "Global: ~/.cursor/mcp.json (or per-project: .cursor/mcp.json)",
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
id: "codex",
|
|
@@ -172,7 +172,7 @@ function writeJsonMcp(agent) {
|
|
|
172
172
|
cfg = JSON.parse(fs.readFileSync(agent.file, "utf8") || "{}");
|
|
173
173
|
} catch {
|
|
174
174
|
throw new Error(
|
|
175
|
-
`${agent.file}
|
|
175
|
+
`${agent.file} is not valid JSON — refusing to overwrite.`,
|
|
176
176
|
);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
@@ -243,11 +243,13 @@ function parseArgs(args) {
|
|
|
243
243
|
|
|
244
244
|
async function pickAgents() {
|
|
245
245
|
const out = process.stdout.write.bind(process.stdout);
|
|
246
|
-
out(
|
|
246
|
+
out(
|
|
247
|
+
"\nSelect agent(s) to register the MCP server (auto-writes config, with backup):\n",
|
|
248
|
+
);
|
|
247
249
|
AGENTS.forEach((a, i) => out(` ${i + 1}. ${a.label}\n`));
|
|
248
|
-
out(" a.
|
|
250
|
+
out(" a. All\n");
|
|
249
251
|
const raw = (
|
|
250
|
-
await ask("
|
|
252
|
+
await ask("Enter numbers (e.g. 1,3), 'a' for all, or press Enter for all: ")
|
|
251
253
|
).toLowerCase();
|
|
252
254
|
if (!raw || raw === "a" || raw === "all") return AGENTS.slice();
|
|
253
255
|
const picked = [];
|
|
@@ -269,7 +271,7 @@ async function installPlugin(args) {
|
|
|
269
271
|
|
|
270
272
|
// 1. Rai plugin + skill ra thu muc.
|
|
271
273
|
const pluginSrc = path.join(ROOT, "plugin");
|
|
272
|
-
if (!fs.existsSync(pluginSrc)) die("
|
|
274
|
+
if (!fs.existsSync(pluginSrc)) die("plugin/ folder missing from package.");
|
|
273
275
|
copyDir(pluginSrc, path.join(target, "plugin"));
|
|
274
276
|
const skillSrc = path.join(ROOT, "skills");
|
|
275
277
|
const hasSkill = fs.existsSync(skillSrc);
|
|
@@ -283,7 +285,7 @@ async function installPlugin(args) {
|
|
|
283
285
|
for (const id of ids) {
|
|
284
286
|
const a = AGENTS.find((x) => x.id === id);
|
|
285
287
|
if (a) selected.push(a);
|
|
286
|
-
else out(` (
|
|
288
|
+
else out(` (skipping unsupported agent: ${id})\n`);
|
|
287
289
|
}
|
|
288
290
|
}
|
|
289
291
|
} else if (process.stdin.isTTY && process.stdout.isTTY && !yes) {
|
|
@@ -309,24 +311,24 @@ async function installPlugin(args) {
|
|
|
309
311
|
|
|
310
312
|
// 4. Bao cao.
|
|
311
313
|
const manifestPath = path.join(target, "plugin", "manifest.json");
|
|
312
|
-
out("\n✓ Plugin + skill
|
|
314
|
+
out("\n✓ Plugin + skill extracted to:\n");
|
|
313
315
|
out(` ${target}\n\n`);
|
|
314
316
|
|
|
315
317
|
if (results.length) {
|
|
316
|
-
out("MCP
|
|
318
|
+
out("MCP registered (existing files backed up as .bak-<timestamp>):\n");
|
|
317
319
|
for (const r of results) {
|
|
318
320
|
if (r.error) out(` ✗ ${r.agent.label}: ${r.error}\n`);
|
|
319
321
|
else {
|
|
320
322
|
const verb =
|
|
321
323
|
r.state === "added"
|
|
322
|
-
? "
|
|
324
|
+
? "added"
|
|
323
325
|
: r.state === "updated"
|
|
324
|
-
? "
|
|
325
|
-
: "
|
|
326
|
+
? "updated"
|
|
327
|
+
: "already present";
|
|
326
328
|
out(` ✓ ${r.agent.label}: ${verb} -> ${r.agent.file}\n`);
|
|
327
329
|
}
|
|
328
330
|
}
|
|
329
|
-
out("\n
|
|
331
|
+
out("\n Restart the agent to load the new MCP server.\n\n");
|
|
330
332
|
}
|
|
331
333
|
|
|
332
334
|
// 5. Huong dan thu cong (moi agent) — de doi chieu / cai tay.
|
|
@@ -341,7 +343,7 @@ async function installPlugin(args) {
|
|
|
341
343
|
.join("\n");
|
|
342
344
|
const tomlArgs = MCP_ENTRY.args.map((a) => JSON.stringify(a)).join(", ");
|
|
343
345
|
out(
|
|
344
|
-
`
|
|
346
|
+
`Manual install (other agents, or to verify)${IS_WIN ? " [Windows]" : ""}:\n`,
|
|
345
347
|
);
|
|
346
348
|
out(" MCP config JSON:\n");
|
|
347
349
|
out(`${jsonEntry}\n\n`);
|
|
@@ -361,13 +363,15 @@ async function installPlugin(args) {
|
|
|
361
363
|
out(` args = [${tomlArgs}]\n\n`);
|
|
362
364
|
|
|
363
365
|
// 6. Figma import (chung cho moi agent).
|
|
364
|
-
out("Import plugin
|
|
365
|
-
out(" 1.
|
|
366
|
+
out("Import the plugin into Figma Desktop:\n");
|
|
367
|
+
out(" 1. Open Figma Desktop (Figma web cannot reach localhost).\n");
|
|
366
368
|
out(" 2. Menu > Plugins > Development > Import plugin from manifest...\n");
|
|
367
|
-
out(` 3.
|
|
368
|
-
out(" 4.
|
|
369
|
+
out(` 3. Select: ${manifestPath}\n`);
|
|
370
|
+
out(" 4. Run: Plugins > Development > Figma2Mobile Local\n\n");
|
|
369
371
|
if (hasSkill)
|
|
370
|
-
out(
|
|
372
|
+
out(
|
|
373
|
+
`Native-layout implementation skill: ${path.join(target, "skills")}\n\n`,
|
|
374
|
+
);
|
|
371
375
|
process.exit(0);
|
|
372
376
|
}
|
|
373
377
|
|