@kevlns/u-cli-mod 0.1.0-beta.1 → 0.1.0-beta.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 +7 -2
- package/dist/cli.js +7 -1
- package/package.json +5 -1
- package/v-cli.plugin.json +265 -0
package/README.md
CHANGED
|
@@ -85,12 +85,13 @@ beta 阶段请显式使用 `@kevlns/u-cli-mod@beta`;发布稳定版并设置 `
|
|
|
85
85
|
### 单元测试与打包守卫
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
npm run check # build + lint +
|
|
88
|
+
npm run check # build + lint + 106 个 vitest 测试 + pack guard
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
`pack:guard` 会执行真实 `npm pack`(含文件清单校验),断言发布包:
|
|
92
92
|
|
|
93
|
-
- 包名为 `@kevlns/u-cli-mod
|
|
93
|
+
- 包名为 `@kevlns/u-cli-mod`,tgz 文件名精确为 `kevlns-u-cli-mod-0.1.0-beta.2.tgz`(与 package.json 版本一致);
|
|
94
|
+
- `files` 必须包含 `v-cli.plugin.json`,且清单身份字段(schemaVersion/package/command/bin/platforms)与包一致;
|
|
94
95
|
- 不出现:
|
|
95
96
|
|
|
96
97
|
```text
|
|
@@ -99,6 +100,10 @@ npm run check # build + lint + 94 个 vitest 测试 + pack guard
|
|
|
99
100
|
完整 com.unity.pipeline 目录树
|
|
100
101
|
```
|
|
101
102
|
|
|
103
|
+
### v-cli 插件清单
|
|
104
|
+
|
|
105
|
+
`v-cli.plugin.json` 随包发布(`package.json` 中 `vCli.manifest` 指向),声明 v-cli 命令 `unity`(平台 win32)与全部公共命令路径、参数、选项、输出与副作用元数据。`tests/vcli-manifest.test.ts` 以 `buildProgram()` 为行为源校验清单:命令树、参数、选项(flags 与描述)、usage 逐项一致,任何 CLI 定义变更未同步清单都会失败。
|
|
106
|
+
|
|
102
107
|
### 本地 tarball 安装矩阵(三模式验证)
|
|
103
108
|
|
|
104
109
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -99,7 +99,13 @@ export function buildProgram() {
|
|
|
99
99
|
.passThroughOptions(true);
|
|
100
100
|
execCmd.action(async (project, opts, command) => {
|
|
101
101
|
const extra = command.args.slice(1);
|
|
102
|
-
|
|
102
|
+
// `--` is commander separator syntax, never a Unity CLI argument. With
|
|
103
|
+
// passThroughOptions commander copies the whole tail verbatim (including a
|
|
104
|
+
// literal `--` written after the project), so strip it here: runExec must
|
|
105
|
+
// only ever receive the real pipeline args, and the project-path override
|
|
106
|
+
// rejection below stays fully intact.
|
|
107
|
+
const passthroughArgs = extra.filter((arg) => arg !== '--');
|
|
108
|
+
const { exitCode } = await runExec(project, passthroughArgs, {
|
|
103
109
|
downloadIfMissing: opts.downloadIfMissing,
|
|
104
110
|
});
|
|
105
111
|
process.exitCode = exitCode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevlns/u-cli-mod",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.2",
|
|
4
4
|
"description": "u-cli-mod: pin exact Unity Editor version routes and install the adapted com.unity.pipeline package for Unity 2022 (Windows-first). Downloads Unity assets at runtime into the user cache; the package itself contains no Unity binaries or package source. Not an official Unity project.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,11 +10,15 @@
|
|
|
10
10
|
"bin": {
|
|
11
11
|
"u-cli-mod": "dist/cli.js"
|
|
12
12
|
},
|
|
13
|
+
"vCli": {
|
|
14
|
+
"manifest": "v-cli.plugin.json"
|
|
15
|
+
},
|
|
13
16
|
"main": "./dist/index.js",
|
|
14
17
|
"files": [
|
|
15
18
|
"dist",
|
|
16
19
|
"routes",
|
|
17
20
|
"templates",
|
|
21
|
+
"v-cli.plugin.json",
|
|
18
22
|
"README.md",
|
|
19
23
|
"LICENSE"
|
|
20
24
|
],
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"package": "@kevlns/u-cli-mod",
|
|
4
|
+
"command": "unity",
|
|
5
|
+
"bin": "u-cli-mod",
|
|
6
|
+
"description": "Pin a Unity project to its exact editor version route, download the verified Unity CLI and install the adapted com.unity.pipeline package for Unity 2022 (Windows-first, non-official Unity tooling).",
|
|
7
|
+
"platforms": ["win32"],
|
|
8
|
+
"runtime": {
|
|
9
|
+
"node": ">=20",
|
|
10
|
+
"os": "win32"
|
|
11
|
+
},
|
|
12
|
+
"environment": [
|
|
13
|
+
{
|
|
14
|
+
"name": "LOCALAPPDATA",
|
|
15
|
+
"description": "User cache base on Windows. CLI downloads and generated pipeline packages live under %LOCALAPPDATA%\\editor-pipeline-cli (falls back to <home>\\AppData\\Local); project-scoped receipts, backups and staging live under <project>/Library/editor-pipeline-cli, never under the user cache."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "PATH",
|
|
19
|
+
"description": "Must resolve powershell.exe; the fail-closed running-Editor guard queries Unity.exe processes through Windows PowerShell."
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"agent": {
|
|
23
|
+
"whenToUse": "Use for Windows-first Unity Editor 2022 workflows that must stay pinned to an exact editor version: diagnose a project against its route, list pinned routes, download the verified Unity CLI, transactionally install the adapted com.unity.pipeline package, or run Unity Pipeline CLI commands with enforced project targeting. Never use on non-Windows hosts.",
|
|
24
|
+
"globalOptions": [
|
|
25
|
+
{
|
|
26
|
+
"flags": "-V, --version",
|
|
27
|
+
"description": "output the version number"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"flags": "-h, --help",
|
|
31
|
+
"description": "display help for command"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"commands": [
|
|
35
|
+
{
|
|
36
|
+
"path": ["doctor"],
|
|
37
|
+
"usage": "u-cli-mod doctor <project> [options]",
|
|
38
|
+
"description": "检查工程版本、路由、CLI 与 Pipeline 状态",
|
|
39
|
+
"arguments": [
|
|
40
|
+
{
|
|
41
|
+
"name": "project",
|
|
42
|
+
"required": true,
|
|
43
|
+
"description": "Path to the Unity project; must contain ProjectSettings/ProjectVersion.txt."
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"options": [
|
|
47
|
+
{
|
|
48
|
+
"flags": "--allow-running-editor",
|
|
49
|
+
"description": "允许查询运行中的 Editor 时不失败"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"output": {
|
|
53
|
+
"format": "json",
|
|
54
|
+
"description": "Diagnostics object: projectPath, editorVersion, editorRevision, routeSupported, routeRevision, cli {version, path, state}, pipeline {version, sourceReady, installed}, unityProcesses, supportedVersions."
|
|
55
|
+
},
|
|
56
|
+
"exitCodes": {
|
|
57
|
+
"0": "success",
|
|
58
|
+
"1": "error (fail-closed project/route mismatch: unreadable project or unsupported editor version)"
|
|
59
|
+
},
|
|
60
|
+
"safety": [
|
|
61
|
+
"read-only; never writes the project or the cache",
|
|
62
|
+
"fail-closed exact m_EditorVersion + m_EditorVersionWithRevision match (no wildcard, no fallback)",
|
|
63
|
+
"queries running Unity.exe processes via PowerShell; a failed query is reported in the unityProcesses output, not fatal"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"path": ["routes"],
|
|
68
|
+
"usage": "u-cli-mod routes [options]",
|
|
69
|
+
"description": "列出所有已配置的 Editor 精确路由",
|
|
70
|
+
"arguments": [],
|
|
71
|
+
"options": [
|
|
72
|
+
{
|
|
73
|
+
"flags": "-e, --editor <version>",
|
|
74
|
+
"description": "只显示指定版本"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"output": {
|
|
78
|
+
"format": "json",
|
|
79
|
+
"description": "Object { routes: [...] } with one entry per pinned route: editorVersion, editorRevision, cliVersion, cliSha256, pipelineVersion, pipelineSha256, status."
|
|
80
|
+
},
|
|
81
|
+
"exitCodes": {
|
|
82
|
+
"0": "success",
|
|
83
|
+
"1": "error (unpinned editor version or internal error)"
|
|
84
|
+
},
|
|
85
|
+
"safety": [
|
|
86
|
+
"read-only; no network access",
|
|
87
|
+
"uses only embedded pinned route metadata shipped in the package"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"path": ["cli", "install"],
|
|
92
|
+
"usage": "u-cli-mod cli install [options]",
|
|
93
|
+
"description": "下载并校验固定版本的 Unity CLI(SHA-256 + Authenticode)",
|
|
94
|
+
"arguments": [],
|
|
95
|
+
"options": [
|
|
96
|
+
{
|
|
97
|
+
"flags": "--editor <version>",
|
|
98
|
+
"description": "限定 Editor 版本,默认全部路由"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"flags": "--force",
|
|
102
|
+
"description": "强制重新下载"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"output": {
|
|
106
|
+
"format": "json",
|
|
107
|
+
"description": "Object { cacheDir, results: [...] } with one entry per route: editorVersion, cliVersion, path, state (valid|downloaded), sha256."
|
|
108
|
+
},
|
|
109
|
+
"exitCodes": {
|
|
110
|
+
"0": "success",
|
|
111
|
+
"1": "error (download, size, SHA-256 or Authenticode verification failure)"
|
|
112
|
+
},
|
|
113
|
+
"safety": [
|
|
114
|
+
"writes only under the user cache: %LOCALAPPDATA%\\editor-pipeline-cli\\cache\\cli",
|
|
115
|
+
"downloads from the pinned Unity official CDN HTTPS URL only",
|
|
116
|
+
"verifies fixed SHA-256 + expected size + Authenticode signer subject and certificate thumbprint before the binary is placed",
|
|
117
|
+
"unverified temp download is deleted on any failure; the final file is created by atomic rename"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"path": ["pipeline", "install"],
|
|
122
|
+
"usage": "u-cli-mod pipeline install <project> [options]",
|
|
123
|
+
"description": "按工程 Editor 版本事务式安装适配后的 com.unity.pipeline",
|
|
124
|
+
"arguments": [
|
|
125
|
+
{
|
|
126
|
+
"name": "project",
|
|
127
|
+
"required": true,
|
|
128
|
+
"description": "Path to the Unity project; must contain ProjectSettings/ProjectVersion.txt."
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"options": [
|
|
132
|
+
{
|
|
133
|
+
"flags": "--force",
|
|
134
|
+
"description": "覆盖现有不一致的包(先备份)"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"flags": "--allow-running-editor",
|
|
138
|
+
"description": "跳过运行中 Editor 的 fail-closed 保护"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"flags": "--dry-run",
|
|
142
|
+
"description": "只校验与预览,不写入工程"
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"output": {
|
|
146
|
+
"format": "json",
|
|
147
|
+
"description": "Install result object: status (Installed|AlreadyInstalled|DryRun), projectPath, editorVersion, editorRevision, pipelineVersion, packagePath, fileCount, backupPath (when replaced), plus sourceDir and sourceFileCount from the caller."
|
|
148
|
+
},
|
|
149
|
+
"exitCodes": {
|
|
150
|
+
"0": "success",
|
|
151
|
+
"1": "error (running-Editor guard, integrity or install failure; transactional rollback on any failure)"
|
|
152
|
+
},
|
|
153
|
+
"safety": [
|
|
154
|
+
"transactional install: stage -> verify -> backup -> replace -> re-verify -> receipt; automatic rollback on any failure",
|
|
155
|
+
"fail-closed when a matching Unity Editor is running, unless --allow-running-editor",
|
|
156
|
+
"--dry-run never writes the project and never writes a receipt",
|
|
157
|
+
"source and destination trees must match the pinned expected-tree (385 files, SHA-256) before and after placement",
|
|
158
|
+
"writes only under <project>/Packages/com.unity.pipeline and <project>/Library/editor-pipeline-cli"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"path": ["setup"],
|
|
163
|
+
"usage": "u-cli-mod setup <project> [options]",
|
|
164
|
+
"description": "cli install + pipeline install",
|
|
165
|
+
"arguments": [
|
|
166
|
+
{
|
|
167
|
+
"name": "project",
|
|
168
|
+
"required": true,
|
|
169
|
+
"description": "Path to the Unity project; must contain ProjectSettings/ProjectVersion.txt."
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"options": [
|
|
173
|
+
{
|
|
174
|
+
"flags": "--force",
|
|
175
|
+
"description": "覆盖现有不一致的包"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"flags": "--allow-running-editor",
|
|
179
|
+
"description": "跳过运行中 Editor 的 fail-closed 保护"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"flags": "--dry-run",
|
|
183
|
+
"description": "只校验与预览,不写入工程"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"flags": "--skip-cli",
|
|
187
|
+
"description": "跳过 CLI 下载"
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
"output": {
|
|
191
|
+
"format": "json",
|
|
192
|
+
"description": "Object { cli: {path, state, sha256} | null (null with --skip-cli), install: <pipeline install result> }."
|
|
193
|
+
},
|
|
194
|
+
"exitCodes": {
|
|
195
|
+
"0": "success",
|
|
196
|
+
"1": "error (any sub-step failure; the pipeline install rolls back)"
|
|
197
|
+
},
|
|
198
|
+
"safety": [
|
|
199
|
+
"combines the cli install and pipeline install safety contracts",
|
|
200
|
+
"fail-closed running-Editor guard unless --allow-running-editor",
|
|
201
|
+
"--dry-run never writes the project",
|
|
202
|
+
"--skip-cli avoids all CLI downloads"
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"path": ["exec"],
|
|
207
|
+
"usage": "u-cli-mod exec <project> [options] -- <unity-cli-args...>",
|
|
208
|
+
"description": "调用路由 CLI 执行 Unity Pipeline 命令;--project-path 由工具统一绑定",
|
|
209
|
+
"arguments": [
|
|
210
|
+
{
|
|
211
|
+
"name": "project",
|
|
212
|
+
"required": true,
|
|
213
|
+
"description": "Path to the Unity project; must contain ProjectSettings/ProjectVersion.txt."
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
"options": [
|
|
217
|
+
{
|
|
218
|
+
"flags": "--download-if-missing",
|
|
219
|
+
"description": "CLI 缺失时自动下载"
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
"output": {
|
|
223
|
+
"format": "text",
|
|
224
|
+
"description": "Unity CLI stdout/stderr pass through verbatim (stdio inherit); the wrapper prints no JSON of its own."
|
|
225
|
+
},
|
|
226
|
+
"exitCodes": {
|
|
227
|
+
"0": "success",
|
|
228
|
+
"1": "guard or wrapper error (project-path override, missing or tampered CLI)",
|
|
229
|
+
"N": "the Unity CLI's own exit code is propagated verbatim"
|
|
230
|
+
},
|
|
231
|
+
"safety": [
|
|
232
|
+
"re-verifies the pinned CLI SHA-256 before every invocation (fail-closed on tamper)",
|
|
233
|
+
"rejects every --project-path variant (case-insensitive: --project-path, --projectPath, -projectPath, --project_path, mixed case)",
|
|
234
|
+
"always appends the resolved --project-path as the final argument; the wrapper owns project targeting",
|
|
235
|
+
"no route fallback: the project must match a pinned route exactly",
|
|
236
|
+
"the documented -- separator is consumed by the wrapper and never forwarded to the Unity CLI"
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"path": ["cache", "clean"],
|
|
241
|
+
"usage": "u-cli-mod cache clean [options]",
|
|
242
|
+
"description": "清理下载缓存与生成的适配包",
|
|
243
|
+
"arguments": [],
|
|
244
|
+
"options": [
|
|
245
|
+
{
|
|
246
|
+
"flags": "--all",
|
|
247
|
+
"description": "连 CLI 缓存一起清理"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
"output": {
|
|
251
|
+
"format": "json",
|
|
252
|
+
"description": "Object { cacheRoot, removed: [absolute directory paths that were removed] }."
|
|
253
|
+
},
|
|
254
|
+
"exitCodes": {
|
|
255
|
+
"0": "success",
|
|
256
|
+
"1": "error"
|
|
257
|
+
},
|
|
258
|
+
"safety": [
|
|
259
|
+
"removes only directories under the user cache root %LOCALAPPDATA%\\editor-pipeline-cli",
|
|
260
|
+
"default scope: generated packages + pipeline downloads only; without --all the CLI cache and logs are preserved"
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
}
|