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

lcclaude

v1.0.6

Published

<p align="right"><strong>中文</strong> | <a href="./README.en.md">English</a></p>

Readme

Claude Code Haha

基于 Claude Code 泄露源码修复的本地可运行版本,支持接入任意 Anthropic 兼容 API(如 MiniMax、OpenRouter 等)。

原始泄露源码无法直接运行。本仓库修复了启动链路中的多个阻塞问题,使完整的 Ink TUI 交互界面可以在本地工作。

功能

  • 完整的 Ink TUI 交互界面(与官方 Claude Code 一致)
  • --print 无头模式(脚本/CI 场景)
  • 支持 MCP 服务器、插件、Skills
  • 支持自定义 API 端点和模型
  • 降级 Recovery CLI 模式

架构概览


快速开始

1. 安装 Bun

本项目运行依赖 Bun。如果你的电脑还没有安装 Bun,可以先执行下面任一方式:

# macOS / Linux(官方安装脚本)
curl -fsSL https://bun.sh/install | bash

如果在精简版 Linux 环境里提示 unzip is required to install bun,先安装 unzip

# Ubuntu / Debian
apt update && apt install -y unzip
# macOS(Homebrew)
brew install bun
# Windows(PowerShell)
powershell -c "irm bun.sh/install.ps1 | iex"

安装完成后,重新打开终端并确认:

bun --version

2. 安装项目依赖

bun install

3. 配置环境变量

复制示例文件并填入你的 API Key:

cp .env.example .env

编辑 .env

# API 认证(二选一)
ANTHROPIC_API_KEY=sk-xxx          # 标准 API Key(x-api-key 头)
ANTHROPIC_AUTH_TOKEN=sk-xxx       # Bearer Token(Authorization 头)

# API 端点(可选,默认 Anthropic 官方)
ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic

# 模型配置
ANTHROPIC_MODEL=MiniMax-M2.7-highspeed
ANTHROPIC_DEFAULT_SONNET_MODEL=MiniMax-M2.7-highspeed
ANTHROPIC_DEFAULT_HAIKU_MODEL=MiniMax-M2.7-highspeed
ANTHROPIC_DEFAULT_OPUS_MODEL=MiniMax-M2.7-highspeed

# 超时(毫秒)
API_TIMEOUT_MS=3000000

# 禁用遥测和非必要网络请求
DISABLE_TELEMETRY=1
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1

4. 启动

npm 全局安装后使用

# 全局安装
npm install -g lcclaude

# 启动交互模式
lcclaude

# 单次提问
lcclaude -p "your prompt here"

# 查看帮助
lcclaude --help

macOS / Linux

# 交互 TUI 模式(完整界面)
./bin/lcclaude

# 无头模式(单次问答)
./bin/lcclaude -p "your prompt here"

# 管道输入
echo "explain this code" | ./bin/lcclaude -p

# 查看所有选项
./bin/lcclaude --help

Windows

前置要求:必须安装 Git for Windows(提供 Git Bash,项目内部 Shell 执行依赖它)。

Windows 下启动脚本 bin/lcclaude 是 bash 脚本,无法在 cmd / PowerShell 中直接运行。请使用以下方式:

方式一:PowerShell / cmd 直接调用 Bun(推荐)

# 交互 TUI 模式
bun --env-file=.env ./src/entrypoints/cli.tsx

# 无头模式
bun --env-file=.env ./src/entrypoints/cli.tsx -p "your prompt here"

# 降级 Recovery CLI
bun --env-file=.env ./src/localRecoveryCli.ts

方式二:Git Bash 中运行

# 在 Git Bash 终端中,与 macOS/Linux 用法一致
./bin/lcclaude

注意:部分功能(语音输入、Computer Use、Sandbox 隔离等)在 Windows 上不可用,不影响核心 TUI 交互。


接入本地 Qwen / OpenAI-compatible 服务

当前主链路使用的是 Anthropic SDK,请求体是 Anthropic messages 协议,而不是 OpenAI chat.completions / responses 协议。

这意味着:

  • 不能直接ANTHROPIC_BASE_URL 指到纯 OpenAI-compatible 端点
  • 如果你要接本地 Qwen、vLLM、Ollama、LM Studio、SGLang 等 OpenAI-compatible 服务,推荐在中间加一层 LiteLLM(或其他可把 OpenAI 协议转成 Anthropic 协议的网关)

推荐方案:LiteLLM 代理本地 Qwen

假设你的本地模型服务已经启动,并暴露了 OpenAI-compatible 接口,例如:

  • http://127.0.0.1:8000/v1(vLLM / SGLang 常见)
  • http://127.0.0.1:11434/v1(Ollama 开启 OpenAI 兼容后)

先安装 LiteLLM:

pip install 'litellm[proxy]'

创建 litellm.yaml

model_list:
  - model_name: qwen-local
    litellm_params:
      model: openai/Qwen2.5-Coder-32B-Instruct
      api_base: http://127.0.0.1:8000/v1
      api_key: dummy

启动代理:

litellm --config litellm.yaml --port 4000

然后把本项目 .env 改成:

