dsh-life-workbench 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 chendb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # dsh-life-workbench
2
+
3
+ DSH Web GUI 的**个人工作台**插件 —— 把「工作 / 生活 / 每日事项」收进一个玻璃拟态面板,一页完成全部日常交互。
4
+
5
+ - **总览**:统计 + 执行 + 记录,所有操作就地完成,不用跳页
6
+ - **看板**:多列看板,可自定义增删看板与事项,事项可挂附件
7
+ - **资料**:上传文件与图片的总库,标注归属,可预览放大
8
+ - **每日事项**:跨天自动归档当天明细(保留 90 天)再重置,可回顾
9
+
10
+ ## 安装
11
+
12
+ ```bash
13
+ dsh plugin --profile web add dsh-life-workbench
14
+ ```
15
+
16
+ 装完 **重启 dsh host** 并刷新浏览器,侧边栏出现「工作台」图标。
17
+
18
+ ## 功能细节
19
+
20
+ ### 总览
21
+
22
+ | 区段 | 内容 |
23
+ |---|---|
24
+ | 开头 | 问候 + 5 个 KPI 读数(今日完成 / 今日待办 / 累计完成 / 近七天 / 资料) |
25
+ | 统计 | 完成趋势(**点击任意柱子**回顾当天逐条明细)、看板进度 |
26
+ | 今日 | 今日执行、最近完成 |
27
+ | 记录 | 随手记、资料缩略图与上传 |
28
+
29
+ **今日执行是一个统一列表**:填了时间就是日程,不填就落进所选看板 —— 不用先想"我该用哪个入口"。日程按天归属,跨天自然不再出现。
30
+
31
+ ### 看板
32
+
33
+ - 事项:双击改名、勾选完成、删除
34
+ - 事项附件:点回形针 → 上传即归属该事项
35
+ - 删除事项时,它的附件**退回总库**而不是跟着消失
36
+
37
+ ### 每日事项
38
+
39
+ 跨天时先把当天**逐条明细**(标题 + 完成状态)归档进 history,再重置勾选。所以能回答"上周三做了什么",而不是只剩一个计数。
40
+
41
+ ## 数据
42
+
43
+ 存放在 `$DSH_HOME/life-workbench/`(`DSH_HOME` 未设时即 `~/.dsh/life-workbench/`):
44
+
45
+ ```
46
+ state.json 工作台状态(看板 / 事项 / 便签 / 日程 / 归档)
47
+ blob-<id>.b64 上传的文件与图片
48
+ ```
49
+
50
+ - 单次上传上限 **8 MB**
51
+ - 写入采用「临时文件 + rename」的原子替换,避免半截文件覆盖好数据
52
+ - 从资料库移除条目**不会删除磁盘文件**(没有删除 API 语义时保留原件)
53
+
54
+ ## 开发
55
+
56
+ **零构建** —— 纯 ESM JavaScript,改完 `lib/*.js` 重启 dsh host 即生效(不需要 TypeScript 或打包器)。
57
+
58
+ ```
59
+ package.json 包清单(dsh.bundle.patch + dsh.client 声明)
60
+ cordis.patch.yml 插件行插入声明
61
+ lib/index.js Host 半边:数据权威 + HTTP 端点
62
+ lib/client.js 浏览器半边:__ModuleLoader__ 协议 + React UI
63
+ ```
64
+
65
+ ### 半边职责
66
+
67
+ - **Host**:结构归一、每日事项跨天归档、原子落盘、暴露 4 个端点。只依赖 `webServer` 服务。
68
+ - **Client**:通过 `window.__ModuleLoader__.load({ id, factory })` 装载,用 `require('react')` 取 React,注册到 `sidebar.panellist` + `main` 两个 slot。
69
+
70
+ ### Host ↔ Client 通信
71
+
72
+ 正式插件没有动态插件的 `host.call`,因此走同源 HTTP:
73
+
74
+ | 端点 | 作用 |
75
+ |---|---|
76
+ | `POST /life-workbench/load` | 读取状态(含每日归档与跨天重置) |
77
+ | `POST /life-workbench/save` | 写入状态(history 以磁盘为准合并) |
78
+ | `POST /life-workbench/upload` | 落盘一个 base64 文件 |
79
+ | `POST /life-workbench/readFile` | 读回某个文件的 base64 |
80
+
81
+ ### 两个已知的实现约束
82
+
83
+ 1. **Client 的 factory 必须 `return module.exports`** —— 漏掉会让浏览器启动页报 `invalid plugin ... received undefined`。
84
+ 2. **`link:` 安装时包自带的 bundle patch 可能不被 dsh 收集**(roster 里没有该 bundle 的 section)。此时改用 profile 用户层:
85
+
86
+ ```yaml
87
+ # ~/.dsh/profiles/web/cordis.patch.yml
88
+ - insert:
89
+ - id: ui-life-workbench
90
+ name: 'dsh-life-workbench'
91
+ ```
92
+
93
+ 用 `dsh --profile web --dump-config | grep -A2 life-workbench` 验证是否进入 roster。npm 正常安装时通常不需要这一步。
94
+
95
+ ## 许可
96
+
97
+ MIT
@@ -0,0 +1,10 @@
1
+ # 个人工作台 bundle patch:把插件行插入 web profile 的 roster。
2
+ # 以 profile bundle 层的形式应用(package.json 的 dsh.bundle.patch 字段),
3
+ # 用 `dsh plugin --profile web add link:/Users/chendaben/Documents/niubi-chen-code/life-poilt` 激活。
4
+ #
5
+ # 这是一个裸按包名的 plugin row:node 半边(exports ".")跑在 host 进程里
6
+ # (数据所有权 + HTTP 端点),package.json 的 dsh.client 声明让浏览器半边
7
+ # (exports "./client",经 __ModuleLoader__ 协议加载)在 web GUI 里生效。
8
+ - insert:
9
+ - id: ui-life-workbench
10
+ name: 'dsh-life-workbench'