byterover-cli 2.5.2 → 3.0.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 (389) hide show
  1. package/.env.production +8 -0
  2. package/LICENSE +44 -0
  3. package/README.md +240 -14
  4. package/bin/dev.js +8 -1
  5. package/bin/run.js +8 -1
  6. package/dist/agent/core/domain/knowledge/conflict-detector.d.ts +38 -0
  7. package/dist/agent/core/domain/knowledge/conflict-detector.js +71 -0
  8. package/dist/agent/core/domain/knowledge/conflict-resolver.d.ts +17 -0
  9. package/dist/agent/core/domain/knowledge/conflict-resolver.js +118 -0
  10. package/dist/agent/core/domain/knowledge/utils.d.ts +4 -0
  11. package/dist/agent/core/domain/knowledge/utils.js +6 -0
  12. package/dist/agent/core/interfaces/i-curate-service.d.ts +6 -0
  13. package/dist/agent/infra/tools/implementations/curate-tool.d.ts +67 -34
  14. package/dist/agent/infra/tools/implementations/curate-tool.js +294 -47
  15. package/dist/agent/resources/prompts/system-prompt.yml +15 -8
  16. package/dist/agent/resources/tools/code_exec.txt +3 -0
  17. package/dist/agent/resources/tools/curate.txt +12 -3
  18. package/dist/oclif/commands/connectors/install.d.ts +2 -1
  19. package/dist/oclif/commands/connectors/install.js +38 -3
  20. package/dist/oclif/commands/curate/index.d.ts +18 -0
  21. package/dist/oclif/commands/curate/index.js +78 -1
  22. package/dist/oclif/commands/init.d.ts +12 -0
  23. package/dist/oclif/commands/init.js +75 -0
  24. package/dist/oclif/commands/locations.js +1 -1
  25. package/dist/oclif/commands/providers/connect.d.ts +31 -1
  26. package/dist/oclif/commands/providers/connect.js +307 -27
  27. package/dist/oclif/commands/pull.d.ts +1 -0
  28. package/dist/oclif/commands/pull.js +7 -0
  29. package/dist/oclif/commands/push.d.ts +1 -0
  30. package/dist/oclif/commands/push.js +8 -0
  31. package/dist/oclif/commands/review/approve.d.ts +17 -0
  32. package/dist/oclif/commands/review/approve.js +37 -0
  33. package/dist/oclif/commands/review/base-review-decision.d.ts +18 -0
  34. package/dist/oclif/commands/review/base-review-decision.js +71 -0
  35. package/dist/oclif/commands/review/pending.d.ts +13 -0
  36. package/dist/oclif/commands/review/pending.js +94 -0
  37. package/dist/oclif/commands/review/reject.d.ts +17 -0
  38. package/dist/oclif/commands/review/reject.js +38 -0
  39. package/dist/oclif/commands/space/list.d.ts +2 -2
  40. package/dist/oclif/commands/space/list.js +13 -35
  41. package/dist/oclif/commands/space/switch.d.ts +2 -7
  42. package/dist/oclif/commands/space/switch.js +13 -56
  43. package/dist/oclif/commands/status.d.ts +1 -0
  44. package/dist/oclif/commands/status.js +11 -1
  45. package/dist/oclif/commands/vc/add.d.ts +7 -0
  46. package/dist/oclif/commands/vc/add.js +29 -0
  47. package/dist/oclif/commands/vc/branch.d.ts +15 -0
  48. package/dist/oclif/commands/vc/branch.js +70 -0
  49. package/dist/oclif/commands/vc/checkout.d.ts +14 -0
  50. package/dist/oclif/commands/vc/checkout.js +47 -0
  51. package/dist/oclif/commands/vc/clone.d.ts +9 -0
  52. package/dist/oclif/commands/vc/clone.js +61 -0
  53. package/dist/oclif/commands/vc/commit.d.ts +10 -0
  54. package/dist/oclif/commands/vc/commit.js +32 -0
  55. package/dist/oclif/commands/vc/config.d.ts +10 -0
  56. package/dist/oclif/commands/vc/config.js +30 -0
  57. package/dist/oclif/commands/vc/fetch.d.ts +10 -0
  58. package/dist/oclif/commands/vc/fetch.js +42 -0
  59. package/dist/oclif/commands/vc/index.d.ts +6 -0
  60. package/dist/oclif/commands/vc/index.js +8 -0
  61. package/dist/oclif/commands/vc/init.d.ts +6 -0
  62. package/dist/oclif/commands/vc/init.js +25 -0
  63. package/dist/oclif/commands/vc/log.d.ts +13 -0
  64. package/dist/oclif/commands/vc/log.js +48 -0
  65. package/dist/oclif/commands/vc/merge.d.ts +19 -0
  66. package/dist/oclif/commands/vc/merge.js +130 -0
  67. package/dist/oclif/commands/vc/pull.d.ts +13 -0
  68. package/dist/oclif/commands/vc/pull.js +60 -0
  69. package/dist/oclif/commands/vc/push.d.ts +13 -0
  70. package/dist/oclif/commands/vc/push.js +60 -0
  71. package/dist/oclif/commands/vc/remote/add.d.ts +10 -0
  72. package/dist/oclif/commands/vc/remote/add.js +30 -0
  73. package/dist/oclif/commands/vc/remote/index.d.ts +6 -0
  74. package/dist/oclif/commands/vc/remote/index.js +16 -0
  75. package/dist/oclif/commands/vc/remote/set-url.d.ts +10 -0
  76. package/dist/oclif/commands/vc/remote/set-url.js +30 -0
  77. package/dist/oclif/commands/vc/reset.d.ts +13 -0
  78. package/dist/oclif/commands/vc/reset.js +62 -0
  79. package/dist/oclif/commands/vc/status.d.ts +8 -0
  80. package/dist/oclif/commands/vc/status.js +106 -0
  81. package/dist/oclif/hooks/init/validate-brv-config.d.ts +26 -0
  82. package/dist/oclif/hooks/init/validate-brv-config.js +62 -0
  83. package/dist/oclif/lib/daemon-client.d.ts +2 -0
  84. package/dist/oclif/lib/daemon-client.js +36 -10
  85. package/dist/oclif/lib/prompt-utils.d.ts +43 -0
  86. package/dist/oclif/lib/prompt-utils.js +84 -0
  87. package/dist/oclif/lib/spinner.d.ts +8 -0
  88. package/dist/oclif/lib/spinner.js +23 -0
  89. package/dist/oclif/lib/task-client.d.ts +5 -0
  90. package/dist/oclif/lib/task-client.js +15 -2
  91. package/dist/server/config/environment.d.ts +2 -19
  92. package/dist/server/config/environment.js +31 -38
  93. package/dist/server/constants.d.ts +3 -9
  94. package/dist/server/constants.js +9 -12
  95. package/dist/server/core/domain/entities/auth-token.d.ts +2 -0
  96. package/dist/server/core/domain/entities/auth-token.js +7 -1
  97. package/dist/server/core/domain/entities/curate-log-entry.d.ts +11 -0
  98. package/dist/server/core/domain/entities/space.d.ts +4 -0
  99. package/dist/server/core/domain/entities/space.js +8 -0
  100. package/dist/server/core/domain/entities/team.d.ts +2 -0
  101. package/dist/server/core/domain/entities/team.js +4 -0
  102. package/dist/server/core/domain/errors/auth-error.d.ts +0 -6
  103. package/dist/server/core/domain/errors/auth-error.js +0 -12
  104. package/dist/server/core/domain/errors/git-error.d.ts +6 -0
  105. package/dist/server/core/domain/errors/git-error.js +12 -0
  106. package/dist/server/core/domain/errors/task-error.d.ts +4 -3
  107. package/dist/server/core/domain/errors/task-error.js +8 -8
  108. package/dist/server/core/domain/errors/transport-error.d.ts +0 -31
  109. package/dist/server/core/domain/errors/transport-error.js +0 -50
  110. package/dist/server/core/domain/errors/vc-error.d.ts +5 -0
  111. package/dist/server/core/domain/errors/vc-error.js +8 -0
  112. package/dist/server/core/domain/knowledge/markdown-writer.d.ts +4 -1
  113. package/dist/server/core/domain/knowledge/markdown-writer.js +37 -7
  114. package/dist/server/core/domain/transport/schemas.d.ts +6 -6
  115. package/dist/server/core/interfaces/context-tree/i-context-tree-service.d.ts +11 -0
  116. package/dist/server/core/interfaces/process/i-task-lifecycle-hook.d.ts +6 -0
  117. package/dist/server/core/interfaces/services/i-git-service.d.ts +234 -0
  118. package/dist/server/core/interfaces/storage/i-curate-log-store.d.ts +5 -0
  119. package/dist/server/core/interfaces/storage/i-review-backup-store.d.ts +19 -0
  120. package/dist/server/core/interfaces/vc/i-vc-git-config-store.d.ts +8 -0
  121. package/dist/server/infra/config/auto-init.d.ts +0 -2
  122. package/dist/server/infra/config/auto-init.js +0 -1
  123. package/dist/server/infra/connectors/rules/rules-connector-config.d.ts +0 -4
  124. package/dist/server/infra/context-tree/file-context-tree-service.d.ts +2 -0
  125. package/dist/server/infra/context-tree/file-context-tree-service.js +13 -0
  126. package/dist/server/infra/daemon/brv-server.js +23 -3
  127. package/dist/server/infra/git/cogit-url.d.ts +17 -0
  128. package/dist/server/infra/git/cogit-url.js +39 -0
  129. package/dist/server/infra/git/git-http-wrapper.d.ts +20 -0
  130. package/dist/server/infra/git/git-http-wrapper.js +334 -0
  131. package/dist/server/infra/git/isomorphic-git-service.d.ts +78 -0
  132. package/dist/server/infra/git/isomorphic-git-service.js +983 -0
  133. package/dist/server/infra/http/models-dev-client.d.ts +0 -4
  134. package/dist/server/infra/http/models-dev-client.js +0 -6
  135. package/dist/server/infra/http/openrouter-api-client.d.ts +0 -8
  136. package/dist/server/infra/http/openrouter-api-client.js +0 -13
  137. package/dist/server/infra/http/provider-model-fetcher-registry.d.ts +0 -5
  138. package/dist/server/infra/http/provider-model-fetcher-registry.js +0 -7
  139. package/dist/server/infra/http/review-api-handler.d.ts +13 -0
  140. package/dist/server/infra/http/review-api-handler.js +286 -0
  141. package/dist/server/infra/http/review-ui.d.ts +7 -0
  142. package/dist/server/infra/http/review-ui.js +606 -0
  143. package/dist/server/infra/mcp/tools/brv-curate-tool.d.ts +2 -2
  144. package/dist/server/infra/process/curate-log-handler.d.ts +18 -2
  145. package/dist/server/infra/process/curate-log-handler.js +50 -13
  146. package/dist/server/infra/process/feature-handlers.js +41 -1
  147. package/dist/server/infra/process/task-router.js +16 -0
  148. package/dist/server/infra/provider/env-provider-detector.d.ts +0 -20
  149. package/dist/server/infra/provider/env-provider-detector.js +0 -27
  150. package/dist/server/infra/space/http-space-service.js +2 -0
  151. package/dist/server/infra/storage/file-curate-log-store.d.ts +10 -0
  152. package/dist/server/infra/storage/file-curate-log-store.js +35 -0
  153. package/dist/server/infra/storage/file-provider-config-store.d.ts +0 -4
  154. package/dist/server/infra/storage/file-provider-config-store.js +0 -6
  155. package/dist/server/infra/storage/file-review-backup-store.d.ts +29 -0
  156. package/dist/server/infra/storage/file-review-backup-store.js +121 -0
  157. package/dist/server/infra/transport/handlers/auth-handler.js +9 -5
  158. package/dist/server/infra/transport/handlers/handler-types.d.ts +9 -0
  159. package/dist/server/infra/transport/handlers/handler-types.js +11 -0
  160. package/dist/server/infra/transport/handlers/index.d.ts +4 -0
  161. package/dist/server/infra/transport/handlers/index.js +2 -0
  162. package/dist/server/infra/transport/handlers/init-handler.d.ts +1 -0
  163. package/dist/server/infra/transport/handlers/init-handler.js +13 -1
  164. package/dist/server/infra/transport/handlers/pull-handler.d.ts +3 -0
  165. package/dist/server/infra/transport/handlers/pull-handler.js +5 -1
  166. package/dist/server/infra/transport/handlers/push-handler.d.ts +20 -0
  167. package/dist/server/infra/transport/handlers/push-handler.js +116 -14
  168. package/dist/server/infra/transport/handlers/reset-handler.d.ts +11 -0
  169. package/dist/server/infra/transport/handlers/reset-handler.js +37 -1
  170. package/dist/server/infra/transport/handlers/review-handler.d.ts +35 -0
  171. package/dist/server/infra/transport/handlers/review-handler.js +162 -0
  172. package/dist/server/infra/transport/handlers/space-handler.d.ts +3 -0
  173. package/dist/server/infra/transport/handlers/space-handler.js +4 -1
  174. package/dist/server/infra/transport/handlers/status-handler.d.ts +5 -0
  175. package/dist/server/infra/transport/handlers/status-handler.js +51 -16
  176. package/dist/server/infra/transport/handlers/vc-handler.d.ts +100 -0
  177. package/dist/server/infra/transport/handlers/vc-handler.js +1050 -0
  178. package/dist/server/infra/transport/socket-io-transport-server.d.ts +7 -0
  179. package/dist/server/infra/transport/socket-io-transport-server.js +12 -1
  180. package/dist/server/infra/transport/transport-connector.d.ts +1 -1
  181. package/dist/server/infra/transport/transport-connector.js +2 -1
  182. package/dist/server/infra/vc/file-vc-git-config-store.d.ts +11 -0
  183. package/dist/server/infra/vc/file-vc-git-config-store.js +43 -0
  184. package/dist/server/templates/skill/SKILL.md +167 -33
  185. package/dist/server/utils/curate-result-parser.d.ts +64 -0
  186. package/dist/server/utils/curate-result-parser.js +8 -0
  187. package/dist/server/utils/file-content-reader.d.ts +2 -1
  188. package/dist/server/utils/file-helpers.d.ts +0 -24
  189. package/dist/server/utils/file-helpers.js +0 -81
  190. package/dist/server/utils/gitignore.d.ts +9 -0
  191. package/dist/server/utils/gitignore.js +47 -0
  192. package/dist/server/utils/process-logger.d.ts +0 -13
  193. package/dist/server/utils/process-logger.js +1 -78
  194. package/dist/shared/transport/events/index.d.ts +6 -0
  195. package/dist/shared/transport/events/index.js +3 -0
  196. package/dist/shared/transport/events/init-events.d.ts +8 -0
  197. package/dist/shared/transport/events/init-events.js +1 -0
  198. package/dist/shared/transport/events/push-events.d.ts +6 -0
  199. package/dist/shared/transport/events/review-events.d.ts +41 -0
  200. package/dist/shared/transport/events/review-events.js +5 -0
  201. package/dist/shared/transport/events/vc-events.d.ts +257 -0
  202. package/dist/shared/transport/events/vc-events.js +67 -0
  203. package/dist/shared/transport/types/dto.d.ts +6 -1
  204. package/dist/tui/app/pages/init-project-page.d.ts +9 -0
  205. package/dist/tui/app/pages/init-project-page.js +54 -0
  206. package/dist/tui/app/pages/protected-routes.js +14 -6
  207. package/dist/tui/components/index.d.ts +0 -2
  208. package/dist/tui/components/index.js +0 -1
  209. package/dist/tui/features/activity/hooks/use-activity-logs.js +7 -1
  210. package/dist/tui/features/commands/definitions/index.js +3 -0
  211. package/dist/tui/features/commands/definitions/space-list.js +9 -18
  212. package/dist/tui/features/commands/definitions/space-switch.js +10 -6
  213. package/dist/tui/features/commands/definitions/vc-add.d.ts +2 -0
  214. package/dist/tui/features/commands/definitions/vc-add.js +15 -0
  215. package/dist/tui/features/commands/definitions/vc-branch.d.ts +2 -0
  216. package/dist/tui/features/commands/definitions/vc-branch.js +33 -0
  217. package/dist/tui/features/commands/definitions/vc-checkout.d.ts +2 -0
  218. package/dist/tui/features/commands/definitions/vc-checkout.js +32 -0
  219. package/dist/tui/features/commands/definitions/vc-clone.d.ts +2 -0
  220. package/dist/tui/features/commands/definitions/vc-clone.js +18 -0
  221. package/dist/tui/features/commands/definitions/vc-commit.d.ts +2 -0
  222. package/dist/tui/features/commands/definitions/vc-commit.js +32 -0
  223. package/dist/tui/features/commands/definitions/vc-config.d.ts +2 -0
  224. package/dist/tui/features/commands/definitions/vc-config.js +40 -0
  225. package/dist/tui/features/commands/definitions/vc-fetch.d.ts +2 -0
  226. package/dist/tui/features/commands/definitions/vc-fetch.js +37 -0
  227. package/dist/tui/features/commands/definitions/vc-init.d.ts +2 -0
  228. package/dist/tui/features/commands/definitions/vc-init.js +11 -0
  229. package/dist/tui/features/commands/definitions/vc-log.d.ts +2 -0
  230. package/dist/tui/features/commands/definitions/vc-log.js +25 -0
  231. package/dist/tui/features/commands/definitions/vc-merge.d.ts +2 -0
  232. package/dist/tui/features/commands/definitions/vc-merge.js +48 -0
  233. package/dist/tui/features/commands/definitions/vc-pull.d.ts +2 -0
  234. package/dist/tui/features/commands/definitions/vc-pull.js +42 -0
  235. package/dist/tui/features/commands/definitions/vc-push.d.ts +2 -0
  236. package/dist/tui/features/commands/definitions/vc-push.js +38 -0
  237. package/dist/tui/features/commands/definitions/vc-remote.d.ts +2 -0
  238. package/dist/tui/features/commands/definitions/vc-remote.js +57 -0
  239. package/dist/tui/features/commands/definitions/vc-reset.d.ts +2 -0
  240. package/dist/tui/features/commands/definitions/vc-reset.js +35 -0
  241. package/dist/tui/features/commands/definitions/vc-status.d.ts +2 -0
  242. package/dist/tui/features/commands/definitions/vc-status.js +11 -0
  243. package/dist/tui/features/commands/definitions/vc.d.ts +2 -0
  244. package/dist/tui/features/commands/definitions/vc.js +36 -0
  245. package/dist/tui/features/commands/hooks/use-slash-command-processor.js +5 -5
  246. package/dist/tui/features/log/api/execute-log.d.ts +8 -0
  247. package/dist/tui/features/log/api/execute-log.js +13 -0
  248. package/dist/tui/features/log/components/log-flow.d.ts +14 -0
  249. package/dist/tui/features/log/components/log-flow.js +29 -0
  250. package/dist/tui/features/log/utils/format-log.d.ts +3 -0
  251. package/dist/tui/features/log/utils/format-log.js +42 -0
  252. package/dist/tui/features/onboarding/hooks/use-app-view-mode.d.ts +9 -5
  253. package/dist/tui/features/onboarding/hooks/use-app-view-mode.js +12 -5
  254. package/dist/tui/features/push/components/push-flow.js +9 -2
  255. package/dist/tui/features/reset/components/reset-flow.js +2 -1
  256. package/dist/tui/features/status/components/status-view.js +2 -1
  257. package/dist/tui/features/status/utils/format-status.js +9 -0
  258. package/dist/tui/features/tasks/hooks/use-task-subscriptions.js +11 -0
  259. package/dist/tui/features/tasks/stores/tasks-store.d.ts +10 -0
  260. package/dist/tui/features/tasks/stores/tasks-store.js +16 -0
  261. package/dist/tui/features/vc/add/api/execute-vc-add.d.ts +8 -0
  262. package/dist/tui/features/vc/add/api/execute-vc-add.js +13 -0
  263. package/dist/tui/features/vc/add/components/vc-add-flow.d.ts +7 -0
  264. package/dist/tui/features/vc/add/components/vc-add-flow.js +35 -0
  265. package/dist/tui/features/vc/branch/api/execute-vc-branch.d.ts +8 -0
  266. package/dist/tui/features/vc/branch/api/execute-vc-branch.js +13 -0
  267. package/dist/tui/features/vc/branch/components/vc-branch-flow.d.ts +8 -0
  268. package/dist/tui/features/vc/branch/components/vc-branch-flow.js +53 -0
  269. package/dist/tui/features/vc/branch/utils/format-branch.d.ts +4 -0
  270. package/dist/tui/features/vc/branch/utils/format-branch.js +12 -0
  271. package/dist/tui/features/vc/checkout/api/execute-vc-checkout.d.ts +8 -0
  272. package/dist/tui/features/vc/checkout/api/execute-vc-checkout.js +13 -0
  273. package/dist/tui/features/vc/checkout/components/vc-checkout-flow.d.ts +8 -0
  274. package/dist/tui/features/vc/checkout/components/vc-checkout-flow.js +33 -0
  275. package/dist/tui/features/vc/clone/api/execute-vc-clone.d.ts +8 -0
  276. package/dist/tui/features/vc/clone/api/execute-vc-clone.js +13 -0
  277. package/dist/tui/features/vc/clone/components/vc-clone-flow.d.ts +7 -0
  278. package/dist/tui/features/vc/clone/components/vc-clone-flow.js +79 -0
  279. package/dist/tui/features/vc/commit/api/execute-vc-commit.d.ts +8 -0
  280. package/dist/tui/features/vc/commit/api/execute-vc-commit.js +13 -0
  281. package/dist/tui/features/vc/commit/components/vc-commit-flow.d.ts +7 -0
  282. package/dist/tui/features/vc/commit/components/vc-commit-flow.js +29 -0
  283. package/dist/tui/features/vc/config/api/execute-vc-config.d.ts +8 -0
  284. package/dist/tui/features/vc/config/api/execute-vc-config.js +13 -0
  285. package/dist/tui/features/vc/config/components/vc-config-flow.d.ts +9 -0
  286. package/dist/tui/features/vc/config/components/vc-config-flow.js +30 -0
  287. package/dist/tui/features/vc/fetch/api/execute-vc-fetch.d.ts +8 -0
  288. package/dist/tui/features/vc/fetch/api/execute-vc-fetch.js +13 -0
  289. package/dist/tui/features/vc/fetch/components/vc-fetch-flow.d.ts +8 -0
  290. package/dist/tui/features/vc/fetch/components/vc-fetch-flow.js +75 -0
  291. package/dist/tui/features/vc/init/api/execute-vc-init.d.ts +8 -0
  292. package/dist/tui/features/vc/init/api/execute-vc-init.js +13 -0
  293. package/dist/tui/features/vc/init/components/vc-init-flow.d.ts +10 -0
  294. package/dist/tui/features/vc/init/components/vc-init-flow.js +37 -0
  295. package/dist/tui/features/vc/merge/api/execute-vc-merge.d.ts +8 -0
  296. package/dist/tui/features/vc/merge/api/execute-vc-merge.js +13 -0
  297. package/dist/tui/features/vc/merge/components/vc-merge-flow.d.ts +11 -0
  298. package/dist/tui/features/vc/merge/components/vc-merge-flow.js +72 -0
  299. package/dist/tui/features/vc/pull/api/execute-vc-pull.d.ts +8 -0
  300. package/dist/tui/features/vc/pull/api/execute-vc-pull.js +13 -0
  301. package/dist/tui/features/vc/pull/components/vc-pull-flow.d.ts +9 -0
  302. package/dist/tui/features/vc/pull/components/vc-pull-flow.js +83 -0
  303. package/dist/tui/features/vc/push/api/execute-vc-push.d.ts +8 -0
  304. package/dist/tui/features/vc/push/api/execute-vc-push.js +13 -0
  305. package/dist/tui/features/vc/push/components/vc-push-flow.d.ts +8 -0
  306. package/dist/tui/features/vc/push/components/vc-push-flow.js +83 -0
  307. package/dist/tui/features/vc/remote/api/execute-vc-remote.d.ts +8 -0
  308. package/dist/tui/features/vc/remote/api/execute-vc-remote.js +13 -0
  309. package/dist/tui/features/vc/remote/components/vc-remote-flow.d.ts +9 -0
  310. package/dist/tui/features/vc/remote/components/vc-remote-flow.js +42 -0
  311. package/dist/tui/features/vc/reset/api/execute-vc-reset.d.ts +8 -0
  312. package/dist/tui/features/vc/reset/api/execute-vc-reset.js +13 -0
  313. package/dist/tui/features/vc/reset/components/vc-reset-flow.d.ts +10 -0
  314. package/dist/tui/features/vc/reset/components/vc-reset-flow.js +63 -0
  315. package/dist/tui/features/vc/status/api/execute-vc-status.d.ts +8 -0
  316. package/dist/tui/features/vc/status/api/execute-vc-status.js +13 -0
  317. package/dist/tui/features/vc/status/components/vc-status-flow.d.ts +10 -0
  318. package/dist/tui/features/vc/status/components/vc-status-flow.js +133 -0
  319. package/dist/tui/lib/environment.d.ts +8 -0
  320. package/dist/tui/lib/environment.js +8 -0
  321. package/dist/tui/utils/error-messages.d.ts +5 -1
  322. package/dist/tui/utils/error-messages.js +32 -3
  323. package/node_modules/@campfirein/brv-transport-client/LICENSE +95 -0
  324. package/node_modules/@campfirein/brv-transport-client/README.md +3 -4
  325. package/node_modules/@campfirein/brv-transport-client/package.json +2 -2
  326. package/oclif.manifest.json +985 -65
  327. package/package.json +13 -5
  328. package/dist/oclif/hooks/prerun/validate-brv-config-version.d.ts +0 -33
  329. package/dist/oclif/hooks/prerun/validate-brv-config-version.js +0 -86
  330. package/dist/server/core/domain/entities/bullet.d.ts +0 -51
  331. package/dist/server/core/domain/entities/bullet.js +0 -94
  332. package/dist/server/core/domain/entities/memory.d.ts +0 -55
  333. package/dist/server/core/domain/entities/memory.js +0 -90
  334. package/dist/server/core/domain/entities/playbook.d.ts +0 -80
  335. package/dist/server/core/domain/entities/playbook.js +0 -214
  336. package/dist/server/core/domain/entities/presigned-url.d.ts +0 -9
  337. package/dist/server/core/domain/entities/presigned-url.js +0 -18
  338. package/dist/server/core/domain/entities/presigned-urls-response.d.ts +0 -10
  339. package/dist/server/core/domain/entities/presigned-urls-response.js +0 -18
  340. package/dist/server/core/domain/entities/retrieve-result.d.ts +0 -35
  341. package/dist/server/core/domain/entities/retrieve-result.js +0 -35
  342. package/dist/server/core/domain/errors/headless-prompt-error.d.ts +0 -11
  343. package/dist/server/core/domain/errors/headless-prompt-error.js +0 -18
  344. package/dist/server/core/interfaces/services/i-legacy-rule-detector.d.ts +0 -56
  345. package/dist/server/core/interfaces/services/i-memory-retrieval-service.d.ts +0 -39
  346. package/dist/server/core/interfaces/services/i-memory-storage-service.d.ts +0 -53
  347. package/dist/server/core/interfaces/services/i-terminal.d.ts +0 -146
  348. package/dist/server/core/interfaces/services/i-terminal.js +0 -1
  349. package/dist/server/core/interfaces/services/i-workspace-detector-service.d.ts +0 -8
  350. package/dist/server/core/interfaces/services/i-workspace-detector-service.js +0 -1
  351. package/dist/server/core/interfaces/storage/i-onboarding-preference-store.d.ts +0 -20
  352. package/dist/server/core/interfaces/storage/i-onboarding-preference-store.js +0 -1
  353. package/dist/server/infra/connectors/rules/legacy-rule-detector.d.ts +0 -21
  354. package/dist/server/infra/connectors/rules/legacy-rule-detector.js +0 -106
  355. package/dist/server/infra/memory/http-memory-retrieval-service.d.ts +0 -18
  356. package/dist/server/infra/memory/http-memory-retrieval-service.js +0 -64
  357. package/dist/server/infra/memory/http-memory-storage-service.d.ts +0 -18
  358. package/dist/server/infra/memory/http-memory-storage-service.js +0 -72
  359. package/dist/server/infra/memory/memory-to-playbook-mapper.d.ts +0 -33
  360. package/dist/server/infra/memory/memory-to-playbook-mapper.js +0 -51
  361. package/dist/server/infra/storage/file-onboarding-preference-store.d.ts +0 -10
  362. package/dist/server/infra/storage/file-onboarding-preference-store.js +0 -45
  363. package/dist/server/infra/terminal/headless-terminal.d.ts +0 -91
  364. package/dist/server/infra/terminal/headless-terminal.js +0 -211
  365. package/dist/server/infra/workspace/workspace-detector-service.d.ts +0 -57
  366. package/dist/server/infra/workspace/workspace-detector-service.js +0 -165
  367. package/dist/server/utils/crash-log.d.ts +0 -14
  368. package/dist/server/utils/crash-log.js +0 -19
  369. package/dist/server/utils/emoji-helpers.d.ts +0 -38
  370. package/dist/server/utils/emoji-helpers.js +0 -42
  371. package/dist/server/utils/error-handler.d.ts +0 -51
  372. package/dist/server/utils/error-handler.js +0 -169
  373. package/dist/server/utils/oclif-error-helpers.d.ts +0 -40
  374. package/dist/server/utils/oclif-error-helpers.js +0 -46
  375. package/dist/server/utils/tool-display-formatter.d.ts +0 -53
  376. package/dist/server/utils/tool-display-formatter.js +0 -257
  377. package/dist/tui/components/init.d.ts +0 -33
  378. package/dist/tui/components/init.js +0 -234
  379. package/dist/tui/features/space/api/get-spaces.d.ts +0 -16
  380. package/dist/tui/features/space/api/get-spaces.js +0 -17
  381. package/dist/tui/features/space/api/switch-space.d.ts +0 -11
  382. package/dist/tui/features/space/api/switch-space.js +0 -24
  383. package/dist/tui/features/space/components/space-list-view.d.ts +0 -12
  384. package/dist/tui/features/space/components/space-list-view.js +0 -56
  385. package/dist/tui/features/space/components/space-switch-flow.d.ts +0 -13
  386. package/dist/tui/features/space/components/space-switch-flow.js +0 -97
  387. /package/dist/server/core/interfaces/services/{i-legacy-rule-detector.js → i-git-service.js} +0 -0
  388. /package/dist/server/core/interfaces/{services/i-memory-retrieval-service.js → storage/i-review-backup-store.js} +0 -0
  389. /package/dist/server/core/interfaces/{services/i-memory-storage-service.js → vc/i-vc-git-config-store.js} +0 -0
