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

koishi-plugin-habit-tracker

v1.0.2

Published

一个功能完整的 Koishi 插件,用于帮助用户创建和管理个人习惯,并打卡记录习惯完成情况。

Downloads

52

Readme

Koishi 习惯追踪插件

一个功能强大的习惯追踪和管理插件,帮助用户建立和维持良好的生活习惯。

功能特性

🎯 习惯管理

  • 创建习惯: 支持自定义习惯名称、描述、分类和频率
  • 习惯分类: 预设健康、学习、工作、生活、娱乐等分类
  • 频率设置: 支持每日、每周、每月三种频率模式
  • 目标设定: 可为每个习惯设置具体的目标完成次数

📊 数据追踪

  • 打卡记录: 记录每次习惯完成情况,支持心情标记和备注
  • 连续天数: 自动计算连续完成天数和最长连续记录
  • 统计分析: 提供习惯完成情况的详细统计信息

🎨 个性化

  • 颜色标记: 每个习惯都有独特的颜色标识
  • 心情记录: 支持记录完成时的心情状态(很棒/不错/一般/不太好)
  • 备注功能: 可为每次打卡添加个性化备注

⏰ 智能提醒

  • 定时提醒: 支持设置习惯提醒时间
  • 默认提醒: 可配置全局默认提醒时间

安装

# 在 Koishi 项目中安装
npm install koishi-plugin-habit-tracker

配置

在 Koishi 配置文件中添加插件:

module.exports = {
  plugins: {
    'habit-tracker': {
      defaultReminderTime: '21:00',  // 默认提醒时间
      maxHabits: 10,                  // 最大习惯数量
      enableReminders: true           // 启用提醒功能
    }
  }
}

使用方法

创建习惯

# 基础创建
习惯创建 每日阅读

# 完整参数创建
习惯创建 晨跑 -c 健康 -f daily -t 1 -d 每天早上6点起床跑步

参数说明:

  • -c <category>: 分类名称(默认:生活)
  • -f <frequency>: 频率(daily/weekly/monthly,默认:daily)
  • -t <target>: 目标次数(默认:1)
  • -d <description>: 习惯描述

习惯打卡

# 打卡所有习惯
习惯打卡

# 打卡特定习惯
习惯打卡 每日阅读

# 带心情打卡
习惯打卡 每日阅读 -m great

心情选项:

  • great: 😊 很棒
  • good: 🙂 不错
  • ok: 😐 一般
  • bad: 😞 不太好

查看习惯列表

习惯列表

查看统计数据

习惯统计

管理习惯

# 查看习惯详情
习惯详情 每日阅读

# 暂停习惯
习惯暂停 每日阅读

# 恢复习惯
习惯恢复 每日阅读

# 删除习惯
习惯删除 每日阅读

数据结构

用户习惯 (UserHabit)

interface UserHabit {
  id: number;
  userId: string;
  platform: string;
  habitName: string;
  description: string;
  category: string;
  frequency: 'daily' | 'weekly' | 'monthly';
  targetCount: number;
  color: string;
  isActive: boolean;
  reminderTime?: string;
  createdAt: Date;
  streak: number;
  longestStreak: number;
}

习惯记录 (HabitRecord)

interface HabitRecord {
  id: number;
  habitId: number;
  userId: string;
  platform: string;
  completedAt: Date;
  notes: string;
  mood: 'great' | 'good' | 'ok' | 'bad';
}

习惯分类 (HabitCategory)

interface HabitCategory {
  id: number;
  userId: string;
  platform: string;
  categoryName: string;
  color: string;
  createdAt: Date;
}

默认分类

插件预设了以下分类:

  • 🏥 健康 (#FF6B6B)
  • 📚 学习 (#4ECDC4)
  • 💼 工作 (#45B7D1)
  • 🏠 生活 (#96CEB4)
  • 🎮 娱乐 (#FFEAA7)

使用示例

场景1:创建学习习惯

习惯创建 学习英语 -c 学习 -f daily -t 1 -d 每天学习30分钟英语

场景2:运动打卡

习惯打卡 晨跑 -m great

场景3:查看进度

习惯统计

注意事项

  1. 习惯数量限制: 默认最多创建10个活跃习惯
  2. 重复打卡: 同一习惯每天只能打卡一次
  3. 数据持久化: 所有数据保存在数据库中,重启后不会丢失
  4. 提醒功能: 需要启用提醒功能配置才能正常工作

开发信息

  • 插件名称: habit-tracker
  • 依赖: koishi, database
  • 数据库表: user_habits, habit_records, habit_categories
  • TypeScript: 完整类型支持

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request 来改进这个插件!


让好习惯成为生活的一部分 🌟