commandmate 0.10.3 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +155 -155
  3. package/.next/app-path-routes-manifest.json +30 -30
  4. package/.next/build-manifest.json +2 -2
  5. package/.next/prerender-manifest.json +12 -12
  6. package/.next/required-server-files.json +1 -1
  7. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/api/app/update/route.js +3 -3
  9. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  10. package/.next/server/app/api/app/update-check/route.js +1 -1
  11. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/assistant/conversation/route.js +1 -1
  13. package/.next/server/app/api/assistant/conversation/route.js.nft.json +1 -1
  14. package/.next/server/app/api/assistant/conversation/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/assistant/current-output/route.js +1 -1
  16. package/.next/server/app/api/assistant/current-output/route.js.nft.json +1 -1
  17. package/.next/server/app/api/assistant/current-output/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/assistant/messages/route.js +1 -1
  19. package/.next/server/app/api/assistant/messages/route.js.nft.json +1 -1
  20. package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/assistant/session/route.js +1 -1
  22. package/.next/server/app/api/assistant/session/route.js.nft.json +1 -1
  23. package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/assistant/start/route.js +1 -1
  25. package/.next/server/app/api/assistant/start/route.js.nft.json +1 -1
  26. package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/assistant/terminal/route.js +3 -2
  28. package/.next/server/app/api/assistant/terminal/route.js.nft.json +1 -1
  29. package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/assistant/tools/route.js +1 -1
  31. package/.next/server/app/api/assistant/tools/route.js.nft.json +1 -1
  32. package/.next/server/app/api/assistant/tools/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/daily-summary/route.js +1 -1
  37. package/.next/server/app/api/daily-summary/route.js.nft.json +1 -1
  38. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/daily-summary/status/route.js +1 -1
  40. package/.next/server/app/api/daily-summary/status/route.js.nft.json +1 -1
  41. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/hooks/claude-done/route.js +1 -1
  46. package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -1
  47. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  49. package/.next/server/app/api/push/subscriptions/route.js +1 -1
  50. package/.next/server/app/api/push/subscriptions/route.js.nft.json +1 -1
  51. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/repositories/[id]/route.js +1 -47
  54. package/.next/server/app/api/repositories/[id]/route.js.nft.json +1 -1
  55. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/repositories/[id]/todos/[todoId]/route.js +1 -1
  57. package/.next/server/app/api/repositories/[id]/todos/[todoId]/route.js.nft.json +1 -1
  58. package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/repositories/[id]/todos/route.js +1 -1
  60. package/.next/server/app/api/repositories/[id]/todos/route.js.nft.json +1 -1
  61. package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
  63. package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -1
  64. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/repositories/clone/route.js +1 -1
  66. package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
  67. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/repositories/excluded/route.js +1 -47
  69. package/.next/server/app/api/repositories/excluded/route.js.nft.json +1 -1
  70. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/repositories/restore/route.js +1 -1
  72. package/.next/server/app/api/repositories/restore/route.js.nft.json +1 -1
  73. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/repositories/route.js +1 -1
  75. package/.next/server/app/api/repositories/route.js.nft.json +1 -1
  76. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/repositories/scan/route.js +1 -1
  78. package/.next/server/app/api/repositories/scan/route.js.nft.json +1 -1
  79. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/repositories/sync/route.js +1 -1
  81. package/.next/server/app/api/repositories/sync/route.js.nft.json +1 -1
  82. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  85. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/todos/route.js +1 -1
  88. package/.next/server/app/api/todos/route.js.nft.json +1 -1
  89. package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
  91. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
  92. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/worktrees/[id]/capture/route.js +1 -1
  94. package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +1 -1
  95. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  96. package/.next/server/app/api/worktrees/[id]/cli-tool/route.js +1 -1
  97. package/.next/server/app/api/worktrees/[id]/cli-tool/route.js.nft.json +1 -1
  98. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  99. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js +1 -1
  100. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js.nft.json +1 -1
  101. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  103. package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
  104. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  105. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route.js +1 -1
  106. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route.js.nft.json +1 -1
  107. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  108. package/.next/server/app/api/worktrees/[id]/execution-logs/route.js +2 -2
  109. package/.next/server/app/api/worktrees/[id]/execution-logs/route.js.nft.json +1 -1
  110. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  111. package/.next/server/app/api/worktrees/[id]/files/[...path]/route.js +1 -1
  112. package/.next/server/app/api/worktrees/[id]/files/[...path]/route.js.nft.json +1 -1
  113. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  114. package/.next/server/app/api/worktrees/[id]/git/branch/create/route.js +1 -1
  115. package/.next/server/app/api/worktrees/[id]/git/branch/create/route.js.nft.json +1 -1
  116. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  117. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route.js +1 -1
  118. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route.js.nft.json +1 -1
  119. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  120. package/.next/server/app/api/worktrees/[id]/git/branches/route.js +1 -1
  121. package/.next/server/app/api/worktrees/[id]/git/branches/route.js.nft.json +1 -1
  122. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  123. package/.next/server/app/api/worktrees/[id]/git/checkout/route.js +1 -1
  124. package/.next/server/app/api/worktrees/[id]/git/checkout/route.js.nft.json +1 -1
  125. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  126. package/.next/server/app/api/worktrees/[id]/git/commit/route.js +1 -1
  127. package/.next/server/app/api/worktrees/[id]/git/commit/route.js.nft.json +1 -1
  128. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  129. package/.next/server/app/api/worktrees/[id]/git/diff/route.js +1 -1
  130. package/.next/server/app/api/worktrees/[id]/git/diff/route.js.nft.json +1 -1
  131. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  132. package/.next/server/app/api/worktrees/[id]/git/fetch/route.js +1 -1
  133. package/.next/server/app/api/worktrees/[id]/git/fetch/route.js.nft.json +1 -1
  134. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  135. package/.next/server/app/api/worktrees/[id]/git/log/route.js +1 -1
  136. package/.next/server/app/api/worktrees/[id]/git/log/route.js.nft.json +1 -1
  137. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  138. package/.next/server/app/api/worktrees/[id]/git/pull/route.js +1 -1
  139. package/.next/server/app/api/worktrees/[id]/git/pull/route.js.nft.json +1 -1
  140. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  141. package/.next/server/app/api/worktrees/[id]/git/push/route.js +1 -1
  142. package/.next/server/app/api/worktrees/[id]/git/push/route.js.nft.json +1 -1
  143. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  144. package/.next/server/app/api/worktrees/[id]/git/reset/route.js +1 -1
  145. package/.next/server/app/api/worktrees/[id]/git/reset/route.js.nft.json +1 -1
  146. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  147. package/.next/server/app/api/worktrees/[id]/git/revert/route.js +1 -1
  148. package/.next/server/app/api/worktrees/[id]/git/revert/route.js.nft.json +1 -1
  149. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  150. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route.js +1 -1
  151. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route.js.nft.json +1 -1
  152. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  153. package/.next/server/app/api/worktrees/[id]/git/stage/route.js +1 -1
  154. package/.next/server/app/api/worktrees/[id]/git/stage/route.js.nft.json +1 -1
  155. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  156. package/.next/server/app/api/worktrees/[id]/git/staged/route.js +1 -1
  157. package/.next/server/app/api/worktrees/[id]/git/staged/route.js.nft.json +1 -1
  158. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  159. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route.js +1 -1
  160. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route.js.nft.json +1 -1
  161. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  162. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route.js +1 -1
  163. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route.js.nft.json +1 -1
  164. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  165. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route.js +1 -1
  166. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route.js.nft.json +1 -1
  167. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  168. package/.next/server/app/api/worktrees/[id]/git/stash/push/route.js +1 -1
  169. package/.next/server/app/api/worktrees/[id]/git/stash/push/route.js.nft.json +1 -1
  170. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  171. package/.next/server/app/api/worktrees/[id]/git/stash/route.js +1 -1
  172. package/.next/server/app/api/worktrees/[id]/git/stash/route.js.nft.json +1 -1
  173. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  174. package/.next/server/app/api/worktrees/[id]/git/status/route.js +1 -1
  175. package/.next/server/app/api/worktrees/[id]/git/status/route.js.nft.json +1 -1
  176. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  177. package/.next/server/app/api/worktrees/[id]/git/unstage/route.js +1 -1
  178. package/.next/server/app/api/worktrees/[id]/git/unstage/route.js.nft.json +1 -1
  179. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  180. package/.next/server/app/api/worktrees/[id]/git/working-diff/route.js +1 -1
  181. package/.next/server/app/api/worktrees/[id]/git/working-diff/route.js.nft.json +1 -1
  182. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  183. package/.next/server/app/api/worktrees/[id]/interrupt/route.js +1 -1
  184. package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -1
  185. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  186. package/.next/server/app/api/worktrees/[id]/kill-session/route.js +1 -1
  187. package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -1
  188. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  189. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route.js +1 -1
  190. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route.js.nft.json +1 -1
  191. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  192. package/.next/server/app/api/worktrees/[id]/logs/route.js +1 -1
  193. package/.next/server/app/api/worktrees/[id]/logs/route.js.nft.json +1 -1
  194. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  195. package/.next/server/app/api/worktrees/[id]/marp-render/route.js +2 -2
  196. package/.next/server/app/api/worktrees/[id]/marp-render/route.js.nft.json +1 -1
  197. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  198. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route.js +1 -1
  199. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route.js.nft.json +1 -1
  200. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  201. package/.next/server/app/api/worktrees/[id]/memos/route.js +1 -1
  202. package/.next/server/app/api/worktrees/[id]/memos/route.js.nft.json +1 -1
  203. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  204. package/.next/server/app/api/worktrees/[id]/messages/route.js +1 -1
  205. package/.next/server/app/api/worktrees/[id]/messages/route.js.nft.json +1 -1
  206. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  207. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
  208. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -1
  209. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  210. package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
  211. package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -1
  212. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  213. package/.next/server/app/api/worktrees/[id]/route.js +1 -1
  214. package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
  215. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  216. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js +1 -1
  217. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js.nft.json +1 -1
  218. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  219. package/.next/server/app/api/worktrees/[id]/schedules/active/route.js +1 -1
  220. package/.next/server/app/api/worktrees/[id]/schedules/active/route.js.nft.json +1 -1
  221. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  222. package/.next/server/app/api/worktrees/[id]/schedules/route.js +2 -2
  223. package/.next/server/app/api/worktrees/[id]/schedules/route.js.nft.json +1 -1
  224. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  225. package/.next/server/app/api/worktrees/[id]/search/route.js +1 -1
  226. package/.next/server/app/api/worktrees/[id]/search/route.js.nft.json +1 -1
  227. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  228. package/.next/server/app/api/worktrees/[id]/send/route.js +1 -1
  229. package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
  230. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  231. package/.next/server/app/api/worktrees/[id]/slash-commands/route.js +1 -1
  232. package/.next/server/app/api/worktrees/[id]/slash-commands/route.js.nft.json +1 -1
  233. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  234. package/.next/server/app/api/worktrees/[id]/special-keys/route.js +1 -1
  235. package/.next/server/app/api/worktrees/[id]/special-keys/route.js.nft.json +1 -1
  236. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  237. package/.next/server/app/api/worktrees/[id]/start-polling/route.js +1 -1
  238. package/.next/server/app/api/worktrees/[id]/start-polling/route.js.nft.json +1 -1
  239. package/.next/server/app/api/worktrees/[id]/start-polling/route_client-reference-manifest.js +1 -1
  240. package/.next/server/app/api/worktrees/[id]/terminal/route.js +1 -1
  241. package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +1 -1
  242. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  243. package/.next/server/app/api/worktrees/[id]/timers/history/route.js +1 -1
  244. package/.next/server/app/api/worktrees/[id]/timers/history/route.js.nft.json +1 -1
  245. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  246. package/.next/server/app/api/worktrees/[id]/timers/route.js +1 -1
  247. package/.next/server/app/api/worktrees/[id]/timers/route.js.nft.json +1 -1
  248. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  249. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route.js +1 -1
  250. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route.js.nft.json +1 -1
  251. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  252. package/.next/server/app/api/worktrees/[id]/todos/route.js +1 -1
  253. package/.next/server/app/api/worktrees/[id]/todos/route.js.nft.json +1 -1
  254. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  255. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route.js +1 -1
  256. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route.js.nft.json +1 -1
  257. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  258. package/.next/server/app/api/worktrees/[id]/tree/route.js +1 -1
  259. package/.next/server/app/api/worktrees/[id]/tree/route.js.nft.json +1 -1
  260. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  261. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route.js +1 -1
  262. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route.js.nft.json +1 -1
  263. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  264. package/.next/server/app/api/worktrees/[id]/viewed/route.js +1 -1
  265. package/.next/server/app/api/worktrees/[id]/viewed/route.js.nft.json +1 -1
  266. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  267. package/.next/server/app/api/worktrees/route.js +1 -1
  268. package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
  269. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  270. package/.next/server/app/chat/page.js +1 -1
  271. package/.next/server/app/chat/page.js.nft.json +1 -1
  272. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  273. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  274. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  275. package/.next/server/app/more/page.js +2 -2
  276. package/.next/server/app/more/page.js.nft.json +1 -1
  277. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  278. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  279. package/.next/server/app/page.js +1 -1
  280. package/.next/server/app/page.js.nft.json +1 -1
  281. package/.next/server/app/page_client-reference-manifest.js +1 -1
  282. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  283. package/.next/server/app/repositories/page.js +1 -1
  284. package/.next/server/app/repositories/page.js.nft.json +1 -1
  285. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  286. package/.next/server/app/review/page.js +1 -1
  287. package/.next/server/app/review/page.js.nft.json +1 -1
  288. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  289. package/.next/server/app/sessions/page.js +1 -1
  290. package/.next/server/app/sessions/page.js.nft.json +1 -1
  291. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  292. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  293. package/.next/server/app/worktrees/[id]/page.js +8 -8
  294. package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
  295. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  296. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  297. package/.next/server/app-paths-manifest.json +30 -30
  298. package/.next/server/chunks/1068.js +1 -1
  299. package/.next/server/chunks/1117.js +1 -0
  300. package/.next/server/chunks/2119.js +1 -1
  301. package/.next/server/chunks/233.js +1 -1
  302. package/.next/server/chunks/2404.js +1 -1
  303. package/.next/server/chunks/2445.js +1 -1
  304. package/.next/server/chunks/3270.js +1 -1
  305. package/.next/server/chunks/3480.js +2 -2
  306. package/.next/server/chunks/3543.js +1 -1
  307. package/.next/server/chunks/3945.js +1 -1
  308. package/.next/server/chunks/406.js +47 -0
  309. package/.next/server/chunks/4444.js +1 -1
  310. package/.next/server/chunks/5381.js +1 -47
  311. package/.next/server/chunks/5959.js +2 -2
  312. package/.next/server/chunks/646.js +33 -0
  313. package/.next/server/chunks/8681.js +1 -0
  314. package/.next/server/chunks/8807.js +305 -300
  315. package/.next/server/chunks/9067.js +1 -1
  316. package/.next/server/chunks/9355.js +1 -1
  317. package/.next/server/chunks/9687.js +1 -1
  318. package/.next/server/middleware-manifest.json +5 -5
  319. package/.next/server/pages/500.html +1 -1
  320. package/.next/server/pages-manifest.json +1 -1
  321. package/.next/server/server-reference-manifest.json +1 -1
  322. package/.next/static/chunks/4560-2bf9cb6504cc4425.js +1 -0
  323. package/.next/static/chunks/7347-7ee39e14be89e508.js +1 -0
  324. package/.next/static/chunks/app/chat/page-5d20240f98c07cee.js +1 -0
  325. package/.next/static/chunks/app/layout-fe5857360dfba2b9.js +1 -0
  326. package/.next/static/chunks/app/more/page-af1d2af13ea901d2.js +1 -0
  327. package/.next/static/chunks/app/page-3bbe737ec910d1fb.js +1 -0
  328. package/.next/static/chunks/app/repositories/page-ace9134ac165a6de.js +1 -0
  329. package/.next/static/chunks/app/review/page-331b80f4f58582bc.js +1 -0
  330. package/.next/static/chunks/app/sessions/page-d694149a7e8649b6.js +1 -0
  331. package/.next/static/chunks/app/worktrees/[id]/page-1c311aaa0950db1e.js +1 -0
  332. package/.next/static/css/d7e2e8d1b8d69d36.css +1 -0
  333. package/.next/trace +10 -10
  334. package/dist/cli/commands/quickstart.d.ts.map +1 -1
  335. package/dist/cli/commands/quickstart.js +27 -0
  336. package/dist/cli/commands/status.d.ts.map +1 -1
  337. package/dist/cli/commands/status.js +19 -0
  338. package/dist/cli/commands/update.d.ts.map +1 -1
  339. package/dist/cli/commands/update.js +178 -1
  340. package/dist/cli/program.d.ts.map +1 -1
  341. package/dist/cli/program.js +6 -0
  342. package/dist/cli/types/index.d.ts +13 -0
  343. package/dist/cli/types/index.d.ts.map +1 -1
  344. package/dist/cli/utils/agent-instances.d.ts +1 -1
  345. package/dist/cli/utils/agent-instances.d.ts.map +1 -1
  346. package/dist/cli/utils/agent-instances.js +8 -1
  347. package/dist/cli/utils/api-client.d.ts +36 -0
  348. package/dist/cli/utils/api-client.d.ts.map +1 -1
  349. package/dist/cli/utils/api-client.js +82 -0
  350. package/dist/cli/utils/daemon.d.ts.map +1 -1
  351. package/dist/cli/utils/daemon.js +44 -9
  352. package/dist/cli/utils/npx-runner.d.ts +88 -0
  353. package/dist/cli/utils/npx-runner.d.ts.map +1 -0
  354. package/dist/cli/utils/npx-runner.js +165 -0
  355. package/dist/cli/utils/package-info.d.ts +17 -0
  356. package/dist/cli/utils/package-info.d.ts.map +1 -0
  357. package/dist/cli/utils/package-info.js +31 -0
  358. package/dist/cli/utils/pid-manager.d.ts +65 -9
  359. package/dist/cli/utils/pid-manager.d.ts.map +1 -1
  360. package/dist/cli/utils/pid-manager.js +81 -21
  361. package/dist/cli/utils/process-inspector.d.ts +27 -0
  362. package/dist/cli/utils/process-inspector.d.ts.map +1 -0
  363. package/dist/cli/utils/process-inspector.js +37 -0
  364. package/dist/lib/app-update/update-lock.d.ts +39 -0
  365. package/dist/lib/app-update/update-lock.d.ts.map +1 -0
  366. package/dist/lib/app-update/update-lock.js +116 -0
  367. package/dist/server/src/config/github-links.js +22 -0
  368. package/dist/server/src/lib/db/db-instance.js +22 -3
  369. package/dist/server/src/lib/db/db-repository.js +107 -19
  370. package/dist/server/src/lib/db/db.js +3 -2
  371. package/dist/server/src/lib/db/memo-db.js +32 -1
  372. package/dist/server/src/lib/db/migrations/index.js +2 -0
  373. package/dist/server/src/lib/db/migrations/runner.js +11 -1
  374. package/dist/server/src/lib/db/migrations/v43-remove-cm-root-dir-ghost-repository.js +126 -0
  375. package/dist/server/src/lib/git/worktrees.js +90 -0
  376. package/dist/server/src/lib/job-executor.js +8 -2
  377. package/dist/server/src/lib/realtime/types.js +76 -0
  378. package/dist/server/src/lib/schedule-manager.js +9 -1
  379. package/dist/server/src/lib/version-checker.js +297 -0
  380. package/dist/server/src/lib/ws-server.js +37 -0
  381. package/package.json +1 -1
  382. package/.next/server/chunks/2464.js +0 -33
  383. package/.next/server/chunks/6791.js +0 -47
  384. package/.next/static/chunks/7347-4a031aecf4664a6d.js +0 -1
  385. package/.next/static/chunks/8954-ce15ee4d0423f1b1.js +0 -1
  386. package/.next/static/chunks/app/chat/page-dee86bdf87516e40.js +0 -1
  387. package/.next/static/chunks/app/layout-d02f4691a4eff86b.js +0 -1
  388. package/.next/static/chunks/app/more/page-39ec8b5f27cf52e7.js +0 -1
  389. package/.next/static/chunks/app/page-ebf1db9826b4065d.js +0 -1
  390. package/.next/static/chunks/app/repositories/page-2be54cae5fcc1f7a.js +0 -1
  391. package/.next/static/chunks/app/review/page-ac4efe6857a0f3bf.js +0 -1
  392. package/.next/static/chunks/app/sessions/page-dc545a3d45374187.js +0 -1
  393. package/.next/static/chunks/app/worktrees/[id]/page-9eb2f37809919531.js +0 -1
  394. package/.next/static/css/eabd34bf2ab147a4.css +0 -1
  395. /package/.next/static/{Ndx_NzkoP54cD0UCmjUlu → 8yp8SRJ9h3Uj75SpHLYpl}/_buildManifest.js +0 -0
  396. /package/.next/static/{Ndx_NzkoP54cD0UCmjUlu → 8yp8SRJ9h3Uj75SpHLYpl}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"quickstart.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/quickstart.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAOD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGtF"}
