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,19 @@
1
+ import { Command } from '@oclif/core';
2
+ import type { ConfirmOptions, FileSelectorItem, FileSelectorOptions, InputOptions, ITerminal, SearchOptions, SelectOptions } from '../../core/interfaces/i-terminal.js';
3
+ /**
4
+ * Terminal implementation that wraps oclif Command methods and @inquirer/prompts.
5
+ */
6
+ export declare class OclifTerminal implements ITerminal {
7
+ private readonly command;
8
+ constructor(command: Command);
9
+ actionStart(message: string): void;
10
+ actionStop(message?: string): void;
11
+ confirm({ default: defaultValue, message }: ConfirmOptions): Promise<boolean>;
12
+ error(message: string): void;
13
+ fileSelector(options: FileSelectorOptions): Promise<FileSelectorItem | null>;
14
+ input({ message, validate }: InputOptions): Promise<string>;
15
+ log(message?: string): void;
16
+ search<T>({ message, source }: SearchOptions<T>): Promise<T>;
17
+ select<T>({ choices, message }: SelectOptions<T>): Promise<T>;
18
+ warn(message: string): void;
19
+ }
@@ -0,0 +1,60 @@
1
+ import { confirm, input, search, select } from '@inquirer/prompts';
2
+ import { ux } from '@oclif/core';
3
+ import { fileSelector, ItemType } from 'inquirer-file-selector';
4
+ /**
5
+ * Terminal implementation that wraps oclif Command methods and @inquirer/prompts.
6
+ */
7
+ export class OclifTerminal {
8
+ command;
9
+ constructor(command) {
10
+ this.command = command;
11
+ }
12
+ actionStart(message) {
13
+ ux.action.start(message);
14
+ }
15
+ actionStop(message) {
16
+ ux.action.stop(message);
17
+ }
18
+ confirm({ default: defaultValue = true, message }) {
19
+ return confirm({ default: defaultValue, message });
20
+ }
21
+ error(message) {
22
+ this.command.error(message);
23
+ }
24
+ async fileSelector(options) {
25
+ const baseConfig = {
26
+ basePath: options.basePath,
27
+ filter: options.filter,
28
+ message: options.message,
29
+ pageSize: options.pageSize,
30
+ theme: options.theme,
31
+ type: options.type === 'directory' ? ItemType.Directory : ItemType.File,
32
+ };
33
+ // Use separate calls to help TypeScript infer the correct overload
34
+ const result = options.allowCancel
35
+ ? await fileSelector({ ...baseConfig, allowCancel: true })
36
+ : await fileSelector({ ...baseConfig, allowCancel: false });
37
+ if (!result)
38
+ return null;
39
+ return {
40
+ isDirectory: result.isDirectory,
41
+ name: result.name,
42
+ path: result.path,
43
+ };
44
+ }
45
+ input({ message, validate }) {
46
+ return input({ message, validate });
47
+ }
48
+ log(message) {
49
+ this.command.log(message);
50
+ }
51
+ search({ message, source }) {
52
+ return search({ message, source });
53
+ }
54
+ select({ choices, message }) {
55
+ return select({ choices, message });
56
+ }
57
+ warn(message) {
58
+ this.command.warn(message);
59
+ }
60
+ }
@@ -0,0 +1,31 @@
1
+ import type { ConfirmOptions, FileSelectorItem, FileSelectorOptions, InputOptions, ITerminal, SearchOptions, SelectOptions } from '../../core/interfaces/i-terminal.js';
2
+ import type { PromptRequest, StreamingMessage } from '../../tui/types.js';
3
+ /**
4
+ * Callbacks for ReplTerminal operations.
5
+ * These bridge the terminal to the TUI streaming system.
6
+ */
7
+ export interface ReplTerminalCallbacks {
8
+ /** Callback for streaming output messages */
9
+ onMessage: (msg: StreamingMessage) => void;
10
+ /** Callback for interactive prompts */
11
+ onPrompt: (prompt: PromptRequest) => void;
12
+ }
13
+ /**
14
+ * REPL-compatible ITerminal implementation.
15
+ * Uses callbacks to integrate with TUI streaming and prompt system.
16
+ */
17
+ export declare class ReplTerminal implements ITerminal {
18
+ private readonly callbacks;
19
+ private currentActionId;
20
+ constructor(callbacks: ReplTerminalCallbacks);
21
+ actionStart(message: string): void;
22
+ actionStop(message?: string): void;
23
+ confirm(options: ConfirmOptions): Promise<boolean>;
24
+ error(message: string): void;
25
+ fileSelector(options: FileSelectorOptions): Promise<FileSelectorItem | null>;
26
+ input(options: InputOptions): Promise<string>;
27
+ log(message?: string): void;
28
+ search<T>(options: SearchOptions<T>): Promise<T>;
29
+ select<T>(options: SelectOptions<T>): Promise<T>;
30
+ warn(message: string): void;
31
+ }
@@ -0,0 +1,116 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ /**
3
+ * Generate a unique message ID
4
+ */
5
+ function generateId() {
6
+ return randomUUID();
7
+ }
8
+ /**
9
+ * REPL-compatible ITerminal implementation.
10
+ * Uses callbacks to integrate with TUI streaming and prompt system.
11
+ */
12
+ export class ReplTerminal {
13
+ callbacks;
14
+ currentActionId = null;
15
+ constructor(callbacks) {
16
+ this.callbacks = callbacks;
17
+ }
18
+ actionStart(message) {
19
+ // Generate a unique action ID to link start/stop
20
+ this.currentActionId = generateId();
21
+ this.callbacks.onMessage({
22
+ actionId: this.currentActionId,
23
+ content: message,
24
+ id: generateId(),
25
+ type: 'action_start',
26
+ });
27
+ }
28
+ actionStop(message) {
29
+ // Stop action if it's in progress
30
+ if (!this.currentActionId) {
31
+ return;
32
+ }
33
+ this.callbacks.onMessage({
34
+ actionId: this.currentActionId,
35
+ content: message ?? '',
36
+ id: generateId(),
37
+ type: 'action_stop',
38
+ });
39
+ this.currentActionId = null;
40
+ }
41
+ confirm(options) {
42
+ return new Promise((resolve) => {
43
+ this.callbacks.onPrompt({
44
+ default: options.default,
45
+ message: options.message,
46
+ onResponse: resolve,
47
+ type: 'confirm',
48
+ });
49
+ });
50
+ }
51
+ error(message) {
52
+ this.callbacks.onMessage({
53
+ content: message,
54
+ id: generateId(),
55
+ type: 'error',
56
+ });
57
+ }
58
+ fileSelector(options) {
59
+ return new Promise((resolve) => {
60
+ this.callbacks.onPrompt({
61
+ allowCancel: options.allowCancel,
62
+ basePath: options.basePath,
63
+ filter: options.filter,
64
+ message: options.message,
65
+ mode: options.type,
66
+ onResponse: resolve,
67
+ pageSize: options.pageSize,
68
+ type: 'file_selector',
69
+ });
70
+ });
71
+ }
72
+ input(options) {
73
+ return new Promise((resolve) => {
74
+ this.callbacks.onPrompt({
75
+ message: options.message,
76
+ onResponse: resolve,
77
+ type: 'input',
78
+ validate: options.validate,
79
+ });
80
+ });
81
+ }
82
+ log(message) {
83
+ this.callbacks.onMessage({
84
+ content: message ?? '',
85
+ id: generateId(),
86
+ type: 'output',
87
+ });
88
+ }
89
+ search(options) {
90
+ return new Promise((resolve) => {
91
+ this.callbacks.onPrompt({
92
+ message: options.message,
93
+ onResponse: resolve,
94
+ source: options.source,
95
+ type: 'search',
96
+ });
97
+ });
98
+ }
99
+ select(options) {
100
+ return new Promise((resolve) => {
101
+ this.callbacks.onPrompt({
102
+ choices: options.choices,
103
+ message: options.message,
104
+ onResponse: resolve,
105
+ type: 'select',
106
+ });
107
+ });
108
+ }
109
+ warn(message) {
110
+ this.callbacks.onMessage({
111
+ content: message,
112
+ id: generateId(),
113
+ type: 'warning',
114
+ });
115
+ }
116
+ }
@@ -1,14 +1,24 @@
1
1
  import { Mixpanel } from 'mixpanel';
