byterover-cli 0.3.4 → 0.4.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 (346) hide show
  1. package/README.md +119 -63
  2. package/bin/dev.js +8 -1
  3. package/bin/run.js +7 -0
  4. package/dist/commands/cipher-agent/run.d.ts +30 -0
  5. package/dist/commands/cipher-agent/run.js +123 -61
  6. package/dist/commands/cipher-agent/set-prompt.d.ts +2 -0
  7. package/dist/commands/cipher-agent/set-prompt.js +13 -8
  8. package/dist/commands/cipher-agent/show-prompt.d.ts +2 -0
  9. package/dist/commands/cipher-agent/show-prompt.js +17 -12
  10. package/dist/commands/curate.d.ts +3 -60
  11. package/dist/commands/curate.js +45 -341
  12. package/dist/commands/foo.d.ts +4 -2
  13. package/dist/commands/foo.js +21 -16
  14. package/dist/commands/main.d.ts +9 -0
  15. package/dist/commands/main.js +34 -0
  16. package/dist/commands/query.d.ts +2 -48
  17. package/dist/commands/query.js +19 -287
  18. package/dist/commands/status.d.ts +2 -13
  19. package/dist/commands/status.js +12 -91
  20. package/dist/commands/watch.d.ts +2 -0
  21. package/dist/commands/watch.js +23 -19
  22. package/dist/config/environment.d.ts +1 -1
  23. package/dist/config/environment.js +2 -2
  24. package/dist/constants.d.ts +4 -5
  25. package/dist/constants.js +5 -5
  26. package/dist/core/domain/cipher/errors/storage-error.d.ts +89 -0
  27. package/dist/core/domain/cipher/errors/storage-error.js +130 -0
  28. package/dist/core/domain/cipher/queue/types.d.ts +71 -0
  29. package/dist/core/domain/cipher/queue/types.js +9 -0
  30. package/dist/core/domain/cipher/storage/message-storage-types.d.ts +218 -0
  31. package/dist/core/domain/cipher/storage/message-storage-types.js +18 -0
  32. package/dist/core/domain/cipher/tools/constants.d.ts +1 -0
  33. package/dist/core/domain/cipher/tools/constants.js +1 -0
  34. package/dist/core/domain/entities/event.d.ts +1 -1
  35. package/dist/core/domain/entities/event.js +5 -0
  36. package/dist/core/domain/entities/global-config.d.ts +36 -0
  37. package/dist/core/domain/entities/global-config.js +66 -0
  38. package/dist/core/domain/knowledge/directory-manager.d.ts +10 -0
  39. package/dist/core/domain/knowledge/directory-manager.js +18 -0
  40. package/dist/core/domain/knowledge/markdown-writer.d.ts +9 -0
  41. package/dist/core/domain/knowledge/markdown-writer.js +51 -1
  42. package/dist/core/interfaces/cipher/i-agent-storage.d.ts +152 -0
  43. package/dist/core/interfaces/cipher/i-agent-storage.js +1 -0
  44. package/dist/core/interfaces/cipher/i-cipher-agent.d.ts +2 -0
  45. package/dist/core/interfaces/cipher/i-key-storage.d.ts +91 -0
  46. package/dist/core/interfaces/cipher/i-key-storage.js +1 -0
  47. package/dist/core/interfaces/i-global-config-store.d.ts +34 -0
  48. package/dist/core/interfaces/i-global-config-store.js +1 -0
  49. package/dist/core/interfaces/i-onboarding-preference-store.d.ts +20 -0
  50. package/dist/core/interfaces/i-onboarding-preference-store.js +1 -0
  51. package/dist/core/interfaces/i-terminal.d.ts +146 -0
  52. package/dist/core/interfaces/i-terminal.js +1 -0
  53. package/dist/core/interfaces/i-workspace-detector-service.d.ts +8 -0
  54. package/dist/core/interfaces/i-workspace-detector-service.js +1 -0
  55. package/dist/core/interfaces/usecase/i-clear-use-case.d.ts +6 -0
  56. package/dist/core/interfaces/usecase/i-clear-use-case.js +1 -0
  57. package/dist/core/interfaces/usecase/i-curate-use-case.d.ts +10 -0
  58. package/dist/core/interfaces/usecase/i-curate-use-case.js +1 -0
  59. package/dist/core/interfaces/usecase/i-generate-rules-use-case.d.ts +3 -0
  60. package/dist/core/interfaces/usecase/i-generate-rules-use-case.js +1 -0
  61. package/dist/core/interfaces/usecase/i-init-use-case.d.ts +5 -0
  62. package/dist/core/interfaces/usecase/i-init-use-case.js +1 -0
  63. package/dist/core/interfaces/usecase/i-login-use-case.d.ts +3 -0
  64. package/dist/core/interfaces/usecase/i-login-use-case.js +1 -0
  65. package/dist/core/interfaces/usecase/i-logout-use-case.d.ts +5 -0
  66. package/dist/core/interfaces/usecase/i-logout-use-case.js +1 -0
  67. package/dist/core/interfaces/usecase/i-pull-use-case.d.ts +5 -0
  68. package/dist/core/interfaces/usecase/i-pull-use-case.js +1 -0
  69. package/dist/core/interfaces/usecase/i-push-use-case.d.ts +6 -0
  70. package/dist/core/interfaces/usecase/i-push-use-case.js +1 -0
  71. package/dist/core/interfaces/usecase/i-query-use-case.d.ts +9 -0
  72. package/dist/core/interfaces/usecase/i-query-use-case.js +1 -0
  73. package/dist/core/interfaces/usecase/i-space-list-use-case.d.ts +3 -0
  74. package/dist/core/interfaces/usecase/i-space-list-use-case.js +1 -0
  75. package/dist/core/interfaces/usecase/i-space-switch-use-case.d.ts +3 -0
  76. package/dist/core/interfaces/usecase/i-space-switch-use-case.js +1 -0
  77. package/dist/core/interfaces/usecase/i-status-use-case.d.ts +5 -0
  78. package/dist/core/interfaces/usecase/i-status-use-case.js +1 -0
  79. package/dist/hooks/init/update-notifier.js +1 -5
  80. package/dist/hooks/init/welcome.js +1 -2
  81. package/dist/infra/cipher/agent-service-factory.d.ts +13 -6
  82. package/dist/infra/cipher/agent-service-factory.js +40 -16
  83. package/dist/infra/cipher/cipher-agent.js +4 -4
  84. package/dist/infra/cipher/consumer/consumer-lock.d.ts +20 -0
  85. package/dist/infra/cipher/consumer/consumer-lock.js +40 -0
  86. package/dist/infra/cipher/consumer/consumer-service.d.ts +99 -0
  87. package/dist/infra/cipher/consumer/consumer-service.js +165 -0
  88. package/dist/infra/cipher/consumer/execution-consumer.d.ts +121 -0
  89. package/dist/infra/cipher/consumer/execution-consumer.js +523 -0
  90. package/dist/infra/cipher/consumer/index.d.ts +33 -0
  91. package/dist/infra/cipher/consumer/index.js +33 -0
  92. package/dist/infra/cipher/consumer/queue-polling-service.d.ts +120 -0
  93. package/dist/infra/cipher/consumer/queue-polling-service.js +248 -0
  94. package/dist/infra/cipher/http/internal-llm-http-service.d.ts +94 -0
  95. package/dist/infra/cipher/http/internal-llm-http-service.js +118 -0
  96. package/dist/infra/cipher/llm/context/compaction/compaction-service.d.ts +106 -0
  97. package/dist/infra/cipher/llm/context/compaction/compaction-service.js +132 -0
  98. package/dist/infra/cipher/llm/context/compaction/index.d.ts +9 -0
  99. package/dist/infra/cipher/llm/context/compaction/index.js +9 -0
  100. package/dist/infra/cipher/llm/context/context-manager.d.ts +46 -2
  101. package/dist/infra/cipher/llm/context/context-manager.js +68 -4
  102. package/dist/infra/cipher/llm/context/rw-lock.d.ts +72 -0
  103. package/dist/infra/cipher/llm/context/rw-lock.js +145 -0
  104. package/dist/infra/cipher/llm/generators/byterover-content-generator.d.ts +7 -7
  105. package/dist/infra/cipher/llm/generators/byterover-content-generator.js +8 -8
  106. package/dist/infra/cipher/llm/internal-llm-service.js +2 -0
  107. package/dist/infra/cipher/session/session-manager.d.ts +4 -4
  108. package/dist/infra/cipher/session/session-manager.js +5 -5
  109. package/dist/infra/cipher/storage/agent-storage.d.ts +246 -0
  110. package/dist/infra/cipher/storage/agent-storage.js +956 -0
  111. package/dist/infra/cipher/storage/dual-format-history-storage.d.ts +77 -0
  112. package/dist/infra/cipher/storage/dual-format-history-storage.js +149 -0
  113. package/dist/infra/cipher/storage/granular-history-storage.d.ts +65 -0
  114. package/dist/infra/cipher/storage/granular-history-storage.js +118 -0
  115. package/dist/infra/cipher/storage/message-storage-service.d.ts +108 -0
  116. package/dist/infra/cipher/storage/message-storage-service.js +529 -0
  117. package/dist/infra/cipher/storage/process-utils.d.ts +16 -0
  118. package/dist/infra/cipher/storage/process-utils.js +43 -0
  119. package/dist/infra/cipher/storage/sqlite-key-storage.d.ts +105 -0
  120. package/dist/infra/cipher/storage/sqlite-key-storage.js +404 -0
  121. package/dist/infra/cipher/system-prompt/simple-prompt-factory.d.ts +1 -0
  122. package/dist/infra/cipher/system-prompt/simple-prompt-factory.js +7 -0
  123. package/dist/infra/cipher/tools/default-policy-rules.js +1 -1
  124. package/dist/infra/cipher/tools/implementations/curate-tool.d.ts +10 -0
  125. package/dist/infra/cipher/tools/implementations/curate-tool.js +371 -0
  126. package/dist/infra/cipher/tools/implementations/find-knowledge-topics-tool.js +11 -8
  127. package/dist/infra/cipher/tools/tool-manager.d.ts +8 -2
  128. package/dist/infra/cipher/tools/tool-manager.js +29 -2
  129. package/dist/infra/cipher/tools/tool-registry.js +7 -0
  130. package/dist/infra/http/authenticated-http-client.d.ts +21 -0
  131. package/dist/infra/http/authenticated-http-client.js +38 -0
  132. package/dist/infra/repl/commands/arg-parser.d.ts +97 -0
  133. package/dist/infra/repl/commands/arg-parser.js +129 -0
  134. package/dist/infra/repl/commands/clear-command.d.ts +5 -0
  135. package/dist/infra/repl/commands/clear-command.js +61 -0
  136. package/dist/infra/repl/commands/curate-command.d.ts +9 -0
  137. package/dist/infra/repl/commands/curate-command.js +88 -0
  138. package/dist/infra/repl/commands/gen-rules-command.d.ts +7 -0
  139. package/dist/infra/repl/commands/gen-rules-command.js +38 -0
  140. package/dist/infra/repl/commands/index.d.ts +8 -0
  141. package/dist/infra/repl/commands/index.js +36 -0
  142. package/dist/infra/repl/commands/init-command.d.ts +7 -0
  143. package/dist/infra/repl/commands/init-command.js +83 -0
  144. package/dist/infra/repl/commands/login-command.d.ts +7 -0
  145. package/dist/infra/repl/commands/login-command.js +50 -0
  146. package/dist/infra/repl/commands/logout-command.d.ts +5 -0
  147. package/dist/infra/repl/commands/logout-command.js +48 -0
  148. package/dist/infra/repl/commands/pull-command.d.ts +5 -0
  149. package/dist/infra/repl/commands/pull-command.js +61 -0
  150. package/dist/infra/repl/commands/push-command.d.ts +5 -0
  151. package/dist/infra/repl/commands/push-command.js +66 -0
  152. package/dist/infra/repl/commands/query-command.d.ts +5 -0
  153. package/dist/infra/repl/commands/query-command.js +66 -0
  154. package/dist/infra/repl/commands/space/index.d.ts +5 -0
  155. package/dist/infra/repl/commands/space/index.js +14 -0
  156. package/dist/infra/repl/commands/space/list-command.d.ts +5 -0
  157. package/dist/infra/repl/commands/space/list-command.js +70 -0
  158. package/dist/infra/repl/commands/space/switch-command.d.ts +5 -0
  159. package/dist/infra/repl/commands/space/switch-command.js +37 -0
  160. package/dist/infra/repl/commands/status-command.d.ts +5 -0
  161. package/dist/infra/repl/commands/status-command.js +39 -0
  162. package/dist/infra/repl/repl-startup.d.ts +18 -0
  163. package/dist/infra/repl/repl-startup.js +26 -0
  164. package/dist/infra/storage/file-global-config-store.d.ts +22 -0
  165. package/dist/infra/storage/file-global-config-store.js +65 -0
  166. package/dist/infra/storage/file-onboarding-preference-store.d.ts +10 -0
  167. package/dist/infra/storage/file-onboarding-preference-store.js +46 -0
  168. package/dist/infra/terminal/oclif-terminal.d.ts +19 -0
  169. package/dist/infra/terminal/oclif-terminal.js +60 -0
  170. package/dist/infra/terminal/repl-terminal.d.ts +31 -0
  171. package/dist/infra/terminal/repl-terminal.js +116 -0
  172. package/dist/infra/tracking/mixpanel-tracking-service.d.ts +11 -1
  173. package/dist/infra/tracking/mixpanel-tracking-service.js +18 -13
  174. package/dist/infra/usecase/clear-use-case.d.ts +20 -0
  175. package/dist/infra/usecase/clear-use-case.js +58 -0
  176. package/dist/infra/usecase/curate-use-case.d.ts +66 -0
  177. package/dist/infra/usecase/curate-use-case.js +283 -0
  178. package/dist/{commands/gen-rules.d.ts → infra/usecase/generate-rules-use-case.d.ts} +14 -20
  179. package/dist/{commands/gen-rules.js → infra/usecase/generate-rules-use-case.js} +59 -78
  180. package/dist/infra/usecase/init-use-case.d.ts +139 -0
  181. package/dist/{commands/init.js → infra/usecase/init-use-case.js} +184 -230
  182. package/dist/infra/usecase/login-use-case.d.ts +28 -0
  183. package/dist/infra/usecase/login-use-case.js +88 -0
  184. package/dist/infra/usecase/logout-use-case.d.ts +22 -0
  185. package/dist/infra/usecase/logout-use-case.js +51 -0
  186. package/dist/infra/usecase/pull-use-case.d.ts +35 -0
  187. package/dist/infra/usecase/pull-use-case.js +89 -0
  188. package/dist/infra/usecase/push-use-case.d.ts +37 -0
  189. package/dist/infra/usecase/push-use-case.js +124 -0
  190. package/dist/infra/usecase/query-use-case.d.ts +78 -0
  191. package/dist/infra/usecase/query-use-case.js +401 -0
  192. package/dist/infra/usecase/space-list-use-case.d.ts +27 -0
  193. package/dist/infra/usecase/space-list-use-case.js +64 -0
  194. package/dist/infra/usecase/space-switch-use-case.d.ts +36 -0
  195. package/dist/infra/usecase/space-switch-use-case.js +140 -0
  196. package/dist/infra/usecase/status-use-case.d.ts +27 -0
  197. package/dist/infra/usecase/status-use-case.js +97 -0
  198. package/dist/infra/workspace/workspace-detector-service.d.ts +3 -6
  199. package/dist/resources/prompts/curate-context-tree-curation.yml +23 -11
  200. package/dist/resources/prompts/query-context-tree-retrieval.yml +3 -4
  201. package/dist/resources/prompts/system-prompt.yml +1 -1
  202. package/dist/resources/prompts/tool-outputs.yml +4 -3
  203. package/dist/templates/sections/command-reference.md +12 -0
  204. package/dist/templates/sections/workflow.md +10 -1
  205. package/dist/tui/app.d.ts +9 -0
  206. package/dist/tui/app.js +26 -0
  207. package/dist/tui/components/enter-prompt.d.ts +13 -0
  208. package/dist/tui/components/enter-prompt.js +15 -0
  209. package/dist/tui/components/execution/execution-changes.d.ts +14 -0
  210. package/dist/tui/components/execution/execution-changes.js +15 -0
  211. package/dist/tui/components/execution/execution-content.d.ts +25 -0
  212. package/dist/tui/components/execution/execution-content.js +67 -0
  213. package/dist/tui/components/execution/execution-input.d.ts +12 -0
  214. package/dist/tui/components/execution/execution-input.js +16 -0
  215. package/dist/tui/components/execution/execution-progress.d.ts +21 -0
  216. package/dist/tui/components/execution/execution-progress.js +21 -0
  217. package/dist/tui/components/execution/execution-status.d.ts +13 -0
  218. package/dist/tui/components/execution/execution-status.js +19 -0
  219. package/dist/tui/components/execution/index.d.ts +11 -0
  220. package/dist/tui/components/execution/index.js +11 -0
  221. package/dist/tui/components/execution/log-item.d.ts +17 -0
  222. package/dist/tui/components/execution/log-item.js +25 -0
  223. package/dist/tui/components/footer.d.ts +5 -0
  224. package/dist/tui/components/footer.js +12 -0
  225. package/dist/tui/components/header.d.ts +18 -0
  226. package/dist/tui/components/header.js +18 -0
  227. package/dist/tui/components/index.d.ts +17 -0
  228. package/dist/tui/components/index.js +14 -0
  229. package/dist/tui/components/inline-prompts/index.d.ts +15 -0
  230. package/dist/tui/components/inline-prompts/index.js +10 -0
  231. package/dist/tui/components/inline-prompts/inline-confirm.d.ts +17 -0
  232. package/dist/tui/components/inline-prompts/inline-confirm.js +32 -0
  233. package/dist/tui/components/inline-prompts/inline-file-selector.d.ts +43 -0
  234. package/dist/tui/components/inline-prompts/inline-file-selector.js +185 -0
  235. package/dist/tui/components/inline-prompts/inline-input.d.ts +19 -0
  236. package/dist/tui/components/inline-prompts/inline-input.js +32 -0
  237. package/dist/tui/components/inline-prompts/inline-search.d.ts +20 -0
  238. package/dist/tui/components/inline-prompts/inline-search.js +50 -0
  239. package/dist/tui/components/inline-prompts/inline-select.d.ts +20 -0
  240. package/dist/tui/components/inline-prompts/inline-select.js +34 -0
  241. package/dist/tui/components/logo.d.ts +43 -0
  242. package/dist/tui/components/logo.js +103 -0
  243. package/dist/tui/components/message-item.d.ts +12 -0
  244. package/dist/tui/components/message-item.js +12 -0
  245. package/dist/tui/components/onboarding/copyable-prompt.d.ts +15 -0
  246. package/dist/tui/components/onboarding/copyable-prompt.js +65 -0
  247. package/dist/tui/components/onboarding/index.d.ts +7 -0
  248. package/dist/tui/components/onboarding/index.js +6 -0
  249. package/dist/tui/components/onboarding/onboarding-flow.d.ts +13 -0
  250. package/dist/tui/components/onboarding/onboarding-flow.js +304 -0
  251. package/dist/tui/components/onboarding/onboarding-step.d.ts +23 -0
  252. package/dist/tui/components/onboarding/onboarding-step.js +12 -0
  253. package/dist/tui/components/output-log.d.ts +14 -0
  254. package/dist/tui/components/output-log.js +13 -0
  255. package/dist/tui/components/scrollable-list.d.ts +30 -0
  256. package/dist/tui/components/scrollable-list.js +121 -0
  257. package/dist/tui/components/suggestions.d.ts +16 -0
  258. package/dist/tui/components/suggestions.js +162 -0
  259. package/dist/tui/components/tab-bar.d.ts +10 -0
  260. package/dist/tui/components/tab-bar.js +12 -0
  261. package/dist/tui/constants.d.ts +11 -0
  262. package/dist/tui/constants.js +13 -0
  263. package/dist/tui/contexts/auth-context.d.ts +30 -0
  264. package/dist/tui/contexts/auth-context.js +153 -0
  265. package/dist/tui/contexts/consumer.d.ts +31 -0
  266. package/dist/tui/contexts/consumer.js +56 -0
  267. package/dist/tui/contexts/index.d.ts +6 -0
  268. package/dist/tui/contexts/index.js +6 -0
  269. package/dist/tui/contexts/onboarding-context.d.ts +43 -0
  270. package/dist/tui/contexts/onboarding-context.js +181 -0
  271. package/dist/tui/contexts/services-context.d.ts +29 -0
  272. package/dist/tui/contexts/services-context.js +20 -0
  273. package/dist/tui/contexts/use-commands.d.ts +29 -0
  274. package/dist/tui/contexts/use-commands.js +53 -0
  275. package/dist/tui/contexts/use-mode.d.ts +43 -0
  276. package/dist/tui/contexts/use-mode.js +76 -0
  277. package/dist/tui/contexts/use-theme.d.ts +53 -0
  278. package/dist/tui/contexts/use-theme.js +60 -0
  279. package/dist/tui/hooks/index.d.ts +17 -0
  280. package/dist/tui/hooks/index.js +14 -0
  281. package/dist/tui/hooks/use-activity-logs.d.ts +26 -0
  282. package/dist/tui/hooks/use-activity-logs.js +90 -0
  283. package/dist/tui/hooks/use-consumer.d.ts +12 -0
  284. package/dist/tui/hooks/use-consumer.js +50 -0
  285. package/dist/tui/hooks/use-onboarding.d.ts +7 -0
  286. package/dist/tui/hooks/use-onboarding.js +6 -0
  287. package/dist/tui/hooks/use-queue-polling.d.ts +31 -0
  288. package/dist/tui/hooks/use-queue-polling.js +90 -0
  289. package/dist/tui/hooks/use-slash-command-processor.d.ts +16 -0
  290. package/dist/tui/hooks/use-slash-command-processor.js +132 -0
  291. package/dist/tui/hooks/use-slash-completion.d.ts +30 -0
  292. package/dist/tui/hooks/use-slash-completion.js +230 -0
  293. package/dist/tui/hooks/use-tab-navigation.d.ts +10 -0
  294. package/dist/tui/hooks/use-tab-navigation.js +35 -0
  295. package/dist/tui/hooks/use-visible-window.d.ts +22 -0
  296. package/dist/tui/hooks/use-visible-window.js +37 -0
  297. package/dist/tui/index.d.ts +1 -0
  298. package/dist/tui/index.js +1 -0
  299. package/dist/tui/providers/app-providers.d.ts +25 -0
  300. package/dist/tui/providers/app-providers.js +9 -0
  301. package/dist/tui/types/commands.d.ts +252 -0
  302. package/dist/tui/types/commands.js +16 -0
  303. package/dist/tui/types/dialogs.d.ts +37 -0
  304. package/dist/tui/types/dialogs.js +4 -0
  305. package/dist/tui/types/index.d.ts +11 -0
  306. package/dist/tui/types/index.js +7 -0
  307. package/dist/tui/types/messages.d.ts +55 -0
  308. package/dist/tui/types/messages.js +4 -0
  309. package/dist/tui/types/prompts.d.ts +100 -0
  310. package/dist/tui/types/prompts.js +4 -0
  311. package/dist/tui/types/ui.d.ts +14 -0
  312. package/dist/tui/types/ui.js +4 -0
  313. package/dist/tui/types.d.ts +1 -0
  314. package/dist/tui/types.js +1 -0
  315. package/dist/tui/views/command-view.d.ts +12 -0
  316. package/dist/tui/views/command-view.js +451 -0
  317. package/dist/tui/views/index.d.ts +6 -0
  318. package/dist/tui/views/index.js +6 -0
  319. package/dist/tui/views/login-view.d.ts +10 -0
  320. package/dist/tui/views/login-view.js +30 -0
  321. package/dist/tui/views/logs-view.d.ts +11 -0
  322. package/dist/tui/views/logs-view.js +73 -0
  323. package/dist/utils/file-validator.d.ts +16 -0
  324. package/dist/utils/file-validator.js +81 -0
  325. package/dist/utils/global-config-path.d.ts +15 -0
  326. package/dist/utils/global-config-path.js +38 -0
  327. package/oclif.manifest.json +29 -315
  328. package/package.json +11 -4
  329. package/dist/commands/clear.d.ts +0 -19
  330. package/dist/commands/clear.js +0 -78
  331. package/dist/commands/init.d.ts +0 -130
  332. package/dist/commands/login.d.ts +0 -22
  333. package/dist/commands/login.js +0 -108
  334. package/dist/commands/logout.d.ts +0 -16
  335. package/dist/commands/logout.js +0 -61
  336. package/dist/commands/pull.d.ts +0 -33
  337. package/dist/commands/pull.js +0 -115
  338. package/dist/commands/push.d.ts +0 -35
  339. package/dist/commands/push.js +0 -160
  340. package/dist/commands/space/list.d.ts +0 -25
  341. package/dist/commands/space/list.js +0 -114
  342. package/dist/commands/space/switch.d.ts +0 -36
  343. package/dist/commands/space/switch.js +0 -160
  344. package/dist/infra/cipher/grpc/internal-llm-grpc-service.d.ts +0 -149
  345. package/dist/infra/cipher/grpc/internal-llm-grpc-service.js +0 -364
  346. package/dist/infra/cipher/grpc/internal-llm-grpc.proto +0 -94
