📚 Improve/restructure critical-info memory, adding navigation memory

This commit is contained in:
Dominik Jain 2026-05-05 16:46:14 +02:00
parent 65fce36898
commit 85cf3fcc3c
2 changed files with 29 additions and 10 deletions

View File

@ -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`.

View File

@ -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 "<team-id>")
:file-id (parse-uuid "<file-id>")
:page-id (parse-uuid "<page-id>"))))
```
**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)})`