126 Commits

Author SHA1 Message Date
David Mann f22cac0de4 MCP: agents in the open window on the shared AgentLink and Agents page
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>
2026-12-03 05:02:17 +01:00
BFlat 89eea4d09d Merge pull request #2922 from storytold/feat/255-2502-feat-cli-let-a-confined-ins
M9: the confined desktop app reaches the servers --automation-allow-server names (#2502)
2026-12-03 07:15:53 +07:00
bflatastic 858c4435ff export --layout refuses .fig and .penpot destinations; layers past the file limit fail the CLI and show in the toast 2026-12-03 02:53:32 +07:00
bflatastic dc71f20498 M6: app project layouts in figcraft-cli export --layout and the Export dialog (part of #1689) 2026-12-03 02:53:31 +07:00
bflatastic 8495573887 M9: the confined desktop app reaches the servers --automation-allow-server names (#2502)
`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.
2026-12-02 16:12:33 +07:00
BFlat c7546e9e0e M6: Open and import Adobe XD (.xd) files, best effort (#2077) (#2912)
* 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.
2026-12-02 10:16:44 +07:00
BFlat 9087f616d3 perf: eliminate UI-thread freezes on save, recovery and MCP render (#2887) (#2896)
* 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>
2026-12-02 07:15:44 +07:00
bflatastic f4ef76aa72 Merge main into perf/lazy-images-1313
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).
2026-12-01 18:32:41 +07:00
bflatastic fd9546a177 figcraft-cli diff: compare what two files hold, so a round trip can be checked in CI (#2384)
`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`.
2026-12-01 13:49:02 +07:00
bflatastic 5e5288dbfb M9: a confined headless MCP session can publish to its allowed server (#2502)
--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.
2026-12-01 12:30:20 +07:00
bflatastic c69230975b mcp: the client configurations in the guide pass both automation roots (#2783)
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.
2026-12-01 03:13:17 +07:00
Bryton Cooper 3587c37513 perf(format,doc,engine): load .figcraft images lazily with bounded LRU and streaming save (#1313) 2026-11-30 07:39:12 -07:00
David Mann ccb2b62533 agents: the token wait is one deadline for the whole first line; stale connection file test
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.
2026-11-29 16:59:28 +01:00
David Mann fe3e2c3e10 Merge branch 'feat/agents-launcher-switch' of https://github.com/davidmann4/figcraft into feat/agents-launcher-switch
# Conflicts:
#	apps/figcraft-cli/src/live_tests.rs
2026-11-29 16:51:34 +01:00
bflatastic 9c89a490ef cli: the live tests write their token file owner-only
On Unix the token client refuses a token file others can read, so the
window test failed on Linux and the wrong-token test passed for that reason.
2026-11-29 22:50:04 +07:00
David Mann e1c5d99399 cli: the live tests' token file is owner-only, as the shared client requires on Unix
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.
2026-11-29 16:35:46 +01:00
David Mann 0d933a62f9 agents: review fixes (#2741)
- 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.
2026-11-29 15:42:04 +01:00
David Mann 48287201cf mcp: plain figcraft-cli mcp reaches the open window through the launcher's switch (#2740)
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.
2026-11-29 15:18:51 +01:00
Bryton Cooper 96a2067684 figcraft-cli: --strict on export, convert and run; .fig fill outline per winding rule (#2384)
`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>
2026-11-28 04:37:07 -07:00
BFlat dbe9eeb1bd Merge pull request #2607 from Utakata/feat/open-camera-raw
format: open camera raw files as their developed picture
2026-11-28 15:06:51 +07:00
FredApps f278b428cb Merge branch 'main' into feat/automation-allow-server-join
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.
2026-11-28 08:01:38 +01:00
FredApps 4561b31166 Merge branch 'main' into feat/open-camera-raw
main's craft-libs pin (8fa4db64) already contains 249a41bd, so the pins stay at
main's and the camera raw crates are added at that same rev.
2026-11-28 07:46:25 +01:00
bflatastic 5a8dcb867e Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	ROADMAP.md
2026-11-27 15:46:21 +07:00
bflatastic fbbe425064 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	ROADMAP.md
2026-11-27 14:26:01 +07:00
bflatastic 3cac6c5051 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	ROADMAP.md
2026-11-27 14:25:45 +07:00
FredApps 3b9bf7ffb5 figcraft-cli: test perf, plugin publish --key and mcp --attach failures in-process 2026-11-26 23:05:03 +01:00
FredApps 8d50b20c64 figcraft-cli: follow RFC-0018 (run(args,out,err), typed errors, env flags, --in-place, man pages and completions) 2026-11-26 22:34:19 +01:00
Utakata 90d2d92430 format: open camera raw files as their developed picture
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>
2026-11-25 04:34:49 +09:00
Anderson 470b6483f1 Require both roots for headless MCP 2026-11-23 04:04:24 +01:00
Anderson 4f2ade852e MCP: allow confined sessions to join an approved server 2026-11-23 02:34:21 +01:00
Mex d7de7b786b Merge branch 'main' into patch-5 2026-11-18 21:19:02 +01:00
Mex ceea6da487 Merge branch 'main' into patch-6 2026-11-18 21:12:24 +01:00
BFlat bf29f7731e Merge pull request #2391 from MMexicann/patch-3
fix: escape Windows device names in generated exports
2026-11-17 18:25:15 +07:00
BFlat 16cc237a7a Merge pull request #2390 from MMexicann/patch-2
cli: reject malformed attach address components
2026-11-17 18:23:06 +07:00
Mex b7b4773639 M0.9: cover printable post-parse CLI diagnostics
Cover control-bearing missing-file failures and invalid connect-publish extensions through the binary, retaining exit codes 1 and 2 and no stdout.
2026-11-15 19:53:28 +01:00
Mex 6b272dc857 M0.9: reuse printable diagnostic text at the CLI boundary
Expose the existing plain helper within the crate so final CLI errors use exactly the same escaping rule as file and script diagnostics.
2026-11-15 19:52:54 +01:00
Mex fff48fc441 M0.9: escape terminal controls in CLI operation errors
Apply the existing printable-text rule at the final Usage and Failed error output boundary, preserving exit codes and the help footer.
2026-11-15 19:52:03 +01:00
Mex 9a7ed6a8e7 M0.9: clarify the default CLI export and render page
Name the existing first non-divider page default in both --page help descriptions. Runtime behavior is unchanged.
2026-11-15 19:39:11 +01:00
Mex 59437c776b M0.9: reject repeated CLI scale suffixes
Accept at most one optional x suffix and cover malformed scales as usage errors for both export and render.
2026-11-15 18:24:44 +01:00
Mex 14bdeff591 fix: check device names after filename length limits
Cap generated CLI names before device-name escaping, then cap again so the prefix fits both limits. Cover character and byte truncation boundaries.
2026-11-15 16:30:31 +01:00
Mex 8244acce2d cli: escape device names in generated export filenames
Use the shared device-name escaping rule for generated CLI export basenames, before existing length caps.
2026-11-15 15:58:13 +01:00
Mex ea8c630821 cli: reject malformed attach address components
Validate a nonempty host and a u16 port before attempting attachment. Preserve valid address spelling and bare-port behavior.
2026-11-15 15:34:15 +01:00
Dylan M. Taylor d5cdba8d3b Isolate concurrent font integration tests 2026-11-13 15:57:06 +00:00
NetterSilver 7b34dbab00 Keep library links working when the project folder is moved or cloned (#2132)
Fixes #2122

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 01:48:30 +01:00
.CooCoo 40360c4a2a Fix main: clippy on Rust 1.100 stops at shortcuts.rs and the CLI script tests (#2316)
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.
2026-11-13 01:38:53 +01:00
skylar taylor-barrick 3839fe4a0c Naming: use Developer Mode instead of Figma's Dev Mode (#2135)
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.
2026-11-09 06:24:44 +01:00
bflatastic 7bfeb5674d CLI: test what info and a failed script print 2026-11-07 11:39:17 +07:00
bflatastic bfae850ab1 Merge remote-tracking branch 'origin/main' into carry/1952 2026-11-07 11:37:12 +07:00
bflatastic 8802f3fd49 CLI: test that plain escapes controls only 2026-11-07 08:56:32 +07:00
bflatastic 680ec56c89 CLI: escape control characters only, so quotes and Windows paths print as they are 2026-11-07 08:02:06 +07:00