uloop-cli 0.55.0 → 0.55.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/dist/cli.bundle.cjs +27 -3
- package/dist/cli.bundle.cjs.map +2 -2
- package/package.json +1 -1
- package/src/__tests__/cli-e2e.test.ts +17 -0
- package/src/cli.ts +22 -0
- package/src/default-tools.json +1 -1
- package/src/direct-unity-client.ts +5 -1
- package/src/version.ts +1 -1
package/package.json
CHANGED
|
@@ -457,6 +457,23 @@ describe('CLI E2E Tests (requires running Unity)', () => {
|
|
|
457
457
|
});
|
|
458
458
|
});
|
|
459
459
|
|
|
460
|
+
describe('execute-dynamic-code', () => {
|
|
461
|
+
it('should execute simple code without parameters', () => {
|
|
462
|
+
// Result is serialized as string by Unity
|
|
463
|
+
const result = runCliJson<{ Result: string }>('execute-dynamic-code --code "return 1;"');
|
|
464
|
+
|
|
465
|
+
expect(result.Result).toBe('1');
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
it('should execute code with explicit empty parameters', () => {
|
|
469
|
+
const result = runCliJson<{ Result: string }>(
|
|
470
|
+
'execute-dynamic-code --code "return \\"hello\\";" --parameters "{}"',
|
|
471
|
+
);
|
|
472
|
+
|
|
473
|
+
expect(result.Result).toBe('hello');
|
|
474
|
+
});
|
|
475
|
+
});
|
|
476
|
+
|
|
460
477
|
describe('error handling', () => {
|
|
461
478
|
it('should handle unknown commands gracefully', () => {
|
|
462
479
|
const { exitCode } = runCli('unknown-command');
|
package/src/cli.ts
CHANGED
|
@@ -232,6 +232,28 @@ function convertValue(value: unknown, propInfo: ToolProperty): unknown {
|
|
|
232
232
|
return parsed;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
if (lowerType === 'object') {
|
|
236
|
+
if (typeof value === 'string') {
|
|
237
|
+
const trimmed = value.trim();
|
|
238
|
+
if (!trimmed.startsWith('{') || !trimmed.endsWith('}')) {
|
|
239
|
+
throw new Error(`Invalid object value: ${value}. Use JSON object syntax.`);
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
const parsed: unknown = JSON.parse(trimmed);
|
|
243
|
+
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
|
|
244
|
+
return parsed;
|
|
245
|
+
}
|
|
246
|
+
} catch {
|
|
247
|
+
// fall through to error below
|
|
248
|
+
}
|
|
249
|
+
throw new Error(`Invalid object value: ${value}. Use JSON object syntax.`);
|
|
250
|
+
}
|
|
251
|
+
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
252
|
+
return value;
|
|
253
|
+
}
|
|
254
|
+
throw new Error(`Invalid object value: ${String(value)}. Use JSON object syntax.`);
|
|
255
|
+
}
|
|
256
|
+
|
|
235
257
|
return value;
|
|
236
258
|
}
|
|
237
259
|
|
package/src/default-tools.json
CHANGED
|
@@ -73,7 +73,11 @@ export class DirectUnityClient {
|
|
|
73
73
|
return new Promise((resolve, reject) => {
|
|
74
74
|
const socket = this.socket!;
|
|
75
75
|
const timeoutId = setTimeout(() => {
|
|
76
|
-
reject(
|
|
76
|
+
reject(
|
|
77
|
+
new Error(
|
|
78
|
+
`Request timed out after ${NETWORK_TIMEOUT_MS}ms. Unity may be frozen or busy. Please report this to the user and ask how to proceed. Do NOT kill Unity processes without user permission.`,
|
|
79
|
+
),
|
|
80
|
+
);
|
|
77
81
|
}, NETWORK_TIMEOUT_MS);
|
|
78
82
|
|
|
79
83
|
const onData = (chunk: Buffer): void => {
|
package/src/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* This file exists to avoid bundling the entire package.json into the CLI bundle.
|
|
5
5
|
* This version is automatically updated by release-please.
|
|
6
6
|
*/
|
|
7
|
-
export const VERSION = '0.55.
|
|
7
|
+
export const VERSION = '0.55.2'; // x-release-please-version
|