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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runwork",
3
- "version": "0.15.1",
3
+ "version": "0.16.0",
4
4
  "description": "CLI for Runwork: develop, preview, and deploy Runwork apps from your local machine.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Runwork <info@runwork.ai> (https://www.runwork.ai)",
@@ -28,14 +28,14 @@
28
28
  },
29
29
  "scripts": {
30
30
  "prebuild": "cd ../framework && bun run build && cd ../runwork-cli && mkdir -p bundled-types && cp ../framework/dist/*.d.ts bundled-types/ && cp -r ../framework/dist/shared bundled-types/shared 2>/dev/null; cp -r ../framework/dist/task-delegation bundled-types/task-delegation 2>/dev/null; bun run scripts/embed-types.ts",
31
- "build": "bun run prebuild && tsc",
31
+ "build": "bun run prebuild && bun run scripts/build-bundle.ts",
32
32
  "build:binary": "bun run prebuild && bun build src/index.ts --compile --outfile dist/runwork",
33
33
  "build:binaries": "bun run scripts/build-binaries.ts",
34
- "dev": "tsc --watch",
34
+ "dev": "bun run scripts/build-bundle.ts --watch",
35
35
  "typecheck": "tsc --noEmit",
36
36
  "test": "vitest run",
37
37
  "test:local": "RUNWORK_TEST_LOCAL_AGENTS=1 vitest run",
38
- "prepublishOnly": "bun run prebuild && tsc",
38
+ "prepublishOnly": "bun run build",
39
39
  "release": "npm publish && npm dist-tag add runwork@$(node -p \"require('./package.json').version\") next",
40
40
  "release:binaries": "bun run scripts/release-binaries.ts",
41
41
  "release:binaries:upload": "bun run scripts/release-binaries.ts --skip-build",
@@ -1 +0,0 @@
1
- export {};
@@ -1,250 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { parseCurlToRequest } from '../utils/curl-parser.js';
3
- describe('parseCurlToRequest', () => {
4
- describe('basic requests', () => {
5
- it('parses a simple GET request', async () => {
6
- const result = await parseCurlToRequest("curl 'https://api.example.com/users'");
7
- expect(result.method).toBe('GET');
8
- expect(result.path).toBe('/users');
9
- expect(result.query).toBeUndefined();
10
- expect(result.body).toBeUndefined();
11
- });
12
- it('parses GET with query parameters', async () => {
13
- const result = await parseCurlToRequest("curl 'https://api.example.com/users?limit=10&offset=20'");
14
- expect(result.method).toBe('GET');
15
- expect(result.path).toBe('/users');
16
- expect(result.query).toBe('limit=10&offset=20');
17
- });
18
- it('parses explicit GET method', async () => {
19
- const result = await parseCurlToRequest("curl -X GET 'https://api.example.com/data'");
20
- expect(result.method).toBe('GET');
21
- expect(result.path).toBe('/data');
22
- });
23
- it('parses URL without quotes', async () => {
24
- const result = await parseCurlToRequest('curl https://api.example.com/items');
25
- expect(result.method).toBe('GET');
26
- expect(result.path).toBe('/items');
27
- });
28
- });
29
- describe('HTTP methods', () => {
30
- it('parses POST with -X', async () => {
31
- const result = await parseCurlToRequest("curl -X POST 'https://api.example.com/users'");
32
- expect(result.method).toBe('POST');
33
- });
34
- it('parses PUT with --request', async () => {
35
- const result = await parseCurlToRequest("curl --request PUT 'https://api.example.com/users/1'");
36
- expect(result.method).toBe('PUT');
37
- });
38
- it('parses DELETE', async () => {
39
- const result = await parseCurlToRequest("curl -X DELETE 'https://api.example.com/users/1'");
40
- expect(result.method).toBe('DELETE');
41
- });
42
- it('parses PATCH', async () => {
43
- const result = await parseCurlToRequest("curl -X PATCH 'https://api.example.com/users/1'");
44
- expect(result.method).toBe('PATCH');
45
- });
46
- it('infers POST when --data is present without -X', async () => {
47
- const result = await parseCurlToRequest(`curl 'https://api.example.com/users' -d '{"name":"test"}'`);
48
- expect(result.method).toBe('POST');
49
- });
50
- });
51
- describe('headers', () => {
52
- it('parses single header with -H', async () => {
53
- const result = await parseCurlToRequest("curl 'https://api.example.com/users' -H 'Accept: application/json'");
54
- expect(result.headers['Accept']).toBe('application/json');
55
- });
56
- it('parses multiple headers', async () => {
57
- const result = await parseCurlToRequest("curl 'https://api.example.com/users' -H 'Accept: application/json' -H 'X-Custom: value'");
58
- expect(result.headers['Accept']).toBe('application/json');
59
- expect(result.headers['X-Custom']).toBe('value');
60
- });
61
- it('strips Authorization header', async () => {
62
- const result = await parseCurlToRequest("curl 'https://api.example.com/users' -H 'Authorization: Bearer token123' -H 'Accept: application/json'");
63
- expect(result.headers['Authorization']).toBeUndefined();
64
- expect(result.headers['Accept']).toBe('application/json');
65
- });
66
- it('strips Cookie header', async () => {
67
- const result = await parseCurlToRequest("curl 'https://api.example.com/users' -H 'Cookie: session=abc' -H 'Accept: application/json'");
68
- expect(result.headers['Cookie']).toBeUndefined();
69
- expect(result.headers['Accept']).toBe('application/json');
70
- });
71
- it('strips Host header', async () => {
72
- const result = await parseCurlToRequest("curl 'https://api.example.com/users' -H 'Host: api.example.com'");
73
- expect(result.headers['Host']).toBeUndefined();
74
- });
75
- it('strips User-Agent header', async () => {
76
- const result = await parseCurlToRequest("curl 'https://api.example.com/users' -H 'User-Agent: Mozilla/5.0' -H 'Accept: text/html'");
77
- expect(result.headers['User-Agent']).toBeUndefined();
78
- expect(result.headers['Accept']).toBe('text/html');
79
- });
80
- it('strips Connection header', async () => {
81
- const result = await parseCurlToRequest("curl 'https://api.example.com/users' -H 'Connection: keep-alive'");
82
- expect(result.headers['Connection']).toBeUndefined();
83
- });
84
- it('preserves Content-Type header', async () => {
85
- const result = await parseCurlToRequest("curl 'https://api.example.com/users' -H 'Content-Type: application/json'");
86
- expect(result.headers['Content-Type']).toBe('application/json');
87
- });
88
- });
89
- describe('request body', () => {
90
- it('parses JSON body with -d', async () => {
91
- const result = await parseCurlToRequest(`curl 'https://api.example.com/users' -X POST -d '{"name":"John","age":30}'`);
92
- expect(result.body).toEqual({ name: 'John', age: 30 });
93
- });
94
- it('parses JSON body with --data', async () => {
95
- const result = await parseCurlToRequest(`curl 'https://api.example.com/users' -X POST --data '{"key":"value"}'`);
96
- expect(result.body).toEqual({ key: 'value' });
97
- });
98
- it('parses JSON body with --data-raw', async () => {
99
- const result = await parseCurlToRequest(`curl 'https://api.example.com/users' -X POST --data-raw '{"items":[1,2,3]}'`);
100
- expect(result.body).toEqual({ items: [1, 2, 3] });
101
- });
102
- it('handles form-encoded body as parsed object', async () => {
103
- const result = await parseCurlToRequest(`curl 'https://api.example.com/submit' -X POST -d 'name=John&age=30'`);
104
- // curlconverter parses form data into key-value pairs
105
- expect(result.body).toEqual({ name: 'John', age: '30' });
106
- });
107
- it('parses empty body', async () => {
108
- const result = await parseCurlToRequest("curl 'https://api.example.com/users' -X POST");
109
- expect(result.body).toBeUndefined();
110
- });
111
- });
112
- describe('Chrome DevTools "Copy as cURL" format', () => {
113
- it('parses typical Chrome GET request', async () => {
114
- const curl = `curl 'https://api.hubapi.com/crm/v3/objects/contacts?limit=10&properties=email%2Cfirstname' \\
115
- -H 'accept: application/json, text/plain, */*' \\
116
- -H 'accept-language: en-US,en;q=0.9' \\
117
- -H 'authorization: Bearer REDACTED' \\
118
- -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)' \\
119
- -H 'cookie: session=abc123'`;
120
- const result = await parseCurlToRequest(curl);
121
- expect(result.method).toBe('GET');
122
- expect(result.path).toBe('/crm/v3/objects/contacts');
123
- expect(result.query).toContain('limit=10');
124
- expect(result.headers['authorization']).toBeUndefined();
125
- expect(result.headers['cookie']).toBeUndefined();
126
- expect(result.headers['user-agent']).toBeUndefined();
127
- expect(result.headers['accept']).toBe('application/json, text/plain, */*');
128
- });
129
- it('parses Chrome POST with JSON body', async () => {
130
- const curl = `curl 'https://api.hubapi.com/crm/v3/objects/contacts' \\
131
- -H 'accept: application/json' \\
132
- -H 'authorization: Bearer REDACTED' \\
133
- -H 'content-type: application/json' \\
134
- --data-raw '{"properties":{"email":"test@example.com","firstname":"Test"}}' \\
135
- --compressed`;
136
- const result = await parseCurlToRequest(curl);
137
- expect(result.method).toBe('POST');
138
- expect(result.path).toBe('/crm/v3/objects/contacts');
139
- expect(result.body).toEqual({
140
- properties: { email: 'test@example.com', firstname: 'Test' },
141
- });
142
- });
143
- it('parses Chrome PUT request', async () => {
144
- const curl = `curl 'https://api.example.com/crm/v3/objects/contacts/123' \\
145
- -X 'PUT' \\
146
- -H 'content-type: application/json' \\
147
- --data-raw '{"properties":{"firstname":"Updated"}}'`;
148
- const result = await parseCurlToRequest(curl);
149
- expect(result.method).toBe('PUT');
150
- expect(result.path).toBe('/crm/v3/objects/contacts/123');
151
- expect(result.body).toEqual({ properties: { firstname: 'Updated' } });
152
- });
153
- it('parses Chrome DELETE request', async () => {
154
- const curl = `curl 'https://api.example.com/crm/v3/objects/contacts/123' \\
155
- -X 'DELETE' \\
156
- -H 'authorization: Bearer REDACTED'`;
157
- const result = await parseCurlToRequest(curl);
158
- expect(result.method).toBe('DELETE');
159
- expect(result.path).toBe('/crm/v3/objects/contacts/123');
160
- });
161
- });
162
- describe('URL path extraction', () => {
163
- it('extracts path from URL with port', async () => {
164
- const result = await parseCurlToRequest("curl 'https://api.example.com:8443/v2/users'");
165
- expect(result.path).toBe('/v2/users');
166
- });
167
- it('handles root path', async () => {
168
- const result = await parseCurlToRequest("curl 'https://api.example.com/'");
169
- expect(result.path).toBe('/');
170
- });
171
- it('handles deeply nested path', async () => {
172
- const result = await parseCurlToRequest("curl 'https://api.example.com/v3/crm/objects/contacts/search'");
173
- expect(result.path).toBe('/v3/crm/objects/contacts/search');
174
- });
175
- it('preserves URL-encoded characters in path', async () => {
176
- const result = await parseCurlToRequest("curl 'https://api.example.com/users/john%40example.com'");
177
- expect(result.path).toBe('/users/john%40example.com');
178
- });
179
- });
180
- describe('edge cases', () => {
181
- it('handles double-quoted strings', async () => {
182
- const result = await parseCurlToRequest('curl "https://api.example.com/users" -H "Accept: application/json"');
183
- expect(result.path).toBe('/users');
184
- expect(result.headers['Accept']).toBe('application/json');
185
- });
186
- it('handles --compressed flag', async () => {
187
- const result = await parseCurlToRequest("curl 'https://api.example.com/data' --compressed -H 'Accept-Encoding: gzip'");
188
- expect(result.method).toBe('GET');
189
- expect(result.path).toBe('/data');
190
- });
191
- it('handles -s (silent) flag', async () => {
192
- const result = await parseCurlToRequest("curl -s 'https://api.example.com/health'");
193
- expect(result.path).toBe('/health');
194
- });
195
- it('handles -L (follow redirects) flag', async () => {
196
- const result = await parseCurlToRequest("curl -L 'https://api.example.com/redirect'");
197
- expect(result.path).toBe('/redirect');
198
- });
199
- it('throws on empty/invalid input', async () => {
200
- await expect(parseCurlToRequest('')).rejects.toThrow();
201
- });
202
- it('handles multiline curl with backslash continuations', async () => {
203
- const curl = `curl \\
204
- 'https://api.example.com/users' \\
205
- -H 'Accept: application/json' \\
206
- -H 'X-Request-Id: abc-123'`;
207
- const result = await parseCurlToRequest(curl);
208
- expect(result.path).toBe('/users');
209
- expect(result.headers['Accept']).toBe('application/json');
210
- expect(result.headers['X-Request-Id']).toBe('abc-123');
211
- });
212
- it('handles complex JSON body with nested objects', async () => {
213
- const curl = `curl 'https://api.example.com/search' -X POST -H 'Content-Type: application/json' --data-raw '{"filters":{"and":[{"property":"email","operator":"EQ","value":"test@example.com"}]},"limit":10}'`;
214
- const result = await parseCurlToRequest(curl);
215
- expect(result.body).toEqual({
216
- filters: {
217
- and: [{ property: 'email', operator: 'EQ', value: 'test@example.com' }],
218
- },
219
- limit: 10,
220
- });
221
- });
222
- it('handles request with many headers (real-world Chrome copy)', async () => {
223
- const curl = `curl 'https://api.stripe.com/v1/charges?limit=3' \\
224
- -H 'accept: application/json' \\
225
- -H 'accept-language: en-US,en;q=0.9,tr;q=0.8' \\
226
- -H 'authorization: Bearer sk_test_xxx' \\
227
- -H 'cache-control: no-cache' \\
228
- -H 'connection: keep-alive' \\
229
- -H 'cookie: __stripe_mid=abc; __stripe_sid=def' \\
230
- -H 'pragma: no-cache' \\
231
- -H 'sec-ch-ua: "Chromium";v="128"' \\
232
- -H 'sec-fetch-dest: empty' \\
233
- -H 'sec-fetch-mode: cors' \\
234
- -H 'sec-fetch-site: same-origin' \\
235
- -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)'`;
236
- const result = await parseCurlToRequest(curl);
237
- expect(result.method).toBe('GET');
238
- expect(result.path).toBe('/v1/charges');
239
- expect(result.query).toBe('limit=3');
240
- // Proxy-managed headers stripped
241
- expect(result.headers['authorization']).toBeUndefined();
242
- expect(result.headers['cookie']).toBeUndefined();
243
- expect(result.headers['connection']).toBeUndefined();
244
- expect(result.headers['user-agent']).toBeUndefined();
245
- // App headers preserved
246
- expect(result.headers['accept']).toBe('application/json');
247
- expect(result.headers['cache-control']).toBe('no-cache');
248
- });
249
- });
250
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,280 +0,0 @@
1
- /**
2
- * Integration tests for the Runwork install scripts.
3
- *
4
- * install.sh runs end-to-end against a local HTTP server that serves a fake
5
- * release manifest and a tar.gz for the current host platform. install.ps1 is
6
- * checked statically (grep of invariants) because PowerShell is not available
7
- * on the Unix runners that execute this suite.
8
- *
9
- * Design note: install.sh uses curl to fetch from the in-process Node HTTP
10
- * server, so we MUST run the child process asynchronously. Using execFileSync
11
- * would block the Node event loop, preventing the HTTP server from responding
12
- * to curl and deadlocking the test.
13
- */
14
- import { describe, it, expect, beforeEach, afterEach } from 'vitest';
15
- import { execFileSync, spawn } from 'node:child_process';
16
- import { createServer } from 'node:http';
17
- import { chmodSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readlinkSync, rmSync, statSync, writeFileSync, } from 'node:fs';
18
- import { tmpdir } from 'node:os';
19
- import { join } from 'node:path';
20
- import { fileURLToPath } from 'node:url';
21
- import { createHash } from 'node:crypto';
22
- const INSTALL_SH = fileURLToPath(new URL('../../install.sh', import.meta.url));
23
- const INSTALL_PS1 = fileURLToPath(new URL('../../install.ps1', import.meta.url));
24
- function detectHostPlatform() {
25
- const osMap = { darwin: 'darwin', linux: 'linux' };
26
- const archMap = { x64: 'x64', arm64: 'arm64' };
27
- const os = osMap[process.platform];
28
- const arch = archMap[process.arch];
29
- if (!os || !arch) {
30
- throw new Error(`install.sh integration test requires darwin/linux and x64/arm64; got ${process.platform}/${process.arch}`);
31
- }
32
- return { os, arch, platform: `${os}-${arch}` };
33
- }
34
- function sha256Hex(data) {
35
- return createHash('sha256').update(data).digest('hex');
36
- }
37
- function runInstallSh(env) {
38
- return new Promise((resolvePromise) => {
39
- const child = spawn('sh', [INSTALL_SH], {
40
- env,
41
- stdio: ['ignore', 'pipe', 'pipe'],
42
- });
43
- let stdout = '';
44
- let stderr = '';
45
- child.stdout.on('data', (chunk) => {
46
- stdout += chunk.toString();
47
- });
48
- child.stderr.on('data', (chunk) => {
49
- stderr += chunk.toString();
50
- });
51
- child.on('error', (err) => {
52
- resolvePromise({ status: -1, stdout, stderr: stderr + `\n[spawn error] ${err.message}` });
53
- });
54
- child.on('close', (code) => {
55
- resolvePromise({ status: code ?? -1, stdout, stderr });
56
- });
57
- });
58
- }
59
- describe('install.sh (end-to-end)', () => {
60
- let workDir;
61
- let serverDir;
62
- let server;
63
- let serverUrl;
64
- let platformInfo;
65
- let archivePath;
66
- beforeEach(async () => {
67
- platformInfo = detectHostPlatform();
68
- workDir = mkdtempSync(join(tmpdir(), 'runwork-install-test-'));
69
- serverDir = join(workDir, 'server');
70
- mkdirSync(serverDir, { recursive: true });
71
- // Fake binary that prints a recognizable version string.
72
- const binaryName = `runwork-${platformInfo.platform}`;
73
- const binarySource = join(workDir, 'binary-source');
74
- mkdirSync(binarySource, { recursive: true });
75
- const binaryPath = join(binarySource, binaryName);
76
- writeFileSync(binaryPath, '#!/bin/sh\necho "runwork 99.99.99 (test)"\n');
77
- chmodSync(binaryPath, 0o755);
78
- // Pack the binary into a tar.gz at the manifest path.
79
- const archiveName = `${binaryName}.tar.gz`;
80
- const releasesDir = join(serverDir, 'cli', 'releases', '99.99.99');
81
- mkdirSync(releasesDir, { recursive: true });
82
- archivePath = join(releasesDir, archiveName);
83
- execFileSync('tar', ['-czf', archivePath, binaryName], { cwd: binarySource });
84
- const sha = sha256Hex(readFileSync(archivePath));
85
- // Write the manifest consumed by install.sh.
86
- const manifest = {
87
- name: 'runwork',
88
- version: '99.99.99',
89
- publishedAt: new Date().toISOString(),
90
- artifacts: {
91
- [platformInfo.platform]: {
92
- path: `/cli/releases/99.99.99/${archiveName}`,
93
- sha256: sha,
94
- },
95
- },
96
- };
97
- writeFileSync(join(serverDir, 'cli', 'latest.json'), JSON.stringify(manifest, null, 2) + '\n');
98
- // Minimal static HTTP server rooted at serverDir.
99
- server = createServer((req, res) => {
100
- const requestPath = decodeURIComponent(req.url ?? '/').replace(/^\/+/, '');
101
- const filePath = join(serverDir, requestPath);
102
- if (!filePath.startsWith(serverDir) ||
103
- !existsSync(filePath) ||
104
- statSync(filePath).isDirectory()) {
105
- res.writeHead(404, { 'Content-Type': 'text/plain' });
106
- res.end('not found');
107
- return;
108
- }
109
- const body = readFileSync(filePath);
110
- res.writeHead(200, {
111
- 'Content-Type': 'application/octet-stream',
112
- 'Content-Length': body.length,
113
- });
114
- res.end(body);
115
- });
116
- await new Promise((resolvePromise) => {
117
- server.listen(0, '127.0.0.1', () => {
118
- const addr = server.address();
119
- if (addr && typeof addr === 'object') {
120
- serverUrl = `http://127.0.0.1:${addr.port}`;
121
- }
122
- resolvePromise();
123
- });
124
- });
125
- });
126
- afterEach(async () => {
127
- await new Promise((resolvePromise) => {
128
- server.close(() => resolvePromise());
129
- });
130
- rmSync(workDir, { recursive: true, force: true });
131
- });
132
- function envFor(overrides) {
133
- return {
134
- ...process.env,
135
- HOME: workDir,
136
- RUNWORK_DOWNLOAD_BASE_URL: serverUrl,
137
- ...overrides,
138
- };
139
- }
140
- it('installs the binary to the canonical location and symlinks it onto PATH', async () => {
141
- const installDir = join(workDir, 'install');
142
- const linkDir = join(workDir, 'link');
143
- const result = await runInstallSh(envFor({
144
- RUNWORK_INSTALL_DIR: installDir,
145
- RUNWORK_BIN_LINK_DIR: linkDir,
146
- }));
147
- expect(result.status, `installer failed:\nstdout:\n${result.stdout}\nstderr:\n${result.stderr}`).toBe(0);
148
- expect(result.stdout).toContain('99.99.99');
149
- expect(result.stdout).toContain(platformInfo.platform);
150
- const installedBinary = join(installDir, 'runwork');
151
- expect(existsSync(installedBinary)).toBe(true);
152
- expect(statSync(installedBinary).mode & 0o111).toBeGreaterThan(0);
153
- const linkPath = join(linkDir, 'runwork');
154
- expect(existsSync(linkPath)).toBe(true);
155
- expect(lstatSync(linkPath).isSymbolicLink()).toBe(true);
156
- expect(readlinkSync(linkPath)).toBe(installedBinary);
157
- const versionOutput = execFileSync(installedBinary, [], { encoding: 'utf-8' });
158
- expect(versionOutput).toContain('99.99.99');
159
- });
160
- it('defaults install location to $HOME/.runwork/bin when RUNWORK_INSTALL_DIR is unset', async () => {
161
- const result = await runInstallSh(envFor({
162
- RUNWORK_BIN_LINK_DIR: join(workDir, 'link'),
163
- }));
164
- expect(result.status, `installer failed:\nstdout:\n${result.stdout}\nstderr:\n${result.stderr}`).toBe(0);
165
- const defaultBinary = join(workDir, '.runwork', 'bin', 'runwork');
166
- expect(existsSync(defaultBinary)).toBe(true);
167
- });
168
- it('persists ~/.runwork/bin to a shell profile, idempotently, on a default install', async () => {
169
- const linkDir = join(workDir, 'link');
170
- const exportLine = 'export PATH="$HOME/.runwork/bin:$PATH"';
171
- const marker = '# Added by Runwork CLI installer';
172
- const profiles = ['.zshrc', '.bashrc', '.bash_profile', '.profile'].map((p) => join(workDir, p));
173
- const read = (p) => (existsSync(p) ? readFileSync(p, 'utf-8') : '');
174
- // First install with the default install dir ($HOME/.runwork/bin) triggers
175
- // PATH persistence.
176
- const r1 = await runInstallSh(envFor({ RUNWORK_BIN_LINK_DIR: linkDir }));
177
- expect(r1.status, `installer failed:\n${r1.stdout}\n${r1.stderr}`).toBe(0);
178
- const written = profiles.filter((p) => read(p).includes(exportLine));
179
- expect(written.length, 'expected the export line in at least one profile').toBeGreaterThan(0);
180
- expect(profiles.some((p) => read(p).includes(marker))).toBe(true);
181
- // Re-running must NOT append a second time (guarded on .runwork/bin).
182
- const r2 = await runInstallSh(envFor({ RUNWORK_BIN_LINK_DIR: linkDir }));
183
- expect(r2.status).toBe(0);
184
- for (const p of written) {
185
- const occurrences = read(p).split('.runwork/bin').length - 1;
186
- expect(occurrences, `profile ${p} should reference .runwork/bin exactly once`).toBe(1);
187
- }
188
- });
189
- it('does NOT touch shell profiles when a custom RUNWORK_INSTALL_DIR is used', async () => {
190
- const result = await runInstallSh(envFor({
191
- RUNWORK_INSTALL_DIR: join(workDir, 'install'),
192
- RUNWORK_BIN_LINK_DIR: join(workDir, 'link'),
193
- }));
194
- expect(result.status).toBe(0);
195
- const profiles = ['.zshrc', '.bashrc', '.bash_profile', '.profile'].map((p) => join(workDir, p));
196
- for (const p of profiles) {
197
- if (existsSync(p))
198
- expect(readFileSync(p, 'utf-8')).not.toContain('.runwork/bin');
199
- }
200
- });
201
- it('aborts on sha256 mismatch and leaves the install directory untouched', async () => {
202
- // Tamper with the archive the server is about to serve.
203
- writeFileSync(archivePath, Buffer.from('tampered payload'));
204
- const installDir = join(workDir, 'install');
205
- const result = await runInstallSh(envFor({
206
- RUNWORK_INSTALL_DIR: installDir,
207
- RUNWORK_BIN_LINK_DIR: join(workDir, 'link'),
208
- }));
209
- expect(result.status).not.toBe(0);
210
- expect(result.stderr).toContain('sha256 mismatch');
211
- expect(existsSync(join(installDir, 'runwork'))).toBe(false);
212
- });
213
- it('reports a clear error when the manifest is unreachable', async () => {
214
- rmSync(join(serverDir, 'cli', 'latest.json'));
215
- const result = await runInstallSh(envFor({
216
- RUNWORK_INSTALL_DIR: join(workDir, 'install'),
217
- RUNWORK_BIN_LINK_DIR: join(workDir, 'link'),
218
- }));
219
- expect(result.status).not.toBe(0);
220
- expect(result.stderr).toContain('failed to fetch release manifest');
221
- });
222
- it('reports a clear error when the manifest has no artifact for the host platform', async () => {
223
- const fakePlatform = platformInfo.platform === 'linux-x64' ? 'linux-arm64' : 'linux-x64';
224
- const manifest = {
225
- name: 'runwork',
226
- version: '99.99.99',
227
- publishedAt: new Date().toISOString(),
228
- artifacts: {
229
- [fakePlatform]: {
230
- path: `/cli/releases/99.99.99/runwork-${fakePlatform}.tar.gz`,
231
- sha256: 'deadbeef',
232
- },
233
- },
234
- };
235
- writeFileSync(join(serverDir, 'cli', 'latest.json'), JSON.stringify(manifest, null, 2));
236
- const result = await runInstallSh(envFor({
237
- RUNWORK_INSTALL_DIR: join(workDir, 'install'),
238
- RUNWORK_BIN_LINK_DIR: join(workDir, 'link'),
239
- }));
240
- expect(result.status).not.toBe(0);
241
- expect(result.stderr).toContain('no artifact entry for platform');
242
- });
243
- });
244
- describe('install.ps1 (static invariants)', () => {
245
- let contents;
246
- beforeEach(() => {
247
- contents = readFileSync(INSTALL_PS1, 'utf-8');
248
- });
249
- it('exists alongside install.sh', () => {
250
- expect(existsSync(INSTALL_PS1)).toBe(true);
251
- });
252
- it('resolves the manifest against runwork.ai/cli/latest.json by default', () => {
253
- expect(contents).toContain("'https://runwork.ai'");
254
- expect(contents).toContain('/cli/latest.json');
255
- });
256
- it('honors the RUNWORK_* env var overrides documented in the plan', () => {
257
- expect(contents).toContain('RUNWORK_VERSION');
258
- expect(contents).toContain('RUNWORK_INSTALL_DIR');
259
- expect(contents).toContain('RUNWORK_DOWNLOAD_BASE_URL');
260
- });
261
- it('verifies sha256 with Get-FileHash -Algorithm SHA256', () => {
262
- expect(contents).toContain('Get-FileHash');
263
- expect(contents).toContain('SHA256');
264
- expect(contents).toContain('sha256 mismatch');
265
- });
266
- it('targets the canonical Windows install location under %USERPROFILE%\\.runwork\\bin', () => {
267
- expect(contents).toMatch(/\$env:USERPROFILE/);
268
- expect(contents).toMatch(/['"]\.runwork\\bin['"]/);
269
- });
270
- it('modifies the user PATH scope only (never machine)', () => {
271
- expect(contents).toContain("'User'");
272
- expect(contents).not.toContain("'Machine'");
273
- });
274
- it('downloads release artifacts from /cli/releases/<version>/<artifact>', () => {
275
- expect(contents).toMatch(/\/cli\/releases\//);
276
- });
277
- it('does not escalate to admin', () => {
278
- expect(contents).not.toMatch(/Start-Process.*-Verb\s+RunAs/i);
279
- });
280
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,89 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- vi.mock('fs');
3
- vi.mock('../generated/bundled-types.js', () => ({
4
- BUNDLED_TYPES: {},
5
- }));
6
- const mockFs = await import('fs');
7
- const bundledTypesModule = await import('../generated/bundled-types.js');
8
- const { populateTypes } = await import('../types-manager.js');
9
- function setBundledTypes(types) {
10
- Object.keys(bundledTypesModule.BUNDLED_TYPES).forEach(k => delete bundledTypesModule.BUNDLED_TYPES[k]);
11
- Object.assign(bundledTypesModule.BUNDLED_TYPES, types);
12
- }
13
- describe('types-manager', () => {
14
- beforeEach(() => {
15
- vi.clearAllMocks();
16
- setBundledTypes({});
17
- });
18
- describe('populateTypes()', () => {
19
- it('creates .runwork/types directory', async () => {
20
- vi.mocked(mockFs.existsSync).mockReturnValue(false);
21
- const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
22
- await populateTypes('/project');
23
- expect(mockFs.mkdirSync).toHaveBeenCalledWith('/project/.runwork/types', { recursive: true });
24
- warnSpy.mockRestore();
25
- });
26
- it('copies from node_modules when available (Tier 1)', async () => {
27
- vi.mocked(mockFs.existsSync).mockImplementation((path) => {
28
- if (String(path).includes('node_modules/@runworkai/framework/dist')) {
29
- return true;
30
- }
31
- return false;
32
- });
33
- vi.mocked(mockFs.readdirSync).mockReturnValue(['core-utils.d.ts', 'index.d.ts', 'README.md', 'index.js']);
34
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
35
- await populateTypes('/project');
36
- expect(mockFs.readdirSync).toHaveBeenCalledWith('/project/node_modules/@runworkai/framework/dist');
37
- expect(logSpy).toHaveBeenCalledWith('Types populated from node_modules/@runworkai/framework');
38
- logSpy.mockRestore();
39
- });
40
- it('copies only .d.ts files, not other files', async () => {
41
- vi.mocked(mockFs.existsSync).mockImplementation((path) => {
42
- if (String(path).includes('node_modules/@runworkai/framework/dist')) {
43
- return true;
44
- }
45
- return false;
46
- });
47
- vi.mocked(mockFs.readdirSync).mockReturnValue(['types.d.ts', 'index.js', 'utils.d.ts', 'readme.md', 'config.json']);
48
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
49
- await populateTypes('/project');
50
- // Only .d.ts files should be copied
51
- expect(mockFs.copyFileSync).toHaveBeenCalledTimes(2);
52
- expect(mockFs.copyFileSync).toHaveBeenCalledWith('/project/node_modules/@runworkai/framework/dist/types.d.ts', '/project/.runwork/types/types.d.ts');
53
- expect(mockFs.copyFileSync).toHaveBeenCalledWith('/project/node_modules/@runworkai/framework/dist/utils.d.ts', '/project/.runwork/types/utils.d.ts');
54
- logSpy.mockRestore();
55
- });
56
- it('falls back to bundled types (Tier 3) when node_modules unavailable', async () => {
57
- vi.mocked(mockFs.existsSync).mockReturnValue(false);
58
- setBundledTypes({
59
- 'framework.d.ts': 'export type Framework = {};',
60
- });
61
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
62
- await populateTypes('/project');
63
- expect(mockFs.writeFileSync).toHaveBeenCalledWith('/project/.runwork/types/framework.d.ts', 'export type Framework = {};');
64
- expect(logSpy).toHaveBeenCalledWith('Types populated from bundled types');
65
- logSpy.mockRestore();
66
- });
67
- it('warns when no types found at all', async () => {
68
- vi.mocked(mockFs.existsSync).mockReturnValue(false);
69
- setBundledTypes({});
70
- const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
71
- await populateTypes('/project');
72
- expect(warnSpy).toHaveBeenCalledWith('No type definitions found. Install @runworkai/framework or reinstall the CLI.');
73
- warnSpy.mockRestore();
74
- });
75
- it('writes all bundled type entries in Tier 3 fallback', async () => {
76
- vi.mocked(mockFs.existsSync).mockReturnValue(false);
77
- setBundledTypes({
78
- 'types.d.ts': 'export type A = {};',
79
- 'utils.d.ts': 'export type B = {};',
80
- });
81
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
82
- await populateTypes('/project');
83
- expect(mockFs.writeFileSync).toHaveBeenCalledTimes(2);
84
- expect(mockFs.writeFileSync).toHaveBeenCalledWith('/project/.runwork/types/types.d.ts', 'export type A = {};');
85
- expect(mockFs.writeFileSync).toHaveBeenCalledWith('/project/.runwork/types/utils.d.ts', 'export type B = {};');
86
- logSpy.mockRestore();
87
- });
88
- });
89
- });
@@ -1 +0,0 @@
1
- export {};