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

ccm-tools

v1.1.1

Published

Claude Config Manager - Manage multiple Claude Code configurations with seamless switching

Downloads

49

Readme

Claude Config Manager

管理 Claude Code 多配置切换的命令行工具

简介

Claude Config Manager 是一个轻量级的 NPM 包,用于管理 Claude Code 的多配置切换。通过拦截 claude 命令实现无感配置选择,让你在不同 AI 提供商和模型之间轻松切换。

特性

  • 多配置管理 - 保存、切换、删除、列出多个配置
  • 命令拦截 - 自动拦截 claude 命令,透明切换配置
  • 交互式选择 - 友好的命令行交互界面
  • 灵活策略 - 三种提示模式适应不同使用习惯
  • 安全可靠 - 自动备份,易于卸载
  • 跨平台 - 支持 macOS、Linux,兼容 zsh、bash、fish

安装

npm install -g ccm-tools

快速开始

1. 安装拦截器

首次使用需要安装命令拦截器:

ccm install

安装完成后,重新加载 Shell 配置:

source ~/.zshrc  # 或 source ~/.bashrc

2. 保存配置

配置好 Claude Code 后,保存当前配置:

ccm save sonnet

3. 切换配置

直接使用 claude 命令,会自动提示选择配置:

claude

或手动切换:

ccm opus

命令说明

install - 安装拦截器

ccm install

安装 Shell 函数拦截器,自动检测 Shell 类型并配置。

uninstall - 卸载拦截器

ccm uninstall

移除拦截器,恢复原始配置。

switch - 切换配置

# 交互式选择
ccm

# 直接切换到指定配置
ccm -n opus

save - 保存配置

ccm save <配置名称>

将当前 ~/.claude/settings.json 保存为命名配置。

delete - 删除配置

ccm delete <配置名称>

# 强制删除(不确认)
ccm delete <配置名称> --force

list - 列出配置

ccm list
# 或
ccm ls

显示所有已保存的配置。

current - 显示当前配置

ccm current

显示当前正在使用的配置。

config - 管理提示策略

# 查看当前策略
ccm config show

# 设置策略
ccm config set <模式>

提示策略模式

| 模式 | 行为 | 适用场景 | |------|------|----------| | always-ask | 每次启动 claude 都询问 | 频繁切换配置的用户 | | ask-once | 每个 shell 会话只问一次(默认) | 一般用户 | | never-ask | 从不询问,使用当前配置 | 只用一个配置的用户 |

工作原理

┌─────────────────────────────────────────────────┐
│                   用户终端                        │
│                                                 │
│  $ claude [args...]                             │
└────────────────┬────────────────────────────────┘
                 │
                 ▼
┌─────────────────────────────────────────────────┐
│              Shell 函数拦截层                     │
│  claude() {                                     │
│    node claude-wrapper.js "$@"                  │
│  }                                              │
└────────────────┬────────────────────────────────┘
                 │
                 ▼
┌─────────────────────────────────────────────────┐
│           claude-wrapper.js                     │
│  - 读取配置列表                                   │
│  - 检查提示策略                                   │
│  - 交互式选择(如需要)                            │
│  - 切换配置文件                                   │
│  - 调用真实 claude                               │
└────────────────┬────────────────────────────────┘
                 │
                 ▼
┌─────────────────────────────────────────────────┐
│          ~/.claude/settings.json                │
│  (切换后的配置文件)                               │
└────────────────┬────────────────────────────────┘
                 │
                 ▼
┌─────────────────────────────────────────────────┐
│          真实的 Claude Code                      │
└─────────────────────────────────────────────────┘

目录结构

~/.claude/
├── settings.json                    # 当前使用的配置
├── configs/                         # 配置文件存储
│   ├── sonnet.json
│   ├── opus.json
│   └── deepseek.json
├── .current-config                  # 当前配置标记
├── .prompt-strategy                 # 提示策略配置
└── backups/                         # 自动备份目录

配置文件格式

配置文件(~/.claude/configs/<name>.json)示例:

{
  "apiProvider": "anthropic",
  "apiKey": "sk-ant-xxx",
  "model": "claude-sonnet-4-20250514",
  "baseURL": "https://api.anthropic.com"
}

常见问题

1. 安装后 claude 命令无响应?

确保重新加载了 Shell 配置:

source ~/.zshrc  # 或 source ~/.bashrc

2. 如何查看当前配置?

ccm current

3. 如何卸载?

ccm uninstall

4. 配置存储在哪里?

所有配置存储在 ~/.claude/ 目录下。

开发

# 克隆仓库
git clone <repo-url>
cd claudeConfigManager

# 安装依赖
npm install

# 本地测试
npm link

# 运行测试
npm test

License

MIT

作者

刘佳林


享受无缝的 Claude Code 配置切换体验! 🚀