@brainfile/cli 0.13.2 → 0.15.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.
Files changed (157) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +123 -358
  3. package/dist/cli.js +113 -2
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/add.d.ts +3 -0
  6. package/dist/commands/add.d.ts.map +1 -1
  7. package/dist/commands/add.js +162 -3
  8. package/dist/commands/add.js.map +1 -1
  9. package/dist/commands/adr.d.ts +22 -0
  10. package/dist/commands/adr.d.ts.map +1 -0
  11. package/dist/commands/adr.js +182 -0
  12. package/dist/commands/adr.js.map +1 -0
  13. package/dist/commands/archive.d.ts.map +1 -1
  14. package/dist/commands/archive.js +147 -0
  15. package/dist/commands/archive.js.map +1 -1
  16. package/dist/commands/complete.d.ts +30 -0
  17. package/dist/commands/complete.d.ts.map +1 -0
  18. package/dist/commands/complete.js +254 -0
  19. package/dist/commands/complete.js.map +1 -0
  20. package/dist/commands/contract.d.ts.map +1 -1
  21. package/dist/commands/contract.js +2 -0
  22. package/dist/commands/contract.js.map +1 -1
  23. package/dist/commands/delete.d.ts.map +1 -1
  24. package/dist/commands/delete.js +29 -1
  25. package/dist/commands/delete.js.map +1 -1
  26. package/dist/commands/init.d.ts +1 -0
  27. package/dist/commands/init.d.ts.map +1 -1
  28. package/dist/commands/init.js +41 -8
  29. package/dist/commands/init.js.map +1 -1
  30. package/dist/commands/list.d.ts +1 -0
  31. package/dist/commands/list.d.ts.map +1 -1
  32. package/dist/commands/list.js +34 -12
  33. package/dist/commands/list.js.map +1 -1
  34. package/dist/commands/log.d.ts +52 -0
  35. package/dist/commands/log.d.ts.map +1 -0
  36. package/dist/commands/log.js +246 -0
  37. package/dist/commands/log.js.map +1 -0
  38. package/dist/commands/mcp.d.ts.map +1 -1
  39. package/dist/commands/mcp.js +979 -44
  40. package/dist/commands/mcp.js.map +1 -1
  41. package/dist/commands/migrate.d.ts +4 -3
  42. package/dist/commands/migrate.d.ts.map +1 -1
  43. package/dist/commands/migrate.js +193 -38
  44. package/dist/commands/migrate.js.map +1 -1
  45. package/dist/commands/move.d.ts.map +1 -1
  46. package/dist/commands/move.js +90 -0
  47. package/dist/commands/move.js.map +1 -1
  48. package/dist/commands/patch.d.ts.map +1 -1
  49. package/dist/commands/patch.js +85 -13
  50. package/dist/commands/patch.js.map +1 -1
  51. package/dist/commands/rules.d.ts +68 -0
  52. package/dist/commands/rules.d.ts.map +1 -0
  53. package/dist/commands/rules.js +322 -0
  54. package/dist/commands/rules.js.map +1 -0
  55. package/dist/commands/schema.d.ts +31 -0
  56. package/dist/commands/schema.d.ts.map +1 -0
  57. package/dist/commands/schema.js +369 -0
  58. package/dist/commands/schema.js.map +1 -0
  59. package/dist/commands/search.d.ts +33 -0
  60. package/dist/commands/search.d.ts.map +1 -0
  61. package/dist/commands/search.js +209 -0
  62. package/dist/commands/search.js.map +1 -0
  63. package/dist/commands/show.d.ts.map +1 -1
  64. package/dist/commands/show.js +74 -1
  65. package/dist/commands/show.js.map +1 -1
  66. package/dist/commands/subtask.d.ts.map +1 -1
  67. package/dist/commands/subtask.js +72 -5
  68. package/dist/commands/subtask.js.map +1 -1
  69. package/dist/commands/types.d.ts +40 -0
  70. package/dist/commands/types.d.ts.map +1 -0
  71. package/dist/commands/types.js +242 -0
  72. package/dist/commands/types.js.map +1 -0
  73. package/dist/index.d.ts +1 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +3 -1
  76. package/dist/index.js.map +1 -1
  77. package/dist/lib/contractRunner.d.ts.map +1 -1
  78. package/dist/lib/contractRunner.js +177 -12
  79. package/dist/lib/contractRunner.js.map +1 -1
  80. package/dist/schemas/base.json +159 -0
  81. package/dist/schemas/board.json +198 -0
  82. package/dist/tui/BrainfileTUI.d.ts.map +1 -1
  83. package/dist/tui/BrainfileTUI.js +23 -20
  84. package/dist/tui/BrainfileTUI.js.map +1 -1
  85. package/dist/tui/actions.d.ts +5 -5
  86. package/dist/tui/actions.d.ts.map +1 -1
  87. package/dist/tui/actions.js +335 -47
  88. package/dist/tui/actions.js.map +1 -1
  89. package/dist/tui/components/ArchivePanel.js +1 -1
  90. package/dist/tui/components/ArchivePanel.js.map +1 -1
  91. package/dist/tui/components/ColumnTabs.d.ts.map +1 -1
  92. package/dist/tui/components/ColumnTabs.js +6 -2
  93. package/dist/tui/components/ColumnTabs.js.map +1 -1
  94. package/dist/tui/components/HelpOverlay.js +3 -3
  95. package/dist/tui/components/HelpOverlay.js.map +1 -1
  96. package/dist/tui/components/LogsPanel.d.ts +16 -0
  97. package/dist/tui/components/LogsPanel.d.ts.map +1 -0
  98. package/dist/tui/components/LogsPanel.js +115 -0
  99. package/dist/tui/components/LogsPanel.js.map +1 -0
  100. package/dist/tui/components/MainPanelTabs.d.ts +2 -2
  101. package/dist/tui/components/MainPanelTabs.d.ts.map +1 -1
  102. package/dist/tui/components/MainPanelTabs.js +3 -3
  103. package/dist/tui/components/MainPanelTabs.js.map +1 -1
  104. package/dist/tui/components/StackedTaskList.d.ts +2 -1
  105. package/dist/tui/components/StackedTaskList.d.ts.map +1 -1
  106. package/dist/tui/components/StackedTaskList.js +9 -9
  107. package/dist/tui/components/StackedTaskList.js.map +1 -1
  108. package/dist/tui/components/TaskCard.d.ts +2 -1
  109. package/dist/tui/components/TaskCard.d.ts.map +1 -1
  110. package/dist/tui/components/TaskCard.js +41 -5
  111. package/dist/tui/components/TaskCard.js.map +1 -1
  112. package/dist/tui/components/TaskCardMeasure.d.ts +2 -16
  113. package/dist/tui/components/TaskCardMeasure.d.ts.map +1 -1
  114. package/dist/tui/components/TaskCardMeasure.js +30 -25
  115. package/dist/tui/components/TaskCardMeasure.js.map +1 -1
  116. package/dist/tui/components/TaskDetail.d.ts +2 -3
  117. package/dist/tui/components/TaskDetail.d.ts.map +1 -1
  118. package/dist/tui/components/TaskDetail.js +35 -12
  119. package/dist/tui/components/TaskDetail.js.map +1 -1
  120. package/dist/tui/components/TaskList.d.ts +2 -1
  121. package/dist/tui/components/TaskList.d.ts.map +1 -1
  122. package/dist/tui/components/TaskList.js +5 -5
  123. package/dist/tui/components/TaskList.js.map +1 -1
  124. package/dist/tui/components/index.d.ts +2 -2
  125. package/dist/tui/components/index.d.ts.map +1 -1
  126. package/dist/tui/components/index.js +3 -3
  127. package/dist/tui/components/index.js.map +1 -1
  128. package/dist/tui/hooks/useBrainfileLoader.d.ts.map +1 -1
  129. package/dist/tui/hooks/useBrainfileLoader.js +97 -31
  130. package/dist/tui/hooks/useBrainfileLoader.js.map +1 -1
  131. package/dist/tui/hooks/useKeyboardNavigation.d.ts.map +1 -1
  132. package/dist/tui/hooks/useKeyboardNavigation.js +47 -47
  133. package/dist/tui/hooks/useKeyboardNavigation.js.map +1 -1
  134. package/dist/tui/types.d.ts +7 -7
  135. package/dist/tui/types.d.ts.map +1 -1
  136. package/dist/utils/board-types.d.ts +13 -0
  137. package/dist/utils/board-types.d.ts.map +1 -0
  138. package/dist/utils/board-types.js +7 -0
  139. package/dist/utils/board-types.js.map +1 -0
  140. package/dist/utils/dot-brainfile.d.ts +9 -0
  141. package/dist/utils/dot-brainfile.d.ts.map +1 -0
  142. package/dist/utils/dot-brainfile.js +74 -0
  143. package/dist/utils/dot-brainfile.js.map +1 -0
  144. package/dist/utils/strict-validation.d.ts +8 -0
  145. package/dist/utils/strict-validation.d.ts.map +1 -0
  146. package/dist/utils/strict-validation.js +41 -0
  147. package/dist/utils/strict-validation.js.map +1 -0
  148. package/dist/utils/v2-detect.d.ts +28 -0
  149. package/dist/utils/v2-detect.d.ts.map +1 -0
  150. package/dist/utils/v2-detect.js +109 -0
  151. package/dist/utils/v2-detect.js.map +1 -0
  152. package/dist/utils/v2-tasks.d.ts +121 -0
  153. package/dist/utils/v2-tasks.d.ts.map +1 -0
  154. package/dist/utils/v2-tasks.js +384 -0
  155. package/dist/utils/v2-tasks.js.map +1 -0
  156. package/package.json +5 -4
  157. package/state.json +3 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,50 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.14.0] - 2026-02-18
11
+
12
+ ### Added
13
+ - **Per-task file architecture (v2)** - Tasks are now individual `.md` files instead of embedded YAML
14
+ - `brainfile init` creates v2 structure: `brainfile.md` (config), `tasks/`, `logs/`, `state.json`
15
+ - `brainfile migrate --v2` converts v1 boards to v2 per-task files (creates `.v1.bak` backup)
16
+ - All existing commands auto-detect v1 vs v2 and handle both transparently
17
+ - **`brainfile complete`** - Move task from `tasks/` to `logs/` with `completedAt` timestamp
18
+ - Strips `column` and `position` fields from completed task
19
+ - `complete_task` MCP tool for parity
20
+ - **`brainfile log`** - View and manage task history
21
+ - `brainfile log -t <id>` - View a completed task's log
22
+ - `brainfile log --search <query>` - Search across all completed task logs
23
+ - `brainfile log --recent` - List recently completed tasks
24
+ - `brainfile log note -t <id> "<message>"` - Append timestamped entry to any task's `## Log` section
25
+ - `search_logs` and `append_log` MCP tools for parity
26
+ - **`brainfile search`** - Search across active tasks and completed logs with relevance scoring
27
+ - `search_tasks` MCP tool updated for v2
28
+
29
+ ### Changed
30
+ - **All MCP tools have v2 support** - 29 tools detect v1/v2 and handle per-task files correctly
31
+ - Uses `@brainfile/core` as single source of truth for all task I/O operations
32
+ - CLI is a thin wrapper over core (no duplicated parsing/serialization logic)
33
+ - **`brainfile init` defaults to v2** - Creates per-task file directory structure
34
+ - Upgraded to @brainfile/core@^0.11.0
35
+
36
+ ## [0.13.3] - 2026-01-01
37
+
38
+ ### Added
39
+ - **`brainfile schema` command** - View and manage brainfile schemas
40
+ - `brainfile schema` - List available schemas (board, base)
41
+ - `brainfile schema <name>` - Display specific schema as JSON
42
+ - `brainfile schema update` - Check for schema updates from protocol repo
43
+ - Schemas bundled with CLI package (no network for basic usage)
44
+ - 24-hour auto-check for updates with non-blocking notification
45
+ - `--json` flag for programmatic output
46
+ - **`brainfile rules` command** - Manage project rules
47
+ - `brainfile rules` - List all rules by category
48
+ - `brainfile rules add <category> "rule text"` - Add a rule
49
+ - `brainfile rules delete <category> <id>` - Delete a rule by ID
50
+ - Categories: `always`, `never`, `prefer`, `context`
51
+ - `--json` flag for programmatic output
52
+ - **MCP tools for rules** - `list_rules`, `add_rule`, `delete_rule`
53
+
10
54
  ## [0.13.2] - 2026-01-01
