brainfile 0.20.0 → 0.21.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 (90) hide show
  1. package/dist/{chunk-UOCQBEEW.mjs → chunk-MUV7XTFA.mjs} +1345 -316
  2. package/dist/cli.mjs +2196 -1349
  3. package/dist/commands/brief.d.ts +1 -0
  4. package/dist/commands/brief.d.ts.map +1 -1
  5. package/dist/commands/brief.js +10 -0
  6. package/dist/commands/brief.js.map +1 -1
  7. package/dist/commands/init.d.ts +14 -0
  8. package/dist/commands/init.d.ts.map +1 -1
  9. package/dist/commands/init.js +115 -15
  10. package/dist/commands/init.js.map +1 -1
  11. package/dist/commands/log.d.ts.map +1 -1
  12. package/dist/commands/log.js +4 -1
  13. package/dist/commands/log.js.map +1 -1
  14. package/dist/commands/mcp.d.ts.map +1 -1
  15. package/dist/commands/mcp.js +44 -0
  16. package/dist/commands/mcp.js.map +1 -1
  17. package/dist/commands/merge-driver.d.ts +26 -0
  18. package/dist/commands/merge-driver.d.ts.map +1 -0
  19. package/dist/commands/merge-driver.js +195 -0
  20. package/dist/commands/merge-driver.js.map +1 -0
  21. package/dist/commands/migrate-tracked.d.ts +8 -0
  22. package/dist/commands/migrate-tracked.d.ts.map +1 -0
  23. package/dist/commands/migrate-tracked.js +428 -0
  24. package/dist/commands/migrate-tracked.js.map +1 -0
  25. package/dist/commands/migrate.d.ts +6 -0
  26. package/dist/commands/migrate.d.ts.map +1 -1
  27. package/dist/commands/migrate.js +9 -0
  28. package/dist/commands/migrate.js.map +1 -1
  29. package/dist/commands/sync.d.ts +18 -0
  30. package/dist/commands/sync.d.ts.map +1 -0
  31. package/dist/commands/sync.js +161 -0
  32. package/dist/commands/sync.js.map +1 -0
  33. package/dist/commands/where.d.ts +24 -0
  34. package/dist/commands/where.d.ts.map +1 -0
  35. package/dist/commands/where.js +141 -0
  36. package/dist/commands/where.js.map +1 -0
  37. package/dist/mcp/helpers.d.ts +9 -0
  38. package/dist/mcp/helpers.d.ts.map +1 -1
  39. package/dist/mcp/helpers.js +43 -0
  40. package/dist/mcp/helpers.js.map +1 -1
  41. package/dist/mcp/tools/brief_tool.d.ts.map +1 -1
  42. package/dist/mcp/tools/brief_tool.js +39 -1
  43. package/dist/mcp/tools/brief_tool.js.map +1 -1
  44. package/dist/mcp/tools/contract_tool.d.ts.map +1 -1
  45. package/dist/mcp/tools/contract_tool.js +6 -5
  46. package/dist/mcp/tools/contract_tool.js.map +1 -1
  47. package/dist/mcp/tools/subtask_tool.d.ts.map +1 -1
  48. package/dist/mcp/tools/subtask_tool.js +5 -4
  49. package/dist/mcp/tools/subtask_tool.js.map +1 -1
  50. package/dist/mcp/tools/task_add_tool.d.ts.map +1 -1
  51. package/dist/mcp/tools/task_add_tool.js +6 -5
  52. package/dist/mcp/tools/task_add_tool.js.map +1 -1
  53. package/dist/mcp/tools/task_complete_tool.d.ts.map +1 -1
  54. package/dist/mcp/tools/task_complete_tool.js +5 -4
  55. package/dist/mcp/tools/task_complete_tool.js.map +1 -1
  56. package/dist/mcp/tools/task_delete_tool.d.ts.map +1 -1
  57. package/dist/mcp/tools/task_delete_tool.js +5 -4
  58. package/dist/mcp/tools/task_delete_tool.js.map +1 -1
  59. package/dist/mcp/tools/task_move_tool.d.ts.map +1 -1
  60. package/dist/mcp/tools/task_move_tool.js +6 -5
  61. package/dist/mcp/tools/task_move_tool.js.map +1 -1
  62. package/dist/mcp/tools/task_patch_tool.d.ts.map +1 -1
  63. package/dist/mcp/tools/task_patch_tool.js +5 -4
  64. package/dist/mcp/tools/task_patch_tool.js.map +1 -1
  65. package/dist/{tui-H3RI22S4.mjs → tui-5TFQR53I.mjs} +295 -253
  66. package/dist/utils/actor.d.ts +22 -0
  67. package/dist/utils/actor.d.ts.map +1 -0
  68. package/dist/utils/actor.js +200 -0
  69. package/dist/utils/actor.js.map +1 -0
  70. package/dist/utils/board-autosync.d.ts +22 -0
  71. package/dist/utils/board-autosync.d.ts.map +1 -0
  72. package/dist/utils/board-autosync.js +166 -0
  73. package/dist/utils/board-autosync.js.map +1 -0
  74. package/dist/utils/board-commit-hooks.d.ts +12 -0
  75. package/dist/utils/board-commit-hooks.d.ts.map +1 -0
  76. package/dist/utils/board-commit-hooks.js +52 -0
  77. package/dist/utils/board-commit-hooks.js.map +1 -0
  78. package/dist/utils/board-repo.d.ts +132 -0
  79. package/dist/utils/board-repo.d.ts.map +1 -0
  80. package/dist/utils/board-repo.js +602 -0
  81. package/dist/utils/board-repo.js.map +1 -0
  82. package/dist/utils/board-sync.d.ts +126 -0
  83. package/dist/utils/board-sync.d.ts.map +1 -0
  84. package/dist/utils/board-sync.js +554 -0
  85. package/dist/utils/board-sync.js.map +1 -0
  86. package/dist/utils/brainfile-path.d.ts +11 -1
  87. package/dist/utils/brainfile-path.d.ts.map +1 -1
  88. package/dist/utils/brainfile-path.js +39 -2
  89. package/dist/utils/brainfile-path.js.map +1 -1
  90. package/package.json +2 -2
