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

english-text-checker

v1.0.1

Published

英文文本收集检测工具

Readme

English Text Checker

一个用于收集、过滤和导出英文文本的命令行工具,辅助英文语法检查和文本处理。

目录结构

├── src/
│   ├── collector.ts              # 收集和过滤有效英文文本
│   ├── exporter.ts               # 导出文本数据
│   ├── index.ts                  # 入口文件
│   ├── parser.ts                 # 文本解析
│   ├── config/
│   │   ├── config.ts             # 基础配置
│   │   └── prompt.ts             # AI 模型配置
│   ├── core/
│   │   └── ai-check-grammar.ts   # AI 语法检查核心逻辑
│   │   └── ast-js.ts             # AST 解析 JS
│   │   └── ast-json.ts           # AST 解析 JSON
│   │   └── ast-vue.ts            # AST 解析 Vue
│   └── utils/
│       └── logger.ts             # 日志工具
│       └── helper.ts             # 通用工具 辅助函数
├── .gitignore                    # Git 忽略文件
├── package.json                  # 项目依赖
├── test/                         # 测试用例
├── tsconfig.json                 # TypeScript 配置
├── README.md                     # 项目说明文档

安装依赖

全局安装(推荐)

npm install -g english-text-checker

本地安装

npm install english-text-checker

使用方式

命令行使用

# 检查目录
english-text-checker --dir <directory> --apiKey=<your api key>

# 指定输出文件
english-text-checker --dir <directory> -j <output JSON file> -c <output CSV file> -p <output Txt file>

配置选项

CLI 参数

english-text-checker [options]

参数选项

  • --dir: 指定要检查的目录路径
  • -j: 指定 JSON 输出文件名
  • -c: 指定CSV 输出文件名
  • -p: 纯文本输出文件名
  • --help: 显示帮助信息
  • --apiKey: 模型 API 密钥
  • --model: 模型名称
  • --apiUrl: 模型 API 地址
  • --batch: 批量AI语法检查的文本数

环境要求

  • Node.js >= 20

开发模式

npm run dev

使用 ts-node 直接运行源码,便于调试。

构建项目

npm run build

将 TypeScript 源码编译到 dist 目录。

以 CLI 方式运行

npm run build && npx english-text-checker --dir <directory> --apiKey=<your api key>

功能特性

  • 文本收集与过滤: 通过 collector.ts 提供的 collectTexts 方法,对解析结果进行英文文本过滤和收集
  • 多格式导出: 支持将收集到的文本导出为 JSON 或 TXT 文件
  • AST 解析: 利用 AST 技术精确提取代码中的英文文本
  • 批量处理: 支持处理整个目录

输出格式

JSON 输出

包含完整的收集结果,包括总文件数、有效文本数等统计信息。

纯文本输出

仅包含提取的有效英文文本,每行一条记录。

CSV 输出

包含语法检查结果,包括原文本、语法错误、修正建议等信息。

注意事项

  1. 目前只支持js/ts/jsx/tsx/json/vue 文件,暂不支持react

依赖管理

  • 项目基于 TypeScript、Node.js 和 Commander.js 开发
  • 需要有效的 ModelScope API Key 以使用语法检查功能
  • API 配置
    • 需要在 ModelScope 上注册账号并获取 API Token
    • 确保网络能够访问配置的 API 地址
    • 语法检查功能会产生 API 调用费用,请注意用量控制
  • 性能考虑
    • 大型项目的扫描可能耗时较长
    • AI 语法检查会增加处理时间,但提供更准确的结果
    • 建议合理设置扫描目录范围以提高效率

主要依赖

  • TypeScript
  • Node.js
  • OpenAI.js

贡献

欢迎提交 issue 或 PR 以改进本项目。

License

MIT