From 14c9fb796ae7dbf9a4710c1c358a657ed92bdf55 Mon Sep 17 00:00:00 2001 From: Ziyi Zhang <90444077+ziyiunity@users.noreply.github.com> Date: Tue, 8 Sep 2026 15:15:51 -0400 Subject: [PATCH] feat: label CLI invocations with caller and skill Every `unity command` example in a skill that drives the Editor now passes `--caller plugin --skill `, and unity-cli states the rule so it applies to invocations no example covers. CLI-951 added the two flags and CLI-1152 made `--caller plugin` survive normalization rather than folding to `other`. Rebuilt on top of the unity-cli refresh (#36), which replaced that skill's SKILL.md wholesale, and extended to migrate-birp-to-urp and generate-editor-search-query, which landed after this branch was first written and also invoke `unity command`. --- skills/audio-setup-mixers/SKILL.md | 2 +- skills/audio-setup-mixers/references/api.md | 2 +- .../references/open-search-window.md | 2 +- skills/migrate-birp-to-urp/SKILL.md | 2 +- skills/optimize-audio/SKILL.md | 2 +- skills/optimize-audio/resources/audio-import-api.md | 2 +- skills/optimize-web/SKILL.md | 2 +- skills/sprite-editor/SKILL.md | 2 +- skills/unity-cli/SKILL.md | 6 +++++- skills/urp-postprocessing/SKILL.md | 2 +- 10 files changed, 14 insertions(+), 10 deletions(-) diff --git a/skills/audio-setup-mixers/SKILL.md b/skills/audio-setup-mixers/SKILL.md index 30c07f2..5bcc7fc 100644 --- a/skills/audio-setup-mixers/SKILL.md +++ b/skills/audio-setup-mixers/SKILL.md @@ -40,7 +40,7 @@ Once `eval` is available, that is how each C# step below runs. Run C# through the connected Editor with the `eval` command. Discover its parameter shape from `unity command --format json` rather than assuming one — the inline form is -`unity command eval --code ''`, and some Pipeline versions also register +`unity command eval --caller plugin --skill audio-setup-mixers --code ''`, and some Pipeline versions also register `eval_file` for running a snippet from a file. **Check the catalog before reaching for `eval_file`; it is frequently absent.** `unity command` defaults to a 30 second timeout. diff --git a/skills/audio-setup-mixers/references/api.md b/skills/audio-setup-mixers/references/api.md index 5ae7f9c..df03989 100644 --- a/skills/audio-setup-mixers/references/api.md +++ b/skills/audio-setup-mixers/references/api.md @@ -27,7 +27,7 @@ to add any missing groups (two clicks in a window they already have open), and t routing itself. The tedious part — walking dozens of Audio Sources and classifying them — is the part that was worth automating anyway. -All snippets below are written for `unity command eval --code ''`: fully qualified, no +All snippets below are written for `unity command eval --caller plugin --skill audio-setup-mixers --code ''`: fully qualified, no `using` directives, returning their result rather than logging it. ## Inventory the project's mixers and their groups diff --git a/skills/generate-editor-search-query/references/open-search-window.md b/skills/generate-editor-search-query/references/open-search-window.md index ba82d60..5733853 100644 --- a/skills/generate-editor-search-query/references/open-search-window.md +++ b/skills/generate-editor-search-query/references/open-search-window.md @@ -8,7 +8,7 @@ This is a read-only Editor UI action. It must not create, modify, delete, import Replace `QUERY_HERE` with the generated Unity Search query. If the query contains double quotes, double them inside the verbatim C# string. -Run it through the Editor with `unity command eval --code ''`. Fully qualified, with no +Run it through the Editor with `unity command eval --caller plugin --skill generate-editor-search-query --code ''`. Fully qualified, with no `using` directives, because `eval` compiles a statement block rather than a file. ```csharp diff --git a/skills/migrate-birp-to-urp/SKILL.md b/skills/migrate-birp-to-urp/SKILL.md index 9b643ef..8d9ef3e 100644 --- a/skills/migrate-birp-to-urp/SKILL.md +++ b/skills/migrate-birp-to-urp/SKILL.md @@ -111,7 +111,7 @@ Two things it can't know for you: materials, and rebaking lighting all need a live Editor. An unreachable Editor is a stop, not a cue to hand-edit `ProjectSettings/GraphicsSettings.asset`. -Run C# with `unity command eval --code ''`. `unity command` defaults to a 30 second +Run C# with `unity command eval --caller plugin --skill migrate-birp-to-urp --code ''`. `unity command` defaults to a 30 second timeout, which matters here: installing URP triggers a package refresh and domain reload that will outlast it. Treat that as a phase boundary rather than raising the timeout. diff --git a/skills/optimize-audio/SKILL.md b/skills/optimize-audio/SKILL.md index 8c6a5a0..16c14c7 100644 --- a/skills/optimize-audio/SKILL.md +++ b/skills/optimize-audio/SKILL.md @@ -26,7 +26,7 @@ Two things it can't know for you: through `SaveAndReimport()` in a live Editor, so an unreachable Editor is a stop, not a cue to edit metadata directly. -Run C# with `unity command eval --code ''`. Discover the parameter shape from +Run C# with `unity command eval --caller plugin --skill optimize-audio --code ''`. Discover the parameter shape from `unity command --format json` rather than assuming one. `unity command` defaults to a 30 second timeout. diff --git a/skills/optimize-audio/resources/audio-import-api.md b/skills/optimize-audio/resources/audio-import-api.md index 08b0fae..e6fc5bb 100644 --- a/skills/optimize-audio/resources/audio-import-api.md +++ b/skills/optimize-audio/resources/audio-import-api.md @@ -1,6 +1,6 @@ # Audio Import API Recipes -C# code recipes for `unity command eval --code ''`. All examples target the Unity 6 +C# code recipes for `unity command eval --caller plugin --skill optimize-audio --code ''`. All examples target the Unity 6 AudioImporter API. `eval` compiles a statement block, so there are no `using` directives and every type is written diff --git a/skills/optimize-web/SKILL.md b/skills/optimize-web/SKILL.md index f727a03..c88f2cf 100644 --- a/skills/optimize-web/SKILL.md +++ b/skills/optimize-web/SKILL.md @@ -24,7 +24,7 @@ Two things it can't know for you: are per-build-target, and a hand-edited value silently disagrees with what the build actually uses. An unreachable Editor is a stop for the write steps. -Run C# with `unity command eval --code ''`. `unity command` defaults to a 30 second +Run C# with `unity command eval --caller plugin --skill optimize-web --code ''`. `unity command` defaults to a 30 second timeout. ### Passing C# to `eval` diff --git a/skills/sprite-editor/SKILL.md b/skills/sprite-editor/SKILL.md index 1e5980d..ceb4398 100644 --- a/skills/sprite-editor/SKILL.md +++ b/skills/sprite-editor/SKILL.md @@ -24,7 +24,7 @@ Two things it can't know for you: Run C# through the connected Editor with the `eval` command. Discover its parameter shape from `unity command --format json` rather than assuming one — the inline form is -`unity command eval --code ''`, and some Pipeline versions also register +`unity command eval --caller plugin --skill sprite-editor --code ''`, and some Pipeline versions also register `eval_file` for running a snippet from a file. **Check the catalog before reaching for `eval_file`; it is frequently absent.** `unity command` defaults to a 30 second timeout. diff --git a/skills/unity-cli/SKILL.md b/skills/unity-cli/SKILL.md index 95b7ddc..505132c 100644 --- a/skills/unity-cli/SKILL.md +++ b/skills/unity-cli/SKILL.md @@ -16,9 +16,13 @@ unity status # confirm a connected Editor (look for state "re unity command # list the commands the Editor exposes unity command editor_play # run one — e.g. enter Play mode # Run arbitrary C# — e.g. add a GameObject named "Joe" — when the Editor exposes eval: -unity command eval 'new UnityEngine.GameObject("Joe");' +unity command eval --caller plugin --skill unity-cli 'new UnityEngine.GameObject("Joe");' ``` +**Pass `--caller plugin --skill ` on every `unity command` invocation.** `--skill` is the +skill whose instructions produced the call, so a task skill that sends you here passes its own name +rather than `unity-cli`. The flags are inert to the command itself; they only label the invocation. + ### More than one Editor open? Pass `--project-path` Every Editor-driving command takes `--project-path `. **Pass it whenever more than one Editor may be running** — without it the CLI targets the Editor whose project contains the current directory, so the target follows the shell's cwd: diff --git a/skills/urp-postprocessing/SKILL.md b/skills/urp-postprocessing/SKILL.md index 3ca6cf7..12523e0 100644 --- a/skills/urp-postprocessing/SKILL.md +++ b/skills/urp-postprocessing/SKILL.md @@ -23,7 +23,7 @@ missing, say so and stop. Run C# through the connected Editor with the `eval` command. Discover its parameter shape from `unity command --format json` rather than assuming one — the inline form is -`unity command eval --code ''`, and some Pipeline versions also register +`unity command eval --caller plugin --skill urp-postprocessing --code ''`, and some Pipeline versions also register `eval_file` for running a snippet from a file. **Check the catalog before reaching for `eval_file`; it is frequently absent.** `unity command` defaults to a 30 second timeout.