1
+ {"version":3,"file":"quickstart.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/quickstart.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0BH,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAOD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGtF"}
@@ -12,6 +12,7 @@ const fs_1 = require("fs");
12
12
  const types_1 = require("../types");
13
13
  const logger_1 = require("../utils/logger");
14
14
  const daemon_1 = require("../utils/daemon");
15
+ const package_info_1 = require("../utils/package-info");
15
16
  const preflight_1 = require("../utils/preflight");
16
17
  const env_setup_1 = require("../utils/env-setup");
17
18
  const prompt_1 = require("../utils/prompt");
@@ -92,6 +93,10 @@ async function ensureServerRunning(daemonManager) {
92
93
  // start.ts reports an already-running server as START_FAILED, so it must not be called here
93
94
  const status = await daemonManager.getStatus();
94
95
  logger.info(`Server is already running (PID: ${status?.pid})`);
96
+ // Issue #1337: this branch returns the existing server's URL without restarting it, so
97
+ // running `npx commandmate@latest` over a still-running old daemon silently never delivers
98
+ // the newer code. Surface that mismatch so the user is not led to believe they are up to date.
99
+ warnOnVersionMismatch(status);
95
100
  // Issue #1266: getStatus() now gives .env precedence over exported variables, so the URL
96
101
  // it reports is the one the server is on; this no longer needs to be re-derived here
97
102
  return { url: status?.url };
@@ -103,6 +108,28 @@ async function ensureServerRunning(daemonManager) {
103
108
  await waitUntilReady(result.url);
104
109
  return { url: result.url };
105
110
  }
111
+ /**
112
+ * Warn when the already-running daemon is a different version than this CLI.
113
+ *
114
+ * Issue #1337: `npx commandmate@latest` over a still-running old daemon returns the existing URL
115
+ * without restarting, so a published fix silently never reaches the user, while `--version`
116
+ * reports the freshly-fetched CLI and hides the discrepancy. #1354 recorded the daemon's version
117
+ * in its state file; getStatus() surfaces it here so the mismatch becomes visible. This only
118
+ * warns — restarting automatically would kill any in-flight sessions the running server holds.
119
+ */
120
+ function warnOnVersionMismatch(status) {
121
+ const runningVersion = status?.version;
122
+ if (!runningVersion) {
123
+ // Legacy daemons (started before #1354) record no version; nothing to compare against.
124
+ return;
125
+ }
126
+ const cliVersion = (0, package_info_1.readPackageVersion)();
127
+ if (cliVersion && cliVersion !== runningVersion) {
128
+ logger.warn(`The running server is v${runningVersion} but this CLI is v${cliVersion}. ` +
129
+ 'This command does not restart it, so the running server stays on the old version. ' +
130
+ 'To update the running server, run "commandmate update".');
131
+ }
132
+ }
106
133
  /**
107
134
  * Poll the server until it accepts connections; a timeout is not fatal
108
135
  */
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAA6B,aAAa,EAAE,MAAM,UAAU,CAAC;AAoFpE;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoF9E"}
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAA2C,aAAa,EAAE,MAAM,UAAU,CAAC;AA4GlF;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsF9E"}
@@ -13,8 +13,25 @@ const types_1 = require("../types");
13
13
  const logger_1 = require("../utils/logger");
14
14
  const daemon_1 = require("../utils/daemon");
15
15
  const env_setup_1 = require("../utils/env-setup");
16
+ const package_info_1 = require("../utils/package-info");
16
17
  const input_validators_1 = require("../utils/input-validators");
17
18
  const logger = new logger_1.CLILogger();
19
+ /**
20
+ * Print the running daemon's version and, when it differs from the installed CLI, a warning.
21
+ * Issue #1354: a new CLI over a still-running old daemon otherwise reports only "Running", so
22
+ * users cannot tell the server is not on the latest version.
23
+ */
24
+ function printVersionInfo(status) {
25
+ if (!status.version) {
26
+ return;
27
+ }
28
+ console.log(`Version: ${status.version}`);
29
+ const cliVersion = (0, package_info_1.readPackageVersion)();
30
+ if (cliVersion && cliVersion !== status.version) {
31
+ logger.warn(`Installed CLI is v${cliVersion} but the running server is v${status.version}. ` +
32
+ 'Restart the server ("commandmate stop && commandmate start") to run the current version.');
33
+ }
34
+ }
18
35
  /**
19
36
  * Show status for a single server (main or issue-specific)
20
37
  */
@@ -45,6 +62,7 @@ async function showSingleStatus(issueNo) {
45
62
  return;
46
63
  }
47
64
  console.log(`Status: Running (PID: ${status.pid})`);
65
+ printVersionInfo(status);
48
66
  if (status.port) {
49
67
  console.log(`Port: ${status.port}`);
50
68
  }
@@ -130,6 +148,7 @@ async function statusCommand(options = {}) {
130
148
  return;
131
149
  }
132
150
  console.log(`Status: Running (PID: ${status.pid})`);
151
+ printVersionInfo(status);
133
152
  if (status.port) {
134
153
  console.log(`Port: ${status.port}`);
135
154
  }
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAkBzE;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgP9E"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAuBzE;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwP9E"}
@@ -28,11 +28,16 @@ const install_context_1 = require("../utils/install-context");
28
28
  const env_setup_1 = require("../utils/env-setup");
