Skip to content

fix: Windows install and PowerShell compatibility fixes#1237

Merged
svarlamov merged 5 commits intomainfrom
windows-mdm-and-ps1-fixes
May 4, 2026
Merged

fix: Windows install and PowerShell compatibility fixes#1237
svarlamov merged 5 commits intomainfrom
windows-mdm-and-ps1-fixes

Conversation

@svarlamov
Copy link
Copy Markdown
Member

@svarlamov svarlamov commented May 3, 2026

Summary

  • Config stderr → stdout: Config set/unset success messages now print to stdout instead of stderr, fixing PowerShell interpreting them as errors
  • Git path resolution on Windows: Fixed double-backslash raw string bug in candidate paths, added cmd\git.exe variants, %LOCALAPPDATA% per-user install paths, and where.exe fallback
  • Shim detection for copies: path_is_git_ai_binary now detects copied shims on Windows (installer copies git-ai.exe to git.exe, which the same_file check missed)
  • Install script ordering: Moved config.json write before install-hooks call in both install.ps1 and install.sh so git_path is available on first install
  • Junction fallback: Added copy_dir_recursive fallback in ensure_git_symlinks when mklink /J fails (MDM-managed environments)

Test plan

  • task build compiles cleanly
  • task lint and task fmt pass
  • task test — all 3001 integration tests pass, 0 failures
  • Verify on Windows: git-ai config set quiet true prints to stdout (no red PowerShell error)
  • Verify on Windows: fresh install completes install-hooks without "Could not locate a real 'git' binary" error
  • Verify on Windows: API base URL is persisted on first install when API_BASE is set

🤖 Generated with Claude Code


Open in Devin Review

- Config set/unset commands now print success messages to stdout instead
  of stderr, preventing PowerShell from interpreting them as errors.

- Fix double-backslash bug in Windows git path candidates (raw string
  r"C:\\..." is literal double-backslash, not an escape). Add cmd\git.exe
  variants, %LOCALAPPDATA% per-user install paths, and where.exe fallback.

- Fix path_is_git_ai_binary to detect copied shims on Windows (the
  installer copies git-ai.exe to git.exe, not symlink/hardlink, so the
  same_file check fails — sibling existence is sufficient on Windows).

- Move config.json write before install-hooks in both install.ps1 and
  install.sh so git_path is available when resolve_git_path runs on
  first install.

- Add copy_dir_recursive fallback in ensure_git_symlinks when mklink /J
  junction creation fails (MDM-managed environments may block cmd.exe).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

github-advanced-security[bot]

This comment was marked as resolved.

svarlamov and others added 4 commits May 3, 2026 21:21
Junctions via mklink /J don't require admin privileges, so the
copy_dir_recursive fallback is unnecessary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The install script config.json ordering change is not needed — the
improved git path resolution in resolve_git_path is sufficient to
find git on first install.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collapse the try_resolve_git_path/resolve_git_path split back into a
single function (the split was scaffolding for the removed try_fresh).
Fix collapsible_if lint that only fires on Windows targets, and switch
path_is_git_ai_binary from cfg!() macros to #[cfg] attributes for
codebase consistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On Windows, path_is_git_ai_binary uses sibling existence check only
(no same_file call), so the function is dead code on that target.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@svarlamov svarlamov self-assigned this May 4, 2026
@svarlamov svarlamov merged commit 8cc0d0b into main May 4, 2026
25 of 26 checks passed
@svarlamov svarlamov deleted the windows-mdm-and-ps1-fixes branch May 4, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants