52 Commits

Author SHA1 Message Date
Dominik Jain
cbb0863746 Add helper function PenpotUtils.addFlexLayout for adding a layout without changing relative child positions
Resolves #33

Additional changes: Improve prompts pertaining to layouts
2026-01-29 14:28:56 +01:00
Dominik Jain
c931e6978b Update @penpot/plugin-types to v1.4.1, removing corresponding TODO #25
Update @penpot/plugin-styles to v1.4.1
2026-01-21 16:15:43 +01:00
Dominik Jain
07300fea2d PenpotUtils.analyzeDescendants: Try more explicit args (root, shape) for evaluator #26
This can perhaps prevent usage errors
2026-01-15 17:30:36 +01:00
Dominik Jain
90459f0ba4 Add PenpotUtils.analyzeDescendants as a powerful utility function for validation #26 2026-01-15 16:42:47 +01:00
Dominik Jain
c4c37adb25 PenpotUtils: Add isContainedIn and setParentXY #26 2026-01-14 22:21:20 +01:00
Dominik Jain
3c1bd875d8 PenpotUtils.shapeStructure: Add essential information on layouts #26 2026-01-14 21:49:52 +01:00
Dominik Jain
528a2e15f2 PenpotUtils.importImage: Fix assigned shape name 2026-01-14 19:31:18 +01:00
Dominik Jain
3dc2411130 Extend ExportShapeTool to support the export of image fill content
Add new tool parameter `mode` ("shape" or "fill") to support this

Since the fill's format is not guaranteed to be PNG, include dependency
`sharp` to handle image format conversion

Because the export logic has become more complex, introduce
PenpotUtils.exportImage utility function for minimal code to be
sent to the plugin for execution

Resolves #12
2026-01-14 16:15:36 +01:00
Dominik Jain
2b1a287f15 Update dependencies 2026-01-13 20:12:19 +01:00
Dominik Jain
055f717207 Standardise configuration with environment variables
Replace CLI parameters with environment variables, keeping only --multi-user and --help

Environment variables:
- PENPOT_MCP_SERVER_PORT (new, replaces CLI param)
- PENPOT_MCP_WEBSOCKET_PORT (new)
- PENPOT_MCP_REPL_PORT (new)
- PENPOT_MCP_SERVER_ADDRESS (new)
- PENPOT_MCP_REMOTE_MODE (existing)
- PENPOT_MCP_LOG_LEVEL (renamed from LOG_LEVEL, replaces CLI param)
- PENPOT_MCP_LOG_DIR (renamed from LOG_DIR, replaces CLI param)
- PENPOT_MCP_PLUGIN_SERVER_LISTEN_ADDRESS (renamed from PENPOT_MCP_PLUGIN_SERVER_ALLOWED_HOSTS)

Additional changes:
- Plugin now constructs WebSocket URL from server address and port (replaces PENPOT_MCP_WEBSOCKET_URL)
- Use configured server address in all startup log messages
- Document all configuration options in README.md
2026-01-12 22:55:17 +01:00
Dominik Jain
7f60e78594 Merge branch 'develop' into server
Conflicts:
  penpot-plugin/src/main.ts
2026-01-12 20:32:04 +01:00
Dominik Jain
4c875ba736 Change default allowedHosts to [], allowing only local connections (as before) 2026-01-12 20:20:57 +01:00
Dominik Jain
b67e6abdd5 Use more specific environment variable names
* VITE_ALLOWED_HOSTS -> PENPOT_MCP_PLUGIN_SERVER_ALLOWED_HOSTS
  * VITE_MCP_WS_URL -> PENPOT_MCP_WEBSOCKET_URL
2026-01-12 20:17:17 +01:00
Fernando Basello
dc3c407ac5 feat(plugin): support running the MCP server on a remote host (not just localhost) 2026-01-11 18:12:31 -03:00
Dominik Jain
02da2b4b19 Plugin: Add multi-user mode option (alt. run script, which sets constant)
User token is a dummy token for now; shall be provided by Penpot in the future
2025-12-16 22:28:02 +01:00
Dominik Jain
4c6b7844b1 Improve comments 2025-12-16 22:28:02 +01:00
Dominik Jain
a27f2d5122 Plugin: Display WebSocket errors (e.g. missing token) in UI #20 2025-12-16 22:28:02 +01:00
Dominik Jain
24ffeac2bf Move image import code to PenpotUtils 2025-11-14 12:58:04 +01:00
Dominik Jain
f8f440c7dd Add ImportImageTool
Add PenpotUtils.atob to support base64 conversion
(regular atob not available in plugin context)

