Skip to content

feat(installer): detect and update PowerShell profiles on Windows#248

Merged
rhuanbarreto merged 1 commit into
mainfrom
claude/condescending-perlman-6308b0
Apr 29, 2026
Merged

feat(installer): detect and update PowerShell profiles on Windows#248
rhuanbarreto merged 1 commit into
mainfrom
claude/condescending-perlman-6308b0

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Unifies the Windows installer's shell-profile section so both Git Bash and PowerShell profiles are detected and (with consent) updated in a single batched prompt.
  • Detect-only — never creates profiles that don't already exist.
  • Per-file try/catch around reads and writes so one failed file doesn't abort the whole batch; failures surface as Write-Warning with a "manually append" fallback message.

What's detected

Shell Path
Git Bash / MSYS2 ~/.bashrc, ~/.bash_profile, ~/.profile (first match wins)
PowerShell 5.1 <MyDocuments>/WindowsPowerShell/Microsoft.PowerShell_profile.ps1
PowerShell 7+ <MyDocuments>/PowerShell/Microsoft.PowerShell_profile.ps1

<MyDocuments> is resolved via [Environment]::GetFolderPath('MyDocuments') so OneDrive-redirected Documents folders work correctly.

Why

The existing installer already updated the Windows User PATH (registry) and Git Bash profiles, but skipped PowerShell's own $PROFILE system entirely. The User PATH update covers PowerShell on new sessions in the common case, but adding $PROFILE lines is a useful belt-and-suspenders for:

  • Locked-down corporate machines where group policy strips User PATH writes
  • Custom $PROFILEs that override $env:PATH
  • Symmetry with how Git Bash already gets its profile updated

Test plan

  • PowerShell AST parse clean ([System.Management.Automation.Language.Parser]::ParseFile)
  • Smoke test against fixture profiles: detection, "already configured" skip, write phase, and read-only-file error path all behave correctly
  • bun run validate passes (lint, typecheck, format, 695 tests, 23/23 ADR checks, build:check)
  • Manual test on a fresh Windows VM with no existing PowerShell profile (should be skipped) and with existing profile (should be detected and updated after Y)
  • Manual test on a Windows machine with OneDrive-redirected Documents folder

Notes

A non-obvious gotcha caught during development: install.ps1 has no UTF-8 BOM, so PowerShell 5.1 reads it as ANSI/Windows-1252 and breaks on multi-byte characters like em-dashes. All comments and strings in the installer must stay ASCII. Captured in agent memory.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 29, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 91a2ec7
Status: ✅  Deploy successful!
Preview URL: https://57d71b47.archgate-cli.pages.dev
Branch Preview URL: https://claude-condescending-perlman.archgate-cli.pages.dev

View logs

Unify the Windows installer's shell-profile section so both Git Bash and
PowerShell profiles are detected and (with consent) updated in a single
batched prompt. Detect-only — never creates profiles. Per-file try/catch
ensures a single failed write doesn't abort the whole batch.

- Git Bash: ~/.bashrc, ~/.bash_profile, ~/.profile (first match wins)
- PowerShell 5.1: <MyDocuments>/WindowsPowerShell/Microsoft.PowerShell_profile.ps1
- PowerShell 7+:  <MyDocuments>/PowerShell/Microsoft.PowerShell_profile.ps1

Uses [Environment]::GetFolderPath('MyDocuments') so OneDrive-redirected
Documents folders resolve correctly. Read/write failures surface as
Write-Warning with a "manually append" fallback message.

Memory: capture the BOM-less PS1 / em-dash parse-error gotcha so future
edits to install.ps1 stick to ASCII.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@rhuanbarreto rhuanbarreto force-pushed the claude/condescending-perlman-6308b0 branch from 00b1692 to 91a2ec7 Compare April 29, 2026 10:16
@rhuanbarreto rhuanbarreto merged commit 3f142ce into main Apr 29, 2026
12 of 14 checks passed
@rhuanbarreto rhuanbarreto deleted the claude/condescending-perlman-6308b0 branch April 29, 2026 10:36
@github-actions github-actions Bot mentioned this pull request Apr 29, 2026
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.

1 participant