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

agent-switch

v1.0.0

Published

AI Agent 配置切换器 - 支持 Claude Code, Copilot, Gemini 等

Readme

Agent Switch - AI Agent 配置切换器

一个美观实用的 TUI(文本用户界面)工具,用于快速切换 AI Agent 框架的配置。支持 Claude Code、GitHub Copilot、Gemini 等多种 AI Agent 框架。

功能特性

  • 🎨 美观的 TUI 界面 - 基于 Ink 构建的现代化终端界面
  • 快速切换 - 在多个 AI Agent 服务配置之间一键切换
  • 🌍 作用域支持 - 支持全局和本地项目级别的配置
  • 🤖 多框架支持 - 当前支持 Claude Code,未来支持 Copilot、Gemini 等
  • 📋 基于现有配置 - 直接读写 ~/.claude/presets.json(Claude Code)

安装

全局安装(推荐)

npm install -g agent-switch

安装后可直接使用 asagent-switch 命令。

本地开发

git clone https://github.com/yourusername/agent-switch.git
cd agent-switch
npm install
npm run build

# 创建全局链接(可选)
npm link

使用方法

TUI 模式(推荐)

启动交互式 TUI 界面:

agent-switch
# 或
agent-switch switch

键盘快捷键:

在服务列表界面:

  • ↑↓ - 在服务列表中导航
  • Enter - 选择服务(进入作用域选择)
  • E - 编辑配置文件(使用系统默认编辑器打开 ~/.claude/presets.json
  • H - 查看帮助(在浏览器中打开帮助文档)
  • Q / Esc - 退出

在作用域选择界面:

  • ↑↓ - 在"本地配置"和"全局配置"之间切换
  • Enter - 确认切换(默认选中"本地配置")
  • Esc - 取消返回服务列表

交互流程:

  1. 启动 TUI,查看服务列表
  2. ↑↓ 选择要切换的服务
  3. Enter 进入作用域选择
  4. ↑↓ 选择作用域(默认:本地配置)
  5. Enter 确认切换
  6. 显示成功消息,1.5秒后自动退出

命令行模式

快速切换服务(无需 TUI):

# 全局切换
agent-switch use anyrouter

# 本地切换(仅当前项目)
agent-switch use anyrouter --local

列出所有服务:

agent-switch list
# 或
agent-switch ls

查看当前服务:

agent-switch current

配置文件

Agent Switch 直接使用对应框架的配置文件:

  • 预设配置: ~/.claude/presets.json - 存储所有服务配置
  • 全局配置: ~/.claude/config.json - 全局激活的服务
  • 本地配置: ./.claude/config.json - 项目级别的服务配置

预设配置格式

{
  "anyrouter": {
    "env": {
      "ANTHROPIC_BASE_URL": "https://anyrouter.top",
      "ANTHROPIC_AUTH_TOKEN": "sk-xxx",
      "ANTHROPIC_MODEL": "claude-sonnet-4-20250514",
      "ANTHROPIC_SMALL_FAST_MODEL": "claude-3-5-haiku-20241022"
    },
    "forceLoginMethod": "console"
  },
  "claudeai": {
    "env": {},
    "forceLoginMethod": "claudeai"
  }
}

项目结构

src/
├── components/          # UI 组件
│   ├── App.tsx         # 主应用
│   ├── Header.tsx      # 标题栏
│   ├── ServiceList.tsx # 服务列表
│   ├── ServiceDetail.tsx # 服务详情
│   ├── StatusBar.tsx   # 状态栏
│   └── ...
├── core/               # 核心逻辑
│   ├── presets.ts      # 预设管理
│   ├── switcher.ts     # 切换逻辑
│   └── types.ts        # 类型定义
├── hooks/              # React Hooks
├── constants/          # 常量和主题
└── utils/              # 工具函数

开发

# 开发模式
npm run dev

# 类型检查
npm run typecheck

# 构建
npm run build

技术栈

  • Ink 4 - React for CLI
  • TypeScript - 类型安全
  • Zod - 运行时验证
  • Commander - CLI 框架
  • Chalk - 终端颜色

License

MIT