mano-coding 0.1.39 → 0.1.41
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
CHANGED
|
@@ -23725,21 +23725,9 @@ function isValidLocalPath(localPath) {
|
|
|
23725
23725
|
if (!localPath || localPath.trim().length === 0) {
|
|
23726
23726
|
return false;
|
|
23727
23727
|
}
|
|
23728
|
-
if (
|
|
23728
|
+
if (localPath.includes("\0")) {
|
|
23729
23729
|
return false;
|
|
23730
23730
|
}
|
|
23731
|
-
if (/^[a-zA-Z]:/.test(localPath)) {
|
|
23732
|
-
return false;
|
|
23733
|
-
}
|
|
23734
|
-
if (localPath.includes("\\")) {
|
|
23735
|
-
return false;
|
|
23736
|
-
}
|
|
23737
|
-
const parts = localPath.split("/");
|
|
23738
|
-
for (const part of parts) {
|
|
23739
|
-
if (part === "..") {
|
|
23740
|
-
return false;
|
|
23741
|
-
}
|
|
23742
|
-
}
|
|
23743
23731
|
return true;
|
|
23744
23732
|
}
|
|
23745
23733
|
function toProjectRelativePath(absPath, projectRoot) {
|
|
@@ -23777,8 +23765,8 @@ var init_local_resolver = __esm({
|
|
|
23777
23765
|
versionRange
|
|
23778
23766
|
);
|
|
23779
23767
|
}
|
|
23780
|
-
const
|
|
23781
|
-
if (!
|
|
23768
|
+
const rawLocalPath = source.path;
|
|
23769
|
+
if (!rawLocalPath) {
|
|
23782
23770
|
throw new ResolveError(
|
|
23783
23771
|
`local \u6E90\u9700\u8981 path \u53C2\u6570`,
|
|
23784
23772
|
"RESOLVE_SOURCE_INVALID",
|
|
@@ -23786,22 +23774,47 @@ var init_local_resolver = __esm({
|
|
|
23786
23774
|
versionRange
|
|
23787
23775
|
);
|
|
23788
23776
|
}
|
|
23789
|
-
if (!isValidLocalPath(
|
|
23777
|
+
if (!isValidLocalPath(rawLocalPath)) {
|
|
23790
23778
|
throw new ResolveError(
|
|
23791
|
-
`local \u6E90\u8DEF\u5F84 '${
|
|
23779
|
+
`local \u6E90\u8DEF\u5F84 '${rawLocalPath}' \u4E0D\u5408\u6CD5`,
|
|
23792
23780
|
"RESOLVE_PATH_INVALID",
|
|
23793
23781
|
packageId,
|
|
23794
23782
|
versionRange
|
|
23795
23783
|
);
|
|
23796
23784
|
}
|
|
23785
|
+
const localPath = rawLocalPath.replaceAll("\\", "/");
|
|
23797
23786
|
const baseRoot = this.manifestRootProvider?.() ?? context.projectRoot ?? process.cwd();
|
|
23798
|
-
const
|
|
23787
|
+
const isAbs = isAbsolute2(localPath) || /^[a-zA-Z]:/.test(localPath);
|
|
23788
|
+
let absPath;
|
|
23789
|
+
if (isAbs) {
|
|
23790
|
+
absPath = normalize(localPath).replaceAll("\\", "/");
|
|
23791
|
+
} else {
|
|
23792
|
+
const cwdCandidate = normalize(resolvePath2(process.cwd(), localPath)).replaceAll("\\", "/");
|
|
23793
|
+
const baseRootCandidate = normalize(resolvePath2(baseRoot, localPath)).replaceAll("\\", "/");
|
|
23794
|
+
let foundInCwd = false;
|
|
23795
|
+
try {
|
|
23796
|
+
await access3(resolvePath2(cwdCandidate, "manifest.yaml"));
|
|
23797
|
+
foundInCwd = true;
|
|
23798
|
+
} catch {
|
|
23799
|
+
}
|
|
23800
|
+
if (foundInCwd) {
|
|
23801
|
+
absPath = cwdCandidate;
|
|
23802
|
+
} else {
|
|
23803
|
+
let foundInBaseRoot = false;
|
|
23804
|
+
try {
|
|
23805
|
+
await access3(resolvePath2(baseRootCandidate, "manifest.yaml"));
|
|
23806
|
+
foundInBaseRoot = true;
|
|
23807
|
+
} catch {
|
|
23808
|
+
}
|
|
23809
|
+
absPath = foundInBaseRoot ? baseRootCandidate : cwdCandidate;
|
|
23810
|
+
}
|
|
23811
|
+
}
|
|
23799
23812
|
const manifestPath = resolvePath2(absPath, "manifest.yaml");
|
|
23800
23813
|
try {
|
|
23801
23814
|
await access3(manifestPath);
|
|
23802
23815
|
} catch {
|
|
23803
23816
|
throw new ResolveError(
|
|
23804
|
-
`\u672C\u5730\u8DEF\u5F84 '${
|
|
23817
|
+
`\u672C\u5730\u8DEF\u5F84 '${rawLocalPath}' \u4E0B\u672A\u627E\u5230 manifest.yaml`,
|
|
23805
23818
|
"RESOLVE_MANIFEST_NOT_FOUND",
|
|
23806
23819
|
packageId,
|
|
23807
23820
|
versionRange
|
|
@@ -23876,7 +23889,7 @@ var init_local_resolver = __esm({
|
|
|
23876
23889
|
}
|
|
23877
23890
|
}
|
|
23878
23891
|
const integrity = computeContentDigest(manifestContent);
|
|
23879
|
-
const lockPath = toProjectRelativePath(absPath, baseRoot);
|
|
23892
|
+
const lockPath = toProjectRelativePath(absPath, baseRoot).replaceAll("\\", "/");
|
|
23880
23893
|
const resolvedSource = {
|
|
23881
23894
|
type: "local",
|
|
23882
23895
|
path: lockPath
|
|
@@ -45923,10 +45936,11 @@ async function buildRequestedSource(req) {
|
|
|
45923
45936
|
"RESOLVE_SOURCE_INVALID"
|
|
45924
45937
|
);
|
|
45925
45938
|
}
|
|
45939
|
+
const normalizedPath = req.localPath.replaceAll("\\", "/");
|
|
45926
45940
|
return {
|
|
45927
45941
|
packageId,
|
|
45928
45942
|
versionRange,
|
|
45929
|
-
source: { type: "local", path:
|
|
45943
|
+
source: { type: "local", path: normalizedPath }
|
|
45930
45944
|
};
|
|
45931
45945
|
}
|
|
45932
45946
|
return {
|
|
@@ -52750,7 +52764,11 @@ async function verifyCliVersion(binPath, expected, runner = runCommand) {
|
|
|
52750
52764
|
}
|
|
52751
52765
|
async function performUpgrade(installation, targetVersion, offline, runner = runCommand) {
|
|
52752
52766
|
const args = installation.manager === "npm" ? ["install", "-g", `${CLI_PACKAGE_NAME}@${targetVersion}`] : ["add", "-g", `${CLI_PACKAGE_NAME}@${targetVersion}`];
|
|
52753
|
-
if (offline)
|
|
52767
|
+
if (offline) {
|
|
52768
|
+
args.push("--offline");
|
|
52769
|
+
} else if (installation.manager === "npm") {
|
|
52770
|
+
args.push("--prefer-online");
|
|
52771
|
+
}
|
|
52754
52772
|
const result = await runner(installation.managerExecutable, args);
|
|
52755
52773
|
if (result.exitCode === 0 && await verifyCliVersion(installation.binPath, targetVersion, runner)) {
|
|
52756
52774
|
return;
|
|
@@ -52765,7 +52783,9 @@ async function performUpgrade(installation, targetVersion, offline, runner = run
|
|
|
52765
52783
|
"CLI_UPDATE_ROLLBACK_FAILED"
|
|
52766
52784
|
);
|
|
52767
52785
|
}
|
|
52768
|
-
|
|
52786
|
+
const rawErr = (result.stderr || result.stdout || "").trim();
|
|
52787
|
+
const detail = rawErr ? ` (${rawErr.split("\n")[0].replace(/[\r\n]+/g, " ").slice(0, 100)})` : "";
|
|
52788
|
+
throw new CliError(`${t("selfUpgrade.upgradeFailed")}${detail}`, ExitCode.ExecuteFailed, "CLI_UPDATE_FAILED");
|
|
52769
52789
|
}
|
|
52770
52790
|
async function fetchCliMetadata(registry, request = fetch, options) {
|
|
52771
52791
|
const envTimeout = process.env["AICODING_FETCH_TIMEOUT"] ? Number.parseInt(process.env["AICODING_FETCH_TIMEOUT"], 10) : void 0;
|
|
@@ -52951,6 +52971,15 @@ async function executeSelfUpgrade(options, cliVersion) {
|
|
|
52951
52971
|
rollbackResult: "not-needed"
|
|
52952
52972
|
});
|
|
52953
52973
|
await cacheRepository.resetAutoUpdateFailure().catch(() => void 0);
|
|
52974
|
+
const previous = await cacheRepository.read().catch(() => void 0);
|
|
52975
|
+
const isHigher = !previous?.latestVersion || isCliUpdateAvailable(previous.latestVersion, result.plan.targetVersion);
|
|
52976
|
+
await cacheRepository.write({
|
|
52977
|
+
schemaVersion: 1,
|
|
52978
|
+
registryOrigin: registry,
|
|
52979
|
+
checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
52980
|
+
latestVersion: isHigher ? result.plan.targetVersion : previous.latestVersion,
|
|
52981
|
+
...previous?.lastNotifiedAt ? { lastNotifiedAt: previous.lastNotifiedAt } : {}
|
|
52982
|
+
}).catch(() => void 0);
|
|
52954
52983
|
}
|
|
52955
52984
|
if (options.json) emitSuccessJson("self-upgrade", { dryRun: result.dryRun, ...result.plan, changed: result.changed });
|
|
52956
52985
|
else if (result.dryRun) writeHumanOutput(
|
|
@@ -53082,9 +53111,11 @@ async function scheduleAutoUpdateWorker(argv, currentVersion, options) {
|
|
|
53082
53111
|
const cacheRepository = new CliUpdateCacheRepository(userDataDir);
|
|
53083
53112
|
const cache = await cacheRepository.read();
|
|
53084
53113
|
if (cache?.autoUpdatePaused) return;
|
|
53114
|
+
const forceCheck = Boolean(process.env["AICODING_FORCE_UPDATE_CHECK"]) && process.env["AICODING_FORCE_UPDATE_CHECK"] !== "0" && process.env["AICODING_FORCE_UPDATE_CHECK"] !== "false";
|
|
53085
53115
|
const checkedAt = cache?.checkedAt ? Date.parse(cache.checkedAt) : Number.NaN;
|
|
53086
|
-
const
|
|
53087
|
-
|
|
53116
|
+
const isFresh = Number.isFinite(checkedAt) && Date.now() - checkedAt < AUTO_UPDATE_CHECK_INTERVAL_MS;
|
|
53117
|
+
const isCacheStale = Boolean(cache?.latestVersion && isCliUpdateAvailable(cache.latestVersion, currentVersion));
|
|
53118
|
+
if (!forceCheck && isFresh && !isCacheStale && (!cache?.latestVersion || !isCliUpdateAvailable(currentVersion, cache.latestVersion))) {
|
|
53088
53119
|
return;
|
|
53089
53120
|
}
|
|
53090
53121
|
if (options?.spawner) {
|
|
@@ -53118,11 +53149,13 @@ async function executeAutoUpdateWorker(options) {
|
|
|
53118
53149
|
if (cache?.autoUpdatePaused) return;
|
|
53119
53150
|
const registry = getRegistryUrl2();
|
|
53120
53151
|
if (!registry) return;
|
|
53152
|
+
const forceCheck = Boolean(process.env["AICODING_FORCE_UPDATE_CHECK"]) && process.env["AICODING_FORCE_UPDATE_CHECK"] !== "0" && process.env["AICODING_FORCE_UPDATE_CHECK"] !== "false";
|
|
53121
53153
|
const checkedAt = cache?.checkedAt ? Date.parse(cache.checkedAt) : Number.NaN;
|
|
53122
|
-
const
|
|
53154
|
+
const isFresh = Number.isFinite(checkedAt) && Date.now() - checkedAt < AUTO_UPDATE_CHECK_INTERVAL_MS;
|
|
53155
|
+
const isCacheStale = Boolean(cache?.latestVersion && isCliUpdateAvailable(cache.latestVersion, options.cliVersion));
|
|
53123
53156
|
let targetVersion = cache?.latestVersion;
|
|
53124
53157
|
let enginesNode = cache?.latestEnginesNode;
|
|
53125
|
-
if (!
|
|
53158
|
+
if (forceCheck || !isFresh || isCacheStale || !targetVersion || !isCliUpdateAvailable(options.cliVersion, targetVersion)) {
|
|
53126
53159
|
const metadata = await fetchCliMetadata(registry, options.fetcher, { timeoutMs: 3e3, retries: 0 }).catch(() => void 0);
|
|
53127
53160
|
if (!metadata) return;
|
|
53128
53161
|
const latest = parseLatestCliVersion(metadata);
|
|
@@ -53237,7 +53270,7 @@ function getRegistryUrl2() {
|
|
|
53237
53270
|
return "";
|
|
53238
53271
|
}
|
|
53239
53272
|
}
|
|
53240
|
-
var DEFAULT_NPM_REGISTRY2;
|
|
53273
|
+
var DEFAULT_NPM_REGISTRY2, AUTO_UPDATE_CHECK_INTERVAL_MS;
|
|
53241
53274
|
var init_auto_update = __esm({
|
|
53242
53275
|
"packages/cli/src/commands/auto-update.ts"() {
|
|
53243
53276
|
"use strict";
|
|
@@ -53246,6 +53279,7 @@ var init_auto_update = __esm({
|
|
|
53246
53279
|
init_self_upgrade_pipeline();
|
|
53247
53280
|
init_cli_output();
|
|
53248
53281
|
DEFAULT_NPM_REGISTRY2 = "https://registry.npmjs.org";
|
|
53282
|
+
AUTO_UPDATE_CHECK_INTERVAL_MS = 60 * 60 * 1e3;
|
|
53249
53283
|
}
|
|
53250
53284
|
});
|
|
53251
53285
|
|
|
@@ -53287,7 +53321,7 @@ import { createRequire as createRequire2 } from "node:module";
|
|
|
53287
53321
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
53288
53322
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
53289
53323
|
function resolveVersion() {
|
|
53290
|
-
if (true) return "0.1.
|
|
53324
|
+
if (true) return "0.1.41";
|
|
53291
53325
|
const candidates = [
|
|
53292
53326
|
new URL("../package.json", import.meta.url),
|
|
53293
53327
|
new URL("../../package.json", import.meta.url),
|
|
@@ -43,6 +43,13 @@
|
|
|
43
43
|
"maxLength": 512,
|
|
44
44
|
"pattern": "^(?![A-Za-z]:)(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\)(?!.*//)(?!\\.?$).+$"
|
|
45
45
|
},
|
|
46
|
+
"localSourcePath": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"minLength": 1,
|
|
49
|
+
"maxLength": 1024,
|
|
50
|
+
"pattern": "^(?!.*\\\\).+$",
|
|
51
|
+
"description": "Normalized local source path; forward slashes only"
|
|
52
|
+
},
|
|
46
53
|
"integrity": {
|
|
47
54
|
"type": "string",
|
|
48
55
|
"pattern": "^(sha256|sha512)-[A-Za-z0-9+/]+={0,2}$",
|
|
@@ -111,7 +118,7 @@
|
|
|
111
118
|
"required": ["type", "path"],
|
|
112
119
|
"properties": {
|
|
113
120
|
"type": { "const": "local" },
|
|
114
|
-
"path": { "$ref": "#/$defs/
|
|
121
|
+
"path": { "$ref": "#/$defs/localSourcePath" }
|
|
115
122
|
},
|
|
116
123
|
"additionalProperties": false
|
|
117
124
|
},
|
|
@@ -178,7 +185,7 @@
|
|
|
178
185
|
"required": ["type", "path"],
|
|
179
186
|
"properties": {
|
|
180
187
|
"type": { "const": "local" },
|
|
181
|
-
"path": { "$ref": "#/$defs/
|
|
188
|
+
"path": { "$ref": "#/$defs/localSourcePath" }
|
|
182
189
|
},
|
|
183
190
|
"additionalProperties": false
|
|
184
191
|
},
|
package/package.json
CHANGED
|
@@ -43,6 +43,13 @@
|
|
|
43
43
|
"maxLength": 512,
|
|
44
44
|
"pattern": "^(?![A-Za-z]:)(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\)(?!.*//)(?!\\.?$).+$"
|
|
45
45
|
},
|
|
46
|
+
"localSourcePath": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"minLength": 1,
|
|
49
|
+
"maxLength": 1024,
|
|
50
|
+
"pattern": "^(?!.*\\\\).+$",
|
|
51
|
+
"description": "Normalized local source path; forward slashes only"
|
|
52
|
+
},
|
|
46
53
|
"integrity": {
|
|
47
54
|
"type": "string",
|
|
48
55
|
"pattern": "^(sha256|sha512)-[A-Za-z0-9+/]+={0,2}$",
|
|
@@ -111,7 +118,7 @@
|
|
|
111
118
|
"required": ["type", "path"],
|
|
112
119
|
"properties": {
|
|
113
120
|
"type": { "const": "local" },
|
|
114
|
-
"path": { "$ref": "#/$defs/
|
|
121
|
+
"path": { "$ref": "#/$defs/localSourcePath" }
|
|
115
122
|
},
|
|
116
123
|
"additionalProperties": false
|
|
117
124
|
},
|
|
@@ -178,7 +185,7 @@
|
|
|
178
185
|
"required": ["type", "path"],
|
|
179
186
|
"properties": {
|
|
180
187
|
"type": { "const": "local" },
|
|
181
|
-
"path": { "$ref": "#/$defs/
|
|
188
|
+
"path": { "$ref": "#/$defs/localSourcePath" }
|
|
182
189
|
},
|
|
183
190
|
"additionalProperties": false
|
|
184
191
|
},
|