Overview
Theinit command launches an interactive setup wizard that guides you through creating a custom statusline for Claude Code. It collects your preferences, generates an optimized bash script, and automatically installs it to your Claude Code configuration.
Syntax
Options
Output path for the generated statusline.sh file. By default, saves to the project’s
.claude directory or ~/.claude for global installations.Prevents automatic installation to
.claude/statusline.sh and skips settings.json updates. Use this flag to generate the script without installing it.Interactive Prompts
The init command guides you through several configuration choices:-
Feature Selection - Enable or disable specific statusline features:
- 📁 Directory display with
~abbreviation - 🌿 Git branch integration
- 🤖 Model info and Claude Code version
- 🧠 Context usage tracking with progress bars
- 💰 Cost tracking with burn rates
- ⌛ Session timer until reset (requires ccusage)
- 📊 Token analytics and consumption metrics
- 📁 Directory display with
- Color Scheme - Enable or disable modern color scheme and emojis (default: yes)
-
Debug Logging - Enable logging to
.claude/statusline.logfor troubleshooting (default: no) -
Installation Location - Choose between global (
~/.claude/) or project-specific (./.claude/) installation (default: project)
Prerequisites Check
Before generating the statusline, the init command automatically checks forjq installation:
- With jq: Full feature support including context tracking, token stats, and session timer
- Without jq: Basic features work with fallback parser, but advanced features are disabled
jq is not detected, the command displays platform-specific installation instructions and asks if you want to continue without it.
Examples
Basic Usage
Run the interactive setup with default options:Custom Output Location
Generate the statusline to a specific path:Generate Without Installing
Create the statusline script without automatic installation:Global Installation
Install the statusline globally for use across all projects:~/.claude/statusline.sh and configured in ~/.claude/settings.json.
Installation Process
When installation is enabled (default), the init command:- Generates an optimized bash script based on your configuration
- Creates the
.claudedirectory if it doesn’t exist - Writes
statusline.shwith execute permissions (chmod +x) - Updates
settings.jsonwith the statusline configuration: - Validates the installation and provides next steps
Safety Features
The init command includes several safety mechanisms:- Conflict Detection: Warns if an existing statusline.sh is found
- Overwrite Protection: Asks for confirmation before replacing existing files
- Settings Preservation: Merges with existing settings.json instead of overwriting
- Graceful Fallback: Provides manual configuration instructions if auto-setup fails
Error Handling
Configuration Validation Failed
Installation Cancelled
--output to save to a different location or --no-install to skip installation.
Settings Update Failed
Next Steps
After runninginit:
- Restart Claude Code to activate the new statusline
- Test with preview (optional):
cc-statusline preview .claude/statusline.sh - Set up ccusage (if using cost tracking): The command runs automatically via
npx ccusage@latest
Related Commands
preview- Test your generated statusline before installingtest- Validate statusline with real Claude Code input
Source Reference
Command definition:src/index.ts:15-20Implementation:
src/cli/commands.ts:84-209