tarsk 0.4.4 → 0.4.6

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 (366) hide show
  1. package/dist/index.js +447375 -37
  2. package/package.json +2 -2
  3. package/dist/agent/agent.error-utils.d.ts +0 -14
  4. package/dist/agent/agent.error-utils.js +0 -52
  5. package/dist/agent/agent.event-transformer.d.ts +0 -55
  6. package/dist/agent/agent.event-transformer.js +0 -175
  7. package/dist/agent/agent.executor.d.ts +0 -26
  8. package/dist/agent/agent.executor.js +0 -286
  9. package/dist/agent/agent.model-resolver.d.ts +0 -22
  10. package/dist/agent/agent.model-resolver.js +0 -67
  11. package/dist/agent/agent.process-manager.d.ts +0 -57
  12. package/dist/agent/agent.process-manager.js +0 -262
  13. package/dist/agent/agent.processing-state-manager.d.ts +0 -74
  14. package/dist/agent/agent.processing-state-manager.js +0 -87
  15. package/dist/agent/agent.prompt-loader.d.ts +0 -16
  16. package/dist/agent/agent.prompt-loader.js +0 -227
  17. package/dist/agent/agent.subagent-executor.d.ts +0 -35
  18. package/dist/agent/agent.subagent-executor.js +0 -135
  19. package/dist/bun/index.d.ts +0 -2
  20. package/dist/bun/index.js +0 -165
  21. package/dist/cli.d.ts +0 -3
  22. package/dist/cli.js +0 -22
  23. package/dist/core/crypto.d.ts +0 -29
  24. package/dist/core/crypto.js +0 -166
  25. package/dist/core/dev-server-cache.d.ts +0 -46
  26. package/dist/core/dev-server-cache.js +0 -59
  27. package/dist/core/env-manager.d.ts +0 -3
  28. package/dist/core/env-manager.js +0 -60
  29. package/dist/core/error-responses.d.ts +0 -61
  30. package/dist/core/error-responses.js +0 -64
  31. package/dist/core/logger.d.ts +0 -10
  32. package/dist/core/logger.js +0 -47
  33. package/dist/core/paths.d.ts +0 -22
  34. package/dist/core/paths.js +0 -26
  35. package/dist/core/random-words.d.ts +0 -18
  36. package/dist/core/random-words.js +0 -135
  37. package/dist/core/response-builder.d.ts +0 -50
  38. package/dist/core/response-builder.js +0 -56
  39. package/dist/core/route-helpers.d.ts +0 -47
  40. package/dist/core/route-helpers.js +0 -54
  41. package/dist/core/run-command-detector.d.ts +0 -26
  42. package/dist/core/run-command-detector.js +0 -98
  43. package/dist/core/stream-helper.d.ts +0 -44
  44. package/dist/core/stream-helper.js +0 -50
  45. package/dist/core/utils.d.ts +0 -43
  46. package/dist/core/utils.js +0 -113
  47. package/dist/core/validation.d.ts +0 -10
  48. package/dist/core/validation.js +0 -20
  49. package/dist/database/database.d.ts +0 -40
  50. package/dist/database/database.encryption.d.ts +0 -33
  51. package/dist/database/database.encryption.js +0 -62
  52. package/dist/database/database.js +0 -480
  53. package/dist/database/database.state.d.ts +0 -52
  54. package/dist/database/database.state.js +0 -119
  55. package/dist/database/database.test-utils.d.ts +0 -22
  56. package/dist/database/database.test-utils.js +0 -39
  57. package/dist/database/database.types.d.ts +0 -3
  58. package/dist/database/database.types.js +0 -2
  59. package/dist/features/agents/agents.manager.d.ts +0 -24
  60. package/dist/features/agents/agents.manager.js +0 -200
  61. package/dist/features/ask-user/ask-user.routes.d.ts +0 -9
  62. package/dist/features/ask-user/ask-user.routes.js +0 -35
  63. package/dist/features/chat/chat-delete.route.d.ts +0 -15
  64. package/dist/features/chat/chat-delete.route.js +0 -36
  65. package/dist/features/chat/chat-post.route.d.ts +0 -11
  66. package/dist/features/chat/chat-post.route.js +0 -270
  67. package/dist/features/chat/chat-stop.route.d.ts +0 -21
  68. package/dist/features/chat/chat-stop.route.js +0 -22
  69. package/dist/features/chat/chat-subscribe.route.d.ts +0 -9
  70. package/dist/features/chat/chat-subscribe.route.js +0 -71
  71. package/dist/features/chat/chat.routes.d.ts +0 -22
  72. package/dist/features/chat/chat.routes.js +0 -29
  73. package/dist/features/conversations/conversations-delete.route.d.ts +0 -16
  74. package/dist/features/conversations/conversations-delete.route.js +0 -34
  75. package/dist/features/conversations/conversations-get-all.route.d.ts +0 -16
  76. package/dist/features/conversations/conversations-get-all.route.js +0 -39
  77. package/dist/features/conversations/conversations-get-by-id.route.d.ts +0 -16
  78. package/dist/features/conversations/conversations-get-by-id.route.js +0 -38
  79. package/dist/features/conversations/conversations-get-deleted.route.d.ts +0 -15
  80. package/dist/features/conversations/conversations-get-deleted.route.js +0 -34
  81. package/dist/features/conversations/conversations-get-messages.route.d.ts +0 -16
  82. package/dist/features/conversations/conversations-get-messages.route.js +0 -49
  83. package/dist/features/conversations/conversations.content.d.ts +0 -28
  84. package/dist/features/conversations/conversations.content.js +0 -142
  85. package/dist/features/conversations/conversations.database.d.ts +0 -108
  86. package/dist/features/conversations/conversations.database.js +0 -373
  87. package/dist/features/conversations/conversations.manager.d.ts +0 -130
  88. package/dist/features/conversations/conversations.manager.js +0 -162
  89. package/dist/features/conversations/conversations.routes.d.ts +0 -21
  90. package/dist/features/conversations/conversations.routes.js +0 -38
  91. package/dist/features/conversations/token-usage.route.d.ts +0 -41
  92. package/dist/features/conversations/token-usage.route.js +0 -419
  93. package/dist/features/git/git-commit.route.d.ts +0 -12
  94. package/dist/features/git/git-commit.route.js +0 -39
  95. package/dist/features/git/git-create-branch.route.d.ts +0 -28
  96. package/dist/features/git/git-create-branch.route.js +0 -119
  97. package/dist/features/git/git-create-pr.route.d.ts +0 -13
  98. package/dist/features/git/git-create-pr.route.js +0 -50
  99. package/dist/features/git/git-create-repo.route.d.ts +0 -14
  100. package/dist/features/git/git-create-repo.route.js +0 -108
  101. package/dist/features/git/git-diff.route.d.ts +0 -30
  102. package/dist/features/git/git-diff.route.js +0 -189
  103. package/dist/features/git/git-fetch.route.d.ts +0 -12
  104. package/dist/features/git/git-fetch.route.js +0 -31
  105. package/dist/features/git/git-generate-commit-message.route.d.ts +0 -12
  106. package/dist/features/git/git-generate-commit-message.route.js +0 -76
  107. package/dist/features/git/git-generate-pr-info.route.d.ts +0 -13
  108. package/dist/features/git/git-generate-pr-info.route.js +0 -147
  109. package/dist/features/git/git-github-status.route.d.ts +0 -16
  110. package/dist/features/git/git-github-status.route.js +0 -68
  111. package/dist/features/git/git-log.route.d.ts +0 -17
  112. package/dist/features/git/git-log.route.js +0 -33
  113. package/dist/features/git/git-pr-status.route.d.ts +0 -15
  114. package/dist/features/git/git-pr-status.route.js +0 -33
  115. package/dist/features/git/git-pull.route.d.ts +0 -12
  116. package/dist/features/git/git-pull.route.js +0 -35
  117. package/dist/features/git/git-push.route.d.ts +0 -12
  118. package/dist/features/git/git-push.route.js +0 -46
  119. package/dist/features/git/git-status-cache.database.d.ts +0 -7
  120. package/dist/features/git/git-status-cache.database.js +0 -53
  121. package/dist/features/git/git-status.route.d.ts +0 -15
  122. package/dist/features/git/git-status.route.js +0 -62
  123. package/dist/features/git/git-sync-branch.route.d.ts +0 -4
  124. package/dist/features/git/git-sync-branch.route.js +0 -208
  125. package/dist/features/git/git-unified-status.route.d.ts +0 -30
  126. package/dist/features/git/git-unified-status.route.js +0 -165
  127. package/dist/features/git/git-username.route.d.ts +0 -3
  128. package/dist/features/git/git-username.route.js +0 -24
  129. package/dist/features/git/git.manager.d.ts +0 -139
  130. package/dist/features/git/git.manager.js +0 -352
  131. package/dist/features/git/git.routes.d.ts +0 -4
  132. package/dist/features/git/git.routes.js +0 -116
  133. package/dist/features/git/git.utils.d.ts +0 -82
  134. package/dist/features/git/git.utils.js +0 -1040
  135. package/dist/features/mcp/mcp.config.d.ts +0 -27
  136. package/dist/features/mcp/mcp.config.js +0 -148
  137. package/dist/features/mcp/mcp.manager.d.ts +0 -61
  138. package/dist/features/mcp/mcp.manager.js +0 -254
  139. package/dist/features/mcp/mcp.popular.json +0 -103
  140. package/dist/features/mcp/mcp.routes.d.ts +0 -13
  141. package/dist/features/mcp/mcp.routes.js +0 -159
  142. package/dist/features/mcp/mcp.types.d.ts +0 -80
  143. package/dist/features/mcp/mcp.types.js +0 -8
  144. package/dist/features/metadata/metadata.manager.d.ts +0 -126
  145. package/dist/features/metadata/metadata.manager.js +0 -423
  146. package/dist/features/models/model-info-aihubmix.d.ts +0 -25
  147. package/dist/features/models/model-info-aihubmix.js +0 -117
  148. package/dist/features/models/model-info-openrouter.d.ts +0 -25
  149. package/dist/features/models/model-info-openrouter.js +0 -104
  150. package/dist/features/models/model-info.d.ts +0 -37
  151. package/dist/features/models/model-info.js +0 -39
  152. package/dist/features/models/models-catalog.d.ts +0 -49
  153. package/dist/features/models/models-catalog.js +0 -80
  154. package/dist/features/models/models-catalog.route.d.ts +0 -43
  155. package/dist/features/models/models-catalog.route.js +0 -15
  156. package/dist/features/models/models-get-available.route.d.ts +0 -36
  157. package/dist/features/models/models-get-available.route.js +0 -66
  158. package/dist/features/models/models-get-enabled.route.d.ts +0 -33
  159. package/dist/features/models/models-get-enabled.route.js +0 -45
  160. package/dist/features/models/models-get-model-info.route.d.ts +0 -31
  161. package/dist/features/models/models-get-model-info.route.js +0 -84
  162. package/dist/features/models/models-model-disable.route.d.ts +0 -15
  163. package/dist/features/models/models-model-disable.route.js +0 -20
  164. package/dist/features/models/models-model-enable.route.d.ts +0 -13
  165. package/dist/features/models/models-model-enable.route.js +0 -20
  166. package/dist/features/models/models-provider-refresh.route.d.ts +0 -17
  167. package/dist/features/models/models-provider-refresh.route.js +0 -20
  168. package/dist/features/models/models.manager.d.ts +0 -58
  169. package/dist/features/models/models.manager.js +0 -138
  170. package/dist/features/models/models.routes.d.ts +0 -18
  171. package/dist/features/models/models.routes.js +0 -83
  172. package/dist/features/models/open-router-models.d.ts +0 -38
  173. package/dist/features/models/open-router-models.js +0 -73
  174. package/dist/features/models/openai-models.d.ts +0 -63
  175. package/dist/features/models/openai-models.js +0 -150
  176. package/dist/features/onboarding/onboarding-get-git-check.route.d.ts +0 -11
  177. package/dist/features/onboarding/onboarding-get-git-check.route.js +0 -28
  178. package/dist/features/onboarding/onboarding-get-status.route.d.ts +0 -12
  179. package/dist/features/onboarding/onboarding-get-status.route.js +0 -15
  180. package/dist/features/onboarding/onboarding-post-complete.route.d.ts +0 -12
  181. package/dist/features/onboarding/onboarding-post-complete.route.js +0 -15
  182. package/dist/features/onboarding/onboarding-post-reset.route.d.ts +0 -12
  183. package/dist/features/onboarding/onboarding-post-reset.route.js +0 -15
  184. package/dist/features/onboarding/onboarding.routes.d.ts +0 -18
  185. package/dist/features/onboarding/onboarding.routes.js +0 -28
  186. package/dist/features/project-todos/project-todos.database.d.ts +0 -38
  187. package/dist/features/project-todos/project-todos.database.js +0 -91
  188. package/dist/features/project-todos/project-todos.routes.d.ts +0 -4
  189. package/dist/features/project-todos/project-todos.routes.js +0 -94
  190. package/dist/features/projects/projects-ai-files.route.d.ts +0 -148
  191. package/dist/features/projects/projects-ai-files.route.js +0 -425
  192. package/dist/features/projects/projects-commands.route.d.ts +0 -27
  193. package/dist/features/projects/projects-commands.route.js +0 -39
  194. package/dist/features/projects/projects-create.route.d.ts +0 -19
  195. package/dist/features/projects/projects-create.route.js +0 -37
  196. package/dist/features/projects/projects-delete.route.d.ts +0 -24
  197. package/dist/features/projects/projects-delete.route.js +0 -34
  198. package/dist/features/projects/projects-get.route.d.ts +0 -47
  199. package/dist/features/projects/projects-get.route.js +0 -36
  200. package/dist/features/projects/projects-list.route.d.ts +0 -58
  201. package/dist/features/projects/projects-list.route.js +0 -59
  202. package/dist/features/projects/projects-open-folder.route.d.ts +0 -10
  203. package/dist/features/projects/projects-open-folder.route.js +0 -11
  204. package/dist/features/projects/projects-open.route.d.ts +0 -26
  205. package/dist/features/projects/projects-open.route.js +0 -49
  206. package/dist/features/projects/projects-package-scripts.route.d.ts +0 -15
  207. package/dist/features/projects/projects-package-scripts.route.js +0 -96
  208. package/dist/features/projects/projects-run-command.route.d.ts +0 -8
  209. package/dist/features/projects/projects-run-command.route.js +0 -21
  210. package/dist/features/projects/projects-run.route.d.ts +0 -51
  211. package/dist/features/projects/projects-run.route.js +0 -74
  212. package/dist/features/projects/projects-update.route.d.ts +0 -24
  213. package/dist/features/projects/projects-update.route.js +0 -81
  214. package/dist/features/projects/projects.creator.d.ts +0 -33
  215. package/dist/features/projects/projects.creator.js +0 -555
  216. package/dist/features/projects/projects.database.d.ts +0 -61
  217. package/dist/features/projects/projects.database.js +0 -212
  218. package/dist/features/projects/projects.manager.d.ts +0 -291
  219. package/dist/features/projects/projects.manager.js +0 -426
  220. package/dist/features/projects/projects.open-with.d.ts +0 -27
  221. package/dist/features/projects/projects.open-with.js +0 -156
  222. package/dist/features/projects/projects.routes.d.ts +0 -20
  223. package/dist/features/projects/projects.routes.js +0 -255
  224. package/dist/features/projects/terminal-session-manager.d.ts +0 -55
  225. package/dist/features/projects/terminal-session-manager.js +0 -90
  226. package/dist/features/providers/provider-resolver.d.ts +0 -13
  227. package/dist/features/providers/provider-resolver.js +0 -22
  228. package/dist/features/providers/providers-get-credits.route.d.ts +0 -15
  229. package/dist/features/providers/providers-get-credits.route.js +0 -51
  230. package/dist/features/providers/providers-get.route.d.ts +0 -16
  231. package/dist/features/providers/providers-get.route.js +0 -32
  232. package/dist/features/providers/providers-open-external.route.d.ts +0 -15
  233. package/dist/features/providers/providers-open-external.route.js +0 -49
  234. package/dist/features/providers/providers-post-bulk-keys.route.d.ts +0 -14
  235. package/dist/features/providers/providers-post-bulk-keys.route.js +0 -31
  236. package/dist/features/providers/providers-post-keys.route.d.ts +0 -14
  237. package/dist/features/providers/providers-post-keys.route.js +0 -25
  238. package/dist/features/providers/providers.routes.d.ts +0 -19
  239. package/dist/features/providers/providers.routes.js +0 -31
  240. package/dist/features/rules/rules-post.route.d.ts +0 -43
  241. package/dist/features/rules/rules-post.route.js +0 -89
  242. package/dist/features/rules/rules.manager.d.ts +0 -36
  243. package/dist/features/rules/rules.manager.js +0 -203
  244. package/dist/features/rules/rules.routes.d.ts +0 -12
  245. package/dist/features/rules/rules.routes.js +0 -13
  246. package/dist/features/run/run-get-running.route.d.ts +0 -15
  247. package/dist/features/run/run-get-running.route.js +0 -21
  248. package/dist/features/run/run-post-start.route.d.ts +0 -8
  249. package/dist/features/run/run-post-start.route.js +0 -21
  250. package/dist/features/run/run-post-stop.route.d.ts +0 -15
  251. package/dist/features/run/run-post-stop.route.js +0 -24
  252. package/dist/features/run/run-post-suggest.route.d.ts +0 -15
  253. package/dist/features/run/run-post-suggest.route.js +0 -21
  254. package/dist/features/run/run-put-command.route.d.ts +0 -15
  255. package/dist/features/run/run-put-command.route.js +0 -24
  256. package/dist/features/run/run.routes.d.ts +0 -19
  257. package/dist/features/run/run.routes.js +0 -31
  258. package/dist/features/scaffold/index.d.ts +0 -7
  259. package/dist/features/scaffold/index.js +0 -5
  260. package/dist/features/scaffold/scaffold-get-templates.route.d.ts +0 -27
  261. package/dist/features/scaffold/scaffold-get-templates.route.js +0 -17
  262. package/dist/features/scaffold/scaffold-post.route.d.ts +0 -8
  263. package/dist/features/scaffold/scaffold-post.route.js +0 -30
  264. package/dist/features/scaffold/scaffold.routes.d.ts +0 -10
  265. package/dist/features/scaffold/scaffold.routes.js +0 -16
  266. package/dist/features/scaffold/scaffold.runner.d.ts +0 -48
  267. package/dist/features/scaffold/scaffold.runner.js +0 -475
  268. package/dist/features/scaffold/scaffold.types.d.ts +0 -26
  269. package/dist/features/scaffold/scaffold.types.js +0 -5
  270. package/dist/features/skills/skills.activation.d.ts +0 -31
  271. package/dist/features/skills/skills.activation.js +0 -155
  272. package/dist/features/skills/skills.manager.d.ts +0 -35
  273. package/dist/features/skills/skills.manager.js +0 -251
  274. package/dist/features/slash-commands/slash-commands-delete.route.d.ts +0 -23
  275. package/dist/features/slash-commands/slash-commands-delete.route.js +0 -36
  276. package/dist/features/slash-commands/slash-commands-get.route.d.ts +0 -53
  277. package/dist/features/slash-commands/slash-commands-get.route.js +0 -54
  278. package/dist/features/slash-commands/slash-commands-post.route.d.ts +0 -39
  279. package/dist/features/slash-commands/slash-commands-post.route.js +0 -70
  280. package/dist/features/slash-commands/slash-commands-put.route.d.ts +0 -23
  281. package/dist/features/slash-commands/slash-commands-put.route.js +0 -36
  282. package/dist/features/slash-commands/slash-commands.manager.d.ts +0 -46
  283. package/dist/features/slash-commands/slash-commands.manager.js +0 -265
  284. package/dist/features/slash-commands/slash-commands.routes.d.ts +0 -13
  285. package/dist/features/slash-commands/slash-commands.routes.js +0 -20
  286. package/dist/features/threads/threads-ai-files.route.d.ts +0 -153
  287. package/dist/features/threads/threads-ai-files.route.js +0 -287
  288. package/dist/features/threads/threads-conversation-folder-path.route.d.ts +0 -14
  289. package/dist/features/threads/threads-conversation-folder-path.route.js +0 -23
  290. package/dist/features/threads/threads-create.route.d.ts +0 -22
  291. package/dist/features/threads/threads-create.route.js +0 -60
  292. package/dist/features/threads/threads-delete.route.d.ts +0 -25
  293. package/dist/features/threads/threads-delete.route.js +0 -35
  294. package/dist/features/threads/threads-files.route.d.ts +0 -15
  295. package/dist/features/threads/threads-files.route.js +0 -20
  296. package/dist/features/threads/threads-fix-comments.route.d.ts +0 -26
  297. package/dist/features/threads/threads-fix-comments.route.js +0 -45
  298. package/dist/features/threads/threads-get.route.d.ts +0 -30
  299. package/dist/features/threads/threads-get.route.js +0 -38
  300. package/dist/features/threads/threads-list.route.d.ts +0 -56
  301. package/dist/features/threads/threads-list.route.js +0 -58
  302. package/dist/features/threads/threads-messages.route.d.ts +0 -28
  303. package/dist/features/threads/threads-messages.route.js +0 -110
  304. package/dist/features/threads/threads-open.route.d.ts +0 -26
  305. package/dist/features/threads/threads-open.route.js +0 -62
  306. package/dist/features/threads/threads-select.route.d.ts +0 -25
  307. package/dist/features/threads/threads-select.route.js +0 -35
  308. package/dist/features/threads/threads-update.route.d.ts +0 -15
  309. package/dist/features/threads/threads-update.route.js +0 -30
  310. package/dist/features/threads/threads.database.d.ts +0 -68
  311. package/dist/features/threads/threads.database.js +0 -215
  312. package/dist/features/threads/threads.manager.d.ts +0 -204
  313. package/dist/features/threads/threads.manager.js +0 -505
  314. package/dist/features/threads/threads.routes.d.ts +0 -20
  315. package/dist/features/threads/threads.routes.js +0 -230
  316. package/dist/features/todos/todos.database.d.ts +0 -14
  317. package/dist/features/todos/todos.database.js +0 -31
  318. package/dist/features/updates/updates.routes.d.ts +0 -13
  319. package/dist/features/updates/updates.routes.js +0 -40
  320. package/dist/index.d.ts +0 -3
  321. package/dist/project-analyzer.d.ts +0 -26
  322. package/dist/project-analyzer.js +0 -307
  323. package/dist/server.d.ts +0 -12
  324. package/dist/server.js +0 -142
  325. package/dist/tools/agent-tool.d.ts +0 -49
  326. package/dist/tools/agent-tool.js +0 -131
  327. package/dist/tools/ask-user.d.ts +0 -25
  328. package/dist/tools/ask-user.js +0 -74
  329. package/dist/tools/ast-grep.d.ts +0 -28
  330. package/dist/tools/ast-grep.js +0 -273
  331. package/dist/tools/bash.d.ts +0 -33
  332. package/dist/tools/bash.js +0 -186
  333. package/dist/tools/edit-diff.d.ts +0 -24
  334. package/dist/tools/edit-diff.js +0 -136
  335. package/dist/tools/edit.d.ts +0 -28
  336. package/dist/tools/edit.js +0 -78
  337. package/dist/tools/find.d.ts +0 -31
  338. package/dist/tools/find.js +0 -117
  339. package/dist/tools/grep.d.ts +0 -37
  340. package/dist/tools/grep.js +0 -231
  341. package/dist/tools/index.d.ts +0 -93
  342. package/dist/tools/index.js +0 -110
  343. package/dist/tools/ls.d.ts +0 -31
  344. package/dist/tools/ls.js +0 -108
  345. package/dist/tools/mcp-tools.d.ts +0 -31
  346. package/dist/tools/mcp-tools.js +0 -59
  347. package/dist/tools/path-utils.d.ts +0 -14
  348. package/dist/tools/path-utils.js +0 -87
  349. package/dist/tools/read.d.ts +0 -27
  350. package/dist/tools/read.js +0 -86
  351. package/dist/tools/resolve-bin.d.ts +0 -5
  352. package/dist/tools/resolve-bin.js +0 -28
  353. package/dist/tools/shell.d.ts +0 -7
  354. package/dist/tools/shell.js +0 -143
  355. package/dist/tools/skill-reference-tool.d.ts +0 -30
  356. package/dist/tools/skill-reference-tool.js +0 -171
  357. package/dist/tools/skill-tool.d.ts +0 -33
  358. package/dist/tools/skill-tool.js +0 -213
  359. package/dist/tools/todo.d.ts +0 -20
  360. package/dist/tools/todo.js +0 -168
  361. package/dist/tools/tool-helpers.d.ts +0 -78
  362. package/dist/tools/tool-helpers.js +0 -109
  363. package/dist/tools/truncate.d.ts +0 -31
  364. package/dist/tools/truncate.js +0 -164
  365. package/dist/tools/write.d.ts +0 -21
  366. package/dist/tools/write.js +0 -65
