feat(installer): detect and update PowerShell profiles on Windows#248
Merged
Conversation
Deploying archgate-cli with
|
| 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 |
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>
00b1692 to
91a2ec7
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
try/catcharound reads and writes so one failed file doesn't abort the whole batch; failures surface asWrite-Warningwith a "manually append" fallback message.What's detected
~/.bashrc,~/.bash_profile,~/.profile(first match wins)<MyDocuments>/WindowsPowerShell/Microsoft.PowerShell_profile.ps1<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
$PROFILEsystem entirely. The User PATH update covers PowerShell on new sessions in the common case, but adding$PROFILElines is a useful belt-and-suspenders for:$PROFILEs that override$env:PATHTest plan
[System.Management.Automation.Language.Parser]::ParseFile)bun run validatepasses (lint, typecheck, format, 695 tests, 23/23 ADR checks, build:check)Y)Notes
A non-obvious gotcha caught during development:
install.ps1has 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.