The window now runs craft_automation's AgentLink and AgentSwitch for the
agents channel (token, challenge handshake, connection file, retry,
stop on switch-off) and forwards its requests into FigCraft's control
queue, each confined to the agent folders as before; FigCraft's own copy
of that code is gone. Preferences offer the shared Agents page (AI
agents..., with the suite's AI-MCP flag) over Prefs::agents, changed by
the new pref.agents command, which an agent's confined request can't
use. figcraft-cli mcp reads the saved settings (folders, When FigCraft
is closed), takes --when-closed, signs in to the window with the
challenge handshake, deprecates --attach and gets the agent_folders tool
(control method agent.folders). The --control server is stopped on exit.
Closes#2963.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`figcraft --control PORT --automation-read-root DIR --automation-write-root DIR
--automation-allow-server wss://host/` lets the window, its control channel and
`figcraft-cli mcp --attach` join, publish to and share on that server, with the same
matching as headless MCP (scheme, host, port, path prefix). Everything else stays off
the network. A malformed allowed server, or one given without a root, stops the app.
The check of an allowlist entry moves to `Endpoint::allowlisted` in collab-net, so the
app and the CLI share it.
* M6: Open and import Adobe XD (.xd) files, best effort (#2077)
The archive's artboards, pasteboard layers, groups, rectangles, circles,
lines and paths, solid, linear-gradient and image fills, strokes, opacity,
drop shadows and blurs, clip paths and text with styled ranges are mapped
onto the REST importer, as the .sketch import is. Point text is measured
so its first baseline and aligned edge stay where the file put them.
File > Open, Import, drop, CLI and MCP take .xd files, in the browser too.
* M6: XD import: clip paths take only shapes, one style range keeps its decoration, groups refit after point text (#2077)
From review: a clip path holding a group clipped by itself recursed without end;
a single style range covering a whole text dropped its underline or strikethrough;
groups kept the bounds of the guessed text size after the point text was measured.
* perf: eliminate UI-thread freezes on save, recovery, MCP render, and Local Share
* Background save runs file.save's own checks, one save at a time
- file.save and the background save share one prepare/write/commit path:
branch tabs are synced first, unknown params, another tab holding the file
and the overwrite check refuse as file.save does, and a save under a new
name leaves the tab saved.
- One save at a time: an MCP file.save waits for the save in flight and
Save chosen again saves once more after it; a panicking worker ends the
save with an error instead of blocking every later one.
- The worker writes under the roots the frame ran in (an agent's shortcut).
- Only Save in the menu and its shortcut write in the background; other
callers (library publish) still save before they go on.
- Recovery: a new copy of a document waits for its dropped copy's cleanup,
which would otherwise remove it.
* Saving again saves the tab it was chosen in; ui.render draws the selection
- Save chosen while a save is written is kept per tab and runs for that tab
once the write is committed, not for whichever tab is in front by then.
- ui.render on a worker picks its layers as file.export does (the ids given,
else the selection, else the page): file.export's choice is now one
engine function, export_ids, used by both.
* Save chosen again keeps the file access roots it was chosen under
A Save queued behind the save in flight remembers the roots of the frame
that chose it (an agent's shortcut) and runs inside them, not the app's.
* Recheck the file right before a save replaces it; recovery cleanup survives a failed spawn
- A save remembers its own file's state on disk when its checks passed and
refuses to replace it if another app changed it while the new file was
written (the background save can take a while).
- A dropped recovery copy's cleanup is a guard: if its helper thread can't
start, it runs on the calling thread instead of leaving the copy behind.
* A revert or a discarding close stops a background save from replacing the file
A background save holds a gate while it replaces the file; file.revert and
file.close (once it is closing) shut the gates of the tab's saves first, so a
save still being written no longer puts back the edits the tab went back on.
A save replacing the file at that moment finishes before the revert reads it.
---------
Co-authored-by: Jeremy <jeremy8776@googlemail.com>
Resolves conflicts in crates/engine/src/lib.rs (keep both test modules) and
crates/penpot/src/export.rs (keep main's orientation check on lazily loaded bytes).
`figcraft-cli diff A B [--json]` counts layers by type, fills, strokes,
effects, layout grids, auto layout frames, export settings, prototype
interactions and flows, variable bindings, style links, styles by kind,
variables, collections, modes, images and comments in both files and
prints the counts that differ. It exits 1 when one differs, so a job
can run `convert in.fig out.fig` and `diff in.fig out.fig` and fail on
anything the save dropped. Takes the automation roots like `info`.
--automation-allow-server already let a confined headless session join
files on a named server. collab.publish and collab.share (online) now
reach that same server too, matched the way joins are (parsed scheme,
host, port and path prefix); the server key stays in the publish
address, never in the allowlist. Other servers, hosting, team libraries
and plugin directories stay refused.
Since 0.19 plain figcraft-cli mcp without the ArtCraft Launcher's switch needs both roots (rule 18), but the Claude Desktop and .mcp.json snippets still passed only ["mcp"], so a client set up from them stopped at start. The snippets now pass both roots, the guide says what a pre-0.19 configuration shows and how to fix it, and a test runs every documented configuration through the CLI's argument parsing and MCP plan with the switch off.
A client sending a byte at a time, never a newline, kept an unauthenticated connection open past
the token wait: the read timeout bounded each read, not the line. The line reader now counts the
remaining time down to the deadline before every read until the token is shown.
The CLI tests now check that a connection file a crashed app left (nothing listens on its port)
isn't used, as #2740 asks.
craft_control refuses a token file group or others can read; the test wrote one with mode 644,
so the window test failed on Linux (and the wrong-token test passed on that refusal instead of
the window's). The file is now 0600 and the wrong-token test checks the window's own refusal.
- Live mode keeps every --automation-write-root, not only the first.
- --attach sends this machine's token file only to a loopback address; another host gets only
FIGCRAFT_CONTROL_TOKEN.
- Stopping a listener (the launcher's switch off) cancels its requests still queued, so none runs
after the stop.
- A screenshot write is checked against the request's roots again when it happens.
- The frame that applies an agent's queued ui.input batch runs confined to that agent's roots, so
a queued Save shortcut can't write outside them.
- The headless confinement test uses the registered file.saveAs; docs say both roots are
required only without the switch or with --headless.
While the ArtCraft Launcher's switch lets agents use FigCraft, figcraft-cli mcp sends each call
to the open window through craft_control::agents::Live (the connection file, the token file; a
closed app is started) and otherwise runs headless in the automation roots or the agent folder.
Without the switch it still needs both roots (rule 18); --headless forces headless. --attach
reads the token file of its port.
Requests from the agent listener carry the agent folder as their roots (ControlRequest::roots):
handle runs confined to them and a screenshot path is checked as it is admitted, unless the app
was started with roots of its own. Docs: mcp.md, control-protocol.md, cli.md.
`export`, `convert` and `run --out` take `--strict`. When the .fig,
.penpot or Android Vector Drawable writer reports anything left out or
changed, nothing is written or replaced and the command exits 1 with the
reasons on the error line. A folder of drawables is written only once
none of its files leaves anything out. `--strict` with an output whose
writer reports nothing (png, svg, pdf, ...) or with `--vd-compat ignore`
is a usage error (exit 2), so it never passes without checking anything.
A .figcraft output is accepted for convert and run: it keeps everything.
.fig export writes a vector whose filled areas use both winding rules as
one fillGeometry path per rule, so other readers fill each area as the
network does. The warning that the outline used the first area's rule is
gone.
Image adjustments, list spacing, hanging punctuation and lists, and
vertical trim were already written on main. OpenType features,
variables' publishing, code syntax and inheritance settings, prototype
device settings and text styles on part of a text keep their warnings:
the .fig import (craft_fig's mapping at the pinned craft-libs rev) does
not read them back, so they cannot round-trip yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main moved figcraft-cli to RFC-0018 (#2645): main.rs is a thin wrapper and the
dispatch lives in lib.rs, so mcp_roots, the --automation-allow-server handling
and its test move there; headless mcp is checked before the fonts are scanned.
RW2, CR2, CR3, NEF, ARW, RAF, ORF, DNG and the other containers craft-raw
decodes now open, import, place and fill shapes. add_image develops a raw
once with craft-develop's stages (AHD demosaic, highlight rebuild, as-shot
white balance and colour matrices, neutral tone curve, sRGB, orientation)
and the document keeps the picture as a quality 95 JPEG, so every way an
image comes in takes raws. file.open and the Open, Import, Place and image
fill dialogs know the raw extensions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rust 1.100 marks `ExitCode` as must-use and extends `needless_bool`,
so `cargo clippy --workspace --all-targets -- -D warnings` fails on main:
- `crates/ui-egui/src/shortcuts.rs`: the end of `key_event` returns the
condition directly instead of `if ... { return true; } false`.
- `apps/figcraft-cli/src/files.rs`: three script tests now assert the exit
code that `run_script` returns (`SUCCESS` for the two scripts that run,
1 for the script whose step fails) instead of dropping it.
Figma holds a US registration for DEV MODE (US 7574348). Display text only: the view.devMode label, Inspect tab, shortcut row, refusal messages, CLI help, docs and all locale catalogs now say Developer Mode. Command ids, preference keys and saved fields are unchanged; "Dev Mode" stays a search alias in the Actions palette. Adds a naming guard test.