byterover-cli 0.3.5 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) 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 +8 -1
  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/welcome.js +10 -26
  80. package/dist/infra/cipher/agent-service-factory.d.ts +13 -6
  81. package/dist/infra/cipher/agent-service-factory.js +40 -16
  82. package/dist/infra/cipher/cipher-agent.js +4 -4
  83. package/dist/infra/cipher/consumer/consumer-lock.d.ts +20 -0
  84. package/dist/infra/cipher/consumer/consumer-lock.js +40 -0
  85. package/dist/infra/cipher/consumer/consumer-service.d.ts +99 -0
  86. package/dist/infra/cipher/consumer/consumer-service.js +165 -0
  87. package/dist/infra/cipher/consumer/execution-consumer.d.ts +121 -0
  88. package/dist/infra/cipher/consumer/execution-consumer.js +523 -0
  89. package/dist/infra/cipher/consumer/index.d.ts +33 -0
  90. package/dist/infra/cipher/consumer/index.js +33 -0
  91. package/dist/infra/cipher/consumer/queue-polling-service.d.ts +120 -0
  92. package/dist/infra/cipher/consumer/queue-polling-service.js +248 -0
  93. package/dist/infra/cipher/http/internal-llm-http-service.d.ts +94 -0
  94. package/dist/infra/cipher/http/internal-llm-http-service.js +118 -0
  95. package/dist/infra/cipher/llm/context/compaction/compaction-service.d.ts +106 -0
  96. package/dist/infra/cipher/llm/context/compaction/compaction-service.js +132 -0
  97. package/dist/infra/cipher/llm/context/compaction/index.d.ts +9 -0
  98. package/dist/infra/cipher/llm/context/compaction/index.js +9 -0
  99. package/dist/infra/cipher/llm/context/context-manager.d.ts +46 -2
  100. package/dist/infra/cipher/llm/context/context-manager.js +68 -4
  101. package/dist/infra/cipher/llm/context/rw-lock.d.ts +72 -0
  102. package/dist/infra/cipher/llm/context/rw-lock.js +145 -0
  103. package/dist/infra/cipher/llm/generators/byterover-content-generator.d.ts +7 -7
  104. package/dist/infra/cipher/llm/generators/byterover-content-generator.js +8 -8
  105. package/dist/infra/cipher/llm/internal-llm-service.js +2 -0
  106. package/dist/infra/cipher/session/session-manager.d.ts +4 -4
  107. package/dist/infra/cipher/session/session-manager.js +5 -5
  108. package/dist/infra/cipher/storage/agent-storage.d.ts +246 -0
  109. package/dist/infra/cipher/storage/agent-storage.js +956 -0
  110. package/dist/infra/cipher/storage/dual-format-history-storage.d.ts +77 -0
  111. package/dist/infra/cipher/storage/dual-format-history-storage.js +149 -0
  112. package/dist/infra/cipher/storage/granular-history-storage.d.ts +65 -0
  113. package/dist/infra/cipher/storage/granular-history-storage.js +118 -0
  114. package/dist/infra/cipher/storage/message-storage-service.d.ts +108 -0
  115. package/dist/infra/cipher/storage/message-storage-service.js +529 -0
  116. package/dist/infra/cipher/storage/process-utils.d.ts +16 -0
  117. package/dist/infra/cipher/storage/process-utils.js +43 -0
  118. package/dist/infra/cipher/storage/sqlite-key-storage.d.ts +105 -0
  119. package/dist/infra/cipher/storage/sqlite-key-storage.js +404 -0
  120. package/dist/infra/cipher/system-prompt/simple-prompt-factory.d.ts +1 -0
  121. package/dist/infra/cipher/system-prompt/simple-prompt-factory.js +7 -0
  122. package/dist/infra/cipher/tools/default-policy-rules.js +1 -1
  123. package/dist/infra/cipher/tools/implementations/curate-tool.d.ts +10 -0
  124. package/dist/infra/cipher/tools/implementations/curate-tool.js +371 -0
  125. package/dist/infra/cipher/tools/implementations/find-knowledge-topics-tool.js +11 -8
  126. package/dist/infra/cipher/tools/tool-manager.d.ts +8 -2
  127. package/dist/infra/cipher/tools/tool-manager.js +29 -2
  128. package/dist/infra/cipher/tools/tool-registry.js +7 -0
  129. package/dist/infra/http/authenticated-http-client.d.ts +21 -0
  130. package/dist/infra/http/authenticated-http-client.js +38 -0
  131. package/dist/infra/repl/commands/arg-parser.d.ts +97 -0
  132. package/dist/infra/repl/commands/arg-parser.js +129 -0
  133. package/dist/infra/repl/commands/clear-command.d.ts +5 -0
  134. package/dist/infra/repl/commands/clear-command.js +61 -0
  135. package/dist/infra/repl/commands/curate-command.d.ts +9 -0
  136. package/dist/infra/repl/commands/curate-command.js +88 -0
  137. package/dist/infra/repl/commands/gen-rules-command.d.ts +7 -0
  138. package/dist/infra/repl/commands/gen-rules-command.js +38 -0
  139. package/dist/infra/repl/commands/index.d.ts +8 -0
  140. package/dist/infra/repl/commands/index.js +36 -0
  141. package/dist/infra/repl/commands/init-command.d.ts +7 -0
  142. package/dist/infra/repl/commands/init-command.js +83 -0
  143. package/dist/infra/repl/commands/login-command.d.ts +7 -0
  144. package/dist/infra/repl/commands/login-command.js +50 -0
  145. package/dist/infra/repl/commands/logout-command.d.ts +5 -0
  146. package/dist/infra/repl/commands/logout-command.js +48 -0
  147. package/dist/infra/repl/commands/pull-command.d.ts +5 -0
  148. package/dist/infra/repl/commands/pull-command.js +61 -0
  149. package/dist/infra/repl/commands/push-command.d.ts +5 -0
  150. package/dist/infra/repl/commands/push-command.js +66 -0
  151. package/dist/infra/repl/commands/query-command.d.ts +5 -0
  152. package/dist/infra/repl/commands/query-command.js +66 -0
  153. package/dist/infra/repl/commands/space/index.d.ts +5 -0
  154. package/dist/infra/repl/commands/space/index.js +14 -0
  155. package/dist/infra/repl/commands/space/list-command.d.ts +5 -0
  156. package/dist/infra/repl/commands/space/list-command.js +70 -0
  157. package/dist/infra/repl/commands/space/switch-command.d.ts +5 -0
  158. package/dist/infra/repl/commands/space/switch-command.js +37 -0
  159. package/dist/infra/repl/commands/status-command.d.ts +5 -0
  160. package/dist/infra/repl/commands/status-command.js +39 -0
  161. package/dist/infra/repl/repl-startup.d.ts +18 -0
  162. package/dist/infra/repl/repl-startup.js +28 -0
  163. package/dist/infra/storage/file-global-config-store.d.ts +22 -0
  164. package/dist/infra/storage/file-global-config-store.js +65 -0
  165. package/dist/infra/storage/file-onboarding-preference-store.d.ts +10 -0
  166. package/dist/infra/storage/file-onboarding-preference-store.js +46 -0
  167. package/dist/infra/terminal/oclif-terminal.d.ts +19 -0
  168. package/dist/infra/terminal/oclif-terminal.js +60 -0
  169. package/dist/infra/terminal/repl-terminal.d.ts +31 -0
  170. package/dist/infra/terminal/repl-terminal.js +116 -0
  171. package/dist/infra/tracking/mixpanel-tracking-service.d.ts +11 -1
  172. package/dist/infra/tracking/mixpanel-tracking-service.js +18 -13
  173. package/dist/infra/usecase/clear-use-case.d.ts +20 -0
  174. package/dist/infra/usecase/clear-use-case.js +58 -0
  175. package/dist/infra/usecase/curate-use-case.d.ts +66 -0
  176. package/dist/infra/usecase/curate-use-case.js +288 -0
  177. package/dist/{commands/gen-rules.d.ts → infra/usecase/generate-rules-use-case.d.ts} +14 -20
  178. package/dist/{commands/gen-rules.js → infra/usecase/generate-rules-use-case.js} +59 -78
  179. package/dist/infra/usecase/init-use-case.d.ts +139 -0
  180. package/dist/{commands/init.js → infra/usecase/init-use-case.js} +197 -233
  181. package/dist/infra/usecase/login-use-case.d.ts +28 -0
  182. package/dist/infra/usecase/login-use-case.js +94 -0
  183. package/dist/infra/usecase/logout-use-case.d.ts +22 -0
  184. package/dist/infra/usecase/logout-use-case.js +51 -0
  185. package/dist/infra/usecase/pull-use-case.d.ts +35 -0
  186. package/dist/infra/usecase/pull-use-case.js +89 -0
  187. package/dist/infra/usecase/push-use-case.d.ts +37 -0
  188. package/dist/infra/usecase/push-use-case.js +124 -0
  189. package/dist/infra/usecase/query-use-case.d.ts +78 -0
  190. package/dist/infra/usecase/query-use-case.js +402 -0
  191. package/dist/infra/usecase/space-list-use-case.d.ts +27 -0
  192. package/dist/infra/usecase/space-list-use-case.js +64 -0
  193. package/dist/infra/usecase/space-switch-use-case.d.ts +36 -0
  194. package/dist/infra/usecase/space-switch-use-case.js +140 -0
  195. package/dist/infra/usecase/status-use-case.d.ts +27 -0
  196. package/dist/infra/usecase/status-use-case.js +97 -0
  197. package/dist/infra/workspace/workspace-detector-service.d.ts +3 -6
  198. package/dist/resources/prompts/curate-context-tree-curation.yml +23 -11
  199. package/dist/resources/prompts/query-context-tree-retrieval.yml +3 -4
  200. package/dist/resources/prompts/system-prompt.yml +1 -1
  201. package/dist/resources/prompts/tool-outputs.yml +4 -3
  202. package/dist/templates/sections/command-reference.md +12 -0
  203. package/dist/templates/sections/workflow.md +10 -1
  204. package/dist/tui/app.d.ts +9 -0
  205. package/dist/tui/app.js +26 -0
  206. package/dist/tui/components/enter-prompt.d.ts +13 -0
  207. package/dist/tui/components/enter-prompt.js +15 -0
  208. package/dist/tui/components/execution/execution-changes.d.ts +14 -0
  209. package/dist/tui/components/execution/execution-changes.js +15 -0
  210. package/dist/tui/components/execution/execution-content.d.ts +25 -0
  211. package/dist/tui/components/execution/execution-content.js +67 -0
  212. package/dist/tui/components/execution/execution-input.d.ts +12 -0
  213. package/dist/tui/components/execution/execution-input.js +16 -0
  214. package/dist/tui/components/execution/execution-progress.d.ts +21 -0
  215. package/dist/tui/components/execution/execution-progress.js +21 -0
  216. package/dist/tui/components/execution/execution-status.d.ts +13 -0
  217. package/dist/tui/components/execution/execution-status.js +19 -0
  218. package/dist/tui/components/execution/index.d.ts +11 -0
  219. package/dist/tui/components/execution/index.js +11 -0
  220. package/dist/tui/components/execution/log-item.d.ts +17 -0
  221. package/dist/tui/components/execution/log-item.js +25 -0
  222. package/dist/tui/components/footer.d.ts +5 -0
  223. package/dist/tui/components/footer.js +12 -0
  224. package/dist/tui/components/header.d.ts +18 -0
  225. package/dist/tui/components/header.js +18 -0
  226. package/dist/tui/components/index.d.ts +17 -0
  227. package/dist/tui/components/index.js +14 -0
  228. package/dist/tui/components/inline-prompts/index.d.ts +15 -0
  229. package/dist/tui/components/inline-prompts/index.js +10 -0
  230. package/dist/tui/components/inline-prompts/inline-confirm.d.ts +17 -0
  231. package/dist/tui/components/inline-prompts/inline-confirm.js +32 -0
  232. package/dist/tui/components/inline-prompts/inline-file-selector.d.ts +43 -0
  233. package/dist/tui/components/inline-prompts/inline-file-selector.js +185 -0
  234. package/dist/tui/components/inline-prompts/inline-input.d.ts +19 -0
  235. package/dist/tui/components/inline-prompts/inline-input.js +32 -0
  236. package/dist/tui/components/inline-prompts/inline-search.d.ts +20 -0
  237. package/dist/tui/components/inline-prompts/inline-search.js +50 -0
  238. package/dist/tui/components/inline-prompts/inline-select.d.ts +20 -0
  239. package/dist/tui/components/inline-prompts/inline-select.js +34 -0
  240. package/dist/tui/components/logo.d.ts +43 -0
  241. package/dist/tui/components/logo.js +103 -0
  242. package/dist/tui/components/message-item.d.ts +12 -0
  243. package/dist/tui/components/message-item.js +12 -0
  244. package/dist/tui/components/onboarding/copyable-prompt.d.ts +15 -0
  245. package/dist/tui/components/onboarding/copyable-prompt.js +65 -0
  246. package/dist/tui/components/onboarding/index.d.ts +7 -0
  247. package/dist/tui/components/onboarding/index.js +6 -0
  248. package/dist/tui/components/onboarding/onboarding-flow.d.ts +13 -0
  249. package/dist/tui/components/onboarding/onboarding-flow.js +304 -0
  250. package/dist/tui/components/onboarding/onboarding-step.d.ts +23 -0
  251. package/dist/tui/components/onboarding/onboarding-step.js +12 -0
  252. package/dist/tui/components/output-log.d.ts +14 -0
  253. package/dist/tui/components/output-log.js +13 -0
  254. package/dist/tui/components/scrollable-list.d.ts +30 -0
  255. package/dist/tui/components/scrollable-list.js +121 -0
  256. package/dist/tui/components/suggestions.d.ts +16 -0
  257. package/dist/tui/components/suggestions.js +162 -0
  258. package/dist/tui/components/tab-bar.d.ts +10 -0
  259. package/dist/tui/components/tab-bar.js +12 -0
  260. package/dist/tui/constants.d.ts +11 -0
  261. package/dist/tui/constants.js +13 -0
  262. package/dist/tui/contexts/auth-context.d.ts +30 -0
  263. package/dist/tui/contexts/auth-context.js +153 -0
  264. package/dist/tui/contexts/consumer.d.ts +31 -0
  265. package/dist/tui/contexts/consumer.js +56 -0
  266. package/dist/tui/contexts/index.d.ts +6 -0
  267. package/dist/tui/contexts/index.js +6 -0
  268. package/dist/tui/contexts/onboarding-context.d.ts +43 -0
  269. package/dist/tui/contexts/onboarding-context.js +181 -0
  270. package/dist/tui/contexts/services-context.d.ts +29 -0
  271. package/dist/tui/contexts/services-context.js +20 -0
  272. package/dist/tui/contexts/use-commands.d.ts +29 -0
  273. package/dist/tui/contexts/use-commands.js +54 -0
  274. package/dist/tui/contexts/use-mode.d.ts +43 -0
  275. package/dist/tui/contexts/use-mode.js +76 -0
  276. package/dist/tui/contexts/use-theme.d.ts +53 -0
  277. package/dist/tui/contexts/use-theme.js +60 -0
  278. package/dist/tui/hooks/index.d.ts +17 -0
  279. package/dist/tui/hooks/index.js +14 -0
  280. package/dist/tui/hooks/use-activity-logs.d.ts +26 -0
  281. package/dist/tui/hooks/use-activity-logs.js +90 -0
  282. package/dist/tui/hooks/use-consumer.d.ts +12 -0
  283. package/dist/tui/hooks/use-consumer.js +50 -0
  284. package/dist/tui/hooks/use-onboarding.d.ts +7 -0
  285. package/dist/tui/hooks/use-onboarding.js +6 -0
  286. package/dist/tui/hooks/use-queue-polling.d.ts +31 -0
  287. package/dist/tui/hooks/use-queue-polling.js +90 -0
  288. package/dist/tui/hooks/use-slash-command-processor.d.ts +16 -0
  289. package/dist/tui/hooks/use-slash-command-processor.js +132 -0
  290. package/dist/tui/hooks/use-slash-completion.d.ts +30 -0
  291. package/dist/tui/hooks/use-slash-completion.js +230 -0
  292. package/dist/tui/hooks/use-tab-navigation.d.ts +10 -0
  293. package/dist/tui/hooks/use-tab-navigation.js +35 -0
  294. package/dist/tui/hooks/use-visible-window.d.ts +22 -0
  295. package/dist/tui/hooks/use-visible-window.js +37 -0
  296. package/dist/tui/index.d.ts +1 -0
  297. package/dist/tui/index.js +1 -0
  298. package/dist/tui/providers/app-providers.d.ts +25 -0
  299. package/dist/tui/providers/app-providers.js +9 -0
  300. package/dist/tui/types/commands.d.ts +252 -0
  301. package/dist/tui/types/commands.js +16 -0
  302. package/dist/tui/types/dialogs.d.ts +37 -0
  303. package/dist/tui/types/dialogs.js +4 -0
  304. package/dist/tui/types/index.d.ts +11 -0
  305. package/dist/tui/types/index.js +7 -0
  306. package/dist/tui/types/messages.d.ts +55 -0
  307. package/dist/tui/types/messages.js +4 -0
  308. package/dist/tui/types/prompts.d.ts +100 -0
  309. package/dist/tui/types/prompts.js +4 -0
  310. package/dist/tui/types/ui.d.ts +14 -0
  311. package/dist/tui/types/ui.js +4 -0
  312. package/dist/tui/types.d.ts +1 -0
  313. package/dist/tui/types.js +1 -0
  314. package/dist/tui/views/command-view.d.ts +12 -0
  315. package/dist/tui/views/command-view.js +451 -0
  316. package/dist/tui/views/index.d.ts +6 -0
  317. package/dist/tui/views/index.js +6 -0
  318. package/dist/tui/views/login-view.d.ts +10 -0
  319. package/dist/tui/views/login-view.js +30 -0
  320. package/dist/tui/views/logs-view.d.ts +11 -0
  321. package/dist/tui/views/logs-view.js +73 -0
  322. package/dist/utils/file-validator.d.ts +16 -0
  323. package/dist/utils/file-validator.js +81 -0
  324. package/dist/utils/global-config-path.d.ts +15 -0
  325. package/dist/utils/global-config-path.js +38 -0
  326. package/oclif.manifest.json +29 -315
  327. package/package.json +11 -4
  328. package/dist/commands/clear.d.ts +0 -19
  329. package/dist/commands/clear.js +0 -78
  330. package/dist/commands/init.d.ts +0 -130
  331. package/dist/commands/login.d.ts +0 -22
  332. package/dist/commands/login.js +0 -108
  333. package/dist/commands/logout.d.ts +0 -16
  334. package/dist/commands/logout.js +0 -61
  335. package/dist/commands/pull.d.ts +0 -33
  336. package/dist/commands/pull.js +0 -115
  337. package/dist/commands/push.d.ts +0 -35
  338. package/dist/commands/push.js +0 -160
  339. package/dist/commands/space/list.d.ts +0 -25
  340. package/dist/commands/space/list.js +0 -114
  341. package/dist/commands/space/switch.d.ts +0 -36
  342. package/dist/commands/space/switch.js +0 -160
  343. package/dist/infra/cipher/grpc/internal-llm-grpc-service.d.ts +0 -149
  344. package/dist/infra/cipher/grpc/internal-llm-grpc-service.js +0 -364
  345. package/dist/infra/cipher/grpc/internal-llm-grpc.proto +0 -94
