@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
|
@@ -0,0 +1,209 @@
|
|
|
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": { "const": 2 },
|
|
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
|
+
"unityProjects": {
|
|
71
|
+
"type": "array",
|
|
72
|
+
"items": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"properties": {
|
|
75
|
+
"path": { "type": "string" },
|
|
76
|
+
"unityVersion": { "type": "string" },
|
|
77
|
+
"relation": { "enum": ["cwd", "ancestor", "descendant"] },
|
|
78
|
+
"depth": { "type": "integer", "minimum": 0 },
|
|
79
|
+
"bridge": {
|
|
80
|
+
"type": "object",
|
|
81
|
+
"properties": {
|
|
82
|
+
"status": { "enum": ["installed", "missing", "damaged", "drifted", "conflict", "unverifiable", "not-inspected"] },
|
|
83
|
+
"installedVersion": { "type": "string" },
|
|
84
|
+
"availableVersion": { "type": "string" },
|
|
85
|
+
"reasonCode": { "type": "string" },
|
|
86
|
+
"message": { "type": "string" }
|
|
87
|
+
},
|
|
88
|
+
"required": ["status"],
|
|
89
|
+
"additionalProperties": false
|
|
90
|
+
},
|
|
91
|
+
"editor": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"properties": {
|
|
94
|
+
"status": { "enum": ["running", "stopped", "unverifiable", "not-inspected"] },
|
|
95
|
+
"processCount": { "type": "integer", "minimum": 0 },
|
|
96
|
+
"message": { "type": "string" }
|
|
97
|
+
},
|
|
98
|
+
"required": ["status"],
|
|
99
|
+
"additionalProperties": false
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"required": ["path", "unityVersion", "relation", "depth", "bridge", "editor"],
|
|
103
|
+
"additionalProperties": false
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"skill": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"properties": {
|
|
109
|
+
"workspace": { "type": "string" },
|
|
110
|
+
"recommendedTarget": { "type": "string" },
|
|
111
|
+
"explicitTargetSupported": { "const": true },
|
|
112
|
+
"status": { "enum": ["installed", "missing", "drifted", "damaged"] },
|
|
113
|
+
"targetPath": { "type": "string" },
|
|
114
|
+
"sourceHash": { "$ref": "#/$defs/sha256" },
|
|
115
|
+
"hash": { "$ref": "#/$defs/sha256" },
|
|
116
|
+
"message": { "type": "string" }
|
|
117
|
+
},
|
|
118
|
+
"required": ["workspace", "recommendedTarget", "explicitTargetSupported", "status", "targetPath", "sourceHash"],
|
|
119
|
+
"additionalProperties": false
|
|
120
|
+
},
|
|
121
|
+
"requiredDecisions": {
|
|
122
|
+
"type": "array",
|
|
123
|
+
"items": {
|
|
124
|
+
"type": "object",
|
|
125
|
+
"properties": {
|
|
126
|
+
"id": { "enum": ["bridgeProjects", "closeEditor"] },
|
|
127
|
+
"question": { "type": "string" },
|
|
128
|
+
"choices": { "type": "array", "items": { "type": "string" } },
|
|
129
|
+
"projectPath": { "type": "string" },
|
|
130
|
+
"multiple": { "type": "boolean" }
|
|
131
|
+
},
|
|
132
|
+
"required": ["id", "question", "multiple"],
|
|
133
|
+
"additionalProperties": false
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"scan": {
|
|
137
|
+
"type": "object",
|
|
138
|
+
"properties": {
|
|
139
|
+
"scannedDirectories": { "type": "integer", "minimum": 0, "maximum": 2000 },
|
|
140
|
+
"truncated": { "type": "boolean" },
|
|
141
|
+
"maxDescendantDepth": { "const": 4 },
|
|
142
|
+
"maxScannedDirectories": { "const": 2000 },
|
|
143
|
+
"maxUnityProjects": { "const": 100 }
|
|
144
|
+
},
|
|
145
|
+
"required": ["scannedDirectories", "truncated", "maxDescendantDepth", "maxScannedDirectories", "maxUnityProjects"],
|
|
146
|
+
"additionalProperties": false
|
|
147
|
+
},
|
|
148
|
+
"nextActions": { "$ref": "#/$defs/nextActions" }
|
|
149
|
+
},
|
|
150
|
+
"required": ["action", "cwd", "repositoryRoot", "unityProjects", "skill", "requiredDecisions", "nextActions"],
|
|
151
|
+
"additionalProperties": false
|
|
152
|
+
},
|
|
153
|
+
"packageData": {
|
|
154
|
+
"type": "object",
|
|
155
|
+
"properties": {
|
|
156
|
+
"action": { "enum": ["init_package", "init_package_check"] },
|
|
157
|
+
"projectPath": { "type": "string" },
|
|
158
|
+
"projectIdentity": { "type": "object" },
|
|
159
|
+
"editorClose": {
|
|
160
|
+
"type": "object",
|
|
161
|
+
"properties": {
|
|
162
|
+
"status": { "enum": ["not-running", "closed"] },
|
|
163
|
+
"requested": { "type": "integer", "minimum": 0 }
|
|
164
|
+
},
|
|
165
|
+
"required": ["status", "requested"],
|
|
166
|
+
"additionalProperties": false
|
|
167
|
+
},
|
|
168
|
+
"package": {
|
|
169
|
+
"type": "object",
|
|
170
|
+
"properties": { "status": { "enum": ["installed", "missing", "damaged", "drifted", "conflict"] } },
|
|
171
|
+
"required": ["status"]
|
|
172
|
+
},
|
|
173
|
+
"nextActions": { "$ref": "#/$defs/nextActions" }
|
|
174
|
+
},
|
|
175
|
+
"required": ["action", "projectPath", "package", "nextActions"],
|
|
176
|
+
"additionalProperties": false
|
|
177
|
+
},
|
|
178
|
+
"skillData": {
|
|
179
|
+
"type": "object",
|
|
180
|
+
"properties": {
|
|
181
|
+
"action": { "enum": ["init_skill", "init_skill_check"] },
|
|
182
|
+
"agent": { "enum": [".agents", "claude"] },
|
|
183
|
+
"scope": { "enum": ["workspace", "user"] },
|
|
184
|
+
"workspace": { "type": "string" },
|
|
185
|
+
"target": { "type": "string" },
|
|
186
|
+
"changes": { "type": "array" },
|
|
187
|
+
"skill": {
|
|
188
|
+
"type": "object",
|
|
189
|
+
"properties": {
|
|
190
|
+
"status": { "enum": ["installed", "missing", "drifted", "damaged"] },
|
|
191
|
+
"targetPath": { "type": "string" },
|
|
192
|
+
"sourceHash": { "$ref": "#/$defs/sha256" },
|
|
193
|
+
"hash": { "$ref": "#/$defs/sha256" },
|
|
194
|
+
"message": { "type": "string" }
|
|
195
|
+
},
|
|
196
|
+
"required": ["status", "targetPath", "sourceHash"],
|
|
197
|
+
"additionalProperties": false
|
|
198
|
+
},
|
|
199
|
+
"nextActions": { "$ref": "#/$defs/nextActions" }
|
|
200
|
+
},
|
|
201
|
+
"required": ["action", "skill", "nextActions"],
|
|
202
|
+
"oneOf": [
|
|
203
|
+
{ "type": "object", "required": ["agent", "scope"] },
|
|
204
|
+
{ "type": "object", "required": ["target"] }
|
|
205
|
+
],
|
|
206
|
+
"additionalProperties": false
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
@@ -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`;当前目录只有一个Unity项目时直接采用,用户已经指定的项目、scope、host或Skill目录都是最终决定,不得重复询问。未指定Skill目录时使用发现结果的当前workspace推荐目标;明确目录使用`init skill --target <SkillDirectory>`。准确目标Unity正在运行时只询问一次是否正常关闭;同意后使用`init package --close-editor`,不得强制终止,也不得替用户决定未保存场景弹窗。Bridge与Skill是独立授权效果,一个失败只阻断自身检查,不阻断另一个;每个成功效果都立即执行对应`--check`并最终汇总全部状态。安装流程不得启动或重启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已经停止。
|
|
@@ -96,16 +96,16 @@ AI 使用当前实例的统一公开目录自发现和执行:
|
|
|
96
96
|
|
|
97
97
|
```powershell
|
|
98
98
|
unitycli tools group --instance <id|projectPath|alias>
|
|
99
|
-
unitycli tools group list <group> --instance <id|projectPath|alias>
|
|
99
|
+
unitycli tools group list <group> --page-size 20 --instance <id|projectPath|alias>
|
|
100
100
|
unitycli tools describe <custom-tool> --instance <id|projectPath|alias>
|
|
101
101
|
unitycli tools run <custom-tool> --input '<json>' --instance <id|projectPath|alias>
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
`<group>` 必须来自当前实例 `tools group` 的真实输出;不要假设项目 Tool 位于 `custom`
|
|
104
|
+
`<group>` 必须来自当前实例 `tools group` 的真实输出;不要假设项目 Tool 位于 `custom` 组。存在`pageInfo.nextCursor`时必须继续读取所需页面。`source` 只作内部描述/审计,不改变发现或执行路径。
|
|
105
105
|
|
|
106
106
|
## 最小验证
|
|
107
107
|
|
|
108
108
|
1. Unity 编译无错误。
|
|
109
|
-
2. `tools group` 与 `tools group list <group>`
|
|
109
|
+
2. `tools group` 与 `tools group list <group>` 的分页结果能从同一实例完整目录发现 Tool。
|
|
110
110
|
3. `tools describe <tool>` 的 schema、风险、target、Play Mode 语义足以让陌生 AI 一次调用成功。
|
|
111
111
|
4. `tools run <tool> --input '<json>' --instance <id|projectPath|alias>` 覆盖默认正向、代表性可选参数和错误路径。
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
`--instance <full-id|canonical-project-path|alias>`是通用显式实例选择器;`command --project-path <path>`是同一canonical identity选择语法。显式空值必须失败;业务`input.instance`不是selector。未传selector时只从当前Unity项目CWD解析;无法确定实例即稳定失败,`--project`和Tool input都不能选实例。
|
|
8
8
|
|
|
9
|
-
`target alias` 只维护 canonical project identity alias。`source` 只供说明和审计,不影响显示、describe、owner
|
|
9
|
+
`target alias` 只维护 canonical project identity alias。`source` 只供说明和审计,不影响显示、describe、owner 路由或执行,也不进入搜索结果。连接实例的 Tool 目录是权威目录;离线静态 catalog 不能替代它。PowerShell中执行多token搜索时使用`tools search '<k1|k2|...>'`;单引号必须包住完整关键词,避免`|`被解释为shell管道。
|
|
10
10
|
|
|
11
|
-
`
|
|
11
|
+
`tools group list`、`tools search`和省略name的`command`列表按名称稳定分页,默认20项、最大100项。存在`pageInfo.nextCursor`时,将其原值传回同一查询的`--cursor`;不要重新解释或递增cursor。stdout默认是单行紧凑JSON,`--pretty`只增加缩进。
|
|
12
|
+
|
|
13
|
+
`instances list`逐个验证当前正式实例记录。旧格式、损坏或不可读文件不参与路由,也不阻断其他合法实例;存在时结果包含`invalidRecordCount`。当前项目由Unity在ready时自动重建。需要清理历史记录时调用`instances prune --instance <id|projectPath|alias>`并检查`removed`、`remaining`、`deferred`、`scanned`和`truncated`;不得读取、兼容解析、转换、移动或手工删除内部文件。
|
|
12
14
|
|
|
13
15
|
## Descriptor
|
|
14
16
|
|
|
@@ -46,7 +48,7 @@ Tool descriptor 常用字段:
|
|
|
46
48
|
|
|
47
49
|
每个live Editor或Development Player session拥有独立任务池,默认达到5个active root时关闭准入,降到4仍关闭,降到3才重开。CLI在业务请求前自动等待;AI不手工轮询、不读取active count,也不管理内部token。统一catalog在Editor和Runtime同时在线时,会分别经过两个session的准入后才返回完整结果。
|
|
48
50
|
|
|
49
|
-
`--timeout-ms T`先提供一份最多`T
|
|
51
|
+
`--timeout-ms T`先提供一份最多`T`的准入预算。CLI在其中等待首次ready记录、当前编译/导入/重载和任务池;证明Unity未运行时立即返回。准入deadline的`E_UNITY_BUSY`明确证明业务Bridge请求未发送、effect未开始,可以稍后提交新root。获得grant后再创建一份完整`T`的execution预算;token重取、status、rebind、reload和terminal recovery都只能消费该预算,不能刷新第三份预算。
|
|
50
52
|
|
|
51
53
|
`E_EXECUTION_TIMEOUT`、放行后的transport丢失、进程中断或没有可信terminal envelope时,只能确定本次调用没有返回可信终态,不能据此判断mutation是否发生。先读取对象、场景、Package、build/test状态或artifact manifest;只有形成新的业务决策后才提交新请求,不把outcome unknown自动重放。
|
|
52
54
|
|
|
@@ -80,4 +82,4 @@ unitycli extensions remove <id> --project <path>
|
|
|
80
82
|
unitycli extensions doctor --project <path>
|
|
81
83
|
```
|
|
82
84
|
|
|
83
|
-
|
|
85
|
+
安装协议先使用`unitycli init help`学习,再由`init discover`只读返回当前项目计划。Bridge使用`init package --project <UnityProject>`安装;准确目标Unity正在运行且用户同意正常关闭时增加`--close-editor`,不得强制终止或替用户处理未保存场景。Skill明确目录使用`init skill --target <SkillDirectory>`,预设目标仍可使用`init skill --agent <.agents|claude> --scope <workspace|user>`,workspace scope同时传`--workspace <path>`;每种形式都用原命令加`--check`校验。用户已指定的目标不得重复询问。Bridge与Skill是独立效果,一个失败不阻断另一个。不得使用裸`init`或把两种效果合并为一个命令。Unity project文件投影完成后,如任务要求Editor效果,仍需在已连接实例中完成import/compile和业务readback。
|
|
@@ -24,7 +24,7 @@ The feedback output contract requires category, concise issue summary, optional
|
|
|
24
24
|
| Feedback privacy negatives | PASS | Secret/endpoint/path negative matrix | Novel secret formats can still exist |
|
|
25
25
|
| Concurrent JSONL validity | PASS | 16 parallel Windows PowerShell writers | Cross-session Windows desktop contention not measured |
|
|
26
26
|
| Rolling bound | PASS | Main + 3 archives, each <= 64 KiB | Longitudinal retention utility not measured |
|
|
27
|
-
| Installed bundle reachability | PASS | Public
|
|
27
|
+
| Installed bundle reachability | PASS | Public exact-target and preset workspace/user install, drifted-update, check, and recorder smoke | Verified with isolated filesystem targets |
|
|
28
28
|
| Clean Agent interpretation | PASS | Black-box runtime discovery transcript and main-agent audit | Human adjudication unavailable |
|
|
29
29
|
|
|
30
30
|
## Rollback Boundary
|
|
@@ -36,7 +36,7 @@ The Skill does not add confirmation, intent review, or a predefined operation ra
|
|
|
36
36
|
|
|
37
37
|
- Full repository tests: 876/876 PASS; targeted Skill/installer/docs regression: 61/61 PASS.
|
|
38
38
|
- Recorder concurrency, rotation, privacy negatives, PowerShell 5.1 BOM, and non-ASCII stdout: PASS.
|
|
39
|
-
- Public runtime install, drifted update, check, marker preservation, and installed-recorder smoke
|
|
39
|
+
- Public exact-target and preset runtime install, drifted update, check, marker preservation, and installed-recorder smoke: PASS.
|
|
40
40
|
- Resource boundary: 963 estimated initial-load tokens (691 Skill body tokens), limit 1300.
|
|
41
41
|
- Trigger fixture gate: 29/29 classifications.
|
|
42
42
|
- Output assertion gate: 5/5 with-skill cases, 100% pass rate.
|
|
@@ -86,6 +86,7 @@ namespace UnityCli
|
|
|
86
86
|
RegisterInstalledExtensionCommands(registry);
|
|
87
87
|
RegisterCodeExecCommand(registry);
|
|
88
88
|
RegisterEditorStateSnapshotCommand(registry);
|
|
89
|
+
RegisterInstanceCleanupCommand(registry);
|
|
89
90
|
UnityCliCompileCoordinator.Register(registry);
|
|
90
91
|
UnityCliLiveBuildCoordinator.Register(registry);
|
|
91
92
|
UnityCliLiveRefreshCoordinator.Register(registry);
|
|
@@ -60,22 +60,34 @@ namespace UnityCli
|
|
|
60
60
|
// pulse只证明EditorApplication.update最近推进;具体请求仍由TryStart证明开始。
|
|
61
61
|
Volatile.Write(ref mainThreadPulseTimestamp, System.Diagnostics.Stopwatch.GetTimestamp());
|
|
62
62
|
Interlocked.Increment(ref mainThreadPulseSequence);
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
var listenerWasStarted = started;
|
|
64
|
+
var isCompiling = EditorApplication.isCompiling;
|
|
65
|
+
var isUpdating = EditorApplication.isUpdating;
|
|
66
|
+
var isBuilding = BuildPipeline.isBuildingPlayer;
|
|
67
|
+
var isPlayModeChanging = IsPlayModeChanging();
|
|
68
|
+
var lifecycleChanged = cachedIsCompiling != isCompiling
|
|
69
|
+
|| cachedIsUpdating != isUpdating
|
|
70
|
+
|| cachedIsBuilding != isBuilding
|
|
71
|
+
|| cachedIsPlayModeChanging != isPlayModeChanging;
|
|
72
|
+
cachedIsCompiling = isCompiling;
|
|
73
|
+
cachedIsUpdating = isUpdating;
|
|
65
74
|
cachedIsPlayingOrWillChangePlaymode = EditorApplication.isPlayingOrWillChangePlaymode;
|
|
66
75
|
cachedIsPlaying = EditorApplication.isPlaying;
|
|
67
|
-
cachedIsBuilding =
|
|
68
|
-
cachedIsPlayModeChanging =
|
|
76
|
+
cachedIsBuilding = isBuilding;
|
|
77
|
+
cachedIsPlayModeChanging = isPlayModeChanging;
|
|
69
78
|
AdvanceBridgeStartup();
|
|
70
79
|
UnityCliSessionMutationLease.TryFinalizeOwnedPlayModeRoot();
|
|
71
80
|
UnityCliWaitScheduler.Tick();
|
|
72
81
|
|
|
73
|
-
//
|
|
74
|
-
if (
|
|
82
|
+
// 新listener先保留至少一个主线程update的transitioning状态;后续生命周期变化即时发布,30秒刷新只修复漏事件。
|
|
83
|
+
if (listenerWasStarted && started
|
|
84
|
+
&& (readyPublicationPending || lifecycleChanged || EditorApplication.timeSinceStartup >= nextRegistryRefreshAt))
|
|
75
85
|
{
|
|
86
|
+
readyPublicationPending = false;
|
|
76
87
|
RegisterInstance("ready");
|
|
77
88
|
nextRegistryRefreshAt = EditorApplication.timeSinceStartup + RegistryRefreshSeconds;
|
|
78
89
|
}
|
|
90
|
+
TickInstancePublicationRetry();
|
|
79
91
|
var startedThisTick = 0;
|
|
80
92
|
while (startedThisTick < MaxWorkStartsPerTick)
|
|
81
93
|
{
|