M14.4: scripting with an After Effects-style JavaScript object model

New crate effectcraft-script (L4): boa runtime with app/Project/CompItem/
Layer/PropertyGroup/Property/TextDocument/MarkerValue/RenderQueue/File
object model over engine commands (undoable, undo groups), AE match-name
table, file/network security gate. Entry points: script.run command,
File > Scripts > Run Script File (.jsx/.js), Window > Script Console,
effectcraft-cli script, MCP run_script. Engine: project.delete/duplicate,
prop.renameGroup/setGroupEnabled/removeGroup/duplicateGroup/moveGroup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-02 22:13:09 -04:00
co-authored by Claude Opus 5.5
parent e911cc5c93
commit 78cd313d3c
36 changed files with 4621 additions and 28 deletions
+28
View File
@@ -54,6 +54,7 @@ fn initialize_and_list_tools() {
for want in [
"list_commands",
"execute_command",
"run_script",
"get_project",
"get_comp",
"get_layer",
@@ -263,3 +264,30 @@ fn bridge_rejects_non_loopback() {
assert!(Backend::bridge("10.0.0.1:9877").is_err());
assert!(Backend::bridge("localhost:9877").is_ok());
}
#[test]
fn run_script_round_trip() {
let mut sess = Session::default();
effectcraft_script::install(&mut sess);
let mut s = McpServer::new(Backend::headless(sess));
let r = call_json(
&mut s,
"run_script",
json!({"code": "var c = app.project.items.addComp('Scripted', 320, 180, 1, 2, 24);\nc.layers.addText('Hi');\nwriteLn('made ' + c.name);\nc.numLayers"}),
);
assert_eq!(r["ok"], json!(true), "{r}");
assert_eq!(r["result"], json!(1));
assert_eq!(r["output"], json!("made Scripted"));
// The edit is visible to the other tools.
let p = call_json(&mut s, "get_project", json!({}));
assert!(p.to_string().contains("Scripted"), "{p}");
// Errors come back with their line.
let r = call_json(&mut s, "run_script", json!({"code": "var a = 1;\nundefinedFn();", "name": "bad.jsx"}));
assert_eq!(r["ok"], json!(false));
assert_eq!(r["error"]["line"], json!(2));
assert_eq!(r["error"]["file"], json!("bad.jsx"));
// Without a scripting engine the command explains itself.
let mut bare = server();
let (c, err) = call(&mut bare, "run_script", json!({"code": "1"}));
assert!(err && c[0]["text"].as_str().unwrap().contains("not available"), "{c:?}");
}