fix(update): automatically ensure hose-aipro symlink exists upon binary update

This commit is contained in:
gitea committed 2026-09-18 12:01:28 +08:00
1 parent c18ff02386
commit 3573ef71aa
1 file changed
+21 -1
+21 -1
View File
@@ -1,4 +1,4 @@
import { chmodSync, existsSync, mkdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
import { chmodSync, existsSync, mkdirSync, renameSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { spawnSync } from "node:child_process";
import { isCompiledBinary, resolveAppRoot } from "../../core/runtime.js";
@@ -458,8 +458,28 @@ export async function handleUpdateCommand(
// ignore
}
renameSync(newBinaryPath, execPath);
// Ensure Windows hose-aipro.cmd wrapper exists
const cmdWrapper = join(execDir, "hose-aipro.cmd");
if (!existsSync(cmdWrapper)) {
try {
writeFileSync(cmdWrapper, '@echo off\r\n"%~dp0hose-use.exe" %*\r\n', "utf8");
} catch {
// ignore
}
}
} else {
renameSync(newBinaryPath, execPath);
// Ensure Unix hose-aipro symlink exists and points to the main binary
const aiproLink = join(execDir, "hose-aipro");
if (!existsSync(aiproLink)) {
try {
symlinkSync(execPath, aiproLink);
} catch {
// ignore
}
}
}
const skillSync = syncGlobalSkillIfPresent();