@@ -0,0 +1,61 @@
1
+ import { Args, Command } from '@oclif/core';
2
+ import { getGitRemoteBaseUrl } from '../../../server/config/environment.js';
3
+ import { InitEvents } from '../../../shared/transport/events/init-events.js';
4
+ import { VcEvents, } from '../../../shared/transport/events/vc-events.js';
5
+ import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
6
+ function subscribeToProgress(client) {
7
+ let lastWasProgress = false;
8
+ const unsub = client.on(VcEvents.CLONE_PROGRESS, (evt) => {
9
+ const isGitProgress = evt.step === 'cloning' && /^\w[\w\s]*: \d/.test(evt.message);
10
+ if (isGitProgress) {
11
+ process.stderr.write(`\r\u001B[K${evt.message}`);
12
+ lastWasProgress = true;
13
+ }
14
+ else {
15
+ if (lastWasProgress)
16
+ process.stderr.write('\n');
17
+ process.stderr.write(`${evt.message}\n`);
18
+ lastWasProgress = false;
19
+ }
20
+ });
21
+ return {
22
+ cleanup() {
23
+ if (lastWasProgress)
24
+ process.stderr.write('\n');
25
+ unsub();
26
+ },
27
+ };
28
+ }
29
+ export default class VcClone extends Command {
30
+ static args = {
31
+ url: Args.string({ description: `Clone URL (e.g. ${getGitRemoteBaseUrl()}/<team>/<space>.git)` }),
32
+ };
33
+ static description = 'Clone a ByteRover space repository';
34
+ static examples = [`<%= config.bin %> vc clone ${getGitRemoteBaseUrl()}/acme/project.git`];
35
+ async run() {
36
+ const { args } = await this.parse(VcClone);
37
+ const { url } = args;
38
+ if (!url) {
39
+ this.error(`URL is required.\nUsage: brv vc clone ${getGitRemoteBaseUrl()}/<team>/<space>.git`);
40
+ }
41
+ const daemonOptions = { projectPath: process.cwd() };
42
+ try {
43
+ // Ensure .brv/config.json exists so the daemon registers this cwd as the project root
44
+ await withDaemonRetry(async (client) => client.requestWithAck(InitEvents.LOCAL, {}), daemonOptions);
45
+ const result = await withDaemonRetry(async (client) => {
46
+ const { cleanup } = subscribeToProgress(client);
47
+ try {
48
+ return await client.requestWithAck(VcEvents.CLONE, { url }, { timeout: 120_000 });
49
+ }
50
+ finally {
51
+ cleanup();
52
+ }
53
+ }, daemonOptions);
54
+ const label = result.teamName && result.spaceName ? `${result.teamName}/${result.spaceName}` : 'repository';
55
+ this.log(`Cloned ${label} successfully.`);
56
+ }
57
+ catch (error) {
58
+ this.error(formatConnectionError(error));
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,10 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class VcCommit extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ message: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ };
8
+ static strict: boolean;
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,32 @@
1
+ import { Command, Flags } from '@oclif/core';
2
+ import { VcEvents } from '../../../shared/transport/events/vc-events.js';
3
+ import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
4
+ export default class VcCommit extends Command {
5
+ static description = 'Save staged changes as a commit';
6
+ static examples = ['<%= config.bin %> <%= command.id %> -m "Add project architecture notes"'];
7
+ static flags = {
8
+ message: Flags.string({
9
+ char: 'm',
10
+ description: 'Commit message',
11
+ }),
12
+ };
13
+ static strict = false;
14
+ async run() {
15
+ const { argv, flags } = await this.parse(VcCommit);
16
+ // Support unquoted multi-word messages: brv vc commit -m hello world
17
+ const extra = argv.join(' ');
18
+ const message = flags.message
19
+ ? (extra ? `${flags.message} ${extra}` : flags.message)
20
+ : (extra || undefined);
21
+ if (!message) {
22
+ this.error('Usage: brv vc commit -m "<message>"');
23
+ }
24
+ try {
25
+ const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.COMMIT, { message }));
26
+ this.log(`[${result.sha.slice(0, 7)}] ${result.message}`);
27
+ }
28
+ catch (error) {
29
+ this.error(formatConnectionError(error));
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,10 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class VcConfig extends Command {
3
+ static args: {
4
+ key: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ value: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,30 @@
1
+ import { Args, Command } from '@oclif/core';
2
+ import { isVcConfigKey, VcEvents } from '../../../shared/transport/events/vc-events.js';
3
+ import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
4
+ export default class VcConfig extends Command {
5
+ static args = {
6
+ key: Args.string({ description: 'Config key (user.name or user.email)', required: true }),
7
+ value: Args.string({ description: 'Value to set (omit to read current value)' }),
8
+ };
9
+ static description = 'Get or set commit author for ByteRover version control';
10
+ static examples = [
11
+ '<%= config.bin %> <%= command.id %> user.name "Your Name"',
12
+ '<%= config.bin %> <%= command.id %> user.email "you@example.com"',
13
+ '<%= config.bin %> <%= command.id %> user.name',
14
+ '<%= config.bin %> <%= command.id %> user.email',
15
+ ];
16
+ async run() {
17
+ const { args } = await this.parse(VcConfig);
18
+ const { key, value } = args;
19
+ if (!isVcConfigKey(key)) {
20
+ this.error(`Unknown key '${key}'. Allowed: user.name, user.email.`);
21
+ }
22
+ try {
23
+ const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.CONFIG, { key, value }));
24
+ this.log(`${result.value}`);
25
+ }
26
+ catch (error) {
27
+ this.error(formatConnectionError(error));
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,10 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class VcFetch extends Command {
3
+ static args: {
4
+ remote: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ branch: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,42 @@
1
+ import { Args, Command } from '@oclif/core';
2
+ import { VcEvents } from '../../../shared/transport/events/vc-events.js';
3
+ import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
4
+ export default class VcFetch extends Command {
5
+ /* eslint-disable perfectionist/sort-objects -- positional order matters: remote before branch */
6
+ static args = {
7
+ remote: Args.string({ description: 'Remote name (only origin supported)', required: false }),
8
+ branch: Args.string({ description: 'Branch to fetch', required: false }),
9
+ };
10
+ /* eslint-enable perfectionist/sort-objects */
11
+ static description = 'Fetch refs from ByteRover cloud';
12
+ static examples = [
13
+ '<%= config.bin %> <%= command.id %>',
14
+ '<%= config.bin %> <%= command.id %> origin',
15
+ '<%= config.bin %> <%= command.id %> origin main',
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(VcFetch);
19
+ let remote;
20
+ let ref;
21
+ if (args.remote && args.branch) {
22
+ if (args.remote !== 'origin') {
23
+ this.error(`Only 'origin' remote is currently supported.`);
24
+ }
25
+ remote = args.remote;
26
+ ref = args.branch;
27
+ }
28
+ else if (args.remote) {
29
+ if (args.remote !== 'origin') {
30
+ this.error(`Only 'origin' remote is currently supported.`);
31
+ }
32
+ remote = args.remote;
33
+ }
34
+ try {
35
+ const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.FETCH, { ref, remote }, { timeout: 120_000 }));
36
+ this.log(`Fetched from ${result.remote}.`);
37
+ }
38
+ catch (error) {
39
+ this.error(formatConnectionError(error));
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,6 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Vc extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Vc extends Command {
3
+ static description = 'Version control commands for the context tree';
4
+ static examples = ['<%= config.bin %> <%= command.id %> --help'];
5
+ async run() {
6
+ await this.config.runCommand('help', ['vc']);
7
+ }
8
+ }
@@ -0,0 +1,6 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class VcInit extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,25 @@
1
+ import { Command } from '@oclif/core';
2
+ import { InitEvents } from '../../../shared/transport/events/init-events.js';
3
+ import { VcEvents } from '../../../shared/transport/events/vc-events.js';
4
+ import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
5
+ export default class VcInit extends Command {
6
+ static description = 'Initialize ByteRover version control for context tree';
7
+ static examples = ['<%= config.bin %> <%= command.id %>'];
8
+ async run() {
9
+ const daemonOptions = { projectPath: process.cwd() };
10
+ try {
11
+ // Ensure .brv/config.json exists so the daemon can register this project
12
+ await withDaemonRetry(async (client) => client.requestWithAck(InitEvents.LOCAL, {}), daemonOptions);
13
+ const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.INIT, {}), daemonOptions);
14
+ if (result.reinitialized) {
15
+ this.log(`Reinitialized existing ByteRover version control in ${result.gitDir}`);
16
+ }
17
+ else {
18
+ this.log(`Initialized ByteRover version control in ${result.gitDir}`);
19
+ }
20
+ }
21
+ catch (error) {
22
+ this.error(formatConnectionError(error));
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,13 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class VcLog extends Command {
3
+ static args: {
4
+ branch: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,48 @@
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import { VcEvents } from '../../../shared/transport/events/vc-events.js';
3
+ import { formatCommitLog } from '../../../tui/features/log/utils/format-log.js';
4
+ import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
5
+ export default class VcLog extends Command {
6
+ static args = {
7
+ branch: Args.string({ description: 'Branch name to show history for' }),
8
+ };
9
+ static description = 'Show commit history for the context-tree';
10
+ static examples = [
11
+ '<%= config.bin %> <%= command.id %>',
12
+ '<%= config.bin %> <%= command.id %> --limit 20',
13
+ '<%= config.bin %> <%= command.id %> main',
14
+ '<%= config.bin %> <%= command.id %> --all',
15
+ ];
16
+ static flags = {
17
+ all: Flags.boolean({
18
+ char: 'a',
19
+ default: false,
20
+ description: 'Show commits from all branches',
21
+ }),
22
+ limit: Flags.integer({
23
+ default: 10,
24
+ description: 'Number of commits to show',
25
+ }),
26
+ };
27
+ async run() {
28
+ const { args, flags } = await this.parse(VcLog);
29
+ try {
30
+ const response = await withDaemonRetry((client) => {
31
+ const req = {
32
+ all: flags.all,
33
+ limit: flags.limit,
34
+ ref: args.branch,
35
+ };
36
+ return client.requestWithAck(VcEvents.LOG, req);
37
+ });
38
+ if (response.commits.length === 0) {
39
+ this.log('No commits found.');
40
+ return;
41
+ }
42
+ this.log(formatCommitLog(response.commits, response.currentBranch));
43
+ }
44
+ catch (error) {
45
+ this.error(formatConnectionError(error));
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,19 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class VcMerge extends Command {
3
+ static args: {
4
+ branch: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ abort: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ 'allow-unrelated-histories': import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ continue: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ message: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ run(): Promise<void>;
15
+ private handleAbort;
16
+ private handleContinue;
17
+ private handleMerge;
18
+ private openEditor;
19
+ }
@@ -0,0 +1,130 @@
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import { execSync } from 'node:child_process';
3
+ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
4
+ import { tmpdir } from 'node:os';
5
+ import { join } from 'node:path';
6
+ import { VcEvents } from '../../../shared/transport/events/vc-events.js';
7
+ import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
8
+ export default class VcMerge extends Command {
9
+ static args = {
10
+ branch: Args.string({ description: 'Branch to merge into the current branch', required: false }),
11
+ };
12
+ static description = 'Merge a branch into the current branch';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> feature/my-branch',
15
+ '<%= config.bin %> <%= command.id %> --abort',
16
+ '<%= config.bin %> <%= command.id %> --continue',
17
+ '<%= config.bin %> <%= command.id %> -m "Custom merge message" feature/my-branch',
18
+ ];
19
+ static flags = {
20
+ abort: Flags.boolean({
21
+ default: false,
22
+ description: 'Abort the current merge',
23
+ exclusive: ['continue'],
24
+ }),
25
+ 'allow-unrelated-histories': Flags.boolean({
26
+ default: false,
27
+ description: 'Allow merging unrelated histories',
28
+ }),
29
+ continue: Flags.boolean({
30
+ default: false,
31
+ description: 'Continue the current merge after resolving conflicts',
32
+ exclusive: ['abort'],
33
+ }),
34
+ message: Flags.string({
35
+ char: 'm',
36
+ description: 'Merge commit message',
37
+ }),
38
+ };
39
+ async run() {
40
+ const { args, flags } = await this.parse(VcMerge);
41
+ if (flags.abort) {
42
+ return this.handleAbort();
43
+ }
44
+ if (flags.continue) {
45
+ return this.handleContinue(flags.message);
46
+ }
47
+ if (!args.branch) {
48
+ this.error('Usage: brv vc merge <branch> | --abort | --continue');
49
+ }
50
+ return this.handleMerge(args.branch, flags.message, flags['allow-unrelated-histories']);
51
+ }
52
+ async handleAbort() {
53
+ try {
54
+ await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.MERGE, { action: 'abort' }));
55
+ // Native git produces no output on successful abort
56
+ }
57
+ catch (error) {
58
+ this.error(formatConnectionError(error));
59
+ }
60
+ }
61
+ async handleContinue(message) {
62
+ try {
63
+ if (message) {
64
+ // Message provided via -m — commit directly
65
+ await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.MERGE, { action: 'continue', message }));
66
+ return;
67
+ }
68
+ // No message — get default from server, open editor
69
+ const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.MERGE, { action: 'continue' }));
70
+ const editedMessage = this.openEditor(result.defaultMessage ?? 'Merge commit');
71
+ if (!editedMessage) {
72
+ this.error('Aborting commit due to empty commit message.');
73
+ }
74
+ await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.MERGE, { action: 'continue', message: editedMessage }));
75
+ }
76
+ catch (error) {
77
+ this.error(formatConnectionError(error));
78
+ }
79
+ }
80
+ async handleMerge(branch, message, allowUnrelatedHistories) {
81
+ try {
82
+ const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.MERGE, {
83
+ action: 'merge',
84
+ allowUnrelatedHistories,
85
+ branch,
86
+ message,
87
+ }));
88
+ if (result.alreadyUpToDate) {
89
+ this.log('Already up to date.');
90
+ }
91
+ else if (result.conflicts && result.conflicts.length > 0) {
92
+ for (const conflict of result.conflicts) {
93
+ this.log(`CONFLICT (${conflict.type}): ${conflict.path}`);
94
+ }
95
+ this.log('Automatic merge failed; fix conflicts and then commit the result.');
96
+ }
97
+ else {
98
+ this.log(`Merged branch '${branch}'.`);
99
+ }
100
+ }
101
+ catch (error) {
102
+ this.error(formatConnectionError(error));
103
+ }
104
+ }
105
+ openEditor(defaultMessage) {
106
+ const editor = process.env.GIT_EDITOR ?? process.env.EDITOR ?? 'vim';
107
+ const tmpDir = mkdtempSync(join(tmpdir(), 'brv-merge-'));
108
+ const tmpFile = join(tmpDir, 'MERGE_MSG');
109
+ writeFileSync(tmpFile, defaultMessage);
110
+ try {
111
+ execSync(`${editor} "${tmpFile}"`, { stdio: 'inherit' });
112
+ const content = readFileSync(tmpFile, 'utf8');
113
+ // Strip comment lines and trim
114
+ const cleaned = content
115
+ .split('\n')
116
+ .filter((line) => !line.startsWith('#'))
117
+ .join('\n')
118
+ .trim();
119
+ return cleaned;
120
+ }
121
+ finally {
122
+ try {
123
+ rmSync(tmpDir, { force: true, recursive: true });
124
+ }
125
+ catch {
126
+ // ignore cleanup errors
127
+ }
128
+ }
129
+ }
130
+ }
@@ -0,0 +1,13 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class VcPull extends Command {
3
+ static args: {
4
+ remote: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ branch: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ 'allow-unrelated-histories': import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,60 @@
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import { VcEvents } from '../../../shared/transport/events/vc-events.js';
3
+ import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
4
+ export default class VcPull extends Command {
5
+ /* eslint-disable perfectionist/sort-objects -- positional order matters: remote before branch */
6
+ static args = {
7
+ remote: Args.string({ description: 'Remote name (only origin supported)', required: false }),
8
+ branch: Args.string({ description: 'Branch to pull', required: false }),
9
+ };
10
+ /* eslint-enable perfectionist/sort-objects */
11
+ static description = 'Pull commits from ByteRover cloud';
12
+ static examples = [
13
+ '<%= config.bin %> <%= command.id %>',
14
+ '<%= config.bin %> <%= command.id %> origin main',
15
+ '<%= config.bin %> <%= command.id %> origin main --allow-unrelated-histories',
16
+ ];
17
+ static flags = {
18
+ 'allow-unrelated-histories': Flags.boolean({
19
+ default: false,
20
+ description: 'Allow merging unrelated histories',
21
+ }),
22
+ };
23
+ async run() {
24
+ const { args, flags } = await this.parse(VcPull);
25
+ let remote;
26
+ let branch;
27
+ if (args.remote && args.branch) {
28
+ if (args.remote !== 'origin') {
29
+ this.error(`Only 'origin' remote is currently supported.`);
30
+ }
31
+ remote = args.remote;
32
+ branch = args.branch;
33
+ }
34
+ else if (args.remote) {
35
+ if (args.remote !== 'origin') {
36
+ this.error(`Only 'origin' remote is currently supported.`);
37
+ }
38
+ remote = args.remote;
39
+ }
40
+ try {
41
+ const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.PULL, {
42
+ allowUnrelatedHistories: flags['allow-unrelated-histories'],
43
+ branch,
44
+ remote,
45
+ }, { timeout: 120_000 }));
46
+ if (result.conflicts && result.conflicts.length > 0) {
47
+ for (const conflict of result.conflicts) {
48
+ this.log(`CONFLICT (${conflict.type}): ${conflict.path}`);
49
+ }
50
+ this.log('Automatic merge failed; fix conflicts and then commit the result.');
51
+ }
52
+ else {
53
+ this.log(result.alreadyUpToDate ? 'Already up to date.' : `Pulled from origin/${result.branch}.`);
54
+ }
55
+ }
56
+ catch (error) {
57
+ this.error(formatConnectionError(error));
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,13 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class VcPush extends Command {
3
+ static args: {
4
+ remote: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ branch: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ 'set-upstream': import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,60 @@
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import { VcEvents } from '../../../shared/transport/events/vc-events.js';
3
+ import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
4
+ export default class VcPush extends Command {
5
+ /* eslint-disable perfectionist/sort-objects -- positional order matters: remote before branch */
6
+ static args = {
7
+ remote: Args.string({ description: 'Remote name (only origin supported)', required: false }),
8
+ branch: Args.string({ description: 'Branch to push', required: false }),
9
+ };
10
+ /* eslint-enable perfectionist/sort-objects */
11
+ static description = 'Push commits to ByteRover cloud';
12
+ static examples = [
13
+ '<%= config.bin %> <%= command.id %>',
14
+ '<%= config.bin %> <%= command.id %> -u',
15
+ '<%= config.bin %> <%= command.id %> origin feat/my-branch',
16
+ ];
17
+ static flags = {
18
+ 'set-upstream': Flags.boolean({
19
+ char: 'u',
20
+ default: false,
21
+ description: 'Set upstream tracking branch',
22
+ }),
23
+ };
24
+ async run() {
25
+ const { args, flags } = await this.parse(VcPush);
26
+ // Git push semantics: push [<remote> [<branch>]]
27
+ // brv vc push → current branch
28
+ // brv vc push origin → current branch (explicit remote)
29
+ // brv vc push origin feat/x → feat/x
30
+ // brv vc push feat/x → error (unknown remote)
31
+ let branch;
32
+ if (args.remote && args.branch) {
33
+ if (args.remote !== 'origin') {
34
+ this.error(`Only 'origin' remote is currently supported.`);
35
+ }
36
+ branch = args.branch;
37
+ }
38
+ else if (args.remote && args.remote !== 'origin') {
39
+ this.error(`Only 'origin' remote is currently supported. Use 'brv vc push origin ${args.remote}' to push a specific branch.`);
40
+ }
41
+ try {
42
+ const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.PUSH, {
43
+ branch,
44
+ setUpstream: flags['set-upstream'],
45
+ }, { timeout: 120_000 }));
46
+ if (result.alreadyUpToDate) {
47
+ this.log('Everything up-to-date.');
48
+ }
49
+ else if (result.upstreamSet) {
50
+ this.log(`Pushed to origin/${result.branch} and set upstream.`);
51
+ }
52
+ else {
53
+ this.log(`Pushed to origin/${result.branch}.`);
54
+ }
55
+ }
56
+ catch (error) {
57
+ this.error(formatConnectionError(error));
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,10 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class VcRemoteAdd extends Command {
3
+ static args: {
4
+ name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ url: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,30 @@
1
+ import { Args, Command } from '@oclif/core';
2
+ import { getGitRemoteBaseUrl } from '../../../../server/config/environment.js';
3
+ import { VcEvents } from '../../../../shared/transport/events/vc-events.js';
4
+ import { formatConnectionError, withDaemonRetry } from '../../../lib/daemon-client.js';
5
+ export default class VcRemoteAdd extends Command {
6
+ static args = {
7
+ name: Args.string({ description: 'Remote name', required: true }),
8
+ url: Args.string({
9
+ description: `Remote URL (e.g. ${getGitRemoteBaseUrl()}/<team>/<space>.git)`,
10
+ required: true,
11
+ }),
12
+ };
13
+ static description = 'Add a named remote';
14
+ static examples = [
15
+ `<%= config.bin %> <%= command.id %> origin ${getGitRemoteBaseUrl()}/acme/project.git`,
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(VcRemoteAdd);
19
+ if (args.name !== 'origin') {
20
+ this.error(`Only 'origin' remote is currently supported.`);
21
+ }
22
+ try {
23
+ const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.REMOTE, { subcommand: 'add', url: args.url }));
24
+ this.log(`Remote 'origin' set to ${result.url}.`);
25
+ }
26
+ catch (error) {
27
+ this.error(formatConnectionError(error));
28
+ }
29
+ }
30
+ }