@boxes-dev/dvb-runtime 1.0.297 → 1.0.299

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 (488) hide show
  1. package/dist/bin/.bundle-state.json +2 -2
  2. package/dist/bin/dvb.cjs +6 -6
  3. package/dist/bin/dvbd.cjs +6 -6
  4. package/package.json +7 -5
  5. package/dist/devbox/auth.d.ts +0 -22
  6. package/dist/devbox/auth.d.ts.map +0 -1
  7. package/dist/devbox/auth.js +0 -233
  8. package/dist/devbox/auth.js.map +0 -1
  9. package/dist/devbox/browser.d.ts +0 -19
  10. package/dist/devbox/browser.d.ts.map +0 -1
  11. package/dist/devbox/browser.js +0 -60
  12. package/dist/devbox/browser.js.map +0 -1
  13. package/dist/devbox/cli.d.ts +0 -7
  14. package/dist/devbox/cli.d.ts.map +0 -1
  15. package/dist/devbox/cli.js +0 -124
  16. package/dist/devbox/cli.js.map +0 -1
  17. package/dist/devbox/commandRegistry/args.d.ts +0 -18
  18. package/dist/devbox/commandRegistry/args.d.ts.map +0 -1
  19. package/dist/devbox/commandRegistry/args.js +0 -107
  20. package/dist/devbox/commandRegistry/args.js.map +0 -1
  21. package/dist/devbox/commandRegistry/catalog.d.ts +0 -4
  22. package/dist/devbox/commandRegistry/catalog.d.ts.map +0 -1
  23. package/dist/devbox/commandRegistry/catalog.js +0 -763
  24. package/dist/devbox/commandRegistry/catalog.js.map +0 -1
  25. package/dist/devbox/commandRegistry/dispatch.d.ts +0 -3
  26. package/dist/devbox/commandRegistry/dispatch.d.ts.map +0 -1
  27. package/dist/devbox/commandRegistry/dispatch.js +0 -61
  28. package/dist/devbox/commandRegistry/dispatch.js.map +0 -1
  29. package/dist/devbox/commandRegistry/errors.d.ts +0 -8
  30. package/dist/devbox/commandRegistry/errors.d.ts.map +0 -1
  31. package/dist/devbox/commandRegistry/errors.js +0 -26
  32. package/dist/devbox/commandRegistry/errors.js.map +0 -1
  33. package/dist/devbox/commandRegistry/help.d.ts +0 -5
  34. package/dist/devbox/commandRegistry/help.d.ts.map +0 -1
  35. package/dist/devbox/commandRegistry/help.js +0 -94
  36. package/dist/devbox/commandRegistry/help.js.map +0 -1
  37. package/dist/devbox/commandRegistry/resolve.d.ts +0 -7
  38. package/dist/devbox/commandRegistry/resolve.d.ts.map +0 -1
  39. package/dist/devbox/commandRegistry/resolve.js +0 -32
  40. package/dist/devbox/commandRegistry/resolve.js.map +0 -1
  41. package/dist/devbox/commandRegistry/tab.d.ts +0 -10
  42. package/dist/devbox/commandRegistry/tab.d.ts.map +0 -1
  43. package/dist/devbox/commandRegistry/tab.js +0 -83
  44. package/dist/devbox/commandRegistry/tab.js.map +0 -1
  45. package/dist/devbox/commandRegistry/types.d.ts +0 -32
  46. package/dist/devbox/commandRegistry/types.d.ts.map +0 -1
  47. package/dist/devbox/commandRegistry/types.js +0 -2
  48. package/dist/devbox/commandRegistry/types.js.map +0 -1
  49. package/dist/devbox/commands/agent.d.ts +0 -52
  50. package/dist/devbox/commands/agent.d.ts.map +0 -1
  51. package/dist/devbox/commands/agent.js +0 -397
  52. package/dist/devbox/commands/agent.js.map +0 -1
  53. package/dist/devbox/commands/boxSelect.d.ts +0 -25
  54. package/dist/devbox/commands/boxSelect.d.ts.map +0 -1
  55. package/dist/devbox/commands/boxSelect.js +0 -94
  56. package/dist/devbox/commands/boxSelect.js.map +0 -1
  57. package/dist/devbox/commands/checkpoint.d.ts +0 -9
  58. package/dist/devbox/commands/checkpoint.d.ts.map +0 -1
  59. package/dist/devbox/commands/checkpoint.js +0 -105
  60. package/dist/devbox/commands/checkpoint.js.map +0 -1
  61. package/dist/devbox/commands/commandProvider.d.ts +0 -33
  62. package/dist/devbox/commands/commandProvider.d.ts.map +0 -1
  63. package/dist/devbox/commands/commandProvider.js +0 -156
  64. package/dist/devbox/commands/commandProvider.js.map +0 -1
  65. package/dist/devbox/commands/connect.d.ts +0 -39
  66. package/dist/devbox/commands/connect.d.ts.map +0 -1
  67. package/dist/devbox/commands/connect.js +0 -1367
  68. package/dist/devbox/commands/connect.js.map +0 -1
  69. package/dist/devbox/commands/connectSessionMapping.d.ts +0 -64
  70. package/dist/devbox/commands/connectSessionMapping.d.ts.map +0 -1
  71. package/dist/devbox/commands/connectSessionMapping.js +0 -153
  72. package/dist/devbox/commands/connectSessionMapping.js.map +0 -1
  73. package/dist/devbox/commands/cp.d.ts +0 -60
  74. package/dist/devbox/commands/cp.d.ts.map +0 -1
  75. package/dist/devbox/commands/cp.js +0 -383
  76. package/dist/devbox/commands/cp.js.map +0 -1
  77. package/dist/devbox/commands/daemon.d.ts +0 -4
  78. package/dist/devbox/commands/daemon.d.ts.map +0 -1
  79. package/dist/devbox/commands/daemon.js +0 -49
  80. package/dist/devbox/commands/daemon.js.map +0 -1
  81. package/dist/devbox/commands/destroy.d.ts +0 -2
  82. package/dist/devbox/commands/destroy.d.ts.map +0 -1
  83. package/dist/devbox/commands/destroy.js +0 -204
  84. package/dist/devbox/commands/destroy.js.map +0 -1
  85. package/dist/devbox/commands/destroyE2b.d.ts +0 -22
  86. package/dist/devbox/commands/destroyE2b.d.ts.map +0 -1
  87. package/dist/devbox/commands/destroyE2b.js +0 -12
  88. package/dist/devbox/commands/destroyE2b.js.map +0 -1
  89. package/dist/devbox/commands/destroyLocalState.d.ts +0 -34
  90. package/dist/devbox/commands/destroyLocalState.d.ts.map +0 -1
  91. package/dist/devbox/commands/destroyLocalState.js +0 -187
  92. package/dist/devbox/commands/destroyLocalState.js.map +0 -1
  93. package/dist/devbox/commands/destroyModal.d.ts +0 -21
  94. package/dist/devbox/commands/destroyModal.d.ts.map +0 -1
  95. package/dist/devbox/commands/destroyModal.js +0 -13
  96. package/dist/devbox/commands/destroyModal.js.map +0 -1
  97. package/dist/devbox/commands/destroyShared.d.ts +0 -14
  98. package/dist/devbox/commands/destroyShared.d.ts.map +0 -1
  99. package/dist/devbox/commands/destroyShared.js +0 -37
  100. package/dist/devbox/commands/destroyShared.js.map +0 -1
  101. package/dist/devbox/commands/fork.d.ts +0 -9
  102. package/dist/devbox/commands/fork.d.ts.map +0 -1
  103. package/dist/devbox/commands/fork.js +0 -94
  104. package/dist/devbox/commands/fork.js.map +0 -1
  105. package/dist/devbox/commands/ide.d.ts +0 -35
  106. package/dist/devbox/commands/ide.d.ts.map +0 -1
  107. package/dist/devbox/commands/ide.js +0 -987
  108. package/dist/devbox/commands/ide.js.map +0 -1
  109. package/dist/devbox/commands/init/args.d.ts +0 -18
  110. package/dist/devbox/commands/init/args.d.ts.map +0 -1
  111. package/dist/devbox/commands/init/args.js +0 -44
  112. package/dist/devbox/commands/init/args.js.map +0 -1
  113. package/dist/devbox/commands/init/clack.d.ts +0 -22
  114. package/dist/devbox/commands/init/clack.d.ts.map +0 -1
  115. package/dist/devbox/commands/init/clack.js +0 -158
  116. package/dist/devbox/commands/init/clack.js.map +0 -1
  117. package/dist/devbox/commands/init/claudeBootstrap.d.ts +0 -49
  118. package/dist/devbox/commands/init/claudeBootstrap.d.ts.map +0 -1
  119. package/dist/devbox/commands/init/claudeBootstrap.js +0 -504
  120. package/dist/devbox/commands/init/claudeBootstrap.js.map +0 -1
  121. package/dist/devbox/commands/init/codex/artifacts.d.ts +0 -49
  122. package/dist/devbox/commands/init/codex/artifacts.d.ts.map +0 -1
  123. package/dist/devbox/commands/init/codex/artifacts.js +0 -278
  124. package/dist/devbox/commands/init/codex/artifacts.js.map +0 -1
  125. package/dist/devbox/commands/init/codex/config.d.ts +0 -6
  126. package/dist/devbox/commands/init/codex/config.d.ts.map +0 -1
  127. package/dist/devbox/commands/init/codex/config.js +0 -43
  128. package/dist/devbox/commands/init/codex/config.js.map +0 -1
  129. package/dist/devbox/commands/init/codex/events.d.ts +0 -14
  130. package/dist/devbox/commands/init/codex/events.d.ts.map +0 -1
  131. package/dist/devbox/commands/init/codex/events.js +0 -435
  132. package/dist/devbox/commands/init/codex/events.js.map +0 -1
  133. package/dist/devbox/commands/init/codex/execConfig.d.ts +0 -5
  134. package/dist/devbox/commands/init/codex/execConfig.d.ts.map +0 -1
  135. package/dist/devbox/commands/init/codex/execConfig.js +0 -10
  136. package/dist/devbox/commands/init/codex/execConfig.js.map +0 -1
  137. package/dist/devbox/commands/init/codex/index.d.ts +0 -136
  138. package/dist/devbox/commands/init/codex/index.d.ts.map +0 -1
  139. package/dist/devbox/commands/init/codex/index.js +0 -1115
  140. package/dist/devbox/commands/init/codex/index.js.map +0 -1
  141. package/dist/devbox/commands/init/codex/local.d.ts +0 -124
  142. package/dist/devbox/commands/init/codex/local.d.ts.map +0 -1
  143. package/dist/devbox/commands/init/codex/local.js +0 -1381
  144. package/dist/devbox/commands/init/codex/local.js.map +0 -1
  145. package/dist/devbox/commands/init/codex/localExecArgs.d.ts +0 -25
  146. package/dist/devbox/commands/init/codex/localExecArgs.d.ts.map +0 -1
  147. package/dist/devbox/commands/init/codex/localExecArgs.js +0 -48
  148. package/dist/devbox/commands/init/codex/localExecArgs.js.map +0 -1
  149. package/dist/devbox/commands/init/codex/plan.d.ts +0 -99
  150. package/dist/devbox/commands/init/codex/plan.d.ts.map +0 -1
  151. package/dist/devbox/commands/init/codex/plan.js +0 -231
  152. package/dist/devbox/commands/init/codex/plan.js.map +0 -1
  153. package/dist/devbox/commands/init/codex/prompts.d.ts +0 -9
  154. package/dist/devbox/commands/init/codex/prompts.d.ts.map +0 -1
  155. package/dist/devbox/commands/init/codex/prompts.js +0 -51
  156. package/dist/devbox/commands/init/codex/prompts.js.map +0 -1
  157. package/dist/devbox/commands/init/codex/proxy.d.ts +0 -10
  158. package/dist/devbox/commands/init/codex/proxy.d.ts.map +0 -1
  159. package/dist/devbox/commands/init/codex/proxy.js +0 -32
  160. package/dist/devbox/commands/init/codex/proxy.js.map +0 -1
  161. package/dist/devbox/commands/init/codex/remote.d.ts +0 -96
  162. package/dist/devbox/commands/init/codex/remote.d.ts.map +0 -1
  163. package/dist/devbox/commands/init/codex/remote.js +0 -927
  164. package/dist/devbox/commands/init/codex/remote.js.map +0 -1
  165. package/dist/devbox/commands/init/codex/retry.d.ts +0 -17
  166. package/dist/devbox/commands/init/codex/retry.d.ts.map +0 -1
  167. package/dist/devbox/commands/init/codex/retry.js +0 -17
  168. package/dist/devbox/commands/init/codex/retry.js.map +0 -1
  169. package/dist/devbox/commands/init/codex/scanStatus.d.ts +0 -5
  170. package/dist/devbox/commands/init/codex/scanStatus.d.ts.map +0 -1
  171. package/dist/devbox/commands/init/codex/scanStatus.js +0 -27
  172. package/dist/devbox/commands/init/codex/scanStatus.js.map +0 -1
  173. package/dist/devbox/commands/init/codex/shellHistory.d.ts +0 -39
  174. package/dist/devbox/commands/init/codex/shellHistory.d.ts.map +0 -1
  175. package/dist/devbox/commands/init/codex/shellHistory.js +0 -258
  176. package/dist/devbox/commands/init/codex/shellHistory.js.map +0 -1
  177. package/dist/devbox/commands/init/codex/template.d.ts +0 -3
  178. package/dist/devbox/commands/init/codex/template.d.ts.map +0 -1
  179. package/dist/devbox/commands/init/codex/template.js +0 -3
  180. package/dist/devbox/commands/init/codex/template.js.map +0 -1
  181. package/dist/devbox/commands/init/finalizeFlow.d.ts +0 -95
  182. package/dist/devbox/commands/init/finalizeFlow.d.ts.map +0 -1
  183. package/dist/devbox/commands/init/finalizeFlow.js +0 -786
  184. package/dist/devbox/commands/init/finalizeFlow.js.map +0 -1
  185. package/dist/devbox/commands/init/index.d.ts +0 -11
  186. package/dist/devbox/commands/init/index.d.ts.map +0 -1
  187. package/dist/devbox/commands/init/index.js +0 -1058
  188. package/dist/devbox/commands/init/index.js.map +0 -1
  189. package/dist/devbox/commands/init/modal.d.ts +0 -5
  190. package/dist/devbox/commands/init/modal.d.ts.map +0 -1
  191. package/dist/devbox/commands/init/modal.js +0 -4
  192. package/dist/devbox/commands/init/modal.js.map +0 -1
  193. package/dist/devbox/commands/init/packaging.d.ts +0 -5
  194. package/dist/devbox/commands/init/packaging.d.ts.map +0 -1
  195. package/dist/devbox/commands/init/packaging.js +0 -81
  196. package/dist/devbox/commands/init/packaging.js.map +0 -1
  197. package/dist/devbox/commands/init/progress.d.ts +0 -31
  198. package/dist/devbox/commands/init/progress.d.ts.map +0 -1
  199. package/dist/devbox/commands/init/progress.js +0 -205
  200. package/dist/devbox/commands/init/progress.js.map +0 -1
  201. package/dist/devbox/commands/init/provider/e2b.d.ts +0 -29
  202. package/dist/devbox/commands/init/provider/e2b.d.ts.map +0 -1
  203. package/dist/devbox/commands/init/provider/e2b.js +0 -130
  204. package/dist/devbox/commands/init/provider/e2b.js.map +0 -1
  205. package/dist/devbox/commands/init/provider/e2bRuntime.d.ts +0 -39
  206. package/dist/devbox/commands/init/provider/e2bRuntime.d.ts.map +0 -1
  207. package/dist/devbox/commands/init/provider/e2bRuntime.js +0 -679
  208. package/dist/devbox/commands/init/provider/e2bRuntime.js.map +0 -1
  209. package/dist/devbox/commands/init/provider/index.d.ts +0 -8
  210. package/dist/devbox/commands/init/provider/index.d.ts.map +0 -1
  211. package/dist/devbox/commands/init/provider/index.js +0 -5
  212. package/dist/devbox/commands/init/provider/index.js.map +0 -1
  213. package/dist/devbox/commands/init/provider/modal.d.ts +0 -34
  214. package/dist/devbox/commands/init/provider/modal.d.ts.map +0 -1
  215. package/dist/devbox/commands/init/provider/modal.js +0 -274
  216. package/dist/devbox/commands/init/provider/modal.js.map +0 -1
  217. package/dist/devbox/commands/init/provider/modalRuntime.d.ts +0 -3
  218. package/dist/devbox/commands/init/provider/modalRuntime.d.ts.map +0 -1
  219. package/dist/devbox/commands/init/provider/modalRuntime.js +0 -2
  220. package/dist/devbox/commands/init/provider/modalRuntime.js.map +0 -1
  221. package/dist/devbox/commands/init/provider/resolve.d.ts +0 -44
  222. package/dist/devbox/commands/init/provider/resolve.d.ts.map +0 -1
  223. package/dist/devbox/commands/init/provider/resolve.js +0 -172
  224. package/dist/devbox/commands/init/provider/resolve.js.map +0 -1
  225. package/dist/devbox/commands/init/provider/shared.d.ts +0 -10
  226. package/dist/devbox/commands/init/provider/shared.d.ts.map +0 -1
  227. package/dist/devbox/commands/init/provider/shared.js +0 -2
  228. package/dist/devbox/commands/init/provider/shared.js.map +0 -1
  229. package/dist/devbox/commands/init/provider/sprites.d.ts +0 -30
  230. package/dist/devbox/commands/init/provider/sprites.d.ts.map +0 -1
  231. package/dist/devbox/commands/init/provider/sprites.js +0 -183
  232. package/dist/devbox/commands/init/provider/sprites.js.map +0 -1
  233. package/dist/devbox/commands/init/provider/types.d.ts +0 -19
  234. package/dist/devbox/commands/init/provider/types.d.ts.map +0 -1
  235. package/dist/devbox/commands/init/provider/types.js +0 -2
  236. package/dist/devbox/commands/init/provider/types.js.map +0 -1
  237. package/dist/devbox/commands/init/provisionFlow.d.ts +0 -53
  238. package/dist/devbox/commands/init/provisionFlow.d.ts.map +0 -1
  239. package/dist/devbox/commands/init/provisionFlow.js +0 -541
  240. package/dist/devbox/commands/init/provisionFlow.js.map +0 -1
  241. package/dist/devbox/commands/init/registry.d.ts +0 -15
  242. package/dist/devbox/commands/init/registry.d.ts.map +0 -1
  243. package/dist/devbox/commands/init/registry.js +0 -38
  244. package/dist/devbox/commands/init/registry.js.map +0 -1
  245. package/dist/devbox/commands/init/remote.d.ts +0 -48
  246. package/dist/devbox/commands/init/remote.d.ts.map +0 -1
  247. package/dist/devbox/commands/init/remote.js +0 -766
  248. package/dist/devbox/commands/init/remote.js.map +0 -1
  249. package/dist/devbox/commands/init/repo.d.ts +0 -45
  250. package/dist/devbox/commands/init/repo.d.ts.map +0 -1
  251. package/dist/devbox/commands/init/repo.js +0 -235
  252. package/dist/devbox/commands/init/repo.js.map +0 -1
  253. package/dist/devbox/commands/init/retryableErrors.d.ts +0 -4
  254. package/dist/devbox/commands/init/retryableErrors.d.ts.map +0 -1
  255. package/dist/devbox/commands/init/retryableErrors.js +0 -42
  256. package/dist/devbox/commands/init/retryableErrors.js.map +0 -1
  257. package/dist/devbox/commands/init/scanProgress.d.ts +0 -18
  258. package/dist/devbox/commands/init/scanProgress.d.ts.map +0 -1
  259. package/dist/devbox/commands/init/scanProgress.js +0 -47
  260. package/dist/devbox/commands/init/scanProgress.js.map +0 -1
  261. package/dist/devbox/commands/init/session.d.ts +0 -72
  262. package/dist/devbox/commands/init/session.d.ts.map +0 -1
  263. package/dist/devbox/commands/init/session.js +0 -348
  264. package/dist/devbox/commands/init/session.js.map +0 -1
  265. package/dist/devbox/commands/init/setupArtifactsValidation.d.ts +0 -28
  266. package/dist/devbox/commands/init/setupArtifactsValidation.d.ts.map +0 -1
  267. package/dist/devbox/commands/init/setupArtifactsValidation.js +0 -113
  268. package/dist/devbox/commands/init/setupArtifactsValidation.js.map +0 -1
  269. package/dist/devbox/commands/init/setupPlanFlow.d.ts +0 -34
  270. package/dist/devbox/commands/init/setupPlanFlow.d.ts.map +0 -1
  271. package/dist/devbox/commands/init/setupPlanFlow.js +0 -967
  272. package/dist/devbox/commands/init/setupPlanFlow.js.map +0 -1
  273. package/dist/devbox/commands/init/ssh.d.ts +0 -19
  274. package/dist/devbox/commands/init/ssh.d.ts.map +0 -1
  275. package/dist/devbox/commands/init/ssh.js +0 -276
  276. package/dist/devbox/commands/init/ssh.js.map +0 -1
  277. package/dist/devbox/commands/init/state.d.ts +0 -73
  278. package/dist/devbox/commands/init/state.d.ts.map +0 -1
  279. package/dist/devbox/commands/init/state.js +0 -118
  280. package/dist/devbox/commands/init/state.js.map +0 -1
  281. package/dist/devbox/commands/init/statusFlow.d.ts +0 -27
  282. package/dist/devbox/commands/init/statusFlow.d.ts.map +0 -1
  283. package/dist/devbox/commands/init/statusFlow.js +0 -160
  284. package/dist/devbox/commands/init/statusFlow.js.map +0 -1
  285. package/dist/devbox/commands/list.d.ts +0 -35
  286. package/dist/devbox/commands/list.d.ts.map +0 -1
  287. package/dist/devbox/commands/list.js +0 -311
  288. package/dist/devbox/commands/list.js.map +0 -1
  289. package/dist/devbox/commands/listFormatting.d.ts +0 -27
  290. package/dist/devbox/commands/listFormatting.d.ts.map +0 -1
  291. package/dist/devbox/commands/listFormatting.js +0 -155
  292. package/dist/devbox/commands/listFormatting.js.map +0 -1
  293. package/dist/devbox/commands/logout.d.ts +0 -2
  294. package/dist/devbox/commands/logout.d.ts.map +0 -1
  295. package/dist/devbox/commands/logout.js +0 -64
  296. package/dist/devbox/commands/logout.js.map +0 -1
  297. package/dist/devbox/commands/managedProviderClient.d.ts +0 -24
  298. package/dist/devbox/commands/managedProviderClient.d.ts.map +0 -1
  299. package/dist/devbox/commands/managedProviderClient.js +0 -42
  300. package/dist/devbox/commands/managedProviderClient.js.map +0 -1
  301. package/dist/devbox/commands/managedProviderContext.d.ts +0 -34
  302. package/dist/devbox/commands/managedProviderContext.d.ts.map +0 -1
  303. package/dist/devbox/commands/managedProviderContext.js +0 -34
  304. package/dist/devbox/commands/managedProviderContext.js.map +0 -1
  305. package/dist/devbox/commands/mount.d.ts +0 -25
  306. package/dist/devbox/commands/mount.d.ts.map +0 -1
  307. package/dist/devbox/commands/mount.js +0 -200
  308. package/dist/devbox/commands/mount.js.map +0 -1
  309. package/dist/devbox/commands/ports.d.ts +0 -11
  310. package/dist/devbox/commands/ports.d.ts.map +0 -1
  311. package/dist/devbox/commands/ports.js +0 -183
  312. package/dist/devbox/commands/ports.js.map +0 -1
  313. package/dist/devbox/commands/power.d.ts +0 -10
  314. package/dist/devbox/commands/power.d.ts.map +0 -1
  315. package/dist/devbox/commands/power.js +0 -139
  316. package/dist/devbox/commands/power.js.map +0 -1
  317. package/dist/devbox/commands/provider/daemonRuntimeShared.d.ts +0 -25
  318. package/dist/devbox/commands/provider/daemonRuntimeShared.d.ts.map +0 -1
  319. package/dist/devbox/commands/provider/daemonRuntimeShared.js +0 -217
  320. package/dist/devbox/commands/provider/daemonRuntimeShared.js.map +0 -1
  321. package/dist/devbox/commands/provider/directDaemonRuntime.d.ts +0 -106
  322. package/dist/devbox/commands/provider/directDaemonRuntime.d.ts.map +0 -1
  323. package/dist/devbox/commands/provider/directDaemonRuntime.js +0 -1442
  324. package/dist/devbox/commands/provider/directDaemonRuntime.js.map +0 -1
  325. package/dist/devbox/commands/provider/e2bCommandContext.d.ts +0 -11
  326. package/dist/devbox/commands/provider/e2bCommandContext.d.ts.map +0 -1
  327. package/dist/devbox/commands/provider/e2bCommandContext.js +0 -16
  328. package/dist/devbox/commands/provider/e2bCommandContext.js.map +0 -1
  329. package/dist/devbox/commands/provider/e2bLifecycleShared.d.ts +0 -20
  330. package/dist/devbox/commands/provider/e2bLifecycleShared.d.ts.map +0 -1
  331. package/dist/devbox/commands/provider/e2bLifecycleShared.js +0 -42
  332. package/dist/devbox/commands/provider/e2bLifecycleShared.js.map +0 -1
  333. package/dist/devbox/commands/provider/modalCommandContext.d.ts +0 -22
  334. package/dist/devbox/commands/provider/modalCommandContext.d.ts.map +0 -1
  335. package/dist/devbox/commands/provider/modalCommandContext.js +0 -47
  336. package/dist/devbox/commands/provider/modalCommandContext.js.map +0 -1
  337. package/dist/devbox/commands/provider/modalLifecycle.d.ts +0 -158
  338. package/dist/devbox/commands/provider/modalLifecycle.d.ts.map +0 -1
  339. package/dist/devbox/commands/provider/modalLifecycle.js +0 -702
  340. package/dist/devbox/commands/provider/modalLifecycle.js.map +0 -1
  341. package/dist/devbox/commands/provider/modalRuntime.d.ts +0 -25
  342. package/dist/devbox/commands/provider/modalRuntime.d.ts.map +0 -1
  343. package/dist/devbox/commands/provider/modalRuntime.js +0 -791
  344. package/dist/devbox/commands/provider/modalRuntime.js.map +0 -1
  345. package/dist/devbox/commands/provider/runtimeTypes.d.ts +0 -8
  346. package/dist/devbox/commands/provider/runtimeTypes.d.ts.map +0 -1
  347. package/dist/devbox/commands/provider/runtimeTypes.js +0 -2
  348. package/dist/devbox/commands/provider/runtimeTypes.js.map +0 -1
  349. package/dist/devbox/commands/providerClient.d.ts +0 -82
  350. package/dist/devbox/commands/providerClient.d.ts.map +0 -1
  351. package/dist/devbox/commands/providerClient.js +0 -719
  352. package/dist/devbox/commands/providerClient.js.map +0 -1
  353. package/dist/devbox/commands/reboot.d.ts +0 -8
  354. package/dist/devbox/commands/reboot.d.ts.map +0 -1
  355. package/dist/devbox/commands/reboot.js +0 -100
  356. package/dist/devbox/commands/reboot.js.map +0 -1
  357. package/dist/devbox/commands/reset.d.ts +0 -30
  358. package/dist/devbox/commands/reset.d.ts.map +0 -1
  359. package/dist/devbox/commands/reset.js +0 -114
  360. package/dist/devbox/commands/reset.js.map +0 -1
  361. package/dist/devbox/commands/runtimeClient.d.ts +0 -65
  362. package/dist/devbox/commands/runtimeClient.d.ts.map +0 -1
  363. package/dist/devbox/commands/runtimeClient.js +0 -127
  364. package/dist/devbox/commands/runtimeClient.js.map +0 -1
  365. package/dist/devbox/commands/sentryTest.d.ts +0 -2
  366. package/dist/devbox/commands/sentryTest.d.ts.map +0 -1
  367. package/dist/devbox/commands/sentryTest.js +0 -117
  368. package/dist/devbox/commands/sentryTest.js.map +0 -1
  369. package/dist/devbox/commands/services.d.ts +0 -2
  370. package/dist/devbox/commands/services.d.ts.map +0 -1
  371. package/dist/devbox/commands/services.js +0 -619
  372. package/dist/devbox/commands/services.js.map +0 -1
  373. package/dist/devbox/commands/servicesConfig.d.ts +0 -19
  374. package/dist/devbox/commands/servicesConfig.d.ts.map +0 -1
  375. package/dist/devbox/commands/servicesConfig.js +0 -61
  376. package/dist/devbox/commands/servicesConfig.js.map +0 -1
  377. package/dist/devbox/commands/servicesToml.d.ts +0 -13
  378. package/dist/devbox/commands/servicesToml.d.ts.map +0 -1
  379. package/dist/devbox/commands/servicesToml.js +0 -201
  380. package/dist/devbox/commands/servicesToml.js.map +0 -1
  381. package/dist/devbox/commands/sessionUtils.d.ts +0 -10
  382. package/dist/devbox/commands/sessionUtils.d.ts.map +0 -1
  383. package/dist/devbox/commands/sessionUtils.js +0 -48
  384. package/dist/devbox/commands/sessionUtils.js.map +0 -1
  385. package/dist/devbox/commands/sessions.d.ts +0 -3
  386. package/dist/devbox/commands/sessions.d.ts.map +0 -1
  387. package/dist/devbox/commands/sessions.js +0 -490
  388. package/dist/devbox/commands/sessions.js.map +0 -1
  389. package/dist/devbox/commands/setup.d.ts +0 -36
  390. package/dist/devbox/commands/setup.d.ts.map +0 -1
  391. package/dist/devbox/commands/setup.js +0 -816
  392. package/dist/devbox/commands/setup.js.map +0 -1
  393. package/dist/devbox/commands/setupClaude.d.ts +0 -51
  394. package/dist/devbox/commands/setupClaude.d.ts.map +0 -1
  395. package/dist/devbox/commands/setupClaude.js +0 -202
  396. package/dist/devbox/commands/setupClaude.js.map +0 -1
  397. package/dist/devbox/commands/setupTooling.d.ts +0 -56
  398. package/dist/devbox/commands/setupTooling.d.ts.map +0 -1
  399. package/dist/devbox/commands/setupTooling.js +0 -187
  400. package/dist/devbox/commands/setupTooling.js.map +0 -1
  401. package/dist/devbox/commands/sshAccess.d.ts +0 -31
  402. package/dist/devbox/commands/sshAccess.d.ts.map +0 -1
  403. package/dist/devbox/commands/sshAccess.js +0 -353
  404. package/dist/devbox/commands/sshAccess.js.map +0 -1
  405. package/dist/devbox/commands/sshConfig.d.ts +0 -23
  406. package/dist/devbox/commands/sshConfig.d.ts.map +0 -1
  407. package/dist/devbox/commands/sshConfig.js +0 -366
  408. package/dist/devbox/commands/sshConfig.js.map +0 -1
  409. package/dist/devbox/commands/sshProxy.d.ts +0 -2
  410. package/dist/devbox/commands/sshProxy.d.ts.map +0 -1
  411. package/dist/devbox/commands/sshProxy.js +0 -215
  412. package/dist/devbox/commands/sshProxy.js.map +0 -1
  413. package/dist/devbox/commands/uninstall.d.ts +0 -2
  414. package/dist/devbox/commands/uninstall.d.ts.map +0 -1
  415. package/dist/devbox/commands/uninstall.js +0 -365
  416. package/dist/devbox/commands/uninstall.js.map +0 -1
  417. package/dist/devbox/commands/upgrade.d.ts +0 -14
  418. package/dist/devbox/commands/upgrade.d.ts.map +0 -1
  419. package/dist/devbox/commands/upgrade.js +0 -60
  420. package/dist/devbox/commands/upgrade.js.map +0 -1
  421. package/dist/devbox/commands/version.d.ts +0 -8
  422. package/dist/devbox/commands/version.d.ts.map +0 -1
  423. package/dist/devbox/commands/version.js +0 -134
  424. package/dist/devbox/commands/version.js.map +0 -1
  425. package/dist/devbox/commands/whoami.d.ts +0 -2
  426. package/dist/devbox/commands/whoami.d.ts.map +0 -1
  427. package/dist/devbox/commands/whoami.js +0 -114
  428. package/dist/devbox/commands/whoami.js.map +0 -1
  429. package/dist/devbox/completions/cache.d.ts +0 -53
  430. package/dist/devbox/completions/cache.d.ts.map +0 -1
  431. package/dist/devbox/completions/cache.js +0 -227
  432. package/dist/devbox/completions/cache.js.map +0 -1
  433. package/dist/devbox/completions/index.d.ts +0 -18
  434. package/dist/devbox/completions/index.d.ts.map +0 -1
  435. package/dist/devbox/completions/index.js +0 -759
  436. package/dist/devbox/completions/index.js.map +0 -1
  437. package/dist/devbox/controlPlane.d.ts +0 -460
  438. package/dist/devbox/controlPlane.d.ts.map +0 -1
  439. package/dist/devbox/controlPlane.js +0 -1910
  440. package/dist/devbox/controlPlane.js.map +0 -1
  441. package/dist/devbox/daemonClient.d.ts +0 -44
  442. package/dist/devbox/daemonClient.d.ts.map +0 -1
  443. package/dist/devbox/daemonClient.js +0 -677
  444. package/dist/devbox/daemonClient.js.map +0 -1
  445. package/dist/devbox/e2bExecErrors.d.ts +0 -11
  446. package/dist/devbox/e2bExecErrors.d.ts.map +0 -1
  447. package/dist/devbox/e2bExecErrors.js +0 -19
  448. package/dist/devbox/e2bExecErrors.js.map +0 -1
  449. package/dist/devbox/latency.d.ts +0 -25
  450. package/dist/devbox/latency.d.ts.map +0 -1
  451. package/dist/devbox/latency.js +0 -186
  452. package/dist/devbox/latency.js.map +0 -1
  453. package/dist/devbox/logger.d.ts +0 -2
  454. package/dist/devbox/logger.d.ts.map +0 -1
  455. package/dist/devbox/logger.js +0 -3
  456. package/dist/devbox/logger.js.map +0 -1
  457. package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.d.ts +0 -11
  458. package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.d.ts.map +0 -1
  459. package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.js +0 -118
  460. package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.js.map +0 -1
  461. package/dist/devbox/terminal/osc.d.ts +0 -11
  462. package/dist/devbox/terminal/osc.d.ts.map +0 -1
  463. package/dist/devbox/terminal/osc.js +0 -84
  464. package/dist/devbox/terminal/osc.js.map +0 -1
  465. package/dist/devbox/terminal/sessionProtocol.d.ts +0 -46
  466. package/dist/devbox/terminal/sessionProtocol.d.ts.map +0 -1
  467. package/dist/devbox/terminal/sessionProtocol.js +0 -631
  468. package/dist/devbox/terminal/sessionProtocol.js.map +0 -1
  469. package/dist/devbox/ui/colors.d.ts +0 -19
  470. package/dist/devbox/ui/colors.d.ts.map +0 -1
  471. package/dist/devbox/ui/colors.js +0 -22
  472. package/dist/devbox/ui/colors.js.map +0 -1
  473. package/dist/devbox/ui/copyableUrl.d.ts +0 -4
  474. package/dist/devbox/ui/copyableUrl.d.ts.map +0 -1
  475. package/dist/devbox/ui/copyableUrl.js +0 -10
  476. package/dist/devbox/ui/copyableUrl.js.map +0 -1
  477. package/dist/devbox/ui/qr.d.ts +0 -3
  478. package/dist/devbox/ui/qr.d.ts.map +0 -1
  479. package/dist/devbox/ui/qr.js +0 -17
  480. package/dist/devbox/ui/qr.js.map +0 -1
  481. package/dist/devbox/ui/statusLine.d.ts +0 -14
  482. package/dist/devbox/ui/statusLine.d.ts.map +0 -1
  483. package/dist/devbox/ui/statusLine.js +0 -92
  484. package/dist/devbox/ui/statusLine.js.map +0 -1
  485. package/dist/devbox/updateNotice.d.ts +0 -2
  486. package/dist/devbox/updateNotice.d.ts.map +0 -1
  487. package/dist/devbox/updateNotice.js +0 -43
  488. package/dist/devbox/updateNotice.js.map +0 -1