11
55
 
12
56
  ### Fixed
package/README.md CHANGED
@@ -1,372 +1,205 @@
1
- <p align="center">
2
- <img src="https://raw.githubusercontent.com/brainfile/cli/main/logo.png" alt="Brainfile Logo" width="128" height="128">
3
- </p>
4
-
5
1
  # @brainfile/cli
6
2
 
7
- **Task management for your terminal.** A full kanban board that lives in a markdown file.
8
-
9
- - Modern, borderless TUI optimized for information density
10
- - Vim-style navigation with intuitive keybindings
11
- - CLI commands for scripting and automation
12
- - MCP server for AI assistant integration
13
-
14
- ## Installation
3
+ **The official CLI for Brainfile.** Manage tasks, contracts, and ADRs directly from your terminal.
15
4
 
16
- ```bash
17
- npm install -g @brainfile/cli
18
- ```
5
+ Designed for developers who want a local-first, file-based task management system that plays nicely with AI agents.
19
6
 
20
- Verify installation:
7
+ ## Install
21
8
 
22
9
  ```bash
23
- brainfile --version
10
+ npm i -g @brainfile/cli
24
11
  ```
25
12
 
26
13
  ## Quick Start
27
14
 
15
+ Initialize a new brainfile in your project root:
16
+
28
17
  ```bash
29
- # Initialize a new brainfile
30
18
  brainfile init
31
-
32
- # Launch interactive TUI
33
- brainfile
34
-
35
- # Or use CLI commands
36
- brainfile list # List all tasks
37
- brainfile add --title "My task" --column todo # Add a task
38
- brainfile move --task task-1 --column done # Move a task
39
19
  ```