@@ -0,0 +1,81 @@
1
+ import fs from 'node:fs';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+ /**
5
+ * Normalize file path - handles relative, absolute, tilde, symlinks
6
+ * Returns absolute canonical path
7
+ * @param filePath - The file path to normalize
8
+ * @returns Normalized absolute path
9
+ */
10
+ function normalizeFilePath(filePath) {
11
+ // Expand tilde to home directory
12
+ const expanded = filePath.startsWith('~') ? filePath.replace(/^~/, os.homedir()) : filePath;
13
+ // Resolve to absolute path
14
+ const absolute = path.resolve(expanded);
15
+ // Resolve symlinks (only if file exists)
16
+ try {
17
+ return fs.realpathSync(absolute);
18
+ }
19
+ catch {
20
+ // File doesn't exist or cannot resolve, return resolved path
21
+ return absolute;
22
+ }
23
+ }
24
+ /**
25
+ * Check if file is text (no null bytes in first 8KB)
26
+ * Returns false for binary files (images, PDFs, compiled binaries, etc.)
27
+ * @param filePath - The file path to check
28
+ * @returns true if file is text, false if binary
29
+ */
30
+ function isTextFile(filePath) {
31
+ try {
32
+ const buffer = Buffer.alloc(8192);
33
+ const fd = fs.openSync(filePath, 'r');
34
+ const bytesRead = fs.readSync(fd, buffer, 0, 8192, 0);
35
+ fs.closeSync(fd);
36
+ // Check for null bytes (indicates binary file)
37
+ for (let i = 0; i < bytesRead; i++) {
38
+ if (buffer[i] === 0)
39
+ return false;
40
+ }
41
+ return true;
42
+ }
43
+ catch {
44
+ // If we can't read the file, consider it non-text
45
+ return false;
46
+ }
47
+ }
48
+ /**
49
+ * Validate file for --files flag in brv curate command
50
+ * Checks:
51
+ * 1. File exists
52
+ * 2. File is within project directory (where .brv exists)
53
+ * 3. File is text/code file (not binary)
54
+ *
55
+ * @param filePath - The file path to validate (can be relative, absolute, or tilde)
56
+ * @param projectRoot - The project root directory (current working directory)
57
+ * @returns Validation result with normalized path or error message
58
+ */
59
+ export function validateFileForCurate(filePath, projectRoot) {
60
+ // Normalize path
61
+ const normalized = normalizeFilePath(filePath);
62
+ // Check existence
63
+ if (!fs.existsSync(normalized)) {
64
+ return { error: `File does not exist: ${filePath}`, valid: false };
65
+ }
66
+ // Check if it's a file (not a directory)
67
+ const stats = fs.statSync(normalized);
68
+ if (!stats.isFile()) {
69
+ return { error: `Path is not a file: ${filePath}`, valid: false };
70
+ }
71
+ // Check within project (normalized paths for reliable comparison)
72
+ const normalizedProjectRoot = normalizeFilePath(projectRoot);
73
+ if (!normalized.startsWith(normalizedProjectRoot + path.sep) && normalized !== normalizedProjectRoot) {
74
+ return { error: `File is outside project directory: ${filePath}`, valid: false };
75
+ }
76
+ // Check is text file
77
+ if (!isTextFile(normalized)) {
78
+ return { error: `File is not a text/code file (binary detected): ${filePath}`, valid: false };
79
+ }
80
+ return { normalizedPath: normalized, valid: true };
81
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Returns the global config directory path following platform conventions:
3
+ * - Linux: $XDG_CONFIG_HOME/brv (defaults to ~/.config/brv)
4
+ * - macOS: ~/.config/brv (CLI tool convention)
5
+ * - Windows: %APPDATA%/brv
6
+ *
7
+ * @returns Absolute path to the global config directory
8
+ */
9
+ export declare const getGlobalConfigDir: () => string;
10
+ /**
11
+ * Returns the full path to the global config file.
12
+ *
13
+ * @returns Absolute path to the global config file
14
+ */
15
+ export declare const getGlobalConfigPath: () => string;
@@ -0,0 +1,38 @@
1
+ import { homedir, platform } from 'node:os';
2
+ import { join } from 'node:path';
3
+ import { GLOBAL_CONFIG_DIR, GLOBAL_CONFIG_FILE } from '../constants.js';
4
+ /**
5
+ * Returns the global config directory path following platform conventions:
6
+ * - Linux: $XDG_CONFIG_HOME/brv (defaults to ~/.config/brv)
7
+ * - macOS: ~/.config/brv (CLI tool convention)
8
+ * - Windows: %APPDATA%/brv
9
+ *
10
+ * @returns Absolute path to the global config directory
11
+ */
12
+ export const getGlobalConfigDir = () => {
13
+ const currentPlatform = platform();
14
+ if (currentPlatform === 'win32') {
15
+ // Windows: use APPDATA
16
+ const appData = process.env.APPDATA;
17
+ if (appData !== undefined) {
18
+ return join(appData, GLOBAL_CONFIG_DIR);
19
+ }
20
+ // Fallback to home directory if APPDATA is not set
21
+ return join(homedir(), 'AppData', 'Roaming', GLOBAL_CONFIG_DIR);
22
+ }
23
+ // Linux: respect XDG_CONFIG_HOME if set
24
+ if (currentPlatform === 'linux') {
25
+ const xdgConfigHome = process.env.XDG_CONFIG_HOME;
26
+ if (xdgConfigHome !== undefined) {
27
+ return join(xdgConfigHome, GLOBAL_CONFIG_DIR);
28
+ }
29
+ }
30
+ // Linux (default) and macOS; use ~/.config/brv
31
+ return join(homedir(), '.config', GLOBAL_CONFIG_DIR);
32
+ };
33
+ /**
34
+ * Returns the full path to the global config file.
35
+ *
36
+ * @returns Absolute path to the global config file
37
+ */
38
+ export const getGlobalConfigPath = () => join(getGlobalConfigDir(), GLOBAL_CONFIG_FILE);
@@ -1,63 +1,41 @@
1
1
  {
2
2
  "commands": {
3
- "clear": {
4
- "aliases": [],
5
- "args": {
6
- "directory": {
7
- "description": "Project directory (defaults to current directory)",
8
- "name": "directory",
9
- "required": false
10
- }
11
- },
12
- "description": "Reset the context tree to its original state (6 default domains)",
13
- "examples": [
14
- "<%= config.bin %> <%= command.id %>",
15
- "<%= config.bin %> <%= command.id %> --yes",
16
- "<%= config.bin %> <%= command.id %> /path/to/project"
17
- ],
18
- "flags": {
19
- "yes": {
20
- "char": "y",
21
- "description": "Skip confirmation prompt",
22
- "name": "yes",
23
- "allowNo": false,
24
- "type": "boolean"
25
- }
26
- },
27
- "hasDynamicHelp": false,
28
- "hiddenAliases": [],
29
- "id": "clear",
30
- "pluginAlias": "byterover-cli",
31
- "pluginName": "byterover-cli",
32
- "pluginType": "core",
33
- "strict": true,
34
- "enableJsonFlag": false,
35
- "isESM": true,
36
- "relativePath": [
37
- "dist",
38
- "commands",
39
- "clear.js"
40
- ]
41
- },
42
3
  "curate": {
43
4
  "aliases": [],
44
5
  "args": {
45
6
  "context": {
46
- "description": "Knowledge context: patterns, decisions, errors, or insights (triggers autonomous mode)",
7
+ "description": "Knowledge context: patterns, decisions, errors, or insights",
47
8
  "name": "context",
48
9
  "required": false
49
10
  }
50
11
  },
51
- "description": "Curate context to the context tree (interactive or autonomous mode)\nGood:\n- \"Auth uses JWT with 24h expiry. Tokens stored in httpOnly cookies via authMiddleware.ts\"\n- \"API rate limit is 100 req/min per user. Implemented using Redis with sliding window in rateLimiter.ts\"\nBad:\n- \"Authentication\" or \"JWT tokens\" (too vague, lacks context)\n- \"Rate limiting\" (no implementation details or file references)",
12
+ "description": "Curate context to the context tree (autonomous mode)\n\nFor interactive mode, use REPL: brv repl then /curate\n\nGood examples:\n- \"Auth uses JWT with 24h expiry. Tokens stored in httpOnly cookies via authMiddleware.ts\"\n- \"API rate limit is 100 req/min per user. Implemented using Redis with sliding window in rateLimiter.ts\"\nBad examples:\n- \"Authentication\" or \"JWT tokens\" (too vague, lacks context)\n- \"Rate limiting\" (no implementation details or file references)",
52
13
  "examples": [
53
- "# Interactive mode (manually choose domain/topic)",
54
- "<%= config.bin %> <%= command.id %>",
55
- "",
56
14
  "# Autonomous mode - LLM auto-categorizes your context",
57
15
  "<%= config.bin %> <%= command.id %> \"Auth uses JWT with 24h expiry. Tokens stored in httpOnly cookies via authMiddleware.ts\"",
16
+ "",
17
+ "# Include relevant files for comprehensive context (use sparingly, max 5 files)",
18
+ "- NOTE: CONTEXT argument must come BEFORE --files flag",
19
+ "- NOTE: For multiple files, repeat --files (or -f) flag for each file",
20
+ "- NOTE: Only text/code files from current project directory.",
21
+ "",
22
+ "## Single file",
23
+ "<%= config.bin %> <%= command.id %> \"Authentication middleware validates JWT tokens and attaches user context\" -f src/middleware/auth.ts",
24
+ "",
25
+ "## Multiple files",
26
+ "<%= config.bin %> <%= command.id %> \"JWT authentication implementation with refresh token rotation\" --files src/auth/jwt.ts --files docs/auth.md",
58
27
  ""
59
28
  ],
60
- "flags": {},
29
+ "flags": {
30
+ "files": {
31
+ "char": "f",
32
+ "description": "Include specific file paths for critical context (max 5 files). Only text/code files from the current project directory are allowed. Use sparingly - only for truly relevant files like docs or key implementation details. NOTE: CONTEXT argument must come BEFORE this flag.",
33
+ "name": "files",
34
+ "hasDynamicHelp": false,
35
+ "multiple": true,
36
+ "type": "option"
37
+ }
38
+ },
61
39
  "hasDynamicHelp": false,
62
40
  "hiddenAliases": [],
63
41
  "id": "curate",
@@ -94,193 +72,15 @@
94
72
  "foo.js"
95
73
  ]
96
74
  },
97
- "gen-rules": {
98
- "aliases": [],
99
- "args": {},
100
- "description": "Generate rule instructions for coding agents to work with ByteRover correctly",
101
- "examples": [
102
- "<%= config.bin %> <%= command.id %>"
103
- ],
104
- "flags": {
105
- "agent": {
106
- "char": "a",
107
- "description": "Agent to generate rules for (optional, will prompt if not provided)",
108
- "name": "agent",
109
- "hasDynamicHelp": false,
110
- "multiple": false,
111
- "type": "option"
112
- }
113
- },
114
- "hasDynamicHelp": false,
115
- "hiddenAliases": [],
116
- "id": "gen-rules",
117
- "pluginAlias": "byterover-cli",
118
- "pluginName": "byterover-cli",
119
- "pluginType": "core",
120
- "strict": true,
121
- "enableJsonFlag": false,
122
- "isESM": true,
123
- "relativePath": [
124
- "dist",
125
- "commands",
126
- "gen-rules.js"
127
- ]
128
- },
129
- "init": {
75
+ "main": {
130
76
  "aliases": [],
131
77
  "args": {},
132
- "description": "Initialize a project with ByteRover (creates .brv/config.json with team/space selection and initializes Context Tree)",
133
- "examples": [
134
- "<%= config.bin %> <%= command.id %>",
135
- "# Re-initialize if config exists (will show current config and exit):\n<%= config.bin %> <%= command.id %>",
136
- "# Full workflow: login then initialize:\n<%= config.bin %> login\n<%= config.bin %> <%= command.id %>"
137
- ],
138
- "flags": {
139
- "force": {
140
- "char": "f",
141
- "description": "Force re-initialization without confirmation prompt",
142
- "name": "force",
143
- "allowNo": false,
144
- "type": "boolean"
145
- }
146
- },
147
- "hasDynamicHelp": false,
148
- "hiddenAliases": [],
149
- "id": "init",
150
- "pluginAlias": "byterover-cli",
151
- "pluginName": "byterover-cli",
152
- "pluginType": "core",
153
- "strict": true,
154
- "enableJsonFlag": false,
155
- "isESM": true,
156
- "relativePath": [
157
- "dist",
158
- "commands",
159
- "init.js"
160
- ]
161
- },
162
- "login": {
163
- "aliases": [],
164
- "args": {},
165
- "description": "Authenticate with ByteRover using OAuth 2.0 + PKCE (opens browser for secure login, stores tokens in keychain)",
166
- "examples": [
167
- "<%= config.bin %> <%= command.id %>",
168
- "# After authentication expires, re-login:\n<%= config.bin %> <%= command.id %>",
169
- "# Check authentication status after login:\n<%= config.bin %> <%= command.id %>\n<%= config.bin %> status"
170
- ],
78
+ "description": "ByteRover CLI - Interactive REPL",
171
79
  "flags": {},
172
80
  "hasDynamicHelp": false,
81
+ "hidden": true,
173
82
  "hiddenAliases": [],
174
- "id": "login",
175
- "pluginAlias": "byterover-cli",
176
- "pluginName": "byterover-cli",
177
- "pluginType": "core",
178
- "strict": true,
179
- "enableJsonFlag": false,
180
- "isESM": true,
181
- "relativePath": [
182
- "dist",
183
- "commands",
184
- "login.js"
185
- ]
186
- },
187
- "logout": {
188
- "aliases": [],
189
- "args": {},
190
- "description": "Log out of ByteRover CLI and clear authentication (does not affect local project files)",
191
- "examples": [
192
- "<%= config.bin %> <%= command.id %>",
193
- "<%= config.bin %> <%= command.id %> --yes"
194
- ],
195
- "flags": {
196
- "yes": {
197
- "char": "y",
198
- "description": "Skip confirmation prompt",
199
- "name": "yes",
200
- "allowNo": false,
201
- "type": "boolean"
202
- }
203
- },
204
- "hasDynamicHelp": false,
205
- "hiddenAliases": [],
206
- "id": "logout",
207
- "pluginAlias": "byterover-cli",
208
- "pluginName": "byterover-cli",
209
- "pluginType": "core",
210
- "strict": true,
211
- "enableJsonFlag": false,
212
- "isESM": true,
213
- "relativePath": [
214
- "dist",
215
- "commands",
216
- "logout.js"
217
- ]
218
- },
219
- "pull": {
220
- "aliases": [],
221
- "args": {},
222
- "description": "Pull context tree from ByteRover memory storage",
223
- "examples": [
224
- "<%= config.bin %> <%= command.id %>",
225
- "<%= config.bin %> <%= command.id %> --branch develop",
226
- "<%= config.bin %> <%= command.id %> -b feature-auth"
227
- ],
228
- "flags": {
229
- "branch": {
230
- "char": "b",
231
- "description": "ByteRover branch name (not Git branch)",
232
- "name": "branch",
233
- "default": "main",
234
- "hasDynamicHelp": false,
235
- "multiple": false,
236
- "type": "option"
237
- }
238
- },
239
- "hasDynamicHelp": false,
240
- "hiddenAliases": [],
241
- "id": "pull",
242
- "pluginAlias": "byterover-cli",
243
- "pluginName": "byterover-cli",
244
- "pluginType": "core",
245
- "strict": true,
246
- "enableJsonFlag": false,
247
- "isESM": true,
248
- "relativePath": [
249
- "dist",
250
- "commands",
251
- "pull.js"
252
- ]
253
- },
254
- "push": {
255
- "aliases": [],
256
- "args": {},
257
- "description": "Push context tree to ByteRover memory storage",
258
- "examples": [
259
- "<%= config.bin %> <%= command.id %>",
260
- "<%= config.bin %> <%= command.id %> --branch develop",
261
- "<%= config.bin %> <%= command.id %> -b feature-auth"
262
- ],
263
- "flags": {
264
- "branch": {
265
- "char": "b",
266
- "description": "ByteRover branch name (not Git branch)",
267
- "name": "branch",
268
- "default": "main",
269
- "hasDynamicHelp": false,
270
- "multiple": false,
271
- "type": "option"
272
- },
273
- "yes": {
274
- "char": "y",
275
- "description": "Skip confirmation prompt",
276
- "name": "yes",
277
- "allowNo": false,
278
- "type": "boolean"
279
- }
280
- },
281
- "hasDynamicHelp": false,
282
- "hiddenAliases": [],
283
- "id": "push",
83
+ "id": "main",
284
84
  "pluginAlias": "byterover-cli",
285
85
  "pluginName": "byterover-cli",
286
86
  "pluginType": "core",
@@ -290,7 +90,7 @@
290
90
  "relativePath": [
291
91
  "dist",
292
92
  "commands",
293
- "push.js"
93
+ "main.js"
294
94
  ]
295
95
  },
296
96
  "query": {
@@ -584,93 +384,7 @@
584
384
  "cipher-agent",
585
385
  "show-prompt.js"
586
386
  ]
587
- },
588
- "space:list": {
589
- "aliases": [],
590
- "args": {},
591
- "description": "List all spaces for the current team (requires project initialization)",
592
- "examples": [
593
- "<%= config.bin %> <%= command.id %>",
594
- "<%= config.bin %> <%= command.id %> --all",
595
- "<%= config.bin %> <%= command.id %> --limit 10",
596
- "<%= config.bin %> <%= command.id %> --limit 10 --offset 20",
597
- "<%= config.bin %> <%= command.id %> --json"
598
- ],
599
- "flags": {
600
- "all": {
601
- "char": "a",
602
- "description": "Fetch all spaces (may be slow for large teams)",
603
- "name": "all",
604
- "allowNo": false,
605
- "type": "boolean"
606
- },
607
- "json": {
608
- "char": "j",
609
- "description": "Output in JSON format",
610
- "name": "json",
611
- "allowNo": false,
612
- "type": "boolean"
613
- },
614
- "limit": {
615
- "char": "l",
616
- "description": "Maximum number of spaces to fetch",
617
- "name": "limit",
618
- "default": 50,
619
- "hasDynamicHelp": false,
620
- "multiple": false,
621
- "type": "option"
622
- },
623
- "offset": {
624
- "char": "o",
625
- "description": "Number of spaces to skip",
626
- "name": "offset",
627
- "default": 0,
628
- "hasDynamicHelp": false,
629
- "multiple": false,
630
- "type": "option"
631
- }
632
- },
633
- "hasDynamicHelp": false,
634
- "hiddenAliases": [],
635
- "id": "space:list",
636
- "pluginAlias": "byterover-cli",
637
- "pluginName": "byterover-cli",
638
- "pluginType": "core",
639
- "strict": true,
640
- "enableJsonFlag": false,
641
- "isESM": true,
642
- "relativePath": [
643
- "dist",
644
- "commands",
645
- "space",
646
- "list.js"
647
- ]
648
- },
649
- "space:switch": {
650
- "aliases": [],
651
- "args": {},
652
- "description": "Switch to a different team or space (updates .brv/config.json)",
653
- "examples": [
654
- "<%= config.bin %> <%= command.id %>",
655
- "# Shows current configuration, then prompts for new team/space selection"
656
- ],
657
- "flags": {},
658
- "hasDynamicHelp": false,
659
- "hiddenAliases": [],
660
- "id": "space:switch",
661
- "pluginAlias": "byterover-cli",
662
- "pluginName": "byterover-cli",
663
- "pluginType": "core",
664
- "strict": true,
665
- "enableJsonFlag": false,
666
- "isESM": true,
667
- "relativePath": [
668
- "dist",
669
- "commands",
670
- "space",
671
- "switch.js"
672
- ]
673
387
  }
674
388
  },
675
- "version": "0.3.5"
389
+ "version": "0.4.1"
676
390
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "byterover-cli",
3
3
  "description": "ByteRover's CLI",
4
- "version": "0.3.5",
4
+ "version": "0.4.1",
5
5
  "author": "ByteRover",
6
6
  "bin": {
7
7
  "brv": "./bin/run.js"
@@ -11,8 +11,7 @@
11
11
  "@anthropic-ai/sdk": "^0.70.1",
12
12
  "@anthropic-ai/vertex-sdk": "^0.14.0",
13
13
  "@google/genai": "^1.29.0",
14
- "@grpc/grpc-js": "^1.10.0",
15
- "@grpc/proto-loader": "^0.7.13",
14
+ "@inkjs/ui": "^2.0.0",
16
15
  "@inquirer/prompts": "^7.9.0",
17
16
  "@oclif/core": "^4",
18
17
  "@oclif/plugin-help": "^6",
@@ -22,8 +21,13 @@
22
21
  "chalk": "^5.6.2",
23
22
  "chokidar": "^4.0.3",
24
23
  "express": "^5.1.0",
24
+ "fullscreen-ink": "^0.1.0",
25
25
  "glob": "^11.0.3",
26
+ "gradient-string": "^3.0.0",
26
27
  "ignore": "^7.0.5",
28
+ "ink": "^6.5.1",
29
+ "ink-spinner": "^5.0.0",
30
+ "ink-text-input": "^6.0.0",
27
31
  "inquirer-file-selector": "^1.0.1",
28
32
  "js-yaml": "^4.1.1",
29
33
  "keytar": "^7.9.0",
@@ -31,6 +35,7 @@
31
35
  "nanoid": "^5.1.6",
32
36
  "open": "^10.2.0",
33
37
  "openai": "^6.9.1",
38
+ "react": "^19.2.1",
34
39
  "update-notifier": "^7.3.1",
35
40
  "zod": "^3.25.76",
36
41
  "zod-to-json-schema": "^3.24.6"
@@ -45,6 +50,7 @@
45
50
  "@types/js-yaml": "^4.0.9",
46
51
  "@types/mocha": "^10",
47
52
  "@types/node": "^20",
53
+ "@types/react": "^19.2.7",
48
54
  "@types/sinon": "^17.0.4",
49
55
  "chai": "^4",
50
56
  "eslint": "^9",
@@ -57,6 +63,7 @@
57
63
  "shx": "^0.3.3",
58
64
  "sinon": "^21.0.0",
59
65
  "ts-node": "^10",
66
+ "tsx": "^4.21.0",
60
67
  "typescript": "^5"
61
68
  },
62
69
  "engines": {
@@ -97,7 +104,7 @@
97
104
  },
98
105
  "repository": "campfirein/byterover-cli",
99
106
  "scripts": {
100
- "build": "shx rm -rf dist && tsc -b && shx cp -r src/templates dist/templates && shx cp -r src/resources dist/resources && shx cp src/infra/cipher/grpc/internal-llm-grpc.proto dist/infra/cipher/grpc/",
107
+ "build": "shx rm -rf dist && tsc -b && shx cp -r src/templates dist/templates && shx cp -r src/resources dist/resources",
101
108
  "lint": "eslint",
102
109
  "postpack": "shx rm -f oclif.manifest.json",
103
110
  "posttest": "npm run lint",
@@ -1,19 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import type { IContextTreeService } from '../core/interfaces/i-context-tree-service.js';
3
- import type { IContextTreeSnapshotService } from '../core/interfaces/i-context-tree-snapshot-service.js';
4
- export default class Clear extends Command {
5
- static args: {
6
- directory: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
- };
8
- static description: string;
9
- static examples: string[];
10
- static flags: {
11
- yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
- };
13
- protected confirmClear(): Promise<boolean>;
14
- protected createServices(): {
15
- contextTreeService: IContextTreeService;
16
- contextTreeSnapshotService: IContextTreeSnapshotService;
17
- };
18
- run(): Promise<void>;
19
- }