feat: prepare Zhinian desktop pilot
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
inman
2026-05-07 21:49:20 +08:00
parent cddaf37016
commit 0abc48189c
103 changed files with 10975 additions and 2049 deletions

View File

@@ -8,8 +8,8 @@ import {
existsSync,
mkdirSync,
readFileSync,
rmSync,
symlinkSync,
unlinkSync,
} from 'node:fs';
import { spawn } from 'node:child_process';
import { homedir } from 'node:os';
@@ -150,10 +150,9 @@ export async function installOpenClawCli(): Promise<{
try {
mkdirSync(targetDir, { recursive: true });
// Remove existing file/symlink to avoid EEXIST
if (existsSync(target)) {
unlinkSync(target);
}
// Remove existing file/symlink to avoid EEXIST. `existsSync` is false for
// broken symlinks, so use rmSync directly with force.
rmSync(target, { force: true });
symlinkSync(wrapperSrc, target);
chmodSync(wrapperSrc, 0o755);
@@ -304,7 +303,7 @@ export async function autoInstallCliIfNeeded(
if (isCliInstalled()) {
if (target && wrapperSrc && existsSync(target)) {
try {
unlinkSync(target);
rmSync(target, { force: true });
symlinkSync(wrapperSrc, target);
logger.debug(`Refreshed CLI symlink: ${target} -> ${wrapperSrc}`);
} catch {