Repository navigation
File › Scripts: run JavaScript scripts over the command registry (G6) - #1183
Open
LloydNicholson wants to merge 34 commits into
Open
LloydNicholson wants to merge 34 commits into
LloydNicholson wants to merge 34 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…atch uses them Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…one undo step, full roll back Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ort, reports, failures, language) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…easing) in the script corpus tinycolor needs String.prototype.substr, one of the legacy web features (Annex B) every browser has: Boa's annex-b feature is now on, covered by lang_legacy_web.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Undo (and Type, inline graphics) commit the interaction in progress, which dropped the batch's own and its snapshot with it; and the undo history wasn't part of the roll back. Batches keep their interaction through such steps and restore each document's history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rom a failed script Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…torytold#1161) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A batch (or script) started while the Type tool was typing joined that typing's interaction: undoing it took the typing too, and a failed batch threw the typed text away. Like Undo, a batch now keeps what is in progress first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ues or drop async errors - Scripts nested more than 256 levels of brackets, or with expressions of more than ~2,500 chained operators, are refused with a position before Boa parses them (its parser and compiler recurse per level and a stack overflow aborts the app); eval, new Function and JSON.parse check their text the same way. - Native builds run each script on a thread with a 256 MiB stack (in the caller's automation-root scope); the web build's stack is 32 MiB instead of wasm's 1 MiB. - Values passed to commands, logged or returned hold at most 1,000,000 entries in all: a value reusing the same objects no longer expands exponentially. - A promise rejection nothing handles (a throw in an async function) fails the run and rolls it back; an async main's value is the script's value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n lately The .js files in VectorCraft Scripts (in the documents folder; subfolders as submenus) are listed by name and followed without a restart, then the last ten scripts run from elsewhere, newest first, then Other Script…, Open Scripts Folder and Clear Recent Scripts. A recent script that's gone leaves the list with a message. The web keeps Other Script… only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # ROADMAP.md
…akes the last colour set A loop, recursion or instruction limit has no place of its own: its error used to borrow an earlier call's line from the backtrace. The guide now says paint.setFill/setStroke also set the defaults new art gets, with an example that colours text explicitly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g-1161 # Conflicts: # ROADMAP.md
…g-1161 # Conflicts: # ROADMAP.md
…g-1161 # Conflicts: # ROADMAP.md # crates/ui-egui/src/i18n/cs.tsv # crates/ui-egui/src/i18n/pt-br.tsv # docs/gaps.md # docs/target-app-parity.md
Czech now translates status messages (upstream); the three from File › Scripts get their rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hungarian became a complete language on main; the scripting strings need its translations for the i18n completeness tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Big G6 step: Boa over the command registry, CLI A few points aligned with how this repo usually lands features:
I have not run the full suite on this branch; happy to re-check once the confinement story is explicit in |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1161. Part of gap G6.
What
File › Scripts › Other Script… (Cmd/Ctrl+F12, desktop and web) and
vectorcraft-cli script FILE.js [DOCUMENT] [--out FILE]... [--arg KEY=VALUE]...run a JavaScript file over the command registry. Scripts get a globalvc(run,document,commands,log,args) andalert. Guide:docs/scripting.md.The Scripts menu lists scripts to run again (desktop):
.jsfiles in VectorCraft Scripts in the documents folder, with subfolders as submenus. Open Scripts Folder creates and shows it, and the menu follows the folder without a restart;The web keeps Other Script… only, because the browser gives no file paths.
Undo and failures. A run is one undo step per document it changes. An uncaught error, a rejected promise or a limit rolls everything back: every document (including ones the script opened, closed or undid steps in), paint defaults, the clipboard and the Untitled-N count.
Engine.
command.batchis now a loop over publicSession::{begin_batch, batch_step, finish_batch, roll_back_batch}. Scripts use the same pieces, and its error texts and journaling are unchanged. Two fixes come with it and apply tocommand.batchtoo:edit.undostep now brings that step back when it fails.New L6 crate
vectorcraft-script. It embeds Boa 0.22 (MIT OR Unlicense), with itsannex-blegacy web features on and Temporal and Intl off. Scripts reach nothing but commands;--automation-read-rootand--automation-write-rootconfine them on the CLI.Limits (none can be caught by the script):
eval,new FunctionandJSON.parse).Stack. Boa's parser needs about 28 KB of stack per nesting level, so wasm's default 1 MiB stack overflowed at about 36 levels. Native builds now run each script on a thread with a 256 MiB stack, and the web build's stack is 32 MiB (
.cargo/config.toml).Not included: Illustrator's scripting object model (
.jsxscripts written for Illustrator don't run) and recording scripts into Actions.Testing
crates/script/tests/api.rscovers:evalandJSON.parse, values that share objects, and anasyncthrow.crates/script/tests/corpus), each with a checked outcome:script_fuzz.rs:evalandJSON.parse, never panics or crashes, and a failed run changes nothing;edit.undoroll-back gap.stack.rs: deep data built at run time uses the script's own stack.file.js:LINE:COLplus its log and leaves the page untouched. Two scripts run from Downloads appear under File › Scripts, newest first.cargo xtask ciis green (fmt, clippy, tests, assets, brands, layers, wasm)..wasmfromcargo build --release --target wasm32-unknown-unknown -p vectorcraft-web, measured withouttrunkor wasm-opt. The 32 MiB stack is confirmed from the module's__stack_pointer; deep scripts weren't run in a browser.Known limits (in
docs/scripting.md)🤖 Generated with Claude Code