codehere 0.1.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 (991) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +378 -0
  3. package/dist/agents/base.d.ts +107 -0
  4. package/dist/agents/base.d.ts.map +1 -0
  5. package/dist/agents/base.js +101 -0
  6. package/dist/agents/base.js.map +1 -0
  7. package/dist/agents/orchestrator-model-driven.d.ts +41 -0
  8. package/dist/agents/orchestrator-model-driven.d.ts.map +1 -0
  9. package/dist/agents/orchestrator-model-driven.js +141 -0
  10. package/dist/agents/orchestrator-model-driven.js.map +1 -0
  11. package/dist/agents/react-orchestrator-agent.d.ts +15 -0
  12. package/dist/agents/react-orchestrator-agent.d.ts.map +1 -0
  13. package/dist/agents/react-orchestrator-agent.js +54 -0
  14. package/dist/agents/react-orchestrator-agent.js.map +1 -0
  15. package/dist/application/agents/execution-agent.d.ts +79 -0
  16. package/dist/application/agents/execution-agent.d.ts.map +1 -0
  17. package/dist/application/agents/execution-agent.js +534 -0
  18. package/dist/application/agents/execution-agent.js.map +1 -0
  19. package/dist/application/agents/multi-agent-orchestrator.d.ts +69 -0
  20. package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -0
  21. package/dist/application/agents/multi-agent-orchestrator.js +296 -0
  22. package/dist/application/agents/multi-agent-orchestrator.js.map +1 -0
  23. package/dist/application/agents/planning-agent.d.ts +65 -0
  24. package/dist/application/agents/planning-agent.d.ts.map +1 -0
  25. package/dist/application/agents/planning-agent.js +553 -0
  26. package/dist/application/agents/planning-agent.js.map +1 -0
  27. package/dist/application/agents/validation-agent.d.ts +68 -0
  28. package/dist/application/agents/validation-agent.d.ts.map +1 -0
  29. package/dist/application/agents/validation-agent.js +317 -0
  30. package/dist/application/agents/validation-agent.js.map +1 -0
  31. package/dist/application/architectures/plan-and-act.d.ts +94 -0
  32. package/dist/application/architectures/plan-and-act.d.ts.map +1 -0
  33. package/dist/application/architectures/plan-and-act.js +242 -0
  34. package/dist/application/architectures/plan-and-act.js.map +1 -0
  35. package/dist/application/index.d.ts +12 -0
  36. package/dist/application/index.d.ts.map +1 -0
  37. package/dist/application/index.js +12 -0
  38. package/dist/application/index.js.map +1 -0
  39. package/dist/application/services/agent-factory.d.ts +9 -0
  40. package/dist/application/services/agent-factory.d.ts.map +1 -0
  41. package/dist/application/services/agent-factory.js +28 -0
  42. package/dist/application/services/agent-factory.js.map +1 -0
  43. package/dist/application/services/context-importer.d.ts +71 -0
  44. package/dist/application/services/context-importer.d.ts.map +1 -0
  45. package/dist/application/services/context-importer.js +436 -0
  46. package/dist/application/services/context-importer.js.map +1 -0
  47. package/dist/application/services/context-manager.d.ts +132 -0
  48. package/dist/application/services/context-manager.d.ts.map +1 -0
  49. package/dist/application/services/context-manager.js +369 -0
  50. package/dist/application/services/context-manager.js.map +1 -0
  51. package/dist/application/services/dependency-container.d.ts +187 -0
  52. package/dist/application/services/dependency-container.d.ts.map +1 -0
  53. package/dist/application/services/dependency-container.js +607 -0
  54. package/dist/application/services/dependency-container.js.map +1 -0
  55. package/dist/application/services/git-context-service.d.ts +30 -0
  56. package/dist/application/services/git-context-service.d.ts.map +1 -0
  57. package/dist/application/services/git-context-service.js +83 -0
  58. package/dist/application/services/git-context-service.js.map +1 -0
  59. package/dist/application/services/intelligent-router.d.ts +90 -0
  60. package/dist/application/services/intelligent-router.d.ts.map +1 -0
  61. package/dist/application/services/intelligent-router.js +942 -0
  62. package/dist/application/services/intelligent-router.js.map +1 -0
  63. package/dist/application/services/token-counting-service.d.ts +87 -0
  64. package/dist/application/services/token-counting-service.d.ts.map +1 -0
  65. package/dist/application/services/token-counting-service.js +196 -0
  66. package/dist/application/services/token-counting-service.js.map +1 -0
  67. package/dist/application/services/tool-executor-service.d.ts +14 -0
  68. package/dist/application/services/tool-executor-service.d.ts.map +1 -0
  69. package/dist/application/services/tool-executor-service.js +94 -0
  70. package/dist/application/services/tool-executor-service.js.map +1 -0
  71. package/dist/application/use-cases/ask-question-use-case.d.ts +67 -0
  72. package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -0
  73. package/dist/application/use-cases/ask-question-use-case.js +437 -0
  74. package/dist/application/use-cases/ask-question-use-case.js.map +1 -0
  75. package/dist/application/use-cases/edit-file-use-case.d.ts +92 -0
  76. package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -0
  77. package/dist/application/use-cases/edit-file-use-case.js +819 -0
  78. package/dist/application/use-cases/edit-file-use-case.js.map +1 -0
  79. package/dist/application/use-cases/explain-file-use-case.d.ts +21 -0
  80. package/dist/application/use-cases/explain-file-use-case.d.ts.map +1 -0
  81. package/dist/application/use-cases/explain-file-use-case.js +50 -0
  82. package/dist/application/use-cases/explain-file-use-case.js.map +1 -0
  83. package/dist/application/use-cases/index-codebase-use-case.d.ts +46 -0
  84. package/dist/application/use-cases/index-codebase-use-case.d.ts.map +1 -0
  85. package/dist/application/use-cases/index-codebase-use-case.js +113 -0
  86. package/dist/application/use-cases/index-codebase-use-case.js.map +1 -0
  87. package/dist/application/use-cases/planning-use-case.d.ts +46 -0
  88. package/dist/application/use-cases/planning-use-case.d.ts.map +1 -0
  89. package/dist/application/use-cases/planning-use-case.js +276 -0
  90. package/dist/application/use-cases/planning-use-case.js.map +1 -0
  91. package/dist/application/use-cases/react-orchestration-use-case.d.ts +51 -0
  92. package/dist/application/use-cases/react-orchestration-use-case.d.ts.map +1 -0
  93. package/dist/application/use-cases/react-orchestration-use-case.js +362 -0
  94. package/dist/application/use-cases/react-orchestration-use-case.js.map +1 -0
  95. package/dist/application/use-cases/reflexion-use-case.d.ts +24 -0
  96. package/dist/application/use-cases/reflexion-use-case.d.ts.map +1 -0
  97. package/dist/application/use-cases/reflexion-use-case.js +30 -0
  98. package/dist/application/use-cases/reflexion-use-case.js.map +1 -0
  99. package/dist/application/workflows/deterministic-workflows.d.ts +61 -0
  100. package/dist/application/workflows/deterministic-workflows.d.ts.map +1 -0
  101. package/dist/application/workflows/deterministic-workflows.js +189 -0
  102. package/dist/application/workflows/deterministic-workflows.js.map +1 -0
  103. package/dist/ast-parser.d 2.ts +55 -0
  104. package/dist/ast-parser.d.ts +55 -0
  105. package/dist/ast-parser.d.ts.map +1 -0
  106. package/dist/ast-parser.js +331 -0
  107. package/dist/ast-parser.js.map +1 -0
  108. package/dist/cache.d.ts +45 -0
  109. package/dist/cache.d.ts.map +1 -0
  110. package/dist/cache.js +180 -0
  111. package/dist/cache.js.map +1 -0
  112. package/dist/chat.d.ts +4 -0
  113. package/dist/chat.d.ts.map +1 -0
  114. package/dist/chat.js +175 -0
  115. package/dist/chat.js.map +1 -0
  116. package/dist/code-analysis 2.js +327 -0
  117. package/dist/code-analysis.d.ts +50 -0
  118. package/dist/code-analysis.d.ts.map +1 -0
  119. package/dist/code-analysis.js +327 -0
  120. package/dist/code-analysis.js.map +1 -0
  121. package/dist/context.d.ts +44 -0
  122. package/dist/context.d.ts 2.map +1 -0
  123. package/dist/context.d.ts.map +1 -0
  124. package/dist/context.js +187 -0
  125. package/dist/context.js.map +1 -0
  126. package/dist/docs.d.ts +21 -0
  127. package/dist/docs.d.ts.map +1 -0
  128. package/dist/docs.js +146 -0
  129. package/dist/docs.js.map +1 -0
  130. package/dist/domain/entities/code-chunk.d.ts +26 -0
  131. package/dist/domain/entities/code-chunk.d.ts.map +1 -0
  132. package/dist/domain/entities/code-chunk.js +6 -0
  133. package/dist/domain/entities/code-chunk.js.map +1 -0
  134. package/dist/domain/entities/conversation-context.d.ts +245 -0
  135. package/dist/domain/entities/conversation-context.d.ts.map +1 -0
  136. package/dist/domain/entities/conversation-context.js +50 -0
  137. package/dist/domain/entities/conversation-context.js.map +1 -0
  138. package/dist/domain/entities/decision.d.ts +37 -0
  139. package/dist/domain/entities/decision.d.ts.map +1 -0
  140. package/dist/domain/entities/decision.js +9 -0
  141. package/dist/domain/entities/decision.js.map +1 -0
  142. package/dist/domain/entities/edit.d.ts +35 -0
  143. package/dist/domain/entities/edit.d.ts.map +1 -0
  144. package/dist/domain/entities/edit.js +6 -0
  145. package/dist/domain/entities/edit.js.map +1 -0
  146. package/dist/domain/entities/knowledge-node.d.ts +83 -0
  147. package/dist/domain/entities/knowledge-node.d.ts.map +1 -0
  148. package/dist/domain/entities/knowledge-node.js +9 -0
  149. package/dist/domain/entities/knowledge-node.js.map +1 -0
  150. package/dist/domain/entities/knowledge-preservation.d.ts +42 -0
  151. package/dist/domain/entities/knowledge-preservation.d.ts.map +1 -0
  152. package/dist/domain/entities/knowledge-preservation.js +10 -0
  153. package/dist/domain/entities/knowledge-preservation.js.map +1 -0
  154. package/dist/domain/entities/memory.d.ts +36 -0
  155. package/dist/domain/entities/memory.d.ts.map +1 -0
  156. package/dist/domain/entities/memory.js +6 -0
  157. package/dist/domain/entities/memory.js.map +1 -0
  158. package/dist/domain/entities/pattern.d.ts +49 -0
  159. package/dist/domain/entities/pattern.d.ts.map +1 -0
  160. package/dist/domain/entities/pattern.js +7 -0
  161. package/dist/domain/entities/pattern.js.map +1 -0
  162. package/dist/domain/entities/plan.d.ts +42 -0
  163. package/dist/domain/entities/plan.d.ts.map +1 -0
  164. package/dist/domain/entities/plan.js +6 -0
  165. package/dist/domain/entities/plan.js.map +1 -0
  166. package/dist/domain/entities/query.d.ts +17 -0
  167. package/dist/domain/entities/query.d.ts.map +1 -0
  168. package/dist/domain/entities/query.js +6 -0
  169. package/dist/domain/entities/query.js.map +1 -0
  170. package/dist/domain/entities/task.d.ts +152 -0
  171. package/dist/domain/entities/task.d.ts.map +1 -0
  172. package/dist/domain/entities/task.js +61 -0
  173. package/dist/domain/entities/task.js.map +1 -0
  174. package/dist/domain/errors/embeddings-not-found-error.d.ts +9 -0
  175. package/dist/domain/errors/embeddings-not-found-error.d.ts.map +1 -0
  176. package/dist/domain/errors/embeddings-not-found-error.js +13 -0
  177. package/dist/domain/errors/embeddings-not-found-error.js.map +1 -0
  178. package/dist/domain/index.d.ts +16 -0
  179. package/dist/domain/index.d.ts.map +1 -0
  180. package/dist/domain/index.js +19 -0
  181. package/dist/domain/index.js.map +1 -0
  182. package/dist/domain/interfaces/ai-service.interface.d.ts +72 -0
  183. package/dist/domain/interfaces/ai-service.interface.d.ts.map +1 -0
  184. package/dist/domain/interfaces/ai-service.interface.js +6 -0
  185. package/dist/domain/interfaces/ai-service.interface.js.map +1 -0
  186. package/dist/domain/interfaces/code-analyzer.interface.d.ts +38 -0
  187. package/dist/domain/interfaces/code-analyzer.interface.d.ts.map +1 -0
  188. package/dist/domain/interfaces/code-analyzer.interface.js +6 -0
  189. package/dist/domain/interfaces/code-analyzer.interface.js.map +1 -0
  190. package/dist/domain/interfaces/context-repository.interface.d.ts +71 -0
  191. package/dist/domain/interfaces/context-repository.interface.d.ts.map +1 -0
  192. package/dist/domain/interfaces/context-repository.interface.js +10 -0
  193. package/dist/domain/interfaces/context-repository.interface.js.map +1 -0
  194. package/dist/domain/interfaces/decision-repository.interface.d.ts +51 -0
  195. package/dist/domain/interfaces/decision-repository.interface.d.ts.map +1 -0
  196. package/dist/domain/interfaces/decision-repository.interface.js +9 -0
  197. package/dist/domain/interfaces/decision-repository.interface.js.map +1 -0
  198. package/dist/domain/interfaces/embedding-repository.interface.d.ts +33 -0
  199. package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +1 -0
  200. package/dist/domain/interfaces/embedding-repository.interface.js +6 -0
  201. package/dist/domain/interfaces/embedding-repository.interface.js.map +1 -0
  202. package/dist/domain/interfaces/knowledge-graph-repository.interface.d.ts +91 -0
  203. package/dist/domain/interfaces/knowledge-graph-repository.interface.d.ts.map +1 -0
  204. package/dist/domain/interfaces/knowledge-graph-repository.interface.js +9 -0
  205. package/dist/domain/interfaces/knowledge-graph-repository.interface.js.map +1 -0
  206. package/dist/domain/interfaces/knowledge-preservation-repository.interface.d.ts +50 -0
  207. package/dist/domain/interfaces/knowledge-preservation-repository.interface.d.ts.map +1 -0
  208. package/dist/domain/interfaces/knowledge-preservation-repository.interface.js +8 -0
  209. package/dist/domain/interfaces/knowledge-preservation-repository.interface.js.map +1 -0
  210. package/dist/domain/interfaces/memory-repository.interface.d.ts +49 -0
  211. package/dist/domain/interfaces/memory-repository.interface.d.ts.map +1 -0
  212. package/dist/domain/interfaces/memory-repository.interface.js +6 -0
  213. package/dist/domain/interfaces/memory-repository.interface.js.map +1 -0
  214. package/dist/domain/interfaces/pattern-repository.interface.d.ts +48 -0
  215. package/dist/domain/interfaces/pattern-repository.interface.d.ts.map +1 -0
  216. package/dist/domain/interfaces/pattern-repository.interface.js +6 -0
  217. package/dist/domain/interfaces/pattern-repository.interface.js.map +1 -0
  218. package/dist/domain/interfaces/verification-service.interface.d.ts +20 -0
  219. package/dist/domain/interfaces/verification-service.interface.d.ts.map +1 -0
  220. package/dist/domain/interfaces/verification-service.interface.js +6 -0
  221. package/dist/domain/interfaces/verification-service.interface.js.map +1 -0
  222. package/dist/domain/services/codebase-detector.d.ts +18 -0
  223. package/dist/domain/services/codebase-detector.d.ts.map +1 -0
  224. package/dist/domain/services/codebase-detector.js +91 -0
  225. package/dist/domain/services/codebase-detector.js.map +1 -0
  226. package/dist/domain/services/cross-team-pattern-sharing.d.ts +65 -0
  227. package/dist/domain/services/cross-team-pattern-sharing.d.ts.map +1 -0
  228. package/dist/domain/services/cross-team-pattern-sharing.js +125 -0
  229. package/dist/domain/services/cross-team-pattern-sharing.js.map +1 -0
  230. package/dist/domain/services/decision-recorder.d.ts +76 -0
  231. package/dist/domain/services/decision-recorder.d.ts.map +1 -0
  232. package/dist/domain/services/decision-recorder.js +223 -0
  233. package/dist/domain/services/decision-recorder.js.map +1 -0
  234. package/dist/domain/services/decision-retriever.d.ts +75 -0
  235. package/dist/domain/services/decision-retriever.d.ts.map +1 -0
  236. package/dist/domain/services/decision-retriever.js +133 -0
  237. package/dist/domain/services/decision-retriever.js.map +1 -0
  238. package/dist/domain/services/environment-mode-manager.d.ts +12 -0
  239. package/dist/domain/services/environment-mode-manager.d.ts.map +1 -0
  240. package/dist/domain/services/environment-mode-manager.js +22 -0
  241. package/dist/domain/services/environment-mode-manager.js.map +1 -0
  242. package/dist/domain/services/graded-memory-activation.d.ts +37 -0
  243. package/dist/domain/services/graded-memory-activation.d.ts.map +1 -0
  244. package/dist/domain/services/graded-memory-activation.js +69 -0
  245. package/dist/domain/services/graded-memory-activation.js.map +1 -0
  246. package/dist/domain/services/knowledge-access.d.ts +63 -0
  247. package/dist/domain/services/knowledge-access.d.ts.map +1 -0
  248. package/dist/domain/services/knowledge-access.js +132 -0
  249. package/dist/domain/services/knowledge-access.js.map +1 -0
  250. package/dist/domain/services/knowledge-extractor.d.ts +54 -0
  251. package/dist/domain/services/knowledge-extractor.d.ts.map +1 -0
  252. package/dist/domain/services/knowledge-extractor.js +247 -0
  253. package/dist/domain/services/knowledge-extractor.js.map +1 -0
  254. package/dist/domain/services/knowledge-graph-builder.d.ts +70 -0
  255. package/dist/domain/services/knowledge-graph-builder.d.ts.map +1 -0
  256. package/dist/domain/services/knowledge-graph-builder.js +268 -0
  257. package/dist/domain/services/knowledge-graph-builder.js.map +1 -0
  258. package/dist/domain/services/knowledge-graph-query.d.ts +69 -0
  259. package/dist/domain/services/knowledge-graph-query.d.ts.map +1 -0
  260. package/dist/domain/services/knowledge-graph-query.js +187 -0
  261. package/dist/domain/services/knowledge-graph-query.js.map +1 -0
  262. package/dist/domain/services/memory-retriever.d.ts +30 -0
  263. package/dist/domain/services/memory-retriever.d.ts.map +1 -0
  264. package/dist/domain/services/memory-retriever.js +82 -0
  265. package/dist/domain/services/memory-retriever.js.map +1 -0
  266. package/dist/domain/services/memory-synthesizer.d.ts +57 -0
  267. package/dist/domain/services/memory-synthesizer.d.ts.map +1 -0
  268. package/dist/domain/services/memory-synthesizer.js +91 -0
  269. package/dist/domain/services/memory-synthesizer.js.map +1 -0
  270. package/dist/domain/services/pattern-extractor.d.ts +108 -0
  271. package/dist/domain/services/pattern-extractor.d.ts.map +1 -0
  272. package/dist/domain/services/pattern-extractor.js +442 -0
  273. package/dist/domain/services/pattern-extractor.js.map +1 -0
  274. package/dist/domain/services/query-intent-classifier.d.ts +16 -0
  275. package/dist/domain/services/query-intent-classifier.d.ts.map +1 -0
  276. package/dist/domain/services/query-intent-classifier.js +173 -0
  277. package/dist/domain/services/query-intent-classifier.js.map +1 -0
  278. package/dist/domain/services/react-loop.d.ts +52 -0
  279. package/dist/domain/services/react-loop.d.ts.map +1 -0
  280. package/dist/domain/services/react-loop.js +186 -0
  281. package/dist/domain/services/react-loop.js.map +1 -0
  282. package/dist/domain/services/risk-tier-detector.d.ts +17 -0
  283. package/dist/domain/services/risk-tier-detector.d.ts.map +1 -0
  284. package/dist/domain/services/risk-tier-detector.js +78 -0
  285. package/dist/domain/services/risk-tier-detector.js.map +1 -0
  286. package/dist/edit.d.ts +26 -0
  287. package/dist/edit.d.ts 2.map +1 -0
  288. package/dist/edit.d.ts.map +1 -0
  289. package/dist/edit.js +319 -0
  290. package/dist/edit.js.map +1 -0
  291. package/dist/embed.d 2.ts +14 -0
  292. package/dist/embed.d.ts +14 -0
  293. package/dist/embed.d.ts.map +1 -0
  294. package/dist/embed.js +472 -0
  295. package/dist/embed.js.map +1 -0
  296. package/dist/error-handler.d 2.ts +77 -0
  297. package/dist/error-handler.d.ts +77 -0
  298. package/dist/error-handler.d.ts.map +1 -0
  299. package/dist/error-handler.js +256 -0
  300. package/dist/error-handler.js.map +1 -0
  301. package/dist/formatter 2.js +168 -0
  302. package/dist/formatter.d.ts +25 -0
  303. package/dist/formatter.d.ts 2.map +1 -0
  304. package/dist/formatter.d.ts.map +1 -0
  305. package/dist/formatter.js +168 -0
  306. package/dist/formatter.js.map +1 -0
  307. package/dist/git 2.js +198 -0
  308. package/dist/git.d 2.ts +55 -0
  309. package/dist/git.d.ts +55 -0
  310. package/dist/git.d.ts.map +1 -0
  311. package/dist/git.js +198 -0
  312. package/dist/git.js.map +1 -0
  313. package/dist/index 2.d.ts +16 -0
  314. package/dist/index 2.d.ts.map +1 -0
  315. package/dist/index 2.js +429 -0
  316. package/dist/index 2.js.map +1 -0
  317. package/dist/index-backup-before-lazy-loading.d.ts +3 -0
  318. package/dist/index-backup-before-lazy-loading.d.ts.map +1 -0
  319. package/dist/index-backup-before-lazy-loading.js +1551 -0
  320. package/dist/index-backup-before-lazy-loading.js.map +1 -0
  321. package/dist/index.d.ts +16 -0
  322. package/dist/index.d.ts 2.map +1 -0
  323. package/dist/index.d.ts.map +1 -0
  324. package/dist/index.js +489 -0
  325. package/dist/index.js 2.map +1 -0
  326. package/dist/index.js.map +1 -0
  327. package/dist/infrastructure/ai/cohere-ai-service.d.ts +71 -0
  328. package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -0
  329. package/dist/infrastructure/ai/cohere-ai-service.js +676 -0
  330. package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -0
  331. package/dist/infrastructure/ai/command-r-evaluation.d.ts +42 -0
  332. package/dist/infrastructure/ai/command-r-evaluation.d.ts.map +1 -0
  333. package/dist/infrastructure/ai/command-r-evaluation.js +206 -0
  334. package/dist/infrastructure/ai/command-r-evaluation.js.map +1 -0
  335. package/dist/infrastructure/ai/model-config.d.ts +47 -0
  336. package/dist/infrastructure/ai/model-config.d.ts.map +1 -0
  337. package/dist/infrastructure/ai/model-config.js +84 -0
  338. package/dist/infrastructure/ai/model-config.js.map +1 -0
  339. package/dist/infrastructure/ai/provider-ai-service.d.ts +67 -0
  340. package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -0
  341. package/dist/infrastructure/ai/provider-ai-service.js +580 -0
  342. package/dist/infrastructure/ai/provider-ai-service.js.map +1 -0
  343. package/dist/infrastructure/cache/embedding-cache.d.ts +58 -0
  344. package/dist/infrastructure/cache/embedding-cache.d.ts.map +1 -0
  345. package/dist/infrastructure/cache/embedding-cache.js +175 -0
  346. package/dist/infrastructure/cache/embedding-cache.js.map +1 -0
  347. package/dist/infrastructure/cache/query-result-cache.d.ts +27 -0
  348. package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -0
  349. package/dist/infrastructure/cache/query-result-cache.js +66 -0
  350. package/dist/infrastructure/cache/query-result-cache.js.map +1 -0
  351. package/dist/infrastructure/cache/response-cache.d.ts +18 -0
  352. package/dist/infrastructure/cache/response-cache.d.ts.map +1 -0
  353. package/dist/infrastructure/cache/response-cache.js +48 -0
  354. package/dist/infrastructure/cache/response-cache.js.map +1 -0
  355. package/dist/infrastructure/cache/security-scan-cache.d.ts +16 -0
  356. package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -0
  357. package/dist/infrastructure/cache/security-scan-cache.js +47 -0
  358. package/dist/infrastructure/cache/security-scan-cache.js.map +1 -0
  359. package/dist/infrastructure/chunking/ast-code-chunker.d.ts +12 -0
  360. package/dist/infrastructure/chunking/ast-code-chunker.d.ts.map +1 -0
  361. package/dist/infrastructure/chunking/ast-code-chunker.js +19 -0
  362. package/dist/infrastructure/chunking/ast-code-chunker.js.map +1 -0
  363. package/dist/infrastructure/chunking/code-aware-chunker.d.ts +63 -0
  364. package/dist/infrastructure/chunking/code-aware-chunker.d.ts.map +1 -0
  365. package/dist/infrastructure/chunking/code-aware-chunker.js +397 -0
  366. package/dist/infrastructure/chunking/code-aware-chunker.js.map +1 -0
  367. package/dist/infrastructure/completion/bash-completion.d.ts +7 -0
  368. package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -0
  369. package/dist/infrastructure/completion/bash-completion.js +25 -0
  370. package/dist/infrastructure/completion/bash-completion.js.map +1 -0
  371. package/dist/infrastructure/completion/fish-completion.d.ts +7 -0
  372. package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -0
  373. package/dist/infrastructure/completion/fish-completion.js +22 -0
  374. package/dist/infrastructure/completion/fish-completion.js.map +1 -0
  375. package/dist/infrastructure/completion/zsh-completion.d.ts +7 -0
  376. package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -0
  377. package/dist/infrastructure/completion/zsh-completion.js +30 -0
  378. package/dist/infrastructure/completion/zsh-completion.js.map +1 -0
  379. package/dist/infrastructure/config/config-manager.d.ts +158 -0
  380. package/dist/infrastructure/config/config-manager.d.ts.map +1 -0
  381. package/dist/infrastructure/config/config-manager.js +294 -0
  382. package/dist/infrastructure/config/config-manager.js.map +1 -0
  383. package/dist/infrastructure/context/context-compressor.d.ts +94 -0
  384. package/dist/infrastructure/context/context-compressor.d.ts.map +1 -0
  385. package/dist/infrastructure/context/context-compressor.js +329 -0
  386. package/dist/infrastructure/context/context-compressor.js.map +1 -0
  387. package/dist/infrastructure/context/conversation-context.d.ts +82 -0
  388. package/dist/infrastructure/context/conversation-context.d.ts.map +1 -0
  389. package/dist/infrastructure/context/conversation-context.js +213 -0
  390. package/dist/infrastructure/context/conversation-context.js.map +1 -0
  391. package/dist/infrastructure/context/direct-context-provider.d.ts +18 -0
  392. package/dist/infrastructure/context/direct-context-provider.d.ts.map +1 -0
  393. package/dist/infrastructure/context/direct-context-provider.js +222 -0
  394. package/dist/infrastructure/context/direct-context-provider.js.map +1 -0
  395. package/dist/infrastructure/context/git-context-provider.d.ts +30 -0
  396. package/dist/infrastructure/context/git-context-provider.d.ts.map +1 -0
  397. package/dist/infrastructure/context/git-context-provider.js +140 -0
  398. package/dist/infrastructure/context/git-context-provider.js.map +1 -0
  399. package/dist/infrastructure/context/project-context-loader.d.ts +35 -0
  400. package/dist/infrastructure/context/project-context-loader.d.ts.map +1 -0
  401. package/dist/infrastructure/context/project-context-loader.js +184 -0
  402. package/dist/infrastructure/context/project-context-loader.js.map +1 -0
  403. package/dist/infrastructure/context/session-manager.d.ts +42 -0
  404. package/dist/infrastructure/context/session-manager.d.ts.map +1 -0
  405. package/dist/infrastructure/context/session-manager.js +94 -0
  406. package/dist/infrastructure/context/session-manager.js.map +1 -0
  407. package/dist/infrastructure/cost/cost-tracker.d.ts +91 -0
  408. package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -0
  409. package/dist/infrastructure/cost/cost-tracker.js +361 -0
  410. package/dist/infrastructure/cost/cost-tracker.js.map +1 -0
  411. package/dist/infrastructure/cost/session-token-tracker.d.ts +68 -0
  412. package/dist/infrastructure/cost/session-token-tracker.d.ts.map +1 -0
  413. package/dist/infrastructure/cost/session-token-tracker.js +178 -0
  414. package/dist/infrastructure/cost/session-token-tracker.js.map +1 -0
  415. package/dist/infrastructure/cost-calculator.d.ts +34 -0
  416. package/dist/infrastructure/cost-calculator.d.ts.map +1 -0
  417. package/dist/infrastructure/cost-calculator.js +145 -0
  418. package/dist/infrastructure/cost-calculator.js.map +1 -0
  419. package/dist/infrastructure/cost-estimator.d.ts +48 -0
  420. package/dist/infrastructure/cost-estimator.d.ts.map +1 -0
  421. package/dist/infrastructure/cost-estimator.js +201 -0
  422. package/dist/infrastructure/cost-estimator.js.map +1 -0
  423. package/dist/infrastructure/file-scanner/file-scanner.d.ts +31 -0
  424. package/dist/infrastructure/file-scanner/file-scanner.d.ts.map +1 -0
  425. package/dist/infrastructure/file-scanner/file-scanner.js +106 -0
  426. package/dist/infrastructure/file-scanner/file-scanner.js.map +1 -0
  427. package/dist/infrastructure/governance/nist-ai-rmf.d.ts +105 -0
  428. package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +1 -0
  429. package/dist/infrastructure/governance/nist-ai-rmf.js +292 -0
  430. package/dist/infrastructure/governance/nist-ai-rmf.js.map +1 -0
  431. package/dist/infrastructure/governance/policy-as-code.d.ts +88 -0
  432. package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -0
  433. package/dist/infrastructure/governance/policy-as-code.js +257 -0
  434. package/dist/infrastructure/governance/policy-as-code.js.map +1 -0
  435. package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +136 -0
  436. package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +1 -0
  437. package/dist/infrastructure/governance/prompt-to-code-lineage.js +239 -0
  438. package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +1 -0
  439. package/dist/infrastructure/index.d.ts +7 -0
  440. package/dist/infrastructure/index.d.ts.map +1 -0
  441. package/dist/infrastructure/index.js +7 -0
  442. package/dist/infrastructure/index.js.map +1 -0
  443. package/dist/infrastructure/observability/execution-tracer.d.ts +130 -0
  444. package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -0
  445. package/dist/infrastructure/observability/execution-tracer.js +400 -0
  446. package/dist/infrastructure/observability/execution-tracer.js.map +1 -0
  447. package/dist/infrastructure/observability/prompt-versioner.d.ts +67 -0
  448. package/dist/infrastructure/observability/prompt-versioner.d.ts.map +1 -0
  449. package/dist/infrastructure/observability/prompt-versioner.js +145 -0
  450. package/dist/infrastructure/observability/prompt-versioner.js.map +1 -0
  451. package/dist/infrastructure/protocols/a2a-metadata.d.ts +278 -0
  452. package/dist/infrastructure/protocols/a2a-metadata.d.ts.map +1 -0
  453. package/dist/infrastructure/protocols/a2a-metadata.js +137 -0
  454. package/dist/infrastructure/protocols/a2a-metadata.js.map +1 -0
  455. package/dist/infrastructure/protocols/a2a-protocol.d.ts +132 -0
  456. package/dist/infrastructure/protocols/a2a-protocol.d.ts.map +1 -0
  457. package/dist/infrastructure/protocols/a2a-protocol.js +314 -0
  458. package/dist/infrastructure/protocols/a2a-protocol.js.map +1 -0
  459. package/dist/infrastructure/protocols/mcp-oauth.d.ts +91 -0
  460. package/dist/infrastructure/protocols/mcp-oauth.d.ts.map +1 -0
  461. package/dist/infrastructure/protocols/mcp-oauth.js +184 -0
  462. package/dist/infrastructure/protocols/mcp-oauth.js.map +1 -0
  463. package/dist/infrastructure/protocols/mcp-server.d.ts +126 -0
  464. package/dist/infrastructure/protocols/mcp-server.d.ts.map +1 -0
  465. package/dist/infrastructure/protocols/mcp-server.js +333 -0
  466. package/dist/infrastructure/protocols/mcp-server.js.map +1 -0
  467. package/dist/infrastructure/protocols/streaming-handler.d.ts +57 -0
  468. package/dist/infrastructure/protocols/streaming-handler.d.ts.map +1 -0
  469. package/dist/infrastructure/protocols/streaming-handler.js +103 -0
  470. package/dist/infrastructure/protocols/streaming-handler.js.map +1 -0
  471. package/dist/infrastructure/providers/cohere-provider.d.ts +39 -0
  472. package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -0
  473. package/dist/infrastructure/providers/cohere-provider.js +470 -0
  474. package/dist/infrastructure/providers/cohere-provider.js.map +1 -0
  475. package/dist/infrastructure/providers/fake-provider.d.ts +43 -0
  476. package/dist/infrastructure/providers/fake-provider.d.ts.map +1 -0
  477. package/dist/infrastructure/providers/fake-provider.js +138 -0
  478. package/dist/infrastructure/providers/fake-provider.js.map +1 -0
  479. package/dist/infrastructure/providers/local-llm-provider.d.ts +49 -0
  480. package/dist/infrastructure/providers/local-llm-provider.d.ts.map +1 -0
  481. package/dist/infrastructure/providers/local-llm-provider.js +336 -0
  482. package/dist/infrastructure/providers/local-llm-provider.js.map +1 -0
  483. package/dist/infrastructure/providers/model-config.types.d.ts +70 -0
  484. package/dist/infrastructure/providers/model-config.types.d.ts.map +1 -0
  485. package/dist/infrastructure/providers/model-config.types.js +9 -0
  486. package/dist/infrastructure/providers/model-config.types.js.map +1 -0
  487. package/dist/infrastructure/providers/model-provider.interface.d.ts +113 -0
  488. package/dist/infrastructure/providers/model-provider.interface.d.ts.map +1 -0
  489. package/dist/infrastructure/providers/model-provider.interface.js +8 -0
  490. package/dist/infrastructure/providers/model-provider.interface.js.map +1 -0
  491. package/dist/infrastructure/providers/openai-provider.d.ts +38 -0
  492. package/dist/infrastructure/providers/openai-provider.d.ts.map +1 -0
  493. package/dist/infrastructure/providers/openai-provider.js +445 -0
  494. package/dist/infrastructure/providers/openai-provider.js.map +1 -0
  495. package/dist/infrastructure/providers/openrouter-provider.d.ts +42 -0
  496. package/dist/infrastructure/providers/openrouter-provider.d.ts.map +1 -0
  497. package/dist/infrastructure/providers/openrouter-provider.js +407 -0
  498. package/dist/infrastructure/providers/openrouter-provider.js.map +1 -0
  499. package/dist/infrastructure/providers/operation-provider-resolver.d.ts +48 -0
  500. package/dist/infrastructure/providers/operation-provider-resolver.d.ts.map +1 -0
  501. package/dist/infrastructure/providers/operation-provider-resolver.js +105 -0
  502. package/dist/infrastructure/providers/operation-provider-resolver.js.map +1 -0
  503. package/dist/infrastructure/providers/provider-config-loader.d.ts +37 -0
  504. package/dist/infrastructure/providers/provider-config-loader.d.ts.map +1 -0
  505. package/dist/infrastructure/providers/provider-config-loader.js +120 -0
  506. package/dist/infrastructure/providers/provider-config-loader.js.map +1 -0
  507. package/dist/infrastructure/providers/provider-registry.d.ts +53 -0
  508. package/dist/infrastructure/providers/provider-registry.d.ts.map +1 -0
  509. package/dist/infrastructure/providers/provider-registry.js +88 -0
  510. package/dist/infrastructure/providers/provider-registry.js.map +1 -0
  511. package/dist/infrastructure/security/ai-sast-scanner.d.ts +59 -0
  512. package/dist/infrastructure/security/ai-sast-scanner.d.ts.map +1 -0
  513. package/dist/infrastructure/security/ai-sast-scanner.js +241 -0
  514. package/dist/infrastructure/security/ai-sast-scanner.js.map +1 -0
  515. package/dist/infrastructure/security/docker-sandbox.d.ts +57 -0
  516. package/dist/infrastructure/security/docker-sandbox.d.ts.map +1 -0
  517. package/dist/infrastructure/security/docker-sandbox.js +178 -0
  518. package/dist/infrastructure/security/docker-sandbox.js.map +1 -0
  519. package/dist/infrastructure/security/enhanced-security-gate.d.ts +66 -0
  520. package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -0
  521. package/dist/infrastructure/security/enhanced-security-gate.js +210 -0
  522. package/dist/infrastructure/security/enhanced-security-gate.js.map +1 -0
  523. package/dist/infrastructure/security/input-validator.d.ts +46 -0
  524. package/dist/infrastructure/security/input-validator.d.ts.map +1 -0
  525. package/dist/infrastructure/security/input-validator.js +269 -0
  526. package/dist/infrastructure/security/input-validator.js.map +1 -0
  527. package/dist/infrastructure/security/license-scanner.d.ts +55 -0
  528. package/dist/infrastructure/security/license-scanner.d.ts.map +1 -0
  529. package/dist/infrastructure/security/license-scanner.js +167 -0
  530. package/dist/infrastructure/security/license-scanner.js.map +1 -0
  531. package/dist/infrastructure/security/provider-bias-detector.d.ts +53 -0
  532. package/dist/infrastructure/security/provider-bias-detector.d.ts.map +1 -0
  533. package/dist/infrastructure/security/provider-bias-detector.js +164 -0
  534. package/dist/infrastructure/security/provider-bias-detector.js.map +1 -0
  535. package/dist/infrastructure/security/sandbox-executor.d.ts +34 -0
  536. package/dist/infrastructure/security/sandbox-executor.d.ts.map +1 -0
  537. package/dist/infrastructure/security/sandbox-executor.js +64 -0
  538. package/dist/infrastructure/security/sandbox-executor.js.map +1 -0
  539. package/dist/infrastructure/serialization/toon-serializer.d.ts +45 -0
  540. package/dist/infrastructure/serialization/toon-serializer.d.ts.map +1 -0
  541. package/dist/infrastructure/serialization/toon-serializer.js +119 -0
  542. package/dist/infrastructure/serialization/toon-serializer.js.map +1 -0
  543. package/dist/infrastructure/storage/embeddings-path.d.ts +18 -0
  544. package/dist/infrastructure/storage/embeddings-path.d.ts.map +1 -0
  545. package/dist/infrastructure/storage/embeddings-path.js +47 -0
  546. package/dist/infrastructure/storage/embeddings-path.js.map +1 -0
  547. package/dist/infrastructure/storage/memory-stream-service.d.ts +47 -0
  548. package/dist/infrastructure/storage/memory-stream-service.d.ts.map +1 -0
  549. package/dist/infrastructure/storage/memory-stream-service.js +204 -0
  550. package/dist/infrastructure/storage/memory-stream-service.js.map +1 -0
  551. package/dist/infrastructure/storage/plan-repository.d.ts +40 -0
  552. package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -0
  553. package/dist/infrastructure/storage/plan-repository.js +95 -0
  554. package/dist/infrastructure/storage/plan-repository.js.map +1 -0
  555. package/dist/infrastructure/storage/sqlite-context-repository.d.ts +95 -0
  556. package/dist/infrastructure/storage/sqlite-context-repository.d.ts.map +1 -0
  557. package/dist/infrastructure/storage/sqlite-context-repository.js +467 -0
  558. package/dist/infrastructure/storage/sqlite-context-repository.js.map +1 -0
  559. package/dist/infrastructure/storage/sqlite-decision-repository.d.ts +29 -0
  560. package/dist/infrastructure/storage/sqlite-decision-repository.d.ts.map +1 -0
  561. package/dist/infrastructure/storage/sqlite-decision-repository.js +228 -0
  562. package/dist/infrastructure/storage/sqlite-decision-repository.js.map +1 -0
  563. package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +47 -0
  564. package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -0
  565. package/dist/infrastructure/storage/sqlite-embedding-repository.js +323 -0
  566. package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -0
  567. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts +41 -0
  568. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts.map +1 -0
  569. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js +413 -0
  570. package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js.map +1 -0
  571. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts +29 -0
  572. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts.map +1 -0
  573. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js +226 -0
  574. package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js.map +1 -0
  575. package/dist/infrastructure/storage/sqlite-memory-repository.d.ts +40 -0
  576. package/dist/infrastructure/storage/sqlite-memory-repository.d.ts.map +1 -0
  577. package/dist/infrastructure/storage/sqlite-memory-repository.js +225 -0
  578. package/dist/infrastructure/storage/sqlite-memory-repository.js.map +1 -0
  579. package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts +25 -0
  580. package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts.map +1 -0
  581. package/dist/infrastructure/storage/sqlite-pattern-repository.js +245 -0
  582. package/dist/infrastructure/storage/sqlite-pattern-repository.js.map +1 -0
  583. package/dist/infrastructure/storage/task-helpers.d.ts +69 -0
  584. package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -0
  585. package/dist/infrastructure/storage/task-helpers.js +197 -0
  586. package/dist/infrastructure/storage/task-helpers.js.map +1 -0
  587. package/dist/infrastructure/storage/task-repository.d.ts +67 -0
  588. package/dist/infrastructure/storage/task-repository.d.ts.map +1 -0
  589. package/dist/infrastructure/storage/task-repository.js +205 -0
  590. package/dist/infrastructure/storage/task-repository.js.map +1 -0
  591. package/dist/infrastructure/telemetry/telemetry-service.d.ts +74 -0
  592. package/dist/infrastructure/telemetry/telemetry-service.d.ts.map +1 -0
  593. package/dist/infrastructure/telemetry/telemetry-service.js +167 -0
  594. package/dist/infrastructure/telemetry/telemetry-service.js.map +1 -0
  595. package/dist/infrastructure/ux/appropriate-friction.d.ts +77 -0
  596. package/dist/infrastructure/ux/appropriate-friction.d.ts.map +1 -0
  597. package/dist/infrastructure/ux/appropriate-friction.js +213 -0
  598. package/dist/infrastructure/ux/appropriate-friction.js.map +1 -0
  599. package/dist/infrastructure/ux/bi-directional-learning.d.ts +131 -0
  600. package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +1 -0
  601. package/dist/infrastructure/ux/bi-directional-learning.js +337 -0
  602. package/dist/infrastructure/ux/bi-directional-learning.js.map +1 -0
  603. package/dist/infrastructure/ux/capability-boundaries.d.ts +22 -0
  604. package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -0
  605. package/dist/infrastructure/ux/capability-boundaries.js +42 -0
  606. package/dist/infrastructure/ux/capability-boundaries.js.map +1 -0
  607. package/dist/infrastructure/ux/cli-style-guide.d.ts +105 -0
  608. package/dist/infrastructure/ux/cli-style-guide.d.ts.map +1 -0
  609. package/dist/infrastructure/ux/cli-style-guide.js +220 -0
  610. package/dist/infrastructure/ux/cli-style-guide.js.map +1 -0
  611. package/dist/infrastructure/ux/comprehensive-formatter.d.ts +21 -0
  612. package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -0
  613. package/dist/infrastructure/ux/comprehensive-formatter.js +117 -0
  614. package/dist/infrastructure/ux/comprehensive-formatter.js.map +1 -0
  615. package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +11 -0
  616. package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -0
  617. package/dist/infrastructure/ux/contextual-feature-discovery.js +10 -0
  618. package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -0
  619. package/dist/infrastructure/ux/expectation-management.d.ts +98 -0
  620. package/dist/infrastructure/ux/expectation-management.d.ts.map +1 -0
  621. package/dist/infrastructure/ux/expectation-management.js +327 -0
  622. package/dist/infrastructure/ux/expectation-management.js.map +1 -0
  623. package/dist/infrastructure/ux/feature-discovery.d.ts +17 -0
  624. package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -0
  625. package/dist/infrastructure/ux/feature-discovery.js +14 -0
  626. package/dist/infrastructure/ux/feature-discovery.js.map +1 -0
  627. package/dist/infrastructure/ux/feedback-prompt.d.ts +26 -0
  628. package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -0
  629. package/dist/infrastructure/ux/feedback-prompt.js +45 -0
  630. package/dist/infrastructure/ux/feedback-prompt.js.map +1 -0
  631. package/dist/infrastructure/ux/hitl-validation.d.ts +139 -0
  632. package/dist/infrastructure/ux/hitl-validation.d.ts.map +1 -0
  633. package/dist/infrastructure/ux/hitl-validation.js +297 -0
  634. package/dist/infrastructure/ux/hitl-validation.js.map +1 -0
  635. package/dist/infrastructure/ux/progress-indicator.d.ts +53 -0
  636. package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -0
  637. package/dist/infrastructure/ux/progress-indicator.js +116 -0
  638. package/dist/infrastructure/ux/progress-indicator.js.map +1 -0
  639. package/dist/infrastructure/ux/progressive-disclosure.d.ts +84 -0
  640. package/dist/infrastructure/ux/progressive-disclosure.d.ts.map +1 -0
  641. package/dist/infrastructure/ux/progressive-disclosure.js +236 -0
  642. package/dist/infrastructure/ux/progressive-disclosure.js.map +1 -0
  643. package/dist/infrastructure/ux/review-checkpoint.d.ts +37 -0
  644. package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -0
  645. package/dist/infrastructure/ux/review-checkpoint.js +72 -0
  646. package/dist/infrastructure/ux/review-checkpoint.js.map +1 -0
  647. package/dist/infrastructure/ux/staged-feature-intro.d.ts +22 -0
  648. package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -0
  649. package/dist/infrastructure/ux/staged-feature-intro.js +24 -0
  650. package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -0
  651. package/dist/infrastructure/ux/syntax-highlighter.d.ts +20 -0
  652. package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -0
  653. package/dist/infrastructure/ux/syntax-highlighter.js +91 -0
  654. package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -0
  655. package/dist/infrastructure/ux/team-standards.d.ts +94 -0
  656. package/dist/infrastructure/ux/team-standards.d.ts.map +1 -0
  657. package/dist/infrastructure/ux/team-standards.js +196 -0
  658. package/dist/infrastructure/ux/team-standards.js.map +1 -0
  659. package/dist/infrastructure/validation/agent-feedback.d.ts +57 -0
  660. package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -0
  661. package/dist/infrastructure/validation/agent-feedback.js +100 -0
  662. package/dist/infrastructure/validation/agent-feedback.js.map +1 -0
  663. package/dist/infrastructure/validation/agent-validation-helper.d.ts +75 -0
  664. package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -0
  665. package/dist/infrastructure/validation/agent-validation-helper.js +137 -0
  666. package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -0
  667. package/dist/infrastructure/validation/hallucination-detector.d.ts +121 -0
  668. package/dist/infrastructure/validation/hallucination-detector.d.ts.map +1 -0
  669. package/dist/infrastructure/validation/hallucination-detector.js +388 -0
  670. package/dist/infrastructure/validation/hallucination-detector.js.map +1 -0
  671. package/dist/infrastructure/validation/review-handler.d.ts +26 -0
  672. package/dist/infrastructure/validation/review-handler.d.ts.map +1 -0
  673. package/dist/infrastructure/validation/review-handler.js +40 -0
  674. package/dist/infrastructure/validation/review-handler.js.map +1 -0
  675. package/dist/infrastructure/validation/summary-aggregator.d.ts +45 -0
  676. package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -0
  677. package/dist/infrastructure/validation/summary-aggregator.js +70 -0
  678. package/dist/infrastructure/validation/summary-aggregator.js.map +1 -0
  679. package/dist/infrastructure/validation/summary-extractor.d.ts +24 -0
  680. package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -0
  681. package/dist/infrastructure/validation/summary-extractor.js +45 -0
  682. package/dist/infrastructure/validation/summary-extractor.js.map +1 -0
  683. package/dist/infrastructure/validation/trace-summary.d.ts +45 -0
  684. package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -0
  685. package/dist/infrastructure/validation/trace-summary.js +52 -0
  686. package/dist/infrastructure/validation/trace-summary.js.map +1 -0
  687. package/dist/infrastructure/verification/verification-service.d.ts +12 -0
  688. package/dist/infrastructure/verification/verification-service.d.ts.map +1 -0
  689. package/dist/infrastructure/verification/verification-service.js +47 -0
  690. package/dist/infrastructure/verification/verification-service.js.map +1 -0
  691. package/dist/infrastructure/xai/attention-visualizer.d.ts +71 -0
  692. package/dist/infrastructure/xai/attention-visualizer.d.ts.map +1 -0
  693. package/dist/infrastructure/xai/attention-visualizer.js +172 -0
  694. package/dist/infrastructure/xai/attention-visualizer.js.map +1 -0
  695. package/dist/infrastructure/xai/cot-visualizer.d.ts +103 -0
  696. package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -0
  697. package/dist/infrastructure/xai/cot-visualizer.js +283 -0
  698. package/dist/infrastructure/xai/cot-visualizer.js.map +1 -0
  699. package/dist/infrastructure/xai/decision-tree-log.d.ts +100 -0
  700. package/dist/infrastructure/xai/decision-tree-log.d.ts.map +1 -0
  701. package/dist/infrastructure/xai/decision-tree-log.js +212 -0
  702. package/dist/infrastructure/xai/decision-tree-log.js.map +1 -0
  703. package/dist/infrastructure/xai/interactive-xai.d.ts +104 -0
  704. package/dist/infrastructure/xai/interactive-xai.d.ts.map +1 -0
  705. package/dist/infrastructure/xai/interactive-xai.js +260 -0
  706. package/dist/infrastructure/xai/interactive-xai.js.map +1 -0
  707. package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +77 -0
  708. package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +1 -0
  709. package/dist/infrastructure/xai/uncertainty-quantifier.js +198 -0
  710. package/dist/infrastructure/xai/uncertainty-quantifier.js.map +1 -0
  711. package/dist/intelligent-retrieval 2.js +272 -0
  712. package/dist/intelligent-retrieval.d.ts +41 -0
  713. package/dist/intelligent-retrieval.d.ts 2.map +1 -0
  714. package/dist/intelligent-retrieval.d.ts.map +1 -0
  715. package/dist/intelligent-retrieval.js +272 -0
  716. package/dist/intelligent-retrieval.js.map +1 -0
  717. package/dist/intent/classifier.d.ts +6 -0
  718. package/dist/intent/classifier.d.ts.map +1 -0
  719. package/dist/intent/classifier.js +2 -0
  720. package/dist/intent/classifier.js.map +1 -0
  721. package/dist/intent/context.d.ts +4 -0
  722. package/dist/intent/context.d.ts.map +1 -0
  723. package/dist/intent/context.js +2 -0
  724. package/dist/intent/context.js.map +1 -0
  725. package/dist/iterative-refinement.d.ts +31 -0
  726. package/dist/iterative-refinement.d.ts.map +1 -0
  727. package/dist/iterative-refinement.js +189 -0
  728. package/dist/iterative-refinement.js.map +1 -0
  729. package/dist/learning.d.ts +69 -0
  730. package/dist/learning.d.ts.map +1 -0
  731. package/dist/learning.js +232 -0
  732. package/dist/learning.js.map +1 -0
  733. package/dist/log.d.ts +4 -0
  734. package/dist/log.d.ts.map +1 -0
  735. package/dist/log.js +31 -0
  736. package/dist/log.js 2.map +1 -0
  737. package/dist/log.js.map +1 -0
  738. package/dist/migrate.d.ts +33 -0
  739. package/dist/migrate.d.ts.map +1 -0
  740. package/dist/migrate.js +133 -0
  741. package/dist/migrate.js 2.map +1 -0
  742. package/dist/migrate.js.map +1 -0
  743. package/dist/monitoring.d.ts +75 -0
  744. package/dist/monitoring.d.ts.map +1 -0
  745. package/dist/monitoring.js +250 -0
  746. package/dist/monitoring.js.map +1 -0
  747. package/dist/parallel-processor.d 2.ts +44 -0
  748. package/dist/parallel-processor.d.ts +44 -0
  749. package/dist/parallel-processor.d.ts.map +1 -0
  750. package/dist/parallel-processor.js +606 -0
  751. package/dist/parallel-processor.js.map +1 -0
  752. package/dist/planner.d.ts +47 -0
  753. package/dist/planner.d.ts.map +1 -0
  754. package/dist/planner.js +198 -0
  755. package/dist/planner.js.map +1 -0
  756. package/dist/policy.d 2.ts +3 -0
  757. package/dist/policy.d.ts +3 -0
  758. package/dist/policy.d.ts.map +1 -0
  759. package/dist/policy.js +26 -0
  760. package/dist/policy.js.map +1 -0
  761. package/dist/presentation/cli/commands/ask-command.d.ts +9 -0
  762. package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -0
  763. package/dist/presentation/cli/commands/ask-command.js +355 -0
  764. package/dist/presentation/cli/commands/ask-command.js.map +1 -0
  765. package/dist/presentation/cli/commands/audit-command.d.ts +13 -0
  766. package/dist/presentation/cli/commands/audit-command.d.ts.map +1 -0
  767. package/dist/presentation/cli/commands/audit-command.js +96 -0
  768. package/dist/presentation/cli/commands/audit-command.js.map +1 -0
  769. package/dist/presentation/cli/commands/config-command.d.ts +9 -0
  770. package/dist/presentation/cli/commands/config-command.d.ts.map +1 -0
  771. package/dist/presentation/cli/commands/config-command.js +125 -0
  772. package/dist/presentation/cli/commands/config-command.js.map +1 -0
  773. package/dist/presentation/cli/commands/context-command.d.ts +32 -0
  774. package/dist/presentation/cli/commands/context-command.d.ts.map +1 -0
  775. package/dist/presentation/cli/commands/context-command.js +295 -0
  776. package/dist/presentation/cli/commands/context-command.js.map +1 -0
  777. package/dist/presentation/cli/commands/context-helper.d.ts +16 -0
  778. package/dist/presentation/cli/commands/context-helper.d.ts.map +1 -0
  779. package/dist/presentation/cli/commands/context-helper.js +88 -0
  780. package/dist/presentation/cli/commands/context-helper.js.map +1 -0
  781. package/dist/presentation/cli/commands/cost-command.d.ts +8 -0
  782. package/dist/presentation/cli/commands/cost-command.d.ts.map +1 -0
  783. package/dist/presentation/cli/commands/cost-command.js +191 -0
  784. package/dist/presentation/cli/commands/cost-command.js.map +1 -0
  785. package/dist/presentation/cli/commands/decision-command.d.ts +12 -0
  786. package/dist/presentation/cli/commands/decision-command.d.ts.map +1 -0
  787. package/dist/presentation/cli/commands/decision-command.js +207 -0
  788. package/dist/presentation/cli/commands/decision-command.js.map +1 -0
  789. package/dist/presentation/cli/commands/docs-command.d.ts +14 -0
  790. package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -0
  791. package/dist/presentation/cli/commands/docs-command.js +25 -0
  792. package/dist/presentation/cli/commands/docs-command.js.map +1 -0
  793. package/dist/presentation/cli/commands/fix-command.d.ts +15 -0
  794. package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -0
  795. package/dist/presentation/cli/commands/fix-command.js +93 -0
  796. package/dist/presentation/cli/commands/fix-command.js.map +1 -0
  797. package/dist/presentation/cli/commands/help-command.d.ts +9 -0
  798. package/dist/presentation/cli/commands/help-command.d.ts.map +1 -0
  799. package/dist/presentation/cli/commands/help-command.js +283 -0
  800. package/dist/presentation/cli/commands/help-command.js.map +1 -0
  801. package/dist/presentation/cli/commands/knowledge-command.d.ts +13 -0
  802. package/dist/presentation/cli/commands/knowledge-command.d.ts.map +1 -0
  803. package/dist/presentation/cli/commands/knowledge-command.js +129 -0
  804. package/dist/presentation/cli/commands/knowledge-command.js.map +1 -0
  805. package/dist/presentation/cli/commands/learning-dashboard-command.d.ts +8 -0
  806. package/dist/presentation/cli/commands/learning-dashboard-command.d.ts.map +1 -0
  807. package/dist/presentation/cli/commands/learning-dashboard-command.js +183 -0
  808. package/dist/presentation/cli/commands/learning-dashboard-command.js.map +1 -0
  809. package/dist/presentation/cli/commands/models-command.d.ts +13 -0
  810. package/dist/presentation/cli/commands/models-command.d.ts.map +1 -0
  811. package/dist/presentation/cli/commands/models-command.js +194 -0
  812. package/dist/presentation/cli/commands/models-command.js.map +1 -0
  813. package/dist/presentation/cli/commands/orchestrate-command.d.ts +10 -0
  814. package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -0
  815. package/dist/presentation/cli/commands/orchestrate-command.js +249 -0
  816. package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -0
  817. package/dist/presentation/cli/commands/plan-command.d.ts +9 -0
  818. package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -0
  819. package/dist/presentation/cli/commands/plan-command.js +246 -0
  820. package/dist/presentation/cli/commands/plan-command.js.map +1 -0
  821. package/dist/presentation/cli/commands/product-command.d.ts +14 -0
  822. package/dist/presentation/cli/commands/product-command.d.ts.map +1 -0
  823. package/dist/presentation/cli/commands/product-command.js +22 -0
  824. package/dist/presentation/cli/commands/product-command.js.map +1 -0
  825. package/dist/presentation/cli/commands/react-command.d.ts +8 -0
  826. package/dist/presentation/cli/commands/react-command.d.ts.map +1 -0
  827. package/dist/presentation/cli/commands/react-command.js +181 -0
  828. package/dist/presentation/cli/commands/react-command.js.map +1 -0
  829. package/dist/presentation/cli/commands/review-command.d.ts +14 -0
  830. package/dist/presentation/cli/commands/review-command.d.ts.map +1 -0
  831. package/dist/presentation/cli/commands/review-command.js +154 -0
  832. package/dist/presentation/cli/commands/review-command.js.map +1 -0
  833. package/dist/presentation/cli/commands/run-command.d.ts +13 -0
  834. package/dist/presentation/cli/commands/run-command.d.ts.map +1 -0
  835. package/dist/presentation/cli/commands/run-command.js +188 -0
  836. package/dist/presentation/cli/commands/run-command.js.map +1 -0
  837. package/dist/presentation/cli/commands/setup-command.d.ts +10 -0
  838. package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -0
  839. package/dist/presentation/cli/commands/setup-command.js +301 -0
  840. package/dist/presentation/cli/commands/setup-command.js.map +1 -0
  841. package/dist/presentation/cli/commands/smart-command.d.ts +11 -0
  842. package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -0
  843. package/dist/presentation/cli/commands/smart-command.js +517 -0
  844. package/dist/presentation/cli/commands/smart-command.js.map +1 -0
  845. package/dist/presentation/cli/commands/status-command.d.ts +14 -0
  846. package/dist/presentation/cli/commands/status-command.d.ts.map +1 -0
  847. package/dist/presentation/cli/commands/status-command.js +167 -0
  848. package/dist/presentation/cli/commands/status-command.js.map +1 -0
  849. package/dist/presentation/cli/commands/suggest-command.d.ts +11 -0
  850. package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -0
  851. package/dist/presentation/cli/commands/suggest-command.js +138 -0
  852. package/dist/presentation/cli/commands/suggest-command.js.map +1 -0
  853. package/dist/presentation/cli/commands/trace-command.d.ts +8 -0
  854. package/dist/presentation/cli/commands/trace-command.d.ts.map +1 -0
  855. package/dist/presentation/cli/commands/trace-command.js +129 -0
  856. package/dist/presentation/cli/commands/trace-command.js.map +1 -0
  857. package/dist/presentation/cli/commands/trust-command.d.ts +28 -0
  858. package/dist/presentation/cli/commands/trust-command.d.ts.map +1 -0
  859. package/dist/presentation/cli/commands/trust-command.js +301 -0
  860. package/dist/presentation/cli/commands/trust-command.js.map +1 -0
  861. package/dist/presentation/cli/commands/undo-command.d.ts +8 -0
  862. package/dist/presentation/cli/commands/undo-command.d.ts.map +1 -0
  863. package/dist/presentation/cli/commands/undo-command.js +150 -0
  864. package/dist/presentation/cli/commands/undo-command.js.map +1 -0
  865. package/dist/presentation/cli/error-display.d.ts +25 -0
  866. package/dist/presentation/cli/error-display.d.ts.map +1 -0
  867. package/dist/presentation/cli/error-display.js +340 -0
  868. package/dist/presentation/cli/error-display.js.map +1 -0
  869. package/dist/query-optimizer.d.ts +32 -0
  870. package/dist/query-optimizer.d.ts.map +1 -0
  871. package/dist/query-optimizer.js +205 -0
  872. package/dist/query-optimizer.js.map +1 -0
  873. package/dist/refactor.d.ts +27 -0
  874. package/dist/refactor.d.ts.map +1 -0
  875. package/dist/refactor.js +116 -0
  876. package/dist/refactor.js.map +1 -0
  877. package/dist/review 2.js +206 -0
  878. package/dist/review.d.ts +31 -0
  879. package/dist/review.d.ts.map +1 -0
  880. package/dist/review.js +206 -0
  881. package/dist/review.js.map +1 -0
  882. package/dist/search.d.ts +19 -0
  883. package/dist/search.d.ts.map +1 -0
  884. package/dist/search.js +193 -0
  885. package/dist/search.js 2.map +1 -0
  886. package/dist/search.js.map +1 -0
  887. package/dist/session 2.js +593 -0
  888. package/dist/session.d.ts +17 -0
  889. package/dist/session.d.ts 2.map +1 -0
  890. package/dist/session.d.ts.map +1 -0
  891. package/dist/session.js +593 -0
  892. package/dist/session.js.map +1 -0
  893. package/dist/task-verification 2.js +336 -0
  894. package/dist/task-verification.d.ts +39 -0
  895. package/dist/task-verification.d.ts 2.map +1 -0
  896. package/dist/task-verification.d.ts.map +1 -0
  897. package/dist/task-verification.js +336 -0
  898. package/dist/task-verification.js.map +1 -0
  899. package/dist/test-minimal.d.ts +2 -0
  900. package/dist/test-minimal.d.ts.map +1 -0
  901. package/dist/test-minimal.js +2 -0
  902. package/dist/test-minimal.js.map +1 -0
  903. package/dist/testgen.d.ts +24 -0
  904. package/dist/testgen.d.ts.map +1 -0
  905. package/dist/testgen.js +166 -0
  906. package/dist/testgen.js 2.map +1 -0
  907. package/dist/testgen.js.map +1 -0
  908. package/dist/token-optimizer.d 2.ts +20 -0
  909. package/dist/token-optimizer.d.ts +20 -0
  910. package/dist/token-optimizer.d.ts.map +1 -0
  911. package/dist/token-optimizer.js +282 -0
  912. package/dist/token-optimizer.js.map +1 -0
  913. package/dist/tools/bash.d.ts +53 -0
  914. package/dist/tools/bash.d.ts.map +1 -0
  915. package/dist/tools/bash.js +213 -0
  916. package/dist/tools/bash.js.map +1 -0
  917. package/dist/tools/edit.d.ts +48 -0
  918. package/dist/tools/edit.d.ts.map +1 -0
  919. package/dist/tools/edit.js +235 -0
  920. package/dist/tools/edit.js.map +1 -0
  921. package/dist/tools/executor.d.ts +29 -0
  922. package/dist/tools/executor.d.ts.map +1 -0
  923. package/dist/tools/executor.js +153 -0
  924. package/dist/tools/executor.js.map +1 -0
  925. package/dist/tools/git-tool.d.ts +87 -0
  926. package/dist/tools/git-tool.d.ts.map +1 -0
  927. package/dist/tools/git-tool.js +292 -0
  928. package/dist/tools/git-tool.js.map +1 -0
  929. package/dist/tools/parser.d.ts +33 -0
  930. package/dist/tools/parser.d.ts.map +1 -0
  931. package/dist/tools/parser.js +158 -0
  932. package/dist/tools/parser.js.map +1 -0
  933. package/dist/tools/registry.d.ts +74 -0
  934. package/dist/tools/registry.d.ts.map +1 -0
  935. package/dist/tools/registry.js +302 -0
  936. package/dist/tools/registry.js.map +1 -0
  937. package/dist/tools/search.d.ts +41 -0
  938. package/dist/tools/search.d.ts.map +1 -0
  939. package/dist/tools/search.js +100 -0
  940. package/dist/tools/search.js.map +1 -0
  941. package/dist/types.d.ts +36 -0
  942. package/dist/types.d.ts.map +1 -0
  943. package/dist/types.js +2 -0
  944. package/dist/types.js.map +1 -0
  945. package/dist/ui.d.ts +60 -0
  946. package/dist/ui.d.ts 2.map +1 -0
  947. package/dist/ui.d.ts.map +1 -0
  948. package/dist/ui.js +334 -0
  949. package/dist/ui.js.map +1 -0
  950. package/dist/utils/check-api-status.d.ts +12 -0
  951. package/dist/utils/check-api-status.d.ts.map +1 -0
  952. package/dist/utils/check-api-status.js +82 -0
  953. package/dist/utils/check-api-status.js.map +1 -0
  954. package/dist/utils/debug.d.ts +7 -0
  955. package/dist/utils/debug.d.ts.map +1 -0
  956. package/dist/utils/debug.js +24 -0
  957. package/dist/utils/debug.js.map +1 -0
  958. package/dist/utils/diff-parser.d.ts +22 -0
  959. package/dist/utils/diff-parser.d.ts.map +1 -0
  960. package/dist/utils/diff-parser.js +192 -0
  961. package/dist/utils/diff-parser.js.map +1 -0
  962. package/dist/utils/provider-check.d.ts +21 -0
  963. package/dist/utils/provider-check.d.ts.map +1 -0
  964. package/dist/utils/provider-check.js +124 -0
  965. package/dist/utils/provider-check.js.map +1 -0
  966. package/dist/utils/version.d.ts +21 -0
  967. package/dist/utils/version.d.ts.map +1 -0
  968. package/dist/utils/version.js +52 -0
  969. package/dist/utils/version.js.map +1 -0
  970. package/dist/verification/backup.d.ts +30 -0
  971. package/dist/verification/backup.d.ts.map +1 -0
  972. package/dist/verification/backup.js +259 -0
  973. package/dist/verification/backup.js.map +1 -0
  974. package/dist/verification/compiler.d.ts +20 -0
  975. package/dist/verification/compiler.d.ts.map +1 -0
  976. package/dist/verification/compiler.js +263 -0
  977. package/dist/verification/compiler.js.map +1 -0
  978. package/dist/verification/index.d.ts +59 -0
  979. package/dist/verification/index.d.ts.map +1 -0
  980. package/dist/verification/index.js +273 -0
  981. package/dist/verification/index.js.map +1 -0
  982. package/dist/verification/test-runner.d.ts +27 -0
  983. package/dist/verification/test-runner.d.ts.map +1 -0
  984. package/dist/verification/test-runner.js +379 -0
  985. package/dist/verification/test-runner.js.map +1 -0
  986. package/dist/verify_db.d.ts +2 -0
  987. package/dist/verify_db.d.ts.map +1 -0
  988. package/dist/verify_db.js +52 -0
  989. package/dist/verify_db.js 2.map +1 -0
  990. package/dist/verify_db.js.map +1 -0
  991. package/package.json +125 -0
