it2 session prompt
Get shell prompt metadata for a session
Synopsis
it2 session prompt [session-id] [flags]
Description
Get shell prompt metadata for a session (requires shell integration).
This command retrieves information about the current shell prompt including:
- Prompt state (EDITING, RUNNING, FINISHED)
- Working directory
- Current command
- Exit status (when finished)
- Prompt/command/output coordinate ranges
Requires shell integration to be enabled in the session.
Use --wait-stable to wait until the prompt stabilizes before retrieving metadata.
This is useful for automation where you need to wait for a command to complete.
Stability options:
--wait-stable - Normal tolerance (2s), max-wait 10s
--wait-stable --wait-stable-tolerance=low - Quick detection (500ms), max-wait 10s
--wait-stable --wait-stable-tolerance=high - Lenient (5s), max-wait 10s
--wait-stable --wait-stable-max-wait=30s - Normal tolerance (2s), but max 30s total
Examples:
Get prompt info for current session
$ it2 session prompt
Get prompt info for specific session
$ it2 session prompt ABC12345
Get as JSON
$ it2 session prompt --format json
Wait until session stabilizes before getting prompt info (command finished)
$ it2 session prompt ABC12345 --wait-stable
Quick detection with low tolerance
$ it2 session prompt ABC12345 --wait-stable --wait-stable-tolerance=low
Wait for automation script completion
$ it2 session send-text ABC12345 "long-running-script.sh"
$ it2 session prompt ABC12345 --wait-stable --format json
Options
-
--format(default "table") - Output format (table|json|yaml|text)
-
--timeout(default "5s") - Command timeout
-
--url(default "ws://localhost:1912") - iTerm2 WebSocket URL
-
--wait-stable - Wait until prompt is stable (uses --wait-stable-tolerance for timing)
-
--wait-stable-max-wait(default "10s") - Maximum total time to wait for stability (default: 10s). 0 for no limit
-
--wait-stable-tolerance(default "normal") - Stability tolerance level: low (500ms), normal (2s), high (5s)
See Also
- it2 session - Manage iTerm2 sessions