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

cc-code-status

v2.0.5

Published

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

Downloads

138

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(必须先安装)
  • 无需单独安装 ccgo(ccs 已内置)
# 安装 Claude Code(如果未安装)
npm install -g @anthropic-ai/claude-code

全局安装

npm install -g cc-code-status

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


快速开始

首次使用

  1. 初始化 Claude Code onboarding 状态:
ccs init
  1. 查看并编辑共享配置文件(调用内置 ccgo config):
ccs config
  1. 启动:
ccs

命令列表

所有命令都支持短别名 ccs

启动器命令

ccs                         # 通过内置 ccgo 启动 Claude Code(多配置时交互选择)
ccs -p "任务"               # 无头模式执行任务(行为同 ccgo -p)
ccs -v                      # 查看版本号
ccs help                    # 显示帮助

配置管理命令

ccs init                    # 写入/更新 ~/.claude.json 的 hasCompletedOnboarding=true
ccs config                  # 调用内置 ccgo config(显示配置文件路径与示例)

统计查看命令

ccs today                   # 显示今日统计

数据上报命令

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

# 编辑 ~/.config/cc-code-status/config.json,维护多个 profile

# 正常启动(多配置会交互选择)
ccs

# 无头模式(多配置默认第一个 profile)
ccs -p "总结今天改动"

场景 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 today
# 输出: 对话: 16次/154轮
#       代码: +446/-313 行

场景 4:数据上报

# 启用数据上报
ccs sync-enable

# 查看上报状态
ccs sync-status

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

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

配置文件

API 配置

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

{
  "profiles": {
    "work": {
      "ANTHROPIC_BASE_URL": "https://api.company.com",
      "ANTHROPIC_AUTH_TOKEN": "sk-ant-...",
      "ANTHROPIC_MODEL": "claude-sonnet-4-5-20250929"
    },
    "personal": {
      "ANTHROPIC_BASE_URL": "https://api.anthropic.com",
      "ANTHROPIC_AUTH_TOKEN": "sk-ant-..."
    }
  }
}

状态栏和同步配置

保存在 ~/.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. 多个配置如何选择?

  • 单配置:自动使用唯一配置
  • 多配置ccs 启动时交互选择
  • 无头模式ccs -p "任务" 时默认使用第一个 profile(行为与 ccgo 一致)

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