figma2mobile-local 0.1.3 → 0.1.5
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 +1 -1
- package/integrity.json +2 -2
- package/loader.cjs +53 -50
- package/main.obf.cjs +1 -1
- package/package.json +1 -1
- package/plugin/dist/code.js +1 -1
- package/plugin/src/ui.html +5 -109
package/README.md
CHANGED
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 = "c707a35-20260802111200"; // 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
|
|
|
@@ -292,39 +292,39 @@ async function pickAgentsClack(clack) {
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
// Build the manual-config + Figma-import guide (reused by clack note & plain out).
|
|
295
|
-
|
|
295
|
+
// Short, always-shown: the only manual steps left after auto-register.
|
|
296
|
+
function figmaSteps(manifestPath) {
|
|
297
|
+
return [
|
|
298
|
+
"1. Open Figma Desktop (Figma web cannot reach localhost).",
|
|
299
|
+
"2. Menu > Plugins > Development > Import plugin from manifest...",
|
|
300
|
+
"3. Select this file:",
|
|
301
|
+
` ${manifestPath}`,
|
|
302
|
+
"4. Run: Plugins > Development > Figma2Mobile Local",
|
|
303
|
+
].join("\n");
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Verbose manual MCP config — only shown when NO agent was auto-registered
|
|
307
|
+
// (otherwise it is noise). Kept compact.
|
|
308
|
+
function manualConfig() {
|
|
296
309
|
const jsonEntry = JSON.stringify(
|
|
297
310
|
{ mcpServers: { [MCP_NAME]: MCP_ENTRY } },
|
|
298
311
|
null,
|
|
299
312
|
2,
|
|
300
313
|
);
|
|
301
314
|
const tomlArgs = MCP_ENTRY.args.map((a) => JSON.stringify(a)).join(", ");
|
|
302
|
-
|
|
303
|
-
`
|
|
304
|
-
"
|
|
305
|
-
...jsonEntry.split("\n").map((l) => ` ${l}`),
|
|
315
|
+
return [
|
|
316
|
+
`JSON (Claude Code / Cursor / Claude Desktop)${IS_WIN ? " [Windows]" : ""}:`,
|
|
317
|
+
...jsonEntry.split("\n").map((l) => ` ${l}`),
|
|
306
318
|
"",
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
" Codex TOML block:",
|
|
312
|
-
` [mcp_servers.${MCP_NAME}]`,
|
|
313
|
-
` command = ${JSON.stringify(MCP_ENTRY.command)}`,
|
|
314
|
-
` args = [${tomlArgs}]`,
|
|
319
|
+
"TOML (Codex CLI · ~/.codex/config.toml):",
|
|
320
|
+
` [mcp_servers.${MCP_NAME}]`,
|
|
321
|
+
` command = ${JSON.stringify(MCP_ENTRY.command)}`,
|
|
322
|
+
` args = [${tomlArgs}]`,
|
|
315
323
|
"",
|
|
316
|
-
"
|
|
317
|
-
|
|
318
|
-
"
|
|
319
|
-
|
|
320
|
-
" 4. Run: Plugins > Development > Figma2Mobile Local",
|
|
321
|
-
];
|
|
322
|
-
if (hasSkill)
|
|
323
|
-
lines.push(
|
|
324
|
-
"",
|
|
325
|
-
`Native-layout implementation skill: ${path.join(target, "skills")}`,
|
|
326
|
-
);
|
|
327
|
-
return lines.join("\n");
|
|
324
|
+
"Config file per agent:",
|
|
325
|
+
...AGENTS.map((a) => ` ${a.label.padEnd(12)} ${a.file}`),
|
|
326
|
+
" Claude Desktop (macOS) ~/Library/Application Support/Claude/claude_desktop_config.json",
|
|
327
|
+
].join("\n");
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
async function installPlugin(args) {
|
|
@@ -382,44 +382,47 @@ async function installPlugin(args) {
|
|
|
382
382
|
}
|
|
383
383
|
if (spin) spin.stop("MCP config written");
|
|
384
384
|
|
|
385
|
-
// 4. Report
|
|
385
|
+
// 4. Report — keep it short. Manual config shown ONLY if nothing was registered.
|
|
386
386
|
const manifestPath = path.join(target, "plugin", "manifest.json");
|
|
387
|
-
const
|
|
387
|
+
const registered = results.filter((r) => !r.error);
|
|
388
|
+
const failed = results.filter((r) => r.error);
|
|
388
389
|
const verbOf = (s) =>
|
|
389
390
|
s === "added" ? "added" : s === "updated" ? "updated" : "already present";
|
|
390
391
|
|
|
391
392
|
if (clack) {
|
|
392
|
-
const reg =
|
|
393
|
-
?
|
|
394
|
-
.map((r) =>
|
|
395
|
-
r.error
|
|
396
|
-
? `✗ ${r.agent.label}: ${r.error}`
|
|
397
|
-
: `✓ ${r.agent.label}: ${verbOf(r.state)} -> ${r.agent.file}`,
|
|
398
|
-
)
|
|
393
|
+
const reg = registered.length
|
|
394
|
+
? registered
|
|
395
|
+
.map((r) => `✓ ${r.agent.label} (${verbOf(r.state)})`)
|
|
399
396
|
.join("\n")
|
|
400
|
-
: "No
|
|
401
|
-
clack.note(
|
|
402
|
-
clack.
|
|
397
|
+
: "No MCP client registered — plugin extracted only.";
|
|
398
|
+
clack.note(reg, "MCP client");
|
|
399
|
+
for (const r of failed) clack.log?.warn?.(`${r.agent.label}: ${r.error}`);
|
|
400
|
+
clack.note(figmaSteps(manifestPath), "Import into Figma Desktop");
|
|
401
|
+
if (!registered.length) clack.note(manualConfig(), "Manual MCP config");
|
|
403
402
|
clack.outro(
|
|
404
|
-
|
|
403
|
+
registered.length
|
|
405
404
|
? "Done. Restart your MCP client, then import the plugin into Figma."
|
|
406
|
-
: "Done.
|
|
405
|
+
: "Done. Add the MCP config above, then import the plugin into Figma.",
|
|
407
406
|
);
|
|
408
407
|
process.exit(0);
|
|
409
408
|
}
|
|
410
409
|
|
|
411
410
|
// Plain output (flags / no-TTY / clack unavailable).
|
|
412
|
-
out(
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
411
|
+
out(`\n✓ Plugin extracted → ${target}\n`);
|
|
412
|
+
if (registered.length) {
|
|
413
|
+
out("\nMCP registered (backup .bak-<timestamp>):\n");
|
|
414
|
+
for (const r of registered)
|
|
415
|
+
out(` ✓ ${r.agent.label} (${verbOf(r.state)})\n`);
|
|
416
|
+
out(" Restart your MCP client to load it.\n");
|
|
417
|
+
}
|
|
418
|
+
for (const r of failed) out(` ✗ ${r.agent.label}: ${r.error}\n`);
|
|
419
|
+
out("\nImport into Figma Desktop:\n");
|
|
420
|
+
for (const l of figmaSteps(manifestPath).split("\n")) out(` ${l}\n`);
|
|
421
|
+
if (!registered.length) {
|
|
422
|
+
out("\nManual MCP config:\n");
|
|
423
|
+
for (const l of manualConfig().split("\n")) out(` ${l}\n`);
|
|
421
424
|
}
|
|
422
|
-
out(
|
|
425
|
+
out("\n");
|
|
423
426
|
process.exit(0);
|
|
424
427
|
}
|
|
425
428
|
|