2
2
  import { EventName, PropertyDict } from '../../core/domain/entities/event.js';
3
+ import { IGlobalConfigStore } from '../../core/interfaces/i-global-config-store.js';
3
4
  import { ITokenStore } from '../../core/interfaces/i-token-store.js';
4
5
  import { ITrackingService } from '../../core/interfaces/i-tracking-service.js';
6
+ /**
7
+ * Parameters for creating a MixpanelTrackingService instance.
8
+ */
9
+ export interface MixpanelTrackingServiceParams {
10
+ readonly globalConfigStore: IGlobalConfigStore;
11
+ readonly mixpanel?: Mixpanel;
12
+ readonly tokenStore: ITokenStore;
13
+ }
5
14
  /**
6
15
  * Tracking service implementation using the Mixpanel library.
7
16
  */
8
17
  export declare class MixpanelTrackingService implements ITrackingService {
18
+ private readonly globalConfigStore;
9
19
  private readonly mp;
10
20
  private readonly tokenStore;
11
- constructor(tokenStore: ITokenStore, mp?: Mixpanel);
21
+ constructor(params: MixpanelTrackingServiceParams);
12
22
  track(eventName: EventName, properties?: PropertyDict): Promise<void>;
13
23
  private getIdentificationProperties;
14
24
  }