@@ -1,987 +0,0 @@
1
- import { spawn, spawnSync } from "node:child_process";
2
- import fs from "node:fs/promises";
3
- import os from "node:os";
4
- import path from "node:path";
5
- import { resolveProjectWorkdir, resolveSocketInfo, } from "@boxes-dev/core";
6
- import { DAEMON_TIMEOUT_MS, ensureDaemonRunning, requestJson, requireDaemonFeatures, throwDaemonResponseError, } from "../daemonClient.js";
7
- import { logger } from "../logger.js";
8
- import { selectDevbox } from "./boxSelect.js";
9
- import { resolveCommandComputeProvider } from "./commandProvider.js";
10
- import { resolveRuntimeClient } from "./runtimeClient.js";
11
- import { ensureKnownHostsFile, ensureLocalSshKey, ensureRemoteSshAccess, ensureSshdService, getKnownHostsPath, getManagedSshConfigPath, getManagedSshKeyPath, readLocalSshPublicKey, resolveRemoteHome, resolveRemoteSshUser, } from "./sshAccess.js";
12
- import { ensureSshConfigInclude, readManagedSshEntries, resolveMainSshConfigPath, resolveManagedHostAlias, resolveManagedHostKeyAlias, writeManagedSshEntries, } from "./sshConfig.js";
13
- import { parseCommandArgs, readBooleanFlag, readStringFlag, } from "../commandRegistry/args.js";
14
- import { usageError } from "../commandRegistry/errors.js";
15
- import { createStatusLine } from "../ui/statusLine.js";
16
- const IDE_USAGE = [
17
- "Usage:",
18
- " dvb ide setup [<box>] [--all] [--json]",
19
- " dvb ide doctor [<box>] [--all] [--editor <vscode|jetbrains|all>] [--json]",
20
- " dvb ide open <box> --editor <vscode|jetbrains> [--path <remote-path>] [--ide <jetbrains-ide>]",
21
- ].join("\n");
22
- const VS_CODE_SETTINGS_RELATIVE_PATH = process.platform === "darwin"
23
- ? path.join("Library", "Application Support", "Code", "User", "settings.json")
24
- : path.join(".config", "Code", "User", "settings.json");
25
- const JETBRAINS_MIN_DISK_KB = 5_000_000;
26
- const JETBRAINS_MIN_CPU_COUNT = 2;
27
- const JETBRAINS_MIN_MEM_KB = 4_000_000;
28
- const JETBRAINS_IDE_CODE_TO_LABEL = new Map([
29
- ["AI", "Android Studio"],
30
- ["CL", "CLion"],
31
- ["DB", "DataGrip"],
32
- ["GO", "GoLand"],
33
- ["IU", "IntelliJ IDEA Ultimate"],
34
- ["PS", "PhpStorm"],
35
- ["PY", "PyCharm"],
36
- ["RD", "Rider"],
37
- ["RM", "RubyMine"],
38
- ["RR", "RustRover"],
39
- ["WS", "WebStorm"],
40
- ]);
41
- const JETBRAINS_IDE_NAME_TO_CODE = new Map([
42
- ["android-studio", "AI"],
43
- ["androidstudio", "AI"],
44
- ["clion", "CL"],
45
- ["datagrip", "DB"],
46
- ["goland", "GO"],
47
- ["idea", "IU"],
48
- ["intellij", "IU"],
49
- ["intellij-idea", "IU"],
50
- ["intellij-ultimate", "IU"],
51
- ["phpstorm", "PS"],
52
- ["pycharm", "PY"],
53
- ["pycharm-professional", "PY"],
54
- ["rider", "RD"],
55
- ["rubymine", "RM"],
56
- ["rustrover", "RR"],
57
- ["webstorm", "WS"],
58
- ]);
59
- const shellEscape = (value) => `'${value.replace(/'/g, `'\\''`)}'`;
60
- const commandExists = (command) => {
61
- const checker = process.platform === "win32" ? "where" : "which";
62
- const result = spawnSync(checker, [command], { stdio: "ignore" });
63
- return result.status === 0;
64
- };
65
- const fileExists = async (filePath) => {
66
- try {
67
- await fs.access(filePath);
68
- return true;
69
- }
70
- catch {
71
- return false;
72
- }
73
- };
74
- const readTextFile = async (filePath) => {
75
- try {
76
- return await fs.readFile(filePath, "utf8");
77
- }
78
- catch (error) {
79
- if (error instanceof Error &&
80
- "code" in error &&
81
- error.code === "ENOENT") {
82
- return null;
83
- }
84
- throw error;
85
- }
86
- };
87
- const normalizeBoxKey = (value) => {
88
- if (typeof value !== "string") {
89
- return null;
90
- }
91
- const trimmed = value.trim();
92
- return trimmed.length > 0 ? trimmed : null;
93
- };
94
- const parseEditor = (value, mode) => {
95
- if (value === "vscode" || value === "jetbrains") {
96
- return value;
97
- }
98
- if (mode === "doctor" && value === "all") {
99
- return value;
100
- }
101
- throw new Error(mode === "doctor"
102
- ? "Expected --editor to be one of: vscode, jetbrains, all."
103
- : "Expected --editor to be one of: vscode, jetbrains.");
104
- };
105
- const parseSetupArgs = (args) => {
106
- const { flags, positionals } = parseCommandArgs({
107
- args,
108
- commandPath: ["ide", "setup"],
109
- flagLabel: "ide setup",
110
- boolean: ["all", "json"],
111
- });
112
- if (positionals.length > 1) {
113
- throw usageError(["ide", "setup"], `Unexpected argument: ${positionals[1]}`);
114
- }
115
- const parsed = {
116
- all: readBooleanFlag(flags, "all"),
117
- json: readBooleanFlag(flags, "json"),
118
- ...(positionals[0] ? { box: positionals[0] } : {}),
119
- };
120
- if (parsed.all && parsed.box) {
121
- throw usageError(["ide", "setup"], "Use either <box> or --all, not both.");
122
- }
123
- return parsed;
124
- };
125
- const parseDoctorArgs = (args) => {
126
- const { flags, positionals } = parseCommandArgs({
127
- args,
128
- commandPath: ["ide", "doctor"],
129
- flagLabel: "ide doctor",
130
- boolean: ["all", "json"],
131
- string: ["editor"],
132
- });
133
- if (positionals.length > 1) {
134
- throw usageError(["ide", "doctor"], `Unexpected argument: ${positionals[1]}`);
135
- }
136
- const editor = readStringFlag(flags, "editor");
137
- const parsed = {
138
- all: readBooleanFlag(flags, "all"),
139
- json: readBooleanFlag(flags, "json"),
140
- editor: editor ? parseEditor(editor, "doctor") : "all",
141
- ...(positionals[0] ? { box: positionals[0] } : {}),
142
- };
143
- if (parsed.all && parsed.box) {
144
- throw usageError(["ide", "doctor"], "Use either <box> or --all, not both.");
145
- }
146
- return parsed;
147
- };
148
- const parseOpenArgs = (args) => {
149
- const { flags, positionals } = parseCommandArgs({
150
- args,
151
- commandPath: ["ide", "open"],
152
- flagLabel: "ide open",
153
- string: ["editor", "ide", "path"],
154
- });
155
- if (positionals.length === 0) {
156
- throw usageError(["ide", "open"], "Usage: dvb ide open <box> --editor <vscode|jetbrains> [--path <remote-path>] [--ide <jetbrains-ide>]");
157
- }
158
- if (positionals.length > 1) {
159
- throw usageError(["ide", "open"], `Unexpected argument: ${positionals[1]}`);
160
- }
161
- const editor = readStringFlag(flags, "editor");
162
- if (!editor) {
163
- throw usageError(["ide", "open"], "dvb ide open requires --editor <vscode|jetbrains>.");
164
- }
165
- const box = positionals[0];
166
- if (!box) {
167
- throw usageError(["ide", "open"], "Usage: dvb ide open <box> --editor <vscode|jetbrains> [--path <remote-path>] [--ide <jetbrains-ide>]");
168
- }
169
- const parsedEditor = parseEditor(editor, "open");
170
- const ide = parseJetBrainsIdeHint(readStringFlag(flags, "ide"));
171
- if (ide && parsedEditor !== "jetbrains") {
172
- throw usageError(["ide", "open"], "Use --ide only with --editor jetbrains.");
173
- }
174
- return {
175
- box,
176
- editor: parsedEditor,
177
- path: readStringFlag(flags, "path") ?? null,
178
- ide,
179
- };
180
- };
181
- const parseJetBrainsIdeHint = (value) => {
182
- const normalized = value?.trim();
183
- if (!normalized) {
184
- return null;
185
- }
186
- const named = JETBRAINS_IDE_NAME_TO_CODE.get(normalized.toLowerCase());
187
- if (named) {
188
- return named;
189
- }
190
- const upper = normalized.toUpperCase();
191
- const prefix = upper.split("-", 1)[0] ?? upper;
192
- if (JETBRAINS_IDE_CODE_TO_LABEL.has(prefix)) {
193
- return upper;
194
- }
195
- throw new Error("Expected --ide to be one of: pycharm, intellij, webstorm, goland, clion, rider, phpstorm, rubymine, datagrip, rustrover, android-studio, or a supported JetBrains product code.");
196
- };
197
- const resolveJetBrainsIdeLabel = (ideHint) => {
198
- if (!ideHint) {
199
- return null;
200
- }
201
- const prefix = ideHint.split("-", 1)[0] ?? ideHint;
202
- return JETBRAINS_IDE_CODE_TO_LABEL.get(prefix) ?? ideHint;
203
- };
204
- const addFinding = (findings, level, scope, code, message) => {
205
- findings.push({ level, scope, code, message });
206
- };
207
- const hasErrors = (findings) => findings.some((finding) => finding.level === "error");
208
- const loadBoxes = async (socketPath) => {
209
- const response = await requestJson(socketPath, "GET", "/boxes", DAEMON_TIMEOUT_MS.registry);
210
- if (response.status !== 200) {
211
- throwDaemonResponseError(response);
212
- }
213
- return response.body.boxes;
214
- };
215
- const resolveBoxSummary = (boxes, target) => {
216
- const normalizedTarget = normalizeBoxKey(target);
217
- if (!normalizedTarget) {
218
- return null;
219
- }
220
- return (boxes.find((entry) => normalizeBoxKey(entry.alias) === normalizedTarget) ??
221
- boxes.find((entry) => normalizeBoxKey(entry.canonical) === normalizedTarget) ??
222
- null);
223
- };
224
- const resolveIdeTarget = async ({ boxes, target, }) => {
225
- const matched = resolveBoxSummary(boxes, target);
226
- if (!matched) {
227
- throw new Error(`Unknown devbox: ${target}`);
228
- }
229
- const providerTarget = await resolveCommandComputeProvider({
230
- box: matched.alias?.trim() || matched.canonical,
231
- boxes: [...boxes],
232
- homeDir: process.env.HOME ?? os.homedir(),
233
- });
234
- const canonical = normalizeBoxKey(matched.canonical);
235
- const instanceId = normalizeBoxKey(matched.instanceId);
236
- if (!canonical) {
237
- throw new Error(`Devbox "${providerTarget.alias}" is missing canonical metadata.`);
238
- }
239
- if (!instanceId) {
240
- throw new Error(`Devbox "${providerTarget.alias}" is missing instanceId metadata. Restart dvbd and retry.`);
241
- }
242
- return {
243
- alias: providerTarget.alias,
244
- canonical,
245
- computeProvider: providerTarget.computeProvider,
246
- instanceId,
247
- };
248
- };
249
- const resolveTargets = async ({ socketPath, boxes, box, all, reminder, }) => {
250
- if (all) {
251
- const aliases = boxes
252
- .map((entry) => normalizeBoxKey(entry.alias))
253
- .filter((value) => value !== null);
254
- if (aliases.length === 0) {
255
- throw new Error("No devboxes found. Use `dvb init` to create one.");
256
- }
257
- return aliases;
258
- }
259
- if (box) {
260
- return [box];
261
- }
262
- const selected = await selectDevbox(reminder);
263
- return selected ? [selected.box] : [];
264
- };
265
- const buildVsCodeFolderUri = ({ hostAlias, remotePath, }) => {
266
- if (!remotePath.startsWith("/")) {
267
- throw new Error(`VS Code remote path must be absolute: ${remotePath}`);
268
- }
269
- const uri = new URL(`vscode-remote://ssh-remote+${hostAlias}`);
270
- uri.pathname = remotePath;
271
- return uri.toString();
272
- };
273
- const buildJetBrainsGatewayUrl = ({ hostAlias, sshUser, remotePath, ideHint, }) => {
274
- if (!remotePath.startsWith("/")) {
275
- throw new Error(`JetBrains remote path must be absolute: ${remotePath}`);
276
- }
277
- const uri = new URL("jetbrains://gateway/ssh/environment");
278
- uri.searchParams.set("h", hostAlias);
279
- uri.searchParams.set("u", sshUser);
280
- uri.searchParams.set("p", "22");
281
- uri.searchParams.set("projectHint", remotePath);
282
- uri.searchParams.set("launchIde", "true");
283
- if (ideHint) {
284
- uri.searchParams.set("ideHint", ideHint);
285
- }
286
- return uri.toString();
287
- };
288
- const spawnDetached = async (command, args) => await new Promise((resolve, reject) => {
289
- const child = spawn(command, args, {
290
- stdio: "ignore",
291
- detached: true,
292
- });
293
- child.once("error", reject);
294
- child.once("spawn", () => {
295
- child.unref();
296
- resolve();
297
- });
298
- });
299
- const resolvePlatformOpener = () => {
300
- if (process.platform === "darwin") {
301
- return { command: "open", args: (value) => [value] };
302
- }
303
- if (process.platform === "linux") {
304
- return { command: "xdg-open", args: (value) => [value] };
305
- }
306
- if (process.platform === "win32") {
307
- return {
308
- command: "cmd",
309
- args: (value) => ["/c", "start", "", value],
310
- };
311
- }
312
- return null;
313
- };
314
- const resolveVsCodeSettingsOverride = async () => {
315
- const homeDir = process.env.HOME ?? os.homedir();
316
- const settingsPath = path.join(homeDir, VS_CODE_SETTINGS_RELATIVE_PATH);
317
- const content = await readTextFile(settingsPath);
318
- if (!content) {
319
- return null;
320
- }
321
- const match = content.match(/"remote\.SSH\.configFile"\s*:\s*"([^"]+)"/);
322
- if (!match?.[1]) {
323
- return null;
324
- }
325
- const configured = match[1].replace(/\\"/g, '"');
326
- if (configured.startsWith("~/")) {
327
- return path.join(homeDir, configured.slice(2));
328
- }
329
- return configured;
330
- };
331
- const execRemoteBash = async (client, box, script) => await client.exec(box, ["/bin/bash", "-lc", script]);
332
- const readRemoteFile = async ({ client, box, filePath, }) => {
333
- const result = await execRemoteBash(client, box, `set -euo pipefail\ncat ${shellEscape(filePath)}`);
334
- if (result.exitCode !== 0) {
335
- return null;
336
- }
337
- return result.stdout;
338
- };
339
- const resolveRemoteCommandStatuses = async ({ client, box, commands, }) => {
340
- const unique = [
341
- ...new Set(commands.map((value) => value.trim()).filter(Boolean)),
342
- ];
343
- const script = [
344
- "set -euo pipefail",
345
- ...unique.flatMap((command) => [
346
- `if command -v ${shellEscape(command)} >/dev/null 2>&1; then`,
347
- ` printf '%s\\n' ${shellEscape(`${command}=1`)}`,
348
- "else",
349
- ` printf '%s\\n' ${shellEscape(`${command}=0`)}`,
350
- "fi",
351
- ]),
352
- ].join("\n");
353
- const result = await execRemoteBash(client, box, script);
354
- if (result.exitCode !== 0) {
355
- throw new Error(result.stderr.trim() || "remote command probe failed");
356
- }
357
- const statuses = new Map();
358
- for (const line of result.stdout.split(/\r?\n/)) {
359
- const [name, value] = line.split("=");
360
- if (!name)
361
- continue;
362
- statuses.set(name, value === "1");
363
- }
364
- return statuses;
365
- };
366
- const resolveJetBrainsHostStats = async ({ client, box, }) => {
367
- const script = [
368
- "set -euo pipefail",
369
- 'cache="missing"',
370
- 'if [ -d "$HOME/.cache" ]; then',
371
- ' if [ -w "$HOME/.cache" ]; then cache="writable"; else cache="not_writable"; fi',
372
- "fi",
373
- 'printf "cache=%s\\n" "$cache"',
374
- 'printf "diskKb=%s\\n" "$(df -Pk "$HOME" 2>/dev/null | awk \'NR==2 {print $4}\')"',
375
- 'printf "cpu=%s\\n" "$(getconf _NPROCESSORS_ONLN 2>/dev/null || nproc 2>/dev/null || true)"',
376
- 'printf "memKb=%s\\n" "$(awk \'/MemTotal:/ {print $2}\' /proc/meminfo 2>/dev/null || true)"',
377
- ].join("\n");
378
- const result = await execRemoteBash(client, box, script);
379
- if (result.exitCode !== 0) {
380
- throw new Error(result.stderr.trim() || "remote host stats probe failed");
381
- }
382
- const values = new Map();
383
- for (const line of result.stdout.split(/\r?\n/)) {
384
- const [key, ...rest] = line.split("=");
385
- if (!key)
386
- continue;
387
- values.set(key, rest.join("="));
388
- }
389
- return {
390
- cache: values.get("cache") ?? "missing",
391
- diskKb: Number.parseInt(values.get("diskKb") ?? "", 10),
392
- cpu: Number.parseInt(values.get("cpu") ?? "", 10),
393
- memKb: Number.parseInt(values.get("memKb") ?? "", 10),
394
- };
395
- };
396
- const checkRemoteHttpReachability = async ({ client, box, url, }) => {
397
- const script = [
398
- "set -euo pipefail",
399
- "if command -v curl >/dev/null 2>&1; then",
400
- ` curl -fsSI --max-time 5 ${shellEscape(url)} >/dev/null`,
401
- " exit 0",
402
- "fi",
403
- "if command -v wget >/dev/null 2>&1; then",
404
- ` wget -q --spider --timeout=5 ${shellEscape(url)}`,
405
- " exit 0",
406
- "fi",
407
- "exit 2",
408
- ].join("\n");
409
- const result = await execRemoteBash(client, box, script);
410
- if (result.exitCode === 0) {
411
- return "ok";
412
- }
413
- if (result.exitCode === 2) {
414
- return "missing_tool";
415
- }
416
- return "failed";
417
- };
418
- const prepareManagedEntry = async ({ target, requireWorkdir, onStage, }) => {
419
- onStage?.("connecting to runtime");
420
- const client = await resolveRuntimeClient({
421
- provider: target.computeProvider,
422
- alias: target.alias,
423
- targetBox: target.alias,
424
- cwd: process.cwd(),
425
- serviceRole: "system",
426
- });
427
- onStage?.("authorizing SSH access");
428
- const publicKey = await readLocalSshPublicKey();
429
- const remoteSshAccess = await ensureRemoteSshAccess({
430
- client,
431
- box: target.alias,
432
- publicKey,
433
- computeProvider: target.computeProvider,
434
- });
435
- onStage?.("ensuring sshd");
436
- await ensureSshdService(client, target.alias, target.computeProvider);
437
- onStage?.("detecting project workdir");
438
- const workdir = await resolveProjectWorkdir(client, target.alias);
439
- if (requireWorkdir && !workdir) {
440
- throw new Error(`Remote project workdir was not found for "${target.alias}". Run \`dvb init --resume\` in the repo first.`);
441
- }
442
- const hostAlias = resolveManagedHostAlias(target.alias);
443
- const hostKeyAlias = resolveManagedHostKeyAlias(target.instanceId);
444
- return {
445
- entry: {
446
- boxAlias: target.alias,
447
- hostAlias,
448
- hostKeyAlias,
449
- instanceId: target.instanceId,
450
- sshUser: remoteSshAccess.sshUser,
451
- workdir,
452
- computeProvider: target.computeProvider,
453
- },
454
- workdir,
455
- sshUser: remoteSshAccess.sshUser,
456
- };
457
- };
458
- const ensureAbsoluteRemotePath = (remotePath) => {
459
- if (!remotePath.startsWith("/")) {
460
- throw new Error(`Remote path must be absolute: ${remotePath}`);
461
- }
462
- return remotePath;
463
- };
464
- const printSetupHuman = (successes, failures) => {
465
- if (successes.length > 0) {
466
- console.log("Configured SSH hosts:");
467
- for (const result of successes) {
468
- console.log(` ${result.hostAlias} -> ${result.workdir}`);
469
- }
470
- }
471
- if (failures.length > 0) {
472
- console.error("Failed boxes:");
473
- for (const failure of failures) {
474
- console.error(` ${failure.box}: ${failure.error}`);
475
- }
476
- }
477
- };
478
- const printDoctorHuman = (results) => {
479
- for (const result of results) {
480
- console.log(`${result.box} (${result.hostAlias})`);
481
- for (const finding of result.findings) {
482
- console.log(` [${finding.level}] ${finding.scope}:${finding.code} ${finding.message}`);
483
- }
484
- console.log("");
485
- }
486
- };
487
- const runIdeSetup = async (args) => {
488
- const parsed = parseSetupArgs(args);
489
- const socketInfo = resolveSocketInfo();
490
- const statusEnabled = process.stderr.isTTY && !parsed.json;
491
- const status = createStatusLine({ enabled: statusEnabled });
492
- logger.info("ide_setup_start", {
493
- box: parsed.box ?? null,
494
- all: parsed.all,
495
- });
496
- const run = async () => {
497
- status.stage("Starting dvbd");
498
- await ensureDaemonRunning(socketInfo.socketPath);
499
- status.stage("Checking dvbd IDE support");
500
- await requireDaemonFeatures(socketInfo.socketPath, [
501
- "boxes",
502
- "registry",
503
- "ports.forward.owners",
504
- ]);
505
- status.stage("Loading devboxes");
506
- const boxes = await loadBoxes(socketInfo.socketPath);
507
- if (!parsed.box && !parsed.all) {
508
- status.stop();
509
- }
510
- const targets = await resolveTargets({
511
- socketPath: socketInfo.socketPath,
512
- boxes,
513
- box: parsed.box,
514
- all: parsed.all,
515
- reminder: "Use `dvb ide setup <box>` to target a specific box.",
516
- });
517
- if (targets.length === 0) {
518
- return;
519
- }
520
- status.stage("Preparing local SSH files");
521
- await ensureLocalSshKey();
522
- await ensureKnownHostsFile();
523
- await ensureSshConfigInclude();
524
- const successes = [];
525
- const failures = [];
526
- const nextEntries = parsed.all
527
- ? new Map()
528
- : await readManagedSshEntries();
529
- for (const [index, target] of targets.entries()) {
530
- const targetPosition = `${index + 1}/${targets.length}`;
531
- try {
532
- status.stage(`Resolving devbox ${targetPosition}: ${target}`);
533
- const resolvedTarget = await resolveIdeTarget({
534
- boxes,
535
- target,
536
- });
537
- const prepared = await prepareManagedEntry({
538
- target: resolvedTarget,
539
- requireWorkdir: true,
540
- onStage: (detail) => status.stage(`Configuring ${resolvedTarget.alias} (${targetPosition}): ${detail}`),
541
- });
542
- nextEntries.set(prepared.entry.hostAlias, prepared.entry);
543
- if (!prepared.workdir) {
544
- throw new Error(`Remote project workdir was not found for "${resolvedTarget.alias}".`);
545
- }
546
- successes.push({
547
- box: resolvedTarget.alias,
548
- hostAlias: prepared.entry.hostAlias,
549
- workdir: prepared.workdir,
550
- sshUser: prepared.sshUser,
551
- instanceId: resolvedTarget.instanceId,
552
- });
553
- }
554
- catch (error) {
555
- failures.push({
556
- box: target,
557
- error: error instanceof Error ? error.message : String(error),
558
- });
559
- }
560
- }
561
- status.stage("Writing managed SSH config");
562
- await writeManagedSshEntries(nextEntries.values());
563
- const ok = failures.length === 0;
564
- logger.info(ok ? "ide_setup_complete" : "ide_setup_failed", {
565
- box: parsed.box ?? null,
566
- all: parsed.all,
567
- successes: successes.length,
568
- failures: failures.length,
569
- });
570
- status.stop();
571
- if (parsed.json) {
572
- console.log(JSON.stringify({
573
- ok,
574
- configured: successes,
575
- errors: failures,
576
- }, null, 2));
577
- if (!ok) {
578
- process.exitCode = 1;
579
- }
580
- return;
581
- }
582
- printSetupHuman(successes, failures);
583
- if (!ok) {
584
- process.exitCode = 1;
585
- }
586
- };
587
- try {
588
- await run();
589
- }
590
- finally {
591
- status.stop();
592
- }
593
- };
594
- const runIdeDoctor = async (args) => {
595
- const parsed = parseDoctorArgs(args);
596
- const socketInfo = resolveSocketInfo();
597
- logger.info("ide_doctor_start", {
598
- box: parsed.box ?? null,
599
- all: parsed.all,
600
- editor: parsed.editor,
601
- });
602
- await ensureDaemonRunning(socketInfo.socketPath);
603
- await requireDaemonFeatures(socketInfo.socketPath, [
604
- "boxes",
605
- "registry",
606
- "ports.forward.owners",
607
- ]);
608
- const boxes = await loadBoxes(socketInfo.socketPath);
609
- const targets = await resolveTargets({
610
- socketPath: socketInfo.socketPath,
611
- boxes,
612
- box: parsed.box,
613
- all: parsed.all,
614
- reminder: "Use `dvb ide doctor <box>` to target a specific box.",
615
- });
616
- if (targets.length === 0) {
617
- return;
618
- }
619
- const mainConfigPath = resolveMainSshConfigPath();
620
- const mainConfig = await readTextFile(mainConfigPath);
621
- const managedEntries = await readManagedSshEntries();
622
- const managedConfigExists = await fileExists(getManagedSshConfigPath());
623
- const keyExists = await fileExists(getManagedSshKeyPath());
624
- const knownHostsExists = await fileExists(getKnownHostsPath());
625
- const vsCodeOverride = parsed.editor === "vscode" || parsed.editor === "all"
626
- ? await resolveVsCodeSettingsOverride()
627
- : null;
628
- const results = [];
629
- for (const target of targets) {
630
- const resolvedTarget = await resolveIdeTarget({
631
- boxes,
632
- target,
633
- });
634
- const hostAlias = resolveManagedHostAlias(resolvedTarget.alias);
635
- const findings = [];
636
- const expectedHostKeyAlias = resolveManagedHostKeyAlias(resolvedTarget.instanceId);
637
- const managedEntry = managedEntries.get(hostAlias);
638
- if (mainConfig &&
639
- mainConfig.includes("# >>> dvb ssh include >>>") &&
640
- mainConfig.includes("# <<< dvb ssh include <<<")) {
641
- addFinding(findings, "ok", "local", "ssh_include", `managed include present in ${mainConfigPath}`);
642
- }
643
- else {
644
- addFinding(findings, "error", "local", "ssh_include", `managed include missing from ${mainConfigPath}`);
645
- }
646
- addFinding(findings, managedConfigExists ? "ok" : "error", "local", "managed_config", managedConfigExists
647
- ? `managed SSH config exists at ${getManagedSshConfigPath()}`
648
- : `managed SSH config missing at ${getManagedSshConfigPath()}`);
649
- addFinding(findings, keyExists ? "ok" : "error", "local", "ssh_key", keyExists
650
- ? `managed SSH key exists at ${getManagedSshKeyPath()}`
651
- : `managed SSH key missing at ${getManagedSshKeyPath()}`);
652
- addFinding(findings, knownHostsExists ? "ok" : "error", "local", "known_hosts", knownHostsExists
653
- ? `managed known_hosts exists at ${getKnownHostsPath()}`
654
- : `managed known_hosts missing at ${getKnownHostsPath()}`);
655
- if (!managedEntry) {
656
- addFinding(findings, "error", "local", "host_entry", `managed SSH host entry missing for ${hostAlias}; run \`dvb ide setup ${resolvedTarget.alias}\``);
657
- }
658
- else {
659
- addFinding(findings, managedEntry.hostKeyAlias === expectedHostKeyAlias &&
660
- managedEntry.instanceId === resolvedTarget.instanceId
661
- ? "ok"
662
- : "error", "local", "host_entry", managedEntry.hostKeyAlias === expectedHostKeyAlias &&
663
- managedEntry.instanceId === resolvedTarget.instanceId
664
- ? `managed SSH host entry exists for ${hostAlias}`
665
- : `managed SSH host entry for ${hostAlias} is stale; run \`dvb ide setup ${resolvedTarget.alias}\``);
666
- }
667
- if (vsCodeOverride) {
668
- const expectedConfigPath = resolveMainSshConfigPath();
669
- addFinding(findings, path.resolve(vsCodeOverride) === path.resolve(expectedConfigPath)
670
- ? "ok"
671
- : "warn", "vscode", "config_file", path.resolve(vsCodeOverride) === path.resolve(expectedConfigPath)
672
- ? `VS Code Remote-SSH uses ${expectedConfigPath}`
673
- : `VS Code remote.SSH.configFile points to ${vsCodeOverride}; the managed include lives in ${expectedConfigPath}`);
674
- }
675
- if (parsed.editor === "vscode" || parsed.editor === "all") {
676
- addFinding(findings, commandExists("code") ? "ok" : "warn", "vscode", "local_cli", commandExists("code")
677
- ? "VS Code CLI (`code`) is available locally"
678
- : "VS Code CLI (`code`) is not on PATH; `dvb ide open --editor vscode` will fail locally");
679
- }
680
- if (parsed.editor === "jetbrains" || parsed.editor === "all") {
681
- const opener = resolvePlatformOpener();
682
- addFinding(findings, opener && commandExists(opener.command) ? "ok" : "warn", "jetbrains", "local_opener", opener && commandExists(opener.command)
683
- ? `platform URL opener (${opener.command}) is available locally`
684
- : "no supported platform URL opener is available locally for JetBrains Gateway links");
685
- }
686
- try {
687
- const client = await resolveRuntimeClient({
688
- provider: resolvedTarget.computeProvider,
689
- alias: resolvedTarget.alias,
690
- targetBox: resolvedTarget.alias,
691
- cwd: process.cwd(),
692
- });
693
- const sshUser = await resolveRemoteSshUser(client, resolvedTarget.alias);
694
- addFinding(findings, "ok", "remote", "ssh_user", `remote SSH user resolves to ${sshUser}`);
695
- const remoteHome = await resolveRemoteHome(client, resolvedTarget.alias);
696
- addFinding(findings, "ok", "remote", "remote_home", `remote home resolves to ${remoteHome}`);
697
- const workdir = await resolveProjectWorkdir(client, resolvedTarget.alias);
698
- addFinding(findings, workdir ? "ok" : "error", "remote", "workdir", workdir
699
- ? `remote project workdir resolves to ${workdir}`
700
- : "remote project workdir is missing; rerun `dvb init --resume` for this repo");
701
- const service = await client.getService(resolvedTarget.alias, "devbox-sshd");
702
- const serviceStatus = service?.state?.status ?? "missing";
703
- addFinding(findings, serviceStatus === "running" ? "ok" : "error", "remote", "sshd_service", serviceStatus === "running"
704
- ? "devbox-sshd is running"
705
- : serviceStatus === "missing"
706
- ? "devbox-sshd service is missing"
707
- : `devbox-sshd is ${serviceStatus}`);
708
- const sshdConfigPath = `${remoteHome}/.devbox/ssh/sshd_config`;
709
- const sshdConfig = await readRemoteFile({
710
- client,
711
- box: resolvedTarget.alias,
712
- filePath: sshdConfigPath,
713
- });
714
- if (!sshdConfig) {
715
- addFinding(findings, "error", "remote", "sshd_config", `remote SSH config missing at ${sshdConfigPath}`);
716
- }
717
- else {
718
- const requiredLines = [
719
- "AllowTcpForwarding yes",
720
- "AllowStreamLocalForwarding yes",
721
- "GatewayPorts no",
722
- "X11Forwarding no",
723
- ];
724
- const missingLines = requiredLines.filter((line) => !sshdConfig.includes(line));
725
- addFinding(findings, missingLines.length === 0 ? "ok" : "error", "remote", "sshd_config", missingLines.length === 0
726
- ? "remote SSH config contains required forwarding settings"
727
- : `remote SSH config is missing: ${missingLines.join(", ")}`);
728
- }
729
- const commonCommandStatuses = await resolveRemoteCommandStatuses({
730
- client,
731
- box: resolvedTarget.alias,
732
- commands: ["bash", "tar", "curl", "wget"],
733
- });
734
- const hasCurlOrWget = commonCommandStatuses.get("curl") || commonCommandStatuses.get("wget");
735
- addFinding(findings, commonCommandStatuses.get("bash") ? "ok" : "error", "remote", "bash", commonCommandStatuses.get("bash")
736
- ? "`bash` is available remotely"
737
- : "`bash` is missing remotely");
738
- addFinding(findings, commonCommandStatuses.get("tar") ? "ok" : "error", "remote", "tar", commonCommandStatuses.get("tar")
739
- ? "`tar` is available remotely"
740
- : "`tar` is missing remotely");
741
- addFinding(findings, hasCurlOrWget ? "ok" : "error", "remote", "fetch_tool", hasCurlOrWget
742
- ? "`curl` or `wget` is available remotely"
743
- : "`curl` and `wget` are both missing remotely");
744
- if (parsed.editor === "vscode" || parsed.editor === "all") {
745
- const vscodeConnectivity = await checkRemoteHttpReachability({
746
- client,
747
- box: resolvedTarget.alias,
748
- url: "https://update.code.visualstudio.com/",
749
- });
750
- addFinding(findings, vscodeConnectivity === "ok" ? "ok" : "warn", "vscode", "outbound", vscodeConnectivity === "ok"
751
- ? "remote outbound connectivity for VS Code server downloads looks healthy"
752
- : "remote outbound connectivity for VS Code server downloads could not be confirmed");
753
- }
754
- if (parsed.editor === "jetbrains" || parsed.editor === "all") {
755
- const jetbrainsCommands = await resolveRemoteCommandStatuses({
756
- client,
757
- box: resolvedTarget.alias,
758
- commands: [
759
- "dd",
760
- "chmod",
761
- "test",
762
- "mkdir",
763
- "echo",
764
- "mv",
765
- "uname",
766
- "command",
767
- "gzip",
768
- ],
769
- });
770
- for (const command of [
771
- "dd",
772
- "chmod",
773
- "test",
774
- "mkdir",
775
- "echo",
776
- "mv",
777
- "uname",
778
- "command",
779
- "gzip",
780
- ]) {
781
- const present = jetbrainsCommands.get(command);
782
- addFinding(findings, present ? "ok" : "error", "jetbrains", `cmd_${command}`, present
783
- ? `JetBrains helper command \`${command}\` is available remotely`
784
- : `JetBrains helper command \`${command}\` is missing remotely`);
785
- }
786
- const stats = await resolveJetBrainsHostStats({
787
- client,
788
- box: resolvedTarget.alias,
789
- });
790
- addFinding(findings, stats.cache === "writable" ? "ok" : "warn", "jetbrains", "cache", stats.cache === "writable"
791
- ? "$HOME/.cache is writable"
792
- : stats.cache === "not_writable"
793
- ? "$HOME/.cache exists but is not writable"
794
- : "$HOME/.cache is missing");
795
- addFinding(findings, Number.isFinite(stats.diskKb) && stats.diskKb >= JETBRAINS_MIN_DISK_KB
796
- ? "ok"
797
- : "warn", "jetbrains", "disk", Number.isFinite(stats.diskKb)
798
- ? `free disk under $HOME is ${Math.floor(stats.diskKb / 1024)} MB`
799
- : "free disk under $HOME could not be determined");
800
- addFinding(findings, Number.isFinite(stats.cpu) && stats.cpu >= JETBRAINS_MIN_CPU_COUNT
801
- ? "ok"
802
- : "warn", "jetbrains", "cpu", Number.isFinite(stats.cpu)
803
- ? `remote CPU count is ${stats.cpu}`
804
- : "remote CPU count could not be determined");
805
- addFinding(findings, Number.isFinite(stats.memKb) && stats.memKb >= JETBRAINS_MIN_MEM_KB
806
- ? "ok"
807
- : "warn", "jetbrains", "memory", Number.isFinite(stats.memKb)
808
- ? `remote memory is ${Math.floor(stats.memKb / 1024)} MB`
809
- : "remote memory could not be determined");
810
- const jetbrainsConnectivity = await checkRemoteHttpReachability({
811
- client,
812
- box: resolvedTarget.alias,
813
- url: "https://download.jetbrains.com/",
814
- });
815
- addFinding(findings, jetbrainsConnectivity === "ok" ? "ok" : "warn", "jetbrains", "outbound", jetbrainsConnectivity === "ok"
816
- ? "remote outbound connectivity for JetBrains downloads looks healthy"
817
- : "remote outbound connectivity for JetBrains downloads could not be confirmed");
818
- }
819
- }
820
- catch (error) {
821
- addFinding(findings, "error", "remote", "probe_failed", error instanceof Error ? error.message : String(error));
822
- }
823
- results.push({
824
- box: resolvedTarget.alias,
825
- hostAlias,
826
- findings,
827
- });
828
- }
829
- const ok = results.every((result) => !hasErrors(result.findings));
830
- logger.info("ide_doctor_complete", {
831
- box: parsed.box ?? null,
832
- all: parsed.all,
833
- editor: parsed.editor,
834
- ok,
835
- });
836
- if (parsed.json) {
837
- console.log(JSON.stringify({ ok, results }, null, 2));
838
- if (!ok) {
839
- process.exitCode = 1;
840
- }
841
- return;
842
- }
843
- printDoctorHuman(results);
844
- if (!ok) {
845
- process.exitCode = 1;
846
- }
847
- };
848
- const launchVsCode = async ({ hostAlias, remotePath, }) => {
849
- if (!commandExists("code")) {
850
- throw new Error([
851
- "VS Code CLI (`code`) is not on PATH.",
852
- `SSH host alias: ${hostAlias}`,
853
- `Remote path: ${remotePath}`,
854
- `Manual next step: use Remote-SSH to connect to ${hostAlias}, then open ${remotePath}.`,
855
- ].join("\n"));
856
- }
857
- const folderUri = buildVsCodeFolderUri({ hostAlias, remotePath });
858
- await spawnDetached("code", ["--folder-uri", folderUri]);
859
- };
860
- const launchJetBrains = async ({ hostAlias, sshUser, remotePath, ideHint, }) => {
861
- const opener = resolvePlatformOpener();
862
- if (!opener || !commandExists(opener.command)) {
863
- throw new Error([
864
- "A platform URL opener is not available for JetBrains Gateway.",
865
- `SSH host alias: ${hostAlias}`,
866
- `Remote path: ${remotePath}`,
867
- `Manual next step: open JetBrains Toolbox Remote Development, choose SSH host ${hostAlias}, then open ${remotePath}.`,
868
- ].join("\n"));
869
- }
870
- const gatewayUrl = buildJetBrainsGatewayUrl({
871
- hostAlias,
872
- sshUser,
873
- remotePath,
874
- ideHint,
875
- });
876
- await spawnDetached(opener.command, opener.args(gatewayUrl));
877
- };
878
- const printJetBrainsOpenInstructions = ({ box, hostAlias, remotePath, ideHint, }) => {
879
- const ideLabel = resolveJetBrainsIdeLabel(ideHint);
880
- const lines = [
881
- "",
882
- `JetBrains launch requested for ${box}.`,
883
- `SSH host alias: ${hostAlias}`,
884
- `Remote project path: ${remotePath}`,
885
- "",
886
- "Next steps in JetBrains Toolbox:",
887
- `1. Connect to ${hostAlias} and make sure the SSH connection succeeds.`,
888
- ideLabel
889
- ? `2. If ${ideLabel} is not installed for that remote host yet, install it from Toolbox.`
890
- : "2. If your JetBrains IDE is not installed for that remote host yet, install it from Toolbox.",
891
- `3. Open ${remotePath}. The dvb launch already passed this path as the project hint, so it may already be preselected.`,
892
- `4. If the project does not open automatically, use File | Open and choose ${remotePath}.`,
893
- `5. If Toolbox cannot connect or launch the project, run \`dvb ide doctor ${box} --editor jetbrains\`.`,
894
- ];
895
- console.log(lines.join("\n"));
896
- };
897
- const runIdeOpen = async (args) => {
898
- const parsed = parseOpenArgs(args);
899
- const socketInfo = resolveSocketInfo();
900
- logger.info("ide_open_start", {
901
- box: parsed.box,
902
- editor: parsed.editor,
903
- });
904
- await ensureDaemonRunning(socketInfo.socketPath);
905
- await requireDaemonFeatures(socketInfo.socketPath, [
906
- "boxes",
907
- "registry",
908
- "ports.forward.owners",
909
- ]);
910
- const boxes = await loadBoxes(socketInfo.socketPath);
911
- const resolvedTarget = await resolveIdeTarget({
912
- boxes,
913
- target: parsed.box,
914
- });
915
- await ensureLocalSshKey();
916
- await ensureKnownHostsFile();
917
- await ensureSshConfigInclude();
918
- const existingEntries = await readManagedSshEntries();
919
- const prepared = await prepareManagedEntry({
920
- target: resolvedTarget,
921
- requireWorkdir: parsed.path === null,
922
- });
923
- existingEntries.set(prepared.entry.hostAlias, prepared.entry);
924
- await writeManagedSshEntries(existingEntries.values());
925
- const remotePath = ensureAbsoluteRemotePath(parsed.path ?? prepared.workdir ?? "");
926
- if (parsed.editor === "vscode") {
927
- await launchVsCode({
928
- hostAlias: prepared.entry.hostAlias,
929
- remotePath,
930
- });
931
- }
932
- else {
933
- await launchJetBrains({
934
- hostAlias: prepared.entry.hostAlias,
935
- sshUser: prepared.sshUser,
936
- remotePath,
937
- ideHint: parsed.ide,
938
- });
939
- printJetBrainsOpenInstructions({
940
- box: resolvedTarget.alias,
941
- hostAlias: prepared.entry.hostAlias,
942
- remotePath,
943
- ideHint: parsed.ide,
944
- });
945
- }
946
- logger.info("ide_open_complete", {
947
- box: resolvedTarget.alias,
948
- editor: parsed.editor,
949
- remotePath,
950
- });
951
- };
952
- export const runIde = async (args) => {
953
- const subcommand = args[0];
954
- if (!subcommand) {
955
- console.log(IDE_USAGE);
956
- return;
957
- }
958
- try {
959
- if (subcommand === "setup") {
960
- await runIdeSetup(args.slice(1));
961
- return;
962
- }
963
- if (subcommand === "doctor") {
964
- await runIdeDoctor(args.slice(1));
965
- return;
966
- }
967
- if (subcommand === "open") {
968
- await runIdeOpen(args.slice(1));
969
- return;
970
- }
971
- throw new Error(IDE_USAGE);
972
- }
973
- catch (error) {
974
- const event = subcommand === "setup"
975
- ? "ide_setup_failed"
976
- : subcommand === "doctor"
977
- ? "ide_doctor_complete"
978
- : "ide_open_failed";
979
- logger.warn(event, {
980
- subcommand,
981
- error: error instanceof Error ? error.message : String(error),
982
- });
983
- throw error;
984
- }
985
- };
986
- export { buildJetBrainsGatewayUrl, buildVsCodeFolderUri, parseDoctorArgs, parseOpenArgs, parseSetupArgs, };
987
- //# sourceMappingURL=ide.js.map