fix: posix PATH segments on Windows CI; sort imports for lint

This commit is contained in:
iliya 2026-03-19 22:30:26 +02:00
parent 731d15b722
commit 4bdfcbcb72
3 changed files with 14 additions and 12 deletions

View file

@ -201,6 +201,8 @@ electron-builder generates these artifacts per platform:
## Stable Download Links
The `upload-stable-links` job in `release.yml` re-uploads key assets with version-agnostic names.
It starts only after **release-mac** (two matrix jobs), **release-win**, and **release-linux** all succeed, so it often stays in **Queued** until the slowest job finishes. Delays of several minutes are common when macOS hosted runners are backed up.
This enables permanent links in README that always point to the latest release:
```

View file

@ -17,9 +17,9 @@
* - Human-readable error messages per phase
*/
import { execCli, killProcessTree, spawnCli } from '@main/utils/childProcess';
import { appendCliAuthDiag } from '@main/utils/cliAuthDiagLog';
import { buildMergedCliPath } from '@main/utils/cliPathMerge';
import { execCli, killProcessTree, spawnCli } from '@main/utils/childProcess';
import { getClaudeBasePath, getHomeDir } from '@main/utils/pathDecoder';
import {
getCachedShellEnv,

View file

@ -3,10 +3,9 @@
* Packaged macOS apps get a minimal PATH; login-shell cache fixes that once warm.
*/
import { realpathSync } from 'fs';
import { dirname, join, posix as pathPosix, win32 as pathWin32 } from 'path';
import { getCachedShellEnv, getShellPreferredHome } from '@main/utils/shellEnv';
import { realpathSync } from 'fs';
import { join as pathJoin, posix as pathPosix, win32 as pathWin32 } from 'path';
/**
* Build a PATH string that prefers the CLI binary directory, then the user's
@ -20,10 +19,11 @@ export function buildMergedCliPath(binaryPath?: string | null): string {
const extraDirs: string[] = [];
if (binaryPath) {
const binDir = dirname(binaryPath);
const pathForBin = process.platform === 'win32' ? pathWin32 : pathPosix;
const binDir = pathForBin.dirname(binaryPath);
extraDirs.push(binDir);
try {
const realBinDir = dirname(realpathSync(binaryPath));
const realBinDir = pathForBin.dirname(realpathSync(binaryPath));
if (realBinDir !== binDir) {
extraDirs.push(realBinDir);
}
@ -36,18 +36,18 @@ export function buildMergedCliPath(binaryPath?: string | null): string {
if (cachedEnv?.PATH) {
extraDirs.push(...cachedEnv.PATH.split(sep).filter(Boolean));
} else if (process.platform === 'win32') {
extraDirs.push(join(home, 'AppData', 'Roaming', 'npm'), join(home, 'scoop', 'shims'));
extraDirs.push(pathJoin(home, 'AppData', 'Roaming', 'npm'), pathJoin(home, 'scoop', 'shims'));
if (process.env.LOCALAPPDATA) {
extraDirs.push(join(process.env.LOCALAPPDATA, 'Programs', 'claude'));
extraDirs.push(pathJoin(process.env.LOCALAPPDATA, 'Programs', 'claude'));
}
if (process.env.ProgramFiles) {
extraDirs.push(join(process.env.ProgramFiles, 'claude'));
extraDirs.push(pathJoin(process.env.ProgramFiles, 'claude'));
}
} else {
extraDirs.push(
join(home, '.local', 'bin'),
join(home, '.npm-global', 'bin'),
join(home, '.npm', 'bin'),
pathPosix.join(home, '.local', 'bin'),
pathPosix.join(home, '.npm-global', 'bin'),
pathPosix.join(home, '.npm', 'bin'),
'/usr/local/bin',
'/opt/homebrew/bin'
);