Bundle
dsh-plugin-water-tracker
喝水打卡插件:记录每日饮水,含水杯动画、预设/自定义饮水按钮、鼓励语与 GitHub 风格热力图
- Source
- YuanTutu
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 13 days ago
Readme
# 💧 dsh-plugin-water-tracker(喝水打卡插件)
一个 DeepSeek Harness(dsh)客户端插件,用来记录每天喝水的情况。
- 打开后显示一只**满杯水**,每喝一次水点击对应按钮,**水面按「饮水量 ÷ 每日目标」的比例下降**;
- 预设 **100 / 300 / 500 ml** 三个按钮,支持**自定义饮水量**(输入数字后会在预设按钮旁出现该自定义量按钮);
- 达标(杯子喝空)时显示 **“喝饱了!”** 等正面鼓励语;
- 内置 **GitHub 风格热力图**,颜色越深表示当天喝水越多(配色、布局完全遵照 GitHub 贡献图)。
数据保存在浏览器 `localStorage`(key:`water-tracker-v1`),跨刷新持久。
## 目录结构
```
dsh-plugin-water-tracker/
├── package.json # dsh.client + dsh.bundle 声明、peer 依赖
├── cordis.patch.yml # 将插件插入 Loader 的 insert 配置
├── install.ps1 # 一键安装脚本
├── preview.html # 独立预览版(浏览器直接打开)
├── lib/
│ ├── index.js # Host 侧插件主体(纯 UI 插件,空 apply)
│ └── client.js # 客户端 bundle(window.__ModuleLoader__ 惰性 CJS 工厂格式)
└── README.md
```
## 安装到 dsh profile
> 🚀 一键安装:解压后进入 `dsh-plugin-water-tracker` 目录,运行
> `pwsh -File .\install.ps1`,脚本会自动完成下面「方式一」的复制与 patch 修改。
插件包需要放进 profile 的 `node_modules`,并把它插入 profile 的 Loader 配置树。
### 方式一(推荐):直接改 profile 的 patch
1. 把整个 `dsh-plugin-water-tracker` 文件夹复制到 profile 的 node_modules:
```powershell
# 本机示例(以桌面 profile 为例,实际路径见 $env:DSH_HOME)
Copy-Item -Recurse dsh-plugin-water-tracker "$env:USERPROFILE\.dsh\profiles\node_modules\dsh-plugin-water-tracker"
```
2. 编辑 profile 的 `cordis.patch.yml`(例如 `~\.dsh\profiles\desktop\cordis.patch.yml`),加入:
```yaml
- insert:
- id: water-tracker
name: dsh-plugin-water-tracker
```
> 若你同时用 web profile,`~\.dsh\profiles\web\cordis.patch.yml` 做同样修改。
3. 重启 dsh(桌面版重新打开,或重启 `dsh web`)。
### 方式二:作为 bundle 加入
编辑 profile 的 `package.json`,把插件加入 `dsh.profile.bundles`:
```jsonc
{
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"@deepseek-ai/dsh-web-app",
"dsh-plugin-water-tracker" // ← 新增
]
}
}
}
```
同时仍需把插件复制到 `profiles\node_modules\dsh-plugin-water-tracker`。本插件自带的 `cordis.patch.yml`(`dsh.bundle.patch`)会负责把它 insert 进 Loader。
## 使用
安装并刷新页面后,右下角会出现一个 **💧 悬浮按钮**:
- 点击 💧 → 打开喝水打卡面板;
- 「今日打卡」页:设置每日目标、点击 100/300/500 ml 或自定义量按钮喝水、撤销/重置今日;
- 「饮水热力图」页:查看过去 52 周的 GitHub 风格喝水热力图,悬停单元格可看当天明细。
## 快速体验(无需安装)
仓库根目录的 `preview.html` 是一个完全独立、双击即可在浏览器打开的版本——功能与本插件一致(含水杯动画、GitHub 风格热力图,数据同样存 localStorage),可以先体验再决定是否安装。
## 明暗主题
插件自动跟随 DeepSeek Harness 的浅色/深色模式(`body[data-ds-dark-theme]`),热力图在深色模式下采用 GitHub 暗色绿配色(`#0e4429 → #39d353`)。
## 常见问题
- **看不到 💧 按钮**:确认插件确实被 Loader 加载(Settings → Plugins 里应能看到 `dsh-plugin-water-tracker`),并刷新页面。
- **悬浮按钮被遮挡 / 点不到**:本插件注册在 `shell.overlay` 浮动层,已显式 `pointer-events: auto`;如仍异常,检查是否有其它 overlay 项覆盖。
- **数据不跨设备**:数据存在浏览器 localStorage,仅本机、本浏览器可见。
Install
dsh plugin --profile web add github:YuanTutu/dsh-plugin-water-tracker
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-plugin-water-tracker from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.