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

@liangrk/claude-code-wechatbot

v0.5.0

Published

WeChat Bot for Claude Code — bridge WeChat messages to Claude Code via the official ilink API

Readme

Claude Code WeChat Bot

通过微信 ClawBot 与 Claude Code 对话。在微信中发送消息,Bot 调用 Claude 处理后自动回复。

前置要求

  • Node.js >= 18
  • ANTHROPIC_API_KEY 环境变量(支持第三方兼容 API,如 GLM/智谱)
  • 微信 iOS 或 Android 最新版(需支持 ClawBot)

安装

npm install -g @liangrk/claude-code-wechatbot

或直接使用 npx(无需安装):

npx @liangrk/claude-code-wechatbot setup
npx @liangrk/claude-code-wechatbot bot

使用

1. 扫码登录

npx @liangrk/claude-code-wechatbot setup

终端显示二维码,用微信扫描并确认。凭据保存到 ~/.claude/channels/wechat/account.json

2. 启动 Bot

npx @liangrk/claude-code-wechatbot bot

启动后 Bot 会持续监听微信消息。在微信中找到 ClawBot 对话,直接发消息即可。

3. 检查状态

npx @liangrk/claude-code-wechatbot status

检查账号凭据和 API 连通性。

内置命令(微信中发送)

  • /help — 显示帮助
  • /clear — 清空上下文,开始新会话

运行模式

Spawn 模式(默认)

通过 claude -p 子进程调用 Claude Code,需要系统 PATH 中有 Claude Code >= 2.1.80。

SDK V2 模式(推荐)

使用 @anthropic-ai/claude-agent-sdk 为每个用户维护持久会话,支持上下文保留和会话恢复。

npm install @anthropic-ai/claude-agent-sdk

安装后 Bot 会自动检测并启用 SDK 模式,无需额外配置。

环境变量

| 变量 | 说明 | 默认值 | |------|------|--------| | ANTHROPIC_API_KEY | API Key(必需) | — | | ANTHROPIC_BASE_URL | API 基础 URL(第三方 API 时设置) | — | | CLAUDE_MODEL | 模型名称 | claude-sonnet-4-6 | | CLAUDE_MAX_TURNS | 单次对话最大轮次(SDK 模式) | 5 | | CLAUDE_SDK_MODE | 设为 spawn 强制使用 spawn 模式 | 自动检测 |

支持的消息类型

  • 文本消息
  • 语音消息(自动转文字)
  • 图片消息(发送给 Claude 视觉分析)
  • 文件消息(显示文件名和大小)
  • 视频消息(显示时长)

故障排查

会话过期

npx @liangrk/claude-code-wechatbot status

如果提示 SESSION EXPIRED,重新运行 setup 扫码登录。

消息收不到

  1. 确认 Bot 进程正在运行
  2. 确认消息发送给了 ClawBot(不是普通联系人)
  3. status 命令检查 API 连通性

License

MIT