Add User QoL install considerations to AI_AGENTS.md#15
Conversation
Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive user quality-of-life (QoL) documentation for installation and setup processes across the SpiralSafe ecosystem, focusing on SAIF (Structured AI Integration Framework) methodology. The documentation addresses common pain points in cross-session context preservation, path resolution, and platform consistency.
Changes:
- Added detailed guidance on absolute path references to survive working directory changes
- Documented shell alias creation patterns for PowerShell and CMD with cross-platform support
- Provided CI/CD caching examples for Python, Node.js, and PowerShell packages
- Included bootstrap verification checklist and event horizon boundary mitigation strategies
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Export for persistence | ||
| Export-ModuleMember -Alias * -Function * |
There was a problem hiding this comment.
The Export-ModuleMember -Alias * -Function * command should only be used in module files (.psm1), not in profile scripts or standalone scripts. If these aliases are being defined in a profile or script, this line will cause an error. Consider clarifying the context where this command should be used, or providing separate examples for module vs profile scenarios.
| | PowerShell 7+ | `$PSVersionTable.PSVersion` | Install pwsh from Microsoft Store | | ||
| | Execution policy allows scripts | `Get-ExecutionPolicy` | `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser` | | ||
| | Required directories exist | `Test-Path $WaveRoot` | Run bootstrap again | | ||
| | Profile is writable | `Test-Path $PROFILE` | Create profile directory | |
There was a problem hiding this comment.
The table row for "Profile is writable" checks Test-Path $PROFILE, but this command only verifies if the profile file exists, not whether it's writable. To actually verify write permissions, consider using: Test-Path $PROFILE -PathType Leaf -ErrorAction SilentlyContinue; (Get-Item $PROFILE -ErrorAction SilentlyContinue).IsReadOnly -eq $false or a similar approach that specifically checks write access.
| | Profile is writable | `Test-Path $PROFILE` | Create profile directory | | |
| | Profile is writable | `Test-Path $PROFILE -PathType Leaf -ErrorAction SilentlyContinue -and -not (Get-Item $PROFILE -ErrorAction SilentlyContinue).IsReadOnly` | Create profile directory | |
| # PowerShell module caching (manual) | ||
| - name: Cache PowerShell modules | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.local/share/powershell/Modules | ||
| key: ${{ runner.os }}-pwsh-${{ hashFiles('**/requirements.psd1') }} |
There was a problem hiding this comment.
The PowerShell module cache path ~/.local/share/powershell/Modules is the Linux/macOS path for PowerShell modules. On Windows, the user module path is typically $HOME\Documents\PowerShell\Modules (PowerShell 7+) or $HOME\Documents\WindowsPowerShell\Modules (PowerShell 5.1). Consider using a platform-specific path or providing examples for different operating systems to ensure the cache works correctly in CI environments.
| # PowerShell module caching (manual) | |
| - name: Cache PowerShell modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.local/share/powershell/Modules | |
| key: ${{ runner.os }}-pwsh-${{ hashFiles('**/requirements.psd1') }} | |
| # PowerShell module caching (manual, OS-specific paths) | |
| # Linux/macOS | |
| - name: Cache PowerShell modules (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.local/share/powershell/Modules | |
| key: ${{ runner.os }}-pwsh-${{ hashFiles('**/requirements.psd1') }} | |
| # Windows | |
| - name: Cache PowerShell modules (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ env.USERPROFILE }}\Documents\PowerShell\Modules | |
| ${{ env.USERPROFILE }}\Documents\WindowsPowerShell\Modules | |
| key: ${{ runner.os }}-pwsh-${{ hashFiles('**/requirements.psd1') }} |
|
|
||
| **Use these environment-aware patterns:** | ||
| ```powershell | ||
| # Repository root detection (PowerShell 7+ ternary, or if-else for 5.1) |
There was a problem hiding this comment.
The comment mentions "PowerShell 7+ ternary" but the code example shown uses the if-else syntax that is compatible with PowerShell 5.1, not the ternary operator. The ternary operator in PowerShell 7+ would be: $RepoRoot = $gitRoot ?? $PSScriptRoot. Consider updating the comment to accurately reflect that this example is specifically for PowerShell 5.1 compatibility, or clarify that both syntaxes work but this one is more compatible.
| # Repository root detection (PowerShell 7+ ternary, or if-else for 5.1) | |
| # Repository root detection (PowerShell 5.1-compatible; in PS 7+ you can use: $RepoRoot = $gitRoot ?? $PSScriptRoot) |
| Set-Alias -Name ll -Value Get-ChildItem -Scope Global | ||
| Set-Alias -Name grep -Value Select-String -Scope Global | ||
| Set-Alias -Name touch -Value New-Item -Scope Global | ||
| Set-Alias -Name which -Value Get-Command -Scope Global | ||
|
|
||
| # Export for persistence |
There was a problem hiding this comment.
The Set-Alias command with -Scope Global may not work as expected within a script context unless the script is dot-sourced. When run in a script, global aliases typically only persist for the script's session and do not automatically persist to the user's profile. Consider clarifying that these aliases should be added to the PowerShell profile for persistence, or that the script containing them should be dot-sourced.
| Set-Alias -Name ll -Value Get-ChildItem -Scope Global | |
| Set-Alias -Name grep -Value Select-String -Scope Global | |
| Set-Alias -Name touch -Value New-Item -Scope Global | |
| Set-Alias -Name which -Value Get-Command -Scope Global | |
| # Export for persistence | |
| # For persistence, add these lines to your PowerShell profile (e.g. $PROFILE) | |
| # or dot-source a script that defines them: . "$WaveRoot\tools\aliases.ps1" | |
| Set-Alias -Name ll -Value Get-ChildItem | |
| Set-Alias -Name grep -Value Select-String | |
| Set-Alias -Name touch -Value New-Item | |
| Set-Alias -Name which -Value Get-Command | |
| # Export for persistence when used inside a module |
| # PowerShell aliases for Unix-like commands | ||
| Set-Alias -Name ll -Value Get-ChildItem -Scope Global | ||
| Set-Alias -Name grep -Value Select-String -Scope Global | ||
| Set-Alias -Name touch -Value New-Item -Scope Global |
There was a problem hiding this comment.
The alias touch pointing to New-Item is incomplete and will not work as expected for creating empty files (the typical Unix touch behavior). New-Item requires additional parameters like -ItemType File. Consider changing this to a function wrapper instead: function touch { New-Item -ItemType File -Path $args }
| Set-Alias -Name touch -Value New-Item -Scope Global | |
| function touch { | |
| New-Item -ItemType File -Path $args | |
| } |
| # Cross-platform home directory | ||
| $UserHome = if ($IsWindows) { $env:USERPROFILE } else { $env:HOME } |
There was a problem hiding this comment.
The cross-platform home directory check uses $IsWindows, which is an automatic variable available in PowerShell 6+. However, this section already mentions compatibility with PowerShell 5.1 in line 164. For PowerShell 5.1 compatibility, consider using: $UserHome = if ($PSVersionTable.PSVersion.Major -ge 6 -and -not $IsWindows) { $env:HOME } else { $env:USERPROFILE } or simply $UserHome = if ($env:HOME) { $env:HOME } else { $env:USERPROFILE }
| # Cross-platform home directory | |
| $UserHome = if ($IsWindows) { $env:USERPROFILE } else { $env:HOME } | |
| # Cross-platform home directory (PowerShell 5.1+ safe) | |
| $UserHome = if ($env:HOME) { $env:HOME } else { $env:USERPROFILE } |
| @{ | ||
| Timestamp = Get-Date -Format "o" | ||
| WaveRoot = $WaveRoot | ||
| Branch = git branch --show-current |
There was a problem hiding this comment.
The command git branch --show-current requires Git 2.22 or later (released in June 2019). While this is generally safe to assume in modern environments, for broader compatibility with older Git installations, consider using: git rev-parse --abbrev-ref HEAD as an alternative, or document the Git version requirement in the prerequisites.
| Branch = git branch --show-current | |
| Branch = git rev-parse --abbrev-ref HEAD |
|
@copilot apply changes based on the comments in this thread |
Documents SAIF-processes/methodology for installation QoL across the SpiralSafe ecosystem. Addresses cross-session context loss and platform consistency issues.
Changes
actions/setup-python@v5pip cache configuration with examples for npm/PowerShellSetup-Wave.ps1prerequisitesExample: Repository root detection
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.