






















@@ -1055,6 +1055,7 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
10551055let downgradeRisk = false;
10561056let fallbackToLatest = false;
10571057let packageInstallSpec: string | null = null;
1058+let packageAlreadyCurrent = false;
1058105910591060if (updateInstallKind !== "git") {
10601061currentVersion = switchToPackage ? null : await readPackageVersion(root);
@@ -1069,6 +1070,13 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
10691070}
10701071const cmp =
10711072currentVersion && targetVersion ? compareSemverStrings(currentVersion, targetVersion) : null;
1073+packageAlreadyCurrent =
1074+updateInstallKind === "package" &&
1075+!switchToPackage &&
1076+currentVersion != null &&
1077+targetVersion != null &&
1078+currentVersion === targetVersion &&
1079+(requestedChannel === null || requestedChannel === storedChannel);
10721080downgradeRisk =
10731081canResolveRegistryVersionForPackageTarget(tag) &&
10741082!fallbackToLatest &&
@@ -1103,16 +1111,20 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
11031111actions.push(`Switch install mode from git to package manager (${mode})`);
11041112} else if (updateInstallKind === "git") {
11051113actions.push(`Run git update flow on channel ${channel} (fetch/rebase/build/doctor)`);
1114+} else if (packageAlreadyCurrent) {
1115+actions.push(`Skip package update; current version already matches ${targetVersion}`);
11061116} else {
11071117actions.push(`Run global package manager update with spec ${packageInstallSpec ?? tag}`);
11081118}
1109-actions.push("Run plugin update sync after core update");
1110-actions.push("Refresh shell completion cache (if needed)");
1111-actions.push(
1112-shouldRestart
1113- ? "Restart gateway service and run doctor checks"
1114- : "Skip restart (because --no-restart is set)",
1115-);
1119+if (!packageAlreadyCurrent) {
1120+actions.push("Run plugin update sync after core update");
1121+actions.push("Refresh shell completion cache (if needed)");
1122+actions.push(
1123+shouldRestart
1124+ ? "Restart gateway service and run doctor checks"
1125+ : "Skip restart (because --no-restart is set)",
1126+);
1127+}
1116112811171129const notes: string[] = [];
11181130if (opts.tag && updateInstallKind === "git") {
@@ -1183,6 +1195,25 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
11831195);
11841196}
118511971198+if (packageAlreadyCurrent) {
1199+const mode = isPackageManagerUpdateMode(updateStatus.packageManager)
1200+ ? updateStatus.packageManager
1201+ : "unknown";
1202+const result: UpdateRunResult = {
1203+status: "skipped",
1204+ mode,
1205+ root,
1206+reason: "already-current",
1207+before: { version: currentVersion },
1208+after: { version: currentVersion },
1209+steps: [],
1210+durationMs: 0,
1211+};
1212+printResult(result, opts);
1213+defaultRuntime.exit(0);
1214+return;
1215+}
1216+11861217if (updateInstallKind === "package") {
11871218const runtimePreflightError = await resolvePackageRuntimePreflightError({
11881219 tag,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。