Scripts: File › Scripts lists the Scripts folder, subfolders as submenus

File › Scripts now lists the .js and .jsx files of the Scripts folder next
to the preferences, each named after its file without the extension, with
each subfolder as a submenu, above Check Script… and Other Script…. The
help page describes this listing:
https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/install-and-run-scripts.html

Choosing a listed script runs it through script.run without the warning
Other Script… shows. script.listInstalled returns the same listing, and
ui.runInstalledScript {path} runs one entry.

VectorCraft's own rules: the folder is read off the UI thread when the
app starts, when its window becomes active and when the File menu of the
window's menu bar opens; only names are read; links, junctions, hidden
and system entries are left out and checked again before a run; one read
stops at 2,048 entries, 512 scripts, 128 subfolders, 4 levels or 250 ms
and the menu then notes that some scripts were not listed. Under an
automation read root, script.listInstalled and ui.menu.list leave out a
folder outside the root.

#1183 (LloydNicholson) also proposed a Scripts menu listing a folder.
This commit is contained in:
dotCooCoo
2026-11-10 17:46:36 -08:00
parent e60da871bc
commit 52efba54aa
55 changed files with 1468 additions and 22 deletions
+3 -3
View File
@@ -689,9 +689,9 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
## G6 Automation and scripting
- **Missing:** the document object model for scripts, a script console, the Scripts folder and script
directives (#1183 is open). File › Scripts › Other Script… and `script.run` run JavaScript files over the
command registry. Actions, Batch, Variables (text, visibility, image and graph), data set CSV import and
- **Missing:** the document object model for scripts, a script console and script directives (#1183 is
open). File › Scripts › Other Script… and `script.run` run JavaScript files over the command registry, and
File › Scripts lists the scripts of the Scripts folder. Actions, Batch, Variables (text, visibility, image and graph), data set CSV import and
export, and full agent control over MCP are done.
- **Estimate:** 4–8 h.
- **Done (2026-10-16):** the MCP server hears the client during a long call: `notifications/cancelled` stops a queued or running export (PDF pages, flattening, baking, drawing, artboards) without writing anything or changing the document, `ping` and the list methods answer at once, any other request that would wait behind a call running for two seconds or more is refused as busy (`-32003`, naming the call), and `_meta.progressToken` gets page progress (#2165, #2171, #2172). Reading the document during an export is not served (refused as busy); estimate unchanged.
+48
View File
@@ -1604,6 +1604,54 @@ In the app the reply is `{running: true, name}`, and the report appears later as
vectorcraft-cli run --cmd script.run --params '{"path": "Tidy Layers.js", "args": {"margin": 12}}'
```
File › Scripts lists the scripts of the `Scripts` folder next to the preferences: `~/Library/Application
Support/VectorCraft/Scripts` on macOS, `%APPDATA%\VectorCraft\Scripts` on Windows, and
`$XDG_CONFIG_HOME/vectorcraft/Scripts` or `~/.config/vectorcraft/Scripts` on Linux and BSD. VectorCraft does not make
the folder: create it, and put `.js` or `.jsx` files in it. Each file is a menu item named after the file without its
extension, and each subfolder is a submenu that holds the scripts in it. The help page
https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/install-and-run-scripts.html and
the page https://ai-scripting.docsforadobe.dev/introduction/executingScripts/ describe a Scripts folder listed this
way. The listed scripts come first in the menu, above Check Script… and Other Script…. Choosing one runs the file as
`script.run` runs a file, without the warning that Other Script… shows.
The rest of this section is VectorCraft's own rules:
- The folder is read when the app starts, each time its window becomes the active one, and, where the menus are in
the window (Windows and Linux), each time the File menu opens. A script added while VectorCraft runs is listed
after the next of these. A read takes names only, never a script's text, and runs off the UI thread, one read at a
time.
- Each level is sorted by label without regard to case, with scripts and subfolders mixed. A script whose label
another row of its folder has (`Tidy.js` beside `Tidy.jsx`, or beside a subfolder `Tidy`) shows its whole file name.
- A symbolic link or a Windows junction is never followed: a linked file or subfolder is left out, and a `Scripts`
folder that is itself a link is not read. Names that start with a dot, files and folders Windows marks hidden or
system, names that are not Unicode, names longer than 255 bytes and subfolders without a script are left out too,
and a listed script that is marked hidden or system, or lies in a folder marked so, by the time it is chosen does
not run.
- One read looks at 2,048 folder entries at most, lists 512 scripts and reads 128 subfolders, 4 levels deep, for at
most 250 ms. A label longer than 128 characters is cut, and control and bidirectional formatting characters in a
name are shown as `\u{…}` escapes. When a read stops at a limit or cannot read a subfolder, the menu keeps what it
found and shows `Some scripts were not listed`. The menu also shows that note, and leaves the rows out, when a
read finds new names after the menus have shown 16,384 different script and folder names since VectorCraft started.
When the folder is there and cannot be read, the menu shows
`The Scripts folder cannot be read`.
- A listed file is checked again when it is chosen. A file that is gone, is no longer a `.js` or `.jsx` file under
the folder, or is or lies behind a link ends with `the script is no longer in the Scripts folder`, and nothing runs.
- The web build has no Scripts folder, and neither has a run with `VECTORCRAFT_NO_PREFS` set.
`script.listInstalled {}` returns the same listing: `{folder, scripts: [{path, label, folders}], truncated,
unreadable}`, with the scripts in menu order and `folders` the labels of the subfolders a script is in. `folder` is
`null` without a Scripts folder. `ui.runInstalledScript {path}` runs one of them by the `path` the listing gave, as
its menu item does. Under `--automation-read-root`, both read the folder only when it lies inside a read root, and
`ui.menu.list` leaves out the listed scripts outside the read roots.
```json
{"name":"run_command","arguments":{"command":"script.listInstalled","params":{}}}
```
```sh
vectorcraft-cli run --cmd script.listInstalled --params '{}'
```
## Transparency and opacity masks
Transparency and opacity-mask commands take `ids` (or `id`), so they need no selection. Opacity is a percentage
+1
View File
@@ -722,6 +722,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- Synthetic input validates complete gestures before queue mutation: at most 256 drag steps, 16 clicks and 1,024 pending events; up to 64 control requests per frame, with later requests retained for the next frame (#1709).
- The control server writes each reply through a 64 KiB buffer. On Windows 11 it sends the 17 MB `document.inspect` reply of a document with 50,000 objects on one layer to a client over loopback in 0.09 s instead of 34 s.
- Scripts: File › Scripts › Other Script… and `script.run` run a JavaScript file against the open documents as one transaction with one undo step for each changed document. A failed or stopped run puts every document back. `crates/engine/src/tests/script_run.rs`.
- Scripts folder: File › Scripts lists the `.js` and `.jsx` files of the `Scripts` folder next to the preferences, each named after its file without the extension, with each subfolder as a submenu, above Check Script… and Other Script… (https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/install-and-run-scripts.html). VectorCraft's own rules: the folder is read again when the window becomes active and when the File menu opens, links are not followed, and one read stops at 2,048 entries, 512 scripts, 128 subfolders, 4 levels or 250 ms. `script.listInstalled` returns the listing. `crates/engine/src/tests/script_folder.rs`, `crates/ui-egui/src/tests/scripts_menu.rs`.
- Parameter keys: the engine refuses a key that a command's params description doesn't name before the command runs, in every build and for every caller, including the app's own calls, the commands a command runs and the steps of `command.batch` and `action.batch`. An action recorded by an older version still plays from the Actions panel and the Batch dialog (`Session::replay`). `crates/engine/tests/it/param_keys.rs`.
- MCP server with 25 tools (drawing, text, effects, Pathfinder, transforms, graphs, text wrap, export, screenshots, any command), attached to the running app or headless. Tool descriptions and replies agree with the engine: format lists come from its format table, `save_file` says it keeps the document's own format, `inspect_document` reports the paint type's characters show, and selection exports report the encoder's warnings. `--automation-read-root` / `--automation-write-root` (on `vectorcraft-cli mcp` and on `vectorcraft --control`) confine the files commands read and write to chosen folders, links followed, with the flags PhotoCraft takes (#832); each flag may be given more than once, a path inside any of its folders being allowed (#3546, `file_access::tests::several_roots_of_a_kind_each_grant_their_access`, `cli::mcp_automation_roots_take_several_folders`). A long export can be cancelled (`notifications/cancelled` stops it at the next page or group and writes nothing), reports page progress to a client that sent a progress token, and does not make other requests wait: engine-free ones answer at once, the rest are refused as busy after two seconds (#2165, #2171, #2172).
- MCP protocol: five prompts (`prompts/list` / `prompts/get`: poster, icon set, recolour, trace-and-style, export set), `completion/complete` for prompt arguments and template variables read from the live catalogues (formats, effect ids, command ids, trace presets, swatch and object ids), four resource templates (`vectorcraft://object/{id}`, `//command/{id}`, `//effect/{id}`, `//swatch/{name}`) so an agent reads one thing instead of the whole document, and `logging/setLevel` with `notifications/message`. `window.panel` ids are case-insensitive (display labels work too), `vectorcraft://object/{id}` reads through `document.node {summary: true}` (the same reply bytes from one lookup instead of summarizing the whole document: a leaf read on a 2,000-object document drops from ~20 ms to ~0.06 ms), large containers slice with `document.node {depth?, childLimit?}` (truncated levels report `childCount`), `document.inspect` and the `inspect_document` tool slice the same way so a depth-0 read is the layer skeleton (~9.7 KB instead of ~2 MB on a 2,000-object document), `document.find` locates nodes by name/kind/text with ancestor paths, and the CLI sweeps the protocol surface over stdio against the compiled binary. `docs/mcp.md` has a Protocol section covering the capability table and what is deliberately absent (subscriptions, progress, cancellation, sampling, elicitation, Streamable HTTP — all of which need the transport to interleave reads).