runwork 0.15.1 → 0.16.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 (404) hide show
  1. package/bundled-types/task-delegation/task-delegation/types.d.ts +6 -0
  2. package/dist/index.js +20237 -116
  3. package/package.json +4 -4
  4. package/dist/__tests__/curl-parser.test.d.ts +0 -1
  5. package/dist/__tests__/curl-parser.test.js +0 -250
  6. package/dist/__tests__/install-scripts.test.d.ts +0 -1
  7. package/dist/__tests__/install-scripts.test.js +0 -280
  8. package/dist/__tests__/types-manager.test.d.ts +0 -1
  9. package/dist/__tests__/types-manager.test.js +0 -89
  10. package/dist/agents/__tests__/chatgpt-registry.test.d.ts +0 -1
  11. package/dist/agents/__tests__/chatgpt-registry.test.js +0 -61
  12. package/dist/agents/__tests__/claude-code-managed-block.test.d.ts +0 -1
  13. package/dist/agents/__tests__/claude-code-managed-block.test.js +0 -105
  14. package/dist/agents/__tests__/claude-code-plugin.test.d.ts +0 -1
  15. package/dist/agents/__tests__/claude-code-plugin.test.js +0 -47
  16. package/dist/agents/__tests__/claude-code-stats.test.d.ts +0 -1
  17. package/dist/agents/__tests__/claude-code-stats.test.js +0 -390
  18. package/dist/agents/__tests__/claude-desktop-memory.test.d.ts +0 -1
  19. package/dist/agents/__tests__/claude-desktop-memory.test.js +0 -154
  20. package/dist/agents/__tests__/claude-desktop-plugin-tree.test.d.ts +0 -1
  21. package/dist/agents/__tests__/claude-desktop-plugin-tree.test.js +0 -161
  22. package/dist/agents/__tests__/claude-desktop-plugin.test.d.ts +0 -1
  23. package/dist/agents/__tests__/claude-desktop-plugin.test.js +0 -117
  24. package/dist/agents/__tests__/claude-desktop-rpm.test.d.ts +0 -1
  25. package/dist/agents/__tests__/claude-desktop-rpm.test.js +0 -126
  26. package/dist/agents/__tests__/claude-desktop-stats.test.d.ts +0 -1
  27. package/dist/agents/__tests__/claude-desktop-stats.test.js +0 -280
  28. package/dist/agents/__tests__/codex-instructions.test.d.ts +0 -1
  29. package/dist/agents/__tests__/codex-instructions.test.js +0 -57
  30. package/dist/agents/__tests__/codex-minimum-permissions.test.d.ts +0 -1
  31. package/dist/agents/__tests__/codex-minimum-permissions.test.js +0 -82
  32. package/dist/agents/__tests__/codex-stats.test.d.ts +0 -1
  33. package/dist/agents/__tests__/codex-stats.test.js +0 -370
  34. package/dist/agents/__tests__/cursor-merge.test.d.ts +0 -1
  35. package/dist/agents/__tests__/cursor-merge.test.js +0 -66
  36. package/dist/agents/__tests__/cursor-stats.test.d.ts +0 -1
  37. package/dist/agents/__tests__/cursor-stats.test.js +0 -183
  38. package/dist/agents/__tests__/defaults-merge.test.d.ts +0 -1
  39. package/dist/agents/__tests__/defaults-merge.test.js +0 -268
  40. package/dist/agents/__tests__/detection.test.d.ts +0 -1
  41. package/dist/agents/__tests__/detection.test.js +0 -89
  42. package/dist/agents/__tests__/graceful-degradation.test.d.ts +0 -1
  43. package/dist/agents/__tests__/graceful-degradation.test.js +0 -129
  44. package/dist/agents/__tests__/instruction-hint.test.d.ts +0 -1
  45. package/dist/agents/__tests__/instruction-hint.test.js +0 -69
  46. package/dist/agents/__tests__/intro-skill.test.d.ts +0 -1
  47. package/dist/agents/__tests__/intro-skill.test.js +0 -193
  48. package/dist/agents/__tests__/schema-validation.test.d.ts +0 -1
  49. package/dist/agents/__tests__/schema-validation.test.js +0 -212
  50. package/dist/agents/__tests__/skill-slug.test.d.ts +0 -1
  51. package/dist/agents/__tests__/skill-slug.test.js +0 -77
  52. package/dist/agents/claude-code.d.ts +0 -59
  53. package/dist/agents/claude-code.js +0 -753
  54. package/dist/agents/claude-desktop-plugin-tree.d.ts +0 -59
  55. package/dist/agents/claude-desktop-plugin-tree.js +0 -143
  56. package/dist/agents/claude-desktop.d.ts +0 -47
  57. package/dist/agents/claude-desktop.js +0 -684
  58. package/dist/agents/cline.d.ts +0 -15
  59. package/dist/agents/cline.js +0 -130
  60. package/dist/agents/codex.d.ts +0 -44
  61. package/dist/agents/codex.js +0 -453
  62. package/dist/agents/conversation-skills.d.ts +0 -18
  63. package/dist/agents/conversation-skills.js +0 -229
  64. package/dist/agents/cursor.d.ts +0 -35
  65. package/dist/agents/cursor.js +0 -294
  66. package/dist/agents/default-config.d.ts +0 -30
  67. package/dist/agents/default-config.js +0 -67
  68. package/dist/agents/defaults-merge.d.ts +0 -87
  69. package/dist/agents/defaults-merge.js +0 -150
  70. package/dist/agents/detect.d.ts +0 -4
  71. package/dist/agents/detect.js +0 -67
  72. package/dist/agents/detection.d.ts +0 -18
  73. package/dist/agents/detection.js +0 -94
  74. package/dist/agents/gemini.d.ts +0 -15
  75. package/dist/agents/gemini.js +0 -122
  76. package/dist/agents/generic-adapter.d.ts +0 -25
  77. package/dist/agents/generic-adapter.js +0 -151
  78. package/dist/agents/intro-skill.d.ts +0 -45
  79. package/dist/agents/intro-skill.js +0 -447
  80. package/dist/agents/registry-data.d.ts +0 -192
  81. package/dist/agents/registry-data.js +0 -669
  82. package/dist/agents/registry.d.ts +0 -13
  83. package/dist/agents/registry.js +0 -36
  84. package/dist/agents/runtime-detection.d.ts +0 -82
  85. package/dist/agents/runtime-detection.js +0 -271
  86. package/dist/agents/session-start-hook.d.ts +0 -37
  87. package/dist/agents/session-start-hook.js +0 -159
  88. package/dist/agents/types.d.ts +0 -171
  89. package/dist/agents/types.js +0 -75
  90. package/dist/agents/utils/instruction-hint.d.ts +0 -21
  91. package/dist/agents/utils/instruction-hint.js +0 -108
  92. package/dist/agents/utils/json-config.d.ts +0 -19
  93. package/dist/agents/utils/json-config.js +0 -69
  94. package/dist/agents/utils/toml-config.d.ts +0 -8
  95. package/dist/agents/utils/toml-config.js +0 -27
  96. package/dist/agents/windsurf.d.ts +0 -14
  97. package/dist/agents/windsurf.js +0 -102
  98. package/dist/api/__tests__/client.test.d.ts +0 -1
  99. package/dist/api/__tests__/client.test.js +0 -272
  100. package/dist/api/client.d.ts +0 -326
  101. package/dist/api/client.js +0 -427
  102. package/dist/auth/__tests__/login-flow.test.d.ts +0 -1
  103. package/dist/auth/__tests__/login-flow.test.js +0 -101
  104. package/dist/auth/__tests__/store.test.d.ts +0 -1
  105. package/dist/auth/__tests__/store.test.js +0 -132
  106. package/dist/auth/login-flow.d.ts +0 -26
  107. package/dist/auth/login-flow.js +0 -137
  108. package/dist/auth/store.d.ts +0 -5
  109. package/dist/auth/store.js +0 -62
  110. package/dist/commands/__tests__/clone-args.test.d.ts +0 -1
  111. package/dist/commands/__tests__/clone-args.test.js +0 -51
  112. package/dist/commands/__tests__/clone-source-result.test.d.ts +0 -1
  113. package/dist/commands/__tests__/clone-source-result.test.js +0 -45
  114. package/dist/commands/__tests__/info-merge.test.d.ts +0 -1
  115. package/dist/commands/__tests__/info-merge.test.js +0 -55
  116. package/dist/commands/__tests__/mcp-entries.test.d.ts +0 -1
  117. package/dist/commands/__tests__/mcp-entries.test.js +0 -48
  118. package/dist/commands/__tests__/setup-persona.test.d.ts +0 -1
  119. package/dist/commands/__tests__/setup-persona.test.js +0 -31
  120. package/dist/commands/__tests__/setup.test.d.ts +0 -1
  121. package/dist/commands/__tests__/setup.test.js +0 -81
  122. package/dist/commands/__tests__/sync-redetect.test.d.ts +0 -1
  123. package/dist/commands/__tests__/sync-redetect.test.js +0 -96
  124. package/dist/commands/__tests__/sync-telemetry.test.d.ts +0 -1
  125. package/dist/commands/__tests__/sync-telemetry.test.js +0 -281
  126. package/dist/commands/__tests__/upgrade.test.d.ts +0 -1
  127. package/dist/commands/__tests__/upgrade.test.js +0 -157
  128. package/dist/commands/agents.d.ts +0 -2
  129. package/dist/commands/agents.js +0 -160
  130. package/dist/commands/api-keys.d.ts +0 -2
  131. package/dist/commands/api-keys.js +0 -95
  132. package/dist/commands/apps.d.ts +0 -2
  133. package/dist/commands/apps.js +0 -82
  134. package/dist/commands/build-plugin.d.ts +0 -2
  135. package/dist/commands/build-plugin.js +0 -135
  136. package/dist/commands/clone.d.ts +0 -60
  137. package/dist/commands/clone.js +0 -271
  138. package/dist/commands/components.d.ts +0 -2
  139. package/dist/commands/components.js +0 -43
  140. package/dist/commands/deploy.d.ts +0 -2
  141. package/dist/commands/deploy.js +0 -279
  142. package/dist/commands/dev.d.ts +0 -11
  143. package/dist/commands/dev.js +0 -1011
  144. package/dist/commands/doctor.d.ts +0 -2
  145. package/dist/commands/doctor.js +0 -230
  146. package/dist/commands/endpoints.d.ts +0 -2
  147. package/dist/commands/endpoints.js +0 -189
  148. package/dist/commands/entities.d.ts +0 -2
  149. package/dist/commands/entities.js +0 -198
  150. package/dist/commands/files.d.ts +0 -2
  151. package/dist/commands/files.js +0 -193
  152. package/dist/commands/inbox.d.ts +0 -11
  153. package/dist/commands/inbox.js +0 -60
  154. package/dist/commands/info.d.ts +0 -178
  155. package/dist/commands/info.js +0 -455
  156. package/dist/commands/init.d.ts +0 -21
  157. package/dist/commands/init.js +0 -185
  158. package/dist/commands/integrations.d.ts +0 -2
  159. package/dist/commands/integrations.js +0 -233
  160. package/dist/commands/login.d.ts +0 -2
  161. package/dist/commands/login.js +0 -44
  162. package/dist/commands/logout.d.ts +0 -2
  163. package/dist/commands/logout.js +0 -13
  164. package/dist/commands/logs.d.ts +0 -2
  165. package/dist/commands/logs.js +0 -232
  166. package/dist/commands/mcp-entries.d.ts +0 -13
  167. package/dist/commands/mcp-entries.js +0 -26
  168. package/dist/commands/mcp.d.ts +0 -2
  169. package/dist/commands/mcp.js +0 -245
  170. package/dist/commands/open.d.ts +0 -2
  171. package/dist/commands/open.js +0 -53
  172. package/dist/commands/resume.d.ts +0 -2
  173. package/dist/commands/resume.js +0 -289
  174. package/dist/commands/save-convo.d.ts +0 -8
  175. package/dist/commands/save-convo.js +0 -20
  176. package/dist/commands/schedules.d.ts +0 -2
  177. package/dist/commands/schedules.js +0 -221
  178. package/dist/commands/setup.d.ts +0 -27
  179. package/dist/commands/setup.js +0 -177
  180. package/dist/commands/share-convo.d.ts +0 -24
  181. package/dist/commands/share-convo.js +0 -167
  182. package/dist/commands/skills.d.ts +0 -2
  183. package/dist/commands/skills.js +0 -352
  184. package/dist/commands/sync-telemetry.d.ts +0 -33
  185. package/dist/commands/sync-telemetry.js +0 -186
  186. package/dist/commands/sync.d.ts +0 -37
  187. package/dist/commands/sync.js +0 -702
  188. package/dist/commands/uninstall.d.ts +0 -2
  189. package/dist/commands/uninstall.js +0 -145
  190. package/dist/commands/upgrade.d.ts +0 -14
  191. package/dist/commands/upgrade.js +0 -217
  192. package/dist/commands/validate.d.ts +0 -2
  193. package/dist/commands/validate.js +0 -89
  194. package/dist/commands/welcome.d.ts +0 -1
  195. package/dist/commands/welcome.js +0 -86
  196. package/dist/commands/workflows.d.ts +0 -2
  197. package/dist/commands/workflows.js +0 -187
  198. package/dist/deploy/__tests__/deploy-state.test.d.ts +0 -1
  199. package/dist/deploy/__tests__/deploy-state.test.js +0 -80
  200. package/dist/deploy/__tests__/deploy-status.test.d.ts +0 -1
  201. package/dist/deploy/__tests__/deploy-status.test.js +0 -41
  202. package/dist/deploy/__tests__/detach-args.test.d.ts +0 -1
  203. package/dist/deploy/__tests__/detach-args.test.js +0 -30
  204. package/dist/deploy/deploy-state.d.ts +0 -36
  205. package/dist/deploy/deploy-state.js +0 -63
  206. package/dist/deploy/deploy-status.d.ts +0 -21
  207. package/dist/deploy/deploy-status.js +0 -36
  208. package/dist/deploy/detach.d.ts +0 -32
  209. package/dist/deploy/detach.js +0 -71
  210. package/dist/dev/__tests__/attach.test.d.ts +0 -1
  211. package/dist/dev/__tests__/attach.test.js +0 -296
  212. package/dist/dev/__tests__/detach.test.d.ts +0 -1
  213. package/dist/dev/__tests__/detach.test.js +0 -404
  214. package/dist/dev/__tests__/preview-url-poller.test.d.ts +0 -1
  215. package/dist/dev/__tests__/preview-url-poller.test.js +0 -149
  216. package/dist/dev/__tests__/session.test.d.ts +0 -1
  217. package/dist/dev/__tests__/session.test.js +0 -446
  218. package/dist/dev/__tests__/startup-sync.test.d.ts +0 -1
  219. package/dist/dev/__tests__/startup-sync.test.js +0 -32
  220. package/dist/dev/__tests__/stop.test.d.ts +0 -1
  221. package/dist/dev/__tests__/stop.test.js +0 -172
  222. package/dist/dev/attach.d.ts +0 -120
  223. package/dist/dev/attach.js +0 -269
  224. package/dist/dev/detach.d.ts +0 -187
  225. package/dist/dev/detach.js +0 -292
  226. package/dist/dev/preview-url-poller.d.ts +0 -35
  227. package/dist/dev/preview-url-poller.js +0 -50
  228. package/dist/dev/session.d.ts +0 -175
  229. package/dist/dev/session.js +0 -258
  230. package/dist/dev/startup-sync.d.ts +0 -23
  231. package/dist/dev/startup-sync.js +0 -14
  232. package/dist/dev/stop.d.ts +0 -52
  233. package/dist/dev/stop.js +0 -101
  234. package/dist/devtools/registry-data.d.ts +0 -46
  235. package/dist/devtools/registry-data.js +0 -40
  236. package/dist/generated/bundled-types.d.ts +0 -1
  237. package/dist/generated/bundled-types.js +0 -46
  238. package/dist/generated/version.d.ts +0 -1
  239. package/dist/generated/version.js +0 -2
  240. package/dist/git/__tests__/auto-commit.test.d.ts +0 -1
  241. package/dist/git/__tests__/auto-commit.test.js +0 -431
  242. package/dist/git/__tests__/classify-sync-error.test.d.ts +0 -1
  243. package/dist/git/__tests__/classify-sync-error.test.js +0 -57
  244. package/dist/git/__tests__/credential-helper-e2e.test.d.ts +0 -21
  245. package/dist/git/__tests__/credential-helper-e2e.test.js +0 -195
  246. package/dist/git/__tests__/credentials.test.d.ts +0 -1
  247. package/dist/git/__tests__/credentials.test.js +0 -141
  248. package/dist/git/__tests__/deploy-guard.test.d.ts +0 -1
  249. package/dist/git/__tests__/deploy-guard.test.js +0 -61
  250. package/dist/git/__tests__/ensure-git-credential-helper.test.d.ts +0 -1
  251. package/dist/git/__tests__/ensure-git-credential-helper.test.js +0 -133
  252. package/dist/git/__tests__/ensure-runwork-remote.test.d.ts +0 -1
  253. package/dist/git/__tests__/ensure-runwork-remote.test.js +0 -109
  254. package/dist/git/__tests__/identity.test.d.ts +0 -1
  255. package/dist/git/__tests__/identity.test.js +0 -146
  256. package/dist/git/__tests__/manifest.test.d.ts +0 -1
  257. package/dist/git/__tests__/manifest.test.js +0 -446
  258. package/dist/git/__tests__/preflight-resolution.test.d.ts +0 -1
  259. package/dist/git/__tests__/preflight-resolution.test.js +0 -366
  260. package/dist/git/__tests__/preflight.test.d.ts +0 -1
  261. package/dist/git/__tests__/preflight.test.js +0 -36
  262. package/dist/git/__tests__/repo-config.test.d.ts +0 -1
  263. package/dist/git/__tests__/repo-config.test.js +0 -26
  264. package/dist/git/__tests__/sync.test.d.ts +0 -1
  265. package/dist/git/__tests__/sync.test.js +0 -405
  266. package/dist/git/auto-commit.d.ts +0 -35
  267. package/dist/git/auto-commit.js +0 -293
  268. package/dist/git/classify-sync-error.d.ts +0 -21
  269. package/dist/git/classify-sync-error.js +0 -111
  270. package/dist/git/credentials.d.ts +0 -75
  271. package/dist/git/credentials.js +0 -164
  272. package/dist/git/critical-files.d.ts +0 -20
  273. package/dist/git/critical-files.js +0 -68
  274. package/dist/git/deploy-guard.d.ts +0 -53
  275. package/dist/git/deploy-guard.js +0 -78
  276. package/dist/git/identity.d.ts +0 -44
  277. package/dist/git/identity.js +0 -133
  278. package/dist/git/preflight.d.ts +0 -57
  279. package/dist/git/preflight.js +0 -276
  280. package/dist/git/remote.d.ts +0 -37
  281. package/dist/git/remote.js +0 -75
  282. package/dist/git/repo-config.d.ts +0 -8
  283. package/dist/git/repo-config.js +0 -29
  284. package/dist/git/sync.d.ts +0 -15
  285. package/dist/git/sync.js +0 -159
  286. package/dist/health/__tests__/checks.test.d.ts +0 -1
  287. package/dist/health/__tests__/checks.test.js +0 -357
  288. package/dist/health/__tests__/cli-distribution-checks.test.d.ts +0 -1
  289. package/dist/health/__tests__/cli-distribution-checks.test.js +0 -196
  290. package/dist/health/__tests__/fix.test.d.ts +0 -1
  291. package/dist/health/__tests__/fix.test.js +0 -72
  292. package/dist/health/__tests__/runner-filter.test.d.ts +0 -1
  293. package/dist/health/__tests__/runner-filter.test.js +0 -61
  294. package/dist/health/checks.d.ts +0 -42
  295. package/dist/health/checks.js +0 -636
  296. package/dist/health/fix.d.ts +0 -22
  297. package/dist/health/fix.js +0 -62
  298. package/dist/health/runner.d.ts +0 -8
  299. package/dist/health/runner.js +0 -47
  300. package/dist/health/types.d.ts +0 -12
  301. package/dist/health/types.js +0 -1
  302. package/dist/index.d.ts +0 -1
  303. package/dist/logs/__tests__/tailer-format.test.d.ts +0 -1
  304. package/dist/logs/__tests__/tailer-format.test.js +0 -43
  305. package/dist/logs/tailer.d.ts +0 -17
  306. package/dist/logs/tailer.js +0 -217
  307. package/dist/sync/__tests__/change-detect.test.d.ts +0 -1
  308. package/dist/sync/__tests__/change-detect.test.js +0 -123
  309. package/dist/sync/__tests__/hash.test.d.ts +0 -1
  310. package/dist/sync/__tests__/hash.test.js +0 -18
  311. package/dist/sync/change-detect.d.ts +0 -19
  312. package/dist/sync/change-detect.js +0 -136
  313. package/dist/sync/conflict-ui.d.ts +0 -5
  314. package/dist/sync/conflict-ui.js +0 -78
  315. package/dist/sync/executor.d.ts +0 -23
  316. package/dist/sync/executor.js +0 -102
  317. package/dist/sync/hash.d.ts +0 -1
  318. package/dist/sync/hash.js +0 -4
  319. package/dist/sync/types.d.ts +0 -24
  320. package/dist/sync/types.js +0 -1
  321. package/dist/template/manifest.d.ts +0 -17
  322. package/dist/template/manifest.js +0 -145
  323. package/dist/tools/types.d.ts +0 -52
  324. package/dist/tools/types.js +0 -8
  325. package/dist/types-manager.d.ts +0 -1
  326. package/dist/types-manager.js +0 -35
  327. package/dist/types.d.ts +0 -349
  328. package/dist/types.js +0 -1
  329. package/dist/ui/__tests__/banner.test.d.ts +0 -1
  330. package/dist/ui/__tests__/banner.test.js +0 -98
  331. package/dist/ui/__tests__/colors.test.d.ts +0 -1
  332. package/dist/ui/__tests__/colors.test.js +0 -22
  333. package/dist/ui/__tests__/keyboard.test.d.ts +0 -1
  334. package/dist/ui/__tests__/keyboard.test.js +0 -34
  335. package/dist/ui/__tests__/status-line.test.d.ts +0 -1
  336. package/dist/ui/__tests__/status-line.test.js +0 -54
  337. package/dist/ui/banner.d.ts +0 -29
  338. package/dist/ui/banner.js +0 -153
  339. package/dist/ui/colors.d.ts +0 -4
  340. package/dist/ui/colors.js +0 -7
  341. package/dist/ui/keyboard.d.ts +0 -12
  342. package/dist/ui/keyboard.js +0 -61
  343. package/dist/ui/status-line.d.ts +0 -6
  344. package/dist/ui/status-line.js +0 -53
  345. package/dist/utils/__tests__/format-error.test.d.ts +0 -1
  346. package/dist/utils/__tests__/format-error.test.js +0 -43
  347. package/dist/utils/__tests__/help-json.test.d.ts +0 -1
  348. package/dist/utils/__tests__/help-json.test.js +0 -39
  349. package/dist/utils/__tests__/http.test.d.ts +0 -1
  350. package/dist/utils/__tests__/http.test.js +0 -381
  351. package/dist/utils/__tests__/ignore-matcher.test.d.ts +0 -1
  352. package/dist/utils/__tests__/ignore-matcher.test.js +0 -205
  353. package/dist/utils/__tests__/output.test.d.ts +0 -1
  354. package/dist/utils/__tests__/output.test.js +0 -38
  355. package/dist/utils/__tests__/prompt.test.d.ts +0 -1
  356. package/dist/utils/__tests__/prompt.test.js +0 -27
  357. package/dist/utils/__tests__/resolve.test.d.ts +0 -1
  358. package/dist/utils/__tests__/resolve.test.js +0 -95
  359. package/dist/utils/__tests__/sqlite.test.d.ts +0 -1
  360. package/dist/utils/__tests__/sqlite.test.js +0 -89
  361. package/dist/utils/agent-guidance.d.ts +0 -47
  362. package/dist/utils/agent-guidance.js +0 -128
  363. package/dist/utils/app-info.d.ts +0 -70
  364. package/dist/utils/app-info.js +0 -167
  365. package/dist/utils/curl-parser.d.ts +0 -12
  366. package/dist/utils/curl-parser.js +0 -162
  367. package/dist/utils/data-input.d.ts +0 -1
  368. package/dist/utils/data-input.js +0 -38
  369. package/dist/utils/format-error.d.ts +0 -10
  370. package/dist/utils/format-error.js +0 -38
  371. package/dist/utils/fs.d.ts +0 -5
  372. package/dist/utils/fs.js +0 -23
  373. package/dist/utils/help-json.d.ts +0 -70
  374. package/dist/utils/help-json.js +0 -88
  375. package/dist/utils/http.d.ts +0 -46
  376. package/dist/utils/http.js +0 -421
  377. package/dist/utils/ignore-matcher.d.ts +0 -47
  378. package/dist/utils/ignore-matcher.js +0 -132
  379. package/dist/utils/output.d.ts +0 -17
  380. package/dist/utils/output.js +0 -27
  381. package/dist/utils/prompt.d.ts +0 -5
  382. package/dist/utils/prompt.js +0 -42
  383. package/dist/utils/resolve.d.ts +0 -12
  384. package/dist/utils/resolve.js +0 -52
  385. package/dist/utils/setup-state.d.ts +0 -3
  386. package/dist/utils/setup-state.js +0 -19
  387. package/dist/utils/sqlite-adapter.d.ts +0 -48
  388. package/dist/utils/sqlite-adapter.js +0 -147
  389. package/dist/utils/sqlite.d.ts +0 -14
  390. package/dist/utils/sqlite.js +0 -14
  391. package/dist/utils/subprocess.d.ts +0 -19
  392. package/dist/utils/subprocess.js +0 -27
  393. package/dist/utils/which.d.ts +0 -14
  394. package/dist/utils/which.js +0 -47
  395. package/dist/utils/zip.d.ts +0 -7
  396. package/dist/utils/zip.js +0 -42
  397. package/dist/validate/__tests__/validate.test.d.ts +0 -1
  398. package/dist/validate/__tests__/validate.test.js +0 -42
  399. package/dist/validate/freshness.d.ts +0 -28
  400. package/dist/validate/freshness.js +0 -48
  401. package/dist/validate/preview.d.ts +0 -21
  402. package/dist/validate/preview.js +0 -39
  403. package/dist/workspace/resolve.d.ts +0 -19
  404. package/dist/workspace/resolve.js +0 -100
