@kevlns/u-cli-mod 0.1.4 → 0.2.0
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/AGENTS.md +5 -1
- package/README.md +12 -3
- package/dist/cli.js +16 -2
- package/dist/commands/exec.d.ts +34 -0
- package/dist/commands/exec.js +150 -5
- package/package.json +2 -2
- package/v-cli.plugin.json +7 -2
package/AGENTS.md
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
- `u-cli-mod pipeline install <project>` - 事务式安装适配包(自动备份/回滚/receipt)
|
|
16
16
|
- `u-cli-mod exec <project> -- <pipeline-args>` - 执行 Pipeline 命令(工具统一绑定 `--project-path`)
|
|
17
17
|
- Pipeline 命令全集见文末「Pipeline 工具清单」(适配版 `com.unity.pipeline` 共 154 个命令,按领域分组)
|
|
18
|
+
- `u-cli-mod exec <project> [--wait <秒>] -- <pipeline-args>` - 长任务默认 5s 后让出控制权,结果用对应的 `command <name>_status` 轮询
|
|
18
19
|
- `u-cli-mod routes` / `u-cli-mod cache clean` - 路由表 / 缓存清理
|
|
19
20
|
|
|
20
21
|
## 使用规范(Agent 必须遵守)
|
|
@@ -27,12 +28,15 @@
|
|
|
27
28
|
6. `exec` 每次调用前都会重新校验 CLI 哈希(防篡改),属正常行为;校验失败按提示跑 `u-cli-mod cli install --force` 修复即可。
|
|
28
29
|
7. **读取 Editor 当前 Console 首选 `command read_console`**,`get_console_logs` 是兼容别名;`command console` 读取回调捕获流,适合 `since`/cursor 跟随,但不能代替原生 Console 快照。工具必须经 `command <名>` 调用。若实际 schema 中缺少 `read_console`,先检查 `doctor` 的 `patchVersion`/`installedPatchVersion` 和 `state`,不要将其误认成 `console` 的别名。
|
|
29
30
|
|
|
31
|
+
8. **长任务默认不阻塞**:`run_tests` 只等待 5 秒,到点后任务仍在 Editor 内继续执行,工具打印输出日志路径并立即返回(退出码 0)。此时**不要重复发起同一命令**,改用 `command test_status` 轮询结果;需要同步拿到完整 `Summary` 时传 `--wait <秒>`,并优先用 `--filter <命名空间或类名>` 缩小范围(通常数秒内即可同步返回)。
|
|
30
32
|
## 典型流程
|
|
31
33
|
|
|
32
34
|
```bash
|
|
33
35
|
u-cli-mod doctor <project> # 1. 体检(只读)
|
|
34
36
|
u-cli-mod setup <project> # 2. 就绪(CLI + 适配包)
|
|
35
37
|
u-cli-mod exec <project> -- command editor_status # 3. 执行
|
|
38
|
+
u-cli-mod exec <project> -- command run_tests --mode EditMode --filter <命名空间或类名> # 小范围:同步返回 Summary
|
|
39
|
+
u-cli-mod exec <project> -- command run_tests --mode EditMode # 全量:5s 后让出,轮询 test_status
|
|
36
40
|
u-cli-mod exec <project> -- command read_console --types error,warning --count 100
|
|
37
41
|
```
|
|
38
42
|
|
|
@@ -230,4 +234,4 @@ u-cli-mod exec <project> -- command read_console --types error,warning --count 1
|
|
|
230
234
|
|
|
231
235
|
### Authoring 根路径
|
|
232
236
|
- `get_authoring_root` — Get the base folder (under Assets/) that bare authoring paths resolve against.
|
|
233
|
-
- `set_authoring_root` — Set the base folder (under Assets/) that bare authoring paths resolve against and are confined to. Use 'Assets' for full project access.
|
|
237
|
+
- `set_authoring_root` — Set the base folder (under Assets/) that bare authoring paths resolve against and are confined to. Use 'Assets' for full project access.
|
package/README.md
CHANGED
|
@@ -80,12 +80,21 @@ u-cli-mod exec <project> -- command editor_status
|
|
|
80
80
|
u-cli-mod exec <project> -- command get_scene_hierarchy
|
|
81
81
|
u-cli-mod exec <project> -- command read_console --types error,warning --count 100
|
|
82
82
|
|
|
83
|
+
# 长任务(run_tests)默认等待 5s 后让出控制权,任务继续在 Editor 内执行
|
|
84
|
+
u-cli-mod exec <project> -- command run_tests --mode EditMode
|
|
85
|
+
# 随后轮询结果
|
|
86
|
+
u-cli-mod exec <project> -- command test_status
|
|
87
|
+
# 需要同步拿到完整 Summary 时放宽等待上限(秒)
|
|
88
|
+
u-cli-mod exec <project> --wait 120 -- command run_tests --mode EditMode --filter Game.AI.Tests
|
|
89
|
+
|
|
83
90
|
# 清理缓存
|
|
84
91
|
u-cli-mod cache clean
|
|
85
92
|
```
|
|
86
93
|
|
|
87
94
|
`exec` 会把 `--project-path <工程>` 追加到 Unity CLI 参数末尾;传入任何形式的 `--project-path`(含 `-projectPath`、`--projectPath`、大小写混合)会直接报错。
|
|
88
95
|
|
|
96
|
+
长任务(`run_tests`)默认只等待 5 秒:到点后任务仍在 Unity Editor 内继续执行,工具打印输出日志路径并立即返回(退出码 0);结果用 `command test_status` 轮询,需要同步等待时用 `--wait <秒>`(`0` = 立即返回)。
|
|
97
|
+
|
|
89
98
|
## 原理
|
|
90
99
|
|
|
91
100
|
1. 读取目标工程 `ProjectSettings/ProjectVersion.txt`,要求 `m_EditorVersion` 与 `m_EditorVersionWithRevision` **同时存在且与路由完全一致**(fail-closed,无通配、无“最近版本”回退)。
|
|
@@ -114,7 +123,7 @@ npm run check # build + lint + vitest 测试 + pack guard
|
|
|
114
123
|
|
|
115
124
|
`pack:guard` 会执行真实 `npm pack`(含文件清单校验),断言发布包:
|
|
116
125
|
|
|
117
|
-
- 包名为 `@kevlns/u-cli-mod`,tgz 文件名精确为 `kevlns-u-cli-mod-0.
|
|
126
|
+
- 包名为 `@kevlns/u-cli-mod`,tgz 文件名精确为 `kevlns-u-cli-mod-0.2.0.tgz`(与 package.json 版本一致);
|
|
118
127
|
- `files` 必须包含 `v-cli.plugin.json`,且清单身份字段(schemaVersion/package/command/bin/platforms)与包一致;
|
|
119
128
|
- 不出现:
|
|
120
129
|
|
|
@@ -184,7 +193,7 @@ kevlns 工具家族共享同一套发布约定(tag 驱动、CI 护栏、MIT)
|
|
|
184
193
|
| --- | --- | --- |
|
|
185
194
|
| [`v-cli`](https://github.com/kevlns/v-cli) | 个人工具箱 CLI | v0.2.3 |
|
|
186
195
|
| [`xlmerge`](https://github.com/kevlns/xlmerge) | Git 中 .xlsx/.xlsm 冲突可视化解决工具 | v1.2.2 |
|
|
187
|
-
| [`u-cli-mod`](https://github.com/kevlns/u-cli-mod) | Unity 精确版本路由 + CLI + pipeline 包(Windows-first,本仓库) | v0.
|
|
196
|
+
| [`u-cli-mod`](https://github.com/kevlns/u-cli-mod) | Unity 精确版本路由 + CLI + pipeline 包(Windows-first,本仓库) | v0.2.0 |
|
|
188
197
|
|
|
189
198
|
## Compatibility
|
|
190
199
|
|
|
@@ -210,4 +219,4 @@ For bugs and feature requests, use [GitHub Issues](https://github.com/kevlns/u-c
|
|
|
210
219
|
|
|
211
220
|
Part of the **kevlns** tool family.
|
|
212
221
|
|
|
213
|
-
</div>
|
|
222
|
+
</div>
|
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import { runRoutes } from './commands/routesCmd.js';
|
|
|
6
6
|
import { runCliInstall } from './commands/cliInstall.js';
|
|
7
7
|
import { runPipelineInstall } from './commands/pipelineInstall.js';
|
|
8
8
|
import { runSetup } from './commands/setup.js';
|
|
9
|
-
import { runExec } from './commands/exec.js';
|
|
9
|
+
import { runExec, extractWaitOption } from './commands/exec.js';
|
|
10
10
|
import { runCacheClean } from './commands/cacheClean.js';
|
|
11
11
|
import { readFileSync } from 'node:fs';
|
|
12
12
|
import { join, dirname } from 'node:path';
|
|
@@ -24,6 +24,17 @@ function packageVersion() {
|
|
|
24
24
|
function printJson(value) {
|
|
25
25
|
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
26
26
|
}
|
|
27
|
+
/** Non-negative seconds for --wait; undefined keeps the wrapper default. */
|
|
28
|
+
function parseWaitSeconds(raw) {
|
|
29
|
+
if (raw === undefined) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const value = Number(raw);
|
|
33
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
34
|
+
throw new CliError(`--wait 需要非负秒数,收到:${raw}`);
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
27
38
|
export function buildProgram() {
|
|
28
39
|
const program = new Command();
|
|
29
40
|
program
|
|
@@ -94,6 +105,7 @@ export function buildProgram() {
|
|
|
94
105
|
.command('exec <project>')
|
|
95
106
|
.description('调用路由 CLI 执行 Unity Pipeline 命令;--project-path 由工具统一绑定')
|
|
96
107
|
.option('--download-if-missing', 'CLI 缺失时自动下载')
|
|
108
|
+
.option('--wait <seconds>', '长任务等待上限(秒):到点后任务在 Editor 内继续,立即返回;0 = 立即返回')
|
|
97
109
|
.allowUnknownOption(true)
|
|
98
110
|
.allowExcessArguments(true)
|
|
99
111
|
.passThroughOptions(true);
|
|
@@ -105,8 +117,10 @@ export function buildProgram() {
|
|
|
105
117
|
// only ever receive the real pipeline args, and the project-path override
|
|
106
118
|
// rejection below stays fully intact.
|
|
107
119
|
const passthroughArgs = extra.filter((arg) => arg !== '--');
|
|
108
|
-
const
|
|
120
|
+
const forwarded = extractWaitOption(passthroughArgs);
|
|
121
|
+
const { exitCode } = await runExec(project, forwarded.args, {
|
|
109
122
|
downloadIfMissing: opts.downloadIfMissing,
|
|
123
|
+
waitSeconds: forwarded.waitSeconds ?? parseWaitSeconds(opts.wait),
|
|
110
124
|
});
|
|
111
125
|
process.exitCode = exitCode;
|
|
112
126
|
});
|
package/dist/commands/exec.d.ts
CHANGED
|
@@ -6,8 +6,42 @@
|
|
|
6
6
|
export declare function findProjectPathOverride(args: string[]): string | null;
|
|
7
7
|
/** The wrapper always appends its own resolved project path as the last args. */
|
|
8
8
|
export declare function buildExecArgs(cliArgs: string[], projectPath: string): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Pipeline commands that block until the Editor-side work finishes.
|
|
11
|
+
* The routed Unity CLI caps that wait at 30s, and its own `--timeout` is not wired
|
|
12
|
+
* in the shipped build (verified: a full run_tests still waits ~30s with
|
|
13
|
+
* `--timeout 1`), so the wait budget belongs to this wrapper.
|
|
14
|
+
*/
|
|
15
|
+
export declare const LONG_RUNNING_PIPELINE_COMMANDS: ReadonlySet<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Long tasks hand control back after this many seconds so the caller can poll the
|
|
18
|
+
* matching status command (`test_status`) instead of blocking on the CLI wait cap.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_LONG_TASK_WAIT_SECONDS = 5;
|
|
21
|
+
/** Pipeline command name of a `command <name> ...` invocation; null when absent. */
|
|
22
|
+
export declare function extractPipelineCommandName(cliArgs: string[]): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Wait budget (ms) for the Unity CLI child process:
|
|
25
|
+
* - an explicit `--wait` wins (0 returns immediately);
|
|
26
|
+
* - long-running pipeline commands get a short budget so callers can poll status;
|
|
27
|
+
* - null means "wait synchronously for the CLI to finish" (unchanged behaviour).
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveWaitMilliseconds(cliArgs: string[], explicitWaitSeconds?: number): number | null;
|
|
30
|
+
/**
|
|
31
|
+
* Strips the wrapper's own `--wait <seconds>` / `--wait=<seconds>` from the
|
|
32
|
+
* passthrough tail. commander copies everything after the <project> operand
|
|
33
|
+
* verbatim (passThroughOptions), so a --wait written there must be lifted here
|
|
34
|
+
* and must never leak into the Unity CLI arguments.
|
|
35
|
+
*/
|
|
36
|
+
export declare function extractWaitOption(args: string[]): {
|
|
37
|
+
args: string[];
|
|
38
|
+
waitSeconds?: number;
|
|
39
|
+
};
|
|
40
|
+
/** Exec output log of a handed-back run: project-scoped, beside the install receipts. */
|
|
41
|
+
export declare function execLogPath(projectPath: string, commandName: string | null, now?: Date): string;
|
|
9
42
|
export interface ExecOptions {
|
|
10
43
|
downloadIfMissing?: boolean;
|
|
44
|
+
waitSeconds?: number;
|
|
11
45
|
}
|
|
12
46
|
export declare function runExec(projectPath: string, cliArgs: string[], options?: ExecOptions): Promise<{
|
|
13
47
|
exitCode: number;
|
package/dist/commands/exec.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
1
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
2
|
+
import { closeSync, mkdirSync, openSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
2
4
|
import { readProjectInfo } from '../projectVersion.js';
|
|
3
5
|
import { resolveRouteForProject } from '../routes.js';
|
|
4
6
|
import { verifyCliBinary, ensureCliBinary } from '../ensure.js';
|
|
@@ -21,6 +23,87 @@ export function findProjectPathOverride(args) {
|
|
|
21
23
|
export function buildExecArgs(cliArgs, projectPath) {
|
|
22
24
|
return [...cliArgs, '--project-path', projectPath];
|
|
23
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Pipeline commands that block until the Editor-side work finishes.
|
|
28
|
+
* The routed Unity CLI caps that wait at 30s, and its own `--timeout` is not wired
|
|
29
|
+
* in the shipped build (verified: a full run_tests still waits ~30s with
|
|
30
|
+
* `--timeout 1`), so the wait budget belongs to this wrapper.
|
|
31
|
+
*/
|
|
32
|
+
export const LONG_RUNNING_PIPELINE_COMMANDS = new Set(['run_tests']);
|
|
33
|
+
/**
|
|
34
|
+
* Long tasks hand control back after this many seconds so the caller can poll the
|
|
35
|
+
* matching status command (`test_status`) instead of blocking on the CLI wait cap.
|
|
36
|
+
*/
|
|
37
|
+
export const DEFAULT_LONG_TASK_WAIT_SECONDS = 5;
|
|
38
|
+
/** Pipeline command name of a `command <name> ...` invocation; null when absent. */
|
|
39
|
+
export function extractPipelineCommandName(cliArgs) {
|
|
40
|
+
const at = cliArgs.indexOf('command');
|
|
41
|
+
if (at < 0) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const name = cliArgs[at + 1];
|
|
45
|
+
return name !== undefined && !name.startsWith('-') ? name : null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Wait budget (ms) for the Unity CLI child process:
|
|
49
|
+
* - an explicit `--wait` wins (0 returns immediately);
|
|
50
|
+
* - long-running pipeline commands get a short budget so callers can poll status;
|
|
51
|
+
* - null means "wait synchronously for the CLI to finish" (unchanged behaviour).
|
|
52
|
+
*/
|
|
53
|
+
export function resolveWaitMilliseconds(cliArgs, explicitWaitSeconds) {
|
|
54
|
+
if (explicitWaitSeconds !== undefined) {
|
|
55
|
+
return Math.max(0, Math.round(explicitWaitSeconds * 1000));
|
|
56
|
+
}
|
|
57
|
+
const name = extractPipelineCommandName(cliArgs);
|
|
58
|
+
return name !== null && LONG_RUNNING_PIPELINE_COMMANDS.has(name)
|
|
59
|
+
? DEFAULT_LONG_TASK_WAIT_SECONDS * 1000
|
|
60
|
+
: null;
|
|
61
|
+
}
|
|
62
|
+
/** Non-negative seconds for --wait; throws on anything else. */
|
|
63
|
+
function parseWaitValue(raw) {
|
|
64
|
+
const value = Number(raw);
|
|
65
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
66
|
+
throw new CliError(`--wait 需要非负秒数,收到:${raw}`);
|
|
67
|
+
}
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Strips the wrapper's own `--wait <seconds>` / `--wait=<seconds>` from the
|
|
72
|
+
* passthrough tail. commander copies everything after the <project> operand
|
|
73
|
+
* verbatim (passThroughOptions), so a --wait written there must be lifted here
|
|
74
|
+
* and must never leak into the Unity CLI arguments.
|
|
75
|
+
*/
|
|
76
|
+
export function extractWaitOption(args) {
|
|
77
|
+
const rest = [];
|
|
78
|
+
let waitSeconds;
|
|
79
|
+
for (let i = 0; i < args.length; i++) {
|
|
80
|
+
const arg = args[i];
|
|
81
|
+
if (arg === undefined) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (arg === '--wait' || arg === '-wait') {
|
|
85
|
+
const value = args[i + 1];
|
|
86
|
+
if (value === undefined) {
|
|
87
|
+
throw new CliError('--wait 需要非负秒数。');
|
|
88
|
+
}
|
|
89
|
+
waitSeconds = parseWaitValue(value);
|
|
90
|
+
i++;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (arg.startsWith('--wait=')) {
|
|
94
|
+
waitSeconds = parseWaitValue(arg.slice('--wait='.length));
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
rest.push(arg);
|
|
98
|
+
}
|
|
99
|
+
return waitSeconds === undefined ? { args: rest } : { args: rest, waitSeconds };
|
|
100
|
+
}
|
|
101
|
+
/** Exec output log of a handed-back run: project-scoped, beside the install receipts. */
|
|
102
|
+
export function execLogPath(projectPath, commandName, now = new Date()) {
|
|
103
|
+
const stamp = now.toISOString().replace(/[:.]/g, '-');
|
|
104
|
+
const suffix = commandName === null ? '' : `-${commandName}`;
|
|
105
|
+
return join(projectPath, 'Library', 'editor-pipeline-cli', 'exec-logs', `${stamp}${suffix}.log`);
|
|
106
|
+
}
|
|
24
107
|
export async function runExec(projectPath, cliArgs, options = {}) {
|
|
25
108
|
const project = readProjectInfo(projectPath);
|
|
26
109
|
const route = resolveRouteForProject(project);
|
|
@@ -40,9 +123,71 @@ export async function runExec(projectPath, cliArgs, options = {}) {
|
|
|
40
123
|
// Re-verify the hash on every invocation (fail closed on tamper).
|
|
41
124
|
await verifyCliBinary(route.cli);
|
|
42
125
|
const args = buildExecArgs(cliArgs, project.projectPath);
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
|
|
126
|
+
const waitMs = resolveWaitMilliseconds(cliArgs, options.waitSeconds);
|
|
127
|
+
if (waitMs === null) {
|
|
128
|
+
const child = spawnSync(cliPath, args, { stdio: 'inherit', windowsHide: true });
|
|
129
|
+
if (child.error) {
|
|
130
|
+
throw new CliError(`CLI 执行失败:${child.error.message}`);
|
|
131
|
+
}
|
|
132
|
+
return { exitCode: child.status ?? 1 };
|
|
46
133
|
}
|
|
47
|
-
return
|
|
134
|
+
return runWithWaitBudget(cliPath, args, project.projectPath, waitMs, extractPipelineCommandName(cliArgs));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Runs the CLI under a wait budget. When the budget expires the child keeps running
|
|
138
|
+
* (the Editor-side work is independent of it) and the wrapper hands control back
|
|
139
|
+
* with the output log path, so callers can poll the matching status command.
|
|
140
|
+
*/
|
|
141
|
+
async function runWithWaitBudget(cliPath, args, projectPath, waitMs, commandName) {
|
|
142
|
+
const logPath = execLogPath(projectPath, commandName);
|
|
143
|
+
mkdirSync(dirname(logPath), { recursive: true });
|
|
144
|
+
const logFd = openSync(logPath, 'a');
|
|
145
|
+
const child = spawn(cliPath, args, { stdio: ['ignore', logFd, logFd], windowsHide: true });
|
|
146
|
+
const spawnState = { error: null };
|
|
147
|
+
child.once('error', (error) => {
|
|
148
|
+
spawnState.error = error;
|
|
149
|
+
});
|
|
150
|
+
const finished = await waitForExit(child, waitMs);
|
|
151
|
+
closeSync(logFd);
|
|
152
|
+
if (finished) {
|
|
153
|
+
if (spawnState.error !== null) {
|
|
154
|
+
throw new CliError(`CLI 执行失败:${spawnState.error.message}`);
|
|
155
|
+
}
|
|
156
|
+
process.stdout.write(readFileSync(logPath, 'utf8'));
|
|
157
|
+
return { exitCode: child.exitCode ?? 1 };
|
|
158
|
+
}
|
|
159
|
+
child.unref();
|
|
160
|
+
const label = commandName ?? 'pipeline 命令';
|
|
161
|
+
process.stderr.write(`[u-cli-mod] ${label} 仍在 Unity Editor 内继续执行:等待 ${(waitMs / 1000).toFixed(1)}s 后让出控制权(未中断)。\n` +
|
|
162
|
+
`[u-cli-mod] 结果请轮询状态命令,例如:u-cli-mod exec <project> -- command test_status\n` +
|
|
163
|
+
`[u-cli-mod] 完整输出日志:${logPath}\n` +
|
|
164
|
+
`[u-cli-mod] 需要同步等待时传 --wait <秒>(0 = 立即返回)。\n`);
|
|
165
|
+
return { exitCode: 0 };
|
|
166
|
+
}
|
|
167
|
+
/** true when the child exited inside the budget; false when the budget expired. */
|
|
168
|
+
/** true when the child exited inside the budget; false when the budget expired. */
|
|
169
|
+
function waitForExit(child, waitMs) {
|
|
170
|
+
return new Promise((resolve) => {
|
|
171
|
+
let settled = false;
|
|
172
|
+
const finish = (exited) => {
|
|
173
|
+
if (settled) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
settled = true;
|
|
177
|
+
resolve(exited);
|
|
178
|
+
};
|
|
179
|
+
const timer = setTimeout(() => finish(false), waitMs);
|
|
180
|
+
child.once('exit', () => {
|
|
181
|
+
clearTimeout(timer);
|
|
182
|
+
finish(true);
|
|
183
|
+
});
|
|
184
|
+
child.once('error', () => {
|
|
185
|
+
clearTimeout(timer);
|
|
186
|
+
finish(true);
|
|
187
|
+
});
|
|
188
|
+
if (waitMs === 0) {
|
|
189
|
+
clearTimeout(timer);
|
|
190
|
+
finish(false);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
48
193
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevlns/u-cli-mod",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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": {
|
|
@@ -68,4 +68,4 @@
|
|
|
68
68
|
"vitest": "^3.2.7"
|
|
69
69
|
},
|
|
70
70
|
"license": "MIT"
|
|
71
|
-
}
|
|
71
|
+
}
|
package/v-cli.plugin.json
CHANGED
|
@@ -217,11 +217,15 @@
|
|
|
217
217
|
{
|
|
218
218
|
"flags": "--download-if-missing",
|
|
219
219
|
"description": "CLI 缺失时自动下载"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"flags": "--wait <seconds>",
|
|
223
|
+
"description": "长任务等待上限(秒):到点后任务在 Editor 内继续,立即返回;0 = 立即返回"
|
|
220
224
|
}
|
|
221
225
|
],
|
|
222
226
|
"output": {
|
|
223
227
|
"format": "text",
|
|
224
|
-
"description": "Unity CLI stdout/stderr pass through verbatim (stdio inherit); the wrapper prints no JSON of its own."
|
|
228
|
+
"description": "Unity CLI stdout/stderr pass through verbatim (stdio inherit); the wrapper prints no JSON of its own. When the wait budget expires the child keeps running and the wrapper prints the log path plus the status command to poll."
|
|
225
229
|
},
|
|
226
230
|
"exitCodes": {
|
|
227
231
|
"0": "success",
|
|
@@ -233,7 +237,8 @@
|
|
|
233
237
|
"rejects every --project-path variant (case-insensitive: --project-path, --projectPath, -projectPath, --project_path, mixed case)",
|
|
234
238
|
"always appends the resolved --project-path as the final argument; the wrapper owns project targeting",
|
|
235
239
|
"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"
|
|
240
|
+
"the documented -- separator is consumed by the wrapper and never forwarded to the Unity CLI",
|
|
241
|
+
"long-running pipeline commands (run_tests) hand control back after 5s by default instead of blocking on the CLI 30s wait cap; the task keeps running inside the Editor — poll test_status, and pass --wait <seconds> to wait synchronously"
|
|
237
242
|
]
|
|
238
243
|
},
|
|
239
244
|
{
|