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

autoanki

v1.0.2

Published

CLI tool for newAutoAnki - generate Anki cards from local files

Readme

AutoAnki CLI

通过命令行,将本地文件一键生成 Anki 卡包。支持任意长度文本,自动分块处理。

安装

npm install -g autoanki

系统要求: Node.js 14+


快速开始

第一步:登录

autoanki login

输入你在 autoanki.xyz 注册的邮箱和密码。

第二步:生成卡片

autoanki generate --input 笔记.txt --cards 20 --output 我的卡片

生成完成后,当前目录下会出现 我的卡片.apkg 文件。

第三步:导入 Anki

打开 Anki → 文件 → 导入 → 选择 .apkg 文件。


命令说明

autoanki login

登录账号,凭证保存在本地,后续无需重复登录。

autoanki login

autoanki generate

从文件生成 Anki 卡包。

autoanki generate --input <文件> --cards <数量> --output <文件名> [选项]

必填参数:

| 参数 | 说明 | |------|------| | -i, --input <文件> | 输入文件路径(支持 .txt / .md) | | -c, --cards <数量> | 期望生成的卡片总数 | | -o, --output <文件名> | 输出文件名,不含扩展名(自动生成 .apkg) |

可选参数:

| 参数 | 说明 | |------|------| | -d, --dir <文件夹> | 输出文件夹,默认为当前目录 | | -l, --language <zh/en> | 指定语言,默认自动检测 | | -y, --yes | 跳过确认提示,直接生成 |

示例:

# 基础用法
autoanki generate --input 量子力学.txt --cards 30 --output 量子力学

# 指定输出文件夹
autoanki generate --input 笔记.md --cards 50 --output 英语单词 --dir ~/anki-cards

# 跳过确认(适合脚本自动化)
autoanki generate --input 文章.txt --cards 20 --output 卡片 --yes

autoanki whoami

查看当前登录状态和剩余积分。

autoanki whoami

autoanki logout

清除本地登录凭证。

autoanki logout

长文本支持

CLI 自动处理超过网页端字数限制的文本,无需手动分割。

  • 中文文本:每块最多 3500 字
  • 英文文本:每块最多 5500 字符

示例: 一篇 10000 字的文章会自动拆为 3 块,分别调用 API 生成卡片,最终合并为一个 .apkg 文件。

生成前会显示预览信息,确认后再消耗积分:

=== 生成预览 ===
文件:量子力学.txt
文本长度:10000 字符
分块数:3 块
请求卡片:60 张
预计生成:60 张
预计消耗:900 积分

确认开始生成? (Y/n)

积分说明

CLI 与网页端共用同一套积分系统,每张卡片消耗 15 积分。

积分不足时可前往 autoanki.xyz 充值。


常见问题

Q:登录提示 Token 过期怎么办?

重新运行 autoanki login 即可。

Q:生成到一半积分不足怎么办?

CLI 会自动导出已生成的卡片,不会全部丢失。充值后重新运行即可生成剩余部分。

Q:支持哪些文件格式?

目前支持 .txt.md 文件,建议使用 UTF-8 编码。

Q:生成的卡片质量不好怎么办?

可以在 Anki 中手动编辑卡片,或减少每次生成的卡片数量(更少的卡片通常质量更高)。