From 3573ef71aa722cd985ead4dae855304da0d5e2b3 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Fri, 18 Sep 2026 12:01:28 +0800 Subject: [PATCH] fix(update): automatically ensure hose-aipro symlink exists upon binary update --- src/cli/commands/update.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/cli/commands/update.ts b/src/cli/commands/update.ts index 0bddf9a..166d187 100644 --- a/src/cli/commands/update.ts +++ b/src/cli/commands/update.ts @@ -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();