Installation
Install the CLI session replay package for Node.js:- npm
- yarn
- pnpm
Basic Usage
CLI Logging Requirement: CLI applications must set
loggingEnabled: 'always'
when initializing the StatsigClient. By default, Statsig only enables logging in browser environments, but CLI session replay requires logging to be enabled in all environments to capture and send session data.Configuration Options
TheStatsigCliSessionReplayPlugin
accepts optional configuration:
Configuration Properties
startTimestamp
(optional): Override the recording start time in milliseconds. Defaults toDate.now()
.asciicastHeader
(optional): Custom properties for the Asciicast header. For detailed information, visit the Asciicast v2 File Format page. Common fields include:title
: Human-readable title for the recordingcommand
: The command that was executedenv
: Environment variables relevant to the sessiontheme
: Terminal color theme object.
Recording Limits
- Duration: Sessions automatically end after 4 hours
- Size: Recording stops if the session data exceeds 1MB
Viewing Recordings
CLI session recordings appear in the Statsig Console alongside web session replays. The recordings can be played back to see exactly what happened in the terminal, including:- All terminal output
- Terminal resize events
- Timing information for each interaction
- Session metadata and environment details
Manual Recording Control
You can access the recording instance for manual control:Platform Support
CLI Session Replay is currently supported on:- Node.js applications
- Linux, macOS, and Windows terminals
- Any terminal that supports standard input/output streams