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

done-coding-extract

v0.1.20

Published

信息提取命令行工具

Readme

@done-coding/cli-extract

信息提取命令行工具 - 从项目中提取和生成各种信息文件

npm version License: MIT

安装

独立安装

npm install @done-coding/cli-extract
# 或
pnpm add @done-coding/cli-extract

作为 done-coding CLI 的一部分

npm install -g @done-coding/cli
# 然后使用
DC extract [command]

快速开始

# 独立使用
dc-extract [command]

# 作为主 CLI 的子命令
DC extract [command]

# 查看帮助
dc-extract --help

功能特性

  • 信息提取: 从项目源码中提取各种信息
  • 📄 文件生成: 基于提取的信息生成文档或配置文件
  • 🔧 模板支持: 支持自定义模板进行信息格式化
  • ⚙️ 配置灵活: 支持多种配置方式和生成模式
  • 🚀 批量处理: 支持批量提取和生成操作

API 文档

基础命令

dc-extract init

初始化配置文件

# 创建默认配置文件
dc-extract init

功能说明:

  • 在项目根目录创建 .done-coding/extract.json5 配置文件
  • 提供默认的提取规则和模板配置
  • 支持自定义提取目标和输出格式

dc-extract (默认命令)

生成文件

# 使用默认配置生成文件
dc-extract

# 指定配置文件路径
dc-extract -C ./custom-config.json5

# 指定生成模式
dc-extract -m template

# 指定运行目录
dc-extract -R ./src

选项说明:

  • -R, --rootDir: 运行目录,默认为当前目录
  • -C, --configPath: 配置文件相对路径,默认为 ./.done-coding/extract.json5
  • -m, --mode: 生成模式,可选值:result(默认)、template

生成模式

result 模式

直接生成最终结果文件

# 生成结果文件
dc-extract -m result

template 模式

生成模板文件供进一步处理

# 生成模板文件
dc-extract -m template

使用示例

基础使用场景

# 1. 初始化配置
dc-extract init

# 2. 编辑配置文件(可选)
# 编辑 .done-coding/extract.json5

# 3. 执行信息提取和文件生成
dc-extract

# 4. 检查生成的文件
ls -la output/

自定义配置使用

# 使用自定义配置文件
dc-extract -C ./configs/my-extract.json5

# 指定不同的运行目录
dc-extract -R ./packages/core

# 生成模板文件而非最终结果
dc-extract -m template

作为主 CLI 的一部分

# Windows 系统
dc extract init
dc extract -m result
dc extract -C ./config.json5

# macOS/Linux 系统
DC extract init
DC extract -m result
DC extract -C ./config.json5

配置

配置文件

通过 dc-extract init 命令可以初始化配置文件 .done-coding/extract.json5

具体的配置选项需要查看初始化后生成的配置文件内容。

编程接口

本包提供了编程接口,具体的导出内容请查看包的类型定义文件。

故障排除

常见问题

Q: 配置文件找不到

# 检查配置文件是否存在
ls -la .done-coding/extract.json5

# 重新初始化配置
dc-extract init

Q: 生成失败

# 检查运行目录
dc-extract -R ./src

# 检查配置文件路径
dc-extract -C ./custom-config.json5

调试模式

# 查看版本信息
dc-extract --version

# 查看帮助信息
dc-extract --help

性能建议

  • 使用合适的文件匹配规则避免处理不必要的文件
  • 启用缓存可以提高重复提取的速度
  • 大项目建议使用并行处理模式

贡献指南

我们欢迎贡献!请遵循以下步骤:

  1. Fork 本仓库
  2. 创建功能分支:git checkout -b feature/amazing-feature
  3. 提交更改:git commit -m "feat: add amazing feature"
  4. 推送分支:git push origin feature/amazing-feature
  5. 创建 Pull Request

开发环境设置

# 克隆仓库
git clone https://gitee.com/done-coding/done-coding-cli.git
cd done-coding-cli/packages/extract

# 安装依赖
pnpm install

# 开发模式
pnpm dev

# 构建
pnpm build

# 本地开发测试
node es/cli.mjs --help

# 注意:本地使用 node + 入口文件,发布后使用 bin 命令名
# 功能完全一致,只是调用方式不同

许可证

MIT © JustSoSu

相关链接