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 🙏

© 2025 – Pkg Stats / Ryan Hefner

cc-code-status

v2.0.4

Published

Enhanced Claude Code launcher with statusline - supports multiple custom API configurations and code statistics

Readme

CC Code Status

增强版 Claude Code 启动器 + 状态栏插件

一个集成了多 API 配置管理、代码统计和数据上报的 Claude Code 增强工具。

核心功能

1. Claude Code 启动器

  • 多 API 配置管理(支持多个账号/环境)
  • 一键启动 Claude Code 并自动注入环境变量
  • 启动前显示今日统计
  • 自动检测 Claude Code 安装状态

2. 状态栏插件

在 Claude Code 状态栏实时显示:

  • Git 用户名 - 从 git config user.name 获取
  • 对话统计 - 对话次数/轮数(排除系统命令)
  • 代码统计 - 新增/删除代码行数

显示格式: qilin ↑ | Chat: 16次/154轮 | Code: +446/-313

  • - 数据上报已启用(可选)
  • 16次 - 对话会话数(按 sessionId 去重)
  • 154轮 - 用户消息总数
  • +446/-313 - 新增/删除代码行数

3. 数据上报

  • 定期同步对话详情到后端 API(可配置APi、间隔,可关闭)
  • 手动触发数据上报
  • 自定义数据上报(手动输入数据)

4. 项目排除

  • 排除指定项目,不计入统计
  • 支持路径模糊匹配

安装

前置要求

  • Node.js >= 16.0.0
  • Claude Code(必须先安装)
# 安装 Claude Code(如果未安装)
npm install -g @anthropic-ai/claude-code

全局安装

npm install -g cc-code-status

安装后会自动配置状态栏。


快速开始

首次使用

安装后首次运行会引导你配置 API:

ccs

交互式配置:

  1. 输入配置名称(如 work, personal
  2. 输入 API Key
  3. 输入 Base URL
  4. 可选:配置模型名称

配置完成后,Claude Code 会自动启动。


命令列表

所有命令都支持短别名 ccs,例如 ccs config add 等同于 cc-code-status config add

启动器命令

ccs                         # 启动 Claude Code(自动选择配置)
ccs --profile <配置名>      # 使用指定配置启动
ccs -p work                 # 使用 work 配置启动
ccs -v                      # 查看版本号
ccs help                    # 显示帮助

配置管理命令

ccs config                  # 查看配置帮助(无配置时引导添加)
ccs config add              # 添加新配置
ccs config list             # 列出所有配置
ccs config show             # 显示当前配置
ccs config remove <名称>    # 删除指定配置
ccs config --reset          # 重置所有配置

统计查看命令

ccs stats today             # 显示今日统计
ccs stats week              # 显示本周统计(周一-周日)
ccs week                    # 同 stats week

数据上报命令

ccs sync-enable             # 启用数据上报
ccs sync-disable            # 禁用数据上报
ccs sync-status             # 查看上报状态
ccs sync-now                # 手动触发一次上报(真实数据)
ccs sync                    # 同 sync-now
ccs custom-sync             # 自定义数据上报(交互式输入)

项目排除命令

ccs exclude add <路径>      # 添加排除项目
ccs exclude remove <路径>   # 移除排除项目
ccs exclude list            # 列出所有排除项目

旧版兼容命令

ccs setup                   # 配置状态栏(向后兼容)
ccs uninstall               # 移除状态栏配置

使用场景

场景 1:多账号管理

# 添加公司账号
ccs config add
# 配置名称: work
# API Key: sk-ant-...
# Base URL: https://api.company.com

# 添加个人账号
ccs config add
# 配置名称: personal
# API Key: sk-ant-...
# Base URL: https://api.anthropic.com

# 查看所有配置
ccs config list

# 使用指定配置启动
ccs --profile work
ccs -p personal

场景 2:排除测试项目

# 添加测试项目到排除列表
ccs exclude add /Users/qilin/test-project
ccs exclude add /Users/qilin/demo-app

# 查看排除列表
ccs exclude list

# 删除缓存以立即生效
rm ~/.cc-code-status/current.json

# 从排除列表中移除
ccs exclude remove /Users/qilin/test-project

场景 3:查看统计数据

# 查看今日统计
ccs stats today
# 输出: 对话: 16次/154轮
#       代码: +446/-313 行

# 查看本周统计
ccs stats week
# 输出:
# ========================================
#    本周统计 (2025-11-04 至 2025-11-10)
# ========================================
# 总计: 42次/186轮 | +1234/-567 行
# 每日明细:
#   周一 (2025-11-04)     5次/25轮 | +123/-45 行
#   周二 (2025-11-05)     8次/32轮 | +234/-56 行
#   ...

场景 4:数据上报

# 启用数据上报
ccs sync-enable

# 查看上报状态
ccs sync-status

# 手动触发一次上报
ccs sync-now

# 自定义数据上报(手动输入数据)
ccs custom-sync
# 交互式输入:
#   - 对话轮次
#   - 新增代码行数
#   - 删除代码行数

配置文件

API 配置

保存在 ~/.config/cc-code-status/config.json

{
  "profiles": {
    "work": {
      "apiKey": "sk-ant-...",
      "baseUrl": "https://api.company.com",
      "model": "claude-sonnet-4-5-20250929",
      "smallFastModel": "claude-3-5-haiku-20250219",
      "configuredAt": "2025-11-18T08:00:00.000Z",
      "version": "2.0.0"
    },
    "personal": {
      "apiKey": "sk-ant-...",
      "baseUrl": "https://api.anthropic.com",
      "configuredAt": "2025-11-18T09:00:00.000Z",
      "version": "2.0.0"
    }
  }
}

状态栏和同步配置

保存在 ~/.cc-code-status/config.json

{
  "apiUrl": "http://10.40.0.70:8087/api/cloudcode-ai/batch-receive",
  "syncInterval": 1800000,
  "enabled": true,
  "excludedProjects": [
    "/Users/qilin/test-project",
    "/Users/qilin/demo-app"
  ]
}

缓存文件

  • ~/.cc-code-status/current.json - 状态栏缓存(5分钟 TTL)
  • ~/.cc-code-status/conversations.json - 对话详情(用于数据上报)

常见问题

1. 状态栏不显示

检查 ~/.claude/settings.json 中的配置:

{
  "statusLine": {
    "type": "command",
    "command": "cc-code-status"
  }
}

或运行:

ccs setup

2. 多个配置如何选择?

  • 单配置:自动使用唯一配置
  • 多配置:启动时交互选择,或使用 --profile 参数指定
  • 命令行参数ccs --profile workccs -p work

3. 统计数据不准确

# 删除缓存,强制重新计算
rm ~/.cc-code-status/current.json

# 检查是否有项目被排除
ccs exclude list

4. 数据上报失败

# 查看上报状态和配置
ccs sync-status

# 检查 API 地址是否正确
cat ~/.cc-code-status/config.json

# 手动触发并查看错误信息
ccs sync-now

5. 卸载插件

# 移除状态栏配置
ccs uninstall

# 卸载插件
npm uninstall -g cc-code-status

# 删除配置文件(可选)
rm -rf ~/.cc-code-status
rm -rf ~/.config/cc-code-status

许可证

MIT