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

@zsc-glitch/habit-tracker

v2.0.1

Published

习惯追踪器 - 记录习惯、追踪连续天数、养成好习惯

Readme

Habit Tracker 🔥

习惯追踪器 - 记录习惯、追踪连续天数、养成好习惯

安装

npm install @zsc-glitch/habit-tracker

功能

核心功能

  • 习惯记录 - 快速打卡,记录完成情况
  • 连续追踪 - 自动计算 streak,激励坚持
  • 目标设置 - 设置每周目标次数
  • 统计报告 - 习惯完成率、趋势分析
  • 打卡历史 - 日历视图,一目了然

新增功能 (v2.0)

  • ✏️ 编辑习惯 - 修改名称、类别、频率、目标、图标、颜色
  • 📦 归档功能 - 暂停追踪但保留数据,随时恢复
  • 🎨 自定义外观 - 支持自定义颜色和图标
  • 📅 历史日历 - 可视化查看月度打卡记录
  • 🔥 改进的 Streak 算法 - 更准确地计算连续天数

使用

添加习惯

habit_add(name: string, category?: string, frequency?: string, goal?: number, emoji?: string, color?: string)

示例:

  • habit_add({ name: "每天运动" })
  • habit_add({ name: "阅读", category: "learning", emoji: "📖", color: "#3498db" })
  • habit_add({ name: "冥想", frequency: "daily", goal: 7 })

打卡

habit_checkin(name: string, note?: string)

示例:

  • habit_checkin({ name: "运动" })
  • habit_checkin({ name: "阅读", note: "读了30页" })

查看状态

habit_status(name?: string, includeArchived?: boolean)

示例:

  • habit_status({}) - 查看所有活跃习惯
  • habit_status({ name: "运动" }) - 查看单个习惯
  • habit_status({ includeArchived: true }) - 包含已归档习惯

编辑习惯

habit_edit(name: string, newName?: string, category?: string, frequency?: string, goal?: number, emoji?: string, color?: string)

示例:

  • habit_edit({ name: "运动", newName: "健身" })
  • habit_edit({ name: "阅读", goal: 5, emoji: "📚" })

查看历史

habit_history(name: string, year?: number, month?: number)

示例:

  • habit_history({ name: "运动" }) - 本月历史
  • habit_history({ name: "运动", year: 2026, month: 2 }) - 指定月份

归档/恢复

habit_archive(name: string)
habit_unarchive(name: string)

示例:

  • habit_archive({ name: "运动" }) - 归档习惯
  • habit_unarchive({ name: "运动" }) - 恢复追踪

生成报告

habit_report(period: "week" | "month" | "year")

示例:

  • habit_report({ period: "week" }) - 本周报告
  • habit_report({ period: "month" }) - 本月报告

删除习惯

habit_delete(name: string, confirm?: boolean)

示例:

  • habit_delete({ name: "运动" }) - 预览删除
  • habit_delete({ name: "运动", confirm: true }) - 确认删除

工具列表

| 工具 | 描述 | |------|------| | habit_add | 添加新习惯 | | habit_checkin | 习惯打卡 | | habit_status | 查看状态 | | habit_edit | 编辑习惯 | | habit_history | 查看打卡历史日历 | | habit_archive | 归档习惯 | | habit_unarchive | 恢复习惯 | | habit_report | 生成报告 | | habit_delete | 删除习惯 |

类别

| 类别 | ID | 默认图标 | 默认颜色 | |------|-----|---------|---------| | 健康 | health | 💪 | #4CAF50 | | 学习 | learning | 📚 | #2196F3 | | 心理 | mindfulness | 🧘 | #9C27B0 | | 生活 | life | 🏠 | #FF9800 | | 自定义 | custom | ⭐ | #607D8B |

数据存储

习惯数据存储在 ~/.habit-tracker/ 目录:

~/.habit-tracker/
├── habits.json      # 习惯配置
├── checkins/        # 打卡记录
│   ├── 2026-03-30.json
│   └── ...
└── stats.json       # 统计数据

Streak 计算规则

每日习惯

  • 最近一次打卡必须是今天或昨天
  • 从最近一次打卡往前计算连续天数
  • 断开一天,streak 重置为 0

每周习惯

  • 最近一次打卡必须在最近 7 天内
  • 每次打卡间隔不超过 7 天即视为连续

更新日志

v2.0.0

  • ✨ 新增 habit_edit 编辑习惯功能
  • ✨ 新增 habit_history 查看打卡历史日历
  • ✨ 新增 habit_archive / habit_unarchive 归档功能
  • 🎨 支持自定义颜色和图标
  • 🔥 改进 streak 计算算法,处理边界情况
  • 📊 报告增加日均打卡数据
  • 🐛 修复 streak 计算错误
  • 🐛 修复归档习惯仍可打卡的问题

v1.0.0

  • 🎉 初始版本
  • 基础习惯追踪功能
  • streak 计算和报告生成

License

MIT


☕ 支持开发者

如果这些工具对你有帮助,欢迎请我喝杯咖啡 ☕

微信赞赏码


Made with 🔥 by 小影