40
20
 
41
- ## Commands
21
+ This creates the standard v2 structure:
22
+ - `.brainfile/brainfile.md` (Configuration, rules, definitions)
23
+ - `.brainfile/board/` (Active tasks)
24
+ - `.brainfile/logs/` (Completed tasks)
25
+
26
+ The board comes pre-configured with `To Do` and `In Progress` columns.
42
27
 
43
- ### Terminal UI (TUI)
28
+ ## Core Workflow
44
29
 
45
- Launch an interactive task board:
30
+ ### Add Tasks
31
+ Create new tasks with rich metadata.
46
32
 
47
33
  ```bash
48
- brainfile # Auto-detect (prefers .brainfile/brainfile.md)
49
- brainfile ./path/to/file.md # Open specific file
50
- ```
34
+ # Basic task
35
+ brainfile add --title "Implement login" --column todo
51
36
 
52
- **Task Card Layout:**
53
- ```
54
- CRIT Implement user authentication flow
55
- [1/5] · Nov 30 · #auth #security task-39
37
+ # Full featured task
38
+ brainfile add \
39
+ --title "Refactor database layer" \
40
+ --type task \
41
+ --column todo \
42
+ --priority high \
43
+ --assignee @josh \
44
+ --tags "refactor,db" \
45
+ --parent epic-123
56
46
 
57
- HIGH Dashboard performance optimization
58
- [0/4] · Dec 4 · #performance #frontend task-40
47
+ # Create a parent with children in one shot
48
+ brainfile add -c todo -t "Auth overhaul" \
49
+ --child "OAuth flow" --child "Session hardening"
59
50
  ```
60
51
 
