cli-ck Docs

Shell integration

What cli-ck injects into your shell, the OSC sequences it watches, and how to opt out.


cli-ck injects shell integration scripts automatically on every PTY spawn. You do not need to edit .zshrc, .bashrc, or $PROFILE. In fact, you should not - hand-rolling OSC emitters on top of the bundled ones will double-emit and confuse the cwd / prompt tracking.

What cli-ck injects

Scripts live in src-tauri/src/modules/pty/scripts/.

Zsh

zshenv.zsh, zprofile.zsh, zlogin.zsh, zshrc.zsh are installed via the ZDOTDIR environment variable. Your real ~/.zshrc is sourced from inside cli-ck's script, so your config still runs. cli-ck adds:

  • precmd hook to emit OSC 7 (cwd)
  • precmd / preexec hooks to emit OSC 133 A / B / C
  • precmd hook to emit OSC 133 D;<code> on the previous command's exit

Bash

bashrc.bash is installed via --rcfile. Your real ~/.bashrc is sourced, plus the OSC 7 / OSC 133 hooks.

PowerShell

profile.ps1 is passed via pwsh -NoLogo -NoExit -ExecutionPolicy Bypass -File <path>. Your real $PROFILE runs first, then cli-ck wraps the prompt function to emit OSC 7 + OSC 133 A / B / D.

The cwd is normalized to backslashes before being passed to ConPTY because CreateProcessW misbehaves with forward-slash cwd on Windows.

cmd.exe

No integration. cmd.exe is the last-resort fallback when neither pwsh nor powershell is available.

What the OSC sequences mean

cli-ck watches three OSC families.

OSC 7 - working directory

ESC ] 7 ; file://<host><path> BEL

Emitted by the shell every time the cwd changes. Drives the status bar breadcrumb and the explorer root.

On Windows, drive-letter normalization runs on the host side: /C:/Users/foo becomes C:/Users/foo before it is stored.

OSC 133 - prompt and command boundaries

MarkerMeaning
OSC 133;AStart of prompt
OSC 133;BEnd of prompt (user input start)
OSC 133;C;<cmd>Start of command output (arms terminal-agent detector)
OSC 133;D;<code>Command exited with <code>

Used for: cwd tracking, command boundary detection, terminal-agent detection (see Coding agents in the terminal).

OSC 777 - agent state

ESC ] 777 ; notify ; cli-ck ; <event> BEL

A cli-ck-specific extension. Emitted by terminal agents (Claude Code hooks) to signal state transitions: started, working, attention, finished, exited. The PTY byte filter (pty/agent_detect.rs) self-arms on OSC 133;C and reads OSC 777 payloads to drive the notification router.

Opting out

Right now shell integration is on for every PTY. If you have a strong reason to disable it (a debugging script that conflicts, a custom prompt framework that emits its own OSC 7), open an issue. There is no per-session opt-out switch in Settings today.

If you maintain a prompt framework (Starship, oh-my-zsh, etc.), it should work as-is - cli-ck's hooks are additive, not destructive.