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

xshat-lite

v1.2.3

Published

CLI chat and agent tool powered by free AI web providers

Readme

XShat

一个基于浏览器自动化的命令行 AI 聊天工具。

它的核心抽象只有四步:

  1. 输入
  2. 发送
  3. 读取
  4. 完成

也就是说,想适配新网站时,重点不是改主流程,而是给这个网站补一份四步配置。

当前内置站点

  • Duck.ai
  • HuggingChat
  • DeepAI Chat
  • Qwen
  • You.com
  • Microsoft Copilot
  • ChatGPT
  • Gemini

其中前四个更偏向免登录或可直接访问;后两个是否能直接使用,取决于地区、配额和站点当时策略。

安装

npm install

全局安装:

npm install -g xshat-lite

首次全局启动时,程序会自动进入一次轻量向导,帮助你:

  • 选择更适合首用的默认 provider
  • 打开可见浏览器支持
  • 预热浏览器环境并准备首次聊天

本地调试全局命令:

npm link

如果你是在当前项目目录里本地试装,也可以:

npm install -g .

运行

xshat

开发模式:

npm run dev

调试模式:

XSHAT_DEBUG=true npm start

如果你还没有全局安装,也可以继续用:

npm start

配置

创建 .env

DEFAULT_PROVIDER=gemini
BROWSER_HEADLESS=true
USER_DATA_DIR=./runtime/profiles/my-profile
SESSION_DIR=./runtime/sessions
LOG_DIR=./runtime/logs

全局命令模式下,运行时数据默认写入:

  • Windows: %LOCALAPPDATA%\\xshat
  • macOS / Linux: ~/.xshat

其中会包含:

  • runtime/profiles
  • runtime/sessions
  • runtime/logs

也可以自己指定:

XSHAT_HOME=D:\\my-xshat xshat

如何扩展新网站

src/config/default.mjs 里新增一个 provider。

结构大致是:

{
  id: 'mychat',
  name: 'My Chat',
  url: 'https://example.com/chat',
  steps: {
    input: {
      selectors: ['textarea', '[contenteditable="true"]']
    },
    send: {
      selectors: ['button[type="submit"]', 'button[aria-label*="Send"]']
    },
    read: {
      selectors: ['.assistant-message', '.message.bot']
    },
    complete: {
      mode: 'script',
      script: '...',
      selectors: {
        response: ['.assistant-message', '.message.bot'],
        pending: ['.streaming', '.loading'],
        done: ['.copy-button', '.finished']
      }
    }
  }
}

四步说明

input

  • 找输入框
  • 点击并聚焦
  • 清空旧内容
  • 粘贴消息

send

  • 找发送按钮点击
  • 如果没配到按钮,退回 Enter

read

  • 定义“助手回复节点”的候选选择器

complete

  • 判断是否还在生成
  • 判断是否已经完成
  • 返回当前累计文本

调试命令

聊天时可输入:

  • /inspect:打印当前网站命中的输入框、发送按钮、读取节点和完成状态
  • /config:打开系统设置并调整默认提供方
  • /model:打开系统设置中的提供方配置
  • /menu:返回主菜单

逐 provider smoke:

SMOKE_PROVIDER=gemini node --env-file=.env scripts/provider-smoke.mjs

多轮 smoke:

SMOKE_PROVIDER=gemini SMOKE_PROMPTS="你好,请只回复1|继续,只回复2" node --env-file=.env scripts/provider-smoke.mjs

导出调试产物(HTML、截图、结果 JSON):

SMOKE_PROVIDER=gemini SMOKE_SAVE_ARTIFACTS=true node --env-file=.env scripts/provider-smoke.mjs

项目结构

src/
  config/
    default.mjs
  modules/
    browser.mjs
    chat.mjs
    logger.mjs
    session.mjs
    ui.mjs
  utils/
    config.mjs
  index.mjs

备注

  • 不同网站 DOM 变动很频繁,所以选择器最好准备多个候选。
  • 某些网站首页可打开,但真正发送消息时仍可能弹登录、限流或地区限制。
  • 当前这套架构已经支持继续扩站,后续新增网站通常只需要补配置,不需要改主循环。
  • 发布 npm 包时,运行时数据目录不会被一起打包。