@@ -0,0 +1,1551 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { config } from 'dotenv';
4
+ import { join, dirname } from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { existsSync } from 'fs';
7
+ import { indexRepositoryParallel } from './embed.js';
8
+ import { executeAskCommand } from './presentation/cli/commands/ask-command.js';
9
+ import { executeReactCommand } from './presentation/cli/commands/react-command.js';
10
+ import { executeSmartCommand } from './presentation/cli/commands/smart-command.js';
11
+ import { executeFixCommand } from './presentation/cli/commands/fix-command.js';
12
+ import { executeSetupCommand } from './presentation/cli/commands/setup-command.js';
13
+ import { executeConfigCommand } from './presentation/cli/commands/config-command.js';
14
+ import { executeHelpCommand } from './presentation/cli/commands/help-command.js';
15
+ import { initLogFile, logEntry } from './log.js';
16
+ import { checkProviderConfiguration, displayProviderError } from './utils/provider-check.js';
17
+ import { performHealthCheck, formatHealthStatus, getMetrics } from './monitoring.js';
18
+ import { refactorMultiFile, findFilesByPattern } from './refactor.js';
19
+ import { getGitStatus, formatGitStatus, getAllGitDiffs, analyzeDiff, getGitDiff } from './git.js';
20
+ import { executePlanCommand } from './presentation/cli/commands/plan-command.js';
21
+ import { executeOrchestrateCommand } from './presentation/cli/commands/orchestrate-command.js';
22
+ import { executeDocsCommand } from './presentation/cli/commands/docs-command.js';
23
+ import { executeProductCommand } from './presentation/cli/commands/product-command.js';
24
+ import { executeStatusCommand } from './presentation/cli/commands/status-command.js';
25
+ import { executeSuggestCommand } from './presentation/cli/commands/suggest-command.js';
26
+ import { executeCostCommand } from './presentation/cli/commands/cost-command.js';
27
+ import { executeTrustCommand } from './presentation/cli/commands/trust-command.js';
28
+ // TEMP DISABLED: Context command triggers WASM hang via SQLiteContextRepository
29
+ // import { executeContextImportCommand, executeContextExportCommand, executeContextStatsCommand } from './presentation/cli/commands/context-command.js';
30
+ import { executeRunCommand } from './presentation/cli/commands/run-command.js';
31
+ import { executeModelsCommand } from './presentation/cli/commands/models-command.js';
32
+ import { executeReviewCommand } from './presentation/cli/commands/review-command.js';
33
+ import { executeDecisionCommand } from './presentation/cli/commands/decision-command.js';
34
+ import { executeKnowledgeCommand } from './presentation/cli/commands/knowledge-command.js';
35
+ import { executeLearningDashboardCommand } from './presentation/cli/commands/learning-dashboard-command.js';
36
+ import { executeTraceCommand } from './presentation/cli/commands/trace-command.js';
37
+ import { executeUndoCommand } from './presentation/cli/commands/undo-command.js';
38
+ import { executeAuditCommand } from './presentation/cli/commands/audit-command.js';
39
+ import { reviewFile, formatReview } from './review.js';
40
+ import { formatLearningInsights, getPerformanceInsights } from './learning.js';
41
+ import { getCacheStats, clearAllCaches } from './cache.js';
42
+ import { planMigration, formatMigrationPlan } from './migrate.js';
43
+ import { generateTests, getTestFilePath, saveTests, improveTests } from './testgen.js';
44
+ import { startSession } from './session.js';
45
+ import { cleanResponse } from './formatter.js';
46
+ import { displayError } from './presentation/cli/error-display.js';
47
+ import { getTelemetryService } from './infrastructure/telemetry/telemetry-service.js';
48
+ import { colors, createSpinner, createBanner, createTable, success, error, warning, info, formatPath, formatNumber, sectionHeader, newline, createWelcomeMessage, isMinimalStyle, printMinimalHeader, } from './ui.js';
49
+ // Load environment variables - try agent directory first, then current directory
50
+ try {
51
+ const __filename = fileURLToPath(import.meta.url);
52
+ const __dirname = dirname(__filename);
53
+ const agentDir = join(__dirname, '..');
54
+ config({ path: join(agentDir, '.env') });
55
+ }
56
+ catch {
57
+ // Fallback to current directory
58
+ }
59
+ config(); // Also try current directory
60
+ // Import centralized version utility
61
+ import { getVersion } from './utils/version.js';
62
+ const program = new Command();
63
+ program
64
+ .name('codehere')
65
+ .description('AI-powered coding assistant with local embeddings and semantic search')
66
+ .version(getVersion())
67
+ .configureHelp({
68
+ helpWidth: 80,
69
+ sortSubcommands: true,
70
+ })
71
+ .addHelpText('beforeAll', () => {
72
+ return createWelcomeMessage();
73
+ });
74
+ // Smart routing: if query provided as argument, route intelligently
75
+ program
76
+ .argument('[query]', 'Your query - Codehere will understand what you need')
77
+ .option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
78
+ .option('--quick', 'Quick mode - work without indexing by reading files directly')
79
+ .option('-c, --continue', 'Continue from previous conversation (session continuity)')
80
+ .option('-m, --model <model>', 'Specify AI model (e.g., gpt-4, claude-3, command-r-plus, llama3)')
81
+ .action(async (query, options) => {
82
+ if (query && query.trim()) {
83
+ // Direct query - use intelligent router
84
+ initLogFile();
85
+ // Check for valid AI provider (supports Cohere, OpenAI, OpenRouter, Local, Fake)
86
+ const providerCheck = checkProviderConfiguration();
87
+ if (!providerCheck.hasValidProvider) {
88
+ displayProviderError(providerCheck);
89
+ process.exit(1);
90
+ }
91
+ try {
92
+ const opts = program.opts();
93
+ // Set model in environment if specified
94
+ if (opts.model) {
95
+ process.env.CODEHERE_MODEL = opts.model;
96
+ }
97
+ await executeSmartCommand(query.trim(), {
98
+ review: opts.review || false,
99
+ quick: opts.quick || false,
100
+ continue: opts.continue || false,
101
+ model: opts.model,
102
+ });
103
+ logEntry({
104
+ timestamp: new Date().toISOString(),
105
+ command: 'smart',
106
+ query: query.trim(),
107
+ policyStatus: 'allowed',
108
+ });
109
+ }
110
+ catch (err) {
111
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
112
+ process.exit(1);
113
+ }
114
+ }
115
+ else if (process.stdin.isTTY) {
116
+ // Interactive mode - start session
117
+ await startSession();
118
+ }
119
+ else {
120
+ // Non-interactive - show help
121
+ console.log(createWelcomeMessage());
122
+ newline();
123
+ console.log(colors.bold('Usage:'));
124
+ newline();
125
+ console.log(colors.cyan(' codehere "<your query>"') + ' Ask anything - Codehere understands');
126
+ console.log(colors.cyan(' codehere') + ' Start interactive session');
127
+ console.log(colors.cyan(' codehere index') + ' Build embeddings index');
128
+ newline();
129
+ console.log(colors.dim('Examples:'));
130
+ console.log(colors.dim(' codehere "How does authentication work?"'));
131
+ console.log(colors.dim(' codehere "Explain src/auth.ts"'));
132
+ console.log(colors.dim(' codehere "Fix src/utils.ts add error handling"'));
133
+ newline();
134
+ console.log(colors.dim('Run "codehere --help" for all commands'));
135
+ newline();
136
+ }
137
+ });
138
+ program
139
+ .command('setup')
140
+ .description('Interactive setup wizard for first-time users')
141
+ .option('-f, --force', 'Force reconfiguration even if already set up')
142
+ .action(async (options) => {
143
+ await executeSetupCommand(options.force || false);
144
+ });
145
+ program
146
+ .command('config')
147
+ .description('Manage configuration and preferences')
148
+ .argument('[action]', 'Action: show, get, set, reset')
149
+ .argument('[key]', 'Preference key (for get/set)')
150
+ .argument('[value]', 'Preference value (for set)')
151
+ .action(async (action, key, value) => {
152
+ await executeConfigCommand(action, key, value);
153
+ });
154
+ program
155
+ .command('models')
156
+ .description('List, search, and get info about available AI models')
157
+ .option('-l, --list', 'List all available models')
158
+ .option('-s, --search <query>', 'Search models by name or ID')
159
+ .option('-i, --info <model-id>', 'Get detailed info about a specific model')
160
+ .option('-p, --provider <provider>', 'Filter by provider (cohere, openai, openrouter, etc.)')
161
+ .option('--json', 'Output in JSON format')
162
+ .action(async (options) => {
163
+ initLogFile();
164
+ try {
165
+ await executeModelsCommand({
166
+ list: options.list,
167
+ search: options.search,
168
+ info: options.info,
169
+ provider: options.provider,
170
+ json: options.json,
171
+ });
172
+ }
173
+ catch (err) {
174
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
175
+ process.exit(1);
176
+ }
177
+ });
178
+ program
179
+ .command('telemetry')
180
+ .description('Manage telemetry settings (opt-in, privacy-first)')
181
+ .option('--enable', 'Enable telemetry')
182
+ .option('--disable', 'Disable telemetry')
183
+ .option('--status', 'Show telemetry status')
184
+ .action(async (options) => {
185
+ const telemetry = getTelemetryService();
186
+ if (options.enable) {
187
+ telemetry.enable();
188
+ console.log(success('Telemetry enabled. Thank you for helping improve Codehere!'));
189
+ console.log(colors.dim('Data is anonymized and no code/content is transmitted.'));
190
+ newline();
191
+ }
192
+ else if (options.disable) {
193
+ telemetry.disable();
194
+ console.log(success('Telemetry disabled.'));
195
+ newline();
196
+ }
197
+ else {
198
+ console.log(colors.bold('Telemetry Status:'));
199
+ newline();
200
+ console.log(telemetry.isEnabled()
201
+ ? success('Enabled (opt-in)')
202
+ : colors.dim('Disabled (set --enable to opt-in)'));
203
+ newline();
204
+ console.log(colors.dim('Telemetry helps us understand usage patterns and improve Codehere.'));
205
+ console.log(colors.dim('All data is anonymized. No code or content is transmitted.'));
206
+ console.log(colors.dim('Enable with: codehere telemetry --enable'));
207
+ newline();
208
+ }
209
+ });
210
+ program
211
+ .command('help')
212
+ .description('Show help for commands')
213
+ .argument('[command]', 'Command name to get help for')
214
+ .action(async (commandName) => {
215
+ await executeHelpCommand(commandName);
216
+ });
217
+ program
218
+ .command('index')
219
+ .description('Build embeddings index of the repository')
220
+ .option('-r, --repo <path>', 'Repository path (default: current directory)')
221
+ .action(async (options) => {
222
+ initLogFile();
223
+ // Check provider configuration (supports all providers)
224
+ const { checkProviderConfiguration, displayProviderError } = await import('./utils/provider-check.js');
225
+ const providerCheck = checkProviderConfiguration();
226
+ if (!providerCheck.hasValidProvider) {
227
+ displayProviderError(providerCheck);
228
+ process.exit(1);
229
+ }
230
+ try {
231
+ if (isMinimalStyle()) {
232
+ console.log(colors.cyan('Indexing codebase...'));
233
+ }
234
+ else {
235
+ console.log(createBanner('Indexing Repository', 'Building semantic search index'));
236
+ }
237
+ newline();
238
+ const repoPath = options.repo || process.cwd();
239
+ // Show progress spinner for indexing
240
+ const spinner = createSpinner('Scanning files...');
241
+ spinner.start();
242
+ const startTime = Date.now();
243
+ // NEW: Use parallel indexing with caching
244
+ await indexRepositoryParallel(repoPath, {
245
+ useCache: true,
246
+ maxConcurrency: 5,
247
+ });
248
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
249
+ spinner.succeed(`Indexed codebase in ${elapsed}s`);
250
+ logEntry({
251
+ timestamp: new Date().toISOString(),
252
+ command: 'index',
253
+ policyStatus: 'allowed',
254
+ });
255
+ newline();
256
+ if (isMinimalStyle()) {
257
+ console.log(success('Indexing complete. Cache written to .codehere-cache/'));
258
+ }
259
+ else {
260
+ console.log(success('Indexing complete!'));
261
+ }
262
+ process.exit(0);
263
+ }
264
+ catch (err) {
265
+ const errorMessage = err instanceof Error ? err.message : String(err);
266
+ // Check for 401 Unauthorized errors
267
+ if (errorMessage.includes('401') || errorMessage.includes('Unauthorized') || errorMessage.includes('no api key')) {
268
+ newline();
269
+ console.error(error('Authentication failed: Invalid or missing API key'));
270
+ newline();
271
+ console.log(colors.bold('Troubleshooting:'));
272
+ console.log(' 1. Verify your COHERE_API_KEY is set correctly:');
273
+ console.log(colors.cyan(' echo $COHERE_API_KEY'));
274
+ console.log(' 2. Check if the key is valid at: https://dashboard.cohere.com/api-keys');
275
+ console.log(' 3. If using a .env file, ensure it\'s loaded (e.g., use dotenv)');
276
+ console.log(' 4. For testing, you can use: CODEHERE_FAKE_AI=1 codehere index');
277
+ newline();
278
+ }
279
+ else {
280
+ console.error(error('Error indexing repository:'), errorMessage);
281
+ }
282
+ process.exit(1);
283
+ }
284
+ });
285
+ program
286
+ .command('ask')
287
+ .description('Ask questions about your codebase using semantic search')
288
+ .argument('<question>', 'The question to ask about your code')
289
+ .option('-q, --quick', 'Quick mode - work without indexing by reading files directly')
290
+ .alias('q')
291
+ .addHelpText('after', `
292
+ Examples:
293
+ $ codehere ask "How does authentication work?"
294
+ $ codehere ask "Where is the user login function?"
295
+ $ codehere q "Explain the database schema"
296
+ $ codehere ask "What does this project do?" --quick
297
+
298
+ This command will:
299
+ • Search your indexed codebase for relevant code
300
+ • Use AI to generate a contextual answer
301
+ • Show which files were used as context
302
+
303
+ Make sure to run "codehere index" first (or use --quick to bypass indexing)!
304
+ `)
305
+ .action(async (question, options) => {
306
+ initLogFile();
307
+ // Check if any valid provider is configured
308
+ const providerCheck = checkProviderConfiguration();
309
+ if (!providerCheck.hasValidProvider) {
310
+ newline();
311
+ console.error(error(providerCheck.message));
312
+ if (providerCheck.setupInstructions) {
313
+ newline();
314
+ console.log(colors.bold('Setup Instructions:'));
315
+ providerCheck.setupInstructions.forEach(instruction => {
316
+ console.log(' ' + instruction);
317
+ });
318
+ }
319
+ newline();
320
+ process.exit(1);
321
+ }
322
+ try {
323
+ await executeAskCommand(question, { quick: options.quick });
324
+ logEntry({
325
+ timestamp: new Date().toISOString(),
326
+ command: 'ask',
327
+ query: question,
328
+ policyStatus: 'allowed',
329
+ });
330
+ }
331
+ catch (err) {
332
+ const errMessage = err instanceof Error ? err.message : String(err);
333
+ // If it's a missing embeddings error, exit with 1
334
+ if (errMessage.includes('No embeddings found')) {
335
+ process.exit(1);
336
+ }
337
+ console.error(error('Error:'), errMessage);
338
+ process.exit(1);
339
+ }
340
+ });
341
+ program
342
+ .command('fix')
343
+ .description('Apply AI-generated code edits to a file')
344
+ .argument('<file>', 'Path to the file to edit')
345
+ .argument('<instruction>', 'Natural language instruction for the edit')
346
+ .alias('edit')
347
+ .option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
348
+ .addHelpText('after', `
349
+ Examples:
350
+ $ codehere fix src/auth.ts "Add error handling for invalid tokens"
351
+ $ codehere fix utils/helpers.js "Rename function foo() to bar()" --review
352
+ $ codehere edit app.js "Add input validation"
353
+
354
+ This command will:
355
+ • Generate a unified diff using AI
356
+ • Apply safety policy checks
357
+ • Apply the changes to your file
358
+ • Log the operation for audit
359
+
360
+ Options:
361
+ --review Enable review & feedback capture (used for trust scoring and Validation Mode)
362
+
363
+ Safety policies:
364
+ • Maximum 50 lines changed per edit
365
+ • Cannot edit files in restricted folders (infra/, billing/)
366
+ • Only one file can be edited at a time
367
+ `)
368
+ .action(async (file, instruction, options) => {
369
+ initLogFile();
370
+ const providerCheck = checkProviderConfiguration();
371
+ if (!providerCheck.hasValidProvider) {
372
+ newline();
373
+ displayProviderError(providerCheck);
374
+ process.exit(1);
375
+ }
376
+ try {
377
+ // Check if embeddings exist for this repository (skip check if using fake AI for testing)
378
+ if (process.env.CODEHERE_FAKE_AI !== '1') {
379
+ const { container } = await import('./application/services/dependency-container.js');
380
+ const embeddingRepo = container.getEmbeddingRepository(process.cwd());
381
+ const hasEmbeddings = await embeddingRepo.hasEmbeddings();
382
+ if (!hasEmbeddings) {
383
+ newline();
384
+ console.error(colors.red('No embeddings found for this repository.'));
385
+ newline();
386
+ console.log('Run:');
387
+ console.log(colors.cyan(' codehere index'));
388
+ console.log('');
389
+ console.log('then re-run this command.');
390
+ newline();
391
+ process.exit(1);
392
+ }
393
+ }
394
+ await executeFixCommand(file, instruction, { review: options?.review });
395
+ logEntry({
396
+ timestamp: new Date().toISOString(),
397
+ command: 'fix',
398
+ query: instruction,
399
+ filepath: file,
400
+ policyStatus: 'allowed',
401
+ });
402
+ }
403
+ catch (err) {
404
+ displayError(err, {
405
+ operation: 'edit',
406
+ query: instruction,
407
+ filepath: file,
408
+ showSuggestions: true,
409
+ });
410
+ process.exit(1);
411
+ }
412
+ });
413
+ program
414
+ .command('explain')
415
+ .description('Get AI explanation of a code file')
416
+ .argument('<file>', 'Path to the file to explain')
417
+ .alias('e')
418
+ .addHelpText('after', `
419
+ Examples:
420
+ $ codehere explain src/auth.ts
421
+ $ codehere explain utils/helpers.js
422
+ $ codehere e app.js
423
+
424
+ This command will:
425
+ • Read the file content
426
+ • Generate an AI explanation
427
+ • Show file structure, functions, and logic
428
+ `)
429
+ .action(async (file) => {
430
+ initLogFile();
431
+ const providerCheck = checkProviderConfiguration();
432
+ if (!providerCheck.hasValidProvider) {
433
+ newline();
434
+ displayProviderError(providerCheck);
435
+ process.exit(1);
436
+ }
437
+ try {
438
+ // Check if embeddings exist for this repository (skip check if using fake AI for testing)
439
+ if (process.env.CODEHERE_FAKE_AI !== '1') {
440
+ const { container } = await import('./application/services/dependency-container.js');
441
+ const embeddingRepo = container.getEmbeddingRepository(process.cwd());
442
+ const hasEmbeddings = await embeddingRepo.hasEmbeddings();
443
+ if (!hasEmbeddings) {
444
+ newline();
445
+ console.error(colors.red('No embeddings found for this repository.'));
446
+ newline();
447
+ console.log('Run:');
448
+ console.log(colors.cyan(' codehere index'));
449
+ console.log('');
450
+ console.log('then re-run this command.');
451
+ newline();
452
+ process.exit(1);
453
+ }
454
+ }
455
+ if (isMinimalStyle()) {
456
+ printMinimalHeader('explain', file);
457
+ }
458
+ else {
459
+ console.log(createBanner('Explain File', 'AI-powered code explanation'));
460
+ newline();
461
+ }
462
+ const fullPath = join(process.cwd(), file);
463
+ // Check if file exists
464
+ const { existsSync } = await import('fs');
465
+ if (!existsSync(fullPath)) {
466
+ newline();
467
+ console.error(error(`File not found: ${file}`));
468
+ console.log(info(`Looking for: ${fullPath}`));
469
+ console.log(info('Tip: Use a relative path from your current directory'));
470
+ newline();
471
+ process.exit(1);
472
+ }
473
+ // Use clean architecture
474
+ const { container } = await import('./application/services/dependency-container.js');
475
+ const useCase = container.explainFileUseCase;
476
+ const explainSpinner = createSpinner('Generating explanation...');
477
+ explainSpinner.start();
478
+ const result = await useCase.execute({ filepath: file });
479
+ explainSpinner.stop();
480
+ // File info
481
+ const lines = result.fileContent.split('\n').length;
482
+ const size = (result.fileContent.length / 1024).toFixed(2);
483
+ console.log(colors.bold('File:') + ' ' + formatPath(file));
484
+ console.log(colors.dim(` Lines: ${lines} | Size: ${size} KB`));
485
+ newline();
486
+ // Display explanation
487
+ sectionHeader('Explanation');
488
+ const formattedResponse = cleanResponse(result.explanation);
489
+ console.log(formattedResponse);
490
+ newline();
491
+ logEntry({
492
+ timestamp: new Date().toISOString(),
493
+ command: 'explain',
494
+ query: `Explain ${file}`,
495
+ filepath: file,
496
+ policyStatus: 'allowed',
497
+ retrievedFiles: [file],
498
+ });
499
+ }
500
+ catch (err) {
501
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
502
+ process.exit(1);
503
+ }
504
+ });
505
+ program
506
+ .command('health')
507
+ .description('Check system health and metrics')
508
+ .option('-m, --metrics', 'Show detailed metrics')
509
+ .action((options) => {
510
+ const health = performHealthCheck();
511
+ if (isMinimalStyle()) {
512
+ printMinimalHeader('health', '');
513
+ }
514
+ else {
515
+ newline();
516
+ console.log(createBanner('System Health', 'Enterprise monitoring'));
517
+ newline();
518
+ }
519
+ console.log(formatHealthStatus(health));
520
+ if (options.metrics) {
521
+ newline();
522
+ sectionHeader('Metrics');
523
+ const metrics = getMetrics();
524
+ const metricsTable = createTable(['Metric', 'Value'], [
525
+ ['Total Operations', formatNumber(metrics.operations.total)],
526
+ ['Successful', formatNumber(metrics.operations.successful)],
527
+ ['Failed', formatNumber(metrics.operations.failed)],
528
+ ['Retries', formatNumber(metrics.operations.retries)],
529
+ ['Avg Response Time', `${metrics.performance.avgResponseTime.toFixed(2)}ms`],
530
+ ['API Calls', formatNumber(metrics.performance.apiCalls)],
531
+ ['Cache Hits', formatNumber(metrics.performance.cacheHits)],
532
+ ]);
533
+ console.log(metricsTable.toString());
534
+ if (Object.keys(metrics.errors.byType).length > 0) {
535
+ newline();
536
+ sectionHeader('Error Summary');
537
+ const errorTable = createTable(['Error Type', 'Count'], Object.entries(metrics.errors.byType).map(([type, count]) => [
538
+ type,
539
+ formatNumber(count),
540
+ ]));
541
+ console.log(errorTable.toString());
542
+ }
543
+ }
544
+ newline();
545
+ if (health.status === 'unhealthy') {
546
+ process.exit(1);
547
+ }
548
+ });
549
+ program
550
+ .command('refactor')
551
+ .description('Refactor multiple files with coordinated changes')
552
+ .argument('<pattern>', 'File pattern (e.g., "src/**/*.ts") or comma-separated files')
553
+ .argument('<instruction>', 'Refactoring instruction')
554
+ .option('--dry-run', 'Show changes without applying')
555
+ .option('--max-files <number>', 'Maximum files to process', '10')
556
+ .action(async (pattern, instruction, options) => {
557
+ initLogFile();
558
+ const providerCheck = checkProviderConfiguration();
559
+ if (!providerCheck.hasValidProvider) {
560
+ displayProviderError(providerCheck);
561
+ process.exit(1);
562
+ }
563
+ try {
564
+ console.log(createBanner('Multi-File Refactor', 'Enterprise-grade cross-file operations'));
565
+ newline();
566
+ // Parse files from pattern
567
+ let files;
568
+ if (pattern.includes(',')) {
569
+ files = pattern.split(',').map(f => f.trim());
570
+ }
571
+ else {
572
+ files = findFilesByPattern(pattern);
573
+ }
574
+ if (files.length === 0) {
575
+ console.log(warning('No files found matching pattern'));
576
+ return;
577
+ }
578
+ console.log(colors.bold('Files to refactor:'));
579
+ files.slice(0, 10).forEach(f => console.log(colors.cyan(' ' + f)));
580
+ if (files.length > 10) {
581
+ console.log(colors.dim(` ... and ${files.length - 10} more`));
582
+ }
583
+ newline();
584
+ console.log(colors.bold('Instruction:') + ' ' + colors.cyan(instruction));
585
+ newline();
586
+ const maxFiles = parseInt(options.maxFiles || '10', 10);
587
+ const result = await refactorMultiFile(files.slice(0, maxFiles), instruction, {
588
+ dryRun: options.dryRun || false,
589
+ maxFiles,
590
+ });
591
+ // Display results
592
+ sectionHeader('Refactoring Results');
593
+ const resultsTable = createTable(['Metric', 'Value'], [
594
+ ['Files Processed', formatNumber(files.length)],
595
+ ['Files Changed', formatNumber(result.filesChanged.length)],
596
+ ['Total Lines Added', formatNumber(result.totalChanges.linesAdded)],
597
+ ['Total Lines Removed', formatNumber(result.totalChanges.linesRemoved)],
598
+ ['Errors', formatNumber(result.errors.length)],
599
+ ]);
600
+ console.log(resultsTable.toString());
601
+ if (result.errors.length > 0) {
602
+ newline();
603
+ sectionHeader('Errors');
604
+ result.errors.forEach(err => {
605
+ console.log(error(`${err.file}: ${err.error}`));
606
+ });
607
+ }
608
+ if (result.filesChanged.length > 0) {
609
+ newline();
610
+ console.log(success(`Refactoring ${options.dryRun ? 'planned' : 'completed'} successfully`));
611
+ }
612
+ }
613
+ catch (err) {
614
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
615
+ process.exit(1);
616
+ }
617
+ });
618
+ program
619
+ .command('git-review')
620
+ .description('Review git changes and suggest improvements')
621
+ .option('-f, --file <file>', 'Review specific file')
622
+ .action((options) => {
623
+ initLogFile();
624
+ try {
625
+ console.log(createBanner('Git Review', 'Git-aware code analysis'));
626
+ newline();
627
+ const status = getGitStatus();
628
+ if (!status.isRepo) {
629
+ console.log(warning('Not a git repository'));
630
+ return;
631
+ }
632
+ console.log(formatGitStatus(status));
633
+ newline();
634
+ if (!status.hasChanges) {
635
+ console.log(info('No changes to review'));
636
+ return;
637
+ }
638
+ // Get diffs
639
+ const diffs = options.file
640
+ ? (() => {
641
+ const diff = getGitDiff(options.file);
642
+ return diff ? new Map([[options.file, diff]]) : new Map();
643
+ })()
644
+ : getAllGitDiffs();
645
+ if (diffs.size === 0) {
646
+ console.log(info('No diffs found'));
647
+ return;
648
+ }
649
+ sectionHeader('Change Analysis');
650
+ for (const [file, diff] of diffs.entries()) {
651
+ const analysis = analyzeDiff(diff);
652
+ console.log(colors.bold(file));
653
+ console.log(colors.dim(` ${analysis.summary}`));
654
+ console.log(colors.dim(` Risk: ${analysis.riskLevel.toUpperCase()}`));
655
+ if (analysis.suggestions.length > 0) {
656
+ console.log(colors.yellow(' Suggestions:'));
657
+ analysis.suggestions.forEach(s => {
658
+ console.log(colors.yellow(` - ${s}`));
659
+ });
660
+ }
661
+ newline();
662
+ }
663
+ }
664
+ catch (err) {
665
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
666
+ process.exit(1);
667
+ }
668
+ });
669
+ program
670
+ .command('plan')
671
+ .description('Plan a complex multi-step task')
672
+ .argument('<instruction>', 'Complex instruction to plan')
673
+ .option('-e, --execute', 'Execute the plan after creating it')
674
+ .option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
675
+ .action(async (instruction, options) => {
676
+ initLogFile();
677
+ const providerCheck = checkProviderConfiguration();
678
+ if (!providerCheck.hasValidProvider) {
679
+ displayProviderError(providerCheck);
680
+ process.exit(1);
681
+ }
682
+ try {
683
+ if (isMinimalStyle()) {
684
+ printMinimalHeader('plan', instruction);
685
+ }
686
+ else {
687
+ console.log(createBanner('Task Planning', 'Intelligent multi-step execution'));
688
+ newline();
689
+ console.log(colors.bold('Instruction:') + ' ' + colors.cyan(instruction));
690
+ }
691
+ newline();
692
+ // Use new memory-based planning
693
+ await executePlanCommand(instruction, { execute: options.execute, review: options.review });
694
+ }
695
+ catch (err) {
696
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
697
+ process.exit(1);
698
+ }
699
+ });
700
+ program
701
+ .command('decision')
702
+ .description('Record and query architectural/design decisions')
703
+ .argument('<action>', 'Action: record, list, query, or explain')
704
+ .argument('[args...]', 'Arguments for the action')
705
+ .option('-c, --codebase <path>', 'Codebase path (default: current directory)')
706
+ .option('-t, --type <type>', 'Decision type filter (for list)')
707
+ .option('-l, --limit <number>', 'Limit number of results', '10')
708
+ .action(async (action, args, options) => {
709
+ initLogFile();
710
+ try {
711
+ await executeDecisionCommand(action, args, {
712
+ codebase: options.codebase,
713
+ type: options.type,
714
+ limit: options.limit ? parseInt(options.limit, 10) : undefined,
715
+ });
716
+ }
717
+ catch (err) {
718
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
719
+ process.exit(1);
720
+ }
721
+ });
722
+ program
723
+ .command('knowledge')
724
+ .description('Query and manage preserved knowledge from codebase')
725
+ .argument('<action>', 'Action: query, list, summary, or extract')
726
+ .argument('[args...]', 'Arguments for the action')
727
+ .option('-c, --codebase <path>', 'Codebase path (default: current directory)')
728
+ .option('-t, --type <type>', 'Knowledge type filter (for list)')
729
+ .option('--tags <tags>', 'Comma-separated tags (for list)')
730
+ .option('-l, --limit <number>', 'Limit number of results', '10')
731
+ .action(async (action, args, options) => {
732
+ initLogFile();
733
+ try {
734
+ await executeKnowledgeCommand(action, args, {
735
+ codebase: options.codebase,
736
+ type: options.type,
737
+ tags: options.tags ? options.tags.split(',') : undefined,
738
+ limit: options.limit ? parseInt(options.limit, 10) : undefined,
739
+ });
740
+ }
741
+ catch (err) {
742
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
743
+ process.exit(1);
744
+ }
745
+ });
746
+ program
747
+ .command('learning')
748
+ .description('Learning dashboard - View patterns, knowledge, and insights')
749
+ .argument('<action>', 'Action: overview, patterns, knowledge, or insights')
750
+ .option('-c, --codebase <path>', 'Codebase path (default: current directory)')
751
+ .action(async (action, options) => {
752
+ initLogFile();
753
+ try {
754
+ await executeLearningDashboardCommand(action, options.codebase);
755
+ }
756
+ catch (err) {
757
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
758
+ process.exit(1);
759
+ }
760
+ });
761
+ program
762
+ .command('review-file')
763
+ .description('Automated code review for a file')
764
+ .argument('<file>', 'File to review')
765
+ .action(async (file) => {
766
+ initLogFile();
767
+ const providerCheck = checkProviderConfiguration();
768
+ if (!providerCheck.hasValidProvider) {
769
+ displayProviderError(providerCheck);
770
+ process.exit(1);
771
+ }
772
+ try {
773
+ if (isMinimalStyle()) {
774
+ console.log(colors.bold(`Review: ${file}`));
775
+ newline();
776
+ }
777
+ else {
778
+ console.log(createBanner('Code Review', 'Automated senior-level analysis'));
779
+ newline();
780
+ }
781
+ const reviewSpinner = createSpinner('Reviewing code...');
782
+ reviewSpinner.start();
783
+ const review = await reviewFile(file);
784
+ reviewSpinner.stop();
785
+ newline();
786
+ if (isMinimalStyle()) {
787
+ console.log(colors.bold('Findings:'));
788
+ console.log(formatReview(review));
789
+ newline();
790
+ console.log(colors.dim(`Score: ${review.score}/100`));
791
+ }
792
+ else {
793
+ console.log(formatReview(review));
794
+ // Display score
795
+ newline();
796
+ sectionHeader('Review Score');
797
+ const scoreTable = createTable(['Metric', 'Value'], [
798
+ ['Overall Score', `${review.score}/100`],
799
+ ['Errors', formatNumber(review.issues.filter(i => i.severity === 'error').length)],
800
+ ['Warnings', formatNumber(review.issues.filter(i => i.severity === 'warning').length)],
801
+ ['Info', formatNumber(review.issues.filter(i => i.severity === 'info').length)],
802
+ ]);
803
+ console.log(scoreTable.toString());
804
+ }
805
+ }
806
+ catch (err) {
807
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
808
+ process.exit(1);
809
+ }
810
+ });
811
+ program
812
+ .command('learn')
813
+ .description('Show learning insights and performance recommendations')
814
+ .action(() => {
815
+ try {
816
+ console.log(createBanner('Learning Insights', 'Self-improvement system'));
817
+ newline();
818
+ const insights = formatLearningInsights();
819
+ console.log(insights);
820
+ const perfInsights = getPerformanceInsights();
821
+ if (perfInsights.recommendations.length > 0) {
822
+ sectionHeader('Performance Recommendations');
823
+ perfInsights.recommendations.forEach(rec => {
824
+ console.log(info(rec));
825
+ });
826
+ }
827
+ const cacheStats = getCacheStats();
828
+ newline();
829
+ sectionHeader('Cache Statistics');
830
+ const cacheTable = createTable(['Metric', 'Value'], [
831
+ ['Memory Cache', `${cacheStats.memorySize}/${cacheStats.memoryMaxSize}`],
832
+ ['File Cache', formatNumber(cacheStats.fileCacheCount)],
833
+ ]);
834
+ console.log(cacheTable.toString());
835
+ }
836
+ catch (err) {
837
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
838
+ process.exit(1);
839
+ }
840
+ });
841
+ program
842
+ .command('cache')
843
+ .description('Manage cache')
844
+ .option('--clear', 'Clear all caches')
845
+ .option('--stats', 'Show cache statistics')
846
+ .action((options) => {
847
+ if (options.clear) {
848
+ clearAllCaches();
849
+ console.log(success('All caches cleared'));
850
+ }
851
+ else if (options.stats) {
852
+ const stats = getCacheStats();
853
+ sectionHeader('Cache Statistics');
854
+ const cacheTable = createTable(['Metric', 'Value'], [
855
+ ['Memory Cache', `${stats.memorySize}/${stats.memoryMaxSize}`],
856
+ ['File Cache', formatNumber(stats.fileCacheCount)],
857
+ ]);
858
+ console.log(cacheTable.toString());
859
+ }
860
+ else {
861
+ console.log(info('Use --clear to clear caches or --stats to show statistics'));
862
+ }
863
+ });
864
+ program
865
+ .command('migrate')
866
+ .description('Plan and execute framework migrations')
867
+ .argument('<from>', 'Source framework/version')
868
+ .argument('<to>', 'Target framework/version')
869
+ .option('-f, --files <files...>', 'Specific files to migrate')
870
+ .option('--plan-only', 'Only show migration plan, do not execute')
871
+ .action(async (from, to, options) => {
872
+ initLogFile();
873
+ const providerCheck = checkProviderConfiguration();
874
+ if (!providerCheck.hasValidProvider) {
875
+ displayProviderError(providerCheck);
876
+ process.exit(1);
877
+ }
878
+ try {
879
+ console.log(createBanner('Migration Assistant', `From ${from} to ${to}`));
880
+ newline();
881
+ const plan = await planMigration(from, to, options.files);
882
+ sectionHeader('Migration Plan');
883
+ console.log(formatMigrationPlan(plan));
884
+ if (!options.planOnly) {
885
+ newline();
886
+ console.log(info('Migration execution coming soon...'));
887
+ }
888
+ }
889
+ catch (err) {
890
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
891
+ process.exit(1);
892
+ }
893
+ });
894
+ // DocumentationAgent-based docs command
895
+ program
896
+ .command('docs')
897
+ .description('Generate documentation using DocumentationAgent')
898
+ .argument('<generate>', 'Command: generate')
899
+ .argument('<type>', 'Documentation type: readme, api, or all')
900
+ .option('--target <dir>', 'Target directory for API docs (default: src)')
901
+ .option('--update-existing', 'Update existing documentation files')
902
+ .option('--output <path>', 'Output path for generated docs')
903
+ .option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
904
+ .addHelpText('after', `
905
+ Examples:
906
+ $ codehere docs generate readme
907
+ $ codehere docs generate api --target src
908
+ $ codehere docs generate all --update-existing
909
+ $ codehere docs generate readme --review
910
+
911
+ Warning: This command may modify README.md and docs/api.md files.
912
+ `)
913
+ .action(async (cmd, type, options) => {
914
+ if (cmd !== 'generate') {
915
+ console.error(error(`Unknown command: ${cmd}. Use 'generate' to create documentation.`));
916
+ process.exit(1);
917
+ }
918
+ const providerCheck = checkProviderConfiguration();
919
+ if (!providerCheck.hasValidProvider) {
920
+ displayProviderError(providerCheck);
921
+ process.exit(1);
922
+ }
923
+ initLogFile();
924
+ await executeDocsCommand(type, {
925
+ target: options.target,
926
+ updateExisting: options.updateExisting,
927
+ outputPath: options.output,
928
+ review: Boolean(options.review),
929
+ });
930
+ });
931
+ // ProductRequirementsAgent-based product command
932
+ program
933
+ .command('product')
934
+ .description('Generate product requirements documents using ProductRequirementsAgent')
935
+ .argument('<spec>', 'Command: spec')
936
+ .argument('<goal>', 'Product goal or feature description')
937
+ .option('--format <format>', 'Output format: markdown, json, or both', 'both')
938
+ .option('--output <path>', 'Output path for generated PRD (optional)')
939
+ .option('--detail <level>', 'Detail level: low, medium, or high', 'medium')
940
+ .option('--include-technical-spec', 'Include technical specification document')
941
+ .option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
942
+ .addHelpText('after', `
943
+ Examples:
944
+ $ codehere product spec "Add team dashboards for executive reporting"
945
+ $ codehere product spec "Build user authentication system" --format markdown --output prd.md
946
+ $ codehere product spec "Implement payment gateway" --detail high --include-technical-spec --review
947
+
948
+ Warning: This command may create new files if --output is specified.
949
+ `)
950
+ .action(async (cmd, goal, options) => {
951
+ if (cmd !== 'spec') {
952
+ console.error(error(`Unknown command: ${cmd}. Use 'spec' to generate product requirements.`));
953
+ process.exit(1);
954
+ }
955
+ const providerCheck = checkProviderConfiguration();
956
+ if (!providerCheck.hasValidProvider) {
957
+ displayProviderError(providerCheck);
958
+ process.exit(1);
959
+ }
960
+ initLogFile();
961
+ // Note: --review flag is defined on parent 'product' command, not 'spec' subcommand
962
+ // In commander.js, parent command options may not be merged into subcommand options
963
+ // So we check both options.review (subcommand) and program.opts().review (parent command)
964
+ // This ensures --review works correctly for 'product spec' commands
965
+ const reviewValue = options.review !== undefined ? options.review : program.opts().review;
966
+ await executeProductCommand(goal, {
967
+ format: options.format,
968
+ output: options.output,
969
+ detail: options.detail,
970
+ includeTechnicalSpec: options.includeTechnicalSpec || false,
971
+ review: Boolean(reviewValue),
972
+ });
973
+ });
974
+ // Status command
975
+ program
976
+ .command('status')
977
+ .description('Show system status and optionally list recent tasks')
978
+ .option('--json', 'Output machine-readable JSON summary instead of text')
979
+ .option('--tasks', 'Show recent tasks (experimental)')
980
+ .option('--env', 'Show environment details')
981
+ .option('--track', 'Show what works (success rates by command)')
982
+ .action(async (options) => {
983
+ await executeStatusCommand({
984
+ json: Boolean(options.json),
985
+ tasks: Boolean(options.tasks),
986
+ env: Boolean(options.env),
987
+ track: Boolean(options.track),
988
+ });
989
+ });
990
+ // Cost tracking command - doesn't require API key
991
+ program
992
+ .command('cost')
993
+ .description('View API cost tracking and budget status (local estimates)')
994
+ .argument('[action]', 'Action: status, summary, run, reset', 'status')
995
+ .argument('[runId]', 'Run ID (for "run" action)')
996
+ .action(async (action, runId) => {
997
+ await executeCostCommand(action, runId);
998
+ });
999
+ // Trust dashboard command - shows agent reliability metrics
1000
+ program
1001
+ .command('trust')
1002
+ .description('View agent reliability and trust metrics')
1003
+ .argument('[action]', 'Action: status, history, reset', 'status')
1004
+ .option('--json', 'Output in JSON format')
1005
+ .option('--limit <n>', 'Limit history entries', '20')
1006
+ .action(async (action, options) => {
1007
+ await executeTrustCommand(action, {
1008
+ json: options.json,
1009
+ limit: options.limit ? parseInt(options.limit, 10) : undefined,
1010
+ });
1011
+ });
1012
+ // TEMP DISABLED: Context commands trigger WASM hang via SQLiteContextRepository
1013
+ // See: commit bc9cd03 fix(P0): Disable context-command to prevent WASM hang blocking CLI
1014
+ /*
1015
+ // Context continuity commands - import, export, stats
1016
+ // Use addCommand for proper subcommand handling
1017
+ const contextImportCmd = new Command('import')
1018
+ .description('Import conversation context from other AI tools')
1019
+ .requiredOption('--from <source>', 'Import source: claude-code, opencode, cursor, or file')
1020
+ .option('--session <id>', 'Session ID (default: latest)', 'latest')
1021
+ .option('--file <path>', 'File path (required for file import)')
1022
+ .option('--project <path>', 'Project path override')
1023
+ .addHelpText('after', `
1024
+ Examples:
1025
+ $ codehere context import --from claude-code --session latest
1026
+ $ codehere context import --from claude-code --session <session-id>
1027
+ $ codehere context import --from opencode
1028
+ $ codehere context import --from cursor
1029
+ $ codehere context import --from file --file ./context.json
1030
+
1031
+ Context continuity allows you to:
1032
+ • Import conversations from Claude Code, OpenCode, or Cursor
1033
+ • Continue conversations across different AI tools
1034
+ • Preserve context when switching providers
1035
+ `)
1036
+ .action(async function(this: Command) {
1037
+ initLogFile();
1038
+
1039
+ try {
1040
+ // Use 'this' context to access command options in Commander.js subcommands
1041
+ const from = this.getOptionValue('from');
1042
+ const session = this.getOptionValue('session') || 'latest';
1043
+ const file = this.getOptionValue('file');
1044
+ const project = this.getOptionValue('project');
1045
+
1046
+ if (!from) {
1047
+ console.error(error('--from is required for import'));
1048
+ console.log(info('Usage: codehere context import --from <source> [options]'));
1049
+ process.exit(1);
1050
+ }
1051
+
1052
+ if (from === 'file' && !file) {
1053
+ console.error(error('--file is required when --from=file'));
1054
+ console.log(info('Usage: codehere context import --from file --file <path>'));
1055
+ process.exit(1);
1056
+ }
1057
+
1058
+ await executeContextImportCommand(from, {
1059
+ session,
1060
+ file,
1061
+ project,
1062
+ });
1063
+ } catch (err) {
1064
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1065
+ process.exit(1);
1066
+ }
1067
+ });
1068
+
1069
+ const contextCmd = new Command('context')
1070
+ .description('Manage conversation contexts (import, export, stats)')
1071
+ .addCommand(contextImportCmd);
1072
+
1073
+ const contextExportCmd = new Command('export')
1074
+ .description('Export conversation context to portable format')
1075
+ .option('--session <id>', 'Session ID (default: latest)')
1076
+ .option('--output <path>', 'Output file path')
1077
+ .option('--json', 'Output in JSON format')
1078
+ .addHelpText('after', `
1079
+ Examples:
1080
+ $ codehere context export --session <sessionId> --output ./export.json
1081
+ $ codehere context export --output my-context.json
1082
+ $ codehere context export --session <sessionId> --json
1083
+
1084
+ Exports context to portable JSON format that can be:
1085
+ • Re-imported into Codehere
1086
+ • Shared with team members
1087
+ • Backed up for safekeeping
1088
+ `)
1089
+ .action(async function(this: Command) {
1090
+ initLogFile();
1091
+
1092
+ try {
1093
+ const session = this.getOptionValue('session');
1094
+ const output = this.getOptionValue('output');
1095
+ const json = this.getOptionValue('json');
1096
+
1097
+ await executeContextExportCommand(session, {
1098
+ output,
1099
+ json,
1100
+ });
1101
+ } catch (err) {
1102
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1103
+ process.exit(1);
1104
+ }
1105
+ });
1106
+
1107
+ contextCmd.addCommand(contextExportCmd);
1108
+
1109
+ const contextStatsCmd = new Command('stats')
1110
+ .description('View conversation context statistics')
1111
+ .option('--session <id>', 'Session ID (shows all if not specified)')
1112
+ .option('--json', 'Output in JSON format')
1113
+ .addHelpText('after', `
1114
+ Examples:
1115
+ $ codehere context stats
1116
+ $ codehere context stats --session <sessionId>
1117
+ $ codehere context stats --session <sessionId> --json
1118
+
1119
+ Shows:
1120
+ • Message count and token usage
1121
+ • Compaction history
1122
+ • Model and provider information
1123
+ • Project metadata
1124
+ `)
1125
+ .action(async function(this: Command) {
1126
+ initLogFile();
1127
+
1128
+ try {
1129
+ const session = this.getOptionValue('session');
1130
+ const json = this.getOptionValue('json');
1131
+
1132
+ await executeContextStatsCommand(session, {
1133
+ json,
1134
+ });
1135
+ } catch (err) {
1136
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1137
+ process.exit(1);
1138
+ }
1139
+ });
1140
+
1141
+ contextCmd.addCommand(contextStatsCmd);
1142
+ program.addCommand(contextCmd);
1143
+ */
1144
+ // END TEMP DISABLED context commands
1145
+ // Suggest command - Read-only assistant mode
1146
+ program
1147
+ .command('suggest')
1148
+ .description('Read-only assistant mode - ask questions and get explanations without making changes')
1149
+ .argument('<query>', 'The question or request')
1150
+ .option('--file <file>', 'Focus on a specific file')
1151
+ .addHelpText('after', `
1152
+ Examples:
1153
+ $ codehere suggest "How does authentication work?"
1154
+ $ codehere suggest "Explain this function" --file src/auth.ts
1155
+
1156
+ This command:
1157
+ • Searches your codebase for relevant code
1158
+ • Provides contextual answers and explanations
1159
+ • Does NOT make any changes (read-only mode)
1160
+ • Creates a task record for tracking
1161
+ `)
1162
+ .action(async (query, options) => {
1163
+ initLogFile();
1164
+ const providerCheck = checkProviderConfiguration();
1165
+ if (!providerCheck.hasValidProvider) {
1166
+ displayProviderError(providerCheck);
1167
+ process.exit(1);
1168
+ }
1169
+ try {
1170
+ await executeSuggestCommand(query, {
1171
+ file: options.file,
1172
+ stream: false,
1173
+ });
1174
+ logEntry({
1175
+ timestamp: new Date().toISOString(),
1176
+ command: 'suggest',
1177
+ query,
1178
+ policyStatus: 'allowed',
1179
+ });
1180
+ }
1181
+ catch (err) {
1182
+ const errMessage = err instanceof Error ? err.message : String(err);
1183
+ // If it's a missing embeddings error, exit with 1 (message already shown)
1184
+ if (errMessage.includes('No embeddings found')) {
1185
+ process.exit(1);
1186
+ }
1187
+ console.error(error('Error:'), errMessage);
1188
+ process.exit(1);
1189
+ }
1190
+ });
1191
+ // Run command - Unified agentic execution
1192
+ program
1193
+ .command('run')
1194
+ .description('Unified agentic execution - execute a task or goal')
1195
+ .argument('<goal>', 'The goal to execute')
1196
+ .option('--task-id <id>', 'Continue execution of an existing task')
1197
+ .option('--file <file>', 'Focus on a specific file')
1198
+ .option('--files <files>', 'Comma-separated list of files to process')
1199
+ .option('--review', 'Enable review before applying changes')
1200
+ .addHelpText('after', `
1201
+ Examples:
1202
+ $ codehere run "Add error handling to the login function"
1203
+ $ codehere run "Refactor authentication module" --file src/auth.ts
1204
+ $ codehere run "Fix bug in payment processing" --task-id task-12345
1205
+
1206
+ This command:
1207
+ • Creates a plan for the goal
1208
+ • Executes the plan step-by-step
1209
+ • Creates/updates task records for tracking
1210
+ • Shows risk tier and environment mode (advisory)
1211
+ `)
1212
+ .action(async (goal, options) => {
1213
+ initLogFile();
1214
+ const providerCheck = checkProviderConfiguration();
1215
+ if (!providerCheck.hasValidProvider) {
1216
+ displayProviderError(providerCheck);
1217
+ process.exit(1);
1218
+ }
1219
+ try {
1220
+ const files = options.files ? options.files.split(',').map((f) => f.trim()) : undefined;
1221
+ await executeRunCommand(goal, {
1222
+ taskId: options.taskId,
1223
+ file: options.file,
1224
+ files,
1225
+ review: Boolean(options.review),
1226
+ });
1227
+ logEntry({
1228
+ timestamp: new Date().toISOString(),
1229
+ command: 'run',
1230
+ query: goal,
1231
+ policyStatus: 'allowed',
1232
+ });
1233
+ }
1234
+ catch (err) {
1235
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1236
+ process.exit(1);
1237
+ }
1238
+ });
1239
+ // Review command - Task review interface
1240
+ program
1241
+ .command('review')
1242
+ .description('Review and approve/reject tasks')
1243
+ .argument('[task-id]', 'Task ID to review (omit to list tasks)')
1244
+ .option('--list', 'List tasks needing review')
1245
+ .option('--approve', 'Approve the task')
1246
+ .option('--reject', 'Reject the task')
1247
+ .option('--comment <text>', 'Add a comment to the review')
1248
+ .option('--all', 'Show all completed tasks in list mode')
1249
+ .addHelpText('after', `
1250
+ Examples:
1251
+ $ codehere review --list
1252
+ $ codehere review task-12345
1253
+ $ codehere review task-12345 --approve
1254
+ $ codehere review task-12345 --reject --comment "Security concerns"
1255
+
1256
+ This command:
1257
+ • Lists tasks that need review
1258
+ • Shows task details (files changed, risk tier, etc.)
1259
+ • Allows approving or rejecting tasks
1260
+ • Updates task status and review records
1261
+ `)
1262
+ .action(async (taskId, options) => {
1263
+ initLogFile();
1264
+ try {
1265
+ await executeReviewCommand(taskId, {
1266
+ list: Boolean(options.list),
1267
+ approve: Boolean(options.approve),
1268
+ reject: Boolean(options.reject),
1269
+ comment: options.comment,
1270
+ all: Boolean(options.all),
1271
+ });
1272
+ logEntry({
1273
+ timestamp: new Date().toISOString(),
1274
+ command: 'review',
1275
+ query: taskId,
1276
+ policyStatus: 'allowed',
1277
+ });
1278
+ }
1279
+ catch (err) {
1280
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1281
+ process.exit(1);
1282
+ }
1283
+ });
1284
+ program
1285
+ .command('test')
1286
+ .description('Generate tests for code')
1287
+ .argument('<file>', 'File to generate tests for')
1288
+ .option('--framework <framework>', 'Test framework (jest, pytest, etc.)')
1289
+ .option('--coverage <type>', 'Coverage type (unit, integration, both)', 'unit')
1290
+ .option('--improve', 'Improve existing test file')
1291
+ .option('--save', 'Save tests to file')
1292
+ .action(async (file, options) => {
1293
+ initLogFile();
1294
+ const providerCheck = checkProviderConfiguration();
1295
+ if (!providerCheck.hasValidProvider) {
1296
+ displayProviderError(providerCheck);
1297
+ process.exit(1);
1298
+ }
1299
+ try {
1300
+ console.log(createBanner('Test Generator', 'Comprehensive test generation'));
1301
+ newline();
1302
+ const testSpinner = createSpinner('Generating tests...');
1303
+ testSpinner.start();
1304
+ let tests;
1305
+ if (options.improve) {
1306
+ tests = await improveTests(file);
1307
+ }
1308
+ else {
1309
+ tests = await generateTests(file, {
1310
+ framework: options.framework,
1311
+ coverage: options.coverage,
1312
+ });
1313
+ }
1314
+ testSpinner.stop();
1315
+ newline();
1316
+ sectionHeader('Generated Tests');
1317
+ const formattedTests = cleanResponse(tests);
1318
+ console.log(formattedTests);
1319
+ if (options.save) {
1320
+ const testPath = options.improve ? file : getTestFilePath(file, options.framework);
1321
+ saveTests(testPath, tests);
1322
+ console.log(success(`Tests saved to ${testPath}`));
1323
+ }
1324
+ }
1325
+ catch (err) {
1326
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1327
+ process.exit(1);
1328
+ }
1329
+ });
1330
+ program
1331
+ .command('react')
1332
+ .description('Execute query using ReAct loop (iterative reasoning with tools)')
1333
+ .argument('<query>', 'The query to process with ReAct reasoning')
1334
+ .addHelpText('after', `
1335
+ Examples:
1336
+ $ codehere react "How does authentication work in this codebase?"
1337
+ $ codehere react "Find and explain the user login function"
1338
+ $ codehere react "What files handle API requests?"
1339
+
1340
+ This command uses ReAct (Reasoning + Acting) pattern:
1341
+ • Generates thoughts about the problem
1342
+ • Takes actions (uses tools, searches code)
1343
+ • Observes results
1344
+ • Iterates until solution found
1345
+ • Learns from memory of past experiences
1346
+ `)
1347
+ .action(async (query) => {
1348
+ initLogFile();
1349
+ const providerCheck = checkProviderConfiguration();
1350
+ if (!providerCheck.hasValidProvider) {
1351
+ newline();
1352
+ displayProviderError(providerCheck);
1353
+ process.exit(1);
1354
+ }
1355
+ try {
1356
+ await executeReactCommand(query);
1357
+ logEntry({
1358
+ timestamp: new Date().toISOString(),
1359
+ command: 'react',
1360
+ query: query,
1361
+ policyStatus: 'allowed',
1362
+ });
1363
+ }
1364
+ catch (err) {
1365
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1366
+ process.exit(1);
1367
+ }
1368
+ });
1369
+ program
1370
+ .command('orchestrate')
1371
+ .description('Orchestrate multi-agent workflows (plan, execute, validate)')
1372
+ .argument('<goal>', 'The goal to orchestrate')
1373
+ .option('-m, --mode <mode>', 'Orchestration mode: plan-only, execute-only, or full', 'full')
1374
+ .option('-p, --plan-id <planId>', 'Load and execute a previously saved plan by ID')
1375
+ .option('--review', 'Enable review & feedback capture (used for trust scoring and Validation Mode)')
1376
+ .action(async (goal, options) => {
1377
+ initLogFile();
1378
+ const providerCheck = checkProviderConfiguration();
1379
+ if (!providerCheck.hasValidProvider) {
1380
+ displayProviderError(providerCheck);
1381
+ process.exit(1);
1382
+ }
1383
+ try {
1384
+ await executeOrchestrateCommand(goal, {
1385
+ mode: options.mode,
1386
+ planId: options.planId,
1387
+ review: options.review,
1388
+ });
1389
+ logEntry({
1390
+ timestamp: new Date().toISOString(),
1391
+ command: 'orchestrate',
1392
+ query: goal,
1393
+ policyStatus: 'allowed',
1394
+ });
1395
+ }
1396
+ catch (err) {
1397
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1398
+ process.exit(1);
1399
+ }
1400
+ });
1401
+ program
1402
+ .command('trace')
1403
+ .description('View execution traces and reproduce runs')
1404
+ .argument('<action>', 'Action: list, show, or reproduce')
1405
+ .argument('[runId]', 'Run ID (required for show/reproduce)')
1406
+ .action(async (action, runId) => {
1407
+ initLogFile();
1408
+ try {
1409
+ if (action === 'list') {
1410
+ await executeTraceCommand('list');
1411
+ }
1412
+ else if (action === 'show') {
1413
+ if (!runId) {
1414
+ console.error(error('Run ID is required for "show" action'));
1415
+ console.log(info('Usage: codehere trace show <runId>'));
1416
+ process.exit(1);
1417
+ }
1418
+ await executeTraceCommand('show', runId);
1419
+ }
1420
+ else if (action === 'reproduce') {
1421
+ if (!runId) {
1422
+ console.error(error('Run ID is required for "reproduce" action'));
1423
+ console.log(info('Usage: codehere trace reproduce <runId>'));
1424
+ process.exit(1);
1425
+ }
1426
+ await executeTraceCommand('reproduce', runId);
1427
+ }
1428
+ else {
1429
+ console.error(error(`Unknown action: ${action}`));
1430
+ console.log(info('Available actions: list, show, reproduce'));
1431
+ process.exit(1);
1432
+ }
1433
+ }
1434
+ catch (err) {
1435
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1436
+ process.exit(1);
1437
+ }
1438
+ });
1439
+ program
1440
+ .command('undo')
1441
+ .description('Undo file changes by restoring from backups')
1442
+ .argument('<action>', 'Action: undo, list, restore')
1443
+ .argument('[filepath]', 'File path (required for undo/list)')
1444
+ .argument('[backupPath]', 'Backup path (required for restore)')
1445
+ .addHelpText('after', `
1446
+ Examples:
1447
+ $ codehere undo undo src/file.ts
1448
+ $ codehere undo list src/file.ts
1449
+ $ codehere undo restore src/file.ts .codehere/backups/file.ts.2024-12-30.backup
1450
+
1451
+ Actions:
1452
+ undo - Restore file from most recent backup
1453
+ list - List all available backups for a file
1454
+ restore - Restore file from a specific backup path
1455
+ `)
1456
+ .action(async (action, filepath, backupPath) => {
1457
+ initLogFile();
1458
+ try {
1459
+ await executeUndoCommand(action, filepath, backupPath);
1460
+ }
1461
+ catch (err) {
1462
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1463
+ process.exit(1);
1464
+ }
1465
+ });
1466
+ // Add completion command
1467
+ program
1468
+ .command('completion')
1469
+ .description('Generate shell completion script')
1470
+ .argument('<shell>', 'Shell type: bash, zsh, or fish')
1471
+ .action(async (shell) => {
1472
+ try {
1473
+ switch (shell.toLowerCase()) {
1474
+ case 'bash': {
1475
+ const { generateBashCompletion } = await import('./infrastructure/completion/bash-completion.js');
1476
+ console.log(generateBashCompletion());
1477
+ break;
1478
+ }
1479
+ case 'zsh': {
1480
+ const { generateZshCompletion } = await import('./infrastructure/completion/zsh-completion.js');
1481
+ console.log(generateZshCompletion());
1482
+ break;
1483
+ }
1484
+ case 'fish': {
1485
+ const { generateFishCompletion } = await import('./infrastructure/completion/fish-completion.js');
1486
+ console.log(generateFishCompletion());
1487
+ break;
1488
+ }
1489
+ default:
1490
+ console.error(error(`Unsupported shell: ${shell}`));
1491
+ console.log(info('Supported shells: bash, zsh, fish'));
1492
+ console.log(info('Usage: codehere completion <bash|zsh|fish>'));
1493
+ process.exit(1);
1494
+ }
1495
+ }
1496
+ catch (err) {
1497
+ displayError(err, {
1498
+ operation: 'completion',
1499
+ showSuggestions: true,
1500
+ });
1501
+ process.exit(1);
1502
+ }
1503
+ });
1504
+ // Security audit export command
1505
+ program
1506
+ .command('audit')
1507
+ .description('Security audit trail export for compliance')
1508
+ .argument('<action>', 'Action: export or list')
1509
+ .option('-f, --format <format>', 'Export format: json, jsonl, or csv', 'json')
1510
+ .option('--start-date <date>', 'Start date (ISO 8601 format, e.g., 2025-01-15T00:00:00Z)')
1511
+ .option('--end-date <date>', 'End date (ISO 8601 format, e.g., 2025-01-15T23:59:59Z)')
1512
+ .option('--include-inputs', 'Include input data in export (may contain sensitive data)')
1513
+ .option('--include-outputs', 'Include output data in export (may contain sensitive data)')
1514
+ .option('-o, --output <path>', 'Output file path (default: auto-generated)')
1515
+ .action(async (action, options) => {
1516
+ initLogFile();
1517
+ try {
1518
+ await executeAuditCommand(action, {
1519
+ format: options.format,
1520
+ startDate: options.startDate,
1521
+ endDate: options.endDate,
1522
+ includeInputs: options.includeInputs,
1523
+ includeOutputs: options.includeOutputs,
1524
+ outputPath: options.output,
1525
+ });
1526
+ }
1527
+ catch (err) {
1528
+ console.error(error('Error:'), err instanceof Error ? err.message : String(err));
1529
+ process.exit(1);
1530
+ }
1531
+ });
1532
+ // Initialize telemetry and track command
1533
+ const telemetry = getTelemetryService();
1534
+ // Track command usage (if enabled)
1535
+ const commandName = process.argv[2] || 'default';
1536
+ if (commandName !== 'telemetry') {
1537
+ telemetry.trackCommand(commandName);
1538
+ }
1539
+ // Check for first run (install tracking)
1540
+ const codebaseRoot = process.cwd();
1541
+ const codehereDir = join(codebaseRoot, '.codehere');
1542
+ if (!existsSync(codehereDir)) {
1543
+ // First run - track install
1544
+ telemetry.track('install', {
1545
+ version: process.env.npm_package_version || 'unknown',
1546
+ os: process.platform,
1547
+ nodeVersion: process.version,
1548
+ });
1549
+ }
1550
+ program.parse();
1551
+ //# sourceMappingURL=index-backup-before-lazy-loading.js.map