@brainfile/cli 0.13.3 → 0.15.1

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 (154) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +129 -354
  3. package/dist/cli.js +91 -5
  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 +163 -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.map +1 -1
  27. package/dist/commands/init.js +38 -19
  28. package/dist/commands/init.js.map +1 -1
  29. package/dist/commands/list.d.ts +1 -0
  30. package/dist/commands/list.d.ts.map +1 -1
  31. package/dist/commands/list.js +35 -12
  32. package/dist/commands/list.js.map +1 -1
  33. package/dist/commands/log.d.ts +52 -0
  34. package/dist/commands/log.d.ts.map +1 -0
  35. package/dist/commands/log.js +246 -0
  36. package/dist/commands/log.js.map +1 -0
  37. package/dist/commands/mcp.d.ts.map +1 -1
  38. package/dist/commands/mcp.js +864 -44
  39. package/dist/commands/mcp.js.map +1 -1
  40. package/dist/commands/migrate.d.ts +4 -3
  41. package/dist/commands/migrate.d.ts.map +1 -1
  42. package/dist/commands/migrate.js +225 -33
  43. package/dist/commands/migrate.js.map +1 -1
  44. package/dist/commands/move.d.ts.map +1 -1
  45. package/dist/commands/move.js +90 -0
  46. package/dist/commands/move.js.map +1 -1
  47. package/dist/commands/patch.d.ts.map +1 -1
  48. package/dist/commands/patch.js +85 -13
  49. package/dist/commands/patch.js.map +1 -1
  50. package/dist/commands/search.d.ts +33 -0
  51. package/dist/commands/search.d.ts.map +1 -0
  52. package/dist/commands/search.js +209 -0
  53. package/dist/commands/search.js.map +1 -0
  54. package/dist/commands/show.d.ts.map +1 -1
  55. package/dist/commands/show.js +75 -1
  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 +72 -5
  59. package/dist/commands/subtask.js.map +1 -1
  60. package/dist/commands/tui.d.ts.map +1 -1
  61. package/dist/commands/tui.js +10 -0
  62. package/dist/commands/tui.js.map +1 -1
  63. package/dist/commands/types.d.ts +40 -0
  64. package/dist/commands/types.d.ts.map +1 -0
  65. package/dist/commands/types.js +242 -0
  66. package/dist/commands/types.js.map +1 -0
  67. package/dist/index.d.ts +1 -0
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +3 -1
  70. package/dist/index.js.map +1 -1
  71. package/dist/lib/contractRunner.d.ts.map +1 -1
  72. package/dist/lib/contractRunner.js +177 -12
  73. package/dist/lib/contractRunner.js.map +1 -1
  74. package/dist/schemas/board.json +105 -18
  75. package/dist/tui/BrainfileTUI.d.ts.map +1 -1
  76. package/dist/tui/BrainfileTUI.js +23 -20
  77. package/dist/tui/BrainfileTUI.js.map +1 -1
  78. package/dist/tui/actions.d.ts +5 -5
  79. package/dist/tui/actions.d.ts.map +1 -1
  80. package/dist/tui/actions.js +335 -47
  81. package/dist/tui/actions.js.map +1 -1
  82. package/dist/tui/components/ArchivePanel.js +1 -1
  83. package/dist/tui/components/ArchivePanel.js.map +1 -1
  84. package/dist/tui/components/ColumnTabs.d.ts.map +1 -1
  85. package/dist/tui/components/ColumnTabs.js +6 -2
  86. package/dist/tui/components/ColumnTabs.js.map +1 -1
  87. package/dist/tui/components/HelpOverlay.js +3 -3
  88. package/dist/tui/components/HelpOverlay.js.map +1 -1
  89. package/dist/tui/components/LogsPanel.d.ts +16 -0
  90. package/dist/tui/components/LogsPanel.d.ts.map +1 -0
  91. package/dist/tui/components/LogsPanel.js +115 -0
  92. package/dist/tui/components/LogsPanel.js.map +1 -0
  93. package/dist/tui/components/MainPanelTabs.d.ts +2 -2
  94. package/dist/tui/components/MainPanelTabs.d.ts.map +1 -1
  95. package/dist/tui/components/MainPanelTabs.js +3 -3
  96. package/dist/tui/components/MainPanelTabs.js.map +1 -1
  97. package/dist/tui/components/StackedTaskList.d.ts +2 -1
  98. package/dist/tui/components/StackedTaskList.d.ts.map +1 -1
  99. package/dist/tui/components/StackedTaskList.js +9 -9
  100. package/dist/tui/components/StackedTaskList.js.map +1 -1
  101. package/dist/tui/components/TaskCard.d.ts +2 -1
  102. package/dist/tui/components/TaskCard.d.ts.map +1 -1
  103. package/dist/tui/components/TaskCard.js +41 -5
  104. package/dist/tui/components/TaskCard.js.map +1 -1
  105. package/dist/tui/components/TaskCardMeasure.d.ts +2 -16
  106. package/dist/tui/components/TaskCardMeasure.d.ts.map +1 -1
  107. package/dist/tui/components/TaskCardMeasure.js +30 -25
  108. package/dist/tui/components/TaskCardMeasure.js.map +1 -1
  109. package/dist/tui/components/TaskDetail.d.ts +2 -3
  110. package/dist/tui/components/TaskDetail.d.ts.map +1 -1
  111. package/dist/tui/components/TaskDetail.js +35 -12
  112. package/dist/tui/components/TaskDetail.js.map +1 -1
  113. package/dist/tui/components/TaskList.d.ts +2 -1
  114. package/dist/tui/components/TaskList.d.ts.map +1 -1
  115. package/dist/tui/components/TaskList.js +5 -5
  116. package/dist/tui/components/TaskList.js.map +1 -1
  117. package/dist/tui/components/index.d.ts +2 -2
  118. package/dist/tui/components/index.d.ts.map +1 -1
  119. package/dist/tui/components/index.js +3 -3
  120. package/dist/tui/components/index.js.map +1 -1
  121. package/dist/tui/hooks/useBrainfileLoader.d.ts.map +1 -1
  122. package/dist/tui/hooks/useBrainfileLoader.js +97 -31
  123. package/dist/tui/hooks/useBrainfileLoader.js.map +1 -1
  124. package/dist/tui/hooks/useKeyboardNavigation.d.ts.map +1 -1
  125. package/dist/tui/hooks/useKeyboardNavigation.js +47 -47
  126. package/dist/tui/hooks/useKeyboardNavigation.js.map +1 -1
  127. package/dist/tui/types.d.ts +7 -7
  128. package/dist/tui/types.d.ts.map +1 -1
  129. package/dist/utils/board-types.d.ts +13 -0
  130. package/dist/utils/board-types.d.ts.map +1 -0
  131. package/dist/utils/board-types.js +7 -0
  132. package/dist/utils/board-types.js.map +1 -0
  133. package/dist/utils/dot-brainfile.d.ts +9 -0
  134. package/dist/utils/dot-brainfile.d.ts.map +1 -0
  135. package/dist/utils/dot-brainfile.js +74 -0
  136. package/dist/utils/dot-brainfile.js.map +1 -0
  137. package/dist/utils/strict-validation.d.ts +8 -0
  138. package/dist/utils/strict-validation.d.ts.map +1 -0
  139. package/dist/utils/strict-validation.js +41 -0
  140. package/dist/utils/strict-validation.js.map +1 -0
  141. package/dist/utils/v2-detect.d.ts +28 -0
  142. package/dist/utils/v2-detect.d.ts.map +1 -0
  143. package/dist/utils/v2-detect.js +112 -0
  144. package/dist/utils/v2-detect.js.map +1 -0
  145. package/dist/utils/v2-tasks.d.ts +121 -0
  146. package/dist/utils/v2-tasks.d.ts.map +1 -0
  147. package/dist/utils/v2-tasks.js +384 -0
  148. package/dist/utils/v2-tasks.js.map +1 -0
  149. package/dist/utils/workspace-format.d.ts +25 -0
  150. package/dist/utils/workspace-format.d.ts.map +1 -0
  151. package/dist/utils/workspace-format.js +106 -0
  152. package/dist/utils/workspace-format.js.map +1 -0
  153. package/package.json +3 -3
  154. package/state.json +3 -0
