@our2ndbrain/cli 1.1.3 → 2026.4.4
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/00_Dashboard/01_All_Tasks.md +17 -15
- package/99_System/Templates/tpl_daily_note.md +24 -7
- package/99_System/Templates/tpl_member_tasks.md +11 -5
- package/99_System/Templates/tpl_member_todo.md +5 -0
- package/CHANGELOG.md +17 -2
- package/README.md +236 -27
- package/bin/2ndbrain.js +30 -1
- package/package.json +11 -6
- package/src/commands/check.js +199 -0
- package/src/commands/completion.js +35 -1
- package/src/commands/init.js +3 -3
- package/src/commands/member.js +3 -1
- package/src/commands/update.js +25 -4
- package/src/commands/watch.js +212 -0
- package/src/index.js +4 -0
- package/src/lib/config.js +1 -0
- package/src/lib/files.js +48 -14
- package/AGENTS.md +0 -193
- package/CLAUDE.md +0 -153
|
@@ -11,10 +11,10 @@ tag does not include #waiting
|
|
|
11
11
|
tag does not include #next
|
|
12
12
|
heading does not include Readings
|
|
13
13
|
description regex matches /\S/
|
|
14
|
+
path includes To-Do
|
|
14
15
|
path does not include Templates
|
|
15
|
-
|
|
16
|
-
group by
|
|
17
|
-
group by function task.file.folder.match(/10_Inbox\/([^\/]+)/)?.[1] ? (" " + task.file.folder.match(/10_Inbox\/([^\/]+)/)[1]) : "📝 NOTES"
|
|
16
|
+
group by filename
|
|
17
|
+
group by heading
|
|
18
18
|
sort by due date
|
|
19
19
|
limit 100
|
|
20
20
|
```
|
|
@@ -31,10 +31,10 @@ tag does not include #waiting
|
|
|
31
31
|
tag does not include #someday
|
|
32
32
|
heading does not include Readings
|
|
33
33
|
description regex matches /\S/
|
|
34
|
+
path includes To-Do
|
|
34
35
|
path does not include Templates
|
|
35
|
-
|
|
36
|
-
group by
|
|
37
|
-
group by function task.file.folder.match(/10_Inbox\/([^\/]+)/)?.[1] ? (" " + task.file.folder.match(/10_Inbox\/([^\/]+)/)[1]) : "📝 NOTES"
|
|
36
|
+
group by filename
|
|
37
|
+
group by heading
|
|
38
38
|
sort by path
|
|
39
39
|
limit 100
|
|
40
40
|
```
|
|
@@ -48,10 +48,10 @@ not done
|
|
|
48
48
|
tag includes #waiting
|
|
49
49
|
heading does not include Readings
|
|
50
50
|
description regex matches /\S/
|
|
51
|
+
path includes To-Do
|
|
51
52
|
path does not include Templates
|
|
52
|
-
|
|
53
|
-
group by
|
|
54
|
-
group by function task.file.folder.match(/10_Inbox\/([^\/]+)/)?.[1] ? (" " + task.file.folder.match(/10_Inbox\/([^\/]+)/)[1]) : "📝 NOTES"
|
|
53
|
+
group by filename
|
|
54
|
+
group by heading
|
|
55
55
|
sort by path
|
|
56
56
|
limit 100
|
|
57
57
|
```
|
|
@@ -65,10 +65,10 @@ not done
|
|
|
65
65
|
tag includes #next
|
|
66
66
|
heading does not include Readings
|
|
67
67
|
description regex matches /\S/
|
|
68
|
+
path includes To-Do
|
|
68
69
|
path does not include Templates
|
|
69
|
-
|
|
70
|
-
group by
|
|
71
|
-
group by function task.file.folder.match(/10_Inbox\/([^\/]+)/)?.[1] ? (" " + task.file.folder.match(/10_Inbox\/([^\/]+)/)[1]) : "📝 NOTES"
|
|
70
|
+
group by filename
|
|
71
|
+
group by heading
|
|
72
72
|
sort by priority
|
|
73
73
|
sort by due date
|
|
74
74
|
limit 100
|
|
@@ -85,10 +85,10 @@ tag does not include #waiting
|
|
|
85
85
|
tag does not include #next
|
|
86
86
|
heading does not include Readings
|
|
87
87
|
description regex matches /\S/
|
|
88
|
+
path includes To-Do
|
|
88
89
|
path does not include Templates
|
|
89
|
-
|
|
90
|
-
group by
|
|
91
|
-
group by function task.file.folder.match(/10_Inbox\/([^\/]+)/)?.[1] ? (" " + task.file.folder.match(/10_Inbox\/([^\/]+)/)[1]) : "📝 NOTES"
|
|
90
|
+
group by filename
|
|
91
|
+
group by heading
|
|
92
92
|
sort by due date
|
|
93
93
|
limit 100
|
|
94
94
|
```
|
|
@@ -101,6 +101,8 @@ limit 100
|
|
|
101
101
|
not done
|
|
102
102
|
(heading includes Readings) OR (heading includes Reading) OR (tag includes #read) OR (tag includes #watch) OR (tag includes #listen)
|
|
103
103
|
description regex matches /\S/
|
|
104
|
+
path includes To-Do
|
|
105
|
+
path does not include Templates
|
|
104
106
|
sort by path desc
|
|
105
107
|
limit 100
|
|
106
108
|
```
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
# {{date:YYYY
|
|
1
|
+
# {{date:YYYY-MM-DD dddd}}
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Created: {{date:YYYY-MM-DD HH:mm}}
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
## To-Do
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Overdue
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```tasks
|
|
10
|
+
not done
|
|
11
|
+
has due date
|
|
12
|
+
due before {{date:YYYY-MM-DD}}
|
|
13
|
+
path includes {{query.file.folder}}
|
|
14
|
+
description regex matches /\S/
|
|
15
|
+
group by heading
|
|
16
|
+
sort by due date
|
|
17
|
+
```
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
### Due Today
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
```tasks
|
|
22
|
+
not done
|
|
23
|
+
due on {{date:YYYY-MM-DD}}
|
|
24
|
+
path includes {{query.file.folder}}
|
|
25
|
+
description regex matches /\S/
|
|
26
|
+
group by heading
|
|
27
|
+
sort by due date
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Thoughts
|
|
@@ -12,7 +12,8 @@ tag does not include #next
|
|
|
12
12
|
heading does not include Readings
|
|
13
13
|
description regex matches /\S/
|
|
14
14
|
path includes {{query.file.folder}}
|
|
15
|
-
|
|
15
|
+
filename includes To-Do
|
|
16
|
+
group by heading
|
|
16
17
|
sort by due date
|
|
17
18
|
limit 100
|
|
18
19
|
```
|
|
@@ -30,7 +31,8 @@ tag does not include #someday
|
|
|
30
31
|
heading does not include Readings
|
|
31
32
|
description regex matches /\S/
|
|
32
33
|
path includes {{query.file.folder}}
|
|
33
|
-
|
|
34
|
+
filename includes To-Do
|
|
35
|
+
group by heading
|
|
34
36
|
sort by path
|
|
35
37
|
limit 100
|
|
36
38
|
```
|
|
@@ -45,7 +47,8 @@ tag includes #waiting
|
|
|
45
47
|
heading does not include Readings
|
|
46
48
|
description regex matches /\S/
|
|
47
49
|
path includes {{query.file.folder}}
|
|
48
|
-
|
|
50
|
+
filename includes To-Do
|
|
51
|
+
group by heading
|
|
49
52
|
sort by path
|
|
50
53
|
limit 100
|
|
51
54
|
```
|
|
@@ -60,7 +63,8 @@ tag includes #next
|
|
|
60
63
|
heading does not include Readings
|
|
61
64
|
description regex matches /\S/
|
|
62
65
|
path includes {{query.file.folder}}
|
|
63
|
-
|
|
66
|
+
filename includes To-Do
|
|
67
|
+
group by heading
|
|
64
68
|
sort by priority
|
|
65
69
|
sort by due date
|
|
66
70
|
limit 100
|
|
@@ -78,7 +82,8 @@ tag does not include #next
|
|
|
78
82
|
heading does not include Readings
|
|
79
83
|
description regex matches /\S/
|
|
80
84
|
path includes {{query.file.folder}}
|
|
81
|
-
|
|
85
|
+
filename includes To-Do
|
|
86
|
+
group by heading
|
|
82
87
|
sort by due date
|
|
83
88
|
limit 100
|
|
84
89
|
```
|
|
@@ -92,6 +97,7 @@ not done
|
|
|
92
97
|
(heading includes Readings) OR (heading includes Reading) OR (tag includes #read) OR (tag includes #watch) OR (tag includes #listen)
|
|
93
98
|
description regex matches /\S/
|
|
94
99
|
path includes {{query.file.folder}}
|
|
100
|
+
filename includes To-Do
|
|
95
101
|
sort by path desc
|
|
96
102
|
limit 100
|
|
97
103
|
```
|
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
-
and this project
|
|
6
|
+
and this project uses date-based release versions: `YYYY.M.D`, `YYYY.M.D-beta.N`,
|
|
7
|
+
and `YYYY.M.D-N`.
|
|
8
|
+
|
|
9
|
+
## [2026.4.4] - 2026-04-04
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- add dependency doctor and install guidance to setup script
|
|
13
|
+
- split daily tasks into overdue and due-today views
|
|
14
|
+
- add 2ndbrain Agent Skill + CLI extensions (check, watch)
|
|
15
|
+
- refactor to "notes stay notes, tasks stay tasks, diary is the dashboard"
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- add todo refactor design spec
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- pin daily note task query to note date
|
|
22
|
+
- correct file diff summary and add regression tests
|
|
7
23
|
|
|
8
24
|
## [1.1.3] - 2026-01-18
|
|
9
25
|
|
|
@@ -64,4 +80,3 @@ A personal knowledge management system CLI tool combining PARA, C-O-R-D, and App
|
|
|
64
80
|
### Removed
|
|
65
81
|
- Bundled dataview plugin (now community plugin)
|
|
66
82
|
- README_zh.md (consolidated into README.md)
|
|
67
|
-
|
package/README.md
CHANGED
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
- [核心入口](#-核心入口)
|
|
31
31
|
- [Obsidian 插件配置](#-obsidian-插件配置)
|
|
32
32
|
- [CLI 命令参考](#-cli-命令参考)
|
|
33
|
+
- [Obsidian CLI](#-obsidian-cli)
|
|
34
|
+
- [AI 助手指南](#-ai-助手指南)
|
|
35
|
+
- [架构说明](#-架构说明)
|
|
33
36
|
- [延伸阅读](#-延伸阅读)
|
|
34
37
|
- [贡献指南](#-贡献指南)
|
|
35
38
|
|
|
@@ -107,7 +110,7 @@ npx @our2ndbrain/cli@latest init
|
|
|
107
110
|
**1. 检查 Node.js**
|
|
108
111
|
|
|
109
112
|
```bash
|
|
110
|
-
# 检查 Node.js 是否可用(需要
|
|
113
|
+
# 检查 Node.js 是否可用(需要 v18+)
|
|
111
114
|
node --version
|
|
112
115
|
|
|
113
116
|
# 如果未安装,引导用户安装:
|
|
@@ -194,6 +197,7 @@ npx @our2ndbrain/cli@latest member Alex
|
|
|
194
197
|
```
|
|
195
198
|
|
|
196
199
|
这会创建:
|
|
200
|
+
- `10_Inbox/Alex/00_To-Do.md` - 个人待办清单(Append-only)
|
|
197
201
|
- `10_Inbox/Alex/01_Tasks.md` - 个人任务看板
|
|
198
202
|
- `10_Inbox/Alex/09_Done.md` - 个人完成记录
|
|
199
203
|
- `.obsidian/daily-notes.json` - 配置日记保存到该成员目录
|
|
@@ -204,6 +208,7 @@ npx @our2ndbrain/cli@latest member Alex
|
|
|
204
208
|
|
|
205
209
|
```bash
|
|
206
210
|
ls -la 00_Dashboard/01_All_Tasks.md
|
|
211
|
+
ls -la 10_Inbox/*/00_To-Do.md
|
|
207
212
|
ls -la 10_Inbox/*/01_Tasks.md
|
|
208
213
|
ls -la 99_System/Templates/tpl_daily_note.md
|
|
209
214
|
```
|
|
@@ -232,7 +237,7 @@ ls -la 99_System/Templates/tpl_daily_note.md
|
|
|
232
237
|
|
|
233
238
|
#### 注意事项
|
|
234
239
|
|
|
235
|
-
-
|
|
240
|
+
- 阅读本文档的 [AI 助手指南](#-ai-助手指南) 了解项目约定
|
|
236
241
|
- 所有任务使用格式:`- [ ] 任务描述 #标签 📅 日期`
|
|
237
242
|
- 日记使用模板 `99_System/Templates/tpl_daily_note.md`
|
|
238
243
|
|
|
@@ -298,28 +303,38 @@ C-O-R-D 是 [GTD (Getting Things Done)](#gtd) 的现代轻量演进——保留
|
|
|
298
303
|
|
|
299
304
|
### 1️⃣ 收集 (Collect)
|
|
300
305
|
|
|
301
|
-
|
|
306
|
+
**记录归记录,任务归任务。**
|
|
302
307
|
|
|
303
|
-
|
|
308
|
+
- **想法、灵感、反思** → 写在今天的日记 `## Thoughts` 区
|
|
309
|
+
- **待办任务** → 追加到 `10_Inbox/{你的名字}/00_To-Do.md` 的 `## Inbox` 区
|
|
310
|
+
|
|
311
|
+
这是 **[Append-and-Review](#append-and-review)** 的核心实践:**先记下来,不打断思考流程**。通过 Obsidian CLI 可以从终端快速捕获:
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
# 追加想法到日记
|
|
315
|
+
obsidian daily:append content="刚想到一个新点子..."
|
|
316
|
+
|
|
317
|
+
# 追加任务到 To-Do(自动落入 Inbox 区域)
|
|
318
|
+
obsidian append file="00_To-Do" content="- [ ] 新任务 📅 2026-04-05"
|
|
319
|
+
```
|
|
304
320
|
|
|
305
321
|
> 💡 **两分钟法则**:能立刻做完的就别记了,直接做掉。
|
|
306
|
-
>
|
|
307
|
-
> 💡 **小技巧**:打开日记后,先写"今天最想推进的一件事",启动成本一下就降下来了。
|
|
308
322
|
|
|
309
323
|
### 2️⃣ 整理 (Organize)
|
|
310
324
|
|
|
311
|
-
|
|
325
|
+
定期整理 To-Do 文件,让任务能被"找到":
|
|
312
326
|
|
|
313
327
|
- 打个标签:`#next`(马上做)/ `#waiting`(等别人)/ `#someday`(以后再说)
|
|
314
328
|
- 有截止日期的,加上 `📅 2026-01-15`
|
|
315
|
-
-
|
|
316
|
-
-
|
|
317
|
-
-
|
|
329
|
+
- 把 `## Inbox` 中的任务移到对应项目的 Heading 下
|
|
330
|
+
- 新项目?在 To-Do 文件中添加 `## 项目名` Heading,并链接到 `30_Projects/`
|
|
331
|
+
- 长期关注的话题?相关笔记移到 `20_Areas/`
|
|
332
|
+
- 参考资料?放到 `40_Resources/`
|
|
318
333
|
|
|
319
334
|
**实际例子**:
|
|
320
|
-
-
|
|
321
|
-
- 日记中记录了"基金定投策略"
|
|
322
|
-
- 日记中收藏了"番茄工作法"
|
|
335
|
+
- To-Do 的 Inbox 中写了"重构公司官网"→ 在 To-Do 中新增 `## 网站重构` Heading,创建 `30_Projects/网站重构/` 项目文件夹
|
|
336
|
+
- 日记中记录了"基金定投策略"→ 移到 `20_Areas/理财/基金定投.md`
|
|
337
|
+
- 日记中收藏了"番茄工作法"→ 整理到 `40_Resources/效率工具/番茄工作法.md`
|
|
323
338
|
|
|
324
339
|
> 💡 **养成习惯**:新任务至少打个标签或日期,不然就会变成"未分类黑洞"。
|
|
325
340
|
>
|
|
@@ -327,19 +342,21 @@ C-O-R-D 是 [GTD (Getting Things Done)](#gtd) 的现代轻量演进——保留
|
|
|
327
342
|
|
|
328
343
|
### 3️⃣ 回顾 (Review)
|
|
329
344
|
|
|
330
|
-
|
|
345
|
+
**日记即看板**——打开今天的日记,`## To-Do` 区会自动展示:
|
|
346
|
+
- 今日到期的任务
|
|
347
|
+
- 过期未完成的遗留任务
|
|
331
348
|
|
|
332
|
-
|
|
349
|
+
按项目 Heading 分组显示,一目了然。需要全景视图?打开个人看板 `01_Tasks.md`:
|
|
333
350
|
- **立即行动**:没分类的任务,赶紧处理或打标签
|
|
334
351
|
- **今日必达**:今天到期的,优先搞定
|
|
335
352
|
- **等待跟进**:在等别人的 `#waiting` 任务
|
|
336
353
|
- **下一步行动**:标了 `#next` 的,随时可以开干
|
|
337
|
-
- **未来计划**:还没到期的任务,以及所有 `#someday`
|
|
354
|
+
- **未来计划**:还没到期的任务,以及所有 `#someday` 标签的任务
|
|
338
355
|
- **阅读清单**:想看的文章、书籍
|
|
339
356
|
|
|
340
|
-
> 💡
|
|
357
|
+
> 💡 **每天**至少看一眼日记看板。
|
|
341
358
|
>
|
|
342
|
-
> 💡
|
|
359
|
+
> 💡 **每周**看看 `09_Done.md` 回顾成就感;顺便清理一下项目,不活跃的挪到 `90_Archives/`。
|
|
343
360
|
|
|
344
361
|
### 4️⃣ 执行 (Do)
|
|
345
362
|
|
|
@@ -369,13 +386,18 @@ C-O-R-D 是 [GTD (Getting Things Done)](#gtd) 的现代轻量演进——保留
|
|
|
369
386
|
| `#listen` | 要听的 | 播客、音频等听觉内容 |
|
|
370
387
|
| `📅 YYYY-MM-DD` | 截止日期 | 必须在某天前完成 |
|
|
371
388
|
|
|
372
|
-
###
|
|
389
|
+
### To-Do 文件结构
|
|
373
390
|
|
|
374
|
-
|
|
391
|
+
每个成员的待办清单 `00_To-Do.md` 用 Headings 分区管理:
|
|
375
392
|
|
|
376
|
-
- `##
|
|
377
|
-
- `##
|
|
378
|
-
- `##
|
|
393
|
+
- `## Readings`:阅读/观看/收听清单(位于上方固定区域)
|
|
394
|
+
- `## 项目名`:项目相关任务,用 blockquote 链接到 `30_Projects/`
|
|
395
|
+
- `## Inbox`:新任务的默认着陆区(**位于文件最底部**,适配 CLI append)
|
|
396
|
+
|
|
397
|
+
日记模板包含两个区域:
|
|
398
|
+
|
|
399
|
+
- `## To-Do`:动态查询,展示今日到期 + 过期任务(按项目 Heading 分组)
|
|
400
|
+
- `## Thoughts`:想法/灵感/反思(日记的主体)
|
|
379
401
|
|
|
380
402
|
## 📁 目录结构 (PARA)
|
|
381
403
|
|
|
@@ -388,9 +410,10 @@ C-O-R-D 是 [GTD (Getting Things Done)](#gtd) 的现代轻量演进——保留
|
|
|
388
410
|
│ ├── Agents/ # AI 助手共享工作区
|
|
389
411
|
│ │ └── Journal.md # Agent 工作日志(append-and-review)
|
|
390
412
|
│ └── {成员名}/ # 每个人类成员一个子目录
|
|
391
|
-
│ ├──
|
|
413
|
+
│ ├── 00_To-Do.md # 个人待办清单(Append-only, Inbox 在底部)
|
|
414
|
+
│ ├── 01_Tasks.md # 个人任务看板(查询视图)
|
|
392
415
|
│ ├── 09_Done.md # 个人完成记录
|
|
393
|
-
│ └── 2026-01-14.md #
|
|
416
|
+
│ └── 2026-01-14.md # 日记(想法 + 今日看板)
|
|
394
417
|
├── 20_Areas/ # 领域:长期关注的事(健康、财务…)
|
|
395
418
|
├── 30_Projects/ # 项目:有明确目标的事
|
|
396
419
|
├── 40_Resources/ # 资源:参考资料、方法论
|
|
@@ -424,10 +447,11 @@ C-O-R-D 是 [GTD (Getting Things Done)](#gtd) 的现代轻量演进——保留
|
|
|
424
447
|
|------|--------|
|
|
425
448
|
| `00_Dashboard/01_All_Tasks.md` | 全局任务看板,汇总所有成员的待办 |
|
|
426
449
|
| `00_Dashboard/09_All_Done.md` | 全局完成记录,回顾团队成就 |
|
|
450
|
+
| `10_Inbox/{成员}/00_To-Do.md` | 个人待办清单,所有任务写在这里 |
|
|
427
451
|
| `10_Inbox/{成员}/01_Tasks.md` | 个人任务看板,每天看这个 |
|
|
428
452
|
| `10_Inbox/{成员}/09_Done.md` | 个人完成记录,回顾成就感 |
|
|
429
453
|
| `10_Inbox/Agents/Journal.md` | Agent 工作日志,记录 AI 助手的工作 |
|
|
430
|
-
| `99_System/Templates/tpl_daily_note.md` |
|
|
454
|
+
| `99_System/Templates/tpl_daily_note.md` | 日记模板(想法 + 今日看板) |
|
|
431
455
|
|
|
432
456
|
## 🔌 Obsidian 插件配置
|
|
433
457
|
|
|
@@ -508,7 +532,7 @@ npx @our2ndbrain/cli@latest <command>
|
|
|
508
532
|
**框架文件包括**:
|
|
509
533
|
- 文档:`AGENTS.md`、`README.md`、`CHANGELOG.md`、`CLAUDE.md`
|
|
510
534
|
- 看板:`00_Dashboard/01_All_Tasks.md`、`00_Dashboard/09_All_Done.md`
|
|
511
|
-
- 模板:`99_System/Templates/`
|
|
535
|
+
- 模板:`99_System/Templates/` 下的所有模板(含 `tpl_member_todo.md`)
|
|
512
536
|
- 脚本:`99_System/Scripts/` 下的所有脚本
|
|
513
537
|
- 配置:`.obsidian/` 目录(插件配置,智能合并)
|
|
514
538
|
|
|
@@ -593,6 +617,191 @@ source ~/.zshrc
|
|
|
593
617
|
|
|
594
618
|
重新打开终端或执行 `source ~/.bashrc`(或对应 shell 配置文件)即可生效。
|
|
595
619
|
|
|
620
|
+
## 🖥️ Obsidian CLI
|
|
621
|
+
|
|
622
|
+
Obsidian v1.12.4+ 内置了官方命令行工具,可以从终端直接操作你的知识库。需要 Obsidian 处于运行状态。
|
|
623
|
+
|
|
624
|
+
### 安装
|
|
625
|
+
|
|
626
|
+
1. 更新 Obsidian 到 v1.12.4 或更高版本
|
|
627
|
+
2. Settings → General → Command line interface → 启用
|
|
628
|
+
3. 按照提示将 CLI 注册到系统 PATH
|
|
629
|
+
|
|
630
|
+
<details>
|
|
631
|
+
<summary><strong>分平台 PATH 配置</strong></summary>
|
|
632
|
+
|
|
633
|
+
**macOS**(zsh):
|
|
634
|
+
```bash
|
|
635
|
+
echo 'export PATH="$PATH:/Applications/Obsidian.app/Contents/MacOS"' >> ~/.zshrc
|
|
636
|
+
source ~/.zshrc
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
**macOS**(bash):
|
|
640
|
+
```bash
|
|
641
|
+
echo 'export PATH="$PATH:/Applications/Obsidian.app/Contents/MacOS"' >> ~/.bash_profile
|
|
642
|
+
source ~/.bash_profile
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
**Windows**:
|
|
646
|
+
```
|
|
647
|
+
# 系统设置 → 环境变量 → Path → 新增
|
|
648
|
+
C:\Users\{用户名}\AppData\Local\Programs\Obsidian\
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
**Linux**:
|
|
652
|
+
```bash
|
|
653
|
+
sudo ln -s /opt/obsidian/obsidian /usr/local/bin/obsidian
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
</details>
|
|
657
|
+
|
|
658
|
+
### 与 2ndBrain 配合使用
|
|
659
|
+
|
|
660
|
+
| 场景 | 命令 |
|
|
661
|
+
|------|------|
|
|
662
|
+
| 追加任务到 To-Do | `obsidian append file="00_To-Do" content="- [ ] 新任务 📅 2026-04-05"` |
|
|
663
|
+
| 追加想法到日记 | `obsidian daily:append content="刚想到一个点子..."` |
|
|
664
|
+
| 查看今日日记 | `obsidian daily:read` |
|
|
665
|
+
| 列出所有任务 | `obsidian tasks format=json` |
|
|
666
|
+
| 搜索仓库 | `obsidian search query="关键词"` |
|
|
667
|
+
| 浏览仓库(TUI 模式) | `obsidian` |
|
|
668
|
+
|
|
669
|
+
> 💡 **CLI 限制**:`append` 只能追加到文件末尾,这就是为什么 To-Do 文件把 `## Inbox` 放在最底部——新任务通过 CLI 追加后自然落入 Inbox 区域。
|
|
670
|
+
|
|
671
|
+
### AI Agent 集成
|
|
672
|
+
|
|
673
|
+
Obsidian CLI 让 AI Agent 能够通过标准命令操作你的知识库:
|
|
674
|
+
|
|
675
|
+
```bash
|
|
676
|
+
# AI Agent 可以通过 CLI 协助管理任务
|
|
677
|
+
obsidian append file="00_To-Do" content="- [ ] AI 建议:整理本周会议笔记 📅 2026-04-07"
|
|
678
|
+
obsidian tasks format=json # 读取任务列表进行分析
|
|
679
|
+
obsidian search query="[tag:next]" format=json # 查找待处理任务
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
更多 CLI 命令参见 [Obsidian CLI 官方文档](https://obsidian.md/cli)。
|
|
683
|
+
|
|
684
|
+
## 🧠 Agent Skill(OpenClaw / Cursor / Claude Code)
|
|
685
|
+
|
|
686
|
+
本项目内置了 **2ndbrain Agent Skill**(`skills/2ndbrain/`),让 AI Agent 成为你的知识管理助手。安装后 Agent 能:
|
|
687
|
+
|
|
688
|
+
- **记录** — 把你说的任务、想法、决策快速写入知识库
|
|
689
|
+
- **处理** — 你丢过来的任何资料(文章、URL、文件),阅读、分析、总结后自动归档到 PARA 对应目录
|
|
690
|
+
- **整理** — 自动分类、打标签、移动任务到正确位置
|
|
691
|
+
- **回顾** — 生成每日行动计划,按优先级排序
|
|
692
|
+
- **记忆** — Agent 自身的所有工作日志和产出也持久化到知识库
|
|
693
|
+
|
|
694
|
+
### OpenClaw 安装
|
|
695
|
+
|
|
696
|
+
把本仓库给到 OpenClaw(龙虾),它会自动识别 `skills/2ndbrain/SKILL.md` 并加载。Skill 的 frontmatter 设置了 `always: true`,加载后始终在 Agent 上下文中激活。
|
|
697
|
+
|
|
698
|
+
首次使用时,Agent 会自动运行 `2ndbrain check` 检测环境,缺什么装什么。你只需要:
|
|
699
|
+
|
|
700
|
+
1. 把本仓库 URL 给到 OpenClaw
|
|
701
|
+
2. 告诉龙虾你要管理知识库
|
|
702
|
+
3. 龙虾会自动完成安装和初始化
|
|
703
|
+
|
|
704
|
+
之后你跟龙虾日常对话就行——"帮我记一下"、"帮我读这篇文章"、"整理一下任务"、"今天做什么"。
|
|
705
|
+
|
|
706
|
+
### Cursor / Claude Code 安装
|
|
707
|
+
|
|
708
|
+
将 `skills/2ndbrain/` 目录复制到你的 Cursor skills 目录(通常是 `~/.cursor/skills/2ndbrain/`),Cursor 会自动识别并加载。
|
|
709
|
+
|
|
710
|
+
### 定时整理
|
|
711
|
+
|
|
712
|
+
Agent Skill 支持通过 OpenClaw cron 设置定时任务,每天自动整理和生成日报:
|
|
713
|
+
|
|
714
|
+
```bash
|
|
715
|
+
openclaw cron add \
|
|
716
|
+
--name "2ndbrain-morning" \
|
|
717
|
+
--cron "0 9 * * *" \
|
|
718
|
+
--session isolated \
|
|
719
|
+
--message "你已安装 2ndbrain skill。执行每日整理并生成今日优先级 Top 3"
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
也可以用 `2ndbrain watch` 命令监听文件变化,自动触发轻量整理。
|
|
723
|
+
|
|
724
|
+
### Skill 文件结构
|
|
725
|
+
|
|
726
|
+
```
|
|
727
|
+
skills/2ndbrain/
|
|
728
|
+
├── SKILL.md # 主技能文件(Agent 读这个)
|
|
729
|
+
└── references/
|
|
730
|
+
├── setup.md # 安装引导
|
|
731
|
+
├── operations.md # 整理算法 + 智能日报
|
|
732
|
+
├── scheduling.md # 调度策略(cron + watch)
|
|
733
|
+
├── task-conventions.md # 任务格式约定
|
|
734
|
+
└── content-processing.md # 内容处理 + PARA 自动归档
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
## 🤖 AI 助手指南
|
|
738
|
+
|
|
739
|
+
> 本节内容面向 AI 助手(Claude、ChatGPT、Cursor 等)。当帮助用户操作本项目时,请遵循以下规则。
|
|
740
|
+
|
|
741
|
+
### 核心规则
|
|
742
|
+
|
|
743
|
+
1. **任务格式**:所有任务使用 `- [ ] 任务描述 #tag 📅 YYYY-MM-DD`
|
|
744
|
+
2. **文件放置**:所有新内容先放 `10_Inbox/{成员}/`,明确目标的放 `30_Projects/`
|
|
745
|
+
3. **不要修改看板查询**:`00_Dashboard/` 和 `01_Tasks.md` 中的 Tasks 查询块是自动生成的,只修改 To-Do 文件中的任务
|
|
746
|
+
4. **使用模板创建日记**:模板位于 `99_System/Templates/tpl_daily_note.md`
|
|
747
|
+
5. **任务完成**:将 `- [ ]` 改为 `- [x]`,Tasks 插件会自动添加完成日期
|
|
748
|
+
6. **遵循用户语言**:匹配对话中使用的语言
|
|
749
|
+
|
|
750
|
+
### Agent 协作设计
|
|
751
|
+
|
|
752
|
+
AI 助手和人类在 2ndBrain 中**共存协作**。Agent 可以直接操作所有目录,使用 `10_Inbox/Agents/` 共享工作区记录工作日志。
|
|
753
|
+
|
|
754
|
+
详细的 Agent 工作日志格式和协作规范参见 `10_Inbox/Agents/Journal.md`。
|
|
755
|
+
|
|
756
|
+
### 工作原则
|
|
757
|
+
|
|
758
|
+
1. **优先改进工具而非绕过工具**——手动操作不可复现且易出错
|
|
759
|
+
2. **注意命名一致性**——工具设计应考虑命名差异,避免同步失败
|
|
760
|
+
|
|
761
|
+
## 🏗️ 架构说明
|
|
762
|
+
|
|
763
|
+
> 本节面向开发者和 AI 编程助手,描述 CLI 工具的内部架构。
|
|
764
|
+
|
|
765
|
+
<details>
|
|
766
|
+
<summary><strong>点击展开架构详情</strong></summary>
|
|
767
|
+
|
|
768
|
+
### 入口
|
|
769
|
+
|
|
770
|
+
- `bin/2ndbrain.js` — CLI 入口(Commander.js)
|
|
771
|
+
- `src/index.js` — 主模块,导出所有命令
|
|
772
|
+
|
|
773
|
+
### 核心模块
|
|
774
|
+
|
|
775
|
+
| 模块 | 职责 |
|
|
776
|
+
|------|------|
|
|
777
|
+
| `src/lib/config.js` | 框架文件定义、目录约定、项目识别 |
|
|
778
|
+
| `src/lib/files.js` | 文件操作(复制、智能比较、删除) |
|
|
779
|
+
| `src/lib/diff.js` | 文件比较(使用 `diff` 包,支持行/词级比较) |
|
|
780
|
+
| `src/lib/prompt.js` | 交互式提示(确认、选择、批量更新) |
|
|
781
|
+
| `src/commands/init.js` | 项目初始化(验证、创建目录、复制文件) |
|
|
782
|
+
| `src/commands/member.js` | 成员目录创建(模板处理、配置更新) |
|
|
783
|
+
| `src/commands/update.js` | 框架文件更新(差异预览、批量/逐个模式) |
|
|
784
|
+
| `src/commands/remove.js` | 框架文件移除(仅框架文件,不碰用户数据) |
|
|
785
|
+
|
|
786
|
+
### 设计模式
|
|
787
|
+
|
|
788
|
+
- **框架 vs 用户数据分离**:`FRAMEWORK_FILES` 由 CLI 管理,`USER_DATA_DIRS` 永不触碰
|
|
789
|
+
- **模板占位符**:`{{MEMBER_NAME}}` 在 `member` 命令执行时替换
|
|
790
|
+
- **智能合并**:`.obsidian/` 配置使用 manifest 驱动的合并策略(数组并集、只增不覆盖等)
|
|
791
|
+
- **Dry Run 模式**:`update` 和 `remove` 支持 `--dry-run` 预览
|
|
792
|
+
- **项目标识**:`AGENTS.md` 文件的存在标识一个 2ndBrain 项目
|
|
793
|
+
|
|
794
|
+
### 依赖
|
|
795
|
+
|
|
796
|
+
- `commander` — CLI 框架
|
|
797
|
+
- `chalk` — 终端颜色
|
|
798
|
+
- `fs-extra` — 增强文件系统操作
|
|
799
|
+
- `diff` — 文件比较/差异生成
|
|
800
|
+
|
|
801
|
+
Node.js >= 18.0.0
|
|
802
|
+
|
|
803
|
+
</details>
|
|
804
|
+
|
|
596
805
|
## 📚 延伸阅读
|
|
597
806
|
|
|
598
807
|
想深入了解背后的方法论?
|
package/bin/2ndbrain.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const { program } = require('commander');
|
|
10
|
-
const { init, update, remove, member, completion } = require('../src');
|
|
10
|
+
const { init, update, remove, member, completion, check, watch } = require('../src');
|
|
11
11
|
const pkg = require('../package.json');
|
|
12
12
|
|
|
13
13
|
// ANSI color codes for terminal output
|
|
@@ -93,6 +93,35 @@ program
|
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
+
// Check command
|
|
97
|
+
program
|
|
98
|
+
.command('check [path]')
|
|
99
|
+
.description('Check environment prerequisites (Node.js, Git, Obsidian, Agent CLI)')
|
|
100
|
+
.action(async (targetPath = '.', options) => {
|
|
101
|
+
try {
|
|
102
|
+
const passed = await check(targetPath, options, log);
|
|
103
|
+
if (!passed) process.exit(1);
|
|
104
|
+
} catch (err) {
|
|
105
|
+
log.error(`Error: ${err.message}`);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Watch command
|
|
111
|
+
program
|
|
112
|
+
.command('watch [path]')
|
|
113
|
+
.description('Watch To-Do files for changes and auto-trigger inbox organization')
|
|
114
|
+
.option('-i, --interval <minutes>', 'Debounce interval in minutes (default: 5)', parseInt)
|
|
115
|
+
.option('--once', 'Exit after first triggered organization')
|
|
116
|
+
.action(async (targetPath = '.', options) => {
|
|
117
|
+
try {
|
|
118
|
+
await watch(targetPath, options, log);
|
|
119
|
+
} catch (err) {
|
|
120
|
+
log.error(`Error: ${err.message}`);
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
96
125
|
// Completion command
|
|
97
126
|
program
|
|
98
127
|
.command('completion <shell>')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@our2ndbrain/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2026.4.4",
|
|
4
4
|
"description": "CLI tool for 2ndBrain - A personal knowledge management system based on PARA + C-O-R-D + Append-and-Review",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"2ndbrain",
|
|
@@ -38,17 +38,22 @@
|
|
|
38
38
|
"url": "https://github.com/Our2ndBrain/2ndBrain-Template/issues"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
|
-
"node": ">=
|
|
41
|
+
"node": ">=18.0.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"
|
|
45
|
-
"
|
|
44
|
+
"lint": "node scripts/lint.js && node scripts/check-workflow-pinning.js",
|
|
45
|
+
"pack:check": "node scripts/check-package.js",
|
|
46
|
+
"release": "node scripts/release.js",
|
|
47
|
+
"release:check": "node scripts/check-release.js",
|
|
48
|
+
"smoke:install": "node scripts/smoke-install.js",
|
|
49
|
+
"test": "node --test",
|
|
50
|
+
"version": "node scripts/version.js && git add CHANGELOG.md"
|
|
46
51
|
},
|
|
47
52
|
"dependencies": {
|
|
48
53
|
"chalk": "^4.1.2",
|
|
49
54
|
"commander": "^12.0.0",
|
|
50
|
-
"diff": "^
|
|
51
|
-
"fs-extra": "^11.
|
|
55
|
+
"diff": "^8.0.4",
|
|
56
|
+
"fs-extra": "^11.3.4"
|
|
52
57
|
},
|
|
53
58
|
"publishConfig": {
|
|
54
59
|
"access": "public"
|