@@ -0,0 +1,126 @@
1
+ export declare const REMOTE_CONFIG_KEY = "brainfile.remote";
2
+ /** Set once this machine has looked for (and moved) a board 0.21.0 pushed as a branch. */
3
+ export declare const LEGACY_CHECKED_CONFIG_KEY = "brainfile.legacyBranchChecked";
4
+ export declare const AUTOSYNC_CONFIG_KEY = "brainfile.autosync";
5
+ /** Remote name used when `--set-remote` is given a URL instead of a name. */
6
+ export declare const URL_REMOTE_NAME = "board";
7
+ export declare const MERGE_DRIVER_NAME = "brainfile";
8
+ export declare const DEFAULT_MERGE_DRIVER_COMMAND = "brainfile merge-driver %O %A %B";
9
+ export declare const BOARD_GITATTRIBUTES: string[];
10
+ export type AutosyncMode = 'off' | 'push' | 'full';
11
+ export interface SyncOptions {
12
+ pull?: boolean;
13
+ push?: boolean;
14
+ }
15
+ export interface SyncResult {
16
+ /** True when every requested step succeeded (nothing to do also counts). */
17
+ ok: boolean;
18
+ /** Set when sync did not run at all. */
19
+ skipped?: 'not-tracked' | 'no-remote';
20
+ remote?: string;
21
+ /** Where the board lives on the remote, e.g. `refs/brainfile/board`. */
22
+ remoteRef?: string;
23
+ /** Commits brought in from the remote. */
24
+ pulled: number;
25
+ /** Commits sent to the remote. */
26
+ pushed: number;
27
+ /** Files left with conflict markers for a human. */
28
+ conflicts: string[];
29
+ /** One-line, technical explanation when `ok` is false. */
30
+ warning?: string;
31
+ /** Why it failed, for plain-language messages (see `syncMessage`). */
32
+ failure?: 'offline' | 'rejected' | 'conflict' | 'error';
33
+ /** Set when a board 0.21.0 had pushed as a branch was moved to `remoteRef`. */
34
+ movedFromBranch?: string;
35
+ }
36
+ export interface SyncState {
37
+ at: string;
38
+ remote: string;
39
+ remoteRef: string;
40
+ ok: boolean;
41
+ warning?: string;
42
+ }
43
+ export declare function boardRemote(dotDir: string): string | null;
44
+ /**
45
+ * Name of the board on the remote (`refs/brainfile/<name>`). Defaults keep
46
+ * the "one private boards repo, one board per project" pattern from
47
+ * colliding: `board` for a board inside a code repository, the parent
48
+ * folder's basename for a standalone board, `home` for the global board.
49
+ */
50
+ export declare function boardRemoteName(dotDir: string): string;
51
+ /** Full ref of the board on the remote, e.g. `refs/brainfile/board`. */
52
+ export declare function boardRemoteRef(dotDir: string): string;
53
+ export declare function boardAutosync(dotDir: string): AutosyncMode;
54
+ export declare function setBoardAutosync(dotDir: string, mode: AutosyncMode): boolean;
55
+ /** True when `target` names a place rather than an existing git remote. */
56
+ export declare function looksLikeRemoteUrl(target: string): boolean;
57
+ export interface RemoteSetting {
58
+ remote: string;
59
+ url: string | null;
60
+ remoteRef: string;
61
+ }
62
+ /**
63
+ * Point the board at a remote: an existing remote name, or a URL/path that is
64
+ * registered as the `board` remote. Throws an Error naming an unknown remote.
65
+ * `cwd` may be the board directory or, when no board exists yet, the code
66
+ * repository the board will be materialized into.
67
+ */
68
+ export declare function setBoardRemote(cwd: string, target: string, boardName?: string): RemoteSetting;
69
+ /**
70
+ * Register the field-level merge driver in the board's git config.
71
+ *
72
+ * Without an explicit `command` this only fills in a missing driver: a
73
+ * driver someone configured on purpose (an absolute path to the CLI, or a
74
+ * test's built bundle) is never overwritten by the next sync.
75
+ */
76
+ export declare function registerMergeDriver(cwd: string, command?: string): boolean;
77
+ /**
78
+ * Make sure `.gitattributes` on the board declares the merge strategies.
79
+ * Returns true when the file was created or extended (caller commits).
80
+ */
81
+ export declare function ensureBoardAttributes(dotDir: string): boolean;
82
+ export declare function readSyncState(dotDir: string): SyncState | null;
83
+ /**
84
+ * Complete-vs-edit: one side archived a task (deleted `board/<id>.md`, wrote
85
+ * `logs/<id>.md`) while the other edited it. Completion wins; the edit is
86
+ * appended to the archived file as a log entry. Returns the paths resolved.
87
+ */
88
+ export declare function resolveCompleteVersusEdit(dotDir: string): string[];
89
+ /**
90
+ * fetch → fast-forward or merge → push. Runs entirely inside the board
91
+ * directory. Never throws; network failures come back as `warning`.
92
+ *
93
+ * The first sync with a remote also looks for a board that 0.21.0 pushed as
94
+ * a branch: it is merged in, published under refs/brainfile/, and the old
95
+ * branch is deleted from the remote once nothing on it can be lost.
96
+ */
97
+ export declare function syncBoard(dotDir: string, options?: SyncOptions): SyncResult;
98
+ /** Seconds since the last recorded sync attempt, or null when there was none. */
99
+ export declare function secondsSinceSync(dotDir: string, now?: number): number | null;
100
+ /**
101
+ * Short status for a header: `synced 12s ago`, `local only` for a tracked
102
+ * board nobody else has, `not synced · saved locally` after a failure. Null
103
+ * for a plain board.
104
+ */
105
+ export declare function syncStatusLabel(dotDir: string, now?: number): string | null;
106
+ /**
107
+ * Commits on this machine the remote has not seen yet, judged against the
108
+ * last-known remote position (no network). Null when the board is not shared.
109
+ */
110
+ export declare function pendingChanges(dotDir: string): number;
111
+ /**
112
+ * A page where people can see the board on the web, for hosts that show refs
113
+ * outside branches: GitHub's commit history accepts a full ref name. Null for
114
+ * other hosts.
115
+ */
116
+ export declare function boardWebUrl(remoteUrl: string | null, remoteRef: string): string | null;
117
+ /**
118
+ * The one sentence a person needs after a sync: what moved, or why nothing
119
+ * did and that nothing was lost. `detail` is the technical cause, if any.
120
+ */
121
+ export declare function syncMessage(result: SyncResult): {
122
+ text: string;
123
+ tone: 'ok' | 'warn';
124
+ detail?: string;
125
+ };
126
+ //# sourceMappingURL=board-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-sync.d.ts","sourceRoot":"","sources":["../../src/utils/board-sync.ts"],"names":[],"mappings":"AAuCA,eAAO,MAAM,iBAAiB,qBAAqB,CAAC;AACpD,0FAA0F;AAC1F,eAAO,MAAM,yBAAyB,kCAAkC,CAAC;AACzE,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AACxD,6EAA6E;AAC7E,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,4BAA4B,oCAAoC,CAAC;AAG9E,eAAO,MAAM,mBAAmB,UAK/B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,4EAA4E;IAC5E,EAAE,EAAE,OAAO,CAAC;IACZ,wCAAwC;IACxC,OAAO,CAAC,EAAE,aAAa,GAAG,WAAW,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;IACxD,+EAA+E;IAC/E,eAA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