@@ -1,455 +0,0 @@
1
- import { Command } from 'commander';
2
- import { readFileSync, existsSync } from 'fs';
3
- import { join } from 'path';
4
- import { shouldOutputJson, jsonOut } from '../utils/output.js';
5
- import { buildInfoGuide } from '../utils/agent-guidance.js';
6
- import { fetchAppInfo } from '../utils/app-info.js';
7
- import { bold, cyan, dim, green, yellow, gray } from '../ui/colors.js';
8
- import { VERSION } from '../generated/version.js';
9
- import { requireAuth } from '../auth/store.js';
10
- import { ApiClient } from '../api/client.js';
11
- import { resolveWorkspace } from '../workspace/resolve.js';
12
- import { getSessionState } from '../dev/session.js';
13
- import { getDeploySummary } from '../deploy/deploy-state.js';
14
- function readLocalDevSession(appDir, appId) {
15
- if (!appId)
16
- return { state: 'none' };
17
- const s = getSessionState(appDir, appId);
18
- if (s.state === 'none')
19
- return { state: 'none' };
20
- if (s.state === 'stale')
21
- return { state: 'stale', reason: s.reason, pid: s.file?.pid };
22
- return {
23
- state: 'alive',
24
- pid: s.file.pid,
25
- sessionId: s.file.sessionId,
26
- previewUrl: s.file.previewUrl,
27
- mode: s.file.mode,
28
- startedAt: s.file.startedAt,
29
- };
30
- }
31
- function tryReadConfig() {
32
- if (!existsSync('.runwork.json'))
33
- return null;
34
- try {
35
- return JSON.parse(readFileSync('.runwork.json', 'utf-8'));
36
- }
37
- catch {
38
- return null;
39
- }
40
- }
41
- function readBlueprint(cwd) {
42
- const blueprintPath = join(cwd, 'blueprint.json');
43
- if (!existsSync(blueprintPath))
44
- return null;
45
- try {
46
- return JSON.parse(readFileSync(blueprintPath, 'utf-8'));
47
- }
48
- catch {
49
- return null;
50
- }
51
- }
52
- function mergeSources(blueprintItems, serverItems, getServerName, appId) {
53
- const map = new Map();
54
- // Skip nameless entries so we never store an `undefined` key. A bad
55
- // blueprint or a partially-populated server-side row would otherwise
56
- // produce a registry entry with `name === undefined`, which then crashes
57
- // the human-readable printer at `a.name.padEnd(24)` and yields ugly
58
- // `"undefined": ...` keys in JSON output.
59
- for (const bp of blueprintItems) {
60
- if (typeof bp.name !== 'string' || bp.name.length === 0)
61
- continue;
62
- map.set(bp.name, { sources: ['blueprint'], blueprintExtra: bp.extra });
63
- }
64
- for (const serverItem of serverItems) {
65
- if (serverItem.appId !== appId)
66
- continue;
67
- const name = getServerName(serverItem);
68
- if (typeof name !== 'string' || name.length === 0)
69
- continue;
70
- const mode = serverItem.deploymentMode;
71
- const source = mode === 'production' ? 'production' : 'preview';
72
- const existing = map.get(name);
73
- if (existing) {
74
- existing.sources.push(source);
75
- existing.serverItem = serverItem;
76
- }
77
- else {
78
- map.set(name, { sources: [source], serverItem: serverItem });
79
- }
80
- }
81
- return map;
82
- }
83
- function buildRegistries(blueprint, serverData, appId) {
84
- // Entities
85
- const bpEntities = (blueprint?.entities ?? []).map(e => ({
86
- name: e.entityName,
87
- extra: e.schema ? { schema: e.schema } : {},
88
- }));
89
- const entityMap = mergeSources(bpEntities, serverData?.entities ?? [], (e) => e.entityName, appId);
90
- const entities = Array.from(entityMap.entries()).map(([name, v]) => ({
91
- name,
92
- sources: v.sources,
93
- ...(v.blueprintExtra?.schema ? { schema: v.blueprintExtra.schema } :
94
- v.serverItem && 'schema' in v.serverItem && v.serverItem.schema ? { schema: v.serverItem.schema } : {}),
95
- }));
96
- // Scheduled jobs (blueprint may use either key)
97
- const bpSchedules = (blueprint?.scheduledJobs ?? blueprint?.schedules ?? []).map(s => ({
98
- name: s.name,
99
- extra: { schedule: s.schedule, description: s.description },
100
- }));
101
- const scheduleMap = mergeSources(bpSchedules, serverData?.schedules ?? [], (s) => s.name, appId);
102
- const scheduledJobs = Array.from(scheduleMap.entries()).map(([name, v]) => {
103
- const serverItem = v.serverItem;
104
- return {
105
- name,
106
- sources: v.sources,
107
- schedule: v.blueprintExtra?.schedule ?? serverItem?.schedule,
108
- description: v.blueprintExtra?.description ?? serverItem?.description,
109
- };
110
- });
111
- // Workflows
112
- const bpWorkflows = (blueprint?.workflows ?? []).map(w => ({
113
- name: w.name,
114
- extra: { description: w.description },
115
- }));
116
- const workflowMap = mergeSources(bpWorkflows, serverData?.workflows ?? [], (w) => w.name, appId);
117
- const workflows = Array.from(workflowMap.entries()).map(([name, v]) => {
118
- const serverItem = v.serverItem;
119
- return {
120
- name,
121
- sources: v.sources,
122
- description: v.blueprintExtra?.description ?? serverItem?.description,
123
- };
124
- });
125
- // Agents
126
- const bpAgents = (blueprint?.agents ?? []).map(a => ({
127
- name: a.name,
128
- extra: { type: a.type, description: a.description },
129
- }));
130
- const agentMap = mergeSources(bpAgents, serverData?.agents ?? [], (a) => a.name, appId);
131
- const agents = Array.from(agentMap.entries()).map(([name, v]) => {
132
- const serverItem = v.serverItem;
133
- return {
134
- name,
135
- sources: v.sources,
136
- type: v.blueprintExtra?.type ?? serverItem?.type,
137
- description: v.blueprintExtra?.description ?? serverItem?.description,
138
- };
139
- });
140
- // Public endpoints (blueprint may use either key)
141
- const bpEndpoints = (blueprint?.publicEndpoints ?? blueprint?.endpoints ?? []).map(e => ({
142
- name: `${e.method ?? 'ANY'} ${e.path}`,
143
- extra: { path: e.path, method: e.method, description: e.description },
144
- }));
145
- const endpointMap = mergeSources(bpEndpoints, serverData?.endpoints ?? [], (e) => `${e.method ?? 'ANY'} ${e.path}`, appId);
146
- const publicEndpoints = Array.from(endpointMap.entries()).map(([, v]) => {
147
- const serverItem = v.serverItem;
148
- return {
149
- path: v.blueprintExtra?.path ?? serverItem?.path ?? '',
150
- method: v.blueprintExtra?.method ?? serverItem?.method,
151
- sources: v.sources,
152
- description: v.blueprintExtra?.description ?? serverItem?.description,
153
- };
154
- });
155
- // Components
156
- const bpComponents = (blueprint?.components ?? []).map(c => ({
157
- name: c.componentName,
158
- extra: {},
159
- }));
160
- const componentMap = mergeSources(bpComponents, serverData?.components ?? [], (c) => c.componentName, appId);
161
- const components = Array.from(componentMap.entries()).map(([name, v]) => ({
162
- name,
163
- sources: v.sources,
164
- }));
165
- // File storage
166
- const bpHasStorage = blueprint
167
- ? typeof blueprint.fileStorage === 'boolean'
168
- ? blueprint.fileStorage
169
- : typeof blueprint.fileStorage === 'object'
170
- ? (blueprint.fileStorage.enabled !== false)
171
- : false
172
- : false;
173
- const serverStorages = (serverData?.fileStorages ?? []).filter(fs => fs.appId === appId);
174
- const storageSources = [];
175
- if (bpHasStorage)
176
- storageSources.push('blueprint');
177
- for (const ss of serverStorages) {
178
- const mode = ss.deploymentMode;
179
- if (mode === 'production')
180
- storageSources.push('production');
181
- else
182
- storageSources.push('preview');
183
- }
184
- const fileStorage = {
185
- enabled: bpHasStorage || serverStorages.length > 0,
186
- sources: storageSources,
187
- };
188
- return { entities, workflows, scheduledJobs, agents, publicEndpoints, components, fileStorage };
189
- }
190
- function getCliCommands(command) {
191
- const program = command.parent;
192
- if (!program)
193
- return [];
194
- return program.commands
195
- .filter(cmd => !cmd._hidden)
196
- .map(cmd => {
197
- const aliases = cmd.aliases();
198
- const name = aliases.length > 0 ? `${cmd.name()}|${aliases.join('|')}` : cmd.name();
199
- return { name, description: cmd.description() };
200
- });
201
- }
202
- /**
203
- * Pad a possibly-missing string to a fixed width. Returns a visible
204
- * placeholder when the value isn't a usable string so the human-readable
205
- * printer can never crash on an unexpectedly-undefined field.
206
- */
207
- function padName(value, width) {
208
- if (typeof value === 'string' && value.length > 0)
209
- return value.padEnd(width);
210
- return '(unnamed)'.padEnd(width);
211
- }
212
- export function formatSources(sources) {
213
- return sources
214
- .map(s => {
215
- if (s === 'blueprint')
216
- return cyan(s);
217
- if (s === 'preview')
218
- return yellow(s);
219
- if (s === 'production')
220
- return green(s);
221
- return s;
222
- })
223
- .join(dim(', '));
224
- }
225
- function printHumanOutput(data) {
226
- console.log('');
227
- const pad = (label) => label.padEnd(12);
228
- const wsLabel = data.workspace.name && data.workspace.name !== data.workspace.id
229
- ? `${data.workspace.name} ${dim('(' + data.workspace.id + ')')}`
230
- : data.workspace.id;
231
- console.log(` ${dim(pad('Workspace:'))}${wsLabel}`);
232
- if (data.app) {
233
- console.log('');
234
- console.log(bold('App Info'));
235
- console.log('');
236
- console.log(` ${dim(pad('App:'))}${bold(data.app.name)}`);
237
- if (data.preview.url) {
238
- console.log(` ${dim(pad('Preview:'))}${green(data.preview.url)} ${dim('(running)')}`);
239
- }
240
- else {
241
- console.log(` ${dim(pad('Preview:'))}${dim('(not running)')}`);
242
- }
243
- if (data.production.url) {
244
- console.log(` ${dim(pad('Production:'))}${green(data.production.url)} ${dim('(deployed)')}`);
245
- }
246
- else {
247
- console.log(` ${dim(pad('Production:'))}${dim('(not deployed)')}`);
248
- }
249
- if (data.deploy.deployedShortSha) {
250
- const localPart = data.deploy.localShortSha ? `, local ${data.deploy.localShortSha}` : '';
251
- const sync = data.deploy.inSync === true
252
- ? green('in sync')
253
- : data.deploy.inSync === false
254
- ? yellow('local has undeployed commits')
255
- : dim('unknown');
256
- console.log(` ${dim(pad('Last deploy:'))}${data.deploy.deployedShortSha}${dim(localPart)} ${sync}`);
257
- }
258
- // Local dev session view: what's running on THIS machine, from the
259
- // session file. This may disagree with the server's "preview"
260
- // status above; that's diagnostic, not a bug.
261
- const local = data.localDevSession;
262
- if (local.state === 'alive') {
263
- const startedSec = Math.round((Date.now() - local.startedAt) / 1000);
264
- const ago = startedSec < 60 ? `${startedSec}s ago`
265
- : startedSec < 3600 ? `${Math.floor(startedSec / 60)}m ago`
266
- : `${Math.floor(startedSec / 3600)}h ago`;
267
- console.log(` ${dim(pad('Dev session:'))}${green('running')} ${dim(`(PID ${local.pid}, ${local.mode}, started ${ago})`)}`);
268
- }
269
- else if (local.state === 'stale') {
270
- console.log(` ${dim(pad('Dev session:'))}${yellow('stale')} ${dim(`(reason: ${local.reason}; run \`runwork dev stop\` to clean up)`)}`);
271
- }
272
- else {
273
- console.log(` ${dim(pad('Dev session:'))}${dim('(none on this machine)')}`);
274
- }
275
- }
276
- console.log('');
277
- // Integrations
278
- if (data.integrations === null) {
279
- console.log(bold('Integrations:'));
280
- console.log(` ${dim('(unavailable -- API error or not authenticated)')}`);
281
- }
282
- else if (data.integrations.length === 0) {
283
- console.log(bold('Integrations:'));
284
- console.log(` ${dim('(none connected)')}`);
285
- }
286
- else {
287
- console.log(bold('Integrations:'));
288
- for (const int of data.integrations) {
289
- const statusColor = int.status === 'connected' ? green : yellow;
290
- console.log(` ${int.id.padEnd(20)} ${statusColor(int.status)}`);
291
- }
292
- }
293
- console.log('');
294
- // Registries
295
- if (data.registries === null) {
296
- // Skip entirely if unavailable
297
- }
298
- else {
299
- const reg = data.registries;
300
- const hasAny = reg.entities.length > 0 || reg.workflows.length > 0 ||
301
- reg.scheduledJobs.length > 0 || reg.agents.length > 0 ||
302
- reg.publicEndpoints.length > 0 || reg.components.length > 0 ||
303
- reg.fileStorage.enabled;
304
- if (!hasAny) {
305
- // No registries -- skip the section entirely
306
- }
307
- else {
308
- console.log(bold('Registries:'));
309
- if (reg.entities.length > 0) {
310
- console.log(` ${bold('Entities:')}`);
311
- for (const e of reg.entities) {
312
- console.log(` ${padName(e.name, 24)} ${formatSources(e.sources)}`);
313
- }
314
- console.log('');
315
- }
316
- if (reg.workflows.length > 0) {
317
- console.log(` ${bold('Workflows:')}`);
318
- for (const w of reg.workflows) {
319
- const desc = w.description ? ` ${dim(w.description)}` : '';
320
- console.log(` ${padName(w.name, 24)} ${formatSources(w.sources)}${desc}`);
321
- }
322
- console.log('');
323
- }
324
- if (reg.scheduledJobs.length > 0) {
325
- console.log(` ${bold('Scheduled Jobs:')}`);
326
- for (const s of reg.scheduledJobs) {
327
- const schedule = s.schedule ? ` ${gray(s.schedule)}` : '';
328
- console.log(` ${padName(s.name, 24)} ${formatSources(s.sources)}${schedule}`);
329
- }
330
- console.log('');
331
- }
332
- if (reg.agents.length > 0) {
333
- console.log(` ${bold('Agents:')}`);
334
- for (const a of reg.agents) {
335
- const type = a.type ? ` ${dim(a.type)}` : '';
336
- console.log(` ${padName(a.name, 24)} ${formatSources(a.sources)}${type}`);
337
- }
338
- console.log('');
339
- }
340
- if (reg.publicEndpoints.length > 0) {
341
- console.log(` ${bold('Public Endpoints:')}`);
342
- for (const e of reg.publicEndpoints) {
343
- const label = e.method && e.path ? `${e.method} ${e.path}` : (e.path || '');
344
- console.log(` ${padName(label, 24)} ${formatSources(e.sources)}`);
345
- }
346
- console.log('');
347
- }
348
- if (reg.components.length > 0) {
349
- console.log(` ${bold('Components:')}`);
350
- for (const c of reg.components) {
351
- console.log(` ${padName(c.name, 24)} ${formatSources(c.sources)}`);
352
- }
353
- console.log('');
354
- }
355
- if (reg.fileStorage.enabled) {
356
- console.log(` ${bold('File Storage:')} ${formatSources(reg.fileStorage.sources)}`);
357
- console.log('');
358
- }
359
- } // end hasAny
360
- }
361
- // CLI commands
362
- console.log(bold('CLI Commands:'));
363
- for (const cmd of data.cli.commands) {
364
- console.log(` ${cyan(('runwork ' + cmd.name).padEnd(36))} ${dim(cmd.description)}`);
365
- }
366
- console.log('');
367
- console.log(dim(` CLI version: ${data.cli.version}`));
368
- console.log('');
369
- }
370
- // Internal helpers exposed for unit tests; do not import from anywhere
371
- // other than `__tests__/`.
372
- export const __testing = { mergeSources, padName, buildRegistries };
373
- export const infoCommand = new Command('info')
374
- .description('Show app context, registries, and CLI reference (use --json for agent discovery)')
375
- .action(async (_opts, command) => {
376
- const asJson = shouldOutputJson(command.optsWithGlobals().json);
377
- const creds = requireAuth();
378
- const client = new ApiClient(creds);
379
- // Try to read project config, but don't require it
380
- const config = tryReadConfig();
381
- const blueprint = config ? readBlueprint(process.cwd()) : null;
382
- // Resolve workspace: project config > --workspace > default > prompt
383
- let workspaceId;
384
- let workspaceName;
385
- if (config) {
386
- workspaceId = config.workspaceId;
387
- workspaceName = config.workspaceName ?? config.workspaceId;
388
- }
389
- else {
390
- const resolved = await resolveWorkspace(client, {});
391
- workspaceId = resolved.workspaceId;
392
- workspaceName = resolved.workspaceName || resolved.workspaceId;
393
- }
394
- const appId = config?.appId;
395
- const appName = config?.appName;
396
- // App-specific info (preview, dashboard, git remote, server registries)
397
- const appInfo = appId ? await fetchAppInfo(client, {
398
- appId,
399
- appName: appName ?? '',
400
- appSlug: appName ?? '',
401
- workspaceId,
402
- workspaceName,
403
- baseUrl: creds.baseUrl || 'https://runwork.ai',
404
- }) : null;
405
- const preview = appInfo?.preview ?? { url: null, active: false };
406
- // Integrations
407
- let integrations = null;
408
- try {
409
- const raw = await client.listConnectedIntegrations(workspaceId);
410
- integrations = raw.map(i => ({
411
- id: i.canonicalId ?? i.integrationId,
412
- status: i.status ?? 'connected',
413
- }));
414
- }
415
- catch {
416
- process.stderr.write('Warning: failed to fetch integrations\n');
417
- }
418
- // Workspace registries
419
- let serverData = null;
420
- try {
421
- serverData = await client.getWorkspaceAll(workspaceId);
422
- }
423
- catch {
424
- process.stderr.write('Warning: failed to fetch workspace registries\n');
425
- }
426
- const registries = buildRegistries(blueprint, serverData, appId ?? '');
427
- const localDevSession = readLocalDevSession(process.cwd(), appId);
428
- const output = {
429
- app: appId ? {
430
- id: appId,
431
- name: appName ?? '',
432
- slug: appName ?? '',
433
- } : null,
434
- workspace: {
435
- id: workspaceId,
436
- name: workspaceName,
437
- },
438
- preview,
439
- localDevSession,
440
- production: appInfo?.production ?? { url: null, deployed: false },
441
- deploy: getDeploySummary(process.cwd()),
442
- integrations,
443
- registries,
444
- cli: {
445
- version: VERSION,
446
- commands: getCliCommands(command),
447
- },
448
- };
449
- if (asJson) {
450
- jsonOut({ ...output, guide: buildInfoGuide() });
451
- }
452
- else {
453
- printHumanOutput(output);
454
- }
455
- });
@@ -1,21 +0,0 @@
1
- import { Command } from 'commander';
2
- import { ApiClient } from '../api/client.js';
3
- import type { Credentials, WorkspaceInfo } from '../types.js';
4
- export interface InitResult {
5
- appId: string;
6
- appName: string;
7
- slug: string;
8
- directory: string;
9
- workspaceId: string;
10
- workspaceName: string;
11
- }
12
- export interface ExecInitOptions {
13
- /** When true, create the app in cwd/<slug> instead of ~/.runwork/<slug>. */
14
- here?: boolean;
15
- }
16
- /** Default parent directory for new apps when --here is not passed. */
17
- export declare const DEFAULT_APPS_DIR: string;
18
- export declare function execInit(client: ApiClient, appName: string, workspace: WorkspaceInfo, options?: ExecInitOptions, creds?: Credentials | null): Promise<InitResult>;
19
- /** Full create flow: prompt for name/workspace, init, and run agent wizard */
20
- export declare function runCreateFlow(name?: string, workspaceFlag?: string, options?: ExecInitOptions): Promise<void>;
21
- export declare const initCommand: Command;
@@ -1,185 +0,0 @@
1
- import { Command } from 'commander';
2
- import { execFileSync } from '../utils/subprocess.js';
3
- import { writeFileSync, existsSync, mkdirSync } from 'fs';
4
- import { join, resolve } from 'path';
5
- import { homedir } from 'os';
6
- import { requireAuth } from '../auth/store.js';
7
- import { ApiClient } from '../api/client.js';
8
- import { ensureGitIdentity } from '../git/identity.js';
9
- import { requireGit } from '../git/preflight.js';
10
- import { formatError } from '../utils/format-error.js';
11
- import { promptSelect, promptInput } from '../utils/prompt.js';
12
- import { resolveWorkspace } from '../utils/resolve.js';
13
- import { generateManifest, saveManifest } from '../template/manifest.js';
14
- import { extractZip } from '../utils/zip.js';
15
- import { removeNestedGitDirs } from '../utils/fs.js';
16
- import { runAgentWizard } from '../ui/banner.js';
17
- import { shouldOutputJson, jsonOut } from '../utils/output.js';
18
- import { buildInitGuide, buildErrorResponse } from '../utils/agent-guidance.js';
19
- /** Default parent directory for new apps when --here is not passed. */
20
- export const DEFAULT_APPS_DIR = join(homedir(), '.runwork', 'apps');
21
- export async function execInit(client, appName, workspace, options = {}, creds) {
22
- const app = await client.initApp(workspace.id, appName);
23
- const slug = app.slug || appName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
24
- const parentDir = options.here ? process.cwd() : DEFAULT_APPS_DIR;
25
- if (!options.here && !existsSync(parentDir)) {
26
- mkdirSync(parentDir, { recursive: true });
27
- }
28
- const dir = join(parentDir, slug);
29
- if (existsSync(dir)) {
30
- console.error(`Directory "${dir}" already exists.`);
31
- process.exit(1);
32
- }
33
- mkdirSync(dir, { recursive: true });
34
- if (!options.here) {
35
- console.log(`Creating app in ${dir}`);
36
- console.log('(Pass --here to scaffold in the current directory instead.)');
37
- }
38
- // Download and extract skeleton template first
39
- console.log('Downloading project template...');
40
- try {
41
- const zipData = await client.downloadSkeleton();
42
- extractZip(zipData, dir);
43
- removeNestedGitDirs(dir);
44
- console.log('Project template extracted.');
45
- // Generate template manifest for tracking user edits
46
- const manifest = await generateManifest(dir);
47
- await saveManifest(dir, manifest);
48
- }
49
- catch {
50
- console.warn('Failed to download skeleton template. Starting with empty project.');
51
- }
52
- // Write .runwork.json AFTER template extraction so it doesn't get overwritten
53
- const config = {
54
- workspaceId: workspace.id,
55
- workspaceName: workspace.name,
56
- appId: app.id,
57
- appName: app.name,
58
- };
59
- writeFileSync(join(dir, '.runwork.json'), JSON.stringify(config, null, 2));
60
- // Initialize git. `stdio: 'pipe'` swallows git's stderr, so we have to
61
- // print any failure ourselves -- otherwise this fails silently and the
62
- // user is left with an empty directory and no clue what happened.
63
- if (!existsSync(join(dir, '.git'))) {
64
- try {
65
- execFileSync('git', ['init'], { cwd: dir, stdio: 'pipe' });
66
- }
67
- catch (err) {
68
- console.error(`git init failed in ${dir}: ${formatError(err)}`);
69
- throw err;
70
- }
71
- // Force the initial branch to `main` regardless of the user's
72
- // `init.defaultBranch` config (older Git installs default to
73
- // `master`). symbolic-ref works before any commits exist; `git
74
- // branch -M main` would not.
75
- try {
76
- execFileSync('git', ['symbolic-ref', 'HEAD', 'refs/heads/main'], { cwd: dir, stdio: 'pipe' });
77
- }
78
- catch { /* best-effort: push uses HEAD:main so this is just cleanliness */ }
79
- }
80
- // Seed a local git identity so the initial commit cannot fail on machines
81
- // (commonly fresh Windows installs) without `git config --global user.email`.
82
- ensureGitIdentity(dir, creds);
83
- // Add runwork remote
84
- const remoteUrl = client.getGitRemoteUrl(workspace.id, app.id);
85
- try {
86
- execFileSync('git', ['remote', 'add', 'runwork', remoteUrl], { cwd: dir, stdio: 'pipe' });
87
- }
88
- catch {
89
- execFileSync('git', ['remote', 'set-url', 'runwork', remoteUrl], { cwd: dir, stdio: 'pipe' });
90
- }
91
- // Create .gitignore if needed
92
- if (!existsSync(join(dir, '.gitignore'))) {
93
- writeFileSync(join(dir, '.gitignore'), 'node_modules/\n.runwork/\n.dev.vars\n');
94
- }
95
- // Initial commit: only track .runwork.json and .gitignore (not template files)
96
- execFileSync('git', ['add', '--', '.runwork.json', '.gitignore'], { cwd: dir, stdio: 'pipe' });
97
- try {
98
- execFileSync('git', ['commit', '-m', 'Initialize app'], { cwd: dir, stdio: 'pipe' });
99
- }
100
- catch {
101
- // Nothing to commit is fine
102
- }
103
- try {
104
- execFileSync('git', ['push', '-u', 'runwork', 'main'], { cwd: dir, stdio: 'pipe' });
105
- }
106
- catch (err) {
107
- console.error(`git push to runwork remote failed: ${formatError(err)}`);
108
- throw err;
109
- }
110
- console.log(`\nApp "${app.name}" initialized in ${dir}`);
111
- return {
112
- appId: app.id,
113
- appName: app.name,
114
- slug,
115
- directory: resolve(dir),
116
- workspaceId: workspace.id,
117
- workspaceName: workspace.name,
118
- };
119
- }
120
- /** Full create flow: prompt for name/workspace, init, and run agent wizard */
121
- export async function runCreateFlow(name, workspaceFlag, options = {}) {
122
- const useJson = shouldOutputJson(undefined);
123
- requireGit('init');
124
- const creds = requireAuth();
125
- const client = new ApiClient(creds);
126
- const appName = name || await promptInput('App name');
127
- if (!appName) {
128
- if (useJson) {
129
- jsonOut(buildErrorResponse('init', 'App name is required.', 'No app name was provided.', ['Provide an app name as an argument: runwork init <name>']));
130
- return;
131
- }
132
- console.error('App name is required.');
133
- process.exit(1);
134
- }
135
- let workspace;
136
- if (workspaceFlag) {
137
- workspace = await resolveWorkspace(client, workspaceFlag);
138
- }
139
- else if (creds.defaultWorkspaceId) {
140
- // Auto-select default workspace from credentials (set during login/onboarding)
141
- workspace = { id: creds.defaultWorkspaceId, name: creds.defaultWorkspaceName || creds.defaultWorkspaceId };
142
- }
143
- else {
144
- const workspaces = await client.listWorkspaces();
145
- if (workspaces.length === 0) {
146
- if (useJson) {
147
- jsonOut(buildErrorResponse('init', 'No workspaces found.', 'The authenticated account has no workspaces.', ['Create a workspace at runwork.ai first.']));
148
- return;
149
- }
150
- console.error('No workspaces found. Create one at runwork.ai first.');
151
- process.exit(1);
152
- }
153
- if (workspaces.length === 1) {
154
- workspace = workspaces[0];
155
- }
156
- else {
157
- const workspaceChoice = await promptSelect('Select workspace:', workspaces.map(w => ({ label: w.name, value: w })));
158
- workspace = workspaceChoice.value;
159
- }
160
- }
161
- if (!useJson) {
162
- console.log(`Creating "${appName}" in workspace "${workspace.name}"...`);
163
- }
164
- const initResult = await execInit(client, appName, workspace, options, creds);
165
- if (useJson) {
166
- const response = {
167
- success: true,
168
- command: 'init',
169
- result: initResult,
170
- guide: buildInitGuide(initResult.appName, initResult.directory),
171
- };
172
- jsonOut(response);
173
- return;
174
- }
175
- await runAgentWizard(initResult.directory);
176
- }
177
- export const initCommand = new Command('init')
178
- .alias('create')
179
- .description('Create a new Runwork app')
180
- .argument('[name]', 'App name')
181
- .option('--workspace <name-or-id>', 'Workspace name or ID (skips interactive selection)')
182
- .option('--here', `Scaffold in the current directory instead of ${DEFAULT_APPS_DIR}/<slug>`)
183
- .action(async (name, options) => {
184
- await runCreateFlow(name, options?.workspace, { here: options?.here });
185
- });
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const integrationsCommand: Command;