61
- - `▌` indicator shows selected task
62
- - Priority badge (CRIT/HIGH/MED/LOW) leads each row
63
- - `[X/Y]` shows subtask progress
64
- - Due dates with urgency coloring (red if overdue, yellow if soon)
65
- - Tags and task ID complete the metadata row
66
-
67
- **Panel Navigation:**
68
- | Key | Action |
69
- |-----|--------|
70
- | `1` | Switch to Tasks panel |
71
- | `2` | Switch to Rules panel |
72
- | `3` | Switch to Archive panel |
73
- | `?` | Show help |
74
- | `q` | Quit |
75
-
76
- **Tasks Panel:**
77
- | Key | Action |
78
- |-----|--------|
79
- | `TAB` / `Shift+TAB` | Navigate columns |
80
- | `j`/`k` or `↑`/`↓` | Navigate tasks |
81
- | `h`/`l` or `←`/`→` | Switch columns |
82
- | `g`/`G` | Jump to top/bottom |
83
- | `Enter` | Expand/collapse task |
84
- | `/` | Search tasks |
85
- | `r` | Refresh |
86
-
87
- **Search Filters:**
88
- | Filter | Example | Description |
89
- |--------|---------|-------------|
90
- | Priority | `p:high` | Filter by priority |
91
- | Tag | `#bug` or `t:feature` | Filter by tag |
92
- | Assignee | `@john` | Filter by assignee |
93
- | Due date | `due:week` | `overdue`, `today`, `week`, `month` |
94
-
95
- Combine filters with text: `p:high #bug login issue`
96
-
97
- **Task Management:**
98
- | Key | Action |
99
- |-----|--------|
100
- | `e` | Edit task in $EDITOR |
101
- | `m` | Move task to column |
102
- | `d` | Delete task |
103
- | `n` | Quick add new task |
104
- | `N` | New task in $EDITOR |
105
- | `p` | Cycle priority |
106
- | `t` | Toggle subtask |
107
- | `A` | Archive task |
108
- | `y` | Copy task ID |
109
-
110
- **Rules Panel:**
111
- | Key | Action |
112
- |-----|--------|
113
- | `TAB` / `Shift+TAB` | Switch rule type |
114
- | `h`/`l` | Switch rule type (always/never/prefer/context) |
115
- | `j`/`k` | Navigate rules |
116
- | `n` | Add new rule |
117
- | `e` | Edit selected rule |
118
- | `d` | Delete selected rule |
119
-
120
- **Archive Panel:**
121
- | Key | Action |
122
- |-----|--------|
123
- | `j`/`k` | Navigate archived tasks |
124
- | `Enter` | Expand/collapse task |
125
- | `R` | Restore task to column |
126
- | `d` | Permanently delete task |
127
- | `r` | Refresh archive |
128
-
129
- ---
130
-
131
- ### list
52
+ **Key Flags:**
53
+ - `--title, -t`: Task summary
54
+ - `--type`: `task`, `epic`, or `adr` (default: `task`)
55
+ - `--column, -c`: Target column ID
56
+ - `--parent`: Parent task/epic ID
57
+ - `--child`: Create child task(s) under the new parent (repeatable)
58
+ - `--priority, -p`: `low`, `medium`, `high`, `critical`
59
+ - `--tags`: Comma-separated list
132
60
 
133
- List all tasks with optional filtering:
61
+ ### List Tasks
62
+ View your board from the command line.
134
63
 
135
64
  ```bash
136
- brainfile list
137
- brainfile list --column "In Progress"
138
- brainfile list --tag bug
65
+ brainfile list # View all active tasks
66
+ brainfile list --column todo # Filter by column
67
+ brainfile list --tag bug # Filter by tag
68
+ brainfile list --parent epic-123 # See all children of an epic
69
+ brainfile list --contract ready # See tasks with contracts waiting for pickup
139
70
  ```
140
71
 
141
- **Options:**
142
- - `-f, --file <path>` - Brainfile path (default: `brainfile.md`)
143
- - `-c, --column <name>` - Filter by column
144
- - `-t, --tag <name>` - Filter by tag
145
-
146
- ---
147
-
148
- ### show
149
-
150
- Show full details of a single task:
72
+ ### Manage Tasks
73
+ Manipulate tasks as you work.
151
74
 
152
75
  ```bash
153
- brainfile show --task task-1
154
- brainfile show -t task-1 --file ./brainfile.md
155
- ```
76
+ # View details
77
+ brainfile show -t task-10
156
78
 
157
- **Options:**
158
- - `-f, --file <path>` - Brainfile path (default: `brainfile.md`)
159
- - `-t, --task <id>` - Task ID (required)
79
+ # Move to another column
80
+ brainfile move -t task-10 -c in-progress
160
81
 
161
- ---
82
+ # Update fields
83
+ brainfile patch -t task-10 --priority critical --tags "frontend,urgent"
162
84
 
