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

@raphaellcs/auto-tasker

v1.0.0

Published

任务自动化工具 - 定时执行、条件触发、任务编排

Downloads

22

Readme

@claw-dev/auto-tasker

任务自动化工具 - 定时执行、条件触发、任务编排

🚀 功能

  • 定时执行:固定间隔或 cron 表达式
  • 文件监控:文件变化自动触发任务
  • 任务编排:串行或并行执行
  • 灵活配置:JSON 配置文件
  • 执行日志:清晰的执行状态和输出

📦 安装

npx @claw-dev/auto-tasker

📖 快速开始

1. 初始化配置

auto-task init

生成 auto-tasker.json 配置文件。

2. 编辑配置

{
  "version": "1.0",
  "mode": "series",
  "tasks": [
    {
      "name": "备份代码",
      "command": "git add . && git commit -m 'auto-backup' && git push",
      "interval": 3600000
    }
  ]
}

3. 运行任务

# 执行所有任务
auto-task run

# 执行指定任务
auto-task run --task "备份代码"

# 使用自定义配置文件
auto-task run --config /path/to/config.json

📋 配置说明

全局配置

| 字段 | 类型 | 说明 | |------|------|------| | version | string | 配置文件版本 | | mode | string | 执行模式:series(串行)或 parallel(并行) |

任务配置

| 字段 | 类型 | 必需 | 说明 | |------|------|------|------| | name | string | ✅ | 任务名称 | | command | string | ✅ | 要执行的命令 | | interval | number | ❌ | 定时间隔(毫秒) | | schedule | string | ❌ | cron 表达式(未实现) | | watch | string | ❌ | 监控的文件/目录 | | debounce | number | ❌ | 防抖延迟(毫秒),默认 1000 | | cwd | string | ❌ | 工作目录 | | env | object | ❌ | 环境变量 | | verbose | boolean | ❌ | 详细输出 | | stopOnError | boolean | ❌ | 失败时停止,默认 true |

🎯 使用场景

1. 自动备份

{
  "name": "备份项目",
  "command": "git add . && git commit -m 'auto-backup' && git push",
  "interval": 3600000
}

2. 文件变化触发测试

{
  "name": "运行测试",
  "command": "npm test",
  "watch": "src/",
  "debounce": 2000
}

3. 定时清理

{
  "name": "清理临时文件",
  "command": "rm -rf temp/",
  "schedule": "0 0 * * *"
}

4. 构建部署流水线

{
  "mode": "series",
  "tasks": [
    {
      "name": "安装依赖",
      "command": "npm install"
    },
    {
      "name": "运行测试",
      "command": "npm test"
    },
    {
      "name": "构建",
      "command": "npm run build"
    },
    {
      "name": "部署",
      "command": "npm run deploy"
    }
  ]
}

🔍 执行模式

串行执行 (series)

任务按顺序执行,前一个任务成功后才执行下一个。

auto-task run --config config-series.json

并行执行 (parallel)

所有任务同时执行。

{
  "mode": "parallel",
  "tasks": [...]
}

📊 输出示例

成功

执行任务: 备份代码
  命令: git add . && git commit -m 'auto-backup' && git push
  ✓ 成功 (2450ms)

==================================================
✓ 所有任务成功

失败

执行任务: 运行测试
  命令: npm test
  ✗ 失败 (120ms)
  stderr: FAIL test/example.test.js

==================================================
✗ 1/2 个任务失败

💡 提示

  • 使用 interval 进行简单的定时任务
  • 使用 watch 监控文件变化(如代码修改后自动测试)
  • debounce 可以防止频繁触发(如保存时)
  • 定期备份你的配置文件
  • 敏感信息使用环境变量(env 字段)

🚧 待实现

  • [ ] 完整的 cron 表达式支持
  • [ ] 任务依赖
  • [ ] 通知功能(邮件、Webhook)
  • [ ] 执行历史记录
  • [ ] Web UI

🤝 贡献

欢迎提交 Issue 和 PR!

📄 许可证

MIT © 梦心


Made with 🌙 by 梦心