@@ -4,19 +4,21 @@ import { getCurrentConfig } from '../../config/environment.js';
4
4
  * Tracking service implementation using the Mixpanel library.
5
5
  */
6
6
  export class MixpanelTrackingService {
7
+ globalConfigStore;
7
8
  mp;
8
9
  tokenStore;
9
- constructor(tokenStore, mp) {
10
- this.tokenStore = tokenStore;
11
- if (mp) {
12
- // Injected dependencies for testing
13
- this.mp = mp;
14
- }
15
- else {
10
+ constructor(params) {
11
+ this.tokenStore = params.tokenStore;
12
+ this.globalConfigStore = params.globalConfigStore;
13
+ if (params.mixpanel === undefined) {
16
14
  // Initialize with real implementations for production
17
15
  const envConfig = getCurrentConfig();
18
16
  this.mp = mixpanel.init(envConfig.mixpanelToken);
19
17
  }
18
+ else {
19
+ // Injected dependencies for testing
20
+ this.mp = params.mixpanel;
21
+ }
20
22
  }
21
23
  async track(eventName, properties) {
22
24
  try {
@@ -32,13 +34,16 @@ export class MixpanelTrackingService {
32
34
  }
33
35
  }
34
36
  async getIdentificationProperties() {
35
- // 2. Load and validate authentication token
37
+ // Always include $device_id for anonymous/pre-auth tracking
38
+ const deviceId = await this.globalConfigStore.getOrCreateDeviceId();
39
+ const props = {
40
+ $device_id: deviceId, // eslint-disable-line camelcase
41
+ };
42
+ // Add $user_id if authenticated (enables Mixpanel identity merging)
36
43
  const token = await this.tokenStore.load();
37
- if (token) {
38
- return {
39
- $user_id: token.userId, // eslint-disable-line camelcase
40
- };
44
+ if (token !== undefined) {
45
+ props.$user_id = token.userId; // eslint-disable-line camelcase
41
46
  }
42
- return {};
47
+ return props;
43
48
  }
44
49
  }
@@ -0,0 +1,20 @@
1
+ import type { IContextTreeService } from '../../core/interfaces/i-context-tree-service.js';
2
+ import type { IContextTreeSnapshotService } from '../../core/interfaces/i-context-tree-snapshot-service.js';
3
+ import type { ITerminal } from '../../core/interfaces/i-terminal.js';
4
+ import type { IClearUseCase } from '../../core/interfaces/usecase/i-clear-use-case.js';
5
+ export interface ClearUseCaseOptions {
6
+ contextTreeService: IContextTreeService;
7
+ contextTreeSnapshotService: IContextTreeSnapshotService;
8
+ terminal: ITerminal;
9
+ }
10
+ export declare class ClearUseCase implements IClearUseCase {
11
+ private readonly contextTreeService;
12
+ private readonly contextTreeSnapshotService;
13
+ private readonly terminal;
14
+ constructor(options: ClearUseCaseOptions);
15
+ protected confirmClear(): Promise<boolean>;
16
+ run(options: {
17
+ directory?: string;
18
+ skipConfirmation: boolean;
19
+ }): Promise<void>;
20
+ }
@@ -0,0 +1,58 @@
1
+ import { rm } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { BRV_DIR, CONTEXT_TREE_DIR } from '../../constants.js';
4
+ export class ClearUseCase {
5
+ contextTreeService;
6
+ contextTreeSnapshotService;
7
+ terminal;
8
+ constructor(options) {
9
+ this.contextTreeService = options.contextTreeService;
10
+ this.contextTreeSnapshotService = options.contextTreeSnapshotService;
11
+ this.terminal = options.terminal;
12
+ }
13
+ // Protected method for testability - can be overridden in tests
14
+ async confirmClear() {
15
+ return this.terminal.confirm({
16
+ default: false,
17
+ message: 'Are you sure you want to reset the context tree? This will remove all existing context and restore default domains.',
18
+ });
19
+ }
20
+ async run(options) {
21
+ try {
22
+ // Check if context tree exists
23
+ const exists = await this.contextTreeService.exists(options.directory);
24
+ if (!exists) {
25
+ this.terminal.log('No context tree found. Nothing to clear.');
26
+ return;
27
+ }
28
+ // Confirmation prompt (unless skipConfirmation is true)
29
+ if (!options.skipConfirmation) {
30
+ const confirmed = await this.confirmClear();
31
+ if (!confirmed) {
32
+ this.terminal.log('Cancelled. Context tree was not reset.');
33
+ return;
34
+ }
35
+ }
36
+ // Remove existing context tree directory
37
+ const baseDir = options.directory ?? process.cwd();
38
+ const contextTreeDir = join(baseDir, BRV_DIR, CONTEXT_TREE_DIR);
39
+ await rm(contextTreeDir, { force: true, recursive: true });
40
+ // Re-initialize context tree with default domains
41
+ await this.contextTreeService.initialize(options.directory);
42
+ // Re-initialize empty snapshot
43
+ await this.contextTreeSnapshotService.initEmptySnapshot(options.directory);
44
+ this.terminal.log('✓ Context tree reset successfully.');
45
+ this.terminal.log(' 6 default domains restored: code_style, design, structure, compliance, testing, bug_fixes');
46
+ }
47
+ catch (error) {
48
+ // Handle user cancelling the prompt (Ctrl+C or closing stdin)
49
+ const errorMessage = error instanceof Error ? error.message : String(error);
50
+ if (errorMessage.includes('User force closed') || errorMessage.includes('force closed')) {
51
+ this.terminal.log('Cancelled. Context tree was not reset.');
52
+ return;
53
+ }
54
+ // For other errors, log error message
55
+ this.terminal.error(error instanceof Error ? error.message : 'Failed to reset context tree');
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,66 @@
1
+ import type { IProjectConfigStore } from '../../core/interfaces/i-project-config-store.js';
2
+ import type { ITerminal } from '../../core/interfaces/i-terminal.js';
3
+ import type { ITokenStore } from '../../core/interfaces/i-token-store.js';
4
+ import type { ITrackingService } from '../../core/interfaces/i-tracking-service.js';
5
+ import type { CurateUseCaseRunOptions, ICurateUseCase } from '../../core/interfaces/usecase/i-curate-use-case.js';
6
+ export interface CurateUseCaseOptions {
7
+ projectConfigStore: IProjectConfigStore;
8
+ terminal: ITerminal;
9
+ tokenStore: ITokenStore;
10
+ trackingService: ITrackingService;
11
+ }
12
+ export declare class CurateUseCase implements ICurateUseCase {
13
+ private readonly projectConfigStore;
14
+ private readonly terminal;
15
+ private readonly tokenStore;
16
+ private readonly trackingService;
17
+ constructor(options: CurateUseCaseOptions);
18
+ /**
19
+ * Create topic folder with context.md file
20
+ * @param targetPath - The parent path where the topic folder will be created
21
+ * @param topicName - The name of the topic folder to create
22
+ * @returns The path to the created context.md file
23
+ */
24
+ protected createTopicWithContextFile(targetPath: string, topicName: string): string;
25
+ /**
26
+ * Generate a unique session ID for the autonomous agent.
27
+ * Uses crypto.randomUUID() for guaranteed uniqueness (122 bits of entropy).
28
+ */
29
+ protected generateSessionId(): string;
30
+ /**
31
+ * Navigate through the context tree using file selector
32
+ * Returns the selected path relative to context-tree root
33
+ */
34
+ protected navigateContextTree(): Promise<null | string>;
35
+ /**
36
+ * Open a file in the default editor
37
+ * @param filePath - The path to the file to open
38
+ */
39
+ protected openFile(filePath: string): Promise<void>;
40
+ /**
41
+ * Prompt user to enter topic name with validation
42
+ * @param targetPath - The path where the topic folder will be created
43
+ * @returns The topic name or null if cancelled
44
+ */
45
+ protected promptForTopicName(targetPath: string): Promise<null | string>;
46
+ run(options: CurateUseCaseRunOptions): Promise<void>;
47
+ /**
48
+ * Handle workspace not initialized error
49
+ */
50
+ private handleWorkspaceError;
51
+ /**
52
+ * Process file paths from --files flag
53
+ * @param filePaths - Array of file paths (relative or absolute)
54
+ * @returns Formatted instructions for the agent to read the specified files, or undefined if validation fails
55
+ */
56
+ private processFileReferences;
57
+ /**
58
+ * Run in autonomous mode - push to queue for background processing
59
+ */
60
+ private runAutonomous;
61
+ /**
62
+ * Run in interactive mode with manual prompts
63
+ */
64
+ private runInteractive;
65
+ private validateTopicName;
66
+ }