@@ -1,7 +1,7 @@
1
1
  import type { Board, Task } from '@brainfile/core';
2
2
  export type BoardColumn = Board['columns'][number];
3
3
  /** Main panel tabs */
4
- export type MainPanel = 'tasks' | 'rules' | 'archive';
4
+ export type MainPanel = 'tasks' | 'rules' | 'logs';
5
5
  /** Responsive layout mode */
6
6
  export type LayoutMode = 'wide' | 'narrow';
7
7
  /** Layout breakpoints */
@@ -12,7 +12,7 @@ export declare const LAYOUT: {
12
12
  };
13
13
  /** Rule categories */
14
14
  export type RuleType = 'always' | 'never' | 'prefer' | 'context';
15
- export type ViewMode = 'browse' | 'search' | 'help' | 'move' | 'delete-confirm' | 'subtask' | 'new-task' | 'rule-add' | 'rule-edit' | 'rule-delete-confirm' | 'archive-restore' | 'archive-delete-confirm';
15
+ export type ViewMode = 'browse' | 'search' | 'help' | 'move' | 'delete-confirm' | 'subtask' | 'new-task' | 'rule-add' | 'rule-edit' | 'rule-delete-confirm' | 'logs-restore' | 'logs-delete-confirm';
16
16
  export interface StatusMessage {
17
17
  text: string;
18
18
  type: 'success' | 'error' | 'info';
@@ -39,11 +39,11 @@ export interface AppState {
39
39
  selectedRuleIndex: number;
40
40
  ruleEditText: string;
41
41
  ruleEditId: number | null;
42
- archive: Task[];
43
- selectedArchiveIndex: number;
44
- archiveSearchQuery: string;
45
- archiveRestoreColumnIndex: number;
46
- expandedArchiveIds: Set<string>;
42
+ logs: Task[];
43
+ selectedLogIndex: number;
44
+ logSearchQuery: string;
45
+ logRestoreColumnIndex: number;
46
+ expandedLogIds: Set<string>;
47
47
  }
48
48
  export interface TUIProps {
49
49
  filePath: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tui/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,sBAAsB;AACtB,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC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,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,IAAI,CAAC;IAGlB,WAAW,EAAE,SAAS,CAAC;IAGvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAG5B,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IAGpB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IAGrB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAG/B,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAGpC,eAAe,EAAE,MAAM,CAAC;IAGxB,oBAAoB,EAAE,MAAM,CAAC;IAG7B,YAAY,EAAE,MAAM,CAAC;IAGrB,cAAc,EAAE,QAAQ,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,WAAW,IAAI,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Board } from '@brainfile/core';
2
+ export interface TypeEntry {
3
+ idPrefix: string;
4
+ completable?: boolean;
5
+ schema?: string;
6
+ }
7
+ export interface TypesConfig {
8
+ [typeName: string]: TypeEntry;
9
+ }
10
+ export declare function getBoardTypes(board: Board & {
11
+ types?: TypesConfig;
12
+ }): TypesConfig;
13
+ //# sourceMappingURL=board-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-types.d.ts","sourceRoot":"","sources":["../../src/utils/board-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,WAAW,CAAA;CAAE,GAAG,WAAW,CAEjF"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBoardTypes = getBoardTypes;
4
+ function getBoardTypes(board) {
5
+ return board.types ?? {};
6
+ }
7
+ //# sourceMappingURL=board-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-types.js","sourceRoot":"","sources":["../../src/utils/board-types.ts"],"names":[],"mappings":";;AAYA,sCAEC;AAFD,SAAgB,aAAa,CAAC,KAAsC;IAClE,OAAO,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;AAC3B,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"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ensureDotBrainfileGitignore = ensureDotBrainfileGitignore;
37
+ exports.removeLegacyStateFile = removeLegacyStateFile;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ function getDotBrainfileDir(brainfilePath) {
41
+ const abs = path.resolve(brainfilePath);
42
+ const dir = path.dirname(abs);
43
+ if (path.basename(dir) === '.brainfile')
44
+ return dir;
45
+ return path.join(dir, '.brainfile');
46
+ }
47
+ /**
48
+ * Ensure `.brainfile/.gitignore` exists and remove legacy `state.json` entries.
49
+ */
50
+ function ensureDotBrainfileGitignore(brainfilePath) {
51
+ const dotDir = getDotBrainfileDir(brainfilePath);
52
+ fs.mkdirSync(dotDir, { recursive: true });
53
+ const gitignorePath = path.join(dotDir, '.gitignore');
54
+ const existing = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf-8') : '';
55
+ const filtered = existing
56
+ .split(/\r?\n/)
57
+ .filter((line) => line.trim() !== 'state.json')
58
+ .join('\n')
59
+ .trimEnd();
60
+ fs.writeFileSync(gitignorePath, filtered.length > 0 ? `${filtered}\n` : '', 'utf-8');
61
+ return gitignorePath;
62
+ }
63
+ /**
64
+ * Remove legacy `.brainfile/state.json` if it exists.
65
+ */
66
+ function removeLegacyStateFile(brainfilePath) {
67
+ const dotDir = getDotBrainfileDir(brainfilePath);
68
+ const statePath = path.join(dotDir, 'state.json');
69
+ if (fs.existsSync(statePath)) {
70
+ fs.rmSync(statePath, { force: true });
71
+ }
72
+ return statePath;
73
+ }
74
+ //# sourceMappingURL=dot-brainfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dot-brainfile.js","sourceRoot":"","sources":["../../src/utils/dot-brainfile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,kEAeC;AAKD,sDAOC;AAxCD,uCAAyB;AACzB,2CAA6B;AAE7B,SAAS,kBAAkB,CAAC,aAAqB;IAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CA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E,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Board } from '@brainfile/core';
2
+ export interface BoardValidationResult {
3
+ valid: boolean;
4
+ error?: string;
5
+ }
6
+ export declare function validateType(board: Board, typeName: string): BoardValidationResult;
7
+ export declare function validateColumn(board: Board, columnId: string): BoardValidationResult;
8
+ //# sourceMappingURL=strict-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strict-validation.d.ts","sourceRoot":"","sources":["../../src/utils/strict-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AASD,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,GAAG,qBAAqB,CAsBlF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,GAAG,qBAAqB,CAkBpF"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateType = validateType;
4
+ exports.validateColumn = validateColumn;
5
+ const coreValidation = require('@brainfile/core');
6
+ function validateType(board, typeName) {
7
+ if (typeof coreValidation.validateType === 'function') {
8
+ return coreValidation.validateType(board, typeName);
9
+ }
10
+ const strict = board.strict;
11
+ const types = board.types;
12
+ if (!strict || !types) {
13
+ return { valid: true };
14
+ }
15
+ if (typeName === 'task' || Object.prototype.hasOwnProperty.call(types, typeName)) {
16
+ return { valid: true };
17
+ }
18
+ const definedKeys = Object.keys(types);
19
+ const availableTypes = definedKeys.includes('task') ? definedKeys : ['task', ...definedKeys];
20
+ return {
21
+ valid: false,
22
+ error: `Type '${typeName}' is not defined. Available types: ${availableTypes.join(', ')}`,
23
+ };
24
+ }
25
+ function validateColumn(board, columnId) {
26
+ if (typeof coreValidation.validateColumn === 'function') {
27
+ return coreValidation.validateColumn(board, columnId);
28
+ }
29
+ if (!board.strict) {
30
+ return { valid: true };
31
+ }
32
+ const columnIds = board.columns.map(column => column.id);
33
+ if (columnIds.includes(columnId)) {
34
+ return { valid: true };
35
+ }
36
+ return {
37
+ valid: false,
38
+ error: `Column '${columnId}' is not defined. Available columns: ${columnIds.join(', ')}`,
39
+ };
40
+ }
41
+ //# sourceMappingURL=strict-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strict-validation.js","sourceRoot":"","sources":["../../src/utils/strict-validation.ts"],"names":[],"mappings":";;AAcA,oCAsBC;AAED,wCAkBC;AA5CD,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAA0B,CAAC;AAE3E,SAAgB,YAAY,CAAC,KAAY,EAAE,QAAgB;IACzD,IAAI,OAAO,cAAc,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;QACtD,OAAO,cAAc,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,MAAM,GAAI,KAAa,CAAC,MAAM,CAAC;IACrC,MAAM,KAAK,GAAI,KAAa,CAAC,KAA4C,CAAC;IAE1E,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACtB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,QAAQ,KAAK,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;QACjF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC;IAC7F,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,SAAS,QAAQ,sCAAsC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KAC1F,CAAC;AACJ,CAAC;AAED,SAAgB,cAAc,CAAC,KAAY,EAAE,QAAgB;IAC3D,IAAI,OAAO,cAAc,CAAC,cAAc,KAAK,UAAU,EAAE,CAAC;QACxD,OAAO,cAAc,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,CAAE,KAAa,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzD,IAAI,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,WAAW,QAAQ,wCAAwC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KACzF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * V2 per-task file architecture detection, path resolution, and body helpers.
3
+ *
4
+ * Core owns these helpers (`@brainfile/core` workspace exports). This file
5
+ * re-exports them for existing CLI imports and retains CLI-only migration
6
+ * hint helpers.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ export { type V2Dirs, getV2Dirs, isV2, ensureV2Dirs, getTaskFilePath, getLogFilePath, findV2Task, extractDescription, extractLog, composeBody, readV2BoardConfig, buildBoardFromV2, } from '@brainfile/core';
11
+ /**
12
+ * Check whether we should show the one-time migration suggestion.
13
+ *
14
+ * Returns true when ALL of these hold:
15
+ * a. The workspace appears to be in a legacy or mixed layout, OR this file
16
+ * itself looks like a legacy board file.
17
+ * b. This process has not already shown the hint for this brainfile path.
18
+ */
19
+ export declare function shouldSuggestV2Migration(brainfilePath: string): boolean;
20
+ /**
21
+ * Record that the migration hint has been shown so it won't appear again.
22
+ *
23
+ * This is intentionally in-memory only; Brainfile no longer persists state.json.
24
+ */
25
+ export declare function markV2MigrationHintShown(brainfilePath: string): void;
26
+ /** @internal test helper */
27
+ export declare function __resetV2MigrationHintState(): void;
28
+ //# sourceMappingURL=v2-detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2-detect.d.ts","sourceRoot":"","sources":["../../src/utils/v2-detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EACL,KAAK,MAAM,EACX,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAYzB;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAuBvE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAEpE;AAED,4BAA4B;AAC5B,wBAAgB,2BAA2B,IAAI,IAAI,CAElD"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * V2 per-task file architecture detection, path resolution, and body helpers.
4
+ *
5
+ * Core owns these helpers (`@brainfile/core` workspace exports). This file
6
+ * re-exports them for existing CLI imports and retains CLI-only migration
7
+ * hint helpers.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
+ desc = { enumerable: true, get: function() { return m[k]; } };
16
+ }
17
+ Object.defineProperty(o, k2, desc);
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || (function () {
28
+ var ownKeys = function(o) {
29
+ ownKeys = Object.getOwnPropertyNames || function (o) {
30
+ var ar = [];
31
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
+ return ar;
33
+ };
34
+ return ownKeys(o);
35
+ };
36
+ return function (mod) {
37
+ if (mod && mod.__esModule) return mod;
38
+ var result = {};
39
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
+ __setModuleDefault(result, mod);
41
+ return result;
42
+ };
43
+ })();
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.buildBoardFromV2 = exports.readV2BoardConfig = exports.composeBody = exports.extractLog = exports.extractDescription = exports.findV2Task = exports.getLogFilePath = exports.getTaskFilePath = exports.ensureV2Dirs = exports.isV2 = exports.getV2Dirs = void 0;
46
+ exports.shouldSuggestV2Migration = shouldSuggestV2Migration;
47
+ exports.markV2MigrationHintShown = markV2MigrationHintShown;
48
+ exports.__resetV2MigrationHintState = __resetV2MigrationHintState;
49
+ const fs = __importStar(require("fs"));
50
+ const path = __importStar(require("path"));
51
+ const core_1 = require("@brainfile/core");
52
+ // ── Re-exports from core ─────────────────────────────────────────────
53
+ var core_2 = require("@brainfile/core");
54
+ Object.defineProperty(exports, "getV2Dirs", { enumerable: true, get: function () { return core_2.getV2Dirs; } });
55
+ Object.defineProperty(exports, "isV2", { enumerable: true, get: function () { return core_2.isV2; } });
56
+ Object.defineProperty(exports, "ensureV2Dirs", { enumerable: true, get: function () { return core_2.ensureV2Dirs; } });
57
+ Object.defineProperty(exports, "getTaskFilePath", { enumerable: true, get: function () { return core_2.getTaskFilePath; } });
58
+ Object.defineProperty(exports, "getLogFilePath", { enumerable: true, get: function () { return core_2.getLogFilePath; } });
59
+ Object.defineProperty(exports, "findV2Task", { enumerable: true, get: function () { return core_2.findV2Task; } });
60
+ Object.defineProperty(exports, "extractDescription", { enumerable: true, get: function () { return core_2.extractDescription; } });
61
+ Object.defineProperty(exports, "extractLog", { enumerable: true, get: function () { return core_2.extractLog; } });
62
+ Object.defineProperty(exports, "composeBody", { enumerable: true, get: function () { return core_2.composeBody; } });
63
+ Object.defineProperty(exports, "readV2BoardConfig", { enumerable: true, get: function () { return core_2.readV2BoardConfig; } });
64
+ Object.defineProperty(exports, "buildBoardFromV2", { enumerable: true, get: function () { return core_2.buildBoardFromV2; } });
65
+ // ── CLI-specific migration hint helpers ──────────────────────────────
66
+ const core_3 = require("@brainfile/core");
67
+ const workspace_format_1 = require("./workspace-format");
68
+ const v2MigrationHintShown = new Set();
69
+ /**
70
+ * Check whether we should show the one-time migration suggestion.
71
+ *
72
+ * Returns true when ALL of these hold:
73
+ * a. The workspace appears to be in a legacy or mixed layout, OR this file
74
+ * itself looks like a legacy board file.
75
+ * b. This process has not already shown the hint for this brainfile path.
76
+ */
77
+ function shouldSuggestV2Migration(brainfilePath) {
78
+ const resolved = path.resolve(brainfilePath);
79
+ if (v2MigrationHintShown.has(resolved))
80
+ return false;
81
+ const probe = (0, workspace_format_1.probeWorkspaceForBrainfile)(resolved);
82
+ if ((0, workspace_format_1.shouldSuggestMigration)(probe)) {
83
+ return true;
84
+ }
85
+ // Fallback: explicit non-standard board files (e.g. fixtures/test-board.md)
86
+ // should still receive a migration suggestion when they parse as v1 board files.
87
+ if (!(0, core_3.isV2)(resolved) && fs.existsSync(resolved)) {
88
+ try {
89
+ const content = fs.readFileSync(resolved, 'utf-8');
90
+ const parsed = core_1.Brainfile.parseWithErrors(content);
91
+ if (parsed.board)
92
+ return true;
93
+ }
94
+ catch {
95
+ // Ignore parse/read errors and suppress hint.
96
+ }
97
+ }
98
+ return false;
99
+ }
100
+ /**
101
+ * Record that the migration hint has been shown so it won't appear again.
102
+ *
103
+ * This is intentionally in-memory only; Brainfile no longer persists state.json.
104
+ */
105
+ function markV2MigrationHintShown(brainfilePath) {
106
+ v2MigrationHintShown.add(path.resolve(brainfilePath));
107
+ }
108
+ /** @internal test helper */
109
+ function __resetV2MigrationHintState() {
110
+ v2MigrationHintShown.clear();
111
+ }
112
+ //# sourceMappingURL=v2-detect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2-detect.js","sourceRoot":"","sources":["../../src/utils/v2-detect.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCH,4DAuBC;AAOD,4DAEC;AAGD,kEAEC;AA5ED,uCAAyB;AACzB,2CAA6B;AAC7B,0CAA4C;AAE5C,wEAAwE;AAExE,wCAayB;AAXvB,iGAAA,SAAS,OAAA;AACT,4FAAA,IAAI,OAAA;AACJ,oGAAA,YAAY,OAAA;AACZ,uGAAA,eAAe,OAAA;AACf,sGAAA,cAAc,OAAA;AACd,kGAAA,UAAU,OAAA;AACV,0GAAA,kBAAkB,OAAA;AAClB,kGAAA,UAAU,OAAA;AACV,mGAAA,WAAW,OAAA;AACX,yGAAA,iBAAiB,OAAA;AACjB,wGAAA,gBAAgB,OAAA;AAGlB,wEAAwE;AAExE,0CAAuC;AACvC,yDAG4B;AAE5B,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;AAE/C;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAC,aAAqB;IAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAE7C,IAAI,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAErD,MAAM,KAAK,GAAG,IAAA,6CAA0B,EAAC,QAAQ,CAAC,CAAC;IACnD,IAAI,IAAA,yCAAsB,EAAC,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,4EAA4E;IAC5E,iFAAiF;IACjF,IAAI,CAAC,IAAA,WAAI,EAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,gBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YAClD,IAAI,MAAM,CAAC,KAAK;gBAAE,OAAO,IAAI,CAAC;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,8CAA8C;QAChD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,aAAqB;IAC5D,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,4BAA4B;AAC5B,SAAgB,2BAA2B;IACzC,oBAAoB,CAAC,KAAK,EAAE,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * V2 per-task file architecture utilities.
3
+ *
4
+ * In v2, tasks live as individual .md files in .brainfile/tasks/ (active)
5
+ * and .brainfile/logs/ (completed). The brainfile.md is config-only.
6
+ *
7
+ * Task file format:
8
+ * ---
9
+ * id: task-1
10
+ * title: My Task
11
+ * column: todo
12
+ * position: 0
13
+ * priority: high
14
+ * tags: [bug, urgent]
15
+ * assignee: alice
16
+ * contract:
17
+ * status: ready
18
+ * ...
19
+ * ---
20
+ *
21
+ * ## Description
22
+ * Task description here...
23
+ *
24
+ * ## Log
25
+ * - 2026-02-18T10:00:00Z: Created task
26
+ *
27
+ * @packageDocumentation
28
+ */
29
+ import type { Task, Board } from '@brainfile/core';
30
+ export interface V2Task extends Task {
31
+ column: string;
32
+ position: number;
33
+ completedAt?: string;
34
+ }
35
+ export interface V2TaskFile {
36
+ frontmatter: V2Task;
37
+ description?: string;
38
+ log?: string;
39
+ rawMarkdown: string;
40
+ }
41
+ export interface V2Dirs {
42
+ dotDir: string;
43
+ tasksDir: string;
44
+ logsDir: string;
45
+ brainfilePath: string;
46
+ }
47
+ /**
48
+ * Get the v2 directory structure paths from a brainfile path.
49
+ */
50
+ export declare function getV2Dirs(brainfilePath: string): V2Dirs;
51
+ /**
52
+ * Check if a brainfile is using v2 per-task file architecture.
53
+ * V2 is detected by the presence of a tasks/ directory in .brainfile/.
54
+ */
55
+ export declare function isV2(brainfilePath: string): boolean;
56
+ /**
57
+ * Get the file path for a task.
58
+ */
59
+ export declare function getTaskFilePath(tasksDir: string, taskId: string): string;
60
+ /**
61
+ * Get the file path for a completed task (log).
62
+ */
63
+ export declare function getLogFilePath(logsDir: string, taskId: string): string;
64
+ /**
65
+ * Ensure the v2 directory structure exists.
66
+ */
67
+ export declare function ensureV2Dirs(brainfilePath: string): V2Dirs;
68
+ /**
69
+ * Parse a task .md file into frontmatter and markdown sections.
70
+ */
71
+ export declare function parseTaskFile(content: string): V2TaskFile;
72
+ /**
73
+ * Serialize a task to .md file format.
74
+ */
75
+ export declare function serializeTaskFile(task: V2Task, description?: string, log?: string): string;
76
+ /**
77
+ * Read a single task file.
78
+ */
79
+ export declare function readTaskFile(filePath: string): V2TaskFile;
80
+ /**
81
+ * Read all active tasks from the tasks/ directory.
82
+ */
83
+ export declare function readAllTasks(tasksDir: string): V2TaskFile[];
84
+ /**
85
+ * Read all completed tasks from the logs/ directory.
86
+ */
87
+ export declare function readAllLogs(logsDir: string): V2TaskFile[];
88
+ /**
89
+ * Find a task by ID across active tasks and optionally logs.
90
+ */
91
+ export declare function findV2Task(dirs: V2Dirs, taskId: string, searchLogs?: boolean): {
92
+ taskFile: V2TaskFile;
93
+ filePath: string;
94
+ isLog: boolean;
95
+ } | null;
96
+ /**
97
+ * Write a task file.
98
+ */
99
+ export declare function writeTaskFile(filePath: string, task: V2Task, description?: string, log?: string): void;
100
+ /**
101
+ * Convert a v1 Task to a V2Task with column and position.
102
+ */
103
+ export declare function taskToV2(task: Task, column: string, position: number): V2Task;
104
+ /**
105
+ * Convert a V2Task back to a v1 Task (stripping column/position).
106
+ */
107
+ export declare function v2ToTask(v2task: V2Task): Task;
108
+ /**
109
+ * Read the v2 board config (columns, rules, etc. without embedded tasks).
110
+ */
111
+ export declare function readV2BoardConfig(brainfilePath: string): Board;
112
+ /**
113
+ * Build a full v1-compatible Board from v2 per-task files.
114
+ * Reads the board config and populates column tasks from the tasks/ directory.
115
+ */
116
+ export declare function buildBoardFromV2(brainfilePath: string): Board;
117
+ /**
118
+ * Generate the next task ID by scanning existing task files.
119
+ */
120
+ export declare function generateNextV2TaskId(dirs: V2Dirs): string;
121
+ //# sourceMappingURL=v2-tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2-tasks.d.ts","sourceRoot":"","sources":["../../src/utils/v2-tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAU,MAAM,iBAAiB,CAAC;AAM3D,MAAM,WAAW,MAAO,SAAQ,IAAI;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;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