Skip to content

Conversation

@jfuchs
Copy link
Owner

@jfuchs jfuchs commented Jan 26, 2026

Powerlevel10k was flaky when run by agents. Replace with a pure-zsh
prompt that shows similar information:

  • Current directory (blue)
  • Git branch with staged/unstaged/untracked indicators
  • Command execution time (if > 3s)
  • Prompt character (green ❯ for success, red for error)
  • Time on right side

Powerlevel10k was flaky when run by agents. Replace with a pure-zsh
prompt that shows similar information:
- Current directory (blue)
- Git branch with staged/unstaged/untracked indicators
- Command execution time (if > 3s)
- Prompt character (green ❯ for success, red for error)
- Time on right side
Adds a testing framework to catch unintended prompt appearance changes:

- test/visual/scenarios.zsh: Defines test scenarios for different prompt
  states (git clean/dirty, error, long commands, etc.)
- test/visual/run-tests.sh: Test runner that captures screenshots and
  compares against baselines
- test/visual/Dockerfile: Consistent environment for CI
- .github/workflows/visual-tests.yml: CI workflow for automated testing

Supports multiple capture methods:
- termshot (preferred): Native terminal screenshots
- aha + wkhtmltoimage: HTML-based rendering
- text: Fallback using plain diff
Includes text-based baselines showing expected prompt output for:
- no_git: Directory without git repo
- git_clean/staged/unstaged/untracked/mixed: Various git states
- error: After failed command (red prompt char)
- long_command: 5s execution time shown
- very_long_command: 1h execution time shown
- deep_path: Deeply nested directory
Add generate_snapshots.py to create PNG baseline images showing:
- Proper terminal colors (dark background, colored text)
- Blue directory paths
- Cyan git branch names
- Green/yellow/blue indicators for staged/unstaged/untracked
- Green prompt for success, red for error
- Yellow execution time on long commands

Images can be viewed directly on GitHub to evaluate prompt appearance.
The previous workflow tried to capture terminal output with termshot,
but baselines are Python-generated PNG images. Now the CI:

1. Verifies prompt syntax with zsh -n
2. Generates snapshots using generate_snapshots.py
3. Compares against committed baselines with ImageMagick
4. Uploads diffs on failure for debugging
The prompt now fetches git status asynchronously using zsh's zle -F
mechanism. This provides p10k-like responsiveness:

1. Prompt appears immediately with directory only
2. Git info (branch, staged, unstaged, untracked) loads in background
3. Prompt updates automatically when git status completes

Uses native zsh features (exec fd redirection, zle -F callbacks) with
no external dependencies.
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.

3 participants