-
Notifications
You must be signed in to change notification settings - Fork 0
Pipeline Plan 1
Based on my analysis of the codebase, the implementation is already partially complete on this branch (8 autonomous loop iterations have run). Here is the complete implementation plan:
| File | Action |
|---|---|
scripts/sw-init.sh |
Add shell completion installation section (after pipeline templates, before Claude settings) |
scripts/sw-init-test.sh |
Add tests 22-26 covering zsh, bash, fish, fpath config, and idempotency |
-
Add Shell Completions section to
scripts/sw-init.sh(after the Pipeline Templates section, around line 387):- Detect
$SHELLenvironment variable for login shell type (zsh,bash,fish) - Set
COMPLETIONS_SRC="$REPO_DIR/completions" - Use
SHELL_TYPEvariable to branch on shell type (avoid relying on$BASH_VERSIONsince init runs in bash regardless)
- Detect
-
Implement zsh completion installation:
- Target:
~/.zsh/completions/_shipwright - Source:
completions/_shipwright -
mkdir -p ~/.zsh/completionsthencpthe file - Check
~/.zshrcfor existingfpath+=~/.zsh/completions— append if absent - Check
~/.zshrcforcompinit— appendautoload -Uz compinit && compinitif absent - Print
success "Installed zsh completions → ~/.zsh/completions/_shipwright"
- Target:
-
Implement bash completion installation:
- Target:
~/.local/share/bash-completion/completions/shipwright - Source:
completions/shipwright.bash -
mkdir -pthe target dir thencp - Check
~/.bashrcfor existing source line — append if absent - Print
success "Installed bash completions → ~/.local/share/bash-completion/completions/shipwright"
- Target:
-
Implement fish completion installation:
- Target:
~/.config/fish/completions/shipwright.fish - Source:
completions/shipwright.fish -
mkdir -p ~/.config/fish/completionsthencp - Print
success "Installed fish completions → ~/.config/fish/completions/shipwright.fish"
- Target:
-
Print reload hint after successful install:
- zsh:
source ~/.zshrc - bash:
source ~/.bashrc - fish:
source ~/.config/fish/config.fish
- zsh:
-
Add tests 22-26 to
scripts/sw-init-test.shunder a "Shell Completions" group:-
test_zsh_completions_installed— run init withSHELL=/bin/zsh, assert~/.zsh/completions/_shipwrightexists -
test_zsh_fpath_configured— run init withSHELL=/bin/zsh, assert~/.zshrccontainsfpath -
test_bash_completions_installed— run init withSHELL=/bin/bash, assert~/.local/share/bash-completion/completions/shipwrightexists -
test_fish_completions_installed— run init withSHELL=/usr/local/bin/fish, assert~/.config/fish/completions/shipwright.fishexists -
test_completions_idempotent— run init twice withSHELL=/bin/zsh, assert no errors and file still present
-
- Task 1: Verify
completions/directory exists with_shipwright,shipwright.bash,shipwright.fish - Task 2: Add Shell Completions section header comment to
sw-init.sh - Task 3: Implement shell type detection from
$SHELL(not$BASH_VERSION) - Task 4: Implement zsh completion copy to
~/.zsh/completions/_shipwright - Task 5: Implement
fpathinjection into~/.zshrc(idempotent, checks before appending) - Task 6: Implement
compinitline injection into~/.zshrc(idempotent) - Task 7: Implement bash completion copy to
~/.local/share/bash-completion/completions/shipwright - Task 8: Implement bash
sourceline injection into~/.bashrc(idempotent) - Task 9: Implement fish completion copy to
~/.config/fish/completions/shipwright.fish - Task 10: Print reload hint after successful installation
- Task 11: Add
test_zsh_completions_installedtest withSHELL=/bin/zsh - Task 12: Add
test_zsh_fpath_configuredtest asserting.zshrcfpath entry - Task 13: Add
test_bash_completions_installedtest withSHELL=/bin/bash - Task 14: Add
test_fish_completions_installedtest withSHELL=/usr/local/bin/fish - Task 15: Add
test_completions_idempotenttest running init twice and verifying no corruption
Tests use the existing sandboxed HOME test harness in sw-init-test.sh:
# Tests 22-26 in the Shell Completions group override $SHELL per test:
SHELL="/bin/zsh" bash "$REAL_INIT_SCRIPT" --no-claude-md
# Then assert against the sandboxed HOME:
assert_file_exists "$TEMP_DIR/home/.zsh/completions/_shipwright"
assert_file_contains "$TEMP_DIR/home/.zshrc" "fpath"Idempotency is verified by running init twice in the same $TEMP_DIR/home and asserting the completion file still exists and .zshrc does not contain duplicate fpath lines.
Run the full test suite to confirm no regressions:
bash scripts/sw-init-test.sh
npm test # runs all 102 test suites-
bash scripts/sw-init.shwithSHELL=/bin/zshcreates~/.zsh/completions/_shipwrightand addsfpathto~/.zshrc -
bash scripts/sw-init.shwithSHELL=/bin/bashcreates~/.local/share/bash-completion/completions/shipwright -
bash scripts/sw-init.shwithSHELL=/usr/local/bin/fishcreates~/.config/fish/completions/shipwright.fish - Running init twice does not duplicate entries in
.zshrc/.bashrc - All 26 tests in
sw-init-test.shpass -
npm testpasses (all 102 suites) - Shell type detection falls back gracefully when
$SHELLis unset or unknown (showswarnand skips)
Status note: The implementation code is already present on this branch (feat/add-shell-completion-installation-to-shi-1) from prior autonomous loop iterations 1–8. The sw-init.sh shell completions section (lines 387–489) and test cases 22–26 in sw-init-test.sh are written and ready for the build/test stages.