@ject-5-fe/figma-plugin 0.0.6 → 0.1.0

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.
@@ -27,6 +27,7 @@ var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
27
27
  var import_uuid = require("uuid");
28
28
  var import_ws = __toESM(require("ws"), 1);
29
29
  var import_zod = require("zod");
30
+ var import_zlib = require("zlib");
30
31
  var logger = {
31
32
  info: (message) => process.stderr.write(`[INFO] ${message}
32
33
  `),
@@ -39,6 +40,13 @@ var logger = {
39
40
  log: (message) => process.stderr.write(`[LOG] ${message}
40
41
  `)
41
42
  };
43
+ function compressData(data) {
44
+ const jsonString = JSON.stringify(data, null, 0);
45
+ const compressed = (0, import_zlib.gzipSync)(jsonString);
46
+ const base64 = compressed.toString("base64");
47
+ logger.info(`Compression: ${jsonString.length} bytes -> ${base64.length} bytes (${Math.round(base64.length / jsonString.length * 100)}%)`);
48
+ return base64;
49
+ }
42
50
  var ws = null;
43
51
  var pendingRequests = /* @__PURE__ */ new Map();
44
52
  var server = new import_mcp.McpServer({
@@ -78,21 +86,17 @@ server.tool(
78
86
  );
79
87
  server.tool(
80
88
  "get_selection",
81
- "Get codegen snapshot (AST/reactNodes/tokens) for current selection or a specific node (optional nodeId)",
82
- {
83
- nodeId: import_zod.z.string().optional().describe("Optional: scope snapshot to a specific node ID")
84
- },
85
- async ({ nodeId }) => {
89
+ "Get information about the current selection in Figma",
90
+ {},
91
+ async () => {
86
92
  try {
87
- const result = await sendCommandToFigma(
88
- "get_selection",
89
- nodeId ? { nodeId } : {}
90
- );
93
+ const result = await sendCommandToFigma("get_selection");
94
+ const compressed = compressData(result);
91
95
  return {
92
96
  content: [
93
97
  {
94
98
  type: "text",
95
- text: JSON.stringify(result)
99
+ text: `[GZIP_BASE64]${compressed}`
96
100
  }
97
101
  ]
98
102
  };
@@ -110,7 +114,7 @@ server.tool(
110
114
  );
111
115
  server.tool(
112
116
  "get_node_info",
113
- "Get raw Figma node info for a specific node (not for codegen)",
117
+ "Get detailed information about a specific node in Figma",
114
118
  {
115
119
  nodeId: import_zod.z.string().describe("The ID of the node to get information about")
116
120
  },
package/package.json CHANGED
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "name": "@ject-5-fe/figma-plugin",
3
- "version": "0.0.6",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
- "publishConfig": {
6
- "access": "public"
7
- },
5
+ "private": "false",
8
6
  "scripts": {
9
7
  "dev": "plugma dev",
10
8
  "socket": "tsx src/socket.ts",
11
9
  "start": "concurrently \"yarn run socket\" \"yarn run dev\" --names \"SOCKET,MCP\" --prefix-colors \"blue,green\"",
12
- "build:server": "tsup",
13
- "type-check": "yarn run -T -B tsc --noEmit"
10
+ "build:server": "tsup"
14
11
  },
15
12
  "bin": "dist/server/server.cjs",
16
13
  "files": [
@@ -18,13 +15,13 @@
18
15
  ],
19
16
  "dependencies": {
20
17
  "@modelcontextprotocol/sdk": "^1",
21
- "es-toolkit": "^1.39.10",
18
+ "es-toolkit": "^1.41.0",
22
19
  "react": "^18.3.1",
23
20
  "react-dom": "^18.3.1",
24
21
  "uuid": "^11",
25
22
  "ws": "^8",
26
23
  "xml-js": "^1.6.11",
27
- "zod": "^3"
24
+ "zod": "^4"
28
25
  },
29
26
  "devDependencies": {
30
27
  "@figma/plugin-typings": "^1.100.2",
@@ -61,7 +58,7 @@
61
58
  ],
62
59
  "devAllowedDomains": [
63
60
  "http://localhost:*",
64
- "ws://localhost:3000"
61
+ "ws://localhost:9001"
65
62
  ]
66
63
  }
67
64
  }