Commit Graph

12 Commits

Author SHA1 Message Date
xintaofei
022172a9ea chore(lint): clean up frontend and Rust lint issues 2026-04-23 15:56:41 +08:00
xintaofei
94ebfaabdc fix(process): apply C.UTF-8 locale across platforms for child processes
Previously LANG/LC_ALL were only set on Windows, so git stderr was
localized on macOS/Linux and substring checks for English messages
(e.g. 'unknown revision or path not in the working tree') silently
failed — empty-repo/missing-branch cases surfaced as red error
banners in the Git log panel instead of rendering as empty lists.
2026-04-19 06:49:24 +08:00
xintaofei
17f4ee88e8 fix(process): use semver-aware sorting for Node.js version selection
Replace lexicographic sort with numeric (major, minor, patch) sort
across all 7 version-directory sort sites in find_node_bin_dir.

Lexicographic sort incorrectly orders v20.9 > v20.11 (because '9' > '1')
which could select an older Node.js version and cause agent preflight
failures for version-gated agents like OpenClaw (requires >=22.12.0).
2026-04-16 12:48:21 +08:00
xintaofei
045411b8d0 fix(process): harden Node.js path discovery for production readiness
- Fix thread safety: replace #[tokio::main] in codeg_server with manual
  runtime construction so set_var runs before any worker threads exist
- Fix nvm alias branch: sort matched candidates (read_dir order is
  undefined) and skip non-numeric aliases like lts/* that cannot be
  resolved without full nvm evaluation
- Fix HOME missing: accept Option<&Path> for home so env-var-only
  discovery (NVM_HOME, VOLTA_HOME, FNM_DIR, etc.) still works in
  Docker / systemd environments without HOME set
- Refactor resolve_dir to accept an env var chain, eliminating all
  inline Option chains for fnm, nvm-windows, mise, and scoop
2026-04-16 11:27:35 +08:00
xintaofei
9adff116ee feat(process): comprehensive cross-platform Node.js path discovery
Expand find_node_bin_dir to support 9 version managers / installation
methods across macOS, Linux, and Windows:

- nvm (Unix): fix alias duplicate candidates, skip symbolic aliases
  like lts/* that cannot be resolved without full nvm evaluation
- nvm-windows: detect via %NVM_SYMLINK% and %NVM_HOME% with correct
  directory layout (node.exe directly in version dir, no bin/)
- fnm: use platform-correct defaults (%APPDATA%/fnm on Windows,
  $XDG_DATA_HOME/fnm on Unix) instead of hardcoded Unix path
- volta: validate that a concrete Node image exists before adding
  the shim directory, preventing cryptic errors when volta is
  installed but no Node version has been set
- asdf (Unix): $ASDF_DATA_DIR or ~/.asdf/installs/nodejs/
- mise/rtx (cross-platform): $MISE_DATA_DIR with XDG fallback
- n (Unix): $N_PREFIX or /usr/local/n/versions/node/
- Homebrew (macOS): /opt/homebrew and /usr/local prefixes
- Scoop (Windows): nodejs-lts and nodejs app detection

Also improve production readiness:
- Document thread-safety requirements for set_var (unsafe in ed. 2024)
- Add warning log when HOME is unset (Docker / minimal containers)
- Clarify FNM_MULTISHELL_PATH scope (server binary only, not GUI)
- Note lexicographic sort limitation for semver edge cases
2026-04-16 11:06:33 +08:00
Kwensiu
2f59d900fb fix(windows): improve fnm Node path discovery 2026-04-16 00:45:15 +08:00
xintaofei
25def31a23 fix(windows): force UTF-8 encoding for all spawned child processes
- Set UTF-8 environment variables (PYTHONUTF8, PYTHONIOENCODING, LANG,
  LC_ALL) on all child processes via process.rs helpers
- Configure PTY terminals per shell flavor: chcp 65001 for cmd.exe,
  [Console]::OutputEncoding for PowerShell, LANG=C.UTF-8 for Git Bash
- Use /K and -NoExit for interactive shells to avoid nested processes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 18:47:31 +08:00
xintaofei
13c8deee84 修复node全局安装时的权限问题 2026-03-31 16:00:04 +08:00
xintaofei
a7f628ee21 后端代码优化 2026-03-29 18:55:47 +08:00
xintaofei
02266039cf 增强node环境检查 2026-03-28 22:17:50 +08:00
xintaofei
f8ea694986 修复windows下执行部分git命令没有带上CREATE_NO_WINDOW标识 2026-03-20 21:35:39 +08:00
xggz
54d1097b41 Initial commit 2026-03-06 22:56:13 +08:00