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

proxy-config-switcher

v1.0.2

Published

跨平台代理配置切换工具 - 快速批量切换开发工具代理设置

Readme

Proxy Config Switcher (PCS)

跨平台代理配置切换工具 - 快速批量切换开发工具代理设置

npm version License: MIT Node.js Version

PCS 是一款跨平台的命令行工具,帮助开发者快速批量切换常用开发工具的代理配置。支持 Git、npm、Yarn、pnpm、uv、pip、curl、wget 等工具,智能检测系统代理,一键启用/取消代理设置。


🚀 功能特性

  • 🔍 自动工具检测 - 智能扫描系统中已安装的开发工具
  • 🌐 系统代理检测 - 自动读取操作系统代理设置
  • 批量快速切换 - 一键启用/取消所有工具的代理配置
  • 💾 配置历史记录 - 保存常用代理地址,支持快速重用
  • 🖥️ 跨平台支持 - 完美支持 Windows、macOS、Linux
  • 🔐 多种代理协议 - 支持 HTTP、HTTPS、SOCKS5 代理
  • 🌍 环境变量配置 - 支持终端环境变量代理设置
  • 📊 配置持久化 - JSON 文件存储,断电不丢失

💡 快速预览

$ npx pcs

🚀 Proxy Config Switcher - 代理配置切换工具

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔍 已检测到的开发工具:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✅ Git (git)
  ✅ npm (npm)
  ✅ Yarn (yarn)
  ✅ pnpm (pnpm)
  ✅ uv (uv)
  ✅ pip (pip)
  ✅ curl (curl)
  ❌ wget - 未安装

  共 7 个工具已安装,1 个未安装

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔍 当前代理状态
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ❌ Git      - 未配置
  ❌ npm      - 未配置
  ❌ Yarn     - 未配置
  ❌ pnpm     - 未配置

请选择操作:
❯ 启用代理
  取消代理
  退出

📦 安装

方式1:使用 npx(推荐)

无需安装,直接运行最新版本:

npx pcs

方式2:全局安装

使用 npm 全局安装:

npm install -g proxy-config-switcher

安装后可直接运行:

pcs

方式3:使用其他包管理器

# Yarn
yarn global add proxy-config-switcher

# pnpm
pnpm add -g proxy-config-switcher

系统要求

  • Node.js >= 18.0.0
  • 操作系统:Windows 10+、macOS 11+、Linux

验证安装

$ pcs --version
Proxy Config Switcher v1.0.0

📖 使用方法

第一次使用

首次运行时,PCS 会自动检测系统中已安装的开发工具:

$ npx pcs

🚀 Proxy Config Switcher - 代理配置切换工具
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔍 已检测到的开发工具:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ✅ Git (git)
  ✅ npm (npm)
  ✅ pnpm (pnpm)
  ❌ uv - 未安装

🌐 未检测到系统代理

请选择操作:
❯ 启用代理
  取消代理
  退出

请输入代理地址 (格式: host:port)
> 192.168.1.100:7890

[1/3] 正在配置 Git...
  ✅ Git 代理已启用

[2/3] 正在配置 npm...
  ✅ npm 代理已启用

[3/3] 正在配置 pnpm...
  ✅ pnpm 代理已启用

📊 操作完成!

  ✅ 成功: 3
  ⏱️  耗时: 1200ms

后续使用

再次运行时,PCS 会显示历史代理记录,方便快速切换:

$ npx pcs

🌐 系统代理: 192.168.1.100:8080
💾 历史代理:
  1. 192.168.1.100:7890 (使用5次)
  2. 10.0.0.1:3128 (使用2次)

请选择代理:
❯ 系统代理 (192.168.1.100:8080)
  历史代理 1: 192.168.1.100:7890
  历史代理 2: 10.0.0.1:3128
  输入新代理地址

命令行选项

# 启动交互式界面
pcs

# 查看版本信息
pcs --version

# 查看帮助信息
pcs --help

# 列出所有支持的工具
pcs --tools

使用场景

场景1:公司网络 ↔ 家里网络切换

# 公司:使用公司代理
$ pcs
选择: 公司代理 192.168.1.100:8080

# 回家:取消代理
$ pcs
选择: 取消代理

场景2:开发环境 ↔ 生产环境切换

# 开发环境:使用开发代理
$ pcs
选择: 开发代理 10.0.0.1:3128

# 生产环境:切换到生产代理
$ pcs
选择: 生产代理 10.0.0.2:3128