29
29
  const daemon_factory_1 = require("../utils/daemon-factory");
30
30
  const npm_runner_1 = require("../utils/npm-runner");
31
+ const npx_runner_1 = require("../utils/npx-runner");
31
32
  const semver_1 = require("../utils/semver");
32
33
  const health_check_1 = require("../utils/health-check");
33
34
  const worktree_servers_1 = require("../utils/worktree-servers");
34
35
  const prompt_1 = require("../utils/prompt");
35
36
  const api_client_1 = require("../utils/api-client");
37
+ // Relative import (not '@/'): the CLI build has no path alias / tsc-alias step.
38
+ // Only the abort paths of the npx relaunch touch this — success leaves the lock
39
+ // to expire, exactly like the global flow (Issue #1395 §5.2).
40
+ const update_lock_1 = require("../../lib/app-update/update-lock");
36
41
  const logger = new logger_1.CLILogger();
37
42
  /** npm package name (kept as a literal: never build it from a dynamic path) */
38
43
  const PACKAGE_NAME = 'commandmate';
@@ -43,7 +48,7 @@ const PACKAGE_NAME = 'commandmate';
43
48
  */
44
49
  async function updateCommand(options = {}) {
45
50
  try {
46
- // --- Step 0: npx gate (Issue #1319) -------------------------------------
51
+ // --- Step 0: npx gate (Issue #1319 / #1395) -----------------------------
47
52
  // `npx commandmate` runs from the npx cache, which isGlobalInstall() reports
48
53
  // as global (Issue #1195). Without this gate step 1 lets a throwaway process
49
54
  // rewrite the user's global install, and step 8 then fails its own check by
@@ -51,6 +56,14 @@ async function updateCommand(options = {}) {
51
56
  // The gate covers --check too: "current version" under npx is whatever npx
52
57
  // happened to cache, which says nothing about the user's install.
53
58
  if ((0, install_context_1.isNpxExecution)()) {
59
+ // Issue #1395: the GUI update route spawns this with the hidden
60
+ // --relaunch-npx flag to actually update in place (fetch a fresh npx cache
61
+ // and relaunch the daemon from it). The bare user-facing `commandmate
62
+ // update` under npx stays the #1319 no-op (§6).
63
+ if (options.relaunchNpx) {
64
+ await runNpxSelfUpdate();
65
+ return;
66
+ }
54
67
  printNpxGuidance();
55
68
  process.exit(types_1.ExitCode.SUCCESS);
56
69
  return;
@@ -244,6 +257,134 @@ async function updateCommand(options = {}) {
244
257
  process.exit(types_1.ExitCode.UNEXPECTED_ERROR);
245
258
  }
246
259
  }
260
+ /**
261
+ * npx in-place self-update orchestrator (Issue #1395, design §2.1).
262
+ *
263
+ * Runs detached from the server it replaces (the GUI route spawns it with
264
+ * `detached + unref`), so stopping the old daemon does not kill this process.
265
+ * The sequence is fail-fast: the new version is fetched and verified BEFORE the
266
+ * old daemon is stopped, so a stale/failed fetch aborts with zero downtime.
267
+ *
268
+ * Lock policy (§5.2): the route already holds the update lock. Abort paths here
269
+ * release it so a retry is not blocked for 10 minutes; a successful relaunch
270
+ * leaves it to expire, exactly like the global flow (a competing retry must not
271
+ * stop the freshly-started daemon). npx env hygiene lives inside npx-runner.
272
+ */
273
+ async function runNpxSelfUpdate() {
274
+ // .env must exist and be loaded before status/auth resolution so the health
275
+ // check URL and token resolve correctly (mirrors step 6).
276
+ const envPath = (0, env_setup_1.getEnvPath)();
277
+ if (!(0, fs_1.existsSync)(envPath)) {
278
+ logger.error('No .env configuration was found, so the server cannot be relaunched.');
279
+ logger.info('Nothing was changed.');
280
+ printNpxManualRelaunch();
281
+ (0, update_lock_1.releaseUpdateLock)();
282
+ process.exit(types_1.ExitCode.CONFIG_ERROR);
283
+ return;
284
+ }
285
+ (0, dotenv_1.config)({ path: envPath });
286
+ // Expected version = the registry's latest (honours the user's .npmrc).
287
+ const view = (0, npm_runner_1.viewLatestVersion)(PACKAGE_NAME);
288
+ if (!view.success || !view.version) {
289
+ logger.error(`Failed to query the npm registry: ${view.error ?? 'unknown error'}`);
290
+ logger.info('Nothing was changed. Check your network/npm configuration and try again.');
291
+ (0, update_lock_1.releaseUpdateLock)();
292
+ process.exit(types_1.ExitCode.UPDATE_FAILED);
293
+ return;
294
+ }
295
+ const expected = view.version;
296
+ // --- Warmup + version verify BEFORE the stop (fail-fast, zero downtime) ----
297
+ logger.info(`Fetching ${PACKAGE_NAME}@latest via npx (this may take a minute)...`);
298
+ const warm = (0, npx_runner_1.warmNpxLatest)(PACKAGE_NAME);
299
+ if (!warm.success || !warm.version) {
300
+ logger.error(`Failed to fetch the latest version via npx: ${warm.error ?? 'unknown error'}`);
301
+ printNpxStaleGuidance();
302
+ (0, update_lock_1.releaseUpdateLock)();
303
+ process.exit(types_1.ExitCode.UPDATE_FAILED);
304
+ return;
305
+ }
306
+ if (stripV(warm.version) !== stripV(expected)) {
307
+ logger.error(`npx returned v${warm.version} but the registry latest is v${expected} (a stale npx cache is likely).`);
308
+ printNpxStaleGuidance();
309
+ (0, update_lock_1.releaseUpdateLock)();
310
+ process.exit(types_1.ExitCode.UPDATE_FAILED);
311
+ return;
312
+ }
313
+ // --- Stop the current daemon (a brief outage starts here) ------------------
314
+ const daemonManager = (0, daemon_factory_1.getDaemonManagerFactory)().create();
315
+ const wasRunning = await daemonManager.isRunning();
316
+ if (wasRunning) {
317
+ logger.info('Stopping the current server...');
318
+ const stopped = await daemonManager.stop();
319
+ if (!stopped) {
320
+ logger.error('Failed to stop the server. Update aborted (nothing was changed).');
321
+ logger.info(`Run "${PACKAGE_NAME} stop --force" and try again.`);
322
+ (0, update_lock_1.releaseUpdateLock)();
323
+ process.exit(types_1.ExitCode.STOP_FAILED);
324
+ return;
325
+ }
326
+ logger.success('Server stopped');
327
+ }
328
+ // --- Relaunch from the freshly-cached version ------------------------------
329
+ logger.info(`Starting ${PACKAGE_NAME}@latest from the npx cache...`);
330
+ const relaunch = (0, npx_runner_1.spawnNpxDaemon)(PACKAGE_NAME);
331
+ if (!relaunch.success) {
332
+ logger.error(`Failed to start the new server: ${relaunch.error ?? 'unknown error'}`);
333
+ // The old server was stopped, so it is down: release the lock so the user
334
+ // can retry immediately.
335
+ printNpxManualRelaunch();
336
+ (0, update_lock_1.releaseUpdateLock)();
337
+ process.exit(types_1.ExitCode.START_FAILED);
338
+ return;
339
+ }
340
+ // (a) liveness is a precondition for the HTTP probe
341
+ if (!(await daemonManager.isRunning())) {
342
+ logger.error('The new server could not be detected after the relaunch.');
343
+ printNpxManualRelaunch();
344
+ (0, update_lock_1.releaseUpdateLock)();
345
+ process.exit(types_1.ExitCode.START_FAILED);
346
+ return;
347
+ }
348
+ // (b) base URL comes from getStatus(), never re-derived here (D-13)
349
+ const status = await daemonManager.getStatus();
350
+ const baseUrl = status?.url;
351
+ if (!baseUrl) {
352
+ logger.error('The server started but its address could not be confirmed.');
353
+ printNpxManualRelaunch();
354
+ (0, update_lock_1.releaseUpdateLock)();
355
+ process.exit(types_1.ExitCode.START_FAILED);
356
+ return;
357
+ }
358
+ // Post-start version verify (belt-and-suspenders, §4.2). A mismatch is a
359
+ // warning, not a rollback: the new daemon is up and the GUI will reload onto
360
+ // whatever it is now running.
361
+ if (status?.version && stripV(status.version) !== stripV(expected)) {
362
+ logger.warn(`The running server reports v${status.version}, but v${expected} was expected. ` +
363
+ `Verify with "${PACKAGE_NAME} status".`);
364
+ }
365
+ // (c) poll until readiness is proven
366
+ logger.info('Waiting for the server to become ready...');
367
+ const readiness = await (0, health_check_1.waitForReady)(baseUrl, { token: (0, api_client_1.resolveAuthToken)() });
368
+ if (readiness === 'ready') {
369
+ logger.success(`CommandMate v${status?.version ?? expected} is ready at ${baseUrl}`);
370
+ printNpxPostUpdateNotes();
371
+ process.exit(types_1.ExitCode.SUCCESS);
372
+ return;
373
+ }
374
+ // (d) degrade: the server answers but readiness cannot be proven (auth/IP/TLS)
375
+ if (readiness === 'degraded') {
376
+ logger.warn('サーバは応答していますが、マイグレーション完了は確認できませんでした(認証有効時はトークンが必要です)。');
377
+ logger.info(`"${PACKAGE_NAME} status" で確認してください。`);
378
+ printNpxPostUpdateNotes();
379
+ process.exit(types_1.ExitCode.SUCCESS);
380
+ return;
381
+ }
382
+ // (e) timeout: the relaunch itself succeeded and the new daemon is up, so the
383
+ // lock is left to expire (a retry must not stop the fresh server).
384
+ logger.error('The server started but did not answer in time.');
385
+ printNpxManualRelaunch();
386
+ process.exit(types_1.ExitCode.START_FAILED);
387
+ }
247
388
  /**
248
389
  * Read the version from the installed package.json.
249
390
  * @throws if package.json cannot be read or has no version
@@ -295,6 +436,42 @@ function printNpxGuidance() {
295
436
  console.log('(stop the server -> install -> restart).');
296
437
  console.log('');
297
438
  }
439
+ /**
440
+ * Guidance when npx could not fetch the expected latest (Issue #1395).
441
+ * The old server is untouched, so this only tells the user how to retry.
442
+ */
443
+ function printNpxStaleGuidance() {
444
+ console.log('');
445
+ console.log('The latest version could not be fetched cleanly (a stale npx cache is likely).');
446
+ console.log('Nothing was changed — the current server is still running.');
447
+ console.log('Try again in a moment, or clear the npx/npm cache first:');
448
+ console.log(` npm cache clean --force`);
449
+ console.log(` npx --yes --prefer-online ${PACKAGE_NAME}@latest`);
450
+ console.log('');
451
+ }
452
+ /**
453
+ * Guidance when the relaunch could not be completed/confirmed (Issue #1395).
454
+ * Under npx there is no global install to roll back to; the recovery path is to
455
+ * relaunch with npx by hand. Config/db under ~/.commandmate are preserved.
456
+ */
457
+ function printNpxManualRelaunch() {
458
+ console.log('');
459
+ console.log('Finish the update by relaunching the server manually:');
460
+ console.log(` npx ${PACKAGE_NAME}@latest`);
461
+ console.log('Your configuration and database under ~/.commandmate are preserved.');
462
+ console.log('');
463
+ }
464
+ /**
465
+ * Completion notes for the npx relaunch (Issue #1395 §7.2).
466
+ * Startup options are not fully re-derived from CLI flags after a relaunch, so
467
+ * point the user at status rather than asserting anything was lost/kept.
468
+ */
469
+ function printNpxPostUpdateNotes() {
470
+ console.log('');
471
+ console.log('Note: 再起動後は .env と引き継がれた設定で起動しています。');
472
+ console.log(` ${PACKAGE_NAME} status で稼働先(ポート等)を確認してください。`);
473
+ console.log('');
474
+ }
298
475
  /**
299
476
  * Manual upgrade steps for non-global (development checkout) installs.
300
477
  *
@@ -1 +1 @@
1
- {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0DpC;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CA0JtC"}
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AA0D5C;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAkKtC"}
@@ -172,10 +172,16 @@ function buildProgram() {
172
172
  .description('Update CommandMate to the latest version')
173
173
  .option('--check', 'Only check for updates (no install, stop or restart)')
174
174
  .option('-y, --yes', 'Skip the confirmation prompt (required for non-interactive use)')
175
+ // Issue #1395: hidden — the GUI update route uses this to relaunch an
176
+ // npx-launched server from a fresh npx cache. Hidden so the user-facing
177
+ // `commandmate update` under npx stays a no-op (§6). Fixed argv, no request
178
+ // input reaches it (§5).
179
+ .addOption(new commander_1.Option('--relaunch-npx', 'Internal: relaunch an npx server from a fresh cache').hideHelp())
175
180
  .action(async (options) => {
176
181
  await (0, update_1.updateCommand)({
177
182
  check: options.check,
178
183
  yes: options.yes,
184
+ relaunchNpx: options.relaunchNpx,
179
185
  });
180
186
  });
181
187
  // Issue #264: issue/docs commands (addCommand pattern for subcommand support)
@@ -89,6 +89,13 @@ export interface UpdateOptions {
89
89
  check?: boolean;
90
90
  /** Skip the confirmation prompt (required for non-interactive execution, D-2) */
91
91
  yes?: boolean;
92
+ /**
93
+ * Hidden flag (Issue #1395): under npx, stop the current daemon and relaunch it
94
+ * from a freshly-fetched `npx commandmate@latest` cache instead of the no-op
95
+ * guidance. Set only by the GUI update route; the bare user-facing
96
+ * `commandmate update` under npx stays a no-op (§6).
97
+ */
98
+ relaunchNpx?: boolean;
92
99
  }
93
100
  /**
94
101
  * Daemon process status
@@ -104,6 +111,12 @@ export interface DaemonStatus {
104
111
  uptime?: number;
105
112
  /** URL to access the server (if running) */
106
113
  url?: string;
114
+ /** Package version the running daemon was started with (Issue #1354) */
115
+ version?: string;
116
+ /** Protocol the running server speaks (Issue #1355) */
117
+ protocol?: 'http' | 'https';
118
+ /** Whether the running server has token authentication enabled (Issue #1355) */
119
+ auth?: boolean;
107
120
  }
108
121
  /**
109
122
  * System dependency definition
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,oBAAY,QAAQ;IAClB,OAAO,IAAI;IACX,gBAAgB,IAAI;IACpB,YAAY,IAAI;IAChB,YAAY,IAAI;IAChB,WAAW,IAAI;IACf,8FAA8F;IAC9F,aAAa,IAAI;IACjB,gBAAgB,KAAK;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC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AAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKtD"}
@@ -11,7 +11,7 @@
11
11
  * via tsconfig.cli.json set `"paths": {}`. Mirrors the existing pattern in
12
12
  * ../config/cli-tool-ids.ts.
13
13
  */
14
- import type { ApiClient } from './api-client';
14
+ import { type ApiClient } from './api-client';
15
15
  import type { AgentInstance } from '../types/api-responses';
16
16
  import { MAX_AGENT_INSTANCES, MAX_AGENT_ALIAS_LENGTH } from '../../lib/cli-tools/types';
17
17
  import { MIN_AGENT_INSTANCES } from '../../lib/agent-instances-validator';
@@ -1 +1 @@
1
- {"version":3,"file":"agent-instances.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/agent-instances.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAA0B,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAA2C,MAAM,2BAA2B,CAAC;AACjI,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;AAE5E;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAGzG;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,aAAa,EAAE,GACzB,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,CAM/F;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAKhE"}
1
+ {"version":3,"file":"agent-instances.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/agent-instances.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAA0B,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAA2C,MAAM,2BAA2B,CAAC;AACjI,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;AAE5E;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAazG;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,aAAa,EAAE,GACzB,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,CAM/F;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAKhE"}
@@ -18,6 +18,7 @@ exports.fetchAgentInstances = fetchAgentInstances;
18
18
  exports.saveAgentInstances = saveAgentInstances;
19
19
  exports.nextInstanceId = nextInstanceId;
20
20
  exports.defaultAlias = defaultAlias;
21
+ const api_client_1 = require("./api-client");
21
22
  const types_1 = require("../../lib/cli-tools/types");
22
23
  Object.defineProperty(exports, "MAX_AGENT_INSTANCES", { enumerable: true, get: function () { return types_1.MAX_AGENT_INSTANCES; } });
23
24
  Object.defineProperty(exports, "MAX_AGENT_ALIAS_LENGTH", { enumerable: true, get: function () { return types_1.MAX_AGENT_ALIAS_LENGTH; } });
@@ -28,7 +29,13 @@ Object.defineProperty(exports, "MIN_AGENT_INSTANCES", { enumerable: true, get: f
28
29
  */
29
30
  async function fetchAgentInstances(client, worktreeId) {
30
31
  const worktree = await client.get(`/api/worktrees/${worktreeId}`);
31
- return worktree.agentInstances ?? [];
32
+ // Issue #1357: a current daemon always includes agentInstances (an empty array
33
+ // when the worktree has no instances). Its absence means the running daemon
34
+ // predates the roster API, so silently returning [] here would look to the user
35
+ // like "no instances" and mask the real cause. Validate the field's presence so
36
+ // a stale daemon surfaces as an actionable version-skew error instead.
37
+ const validated = (0, api_client_1.assertResponseShape)(worktree, ['agentInstances'], 'GET /api/worktrees/:id (agent-instance roster)');
38
+ return validated.agentInstances;
32
39
  }
33
40
  /**
34
41
  * Persist a full roster replacement. `order` is re-normalized to array
@@ -84,4 +84,40 @@ export declare class ApiError extends Error {
84
84
  readonly statusCode?: number | undefined;
85
85
  constructor(message: string, exitCode: number, statusCode?: number | undefined);
86
86
  }
87
+ /**
88
+ * Assert that a parsed API response contains the given required top-level fields
89
+ * (Issue #1357).
90
+ *
91
+ * get<T>/post<T>/patch<T> cast the parsed body with `as T` and perform no runtime
92
+ * validation, so a response from a stale daemon that omits a field silently
93
+ * degrades to `undefined` downstream (e.g. a missing roster read as an empty
94
+ * roster). Route responses whose fields you depend on through this guard so a
95
+ * missing field surfaces as an actionable version-skew error instead of a silent
96
+ * wrong value.
97
+ *
98
+ * @param value - Parsed response body
99
+ * @param fields - Required top-level field names
100
+ * @param context - Short endpoint/response label included in the error message
101
+ * @returns value, typed as T, when it is an object and every required field is present
102
+ * @throws ApiError when value is not an object or a required field is absent
103
+ */
104
+ export declare function assertResponseShape<T>(value: unknown, fields: ReadonlyArray<keyof T & string>, context: string): T;
105
+ /**
106
+ * Read the version the running daemon reports via GET /api/app/update-check.
107
+ * Issue #1359 made that field a runtime package.json read, so it reflects the
108
+ * daemon's actual running code rather than a build-time constant.
109
+ *
110
+ * Returns undefined when the endpoint is unreachable or omits currentVersion (an
111
+ * older daemon predating the field) — callers treat that as "unknown", never as
112
+ * an error. Never throws.
113
+ */
114
+ export declare function fetchDaemonVersion(client: ApiClient): Promise<string | undefined>;
115
+ /**
116
+ * Compare this CLI's version against the running daemon's and print a stderr
117
+ * warning when they differ (Issue #1357). Advisory only: never throws, and stays
118
+ * silent when either version is unknown. Intended to run once per CLI invocation
119
+ * that connects to the server, so a stale daemon serving an older API is called
120
+ * out before its responses are misread.
121
+ */
122
+ export declare function warnIfVersionSkew(client: ApiClient): Promise<void>;
87
123
  //# sourceMappingURL=api-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/api-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,4CAA4C;AAC5C,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAK3C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAErD;AAaD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CASjF;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAA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AAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CASvF;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CASxE"}
@@ -14,7 +14,11 @@ exports.isValidWorktreeId = isValidWorktreeId;
14
14
  exports.isValidInstanceId = isValidInstanceId;
15
15
  exports.resolveAuthToken = resolveAuthToken;
16
16
  exports.handleApiError = handleApiError;
17
+ exports.assertResponseShape = assertResponseShape;
18
+ exports.fetchDaemonVersion = fetchDaemonVersion;
19
+ exports.warnIfVersionSkew = warnIfVersionSkew;
17
20
  const types_1 = require("../types");
21
+ const package_info_1 = require("./package-info");
18
22
  /** Maximum stop-pattern length [SEC4-06] */
19
23
  exports.MAX_STOP_PATTERN_LENGTH = 500;
20
24
  /** Worktree ID validation pattern [SEC4-04] */
@@ -266,3 +270,81 @@ class ApiError extends Error {
266
270
  }
267
271
  }
268
272
  exports.ApiError = ApiError;
273
+ // =============================================================================
274
+ // Response shape validation & version-skew detection (Issue #1357)
275
+ // =============================================================================
276
+ /**
277
+ * Build the message shown when a daemon response is malformed or the CLI/daemon
278
+ * versions disagree. Always names the most likely cause — a stale daemon still
279
+ * running an older build than the installed CLI — and the concrete recovery.
280
+ */
281
+ function versionSkewMessage(detail) {
282
+ return (`${detail}. The running CommandMate server may be an older version than this CLI. ` +
283
+ `Restart it to pick up the current version: commandmate stop && commandmate start`);
284
+ }
285
+ /**
286
+ * Assert that a parsed API response contains the given required top-level fields
287
+ * (Issue #1357).
288
+ *
289
+ * get<T>/post<T>/patch<T> cast the parsed body with `as T` and perform no runtime
290
+ * validation, so a response from a stale daemon that omits a field silently
291
+ * degrades to `undefined` downstream (e.g. a missing roster read as an empty
292
+ * roster). Route responses whose fields you depend on through this guard so a
293
+ * missing field surfaces as an actionable version-skew error instead of a silent
294
+ * wrong value.
295
+ *
296
+ * @param value - Parsed response body
297
+ * @param fields - Required top-level field names
298
+ * @param context - Short endpoint/response label included in the error message
299
+ * @returns value, typed as T, when it is an object and every required field is present
300
+ * @throws ApiError when value is not an object or a required field is absent
301
+ */
302
+ function assertResponseShape(value, fields, context) {
303
+ if (value === null || typeof value !== 'object') {
304
+ throw new ApiError(versionSkewMessage(`${context}: expected an object from the server`), types_1.ExitCode.UNEXPECTED_ERROR);
305
+ }
306
+ const record = value;
307
+ for (const field of fields) {
308
+ if (!(field in record)) {
309
+ throw new ApiError(versionSkewMessage(`${context}: the server response is missing the "${field}" field`), types_1.ExitCode.UNEXPECTED_ERROR);
310
+ }
311
+ }
312
+ return value;
313
+ }
314
+ /**
315
+ * Read the version the running daemon reports via GET /api/app/update-check.
316
+ * Issue #1359 made that field a runtime package.json read, so it reflects the
317
+ * daemon's actual running code rather than a build-time constant.
318
+ *
319
+ * Returns undefined when the endpoint is unreachable or omits currentVersion (an
320
+ * older daemon predating the field) — callers treat that as "unknown", never as
321
+ * an error. Never throws.
322
+ */
323
+ async function fetchDaemonVersion(client) {
324
+ try {
325
+ const info = await client.get('/api/app/update-check');
326
+ return typeof info?.currentVersion === 'string' && info.currentVersion.length > 0
327
+ ? info.currentVersion
328
+ : undefined;
329
+ }
330
+ catch {
331
+ return undefined;
332
+ }
333
+ }
334
+ /**
335
+ * Compare this CLI's version against the running daemon's and print a stderr
336
+ * warning when they differ (Issue #1357). Advisory only: never throws, and stays
337
+ * silent when either version is unknown. Intended to run once per CLI invocation
338
+ * that connects to the server, so a stale daemon serving an older API is called
339
+ * out before its responses are misread.
340
+ */
341
+ async function warnIfVersionSkew(client) {
342
+ const cliVersion = (0, package_info_1.readPackageVersion)();
343
+ if (!cliVersion)
344
+ return;
345
+ const daemonVersion = await fetchDaemonVersion(client);
346
+ if (!daemonVersion || daemonVersion === cliVersion)
347
+ return;
348
+ console.error(`Warning: this CLI is version ${cliVersion} but the running CommandMate server is version ${daemonVersion}. ` +
349
+ `Restart the server to pick up the current version: commandmate stop && commandmate start`);
350
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/daemon.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAMtD,OAAO,EAA2C,SAAS,EAAE,MAAM,cAAc,CAAC;AAElF;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,YAAY,CAAC,CAAY;IAEjC;;;;OAIG;gBACS,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAMjD;;;;;;OAMG;IACH,eAAe,IAAI,SAAS;IAK5B;;;;;OAKG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAgGnD;;;;OAIG;IACG,IAAI,CAAC,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IA8BpD;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IA4B/C;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAInC;;OAEG;YACW,WAAW;CAiB1B"}
1
+ {"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/daemon.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAOtD,OAAO,EAA2C,SAAS,EAAE,MAAM,cAAc,CAAC;AAElF;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,YAAY,CAAC,CAAY;IAEjC;;;;OAIG;gBACS,WAAW,EAAE,MAAM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