brainfile 0.18.0 → 0.19.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 (245) hide show
  1. package/README.md +4 -4
  2. package/dist/__tests__/helpers/mcp.d.ts +34 -0
  3. package/dist/__tests__/helpers/mcp.d.ts.map +1 -0
  4. package/dist/__tests__/helpers/mcp.js +37 -0
  5. package/dist/__tests__/helpers/mcp.js.map +1 -0
  6. package/dist/chunk-I5SJHUZK.mjs +52 -0
  7. package/dist/chunk-YTFLC673.mjs +12089 -0
  8. package/dist/cli.js +8 -479
  9. package/dist/cli.mjs +41194 -0
  10. package/dist/commands/add.d.ts.map +1 -1
  11. package/dist/commands/add.js +28 -37
  12. package/dist/commands/add.js.map +1 -1
  13. package/dist/commands/archive.d.ts +3 -2
  14. package/dist/commands/archive.d.ts.map +1 -1
  15. package/dist/commands/archive.js +16 -205
  16. package/dist/commands/archive.js.map +1 -1
  17. package/dist/commands/complete.d.ts +0 -4
  18. package/dist/commands/complete.d.ts.map +1 -1
  19. package/dist/commands/complete.js +14 -168
  20. package/dist/commands/complete.js.map +1 -1
  21. package/dist/commands/contract.d.ts.map +1 -1
  22. package/dist/commands/contract.js +66 -331
  23. package/dist/commands/contract.js.map +1 -1
  24. package/dist/commands/delete.d.ts.map +1 -1
  25. package/dist/commands/delete.js +13 -55
  26. package/dist/commands/delete.js.map +1 -1
  27. package/dist/commands/init.d.ts.map +1 -1
  28. package/dist/commands/init.js +3 -2
  29. package/dist/commands/init.js.map +1 -1
  30. package/dist/commands/list.d.ts.map +1 -1
  31. package/dist/commands/list.js +3 -54
  32. package/dist/commands/list.js.map +1 -1
  33. package/dist/commands/log.js +2 -8
  34. package/dist/commands/log.js.map +1 -1
  35. package/dist/commands/mcp.d.ts.map +1 -1
  36. package/dist/commands/mcp.js +22 -17
  37. package/dist/commands/mcp.js.map +1 -1
  38. package/dist/commands/migrate.d.ts.map +1 -1
  39. package/dist/commands/migrate.js +4 -3
  40. package/dist/commands/migrate.js.map +1 -1
  41. package/dist/commands/move.d.ts.map +1 -1
  42. package/dist/commands/move.js +31 -126
  43. package/dist/commands/move.js.map +1 -1
  44. package/dist/commands/patch.d.ts.map +1 -1
  45. package/dist/commands/patch.js +22 -92
  46. package/dist/commands/patch.js.map +1 -1
  47. package/dist/commands/plan.d.ts +61 -0
  48. package/dist/commands/plan.d.ts.map +1 -0
  49. package/dist/commands/plan.js +205 -0
  50. package/dist/commands/plan.js.map +1 -0
  51. package/dist/commands/search.d.ts.map +1 -1
  52. package/dist/commands/search.js +20 -146
  53. package/dist/commands/search.js.map +1 -1
  54. package/dist/commands/show.d.ts.map +1 -1
  55. package/dist/commands/show.js +5 -126
  56. package/dist/commands/show.js.map +1 -1
  57. package/dist/commands/subtask.d.ts.map +1 -1
  58. package/dist/commands/subtask.js +19 -135
  59. package/dist/commands/subtask.js.map +1 -1
  60. package/dist/commands/types.d.ts +2 -2
  61. package/dist/commands/types.d.ts.map +1 -1
  62. package/dist/commands/types.js +8 -30
  63. package/dist/commands/types.js.map +1 -1
  64. package/dist/devtools-NE5M3KPM.mjs +92 -0
  65. package/dist/lib/contractRunner.d.ts.map +1 -1
  66. package/dist/lib/contractRunner.js +19 -205
  67. package/dist/lib/contractRunner.js.map +1 -1
  68. package/dist/mcp/helpers.d.ts +11 -16
  69. package/dist/mcp/helpers.d.ts.map +1 -1
  70. package/dist/mcp/helpers.js +9 -46
  71. package/dist/mcp/helpers.js.map +1 -1
  72. package/dist/mcp/tools/contract_tool.d.ts +1 -1
  73. package/dist/mcp/tools/contract_tool.d.ts.map +1 -1
  74. package/dist/mcp/tools/contract_tool.js +23 -175
  75. package/dist/mcp/tools/contract_tool.js.map +1 -1
  76. package/dist/mcp/tools/get_task_tool.d.ts +1 -1
  77. package/dist/mcp/tools/get_task_tool.d.ts.map +1 -1
  78. package/dist/mcp/tools/get_task_tool.js +15 -34
  79. package/dist/mcp/tools/get_task_tool.js.map +1 -1
  80. package/dist/mcp/tools/list_tasks_tool.d.ts +1 -1
  81. package/dist/mcp/tools/list_tasks_tool.d.ts.map +1 -1
  82. package/dist/mcp/tools/list_tasks_tool.js +11 -48
  83. package/dist/mcp/tools/list_tasks_tool.js.map +1 -1
  84. package/dist/mcp/tools/search_tool.d.ts +1 -1
  85. package/dist/mcp/tools/search_tool.d.ts.map +1 -1
  86. package/dist/mcp/tools/search_tool.js +17 -98
  87. package/dist/mcp/tools/search_tool.js.map +1 -1
  88. package/dist/mcp/tools/subtask_tool.d.ts +1 -1
  89. package/dist/mcp/tools/subtask_tool.d.ts.map +1 -1
  90. package/dist/mcp/tools/subtask_tool.js +49 -224
  91. package/dist/mcp/tools/subtask_tool.js.map +1 -1
  92. package/dist/mcp/tools/task_add_tool.d.ts +1 -1
  93. package/dist/mcp/tools/task_add_tool.d.ts.map +1 -1
  94. package/dist/mcp/tools/task_add_tool.js +58 -154
  95. package/dist/mcp/tools/task_add_tool.js.map +1 -1
  96. package/dist/mcp/tools/task_complete_tool.d.ts +1 -1
  97. package/dist/mcp/tools/task_complete_tool.d.ts.map +1 -1
  98. package/dist/mcp/tools/task_complete_tool.js +28 -124
  99. package/dist/mcp/tools/task_complete_tool.js.map +1 -1
  100. package/dist/mcp/tools/task_delete_tool.d.ts +1 -1
  101. package/dist/mcp/tools/task_delete_tool.d.ts.map +1 -1
  102. package/dist/mcp/tools/task_delete_tool.js +14 -33
  103. package/dist/mcp/tools/task_delete_tool.js.map +1 -1
  104. package/dist/mcp/tools/task_move_tool.d.ts +1 -1
  105. package/dist/mcp/tools/task_move_tool.d.ts.map +1 -1
  106. package/dist/mcp/tools/task_move_tool.js +44 -150
  107. package/dist/mcp/tools/task_move_tool.js.map +1 -1
  108. package/dist/mcp/tools/task_patch_tool.d.ts +1 -1
  109. package/dist/mcp/tools/task_patch_tool.d.ts.map +1 -1
  110. package/dist/mcp/tools/task_patch_tool.js +37 -113
  111. package/dist/mcp/tools/task_patch_tool.js.map +1 -1
  112. package/dist/open-ZGSQIGEH.mjs +542 -0
  113. package/dist/tui-P56H4X7N.mjs +23715 -0
  114. package/dist/utils/dot-brainfile.d.ts +0 -4
  115. package/dist/utils/dot-brainfile.d.ts.map +1 -1
  116. package/dist/utils/dot-brainfile.js +0 -17
  117. package/dist/utils/dot-brainfile.js.map +1 -1
  118. package/dist/utils/errorHandler.d.ts +7 -11
  119. package/dist/utils/errorHandler.d.ts.map +1 -1
  120. package/dist/utils/errorHandler.js +8 -19
  121. package/dist/utils/errorHandler.js.map +1 -1
  122. package/package.json +24 -16
  123. package/dist/cli.d.ts +0 -3
  124. package/dist/cli.d.ts.map +0 -1
  125. package/dist/cli.js.map +0 -1
  126. package/dist/commands/tui.d.ts +0 -6
  127. package/dist/commands/tui.d.ts.map +0 -1
  128. package/dist/commands/tui.js +0 -79
  129. package/dist/commands/tui.js.map +0 -1
  130. package/dist/tui/BrainfileTUI.d.ts +0 -4
  131. package/dist/tui/BrainfileTUI.d.ts.map +0 -1
  132. package/dist/tui/BrainfileTUI.js +0 -272
  133. package/dist/tui/BrainfileTUI.js.map +0 -1
  134. package/dist/tui/actions.d.ts +0 -84
  135. package/dist/tui/actions.d.ts.map +0 -1
  136. package/dist/tui/actions.js +0 -1251
  137. package/dist/tui/actions.js.map +0 -1
  138. package/dist/tui/components/ColumnTabs.d.ts +0 -9
  139. package/dist/tui/components/ColumnTabs.d.ts.map +0 -1
  140. package/dist/tui/components/ColumnTabs.js +0 -34
  141. package/dist/tui/components/ColumnTabs.js.map +0 -1
  142. package/dist/tui/components/Header.d.ts +0 -15
  143. package/dist/tui/components/Header.d.ts.map +0 -1
  144. package/dist/tui/components/Header.js +0 -48
  145. package/dist/tui/components/Header.js.map +0 -1
  146. package/dist/tui/components/HelpOverlay.d.ts +0 -9
  147. package/dist/tui/components/HelpOverlay.d.ts.map +0 -1
  148. package/dist/tui/components/HelpOverlay.js +0 -116
  149. package/dist/tui/components/HelpOverlay.js.map +0 -1
  150. package/dist/tui/components/LogsPanel.d.ts +0 -16
  151. package/dist/tui/components/LogsPanel.d.ts.map +0 -1
  152. package/dist/tui/components/LogsPanel.js +0 -115
  153. package/dist/tui/components/LogsPanel.js.map +0 -1
  154. package/dist/tui/components/MainPanelTabs.d.ts +0 -10
  155. package/dist/tui/components/MainPanelTabs.d.ts.map +0 -1
  156. package/dist/tui/components/MainPanelTabs.js +0 -56
  157. package/dist/tui/components/MainPanelTabs.js.map +0 -1
  158. package/dist/tui/components/ManualBorder.d.ts +0 -42
  159. package/dist/tui/components/ManualBorder.d.ts.map +0 -1
  160. package/dist/tui/components/ManualBorder.js +0 -56
  161. package/dist/tui/components/ManualBorder.js.map +0 -1
  162. package/dist/tui/components/Overlays.d.ts +0 -41
  163. package/dist/tui/components/Overlays.d.ts.map +0 -1
  164. package/dist/tui/components/Overlays.js +0 -127
  165. package/dist/tui/components/Overlays.js.map +0 -1
  166. package/dist/tui/components/ProgressBar.d.ts +0 -8
  167. package/dist/tui/components/ProgressBar.d.ts.map +0 -1
  168. package/dist/tui/components/ProgressBar.js +0 -35
  169. package/dist/tui/components/ProgressBar.js.map +0 -1
  170. package/dist/tui/components/RulesPanel.d.ts +0 -25
  171. package/dist/tui/components/RulesPanel.d.ts.map +0 -1
  172. package/dist/tui/components/RulesPanel.js +0 -139
  173. package/dist/tui/components/RulesPanel.js.map +0 -1
  174. package/dist/tui/components/SearchBar.d.ts +0 -8
  175. package/dist/tui/components/SearchBar.d.ts.map +0 -1
  176. package/dist/tui/components/SearchBar.js +0 -38
  177. package/dist/tui/components/SearchBar.js.map +0 -1
  178. package/dist/tui/components/StackedTaskList.d.ts +0 -27
  179. package/dist/tui/components/StackedTaskList.d.ts.map +0 -1
  180. package/dist/tui/components/StackedTaskList.js +0 -120
  181. package/dist/tui/components/StackedTaskList.js.map +0 -1
  182. package/dist/tui/components/StatusBar.d.ts +0 -14
  183. package/dist/tui/components/StatusBar.d.ts.map +0 -1
  184. package/dist/tui/components/StatusBar.js +0 -42
  185. package/dist/tui/components/StatusBar.js.map +0 -1
  186. package/dist/tui/components/TaskCard.d.ts +0 -25
  187. package/dist/tui/components/TaskCard.d.ts.map +0 -1
  188. package/dist/tui/components/TaskCard.js +0 -221
  189. package/dist/tui/components/TaskCard.js.map +0 -1
  190. package/dist/tui/components/TaskCardMeasure.d.ts +0 -31
  191. package/dist/tui/components/TaskCardMeasure.d.ts.map +0 -1
  192. package/dist/tui/components/TaskCardMeasure.js +0 -133
  193. package/dist/tui/components/TaskCardMeasure.js.map +0 -1
  194. package/dist/tui/components/TaskDetail.d.ts +0 -13
  195. package/dist/tui/components/TaskDetail.d.ts.map +0 -1
  196. package/dist/tui/components/TaskDetail.js +0 -64
  197. package/dist/tui/components/TaskDetail.js.map +0 -1
  198. package/dist/tui/components/TaskList.d.ts +0 -12
  199. package/dist/tui/components/TaskList.d.ts.map +0 -1
  200. package/dist/tui/components/TaskList.js +0 -75
  201. package/dist/tui/components/TaskList.js.map +0 -1
  202. package/dist/tui/components/index.d.ts +0 -31
  203. package/dist/tui/components/index.d.ts.map +0 -1
  204. package/dist/tui/components/index.js +0 -43
  205. package/dist/tui/components/index.js.map +0 -1
  206. package/dist/tui/hooks/index.d.ts +0 -3
  207. package/dist/tui/hooks/index.d.ts.map +0 -1
  208. package/dist/tui/hooks/index.js +0 -8
  209. package/dist/tui/hooks/index.js.map +0 -1
  210. package/dist/tui/hooks/useBrainfileLoader.d.ts +0 -5
  211. package/dist/tui/hooks/useBrainfileLoader.d.ts.map +0 -1
  212. package/dist/tui/hooks/useBrainfileLoader.js +0 -237
  213. package/dist/tui/hooks/useBrainfileLoader.js.map +0 -1
  214. package/dist/tui/hooks/useKeyboardNavigation.d.ts +0 -20
  215. package/dist/tui/hooks/useKeyboardNavigation.d.ts.map +0 -1
  216. package/dist/tui/hooks/useKeyboardNavigation.js +0 -806
  217. package/dist/tui/hooks/useKeyboardNavigation.js.map +0 -1
  218. package/dist/tui/index.d.ts +0 -10
  219. package/dist/tui/index.d.ts.map +0 -1
  220. package/dist/tui/index.js +0 -38
  221. package/dist/tui/index.js.map +0 -1
  222. package/dist/tui/theme.d.ts +0 -119
  223. package/dist/tui/theme.d.ts.map +0 -1
  224. package/dist/tui/theme.js +0 -138
  225. package/dist/tui/theme.js.map +0 -1
  226. package/dist/tui/types.d.ts +0 -53
  227. package/dist/tui/types.d.ts.map +0 -1
  228. package/dist/tui/types.js +0 -12
  229. package/dist/tui/types.js.map +0 -1
  230. package/dist/tui/utils.d.ts +0 -24
  231. package/dist/tui/utils.d.ts.map +0 -1
  232. package/dist/tui/utils.js +0 -161
  233. package/dist/tui/utils.js.map +0 -1
  234. package/dist/utils/board-types.d.ts +0 -13
  235. package/dist/utils/board-types.d.ts.map +0 -1
  236. package/dist/utils/board-types.js +0 -7
  237. package/dist/utils/board-types.js.map +0 -1
  238. package/dist/utils/contractSpec.d.ts +0 -13
  239. package/dist/utils/contractSpec.d.ts.map +0 -1
  240. package/dist/utils/contractSpec.js +0 -61
  241. package/dist/utils/contractSpec.js.map +0 -1
  242. package/dist/utils/strict-validation.d.ts +0 -8
  243. package/dist/utils/strict-validation.d.ts.map +0 -1
  244. package/dist/utils/strict-validation.js +0 -41
  245. package/dist/utils/strict-validation.js.map +0 -1
