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,431 +0,0 @@
1
- import { describe, it, expect, afterEach } from 'vitest';
2
- import { execFileSync } from 'child_process';
3
- import { mkdtempSync, writeFileSync, readFileSync, rmSync, existsSync, mkdirSync, } from 'fs';
4
- import { join } from 'path';
5
- import { tmpdir } from 'os';
6
- import { isIgnored, commitWorkingTree } from '../auto-commit.js';
7
- const tempDirs = [];
8
- function makeTempDir(prefix) {
9
- const dir = mkdtempSync(join(tmpdir(), `runwork-autocommit-test-${prefix}-`));
10
- tempDirs.push(dir);
11
- return dir;
12
- }
13
- function initGitRepo(dir) {
14
- execFileSync('git', ['init', dir]);
15
- execFileSync('git', ['config', 'user.email', 'test@test.com'], { cwd: dir });
16
- execFileSync('git', ['config', 'user.name', 'Test'], { cwd: dir });
17
- }
18
- function createTestRepo() {
19
- const remote = makeTempDir('remote');
20
- execFileSync('git', ['init', '--bare', remote]);
21
- const local = makeTempDir('local');
22
- execFileSync('git', ['init', local]);
23
- execFileSync('git', ['remote', 'add', 'runwork', remote], { cwd: local });
24
- execFileSync('git', ['config', 'user.email', 'test@test.com'], { cwd: local });
25
- execFileSync('git', ['config', 'user.name', 'Test'], { cwd: local });
26
- return { local, remote };
27
- }
28
- function commitFile(repoDir, filename, content, message) {
29
- const fullPath = join(repoDir, filename);
30
- const dir = fullPath.substring(0, fullPath.lastIndexOf('/'));
31
- if (dir !== repoDir && !existsSync(dir)) {
32
- mkdirSync(dir, { recursive: true });
33
- }
34
- writeFileSync(fullPath, content);
35
- execFileSync('git', ['add', filename], { cwd: repoDir });
36
- execFileSync('git', ['commit', '-m', message], { cwd: repoDir });
37
- }
38
- afterEach(() => {
39
- for (const dir of tempDirs) {
40
- try {
41
- rmSync(dir, { recursive: true, force: true });
42
- }
43
- catch { /* best effort */ }
44
- }
45
- tempDirs.length = 0;
46
- });
47
- // ============================================================
48
- // isIgnored() unit tests
49
- // ============================================================
50
- describe('isIgnored()', () => {
51
- it('ignores .git directory', () => {
52
- expect(isIgnored('.git')).toBe(true);
53
- expect(isIgnored('/path/to/.git')).toBe(true);
54
- });
55
- it('ignores node_modules directory', () => {
56
- expect(isIgnored('node_modules')).toBe(true);
57
- expect(isIgnored('/path/to/node_modules')).toBe(true);
58
- });
59
- it('ignores .runwork directory', () => {
60
- expect(isIgnored('.runwork')).toBe(true);
61
- expect(isIgnored('/project/.runwork')).toBe(true);
62
- });
63
- it('ignores .dev.vars file', () => {
64
- expect(isIgnored('.dev.vars')).toBe(true);
65
- expect(isIgnored('/project/.dev.vars')).toBe(true);
66
- });
67
- it('ignores .env file (BUG FIX: was missing before)', () => {
68
- expect(isIgnored('.env')).toBe(true);
69
- expect(isIgnored('/project/.env')).toBe(true);
70
- });
71
- it('ignores .log extension', () => {
72
- expect(isIgnored('app.log')).toBe(true);
73
- expect(isIgnored('/var/log/debug.log')).toBe(true);
74
- });
75
- it('does not ignore normal files', () => {
76
- expect(isIgnored('index.ts')).toBe(false);
77
- expect(isIgnored('package.json')).toBe(false);
78
- expect(isIgnored('vite.config.ts')).toBe(false);
79
- expect(isIgnored('/project/src/app.tsx')).toBe(false);
80
- });
81
- it('does not ignore files that contain skip names as substrings', () => {
82
- // ".env.example" has basename ".env.example", not ".env"
83
- expect(isIgnored('.env.example')).toBe(false);
84
- expect(isIgnored('.env.local')).toBe(false);
85
- // ".gitignore" has basename ".gitignore", not ".git"
86
- expect(isIgnored('.gitignore')).toBe(false);
87
- });
88
- it('BUG PROBE: does not ignore files INSIDE node_modules when given full path', () => {
89
- // isIgnored uses basename(), so "node_modules/foo/bar.js" -> basename = "bar.js"
90
- // This is fine because chokidar calls isIgnored on the directory entry first,
91
- // so it never descends into node_modules. But if isIgnored is called with a
92
- // full path directly, it would NOT catch files inside node_modules.
93
- const fullPath = '/project/node_modules/some-package/index.js';
94
- // basename is "index.js" - NOT in SKIP_DIRS
95
- expect(isIgnored(fullPath)).toBe(false);
96
- // This is acceptable because chokidar checks the directory first.
97
- // But it means isIgnored is NOT safe for general-purpose use outside chokidar.
98
- });
99
- it('does not ignore files without extensions', () => {
100
- expect(isIgnored('Makefile')).toBe(false);
101
- expect(isIgnored('Dockerfile')).toBe(false);
102
- expect(isIgnored('LICENSE')).toBe(false);
103
- });
104
- });
105
- // ============================================================
106
- // Bug fix verification: .env file protection
107
- // ============================================================
108
- describe('.env file protection (BUG FIX)', () => {
109
- it('.env file should NOT be staged by auto-commit git add -u', () => {
110
- // Scenario: user has .env tracked in git (mistake), modifies it.
111
- // auto-commit does `git add -u` which would stage it.
112
- // The chokidar watcher should never fire for .env files.
113
- const { local } = createTestRepo();
114
- // Commit a .env file (simulating an initial mistake)
115
- commitFile(local, '.env', 'SECRET=old', 'init with env');
116
- // Modify it
117
- writeFileSync(join(local, '.env'), 'SECRET=new_value_leaked');
118
- // The isIgnored function should prevent chokidar from watching .env
119
- expect(isIgnored('.env')).toBe(true);
120
- // But even if chokidar somehow fired, the file should be ignored.
121
- // The real protection is that isIgnored('.env') returns true,
122
- // so changedFiles never includes it, so it won't be in filesToAdd.
123
- // However, `git add -u` (line 152) stages ALL modified tracked files,
124
- // including .env if it's tracked. This is a secondary concern —
125
- // the primary fix is preventing chokidar from triggering.
126
- });
127
- it('.dev.vars file is also protected', () => {
128
- expect(isIgnored('.dev.vars')).toBe(true);
129
- });
130
- it('REMAINING RISK: git add -u stages tracked .env even if chokidar ignores it', () => {
131
- // This test documents a remaining risk: if .env is already tracked in git
132
- // and gets modified outside the watcher, `git add -u` in commitAndPush()
133
- // will still stage it. The isIgnored fix only prevents chokidar from
134
- // firing events, but git add -u is unconditional.
135
- const { local } = createTestRepo();
136
- commitFile(local, 'index.ts', 'export {}', 'init');
137
- commitFile(local, '.env', 'SECRET=123', 'add env (mistake)');
138
- // Modify both files
139
- writeFileSync(join(local, 'index.ts'), 'export { hello }');
140
- writeFileSync(join(local, '.env'), 'SECRET=leaked_value');
141
- // Simulate what commitAndPush does: git add -u
142
- execFileSync('git', ['add', '-u'], { cwd: local, stdio: 'pipe' });
143
- const staged = execFileSync('git', ['diff', '--cached', '--name-only'], { cwd: local, encoding: 'utf-8' }).trim();
144
- // BUG: git add -u stages .env if it's tracked, even though isIgnored
145
- // prevents chokidar from watching it. The user's .env modification
146
- // from another editor would still be committed on the next auto-commit
147
- // cycle triggered by any other file change.
148
- expect(staged.split('\n')).toContain('.env');
149
- // This is a known risk - the fix prevents most .env commits (via chokidar),
150
- // but doesn't prevent `git add -u` from staging tracked .env files.
151
- });
152
- });
153
- // ============================================================
154
- // Bug fix verification: unicode filenames in git diff --cached
155
- // ============================================================
156
- describe('unicode filename handling in commitAndPush (BUG FIX)', () => {
157
- it('git diff --cached with core.quotePath=false returns real filenames', () => {
158
- const { local } = createTestRepo();
159
- // Create and commit a unicode filename
160
- const filename = 'caf\u00e9.txt';
161
- commitFile(local, 'init.txt', 'hello', 'init');
162
- // Stage a unicode file
163
- writeFileSync(join(local, filename), 'content');
164
- execFileSync('git', ['add', filename], { cwd: local });
165
- // WITHOUT fix: git diff --cached --name-only returns octal-escaped
166
- const withoutFix = execFileSync('git', ['diff', '--cached', '--name-only'], { cwd: local, encoding: 'utf-8' }).trim();
167
- // WITH fix: git -c core.quotePath=false diff --cached --name-only returns real name
168
- const withFix = execFileSync('git', ['-c', 'core.quotePath=false', 'diff', '--cached', '--name-only'], { cwd: local, encoding: 'utf-8' }).trim();
169
- // The fixed version should contain the actual unicode character
170
- expect(withFix).toContain('caf\u00e9.txt');
171
- // The unfixed version may contain octal escaping (depends on git config)
172
- // On most systems, git.quotePath defaults to true for non-ASCII
173
- if (withoutFix.includes('\\')) {
174
- // Confirms the bug existed: without the fix, git returns escaped names
175
- expect(withoutFix).not.toContain('caf\u00e9');
176
- }
177
- });
178
- it('staged file count is correct with unicode filenames', () => {
179
- const { local } = createTestRepo();
180
- commitFile(local, 'init.txt', 'hello', 'init');
181
- // Stage multiple files including unicode names
182
- const files = ['normal.txt', 'caf\u00e9.txt', '\u00fcber.ts', 'na\u00efve.md'];
183
- for (const f of files) {
184
- writeFileSync(join(local, f), `content of ${f}`);
185
- execFileSync('git', ['add', f], { cwd: local });
186
- }
187
- const staged = execFileSync('git', ['-c', 'core.quotePath=false', 'diff', '--cached', '--name-only'], { cwd: local, encoding: 'utf-8' }).trim();
188
- const stagedFiles = staged.split('\n').filter(Boolean);
189
- expect(stagedFiles).toHaveLength(files.length);
190
- for (const f of files) {
191
- expect(stagedFiles).toContain(f);
192
- }
193
- });
194
- });
195
- // ============================================================
196
- // Real-life scenario tests
197
- // ============================================================
198
- describe('real-life auto-commit scenarios', () => {
199
- it('handles rapid file writes without losing changes', () => {
200
- // Scenario: IDE save-all writes 10 files in quick succession.
201
- // All should be captured for staging.
202
- const { local } = createTestRepo();
203
- commitFile(local, 'init.txt', 'hello', 'init');
204
- // Rapidly create files (simulating what changedFiles set would collect)
205
- const files = Array.from({ length: 10 }, (_, i) => `file-${i}.ts`);
206
- for (const f of files) {
207
- writeFileSync(join(local, f), `export const x${f.replace(/\W/g, '')} = true;`);
208
- }
209
- // Stage them all (simulating what commitAndPush does)
210
- execFileSync('git', ['add', '--', ...files], { cwd: local, stdio: 'pipe' });
211
- const staged = execFileSync('git', ['-c', 'core.quotePath=false', 'diff', '--cached', '--name-only'], { cwd: local, encoding: 'utf-8' }).trim().split('\n').filter(Boolean);
212
- expect(staged).toHaveLength(10);
213
- });
214
- it('handles files deleted between detection and staging', () => {
215
- // Scenario: chokidar fires for a temp file that gets deleted
216
- // before git add runs. git add throws for non-existent files,
217
- // but commitAndPush wraps it in try/catch so it's handled gracefully.
218
- const { local } = createTestRepo();
219
- commitFile(local, 'init.txt', 'hello', 'init');
220
- const tempFile = join(local, 'temp.txt');
221
- writeFileSync(tempFile, 'temporary');
222
- // Delete before staging
223
- rmSync(tempFile);
224
- // git add -- temp.txt DOES throw for non-existent files
225
- let threw = false;
226
- try {
227
- execFileSync('git', ['add', '--', 'temp.txt'], { cwd: local, stdio: 'pipe' });
228
- }
229
- catch {
230
- threw = true;
231
- }
232
- // Confirmed: git add throws. commitAndPush catches this per batch.
233
- expect(threw).toBe(true);
234
- });
235
- it('batch staging handles more than 50 files correctly', () => {
236
- // commitAndPush batches git add into groups of 50.
237
- // Verify nothing gets lost at batch boundaries.
238
- const { local } = createTestRepo();
239
- commitFile(local, 'init.txt', 'hello', 'init');
240
- const fileCount = 120; // 50 + 50 + 20
241
- const files = [];
242
- for (let i = 0; i < fileCount; i++) {
243
- const name = `batch-${String(i).padStart(3, '0')}.ts`;
244
- writeFileSync(join(local, name), `export const x = ${i};`);
245
- files.push(name);
246
- }
247
- // Simulate batch staging from commitAndPush
248
- const BATCH_SIZE = 50;
249
- for (let i = 0; i < files.length; i += BATCH_SIZE) {
250
- const batch = files.slice(i, i + BATCH_SIZE);
251
- execFileSync('git', ['add', '--', ...batch], { cwd: local, stdio: 'pipe' });
252
- }
253
- const staged = execFileSync('git', ['-c', 'core.quotePath=false', 'diff', '--cached', '--name-only'], { cwd: local, encoding: 'utf-8' }).trim().split('\n').filter(Boolean);
254
- expect(staged).toHaveLength(fileCount);
255
- });
256
- it('commit message includes ISO timestamp', () => {
257
- const { local } = createTestRepo();
258
- commitFile(local, 'init.txt', 'hello', 'init');
259
- writeFileSync(join(local, 'new.ts'), 'export {}');
260
- execFileSync('git', ['add', 'new.ts'], { cwd: local, stdio: 'pipe' });
261
- const timestamp = new Date().toISOString().replace('T', ' ').slice(0, 19);
262
- execFileSync('git', ['commit', '-m', `dev: updated ${timestamp}`], { cwd: local, stdio: 'pipe' });
263
- const log = execFileSync('git', ['log', '-1', '--format=%s'], {
264
- cwd: local, encoding: 'utf-8',
265
- }).trim();
266
- expect(log).toMatch(/^dev: updated \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/);
267
- });
268
- it('pull --rebase then push works after remote has new commits', () => {
269
- const { local, remote } = createTestRepo();
270
- commitFile(local, 'init.txt', 'hello', 'init');
271
- execFileSync('git', ['push', 'runwork', 'main'], { cwd: local, stdio: 'pipe' });
272
- // Simulate remote commit (e.g. DO onStart creating files)
273
- const secondary = makeTempDir('secondary');
274
- execFileSync('git', ['clone', remote, secondary]);
275
- execFileSync('git', ['config', 'user.email', 'server@test.com'], { cwd: secondary });
276
- execFileSync('git', ['config', 'user.name', 'Server'], { cwd: secondary });
277
- commitFile(secondary, 'server-file.txt', 'from server', 'server: init');
278
- execFileSync('git', ['push', 'origin', 'main'], { cwd: secondary, stdio: 'pipe' });
279
- // Local commit (user edit)
280
- commitFile(local, 'user-file.ts', 'export {}', 'dev: user edit');
281
- // Simulate commitAndPush: pull --rebase then push
282
- execFileSync('git', ['pull', '--rebase', 'runwork', 'main'], { cwd: local, stdio: 'pipe' });
283
- execFileSync('git', ['push', 'runwork', 'main'], { cwd: local, stdio: 'pipe' });
284
- // Both files should exist
285
- expect(existsSync(join(local, 'server-file.txt'))).toBe(true);
286
- expect(existsSync(join(local, 'user-file.ts'))).toBe(true);
287
- });
288
- it('merge with --allow-unrelated-histories combines diverged trees', () => {
289
- // Scenario: template update on web UI rewrites history.
290
- // The merge fallback (used when rebase fails) should combine both trees.
291
- const { local, remote } = createTestRepo();
292
- commitFile(local, 'local-file.txt', 'local content', 'local init');
293
- // Create a completely separate history on the remote
294
- const other = makeTempDir('template-update');
295
- execFileSync('git', ['init', other]);
296
- execFileSync('git', ['config', 'user.email', 'server@test.com'], { cwd: other });
297
- execFileSync('git', ['config', 'user.name', 'Server'], { cwd: other });
298
- commitFile(other, 'template-file.txt', 'new template', 'template: v2');
299
- execFileSync('git', ['remote', 'add', 'origin', remote], { cwd: other });
300
- execFileSync('git', ['push', 'origin', 'main'], { cwd: other, stdio: 'pipe' });
301
- // Fetch remote
302
- execFileSync('git', ['fetch', 'runwork', 'main'], { cwd: local, stdio: 'pipe' });
303
- // Merge with unrelated histories
304
- execFileSync('git', ['merge', 'runwork/main', '--allow-unrelated-histories', '--no-edit'], { cwd: local, stdio: 'pipe' });
305
- // Both files should exist after merge
306
- expect(existsSync(join(local, 'local-file.txt'))).toBe(true);
307
- expect(existsSync(join(local, 'template-file.txt'))).toBe(true);
308
- });
309
- it('binary files are excluded from fast sync but included in git', () => {
310
- // Scenario: user adds an image file. Fast sync should skip it,
311
- // but git should still commit and push it.
312
- const { local } = createTestRepo();
313
- commitFile(local, 'init.txt', 'hello', 'init');
314
- const binaryExtensions = ['.png', '.jpg', '.woff2', '.pdf', '.wasm'];
315
- for (const ext of binaryExtensions) {
316
- writeFileSync(join(local, `file${ext}`), Buffer.from([0x00, 0xFF, 0x89, 0x50]));
317
- }
318
- // All binary files should be stageable by git
319
- execFileSync('git', ['add', '.'], { cwd: local, stdio: 'pipe' });
320
- const staged = execFileSync('git', ['-c', 'core.quotePath=false', 'diff', '--cached', '--name-only'], { cwd: local, encoding: 'utf-8' }).trim().split('\n').filter(Boolean);
321
- for (const ext of binaryExtensions) {
322
- expect(staged).toContain(`file${ext}`);
323
- }
324
- });
325
- it('handles .gitignore interaction: ignored files not staged by git add -u', () => {
326
- // Scenario: user has .gitignore. Modified ignored files should NOT
327
- // be staged by git add -u.
328
- const { local } = createTestRepo();
329
- writeFileSync(join(local, '.gitignore'), 'dist/\n*.tmp\n');
330
- commitFile(local, '.gitignore', readFileSync(join(local, '.gitignore'), 'utf-8'), 'add gitignore');
331
- commitFile(local, 'src/app.ts', 'export {}', 'init');
332
- // Create ignored files
333
- mkdirSync(join(local, 'dist'));
334
- writeFileSync(join(local, 'dist', 'bundle.js'), 'compiled');
335
- writeFileSync(join(local, 'temp.tmp'), 'temporary');
336
- // git add -u should NOT stage ignored files
337
- execFileSync('git', ['add', '-u'], { cwd: local, stdio: 'pipe' });
338
- const staged = execFileSync('git', ['diff', '--cached', '--name-only'], { cwd: local, encoding: 'utf-8' }).trim();
339
- // Nothing should be staged (only gitignored files were modified)
340
- expect(staged).toBe('');
341
- });
342
- it('handles empty working directory after initial commit', () => {
343
- // Edge case: all files deleted, nothing to stage
344
- const { local } = createTestRepo();
345
- commitFile(local, 'init.txt', 'hello', 'init');
346
- execFileSync('git', ['rm', 'init.txt'], { cwd: local, stdio: 'pipe' });
347
- execFileSync('git', ['commit', '-m', 'delete all'], { cwd: local, stdio: 'pipe' });
348
- // git add -u with nothing to add
349
- execFileSync('git', ['add', '-u'], { cwd: local, stdio: 'pipe' });
350
- const staged = execFileSync('git', ['diff', '--cached', '--name-only'], { cwd: local, encoding: 'utf-8' }).trim();
351
- expect(staged).toBe('');
352
- });
353
- it('commitWorkingTree stages and commits new untracked files (deploy path)', () => {
354
- // Deploy must commit pending working-tree changes even when no dev
355
- // session ever ran -- including brand-new untracked files.
356
- const { local } = createTestRepo();
357
- commitFile(local, 'init.txt', 'hello', 'init');
358
- writeFileSync(join(local, 'new-feature.ts'), 'export const feature = true;');
359
- mkdirSync(join(local, 'src'));
360
- writeFileSync(join(local, 'src', 'page.tsx'), 'export default () => null;');
361
- const result = commitWorkingTree(local, 'deploy: test');
362
- expect(result.committed).toBe(true);
363
- expect(result.fileCount).toBe(2);
364
- const log = execFileSync('git', ['log', '-1', '--format=%s'], { cwd: local, encoding: 'utf-8' }).trim();
365
- expect(log).toBe('deploy: test');
366
- const status = execFileSync('git', ['status', '--porcelain'], { cwd: local, encoding: 'utf-8' }).trim();
367
- expect(status).toBe('');
368
- });
369
- it('commitWorkingTree stages tracked modifications and deletions', () => {
370
- const { local } = createTestRepo();
371
- commitFile(local, 'keep.ts', 'export const a = 1;', 'init');
372
- commitFile(local, 'remove.ts', 'export const b = 2;', 'add remove');
373
- writeFileSync(join(local, 'keep.ts'), 'export const a = 99;');
374
- rmSync(join(local, 'remove.ts'));
375
- const result = commitWorkingTree(local, 'deploy: edits');
376
- expect(result.committed).toBe(true);
377
- expect(result.fileCount).toBe(2);
378
- expect(existsSync(join(local, 'remove.ts'))).toBe(false);
379
- });
380
- it('commitWorkingTree returns committed=false on a clean tree', () => {
381
- const { local } = createTestRepo();
382
- commitFile(local, 'init.txt', 'hello', 'init');
383
- const result = commitWorkingTree(local, 'deploy: noop');
384
- expect(result.committed).toBe(false);
385
- expect(result.fileCount).toBe(0);
386
- const count = execFileSync('git', ['rev-list', '--count', 'HEAD'], { cwd: local, encoding: 'utf-8' }).trim();
387
- expect(count).toBe('1');
388
- });
389
- it('commitWorkingTree does NOT stage untracked secrets / ignored dirs (matches dev, not git add -A)', () => {
390
- // SECURITY: a bare `.env` is not in the runwork-app .gitignore, so a
391
- // blanket `git add -A` would commit and push it. commitWorkingTree must
392
- // filter untracked files through the CLI ignore matcher, exactly like
393
- // the dev watcher, so local secrets never reach the remote.
394
- const { local } = createTestRepo();
395
- commitFile(local, 'init.txt', 'hello', 'init');
396
- // Real source that SHOULD be committed.
397
- writeFileSync(join(local, 'app.ts'), 'export const x = 1;');
398
- // Secrets / caches that MUST NOT be committed.
399
- writeFileSync(join(local, '.env'), 'SECRET=do_not_leak');
400
- writeFileSync(join(local, '.dev.vars'), 'WORKSPACE_API_KEY=do_not_leak');
401
- mkdirSync(join(local, '.bun-cache'));
402
- writeFileSync(join(local, '.bun-cache', 'pkg.json'), '{}');
403
- const result = commitWorkingTree(local, 'deploy: test');
404
- expect(result.committed).toBe(true);
405
- const tracked = execFileSync('git', ['ls-files'], { cwd: local, encoding: 'utf-8' }).trim().split('\n');
406
- expect(tracked).toContain('app.ts');
407
- expect(tracked).not.toContain('.env');
408
- expect(tracked).not.toContain('.dev.vars');
409
- expect(tracked.some((f) => f.startsWith('.bun-cache/'))).toBe(false);
410
- });
411
- it('push -u sets upstream on first push', () => {
412
- // commitAndPush tries `git rev-parse --abbrev-ref @{u}` to check
413
- // for upstream. If it fails, it uses `push -u` to set upstream.
414
- const { local, remote } = createTestRepo();
415
- commitFile(local, 'init.txt', 'hello', 'init');
416
- // No upstream configured yet
417
- let hasUpstream = true;
418
- try {
419
- execFileSync('git', ['rev-parse', '--abbrev-ref', '@{u}'], { cwd: local, stdio: 'pipe' });
420
- }
421
- catch {
422
- hasUpstream = false;
423
- }
424
- expect(hasUpstream).toBe(false);
425
- // Push with -u to set upstream
426
- execFileSync('git', ['push', '-u', 'runwork', 'main'], { cwd: local, stdio: 'pipe' });
427
- // Now upstream should be set
428
- const upstream = execFileSync('git', ['rev-parse', '--abbrev-ref', '@{u}'], { cwd: local, encoding: 'utf-8' }).trim();
429
- expect(upstream).toBe('runwork/main');
430
- });
431
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,57 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { classifySyncError, diagnoseSyncError } from '../classify-sync-error.js';
3
- describe('git/classify-sync-error', () => {
4
- describe('classifySyncError()', () => {
5
- it('detects a missing/misnamed runwork remote', () => {
6
- expect(classifySyncError("fatal: 'runwork' does not appear to be a git repository")).toBe('no-remote');
7
- expect(classifySyncError('fatal: No such remote: runwork')).toBe('no-remote');
8
- });
9
- it('detects authentication failures', () => {
10
- expect(classifySyncError('fatal: Authentication failed for https://runwork.ai/...')).toBe('auth');
11
- expect(classifySyncError('fatal: could not read Username for https://runwork.ai: terminal prompts disabled')).toBe('auth');
12
- expect(classifySyncError("fatal: unable to access '...': The requested URL returned error: 403")).toBe('auth');
13
- });
14
- it('detects network failures', () => {
15
- expect(classifySyncError("fatal: unable to access '...': Could not resolve host: runwork.ai")).toBe('network');
16
- expect(classifySyncError('fatal: unable to access: Failed to connect to runwork.ai port 443: Connection timed out')).toBe('network');
17
- });
18
- it('detects merge/rebase conflicts and the stash-conflict sentinel', () => {
19
- expect(classifySyncError('CONFLICT (content): Merge conflict in src/App.tsx')).toBe('conflict');
20
- expect(classifySyncError('error: Automatic merge failed')).toBe('conflict');
21
- expect(classifySyncError('stash-conflict')).toBe('conflict');
22
- });
23
- it('falls back to unknown for unrecognized errors and empty input', () => {
24
- expect(classifySyncError('some unexpected git failure')).toBe('unknown');
25
- expect(classifySyncError(undefined)).toBe('unknown');
26
- expect(classifySyncError('')).toBe('unknown');
27
- });
28
- it('is case-insensitive', () => {
29
- expect(classifySyncError('AUTHENTICATION FAILED')).toBe('auth');
30
- expect(classifySyncError('could not resolve HOST')).toBe('network');
31
- });
32
- });
33
- describe('diagnoseSyncError()', () => {
34
- it('points a no-remote failure at doctor --fix, not network/session', () => {
35
- const d = diagnoseSyncError("fatal: 'runwork' does not appear to be a git repository");
36
- expect(d.reason).toBe('no-remote');
37
- expect(d.suggestions.join(' ')).toContain('runwork doctor --fix');
38
- // Must NOT regress to the old misleading "session expired / network" advice.
39
- expect(d.diagnosis.toLowerCase()).not.toContain('session expired');
40
- });
41
- it('points an auth failure at credential-helper remediation', () => {
42
- const d = diagnoseSyncError('fatal: Authentication failed');
43
- expect(d.reason).toBe('auth');
44
- expect(d.suggestions.join(' ')).toContain('runwork doctor --fix');
45
- });
46
- it('gives stash-conflict a restore-specific message', () => {
47
- const d = diagnoseSyncError('stash-conflict');
48
- expect(d.reason).toBe('conflict');
49
- expect(d.message).toContain('restoring local changes');
50
- });
51
- it('preserves the raw error in the unknown-case message', () => {
52
- const d = diagnoseSyncError('weird git explosion');
53
- expect(d.reason).toBe('unknown');
54
- expect(d.message).toBe('weird git explosion');
55
- });
56
- });
57
- });
@@ -1,21 +0,0 @@
1
- /**
2
- * End-to-end auth test.
3
- *
4
- * Spins up a tiny HTTP server that mimics the runwork.ai git endpoint's
5
- * auth contract (HTTP Basic, any username, password = API key) and runs a
6
- * real `git ls-remote` against it through a credential-helper script. This
7
- * verifies the entire chain we depend on:
8
- *
9
- * git -> credential.<origin>.helper -> our helper script -> our helper's
10
- * protocol output -> git constructs Basic auth -> server accepts it.
11
- *
12
- * Catches the class of bugs we've burned hours on (Pass 1's PATH issues,
13
- * Pass 2's "logged in but no helper registered") *before* a user hits them.
14
- *
15
- * Note: this test exercises the contract our credential helper depends on,
16
- * not the helper function itself -- credentials.test.ts already covers
17
- * `handleGitCredentialRequest()` in isolation. Together they prove that
18
- * (a) the helper produces the right protocol output and (b) git+server
19
- * accept that output as Basic auth.
20
- */
21
- export {};