@our2ndbrain/cli 1.1.3 → 2026.4.5
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/CHANGELOG.md +30 -2
- package/README.md +54 -582
- package/README_en.md +108 -0
- package/bin/2ndbrain.js +30 -1
- package/package.json +14 -11
- package/src/commands/check.js +199 -0
- package/src/commands/completion.js +35 -1
- package/src/commands/init.js +7 -4
- package/src/commands/member.js +3 -1
- package/src/commands/update.js +38 -12
- package/src/commands/watch.js +212 -0
- package/src/index.js +4 -0
- package/src/lib/config.js +46 -2
- package/src/lib/files.js +58 -19
- package/{.obsidian → template/.obsidian}/plugins/obsidian-git/obsidian_askpass.sh +0 -0
- package/{00_Dashboard → template/00_Dashboard}/01_All_Tasks.md +17 -15
- package/template/10_Inbox/.gitkeep +0 -0
- package/template/20_Areas/.gitkeep +0 -0
- package/template/30_Projects/.gitkeep +0 -0
- package/template/40_Resources/.gitkeep +0 -0
- package/template/90_Archives/.gitkeep +0 -0
- package/{99_System → template/99_System}/Scripts/init_member.sh +0 -0
- package/template/99_System/Templates/tpl_daily_note.md +30 -0
- package/{99_System → template/99_System}/Templates/tpl_member_tasks.md +11 -5
- package/template/99_System/Templates/tpl_member_todo.md +5 -0
- package/99_System/Templates/tpl_daily_note.md +0 -13
- package/AGENTS.md +0 -193
- package/CLAUDE.md +0 -153
- /package/{.obsidian → template/.obsidian}/.2ndbrain-manifest.json +0 -0
- /package/{.obsidian → template/.obsidian}/app.json +0 -0
- /package/{.obsidian → template/.obsidian}/appearance.json +0 -0
- /package/{.obsidian → template/.obsidian}/community-plugins.json +0 -0
- /package/{.obsidian → template/.obsidian}/core-plugins.json +0 -0
- /package/{.obsidian → template/.obsidian}/graph.json +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/calendar/data.json +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/calendar/main.js +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/calendar/manifest.json +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-custom-attachment-location/data.json +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-custom-attachment-location/main.js +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-custom-attachment-location/manifest.json +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-custom-attachment-location/styles.css +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-git/data.json +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-git/main.js +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-git/manifest.json +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-git/styles.css +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-tasks-plugin/main.js +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-tasks-plugin/manifest.json +0 -0
- /package/{.obsidian → template/.obsidian}/plugins/obsidian-tasks-plugin/styles.css +0 -0
- /package/{.obsidian → template/.obsidian}/types.json +0 -0
- /package/{00_Dashboard → template/00_Dashboard}/09_All_Done.md +0 -0
- /package/{10_Inbox → template/10_Inbox}/Agents/Journal.md +0 -0
- /package/{99_System → template/99_System}/Templates/tpl_member_done.md +0 -0
|
@@ -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
|
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# {{date:YYYY-MM-DD dddd}}
|
|
2
|
+
|
|
3
|
+
> Created: {{date:YYYY-MM-DD HH:mm}}
|
|
4
|
+
|
|
5
|
+
## To-Do
|
|
6
|
+
|
|
7
|
+
### Overdue
|
|
8
|
+
|
|
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
|
+
```
|
|
18
|
+
|
|
19
|
+
### Due Today
|
|
20
|
+
|
|
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/AGENTS.md
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
# AGENTS.md
|
|
2
|
-
|
|
3
|
-
> This is the project guide for AI assistants. When helping users operate this project, please follow these rules.
|
|
4
|
-
|
|
5
|
-
## Installing 2ndBrain CLI
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Use npx to run directly (recommended)
|
|
9
|
-
npx @our2ndbrain/cli@latest <command>
|
|
10
|
-
|
|
11
|
-
# Or install globally
|
|
12
|
-
npm install -g @our2ndbrain/cli
|
|
13
|
-
2ndbrain <command>
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Project Overview
|
|
17
|
-
|
|
18
|
-
**2ndBrain** is a personal knowledge management system based on PARA + C-O-R-D + Append-and-Review, using Obsidian as the frontend tool.
|
|
19
|
-
|
|
20
|
-
## Directory Structure Conventions
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
2ndBrain/
|
|
24
|
-
├── 00_Dashboard/ # Dashboards: task aggregation entry point
|
|
25
|
-
├── 10_Inbox/ # Inbox: journals land here
|
|
26
|
-
│ └── {MemberName}/ # One subdirectory per member
|
|
27
|
-
├── 20_Areas/ # Areas: long-term focus areas
|
|
28
|
-
├── 30_Projects/ # Projects: things with clear goals
|
|
29
|
-
├── 40_Resources/ # Resources: reference materials
|
|
30
|
-
├── 90_Archives/ # Archives: completed or inactive items
|
|
31
|
-
└── 99_System/ # System: templates, scripts and config
|
|
32
|
-
├── Scripts/ # Automation scripts
|
|
33
|
-
└── Templates/ # Note templates
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Core Rules
|
|
37
|
-
|
|
38
|
-
### 1. Task Format
|
|
39
|
-
|
|
40
|
-
All tasks use Markdown checkbox format:
|
|
41
|
-
|
|
42
|
-
```markdown
|
|
43
|
-
- [ ] Task description #tag 📅 2026-01-15
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### 2. Tag Conventions
|
|
47
|
-
|
|
48
|
-
| Tag | Purpose |
|
|
49
|
-
|-----|---------|
|
|
50
|
-
| `#next` | Next task to do |
|
|
51
|
-
| `#waiting` | Waiting on others |
|
|
52
|
-
| `#someday` | Later task |
|
|
53
|
-
| `#read` / `#watch` / `#listen` | Read/watch/listen lists |
|
|
54
|
-
| `📅 YYYY-MM-DD` | Due date |
|
|
55
|
-
|
|
56
|
-
### 3. Journal Heading Structure
|
|
57
|
-
|
|
58
|
-
Use the following headings in journals to categorize content. Dashboards will auto-recognize them:
|
|
59
|
-
|
|
60
|
-
- `## 💼 Works` - Work tasks
|
|
61
|
-
- `## 💡 Thoughts` - Ideas and inspirations
|
|
62
|
-
- `## 📚 Readings` - Reading list
|
|
63
|
-
|
|
64
|
-
### 4. File Placement Rules
|
|
65
|
-
|
|
66
|
-
- **All new content** → First put in journals under `10_Inbox/{member}/`
|
|
67
|
-
- **Clear goals** → `30_Projects/`
|
|
68
|
-
- **Long-term maintenance** → `20_Areas/`
|
|
69
|
-
- **Reference materials** → `40_Resources/`
|
|
70
|
-
- **No longer active** → `90_Archives/`
|
|
71
|
-
|
|
72
|
-
## Common Operations
|
|
73
|
-
|
|
74
|
-
### Creating a New Member
|
|
75
|
-
|
|
76
|
-
Use CLI command:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
npx @our2ndbrain/cli@latest member {MemberName}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
This creates:
|
|
83
|
-
- `10_Inbox/{MemberName}/01_Tasks.md` - Personal task dashboard
|
|
84
|
-
- `10_Inbox/{MemberName}/09_Done.md` - Personal completion record
|
|
85
|
-
- `.obsidian/daily-notes.json` - Configures journal to save to that member directory
|
|
86
|
-
|
|
87
|
-
> 💡 Use `--no-config` option for team collaboration to avoid overwriting other members' config.
|
|
88
|
-
|
|
89
|
-
## AI Assistant Notes
|
|
90
|
-
|
|
91
|
-
1. **Don't modify Dataview queries in dashboard files**
|
|
92
|
-
- Global dashboards: `00_Dashboard/01_All_Tasks.md` and `09_All_Done.md`
|
|
93
|
-
- Personal dashboards: `10_Inbox/{member}/01_Tasks.md` and `09_Done.md`
|
|
94
|
-
- These are auto-generated dashboards. Only modify tasks in journals, dashboards will auto-update.
|
|
95
|
-
|
|
96
|
-
2. **Use template when creating journals**
|
|
97
|
-
- Template located at `99_System/Templates/tpl_daily_note.md`
|
|
98
|
-
- Journal naming format: `YYYY-MM-DD.md`
|
|
99
|
-
|
|
100
|
-
3. **After task completion**
|
|
101
|
-
- Change `- [ ]` to `- [x]`
|
|
102
|
-
- Tasks plugin will auto-add completion date `✅ YYYY-MM-DD`
|
|
103
|
-
|
|
104
|
-
4. **Follow user's language preference**
|
|
105
|
-
- Adapt responses to user's language settings
|
|
106
|
-
- Match the language used in the conversation
|
|
107
|
-
|
|
108
|
-
## Agent Collaboration Design
|
|
109
|
-
|
|
110
|
-
AI assistants and humans **coexist collaboratively** in 2ndBrain. Agents can directly operate all directories (`20_Areas/`, `30_Projects/`, `40_Resources/`, etc.), only need a shared workspace to record work logs.
|
|
111
|
-
|
|
112
|
-
### Shared Workspace
|
|
113
|
-
|
|
114
|
-
All Agents share the `10_Inbox/Agents/` directory (note: plural), using a single-file Journal mode:
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
10_Inbox/Agents/
|
|
118
|
-
└── Journal.md # All Agents' work logs (append-and-review)
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Journal Format
|
|
122
|
-
|
|
123
|
-
Uses **append-and-review** mode:
|
|
124
|
-
- **Append**: New content appended to file end, separated by delimiters per entry
|
|
125
|
-
- **Review**: Periodically review TODOs, check off when complete; valuable content can be output to other directories
|
|
126
|
-
|
|
127
|
-
```markdown
|
|
128
|
-
# Agent Journal
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
2026-01-14 15:30 | Cursor
|
|
132
|
-
|
|
133
|
-
Executed xxx task...
|
|
134
|
-
|
|
135
|
-
- [ ] Discovered issue #next
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
2026-01-14 16:45 | Claude Desktop
|
|
139
|
-
|
|
140
|
-
Optimized yyy...
|
|
141
|
-
|
|
142
|
-
## 💡 Improvement Suggestions
|
|
143
|
-
|
|
144
|
-
- Suggest zzz
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Why This Design?
|
|
148
|
-
|
|
149
|
-
| Feature | Reason |
|
|
150
|
-
|---------|--------|
|
|
151
|
-
| **Shared directory** | Agents aren't "people", don't need isolated personal spaces |
|
|
152
|
-
| **Single file** | Read once for full context, highest efficiency |
|
|
153
|
-
| **Append-and-Review** | Simple writing + periodic organization, follows C-O-R-D workflow |
|
|
154
|
-
| **Timestamp + Agent name** | Know who did what when |
|
|
155
|
-
|
|
156
|
-
### Review Workflow
|
|
157
|
-
|
|
158
|
-
Journal content can be output to other directories during review:
|
|
159
|
-
|
|
160
|
-
| Content Type | Output Target |
|
|
161
|
-
|-------------|---------------|
|
|
162
|
-
| Completed TODOs | Check off `[x]` stay in place |
|
|
163
|
-
| Discovered issues/solutions | → `30_Projects/` related projects |
|
|
164
|
-
| Reusable experience | → `40_Resources/` or `20_Areas/` |
|
|
165
|
-
| Error post-mortem | Keep in Journal as history |
|
|
166
|
-
|
|
167
|
-
### When to Write Journal
|
|
168
|
-
|
|
169
|
-
- After executing complex tasks (migration, refactoring, batch modifications)
|
|
170
|
-
- When discovering issues that need fixing
|
|
171
|
-
- When having improvement suggestions
|
|
172
|
-
- When encountering failures or anomalies
|
|
173
|
-
|
|
174
|
-
### Work Principles
|
|
175
|
-
|
|
176
|
-
1. **Prefer improving tools over bypassing them** - Manual operations are non-reproducible and error-prone. When encountering scenarios not supported by tools, improve the tool first then execute.
|
|
177
|
-
2. **Pay attention to naming consistency** - Tool design should consider naming differences to avoid sync failures due to inconsistent naming.
|
|
178
|
-
|
|
179
|
-
### Tasks in Journal
|
|
180
|
-
|
|
181
|
-
Agents can write todo tasks in Journal, Dashboard dashboards will auto-recognize:
|
|
182
|
-
|
|
183
|
-
```markdown
|
|
184
|
-
- [ ] Discovered xxx needs fixing #next
|
|
185
|
-
- [ ] Suggest adding yyy feature #someday 📅 2026-01-30
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
> 💡 **Note**: Tasks with `#someday` tag will appear in "Future Plans" section, regardless of whether they have a due date. This is the dedicated area for "later" tasks.
|
|
189
|
-
|
|
190
|
-
## Reference Links
|
|
191
|
-
|
|
192
|
-
- [README.md](README.md) - Complete project documentation
|
|
193
|
-
- [Template repository](https://github.com/Our2ndBrain/2ndBrain-Template) - Open source template
|
package/CLAUDE.md
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
**2ndBrain** is a personal knowledge management system CLI tool published as `@our2ndbrain/cli`. It combines three methodologies:
|
|
8
|
-
- **PARA**: Projects, Areas, Resources, Archives organizational structure
|
|
9
|
-
- **C-O-R-D**: Collect → Organize → Review → Do workflow
|
|
10
|
-
- **Append-and-Review**: Karpathy's note-taking approach (append first, organize during review)
|
|
11
|
-
|
|
12
|
-
The CLI provides an Obsidian-based template with a Node.js CLI tool for setup and management. The tool is designed for both individual and team use, with Git integration for synchronization.
|
|
13
|
-
|
|
14
|
-
## CLI Commands
|
|
15
|
-
|
|
16
|
-
### Installation and Usage
|
|
17
|
-
```bash
|
|
18
|
-
# Use npx directly (recommended)
|
|
19
|
-
npx @our2ndbrain/cli@latest <command>
|
|
20
|
-
|
|
21
|
-
# Or install globally
|
|
22
|
-
npm install -g @our2ndbrain/cli
|
|
23
|
-
2ndbrain <command>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Available Commands
|
|
27
|
-
- `2ndbrain init [path]` - Initialize new project from template
|
|
28
|
-
- `2ndbrain member <name> [path]` - Add new member directory
|
|
29
|
-
- `2ndbrain update [path]` - Update framework files with diff preview
|
|
30
|
-
- `2ndbrain remove [path]` - Remove framework files
|
|
31
|
-
|
|
32
|
-
### Command Options
|
|
33
|
-
**init**: `-f, --force` (overwrite), `-t, --template <path>` (custom template)
|
|
34
|
-
**member**: `-f, --force` (overwrite), `--no-config` (skip Obsidian config)
|
|
35
|
-
**update**: `-d, --dry-run` (preview), `-t, --template <path>` (custom template)
|
|
36
|
-
**remove**: `-d, --dry-run` (preview), `-f, --force` (skip confirmation)
|
|
37
|
-
|
|
38
|
-
### Publishing
|
|
39
|
-
```bash
|
|
40
|
-
npm version <major|minor|patch> # Updates CHANGELOG.md via scripts/version.js
|
|
41
|
-
# postversion hook runs: git push && git push --tags && npm publish
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Architecture
|
|
45
|
-
|
|
46
|
-
### Entry Points
|
|
47
|
-
- `bin/2ndbrain.js` - CLI entry point (Commander.js)
|
|
48
|
-
- `src/index.js` - Main module that exports commands
|
|
49
|
-
|
|
50
|
-
### Core Modules
|
|
51
|
-
|
|
52
|
-
**src/lib/config.js** - Framework file definitions
|
|
53
|
-
- `FRAMEWORK_FILES`: Files managed by init/update/remove (AGENTS.md, README.md, CHANGELOG.md, CLAUDE.md, dashboards, templates)
|
|
54
|
-
- `FRAMEWORK_DIRS`: Directories created during init (00_Dashboard, 10_Inbox/Agents, 99_System)
|
|
55
|
-
- `USER_DATA_DIRS`: Never touched by CLI (20_Areas, 30_Projects, 40_Resources, 90_Archives)
|
|
56
|
-
- `COPY_DIRS`: Directories copied entirely (e.g., .obsidian with plugins)
|
|
57
|
-
- `MARKER_FILE`: `AGENTS.md` - identifies a 2ndBrain project
|
|
58
|
-
|
|
59
|
-
**src/lib/files.js** - File operations
|
|
60
|
-
- `copyFiles()` - Basic file copying
|
|
61
|
-
- `copyFilesSmart()` - Copy with comparison, dry-run support, change tracking
|
|
62
|
-
- `removeFiles()` - File removal with tracking
|
|
63
|
-
- `ensureDirs()` / `removeEmptyDirs()` - Directory management
|
|
64
|
-
|
|
65
|
-
**src/lib/diff.js** - File comparison utilities
|
|
66
|
-
- Uses `diff` npm package for line/word comparison
|
|
67
|
-
- `compareFiles()` - Detects binary/large files, compares contents
|
|
68
|
-
- `summarizeChanges()` - Returns added/removed line counts
|
|
69
|
-
- `generateDiff()` / `formatDiffForTerminal()` - Unified diff with colors
|
|
70
|
-
- Large file threshold: 100KB
|
|
71
|
-
|
|
72
|
-
**src/lib/prompt.js** - Interactive prompts
|
|
73
|
-
- `confirm()` - Yes/no prompts with defaults
|
|
74
|
-
- `select()` - Multi-option selection
|
|
75
|
-
- `confirmBatchUpdates()` - Bulk update confirmation
|
|
76
|
-
- Special handling for binary/large files
|
|
77
|
-
|
|
78
|
-
**src/commands/init.js** - Project initialization
|
|
79
|
-
- Validates target directory (checks for existing 2ndBrain projects or non-empty dirs)
|
|
80
|
-
- Creates framework and user data directories
|
|
81
|
-
- Copies framework files and .obsidian config
|
|
82
|
-
- Creates init-only files (e.g., 10_Inbox/Agents/Journal.md)
|
|
83
|
-
|
|
84
|
-
**src/commands/member.js** - Member directory creation
|
|
85
|
-
- Validates project is a 2ndBrain project
|
|
86
|
-
- Creates `10_Inbox/{member}/` directory
|
|
87
|
-
- Processes template files with `{{MEMBER_NAME}}` placeholder replacement
|
|
88
|
-
- Updates `.obsidian/daily-notes.json` (unless `--no-config`)
|
|
89
|
-
|
|
90
|
-
**src/commands/update.js** - Framework file updates
|
|
91
|
-
- Compares template files with existing files
|
|
92
|
-
- Shows diff with colored output for changes
|
|
93
|
-
- Supports batch (all), review (individual), or skip modes
|
|
94
|
-
- Also updates member dashboards using latest templates
|
|
95
|
-
|
|
96
|
-
**src/commands/remove.js** - Framework file removal
|
|
97
|
-
- Removes only framework files (never user data directories)
|
|
98
|
-
- Cleans up empty directories
|
|
99
|
-
|
|
100
|
-
### Key Design Patterns
|
|
101
|
-
|
|
102
|
-
**Smart File Management**: Files are compared before copying to avoid unnecessary writes. Binary and large files are detected and handled specially.
|
|
103
|
-
|
|
104
|
-
**Template System**: Member files use `{{MEMBER_NAME}}` placeholder that gets replaced during `member` command execution.
|
|
105
|
-
|
|
106
|
-
**Framework vs User Data Separation**:
|
|
107
|
-
- Framework files: Managed by CLI, can be updated/removed
|
|
108
|
-
- User data directories: Created during init, never modified by CLI
|
|
109
|
-
- This allows users to keep their content while updating framework
|
|
110
|
-
|
|
111
|
-
**Dry Run Mode**: Both `update` and `remove` support `--dry-run` to preview changes before applying.
|
|
112
|
-
|
|
113
|
-
## Directory Structure (PARA)
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
2ndBrain/
|
|
117
|
-
├── 00_Dashboard/ # Task aggregation dashboards (Dataview/Tasks queries)
|
|
118
|
-
├── 10_Inbox/ # Collection point (daily journals)
|
|
119
|
-
│ ├── Agents/ # AI assistant shared workspace
|
|
120
|
-
│ └── {MemberName}/ # Each member's personal directory
|
|
121
|
-
├── 20_Areas/ # Long-term focus areas
|
|
122
|
-
├── 30_Projects/ # Goal-oriented work
|
|
123
|
-
├── 40_Resources/ # Reference materials
|
|
124
|
-
├── 90_Archives/ # Completed/inactive content
|
|
125
|
-
└── 99_System/ # Templates and scripts
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## Task Format Convention
|
|
129
|
-
|
|
130
|
-
Tasks use Markdown checkbox format with tags and dates:
|
|
131
|
-
```markdown
|
|
132
|
-
- [ ] Task description #tag 📅 YYYY-MM-DD
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Tags: `#next` (do next), `#waiting` (waiting on others), `#someday` (later), `#read`/`#watch`/`#listen` (consume lists)
|
|
136
|
-
|
|
137
|
-
## Dependencies
|
|
138
|
-
|
|
139
|
-
- `commander` - CLI framework
|
|
140
|
-
- `chalk` - Terminal colors
|
|
141
|
-
- `fs-extra` - Enhanced file system operations
|
|
142
|
-
- `diff` - File comparison/diff generation
|
|
143
|
-
|
|
144
|
-
## Node.js Requirement
|
|
145
|
-
|
|
146
|
-
Node.js >= 16.0.0 (specified in package.json `engines`)
|
|
147
|
-
|
|
148
|
-
## Important Notes
|
|
149
|
-
|
|
150
|
-
- The CLI is published as an npm package, so template files are bundled via `package.json` `files` field
|
|
151
|
-
- `.obsidian/` directory is included in the package to provide pre-configured plugins
|
|
152
|
-
- `AGENTS.md` serves as both documentation and the marker file for identifying 2ndBrain projects
|
|
153
|
-
- Member directories are excluded from automatic updates (must be re-run manually if needed)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{.obsidian → template/.obsidian}/plugins/obsidian-custom-attachment-location/data.json
RENAMED
|
File without changes
|
/package/{.obsidian → template/.obsidian}/plugins/obsidian-custom-attachment-location/main.js
RENAMED
|
File without changes
|
/package/{.obsidian → template/.obsidian}/plugins/obsidian-custom-attachment-location/manifest.json
RENAMED
|
File without changes
|
/package/{.obsidian → template/.obsidian}/plugins/obsidian-custom-attachment-location/styles.css
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|