-
Notifications
You must be signed in to change notification settings - Fork 0
Releases: niqibiao/unity-cli-plugin
v1.5.0
c134037 Added
- Self-evolving C# snippet library:
cs snippets list / show / search / use / add / update / deprecate / prune / stats. Snippets are project-local markdown
files at.unity-cli/snippets~/<id>.mdcontaining astatic Run(...)method;
the CLI wraps each submission in a uniquestatic class __Snip_<hash>for
symbol isolation across REPL sessions. Validation gate runs each new snippet's
examplethrough the REPL (read-only auto-validated; mutates requires
--no-validateand is recorded as unverified). Usage tracking auto-deprecates
snippets after 5 consecutive failures spanning ≥ 7 days. Cold detection is
informational only;prune --coldis opt-in. unity-cli-snippetsskill: operator's manual for the snippet library, with
hard decision order (command → snippet → ad-hoc) and distill criteria.cs snippets doctor [--revalidate]: anti-rot health check — integrity
drift (orphan files, missing files, corrupt bodies), staleness (broken /
cold / unverified), removal candidates, and opt-in live revalidation of
read-only snippets to catch Unity API drift after upgrades. Paired with
theunity-cli-snippets-auditskill (triage table; destructive cleanup
always requires user confirmation).cs setupautomatically adds.unity-cli/snippets-stats.jsonto the project
.gitignoreto avoid PR churn from routine usage tracking. The audit file
(snippets-audit.json) remains committed as project state.
Changed
cs --json(slim mode) now parsesdata.resultJsonautomatically when the
underlying response carries it as a JSON string.cs list-commands --json
consumers should readdata.commandsdirectly (previously they had to
json.loads(data)first). The old shape is still emitted under--verbose.
Fixed
cs catalog syncnow readscommandNamespaceandargumentsfrom the
wire response. Previously it looked fornamespaceandargs, which the
service does not emit — so every synced custom-command entry ended up with
an empty namespace, a brokenidlike".action", and an emptyargs
list, and the next sync's diff would falsely flag all prior entries as
removed. Both legacy field names are still accepted for forward
compatibility.cs list-commands --type {builtin,custom}now actually filters when the
underlying response carriesresultJsonas a parsed dict. Previously the
filter wrote todata.commandsbut leftdata.resultJsonunchanged, and
_slim_resultthen surfaced the unfilteredresultJson, so all three
--typevalues returned the same list./unity-cli-sync-catalogdescription corrected: it audits the built-in
tables inunity-cli-command/SKILL.mdagainst the live Editor and is
intended for plugin maintainers, not for refreshing the per-project custom
command cache (use/unity-cli-refresh-commandsfor that).cs exec --mode runtimenow actually runs on the player. Previously the
CLI'sConsoleSession.execunconditionally calledexecute_editor_request,
so runtime-mode snippets were POSTed to the editor's"editor"endpoint
(viacompile_ip:compile_port) withouttargetIP/targetPort, silently
executing in the local Editor instead of the player and ignoring--ip
entirely. The exec path now mirrors the REPL: in runtime mode it calls
execute_runtime_request, which POSTs to"compile"with
targetIP/targetPortso the Editor compiles and forwards to the player.
command/batch/completecontinue to route through the editor by
design (matching the REPL's behavior — most commands are editor-only).
Assets 2
v1.4.3
Changed
cs setupnow pins the package to the latestvMAJOR.MINOR.*tag in the
remote that matches the plugin's version, instead of writing a bare URL
(which Unity resolved to HEAD of the default branch). This eliminates the
drift that producedplugin X.Y.x ≠ package X.Z.xwarnings shortly
after a package release. Discovery usesgit ls-remote --tags; on no
match or network failure, setup falls back to HEAD with a one-line
warning. Pass--no-pinto opt out, or--source URL#tagto pin
explicitly.cs setup --method localnowgit checkouts the resolved tag in the
local clone (fresh or existing). The clone ends in detached HEAD; if you
intend to develop in the clone, rungit checkout mainafterward.
Fixed
cs setupno longer prints a misleadingPinning to vX.Y.Zline (and
no longer hits the network) on no-op runs where the package is already
installed and--updatewas not passed. Pin resolution is now lazy.- Release workflow now passes
--title "vX.Y.Z"togh release createso
the rendered release title is just the tag, not the GitHub web fallback
of{tag}: {commit subject}.
Assets 2
v1.4.2
Added
cs exec --file PATHreads C# code from a file. Useful for long or
multi-line snippets where shell quoting would otherwise be painful.
UTF-8 BOM is stripped automatically (handles files saved by Visual
Studio / Rider / Unity).- Empty / unreadable files are rejected with a clean parser error
instead of silently sending empty code to Roslyn.
Fixed
- Shared flags (
--project,--ip,--port,--mode,--timeout,
--json, ...) placed before the subcommand are no longer reset to
their defaults by the subparser. Bothcs --project X statusand
cs status --project Xnow behave the same.
Workflow
- Release notes are sourced from this file. The
release.ymlworkflow
looks up the section matching the pushed tag and falls back to
--generate-noteswhen no matching section is present. - The Codex companion plugin now publishes its own GitHub Release for
everyvX.Y.Z-codextag, mirroring the main release. Previously the
-codextag was created but no Release was attached, because tags
pushed byGITHUB_TOKENcannot trigger other workflows.
Assets 2
v1.4.1
Full Changelog: v1.3.1...v1.4.1
Assets 2
v1.3.1
What's New in v1.3.1
Refresh System Overhaul
The cs refresh command has been completely reworked to fix compilation reliability issues and add targeted import support.
Two-Mode Refresh
| Mode | Usage | How it works |
|---|---|---|
| Targeted | cs refresh --files Assets/Scripts/Foo.cs Packages/com.xxx/Bar.cs |
ImportAsset each file directly — no scanning, works for any path |
| Full | cs refresh (no --files) |
Activates Unity window (flushes file watcher) then AssetDatabase.Refresh() handles everything |
Targeted mode is ideal for agent workflows where the caller knows exactly which files changed. It is O(N) where N = number of changed files, regardless of project size.
Full mode now uses SetForegroundWindow (Windows P/Invoke) to bring Unity to the foreground before calling Refresh(). This ensures the OS file-watcher queue is flushed, making Refresh() reliable even when Unity runs in the background.
Root Causes Fixed (C# Package Side)
These fixes are in com.zh1zh1.csharpconsole v1.3.1, consumed by this plugin:
| Issue | Cause | Fix |
|---|---|---|
| Refresh misses external changes when Unity is in background | OS file-watcher queue not flushed | ActivateEditorWindow via SetForegroundWindow P/Invoke |
| ImportAsset(ForceUpdate) does not trigger compilation | Import is deferred, RequestScriptCompilation compiles stale code | Changed to ForceUpdate + ForceSynchronousImport |
| EditorApplication.delayCall unreliable from HTTP thread | TriggerRefresh callback silently lost | Use MainThreadRequestRunner.Post thread-safe dispatcher |
| Refresh resets ImportAsset cache | Calling both in the same frame undoes the import | Separated into two modes: targeted (ImportAsset only) vs full (Refresh only) |
| Grace period race condition | OnEditorUpdate used stale timestamp after domain reload | Separate Requested/RefreshingAssets phase handling with DateTimeOffset.UtcNow.Ticks |
--wait Timeout
- Cap raised from 300s to 600s (10 minutes) to accommodate large projects with long compilation times
- Default in /unity-cli-refresh slash command raised from 60s to 120s
- The C# state machine has no compilation timeout — it waits indefinitely for isCompiling to finish
Setup UX Improvements
- Local setup always checks for updates:
cs setup --method localnow runsgit pull --ff-onlyevery time instead of silently returning "Already installed" - Version alignment check on setup: Both local and git methods now compare plugin vs package version after confirming installation. Prints
⚠ version mismatchwhen misaligned - Slash commands offer immediate action:
/unity-cli-setupand/unity-cli-statusnow directly ask whether to update when a version mismatch is detected, instead of passively reporting it
Port Management
- Constants extracted: DEFAULT_EDITOR_PORT = 14500, DEFAULT_RUNTIME_PORT = 15500 centralized in cli/init.py
- Auto-detection: Reads Temp/CSharpConsole/refresh_state.json to discover the actual editor port (supports dynamic port allocation)
- Runtime mode fix: compile_ip/compile_port now correctly route refresh/compile operations to the editor service when --mode runtime
Connection Reliability
- Broader error handling: Retry logic now catches OSError (stdlib base class) instead of just ConnectionRefusedError, covering all socket-level failures including those from bundled requests library
- TOCTOU fix: detect_port() no longer does redundant exists() check before read_text() — eliminated race condition
- Deferred port detection: detect_port() only reads disk when the result is actually needed
Command Catalog Update
9 new prefab asset commands added to SKILL.md (total: 46 to 59 commands):
| Command | Description |
|---|---|
| prefab/asset_hierarchy | Get hierarchy tree of a prefab asset |
| prefab/asset_get | Get GameObject info in a prefab asset |
| prefab/asset_get_component | Get serialized properties of a component |
| prefab/asset_modify_component | Modify component fields with auto-save |
| prefab/asset_add_component | Add a component to a prefab GameObject |
| prefab/asset_remove_component | Remove a component by type and index |
| prefab/asset_add_gameobject | Add a child GameObject |
| prefab/asset_modify_gameobject | Modify GO properties (name, tag, layer, active, isStatic) |
| prefab/asset_remove_gameobject | Remove a child GameObject |
Housekeeping
- Removed completed design docs from git history (docs directory purged via git filter-repo)
- .gitignore now excludes docs directory
Companion Package
Requires com.zh1zh1.csharpconsole v1.3.1 for the refresh reliability fixes.
Full changelog: v1.2.0...v1.3.1
Assets 2
v1.2.0
Full Changelog: v1.1.4...v1.2.0
Assets 2
v1.1.4
Full Changelog: v1.1.3...v1.1.4
Assets 2
v1.1.1
Title: v1.1.1 — Codex installer safety & package path management
Release notes:
What's Changed
Codex Installer
- Rollback-safe plugin update: clone to temp directory before replacing existing plugin, preventing data loss on clone failure
Package Path Management
- Cache rekeyed by agent working directory, supporting multiple Unity projects without cache collisions
- Setup validates clone completeness via
package.jsoncheck and cleans up partial clones on retry - Post-setup commands resolve package path explicitly with clear error when package is missing
Bug Fixes
- Only retry HTTP POST on
ConnectionRefusedError(request never reached server), avoiding duplicate execution of non-idempotent commands - Fix
ConsoleSession.emitcrash when outputting non-JSON text results - Add
.pkg-cache.jsonto.gitignore