Scripts: Check Script reads document member names given in brackets

Check Script now counts print on a document as a file write when the
document is reached with member names as string literals in brackets
(app['activeDocument'].print(o), app["documents"][0].print(o),
app.documents['getByName']('Draft').print(o)), also through a
variable, parentheses, a closed function or catch scope, and included
files. A string key on a collection stays an item lookup by name
(app.documents['Draft']) unless it names one of the collection's
documented members or an Object.prototype member. The report still
shows each chain as written.
This commit is contained in:
dotCooCoo committed 2026-11-30 09:28:31 -08:00
1 parent 374afab73b
commit f4aa208239
6 files changed
+200 -21

No files matched your search

+106 -12
View File
@@ -51,6 +51,7 @@ pub(crate) struct IncludeRef {
#[derive(Clone, Debug, Default)]
pub(crate) struct Known {
pub bound: HashMap<String, String>,
pub bound_dom: HashMap<String, String>,
pub files: HashSet<String>,
pub folders: HashSet<String>,
/// A file gives names values the analysis doesn't read ([`Declared::unsure`]): no object counts
@@ -59,10 +60,11 @@ pub(crate) struct Known {
}
impl Known {
/// The names known, a name that may hold a File object counting twice: a Folder that becomes a
/// possible File object ([`Known::add`]) changes it too.
/// The names known, a chain's document-model form counting as one more and a name that may hold
/// a File object counting twice: a Folder that becomes a possible File object ([`Known::add`])
/// changes it too.
pub fn len(&self) -> usize {
self.bound.len() + self.files.len().saturating_mul(2).saturating_sub(self.folders.len()) + usize::from(self.unsure)
self.bound.len() + self.bound_dom.len() + self.files.len().saturating_mul(2).saturating_sub(self.folders.len()) + usize::from(self.unsure)
}
/// No variable holds a member chain or a File or Folder object. [`Known::unsure`] may be set.
@@ -76,8 +78,13 @@ impl Known {
pub fn add(&mut self, other: Known, entries: usize) {
self.unsure |= other.unsure;
for (name, chain) in other.bound {
if self.bound.len() < entries || self.bound.contains_key(&name) {
self.bound.entry(name).or_insert(chain);
if self.bound.len() < entries
&& let std::collections::hash_map::Entry::Vacant(entry) = self.bound.entry(name.clone())
{
if let Some(dom) = other.bound_dom.get(&name) {
self.bound_dom.insert(name, dom.clone());
}
entry.insert(chain);
}
}
for name in other.files {
@@ -339,7 +346,7 @@ impl ObjectValue {
/// What a value the check follows holds: a member chain, or a File or Folder object (`folder` when it
/// is a Folder object whatever the path names: [`Operand::file_step`]).
enum Held {
Chain(String),
Chain { path: String, dom: Option<String> },
File { folder: bool },
}
@@ -473,12 +480,22 @@ struct Chain {
assign: Option<String>,
/// The grouped value ([`Group::id`]) whose operand starts with the chain.
group: Option<usize>,
/// The chain as the document model reads it, for telling which method is called on what: as
/// `path`, without the echo limit, but with a string literal in brackets that names a member
/// written as that member (`app['activeDocument']` is `app.activeDocument`). `None` once it
/// passes [`DOM_KEY_MAX`] characters.
dom: Option<String>,
}
/// The most characters [`Chain::dom`] holds.
const DOM_KEY_MAX: usize = 256;
impl Chain {
fn new(root: String, bare: bool, line: usize) -> Self {
let (chars, cut) = (root.chars().count(), root.ends_with('…'));
let dom = (!cut && chars <= DOM_KEY_MAX).then(|| root.clone());
Chain {
dom,
path: root,
chars,
cut,
@@ -510,10 +527,23 @@ impl Chain {
}
}
/// Adds `s` to [`Chain::dom`], which ends when it would pass [`DOM_KEY_MAX`] characters.
fn append_dom(&mut self, s: &str) {
if let Some(dom) = &mut self.dom {
if dom.chars().count() + s.chars().count() > DOM_KEY_MAX {
self.dom = None;
} else {
dom.push_str(s);
}
}
}
fn member(&mut self, name: &str, cap: usize) {
self.segments += 1;
self.append(".", cap);
self.append(name, cap);
self.append_dom(".");
self.append_dom(name);
self.last_change = name.starts_with("set") || name.starts_with("remove");
}
@@ -522,6 +552,28 @@ impl Chain {
self.change_call |= call && self.last_change;
self.last_change = false;
self.append(if call { "()" } else { "[]" }, cap);
self.append_dom(if call { "()" } else { "[]" });
}
/// The index `[]` just closed held only the string literal `name`, read whole. When `name` is
/// an identifier and the index is not one of a collection (`documents['Draft']` looks a
/// document up by its name), [`Chain::dom`] reads `.name` there, as a member reached with a
/// dot does. The shown `path` keeps `[]`.
fn named_index(&mut self, name: &str) {
let mut chars = name.chars();
let identifier = chars.next().is_some_and(|c| c.is_ascii_alphabetic() || c == '_' || c == '$')
&& chars.all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '$');
let Some(dom) = &mut self.dom else { return };
let Some(before) = dom.strip_suffix("[]") else { return };
let collection = before.rsplit('.').next().unwrap_or(before);
let lookup = !catalog::OBJECT_PROTOTYPE_MEMBERS.contains(&name)
&& catalog::DOM_COLLECTIONS.iter().any(|(c, members)| collection == *c && !members.contains(&name));
if !identifier || lookup {
return;
}
dom.truncate(before.len());
self.append_dom(".");
self.append_dom(name);
}
}
@@ -554,6 +606,8 @@ struct Catch {
struct Saved {
/// The member chain assigned to it.
chain: Option<String>,
/// The document-model form of the saved chain when it differs from the shown path.
dom: Option<String>,
/// It held a File or Folder object.
file: bool,
/// It held a Folder object.
@@ -633,6 +687,9 @@ struct Analyzer<'s, 'a, 'l> {
shadowed: [bool; 4],
/// Variables assigned from a member chain, and the chain.
bound: HashMap<String, String>,
/// For a variable in `bound`, the chain as the document model reads it ([`Chain::dom`]) when it
/// differs from the chain shown.
bound_dom: HashMap<String, String>,
/// Variables holding a File or Folder object.
files: HashSet<String>,
/// The variables in `files` holding a Folder object whatever the path names ([`Held::File`]).
@@ -733,6 +790,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
suspend: false,
shadowed: [false; 4],
bound: known.bound.clone(),
bound_dom: known.bound_dom.clone(),
files: known.files.clone(),
folders: known.folders.clone(),
// A variable of the same name as a property a member assignment writes may be that
@@ -900,7 +958,11 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
} else {
return false;
};
self.active = Some(Chain::new(root, bare, t.line));
let mut c = Chain::new(root, bare, t.line);
if let Some(dom) = self.bound_dom.get(t.text).filter(|_| self.bound.contains_key(t.text)) {
c.dom = Some(dom.clone());
}
self.active = Some(c);
true
}
@@ -938,23 +1000,28 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
&& g.id == id
&& matches!(g.operand, Operand::Chain)
{
g.operand = Operand::Done(Held::Chain(c.path.clone()));
g.operand = Operand::Done(Held::Chain { path: c.path.clone(), dom: c.dom.clone() });
}
if let Some(name) = c.assign {
let ends = ending.is_none_or(ends_value);
if ends && !key {
self.bind(name, c.path);
self.bind(name, c.path, c.dom);
} else {
self.unbind(&name);
}
}
}
fn bind(&mut self, name: String, path: String) {
/// `name` holds the chain `path`, which the document model reads as `dom` when that differs.
fn bind(&mut self, name: String, path: String, dom: Option<String>) {
self.files.remove(&name);
self.folders.remove(&name);
self.writers.remove(&name);
self.bound_dom.remove(&name);
if self.bound.contains_key(&name) || self.acc.room(self.bound.len()) {
if let Some(dom) = dom.filter(|d| *d != path) {
self.bound_dom.insert(name.clone(), dom);
}
self.bound.insert(name, path);
}
}
@@ -962,6 +1029,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
/// `name` holds a File or Folder object (`folder` for a Folder object whatever the path names).
fn hold_file(&mut self, name: String, folder: bool) {
self.bound.remove(&name);
self.bound_dom.remove(&name);
self.folders.remove(&name);
self.writers.remove(&name);
if !folder && !self.maybe_files.contains(&name) {
@@ -1081,6 +1149,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
let shadowed = catalog::DOM_ROOTS.iter().position(|r| *r == name).and_then(|i| self.shadowed.get(i).copied());
Saved {
chain: self.bound.get(name).cloned(),
dom: self.bound_dom.get(name).cloned(),
file: self.files.contains(name),
folder: self.folders.contains(name),
maybe_file: self.maybe_files.contains(name),
@@ -1094,8 +1163,12 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
/// `name` holds `saved` again.
fn restore(&mut self, name: String, saved: Saved) {
self.acc.steps = self.acc.steps.saturating_add(1);
self.bound_dom.remove(&name);
match saved.chain {
Some(chain) => {
if let Some(dom) = saved.dom {
self.bound_dom.insert(name.clone(), dom);
}
self.bound.insert(name.clone(), chain);
}
None => {
@@ -1177,6 +1250,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
fn empty(&mut self, name: &str) {
self.make_own(name);
self.bound.remove(name);
self.bound_dom.remove(name);
self.files.remove(name);
self.folders.remove(name);
self.writers.remove(name);
@@ -1262,6 +1336,19 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
}
if self.suspended.last().is_some_and(|c| c.wait == self.depth()) {
self.active = self.suspended.pop();
// `app['activeDocument']` reads as `app.activeDocument` in the chain's
// `dom`. A key longer than `DOM_KEY_MAX` characters is not read whole.
if t.text == "]"
&& is(self.h[1], "[")
&& let Some(s) = self.h[0].filter(|s| s.kind == T::Str)
{
let name = unquote(s.text, DOM_KEY_MAX + 1);
if name.chars().count() <= DOM_KEY_MAX
&& let Some(c) = self.active.as_mut()
{
c.named_index(&name);
}
}
}
self.close_scopes();
let grouped = self.close_parens(t);
@@ -1367,6 +1454,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
let Some(c) = self.catches.get_mut(i) else { return };
let empty = Saved {
chain: None,
dom: None,
file: false,
folder: false,
maybe_file: false,
@@ -1711,7 +1799,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
fn settle(&mut self, g: Group, ends: bool) {
let complete = (g.closed || g.bare) && ends;
match g.operand {
Operand::Done(Held::Chain(path)) if complete => self.bind(g.name, path),
Operand::Done(Held::Chain { path, dom }) if complete => self.bind(g.name, path, dom),
Operand::Done(Held::File { folder }) | Operand::FileName { new: true, folder } if complete => self.hold_file(g.name, folder),
_ => self.unbind(&g.name),
}
@@ -1799,7 +1887,13 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
}
// A variable that any assignment gave a value that may be a File object leaves as one.
let folders = self.folders.iter().filter(|name| self.folder(name)).cloned().collect();
let known = Known { bound: std::mem::take(&mut self.bound), files: std::mem::take(&mut self.files), folders, unsure: self.unsure };
let known = Known {
bound: std::mem::take(&mut self.bound),
bound_dom: std::mem::take(&mut self.bound_dom),
files: std::mem::take(&mut self.files),
folders,
unsure: self.unsure,
};
(std::mem::take(&mut self.includes), module, known)
}
}
+11 -7
View File
@@ -308,11 +308,15 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
}
/// Whether this `(` calls a document's `print`: the document-model member chain the `(` has just
/// set aside until its `)` is one of [`catalog::DOM_DOCUMENTS`] followed by `called`, the method
/// as the chain writes it (`.print()`, or `[]()` when brackets name it).
fn document_print(&self, called: &str) -> bool {
/// set aside until its `)` is one of [`catalog::DOM_DOCUMENTS`] followed by `.print()`, read as
/// the document model reads the chain ([`super::Chain::dom`]), so a member name in brackets
/// counts as one after a dot.
fn document_print(&self) -> bool {
let chain = self.suspended.last().filter(|c| c.wait.saturating_add(1) == self.depth());
chain.and_then(|c| c.path.strip_suffix(called)).is_some_and(|receiver| catalog::DOM_DOCUMENTS.contains(&receiver))
chain
.and_then(|c| c.dom.as_deref())
.and_then(|dom| dom.strip_suffix(".print()"))
.is_some_and(|receiver| catalog::DOM_DOCUMENTS.contains(&receiver))
}
/// `(` after a name: a call.
@@ -324,7 +328,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
&& let Some(name) = h1.filter(|s| s.kind == T::Str).map(|s| unquote(s.text, 32))
{
if (catalog::DOM_FILE_WRITES.contains(&name.as_str()) && !Self::defines(self.index_receiver, &name))
|| (name == catalog::DOM_PRINT && self.document_print("[]()"))
|| (name == catalog::DOM_PRINT && self.document_print())
{
self.acc.feature(FeatureId::FileWrite, line);
self.acc.outside(OutsideId::FilesWritten, line, None);
@@ -333,7 +337,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
if name == catalog::OPEN
&& word(h3, "app")
&& !self.shadowed[0]
&& self.suspended.last().is_some_and(|c| c.wait.saturating_add(1) == self.depth() && c.path == "app[]()")
&& self.suspended.last().is_some_and(|c| c.wait.saturating_add(1) == self.depth() && c.dom.as_deref() == Some("app.open()"))
{
self.acc.feature(FeatureId::FileRead, line);
return;
@@ -363,7 +367,7 @@ impl<'s, 'a, 'l> Analyzer<'s, 'a, 'l> {
self.acc.feature(FeatureId::FileRead, line);
} else if (file && catalog::FILE_WRITES.contains(&n))
|| (catalog::DOM_FILE_WRITES.contains(&n) && !Self::defines(self.writer_bits(h2, h3, Some(t.start)), n))
|| (n == catalog::DOM_PRINT && self.document_print(".print()"))
|| (n == catalog::DOM_PRINT && self.document_print())
{
self.acc.feature(FeatureId::FileWrite, line);
self.acc.outside(OutsideId::FilesWritten, line, None);
+28
View File
@@ -105,6 +105,34 @@ pub(crate) const DOM_DOCUMENTS: &[&str] = &[
"app.open()",
];
// Every collection inherits these Object.prototype members (ECMA-262 3rd edition, section 15.2.4).
pub(crate) const OBJECT_PROTOTYPE_MEMBERS: &[&str] =
&["constructor", "toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable"];
// Each collection lists the members a string key names instead of looking up an item.
// https://ai-scripting.docsforadobe.dev/jsobjref/Documents/ and the corresponding collection
// pages list these properties and methods.
pub(crate) const DOM_COLLECTIONS: &[(&str, &[&str])] = &[
("artboards", &["add", "getActiveArtboardIndex", "getByName", "insert", "length", "parent", "remove", "setActiveArtboardIndex", "typename"]),
("characterStyles", &["add", "getByName", "index", "length", "parent", "removeAll", "typename"]),
("documents", &["add", "addDocument", "addDocumentNoUI", "getByName", "index", "length", "parent", "typename"]),
("groupItems", &["add", "createFromFile", "getByName", "index", "length", "parent", "removeAll", "typename"]),
("layers", &["add", "getByName", "index", "length", "parent", "removeAll", "typename"]),
("pageItems", &["getByName", "index", "length", "parent", "removeAll", "typename"]),
("paragraphStyles", &["add", "getByName", "index", "length", "parent", "removeAll", "typename"]),
(
"pathItems",
&["add", "ellipse", "getByName", "index", "length", "parent", "polygon", "rectangle", "removeAll", "roundedRectangle", "star", "typename"],
),
("pathPoints", &["add", "index", "length", "parent", "removeAll", "typename"]),
("stories", &["index", "length", "parent", "typename"]),
("swatches", &["add", "getByName", "getSelected", "index", "length", "parent", "removeAll", "typename"]),
("symbols", &["add", "getByName", "index", "length", "parent", "removeAll", "typename"]),
("tags", &["add", "getByName", "index", "length", "parent", "removeAll", "typename"]),
("textFrames", &["add", "areaText", "getByName", "index", "length", "parent", "pathText", "pointText", "removeAll", "typename"]),
("views", &["index", "length", "parent", "typename"]),
];
// The save option of `Document.close` that saves the document to its own file:
// https://ai-scripting.docsforadobe.dev/jsobjref/Document/ and
// https://ai-scripting.docsforadobe.dev/jsobjref/scripting-constants/ (SaveOptions).
+52
View File
@@ -674,6 +674,58 @@ fn print_writes_a_file() {
assert_eq!(r.outside.iter().map(|o| (o.id, o.lines.as_slice())).collect::<Vec<_>>(), [("filesWritten", lines)]);
}
/// A document reached with its member names in brackets prints to a file as one reached with dots
/// does, and so does one a collection looks up by its name; a bracketed name that is not a
/// document's member, and a computed one, do not. The report still shows the chains as written.
#[test]
fn print_on_bracketed_document_chains_writes_a_file() {
let r = report(concat!(
"var o = new PrintOptions(); o.jobOptions.file = new File(p);\n",
"app['activeDocument'].print(o);\n",
"app[\"activeDocument\"][\"print\"](o);\n",
"app[\"documents\"][0].print(o);\n",
"app.documents['Draft'].print(o);\n",
"app['preferences'].print(o);\n",
"app[key].print(o);\n",
"app['open'](new File(p));\n",
"var d = app['activeDocument']; d.print(o);\n",
"app.documents['getByName']('Draft').print(o);\n",
"app['documents']['length'].print(o);\n",
"var grouped = (app['activeDocument']); grouped.print(o);\n",
"var scoped = app['activeDocument']; function f(scoped) {} scoped.print(o);\n",
"var caught = app['activeDocument']; try {} catch (caught) {} caught.print(o);\n",
"function later() { future.print(o); } var future = app['activeDocument'];\n",
"app.documents['removeAll'].print(o);\n",
"app['documents']['remove'].print(o);\n",
"app.documents['addDocumentNoUI']('Print').print(o);\n",
"app.documents['index'](0).print(o);\n",
"app.documents['parent'].print(o); app.documents['typename'].print(o);\n",
"app['documents']['toString'].print(o);\n",
));
let lines = &[2, 3, 4, 5, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19][..];
assert_eq!(feature(&r, "file.write").map(|f| f.lines.as_slice()), Some(lines));
assert_eq!(r.outside.iter().map(|o| (o.id, o.lines.as_slice())).collect::<Vec<_>>(), [("filesWritten", lines)]);
assert_eq!(feature(&r, "file.read").map(|f| f.lines.as_slice()), Some(&[8][..]));
assert!(r.members.iter().any(|m| m.name == "app[].print()"));
assert!(r.members.iter().all(|m| m.name != "app.activeDocument.print()"));
}
/// A bracketed document chain keeps its document-model form across scans and included files.
#[test]
fn print_on_bracketed_document_chains_in_included_files_writes_a_file() {
for order in [["doc.jsxinc", "alias.jsxinc"], ["alias.jsxinc", "doc.jsxinc"]] {
let mut m = mem(&[("doc.jsxinc", "var doc = app['activeDocument'];\n"), ("alias.jsxinc", "var alias = doc;\n")]);
let main = format!("#include '{}'\n#include '{}'\ndoc.print(o);\nalias.print(o);\n", order[0], order[1]);
let r = check("main.jsx", main.as_bytes(), Some(&mut m), &Limits::default());
let lines = &[3, 4][..];
assert_eq!(feature(&r, "file.write").map(|f| f.lines.as_slice()), Some(lines), "{order:?}");
assert_eq!(r.outside.iter().map(|o| (o.id, o.lines.as_slice())).collect::<Vec<_>>(), [("filesWritten", lines)], "{order:?}");
let mut members: Vec<&str> = r.members.iter().map(|m| m.name.as_str()).collect();
members.sort_unstable();
assert_eq!(members, ["app[]", "app[].print()"], "{order:?}");
}
}
/// `saveAs` and `exportFile` called on an object literal of the script's own that defines them write
/// nothing, with `.` or in brackets. On a document, on a variable the check does not follow, on one
/// assigned something else since, and for a method the literal does not define, they write the file.
+2 -1
View File
@@ -2750,7 +2750,8 @@ control character, in the first 8 KiB) or `tooLarge` (over 8 MiB). For a script,
have; a document's `saveAs`, `exportFile` or `exportVariables` counts too, and so does `SaveOptions.SAVECHANGES`
wherever the script reads it, since `close` given it saves the document to its file, and `print` called on
`app.activeDocument`, `app.documents[i]`, `documents.add()`, `documents.getByName()` or `app.open()`, or on a
variable that holds one of them), `filesOpened` (files opened in other apps), `network`,
variable that holds one of them, with each member name after a dot or as a string in brackets
(`app['activeDocument']['print'](o)`)), `filesOpened` (files opened in other apps), `network`,
`nativeCode`, `otherApps` (messages to other apps), `environment` (environment variables), `unseenCode` (`eval`,
`new Function` and `$.evalFile`) and `preferences` (the reference app's preferences changed).
- `problems` lists what would stop the script loading as written (strings, comments, regular expressions,
+1 -1
View File
@@ -1120,7 +1120,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: `Document.print` prints the document to a file with `PrintOptions` and the job, color management, color separation, coordinate, flattener, font, page marks, paper and PostScript option classes the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/ and https://ai-scripting.docsforadobe.dev/jsobjref/PrintJobOptions/ describe, over the document's print settings, and `app.printPresetsList` lists the print presets. Printing to a printer from a script and `app.printerList` are not available yet (`docs/mcp.md`). `crates/engine/src/tests/script_print.rs`.
- Scripts: `Document.print` prints the document to a file with `PrintOptions` and the job, color management, color separation, coordinate, flattener, font, page marks, paper and PostScript option classes the help pages https://ai-scripting.docsforadobe.dev/jsobjref/PrintOptions/ and https://ai-scripting.docsforadobe.dev/jsobjref/PrintJobOptions/ describe, over the document's print settings, and `app.printPresetsList` lists the print presets. Printing to a printer from a script and `app.printerList` are not available yet (`docs/mcp.md`). Check Script counts `print` on a document as a file write, with the document's member names after dots or as strings in brackets (`app['activeDocument'].print(o)`, `app.documents['Draft'].print(o)`). `crates/engine/src/tests/script_print.rs`, `crates/scriptcheck/src/tests.rs` (`print_writes_a_file`, `print_on_bracketed_document_chains_writes_a_file`).
- Scripts: `Document.pathItems` lists the paths and makes rectangles, rounded rectangles, ellipses, polygons, stars and empty paths with the defaults the help page https://ai-scripting.docsforadobe.dev/jsobjref/PathItems/ gives; each path's points, closed state, fill rule, area, length, guide state, selected points, fill and stroke colors, stroke options and transforms read and change as https://ai-scripting.docsforadobe.dev/jsobjref/PathItem/, https://ai-scripting.docsforadobe.dev/jsobjref/PathPoints/ and https://ai-scripting.docsforadobe.dev/jsobjref/PathPoint/ describe them, and `RGBColor`, `CMYKColor`, `GrayColor`, `LabColor` and `NoColor` make colors (`docs/mcp.md`). The transforms move gradients with the art: `changeFillGradients` false throws an error, as do `changeFillPatterns` and `changeStrokePattern` given as different values, and `transform` is not there yet (`docs/mcp.md` lists these limits). Gradient stops are not there yet. A `PathPoint` of a path in an Objects on Path group goes stale when an edit of another path in the group moves it. `crates/engine/src/tests/script_dom_paths.rs`.
- Scripts: a document's `default*` members (https://ai-scripting.docsforadobe.dev/jsobjref/Document/) read and set the fill, stroke and stroke options of the next object drawn through `appearance.setNewArt`, leaving the selection and its art as they were, and `scaleFactor` reads 1 (`docs/mcp.md`). `crates/engine/src/tests/script_dom_defaults.rs`.
- Scripts: `app.undo()` and `app.redo()` undo and redo the edits the run made, and each document open before and after the run that it changed gets one undo step. `crates/engine/src/tests/script_dom.rs`.