ocm is a command-line tool for managing opencode configuration files, similar to how nvm manages Node.js versions.
This project is inspired by hungthai1401/occtx and vibe coded with sst/opencode & Kimi K2.
- List all available configurations
- Switch between configurations
- Create new configurations
- Edit existing configurations
- Delete configurations
- Copy configurations
- Backup and restore configurations
Install with Fisher:
fisher install gkzhb/ocm.fish# List all available configurations
ocm list
# Show current configuration
ocm current
# Switch to specified configuration
ocm use dev-plugin
# Set default configuration
ocm default myconfig
# Create new configuration
ocm create myconfig
# Edit configuration
ocm edit myconfig
# Delete configuration
ocm delete myconfig
# Copy configuration
ocm copy source-config dest-config
# Backup current configuration
ocm backup
# Restore from backup
ocm restore backup_20251120_005705OPENCODE_CONFIG: Specify the configuration file path to use (supports both.jsonand.jsoncformats)ocm_current_config: Fish variable showing the current active configuration name (similar tonvm_current_version)ocm_default_config: Universal Fish variable showing the default configuration name (similar tonvm_default_version)
# Use custom configuration file
OPENCODE_CONFIG=~/myconfig.jsonc opencode
OPENCODE_CONFIG=~/myconfig.json opencode
# Or set environment variable first
export OPENCODE_CONFIG=~/myconfig.jsonc
opencode
# Check current and default configurations
echo $ocm_current_config
echo $ocm_default_config
# Note: Default configuration is stored as a universal variable and persists across all Fish shell sessionsConfiguration files are stored in the following locations:
- Default configuration:
~/.config/opencode/opencode.jsoncor~/.config/opencode/opencode.json - Other configurations:
~/.config/opencode/settings/<name>.jsoncor~/.config/opencode/settings/<name>.json - Backup files:
~/.config/opencode/backups/backup_<timestamp>.jsoncor~/.config/opencode/backups/backup_<timestamp>.json
Note: Both .json and .jsonc (JSON with comments) formats are supported.
Basic configuration file structure:
- Confirmation prompt when deleting configurations
- Configuration switching is achieved by setting the
OPENCODE_CONFIGenvironment variable (does not completely replace the default config file, but merges the contents of theOPENCODE_CONFIGconfig file on top of it and the project config) - Backup files are automatically created in the
~/.config/opencode/backups/directory - Both
.jsonand.jsonc(JSON with comments) formats are supported for all configuration files - Default configuration is stored as a Fish universal variable (
ocm_default_config) and persists across all Fish shell sessions and terminal restarts
| nvm | ocm |
|---|---|
nvm list |
ocm list |
nvm use <version> |
ocm use <config> |
nvm current |
ocm current |
nvm install <version> |
ocm create <config> |
nvm alias default <version> |
ocm default <config> |
$nvm_current_version |
$ocm_current_config |
$nvm_default_version |
$ocm_default_config |
| Manages Node.js versions | Manages opencode configurations |
{ "$schema": "https://opencode.ai/config.json", "plugin": [], "provider": {}, "permission": { "edit": "ask", "bash": "ask" }, "instructions": [], "mcp": {}, "share": "disabled", "autoupdate": false }