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

@huyooo/ai-chat-cli

v0.3.29

Published

AI Chat 命令行工具 - 终端中与 AI 对话

Readme

@huyooo/ai-chat-cli

终端 AI 对话工具,与业界 CLI(Claude Code、Aider、Gemini CLI、OpenCode)使用方式一致。

特性

  • TUI 界面 - 现代化终端界面,支持快捷键和命令菜单
  • 多行输入 - \ + Enter 换行
  • 文件管理 - @ 引用文件,/add /drop 管理上下文
  • 命令执行 - ! 执行 Shell 命令
  • 网页抓取 - /web URL 抓取网页内容
  • Git 集成 - /git 快速查看状态、diff、log
  • Token 统计 - 实时显示 token 消耗
  • 上下文压缩 - /compress 压缩长对话
  • 自定义命令 - 定义可复用提示模板
  • 会话管理 - 保存、恢复对话

安装

# npm 全局安装
npm install -g @huyooo/ai-chat-cli

# 或从源码安装
cd ai-chat/packages/ai-chat-cli
npm link

配置

# 设置 API Key(至少配置一个)
ai-chat config --set arkApiKey=YOUR_ARK_API_KEY
ai-chat config --set geminiApiKey=YOUR_GEMINI_KEY
ai-chat config --set qwenApiKey=YOUR_QWEN_KEY

# Web 搜索(可选)
ai-chat config --set tavilyApiKey=YOUR_TAVILY_KEY

# 查看配置
ai-chat config --list

配置文件:~/.ai-chat/config.json

使用

启动 TUI

ai-chat

界面:

◆ AI Chat • ask • doubao-seed-1-6          1.2k↑ 0.8k↓

你: 你好
AI: 你好!有什么我可以帮助你的吗?

❯ _

@ 文件 • / 命令 • ! Shell • \↵ 换行 • ^L 清屏

快捷键

| 按键 | 功能 | |------|------| | @ | 打开文件选择器 | | / | 打开命令菜单 | | !cmd | 执行 Shell 命令 | | \ + Enter | 多行输入 | | ↑↓ | 历史记录 | | Ctrl+L | 清屏 | | Ctrl+C | 取消生成/退出 | | Ctrl+D | 退出 | | t | 切换思考显示 |

命令

输入 / 打开命令菜单,或直接输入:

| 命令 | 说明 | |------|------| | /help | 显示帮助 | | /model | 选择模型 | | /mode ask\|agent | 切换模式 | | /add <file> | 添加文件到上下文 | | /drop [file] | 移除文件(不带参数移除全部)| | /files | 列出上下文文件 | | /web <URL> | 抓取网页内容 | | /git [cmd] | Git 命令(status/diff/log/branch)| | /compress | 压缩对话上下文 | | /tokens | 显示 Token 统计 | | /clear | 清空对话 | | /exit | 退出 |

非交互模式

# 单次查询
ai-chat -p "解释这段代码"

# 管道输入
cat error.log | ai-chat -p "分析这个错误"

# JSON 输出
ai-chat -p "1+1" --json

# 继续上次对话
ai-chat -c -p "继续"

经典模式

# 使用 readline 风格的经典界面
ai-chat --classic

自定义命令

.ai-chat/commands/ 创建 .md 文件定义自定义命令:

---
name: review
description: 代码审查
---

请审查以下代码,关注:
1. 代码质量
2. 潜在 bug
3. 性能问题

$ARGS

支持位置:

  • ~/.ai-chat/commands/ - 全局命令
  • .ai-chat/commands/ - 项目命令(优先)

命令菜单中自定义命令显示 ✦ 标记。

文件排除规则

创建 .aiignore 文件定义文件选择器排除规则:

# .aiignore
*.log
tmp/
secret/

支持位置:

  • .aiignore - 项目根目录
  • .ai-chat/ignore - 项目配置目录
  • ~/.ai-chat/ignore - 全局配置

项目指令

类似 Claude Code 的 CLAUDE.md,支持项目级指令:

项目/
├── AI-CHAT.md              # 项目指令(优先)
├── .ai-chat/
│   └── instructions.md     # 备选位置

全局指令:~/.ai-chat/instructions.md

会话管理

ai-chat chat list           # 列出会话
ai-chat chat save <tag>     # 保存会话
ai-chat chat resume <tag>   # 恢复会话
ai-chat chat show <id>      # 显示详情
ai-chat chat delete <id>    # 删除会话

TUI 中使用 -c 继续上次对话:

ai-chat -c

与业界对比

| 特性 | Claude Code | Aider | Gemini CLI | ai-chat | |------|:-----------:|:-----:|:----------:|:-----------:| | TUI 界面 | ✅ | ✅ | ✅ | ✅ | | @ 文件引用 | ✅ | ✅ | ✅ | ✅ | | / 命令菜单 | ✅ | ✅ | ✅ | ✅ | | ! Shell | ✅ | ✅ | ✅ | ✅ | | 多行输入 | ✅ | ✅ | ✅ | ✅ | | /add /drop | ✅ | ✅ | ✅ | ✅ | | /web URL | ✅ | ✅ | ✅ | ✅ | | Git 集成 | ✅ | ✅ | ✅ | ✅ | | Token 统计 | ✅ | ✅ | ✅ | ✅ | | 上下文压缩 | ✅ | ✅ | ✅ | ✅ | | 自定义命令 | ✅ | ✅ | ✅ | ✅ | | .ignore | ✅ | ✅ | ✅ | ✅ | | 会话管理 | ✅ | ✅ | ✅ | ✅ |

CLI 参数

Usage: ai-chat [options] [message]

Options:
  -V, --version        版本号
  -p, --print          非交互式打印模式
  -c, --continue       继续上次对话
  -r, --resume <id>    恢复指定会话
  -m, --model <model>  指定模型
  --mode <mode>        对话模式 (ask/agent)
  --tui                使用 TUI 界面(默认)
  --classic            使用经典 readline 界面
  --search             启用 Web 搜索
  --think              启用深度思考
  --json               JSON 格式输出
  --no-instructions    禁用项目指令
  -h, --help           帮助信息

Commands:
  chat                 会话管理
  config               配置管理
  models               列出可用模型

License

MIT