@alpsckr/unitycli 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -299
- package/contracts/init-contract.json +64 -0
- package/contracts/instances-contract.json +49 -0
- package/contracts/package-assembly-closure.json +33 -0
- package/contracts/package-files.json +1953 -0
- package/dist/bridge/session-supervisor.d.ts +2 -0
- package/dist/bridge/session-supervisor.js +52 -19
- package/dist/bridge/session-supervisor.js.map +1 -1
- package/dist/cli-commands/command.js +33 -15
- package/dist/cli-commands/command.js.map +1 -1
- package/dist/cli-commands/init-discovery.d.ts +11 -0
- package/dist/cli-commands/init-discovery.js +185 -0
- package/dist/cli-commands/init-discovery.js.map +1 -0
- package/dist/cli-commands/init-help.d.ts +3 -0
- package/dist/cli-commands/init-help.js +41 -0
- package/dist/cli-commands/init-help.js.map +1 -0
- package/dist/cli-commands/init-skill.d.ts +10 -0
- package/dist/cli-commands/init-skill.js +171 -0
- package/dist/cli-commands/init-skill.js.map +1 -0
- package/dist/cli-commands/instances.d.ts +4 -0
- package/dist/cli-commands/instances.js +90 -0
- package/dist/cli-commands/instances.js.map +1 -0
- package/dist/cli-commands/package.d.ts +2 -2
- package/dist/cli-commands/package.js +97 -130
- package/dist/cli-commands/package.js.map +1 -1
- package/dist/cli-commands/skill-installer.d.ts +29 -13
- package/dist/cli-commands/skill-installer.js +127 -88
- package/dist/cli-commands/skill-installer.js.map +1 -1
- package/dist/cli-commands/types.d.ts +4 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +46 -37
- package/dist/cli.js.map +1 -1
- package/dist/contracts/command-contract.js +1 -0
- package/dist/contracts/command-contract.js.map +1 -1
- package/dist/doctor.js +1 -1
- package/dist/doctor.js.map +1 -1
- package/dist/instances.d.ts +1 -1
- package/dist/instances.js +63 -38
- package/dist/instances.js.map +1 -1
- package/dist/output.d.ts +4 -4
- package/dist/output.js +3 -4
- package/dist/output.js.map +1 -1
- package/dist/package-manager.d.ts +47 -2
- package/dist/package-manager.js +267 -16
- package/dist/package-manager.js.map +1 -1
- package/dist/tools/.generated-schemas.js +2 -2
- package/dist/tools/.generated-schemas.js.map +1 -1
- package/dist/tools/commands.js +11 -4
- package/dist/tools/commands.js.map +1 -1
- package/dist/tools/dispatcher.js +1 -1
- package/dist/tools/dispatcher.js.map +1 -1
- package/dist/tools/tools/group-list.d.ts +4 -8
- package/dist/tools/tools/group-list.js +12 -13
- package/dist/tools/tools/group-list.js.map +1 -1
- package/dist/tools/tools/pagination.d.ts +17 -0
- package/dist/tools/tools/pagination.js +28 -0
- package/dist/tools/tools/pagination.js.map +1 -0
- package/dist/tools/tools/search.d.ts +3 -5
- package/dist/tools/tools/search.js +12 -12
- package/dist/tools/tools/search.js.map +1 -1
- package/dist/unity-project-processes.d.ts +7 -0
- package/dist/unity-project-processes.js +54 -0
- package/dist/unity-project-processes.js.map +1 -1
- package/docs/README.md +7 -4
- package/docs/architecture.md +103 -0
- package/docs/availability-differences.md +1 -1
- package/docs/command-execution.md +6 -1
- package/docs/development.md +91 -0
- package/docs/error-codes.md +21 -5
- package/docs/extensions.md +13 -13
- package/docs/target-and-instance.md +6 -4
- package/docs/tool-discovery.md +12 -10
- package/docs/tool-execution.md +3 -2
- package/package.json +10 -4
- package/schemas/init.schema.json +209 -0
- package/schemas/instances.schema.json +104 -0
- package/skills/unitycli/SKILL.md +18 -6
- package/skills/unitycli/manifest.json +2 -2
- package/skills/unitycli/references/custom-tools.md +3 -3
- package/skills/unitycli/references/operation-protocol.md +6 -4
- package/skills/unitycli/reports/output_quality_scorecard.md +1 -1
- package/skills/unitycli/reports/trust-report.md +1 -1
- package/unitypkg/Editor/Bridge/BridgeCommandRegistry.cs +1 -0
- package/unitypkg/Editor/Bridge/BridgeWorkQueue.cs +18 -6
- package/unitypkg/Editor/Infrastructure/CodeExecSupport.cs +8 -77
- package/unitypkg/Editor/Infrastructure/UnityCliInstanceCleanup.cs +295 -0
- package/unitypkg/Editor/Infrastructure/UnityCliInstanceRegistry.cs +166 -10
- package/unitypkg/Editor/Infrastructure/UnityCliOperationCoordinator.cs +1 -0
- package/unitypkg/Editor/UnityCliBridge.cs +5 -1
- package/unitypkg/Tests/Editor/UnityCliInstanceCleanupTests.cs +232 -0
- package/unitypkg/Tests/Editor/UnityCliInstancePublicationRetryTests.cs +143 -0
- package/unitypkg/UnityCli.Editor.asmdef +1 -5
- package/unitypkg/package.json +1 -1
- package/unitypkg/Editor/Roslyn/LICENSE.txt +0 -23
- package/unitypkg/Editor/Roslyn/Microsoft.CodeAnalysis.CSharp.dll +0 -0
- package/unitypkg/Editor/Roslyn/Microsoft.CodeAnalysis.dll +0 -0
- package/unitypkg/Editor/Roslyn/System.Collections.Immutable.dll +0 -0
- package/unitypkg/Editor/Roslyn/System.Reflection.Metadata.dll +0 -0
package/README.md
CHANGED
|
@@ -1,389 +1,201 @@
|
|
|
1
1
|
# UnityCLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Windows-first Unity Editor automation CLI for AI agents. The executable is `unitycli`; the npm package is `@alpsckr/unitycli`; the Unity Package is `com.alpsckr.unitycli`.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
运行环境:Windows + Node.js 20+
|
|
7
|
-
当前方向:冻结决策 - 独立 CLI 实现、Windows-only、npm-first 安装;公开 Tool 与 CLI 控制面调用即授权。
|
|
5
|
+
## Requirements
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
- Windows
|
|
8
|
+
- Node.js 20 or newer
|
|
9
|
+
- Unity 2022.3 or newer
|
|
10
|
+
- A Unity project when installing the Bridge
|
|
11
|
+
- An opened Unity Editor only when using live Unity capabilities; installation may normally close only the exact target Editor after explicit user approval
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## Install
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
本项目是开发中项目,不承担旧版本兼容义务。
|
|
16
|
-
|
|
17
|
-
项目代码、文档、命令形态和注释必须表达当前项目规范。发现旧语义、阶段性语义或兼容性语义时,应统一改为当前规范;无法干净迁移时,优先删除,而不是保留多套说法。
|
|
18
|
-
|
|
19
|
-
### 2. Top-Level CLI Shape
|
|
20
|
-
|
|
21
|
-
用户可见顶层命令分为两类:能力入口和 CLI 控制面。
|
|
22
|
-
|
|
23
|
-
能力入口只允许:
|
|
24
|
-
|
|
25
|
-
- `tools`
|
|
26
|
-
- `command`
|
|
27
|
-
|
|
28
|
-
CLI控制面只允许:
|
|
29
|
-
|
|
30
|
-
- `init`
|
|
31
|
-
- `extensions`
|
|
32
|
-
- `target`
|
|
33
|
-
- `instances`
|
|
34
|
-
- `doctor`
|
|
35
|
-
|
|
36
|
-
Unity项目内容与Editor能力域必须进入唯一Tool catalog,例如scene、asset、game-object、prefab、editor、screenshot、package、docs、reflect、build、test、code、profiler、physics、graphics等。`tools run <tool> --input <json>`与`command <name> <business-args>`只是同一descriptor和dispatcher的两种调用语法。
|
|
37
|
-
|
|
38
|
-
`target`、`instances`、`doctor` 是 CLI 自身的状态、路由和诊断控制面;它们可以作为顶层命令存在,但不得重新引入 Unity 能力域的顶层入口。
|
|
39
|
-
|
|
40
|
-
内部 Bridge、协调器和 registry 可以作为实现细节存在,但不得定义超出上述清单的用户可见顶层命令形态。
|
|
41
|
-
|
|
42
|
-
本产品只吸收必须由已打开 Unity Editor 或 development Player 提供的项目内自动化价值。auth、Unity Hub、Editor 安装或打开、Cloud、License 和 proxy 配置属于外部控制面,必须直接使用系统或官方控制面工具,不进入 Tool catalog,也不新增顶层命令。
|
|
43
|
-
|
|
44
|
-
### 3. AI-First Tool Interface
|
|
45
|
-
|
|
46
|
-
本 CLI 主要提供给 AI 使用。项目哲学不是维护一套面向人工记忆的传统命令手册,而是提供可发现、可描述、可审计的工具目录。
|
|
47
|
-
|
|
48
|
-
AI 的标准流程是:
|
|
49
|
-
|
|
50
|
-
```text
|
|
51
|
-
unitycli tools group/search
|
|
52
|
-
unitycli tools describe <tool>
|
|
53
|
-
unitycli tools run <tool> --input <json>
|
|
54
|
-
unitycli command
|
|
55
|
-
unitycli command <name> --field <value>
|
|
56
|
-
|
|
57
|
-
unitycli target alias list/set/unset
|
|
58
|
-
unitycli instances list/prune
|
|
59
|
-
unitycli doctor
|
|
60
|
-
|
|
61
|
-
unitycli extensions list/install/remove/doctor
|
|
62
|
-
unitycli init
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
具体有哪些工具、工具参数是什么、风险边界是什么,应由AI通过本CLI内置的`tools group/search/describe`自发现。省略name的`command`只返回同一live catalog的command投影,不是第二份能力目录。
|
|
66
|
-
|
|
67
|
-
## 快速开始
|
|
15
|
+
Install the CLI once for the current user:
|
|
68
16
|
|
|
69
17
|
```powershell
|
|
70
|
-
# 安装
|
|
71
18
|
npm install -g @alpsckr/unitycli
|
|
19
|
+
```
|
|
72
20
|
|
|
73
|
-
|
|
74
|
-
unitycli init --project C:\path\MyProject
|
|
21
|
+
Start your AI in the directory where you normally work and tell it:
|
|
75
22
|
|
|
76
|
-
|
|
77
|
-
# 修改后从下一次Domain Reload或Editor启动生效
|
|
23
|
+
> 执行 unitycli init help,然后照做。
|
|
78
24
|
|
|
79
|
-
|
|
80
|
-
unitycli --help
|
|
81
|
-
unitycli --version
|
|
82
|
-
```
|
|
25
|
+
`init help` contains the complete AI installation protocol. Read-only discovery uses the unique current Unity project and workspace without asking you to repeat them, reports the installed and available Bridge versions, and accepts any exact Skill directory you already named. It asks only when a real choice remains, including permission to normally close the exact target Unity Editor before replacing an in-use Bridge. It never force-terminates Unity or decides an unsaved-scene prompt.
|
|
83
26
|
|
|
84
|
-
##
|
|
27
|
+
## Manual Setup
|
|
85
28
|
|
|
86
|
-
|
|
29
|
+
Read the same protocol and inspect the current directory:
|
|
87
30
|
|
|
88
31
|
```powershell
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
unitycli instances list
|
|
92
|
-
# 需要审计历史/offline 合法记录时显式展开
|
|
93
|
-
unitycli instances list --all
|
|
94
|
-
|
|
95
|
-
# 已知实例时,在后续每条 Bridge 命令上显式传入
|
|
96
|
-
unitycli tools group --instance <instanceId>
|
|
97
|
-
# 可先创建稳定别名,再继续显式传入
|
|
98
|
-
unitycli target alias set <instanceId> my-project
|
|
99
|
-
unitycli tools group --instance my-project
|
|
32
|
+
unitycli init help
|
|
33
|
+
unitycli init discover
|
|
100
34
|
```
|
|
101
35
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
推荐按组逐层发现,避免一次展开全量工具:
|
|
36
|
+
Install or repair the Bridge in one explicit Unity project. Use `--close-editor` only after the user approves normally closing that exact project:
|
|
105
37
|
|
|
106
38
|
```powershell
|
|
107
|
-
|
|
108
|
-
unitycli
|
|
109
|
-
|
|
110
|
-
# 第二步:按组查看工具摘要
|
|
111
|
-
unitycli tools group list camera
|
|
112
|
-
# 或搜索关键词(使用 | 分隔多关键词,OR 匹配;PowerShell必须单引号包住整段)
|
|
113
|
-
unitycli tools search 'screenshot|camera'
|
|
114
|
-
|
|
115
|
-
# 第三步:查看工具完整描述(执行前必做)
|
|
116
|
-
unitycli tools describe camera.screenshot
|
|
117
|
-
|
|
118
|
-
# 第四步:执行工具
|
|
119
|
-
unitycli tools run camera.screenshot --input '{"target":"Main Camera","output":"Artifacts/shot.png"}'
|
|
39
|
+
unitycli init package --project C:\path\UnityProject
|
|
40
|
+
unitycli init package --project C:\path\UnityProject --close-editor
|
|
41
|
+
unitycli init package --project C:\path\UnityProject --check
|
|
120
42
|
```
|
|
121
43
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
当前版本通过 `docs.get/search` 查询 Unity API 文档,通过 `reflect.*` 查询类型缓存;这些 Tool 仍从已连接实例的统一 catalog 发现和调用:
|
|
44
|
+
Install or check an exact user-selected Skill directory, including Pi:
|
|
125
45
|
|
|
126
46
|
```powershell
|
|
127
|
-
|
|
128
|
-
unitycli
|
|
129
|
-
unitycli tools run docs.search "Render Pipeline"
|
|
130
|
-
|
|
131
|
-
# 类型反射
|
|
132
|
-
unitycli tools run reflect.type UnityEngine.Camera
|
|
133
|
-
unitycli tools run reflect.member UnityEngine.Camera.fieldOfView
|
|
47
|
+
unitycli init skill --target C:\path\Workspace\.pi\skills\unitycli
|
|
48
|
+
unitycli init skill --target C:\path\Workspace\.pi\skills\unitycli --check
|
|
134
49
|
```
|
|
135
50
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
### 4. 项目注册能力
|
|
139
|
-
|
|
140
|
-
Unity 项目可通过异步 C# `IUnityCliTool<TReq,TRes>` 注册能力;完成编译后自动进入该实例的完整目录,与 package 内置和 Extension 能力使用同一路径:
|
|
51
|
+
Generic Agent Skills remain available as a preset:
|
|
141
52
|
|
|
142
53
|
```powershell
|
|
143
|
-
|
|
144
|
-
unitycli
|
|
145
|
-
|
|
146
|
-
# 描述并执行项目 Tool
|
|
147
|
-
unitycli tools describe my.custom-tool --instance <id|projectPath|alias>
|
|
148
|
-
unitycli tools run my.custom-tool --input '{"key":"value"}' --instance <id|projectPath|alias>
|
|
54
|
+
unitycli init skill --agent .agents --scope workspace --workspace C:\path\Workspace
|
|
55
|
+
unitycli init skill --agent .agents --scope workspace --workspace C:\path\Workspace --check
|
|
149
56
|
```
|
|
150
57
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
### 5. 使用command语法
|
|
154
|
-
|
|
155
|
-
`command`按目标Tool的live `inputSchema`解析named、attached、boolean裸开关和声明顺序positional参数,然后进入与`tools run`相同的dispatcher和JSON envelope:
|
|
58
|
+
Install or check Claude Skills in one workspace:
|
|
156
59
|
|
|
157
60
|
```powershell
|
|
158
|
-
|
|
159
|
-
unitycli
|
|
160
|
-
|
|
161
|
-
# native Tool使用完整Tool名
|
|
162
|
-
unitycli command editor.compile --refresh true --includeWarnings true
|
|
163
|
-
|
|
164
|
-
# [CliCommand("test")]在tools中名为UnityPipeline_test,command可用attribute原名
|
|
165
|
-
unitycli command test --mode EditMode
|
|
166
|
-
unitycli command UnityPipeline_test --mode EditMode
|
|
61
|
+
unitycli init skill --agent claude --scope workspace --workspace C:\path\Workspace
|
|
62
|
+
unitycli init skill --agent claude --scope workspace --workspace C:\path\Workspace --check
|
|
167
63
|
```
|
|
168
64
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
`com.unity.pipeline` package自身的attribute命令已由native能力矩阵吸收,不进入live目录;项目和其他Package声明的`[CliCommand]`继续正常导入。本package首次检测到Pipeline时只执行一次`AutoStart=false`持久化和当前server停服,成功后不再覆盖用户后续手动操作。
|
|
172
|
-
|
|
173
|
-
### 6. 诊断与健康检查
|
|
65
|
+
Install or check one user-level Skill:
|
|
174
66
|
|
|
175
67
|
```powershell
|
|
176
|
-
|
|
177
|
-
unitycli
|
|
68
|
+
unitycli init skill --agent .agents --scope user
|
|
69
|
+
unitycli init skill --agent .agents --scope user --check
|
|
178
70
|
|
|
179
|
-
|
|
180
|
-
unitycli
|
|
71
|
+
unitycli init skill --agent claude --scope user
|
|
72
|
+
unitycli init skill --agent claude --scope user --check
|
|
181
73
|
```
|
|
182
74
|
|
|
183
|
-
|
|
75
|
+
Preset workspace and user scope are separate choices. An exact `--target` is final user intent and cannot be combined with preset agent/scope options. Bridge and Skill are independently authorized effects; failure of one does not invalidate or block the other.
|
|
184
76
|
|
|
185
|
-
|
|
186
|
-
|------|------|
|
|
187
|
-
| Tool 可有副作用 | 调用即授权;`destructiveHint`、`sideEffects` 与 `supportsDryRun` 仅描述风险和可选预览 |
|
|
188
|
-
| 读取型 Tool 纯只读 | 读取型 Tool 不触发写入、import、compile、domain reload 或 PlayMode 变化 |
|
|
189
|
-
| Extension 不能绕过 descriptor/envelope | 项目工具必须可描述、可审计、可阻断 |
|
|
190
|
-
| 内部完整性不匹配默认阻止 | 自定义工具的 handler 代码与 descriptor 不一致时,默认阻止执行 |
|
|
77
|
+
## Verify And Diagnose
|
|
191
78
|
|
|
192
|
-
|
|
79
|
+
Package and Skill checks are read-only:
|
|
193
80
|
|
|
194
81
|
```powershell
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
# 本地开发
|
|
199
|
-
npm install
|
|
200
|
-
npm run build
|
|
201
|
-
npm test
|
|
202
|
-
npm link
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
## 输出格式
|
|
206
|
-
|
|
207
|
-
所有命令输出统一 JSON envelope:
|
|
208
|
-
|
|
209
|
-
```json
|
|
210
|
-
{
|
|
211
|
-
"ok": true,
|
|
212
|
-
"requestId": "req-xxx",
|
|
213
|
-
"data": { ... }
|
|
214
|
-
}
|
|
82
|
+
unitycli init package --project C:\path\UnityProject --check
|
|
83
|
+
unitycli init skill --target C:\path\Workspace\.pi\skills\unitycli --check
|
|
84
|
+
unitycli init skill --agent .agents --scope workspace --workspace C:\path\Workspace --check
|
|
215
85
|
```
|
|
216
86
|
|
|
217
|
-
|
|
87
|
+
After the user opens or refreshes Unity, inspect registered Editor sessions:
|
|
218
88
|
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
"error": {
|
|
224
|
-
"code": "E_INSTANCE_CONFLICT",
|
|
225
|
-
"message": "...",
|
|
226
|
-
"transient": false,
|
|
227
|
-
"nextActions": ["Close duplicate Editor sessions for the selected project."],
|
|
228
|
-
"retryAfterMs": 0
|
|
229
|
-
}
|
|
230
|
-
}
|
|
89
|
+
```powershell
|
|
90
|
+
unitycli instances list
|
|
91
|
+
unitycli instances prune --instance C:\path\UnityProject
|
|
92
|
+
unitycli doctor --project C:\path\UnityProject
|
|
231
93
|
```
|
|
232
94
|
|
|
233
|
-
|
|
95
|
+
`instances list`默认隐藏offline记录;`instances list --all`仅用于展开审计。Unity启动、编译或重载时,live命令会在本次timeout内等待当前连接ready。旧格式、损坏或不可读记录会逐文件隔离,不阻断合法实例,并通过`invalidRecordCount`返回数量;当前项目由Unity自动恢复。需要清理历史记录时运行`instances prune --instance <id|projectPath|alias>`并检查`removed`、`remaining`和`deferred`,不要手工读取或删除内部文件。
|
|
234
96
|
|
|
235
|
-
|
|
97
|
+
To create a stable selector:
|
|
236
98
|
|
|
237
|
-
|
|
99
|
+
```powershell
|
|
100
|
+
unitycli target alias set C:\path\UnityProject my-project
|
|
101
|
+
unitycli target alias list
|
|
102
|
+
```
|
|
238
103
|
|
|
239
|
-
##
|
|
104
|
+
## First Unity Call
|
|
240
105
|
|
|
241
|
-
|
|
106
|
+
With the selected Unity project open and ready:
|
|
242
107
|
|
|
243
108
|
```powershell
|
|
244
|
-
unitycli tools group
|
|
245
|
-
unitycli tools
|
|
246
|
-
unitycli tools
|
|
247
|
-
unitycli tools
|
|
248
|
-
unitycli tools run <tool-name> --input '<json>' [--instance <id|projectPath|alias>]
|
|
109
|
+
unitycli tools group --instance C:\path\UnityProject
|
|
110
|
+
unitycli tools search 'editor|state' --instance C:\path\UnityProject
|
|
111
|
+
unitycli tools describe editor.state --instance C:\path\UnityProject
|
|
112
|
+
unitycli tools run editor.state --input '{}' --instance C:\path\UnityProject
|
|
249
113
|
```
|
|
250
114
|
|
|
251
|
-
Tool
|
|
252
|
-
|
|
253
|
-
Bridge-backed Tool在Unity主线程执行。CLI使用Registry/Health v3与只读内存pulse,在一个不可变deadline内处理compile、import、domain reload和listener generation交接。mutation只允许在同一`editorSessionId`内用完全相同的请求续接;首次POST后session改变时禁止向新session重投,并返回outcome unknown的`E_EXECUTION_TIMEOUT`。`unitycli tools run editor.state --input '{}'`、`editor.dialogs`与`editor.dialog.click`使用exact frozen本地descriptor进入同一dispatcher,因此统一状态观察和弹窗恢复不依赖被阻断的Live catalog;其他Tool仍严格依赖Live catalog。
|
|
115
|
+
Do not guess Tool names or inputs. Discover the current catalog, read one descriptor, then call that exact Tool. `command <name>` is a schema-argument projection of the same live catalog, not a second capability system.
|
|
254
116
|
|
|
255
|
-
|
|
117
|
+
Optional extensions use their dedicated control plane:
|
|
256
118
|
|
|
257
119
|
```powershell
|
|
258
|
-
|
|
259
|
-
unitycli
|
|
260
|
-
unitycli
|
|
261
|
-
unitycli
|
|
120
|
+
unitycli extensions list --project C:\path\UnityProject
|
|
121
|
+
unitycli extensions install <id> --project C:\path\UnityProject
|
|
122
|
+
unitycli extensions remove <id> --project C:\path\UnityProject
|
|
123
|
+
unitycli extensions doctor --project C:\path\UnityProject
|
|
262
124
|
```
|
|
263
125
|
|
|
264
|
-
|
|
126
|
+
Discovery lists default to 20 items, allow at most 100, and continue with `pageInfo.nextCursor`:
|
|
265
127
|
|
|
266
128
|
```powershell
|
|
267
|
-
|
|
268
|
-
unitycli
|
|
269
|
-
unitycli
|
|
270
|
-
unitycli target alias list
|
|
129
|
+
unitycli tools group list <group> --page-size 20 --instance <id|projectPath|alias>
|
|
130
|
+
unitycli tools search '<k1|k2|...>' --page-size 20 --instance <id|projectPath|alias>
|
|
131
|
+
unitycli command --project-path C:\path\UnityProject --page-size 20
|
|
271
132
|
```
|
|
272
133
|
|
|
273
|
-
|
|
134
|
+
In PowerShell, quote pipe-separated search keywords with single quotes.
|
|
274
135
|
|
|
275
|
-
|
|
136
|
+
## Output
|
|
276
137
|
|
|
277
|
-
|
|
138
|
+
Every command returns one JSON envelope. stdout is compact single-line JSON by default; use `--pretty` only for indented output.
|
|
278
139
|
|
|
279
|
-
|
|
140
|
+
Success:
|
|
280
141
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
| *(none)* | 安装/更新 Bridge 包(copy 模式),并为已存在的 Agent 目录安装 Skill |
|
|
284
|
-
| `--pkg-only` | 仅安装 Bridge 包,不安装 Skill |
|
|
285
|
-
| `--skill-only [--agent <agent>]` | 仅安装 Skill;未传 `--agent` 时使用已存在的 Agent 目录 |
|
|
286
|
-
| `--check` | 检查安装状态,不修改项目 |
|
|
287
|
-
| `--agent <pi\|claude\|.agents,...>` | 显式指定 Skill 安装目标 |
|
|
288
|
-
|
|
289
|
-
```powershell
|
|
290
|
-
# 默认安装 Bridge;若项目已有 .pi/.claude/.agents,则自动安装 Skill
|
|
291
|
-
unitycli init --project C:\path\MyProject
|
|
292
|
-
|
|
293
|
-
# 仅 Bridge 包
|
|
294
|
-
unitycli init --project C:\path\MyProject --pkg-only
|
|
295
|
-
|
|
296
|
-
# 显式安装 Skill 到 pi
|
|
297
|
-
unitycli init --project C:\path\MyProject --skill-only --agent pi
|
|
298
|
-
|
|
299
|
-
# 检查安装状态;未传 --agent 时同样会检查已存在的 Agent 目录
|
|
300
|
-
unitycli init --check --project C:\path\MyProject
|
|
142
|
+
```json
|
|
143
|
+
{"ok":true,"requestId":"req-...","data":{}}
|
|
301
144
|
```
|
|
302
145
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
## Unity Editor Bridge
|
|
146
|
+
Failure:
|
|
306
147
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
148
|
+
```json
|
|
149
|
+
{"ok":false,"requestId":"req-...","error":{"code":"...","message":"...","nextActions":[],"transient":false,"retryAfterMs":0}}
|
|
150
|
+
```
|
|
310
151
|
|
|
311
|
-
|
|
152
|
+
Follow structured `nextActions`. With `--timeout-ms T`, use a host budget of at least `2 * T + 5000` milliseconds and wait for the unitycli process to exit. `E_EXECUTION_TIMEOUT` means no trusted terminal result; timeout does not stop Unity effects or synchronous C# already running. Inspect business state before deciding whether to submit a new mutation.
|
|
312
153
|
|
|
313
|
-
##
|
|
154
|
+
## Update And Remove
|
|
314
155
|
|
|
315
|
-
|
|
156
|
+
Update the global CLI, then let the AI run the installation protocol again:
|
|
316
157
|
|
|
317
158
|
```powershell
|
|
318
|
-
|
|
319
|
-
unitycli
|
|
320
|
-
unitycli tools describe my.editor-tool --instance <id|projectPath|alias>
|
|
321
|
-
unitycli tools run my.editor-tool --input '{"message":"hello"}' --instance <id|projectPath|alias>
|
|
159
|
+
npm install -g @alpsckr/unitycli@latest
|
|
160
|
+
unitycli init help
|
|
322
161
|
```
|
|
323
162
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
所有能力都以 Tool 呈现。`target: "editor" | "runtime" | "both"` 只是可用性与路由约束,不是两套用户入口。
|
|
327
|
-
|
|
328
|
-
`runtime` 表示 Unity gameplay/runtime layer;具体 tool 是否需要 Play Mode,由 `availabilityScope` 和 `nextActions` 说明。
|
|
163
|
+
To remove a workspace or user Skill, delete only the selected `unitycli` Skill directory:
|
|
329
164
|
|
|
330
|
-
|
|
165
|
+
```text
|
|
166
|
+
<explicit-target>/unitycli
|
|
167
|
+
<workspace>/.agents/skills/unitycli
|
|
168
|
+
<workspace>/.claude/skills/unitycli
|
|
169
|
+
~/.agents/skills/unitycli
|
|
170
|
+
~/.claude/skills/unitycli
|
|
171
|
+
```
|
|
331
172
|
|
|
332
|
-
|
|
333
|
-
- **Envelope**:所有输入输出必须通过统一 envelope 格式
|
|
334
|
-
- **内部完整性校验**:handler 与 descriptor 不一致时默认阻止执行
|
|
335
|
-
- **target-scoped availability**:工具可用性依赖目标实例和 Play Mode 状态
|
|
336
|
-
- **禁止项**:不允许任意方法调用、反射 escape hatch、绕过 registry 直接执行
|
|
173
|
+
To remove the managed Bridge, first inspect the current `package.bridge-remove` descriptor and follow it:
|
|
337
174
|
|
|
338
|
-
|
|
175
|
+
```powershell
|
|
176
|
+
unitycli tools describe package.bridge-remove --instance C:\path\UnityProject
|
|
177
|
+
```
|
|
339
178
|
|
|
340
|
-
|
|
179
|
+
Remove the global CLI with:
|
|
341
180
|
|
|
342
181
|
```powershell
|
|
343
|
-
|
|
344
|
-
unitycli tools group list probuilder --instance <id|projectPath|alias>
|
|
345
|
-
unitycli tools describe probuilder.create-shape --instance <id|projectPath|alias>
|
|
346
|
-
unitycli tools run probuilder.create-shape --input '{"shapeType":"Cube","name":"MyCube"}' --instance <id|projectPath|alias>
|
|
182
|
+
npm uninstall -g @alpsckr/unitycli
|
|
347
183
|
```
|
|
348
184
|
|
|
349
|
-
##
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
## 更多文档
|
|
364
|
-
|
|
365
|
-
- [文档索引](docs/README.md) — 当前使用、扩展与诊断文档入口
|
|
366
|
-
- [Target 与 Instance](docs/target-and-instance.md) — 目标选择与实例管理
|
|
367
|
-
- [工具发现](docs/tool-discovery.md) — group-first 分层发现详解
|
|
368
|
-
- [工具执行](docs/tool-execution.md) — tools run 执行通道详解
|
|
369
|
-
- [安全边界](docs/safety-boundaries.md) — 调用授权、风险元数据与正确性边界
|
|
370
|
-
- [风险与副作用](docs/risk-and-side-effects.md) — destructive/dry-run 描述与可选预览
|
|
371
|
-
- [错误码](docs/error-codes.md) — 结构化错误与 nextActions
|
|
372
|
-
- [可用性差异](docs/availability-differences.md) — 不同实例的工具有效性
|
|
373
|
-
- [扩展包](docs/extensions.md) — 可选扩展安装、卸载与诊断
|
|
374
|
-
- [自定义 Tool](skills/unitycli/references/custom-tools.md) — 项目侧 Tool 注册开发
|
|
375
|
-
- [AI Agent Skill](skills/unitycli/SKILL.md) — Agent 最小入口卡片
|
|
376
|
-
|
|
377
|
-
## 本地开发
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
npm install
|
|
381
|
-
npm run build
|
|
382
|
-
npm test
|
|
383
|
-
npm link
|
|
384
|
-
unitycli --help
|
|
385
|
-
```
|
|
185
|
+
## Documentation
|
|
186
|
+
|
|
187
|
+
- [Documentation index](docs/README.md)
|
|
188
|
+
- [Architecture and public boundaries](docs/architecture.md)
|
|
189
|
+
- [Local development](docs/development.md)
|
|
190
|
+
- [Tool discovery](docs/tool-discovery.md)
|
|
191
|
+
- [Tool execution](docs/tool-execution.md)
|
|
192
|
+
- [Command execution](docs/command-execution.md)
|
|
193
|
+
- [Target and instance selection](docs/target-and-instance.md)
|
|
194
|
+
- [Safety boundaries](docs/safety-boundaries.md)
|
|
195
|
+
- [Errors](docs/error-codes.md)
|
|
196
|
+
- [Extensions](docs/extensions.md)
|
|
197
|
+
- [Public AI Skill](skills/unitycli/SKILL.md)
|
|
386
198
|
|
|
387
|
-
##
|
|
199
|
+
## License
|
|
388
200
|
|
|
389
201
|
MIT
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"topLevel": "init",
|
|
4
|
+
"schema": "schemas/init.schema.json",
|
|
5
|
+
"subcommands": {
|
|
6
|
+
"help": {
|
|
7
|
+
"options": []
|
|
8
|
+
},
|
|
9
|
+
"discover": {
|
|
10
|
+
"options": []
|
|
11
|
+
},
|
|
12
|
+
"package": {
|
|
13
|
+
"options": [
|
|
14
|
+
"project",
|
|
15
|
+
"close-editor",
|
|
16
|
+
"check",
|
|
17
|
+
"timeout-ms"
|
|
18
|
+
],
|
|
19
|
+
"required": [
|
|
20
|
+
"project"
|
|
21
|
+
],
|
|
22
|
+
"checkStatuses": [
|
|
23
|
+
"installed",
|
|
24
|
+
"missing",
|
|
25
|
+
"damaged",
|
|
26
|
+
"drifted",
|
|
27
|
+
"conflict"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"skill": {
|
|
31
|
+
"options": [
|
|
32
|
+
"agent",
|
|
33
|
+
"scope",
|
|
34
|
+
"workspace",
|
|
35
|
+
"target",
|
|
36
|
+
"check",
|
|
37
|
+
"timeout-ms"
|
|
38
|
+
],
|
|
39
|
+
"requiredAnyOf": [
|
|
40
|
+
[
|
|
41
|
+
"target"
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
"agent",
|
|
45
|
+
"scope"
|
|
46
|
+
]
|
|
47
|
+
],
|
|
48
|
+
"agents": [
|
|
49
|
+
".agents",
|
|
50
|
+
"claude"
|
|
51
|
+
],
|
|
52
|
+
"scopes": [
|
|
53
|
+
"workspace",
|
|
54
|
+
"user"
|
|
55
|
+
],
|
|
56
|
+
"checkStatuses": [
|
|
57
|
+
"installed",
|
|
58
|
+
"missing",
|
|
59
|
+
"drifted",
|
|
60
|
+
"damaged"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"topLevel": "instances",
|
|
4
|
+
"schema": "schemas/instances.schema.json",
|
|
5
|
+
"registry": {
|
|
6
|
+
"version": 3,
|
|
7
|
+
"canonicalizationVersion": 1,
|
|
8
|
+
"statuses": [
|
|
9
|
+
"ready",
|
|
10
|
+
"transitioning",
|
|
11
|
+
"blocked",
|
|
12
|
+
"unresponsive",
|
|
13
|
+
"unverifiable",
|
|
14
|
+
"offline",
|
|
15
|
+
"conflict"
|
|
16
|
+
],
|
|
17
|
+
"readerPollMs": 100,
|
|
18
|
+
"writer": "unity-bridge"
|
|
19
|
+
},
|
|
20
|
+
"subcommands": {
|
|
21
|
+
"list": {
|
|
22
|
+
"options": ["all"],
|
|
23
|
+
"readOnly": true
|
|
24
|
+
},
|
|
25
|
+
"prune": {
|
|
26
|
+
"options": ["instance", "timeout-ms"],
|
|
27
|
+
"privateCommand": "internal.instances.prune",
|
|
28
|
+
"mutation": true,
|
|
29
|
+
"retention": {
|
|
30
|
+
"offlineMax": 100,
|
|
31
|
+
"damagedMax": 20,
|
|
32
|
+
"maxAgeDays": 30,
|
|
33
|
+
"scanLimit": 2000,
|
|
34
|
+
"deleteLimit": 20
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"errors": [
|
|
39
|
+
"E_INSTANCE_NOT_FOUND",
|
|
40
|
+
"E_INSTANCE_NOT_RUNNING",
|
|
41
|
+
"E_INSTANCE_UNVERIFIABLE",
|
|
42
|
+
"E_UNITY_TRANSITION_TIMEOUT",
|
|
43
|
+
"E_UNITY_BUSY",
|
|
44
|
+
"E_EXECUTION_TIMEOUT",
|
|
45
|
+
"E_BRIDGE_RESPONSE_INVALID",
|
|
46
|
+
"E_SCHEMA_INVALID",
|
|
47
|
+
"BRIDGE_CONNECTION_FAILED"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"packageName": "com.alpsckr.unitycli",
|
|
4
|
+
"minimumUnityVersion": "2022.3",
|
|
5
|
+
"bundledAssemblies": [],
|
|
6
|
+
"editorProvidedAssemblies": [
|
|
7
|
+
{
|
|
8
|
+
"fileName": "Newtonsoft.Json.dll",
|
|
9
|
+
"assemblyName": "Newtonsoft.Json",
|
|
10
|
+
"minimumAssemblyVersion": "13.0.0.0",
|
|
11
|
+
"provider": "Unity Editor/Data/Managed",
|
|
12
|
+
"referencedBy": "UnityCli.Editor.asmdef"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"compiler": {
|
|
16
|
+
"mode": "editor-bundled-csc-subprocess",
|
|
17
|
+
"monoRelativePath": "MonoBleedingEdge/bin/mono.exe",
|
|
18
|
+
"compilerRelativePath": "MonoBleedingEdge/lib/mono/4.5/csc.exe",
|
|
19
|
+
"packageOwnedRoslyn": false,
|
|
20
|
+
"temporaryRoot": "Library/UnityCli/code-exec-temp"
|
|
21
|
+
},
|
|
22
|
+
"conflictPolicy": {
|
|
23
|
+
"protectedAssemblyFileNames": [
|
|
24
|
+
"Newtonsoft.Json.dll"
|
|
25
|
+
],
|
|
26
|
+
"allowedPackageProviders": [
|
|
27
|
+
"com.unity.nuget.newtonsoft-json"
|
|
28
|
+
],
|
|
29
|
+
"maxDirectories": 4096,
|
|
30
|
+
"maxFiles": 50000,
|
|
31
|
+
"maxConflicts": 100
|
|
32
|
+
}
|
|
33
|
+
}
|