@@ -1,208 +0,0 @@
1
- import { existsSync } from "fs";
2
- import { resolveThreadPath, getGitRoot, getCurrentBranch, findDefaultBranch } from "./git.utils.js";
3
- export async function gitSyncBranchHandler(c, metadataManager) {
4
- try {
5
- const threadId = c.req.param("threadId");
6
- console.log(`[sync-branch] Starting sync for thread: ${threadId}`);
7
- const thread = await metadataManager
8
- .loadThreads()
9
- .then((threads) => threads.find((t) => t.id === threadId));
10
- if (!thread) {
11
- console.log(`[sync-branch] Thread not found: ${threadId}`);
12
- return c.json({ error: "Thread not found" }, 404);
13
- }
14
- const repoPath = thread.path;
15
- if (!repoPath) {
16
- console.log(`[sync-branch] Thread path not found for threadId: ${threadId}`);
17
- return c.json({ error: "Thread path not found" }, 404);
18
- }
19
- const absolutePath = resolveThreadPath(repoPath);
20
- console.log(`[sync-branch] Resolved path: ${absolutePath}`);
21
- if (!existsSync(absolutePath)) {
22
- console.log(`[sync-branch] Path does not exist: ${absolutePath}`);
23
- return c.json({
24
- error: `Thread repo path does not exist: ${absolutePath}`,
25
- }, 400);
26
- }
27
- let gitRoot;
28
- try {
29
- gitRoot = await getGitRoot(absolutePath);
30
- console.log(`[sync-branch] Git root: ${gitRoot}`);
31
- }
32
- catch (e) {
33
- const msg = e instanceof Error ? e.message : String(e);
34
- console.log(`[sync-branch] Not a git repository: ${msg}`);
35
- return c.json({
36
- error: `Path is not a git repository: ${msg}`,
37
- }, 400);
38
- }
39
- // Get current branch and default branch
40
- const currentBranch = await getCurrentBranch(gitRoot);
41
- const defaultBranch = await findDefaultBranch(gitRoot);
42
- console.log(`[sync-branch] Current branch: ${currentBranch}, Default branch: ${defaultBranch}`);
43
- if (!defaultBranch) {
44
- console.log(`[sync-branch] Could not determine default branch`);
45
- return c.json({
46
- error: "Could not determine default branch",
47
- }, 400);
48
- }
49
- if (currentBranch === defaultBranch) {
50
- console.log(`[sync-branch] Already on default branch: ${defaultBranch}`);
51
- return c.json({
52
- error: `Already on default branch (${defaultBranch})`,
53
- }, 400);
54
- }
55
- // Check if branch is diverged (has unpushed commits and is behind remote)
56
- const { spawnProcess } = await import("../../core/utils.js");
57
- return new Promise((resolve) => {
58
- console.log(`[sync-branch] Checking branch status...`);
59
- const statusProc = spawnProcess("git", ["status", "-sb"], { cwd: gitRoot });
60
- let statusOutput = "";
61
- statusProc.on("close", (statusCode) => {
62
- if (statusCode !== 0) {
63
- console.log(`[sync-branch] Failed to get git status: code ${statusCode}`);
64
- resolve(c.json({
65
- error: "Failed to check git status",
66
- code: statusCode,
67
- }, 400));
68
- return;
69
- }
70
- statusOutput = statusOutput.trim();
71
- console.log(`[sync-branch] git status output: ${statusOutput}`);
72
- // Check if branch is diverged (contains "ahead" and "behind")
73
- const isDiverged = statusOutput.includes("ahead") && statusOutput.includes("behind");
74
- if (isDiverged) {
75
- console.log(`[sync-branch] Branch is diverged, pushing commits first...`);
76
- // First push the commits
77
- const pushProc = spawnProcess("git", ["push", "origin", currentBranch], { cwd: gitRoot });
78
- let pushOut = "";
79
- let pushErr = "";
80
- if (pushProc.stdout) {
81
- pushProc.stdout.on("data", (d) => {
82
- pushOut += d.toString();
83
- console.log(`[sync-branch] push stdout: ${d.toString().trim()}`);
84
- });
85
- }
86
- if (pushProc.stderr) {
87
- pushProc.stderr.on("data", (d) => {
88
- pushErr += d.toString();
89
- console.log(`[sync-branch] push stderr: ${d.toString().trim()}`);
90
- });
91
- }
92
- pushProc.on("close", (pushCode) => {
93
- if (pushCode !== 0) {
94
- console.log(`[sync-branch] Failed to push commits: code ${pushCode}`);
95
- resolve(c.json({
96
- error: `Failed to push commits before sync: ${pushErr || pushOut}`,
97
- code: pushCode,
98
- }, 400));
99
- return;
100
- }
101
- console.log(`[sync-branch] ✓ Pushed commits successfully`);
102
- // Now proceed with sync after push
103
- performSync();
104
- });
105
- pushProc.on("error", (error) => {
106
- console.log(`[sync-branch] ✗ Push process error: ${error instanceof Error ? error.message : String(error)}`);
107
- resolve(c.json({
108
- error: `Failed to push commits: ${error instanceof Error ? error.message : String(error)}`,
109
- }, 500));
110
- });
111
- }
112
- else {
113
- console.log(`[sync-branch] Branch is not diverged, proceeding with sync...`);
114
- performSync();
115
- }
116
- });
117
- if (statusProc.stdout) {
118
- statusProc.stdout.on("data", (d) => {
119
- statusOutput += d.toString();
120
- });
121
- }
122
- if (statusProc.stderr) {
123
- statusProc.stderr.on("data", (d) => {
124
- statusOutput += d.toString();
125
- });
126
- }
127
- statusProc.on("error", (error) => {
128
- console.log(`[sync-branch] ✗ Status process error: ${error instanceof Error ? error.message : String(error)}`);
129
- resolve(c.json({
130
- error: `Failed to check git status: ${error instanceof Error ? error.message : String(error)}`,
131
- }, 500));
132
- });
133
- // Function to perform the actual sync
134
- function performSync() {
135
- // First, configure git to use rebase for pulls (handles divergent branches)
136
- console.log(`[sync-branch] Configuring git pull strategy to rebase...`);
137
- const configProc = spawnProcess("git", ["config", "pull.rebase", "true"], { cwd: gitRoot });
138
- configProc.on("close", (configCode) => {
139
- if (configCode !== 0) {
140
- console.log(`[sync-branch] Failed to configure git: code ${configCode}`);
141
- resolve(c.json({
142
- error: "Failed to configure git pull strategy",
143
- code: configCode,
144
- }, 400));
145
- return;
146
- }
147
- console.log(`[sync-branch] Git config set successfully`);
148
- console.log(`[sync-branch] Starting git pull --rebase origin ${defaultBranch}...`);
149
- // Now perform git pull with rebase
150
- const pullProc = spawnProcess("git", ["pull", "--rebase", "origin", defaultBranch], {
151
- cwd: gitRoot,
152
- });
153
- let out = "";
154
- let err = "";
155
- if (pullProc.stdout) {
156
- pullProc.stdout.on("data", (d) => {
157
- out += d.toString();
158
- console.log(`[sync-branch] stdout: ${d.toString().trim()}`);
159
- });
160
- }
161
- if (pullProc.stderr) {
162
- pullProc.stderr.on("data", (d) => {
163
- err += d.toString();
164
- console.log(`[sync-branch] stderr: ${d.toString().trim()}`);
165
- });
166
- }
167
- pullProc.on("close", (code) => {
168
- if (code === 0) {
169
- console.log(`[sync-branch] ✓ Successfully synced ${currentBranch} with ${defaultBranch}`);
170
- resolve(c.json({
171
- success: true,
172
- message: `Successfully synced ${currentBranch} with ${defaultBranch}`,
173
- branch: currentBranch,
174
- defaultBranch,
175
- }));
176
- }
177
- else {
178
- console.log(`[sync-branch] ✗ Failed to sync with exit code ${code}`);
179
- console.log(`[sync-branch] Error output: ${err || out}`);
180
- resolve(c.json({
181
- error: `Failed to sync with ${defaultBranch}: ${err || out}`,
182
- code,
183
- }, 400));
184
- }
185
- });
186
- pullProc.on("error", (error) => {
187
- console.log(`[sync-branch] ✗ Process error: ${error instanceof Error ? error.message : String(error)}`);
188
- resolve(c.json({
189
- error: `Failed to sync branch: ${error instanceof Error ? error.message : String(error)}`,
190
- }, 500));
191
- });
192
- });
193
- configProc.on("error", (error) => {
194
- console.log(`[sync-branch] ✗ Config process error: ${error instanceof Error ? error.message : String(error)}`);
195
- resolve(c.json({
196
- error: `Failed to configure git: ${error instanceof Error ? error.message : String(error)}`,
197
- }, 500));
198
- });
199
- }
200
- });
201
- }
202
- catch (error) {
203
- const message = error instanceof Error ? error.message : "Failed to sync branch";
204
- console.log(`[sync-branch] ✗ Unexpected error: ${message}`);
205
- return c.json({ error: message }, 500);
206
- }
207
- }
208
- //# sourceMappingURL=git-sync-branch.route.js.map
@@ -1,30 +0,0 @@
1
- import type { Context } from "hono";
2
- import { MetadataManager } from "../metadata/metadata.manager.js";
3
- import { Database } from "../../database/database.types.js";
4
- export declare function gitUnifiedStatusHandler(c: Context, metadataManager: MetadataManager, db: Database): Promise<(Response & import("hono").TypedResponse<{
5
- cached: true;
6
- }, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
7
- error: string;
8
- }, 404, "json">) | (Response & import("hono").TypedResponse<{
9
- error: string;
10
- }, 400, "json">) | (Response & import("hono").TypedResponse<{
11
- cached: false;
12
- hasChanges: boolean;
13
- changedFilesCount: number;
14
- currentBranch: string;
15
- hasUnpushedCommits: boolean;
16
- hasRemoteBranch: boolean;
17
- commitsAheadOfDefault: boolean;
18
- isOnGitHub: boolean;
19
- remoteUrl: string;
20
- canCreateRepo: boolean;
21
- repoUrl: string;
22
- status: "Behind" | "Diverged" | "Ahead" | "Up to date";
23
- defaultBranch: string | null;
24
- prExists: boolean;
25
- prUrl: string | undefined;
26
- prState: string | undefined;
27
- }, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
28
- error: string;
29
- }, 500, "json">)>;
30
- //# sourceMappingURL=git-unified-status.route.d.ts.map
@@ -1,165 +0,0 @@
1
- import { existsSync } from "fs";
2
- import { getGitStatusCache, setGitStatusCache } from "./git-status-cache.database.js";
3
- import { resolveThreadPath, getGitRoot, getGitStatus, getCurrentBranch, hasUnpushedCommits, getRemoteOrigin, getGitSyncStatus, hasRemoteBranch, getPullRequestStatus, findDefaultBranch, hasCommitsAheadOfDefault, } from "./git.utils.js";
4
- export async function gitUnifiedStatusHandler(c, metadataManager, db) {
5
- try {
6
- const threadId = c.req.param("threadId");
7
- const fresh = c.req.query("fresh") === "true";
8
- // Return cached result if available and fresh is not requested
9
- if (!fresh) {
10
- const cached = await getGitStatusCache(db, threadId);
11
- if (cached) {
12
- return c.json({ ...cached, cached: true });
13
- }
14
- }
15
- const thread = await metadataManager
16
- .loadThreads()
17
- .then((threads) => threads.find((t) => t.id === threadId));
18
- if (!thread) {
19
- return c.json({ error: "Thread not found" }, 404);
20
- }
21
- const repoPath = thread.path;
22
- if (!repoPath) {
23
- return c.json({ error: "Thread path not found" }, 404);
24
- }
25
- const absolutePath = resolveThreadPath(repoPath);
26
- if (!existsSync(absolutePath)) {
27
- return c.json({
28
- error: `Thread repo path does not exist: ${absolutePath}. Check that the project folder is present.`,
29
- }, 400);
30
- }
31
- let gitRoot;
32
- try {
33
- gitRoot = await getGitRoot(absolutePath);
34
- }
35
- catch (e) {
36
- const msg = e instanceof Error ? e.message : String(e);
37
- return c.json({
38
- error: `Path is not a git repository: ${absolutePath}. ${msg}`,
39
- }, 400);
40
- }
41
- // === Git Status Information ===
42
- // Check for uncommitted changes and count files
43
- const { hasChanges, changedFilesCount } = await new Promise((resolve) => {
44
- getGitStatus(gitRoot)
45
- .then((statusOutput) => {
46
- const lines = statusOutput
47
- .trim()
48
- .split("\n")
49
- .filter((line) => line.length > 0);
50
- resolve({
51
- hasChanges: lines.length > 0,
52
- changedFilesCount: lines.length,
53
- });
54
- })
55
- .catch(() => resolve({ hasChanges: false, changedFilesCount: 0 }));
56
- });
57
- // Get current branch
58
- const currentBranch = await getCurrentBranch(gitRoot);
59
- // Check if there are unpushed commits
60
- const hasUnpushed = await hasUnpushedCommits(gitRoot, currentBranch);
61
- // === GitHub Status Information ===
62
- // Check if origin remote is a GitHub URL
63
- const remoteUrl = await getRemoteOrigin(gitRoot);
64
- const isOnGitHub = remoteUrl.includes("github.com");
65
- // Extract repo URL from remote URL (handle both https and ssh formats)
66
- let repoUrl = "";
67
- if (isOnGitHub) {
68
- if (remoteUrl.startsWith("https://")) {
69
- repoUrl = remoteUrl.replace(/\.git$/, "");
70
- }
71
- else if (remoteUrl.startsWith("git@")) {
72
- // Convert git@github.com:user/repo.git to https://github.com/user/repo
73
- const match = remoteUrl.match(/git@github\.com:(.+?)\.git$/);
74
- if (match) {
75
- repoUrl = `https://github.com/${match[1]}`;
76
- }
77
- }
78
- }
79
- // Check if remote branch exists
80
- let hasRemoteBranchExists = false;
81
- if (remoteUrl && currentBranch && currentBranch !== "HEAD") {
82
- try {
83
- hasRemoteBranchExists = await hasRemoteBranch(gitRoot, currentBranch);
84
- }
85
- catch (error) {
86
- // If we can't determine remote branch existence, default to false
87
- console.warn(`Failed to check remote branch existence: ${error instanceof Error ? error.message : String(error)}`);
88
- hasRemoteBranchExists = false;
89
- }
90
- }
91
- // Get default branch
92
- let defaultBranchName = null;
93
- try {
94
- defaultBranchName = await findDefaultBranch(gitRoot);
95
- }
96
- catch (error) {
97
- console.warn(`Failed to find default branch: ${error instanceof Error ? error.message : String(error)}`);
98
- }
99
- // Check if current branch has commits ahead of default branch (covers pushed + unpushed)
100
- let commitsAheadOfDefault = false;
101
- if (defaultBranchName && currentBranch && currentBranch !== defaultBranchName) {
102
- try {
103
- commitsAheadOfDefault = await hasCommitsAheadOfDefault(gitRoot, defaultBranchName);
104
- }
105
- catch {
106
- commitsAheadOfDefault = false;
107
- }
108
- }
109
- // Check git sync status
110
- let status = "Up to date";
111
- if (isOnGitHub && remoteUrl) {
112
- try {
113
- if (currentBranch && currentBranch !== "HEAD") {
114
- status = await getGitSyncStatus(gitRoot, currentBranch);
115
- }
116
- }
117
- catch (error) {
118
- // If we can't determine the status, default to Up to date
119
- console.warn(`Failed to check git sync status: ${error instanceof Error ? error.message : String(error)}`);
120
- status = "Up to date";
121
- }
122
- }
123
- // === PR Status Information ===
124
- // Check PR status (only if on GitHub)
125
- let prStatus = { exists: false };
126
- if (isOnGitHub) {
127
- try {
128
- prStatus = await getPullRequestStatus(gitRoot);
129
- }
130
- catch (error) {
131
- // If we can't determine PR status, default to false
132
- console.warn(`Failed to check PR status: ${error instanceof Error ? error.message : String(error)}`);
133
- prStatus = { exists: false };
134
- }
135
- }
136
- // === Combined Response ===
137
- const result = {
138
- // Git status fields
139
- hasChanges,
140
- changedFilesCount,
141
- currentBranch,
142
- hasUnpushedCommits: hasUnpushed,
143
- hasRemoteBranch: hasRemoteBranchExists,
144
- commitsAheadOfDefault,
145
- // GitHub status fields
146
- isOnGitHub,
147
- remoteUrl,
148
- canCreateRepo: !isOnGitHub && remoteUrl.length === 0,
149
- repoUrl,
150
- status,
151
- defaultBranch: defaultBranchName,
152
- // PR status fields
153
- prExists: prStatus.exists,
154
- prUrl: prStatus.url,
155
- prState: prStatus.state,
156
- };
157
- await setGitStatusCache(db, threadId, result);
158
- return c.json({ ...result, cached: false });
159
- }
160
- catch (error) {
161
- const message = error instanceof Error ? error.message : "Failed to get unified git status";
162
- return c.json({ error: message }, 500);
163
- }
164
- }
165
- //# sourceMappingURL=git-unified-status.route.js.map
@@ -1,3 +0,0 @@
1
- import type { Context } from "hono";
2
- export declare function gitUsernameHandler(c: Context): Promise<Response>;
3
- //# sourceMappingURL=git-username.route.d.ts.map
@@ -1,24 +0,0 @@
1
- import { spawnProcess } from "../../core/utils.js";
2
- export function gitUsernameHandler(c) {
3
- return new Promise((resolve) => {
4
- const proc = spawnProcess("git", ["config", "user.name"]);
5
- let out = "";
6
- let _err = "";
7
- proc.stdout?.on("data", (d) => {
8
- out += d.toString();
9
- });
10
- proc.stderr?.on("data", (d) => {
11
- _err += d.toString();
12
- });
13
- proc.on("close", (code) => {
14
- if (code === 0) {
15
- resolve(c.json({ name: out.trim() }));
16
- }
17
- else {
18
- resolve(c.json({ name: "" }));
19
- }
20
- });
21
- proc.on("error", (_e) => resolve(c.json({ name: "" })));
22
- });
23
- }
24
- //# sourceMappingURL=git-username.route.js.map
@@ -1,139 +0,0 @@
1
- /**
2
- * GitManager handles git operations including URL validation and repository cloning
3
- *
4
- * This manager is responsible for:
5
- * - Validating git URLs in various formats
6
- * - Cloning repositories with streaming output
7
- * - Handling git operation errors
8
- */
9
- import { GitEvent } from "@tarsk/shared";
10
- /**
11
- * GitManager interface defines the contract for git operations
12
- */
13
- export interface GitManager {
14
- /**
15
- * Validates a git URL format
16
- * @param url - The git URL to validate
17
- * @returns true if the URL is a valid git URL, false otherwise
18
- */
19
- validateGitUrl(url: string): boolean;
20
- /**
21
- * Clones a git repository to the specified target path
22
- * @param gitUrl - The git repository URL to clone
23
- * @param targetPath - The local path where the repository should be cloned
24
- * @yields GitEvent objects for stdout, stderr, complete, and error events
25
- */
26
- cloneRepository(gitUrl: string, targetPath: string): AsyncGenerator<GitEvent>;
27
- /**
28
- * Sanitizes a branch name to ensure it only contains valid git branch characters
29
- * Replaces spaces with dashes and removes invalid characters
30
- * @param name - The branch name to sanitize
31
- * @returns The sanitized branch name
32
- */
33
- sanitizeBranchName(name: string): string;
34
- /**
35
- * Checks if a branch exists in a git repository
36
- * @param repoPath - The path to the git repository
37
- * @param branchName - The branch name to check
38
- * @returns true if the branch exists, false otherwise
39
- */
40
- checkBranchExists(repoPath: string, branchName: string): Promise<boolean>;
41
- /**
42
- * Creates and checks out a new branch in a git repository
43
- * @param repoPath - The path to the git repository
44
- * @param branchName - The branch name to create
45
- * @yields GitEvent objects for stdout, stderr, complete, and error events
46
- */
47
- createAndCheckoutBranch(repoPath: string, branchName: string): AsyncGenerator<GitEvent>;
48
- /**
49
- * Initializes a new git repository at the given path
50
- * @param repoPath - The path where to run git init
51
- */
52
- initRepository(repoPath: string): Promise<void>;
53
- }
54
- /**
55
- * GitManagerImpl provides the implementation for git operations
56
- */
57
- export declare class GitManagerImpl implements GitManager {
58
- /**
59
- * Regular expressions for validating different git URL formats
60
- */
61
- private readonly gitUrlPatterns;
62
- /**
63
- * Validates a git URL against common git URL formats
64
- *
65
- * Supports the following formats:
66
- * - HTTPS: https://github.com/user/repo.git
67
- * - Git protocol: git://github.com/user/repo.git
68
- * - SSH (git@): git@github.com:user/repo.git
69
- * - SSH (ssh://): ssh://git@github.com/user/repo.git
70
- *
71
- * @param url - The URL to validate
72
- * @returns true if the URL matches a valid git URL format, false otherwise
73
- *
74
- * Requirements: 7.1 - WHEN cloning a git repository, THE CLI SHALL validate the git URL format
75
- */
76
- validateGitUrl(url: string): boolean;
77
- /**
78
- * Clones a git repository to the specified target path with streaming output
79
- *
80
- * This method:
81
- * 1. Validates the git URL
82
- * 2. Creates the target directory if needed
83
- * 3. Spawns a git clone process
84
- * 4. Streams stdout and stderr output
85
- * 5. Handles completion and errors
86
- *
87
- * @param gitUrl - The git repository URL to clone
88
- * @param targetPath - The local path where the repository should be cloned
89
- * @yields GitEvent objects during the clone operation
90
- *
91
- * Requirements:
92
- * - 1.1 - WHEN a user provides a git URL to create a new Project, THE CLI SHALL clone the repository
93
- * - 1.3 - WHEN the clone operation executes, THE CLI SHALL stream the git clone output back to the App
94
- * - 7.1 - WHEN cloning a git repository, THE CLI SHALL validate the git URL format
95
- * - 7.2 - IF a git clone operation fails, THEN THE CLI SHALL return a descriptive error message
96
- * - 7.3 - WHEN a clone operation is in progress, THE CLI SHALL stream git output to provide progress feedback
97
- */
98
- cloneRepository(gitUrl: string, targetPath: string): AsyncGenerator<GitEvent>;
99
- /**
100
- * Sanitizes a branch name to ensure it only contains valid git branch characters
101
- *
102
- * This method:
103
- * 1. Trims whitespace
104
- * 2. Converts to lowercase
105
- * 3. Replaces spaces with dashes
106
- * 4. Removes invalid characters (only allows alphanumeric, dash, underscore, slash, dot)
107
- * 5. Removes leading/trailing slashes and dots
108
- * 6. Collapses multiple consecutive dashes into one
109
- *
110
- * @param name - The branch name to sanitize
111
- * @returns The sanitized branch name (all lowercase)
112
- */
113
- sanitizeBranchName(name: string): string;
114
- /**
115
- * Checks if a branch exists in a git repository
116
- *
117
- * Uses `git show-ref` to check for the branch without checking out
118
- *
119
- * @param repoPath - The path to the git repository
120
- * @param branchName - The branch name to check
121
- * @returns true if the branch exists, false otherwise
122
- */
123
- checkBranchExists(repoPath: string, branchName: string): Promise<boolean>;
124
- /**
125
- * Creates and checks out a new branch in a git repository with streaming output
126
- *
127
- * This method:
128
- * 1. Creates a new branch from the current HEAD
129
- * 2. Checks out the new branch
130
- * 3. Streams output during the operation
131
- *
132
- * @param repoPath - The path to the git repository
133
- * @param branchName - The branch name to create
134
- * @yields GitEvent objects during the branch creation
135
- */
136
- createAndCheckoutBranch(repoPath: string, branchName: string): AsyncGenerator<GitEvent>;
137
- initRepository(repoPath: string): Promise<void>;
138
- }
139
- //# sourceMappingURL=git.manager.d.ts.map