163
- ### add
85
+ # Clear fields
86
+ brainfile patch -t task-10 --clear-tags --clear-assignee
164
87
 
165
- Create a new task:
166
-
167
- ```bash
168
- brainfile add --title "Implement auth" --column todo
169
- brainfile add --title "Fix bug" --priority high --tags "bug,urgent"
170
- brainfile add --title "Review PR" --assignee john --due-date 2025-02-01
88
+ # Delete (permanently)
89
+ brainfile delete -t task-10
171
90
  ```
172
91
 
173
- **Options:**
174
- - `-t, --title <text>` - Task title (required)
175
- - `-c, --column <name>` - Target column (default: `todo`)
176
- - `-d, --description <text>` - Task description
177
- - `-p, --priority <level>` - `low`, `medium`, `high`, or `critical`
178
- - `--tags <list>` - Comma-separated tags
179
- - `--assignee <name>` - Assignee name
180
- - `--due-date <date>` - Due date (YYYY-MM-DD)
181
- - `--subtasks <list>` - Comma-separated subtask titles
182
-
183
- ---
184
-
185
- ### move
186
-
187
- Move a task to a different column:
92
+ ### Complete
93
+ When a task is done, move it to the archive.
188
94
 
189
95
  ```bash
190
- brainfile move --task task-1 --column "In Progress"
191
- brainfile move --task task-5 --column done
96
+ brainfile complete -t task-10
192
97
  ```
98
+ This moves the file from `.brainfile/board/` to `.brainfile/logs/`, preserving its history forever.
193
99
 
194
- **Options:**
195
- - `-t, --task <id>` - Task ID (required)
196
- - `-c, --column <name>` - Target column (required)
197
-
198
- ---
100
+ ## Types
199
101
 
200
- ### patch
201
-
202
- Update specific fields of a task:
102
+ Brainfile supports different document types.
203
103
 
204
104
  ```bash
205
- brainfile patch --task task-1 --priority critical
206
- brainfile patch --task task-1 --title "Updated title" --tags "new,tags"
207
- brainfile patch --task task-1 --clear-assignee # Remove assignee
105
+ brainfile types list # See available types (task, epic, adr)
106
+ brainfile types add # (Coming soon: define custom types)
208
107
  ```
209
108
 
210
- **Options:**
211
- - `-t, --task <id>` - Task ID (required)
212
- - `--title <text>` - New title
213
- - `--description <text>` - New description
214
- - `--priority <level>` - New priority
215
- - `--tags <list>` - New tags (comma-separated)
216
- - `--assignee <name>` - New assignee
217
- - `--due-date <date>` - New due date
218
- - `--clear-description` - Remove description
219
- - `--clear-priority` - Remove priority
220
- - `--clear-tags` - Remove tags
221
- - `--clear-assignee` - Remove assignee
222
- - `--clear-due-date` - Remove due date
223
-
224
- ---
109
+ ## Contracts: Working with AI Agents
225
110
 
226
- ### delete
111
+ Contracts allow you to define explicit deliverables and validation rules for AI agents.
227
112
 
228
- Permanently delete a task:
113
+ ### 1. Create a Contract
114
+ Add a task with a contract definition.
229
115
 
230
116
  ```bash
231
- brainfile delete --task task-1 --force
117
+ brainfile add -c todo -t "Optimize image loader" \
118
+ --with-contract \
119
+ --deliverable "file:src/utils/loader.ts:Optimized implementation" \
120
+ --validation "npm test -- loader" \
121
+ --constraint "Must use lazy loading"
232
122
  ```
233
123
 
234
- **Options:**
235
- - `-t, --task <id>` - Task ID (required)
236
- - `--force` - Confirm deletion (required)
237
-
238
- ---
239
-
240
- ### archive
241
-
242
- Move a task to the archive:
124
+ ### 2. Pickup (Agent)
125
+ The agent claims the task.
243
126
 
244
127
  ```bash
245
- brainfile archive --task task-1
128
+ brainfile contract pickup -t task-45
246
129
  ```
130
+ Status changes to `in_progress`. Metrics tracking begins.
247
131
 
248
- ---
249
-
250
- ### restore
251
-
252
- Restore a task from the archive:
132
+ ### 3. Deliver (Agent)
133
+ The agent marks work as ready for review.
253
134
 
