# lefthook-playground.yml # # Exercise every terminal behavior mode in lefthook. # Run with: LEFTHOOK_CONFIG=.scratch/tty-playground/lefthook-playground.yml lefthook run # # The probe script reports whether stdout is a tty (pty path) or not (direct exec), # what color env vars are set, and session/process group info. # ============================================================ # 1. DEFAULT: no flags # Expected: pty.Start path, stdout is a tty, no color env vars # ============================================================ test-default: commands: probe: run: .scratch/tty-playground/tty-probe.sh # ============================================================ # 2. INTERACTIVE: skips pty, connects stdin # Expected: direct exec, stdout NOT a tty, stdin from /dev/tty # ============================================================ test-interactive: commands: probe: run: .scratch/tty-playground/tty-probe.sh interactive: true # ============================================================ # 3. USE_STDIN: skips pty, passes stdin # Expected: direct exec, stdout NOT a tty # ============================================================ test-use-stdin: commands: probe: run: .scratch/tty-playground/tty-probe.sh use_stdin: true # ============================================================ # 4. FOLLOW: hook-level, streams output live # Expected: still uses pty (follow doesn't affect exec path), # but output streams instead of buffering # ============================================================ test-follow: follow: true commands: probe: run: .scratch/tty-playground/tty-probe.sh # ============================================================ # 5. NO_TTY: global flag, disables spinner and interactive # Expected: pty path still used (no_tty only gates interactive), # spinner suppressed # ============================================================ test-no-tty: commands: probe: run: .scratch/tty-playground/tty-probe.sh # ============================================================ # 6. NO_TTY + INTERACTIVE: the conflict case # no_tty neutralizes interactive (Interactive && !DisableTTY = false) # Expected: falls back to pty path even though interactive was requested # ============================================================ test-no-tty-interactive: commands: probe: run: .scratch/tty-playground/tty-probe.sh interactive: true # ============================================================ # 7. COLORS ON: forces CLICOLOR_FORCE=true on child # Expected: pty path, CLICOLOR_FORCE=true in env # ============================================================ test-colors-on: commands: probe: run: .scratch/tty-playground/tty-probe.sh # ============================================================ # 8. COLORS OFF: forces NO_COLOR=true on child # Expected: pty path, NO_COLOR=true in env # ============================================================ test-colors-off: commands: probe: run: .scratch/tty-playground/tty-probe.sh # ============================================================ # 9. COLORS AUTO: default, no color env vars set # Expected: pty path, no color env vars (child detects tty itself) # ============================================================ test-colors-auto: commands: probe: run: .scratch/tty-playground/tty-probe.sh # ============================================================ # 10. INTERACTIVE + COLORS ON: the current sandbox workaround # interactive skips pty, colors on adds CLICOLOR_FORCE # Expected: direct exec, CLICOLOR_FORCE=true # ============================================================ test-interactive-colors-on: commands: probe: run: .scratch/tty-playground/tty-probe.sh interactive: true # ============================================================ # 11. FOLLOW + INTERACTIVE: both set # Expected: direct exec (interactive wins for exec path), # output streams live (follow wins for output routing) # ============================================================ test-follow-interactive: follow: true commands: probe: run: .scratch/tty-playground/tty-probe.sh interactive: true