# Claude Haha -> LiteLLM(Anthropic) -> 本地 OpenAI-compatible 服务
ANTHROPIC_BASE_URL=http://127.0.0.1:4000/anthropic
ANTHROPIC_AUTH_TOKEN=dummy

ANTHROPIC_MODEL=qwen-local
ANTHROPIC_DEFAULT_SONNET_MODEL=qwen-local
ANTHROPIC_DEFAULT_HAIKU_MODEL=qwen-local
ANTHROPIC_DEFAULT_OPUS_MODEL=qwen-local

DISABLE_TELEMETRY=1
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1

如果你的 OpenAI-compatible 网关要求额外请求头,可以继续加:

ANTHROPIC_CUSTOM_HEADERS=Authorization: Bearer your-token
X-Api-Key: your-extra-key

常见说明

  • ANTHROPIC_AUTH_TOKEN 在这里通常只是给 LiteLLM / 网关占位,很多本地服务填 dummy 即可
  • 如果你的本地服务是 Ollamaapi_base 常见写法是 http://127.0.0.1:11434/v1
  • 如果你的本地服务已经是 Anthropic-compatible,那就不需要 LiteLLM,直接把 ANTHROPIC_BASE_URL 指过去即可
  • 某些代理不支持 Anthropic 的实验字段,出现 Extra inputs are not permitted400 Bad Request 时,优先保留 CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1

环境变量说明

| 变量 | 必填 | 说明 | |------|------|------| | ANTHROPIC_API_KEY | 二选一 | API Key,通过 x-api-key 头发送 | | ANTHROPIC_AUTH_TOKEN | 二选一 | Auth Token,通过 Authorization: Bearer 头发送 | | ANTHROPIC_BASE_URL | 否 | 自定义 API 端点,默认 Anthropic 官方 | | ANTHROPIC_CUSTOM_HEADERS | 否 | 追加自定义请求头,适合某些代理 / 网关的额外鉴权 | | ANTHROPIC_MODEL | 否 | 默认模型 | | ANTHROPIC_DEFAULT_SONNET_MODEL | 否 | Sonnet 级别模型映射 | | ANTHROPIC_DEFAULT_HAIKU_MODEL | 否 | Haiku 级别模型映射 | | ANTHROPIC_DEFAULT_OPUS_MODEL | 否 | Opus 级别模型映射 | | API_TIMEOUT_MS | 否 | API 请求超时,默认 600000 (10min) | | DISABLE_TELEMETRY | 否 | 设为 1 禁用遥测 | | CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC | 否 | 设为 1 禁用非必要网络请求 | | CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS | 否 | 设为 1 去掉部分 Anthropic 实验字段,适合严格代理 |


降级模式

如果完整 TUI 出现问题,可以使用简化版 readline 交互模式:

CLAUDE_CODE_FORCE_RECOVERY_CLI=1 ./bin/lcclaude

相对于原始泄露源码的修复

泄露的源码无法直接运行,主要修复了以下问题:

| 问题 | 根因 | 修复 | |------|------|------| | TUI 不启动 | 入口脚本把无参数启动路由到了 recovery CLI | 恢复走 cli.tsx 完整入口 | | 启动卡死 | verify skill 导入缺失的 .md 文件,Bun text loader 无限挂起 | 创建 stub .md 文件 | | --print 卡死 | filePersistence/types.ts 缺失 | 创建类型桩文件 | | --print 卡死 | ultraplan/prompt.txt 缺失 | 创建资源桩文件 | | Enter 键无响应 | modifiers-napi native 包缺失,isModifierPressed() 抛异常导致 handleEnter 中断,onSubmit 永远不执行 | 加 try-catch 容错 | | setup 被跳过 | preload.ts 自动设置 LOCAL_RECOVERY=1 跳过全部初始化 | 移除默认设置 |


项目结构

bin/lcclaude             # 入口脚本
preload.ts               # Bun preload(设置 MACRO 全局变量)
.env.example             # 环境变量模板
src/
├── entrypoints/cli.tsx  # CLI 主入口
├── main.tsx             # TUI 主逻辑(Commander.js + React/Ink)
├── localRecoveryCli.ts  # 降级 Recovery CLI
├── setup.ts             # 启动初始化
├── screens/REPL.tsx     # 交互 REPL 界面
├── ink/                 # Ink 终端渲染引擎
├── components/          # UI 组件
├── tools/               # Agent 工具(Bash, Edit, Grep 等)
├── commands/            # 斜杠命令(/commit, /review 等)
├── skills/              # Skill 系统
├── services/            # 服务层(API, MCP, OAuth 等)
├── hooks/               # React hooks
└── utils/               # 工具函数

技术栈

| 类别 | 技术 | |------|------| | 运行时 | Bun | | 语言 | TypeScript | | 终端 UI | React + Ink | | CLI 解析 | Commander.js | | API | Anthropic SDK | | 协议 | MCP, LSP |


Disclaimer

本仓库基于 2026-03-31 从 Anthropic npm registry 泄露的 Claude Code 源码。所有原始源码版权归 Anthropic 所有。仅供学习和研究用途。