@@ -1,78 +0,0 @@
1
- import { confirm } from '@inquirer/prompts';
2
- import { Args, Command, Flags } from '@oclif/core';
3
- import { rm } from 'node:fs/promises';
4
- import { join } from 'node:path';
5
- import { BRV_DIR, CONTEXT_TREE_DIR } from '../constants.js';
6
- import { FileContextTreeService } from '../infra/context-tree/file-context-tree-service.js';
7
- import { FileContextTreeSnapshotService } from '../infra/context-tree/file-context-tree-snapshot-service.js';
8
- export default class Clear extends Command {
9
- static args = {
10
- directory: Args.string({ description: 'Project directory (defaults to current directory)', required: false }),
11
- };
12
- static description = 'Reset the context tree to its original state (6 default domains)';
13
- static examples = [
14
- '<%= config.bin %> <%= command.id %>',
15
- '<%= config.bin %> <%= command.id %> --yes',
16
- '<%= config.bin %> <%= command.id %> /path/to/project',
17
- ];
18
- static flags = {
19
- yes: Flags.boolean({
20
- char: 'y',
21
- default: false,
22
- description: 'Skip confirmation prompt',
23
- }),
24
- };
25
- // Protected method for testability - can be overridden in tests
26
- async confirmClear() {
27
- return confirm({
28
- default: false,
29
- message: 'Are you sure you want to reset the context tree? This will remove all existing context and restore default domains.',
30
- });
31
- }
32
- createServices() {
33
- return {
34
- contextTreeService: new FileContextTreeService(),
35
- contextTreeSnapshotService: new FileContextTreeSnapshotService(),
36
- };
37
- }
38
- async run() {
39
- const { args, flags } = await this.parse(Clear);
40
- try {
41
- const { contextTreeService, contextTreeSnapshotService } = this.createServices();
42
- // Check if context tree exists
43
- const exists = await contextTreeService.exists(args.directory);
44
- if (!exists) {
45
- this.log('No context tree found. Nothing to clear.');
46
- return;
47
- }
48
- // Confirmation prompt (unless --yes flag is used)
49
- if (!flags.yes) {
50
- const confirmed = await this.confirmClear();
51
- if (!confirmed) {
52
- this.log('Cancelled. Context tree was not reset.');
53
- return;
54
- }
55
- }
56
- // Remove existing context tree directory
57
- const baseDir = args.directory ?? process.cwd();
58
- const contextTreeDir = join(baseDir, BRV_DIR, CONTEXT_TREE_DIR);
59
- await rm(contextTreeDir, { force: true, recursive: true });
60
- // Re-initialize context tree with default domains
61
- await contextTreeService.initialize(args.directory);
62
- // Re-initialize empty snapshot
63
- await contextTreeSnapshotService.initEmptySnapshot(args.directory);
64
- this.log('✓ Context tree reset successfully.');
65
- this.log(' 6 default domains restored: code_style, design, structure, compliance, testing, bug_fixes');
66
- }
67
- catch (error) {
68
- // Handle user cancelling the prompt (Ctrl+C or closing stdin)
69
- const errorMessage = error instanceof Error ? error.message : String(error);
70
- if (errorMessage.includes('User force closed') || errorMessage.includes('force closed')) {
71
- this.log('Cancelled. Context tree was not reset.');
72
- return;
73
- }
74
- // For other errors, throw to let oclif handle display
75
- this.error(error instanceof Error ? error.message : 'Failed to reset context tree');
76
- }
77
- }
78
- }
@@ -1,130 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import type { AuthToken } from '../core/domain/entities/auth-token.js';
3
- import type { Space } from '../core/domain/entities/space.js';
4
- import type { Team } from '../core/domain/entities/team.js';
5
- import type { ICogitPullService } from '../core/interfaces/i-cogit-pull-service.js';
6
- import type { IContextTreeService } from '../core/interfaces/i-context-tree-service.js';
7
- import type { IContextTreeSnapshotService } from '../core/interfaces/i-context-tree-snapshot-service.js';
8
- import type { IContextTreeWriterService } from '../core/interfaces/i-context-tree-writer-service.js';
9
- import type { IProjectConfigStore } from '../core/interfaces/i-project-config-store.js';
10
- import type { ISpaceService } from '../core/interfaces/i-space-service.js';
11
- import type { ITeamService } from '../core/interfaces/i-team-service.js';
12
- import type { ITokenStore } from '../core/interfaces/i-token-store.js';
13
- import { type Agent } from '../core/domain/entities/agent.js';
14
- import { BrvConfig } from '../core/domain/entities/brv-config.js';
15
- import { IFileService } from '../core/interfaces/i-file-service.js';
16
- import { ILegacyRuleDetector } from '../core/interfaces/i-legacy-rule-detector.js';
17
- import { IRuleTemplateService } from '../core/interfaces/i-rule-template-service.js';
18
- import { ITrackingService } from '../core/interfaces/i-tracking-service.js';
19
- type CleanupStrategy = 'automatic' | 'manual';
20
- /**
21
- * Represents a legacy config that exists but has version issues.
22
- * Used to display config info during re-initialization prompt.
23
- */
24
- export type LegacyProjectConfigInfo = {
25
- /**
26
- * undefined = missing, string = mismatched
27
- */
28
- currentVersion: string | undefined;
29
- spaceName: string;
30
- teamName: string;
31
- type: 'legacy';
32
- };
33
- export default class Init extends Command {
34
- static description: string;
35
- static examples: string[];
36
- static flags: {
37
- force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
38
- };
39
- protected aceDirectoryExists(baseDir?: string): Promise<boolean>;
40
- protected cleanupBeforeReInitialization(): Promise<void>;
41
- protected confirmReInitialization(config: BrvConfig | LegacyProjectConfigInfo): Promise<boolean>;
42
- protected createServices(): {
43
- cogitPullService: ICogitPullService;
44
- contextTreeService: IContextTreeService;
45
- contextTreeSnapshotService: IContextTreeSnapshotService;
46
- contextTreeWriterService: IContextTreeWriterService;
47
- fileService: IFileService;
48
- legacyRuleDetector: ILegacyRuleDetector;
49
- projectConfigStore: IProjectConfigStore;
50
- spaceService: ISpaceService;
51
- teamService: ITeamService;
52
- templateService: IRuleTemplateService;
53
- tokenStore: ITokenStore;
54
- trackingService: ITrackingService;
55
- };
56
- protected detectWorkspacesForAgent(agent: Agent): {
57
- chatLogPath: string;
58
- cwd: string;
59
- };
60
- protected ensureAuthenticated(tokenStore: ITokenStore): Promise<AuthToken>;
61
- protected fetchAndSelectSpace(spaceService: ISpaceService, token: AuthToken, team: Team): Promise<Space | undefined>;
62
- protected fetchAndSelectTeam(teamService: ITeamService, token: AuthToken): Promise<Team | undefined>;
63
- protected generateRulesForAgent(selectedAgent: Agent, fileService: IFileService, templateService: IRuleTemplateService, legacyRuleDetector: ILegacyRuleDetector): Promise<void>;
64
- protected getExistingConfig(projectConfigStore: IProjectConfigStore): Promise<BrvConfig | LegacyProjectConfigInfo | undefined>;
65
- protected initializeMemoryContextDir(name: string, initFn: () => Promise<string>): Promise<void>;
66
- protected isLegacyProjectConfig(config: BrvConfig | LegacyProjectConfigInfo): config is LegacyProjectConfigInfo;
67
- /**
68
- * Checks if the given path represents a README.md placeholder file.
69
- * Handles both legacy paths with leading slash and new paths without.
70
- */
71
- protected isReadmePlaceholder(path: string): boolean;
72
- protected promptAceDeprecationRemoval(): Promise<boolean>;
73
- /**
74
- * Prompts the user to select an agent.
75
- * This method is protected to allow test overrides.
76
- * @returns The selected agent
77
- */
78
- protected promptForAgentSelection(): Promise<Agent>;
79
- /**
80
- * Prompts the user to choose cleanup strategy for legacy rules.
81
- * This method is protected to allow test overrides.
82
- * @returns The chosen cleanup strategy
83
- */
84
- protected promptForCleanupStrategy(): Promise<CleanupStrategy>;
85
- /**
86
- * Prompts the user to create a new rule file.
87
- * This method is protected to allow test overrides.
88
- * @param agent The agent for which the rule file doesn't exist
89
- * @param filePath The path where the file would be created
90
- * @returns True if the user wants to create the file, false otherwise
91
- */
92
- protected promptForFileCreation(agent: Agent, filePath: string): Promise<boolean>;
93
- /**
94
- * Prompts the user to confirm overwriting an existing rule file.
95
- * This method is protected to allow test overrides.
96
- */
97
- protected promptForOverwriteConfirmation(agent: Agent): Promise<boolean>;
98
- protected promptForSpaceSelection(spaces: Space[]): Promise<Space>;
99
- protected promptForTeamSelection(teams: Team[]): Promise<Team>;
100
- protected removeAceDirectory(baseDir?: string): Promise<void>;
101
- run(): Promise<void>;
102
- protected syncFromRemoteOrInitialize(params: {
103
- cogitPullService: ICogitPullService;
104
- contextTreeService: IContextTreeService;
105
- contextTreeSnapshotService: IContextTreeSnapshotService;
106
- contextTreeWriterService: IContextTreeWriterService;
107
- projectConfig: {
108
- spaceId: string;
109
- teamId: string;
110
- };
111
- token: AuthToken;
112
- }): Promise<void>;
113
- /**
114
- * Appends ByteRover rules to a file that has no ByteRover content.
115
- */
116
- private appendRulesToFile;
117
- /**
118
- * Creates a new rule file with ByteRover rules.
119
- */
120
- private createNewRuleFile;
121
- private handleLegacyRulesCleanup;
122
- private logSuccess;
123
- private performAutomaticCleanup;
124
- private performManualCleanup;
125
- /**
126
- * Replaces existing ByteRover rules (with boundary markers) with new rules.
127
- */
128
- private replaceExistingRules;
129
- }
130
- export {};
@@ -1,22 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import type { IAuthService } from '../core/interfaces/i-auth-service.js';
3
- import type { IBrowserLauncher } from '../core/interfaces/i-browser-launcher.js';
4
- import type { ICallbackHandler } from '../core/interfaces/i-callback-handler.js';
5
- import type { IOidcDiscoveryService } from '../core/interfaces/i-oidc-discovery-service.js';
6
- import type { ITokenStore } from '../core/interfaces/i-token-store.js';
7
- import type { IUserService } from '../core/interfaces/i-user-service.js';
8
- import { ITrackingService } from '../core/interfaces/i-tracking-service.js';
9
- export default class Login extends Command {
10
- static description: string;
11
- static examples: string[];
12
- protected createAuthService(discoveryService: IOidcDiscoveryService): Promise<IAuthService>;
13
- protected createServices(): {
14
- browserLauncher: IBrowserLauncher;
15
- callbackHandler: ICallbackHandler;
16
- discoveryService: IOidcDiscoveryService;
17
- tokenStore: ITokenStore;
18
- trackingService: ITrackingService;
19
- userService: IUserService;
20
- };
21
- run(): Promise<void>;
22
- }
@@ -1,108 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import { getAuthConfig } from '../config/auth.config.js';
3
- import { getCurrentConfig } from '../config/environment.js';
4
- import { AuthToken } from '../core/domain/entities/auth-token.js';
5
- import { DiscoveryError } from '../core/domain/errors/discovery-error.js';
6
- import { OAuthService } from '../infra/auth/oauth-service.js';
7
- import { OidcDiscoveryService } from '../infra/auth/oidc-discovery-service.js';
8
- import { SystemBrowserLauncher } from '../infra/browser/system-browser-launcher.js';
9
- import { CallbackHandler } from '../infra/http/callback-handler.js';
10
- import { KeychainTokenStore } from '../infra/storage/keychain-token-store.js';
11
- import { MixpanelTrackingService } from '../infra/tracking/mixpanel-tracking-service.js';
12
- import { HttpUserService } from '../infra/user/http-user-service.js';
13
- export default class Login extends Command {
14
- static description = 'Authenticate with ByteRover using OAuth 2.0 + PKCE (opens browser for secure login, stores tokens in keychain)';
15
- static examples = [
16
- '<%= config.bin %> <%= command.id %>',
17
- '# After authentication expires, re-login:\n<%= config.bin %> <%= command.id %>',
18
- '# Check authentication status after login:\n<%= config.bin %> <%= command.id %>\n<%= config.bin %> status',
19
- ];
20
- async createAuthService(discoveryService) {
21
- const config = await getAuthConfig(discoveryService);
22
- return new OAuthService(config);
23
- }
24
- createServices() {
25
- const config = getCurrentConfig();
26
- const tokenStore = new KeychainTokenStore();
27
- const trackingService = new MixpanelTrackingService(tokenStore);
28
- return {
29
- browserLauncher: new SystemBrowserLauncher(),
30
- callbackHandler: new CallbackHandler(),
31
- discoveryService: new OidcDiscoveryService(),
32
- tokenStore,
33
- trackingService,
34
- userService: new HttpUserService({ apiBaseUrl: config.apiBaseUrl }),
35
- };
36
- }
37
- async run() {
38
- const { browserLauncher, callbackHandler, discoveryService, tokenStore, trackingService, userService } = this.createServices();
39
- try {
40
- this.log('Starting authentication process...');
41
- // Create auth service with discovered config
42
- const authService = await this.createAuthService(discoveryService);
43
- // Start callback server
44
- await callbackHandler.start();
45
- // Get port and build redirect URI
46
- const port = callbackHandler.getPort();
47
- if (!port) {
48
- throw new Error('Failed to get callback server port');
49
- }
50
- const redirectUri = `http://localhost:${port}/callback`;
51
- // Initiate authorization (generates PKCE parameters and state internally)
52
- const authContext = authService.initiateAuthorization(redirectUri);
53
- // Try to open browser
54
- let browserOpened = false;
55
- try {
56
- await browserLauncher.open(authContext.authUrl);
57
- browserOpened = true;
58
- }
59
- catch {
60
- // Browser launch failed, will return URL to user
61
- }
62
- // If browser failed to open, display the URL for manual copy
63
- if (!browserOpened) {
64
- this.log('\nBrowser failed to open automatically.');
65
- this.log('Please open this URL in your browser:');
66
- this.log(authContext.authUrl);
67
- }
68
- try {
69
- // Wait for callback with 5 minute timeout
70
- const { code } = await callbackHandler.waitForCallback(authContext.state, 5 * 60 * 1000);
71
- const authTokenData = await authService.exchangeCodeForToken(code, authContext, redirectUri);
72
- const user = await userService.getCurrentUser(authTokenData.accessToken, authTokenData.sessionKey);
73
- const authToken = new AuthToken({
74
- accessToken: authTokenData.accessToken,
75
- expiresAt: authTokenData.expiresAt,
76
- refreshToken: authTokenData.refreshToken,
77
- sessionKey: authTokenData.sessionKey,
78
- tokenType: authTokenData.tokenType,
79
- userEmail: user.email,
80
- userId: user.id,
81
- });
82
- await tokenStore.save(authToken);
83
- // Track successful authentication
84
- await trackingService.track('auth:signed_in');
85
- this.log('Successfully authenticated!');
86
- }
87
- catch (error) {
88
- // Throw error to let oclif handle display
89
- const errorMessage = error instanceof Error ? error.message : 'Authentication failed';
90
- this.error(errorMessage);
91
- }
92
- }
93
- catch (error) {
94
- if (error instanceof DiscoveryError) {
95
- const errorMessage = `Failed to configure authentication: ${error.message}\n` +
96
- 'Please check your network connection and try again.';
97
- this.error(errorMessage);
98
- }
99
- // Throw error to let oclif handle display
100
- const errorMessage = error instanceof Error ? error.message : 'Authentication failed';
101
- this.error(errorMessage);
102
- }
103
- finally {
104
- // Always cleanup server
105
- await callbackHandler.stop();
106
- }
107
- }
108
- }
@@ -1,16 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import type { ITokenStore } from '../core/interfaces/i-token-store.js';
3
- import type { ITrackingService } from '../core/interfaces/i-tracking-service.js';
4
- export default class Logout extends Command {
5
- static description: string;
6
- static examples: string[];
7
- static flags: {
8
- yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
- };
10
- protected confirmLogout(userEmail: string): Promise<boolean>;
11
- protected createServices(): {
12
- tokenStore: ITokenStore;
13
- trackingService: ITrackingService;
14
- };
15
- run(): Promise<void>;
16
- }
@@ -1,61 +0,0 @@
1
- import { confirm } from '@inquirer/prompts';
2
- import { Command, Flags } from '@oclif/core';
3
- import { KeychainTokenStore } from '../infra/storage/keychain-token-store.js';
4
- import { MixpanelTrackingService } from '../infra/tracking/mixpanel-tracking-service.js';
5
- export default class Logout extends Command {
6
- static description = 'Log out of ByteRover CLI and clear authentication (does not affect local project files)';
7
- static examples = ['<%= config.bin %> <%= command.id %>', '<%= config.bin %> <%= command.id %> --yes'];
8
- static flags = {
9
- yes: Flags.boolean({
10
- char: 'y',
11
- default: false,
12
- description: 'Skip confirmation prompt',
13
- }),
14
- };
15
- async confirmLogout(userEmail) {
16
- return confirm({
17
- // Pressing 'Enter' = Yes
18
- default: true,
19
- message: `Logging out ${userEmail}. Are you sure?`,
20
- });
21
- }
22
- createServices() {
23
- const tokenStore = new KeychainTokenStore();
24
- const trackingService = new MixpanelTrackingService(tokenStore);
25
- return {
26
- tokenStore,
27
- trackingService,
28
- };
29
- }
30
- async run() {
31
- const { flags } = await this.parse(Logout);
32
- const { tokenStore, trackingService } = this.createServices();
33
- try {
34
- const token = await tokenStore.load();
35
- if (token === undefined) {
36
- this.log('You are not currently logged in.');
37
- return;
38
- }
39
- if (!flags.yes) {
40
- const confirmed = await this.confirmLogout(token.userEmail);
41
- if (!confirmed) {
42
- this.log('Logout cancelled.');
43
- return;
44
- }
45
- }
46
- try {
47
- await trackingService.track('auth:signed_out');
48
- }
49
- catch { }
50
- await tokenStore.clear();
51
- this.log('Successfully logged out.');
52
- this.log("Run 'brv login' to authenticate again.");
53
- }
54
- catch (error) {
55
- if (error instanceof Error && error.message.includes('keychain')) {
56
- this.error('Unable to access system keychain. Please check your system permissions and try again.');
57
- }
58
- this.error(error instanceof Error ? error.message : 'Logout failed');
59
- }
60
- }
61
- }
@@ -1,33 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import type { AuthToken } from '../core/domain/entities/auth-token.js';
3
- import type { BrvConfig } from '../core/domain/entities/brv-config.js';
4
- import type { ICogitPullService } from '../core/interfaces/i-cogit-pull-service.js';
5
- import type { IContextTreeSnapshotService } from '../core/interfaces/i-context-tree-snapshot-service.js';
6
- import type { IContextTreeWriterService } from '../core/interfaces/i-context-tree-writer-service.js';
7
- import type { IProjectConfigStore } from '../core/interfaces/i-project-config-store.js';
8
- import type { ITokenStore } from '../core/interfaces/i-token-store.js';
9
- import type { ITrackingService } from '../core/interfaces/i-tracking-service.js';
10
- export default class Pull extends Command {
11
- static description: string;
12
- static examples: string[];
13
- static flags: {
14
- branch: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
- };
16
- catch(error: Error & {
17
- oclif?: {
18
- exit: number;
19
- };
20
- }): Promise<void>;
21
- protected checkLocalChanges(contextTreeSnapshotService: IContextTreeSnapshotService): Promise<boolean>;
22
- protected checkProjectInit(projectConfigStore: IProjectConfigStore): Promise<BrvConfig>;
23
- protected createServices(): {
24
- cogitPullService: ICogitPullService;
25
- contextTreeSnapshotService: IContextTreeSnapshotService;
26
- contextTreeWriterService: IContextTreeWriterService;
27
- projectConfigStore: IProjectConfigStore;
28
- tokenStore: ITokenStore;
29
- trackingService: ITrackingService;
30
- };
31
- run(): Promise<void>;
32
- protected validateAuth(tokenStore: ITokenStore): Promise<AuthToken>;
33
- }
@@ -1,115 +0,0 @@
1
- import { Command, Flags, ux } from '@oclif/core';
2
- import { getCurrentConfig } from '../config/environment.js';
3
- import { DEFAULT_BRANCH } from '../constants.js';
4
- import { ExitCode, ExitError, exitWithCode } from '../infra/cipher/exit-codes.js';
5
- import { WorkspaceNotInitializedError } from '../infra/cipher/validation/workspace-validator.js';
6
- import { HttpCogitPullService } from '../infra/cogit/http-cogit-pull-service.js';
7
- import { ProjectConfigStore } from '../infra/config/file-config-store.js';
8
- import { FileContextTreeSnapshotService } from '../infra/context-tree/file-context-tree-snapshot-service.js';
9
- import { FileContextTreeWriterService } from '../infra/context-tree/file-context-tree-writer-service.js';
10
- import { KeychainTokenStore } from '../infra/storage/keychain-token-store.js';
11
- import { MixpanelTrackingService } from '../infra/tracking/mixpanel-tracking-service.js';
12
- export default class Pull extends Command {
13
- static description = 'Pull context tree from ByteRover memory storage';
14
- static examples = [
15
- '<%= config.bin %> <%= command.id %>',
16
- '<%= config.bin %> <%= command.id %> --branch develop',
17
- '<%= config.bin %> <%= command.id %> -b feature-auth',
18
- ];
19
- static flags = {
20
- branch: Flags.string({
21
- char: 'b',
22
- default: DEFAULT_BRANCH,
23
- description: 'ByteRover branch name (not Git branch)',
24
- }),
25
- };
26
- async catch(error) {
27
- if (error instanceof ExitError) {
28
- return;
29
- }
30
- if (error.oclif?.exit !== undefined) {
31
- return;
32
- }
33
- throw error;
34
- }
35
- async checkLocalChanges(contextTreeSnapshotService) {
36
- const changes = await contextTreeSnapshotService.getChanges();
37
- return changes.added.length > 0 || changes.modified.length > 0 || changes.deleted.length > 0;
38
- }
39
- async checkProjectInit(projectConfigStore) {
40
- const projectConfig = await projectConfigStore.read();
41
- if (projectConfig === undefined) {
42
- throw new WorkspaceNotInitializedError('Project not initialized. Please run "brv init" to select your team and workspace.', '.brv');
43
- }
44
- return projectConfig;
45
- }
46
- createServices() {
47
- const envConfig = getCurrentConfig();
48
- const tokenStore = new KeychainTokenStore();
49
- const trackingService = new MixpanelTrackingService(tokenStore);
50
- const contextTreeSnapshotService = new FileContextTreeSnapshotService();
51
- return {
52
- cogitPullService: new HttpCogitPullService({
53
- apiBaseUrl: envConfig.cogitApiBaseUrl,
54
- }),
55
- contextTreeSnapshotService,
56
- contextTreeWriterService: new FileContextTreeWriterService({ snapshotService: contextTreeSnapshotService }),
57
- projectConfigStore: new ProjectConfigStore(),
58
- tokenStore,
59
- trackingService,
60
- };
61
- }
62
- async run() {
63
- const { flags } = await this.parse(Pull);
64
- try {
65
- const { cogitPullService, contextTreeSnapshotService, contextTreeWriterService, projectConfigStore, tokenStore, trackingService, } = this.createServices();
66
- await trackingService.track('mem:pull');
67
- const token = await this.validateAuth(tokenStore);
68
- const projectConfig = await this.checkProjectInit(projectConfigStore);
69
- // Check for local changes
70
- ux.action.start('Checking for local Context Tree changes');
71
- const hasLocalChanges = await this.checkLocalChanges(contextTreeSnapshotService);
72
- ux.action.stop();
73
- if (hasLocalChanges) {
74
- exitWithCode(ExitCode.VALIDATION_ERROR, 'You have local changes that have not been pushed. Run "brv push" first.');
75
- }
76
- // Pull from CoGit
77
- this.log('Pulling from ByteRover...');
78
- const snapshot = await cogitPullService.pull({
79
- accessToken: token.accessToken,
80
- branch: flags.branch,
81
- sessionKey: token.sessionKey,
82
- spaceId: projectConfig.spaceId,
83
- teamId: projectConfig.teamId,
84
- });
85
- // Sync files to local context tree
86
- ux.action.start('Syncing context files');
87
- const syncResult = await contextTreeWriterService.sync({ files: snapshot.files });
88
- ux.action.stop();
89
- // Update snapshot ONLY after successful sync
90
- await contextTreeSnapshotService.saveSnapshot();
91
- // Success message
92
- this.log('\n✓ Successfully pulled context tree from ByteRover memory storage!');
93
- this.log(` Branch: ${flags.branch}`);
94
- this.log(` Commit: ${snapshot.commitSha.slice(0, 7)}`);
95
- this.log(` Added: ${syncResult.added.length}, Edited: ${syncResult.edited.length}, Deleted: ${syncResult.deleted.length}`);
96
- }
97
- catch (error) {
98
- if (error instanceof WorkspaceNotInitializedError) {
99
- exitWithCode(ExitCode.VALIDATION_ERROR, 'Project not initialized. Please run "brv init" to select your team and workspace.');
100
- }
101
- const message = error instanceof Error ? error.message : 'Pull failed';
102
- exitWithCode(ExitCode.RUNTIME_ERROR, `Failed to pull: ${message}`);
103
- }
104
- }
105
- async validateAuth(tokenStore) {
106
- const token = await tokenStore.load();
107
- if (token === undefined) {
108
- this.error('Not authenticated. Run "brv login" first.');
109
- }
110
- if (!token.isValid()) {
111
- this.error('Authentication token expired. Run "brv login" again.');
112
- }
113
- return token;
114
- }
115
- }
@@ -1,35 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import type { AuthToken } from '../core/domain/entities/auth-token.js';
3
- import type { BrvConfig } from '../core/domain/entities/brv-config.js';
4
- import type { ICogitPushService } from '../core/interfaces/i-cogit-push-service.js';
5
- import type { IContextFileReader } from '../core/interfaces/i-context-file-reader.js';
6
- import type { IProjectConfigStore } from '../core/interfaces/i-project-config-store.js';
7
- import type { ITokenStore } from '../core/interfaces/i-token-store.js';
8
- import { IContextTreeSnapshotService } from '../core/interfaces/i-context-tree-snapshot-service.js';
9
- import { ITrackingService } from '../core/interfaces/i-tracking-service.js';
10
- export default class Push extends Command {
11
- static description: string;
12
- static examples: string[];
13
- static flags: {
14
- branch: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
- yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
- };
17
- protected buildSpaceUrl(webAppUrl: string, teamName: string, spaceName: string): string;
18
- catch(error: Error & {
19
- oclif?: {
20
- exit: number;
21
- };
22
- }): Promise<void>;
23
- protected checkProjectInit(projectConfigStore: IProjectConfigStore): Promise<BrvConfig>;
24
- protected confirmPush(projectConfig: BrvConfig, branch: string): Promise<boolean>;
25
- protected createServices(): {
26
- cogitPushService: ICogitPushService;
27
- contextFileReader: IContextFileReader;
28
- contextTreeSnapshotService: IContextTreeSnapshotService;
29
- projectConfigStore: IProjectConfigStore;
30
- tokenStore: ITokenStore;
31
- trackingService: ITrackingService;
32
- };
33
- run(): Promise<void>;
34
- protected validateAuth(tokenStore: ITokenStore): Promise<AuthToken>;
35
- }