diff --git a/.serena/memories/critical-info.md b/.serena/memories/critical-info.md index acb3f560fe..23abc1910e 100644 --- a/.serena/memories/critical-info.md +++ b/.serena/memories/critical-info.md @@ -1,21 +1,26 @@ You are working on the GitHub project penpot/penpot. -# Working with Penpot Designs +# Working with Penpot Designs via the JavaScript API Before working with Penpot designs, call the `high_level_overview` tool of the Penpot MCP server. -It explains the JavaScript API, which you can use to automate tasks via the `execute_code` tool. +It explains the API, which you can use to automate tasks via the `execute_code` tool. -# Critical Memories +# Dev Workflow -* Before creating a commit, read `creating-commits`. -* When working on the Penpot frontend ... - - read the file `frontend/AGENTS.md` for an overview - - to understand the connection between the JavaScript API and the ClojureScript code, read memory `frontend/js-api-to-cljs-binding`. - - to understand how to execute ClojureScript code in the Penpot frontend, read memory `frontend/cljs-repl`. +Memories: + - before creating a commit, read `creating-commits`. + - before creating a PR, read `creating-prs`. -# Detecting Frontend Crashes +# Frontend + +Read the file `frontend/AGENTS.md` for an overview. +Memories: + - connection between the JavaScript API and the ClojureScript code: `frontend/js-api-to-cljs-binding`. + - executing ClojureScript code in the frontend: `frontend/cljs-repl`. + - programmatically navigating to a file in the workspace: `frontend/navigation`. + +## Detecting Crashes The Penpot frontend can crash silently from the JS API's perspective: `execute_code` calls return successfully, but 1-2s later the workspace becomes unusable (Internal Error page). The `execute_code` tool then stops working, but `cljs_repl` still works. Use it to detect a crash via `(some? (:exception @app.main.store/state))`. For details on handling crashes, read memory `frontend/handling-crashes`. - diff --git a/.serena/memories/frontend/navigation.md b/.serena/memories/frontend/navigation.md new file mode 100644 index 0000000000..67e09042f9 --- /dev/null +++ b/.serena/memories/frontend/navigation.md @@ -0,0 +1,14 @@ +# Navigating to a File in the Workspace + +To programmatically open a file in the workspace, use `cljs_repl` with: +```clojure +(do (require '[app.main.data.common :as dcm]) + (app.main.store/emit! (dcm/go-to-workspace + :team-id (parse-uuid "") + :file-id (parse-uuid "") + :page-id (parse-uuid "")))) +``` +**All three IDs are required.** You can get: +- `team-id` from `(:current-team-id @app.main.store/state)` +- `file-id` from the dashboard files: `(vals (:files @app.main.store/state))` +- `page-id` by fetching the file: `(get-in file-data [:data :pages])` via `(rp/cmd! :get-file {:id file-id :features (get @app.main.store/state :features)})`