Skip to content

Add PowerShell as an optional default shell - #167

Merged
BrettKinny merged 3 commits into
mainfrom
feat/multiple-shell-options
Sep 30, 2026
Merged

BrettKinny merged 3 commits into
mainfrom
feat/multiple-shell-options

Conversation

@BrettKinny

Copy link
Copy Markdown
Collaborator

Summary

Adds PowerShell 7 (pwsh) as a fourth option in setup's shell Selection, alongside the existing bash / zsh / fish.

What changes

  • setup.sh — shell menu (gum + text) now offers powershell (experimental); new install_pwsh:
    • resolves the exact latest PowerShell/PowerShell GitHub release,
    • picks the architecture-matching .deb (amd64/arm64),
    • verifies GitHub's release-asset SHA-256 before download/install,
    • installs via apt_install so declared dependencies resolve under the existing sudo contract,
    • generates ~/.config/powershell/profile.ps1 mirroring the bashrc (starship / zoxide / mise activation; aliases as PowerShell functions since Set-Alias cannot attach arguments),
    • translates AI/editor/TUI selections into ~/.config/powershell/squarebox-selections.ps1 (mirrors the fish snippet flow).
  • dotfiles/bashrc — ~/.squarebox-use-pwsh marker → exec pwsh -l handoff, with SQUAREBOX_NO_PWSH override; markers are now cleaned up mutually exclusively across all shells.
  • scripts/squarebox-entrypoint.sh — a saved pwsh Selection reconciles when the binary or managed profile is missing from a Box (Box-tier lifecycle), matching zsh/fish.
  • Docs/demo — README shell section, sqrbx-setup --help, CLAUDE.md contract, demo recorder, CHANGELOG.

Verification

  • 19/19 host test files pass, including 12 new failure-injection cases:
    • metadata failure aborts before any download or Managed-home mutation,
    • digest mismatch rejects the asset,
    • verified install commits pwsh, activation marker is exclusive, profile sources the selection snippet, install goes through apt-get.
  • Full e2e smoke suite: 62/62 pass against a fresh image build (podman build + scripts/e2e-test.sh smoke).
  • The generated profile.ps1 was executed by real pwsh 7.6.5 (extracted from the official .deb): loads cleanly, sets EDITOR, defines c/lg/ls as functions, runs motd.

Notes

  • PowerShell is labelled experimental, consistent with zsh/fish.
  • Language/tooling integration points the repo already had: mise activate powershell and starship init powershell both emit valid PowerShell (verified), so profile activation uses them natively.

@BrettKinny
BrettKinny force-pushed the feat/multiple-shell-options branch from 384b167 to 177a672 Compare September 30, 2026 11:17
BrettKinny and others added 3 commits September 30, 2026 21:35
Setup now offers PowerShell 7 (pwsh) alongside bash/zsh/fish as the
Box default shell. The installer resolves the exact latest PowerShell
GitHub release, picks the architecture-matching .deb, verifies its
release-asset SHA-256 before download, and installs through apt so
declared dependencies resolve. A generated
~/.config/powershell/profile.ps1 mirrors the bashrc in PowerShell
syntax (starship/zoxide/mise activation plus aliases as functions, since
Set-Alias cannot attach arguments), and AI/editor/TUI selections are
translated into squarebox-selections.ps1 like the existing fish snippet.

A ~/.squarebox-use-pwsh marker hands interactive logins off to pwsh via
bashrc re-exec, matching the zsh/fish flow; the entrypoint reconciles a
saved pwsh Selection when the binary or profile is missing from a Box.

Tests cover metadata failure, digest mismatch, and the verified-install
path through fault-injected fixtures, plus entrypoint reconcile state.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mise names the shell 'pwsh', so 'mise activate powershell' errored on every
pwsh start. pwsh also loads profiles for -Command invocations, so the MOTD
leaked into stdout of scripted pwsh calls; show it only on the bashrc login
handoff via a one-shot SQUAREBOX_PWSH_MOTD flag the profile clears.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@BrettKinny
BrettKinny force-pushed the feat/multiple-shell-options branch from 1ca40ce to 18073e0 Compare September 30, 2026 11:35
@BrettKinny
BrettKinny merged commit 55df2b4 into main Sep 30, 2026
4 checks passed
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