场景3:临时使用代理加速下载

# 临时启用代理下载依赖
$ pcs
选择: 启用代理

$ npm install

# 下载完成后取消
$ pcs
选择: 取消代理

🎯 支持的工具

| 工具 | Windows | macOS | Linux | 配置方式 | |------|---------|-------|-------|----------| | Git | ✅ | ✅ | ✅ | git config | | npm | ✅ | ✅ | ✅ | .npmrc 配置文件 | | Yarn | ✅ | ✅ | ✅ | .yarnrc 配置文件 | | pnpm | ✅ | ✅ | ✅ | .npmrc 配置文件 | | uv | ✅ | ✅ | ✅ | 环境变量 | | pip | ✅ | ✅ | ✅ | pip config | | curl | ✅ | ✅ | ✅ | 环境变量 | | wget | ✅ | ✅ | ✅ | .wgetrc 配置文件 |

支持的代理协议

  • HTTP 代理http://host:port
  • HTTPS 代理https://host:port
  • SOCKS5 代理socks5://host:port

⚙️ 配置文件

PCS 将配置和历史记录保存在本地配置文件中:

配置文件位置

| 操作系统 | 配置文件路径 | |----------|--------------| | Windows | %APPDATA%\pcs\config.json | | macOS | ~/Library/Application Support/pcs/config.json | | Linux | ~/.config/pcs/config.json |

配置文件格式

{
  "version": "1.0.0",
  "proxyHistory": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "host": "192.168.1.100",
      "port": 8080,
      "protocol": "http",
      "createdAt": "2025-12-26T10:00:00.000Z",
      "lastUsedAt": "2025-12-26T14:30:00.000Z",
      "useCount": 5
    }
  ],
  "lastUsedProxyId": "550e8400-e29b-41d4-a716-446655440000"
}

手动编辑配置

您可以直接编辑配置文件来管理代理历史记录:

# Windows
notepad %APPDATA%\pcs\config.json

# macOS/Linux
nano ~/.config/pcs/config.json

🔧 故障排除

问题1:工具检测失败

症状:某些工具显示 "未安装",但实际上已安装。

解决方案

  • 检查工具是否在系统 PATH 环境变量中
  • 手动验证工具是否可访问:
    git --version
    npm --version

问题2:权限不足

症状:配置时提示 "EACCES: permission denied"。

解决方案

  • Windows:以管理员身份运行命令提示符
  • macOS/Linux:使用 sudo 运行命令
    sudo pcs

问题3:代理不生效

症状:配置成功但工具仍无法通过代理访问网络。

解决方案

  • 验证代理服务器是否正常运行
  • 检查防火墙是否阻止了代理连接
  • 确认代理地址格式正确(host:port
  • 尝试手动测试代理:
    curl -x http://192.168.1.100:7890 https://www.google.com

问题4:配置文件损坏

症状:启动时报错或历史记录丢失。

解决方案: 删除配置文件,PCS 会自动重新创建:

# Windows
del %APPDATA%\pcs\config.json

# macOS/Linux
rm ~/.config/pcs/config.json

❓ FAQ

PCS 是免费的吗?

是的,PCS 完全免费且开源,采用 MIT 许可证。

支持哪些代理协议?

支持 HTTP、HTTPS 和 SOCKS5 代理协议。

PCS 会修改我的系统代理设置吗?

不会。PCS 只会修改各个开发工具的代理配置,不会修改操作系统级别的代理设置。

如何卸载 PCS?

# 如果使用 npm 全局安装
npm uninstall -g proxy-config-switcher

# 删除配置文件(可选)
# Windows: del %APPDATA%\pcs\config.json
# macOS/Linux: rm -rf ~/.config/pcs

PCS 会收集我的数据吗?

绝对不会。所有数据都存储在本地,不会上传到任何服务器。

支持代理认证吗(用户名/密码)?

当前版本暂不支持代理认证,计划在未来版本中添加此功能。

可以同时配置多个代理吗?

当前版本一次只能配置一个代理地址,但可以保存多个代理历史记录并快速切换。

PCS 会影响工具的正常使用吗?

不会。PCS 只修改代理配置,不会影响工具的其他功能。取消代理后,工具会恢复到原始状态。


📝 许可证

MIT License

Copyright © 2025


🙏 鸣谢

感谢以下优秀的开源项目:


📮 反馈与支持

如有问题或建议,欢迎通过 npm 包页面反馈。