framer-dalton 0.0.24 → 0.0.26
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 +5 -5
- package/dist/cli.js +347 -36
- package/dist/start-relay-server.js +112 -27
- package/docs/skills/framer-code-components.md +1 -1
- package/docs/skills/framer-project.md +439 -0
- package/docs/skills/framer.md +6 -383
- package/package.json +8 -7
- package/docs/skills/framer-canvas-editing-project.md +0 -49
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: {{SKILL_NAME}}
|
|
3
|
+
description: "Project-scoped Framer skill for project {{PROJECT_ID}}. Covers project reads, edits, change review, publishing, image sourcing, component operations, and canvas editing. Very important: never load this skill without having already read the `framer` skill and without having already run `session new`, which will dynamically update this skill."
|
|
4
|
+
allowed-tools: ["Bash(npx framer-dalton:*)", "Bash(npx framer-dalton@latest:*)", "Read({{FRAMER_TEMPORARY_DIR}}/*)", "Write({{FRAMER_TEMPORARY_DIR}}/*)"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Project Scope
|
|
8
|
+
|
|
9
|
+
- Project ID: {{PROJECT_ID}}
|
|
10
|
+
- Generated At: {{GENERATED_AT}}
|
|
11
|
+
|
|
12
|
+
## Required Workflow
|
|
13
|
+
|
|
14
|
+
Every connected-project task follows these steps:
|
|
15
|
+
|
|
16
|
+
### 1. Look up the API (before EVERY new use of an API method)
|
|
17
|
+
|
|
18
|
+
**You MUST run `npx framer-dalton docs` before writing any code.** Do not guess method names or signatures.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx framer-dalton docs Collection # What methods exist?
|
|
22
|
+
npx framer-dalton docs Collection.getItems # What are the parameters and return type?
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. Execute code
|
|
26
|
+
|
|
27
|
+
Only after checking docs, use your write tool to write your code to a unique file under `{{FRAMER_TEMPORARY_DIR}}/`, then execute it with `-f`. Do not create code files with shell heredocs or `cat`. Name each file `<sessionId>-<short-summary>.js` where `<short-summary>` is a brief kebab-case description (e.g., `1-read-collections.js`, `1-add-team-member.js`).
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx framer-dalton exec -s 1 -f {{FRAMER_TEMPORARY_DIR}}/1-read-collections.js
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 3. Store results in `state`
|
|
34
|
+
|
|
35
|
+
Always save results you'll need again. Don't repeat API calls.
|
|
36
|
+
|
|
37
|
+
## Method Selection
|
|
38
|
+
|
|
39
|
+
Use agent-specific methods whenever a plugin API method and an agent method overlap:
|
|
40
|
+
|
|
41
|
+
- Use `readProjectForAgent`, `getNodeForAgent`, `getNodesForAgent`, `getNodesOfTypesForAgent`, `getScopeNodeForAgent`, `getGroundNodeForAgent`, `getParentNodeForAgent`, `getAncestorsForAgent`, `serializeForAgent`, `serializeNodesForAgent`, and `paginateForAgent` for project tree reads.
|
|
42
|
+
- Use `readComponentControlsForAgent`, `readIconSetControlsForAgent`, `readIconsForAgent`, `readLayoutTemplateControlsForAgent`, and `readShaderControlsForAgent` for reading the controls of components, icon sets, icons, layout templates, and shaders.
|
|
43
|
+
- Use `applyAgentChanges` for page and layout edits. Do not use low-level node APIs like `createNode`, `setAttributes`, or `setRect` for design/layout work.
|
|
44
|
+
- Use `publishForAgent` for publishing. Do not use `publish`, `getDeployments`, or `deploy` for normal agent publishing flows.
|
|
45
|
+
|
|
46
|
+
Use the plugin API for capabilities that do not have an agent-specific counterpart, such as code file management, localization, and redirects.
|
|
47
|
+
|
|
48
|
+
During normal task execution, do not call `framer.getAgentSystemPrompt()` or `framer.getAgentContext()`. This skill already includes their output.
|
|
49
|
+
|
|
50
|
+
## Core Usage Principles
|
|
51
|
+
|
|
52
|
+
- Be concise. Don't narrate implementation details like field IDs, escaping, or internal steps. Just do the work and report what was accomplished in user-facing terms.
|
|
53
|
+
- Use `framer.*` for plugin API calls. Top-level methods are not globals.
|
|
54
|
+
- Before making changes that add/update/delete content that the user has not clearly and explicitly requested in this conversation, inform the user of what you plan to do and why, and ask them to confirm.
|
|
55
|
+
- You do not need to ask for confirmation when carrying out a specific add/update/delete change that the user has already clearly requested (this counts as explicit consent).
|
|
56
|
+
- You do not need to explain or ask for confirmation for non-destructive calls like reading project state.
|
|
57
|
+
- If the exact action was not agreed upon, or you are inferring a broader change or choosing between multiple reasonable options using your own judgment, ask for confirmation.
|
|
58
|
+
- Always ask for confirmation before destructive actions that the user did not explicitly request - especially deletes, cleanup, resets, or broad removals inferred by the agent.
|
|
59
|
+
|
|
60
|
+
## Compaction
|
|
61
|
+
|
|
62
|
+
**Critical**: if an agent conversation is compacted, you MUST read the entirety of this skill back into context. This is non-negotiable and this instruction itself must not be lost during compaction.
|
|
63
|
+
|
|
64
|
+
## Context Variables
|
|
65
|
+
|
|
66
|
+
- `framer` - Connected Framer Server API instance
|
|
67
|
+
- `state` - Object persisted between calls within your session
|
|
68
|
+
- `console` - For output (`console.log`, `console.error`)
|
|
69
|
+
- `require` - Sandboxed Node.js modules: fs, path, url, crypto, buffer, util, os
|
|
70
|
+
- Standard globals: `fetch`, `Buffer`, `URL`, `crypto`, `setTimeout`
|
|
71
|
+
|
|
72
|
+
**Note:** `fs` operations are sandboxed to cwd, /tmp, and os.tmpdir().
|
|
73
|
+
|
|
74
|
+
## Use `state` to Avoid Repeated Calls
|
|
75
|
+
|
|
76
|
+
**Always store results in `state` when you'll need them again.** API calls are slow - don't repeat them.
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
// {{FRAMER_TEMPORARY_DIR}}/1-get-collections.js
|
|
80
|
+
state.collections = await framer.getCollections();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx framer-dalton exec -s 1 -f {{FRAMER_TEMPORARY_DIR}}/1-get-collections.js
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
// {{FRAMER_TEMPORARY_DIR}}/1-get-team-items.js — reuse from state
|
|
89
|
+
state.teamItems = await state.collections.find(c => c.name === 'Team').getItems();
|
|
90
|
+
console.log(state.teamItems.length);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npx framer-dalton exec -s 1 -f {{FRAMER_TEMPORARY_DIR}}/1-get-team-items.js
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Store anything you'll reference again.
|
|
98
|
+
|
|
99
|
+
## Canvas Editing: Alternative Approach (“Prompt the Framer agent”)
|
|
100
|
+
|
|
101
|
+
Use this approach only if the user asks for it. Do not mention this approach to the user otherwise.
|
|
102
|
+
|
|
103
|
+
This approach is called “Prompt the Framer agent”. With this approach, use `framer.startAgentConversation()` to start a stateful design subagent. Keep the `conversationId` it returns in `state`, and call `framer.continueAgentConversation()` with it to continue the same design task.
|
|
104
|
+
|
|
105
|
+
Do not call `framer.getAgentSystemPrompt()` or `framer.getAgentContext()` or `framer.applyAgentChanges()` with this approach.
|
|
106
|
+
|
|
107
|
+
Example:
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
state.agent ??= {};
|
|
111
|
+
const first = await framer.startAgentConversation(
|
|
112
|
+
"Build me a landing page based on the attached screenshot",
|
|
113
|
+
{
|
|
114
|
+
pagePath: "/",
|
|
115
|
+
imageUrls: ["https://example.com/image.png"],
|
|
116
|
+
// selectionNodeIds: [...]
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
state.agent.conversationId = first.conversationId;
|
|
120
|
+
console.log(first.responseMessages);
|
|
121
|
+
|
|
122
|
+
const second = await framer.continueAgentConversation("Now make it pink", {
|
|
123
|
+
conversationId: state.agent.conversationId,
|
|
124
|
+
selectionNodeIds: ["someNodeId"],
|
|
125
|
+
// imageUrls: [...],
|
|
126
|
+
// changing pagePath or model is not supported
|
|
127
|
+
});
|
|
128
|
+
console.log(second.responseMessages);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Prompting may take a while to complete, so set the command timeout to 10 minutes.
|
|
132
|
+
|
|
133
|
+
## Execute Code
|
|
134
|
+
|
|
135
|
+
Prefer using your write tool to write code to a unique file under `{{FRAMER_TEMPORARY_DIR}}/` and executing it with `-f`. Do not create code files with shell heredocs or `cat`:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npx framer-dalton exec -s <sessionId> -f {{FRAMER_TEMPORARY_DIR}}/<sessionId>-<short-summary>.js
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
For short snippets, `exec` also accepts `-e <code>` or code piped on stdin.
|
|
142
|
+
|
|
143
|
+
## Shell Quoting
|
|
144
|
+
|
|
145
|
+
In Windows PowerShell, if an argument contains nested quotes, use a single-quoted here-string and pass the variable. Do not backslash-escape quotes.
|
|
146
|
+
|
|
147
|
+
```powershell
|
|
148
|
+
$value = @'
|
|
149
|
+
[{"key":"value","filter":["text","$rect"]}]
|
|
150
|
+
'@
|
|
151
|
+
npx framer-dalton <command> --option $value
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## API Documentation
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npx framer-dalton docs # List all available methods
|
|
158
|
+
npx framer-dalton docs framer.getCollections # Show top level method
|
|
159
|
+
npx framer-dalton docs Collection # Show class with all method signatures
|
|
160
|
+
npx framer-dalton docs Collection.addItems # Show method + recursively expand all referenced types
|
|
161
|
+
npx framer-dalton docs ScreenshotOptions # Show type + recursively expand all referenced types
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`docs` with no arguments lists available methods. Looking up a class shows its full definition without expanding referenced types. Looking up a specific method or type automatically expands all referenced types recursively.
|
|
165
|
+
|
|
166
|
+
## API Examples
|
|
167
|
+
|
|
168
|
+
**STOP: These are patterns only. Before using any method below, run `npx framer-dalton docs <ClassName>` to verify the current signature.**
|
|
169
|
+
|
|
170
|
+
### Working with Collections (CMS)
|
|
171
|
+
|
|
172
|
+
Collections are Framer's CMS. Each collection has fields (columns) and items (rows). Use the plugin Collection API (the methods below) for collection schema and item CRUD.
|
|
173
|
+
|
|
174
|
+
**Exception — CMS Collection Lists.** The in-canvas construct that *renders* a collection as a repeating list of cards (the "Collection List" / repeater) is an agent/page concern. Build and edit those through `readProjectForAgent` and `applyAgentChanges`, not the plugin API. Use the plugin Collection API to read available collections and field schema first, then use `applyAgentChanges` to add the list.
|
|
175
|
+
|
|
176
|
+
#### Reading Collections
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
// Get all collections
|
|
180
|
+
const collections = await framer.getCollections();
|
|
181
|
+
console.log(collections.map((c) => ({ name: c.name, id: c.id })));
|
|
182
|
+
|
|
183
|
+
// Get a specific collection by ID
|
|
184
|
+
const collection = await framer.getCollection("collection-id");
|
|
185
|
+
|
|
186
|
+
// Get fields (columns)
|
|
187
|
+
const fields = await collection.getFields();
|
|
188
|
+
// Note that a plain console.log will miss getter-backed properties
|
|
189
|
+
console.log(fields.map((f) => ({ id: f.id, name: f.name, type: f.type })));
|
|
190
|
+
// [{ id: "BnNuS2i3o", name: "Title", type: "string" }, ...]
|
|
191
|
+
|
|
192
|
+
// Get items (rows)
|
|
193
|
+
const items = await collection.getItems();
|
|
194
|
+
console.log(items);
|
|
195
|
+
// [{ id: "XTM8FSHGs", slug: "post-1", draft: false, fieldData: {...} }, ...]
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### Sync external data to collection
|
|
199
|
+
|
|
200
|
+
```js
|
|
201
|
+
const collection = await framer.getCollection("collection-id");
|
|
202
|
+
const existing = await collection.getItems();
|
|
203
|
+
const existingIds = new Set(existing.map((i) => i.id));
|
|
204
|
+
|
|
205
|
+
const externalData = await fetch("https://api.example.com/posts").then((r) =>
|
|
206
|
+
r.json(),
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const items = externalData.map((post) => ({
|
|
210
|
+
id: post.id,
|
|
211
|
+
slug: post.slug,
|
|
212
|
+
fieldData: { title: post.title, content: post.body },
|
|
213
|
+
}));
|
|
214
|
+
|
|
215
|
+
await collection.addItems(items);
|
|
216
|
+
|
|
217
|
+
// Remove items no longer in external source
|
|
218
|
+
const newIds = new Set(items.map((i) => i.id));
|
|
219
|
+
const toRemove = [...existingIds].filter((id) => !newIds.has(id));
|
|
220
|
+
if (toRemove.length) await collection.removeItems(toRemove);
|
|
221
|
+
|
|
222
|
+
await collection.setPluginData("lastSync", new Date().toISOString());
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### Field Types
|
|
226
|
+
|
|
227
|
+
`boolean`, `color`, `number`, `string`, `formattedText` (HTML), `image`, `file`, `link`, `date`, `enum`, `collectionReference`, `multiCollectionReference`, `array` (galleries)
|
|
228
|
+
|
|
229
|
+
#### Updating Collection Items
|
|
230
|
+
|
|
231
|
+
```js
|
|
232
|
+
// Add or update items (if id matches existing item, it updates)
|
|
233
|
+
await collection.addItems([
|
|
234
|
+
{
|
|
235
|
+
id: "new-item-1",
|
|
236
|
+
slug: "hello-world",
|
|
237
|
+
fieldData: { titleFieldId: "Hello World" },
|
|
238
|
+
},
|
|
239
|
+
]);
|
|
240
|
+
|
|
241
|
+
// Remove items
|
|
242
|
+
await collection.removeItems(["item-id-1", "item-id-2"]);
|
|
243
|
+
|
|
244
|
+
// Reorder items
|
|
245
|
+
const ids = items.map((i) => i.id).reverse();
|
|
246
|
+
await collection.setItemOrder(ids);
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### Writing enum fields
|
|
250
|
+
|
|
251
|
+
Enum fields are **write-by-case-id, read-by-name**: a write must pass the case's `id`, but `getItems()` reads the value back as the case name. Writing `{ type: "enum", value: "New" }` (the name) is rejected — look up the id from the field definition first:
|
|
252
|
+
|
|
253
|
+
```js
|
|
254
|
+
const caseId = field.cases.find((c) => c.name === "New").id;
|
|
255
|
+
await collection.addItems([
|
|
256
|
+
{ slug: "hello-world", fieldData: { [field.id]: { type: "enum", value: caseId } } },
|
|
257
|
+
]);
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### Working with CollectionItem
|
|
261
|
+
|
|
262
|
+
```js
|
|
263
|
+
const items = await collection.getItems();
|
|
264
|
+
const item = items[0];
|
|
265
|
+
|
|
266
|
+
// Update item attributes
|
|
267
|
+
await item.setAttributes({ slug: "new-slug" });
|
|
268
|
+
|
|
269
|
+
// Navigate to item in Framer UI
|
|
270
|
+
await item.navigateTo();
|
|
271
|
+
|
|
272
|
+
// Remove item
|
|
273
|
+
await item.remove();
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Working with Images
|
|
277
|
+
|
|
278
|
+
Canvas editing accepts image URLs directly when setting an image fill, so the typical task is to obtain a URL and use it directly with `applyAgentChanges`.
|
|
279
|
+
|
|
280
|
+
There are three sources you'll typically pull URLs from:
|
|
281
|
+
|
|
282
|
+
**Stock photography.** Use `framer.queryImagesForAgent` to source candidates and stash the URL you want:
|
|
283
|
+
|
|
284
|
+
```js
|
|
285
|
+
const { results } = await framer.queryImagesForAgent({
|
|
286
|
+
source: "unsplash",
|
|
287
|
+
query: "snow-capped mountains",
|
|
288
|
+
count: 4,
|
|
289
|
+
orientation: "landscape",
|
|
290
|
+
});
|
|
291
|
+
state.heroUrl = results[0].url;
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**An external URL the user provided.** Pass it through directly. If you'll reuse the same image across many edits, upload it once and stash the resulting asset URL to avoid re-resolving the source on every change:
|
|
295
|
+
|
|
296
|
+
```js
|
|
297
|
+
state.heroUrl = (await framer.uploadImage({
|
|
298
|
+
image: "https://example.com/hero.png",
|
|
299
|
+
altText: "Mountain range at sunset",
|
|
300
|
+
})).url;
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**An image already on the canvas.** Read the node and reuse its existing image URL:
|
|
304
|
+
|
|
305
|
+
```js
|
|
306
|
+
const node = await framer.getNodeForAgent({ id: "<image-node-id>" });
|
|
307
|
+
state.heroUrl = node.attributes.fill;
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
For inline SVGs, use the plugin method directly:
|
|
311
|
+
|
|
312
|
+
```js
|
|
313
|
+
await framer.addSVG({
|
|
314
|
+
svg: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><circle cx="10" cy="10" r="8"/></svg>',
|
|
315
|
+
name: "circle.svg",
|
|
316
|
+
});
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Code Components
|
|
320
|
+
|
|
321
|
+
Code components are custom React components that run inside Framer. Use them when you need behavior that Framer's canvas doesn't support:
|
|
322
|
+
|
|
323
|
+
- **Custom interactivity** — drag-to-reorder, gesture-driven animations, games, form validation
|
|
324
|
+
- **External data** — fetching from APIs, rendering dynamic content, real-time updates
|
|
325
|
+
- **Complex logic** — state machines, calculations, conditional rendering beyond simple variants
|
|
326
|
+
- **Third-party libraries** — maps, charts, video players, rich text editors
|
|
327
|
+
- **Canvas/WebGL** — custom drawing, 3D rendering, generative art
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
If the design can be built with Framer's built-in components, layout tools, and interactions — don't use a code component. Code components are harder to maintain and can't be visually edited.
|
|
331
|
+
|
|
332
|
+
Before writing code components, load the `framer-code-components` skill.
|
|
333
|
+
|
|
334
|
+
#### Creation
|
|
335
|
+
|
|
336
|
+
```js
|
|
337
|
+
state.codeFile = await framer.createCodeFile("Badge.tsx", code);
|
|
338
|
+
state.diagnostics = await state.codeFile.typecheck();
|
|
339
|
+
console.log(state.diagnostics);
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
```js
|
|
343
|
+
state.component = state.codeFile.exports.find(
|
|
344
|
+
(exportItem) => exportItem.type === "component" && exportItem.isDefaultExport,
|
|
345
|
+
);
|
|
346
|
+
await framer.applyAgentChanges(
|
|
347
|
+
`+ComponentInstanceNode badge parent="wrapper" component="${state.component.componentId}"; SET badge width=120 height=48;`,
|
|
348
|
+
{ pagePath: "/" },
|
|
349
|
+
);
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
#### Editing
|
|
353
|
+
|
|
354
|
+
```js
|
|
355
|
+
const codeFile = await framer.getCodeFile("Badge.tsx");
|
|
356
|
+
state.updatedCodeFile = await codeFile.setFileContent(code);
|
|
357
|
+
state.diagnostics = await state.updatedCodeFile.typecheck();
|
|
358
|
+
console.log(state.diagnostics);
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
For large files, write `codeFile.content` to disk:
|
|
362
|
+
|
|
363
|
+
```js
|
|
364
|
+
const fs = require("fs");
|
|
365
|
+
|
|
366
|
+
state.codeFile = await framer.getCodeFile("Badge.tsx");
|
|
367
|
+
state.localCodePath = "{{FRAMER_TEMPORARY_DIR}}/Badge.tsx";
|
|
368
|
+
fs.writeFileSync(state.localCodePath, state.codeFile.content);
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Update the file with your patch tools, then load it back into Framer:
|
|
372
|
+
|
|
373
|
+
```js
|
|
374
|
+
const fs = require("fs");
|
|
375
|
+
const code = fs.readFileSync(state.localCodePath, "utf8");
|
|
376
|
+
state.updatedCodeFile = await state.codeFile.setFileContent(code);
|
|
377
|
+
state.diagnostics = await state.updatedCodeFile.typecheck();
|
|
378
|
+
console.log(state.diagnostics);
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Storing Data
|
|
382
|
+
|
|
383
|
+
Store metadata on nodes or globally in the project.
|
|
384
|
+
|
|
385
|
+
```js
|
|
386
|
+
// Store global project data
|
|
387
|
+
await framer.setPluginData("myKey", "myValue");
|
|
388
|
+
const value = await framer.getPluginData("myKey");
|
|
389
|
+
|
|
390
|
+
// Store data on a node
|
|
391
|
+
await node.setPluginData("processed", "true");
|
|
392
|
+
const nodeData = await node.getPluginData("processed");
|
|
393
|
+
|
|
394
|
+
// List all keys
|
|
395
|
+
const keys = await framer.getPluginDataKeys();
|
|
396
|
+
const nodeKeys = await node.getPluginDataKeys();
|
|
397
|
+
|
|
398
|
+
// Delete data (set to null)
|
|
399
|
+
await framer.setPluginData("myKey", null);
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### Localization
|
|
403
|
+
|
|
404
|
+
```js
|
|
405
|
+
// Get all locales
|
|
406
|
+
const locales = await framer.getLocales();
|
|
407
|
+
const defaultLocale = await framer.getDefaultLocale();
|
|
408
|
+
|
|
409
|
+
// Get localization groups (pages, CMS items with translations)
|
|
410
|
+
const groups = await framer.getLocalizationGroups();
|
|
411
|
+
|
|
412
|
+
// Update translations
|
|
413
|
+
const french = locales.find((l) => l.code === "fr");
|
|
414
|
+
await framer.setLocalizationData({
|
|
415
|
+
valuesBySource: {
|
|
416
|
+
[sourceId]: {
|
|
417
|
+
[french.id]: { action: "set", value: "Bonjour" },
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
});
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Known Limitations
|
|
424
|
+
|
|
425
|
+
- **Pages**: Cannot change the path of a page
|
|
426
|
+
- **Code overrides**: Cannot assign overrides to nodes
|
|
427
|
+
- **Analytics**: No APIs exist for accessing analytics data
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
Below is documentation for agent-specific methods and guidelines on how to work on projects.
|
|
432
|
+
|
|
433
|
+
{{AGENT_PROMPT}}
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
Below is the current project context:
|
|
438
|
+
|
|
439
|
+
{{AGENT_CONTEXT}}
|