mano-coding 0.1.31 → 0.1.32
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/bin.js +36 -11
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -3533,6 +3533,7 @@ var init_zh = __esm({
|
|
|
3533
3533
|
"selfUpgrade.toMustBeExact": "--to \u5FC5\u987B\u662F\u7CBE\u786E\u7684 SemVer \u7248\u672C\u3002",
|
|
3534
3534
|
"selfUpgrade.offlineCacheMiss": "\u672C\u5730\u66F4\u65B0\u7F13\u5B58\u4E2D\u6CA1\u6709\u8BF7\u6C42\u7684 CLI \u7248\u672C\u3002",
|
|
3535
3535
|
"selfUpgrade.fetchMetadataFailed": "\u65E0\u6CD5\u8BFB\u53D6 CLI \u7248\u672C\u5143\u6570\u636E\uFF1A{0}",
|
|
3536
|
+
"selfUpgrade.fetchMetadataTimeout": "\u7F51\u7EDC\u8BF7\u6C42\u8D85\u65F6\uFF08\u8D85\u8FC7 {0} \u79D2\uFF09\uFF0C\u65E0\u6CD5\u8BFB\u53D6 CLI \u7248\u672C\u5143\u6570\u636E\u3002\u5EFA\u8BAE\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\uFF0C\u6216\u901A\u8FC7\u73AF\u5883\u53D8\u91CF AICODING_NPM_REGISTRY \u914D\u7F6E\u56FD\u5185\u955C\u50CF\u6E90\uFF08\u4F8B\u5982 https://registry.npmmirror.com\uFF09",
|
|
3536
3537
|
"selfUpgrade.noLatestVersion": "Registry \u5143\u6570\u636E\u6CA1\u6709\u6709\u6548\u7684\u6700\u65B0 CLI \u7248\u672C\u3002",
|
|
3537
3538
|
"selfUpgrade.versionNotInMetadata": "CLI \u7248\u672C {0} \u4E0D\u5B58\u5728\u4E8E Registry \u5143\u6570\u636E\u4E2D\u3002",
|
|
3538
3539
|
"selfUpgrade.confirmationRequired": "CLI \u5347\u7EA7\u9700\u8981\u786E\u8BA4\u3002\u4F7F\u7528 --yes \u6279\u51C6\u3002",
|
|
@@ -50449,17 +50450,41 @@ async function verifyCliVersion(binPath, expected) {
|
|
|
50449
50450
|
const result = await runCommand(process.execPath, [binPath, "--version"]).catch(() => void 0);
|
|
50450
50451
|
return result?.exitCode === 0 && result.stdout.trim() === expected;
|
|
50451
50452
|
}
|
|
50452
|
-
async function fetchCliMetadata(registry, request = fetch) {
|
|
50453
|
-
const
|
|
50454
|
-
const
|
|
50455
|
-
|
|
50456
|
-
|
|
50457
|
-
|
|
50458
|
-
|
|
50459
|
-
|
|
50460
|
-
|
|
50461
|
-
|
|
50453
|
+
async function fetchCliMetadata(registry, request = fetch, options) {
|
|
50454
|
+
const envTimeout = process.env["AICODING_FETCH_TIMEOUT"] ? Number.parseInt(process.env["AICODING_FETCH_TIMEOUT"], 10) : void 0;
|
|
50455
|
+
const timeoutMs = options?.timeoutMs ?? (Number.isFinite(envTimeout) && (envTimeout ?? 0) > 0 ? envTimeout : 15e3);
|
|
50456
|
+
const maxRetries = options?.retries ?? 1;
|
|
50457
|
+
let lastError;
|
|
50458
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
50459
|
+
const controller = new AbortController();
|
|
50460
|
+
let timedOut = false;
|
|
50461
|
+
const timer = setTimeout(() => {
|
|
50462
|
+
timedOut = true;
|
|
50463
|
+
controller.abort();
|
|
50464
|
+
}, timeoutMs);
|
|
50465
|
+
timer.unref?.();
|
|
50466
|
+
try {
|
|
50467
|
+
const response = await request(`${registry}/${encodeURIComponent(CLI_PACKAGE_NAME)}`, {
|
|
50468
|
+
signal: controller.signal,
|
|
50469
|
+
redirect: "error"
|
|
50470
|
+
});
|
|
50471
|
+
if (!response.ok) throw new Error(`Registry returned HTTP ${response.status}`);
|
|
50472
|
+
return await response.json();
|
|
50473
|
+
} catch (error) {
|
|
50474
|
+
const isAbort = timedOut || error instanceof Error && (error.name === "AbortError" || error.message.includes("aborted"));
|
|
50475
|
+
if (isAbort) {
|
|
50476
|
+
lastError = new Error(t("selfUpgrade.fetchMetadataTimeout", Math.round(timeoutMs / 1e3)));
|
|
50477
|
+
} else {
|
|
50478
|
+
lastError = error;
|
|
50479
|
+
}
|
|
50480
|
+
if (attempt < maxRetries) {
|
|
50481
|
+
await new Promise((resolve28) => setTimeout(resolve28, 200));
|
|
50482
|
+
}
|
|
50483
|
+
} finally {
|
|
50484
|
+
clearTimeout(timer);
|
|
50485
|
+
}
|
|
50462
50486
|
}
|
|
50487
|
+
throw lastError;
|
|
50463
50488
|
}
|
|
50464
50489
|
async function runCommand(command, args) {
|
|
50465
50490
|
const useCmd = process.platform === "win32" && (command === "pnpm" || command === "npm");
|
|
@@ -50538,7 +50563,7 @@ import { createRequire as createRequire2 } from "node:module";
|
|
|
50538
50563
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
50539
50564
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
50540
50565
|
function resolveVersion() {
|
|
50541
|
-
if (true) return "0.1.
|
|
50566
|
+
if (true) return "0.1.32";
|
|
50542
50567
|
const candidates = [
|
|
50543
50568
|
new URL("../package.json", import.meta.url),
|
|
50544
50569
|
new URL("../../package.json", import.meta.url),
|