Summary
Add automated tests that exercise dotfiles shell bootstrap logic in non-interactive zsh, and wire those tests into CI. This would improve safety and maintainability when editing zsh/, zshenv, aliases, and helper functions.
Today, shell-related tests live under zsh/ but mostly run through bash (via @uniquedivine/bash in Bun tests, or bash -c in zsh/ud/ud_test.go). CI (.github/workflows/test.yml) runs just test → bun test only.
The repo already has a non-interactive bootstrap path in zsh/zshenv and zsh/bashlib.sh, but we do not currently verify that path under an actual zsh process in CI.
Motivation
- Catch regressions when editing shell bootstrap files (
zshenv, bashlib.sh, aliases.sh, quick.sh)
- Ensure non-interactive shells (Codex, Cloud Agents, scripts) get the expected env, aliases, and functions
- Reduce reliance on manual “source and try it” validation after dotfile changes
- Complement existing bash-based tests with coverage of zsh-specific behavior where it matters
Current State
| Area |
Today |
| CI workflow |
.github/workflows/test.yml → just test → bun test |
| Shell tests |
zsh/bashlib.test.ts, zsh/clipboard.test.ts (bash) |
ud tests |
zsh/ud/ud_test.go (bash sourcing ud.sh) |
| Non-interactive bootstrap |
zsh/zshenv sources bashlib.sh, aliases.sh, quick.sh |
| Headless zsh in tests |
Not used yet |
Proposed Approach
1. Define a testable non-interactive bootstrap contract
Document and enforce what non-interactive shells should load:
zshenv (zsh non-interactive path)
bashlib.sh helpers (which_ok, env_var_ok, is_wsl, main_bash_setup, etc.)
- Selected aliases/functions from
aliases.sh and quick.sh
Keep interactive-only setup (zshrc, oh-my-zsh, p10k) out of CI scope.
2. Add zsh non-interactive test harness
Introduce tests that run commands like:
DOTFILES="$PWD" REPO="/tmp/test-ki" zsh -c '
source "$DOTFILES/zsh/zshenv"
type which_ok
echo "$DOTFILES"
'
Possible implementation options:
- Option A: Bun tests using
@uniquedivine/bash with zsh -c instead of bare bash
- Option B: Small shell script + Bun wrapper tests asserting stdout/exit codes
- Option C: Extend
zsh/ud/ud_test.go pattern with zsh-based cases
Prefer Option A or B for consistency with existing bun test workflow.
3. Add initial test cases (MVP)
Start with high-value, low-flake coverage:
4. Wire into CI
Update .github/workflows/test.yml:
5. Developer ergonomics
Non-Goals
- Testing full interactive
zshrc / oh-my-zsh / powerlevel10k startup
- Clipboard bridge tests on Linux CI (already skipped unless
pbcopy/pbpaste exist)
- End-to-end WSL-only behavior in default CI (can remain fixture-based like
is_wsl tests)
Acceptance Criteria
References
zsh/zshenv — non-interactive bootstrap entry point
zsh/bashlib.sh — shared helpers and main_bash_setup
zsh/bashlib.test.ts — existing bash-based pattern to mirror
.github/workflows/test.yml — current CI entry point
Suggested Labels
enhancement, testing, ci, zsh
Summary
Add automated tests that exercise dotfiles shell bootstrap logic in non-interactive zsh, and wire those tests into CI. This would improve safety and maintainability when editing
zsh/,zshenv, aliases, and helper functions.Today, shell-related tests live under
zsh/but mostly run through bash (via@uniquedivine/bashin Bun tests, orbash -cinzsh/ud/ud_test.go). CI (.github/workflows/test.yml) runsjust test→bun testonly.The repo already has a non-interactive bootstrap path in
zsh/zshenvandzsh/bashlib.sh, but we do not currently verify that path under an actualzshprocess in CI.Motivation
zshenv,bashlib.sh,aliases.sh,quick.sh)Current State
.github/workflows/test.yml→just test→bun testzsh/bashlib.test.ts,zsh/clipboard.test.ts(bash)udtestszsh/ud/ud_test.go(bash sourcingud.sh)zsh/zshenvsourcesbashlib.sh,aliases.sh,quick.shProposed Approach
1. Define a testable non-interactive bootstrap contract
Document and enforce what non-interactive shells should load:
zshenv(zsh non-interactive path)bashlib.shhelpers (which_ok,env_var_ok,is_wsl,main_bash_setup, etc.)aliases.shandquick.shKeep interactive-only setup (
zshrc, oh-my-zsh, p10k) out of CI scope.2. Add zsh non-interactive test harness
Introduce tests that run commands like:
Possible implementation options:
@uniquedivine/bashwithzsh -cinstead of bare bashzsh/ud/ud_test.gopattern with zsh-based casesPrefer Option A or B for consistency with existing
bun testworkflow.3. Add initial test cases (MVP)
Start with high-value, low-flake coverage:
zshenvsources without error whenDOTFILESandREPOare setbashlib.shfunctions are available after bootstrap (which_ok,env_var_ok,is_wsl)ud --helpworks when invoked via non-interactive zsh bootstrapPROC_VERSIONfixture) to avoid host dependence4. Wire into CI
Update
.github/workflows/test.yml:zshinjust i-bash-ci(or a newjust i-zsh-cirecipe)just test(orjust test-zsh)5. Developer ergonomics
just test-zshrecipe for local runsREADME.mdorAGENTS.mdNon-Goals
zshrc/ oh-my-zsh / powerlevel10k startuppbcopy/pbpasteexist)is_wsltests)Acceptance Criteria
zsh/just test(or documentedjust test-zsh) runs the new suite locally~/ki, symlinks, etc.)References
zsh/zshenv— non-interactive bootstrap entry pointzsh/bashlib.sh— shared helpers andmain_bash_setupzsh/bashlib.test.ts— existing bash-based pattern to mirror.github/workflows/test.yml— current CI entry pointSuggested Labels
enhancement,testing,ci,zsh