DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge PR #604
Brandon Thomas0e63dcad118f
diff --cc apps/designcraft-cli/src/main.rsindex dd62cd91d,80ee7915f..589c01a3a--- a/apps/designcraft-cli/src/main.rs+++ b/apps/designcraft-cli/src/main.rs@@@ -36,39 -38,8 +38,39 @@@ use designcraft_engine::Sessionuse serde_json::{Value, json};/// The usage block. Shared by `--help` (stdout, success) and an unknown command (stderr, failure).- const USAGE: &str = "usage: designcraft-cli run [--in FILE | --sample] [--cmd ID[=JSON]]... [--page N] [--scale S] [--pdf-options JSON] [--export OUT] [--all-pages DIR]\n (--page, --scale and --pdf-options apply to the exports that follow them)\n designcraft-cli commands [FILTER]\n designcraft-cli describe COMMAND\n designcraft-cli script [FILE|-] [--in FILE | --sample] [--connect PORT] [--save OUT] [--export OUT] [--keep-going]\n designcraft-cli app [--port PORT] COMMAND [JSON] | --method METHOD [JSON]\n designcraft-cli mcp [--connect PORT] [--sample]\n designcraft-cli perf [--pages N] [--runs N] [--strict]\n designcraft-cli bench FILE [--runs N]\n designcraft-cli links\n designcraft-cli --version";+ const USAGE: &str = "usage: designcraft-cli run [--in FILE | --sample] [--cmd ID[=JSON]]... [--page N] [--scale S] [--pdf-options JSON] [--export OUT] [--all-pages DIR]\n (--page, --scale and --pdf-options apply to the exports that follow them)\n designcraft-cli commands [FILTER]\n designcraft-cli describe COMMAND\n designcraft-cli script [FILE|-] [--in FILE | --sample] [--connect PORT] [--save OUT] [--export OUT] [--keep-going]\n designcraft-cli app [--port PORT] COMMAND [JSON] | --method METHOD [JSON]\n designcraft-cli mcp [--connect PORT] [--sample] [--automation-read-root DIR] [--automation-write-root DIR]\n the two roots confine every file the agent's commands read (open, placed images, data sources, libraries) and\n write (save, export, package) to those folders, links followed. A root left out grants none of its access.\n They run the in-process server, so they conflict with --connect (a running app is not confined by them).\n designcraft-cli perf [--pages N] [--runs N] [--strict]\n designcraft-cli bench FILE [--runs N]\n designcraft-cli links\n designcraft-cli --version";+/// `script --help`: the script syntax, otherwise only in `describe script.run` and docs/agents.md.+const SCRIPT_HELP: &str = r#"usage: designcraft-cli script [FILE|-] [--in FILE | --sample] [--connect PORT] [--save OUT] [--export OUT] [--keep-going]++Runs a command script from FILE (stdin when FILE is `-` or missing), headless or, with+--connect PORT, in the running app (designcraft --control PORT).++Script text, one step per line:+ command.id {"param": 1} also `command.id={json}`, or `command.id` alone+ {"command": "command.id", "params": {...}} JSON lines, or a JSON array of them+ # comment, // comment skipped, like blank lines+ UTF-8 with or without a byte order mark; LF or CRLF line endings.++References to earlier results (in string parameters):+ "$N.path" the value at `path` in the result of step N. N is the 0-based step index:+ comments and blank lines are not steps. `$last` is the previous step.+ Paths go through result fields and array indices: "$1.story", "$3.ids.0".+ "${N.path}" inside a longer string, replaced by the value's text: "Frame ${0.id}".++Text parameters: "\n" starts a new paragraph, "\u2028" is a forced line break, "\t" a tab.+Most commands ignore parameters they do not know instead of rejecting them: check names+with `designcraft-cli describe COMMAND`.++Options:+ --in FILE / --sample open a document (.designcraft or .idml) or the sample first+ --save OUT save as .designcraft after the script succeeds+ --export OUT export after the script succeeds (.pdf, .idml, .epub, .png, .jpg); repeatable+ --keep-going run every step, recording failures as {"error": ...} results++Prints {"completed": n, "results": [...]}, plus failedIndex / failedCommand / error and a+non-zero exit when a step fails."#;+/// The links line under the usage block.fn usage_footer() -> String {format!(