package/dist/cli.js CHANGED
@@ -1,480 +1,9 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const commander_1 = require("commander");
5
- const fs_1 = require("fs");
6
- const path_1 = require("path");
7
- const list_1 = require("./commands/list");
8
- const show_1 = require("./commands/show");
9
- const add_1 = require("./commands/add");
10
- const move_1 = require("./commands/move");
11
- const template_1 = require("./commands/template");
12
- const lint_1 = require("./commands/lint");
13
- const init_1 = require("./commands/init");
14
- const migrate_1 = require("./commands/migrate");
15
- const tui_1 = require("./commands/tui");
16
- const patch_1 = require("./commands/patch");
17
- const delete_1 = require("./commands/delete");
18
- const archive_1 = require("./commands/archive");
19
- const restore_1 = require("./commands/restore");
20
- const complete_1 = require("./commands/complete");
21
- const log_1 = require("./commands/log");
22
- const search_1 = require("./commands/search");
23
- const auth_1 = require("./commands/auth");
24
- const subtask_1 = require("./commands/subtask");
25
- const mcp_1 = require("./commands/mcp");
26
- const contract_1 = require("./commands/contract");
27
- const hooks_1 = require("./commands/hooks");
28
- const config_1 = require("./commands/config");
29
- const schema_1 = require("./commands/schema");
30
- const rules_1 = require("./commands/rules");
31
- const adr_1 = require("./commands/adr");
32
- const types_1 = require("./commands/types");
33
- // Read version from package.json
34
- const packageJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '..', 'package.json'), 'utf8'));
35
- // Known subcommands to distinguish from file paths
36
- const SUBCOMMANDS = ['init', 'migrate', 'list', 'show', 'add', 'move', 'patch', 'delete', 'archive', 'restore', 'complete', 'log', 'note', 'search', 'subtask', 'template', 'lint', 'tui', 'hooks', 'mcp', 'auth', 'config', 'contract', 'schema', 'rules', 'adr', 'types', 'help'];
37
- // Check if first arg looks like a file path (not a subcommand or flag)
38
- function shouldLaunchTUI() {
39
- const args = process.argv.slice(2);
40
- // No args → TUI with default file
41
- if (args.length === 0) {
42
- return { launch: true, file: 'brainfile.md' };
43
- }
44
- const firstArg = args[0];
45
- // If first arg is a flag, let commander handle it
46
- if (firstArg.startsWith('-')) {
47
- // Handle -f/--file flag for TUI
48
- if (args.length >= 2 && (firstArg === '-f' || firstArg === '--file')) {
49
- return { launch: true, file: args[1] };
50
- }
51
- return { launch: false, file: '' };
52
- }
53
- // If first arg is a known subcommand, don't launch TUI
54
- if (SUBCOMMANDS.includes(firstArg)) {
55
- return { launch: false, file: '' };
56
- }
57
- // If first arg looks like a file/directory path, launch TUI with it.
58
- // Directories are resolved to their .brainfile/brainfile.md by resolveCliBrainfilePath.
59
- if (firstArg.includes('.') || firstArg.includes('/') || firstArg.endsWith(path_1.sep) || (0, fs_1.existsSync)(firstArg)) {
60
- return { launch: true, file: firstArg };
61
- }
62
- // Otherwise let commander handle it (will show help for unknown command)
63
- return { launch: false, file: '' };
64
- }
65
- const tuiCheck = shouldLaunchTUI();
66
- if (tuiCheck.launch) {
67
- void (0, tui_1.tuiCommand)({ file: tuiCheck.file }).catch((error) => {
68
- console.error(error instanceof Error ? error.message : String(error));
69
- process.exit(1);
70
- });
71
- }
72
- else {
73
- const program = new commander_1.Command();
74
- program
75
- .name('brainfile')
76
- .description('Command-line interface for Brainfile task management')
77
- .version(packageJson.version);
78
- program.addHelpText('after', `
79
- Common workflows:
80
- # Create a board
81
- brainfile init
82
-
83
- # Migrate legacy layouts to v2 (.brainfile + board/logs)
84
- brainfile migrate
85
-
86
- # Daily usage
87
- brainfile list
88
- brainfile add -c todo -t "My task"
89
- brainfile move -t task-1 -c done
90
-
91
- Contract workflow (PM ↔ Agent):
92
- # PM creates a task with a contract
93
- brainfile add -c todo -t "Feature" --assignee codex --with-contract --deliverable "file:src/feature.ts:Impl"
94
-
95
- # Agent picks up / delivers
96
- brainfile contract pickup -t task-123
97
- brainfile contract deliver -t task-123
98
-
99
- # PM validates
100
- brainfile contract validate -t task-123
101
-
102
- Brainfile file resolution (when you don't pass --file):
103
- 1) .brainfile/brainfile.md
104
- 2) brainfile.md
105
- 3) .brainfile.md
106
- 4) .bb.md
107
- `.trimEnd());
108
- // Register commands
109
- program
110
- .command('init')
111
- .description('Initialize a new .brainfile/brainfile.md in the current directory')
112
- .option('-f, --file <path>', 'Path to brainfile file', '.brainfile/brainfile.md')
113
- .option('--force', 'Overwrite existing file')
114
- .action(init_1.initCommand);
115
- program
116
- .command('migrate')
117
- .description('Migrate legacy brainfile layouts to v2 (.brainfile/brainfile.md + board/ + logs/)')
118
- .option('--dir <path>', 'Directory containing legacy brainfile files (default: cwd)')
119
- .option('--force', 'Overwrite existing migration outputs (task files/backups)')
120
- .option('--v2', 'Deprecated alias; migration now targets v2 by default')
121
- .option('--logs-to-ledger', 'Migrate logs/*.md files into ledger.jsonl (resolves ID conflicts with board)')
122
- .action(migrate_1.migrateCommand);
123
- const listCmd = program
124
- .command('list')
125
- .description('List tasks')
126
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
127
- .option('-c, --column <name>', 'Filter by column')
128
- .option('-t, --tag <name>', 'Filter by tag')
129
- .option('--parent <id>', 'Filter by parent task ID (parentId)')
130
- .option('--contract <status>', 'Filter by contract status (ready|in_progress|delivered|done|failed)')
131
- .action((options) => { (0, list_1.listCommand)(options); });
132
- listCmd.addHelpText('after', `\n${list_1.LIST_COMMAND_HELP}`);
133
- program
134
- .command('show')
135
- .description('Show full details of a single task')
136
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
137
- .option('-t, --task <id>', 'Task ID to show (required)')
138
- .option('--json', 'Output task data as JSON')
139
- .action((options) => { (0, show_1.showCommand)(options); });
140
- const addCmd = program
141
- .command('add')
142
- .description('Add a new task')
143
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
144
- .option('-c, --column <name>', 'Column to add task to', 'todo')
145
- .option('-t, --title <text>', 'Task title (required)')
146
- .option('-d, --description <text>', 'Task description')
147
- .option('-p, --priority <level>', 'Priority level (low, medium, high, critical)')
148
- .option('--tags <tags>', 'Comma-separated tags')
149
- .option('--assignee <name>', 'Assignee name')
150
- .option('--due-date <date>', 'Due date (YYYY-MM-DD)')
151
- .option('--subtasks <titles>', 'Comma-separated subtask titles')
152
- .option('--files <paths>', 'Comma-separated related file paths')
153
- .option('--type <type>', 'Document type (e.g., epic, adr). Determines ID prefix. Default: task')
154
- .option('--parent <id>', 'Parent task ID (sets parentId on the new task file)')
155
- .option('--child <title>', 'Create a child task under the newly created parent (repeatable; children default to type: task)', (value, previous) => (previous ? [...previous, value] : [value]), [])
156
- .option('--with-contract', 'Attach a draft contract (use --ready to make it immediately dispatchable)')
157
- .option('--ready', 'When used with --with-contract: set contract status=ready instead of draft')
158
- .option('--deliverable <spec>', 'Contract deliverable: type:path:description (description optional). Type: file|test|docs|design|research', (value, previous) => (previous ? [...previous, value] : [value]), [])
159
- .option('--validation <command>', 'Contract validation command (repeatable)', (value, previous) => (previous ? [...previous, value] : [value]), [])
160
- .option('--constraint <text>', 'Contract constraint (repeatable)', (value, previous) => (previous ? [...previous, value] : [value]), [])
161
- .action((options) => { (0, add_1.addCommand)(options); });
162
- addCmd.addHelpText('after', `\n${add_1.ADD_COMMAND_HELP}`);
163
- program
164
- .command('patch')
165
- .description('Update task fields (partial update)')
166
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
167
- .option('-t, --task <id>', 'Task ID to update (required)')
168
- .option('--title <text>', 'New task title')
169
- .option('-d, --description <text>', 'New task description')
170
- .option('-p, --priority <level>', 'Priority (low, medium, high, critical, or "none" to remove)')
171
- .option('--tags <tags>', 'Comma-separated tags (replaces existing)')
172
- .option('--assignee <name>', 'Assignee name')
173
- .option('--due-date <date>', 'Due date (YYYY-MM-DD)')
174
- .option('--clear-tags', 'Remove all tags')
175
- .option('--clear-assignee', 'Remove assignee')
176
- .option('--clear-due-date', 'Remove due date')
177
- .option('--clear-priority', 'Remove priority')
178
- .action(patch_1.patchCommand);
179
- program
180
- .command('delete')
181
- .description('Delete a task permanently')
182
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
183
- .option('-t, --task <id>', 'Task ID to delete (required)')
184
- .option('--force', 'Confirm deletion (required)')
185
- .action(delete_1.deleteCommand);
186
- program
187
- .command('archive')
188
- .description('Archive a task (locally or to GitHub/Linear)')
189
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
190
- .option('-t, --task <id>', 'Task ID to archive')
191
- .option('--to <destination>', 'Archive destination: local, github, or linear')
192
- .option('--all', 'Archive all tasks from local archive to external service')
193
- .option('--dry-run', 'Preview what would be created without making changes')
194
- .action(archive_1.archiveCommand);
195
- program
196
- .command('restore')
197
- .description('Restore a task from the archive')
198
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
199
- .option('-t, --task <id>', 'Task ID to restore (required)')
200
- .option('-c, --column <name>', 'Target column name or ID (required)')
201
- .action(restore_1.restoreCommand);
202
- program
203
- .command('complete')
204
- .description('Complete a task (move to logs in v2, or move to done column in v1)')
205
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
206
- .option('-t, --task <id>', 'Task ID to complete (required)')
207
- .option('--force', 'Force epic completion even if child tasks are still active')
208
- .action((options) => { (0, complete_1.completeCommand)(options); });
209
- program
210
- .command('log')
211
- .description('View, search, and manage completed task logs (v2 only)')
212
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
213
- .option('-t, --task <id>', 'View a specific task log')
214
- .option('-s, --search <query>', 'Search across all logs')
215
- .option('--recent', 'List recently completed tasks')
216
- .action((options) => { (0, log_1.logCommand)(options); });
217
- program
218
- .command('note')
219
- .description('Append a timestamped note to a task log')
220
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
221
- .option('-t, --task <id>', 'Task ID to add note to (required)')
222
- .option('--agent <name>', 'Agent name for attribution')
223
- .argument('[message]', 'Log message to append')
224
- .action((message, options) => { (0, log_1.logNoteCommand)({ ...options, message }); });
225
- program
226
- .command('search')
227
- .description('Search across active tasks and completed logs')
228
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
229
- .option('-c, --column <name>', 'Filter by column')
230
- .argument('<query>', 'Search query')
231
- .action((query, options) => { (0, search_1.searchCommand)({ ...options, query }); });
232
- program
233
- .command('subtask')
234
- .description('Manage subtasks (add, delete, update, toggle)')
235
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
236
- .option('-t, --task <id>', 'Parent task ID (required)')
237
- .option('--add <title>', 'Add a new subtask')
238
- .option('--delete <subtask-id>', 'Delete a subtask')
239
- .option('--update <subtask-id>', 'Update a subtask (requires --title)')
240
- .option('--toggle <subtask-id>', 'Toggle subtask completion')
241
- .option('--title <text>', 'New title (for --update)')
242
- .action(subtask_1.subtaskCommand);
243
- program
244
- .command('move')
245
- .description('Move a task to a different column')
246
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
247
- .option('-t, --task <id>', 'Task ID to move (required)')
248
- .option('-c, --column <name>', 'Target column name or ID (required)')
249
- .action((options) => { (0, move_1.moveCommand)(options); });
250
- program
251
- .command('template')
252
- .description('Manage and use task templates')
253
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
254
- .option('-l, --list', 'List all available templates')
255
- .option('-u, --use <template-id>', 'Create task from template')
256
- .option('--title <text>', 'Task title (for template usage)')
257
- .option('--description <text>', 'Task description (for template usage)')
258
- .option('-c, --column <name>', 'Column to add task to', 'todo')
259
- .action((options) => { (0, template_1.templateCommand)(options); });
260
- program
261
- .command('lint')
262
- .description('Validate and auto-fix brainfile.md syntax')
263
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
264
- .option('--fix', 'Automatically fix issues when possible')
265
- .option('--check', 'Exit with error code if issues found (for CI/CD)')
266
- .action((options) => { (0, lint_1.lintCommand)(options); });
267
- program
268
- .command('tui')
269
- .description('Launch interactive Terminal UI for task management')
270
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
271
- .action(tui_1.tuiCommand);
272
- // Add hooks command group
273
- const hooksCommand = program
274
- .command('hooks')
275
- .description('Manage AI agent hooks integration');
276
- hooksCommand
277
- .command('after-edit')
278
- .description('Handle post-edit hook event (internal use by AI assistants)')
279
- .action(() => { (0, hooks_1.afterEditCommand)(); });
280
- hooksCommand
281
- .command('before-prompt')
282
- .description('Handle pre-prompt hook event (internal use by AI assistants)')
283
- .action(() => { (0, hooks_1.beforePromptCommand)(); });
284
- hooksCommand
285
- .command('session-start')
286
- .description('Handle session-start hook event (internal use by AI assistants)')
287
- .action(() => { (0, hooks_1.sessionStartCommand)(); });
288
- hooksCommand
289
- .command('install <tool>')
290
- .description('Install brainfile hooks for an AI coding assistant')
291
- .option('--scope <scope>', 'Installation scope: user or project', 'user')
292
- .action((tool, options) => (0, hooks_1.installCommand)({ tool, scope: options.scope }));
293
- hooksCommand
294
- .command('uninstall <tool>')
295
- .description('Uninstall brainfile hooks for an AI coding assistant')
296
- .option('--scope <scope>', 'Scope to uninstall from: user, project, or all', 'user')
297
- .action((tool, options) => (0, hooks_1.uninstallCommand)({ tool, scope: options.scope }));
298
- hooksCommand
299
- .command('list [tool]')
300
- .description('List installed brainfile hooks')
301
- .action((tool) => (0, hooks_1.listCommand)({ tool }));
302
- // Add auth command group
303
- const authCommand = program
304
- .command('auth')
305
- .description('Manage authentication for external services (GitHub, Linear)');
306
- authCommand
307
- .command('github')
308
- .description('Authenticate with GitHub')
309
- .option('--token <token>', 'Personal Access Token (or use OAuth device flow)')
310
- .action(auth_1.githubAuthCommand);
311
- authCommand
312
- .command('linear')
313
- .description('Authenticate with Linear')
314
- .option('--token <token>', 'Linear API key (required)')
315
- .action(auth_1.linearAuthCommand);
316
- authCommand
317
- .command('status')
318
- .description('Show authentication status for all providers')
319
- .action(auth_1.authStatusCommand);
320
- authCommand
321
- .command('logout [provider]')
322
- .description('Log out from a provider (github, linear, or --all)')
323
- .option('--all', 'Log out from all providers')
324
- .action(auth_1.authLogoutCommand);
325
- // Add config command group
326
- const configCmd = program
327
- .command('config')
328
- .description('Manage user configuration (~/.config/brainfile/config.json)');
329
- configCmd
330
- .command('list')
331
- .description('Show all config values')
332
- .action(() => (0, config_1.configCommand)('list', {}));
333
- configCmd
334
- .command('get <key>')
335
- .description('Get a specific config value')
336
- .action((key) => (0, config_1.configCommand)('get', { key }));
337
- configCmd
338
- .command('set <key> <value>')
339
- .description('Set a config value')
340
- .action((key, value) => (0, config_1.configCommand)('set', { key, value }));
341
- configCmd
342
- .command('path')
343
- .description('Show config file path')
344
- .action(() => (0, config_1.configCommand)('path', {}));
345
- program
346
- .command('mcp')
347
- .description('Start MCP server for AI assistant integration')
348
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
349
- .action(mcp_1.mcpCommand);
350
- // Add contract command group
351
- const contractCmd = program
352
- .command('contract')
353
- .description('Manage task contracts (pickup, deliver, validate)');
354
- contractCmd.addHelpText('after', `\n${contract_1.CONTRACT_COMMAND_HELP}`);
355
- const contractPickupCmd = contractCmd
356
- .command('pickup')
357
- .description('Claim a contract and output context for an agent')
358
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
359
- .option('-t, --task <id>', 'Task ID to pick up (required)')
360
- .action((options) => { (0, contract_1.contractPickupCommand)(options); });
361
- contractPickupCmd.addHelpText('after', `\n${contract_1.CONTRACT_PICKUP_HELP}`);
362
- const contractDeliverCmd = contractCmd
363
- .command('deliver')
364
- .description('Mark a contract as delivered')
365
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
366
- .option('-t, --task <id>', 'Task ID to deliver (required)')
367
- .action((options) => { (0, contract_1.contractDeliverCommand)(options); });
368
- contractDeliverCmd.addHelpText('after', `\n${contract_1.CONTRACT_DELIVER_HELP}`);
369
- const contractValidateCmd = contractCmd
370
- .command('validate')
371
- .description('Validate contract deliverables and commands; set status done/failed')
372
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
373
- .option('-t, --task <id>', 'Task ID to validate (required)')
374
- .action((options) => { (0, contract_1.contractValidateCommand)(options); });
375
- contractValidateCmd.addHelpText('after', `\n${contract_1.CONTRACT_VALIDATE_HELP}`);
376
- const contractAttachCmd = contractCmd
377
- .command('attach')
378
- .description('Attach a new contract to an existing task (default status=draft)')
379
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
380
- .option('-t, --task <id>', 'Task ID to attach contract to (required)')
381
- .option('--ready', 'Set contract status=ready instead of draft (immediately dispatchable)')
382
- .option('--deliverable <spec>', 'Contract deliverable: type:path:description (description optional). Type: file|test|docs|design|research', (value, previous) => (previous ? [...previous, value] : [value]), [])
383
- .option('--validation <command>', 'Contract validation command (repeatable)', (value, previous) => (previous ? [...previous, value] : [value]), [])
384
- .option('--constraint <text>', 'Contract constraint (repeatable)', (value, previous) => (previous ? [...previous, value] : [value]), [])
385
- .action((options) => { (0, contract_1.contractAttachCommand)(options); });
386
- contractAttachCmd.addHelpText('after', `\n${contract_1.CONTRACT_ATTACH_HELP}`);
387
- const contractGraphCmd = contractCmd
388
- .command('graph')
389
- .description('Attach contracts to multiple tasks as a dependency graph')
390
- .allowUnknownOption(true)
391
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
392
- .option('--ready', 'Set attached contracts to status=ready instead of draft')
393
- .option('--show', 'Print the current task dependency graph')
394
- .action(() => {
395
- const rawArgs = process.argv.slice(2);
396
- const graphIndex = rawArgs.findIndex((arg, index) => arg === 'graph' && rawArgs[index - 1] === 'contract');
397
- const graphArgs = graphIndex >= 0 ? rawArgs.slice(graphIndex + 1) : [];
398
- (0, contract_1.contractGraphCommand)((0, contract_1.parseContractGraphArgs)(graphArgs));
399
- });
400
- contractGraphCmd.addHelpText('after', `\n${contract_1.CONTRACT_GRAPH_HELP}`);
401
- const contractActivateCmd = contractCmd
402
- .command('activate')
403
- .description('Activate one or more draft contracts (draft → ready)')
404
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
405
- .option('-t, --task <id>', 'Task ID to activate (single contract)')
406
- .option('--parent <id>', 'Activate all draft contracts whose parentId matches this value')
407
- .action((options) => { (0, contract_1.contractActivateCommand)(options); });
408
- contractActivateCmd.addHelpText('after', `\n${contract_1.CONTRACT_ACTIVATE_HELP}`);
409
- // Add schema command
410
- const schemaCmd = program
411
- .command('schema [name]')
412
- .description('View and manage brainfile schemas')
413
- .option('--json', 'Output in JSON format')
414
- .action((name, options) => { (0, schema_1.schemaCommand)({ name, json: options.json }); });
415
- schemaCmd.addHelpText('after', `\n${schema_1.SCHEMA_COMMAND_HELP}`);
416
- // Add rules command group
417
- const rulesCmd = program
418
- .command('rules [action]')
419
- .description('Manage project rules (always, never, prefer, context)')
420
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
421
- .option('--json', 'Output in JSON format')
422
- .option('--category <category>', 'Filter by category (for list)')
423
- .argument('[args...]', 'Arguments for the action (category, text/id)')
424
- .action((action, args, options) => {
425
- (0, rules_1.rulesCommand)(action, args, {
426
- file: options.file,
427
- json: options.json,
428
- category: options.category,
429
- });
430
- });
431
- rulesCmd.addHelpText('after', `\n${rules_1.RULES_COMMAND_HELP}`);
432
- // Add ADR command group
433
- const adrCmd = program
434
- .command('adr')
435
- .description('Manage Architectural Decision Records (ADR) lifecycle');
436
- adrCmd.addHelpText('after', `\n${adr_1.ADR_COMMAND_HELP}`);
437
- adrCmd
438
- .command('promote')
439
- .description('Promote an ADR into a project rule and move it to logs/')
440
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
441
- .option('-t, --task <id>', 'ADR task ID to promote (required)')
442
- .option('--category <category>', 'Rule category (prefer|always|never|context)')
443
- .action((options) => { (0, adr_1.adrPromoteCommand)(options); });
444
- // Add types command
445
- program
446
- .command('types [action]')
447
- .description('Inspect and manage board document types')
448
- .option('-f, --file <path>', 'Path to brainfile file (auto-detect by default)', 'brainfile.md')
449
- .option('--json', 'Output in JSON format (list action)')
450
- .option('--id-prefix <prefix>', 'ID prefix to use for the type (add action; default: type name)')
451
- .option('--completable <bool>', 'Whether this type can be completed (add action; default: true)')
452
- .option('--schema <url>', 'Optional schema URL/path for this type (add action)')
453
- .argument('[name]', 'Type name (required for add action)')
454
- .action((action, name, options) => {
455
- const normalizedAction = (action || 'list').toLowerCase();
456
- if (normalizedAction === 'list') {
457
- (0, types_1.typesListCommand)({
458
- file: options.file,
459
- json: options.json,
460
- });
461
- return;
462
- }
463
- if (normalizedAction === 'add') {
464
- const completable = options.completable !== undefined
465
- ? (0, types_1.parseBooleanFlag)(String(options.completable))
466
- : undefined;
467
- (0, types_1.typesAddCommand)({
468
- file: options.file,
469
- name,
470
- idPrefix: options.idPrefix,
471
- completable,
472
- schema: options.schema,
473
- });
474
- return;
475
- }
476
- throw new Error(`Unknown types action: ${action}`);
477
- });
478
- program.parse();
479
- } // end else block for CLI commands
480
- //# sourceMappingURL=cli.js.map
2
+ 'use strict';
3
+ // Generated by scripts/build-bundle.mjs — do not edit.
4
+ // Defers to the ESM bundle; dynamic import() is the only way a CJS file can
5
+ // load ESM, and the bundle must be ESM because yoga-layout uses top-level await.
6
+ import('./cli.mjs').catch((error) => {
7
+ console.error(error);
8
+ process.exit(1);
9
+ });