Resolves #10
2025-11-13 19:09:27 +01:00
Dominik Jain
ac0290aca0 Add util functions getPageForShape and generateCss
in an attempt to circumvent restrictions of penpot.generateStyle
2025-10-15 17:30:23 +02:00
Dominik Jain
b5869d185b Reduce plugin UI size and improve colours 2025-10-11 22:56:57 +02:00
Dominik Jain
8a6848a663 Move prettier configuration to top level 2025-10-11 22:56:57 +02:00
Dominik Jain
0b9404e2a2 Remove obsolete tool: PrintTextTool 2025-10-11 22:56:57 +02:00
Dominik Jain
9dcbc68f09 Extend plugin permissions: Add read/write for library and comments 2025-10-08 00:10:26 +02:00
Dominik Jain
094e436d80 Make ExecuteCodeTaskHandler use async functions by default
facilitating calls to async functions (also triggered by the LLM)
2025-10-08 00:10:26 +02:00
Dominik Jain
3f7153c7e4 Update lock files 2025-10-08 00:10:26 +02:00
Dominik Jain
cbac84bab2 Restructuring, improving README structure and npm commands 2025-10-08 00:10:26 +02:00
Dominik Jain
cb5dbcfb06 Make plugin window smaller and use purple colour for successful connection 2025-10-08 00:10:26 +02:00
Dominik Jain
e5b5722ce6 Remove demo 'add text' button 2025-10-08 00:10:26 +02:00
Dominik Jain
11d67037e7 Make PenpotUtils.findShape search across all pages (i.e. globally) 2025-10-08 00:10:26 +02:00
Dominik Jain
dab0ab944e Remove obsolete template stuff from plugin 2025-10-08 00:10:26 +02:00
Dominik Jain
dacd87bbac Add utils for Page handling, improve prompts explaining design structure 2025-10-08 00:10:26 +02:00
Dominik Jain
865606b7b0 Add PenpotUtils (utility functions the LLM can make use of) 2025-10-08 00:10:25 +02:00
Dominik Jain
afb00f6033 Switch WebSocket port from 8080 to 4402 2025-10-08 00:10:25 +02:00
Dominik Jain
223d6d50b0 Improve return type definition of ExecuteCodePluginTask 2025-10-08 00:10:25 +02:00
Dominik Jain
13cb1aee0f ExecuteCodeTaskHandler: Await result if it is a Promise 2025-10-08 00:10:25 +02:00
Dominik Jain
4350f18ab3 Make TaskHandler.handle async 2025-10-08 00:10:25 +02:00
Dominik Jain
5ab14ffb9e Allow code execution to use the console, returning the full log 2025-10-08 00:10:25 +02:00
Dominik Jain
f0b25c1052 Apply formatter 2025-10-08 00:10:25 +02:00
Dominik Jain
c3ae05c8fc Track handler responses being sent 2025-10-08 00:10:25 +02:00
Dominik Jain
5ffaabd728 Add code execution tool 2025-10-08 00:09:42 +02:00
Dominik Jain
93e98f5e08 Refactor task handling (adding Task abstraction) 2025-09-17 19:43:21 +02:00
Dominik Jain
8275735999 Refactor task handling (introducing abstraction TaskHandler) 2025-09-16 17:38:34 +02:00
Dominik Jain
23d2270df0 Improve error handling in PluginTask execution 2025-09-12 18:36:13 +02:00
Dominik Jain
b7d1171654 Establish return channel when executing plugin tasks
and package 'common' for representations used in both subprojects
2025-09-12 16:42:13 +02:00
Dominik Jain
4b755e4381 Apply formatter 2025-09-11 11:37:25 +02:00
Dominik Jain
f99fedb4f1 Update formatter config 2025-09-11 11:35:48 +02:00
Dominik Jain
4a9700d445 Implement initial WebSocket interaction between MCP server and Penpot plugin
(Example: Writing and selecting a text object to the Penpot project)
2025-09-10 23:02:57 +02:00
Dominik Jain
7faca70aa7 Establish websocket connection between plugin and MCP server 2025-09-10 16:33:53 +02:00
Dominik Jain
740750fbd8 Update plugin metadata 2025-09-10 16:00:30 +02:00