brainfile 0.18.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 (360) hide show
  1. package/README.md +222 -0
  2. package/dist/__tests__/helpers/v2.d.ts +12 -0
  3. package/dist/__tests__/helpers/v2.d.ts.map +1 -0
  4. package/dist/__tests__/helpers/v2.js +73 -0
  5. package/dist/__tests__/helpers/v2.js.map +1 -0
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +480 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/commands/add.d.ts +34 -0
  11. package/dist/commands/add.d.ts.map +1 -0
  12. package/dist/commands/add.js +255 -0
  13. package/dist/commands/add.js.map +1 -0
  14. package/dist/commands/adr.d.ts +22 -0
  15. package/dist/commands/adr.d.ts.map +1 -0
  16. package/dist/commands/adr.js +195 -0
  17. package/dist/commands/adr.js.map +1 -0
  18. package/dist/commands/archive.d.ts +20 -0
  19. package/dist/commands/archive.d.ts.map +1 -0
  20. package/dist/commands/archive.js +590 -0
  21. package/dist/commands/archive.js.map +1 -0
  22. package/dist/commands/auth.d.ts +26 -0
  23. package/dist/commands/auth.d.ts.map +1 -0
  24. package/dist/commands/auth.js +245 -0
  25. package/dist/commands/auth.js.map +1 -0
  26. package/dist/commands/complete.d.ts +30 -0
  27. package/dist/commands/complete.d.ts.map +1 -0
  28. package/dist/commands/complete.js +267 -0
  29. package/dist/commands/complete.js.map +1 -0
  30. package/dist/commands/config.d.ts +29 -0
  31. package/dist/commands/config.d.ts.map +1 -0
  32. package/dist/commands/config.js +210 -0
  33. package/dist/commands/config.js.map +1 -0
  34. package/dist/commands/contract.d.ts +84 -0
  35. package/dist/commands/contract.d.ts.map +1 -0
  36. package/dist/commands/contract.js +715 -0
  37. package/dist/commands/contract.js.map +1 -0
  38. package/dist/commands/delete.d.ts +8 -0
  39. package/dist/commands/delete.d.ts.map +1 -0
  40. package/dist/commands/delete.js +139 -0
  41. package/dist/commands/delete.js.map +1 -0
  42. package/dist/commands/hooks.d.ts +35 -0
  43. package/dist/commands/hooks.d.ts.map +1 -0
  44. package/dist/commands/hooks.js +324 -0
  45. package/dist/commands/hooks.js.map +1 -0
  46. package/dist/commands/init.d.ts +7 -0
  47. package/dist/commands/init.d.ts.map +1 -0
  48. package/dist/commands/init.js +118 -0
  49. package/dist/commands/init.js.map +1 -0
  50. package/dist/commands/lint.d.ts +16 -0
  51. package/dist/commands/lint.d.ts.map +1 -0
  52. package/dist/commands/lint.js +123 -0
  53. package/dist/commands/lint.js.map +1 -0
  54. package/dist/commands/list.d.ts +20 -0
  55. package/dist/commands/list.d.ts.map +1 -0
  56. package/dist/commands/list.js +175 -0
  57. package/dist/commands/list.js.map +1 -0
  58. package/dist/commands/log.d.ts +52 -0
  59. package/dist/commands/log.d.ts.map +1 -0
  60. package/dist/commands/log.js +246 -0
  61. package/dist/commands/log.js.map +1 -0
  62. package/dist/commands/mcp.d.ts +3 -0
  63. package/dist/commands/mcp.d.ts.map +1 -0
  64. package/dist/commands/mcp.js +96 -0
  65. package/dist/commands/mcp.js.map +1 -0
  66. package/dist/commands/migrate.d.ts +16 -0
  67. package/dist/commands/migrate.d.ts.map +1 -0
  68. package/dist/commands/migrate.js +388 -0
  69. package/dist/commands/migrate.js.map +1 -0
  70. package/dist/commands/move.d.ts +16 -0
  71. package/dist/commands/move.d.ts.map +1 -0
  72. package/dist/commands/move.js +225 -0
  73. package/dist/commands/move.js.map +1 -0
  74. package/dist/commands/patch.d.ts +17 -0
  75. package/dist/commands/patch.d.ts.map +1 -0
  76. package/dist/commands/patch.js +226 -0
  77. package/dist/commands/patch.js.map +1 -0
  78. package/dist/commands/restore.d.ts +8 -0
  79. package/dist/commands/restore.d.ts.map +1 -0
  80. package/dist/commands/restore.js +111 -0
  81. package/dist/commands/restore.js.map +1 -0
  82. package/dist/commands/rules.d.ts +68 -0
  83. package/dist/commands/rules.d.ts.map +1 -0
  84. package/dist/commands/rules.js +322 -0
  85. package/dist/commands/rules.js.map +1 -0
  86. package/dist/commands/schema.d.ts +31 -0
  87. package/dist/commands/schema.d.ts.map +1 -0
  88. package/dist/commands/schema.js +374 -0
  89. package/dist/commands/schema.js.map +1 -0
  90. package/dist/commands/search.d.ts +33 -0
  91. package/dist/commands/search.d.ts.map +1 -0
  92. package/dist/commands/search.js +209 -0
  93. package/dist/commands/search.js.map +1 -0
  94. package/dist/commands/show.d.ts +20 -0
  95. package/dist/commands/show.d.ts.map +1 -0
  96. package/dist/commands/show.js +272 -0
  97. package/dist/commands/show.js.map +1 -0
  98. package/dist/commands/subtask.d.ts +12 -0
  99. package/dist/commands/subtask.d.ts.map +1 -0
  100. package/dist/commands/subtask.js +212 -0
  101. package/dist/commands/subtask.js.map +1 -0
  102. package/dist/commands/template.d.ts +17 -0
  103. package/dist/commands/template.d.ts.map +1 -0
  104. package/dist/commands/template.js +149 -0
  105. package/dist/commands/template.js.map +1 -0
  106. package/dist/commands/tui.d.ts +6 -0
  107. package/dist/commands/tui.d.ts.map +1 -0
  108. package/dist/commands/tui.js +79 -0
  109. package/dist/commands/tui.js.map +1 -0
  110. package/dist/commands/types.d.ts +40 -0
  111. package/dist/commands/types.d.ts.map +1 -0
  112. package/dist/commands/types.js +242 -0
  113. package/dist/commands/types.js.map +1 -0
  114. package/dist/index.d.ts +10 -0
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.js +29 -0
  117. package/dist/index.js.map +1 -0
  118. package/dist/lib/contractRunner.d.ts +59 -0
  119. package/dist/lib/contractRunner.d.ts.map +1 -0
  120. package/dist/lib/contractRunner.js +511 -0
  121. package/dist/lib/contractRunner.js.map +1 -0
  122. package/dist/mcp/helpers.d.ts +32 -0
  123. package/dist/mcp/helpers.d.ts.map +1 -0
  124. package/dist/mcp/helpers.js +125 -0
  125. package/dist/mcp/helpers.js.map +1 -0
  126. package/dist/mcp/tools/contract.d.ts +25 -0
  127. package/dist/mcp/tools/contract.d.ts.map +1 -0
  128. package/dist/mcp/tools/contract.js +33 -0
  129. package/dist/mcp/tools/contract.js.map +1 -0
  130. package/dist/mcp/tools/contract_tool.d.ts +3 -0
  131. package/dist/mcp/tools/contract_tool.d.ts.map +1 -0
  132. package/dist/mcp/tools/contract_tool.js +328 -0
  133. package/dist/mcp/tools/contract_tool.js.map +1 -0
  134. package/dist/mcp/tools/get_task_tool.d.ts +3 -0
  135. package/dist/mcp/tools/get_task_tool.d.ts.map +1 -0
  136. package/dist/mcp/tools/get_task_tool.js +55 -0
  137. package/dist/mcp/tools/get_task_tool.js.map +1 -0
  138. package/dist/mcp/tools/list_tasks_tool.d.ts +3 -0
  139. package/dist/mcp/tools/list_tasks_tool.d.ts.map +1 -0
  140. package/dist/mcp/tools/list_tasks_tool.js +82 -0
  141. package/dist/mcp/tools/list_tasks_tool.js.map +1 -0
  142. package/dist/mcp/tools/search_tool.d.ts +3 -0
  143. package/dist/mcp/tools/search_tool.d.ts.map +1 -0
  144. package/dist/mcp/tools/search_tool.js +155 -0
  145. package/dist/mcp/tools/search_tool.js.map +1 -0
  146. package/dist/mcp/tools/subtask_tool.d.ts +3 -0
  147. package/dist/mcp/tools/subtask_tool.d.ts.map +1 -0
  148. package/dist/mcp/tools/subtask_tool.js +321 -0
  149. package/dist/mcp/tools/subtask_tool.js.map +1 -0
  150. package/dist/mcp/tools/task_add_tool.d.ts +3 -0
  151. package/dist/mcp/tools/task_add_tool.d.ts.map +1 -0
  152. package/dist/mcp/tools/task_add_tool.js +196 -0
  153. package/dist/mcp/tools/task_add_tool.js.map +1 -0
  154. package/dist/mcp/tools/task_complete_tool.d.ts +3 -0
  155. package/dist/mcp/tools/task_complete_tool.d.ts.map +1 -0
  156. package/dist/mcp/tools/task_complete_tool.js +265 -0
  157. package/dist/mcp/tools/task_complete_tool.js.map +1 -0
  158. package/dist/mcp/tools/task_delete_tool.d.ts +3 -0
  159. package/dist/mcp/tools/task_delete_tool.d.ts.map +1 -0
  160. package/dist/mcp/tools/task_delete_tool.js +87 -0
  161. package/dist/mcp/tools/task_delete_tool.js.map +1 -0
  162. package/dist/mcp/tools/task_move_tool.d.ts +3 -0
  163. package/dist/mcp/tools/task_move_tool.d.ts.map +1 -0
  164. package/dist/mcp/tools/task_move_tool.js +187 -0
  165. package/dist/mcp/tools/task_move_tool.js.map +1 -0
  166. package/dist/mcp/tools/task_patch_tool.d.ts +3 -0
  167. package/dist/mcp/tools/task_patch_tool.d.ts.map +1 -0
  168. package/dist/mcp/tools/task_patch_tool.js +189 -0
  169. package/dist/mcp/tools/task_patch_tool.js.map +1 -0
  170. package/dist/schemas/base.json +159 -0
  171. package/dist/schemas/board.json +290 -0
  172. package/dist/tui/BrainfileTUI.d.ts +4 -0
  173. package/dist/tui/BrainfileTUI.d.ts.map +1 -0
  174. package/dist/tui/BrainfileTUI.js +272 -0
  175. package/dist/tui/BrainfileTUI.js.map +1 -0
  176. package/dist/tui/actions.d.ts +84 -0
  177. package/dist/tui/actions.d.ts.map +1 -0
  178. package/dist/tui/actions.js +1251 -0
  179. package/dist/tui/actions.js.map +1 -0
  180. package/dist/tui/components/ColumnTabs.d.ts +9 -0
  181. package/dist/tui/components/ColumnTabs.d.ts.map +1 -0
  182. package/dist/tui/components/ColumnTabs.js +34 -0
  183. package/dist/tui/components/ColumnTabs.js.map +1 -0
  184. package/dist/tui/components/Header.d.ts +15 -0
  185. package/dist/tui/components/Header.d.ts.map +1 -0
  186. package/dist/tui/components/Header.js +48 -0
  187. package/dist/tui/components/Header.js.map +1 -0
  188. package/dist/tui/components/HelpOverlay.d.ts +9 -0
  189. package/dist/tui/components/HelpOverlay.d.ts.map +1 -0
  190. package/dist/tui/components/HelpOverlay.js +116 -0
  191. package/dist/tui/components/HelpOverlay.js.map +1 -0
  192. package/dist/tui/components/LogsPanel.d.ts +16 -0
  193. package/dist/tui/components/LogsPanel.d.ts.map +1 -0
  194. package/dist/tui/components/LogsPanel.js +115 -0
  195. package/dist/tui/components/LogsPanel.js.map +1 -0
  196. package/dist/tui/components/MainPanelTabs.d.ts +10 -0
  197. package/dist/tui/components/MainPanelTabs.d.ts.map +1 -0
  198. package/dist/tui/components/MainPanelTabs.js +56 -0
  199. package/dist/tui/components/MainPanelTabs.js.map +1 -0
  200. package/dist/tui/components/ManualBorder.d.ts +42 -0
  201. package/dist/tui/components/ManualBorder.d.ts.map +1 -0
  202. package/dist/tui/components/ManualBorder.js +56 -0
  203. package/dist/tui/components/ManualBorder.js.map +1 -0
  204. package/dist/tui/components/Overlays.d.ts +41 -0
  205. package/dist/tui/components/Overlays.d.ts.map +1 -0
  206. package/dist/tui/components/Overlays.js +127 -0
  207. package/dist/tui/components/Overlays.js.map +1 -0
  208. package/dist/tui/components/ProgressBar.d.ts +8 -0
  209. package/dist/tui/components/ProgressBar.d.ts.map +1 -0
  210. package/dist/tui/components/ProgressBar.js +35 -0
  211. package/dist/tui/components/ProgressBar.js.map +1 -0
  212. package/dist/tui/components/RulesPanel.d.ts +25 -0
  213. package/dist/tui/components/RulesPanel.d.ts.map +1 -0
  214. package/dist/tui/components/RulesPanel.js +139 -0
  215. package/dist/tui/components/RulesPanel.js.map +1 -0
  216. package/dist/tui/components/SearchBar.d.ts +8 -0
  217. package/dist/tui/components/SearchBar.d.ts.map +1 -0
  218. package/dist/tui/components/SearchBar.js +38 -0
  219. package/dist/tui/components/SearchBar.js.map +1 -0
  220. package/dist/tui/components/StackedTaskList.d.ts +27 -0
  221. package/dist/tui/components/StackedTaskList.d.ts.map +1 -0
  222. package/dist/tui/components/StackedTaskList.js +120 -0
  223. package/dist/tui/components/StackedTaskList.js.map +1 -0
  224. package/dist/tui/components/StatusBar.d.ts +14 -0
  225. package/dist/tui/components/StatusBar.d.ts.map +1 -0
  226. package/dist/tui/components/StatusBar.js +42 -0
  227. package/dist/tui/components/StatusBar.js.map +1 -0
  228. package/dist/tui/components/TaskCard.d.ts +25 -0
  229. package/dist/tui/components/TaskCard.d.ts.map +1 -0
  230. package/dist/tui/components/TaskCard.js +221 -0
  231. package/dist/tui/components/TaskCard.js.map +1 -0
  232. package/dist/tui/components/TaskCardMeasure.d.ts +31 -0
  233. package/dist/tui/components/TaskCardMeasure.d.ts.map +1 -0
  234. package/dist/tui/components/TaskCardMeasure.js +133 -0
  235. package/dist/tui/components/TaskCardMeasure.js.map +1 -0
  236. package/dist/tui/components/TaskDetail.d.ts +13 -0
  237. package/dist/tui/components/TaskDetail.d.ts.map +1 -0
  238. package/dist/tui/components/TaskDetail.js +64 -0
  239. package/dist/tui/components/TaskDetail.js.map +1 -0
  240. package/dist/tui/components/TaskList.d.ts +12 -0
  241. package/dist/tui/components/TaskList.d.ts.map +1 -0
  242. package/dist/tui/components/TaskList.js +75 -0
  243. package/dist/tui/components/TaskList.js.map +1 -0
  244. package/dist/tui/components/index.d.ts +31 -0
  245. package/dist/tui/components/index.d.ts.map +1 -0
  246. package/dist/tui/components/index.js +43 -0
  247. package/dist/tui/components/index.js.map +1 -0
  248. package/dist/tui/hooks/index.d.ts +3 -0
  249. package/dist/tui/hooks/index.d.ts.map +1 -0
  250. package/dist/tui/hooks/index.js +8 -0
  251. package/dist/tui/hooks/index.js.map +1 -0
  252. package/dist/tui/hooks/useBrainfileLoader.d.ts +5 -0
  253. package/dist/tui/hooks/useBrainfileLoader.d.ts.map +1 -0
  254. package/dist/tui/hooks/useBrainfileLoader.js +237 -0
  255. package/dist/tui/hooks/useBrainfileLoader.js.map +1 -0
  256. package/dist/tui/hooks/useKeyboardNavigation.d.ts +20 -0
  257. package/dist/tui/hooks/useKeyboardNavigation.d.ts.map +1 -0
  258. package/dist/tui/hooks/useKeyboardNavigation.js +806 -0
  259. package/dist/tui/hooks/useKeyboardNavigation.js.map +1 -0
  260. package/dist/tui/index.d.ts +10 -0
  261. package/dist/tui/index.d.ts.map +1 -0
  262. package/dist/tui/index.js +38 -0
  263. package/dist/tui/index.js.map +1 -0
  264. package/dist/tui/theme.d.ts +119 -0
  265. package/dist/tui/theme.d.ts.map +1 -0
  266. package/dist/tui/theme.js +138 -0
  267. package/dist/tui/theme.js.map +1 -0
  268. package/dist/tui/types.d.ts +53 -0
  269. package/dist/tui/types.d.ts.map +1 -0
  270. package/dist/tui/types.js +12 -0
  271. package/dist/tui/types.js.map +1 -0
  272. package/dist/tui/utils.d.ts +24 -0
  273. package/dist/tui/utils.d.ts.map +1 -0
  274. package/dist/tui/utils.js +161 -0
  275. package/dist/tui/utils.js.map +1 -0
  276. package/dist/utils/archive.d.ts +57 -0
  277. package/dist/utils/archive.d.ts.map +1 -0
  278. package/dist/utils/archive.js +304 -0
  279. package/dist/utils/archive.js.map +1 -0
  280. package/dist/utils/auth-store.d.ts +69 -0
  281. package/dist/utils/auth-store.d.ts.map +1 -0
  282. package/dist/utils/auth-store.js +308 -0
  283. package/dist/utils/auth-store.js.map +1 -0
  284. package/dist/utils/board-types.d.ts +13 -0
  285. package/dist/utils/board-types.d.ts.map +1 -0
  286. package/dist/utils/board-types.js +7 -0
  287. package/dist/utils/board-types.js.map +1 -0
  288. package/dist/utils/brainfile-finder.d.ts +12 -0
  289. package/dist/utils/brainfile-finder.d.ts.map +1 -0
  290. package/dist/utils/brainfile-finder.js +69 -0
  291. package/dist/utils/brainfile-finder.js.map +1 -0
  292. package/dist/utils/brainfile-path.d.ts +10 -0
  293. package/dist/utils/brainfile-path.d.ts.map +1 -0
  294. package/dist/utils/brainfile-path.js +88 -0
  295. package/dist/utils/brainfile-path.js.map +1 -0
  296. package/dist/utils/cli-error.d.ts +44 -0
  297. package/dist/utils/cli-error.d.ts.map +1 -0
  298. package/dist/utils/cli-error.js +85 -0
  299. package/dist/utils/cli-error.js.map +1 -0
  300. package/dist/utils/config.d.ts +119 -0
  301. package/dist/utils/config.d.ts.map +1 -0
  302. package/dist/utils/config.js +304 -0
  303. package/dist/utils/config.js.map +1 -0
  304. package/dist/utils/contractSpec.d.ts +13 -0
  305. package/dist/utils/contractSpec.d.ts.map +1 -0
  306. package/dist/utils/contractSpec.js +61 -0
  307. package/dist/utils/contractSpec.js.map +1 -0
  308. package/dist/utils/dot-brainfile.d.ts +9 -0
  309. package/dist/utils/dot-brainfile.d.ts.map +1 -0
  310. package/dist/utils/dot-brainfile.js +74 -0
  311. package/dist/utils/dot-brainfile.js.map +1 -0
  312. package/dist/utils/errorHandler.d.ts +106 -0
  313. package/dist/utils/errorHandler.d.ts.map +1 -0
  314. package/dist/utils/errorHandler.js +223 -0
  315. package/dist/utils/errorHandler.js.map +1 -0
  316. package/dist/utils/git-helper.d.ts +17 -0
  317. package/dist/utils/git-helper.d.ts.map +1 -0
  318. package/dist/utils/git-helper.js +62 -0
  319. package/dist/utils/git-helper.js.map +1 -0
  320. package/dist/utils/github-auth.d.ts +56 -0
  321. package/dist/utils/github-auth.d.ts.map +1 -0
  322. package/dist/utils/github-auth.js +341 -0
  323. package/dist/utils/github-auth.js.map +1 -0
  324. package/dist/utils/hook-parser.d.ts +15 -0
  325. package/dist/utils/hook-parser.d.ts.map +1 -0
  326. package/dist/utils/hook-parser.js +69 -0
  327. package/dist/utils/hook-parser.js.map +1 -0
  328. package/dist/utils/hook-settings.d.ts +27 -0
  329. package/dist/utils/hook-settings.d.ts.map +1 -0
  330. package/dist/utils/hook-settings.js +364 -0
  331. package/dist/utils/hook-settings.js.map +1 -0
  332. package/dist/utils/linear-auth.d.ts +59 -0
  333. package/dist/utils/linear-auth.d.ts.map +1 -0
  334. package/dist/utils/linear-auth.js +295 -0
  335. package/dist/utils/linear-auth.js.map +1 -0
  336. package/dist/utils/logger.d.ts +34 -0
  337. package/dist/utils/logger.d.ts.map +1 -0
  338. package/dist/utils/logger.js +56 -0
  339. package/dist/utils/logger.js.map +1 -0
  340. package/dist/utils/strict-validation.d.ts +8 -0
  341. package/dist/utils/strict-validation.d.ts.map +1 -0
  342. package/dist/utils/strict-validation.js +41 -0
  343. package/dist/utils/strict-validation.js.map +1 -0
  344. package/dist/utils/v2-detect.d.ts +28 -0
  345. package/dist/utils/v2-detect.d.ts.map +1 -0
  346. package/dist/utils/v2-detect.js +112 -0
  347. package/dist/utils/v2-detect.js.map +1 -0
  348. package/dist/utils/v2-only.d.ts +9 -0
  349. package/dist/utils/v2-only.d.ts.map +1 -0
  350. package/dist/utils/v2-only.js +64 -0
  351. package/dist/utils/v2-only.js.map +1 -0
  352. package/dist/utils/workspace-format.d.ts +25 -0
  353. package/dist/utils/workspace-format.d.ts.map +1 -0
  354. package/dist/utils/workspace-format.js +106 -0
  355. package/dist/utils/workspace-format.js.map +1 -0
  356. package/dist/validation/command-lint.d.ts +11 -0
  357. package/dist/validation/command-lint.d.ts.map +1 -0
  358. package/dist/validation/command-lint.js +88 -0
  359. package/dist/validation/command-lint.js.map +1 -0
  360. package/package.json +69 -0
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLIError = void 0;
4
+ exports.fileNotFound = fileNotFound;
5
+ exports.parseFailure = parseFailure;
6
+ exports.missingRequired = missingRequired;
7
+ exports.operationFailed = operationFailed;
8
+ exports.columnNotFound = columnNotFound;
9
+ exports.taskNotFound = taskNotFound;
10
+ exports.subtaskNotFound = subtaskNotFound;
11
+ exports.validationError = validationError;
12
+ const errorHandler_1 = require("./errorHandler");
13
+ /**
14
+ * Custom error class for CLI errors.
15
+ * Thrown by commands to signal failure without calling process.exit directly.
16
+ * The CLI entry point catches this and handles exit codes.
17
+ */
18
+ class CLIError extends Error {
19
+ constructor(message, exitCode = errorHandler_1.ExitCode.USER_ERROR, details) {
20
+ super(message);
21
+ this.name = 'CLIError';
22
+ this.exitCode = exitCode;
23
+ this.details = details;
24
+ }
25
+ }
26
+ exports.CLIError = CLIError;
27
+ /**
28
+ * Create a CLIError for file not found.
29
+ */
30
+ function fileNotFound(filePath) {
31
+ return new CLIError(`File not found: ${filePath}`, errorHandler_1.ExitCode.USER_ERROR, 'To create a new brainfile, run: brainfile init');
32
+ }
33
+ /**
34
+ * Create a CLIError for parse errors.
35
+ */
36
+ function parseFailure(error) {
37
+ const msg = error ? `Failed to parse brainfile: ${error}` : 'Failed to parse brainfile';
38
+ return new CLIError(msg, errorHandler_1.ExitCode.USER_ERROR, 'To validate and fix syntax issues, run: brainfile lint --fix');
39
+ }
40
+ /**
41
+ * Create a CLIError for missing required options.
42
+ */
43
+ function missingRequired(option, usage) {
44
+ return new CLIError(`${option} is required`, errorHandler_1.ExitCode.USER_ERROR, `Usage: ${usage}`);
45
+ }
46
+ /**
47
+ * Create a CLIError from a core operation failure.
48
+ */
49
+ function operationFailed(error) {
50
+ return new CLIError(error, errorHandler_1.ExitCode.USER_ERROR);
51
+ }
52
+ /**
53
+ * Create a CLIError for column not found.
54
+ */
55
+ function columnNotFound(columnId, availableColumns) {
56
+ const listStr = availableColumns.join(', ');
57
+ return new CLIError(`Column not found: ${columnId}`, errorHandler_1.ExitCode.USER_ERROR, `Available columns: ${listStr}`);
58
+ }
59
+ /**
60
+ * Create a CLIError for task not found.
61
+ */
62
+ function taskNotFound(taskId, availableTasks = []) {
63
+ let details;
64
+ if (availableTasks.length > 0) {
65
+ details = `Available tasks:\n${availableTasks.map(t => ` - ${t}`).join('\n')}`;
66
+ }
67
+ return new CLIError(`Task not found: ${taskId}`, errorHandler_1.ExitCode.USER_ERROR, details);
68
+ }
69
+ /**
70
+ * Create a CLIError for subtask not found.
71
+ */
72
+ function subtaskNotFound(subtaskId, availableSubtasks = []) {
73
+ let details;
74
+ if (availableSubtasks.length > 0) {
75
+ details = `Available subtasks:\n${availableSubtasks.map(t => ` - ${t}`).join('\n')}`;
76
+ }
77
+ return new CLIError(`Subtask not found: ${subtaskId}`, errorHandler_1.ExitCode.USER_ERROR, details);
78
+ }
79
+ /**
80
+ * Create a CLIError for validation errors.
81
+ */
82
+ function validationError(message) {
83
+ return new CLIError(`Validation error: ${message}`, errorHandler_1.ExitCode.USER_ERROR);
84
+ }
85
+ //# sourceMappingURL=cli-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-error.js","sourceRoot":"","sources":["../../src/utils/cli-error.ts"],"names":[],"mappings":";;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for:
5
+ * - Archive destination defaults
6
+ * - GitHub connection details (owner, repo)
7
+ * - Linear connection details (teamId)
8
+ * - User preferences
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ export interface GitHubConfig {
13
+ /** GitHub repository owner (username or org) */
14
+ owner?: string;
15
+ /** GitHub repository name */
16
+ repo?: string;
17
+ /** Extra labels to add to archived issues */
18
+ labels?: string[];
19
+ }
20
+ export interface LinearConfig {
21
+ /** Linear team ID */
22
+ teamId?: string;
23
+ /** Linear project ID (optional) */
24
+ projectId?: string;
25
+ }
26
+ export interface ArchiveConfig {
27
+ /** Default archive destination: 'local' | 'github' | 'linear' */
28
+ default?: 'local' | 'github' | 'linear';
29
+ /** GitHub-specific settings */
30
+ github?: GitHubConfig;
31
+ /** Linear-specific settings */
32
+ linear?: LinearConfig;
33
+ }
34
+ export interface BrainfileConfig {
35
+ /** Archive configuration */
36
+ archive?: ArchiveConfig;
37
+ }
38
+ /**
39
+ * Get the path to the config directory
40
+ */
41
+ export declare function getConfigDir(): string;
42
+ /**
43
+ * Get the path to the config file
44
+ */
45
+ export declare function getConfigPath(): string;
46
+ /**
47
+ * Ensure the config directory exists
48
+ */
49
+ export declare function ensureConfigDir(): void;
50
+ /**
51
+ * Load the config file
52
+ * @returns Config object, or empty object if file doesn't exist
53
+ */
54
+ export declare function loadConfig(): BrainfileConfig;
55
+ /**
56
+ * Save the config file
57
+ * @param config - Config object to save
58
+ */
59
+ export declare function saveConfig(config: BrainfileConfig): void;
60
+ /**
61
+ * Update specific config values (merges with existing)
62
+ * @param updates - Partial config to merge
63
+ */
64
+ export declare function updateConfig(updates: Partial<BrainfileConfig>): BrainfileConfig;
65
+ /**
66
+ * Get archive configuration with defaults
67
+ */
68
+ export declare function getArchiveConfig(): ArchiveConfig;
69
+ /**
70
+ * Set archive default destination
71
+ */
72
+ export declare function setArchiveDefault(destination: 'local' | 'github' | 'linear'): void;
73
+ /**
74
+ * Set GitHub configuration
75
+ */
76
+ export declare function setGitHubConfig(github: GitHubConfig): void;
77
+ /**
78
+ * Set Linear configuration
79
+ */
80
+ export declare function setLinearConfig(linear: LinearConfig): void;
81
+ /**
82
+ * Get the effective archive destination
83
+ * Priority: brainfile.md archive.destination > config default > 'local'
84
+ *
85
+ * @param brainfileDestination - Destination from brainfile.md (if any)
86
+ * @returns The effective destination
87
+ */
88
+ export declare function getEffectiveArchiveDestination(brainfileDestination?: string): 'local' | 'github' | 'linear';
89
+ export interface ParsedDestination {
90
+ type: 'local' | 'github' | 'linear';
91
+ /** GitHub owner (from github:owner/repo) */
92
+ owner?: string;
93
+ /** GitHub repo (from github:owner/repo) */
94
+ repo?: string;
95
+ /** Linear team key (from linear:TEAM) */
96
+ teamKey?: string;
97
+ }
98
+ /**
99
+ * Parse an archive destination string
100
+ *
101
+ * Formats:
102
+ * - `local` → local archive
103
+ * - `github` → GitHub with config defaults
104
+ * - `github:owner/repo` → GitHub with explicit owner/repo
105
+ * - `linear` → Linear with config defaults
106
+ * - `linear:TEAM` → Linear with explicit team key
107
+ *
108
+ * @param destination - Destination string from brainfile.md or CLI
109
+ * @returns Parsed destination with type and optional target info
110
+ */
111
+ export declare function parseArchiveDestination(destination: string): ParsedDestination | null;
112
+ /**
113
+ * Get effective archive destination with full config resolution
114
+ *
115
+ * @param brainfileDestination - Destination from brainfile.md (may include target)
116
+ * @returns Fully resolved destination with type and target info
117
+ */
118
+ export declare function getEffectiveDestination(brainfileDestination?: string): ParsedDestination;
119
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAA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,iBAAiB;IAChC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACpC,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAsCrF;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,oBAAoB,CAAC,EAAE,MAAM,GAAG,iBAAiB,CA6BxF"}
@@ -0,0 +1,304 @@
1
+ "use strict";
2
+ /**
3
+ * Configuration file management for Brainfile CLI
4
+ *
5
+ * Handles reading/writing ~/.config/brainfile/config.json for:
6
+ * - Archive destination defaults
7
+ * - GitHub connection details (owner, repo)
8
+ * - Linear connection details (teamId)
9
+ * - User preferences
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.getConfigDir = getConfigDir;
48
+ exports.getConfigPath = getConfigPath;
49
+ exports.ensureConfigDir = ensureConfigDir;
50
+ exports.loadConfig = loadConfig;
51
+ exports.saveConfig = saveConfig;
52
+ exports.updateConfig = updateConfig;
53
+ exports.getArchiveConfig = getArchiveConfig;
54
+ exports.setArchiveDefault = setArchiveDefault;
55
+ exports.setGitHubConfig = setGitHubConfig;
56
+ exports.setLinearConfig = setLinearConfig;
57
+ exports.getEffectiveArchiveDestination = getEffectiveArchiveDestination;
58
+ exports.parseArchiveDestination = parseArchiveDestination;
59
+ exports.getEffectiveDestination = getEffectiveDestination;
60
+ const fs = __importStar(require("fs"));
61
+ const path = __importStar(require("path"));
62
+ const os = __importStar(require("os"));
63
+ // ============================================================================
64
+ // Constants
65
+ // ============================================================================
66
+ function resolveHomeDir() {
67
+ const envHome = process.env.XDG_CONFIG_HOME?.trim();
68
+ if (envHome) {
69
+ return envHome;
70
+ }
71
+ const home = process.env.HOME?.trim();
72
+ return home || os.homedir();
73
+ }
74
+ // ============================================================================
75
+ // Config Functions
76
+ // ============================================================================
77
+ /**
78
+ * Get the path to the config directory
79
+ */
80
+ function getConfigDir() {
81
+ const xdgConfigHome = process.env.XDG_CONFIG_HOME?.trim();
82
+ if (xdgConfigHome) {
83
+ return path.join(xdgConfigHome, 'brainfile');
84
+ }
85
+ return path.join(resolveHomeDir(), '.config', 'brainfile');
86
+ }
87
+ /**
88
+ * Get the path to the config file
89
+ */
90
+ function getConfigPath() {
91
+ return path.join(getConfigDir(), 'config.json');
92
+ }
93
+ /**
94
+ * Ensure the config directory exists
95
+ */
96
+ function ensureConfigDir() {
97
+ const configDir = getConfigDir();
98
+ if (!fs.existsSync(configDir)) {
99
+ fs.mkdirSync(configDir, { recursive: true, mode: 0o700 });
100
+ }
101
+ }
102
+ /**
103
+ * Load the config file
104
+ * @returns Config object, or empty object if file doesn't exist
105
+ */
106
+ function loadConfig() {
107
+ const configFile = getConfigPath();
108
+ try {
109
+ if (fs.existsSync(configFile)) {
110
+ const content = fs.readFileSync(configFile, 'utf-8');
111
+ return JSON.parse(content);
112
+ }
113
+ }
114
+ catch (error) {
115
+ // If file is corrupted, return empty config
116
+ console.error(`Warning: Could not read config file: ${error}`);
117
+ }
118
+ return {};
119
+ }
120
+ /**
121
+ * Save the config file
122
+ * @param config - Config object to save
123
+ */
124
+ function saveConfig(config) {
125
+ const configFile = getConfigPath();
126
+ ensureConfigDir();
127
+ fs.writeFileSync(configFile, JSON.stringify(config, null, 2), {
128
+ encoding: 'utf-8',
129
+ mode: 0o600, // Owner read/write only
130
+ });
131
+ }
132
+ /**
133
+ * Update specific config values (merges with existing)
134
+ * @param updates - Partial config to merge
135
+ */
136
+ function updateConfig(updates) {
137
+ const current = loadConfig();
138
+ const updated = deepMerge(current, updates);
139
+ saveConfig(updated);
140
+ return updated;
141
+ }
142
+ /**
143
+ * Get archive configuration with defaults
144
+ */
145
+ function getArchiveConfig() {
146
+ const config = loadConfig();
147
+ return config.archive || { default: 'local' };
148
+ }
149
+ /**
150
+ * Set archive default destination
151
+ */
152
+ function setArchiveDefault(destination) {
153
+ const config = loadConfig();
154
+ config.archive = config.archive || {};
155
+ config.archive.default = destination;
156
+ saveConfig(config);
157
+ }
158
+ /**
159
+ * Set GitHub configuration
160
+ */
161
+ function setGitHubConfig(github) {
162
+ const config = loadConfig();
163
+ config.archive = config.archive || {};
164
+ config.archive.github = { ...config.archive.github, ...github };
165
+ saveConfig(config);
166
+ }
167
+ /**
168
+ * Set Linear configuration
169
+ */
170
+ function setLinearConfig(linear) {
171
+ const config = loadConfig();
172
+ config.archive = config.archive || {};
173
+ config.archive.linear = { ...config.archive.linear, ...linear };
174
+ saveConfig(config);
175
+ }
176
+ /**
177
+ * Get the effective archive destination
178
+ * Priority: brainfile.md archive.destination > config default > 'local'
179
+ *
180
+ * @param brainfileDestination - Destination from brainfile.md (if any)
181
+ * @returns The effective destination
182
+ */
183
+ function getEffectiveArchiveDestination(brainfileDestination) {
184
+ // Priority 1: brainfile.md setting
185
+ if (brainfileDestination && isValidDestination(brainfileDestination)) {
186
+ return brainfileDestination;
187
+ }
188
+ // Priority 2: config default
189
+ const config = getArchiveConfig();
190
+ if (config.default && isValidDestination(config.default)) {
191
+ return config.default;
192
+ }
193
+ // Priority 3: fallback to local
194
+ return 'local';
195
+ }
196
+ /**
197
+ * Parse an archive destination string
198
+ *
199
+ * Formats:
200
+ * - `local` → local archive
201
+ * - `github` → GitHub with config defaults
202
+ * - `github:owner/repo` → GitHub with explicit owner/repo
203
+ * - `linear` → Linear with config defaults
204
+ * - `linear:TEAM` → Linear with explicit team key
205
+ *
206
+ * @param destination - Destination string from brainfile.md or CLI
207
+ * @returns Parsed destination with type and optional target info
208
+ */
209
+ function parseArchiveDestination(destination) {
210
+ if (!destination)
211
+ return null;
212
+ // Simple destinations
213
+ if (destination === 'local') {
214
+ return { type: 'local' };
215
+ }
216
+ if (destination === 'github') {
217
+ return { type: 'github' };
218
+ }
219
+ if (destination === 'linear') {
220
+ return { type: 'linear' };
221
+ }
222
+ // Extended format: github:owner/repo
223
+ if (destination.startsWith('github:')) {
224
+ const target = destination.slice(7); // Remove 'github:'
225
+ const parts = target.split('/');
226
+ if (parts.length === 2 && parts[0] && parts[1]) {
227
+ return { type: 'github', owner: parts[0], repo: parts[1] };
228
+ }
229
+ // Invalid format, treat as plain github
230
+ return { type: 'github' };
231
+ }
232
+ // Extended format: linear:TEAM
233
+ if (destination.startsWith('linear:')) {
234
+ const teamKey = destination.slice(7); // Remove 'linear:'
235
+ if (teamKey) {
236
+ return { type: 'linear', teamKey };
237
+ }
238
+ // Invalid format, treat as plain linear
239
+ return { type: 'linear' };
240
+ }
241
+ return null;
242
+ }
243
+ /**
244
+ * Get effective archive destination with full config resolution
245
+ *
246
+ * @param brainfileDestination - Destination from brainfile.md (may include target)
247
+ * @returns Fully resolved destination with type and target info
248
+ */
249
+ function getEffectiveDestination(brainfileDestination) {
250
+ // Priority 1: brainfile.md setting (may have inline target)
251
+ if (brainfileDestination) {
252
+ const parsed = parseArchiveDestination(brainfileDestination);
253
+ if (parsed) {
254
+ // Fill in missing config from global config
255
+ const config = getArchiveConfig();
256
+ if (parsed.type === 'github' && !parsed.owner) {
257
+ parsed.owner = config.github?.owner;
258
+ parsed.repo = config.github?.repo;
259
+ }
260
+ if (parsed.type === 'linear' && !parsed.teamKey) {
261
+ // We'll resolve teamKey to teamId later in the archive command
262
+ }
263
+ return parsed;
264
+ }
265
+ }
266
+ // Priority 2: config default
267
+ const config = getArchiveConfig();
268
+ if (config.default && isValidDestination(config.default)) {
269
+ return { type: config.default };
270
+ }
271
+ // Priority 3: fallback to local
272
+ return { type: 'local' };
273
+ }
274
+ // ============================================================================
275
+ // Helper Functions
276
+ // ============================================================================
277
+ function isValidDestination(dest) {
278
+ return ['local', 'github', 'linear'].includes(dest);
279
+ }
280
+ /**
281
+ * Deep merge two objects
282
+ */
283
+ function deepMerge(target, source) {
284
+ const result = { ...target };
285
+ for (const key in source) {
286
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
287
+ const sourceValue = source[key];
288
+ const targetValue = result[key];
289
+ if (sourceValue !== null &&
290
+ typeof sourceValue === 'object' &&
291
+ !Array.isArray(sourceValue) &&
292
+ targetValue !== null &&
293
+ typeof targetValue === 'object' &&
294
+ !Array.isArray(targetValue)) {
295
+ result[key] = deepMerge(targetValue, sourceValue);
296
+ }
297
+ else {
298
+ result[key] = sourceValue;
299
+ }
300
+ }
301
+ }
302
+ return result;
303
+ }
304
+ //# sourceMappingURL=config.js.map
@@ -0,0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AED,gCAAgC;IAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC;AAED,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,SAAS,SAAS,CAAgC,MAAS,EAAE,MAAkB;IAC7E,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAE7B,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YACtD,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAChC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAEhC,IACE,WAAW,KAAK,IAAI;gBACpB,OAAO,WAAW,KAAK,QAAQ;gBAC/B,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;gBAC3B,WAAW,KAAK,IAAI;gBACpB,OAAO,WAAW,KAAK,QAAQ;gBAC/B,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAC3B,CAAC;gBACD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACpD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,WAA0C,CAAC;YAC3D,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Contract, Deliverable } from '@brainfile/core';
2
+ export declare const ALLOWED_DELIVERABLE_TYPES: readonly ["file", "test", "docs", "design", "research"];
3
+ export type AllowedDeliverableType = (typeof ALLOWED_DELIVERABLE_TYPES)[number];
4
+ export declare function normalizeToArray(input?: string | string[]): string[];
5
+ export declare function parseDeliverableSpec(spec: string): Deliverable;
6
+ export declare function buildContract(params: {
7
+ deliverableSpecs?: string | string[];
8
+ validationCommands?: string | string[];
9
+ constraints?: string | string[];
10
+ /** Contract status — defaults to 'draft'. Pass 'ready' to make immediately dispatchable. */
11
+ status?: import('@brainfile/core').ContractStatus;
12
+ }): Contract;
13
+ //# sourceMappingURL=contractSpec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contractSpec.d.ts","sourceRoot":"","sources":["../../src/utils/contractSpec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7D,eAAO,MAAM,yBAAyB,yDAA0D,CAAC;AACjG,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhF,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAGpE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CA8C9D;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE;IACpC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,4FAA4F;IAC5F,MAAM,CAAC,EAAE,OAAO,iBAAiB,EAAE,cAAc,CAAC;CACnD,GAAG,QAAQ,CAmBX"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ALLOWED_DELIVERABLE_TYPES = void 0;
4
+ exports.normalizeToArray = normalizeToArray;
5
+ exports.parseDeliverableSpec = parseDeliverableSpec;
6
+ exports.buildContract = buildContract;
7
+ exports.ALLOWED_DELIVERABLE_TYPES = ['file', 'test', 'docs', 'design', 'research'];
8
+ function normalizeToArray(input) {
9
+ if (!input)
10
+ return [];
11
+ return Array.isArray(input) ? input : [input];
12
+ }
13
+ function parseDeliverableSpec(spec) {
14
+ const raw = spec.trim();
15
+ if (!raw) {
16
+ throw new Error('Deliverable spec is required');
17
+ }
18
+ const firstColon = raw.indexOf(':');
19
+ if (firstColon === -1) {
20
+ throw new Error(`Invalid deliverable format: "${spec}". Expected "type:path:description" (description optional).`);
21
+ }
22
+ const type = raw.slice(0, firstColon).trim();
23
+ const rest = raw.slice(firstColon + 1);
24
+ const secondColon = rest.indexOf(':');
25
+ const path = (secondColon === -1 ? rest : rest.slice(0, secondColon)).trim();
26
+ const description = (secondColon === -1 ? '' : rest.slice(secondColon + 1)).trim();
27
+ if (!type) {
28
+ throw new Error(`Invalid deliverable format: "${spec}". Expected "type:path:description" with non-empty type.`);
29
+ }
30
+ if (!path) {
31
+ throw new Error(`Invalid deliverable format: "${spec}". Expected "type:path:description" with non-empty path.`);
32
+ }
33
+ const typeLower = type.toLowerCase();
34
+ if (!exports.ALLOWED_DELIVERABLE_TYPES.includes(typeLower)) {
35
+ throw new Error(`Invalid deliverable type: "${type}". Expected one of: ${exports.ALLOWED_DELIVERABLE_TYPES.join(', ')}`);
36
+ }
37
+ const deliverable = {
38
+ type: typeLower,
39
+ path,
40
+ ...(description ? { description } : {}),
41
+ };
42
+ return deliverable;
43
+ }
44
+ function buildContract(params) {
45
+ const deliverableSpecs = normalizeToArray(params.deliverableSpecs);
46
+ const validationCommands = normalizeToArray(params.validationCommands).map((c) => c.trim()).filter(Boolean);
47
+ const constraints = normalizeToArray(params.constraints).map((c) => c.trim()).filter(Boolean);
48
+ const status = params.status ?? 'draft';
49
+ const deliverables = deliverableSpecs.map(parseDeliverableSpec);
50
+ const contract = {
51
+ status,
52
+ ...(deliverables.length > 0 ? { deliverables } : {}),
53
+ ...(validationCommands.length > 0 ? { validation: { commands: validationCommands } } : {}),
54
+ ...(constraints.length > 0 ? { constraints } : {}),
55
+ ...(status === 'ready'
56
+ ? { metrics: { readyAt: new Date().toISOString() } }
57
+ : {}),
58
+ };
59
+ return contract;
60
+ }
61
+ //# sourceMappingURL=contractSpec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contractSpec.js","sourceRoot":"","sources":["../../src/utils/contractSpec.ts"],"names":[],"mappings":";;;AAKA,4CAGC;AAED,oDA8CC;AAED,sCAyBC;AAjFY,QAAA,yBAAyB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC;AAGjG,SAAgB,gBAAgB,CAAC,KAAyB;IACxD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACxB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,gCAAgC,IAAI,6DAA6D,CAClG,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAEvC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC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AAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5G,MAAM,WAAW,GAAG,gBAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9F,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC;IAExC,MAAM,YAAY,GAAG,gBAAgB,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAEhE,MAAM,QAAQ,GAAa;QACzB,MAAM;QACN,GAAG,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,GAAG,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1F,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,GAAG,CAAC,MAAM,KAAK,OAAO;YACpB,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAyB,EAAE;YAC3E,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Ensure `.brainfile/.gitignore` exists and remove legacy `state.json` entries.
3
+ */
4
+ export declare function ensureDotBrainfileGitignore(brainfilePath: string): string;
5
+ /**
6
+ * Remove legacy `.brainfile/state.json` if it exists.
7
+ */
8
+ export declare function removeLegacyStateFile(brainfilePath: string): string;
9
+ //# sourceMappingURL=dot-brainfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dot-brainfile.d.ts","sourceRoot":"","sources":["../../src/utils/dot-brainfile.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAezE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAOnE"}