Skip to content

About

omo配置切换工具,轻松切换 OhMyOpenAgent 多配置。支持 macOS、Linux 和 Windows WSL。

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

omo-switch

English | 中文

A simple tool for switching between multiple OhMyOpenAgent configurations.

Features

  • 🔄 Quick switch between multiple OMO configurations
  • 📁 Profile-based configuration management
  • 🔧 Easy to create and manage custom profiles
  • 🌍 Cross-platform support (macOS, Linux, Windows WSL)
  • 📦 One-click installation

Installation

One-line install (macOS/Linux)

curl -fsSL https://raw.githubusercontent.com/wycto/omo-switch/main/install.sh | bash

Manual install

# Clone the repository
git clone https://github.com/wycto/omo-switch.git
cd omo-switch

# Run the installer
chmod +x install.sh
./install.sh

Windows (WSL/Git Bash)

  1. Install WSL or Git for Windows
  2. Open WSL/Git Bash terminal
  3. Run the installation command above

Quick Start

# Initialize profiles (first time only)
omo-switch init

# List available profiles
omo-switch list

# Switch to a profile
omo-switch use work

# Check current status
omo-switch status

Project-level Profiles

Each project can have its own OMO configuration. Use the --local flag:

# Initialize project-level profiles
cd /path/to/your/project
omo-switch init --local

# Switch project-level profile
omo-switch use work --local

# List project-level profiles
omo-switch list --local

# View all profile status (user + project level)
omo-switch status

Auto-detect Free Models

The auto command detects your configured API keys and generates a profile with free models:

omo-switch auto

Supported free model providers:

Provider Required Env Var Free Models
Google Gemini GEMINI_API_KEY gemini-2.5-flash
Groq GROQ_API_KEY llama-4-maverick, qwq-32b
OpenRouter OPENROUTER_API_KEY deepseek-chat:free, gemini-flash:free

The auto mode re-detects on every run — the model list may change based on provider free-tier policies.

Available Profiles

Profile Description Models
work Production code, important projects Claude + GPT-5
personal Personal projects, learning Free models
experiment Testing new models GPT-5 + o3
cost-saving Budget-friendly All free models
auto Auto-detect Dynamically detects available free models

Commands

Command Description
omo-switch use <profile> Switch to user-level profile
omo-switch use <profile> --local Switch to project-level profile
omo-switch show <profile> View profile contents
omo-switch auto Auto-detect free models and generate profile
omo-switch list List user-level profiles
omo-switch list --local List project-level profiles
omo-switch status Show all profile status
omo-switch init Initialize user-level profiles directory
omo-switch init --local Initialize project-level profiles directory
omo-switch default Restore default configuration
omo-switch help Show help message

Use -l as shorthand for --local.

Custom Profiles

User-level Profiles

Add a .jsonc file to ~/.config/opencode/profiles/:

cat > ~/.config/opencode/profiles/my-profile.jsonc << 'EOF'
{
  "agents": {
    "sisyphus": {
      "model": "your-preferred-model"
    }
  }
}
EOF

omo-switch my-profile

Project-level Profiles

Add a .jsonc file to <project>/.opencode/profiles/:

# Interactive creation
omo-switch add --local

# Or manually
mkdir -p .opencode/profiles
cat > .opencode/profiles/my-project.jsonc << 'EOF'
{
  "agents": {
    "sisyphus": {
      "model": "your-preferred-model"
    }
  }
}
EOF

omo-switch my-project --local

Environment Variables

Variable Description Default
OPENCODE_CONFIG_DIR Custom OpenCode config directory ~/.config/opencode

How It Works

User-level Profiles

  1. Profile files are stored in ~/.config/opencode/profiles/
  2. Switching writes to ~/.config/opencode/oh-my-openagent.jsonc
  3. Original configuration is backed up before switching

Project-level Profiles (--local)

  1. Profile files are stored in <project>/.opencode/profiles/
  2. Switching writes to <project>/.opencode/oh-my-openagent.jsonc
  3. Project-level profiles take priority over user-level profiles

The active profile is applied when you restart OpenCode.

Important Notes

About Overwriting

omo-switch init will NOT overwrite existing configurations:

  • If ~/.config/opencode/profiles/ already contains config files, it will show "Profile directory already exists"
  • To reinitialize, manually delete the directory first:
# Reinitialize
rm -rf ~/.config/opencode/profiles/
omo-switch init

Without OpenCode/OMO Installed

omo-switch can be used without OpenCode/OhMyOpenAgent installed:

  • ✅ Can create profile files
  • ✅ Can switch between profiles
  • ⚠️ Profiles won't take effect until OMO is installed and enabled

During initialization, it will detect your environment:

  • OpenCode not found → Shows installation instructions
  • OhMyOpenAgent not found → Shows installation instructions
  • User can choose to continue creating profiles (will take effect after installing OMO)

Platform Support

Platform Status Notes
macOS (Intel/Apple Silicon) ✅ Full support
Linux (x86_64/ARM) ✅ Full support
Windows (WSL) ✅ Full support Recommended for Windows
Windows (Git Bash) ⚠️ Partial Some features may differ
Windows (native) ❌ Not supported Use WSL instead

Uninstall

omo-switch --uninstall

Or manually:

rm ~/.config/opencode/omo-switch
rm ~/.local/bin/omo-switch

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE for details.

Acknowledgments

  • OhMyOpenAgent - The amazing multi-agent system for OpenCode
  • OpenCode - The AI coding agent that started it all

About

omo配置切换工具,轻松切换 OhMyOpenAgent 多配置。支持 macOS、Linux 和 Windows WSL。

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages