figma_checkpoint
Save a Figma subtree as inspectable JSON, compare it with the live document, and restore its children in one verified transaction—a manual undo-stack alternative for Plugin API work.
Instructions
Save a subtree as data, compare it against the live document, and rebuild it — the alternative to an undo stack the Plugin API does not offer. action "save" writes an inspectable JSON file; "show" diffs the live subtree against it; "restore" replaces the target's children from it in ONE transaction, dry run first, and verifies itself by dumping the subtree again. Refuses what it cannot promise: node types it cannot rebuild, truncated dumps, a group or instance target, and any restore not asked for out loud. STAR and POLYGON are rebuilt natively with their point count (and STAR's inner radius); BOOLEAN_OPERATION trees are rebuilt from their children with the recorded operation; SLICE nodes come back with their geometry and exportSettings; COMPONENT_SETs are rebuilt from their variant components, with non-variant properties added back by type and default value, their supported metadata and default-value variable bindings restored, and layer references remapped, while other unsupported node types are still refused by name. A save says what a checkpoint-v1 rebuild does not carry (an INSTANCE's interior structure beyond its direct overrides, and component and component-set identity/instances); direct per-layer overrides are captured and replayed by path after the main component is re-instantiated, including per-run text styling inside an overridden text layer, where a link or binding the override removed is cleared before the run snapshot is replayed, and style ids and node-level and run-level variable bindings are re-linked when still present. Every missing link or stale override path is reported.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "figma_checkpoint"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Checkpoint id; an unambiguous prefix is enough, and "latest" (the default) is the newest for this file | |
| dir | No | Where checkpoints live; defaults to ~/.local/share/opencode/figma-bridge-checkpoints | |
| name | No | save: a label for the id (defaults to the node name) | |
| force | No | restore: rebuild even when the subtree already matches the checkpoint | |
| action | Yes | save | show (compare live, read-only) | list | drop (a local file) | restore (dry run unless dryRun: false) | |
| dryRun | No | restore: default TRUE. false performs the rebuild (also needs allowDestructive and a bridge started with destructive writes) | |
| nodeId | No | The subtree root. save: defaults to the selection; show/restore: defaults to the checkpoint's own root | |
| compare | No | show: compare against the live subtree (default true). false reads the file only | |
| fileKey | No | Which connected Figma file to use: its fileKey (figma_whoami) or, when omitted, the only connected file. Required once more than one file is connected; figma_ping lists them. | |
| maxNodes | No | save: node cap; a truncated checkpoint cannot be restored | |
| allowPartial | No | restore: rebuild what can be rebuilt and list the rest as skipped, instead of refusing | |
| allowDestructive | No | restore: required for a real rebuild — it deletes the target's current children |