uloop-cli 0.54.6 → 0.55.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/dist/cli.bundle.cjs +62 -13
- package/dist/cli.bundle.cjs.map +2 -2
- package/package.json +1 -1
- package/src/__tests__/cli-e2e.test.ts +64 -1
- package/src/cli.ts +72 -16
- package/src/default-tools.json +2 -2
- package/src/version.ts +1 -1
package/dist/cli.bundle.cjs
CHANGED
|
@@ -5759,7 +5759,7 @@ var import_path3 = require("path");
|
|
|
5759
5759
|
|
|
5760
5760
|
// src/default-tools.json
|
|
5761
5761
|
var default_tools_default = {
|
|
5762
|
-
version: "0.
|
|
5762
|
+
version: "0.55.0",
|
|
5763
5763
|
tools: [
|
|
5764
5764
|
{
|
|
5765
5765
|
name: "compile",
|
|
@@ -5803,7 +5803,7 @@ var default_tools_default = {
|
|
|
5803
5803
|
IncludeStackTrace: {
|
|
5804
5804
|
type: "boolean",
|
|
5805
5805
|
description: "Include stack trace in output",
|
|
5806
|
-
default:
|
|
5806
|
+
default: false
|
|
5807
5807
|
},
|
|
5808
5808
|
UseRegex: {
|
|
5809
5809
|
type: "boolean",
|
|
@@ -6185,12 +6185,15 @@ function saveToolsCache(cache) {
|
|
|
6185
6185
|
const content = JSON.stringify(cache, null, 2);
|
|
6186
6186
|
(0, import_fs3.writeFileSync)(cachePath, content, "utf-8");
|
|
6187
6187
|
}
|
|
6188
|
+
function hasCacheFile() {
|
|
6189
|
+
return (0, import_fs3.existsSync)(getCachePath());
|
|
6190
|
+
}
|
|
6188
6191
|
function getCacheFilePath() {
|
|
6189
6192
|
return getCachePath();
|
|
6190
6193
|
}
|
|
6191
6194
|
|
|
6192
6195
|
// src/version.ts
|
|
6193
|
-
var VERSION = "0.
|
|
6196
|
+
var VERSION = "0.55.0";
|
|
6194
6197
|
|
|
6195
6198
|
// src/spinner.ts
|
|
6196
6199
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
@@ -7246,10 +7249,6 @@ program2.command("fix").description("Clean up stale lock files that may prevent
|
|
|
7246
7249
|
cleanupLockFiles();
|
|
7247
7250
|
});
|
|
7248
7251
|
registerSkillsCommand(program2);
|
|
7249
|
-
var toolsCache = loadToolsCache();
|
|
7250
|
-
for (const tool of toolsCache.tools) {
|
|
7251
|
-
registerToolCommand(tool);
|
|
7252
|
-
}
|
|
7253
7252
|
function registerToolCommand(tool) {
|
|
7254
7253
|
const cmd = program2.command(tool.name).description(tool.description);
|
|
7255
7254
|
const properties = tool.inputSchema.properties;
|
|
@@ -7257,8 +7256,9 @@ function registerToolCommand(tool) {
|
|
|
7257
7256
|
const optionStr = generateOptionString(propName, propInfo);
|
|
7258
7257
|
const description = buildOptionDescription(propInfo);
|
|
7259
7258
|
const defaultValue = propInfo.default;
|
|
7260
|
-
if (defaultValue !== void 0) {
|
|
7261
|
-
|
|
7259
|
+
if (defaultValue !== void 0 && defaultValue !== null) {
|
|
7260
|
+
const defaultStr = convertDefaultToString(defaultValue);
|
|
7261
|
+
cmd.option(optionStr, description, defaultStr);
|
|
7262
7262
|
} else {
|
|
7263
7263
|
cmd.option(optionStr, description);
|
|
7264
7264
|
}
|
|
@@ -7275,12 +7275,18 @@ function registerToolCommand(tool) {
|
|
|
7275
7275
|
);
|
|
7276
7276
|
});
|
|
7277
7277
|
}
|
|
7278
|
+
function convertDefaultToString(value) {
|
|
7279
|
+
if (typeof value === "string") {
|
|
7280
|
+
return value;
|
|
7281
|
+
}
|
|
7282
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
7283
|
+
return String(value);
|
|
7284
|
+
}
|
|
7285
|
+
return JSON.stringify(value);
|
|
7286
|
+
}
|
|
7278
7287
|
function generateOptionString(propName, propInfo) {
|
|
7279
7288
|
const kebabName = pascalToKebabCase(propName);
|
|
7280
|
-
|
|
7281
|
-
if (lowerType === "boolean") {
|
|
7282
|
-
return `--${kebabName}`;
|
|
7283
|
-
}
|
|
7289
|
+
void propInfo;
|
|
7284
7290
|
return `--${kebabName} <value>`;
|
|
7285
7291
|
}
|
|
7286
7292
|
function buildOptionDescription(propInfo) {
|
|
@@ -7304,7 +7310,26 @@ function buildParams(options, properties) {
|
|
|
7304
7310
|
}
|
|
7305
7311
|
function convertValue(value, propInfo) {
|
|
7306
7312
|
const lowerType = propInfo.type.toLowerCase();
|
|
7313
|
+
if (lowerType === "boolean" && typeof value === "string") {
|
|
7314
|
+
const lower = value.toLowerCase();
|
|
7315
|
+
if (lower === "true") {
|
|
7316
|
+
return true;
|
|
7317
|
+
}
|
|
7318
|
+
if (lower === "false") {
|
|
7319
|
+
return false;
|
|
7320
|
+
}
|
|
7321
|
+
throw new Error(`Invalid boolean value: ${value}. Use 'true' or 'false'.`);
|
|
7322
|
+
}
|
|
7307
7323
|
if (lowerType === "array" && typeof value === "string") {
|
|
7324
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
7325
|
+
try {
|
|
7326
|
+
const parsed = JSON.parse(value);
|
|
7327
|
+
if (Array.isArray(parsed)) {
|
|
7328
|
+
return parsed;
|
|
7329
|
+
}
|
|
7330
|
+
} catch {
|
|
7331
|
+
}
|
|
7332
|
+
}
|
|
7308
7333
|
return value.split(",").map((s) => s.trim());
|
|
7309
7334
|
}
|
|
7310
7335
|
if (lowerType === "integer" && typeof value === "string") {
|
|
@@ -7649,6 +7674,30 @@ async function main() {
|
|
|
7649
7674
|
if (handleCompletionOptions()) {
|
|
7650
7675
|
return;
|
|
7651
7676
|
}
|
|
7677
|
+
const cachedVersion = loadToolsCache().version;
|
|
7678
|
+
if (hasCacheFile() && cachedVersion !== VERSION) {
|
|
7679
|
+
console.log(
|
|
7680
|
+
`\x1B[33mCache outdated (${cachedVersion} \u2192 ${VERSION}). Syncing tools from Unity...\x1B[0m`
|
|
7681
|
+
);
|
|
7682
|
+
try {
|
|
7683
|
+
await syncTools({});
|
|
7684
|
+
console.log("\x1B[32m\u2713 Tools synced successfully.\x1B[0m\n");
|
|
7685
|
+
} catch (error) {
|
|
7686
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
7687
|
+
if (isConnectionError(message)) {
|
|
7688
|
+
console.error("\x1B[33mWarning: Failed to sync tools. Using cached definitions.\x1B[0m");
|
|
7689
|
+
console.error("\x1B[33mRun 'uloop sync' manually when Unity is available.\x1B[0m\n");
|
|
7690
|
+
} else {
|
|
7691
|
+
console.error("\x1B[33mWarning: Failed to sync tools. Using cached definitions.\x1B[0m");
|
|
7692
|
+
console.error(`\x1B[33mError: ${message}\x1B[0m`);
|
|
7693
|
+
console.error("\x1B[33mRun 'uloop sync' manually when Unity is available.\x1B[0m\n");
|
|
7694
|
+
}
|
|
7695
|
+
}
|
|
7696
|
+
}
|
|
7697
|
+
const toolsCache = loadToolsCache();
|
|
7698
|
+
for (const tool of toolsCache.tools) {
|
|
7699
|
+
registerToolCommand(tool);
|
|
7700
|
+
}
|
|
7652
7701
|
const args = process.argv.slice(2);
|
|
7653
7702
|
const cmdName = args.find((arg) => !arg.startsWith("-"));
|
|
7654
7703
|
if (cmdName && !commandExists(cmdName)) {
|