npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@r2neuron/r2d2

v1.0.3

Published

R2D2 CLI - Claude Code model switcher

Downloads

9

Readme

R2D2 CLI

R2D2 CLI - Interactive Claude Code model switcher for managing Claude Code and GLM API configurations.

Features

  • Interactive Configuration: Arrow-key navigation for easy setup
  • Multiple Model Support: Claude Subscription, Claude API, and GLM modes
  • Template System: Preserves existing settings while updating configurations
  • Automatic Backup: Settings are backed up before any changes
  • Multi-line Instructions: Support for complex onstart instructions
  • Cross-platform Support: Works on macOS, Linux, and Windows

Installation

Step 1: Install R2D2 CLI

npm install -g @r2neuron/r2d2

Step 2: Setup Claude Configs (Optional but Recommended)

For full functionality with R2D2's extended features:

# Sync Claude configuration templates
npm run claude-configs

# Initialize Claude configuration
r2d2 init

From source

git clone https://github.com/hatsuka05/r2d2-cli.git
cd r2d2-cli
npm install
npm run build
npm link

# Setup Claude configs (optional)
npm run claude-configs

From Homebrew

brew install r2d2

# Setup Claude configs (optional)
npm run claude-configs

Setup Instructions

Quick Setup (Basic)

  1. Install R2D2 CLI
  2. Run r2d2 glm or r2d2 cc-api to configure API mode
  3. Edit ~/.claude/settings.json to add your API key
  4. Start using with r2d2

Full Setup (Recommended)

  1. Install: npm install -g @r2neuron/r2d2
  2. Sync Templates: npm run claude-configs (requires SSH access to claude-configs repo)
  3. Initialize: r2d2 init or r2d2 init --force (overwrites existing files)
  4. Configure API: Edit ~/.claude/settings.json with your API key
  5. Start: r2d2

Claude Configs Management

# Sync latest templates from repository
npm run claude-configs

# Initialize/update local configuration
r2d2 init        # Safe mode (preserves existing files)
r2d2 init --force # Force mode (overwrites existing files)

# Configure API keys manually
nano ~/.claude/settings.json

Usage

Interactive Mode (Default)

r2d2

First shows action selection:

  1. Start: Launch Claude Code CLI with current configuration immediately
  2. Configure: Full configuration flow with arrow-key navigation

If Configure is selected:

  1. Model Selection: Choose between Claude Subscription, Claude API, or GLM
  2. API Configuration: Enter new API key, use existing, or skip
  3. CLI Selection: Choose Claude Code (future: more CLI options)
  4. Onstart Instructions: Add multi-line custom instructions or skip

After configuration, Claude Code CLI starts automatically with your selected settings.

Show Version

r2d2 --version
r2d2 -V

Check Current Status

r2d2 status

Shows:

  • Current mode (Claude Code, Claude API, or GLM)
  • Settings file location
  • Token configuration status

Quick Configuration Switches

Claude Subscription Mode

r2d2 cc

Switches to Claude Code subscription mode without starting CLI.

Claude API Mode

r2d2 cc-api

Configures Claude API mode without starting CLI.

GLM Mode

r2d2 glm

Configures GLM API mode without starting CLI.

To start Claude Code CLI with current configuration:

r2d2
# Select "Start"

Or configure first then start:

r2d2
# Select "Configure" → Complete setup → Starts automatically

Configuration Templates

R2D2 uses configuration templates to preserve your existing settings:

  • Subscription Template: Full Claude Code settings without API keys
  • API Key Template: Complete configuration with ${API_KEY} placeholders
  • Automatic Merging: Preserves existing permissions, hooks, plugins, and custom settings

File Management

R2D2 automatically manages backup files:

  • ~/.claude/settings-cc.json - Claude Code subscription backup
  • ~/.claude/settings-cc-api.json - Claude API backup
  • ~/.claude/settings-glm.json - GLM backup
  • ~/.claude/settings.json - Active settings
  • configs/claude/ - Configuration templates

Security

  • API Key Encryption: AES-256-GCM encryption for stored API keys
  • Input Validation: Comprehensive protection against command injection attacks
  • Secure File Permissions: 0o600 permissions on sensitive files
  • No Exposure: API tokens are never logged or displayed (masked format only)
  • Automatic Backup: Settings files are backed up before any changes
  • No Hardcoded Credentials: All credentials are user-controlled
  • Memory Protection: Temporary files are securely handled and cleaned up

Requirements

  • Node.js >= 16.0.0
  • npm or yarn
  • Write access to ~/.claude/ directory

Troubleshooting

Permission denied

chmod 600 ~/.claude/settings.json

Settings not found

R2D2 will create the .claude directory and default settings if they don't exist.

Restore from backup

If you need to manually restore a backup:

cp ~/.claude/settings-cc.json ~/.claude/settings.json  # Restore Claude Code
cp ~/.claude/settings-glm.json ~/.claude/settings.json # Restore GLM

Development

Setup

git clone https://github.com/hatsuka05/r2d2-cli.git
cd r2d2-cli
npm install

Build

npm run build

Test locally

npm link
r2d2 --version

Test Interactive Mode

r2d2
# Try different configurations and test arrow-key navigation

Unlink

npm unlink -g @r2neuron/r2d2

Contributing

For detailed contribution guidelines, including our Git workflow and release process, see docs/publish-guide.md.

Quick setup:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT License - see LICENSE file for details.

Repository

https://github.com/hatsuka05/r2d2-cli

Support

For issues and feature requests, please use the GitHub issue tracker.