@alpsckr/unitycli 0.4.0 → 0.4.1
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 +109 -300
- package/contracts/init-contract.json +57 -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 +4 -0
- package/dist/cli-commands/init-discovery.js +175 -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 +37 -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 +105 -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 +57 -137
- package/dist/cli-commands/package.js.map +1 -1
- package/dist/cli-commands/skill-installer.d.ts +14 -6
- package/dist/cli-commands/skill-installer.js +37 -38
- package/dist/cli-commands/skill-installer.js.map +1 -1
- package/dist/cli-commands/types.d.ts +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +44 -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 +43 -2
- package/dist/package-manager.js +255 -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/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 +5 -5
- package/docs/extensions.md +11 -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 +124 -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
|
@@ -61,15 +61,20 @@ object、array和任意JSON值必须是有效JSON。字段大小写和下划线
|
|
|
61
61
|
## Command级控制项
|
|
62
62
|
|
|
63
63
|
```powershell
|
|
64
|
+
# 省略name时只返回有界路由摘要;参数在单命令help中读取
|
|
65
|
+
unitycli command --project-path C:\path\MyProject --page-size 20
|
|
66
|
+
unitycli command --project-path C:\path\MyProject --page-size 20 --cursor 20
|
|
67
|
+
|
|
64
68
|
unitycli command --project-path C:\path\MyProject <name> ...
|
|
65
69
|
unitycli command --timeout 120 <name> ...
|
|
66
70
|
unitycli command <name> ... --timeout-ms 120000 --dry-run
|
|
67
71
|
```
|
|
68
72
|
|
|
69
73
|
- `--project-path <path>`绑定现有canonical项目实例,不直连endpoint,也不写入active target。
|
|
74
|
+
- 省略name时,`--page-size`默认20、最大100;存在`pageInfo.nextCursor`时将其原值传回`--cursor`。列表项不展开parameters,使用`command <name> --help`读取参数。
|
|
70
75
|
- `--timeout <seconds>`位于name前;`--timeout-ms <milliseconds>`使用本项目执行控制语义。
|
|
71
76
|
- `--dry-run`、`--runtime`、`--artifact-dir`和`--instance`仍是执行/选择控制项,不进入Tool business input。
|
|
72
|
-
-
|
|
77
|
+
- stdout默认是单行紧凑JSON;`--pretty`只增加缩进,不改变envelope字段。
|
|
73
78
|
|
|
74
79
|
## 等价性
|
|
75
80
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Local Development
|
|
2
|
+
|
|
3
|
+
## Requirements
|
|
4
|
+
|
|
5
|
+
- Windows
|
|
6
|
+
- Node.js 20 or newer
|
|
7
|
+
- PowerShell 7
|
|
8
|
+
- Unity 2022.3 for the Dev validation project
|
|
9
|
+
|
|
10
|
+
## Build And Test
|
|
11
|
+
|
|
12
|
+
```powershell
|
|
13
|
+
npm install
|
|
14
|
+
npm run build:test
|
|
15
|
+
npm test
|
|
16
|
+
npm run architecture:validate
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`build:test` regenerates extension projections, TypeScript registries, completion contracts, command contracts, protocol output, Tool schemas, and the canonical Package file manifest before compiling production and test code.
|
|
20
|
+
|
|
21
|
+
Package integrity checks can be run directly:
|
|
22
|
+
|
|
23
|
+
```powershell
|
|
24
|
+
npm run package-closure:validate
|
|
25
|
+
npm run init-contract:validate
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The Package closure audit enforces:
|
|
29
|
+
|
|
30
|
+
- exact canonical `unitypkg` file paths, sizes, per-file SHA-256, and tree hash;
|
|
31
|
+
- zero package-owned Roslyn DLLs;
|
|
32
|
+
- Unity-provided precompiled references;
|
|
33
|
+
- the Unity Editor compiler path used by `code.exec`;
|
|
34
|
+
- bounded assembly-conflict policy.
|
|
35
|
+
|
|
36
|
+
## Run The Source CLI
|
|
37
|
+
|
|
38
|
+
```powershell
|
|
39
|
+
node dist/cli.js --help
|
|
40
|
+
node dist/cli.js init help
|
|
41
|
+
node dist/cli.js init discover
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For global local development:
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
npm link
|
|
48
|
+
unitycli --version
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Dev Unity Isolation
|
|
52
|
+
|
|
53
|
+
Only `Dev/UnityProject` is controlled by automated validation. Launch both Unity and the source CLI with the process-local environment variable:
|
|
54
|
+
|
|
55
|
+
```powershell
|
|
56
|
+
$env:UNITYCLI_DATA_DIR = Join-Path $env:LOCALAPPDATA 'UnityCli-Dev'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Do not set this variable globally. Before and after validation, record:
|
|
60
|
+
|
|
61
|
+
- the formal `%LOCALAPPDATA%\UnityCli` file set;
|
|
62
|
+
- existing Unity process IDs and project command lines;
|
|
63
|
+
- Dev registry and temporary files;
|
|
64
|
+
- every changed Dev fixture and its restoration state.
|
|
65
|
+
|
|
66
|
+
Use the current source installation route before Unity validation:
|
|
67
|
+
|
|
68
|
+
```powershell
|
|
69
|
+
$project = (Resolve-Path 'Dev/UnityProject').Path
|
|
70
|
+
node dist/cli.js init package --project $project
|
|
71
|
+
node dist/cli.js init package --project $project --check
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Validation Order
|
|
75
|
+
|
|
76
|
+
1. Finish source, tests, contracts, generated outputs, public Skill, and docs.
|
|
77
|
+
2. Run focused build, type checks, tests, and contract audits.
|
|
78
|
+
3. Run the affected isolated Dev Unity matrix.
|
|
79
|
+
4. Audit the final diff and npm artifact.
|
|
80
|
+
|
|
81
|
+
A failed validation step stops the current validation stage. Classify it as product, harness, environment, specification, or test-scope failure; fix the owner and rerun every affected check fresh.
|
|
82
|
+
|
|
83
|
+
## Packaging
|
|
84
|
+
|
|
85
|
+
Inspect the npm artifact without publishing:
|
|
86
|
+
|
|
87
|
+
```powershell
|
|
88
|
+
npm pack --dry-run --json
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The artifact must contain the canonical `unitypkg`, contracts, schemas, public Skill source, docs, and README. Publishing, tagging, pushing, installing a release artifact, or changing versions requires the repository release procedure and explicit user authorization.
|
package/docs/error-codes.md
CHANGED
|
@@ -43,11 +43,11 @@ alps-unity-cli 使用结构化错误码,包含机器可读的 `code`、`transi
|
|
|
43
43
|
| 错误码 | 含义 | 恢复 |
|
|
44
44
|
|--------|------|------|
|
|
45
45
|
| `E_INSTANCE_REQUIRED` | 没有显式 selector,CWD 也不在 Unity 项目中 | 传完整 `--instance <id|projectPath|alias>` 或从项目目录调用 |
|
|
46
|
-
| `E_INSTANCE_NOT_FOUND` | selector
|
|
47
|
-
| `E_INSTANCE_NOT_RUNNING` | 项目 identity
|
|
46
|
+
| `E_INSTANCE_NOT_FOUND` | selector 在当前截止时间内没有对应项目记录 | 核对项目路径/alias;完整instance ID在目标Unity启动时会等待首次记录 |
|
|
47
|
+
| `E_INSTANCE_NOT_RUNNING` | 项目 identity 已确定,且没有可验证的运行中 Editor | 打开该项目;CLI会在本次调用内等待首次ready记录 |
|
|
48
48
|
| `E_INSTANCE_CONFLICT` | 至少两个已验证live process claim声明同一项目 | 关闭重复Editor,只保留目标session |
|
|
49
49
|
| `E_INSTANCE_UNVERIFIABLE` | PID/start、project claim、Registry读取或权限证据不完整 | 重新观察identity;不得把未知mutation自动重投 |
|
|
50
|
-
| `E_INSTANCE_IDENTITY_MISMATCH` |
|
|
50
|
+
| `E_INSTANCE_IDENTITY_MISMATCH` | 当前Unity无法在截止时间内重建并证明一致的项目身份 | 更新匹配的CLI/Package,打开该项目并重新观察;不要手工修改内部记录 |
|
|
51
51
|
| `E_UNITY_UNRESPONSIVE` | transport identity存在,但近期Unity主线程pulse或Bridge响应不可证明 | 读取`editor.state`与`editor.dialogs`后处理transition/modal |
|
|
52
52
|
| `E_INSTANCE_PROJECT_MISMATCH` | 显式项目约束与 selector 指向不同 identity | 统一 `--project` 和 `--instance` |
|
|
53
53
|
| `E_INSTANCE_PATH_UNAVAILABLE` | 无法取得可证明的物理 canonical path | 修复不可访问路径、broken link 或 reparse 配置 |
|
|
@@ -168,8 +168,8 @@ alps-unity-cli 使用结构化错误码,包含机器可读的 `code`、`transi
|
|
|
168
168
|
| 错误码 | 含义 |
|
|
169
169
|
|--------|------|
|
|
170
170
|
| `E_UNITY_BLOCKED` | effect 前已证明 Unity/UI blocker;原错误的 `details.blockers` 含结构化弹窗摘要 |
|
|
171
|
-
| `E_UNITY_BUSY` |
|
|
172
|
-
| `E_UNITY_TRANSITION_TIMEOUT` |
|
|
171
|
+
| `E_UNITY_BUSY` | 任务池、修改owner或实例清理owner正在工作;按message与`nextActions`区分是否尚未发送业务请求,`instances prune`可按`retryAfterMs`稍后重试 |
|
|
172
|
+
| `E_UNITY_TRANSITION_TIMEOUT` | 首次ready记录或可恢复状态变化未在原命令截止时间内稳定;确认Unity仍在推进后才使用更大的timeout重试 |
|
|
173
173
|
| `E_EXECUTION_TIMEOUT` | 已放行调用未在execution deadline内返回终态、连接提前断开,或首次mutation POST后Editor session改变;outcome unknown,CLI不向新session自动重投 |
|
|
174
174
|
| `E_REQUEST_ID_REUSED` | 同一 root request ID 被不同 exact request bytes 使用 |
|
|
175
175
|
| `E_TOOL_COMPLETION_PROOF_INVALID` | Tool 返回值不满足其 completion contract 或 proof 校验 |
|
package/docs/extensions.md
CHANGED
|
@@ -10,23 +10,21 @@
|
|
|
10
10
|
|
|
11
11
|
### Bridge 包安装
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Bridge 与 AI Skill 是两个独立安装对象。先用安装协议发现并选择项目,再单独安装或检查 Bridge:
|
|
14
14
|
|
|
15
15
|
```powershell
|
|
16
|
-
|
|
17
|
-
unitycli init
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
unitycli init --project C:\path\MyProject --pkg-only
|
|
21
|
-
|
|
22
|
-
# 检查安装状态
|
|
23
|
-
unitycli init --check --project C:\path\MyProject
|
|
16
|
+
unitycli init help
|
|
17
|
+
unitycli init discover
|
|
18
|
+
unitycli init package --project C:\path\UnityProject
|
|
19
|
+
unitycli init package --project C:\path\UnityProject --check
|
|
24
20
|
```
|
|
25
21
|
|
|
26
|
-
安装内容:
|
|
27
|
-
- `Packages/com.alpsckr.unitycli/` — Bridge 包(copy 模式)
|
|
28
|
-
- `Packages/unitycli.install.json` — 安装元数据(项目 hash
|
|
29
|
-
-
|
|
22
|
+
Bridge 安装内容:
|
|
23
|
+
- `Packages/com.alpsckr.unitycli/` — canonical Bridge 包(copy 模式)
|
|
24
|
+
- `Packages/unitycli.install.json` — 安装元数据(项目 hash、source hash、managed-file hash、版本与支持范围)
|
|
25
|
+
- `Packages/com.alpsckr.unitycli/unitycli.files.json` — 受管文件路径清单
|
|
26
|
+
|
|
27
|
+
Skill 使用`init skill`安装到用户选择的`.agents`或Claude workspace/user目标,不属于Unity项目Package安装。
|
|
30
28
|
|
|
31
29
|
### 项目能力发现
|
|
32
30
|
|
|
@@ -13,12 +13,12 @@ CLI 只接受本机可证明的 Unity 项目目录。目录大小写、尾分隔
|
|
|
13
13
|
```powershell
|
|
14
14
|
unitycli instances list
|
|
15
15
|
unitycli instances list --all
|
|
16
|
-
unitycli instances prune
|
|
16
|
+
unitycli instances prune --instance <id|projectPath|alias>
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
`instances list` 默认排除 `status="offline"` 的记录;存在隐藏项时返回 `hiddenOfflineCount`。只有需要审计历史/offline identity 时使用 `--all`,此时返回完整合法集合并省略 `hiddenOfflineCount`。每项公开字段固定为 `instanceId`、可选 `alias`、`canonicalProjectPath`、`displayProjectPath`、`projectName`、`status` 和可选 `unityVersion`;`--all` 不会恢复内部 session、快照、进程 claim 或诊断字段。
|
|
20
20
|
|
|
21
|
-
实例目录按文件独立验证。旧格式、损坏、不可读或identity不匹配的记录不参与列表和路由,也不阻断其他合法Registry v3
|
|
21
|
+
实例目录按文件独立验证。旧格式、损坏、不可读或identity不匹配的记录不参与列表和路由,也不阻断其他合法Registry v3实例;`instances list`存在这类文件时返回`invalidRecordCount`。当前项目的Unity在启动或重载完成后会使用当前进程和连接重建自己的记录;CLI在能够证明目标Unity正在运行时等待该结果。不要兼容解析、转换、移动或手工删除内部记录。
|
|
22
22
|
|
|
23
23
|
实例状态:
|
|
24
24
|
|
|
@@ -32,7 +32,7 @@ unitycli instances prune
|
|
|
32
32
|
| `offline` | 该项目没有已证明存活的Editor session |
|
|
33
33
|
| `conflict` | 至少两个已验证live process claim同属该project identity |
|
|
34
34
|
|
|
35
|
-
`instances prune
|
|
35
|
+
`instances prune --instance <id|projectPath|alias>`只授权选定的当前Unity执行有界历史清理,CLI本身不删除记录。Unity保留当前、存活、无法确认、链接或被占用的记录;关闭记录最多保留最近100个,损坏记录最多保留最近20个,30天前的记录优先清理。每次最多检查2000个、删除20个。结果中的`removed`、`remaining`、`deferred`、`scanned`和`truncated`描述本次真实结果;`deferred>0`时可在当前清理完成后再次调用。
|
|
36
36
|
|
|
37
37
|
不要读取 registry 文件、listener ID、端口或 URL,也不要直接调用 Bridge HTTP。transport binding 是 session supervisor 的内部职责。
|
|
38
38
|
|
|
@@ -44,6 +44,8 @@ Tool discovery、describe、`tools run`与`command`使用同一严格选择规
|
|
|
44
44
|
2. 未传 selector 时,从 CWD 向上寻找最近的 Unity project root,并解析其 canonical identity。
|
|
45
45
|
3. 无法得到唯一项目身份时返回结构化 instance error。
|
|
46
46
|
|
|
47
|
+
目标项目已有唯一Unity进程但尚未发布记录、正在编译/导入/重载或正在更换连接时,CLI会在原命令截止时间内等待;Unity没有运行时不会进行无意义的完整等待。完整instance ID无法反推出项目路径,因此显式ID会直接等待其固定记录直到截止时间。
|
|
48
|
+
|
|
47
49
|
不存在按PID、短hash、单个存活Editor或任意健康实例自动选取的路径。只有至少两个已验证live process claim才返回`E_INSTANCE_CONFLICT`;权限失败、超时或PID/start/project identity无法证明时返回`E_INSTANCE_UNVERIFIABLE`。选定项目已证明无运行进程时返回`E_INSTANCE_NOT_RUNNING`。
|
|
48
50
|
|
|
49
51
|
```powershell
|
|
@@ -70,7 +72,7 @@ alias 绑定完整 `instanceId`、canonical project path 和 canonicalization ve
|
|
|
70
72
|
|
|
71
73
|
- 每个Editor或Development Player session独立维护默认5/3高低水位,不跨进程共享计数;
|
|
72
74
|
- 对一次transport尝试绑定listener generation;
|
|
73
|
-
-
|
|
75
|
+
- 首次记录尚未出现或在compile、import、domain reload、listener restart期间,等待当前ready generation,但不刷新execution deadline;
|
|
74
76
|
- 同一次mutation调用只在`editorSessionId`未改变时,使用完全相同的root request ID与request bytes续接durable canonical terminal;
|
|
75
77
|
- 首次mutation POST后若`editorSessionId`改变,禁止向新session再次POST,返回`E_EXECUTION_TIMEOUT`与outcome unknown;
|
|
76
78
|
- 准入deadline到达返回effect-before `E_UNITY_BUSY`并证明业务请求未发送;
|
package/docs/tool-discovery.md
CHANGED
|
@@ -17,7 +17,7 @@ unitycli tools group --instance <id|projectPath|alias>
|
|
|
17
17
|
|
|
18
18
|
```text
|
|
19
19
|
tools group
|
|
20
|
-
-> tools group list <group>
|
|
20
|
+
-> tools group list <group> [--page-size <n>] [--cursor <n>]
|
|
21
21
|
-> tools describe <tool>
|
|
22
22
|
-> tools run <tool> --input '<json>'
|
|
23
23
|
```
|
|
@@ -35,24 +35,26 @@ unitycli tools group --instance my-project
|
|
|
35
35
|
|
|
36
36
|
### `tools group list`
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
按名称稳定排序并返回一个真实分组中的 Tool 摘要页。默认 `pageSize=20`,最大 100:
|
|
39
39
|
|
|
40
40
|
```powershell
|
|
41
|
-
unitycli tools group list camera
|
|
42
|
-
unitycli tools group list probuilder --instance my-project
|
|
41
|
+
unitycli tools group list camera --page-size 20
|
|
42
|
+
unitycli tools group list probuilder --page-size 20 --cursor 20 --instance my-project
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
分组名称必须来自当前实例的`tools group`输出,不要假设项目能力都位于`custom
|
|
45
|
+
分组名称必须来自当前实例的`tools group`输出,不要假设项目能力都位于`custom`分组。每个`tools[].name`已经是完整精确调用名,group只用于筛选,绝不能拼到name前;`available`仅在不可用时以`false`出现。存在`pageInfo.nextCursor`时,将其原值传回`--cursor`继续读取。
|
|
46
46
|
|
|
47
47
|
### `tools search`
|
|
48
48
|
|
|
49
|
-
按名称、summary、description 和 group
|
|
49
|
+
按名称、summary、description 和 group 搜索当前实例完整目录,并只返回名称、summary、group组成的有界页。默认 `pageSize=20`,最大 100:
|
|
50
50
|
|
|
51
51
|
```powershell
|
|
52
|
-
unitycli tools search 'screenshot|camera'
|
|
53
|
-
unitycli tools search 'project-summary|scene' --instance my-project
|
|
52
|
+
unitycli tools search 'screenshot|camera' --page-size 20
|
|
53
|
+
unitycli tools search 'project-summary|scene' --page-size 20 --cursor 20 --instance my-project
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
结果按精确 Tool name 排序;存在`pageInfo.nextCursor`时,将其原值传回同一关键词查询的`--cursor`。
|
|
57
|
+
|
|
56
58
|
### `tools describe`
|
|
57
59
|
|
|
58
60
|
执行前读取单个 Tool 的完整 descriptor:
|
|
@@ -74,7 +76,7 @@ unitycli tools describe camera.screenshot
|
|
|
74
76
|
| `requiresPackages` | 非空 Unity Package 依赖 |
|
|
75
77
|
| `examples` | `description`、结构化业务 `input` 与按需 `execution` |
|
|
76
78
|
|
|
77
|
-
`group
|
|
79
|
+
`group`和`summary`已在发现层使用,不在单 Tool describe重复;`source`、`outputSchema`、`permissions`、fingerprint、completion 和 handler 只保留在内部 metadata。
|
|
78
80
|
|
|
79
81
|
## 完整目录语义
|
|
80
82
|
|
|
@@ -86,7 +88,7 @@ unitycli tools describe camera.screenshot
|
|
|
86
88
|
|
|
87
89
|
1. 用 `instances list` 确认 canonical project identity,或切换到目标 Unity 项目 CWD。
|
|
88
90
|
2. 用 `tools group` 读取当前实例目录。
|
|
89
|
-
3. 用 `tools group list`、`tools search '<k1|k2|...>'`
|
|
91
|
+
3. 用 `tools group list`、`tools search '<k1|k2|...>'` 缩小范围,并消费完所需的`pageInfo.nextCursor`页面。
|
|
90
92
|
4. 用 `tools describe` 获取 schema、状态约束、副作用和示例。
|
|
91
93
|
5. 用 `tools run` 调用同一名称。
|
|
92
94
|
6. 安装 Package、安装 Extension、domain reload 或切换 PlayMode 后重新 discovery。
|
package/docs/tool-execution.md
CHANGED
|
@@ -58,7 +58,7 @@ unitycli tools run camera.screenshot --input '{}'
|
|
|
58
58
|
|
|
59
59
|
## Bridge 执行约束
|
|
60
60
|
|
|
61
|
-
Bridge-backed Tool由Unity Editor
|
|
61
|
+
Bridge-backed Tool由Unity Editor主线程执行。业务请求发送前,session supervisor会在准入deadline内等待首次ready记录、compile、import、domain reload和listener generation交接;只有能证明目标Unity正在运行时才等待,证明未运行时立即返回。准入放行后只创建一次execution absolute deadline,token重取、status、rebind和terminal recovery不得刷新预算。读取可在新generation重新执行完整读取;mutation只有在`editorSessionId`未改变时才可用完全相同的request bytes续接durable terminal。
|
|
62
62
|
|
|
63
63
|
首次mutation POST后若Editor session改变,CLI禁止向新session再次POST,并返回`E_EXECUTION_TIMEOUT`、`outcome:unknown`。其他超时或终态前断连同样表示没有可信终态;调用方应先用业务读取或`editor.state`收集证据,再决定是否提交全新请求。`editor.state`使用frozen本地descriptor绕过被阻断的Live catalog,再读取Registry/Health v3、内存主线程pulse、Bridge和Windows modal证据;两个dialog recovery Tool保持同一例外,其他Tool不建立静态fallback。
|
|
64
64
|
|
|
@@ -96,7 +96,8 @@ unitycli tools run asset.delete --input '{"path":"Assets/Temp.mat"}'
|
|
|
96
96
|
|
|
97
97
|
通用规则:
|
|
98
98
|
|
|
99
|
-
-
|
|
99
|
+
- discovery 的 `tools group list`、`tools search` 和省略name的`command`列表默认每页20项、最大100项;继续读取时将`pageInfo.nextCursor`原值传回CLI `--cursor`。
|
|
100
|
+
- 业务列表/层级工具优先传 JSON `pageSize`、`cursor`、`parent`、`query`、`componentType` 或 `className`。继续读取时将输出里的 `pageInfo.nextCursor` 原值传回 `cursor`;两者保持相同 JSON 类型。`hasMore`、`truncated` 或 `childrenTruncated` 表示还有更深或更多内容。
|
|
100
101
|
- 深度序列化工具(`object.get-data`、`asset.get-data`、`component.get`)优先传 `paths` 或 `viewQuery`,并保持 `maxDepth` 较低。数组、列表和字典受 `maxArrayItems` 限制;输出里的 `totalCount`、`returnedCount`、`truncated`、`nextPath` 用于判断是否需要继续按路径读取。CLR 的 `NaN`、正无穷和负无穷无法作为 JSON number,会在 AnyJson 值节点中分别表示为字符串 `"NaN"`、`"Infinity"`、`"-Infinity"`。
|
|
101
102
|
- 文本源码工具(如 `shader.read`)使用 `offset` 和 `maxBytes` 分段读取。输出 `truncated=true` 时,下一次把 `nextOffset` 作为新的 `offset`。
|
|
102
103
|
- 截图和相机工具默认返回 artifact 路径。只有确实需要内联图片时才传 `inlineBase64:true`;图片超过 Bridge 内联上限时会省略 `imageBase64` 并返回 warning,继续使用 artifact 路径。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpsckr/unitycli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Windows-first CLI for UnityCLI automation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
21
21
|
"generate:extensions": "node scripts/gen-extension-projections.mjs",
|
|
22
22
|
"generate:registries": "node scripts/gen-ts-registries.mjs && node scripts/gen-tool-completion-registry.mjs",
|
|
23
|
-
"
|
|
24
|
-
"build
|
|
23
|
+
"generate:package-files": "node scripts/gen-package-files.mjs",
|
|
24
|
+
"build": "npm run clean && npm run generate:extensions && npm run generate:registries && tsc -p tsconfig.json && node scripts/gen-command-contract.mjs && node scripts/gen-protocol.mjs && node scripts/gen-tool-schemas.mjs && npm run generate:registries && npm run generate:package-files && npm run package-closure:validate && npm run init-contract:validate && npm run instances-contract:validate && tsc -p tsconfig.json",
|
|
25
|
+
"build:test": "npm run clean && npm run generate:extensions && npm run generate:registries && tsc -p tsconfig.test.json && node scripts/gen-command-contract.mjs && node scripts/gen-protocol.mjs && node scripts/gen-tool-schemas.mjs && npm run generate:registries && npm run generate:package-files && npm run package-closure:validate && npm run init-contract:validate && npm run instances-contract:validate && tsc -p tsconfig.test.json && node scripts/copy-test-resources.cjs && tsc -p tsconfig.json",
|
|
25
26
|
"test": "node --test \"dist/tests/**/*.test.js\"",
|
|
26
27
|
"pretest": "npm run build:test",
|
|
27
28
|
"prepack": "npm run build",
|
|
@@ -29,7 +30,12 @@
|
|
|
29
30
|
"architecture:audit": "node scripts/audit-final-architecture.mjs",
|
|
30
31
|
"static-catalog:audit": "node scripts/audit-static-capability-catalog.mjs",
|
|
31
32
|
"static-catalog:capture": "node scripts/capture-static-capability-catalog.mjs",
|
|
32
|
-
"architecture:validate": "node scripts/audit-final-architecture.mjs --strict && node scripts/audit-tool-completion-contract.mjs --strict && node scripts/audit-static-capability-catalog.mjs",
|
|
33
|
+
"architecture:validate": "npm run package-closure:validate && npm run init-contract:validate && npm run instances-contract:validate && node scripts/audit-final-architecture.mjs --strict && node scripts/audit-tool-completion-contract.mjs --strict && node scripts/audit-static-capability-catalog.mjs",
|
|
34
|
+
"init-contract:validate": "node scripts/audit-init-contract.mjs",
|
|
35
|
+
"instances-contract:validate": "node scripts/audit-instances-contract.mjs",
|
|
36
|
+
"instances-live:validate": "node scripts/validation/validate-instance-concurrent-readers.mjs && node scripts/validation/validate-instance-dual-writer.mjs && node scripts/validation/validate-instance-multi-cli.mjs && node scripts/validation/validate-instance-multi-prune.mjs",
|
|
37
|
+
"package-files:validate": "node scripts/audit-package-files.mjs",
|
|
38
|
+
"package-closure:validate": "node scripts/audit-package-assembly-closure.mjs && npm run package-files:validate",
|
|
33
39
|
"completion:audit": "node scripts/audit-tool-completion-contract.mjs --strict",
|
|
34
40
|
"matrix:live": "node scripts/run-final-live-matrix.mjs",
|
|
35
41
|
"test:matrix-runner": "node --test scripts/run-final-live-matrix.test.mjs",
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://alpsckr.dev/unitycli/schemas/init.schema.json",
|
|
4
|
+
"title": "UnityCLI init envelope",
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"ok": { "const": true },
|
|
10
|
+
"requestId": { "type": "string", "minLength": 1 },
|
|
11
|
+
"data": {
|
|
12
|
+
"oneOf": [
|
|
13
|
+
{ "$ref": "#/$defs/helpData" },
|
|
14
|
+
{ "$ref": "#/$defs/discoverData" },
|
|
15
|
+
{ "$ref": "#/$defs/packageData" },
|
|
16
|
+
{ "$ref": "#/$defs/skillData" }
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"required": ["ok", "requestId", "data"],
|
|
21
|
+
"additionalProperties": false
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"ok": { "const": false },
|
|
27
|
+
"requestId": { "type": "string", "minLength": 1 },
|
|
28
|
+
"error": { "$ref": "#/$defs/error" }
|
|
29
|
+
},
|
|
30
|
+
"required": ["ok", "requestId", "error"],
|
|
31
|
+
"additionalProperties": false
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"$defs": {
|
|
35
|
+
"nextActions": { "type": "array", "items": { "type": "string" } },
|
|
36
|
+
"sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
37
|
+
"error": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"properties": {
|
|
40
|
+
"code": { "type": "string", "minLength": 1 },
|
|
41
|
+
"message": { "type": "string", "minLength": 1 },
|
|
42
|
+
"nextActions": { "$ref": "#/$defs/nextActions" },
|
|
43
|
+
"transient": { "type": "boolean" },
|
|
44
|
+
"retryAfterMs": { "type": "number", "minimum": 0 },
|
|
45
|
+
"details": { "x-unityCliAnyJson": true }
|
|
46
|
+
},
|
|
47
|
+
"required": ["code", "message", "nextActions", "transient", "retryAfterMs"],
|
|
48
|
+
"additionalProperties": false
|
|
49
|
+
},
|
|
50
|
+
"helpData": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"properties": {
|
|
53
|
+
"action": { "const": "init_help" },
|
|
54
|
+
"audience": { "const": "ai" },
|
|
55
|
+
"protocolVersion": { "type": "integer", "minimum": 1 },
|
|
56
|
+
"aiInstructions": { "type": "array", "minItems": 1, "items": { "type": "string" } },
|
|
57
|
+
"commands": { "type": "object", "additionalProperties": { "type": "string" } },
|
|
58
|
+
"nextCommand": { "type": "string" },
|
|
59
|
+
"nextActions": { "$ref": "#/$defs/nextActions" }
|
|
60
|
+
},
|
|
61
|
+
"required": ["action", "audience", "protocolVersion", "aiInstructions", "commands", "nextCommand", "nextActions"],
|
|
62
|
+
"additionalProperties": false
|
|
63
|
+
},
|
|
64
|
+
"discoverData": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"properties": {
|
|
67
|
+
"action": { "const": "init_discover" },
|
|
68
|
+
"cwd": { "type": "string" },
|
|
69
|
+
"repositoryRoot": { "type": ["string", "null"] },
|
|
70
|
+
"limits": { "type": "object" },
|
|
71
|
+
"scan": { "type": "object" },
|
|
72
|
+
"unityProjects": { "type": "array" },
|
|
73
|
+
"skillWorkspaces": { "type": "array" },
|
|
74
|
+
"skillCopies": { "type": "array" },
|
|
75
|
+
"shadowingRisks": { "type": "array" },
|
|
76
|
+
"requiredDecisions": { "type": "array", "minItems": 4 },
|
|
77
|
+
"nextActions": { "$ref": "#/$defs/nextActions" }
|
|
78
|
+
},
|
|
79
|
+
"required": ["action", "cwd", "repositoryRoot", "limits", "scan", "unityProjects", "skillWorkspaces", "skillCopies", "shadowingRisks", "requiredDecisions", "nextActions"],
|
|
80
|
+
"additionalProperties": false
|
|
81
|
+
},
|
|
82
|
+
"packageData": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"properties": {
|
|
85
|
+
"action": { "enum": ["init_package", "init_package_check"] },
|
|
86
|
+
"projectPath": { "type": "string" },
|
|
87
|
+
"projectIdentity": { "type": "object" },
|
|
88
|
+
"package": {
|
|
89
|
+
"type": "object",
|
|
90
|
+
"properties": { "status": { "enum": ["installed", "missing", "damaged", "drifted", "conflict"] } },
|
|
91
|
+
"required": ["status"]
|
|
92
|
+
},
|
|
93
|
+
"nextActions": { "$ref": "#/$defs/nextActions" }
|
|
94
|
+
},
|
|
95
|
+
"required": ["action", "projectPath", "package", "nextActions"],
|
|
96
|
+
"additionalProperties": false
|
|
97
|
+
},
|
|
98
|
+
"skillData": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"properties": {
|
|
101
|
+
"action": { "enum": ["init_skill", "init_skill_check"] },
|
|
102
|
+
"agent": { "enum": [".agents", "claude"] },
|
|
103
|
+
"scope": { "enum": ["workspace", "user"] },
|
|
104
|
+
"workspace": { "type": "string" },
|
|
105
|
+
"changes": { "type": "array" },
|
|
106
|
+
"skill": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"properties": {
|
|
109
|
+
"status": { "enum": ["installed", "missing", "drifted", "damaged"] },
|
|
110
|
+
"targetPath": { "type": "string" },
|
|
111
|
+
"sourceHash": { "$ref": "#/$defs/sha256" },
|
|
112
|
+
"hash": { "$ref": "#/$defs/sha256" },
|
|
113
|
+
"message": { "type": "string" }
|
|
114
|
+
},
|
|
115
|
+
"required": ["status", "targetPath", "sourceHash"],
|
|
116
|
+
"additionalProperties": false
|
|
117
|
+
},
|
|
118
|
+
"nextActions": { "$ref": "#/$defs/nextActions" }
|
|
119
|
+
},
|
|
120
|
+
"required": ["action", "agent", "scope", "skill", "nextActions"],
|
|
121
|
+
"additionalProperties": false
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://alpsckr.dev/unitycli/schemas/instances.schema.json",
|
|
4
|
+
"title": "UnityCLI instances envelope",
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{ "$ref": "#/$defs/listSuccess" },
|
|
7
|
+
{ "$ref": "#/$defs/pruneSuccess" },
|
|
8
|
+
{ "$ref": "#/$defs/errorEnvelope" }
|
|
9
|
+
],
|
|
10
|
+
"$defs": {
|
|
11
|
+
"instanceSummary": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"instanceId": { "type": "string", "pattern": "^unity-[a-f0-9]{64}$" },
|
|
15
|
+
"canonicalProjectPath": { "type": "string", "minLength": 3 },
|
|
16
|
+
"displayProjectPath": { "type": "string", "minLength": 3 },
|
|
17
|
+
"projectName": { "type": "string", "minLength": 1 },
|
|
18
|
+
"status": { "enum": ["ready", "transitioning", "blocked", "unresponsive", "unverifiable", "offline", "conflict"] },
|
|
19
|
+
"unityVersion": { "type": "string", "minLength": 1 },
|
|
20
|
+
"alias": { "type": "string", "minLength": 1 }
|
|
21
|
+
},
|
|
22
|
+
"required": ["instanceId", "canonicalProjectPath", "displayProjectPath", "projectName", "status"],
|
|
23
|
+
"additionalProperties": false
|
|
24
|
+
},
|
|
25
|
+
"listData": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"instances": { "type": "array", "items": { "$ref": "#/$defs/instanceSummary" } },
|
|
29
|
+
"hiddenOfflineCount": { "type": "integer", "minimum": 0 },
|
|
30
|
+
"invalidRecordCount": { "type": "integer", "minimum": 1 }
|
|
31
|
+
},
|
|
32
|
+
"required": ["instances"],
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
},
|
|
35
|
+
"retention": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"properties": {
|
|
38
|
+
"offlineMax": { "const": 100 },
|
|
39
|
+
"damagedMax": { "const": 20 },
|
|
40
|
+
"maxAgeDays": { "const": 30 },
|
|
41
|
+
"scanLimit": { "const": 2000 },
|
|
42
|
+
"deleteLimit": { "const": 20 }
|
|
43
|
+
},
|
|
44
|
+
"required": ["offlineMax", "damagedMax", "maxAgeDays", "scanLimit", "deleteLimit"],
|
|
45
|
+
"additionalProperties": false
|
|
46
|
+
},
|
|
47
|
+
"pruneData": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {
|
|
50
|
+
"removed": { "type": "integer", "minimum": 0 },
|
|
51
|
+
"remaining": { "type": "integer", "minimum": 0 },
|
|
52
|
+
"deferred": { "type": "integer", "minimum": 0 },
|
|
53
|
+
"scanned": { "type": "integer", "minimum": 0, "maximum": 2000 },
|
|
54
|
+
"truncated": { "type": "boolean" },
|
|
55
|
+
"retention": { "$ref": "#/$defs/retention" }
|
|
56
|
+
},
|
|
57
|
+
"required": ["removed", "remaining", "deferred", "scanned", "truncated", "retention"],
|
|
58
|
+
"additionalProperties": false
|
|
59
|
+
},
|
|
60
|
+
"error": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"properties": {
|
|
63
|
+
"code": { "type": "string", "minLength": 1 },
|
|
64
|
+
"message": { "type": "string", "minLength": 1 },
|
|
65
|
+
"nextActions": { "type": "array", "items": { "type": "string" } },
|
|
66
|
+
"transient": { "type": "boolean" },
|
|
67
|
+
"retryAfterMs": { "type": "number", "minimum": 0 },
|
|
68
|
+
"details": { "x-unityCliAnyJson": true }
|
|
69
|
+
},
|
|
70
|
+
"required": ["code", "message", "nextActions", "transient", "retryAfterMs"],
|
|
71
|
+
"additionalProperties": false
|
|
72
|
+
},
|
|
73
|
+
"listSuccess": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"properties": {
|
|
76
|
+
"ok": { "const": true },
|
|
77
|
+
"requestId": { "type": "string", "minLength": 1 },
|
|
78
|
+
"data": { "$ref": "#/$defs/listData" }
|
|
79
|
+
},
|
|
80
|
+
"required": ["ok", "requestId", "data"],
|
|
81
|
+
"additionalProperties": false
|
|
82
|
+
},
|
|
83
|
+
"pruneSuccess": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"properties": {
|
|
86
|
+
"ok": { "const": true },
|
|
87
|
+
"requestId": { "type": "string", "minLength": 1 },
|
|
88
|
+
"data": { "$ref": "#/$defs/pruneData" }
|
|
89
|
+
},
|
|
90
|
+
"required": ["ok", "requestId", "data"],
|
|
91
|
+
"additionalProperties": false
|
|
92
|
+
},
|
|
93
|
+
"errorEnvelope": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"properties": {
|
|
96
|
+
"ok": { "const": false },
|
|
97
|
+
"requestId": { "type": "string", "minLength": 1 },
|
|
98
|
+
"error": { "$ref": "#/$defs/error" }
|
|
99
|
+
},
|
|
100
|
+
"required": ["ok", "requestId", "error"],
|
|
101
|
+
"additionalProperties": false
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
package/skills/unitycli/SKILL.md
CHANGED
|
@@ -19,25 +19,37 @@ FeedbackMode: off
|
|
|
19
19
|
- 已连接实例的目录同时包含 built-in、Extension、project、Editor 和 Runtime 能力,不按 `source` 或当前模式过滤。
|
|
20
20
|
- 完全兼容 Unity 官方 CLI 特性体系:项目与第三方 Package 中以官方 `[CliCommand]`/`[CliArg]`/`IStructuredCommandInput` 声明的命令直接进入同一 catalog,固定投影为 `UnityPipeline_<原名>`、group `UnityPipeline`,用 `command <原名>` 或完整前缀名调用;`com.unity.pipeline` 包自身命令已由 native 能力吸收并按 provider identity 抑制。native 精确重名优先。
|
|
21
21
|
|
|
22
|
+
## 安装协议
|
|
23
|
+
|
|
24
|
+
当用户要求安装、配置、检查或修复 UnityCLI 时,唯一学习入口是:
|
|
25
|
+
|
|
26
|
+
```powershell
|
|
27
|
+
unitycli init help
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
严格执行返回的版本化`aiInstructions`,不要依赖本Skill记忆安装步骤。先运行`init discover`,再向用户询问要安装Bridge的Unity项目,以及Skill的agent、scope和常用workspace;不得静默选择。多个Bridge项目逐个严格串行安装,每次等待terminal并执行对应`--check`后才能继续;Skill通常只安装到用户选择的一个`.agents`或Claude workspace/user目标。第一次非预期CLI失败或业务check失败立即停止,不重试、纠参或继续后续effect。安装流程不得启动、关闭、重启或终止Unity Editor。用户完成选择后的明确安装调用即授权,不增加第二次确认。
|
|
31
|
+
|
|
22
32
|
## 执行骨架
|
|
23
33
|
|
|
24
34
|
```powershell
|
|
25
35
|
# 默认隐藏 offline;仅审计完整历史集合时使用 instances list --all
|
|
26
36
|
unitycli instances list
|
|
37
|
+
# 仅需清理历史记录时,授权选定的当前Unity执行有界prune
|
|
38
|
+
unitycli instances prune --instance <id|projectPath|alias>
|
|
27
39
|
unitycli tools group --instance <id|projectPath|alias>
|
|
28
|
-
unitycli tools group list <group> --instance <id|projectPath|alias>
|
|
29
|
-
unitycli tools search '<k1|k2|...>' --instance <id|projectPath|alias>
|
|
40
|
+
unitycli tools group list <group> --page-size 20 --instance <id|projectPath|alias>
|
|
41
|
+
unitycli tools search '<k1|k2|...>' --page-size 20 --instance <id|projectPath|alias>
|
|
30
42
|
unitycli tools describe <tool> --instance <id|projectPath|alias>
|
|
31
43
|
unitycli tools run <tool> --input '<json>' --instance <id|projectPath|alias>
|
|
32
44
|
|
|
33
45
|
# 同一catalog的schema参数调用;省略name时列出command投影
|
|
34
|
-
unitycli command --project-path <projectPath>
|
|
46
|
+
unitycli command --project-path <projectPath> --page-size 20
|
|
35
47
|
unitycli command <name> --field <value> --instance <id|projectPath|alias>
|
|
36
48
|
```
|
|
37
49
|
|
|
38
|
-
显式`--instance`优先;`command --project-path <path>`绑定同一canonical项目实例;未传时只能从当前Unity项目CWD解析。没有连接实例时discovery返回稳定instance error,不返回静态或空目录。`instances list
|
|
50
|
+
显式`--instance`优先;`command --project-path <path>`绑定同一canonical项目实例;未传时只能从当前Unity项目CWD解析。没有连接实例时discovery返回稳定instance error,不返回静态或空目录。`instances list`逐文件隔离旧格式、损坏或不可读记录,合法实例继续返回,并用`invalidRecordCount`报告隔离数量;当前项目由Unity在ready时自动重建。需要清理历史记录时调用`instances prune --instance <id|projectPath|alias>`并检查`removed`、`remaining`、`deferred`,不得读取、转换、移动或手工删除内部记录。
|
|
39
51
|
|
|
40
|
-
执行不了解的Tool前必须`tools describe`,输入和行为以当前descriptor为准。PowerShell中必须用单引号包住`tools search '<k1|k2|...>'`的整个关键词,否则`|`会被shell解释为管道。schema default 与 `examples[].input` 描述合法默认业务值,按需 `examples[].execution` 描述 dry-run/timeout 控制;任务明确要求的业务值优先,不能把default/example当作连通性或probe调用。`tools group list
|
|
52
|
+
执行不了解的Tool前必须`tools describe`,输入和行为以当前descriptor为准。PowerShell中必须用单引号包住`tools search '<k1|k2|...>'`的整个关键词,否则`|`会被shell解释为管道。schema default 与 `examples[].input` 描述合法默认业务值,按需 `examples[].execution` 描述 dry-run/timeout 控制;任务明确要求的业务值优先,不能把default/example当作连通性或probe调用。`tools group list`、`tools search`和省略name的`command`列表默认20项、最大100项;需要更多时把`pageInfo.nextCursor`原值传回`--cursor`。返回的Tool `name`就是exact调用名;group只用于筛选,不能拼到name前。stdout默认是单行紧凑JSON,只有显式`--pretty`才缩进。
|
|
41
53
|
|
|
42
54
|
`command`不建立第二套目录:native Tool使用完整精确名;Unity官方`[CliCommand]`完全兼容,项目或其他Package的`[CliCommand("test")]`在`tools`中固定名为`UnityPipeline_test`、group为`UnityPipeline`,可由`command test`或完整前缀名选择。`com.unity.pipeline` package自身命令已由native能力吸收并按provider identity抑制,不应期待其attribute原名存在。native精确重名优先;不得把不存在的名称映射到相似Tool。业务参数支持`--field value`、`--field=value`、boolean裸开关和按schema声明顺序的positional。
|
|
43
55
|
|
|
@@ -45,7 +57,7 @@ unitycli command <name> --field <value> --instance <id|projectPath|alias>
|
|
|
45
57
|
|
|
46
58
|
- 调用即授权。`destructiveHint`、`sideEffects`、`supportsDryRun`只描述效果;仅在确需预览时使用`--dry-run`。Skill不增加确认、意图复核或预定义操作范围;产品的cross-session mutation fence仍必须遵守。
|
|
47
59
|
- 建议通过 `instances`、`doctor`、`tools run editor.state` 观察状态,不读取内部 Bridge 注册文件、端口或 URL,也不直接 ping transport。
|
|
48
|
-
- CLI会在发送Unity
|
|
60
|
+
- CLI会在发送Unity业务请求前自行等待首次ready记录、编译/导入/重载完成和target session任务池放行;不得手工每100毫秒循环调用,也不得读取或操作内部状态。`--timeout-ms T`分别提供最多`T`的准入等待与放行后最多`T`的业务执行。
|
|
49
61
|
- 准入deadline返回的`E_UNITY_BUSY`会明确证明`no business request was sent`,effect未开始,可以稍后提交新root。已进入池后的mutation lease busy不得解释为effect未开始。
|
|
50
62
|
- `E_EXECUTION_TIMEOUT`、放行后连接丢失或缺少可信terminal envelope只表示没有可信终态。先用只读Tool或业务readback观察并形成新的业务决策;CLI不自动重放,首次mutation POST后Editor session改变时也不会向新session重投。`transient:true`与`nextActions`仍是建议,不构成额外授权门。
|
|
51
63
|
- 运行公开CLI时必须等待该进程退出,不得后台分离。传入`--timeout-ms T`时,命令host至少等待`2 * T + 5000`毫秒;CLI在stdout完成或最多1秒后退出。host提前超时不等于CLI、准入grant或Unity effect已经停止。
|