-
Notifications
You must be signed in to change notification settings - Fork 1
Pipeline Plan 1
Seth Ford edited this page Feb 14, 2026
·
3 revisions
Here's the implementation plan:
The init script (scripts/sw-init.sh) already has zsh and bash completion installation (lines 199-284). The completions directory has all three shell files: _shipwright (zsh), shipwright.bash (bash), and shipwright.fish (fish).
- Fish shell support — The init script handles zsh and bash but ignores fish entirely
- Idempotency — The current code always overwrites completion files instead of checking if they're already identical (the issue asks for "already installed" skip messages)
-
Test coverage — Zero tests for the completions section in
sw-init-test.sh
- Shell detection via
$SHELLand$ZSH_VERSION/$BASH_VERSION - Zsh: copies to
~/.zsh/completions/, ensuresfpathin.zshrc - Bash: copies to
~/.local/share/bash-completion/completions/, sources in.bashrc - Success messages with reload instructions
| File | Action | Purpose |
|---|---|---|
scripts/sw-init.sh |
Modify | Add fish support, add idempotency checks |
scripts/sw-init-test.sh |
Modify | Add test cases for shell completion installation |
In the shell detection block (lines 201-213), add fish detection to both the version-variable check and the $SHELL fallback.
Before copying _shipwright, check if the destination file is identical using cmp -s. If identical, show "already installed" and skip.
Same cmp -s pattern as zsh.
After the bash block (line 275), add a new elif for fish:
- Target:
~/.config/fish/completions/shipwright.fish - Include idempotency check
- No rc file modification needed — fish auto-loads from that directory
Add a fish case (no source needed — fish picks up completions automatically).
- Test bash completions installed to correct path
- Test completions idempotency (second run shows "already installed")
- Test fish completions installed when
$SHELLis overridden to fish
Run sw-init-test.sh and npm test to verify no regressions.
- Task 1: Add fish shell detection (
$SHELL == *fish*) to the shell type detection block - Task 2: Add idempotency check (
cmp -s) to zsh completion installation — skip with "already installed" if files match - Task 3: Add idempotency check (
cmp -s) to bash completion installation — skip with "already installed" if files match - Task 4: Add fish completion installation block — copy
shipwright.fishto~/.config/fish/completions/ - Task 5: Update reload instructions section to handle fish
- Task 6: Add test: bash completions file installed to correct path
- Task 7: Add test: completions idempotency — second run shows "already installed"
- Task 8: Add test: fish completions installed when SHELL is fish
- Task 9: Run
sw-init-test.sh— all tests pass - Task 10: Run
npm test— all existing test suites pass
-
Unit tests in
sw-init-test.shusing the existing sandboxed HOME pattern (tests already run withHOME="$TEMP_DIR/home") -
Shell override: For fish test, override
SHELL=/usr/local/bin/fishin theinvoke_initcall - Idempotency test: Run init twice, grep second run's output for "already installed"
- Fish completions installed automatically during init (in addition to existing zsh/bash)
- Idempotent — running init twice skips with "already installed" message
- Shows clear success/skip messages for all three shells
- Test coverage for completions in
sw-init-test.sh - All existing tests still pass (
npm test) - Bash 3.2 compatible (no associative arrays, no
readarray, etc.)