CodeState CLI - Configuration, Script, and Git Management
npm install codestate-clibash
npm install -g codestate-cli
`
Quick Start
`bash
Initialize CodeState in your project
codestate config show
Create your first script
codestate scripts create
Save your current development session
codestate session save
List all your scripts
codestate scripts show
`
Command Reference
$3
`bash
Create a new script
codestate scripts create
Show all scripts
codestate scripts show
Show scripts for specific project
codestate scripts show --root-path /path/to/project
Update a script
codestate scripts update
Delete a script
codestate scripts delete
Delete all scripts for a project
codestate scripts delete-by-root-path /path/to/project
Export scripts to file
codestate scripts export --output scripts.json
Import scripts from file
codestate scripts import --input scripts.json
`
$3
`bash
Save current session
codestate session save
List all sessions
codestate session list
Resume a session
codestate session resume
Update session metadata
codestate session update
Delete a session
codestate session delete
`
$3
`bash
Show current configuration
codestate config show
Update configuration
codestate config update
Export configuration
codestate config export --output config.json
Import configuration
codestate config import --input config.json
Reset to defaults
codestate config reset
`
$3
`bash
List all terminal collections
codestate terminals list
Get details of a specific collection
codestate terminals get
Execute a terminal collection
codestate terminals execute
`
Interactive Mode
CodeState CLI includes an interactive TUI for enhanced user experience:
`bash
Launch interactive mode for scripts
codestate scripts
Launch interactive mode for sessions
codestate session
Launch interactive mode for configuration
codestate config
Launch interactive mode for terminal collections
codestate terminals
`
Examples
$3
`bash
codestate scripts create
Follow the prompts to create a script:
- Name: setup-project
- Content: npm install && npm run build
- Root Path: /path/to/your/project
`
$3
`bash
Save current state including open files, git status, and scripts
codestate session save
Enter session name: feature-development
Session saved with ID: abc123
`
$3
`bash
List available sessions
codestate session list
Resume a specific session
codestate session resume abc123
This will restore your development environment
`
$3
`bash
View current settings
codestate config show
Update settings interactively
codestate config update
Follow prompts to modify configuration
`
$3
`bash
List all terminal collections
codestate terminals list
Execute a collection of commands
codestate terminals execute setup-project
This will run all commands in the collection sequentially
`
Configuration
CodeState CLI uses a configuration file to store settings. The default location is:
- Windows: %APPDATA%/codestate/config.json
- macOS: ~/Library/Application Support/codestate/config.json
- Linux: ~/.config/codestate/config.json
$3
`json
{
"defaultIDE": "vscode",
"scriptsDirectory": "~/.codestate/scripts",
"sessionsDirectory": "~/.codestate/sessions",
"gitAutoCommit": false,
"sessionAutoSave": true
}
`
Integration with IDEs
CodeState CLI integrates with popular IDEs:
- VS Code: Open projects and files directly
- Install the CodeState IDE Extension for seamless IDE integration - manage scripts, sessions, and configurations directly from VS Code
- WebStorm/IntelliJ: Launch projects in JetBrains IDEs
- Sublime Text: Open files in Sublime
- Vim/Neovim: Open files in terminal editors
> Tip: You can use both the CLI and IDE extension for most tasks. However, for saving sessions, we recommend using the IDE extension as it can capture file contents and open files, while the CLI can only save metadata. The CLI is great for terminal workflows and automation, while the IDE extension provides a native VS Code experience for managing your development context.
Development
This package is part of the CodeState monorepo. For development setup, see the main CodeState repository.
$3
`bash
Clone the repository
git clone https://github.com/codestate-cs/code-state-library.git
cd code-state-library
Install dependencies
npm install
Build CLI package
npm run build:cli
Run in development mode
npm run dev
``