254
135
  ```bash
255
- brainfile restore --task task-1 --column todo
136
+ brainfile contract deliver -t task-45
256
137
  ```
138
+ Status changes to `delivered`.
257
139
 
258
- **Options:**
259
- - `-t, --task <id>` - Task ID (required)
260
- - `-c, --column <name>` - Target column (required)
261
-
262
- ---
263
-
264
- ### subtask
265
-
266
- Manage subtasks:
140
+ ### 4. Validate (User)
141
+ Run the validation commands automatically.
267
142
 
268
143
  ```bash
269
- brainfile subtask --task task-1 --add "New subtask"
270
- brainfile subtask --task task-1 --toggle task-1-1
271
- brainfile subtask --task task-1 --update task-1-1 --title "Updated"
272
- brainfile subtask --task task-1 --delete task-1-2
144
+ brainfile contract validate -t task-45
273
145
  ```
146
+ - **Pass**: Task is marked `done`.
147
+ - **Fail**: Task status reverts to `ready` (or `failed`) for rework.
274
148
 
275
- **Options:**
276
- - `-t, --task <id>` - Parent task ID (required)
277
- - `--add <title>` - Add a new subtask
278
- - `--toggle <id>` - Toggle subtask completion
279
- - `--update <id>` - Update subtask (use with `--title`)
280
- - `--delete <id>` - Delete a subtask
281
- - `--title <text>` - New title (for `--update`)
282
-
283
- ---
284
-
285
- ### lint
149
+ ## ADR Promotion
286
150
 
287
- Validate and auto-fix brainfile syntax:
151
+ Architecture Decision Records (ADRs) are first-class citizens. You can promote an accepted ADR to a global rule that agents must follow.
288
152
 
289
153
  ```bash
290
- brainfile lint # Check for issues
291
- brainfile lint --fix # Auto-fix issues
292
- brainfile lint --check # Exit with error code (for CI)
293
- ```
294
-
295
- **What it checks:**
296
- - YAML syntax errors
297
- - Unquoted strings with colons (auto-fixable)
298
- - Duplicate column IDs
299
- - Missing required fields
300
-
301
- ---
154
+ # 1. Create an ADR
155
+ brainfile add -t "Use Postgres for all user data" --type adr -c proposed
302
156
 
303
- ### template
157
+ # 2. Accept it (move to accepted column)
158
+ brainfile move -t adr-1 -c accepted
304
159
 
305
- Create tasks from templates:
306
-
307
- ```bash
308
- brainfile template --list
309
- brainfile template --use bug-report --title "Login fails"
310
- brainfile template --use feature-request --title "Dark mode"
160
+ # 3. Promote to a rule
161
+ brainfile adr promote -t adr-1 --category always
311
162
  ```
312
163
 
313
- **Built-in Templates:**
314
- - `bug-report` - Bug tracking with triage steps
315
- - `feature-request` - Feature proposals
316
- - `refactor` - Code refactoring tasks
164
+ **Categories:**
165
+ - `always`: Strict rules (e.g., "Always use TypeScript")
166
+ - `never`: Prohibitions (e.g., "Never commit secrets")
167
+ - `prefer`: Guidelines (e.g., "Prefer functional components")
168
+ - `context`: informational context
317
169
 
318
- ---
170
+ Promoted rules are added to `.brainfile/brainfile.md` and injected into agent prompts.
319
171
 
320
- ### hooks
172
+ ## TUI (Terminal UI)
321
173
 
322
- Integrate with AI coding assistants:
174
+ Launch the interactive board:
323
175
 
324
176
  ```bash
325
- brainfile hooks install claude-code
326
- brainfile hooks install cursor --scope project
327
- brainfile hooks install cline
328
- brainfile hooks list
329
- brainfile hooks uninstall claude-code --scope all
177
+ brainfile # No arguments launches the TUI
178
+ brainfile tui # Explicit subcommand also works
330
179
  ```
331
180
 
332
- **Supported Assistants:**
333
- - Claude Code
334
- - Cursor
335
- - Cline
336
-
337
- Hooks provide automatic reminders to update task status during AI-assisted development.
338
-
339
- ---
340
-
341
- ### mcp
342
-
343
- Start an MCP (Model Context Protocol) server for AI assistant integration:
344
-
345
- ```bash
346
- brainfile mcp
347
- brainfile mcp --file ./project/brainfile.md
348
- ```
181
+ ### Panels
182
+ - **Board (`1`)**: Kanban view of active tasks.
183
+ - **Logs (`2`)**: List of completed tasks.
184
+ - **Rules (`3`)**: Active rules and configuration.
349
185
 
350
- The MCP server exposes all brainfile operations as tools that AI assistants can use directly.
186
+ ### Keyboard Shortcuts
187
+ | Key | Action |
188
+ |-----|--------|
189
+ | `tab` | Next column |
190
+ | `j` / `k` | Down / Up |
191
+ | `enter` | View task details |
192
+ | `n` | New task |
193
+ | `m` | Move task |
194
+ | `e` | Edit task (in $EDITOR) |
195
+ | `/` | Search |
196
+ | `q` | Quit |
351
197
 
352
- **Available MCP Tools:**
353
- | Tool | Description |
354
- |------|-------------|
355
- | `list_tasks` | List tasks with optional filtering |
356
- | `add_task` | Create a new task |
357
- | `move_task` | Move task between columns |
358
- | `patch_task` | Update task fields |
359
- | `delete_task` | Permanently delete a task |
360
- | `archive_task` | Archive a task |
361
- | `restore_task` | Restore from archive |
362
- | `add_subtask` | Add a subtask |
363
- | `delete_subtask` | Delete a subtask |
364
- | `toggle_subtask` | Toggle subtask completion |
365
- | `update_subtask` | Update subtask title |
198
+ ## AI Integration
366
199
 
367
- **Configuration for Claude Code:**
200
+ The CLI includes an MCP (Model Context Protocol) server.
368
201
 
369
- Add to your MCP settings (`.mcp.json` or Claude Code config):
202
+ Add to your `claude_desktop_config.json`:
370
203
 
371
204
  ```json
372
205
  {
@@ -379,72 +212,4 @@ Add to your MCP settings (`.mcp.json` or Claude Code config):
379
212
  }
380
213
  ```
381
214
 
382
- Or with a specific file:
383
-
384
- ```json
385
- {
386
- "mcpServers": {
387
- "brainfile": {
388
- "command": "npx",
389
- "args": ["@brainfile/cli", "mcp", "-f", "path/to/brainfile.md"]
390
- }
391
- }
392
- }
393
- ```
394
-
395
- ---
396
-
397
- ### init
398
-
399
- Create a new brainfile:
400
-
401
- ```bash
402
- brainfile init
403
- brainfile init --file ./project/tasks.md # Custom location (optional)
404
- brainfile init --force # Overwrite existing
405
- ```
406
-
407
- ### migrate
408
-
409
- Move a legacy root `brainfile.md` into the preferred `.brainfile/` directory:
410
-
411
- ```bash
412
- brainfile migrate
413
- brainfile migrate --force
414
- ```
415
-
416
- ## Output Colors
417
-
418
- The CLI uses colors to highlight information:
419
-
420
- | Element | Color |
421
- |---------|-------|
422
- | Task IDs | Gray |
423
- | Titles | White |
424
- | Critical Priority | Red (bold) |
425
- | High Priority | Red |
426
- | Medium Priority | Yellow |
427
- | Low Priority | Blue |
428
- | Tags | Cyan |
429
- | Completed | Green |
430
-
431
- ## Package Information
432
-
433
- - **npm**: https://www.npmjs.com/package/@brainfile/cli
434
- - **GitHub**: https://github.com/brainfile/cli
435
- - **Core Library**: [@brainfile/core](https://www.npmjs.com/package/@brainfile/core)
436
- - **Protocol**: https://brainfile.md
437
-
438
- ## Development
439
-
440
- ```bash
441
- git clone https://github.com/brainfile/cli.git
442
- cd cli
443
- npm install
444
- npm run build
445
- npm test
446
- ```
447
-
448
- ## License
449
-
450
- MIT
215
+ This gives Claude (and other MCP clients) full access to read your board, create tasks, and manage contracts.