patchwork-os 0.2.0-alpha.9 → 0.2.0-beta.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 (581) hide show
  1. package/README.bridge.md +6 -0
  2. package/README.md +315 -35
  3. package/deploy/bootstrap-new-vps.sh +12 -12
  4. package/deploy/bootstrap-vps.sh +187 -0
  5. package/deploy/deploy-dashboard.sh +174 -0
  6. package/deploy/deploy-landing.sh +136 -0
  7. package/dist/activationMetrics.d.ts +67 -0
  8. package/dist/activationMetrics.js +255 -0
  9. package/dist/activationMetrics.js.map +1 -0
  10. package/dist/activityLog.d.ts +49 -0
  11. package/dist/activityLog.js +78 -0
  12. package/dist/activityLog.js.map +1 -1
  13. package/dist/approvalHttp.d.ts +49 -2
  14. package/dist/approvalHttp.js +217 -21
  15. package/dist/approvalHttp.js.map +1 -1
  16. package/dist/approvalInsights.d.ts +49 -0
  17. package/dist/approvalInsights.js +97 -0
  18. package/dist/approvalInsights.js.map +1 -0
  19. package/dist/approvalQueue.d.ts +27 -1
  20. package/dist/approvalQueue.js +123 -3
  21. package/dist/approvalQueue.js.map +1 -1
  22. package/dist/approvalSignals.d.ts +124 -0
  23. package/dist/approvalSignals.js +512 -0
  24. package/dist/approvalSignals.js.map +1 -0
  25. package/dist/automation.d.ts +57 -0
  26. package/dist/automation.js +156 -59
  27. package/dist/automation.js.map +1 -1
  28. package/dist/automationSuggestions.d.ts +79 -0
  29. package/dist/automationSuggestions.js +150 -0
  30. package/dist/automationSuggestions.js.map +1 -0
  31. package/dist/bridge.d.ts +3 -0
  32. package/dist/bridge.js +174 -143
  33. package/dist/bridge.js.map +1 -1
  34. package/dist/bridgeToken.js +57 -19
  35. package/dist/bridgeToken.js.map +1 -1
  36. package/dist/ccPermissions.d.ts +15 -0
  37. package/dist/ccPermissions.js +21 -4
  38. package/dist/ccPermissions.js.map +1 -1
  39. package/dist/claudeDriver.js +74 -16
  40. package/dist/claudeDriver.js.map +1 -1
  41. package/dist/claudeOrchestrator.d.ts +1 -1
  42. package/dist/claudeOrchestrator.js +14 -8
  43. package/dist/claudeOrchestrator.js.map +1 -1
  44. package/dist/commands/dashboard.js +1 -1
  45. package/dist/commands/dashboard.js.map +1 -1
  46. package/dist/commands/launchd.d.ts +2 -0
  47. package/dist/commands/launchd.js +94 -0
  48. package/dist/commands/launchd.js.map +1 -0
  49. package/dist/commands/patchworkInit.d.ts +8 -0
  50. package/dist/commands/patchworkInit.js +77 -11
  51. package/dist/commands/patchworkInit.js.map +1 -1
  52. package/dist/commands/recipe.d.ts +289 -0
  53. package/dist/commands/recipe.js +1359 -0
  54. package/dist/commands/recipe.js.map +1 -0
  55. package/dist/commands/recipeInstall.d.ts +150 -0
  56. package/dist/commands/recipeInstall.js +647 -0
  57. package/dist/commands/recipeInstall.js.map +1 -0
  58. package/dist/commands/tracesExport.d.ts +83 -0
  59. package/dist/commands/tracesExport.js +269 -0
  60. package/dist/commands/tracesExport.js.map +1 -0
  61. package/dist/commands/tracesImport.d.ts +56 -0
  62. package/dist/commands/tracesImport.js +161 -0
  63. package/dist/commands/tracesImport.js.map +1 -0
  64. package/dist/config.d.ts +22 -1
  65. package/dist/config.js +108 -9
  66. package/dist/config.js.map +1 -1
  67. package/dist/connectorRoutes.d.ts +43 -0
  68. package/dist/connectorRoutes.js +1609 -0
  69. package/dist/connectorRoutes.js.map +1 -0
  70. package/dist/connectors/asana.d.ts +198 -0
  71. package/dist/connectors/asana.js +679 -0
  72. package/dist/connectors/asana.js.map +1 -0
  73. package/dist/connectors/baseConnector.d.ts +153 -0
  74. package/dist/connectors/baseConnector.js +336 -0
  75. package/dist/connectors/baseConnector.js.map +1 -0
  76. package/dist/connectors/confluence.d.ts +111 -0
  77. package/dist/connectors/confluence.js +406 -0
  78. package/dist/connectors/confluence.js.map +1 -0
  79. package/dist/connectors/datadog.d.ts +116 -0
  80. package/dist/connectors/datadog.js +385 -0
  81. package/dist/connectors/datadog.js.map +1 -0
  82. package/dist/connectors/discord.d.ts +150 -0
  83. package/dist/connectors/discord.js +543 -0
  84. package/dist/connectors/discord.js.map +1 -0
  85. package/dist/connectors/fixtureLibrary.d.ts +21 -0
  86. package/dist/connectors/fixtureLibrary.js +70 -0
  87. package/dist/connectors/fixtureLibrary.js.map +1 -0
  88. package/dist/connectors/fixtureRecorder.d.ts +1 -0
  89. package/dist/connectors/fixtureRecorder.js +35 -0
  90. package/dist/connectors/fixtureRecorder.js.map +1 -0
  91. package/dist/connectors/github.js +17 -18
  92. package/dist/connectors/github.js.map +1 -1
  93. package/dist/connectors/gitlab.d.ts +180 -0
  94. package/dist/connectors/gitlab.js +582 -0
  95. package/dist/connectors/gitlab.js.map +1 -0
  96. package/dist/connectors/gmail.d.ts +4 -1
  97. package/dist/connectors/gmail.js +149 -27
  98. package/dist/connectors/gmail.js.map +1 -1
  99. package/dist/connectors/googleCalendar.d.ts +4 -1
  100. package/dist/connectors/googleCalendar.js +88 -25
  101. package/dist/connectors/googleCalendar.js.map +1 -1
  102. package/dist/connectors/googleDrive.d.ts +34 -0
  103. package/dist/connectors/googleDrive.js +321 -0
  104. package/dist/connectors/googleDrive.js.map +1 -0
  105. package/dist/connectors/htmlEscape.d.ts +5 -0
  106. package/dist/connectors/htmlEscape.js +13 -0
  107. package/dist/connectors/htmlEscape.js.map +1 -0
  108. package/dist/connectors/hubspot.d.ts +112 -0
  109. package/dist/connectors/hubspot.js +408 -0
  110. package/dist/connectors/hubspot.js.map +1 -0
  111. package/dist/connectors/intercom.d.ts +102 -0
  112. package/dist/connectors/intercom.js +402 -0
  113. package/dist/connectors/intercom.js.map +1 -0
  114. package/dist/connectors/jira.d.ts +98 -0
  115. package/dist/connectors/jira.js +379 -0
  116. package/dist/connectors/jira.js.map +1 -0
  117. package/dist/connectors/linear.js +30 -19
  118. package/dist/connectors/linear.js.map +1 -1
  119. package/dist/connectors/mcpOAuth.d.ts +3 -0
  120. package/dist/connectors/mcpOAuth.js +64 -10
  121. package/dist/connectors/mcpOAuth.js.map +1 -1
  122. package/dist/connectors/mockConnector.d.ts +28 -0
  123. package/dist/connectors/mockConnector.js +81 -0
  124. package/dist/connectors/mockConnector.js.map +1 -0
  125. package/dist/connectors/notion.d.ts +143 -0
  126. package/dist/connectors/notion.js +424 -0
  127. package/dist/connectors/notion.js.map +1 -0
  128. package/dist/connectors/oauthStateStore.d.ts +31 -0
  129. package/dist/connectors/oauthStateStore.js +52 -0
  130. package/dist/connectors/oauthStateStore.js.map +1 -0
  131. package/dist/connectors/pagerduty.d.ts +160 -0
  132. package/dist/connectors/pagerduty.js +464 -0
  133. package/dist/connectors/pagerduty.js.map +1 -0
  134. package/dist/connectors/sentry.js +5 -13
  135. package/dist/connectors/sentry.js.map +1 -1
  136. package/dist/connectors/slack.d.ts +16 -1
  137. package/dist/connectors/slack.js +155 -32
  138. package/dist/connectors/slack.js.map +1 -1
  139. package/dist/connectors/stripe.d.ts +116 -0
  140. package/dist/connectors/stripe.js +379 -0
  141. package/dist/connectors/stripe.js.map +1 -0
  142. package/dist/connectors/tokenStorage.d.ts +35 -0
  143. package/dist/connectors/tokenStorage.js +484 -0
  144. package/dist/connectors/tokenStorage.js.map +1 -0
  145. package/dist/connectors/zendesk.d.ts +104 -0
  146. package/dist/connectors/zendesk.js +442 -0
  147. package/dist/connectors/zendesk.js.map +1 -0
  148. package/dist/cors.d.ts +10 -0
  149. package/dist/cors.js +29 -0
  150. package/dist/cors.js.map +1 -0
  151. package/dist/decisionReplay.d.ts +72 -0
  152. package/dist/decisionReplay.js +92 -0
  153. package/dist/decisionReplay.js.map +1 -0
  154. package/dist/decisionTraceLog.d.ts +6 -0
  155. package/dist/decisionTraceLog.js +54 -2
  156. package/dist/decisionTraceLog.js.map +1 -1
  157. package/dist/drivers/gemini/index.d.ts +5 -1
  158. package/dist/drivers/gemini/index.js +39 -5
  159. package/dist/drivers/gemini/index.js.map +1 -1
  160. package/dist/drivers/index.d.ts +5 -0
  161. package/dist/drivers/index.js +1 -1
  162. package/dist/drivers/index.js.map +1 -1
  163. package/dist/featureFlags.d.ts +79 -0
  164. package/dist/featureFlags.js +208 -0
  165. package/dist/featureFlags.js.map +1 -0
  166. package/dist/fp/automationInterpreter.js +26 -21
  167. package/dist/fp/automationInterpreter.js.map +1 -1
  168. package/dist/fp/automationProgram.d.ts +1 -1
  169. package/dist/fp/automationProgram.js.map +1 -1
  170. package/dist/fp/automationState.js +4 -1
  171. package/dist/fp/automationState.js.map +1 -1
  172. package/dist/fp/policyParser.js +21 -1
  173. package/dist/fp/policyParser.js.map +1 -1
  174. package/dist/inboxRoutes.d.ts +22 -0
  175. package/dist/inboxRoutes.js +114 -0
  176. package/dist/inboxRoutes.js.map +1 -0
  177. package/dist/index.js +1400 -201
  178. package/dist/index.js.map +1 -1
  179. package/dist/installGuard.d.ts +25 -0
  180. package/dist/installGuard.js +48 -0
  181. package/dist/installGuard.js.map +1 -0
  182. package/dist/mcpRoutes.d.ts +37 -0
  183. package/dist/mcpRoutes.js +76 -0
  184. package/dist/mcpRoutes.js.map +1 -0
  185. package/dist/oauth.d.ts +7 -1
  186. package/dist/oauth.js +201 -39
  187. package/dist/oauth.js.map +1 -1
  188. package/dist/oauthRoutes.d.ts +32 -0
  189. package/dist/oauthRoutes.js +124 -0
  190. package/dist/oauthRoutes.js.map +1 -0
  191. package/dist/orchestrator/orchestratorBridge.js +2 -2
  192. package/dist/orchestrator/orchestratorBridge.js.map +1 -1
  193. package/dist/patchworkConfig.d.ts +16 -0
  194. package/dist/patchworkConfig.js +1 -1
  195. package/dist/patchworkConfig.js.map +1 -1
  196. package/dist/pluginLoader.d.ts +28 -0
  197. package/dist/pluginLoader.js +77 -11
  198. package/dist/pluginLoader.js.map +1 -1
  199. package/dist/pluginWatcher.js +8 -3
  200. package/dist/pluginWatcher.js.map +1 -1
  201. package/dist/preToolUseHook.d.ts +12 -0
  202. package/dist/preToolUseHook.js +23 -0
  203. package/dist/preToolUseHook.js.map +1 -1
  204. package/dist/recipeOrchestration.d.ts +121 -0
  205. package/dist/recipeOrchestration.js +955 -0
  206. package/dist/recipeOrchestration.js.map +1 -0
  207. package/dist/recipeRoutes.d.ts +180 -0
  208. package/dist/recipeRoutes.js +1345 -0
  209. package/dist/recipeRoutes.js.map +1 -0
  210. package/dist/recipes/RecipeOrchestrator.d.ts +40 -0
  211. package/dist/recipes/RecipeOrchestrator.js +51 -0
  212. package/dist/recipes/RecipeOrchestrator.js.map +1 -0
  213. package/dist/recipes/agentExecutor.d.ts +29 -0
  214. package/dist/recipes/agentExecutor.js +49 -0
  215. package/dist/recipes/agentExecutor.js.map +1 -0
  216. package/dist/recipes/chainedRunner.d.ts +191 -0
  217. package/dist/recipes/chainedRunner.js +759 -0
  218. package/dist/recipes/chainedRunner.js.map +1 -0
  219. package/dist/recipes/compiler.js +3 -3
  220. package/dist/recipes/compiler.js.map +1 -1
  221. package/dist/recipes/dependencyGraph.d.ts +39 -0
  222. package/dist/recipes/dependencyGraph.js +199 -0
  223. package/dist/recipes/dependencyGraph.js.map +1 -0
  224. package/dist/recipes/disabledMarkers.d.ts +48 -0
  225. package/dist/recipes/disabledMarkers.js +52 -0
  226. package/dist/recipes/disabledMarkers.js.map +1 -0
  227. package/dist/recipes/installer.js +3 -3
  228. package/dist/recipes/installer.js.map +1 -1
  229. package/dist/recipes/legacyRecipeCompat.d.ts +10 -0
  230. package/dist/recipes/legacyRecipeCompat.js +131 -0
  231. package/dist/recipes/legacyRecipeCompat.js.map +1 -0
  232. package/dist/recipes/manifest.d.ts +47 -0
  233. package/dist/recipes/manifest.js +156 -0
  234. package/dist/recipes/manifest.js.map +1 -0
  235. package/dist/recipes/migrationWarnings.d.ts +12 -0
  236. package/dist/recipes/migrationWarnings.js +44 -0
  237. package/dist/recipes/migrationWarnings.js.map +1 -0
  238. package/dist/recipes/migrations/index.d.ts +24 -0
  239. package/dist/recipes/migrations/index.js +55 -0
  240. package/dist/recipes/migrations/index.js.map +1 -0
  241. package/dist/recipes/migrations/types.d.ts +28 -0
  242. package/dist/recipes/migrations/types.js +2 -0
  243. package/dist/recipes/migrations/types.js.map +1 -0
  244. package/dist/recipes/migrations/v1.d.ts +11 -0
  245. package/dist/recipes/migrations/v1.js +18 -0
  246. package/dist/recipes/migrations/v1.js.map +1 -0
  247. package/dist/recipes/names.d.ts +40 -0
  248. package/dist/recipes/names.js +66 -0
  249. package/dist/recipes/names.js.map +1 -0
  250. package/dist/recipes/nestedRecipeStep.d.ts +58 -0
  251. package/dist/recipes/nestedRecipeStep.js +95 -0
  252. package/dist/recipes/nestedRecipeStep.js.map +1 -0
  253. package/dist/recipes/outputRegistry.d.ts +28 -0
  254. package/dist/recipes/outputRegistry.js +52 -0
  255. package/dist/recipes/outputRegistry.js.map +1 -0
  256. package/dist/recipes/parser.js +4 -1
  257. package/dist/recipes/parser.js.map +1 -1
  258. package/dist/recipes/replayRun.d.ts +62 -0
  259. package/dist/recipes/replayRun.js +97 -0
  260. package/dist/recipes/replayRun.js.map +1 -0
  261. package/dist/recipes/resolveRecipePath.d.ts +69 -0
  262. package/dist/recipes/resolveRecipePath.js +202 -0
  263. package/dist/recipes/resolveRecipePath.js.map +1 -0
  264. package/dist/recipes/scheduler.d.ts +23 -7
  265. package/dist/recipes/scheduler.js +225 -45
  266. package/dist/recipes/scheduler.js.map +1 -1
  267. package/dist/recipes/schema.d.ts +17 -2
  268. package/dist/recipes/schemaGenerator.d.ts +28 -0
  269. package/dist/recipes/schemaGenerator.js +565 -0
  270. package/dist/recipes/schemaGenerator.js.map +1 -0
  271. package/dist/recipes/stepObservation.d.ts +44 -0
  272. package/dist/recipes/stepObservation.js +232 -0
  273. package/dist/recipes/stepObservation.js.map +1 -0
  274. package/dist/recipes/templateEngine.d.ts +62 -0
  275. package/dist/recipes/templateEngine.js +201 -0
  276. package/dist/recipes/templateEngine.js.map +1 -0
  277. package/dist/recipes/toolRegistry.d.ts +186 -0
  278. package/dist/recipes/toolRegistry.js +309 -0
  279. package/dist/recipes/toolRegistry.js.map +1 -0
  280. package/dist/recipes/tools/asana.d.ts +16 -0
  281. package/dist/recipes/tools/asana.js +524 -0
  282. package/dist/recipes/tools/asana.js.map +1 -0
  283. package/dist/recipes/tools/calendar.d.ts +6 -0
  284. package/dist/recipes/tools/calendar.js +61 -0
  285. package/dist/recipes/tools/calendar.js.map +1 -0
  286. package/dist/recipes/tools/confluence.d.ts +6 -0
  287. package/dist/recipes/tools/confluence.js +254 -0
  288. package/dist/recipes/tools/confluence.js.map +1 -0
  289. package/dist/recipes/tools/datadog.d.ts +6 -0
  290. package/dist/recipes/tools/datadog.js +239 -0
  291. package/dist/recipes/tools/datadog.js.map +1 -0
  292. package/dist/recipes/tools/diagnostics.d.ts +6 -0
  293. package/dist/recipes/tools/diagnostics.js +36 -0
  294. package/dist/recipes/tools/diagnostics.js.map +1 -0
  295. package/dist/recipes/tools/discord.d.ts +18 -0
  296. package/dist/recipes/tools/discord.js +254 -0
  297. package/dist/recipes/tools/discord.js.map +1 -0
  298. package/dist/recipes/tools/file.d.ts +12 -0
  299. package/dist/recipes/tools/file.js +174 -0
  300. package/dist/recipes/tools/file.js.map +1 -0
  301. package/dist/recipes/tools/git.d.ts +6 -0
  302. package/dist/recipes/tools/git.js +63 -0
  303. package/dist/recipes/tools/git.js.map +1 -0
  304. package/dist/recipes/tools/github.d.ts +6 -0
  305. package/dist/recipes/tools/github.js +116 -0
  306. package/dist/recipes/tools/github.js.map +1 -0
  307. package/dist/recipes/tools/gitlab.d.ts +11 -0
  308. package/dist/recipes/tools/gitlab.js +285 -0
  309. package/dist/recipes/tools/gitlab.js.map +1 -0
  310. package/dist/recipes/tools/gmail.d.ts +6 -0
  311. package/dist/recipes/tools/gmail.js +434 -0
  312. package/dist/recipes/tools/gmail.js.map +1 -0
  313. package/dist/recipes/tools/googleDrive.d.ts +1 -0
  314. package/dist/recipes/tools/googleDrive.js +55 -0
  315. package/dist/recipes/tools/googleDrive.js.map +1 -0
  316. package/dist/recipes/tools/hubspot.d.ts +6 -0
  317. package/dist/recipes/tools/hubspot.js +232 -0
  318. package/dist/recipes/tools/hubspot.js.map +1 -0
  319. package/dist/recipes/tools/index.d.ts +30 -0
  320. package/dist/recipes/tools/index.js +33 -0
  321. package/dist/recipes/tools/index.js.map +1 -0
  322. package/dist/recipes/tools/intercom.d.ts +6 -0
  323. package/dist/recipes/tools/intercom.js +226 -0
  324. package/dist/recipes/tools/intercom.js.map +1 -0
  325. package/dist/recipes/tools/jira.d.ts +14 -0
  326. package/dist/recipes/tools/jira.js +369 -0
  327. package/dist/recipes/tools/jira.js.map +1 -0
  328. package/dist/recipes/tools/linear.d.ts +7 -0
  329. package/dist/recipes/tools/linear.js +307 -0
  330. package/dist/recipes/tools/linear.js.map +1 -0
  331. package/dist/recipes/tools/meetingNotes.d.ts +21 -0
  332. package/dist/recipes/tools/meetingNotes.js +701 -0
  333. package/dist/recipes/tools/meetingNotes.js.map +1 -0
  334. package/dist/recipes/tools/notion.d.ts +6 -0
  335. package/dist/recipes/tools/notion.js +278 -0
  336. package/dist/recipes/tools/notion.js.map +1 -0
  337. package/dist/recipes/tools/pagerduty.d.ts +15 -0
  338. package/dist/recipes/tools/pagerduty.js +451 -0
  339. package/dist/recipes/tools/pagerduty.js.map +1 -0
  340. package/dist/recipes/tools/sentry.d.ts +12 -0
  341. package/dist/recipes/tools/sentry.js +73 -0
  342. package/dist/recipes/tools/sentry.js.map +1 -0
  343. package/dist/recipes/tools/slack.d.ts +6 -0
  344. package/dist/recipes/tools/slack.js +82 -0
  345. package/dist/recipes/tools/slack.js.map +1 -0
  346. package/dist/recipes/tools/stripe.d.ts +6 -0
  347. package/dist/recipes/tools/stripe.js +265 -0
  348. package/dist/recipes/tools/stripe.js.map +1 -0
  349. package/dist/recipes/tools/zendesk.d.ts +6 -0
  350. package/dist/recipes/tools/zendesk.js +245 -0
  351. package/dist/recipes/tools/zendesk.js.map +1 -0
  352. package/dist/recipes/validation.d.ts +13 -0
  353. package/dist/recipes/validation.js +617 -0
  354. package/dist/recipes/validation.js.map +1 -0
  355. package/dist/recipes/yamlRunner.d.ts +116 -1
  356. package/dist/recipes/yamlRunner.js +1000 -401
  357. package/dist/recipes/yamlRunner.js.map +1 -1
  358. package/dist/recipesHttp.d.ts +137 -6
  359. package/dist/recipesHttp.js +941 -29
  360. package/dist/recipesHttp.js.map +1 -1
  361. package/dist/riskTier.js +7 -1
  362. package/dist/riskTier.js.map +1 -1
  363. package/dist/runLog.d.ts +100 -1
  364. package/dist/runLog.js +258 -5
  365. package/dist/runLog.js.map +1 -1
  366. package/dist/schemas/dry-run-plan.v1.json +139 -0
  367. package/dist/schemas/recipe.v1.json +684 -0
  368. package/dist/server.d.ts +121 -8
  369. package/dist/server.js +538 -735
  370. package/dist/server.js.map +1 -1
  371. package/dist/ssrfGuard.d.ts +54 -0
  372. package/dist/ssrfGuard.js +122 -0
  373. package/dist/ssrfGuard.js.map +1 -0
  374. package/dist/streamableHttp.d.ts +39 -1
  375. package/dist/streamableHttp.js +128 -17
  376. package/dist/streamableHttp.js.map +1 -1
  377. package/dist/tokenUsageTracker.d.ts +33 -0
  378. package/dist/tokenUsageTracker.js +146 -0
  379. package/dist/tokenUsageTracker.js.map +1 -0
  380. package/dist/tools/activityLog.d.ts +2 -0
  381. package/dist/tools/addLinearComment.d.ts +1 -0
  382. package/dist/tools/addLinearComment.js +4 -2
  383. package/dist/tools/addLinearComment.js.map +1 -1
  384. package/dist/tools/batchLsp.d.ts +3 -0
  385. package/dist/tools/bridgeDoctor.d.ts +1 -0
  386. package/dist/tools/bridgeDoctor.js +2 -2
  387. package/dist/tools/bridgeDoctor.js.map +1 -1
  388. package/dist/tools/bridgeStatus.d.ts +1 -0
  389. package/dist/tools/cancelClaudeTask.d.ts +2 -0
  390. package/dist/tools/cancelClaudeTask.js +1 -0
  391. package/dist/tools/cancelClaudeTask.js.map +1 -1
  392. package/dist/tools/checkDocumentDirty.d.ts +1 -0
  393. package/dist/tools/clipboard.d.ts +2 -0
  394. package/dist/tools/closeTabs.d.ts +2 -0
  395. package/dist/tools/codeLens.d.ts +1 -0
  396. package/dist/tools/contextBundle.d.ts +1 -0
  397. package/dist/tools/createIssueFromAIComment.d.ts +1 -0
  398. package/dist/tools/createLinearIssue.d.ts +1 -0
  399. package/dist/tools/ctxGetTaskContext.d.ts +1 -0
  400. package/dist/tools/ctxQueryTraces.d.ts +1 -0
  401. package/dist/tools/ctxSaveTrace.d.ts +1 -0
  402. package/dist/tools/debug.d.ts +4 -0
  403. package/dist/tools/decorations.d.ts +2 -0
  404. package/dist/tools/documentLinks.d.ts +1 -0
  405. package/dist/tools/editText.d.ts +1 -0
  406. package/dist/tools/enrichCommit.d.ts +1 -0
  407. package/dist/tools/enrichStackTrace.d.ts +1 -0
  408. package/dist/tools/explainDiagnostic.d.ts +1 -0
  409. package/dist/tools/explainSymbol.d.ts +1 -0
  410. package/dist/tools/fetchCalendarEvents.d.ts +1 -0
  411. package/dist/tools/fetchGithubIssue.d.ts +1 -0
  412. package/dist/tools/fetchGithubPR.d.ts +1 -0
  413. package/dist/tools/fetchLinearIssue.d.ts +1 -0
  414. package/dist/tools/fetchSentryIssue.d.ts +1 -0
  415. package/dist/tools/fetchSlackProfile.d.ts +1 -0
  416. package/dist/tools/fetchSlackProfile.js +4 -1
  417. package/dist/tools/fetchSlackProfile.js.map +1 -1
  418. package/dist/tools/fileOperations.d.ts +3 -0
  419. package/dist/tools/fileWatcher.d.ts +2 -0
  420. package/dist/tools/findFiles.d.ts +1 -0
  421. package/dist/tools/findRelatedTests.d.ts +1 -0
  422. package/dist/tools/fixAllLintErrors.d.ts +1 -0
  423. package/dist/tools/foldingRanges.d.ts +1 -0
  424. package/dist/tools/formatDocument.d.ts +1 -0
  425. package/dist/tools/generateTests.d.ts +1 -0
  426. package/dist/tools/getAIComments.d.ts +1 -0
  427. package/dist/tools/getAnalyticsReport.d.ts +1 -0
  428. package/dist/tools/getArchitectureContext.d.ts +1 -0
  429. package/dist/tools/getBufferContent.d.ts +1 -0
  430. package/dist/tools/getChangeImpact.d.ts +1 -0
  431. package/dist/tools/getClaudeTaskStatus.d.ts +2 -0
  432. package/dist/tools/getClaudeTaskStatus.js +1 -0
  433. package/dist/tools/getClaudeTaskStatus.js.map +1 -1
  434. package/dist/tools/getCodeCoverage.d.ts +1 -0
  435. package/dist/tools/getCommitsForIssue.d.ts +1 -0
  436. package/dist/tools/getConnectorStatus.d.ts +1 -0
  437. package/dist/tools/getCurrentSelection.d.ts +2 -0
  438. package/dist/tools/getDebugState.d.ts +1 -0
  439. package/dist/tools/getDependencyTree.d.ts +1 -0
  440. package/dist/tools/getDiagnostics.d.ts +1 -0
  441. package/dist/tools/getDiffFromHandoff.d.ts +1 -0
  442. package/dist/tools/getDocumentSymbols.d.ts +25 -0
  443. package/dist/tools/getDocumentSymbols.js +74 -8
  444. package/dist/tools/getDocumentSymbols.js.map +1 -1
  445. package/dist/tools/getFileTree.d.ts +1 -0
  446. package/dist/tools/getGitDiff.d.ts +1 -0
  447. package/dist/tools/getGitHotspots.d.ts +1 -0
  448. package/dist/tools/getGitLog.d.ts +1 -0
  449. package/dist/tools/getGitStatus.d.ts +1 -0
  450. package/dist/tools/getImportTree.d.ts +1 -0
  451. package/dist/tools/getImportedSignatures.d.ts +1 -0
  452. package/dist/tools/getOpenEditors.d.ts +1 -0
  453. package/dist/tools/getPRTemplate.d.ts +1 -0
  454. package/dist/tools/getProjectContext.d.ts +1 -0
  455. package/dist/tools/getProjectInfo.d.ts +1 -0
  456. package/dist/tools/getSecurityAdvisories.d.ts +1 -0
  457. package/dist/tools/getSecurityAdvisories.js +10 -1
  458. package/dist/tools/getSecurityAdvisories.js.map +1 -1
  459. package/dist/tools/getSessionUsage.d.ts +4 -0
  460. package/dist/tools/getSessionUsage.js +3 -0
  461. package/dist/tools/getSessionUsage.js.map +1 -1
  462. package/dist/tools/getSymbolHistory.d.ts +1 -0
  463. package/dist/tools/getToolCapabilities.d.ts +1 -0
  464. package/dist/tools/getTypeSignature.d.ts +1 -0
  465. package/dist/tools/getWorkspaceFolders.d.ts +1 -0
  466. package/dist/tools/getWorkspaceSettings.d.ts +1 -0
  467. package/dist/tools/gitHistory.d.ts +2 -0
  468. package/dist/tools/gitWrite.d.ts +11 -0
  469. package/dist/tools/github/actions.d.ts +2 -0
  470. package/dist/tools/github/actions.js +4 -2
  471. package/dist/tools/github/actions.js.map +1 -1
  472. package/dist/tools/github/composite.d.ts +342 -0
  473. package/dist/tools/github/composite.js +343 -0
  474. package/dist/tools/github/composite.js.map +1 -0
  475. package/dist/tools/github/index.d.ts +1 -0
  476. package/dist/tools/github/index.js +1 -0
  477. package/dist/tools/github/index.js.map +1 -1
  478. package/dist/tools/github/issues.d.ts +4 -0
  479. package/dist/tools/github/issues.js +8 -4
  480. package/dist/tools/github/issues.js.map +1 -1
  481. package/dist/tools/github/pr.d.ts +7 -0
  482. package/dist/tools/github/pr.js +50 -12
  483. package/dist/tools/github/pr.js.map +1 -1
  484. package/dist/tools/handoffNote.d.ts +4 -0
  485. package/dist/tools/handoffNote.js +2 -0
  486. package/dist/tools/handoffNote.js.map +1 -1
  487. package/dist/tools/hoverAtCursor.d.ts +1 -0
  488. package/dist/tools/httpClient.d.ts +2 -0
  489. package/dist/tools/index.d.ts +8 -0
  490. package/dist/tools/index.js +47 -8
  491. package/dist/tools/index.js.map +1 -1
  492. package/dist/tools/inlayHints.d.ts +1 -0
  493. package/dist/tools/launchQuickTask.d.ts +2 -0
  494. package/dist/tools/launchQuickTask.js +1 -0
  495. package/dist/tools/launchQuickTask.js.map +1 -1
  496. package/dist/tools/listClaudeTasks.d.ts +2 -0
  497. package/dist/tools/listClaudeTasks.js +1 -0
  498. package/dist/tools/listClaudeTasks.js.map +1 -1
  499. package/dist/tools/listTerminals.d.ts +1 -0
  500. package/dist/tools/lsp.d.ts +14 -0
  501. package/dist/tools/navigateToSymbolByName.d.ts +1 -0
  502. package/dist/tools/openDiff.d.ts +1 -0
  503. package/dist/tools/openFile.d.ts +1 -0
  504. package/dist/tools/openInBrowser.d.ts +1 -0
  505. package/dist/tools/organizeImports.d.ts +1 -0
  506. package/dist/tools/performanceReport.d.ts +1 -0
  507. package/dist/tools/planPersistence.d.ts +5 -0
  508. package/dist/tools/previewEdit.d.ts +1 -0
  509. package/dist/tools/refactorAnalyze.d.ts +1 -0
  510. package/dist/tools/refactorPreview.d.ts +2 -0
  511. package/dist/tools/refactorPreview.js +1 -0
  512. package/dist/tools/refactorPreview.js.map +1 -1
  513. package/dist/tools/replaceBlock.d.ts +1 -0
  514. package/dist/tools/resumeClaudeTask.d.ts +2 -0
  515. package/dist/tools/resumeClaudeTask.js +1 -0
  516. package/dist/tools/resumeClaudeTask.js.map +1 -1
  517. package/dist/tools/runClaudeTask.d.ts +2 -0
  518. package/dist/tools/runClaudeTask.js +1 -0
  519. package/dist/tools/runClaudeTask.js.map +1 -1
  520. package/dist/tools/runCommand.d.ts +1 -0
  521. package/dist/tools/runTests.d.ts +1 -0
  522. package/dist/tools/saveDocument.d.ts +1 -0
  523. package/dist/tools/screenshotAndAnnotate.d.ts +1 -0
  524. package/dist/tools/searchAndReplace.d.ts +1 -0
  525. package/dist/tools/searchTools.d.ts +1 -0
  526. package/dist/tools/searchTools.js +1 -1
  527. package/dist/tools/searchTools.js.map +1 -1
  528. package/dist/tools/searchWorkspace.d.ts +1 -0
  529. package/dist/tools/selectionRanges.d.ts +1 -0
  530. package/dist/tools/semanticTokens.d.ts +1 -0
  531. package/dist/tools/setActiveWorkspaceFolder.d.ts +1 -0
  532. package/dist/tools/signatureHelp.d.ts +1 -0
  533. package/dist/tools/slackListChannels.d.ts +1 -0
  534. package/dist/tools/slackListChannels.js.map +1 -1
  535. package/dist/tools/slackPostMessage.d.ts +1 -0
  536. package/dist/tools/slackPostMessage.js +11 -6
  537. package/dist/tools/slackPostMessage.js.map +1 -1
  538. package/dist/tools/terminal.d.ts +6 -0
  539. package/dist/tools/testTraceToSource.d.ts +1 -0
  540. package/dist/tools/testTraceToSource.js +2 -2
  541. package/dist/tools/testTraceToSource.js.map +1 -1
  542. package/dist/tools/transaction.d.ts +23 -0
  543. package/dist/tools/transaction.js +29 -0
  544. package/dist/tools/transaction.js.map +1 -1
  545. package/dist/tools/typeHierarchy.d.ts +1 -0
  546. package/dist/tools/updateLinearIssue.d.ts +1 -0
  547. package/dist/tools/updateLinearIssue.js +20 -6
  548. package/dist/tools/updateLinearIssue.js.map +1 -1
  549. package/dist/tools/utils.d.ts +2 -0
  550. package/dist/tools/utils.js.map +1 -1
  551. package/dist/tools/vscodeCommands.d.ts +2 -0
  552. package/dist/tools/vscodeTasks.d.ts +2 -0
  553. package/dist/tools/workspaceSettings.d.ts +1 -0
  554. package/dist/traceEncryption.d.ts +46 -0
  555. package/dist/traceEncryption.js +124 -0
  556. package/dist/traceEncryption.js.map +1 -0
  557. package/dist/transport.d.ts +46 -1
  558. package/dist/transport.js +173 -19
  559. package/dist/transport.js.map +1 -1
  560. package/package.json +30 -8
  561. package/scripts/mcp-stdio-shim.cjs +19 -3
  562. package/scripts/start-all.sh +30 -1
  563. package/templates/automation-policies/recipe-authoring.json +25 -0
  564. package/templates/automation-policy.example.json +6 -0
  565. package/templates/co.patchwork-os.bridge.plist +34 -0
  566. package/templates/policies/README.md +72 -0
  567. package/templates/policies/conservative.json +14 -0
  568. package/templates/policies/developer.json +14 -0
  569. package/templates/policies/headless-ci.json +24 -0
  570. package/templates/policies/personal-assistant.json +15 -0
  571. package/templates/policies/regulated-industry.json +18 -0
  572. package/templates/recipes/lint-on-save.yaml +1 -2
  573. package/templates/recipes/morning-brief-slack.yaml +57 -0
  574. package/templates/recipes/morning-brief.yaml +2 -2
  575. package/templates/recipes/project-health-check.yaml +50 -0
  576. package/templates/recipes/webhook/README.md +70 -0
  577. package/templates/recipes/webhook/capture-thought.yaml +26 -0
  578. package/templates/recipes/webhook/customer-escalation.yaml +49 -0
  579. package/templates/recipes/webhook/incident-intake.yaml +46 -0
  580. package/templates/recipes/webhook/meeting-prep.yaml +48 -0
  581. package/templates/recipes/webhook/morning-brief.yaml +57 -0
@@ -0,0 +1,47 @@
1
+ /**
2
+ * RecipeManifest — recipe.json format for the Patchwork recipe marketplace.
3
+ *
4
+ * Each recipe package directory contains a recipe.json manifest describing
5
+ * the package metadata, entry-point recipe file, child recipes, required
6
+ * connectors, and configurable variables.
7
+ */
8
+ export interface RecipeManifest {
9
+ name: string;
10
+ version: string;
11
+ description: string;
12
+ author?: string;
13
+ license?: string;
14
+ tags?: string[];
15
+ connectors?: string[];
16
+ recipes: {
17
+ main: string;
18
+ children?: string[];
19
+ };
20
+ variables?: Record<string, {
21
+ description: string;
22
+ required?: boolean;
23
+ default?: string;
24
+ }>;
25
+ homepage?: string;
26
+ repository?: string;
27
+ }
28
+ /**
29
+ * Validate an unknown value as a RecipeManifest.
30
+ * Throws a descriptive Error if any required field is missing or invalid.
31
+ */
32
+ export declare function validateManifest(manifest: unknown): RecipeManifest;
33
+ /**
34
+ * Parse and validate a recipe.json string.
35
+ * Throws with a clear error message if invalid JSON or schema violations.
36
+ */
37
+ export declare function parseManifest(json: string): RecipeManifest;
38
+ /**
39
+ * Load and parse recipe.json from a directory.
40
+ * Returns null if the file does not exist (not a recipe package dir).
41
+ * Throws if file exists but is invalid.
42
+ */
43
+ export declare function loadManifestFromDir(dir: string): RecipeManifest | null;
44
+ /**
45
+ * Returns all recipe filenames declared in the manifest: [main, ...children].
46
+ */
47
+ export declare function getManifestRecipeFiles(manifest: RecipeManifest): string[];
@@ -0,0 +1,156 @@
1
+ /**
2
+ * RecipeManifest — recipe.json format for the Patchwork recipe marketplace.
3
+ *
4
+ * Each recipe package directory contains a recipe.json manifest describing
5
+ * the package metadata, entry-point recipe file, child recipes, required
6
+ * connectors, and configurable variables.
7
+ */
8
+ import { existsSync, readFileSync } from "node:fs";
9
+ import path from "node:path";
10
+ const NAME_RE = /^(@[a-z0-9-]+\/)?[a-z0-9][a-z0-9\-_.]*$/;
11
+ const VERSION_RE = /^\d+\.\d+\.\d+/;
12
+ const YAML_EXT_RE = /\.ya?ml$/;
13
+ /**
14
+ * Recipe filenames in the manifest must be plain basenames, not paths.
15
+ * Rejects "../escape.yaml", "subdir/foo.yaml", "/etc/passwd.yaml", control
16
+ * characters, and so on — anything that could resolve outside the install
17
+ * directory when the consumer does `path.join(installDir, recipes.main)`.
18
+ */
19
+ function isSafeRecipeBasename(filename) {
20
+ if (typeof filename !== "string" || filename.length === 0)
21
+ return false;
22
+ if (filename === "." || filename === "..")
23
+ return false;
24
+ if (filename.includes("/") || filename.includes("\\"))
25
+ return false;
26
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: explicit control-char check
27
+ if (/[\x00-\x1F\x7F]/.test(filename))
28
+ return false;
29
+ return YAML_EXT_RE.test(filename);
30
+ }
31
+ /**
32
+ * Validate an unknown value as a RecipeManifest.
33
+ * Throws a descriptive Error if any required field is missing or invalid.
34
+ */
35
+ export function validateManifest(manifest) {
36
+ if (typeof manifest !== "object" || manifest === null) {
37
+ throw new Error("recipe.json must be a JSON object");
38
+ }
39
+ const m = manifest;
40
+ // name
41
+ if (typeof m.name !== "string" || !m.name) {
42
+ throw new Error('recipe.json: "name" is required and must be a string');
43
+ }
44
+ if (!NAME_RE.test(m.name)) {
45
+ throw new Error(`recipe.json: "name" must match pattern (@scope/)?[a-z0-9][a-z0-9-_.]* — got "${m.name}"`);
46
+ }
47
+ // version
48
+ if (typeof m.version !== "string" || !m.version) {
49
+ throw new Error('recipe.json: "version" is required and must be a string');
50
+ }
51
+ if (!VERSION_RE.test(m.version)) {
52
+ throw new Error(`recipe.json: "version" must be valid semver (e.g. "1.0.0") — got "${m.version}"`);
53
+ }
54
+ // description
55
+ if (typeof m.description !== "string" || !m.description) {
56
+ throw new Error('recipe.json: "description" is required and must be a non-empty string');
57
+ }
58
+ // recipes
59
+ if (typeof m.recipes !== "object" || m.recipes === null) {
60
+ throw new Error('recipe.json: "recipes" is required and must be an object');
61
+ }
62
+ const recipes = m.recipes;
63
+ if (!isSafeRecipeBasename(recipes.main)) {
64
+ throw new Error(`recipe.json: "recipes.main" must be a .yaml or .yml basename without path separators or control characters — got "${recipes.main}"`);
65
+ }
66
+ if (recipes.children !== undefined) {
67
+ if (!Array.isArray(recipes.children)) {
68
+ throw new Error('recipe.json: "recipes.children" must be an array');
69
+ }
70
+ for (let i = 0; i < recipes.children.length; i++) {
71
+ if (!isSafeRecipeBasename(recipes.children[i])) {
72
+ throw new Error(`recipe.json: "recipes.children[${i}]" must be a .yaml or .yml basename without path separators or control characters — got "${recipes.children[i]}"`);
73
+ }
74
+ }
75
+ }
76
+ // optional string fields
77
+ for (const field of [
78
+ "author",
79
+ "license",
80
+ "homepage",
81
+ "repository",
82
+ ]) {
83
+ if (m[field] !== undefined && typeof m[field] !== "string") {
84
+ throw new Error(`recipe.json: "${field}" must be a string`);
85
+ }
86
+ }
87
+ // optional string[] fields
88
+ for (const field of ["tags", "connectors"]) {
89
+ if (m[field] !== undefined) {
90
+ if (!Array.isArray(m[field])) {
91
+ throw new Error(`recipe.json: "${field}" must be an array of strings`);
92
+ }
93
+ for (let i = 0; i < m[field].length; i++) {
94
+ if (typeof m[field][i] !== "string") {
95
+ throw new Error(`recipe.json: "${field}[${i}]" must be a string`);
96
+ }
97
+ }
98
+ }
99
+ }
100
+ // variables
101
+ if (m.variables !== undefined) {
102
+ if (typeof m.variables !== "object" || m.variables === null) {
103
+ throw new Error('recipe.json: "variables" must be an object');
104
+ }
105
+ for (const [key, val] of Object.entries(m.variables)) {
106
+ if (typeof val !== "object" || val === null) {
107
+ throw new Error(`recipe.json: "variables.${key}" must be an object with a "description" field`);
108
+ }
109
+ const v = val;
110
+ if (typeof v.description !== "string" || !v.description) {
111
+ throw new Error(`recipe.json: "variables.${key}.description" is required and must be a non-empty string`);
112
+ }
113
+ if (v.required !== undefined && typeof v.required !== "boolean") {
114
+ throw new Error(`recipe.json: "variables.${key}.required" must be a boolean`);
115
+ }
116
+ if (v.default !== undefined && typeof v.default !== "string") {
117
+ throw new Error(`recipe.json: "variables.${key}.default" must be a string`);
118
+ }
119
+ }
120
+ }
121
+ return m;
122
+ }
123
+ /**
124
+ * Parse and validate a recipe.json string.
125
+ * Throws with a clear error message if invalid JSON or schema violations.
126
+ */
127
+ export function parseManifest(json) {
128
+ let parsed;
129
+ try {
130
+ parsed = JSON.parse(json);
131
+ }
132
+ catch (err) {
133
+ throw new Error(`recipe.json: invalid JSON — ${err instanceof Error ? err.message : String(err)}`);
134
+ }
135
+ return validateManifest(parsed);
136
+ }
137
+ /**
138
+ * Load and parse recipe.json from a directory.
139
+ * Returns null if the file does not exist (not a recipe package dir).
140
+ * Throws if file exists but is invalid.
141
+ */
142
+ export function loadManifestFromDir(dir) {
143
+ const manifestPath = path.join(dir, "recipe.json");
144
+ if (!existsSync(manifestPath)) {
145
+ return null;
146
+ }
147
+ const raw = readFileSync(manifestPath, "utf-8");
148
+ return parseManifest(raw);
149
+ }
150
+ /**
151
+ * Returns all recipe filenames declared in the manifest: [main, ...children].
152
+ */
153
+ export function getManifestRecipeFiles(manifest) {
154
+ return [manifest.recipes.main, ...(manifest.recipes.children ?? [])];
155
+ }
156
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/recipes/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AA0B7B,MAAM,OAAO,GAAG,yCAAyC,CAAC;AAC1D,MAAM,UAAU,GAAG,gBAAgB,CAAC;AACpC,MAAM,WAAW,GAAG,UAAU,CAAC;AAE/B;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,QAAiB;IAC7C,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACxE,IAAI,QAAQ,KAAK,GAAG,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC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D,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAChD,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAwB;IAC7D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;AACvE,CAAC"}
@@ -0,0 +1,12 @@
1
+ export interface PermissionsSidecarWarningResult {
2
+ count: number;
3
+ warned: boolean;
4
+ }
5
+ /**
6
+ * Scans `recipesDir` for legacy permissions sidecar files. Emits a single
7
+ * `console.warn` if any are found (skipped in test env). Returns the count
8
+ * for caller observability + tests.
9
+ */
10
+ export declare function warnAboutLegacyPermissionsSidecars(recipesDir: string, options?: {
11
+ warn?: (msg: string) => void;
12
+ }): PermissionsSidecarWarningResult;
@@ -0,0 +1,44 @@
1
+ import { readdirSync } from "node:fs";
2
+ /**
3
+ * Boot-time scan for legacy `<name>.permissions.json` sidecars left over from
4
+ * pre-alpha.36 installs. The sidecar files were decorative — never read by
5
+ * toolRegistry — so they're safe to ignore on disk. Emits a single warning
6
+ * pointing users at the canonical permission location (~/.claude/settings.json).
7
+ *
8
+ * Per recipe-dogfood-2026-05-01/PLAN-MASTER-V2.md A-PR4 §6 (R2 L-2):
9
+ * - Fires ONCE per boot, not per recipe.
10
+ * - Skipped under NODE_ENV=test so vitest output stays clean.
11
+ * - Migration script for users who want to archive:
12
+ * find ~/.patchwork/recipes -name '*.permissions.json' \
13
+ * -exec mv {} ~/.patchwork/recipes/.permissions-archive/ \;
14
+ */
15
+ const DOC_URL = "https://github.com/Oolab-labs/patchwork-os/blob/main/docs/dogfood/recipe-dogfood-2026-05-01/PLAN-MASTER-V2.md";
16
+ /**
17
+ * Scans `recipesDir` for legacy permissions sidecar files. Emits a single
18
+ * `console.warn` if any are found (skipped in test env). Returns the count
19
+ * for caller observability + tests.
20
+ */
21
+ export function warnAboutLegacyPermissionsSidecars(recipesDir, options = {}) {
22
+ let entries;
23
+ try {
24
+ entries = readdirSync(recipesDir);
25
+ }
26
+ catch {
27
+ return { count: 0, warned: false };
28
+ }
29
+ const sidecars = entries.filter((f) => f.endsWith(".permissions.json"));
30
+ const count = sidecars.length;
31
+ if (count === 0) {
32
+ return { count: 0, warned: false };
33
+ }
34
+ if (process.env.NODE_ENV === "test" && !options.warn) {
35
+ return { count, warned: false };
36
+ }
37
+ const warn = options.warn ?? ((msg) => console.warn(msg));
38
+ warn(`[patchwork] Found ${count} legacy <name>.permissions.json sidecar file${count === 1 ? "" : "s"} in ${recipesDir}. ` +
39
+ `These are decorative and no longer generated (alpha.36+). ` +
40
+ `Configure tool gating in ~/.claude/settings.json. ` +
41
+ `Migration guide: ${DOC_URL}`);
42
+ return { count, warned: true };
43
+ }
44
+ //# sourceMappingURL=migrationWarnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrationWarnings.js","sourceRoot":"","sources":["../../src/recipes/migrationWarnings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;;;;;;;;GAYG;AAEH,MAAM,OAAO,GACX,+GAA+G,CAAC;AAOlH;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAChD,UAAkB,EAClB,UAA4C,EAAE;IAE9C,IAAI,OAAiB,CAAC;IACtB,IAAI,CAAC;QACH,OAAO,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC;IAE9B,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAChB,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACrD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAClC,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAClE,IAAI,CACF,qBAAqB,KAAK,+CACxB,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACrB,OAAO,UAAU,IAAI;QACnB,4DAA4D;QAC5D,oDAAoD;QACpD,oBAAoB,OAAO,EAAE,CAChC,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { WarnFn } from "./types.js";
2
+ export type { RecipeMigration, WarnFn } from "./types.js";
3
+ export { v1Migration } from "./v1.js";
4
+ /** apiVersion produced by the most recent migration. */
5
+ export declare const CURRENT_API_VERSION = "patchwork.sh/v1";
6
+ export interface MigrationResult {
7
+ /** Migrated recipe object. Same reference if no migrations applied. */
8
+ recipe: unknown;
9
+ /** Sequence of "<from> -> <to>" strings describing applied migrations. */
10
+ applied: string[];
11
+ }
12
+ /**
13
+ * Migrate a recipe object up to `CURRENT_API_VERSION`.
14
+ *
15
+ * Behavior:
16
+ * - Non-record inputs are returned as-is with no migrations applied.
17
+ * - Each iteration looks for a registered migration whose `from`
18
+ * matches the current `apiVersion` and applies it.
19
+ * - The loop stops when the recipe declares `CURRENT_API_VERSION`,
20
+ * when no matching migration exists for an unversioned recipe (no-op),
21
+ * or when the recipe declares an unknown future apiVersion (passed
22
+ * through unchanged so downstream schema lint can flag it).
23
+ */
24
+ export declare function migrateRecipeToCurrent(recipe: unknown, warn?: WarnFn): MigrationResult;
@@ -0,0 +1,55 @@
1
+ import { v1Migration } from "./v1.js";
2
+ export { v1Migration } from "./v1.js";
3
+ /** apiVersion produced by the most recent migration. */
4
+ export const CURRENT_API_VERSION = "patchwork.sh/v1";
5
+ /**
6
+ * Ordered list of available migrations. Each step's `to` is consumed
7
+ * by the next step's `from` (or matches `CURRENT_API_VERSION`).
8
+ */
9
+ const REGISTRY = [v1Migration];
10
+ function isRecord(value) {
11
+ return typeof value === "object" && value !== null && !Array.isArray(value);
12
+ }
13
+ function readApiVersion(recipe) {
14
+ return typeof recipe.apiVersion === "string" ? recipe.apiVersion : null;
15
+ }
16
+ /**
17
+ * Migrate a recipe object up to `CURRENT_API_VERSION`.
18
+ *
19
+ * Behavior:
20
+ * - Non-record inputs are returned as-is with no migrations applied.
21
+ * - Each iteration looks for a registered migration whose `from`
22
+ * matches the current `apiVersion` and applies it.
23
+ * - The loop stops when the recipe declares `CURRENT_API_VERSION`,
24
+ * when no matching migration exists for an unversioned recipe (no-op),
25
+ * or when the recipe declares an unknown future apiVersion (passed
26
+ * through unchanged so downstream schema lint can flag it).
27
+ */
28
+ export function migrateRecipeToCurrent(recipe, warn) {
29
+ if (!isRecord(recipe)) {
30
+ return { recipe, applied: [] };
31
+ }
32
+ let current = { ...recipe };
33
+ const applied = [];
34
+ // Bound the loop defensively so a malformed registry can never
35
+ // produce an infinite cycle.
36
+ const maxIterations = REGISTRY.length + 1;
37
+ for (let i = 0; i < maxIterations; i++) {
38
+ const version = readApiVersion(current);
39
+ if (version === CURRENT_API_VERSION) {
40
+ break;
41
+ }
42
+ const migration = REGISTRY.find((m) => m.from === version);
43
+ if (!migration) {
44
+ // Unknown future/unsupported apiVersion: leave the recipe alone
45
+ // and let schema lint surface the enum mismatch with a clear
46
+ // message instead of throwing here.
47
+ break;
48
+ }
49
+ const next = migration.migrate(current, warn);
50
+ current = isRecord(next) ? next : current;
51
+ applied.push(`${migration.from ?? "(unversioned)"} -> ${migration.to}`);
52
+ }
53
+ return { recipe: current, applied };
54
+ }
55
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/recipes/migrations/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAErD;;;GAGG;AACH,MAAM,QAAQ,GAAmC,CAAC,WAAW,CAAC,CAAC;AAS/D,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,cAAc,CAAC,MAA+B;IACrD,OAAO,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1E,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAe,EACf,IAAa;IAEb,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACjC,CAAC;IAED,IAAI,OAAO,GAA4B,EAAE,GAAG,MAAM,EAAE,CAAC;IACrD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,+DAA+D;IAC/D,6BAA6B;IAC7B,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAE1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,OAAO,KAAK,mBAAmB,EAAE,CAAC;YACpC,MAAM;QACR,CAAC;QAED,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,gEAAgE;YAChE,6DAA6D;YAC7D,oCAAoC;YACpC,MAAM;QACR,CAAC;QAED,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC9C,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;QAC1C,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,IAAI,eAAe,OAAO,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Recipe apiVersion migration layer.
3
+ *
4
+ * A `RecipeMigration` upgrades a recipe object from one declared
5
+ * `apiVersion` to the next. Migrations are chained by the registry in
6
+ * `./index.ts` until the recipe carries the current apiVersion or no
7
+ * matching migration exists.
8
+ *
9
+ * Field-level legacy compatibility (e.g. `output -> into`,
10
+ * `params` flattening, `trigger.schedule -> trigger.at`) lives in
11
+ * `../legacyRecipeCompat.ts` and runs alongside this layer; migrations
12
+ * here are reserved for changes that are explicitly version-bumped.
13
+ */
14
+ export type WarnFn = (msg: string) => void;
15
+ export interface RecipeMigration {
16
+ /**
17
+ * apiVersion this migration consumes. `null` means "no apiVersion
18
+ * field present" (i.e. an unversioned legacy recipe).
19
+ */
20
+ from: string | null;
21
+ /** apiVersion this migration produces. */
22
+ to: string;
23
+ /**
24
+ * Migrate a shallow-cloned record. Implementations should return a
25
+ * new object rather than mutating the input.
26
+ */
27
+ migrate: (recipe: Record<string, unknown>, warn?: WarnFn) => Record<string, unknown>;
28
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/recipes/migrations/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { RecipeMigration } from "./types.js";
2
+ /**
3
+ * Migrate an unversioned (no `apiVersion`) recipe to `patchwork.sh/v1`.
4
+ *
5
+ * The shape changes that distinguished pre-v1 from v1 (e.g. flat
6
+ * `agent: true`, `params`, `output`, `trigger.schedule`) are still
7
+ * accepted at runtime and lint via `../legacyRecipeCompat.ts`. This
8
+ * migration's job is the explicit version stamp plus a single
9
+ * deprecation warning telling authors to add `apiVersion` themselves.
10
+ */
11
+ export declare const v1Migration: RecipeMigration;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Migrate an unversioned (no `apiVersion`) recipe to `patchwork.sh/v1`.
3
+ *
4
+ * The shape changes that distinguished pre-v1 from v1 (e.g. flat
5
+ * `agent: true`, `params`, `output`, `trigger.schedule`) are still
6
+ * accepted at runtime and lint via `../legacyRecipeCompat.ts`. This
7
+ * migration's job is the explicit version stamp plus a single
8
+ * deprecation warning telling authors to add `apiVersion` themselves.
9
+ */
10
+ export const v1Migration = {
11
+ from: null,
12
+ to: "patchwork.sh/v1",
13
+ migrate(recipe, warn) {
14
+ warn?.("Recipe missing 'apiVersion' — implicitly migrated to 'patchwork.sh/v1'. Add `apiVersion: patchwork.sh/v1` to silence this warning (will be required in a future major version).");
15
+ return { apiVersion: "patchwork.sh/v1", ...recipe };
16
+ },
17
+ };
18
+ //# sourceMappingURL=v1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1.js","sourceRoot":"","sources":["../../../src/recipes/migrations/v1.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAoB;IAC1C,IAAI,EAAE,IAAI;IACV,EAAE,EAAE,iBAAiB;IACrB,OAAO,CAAC,MAA+B,EAAE,IAA4B;QACnE,IAAI,EAAE,CACJ,iLAAiL,CAClL,CAAC;QACF,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAAC;IACtD,CAAC;CACF,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Canonical name + variable-name rules for recipes.
3
+ *
4
+ * Single source of truth used by:
5
+ * - `src/recipesHttp.ts` — file-system + HTTP route validation
6
+ * - `src/recipes/validation.ts` — `validateRecipeDefinition` lint
7
+ * - `dashboard/src/app/recipes/new/page.tsx` — form-side mirroring
8
+ * (the dashboard package re-declares them, kept in sync by hand)
9
+ * - `schemas/recipe.v1.json` — IDE-time JSON-Schema validation
10
+ *
11
+ * Lives in its own module to avoid the circular import that arises if
12
+ * the constants live in `recipesHttp.ts` (which imports
13
+ * `validateRecipeDefinition` from `validation.ts`, which would then
14
+ * import the constants back).
15
+ */
16
+ /**
17
+ * Canonical recipe-name regex. kebab-case, 1–64 chars, must start with
18
+ * a letter or digit. Survey of all 22 production recipes in
19
+ * `~/.patchwork/recipes/` confirmed none use underscore filenames; this
20
+ * matches the JSON Schema `pattern` and the previous strict server
21
+ * regex (which disagreed with the schema by also allowing `_`).
22
+ */
23
+ export declare const RECIPE_NAME_RE: RegExp;
24
+ /**
25
+ * Canonical variable-name regex (for `trigger.vars[].name` and
26
+ * `trigger.inputs[].name`). Mirrors the runtime template-reference
27
+ * regex root group in `validation.ts:extractTemplateDottedPaths`,
28
+ * minus `-` (hyphens in var names parse oddly in template expressions).
29
+ * Permits both SCREAMING_SNAKE and lowercase_snake conventions seen in
30
+ * production recipes.
31
+ */
32
+ export declare const RECIPE_VAR_NAME_RE: RegExp;
33
+ /**
34
+ * Built-in context keys reserved by the runtime. Declaring a `vars` or
35
+ * `inputs` entry with any of these names would shadow trigger-emitted
36
+ * data silently. The simple-identifier subset of
37
+ * `registerRecipeContextKeys` + `extractTemplateExpressions builtinKeys`
38
+ * (see `src/recipes/validation.ts`).
39
+ */
40
+ export declare const RESERVED_VAR_NAMES: ReadonlySet<string>;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Canonical name + variable-name rules for recipes.
3
+ *
4
+ * Single source of truth used by:
5
+ * - `src/recipesHttp.ts` — file-system + HTTP route validation
6
+ * - `src/recipes/validation.ts` — `validateRecipeDefinition` lint
7
+ * - `dashboard/src/app/recipes/new/page.tsx` — form-side mirroring
8
+ * (the dashboard package re-declares them, kept in sync by hand)
9
+ * - `schemas/recipe.v1.json` — IDE-time JSON-Schema validation
10
+ *
11
+ * Lives in its own module to avoid the circular import that arises if
12
+ * the constants live in `recipesHttp.ts` (which imports
13
+ * `validateRecipeDefinition` from `validation.ts`, which would then
14
+ * import the constants back).
15
+ */
16
+ /**
17
+ * Canonical recipe-name regex. kebab-case, 1–64 chars, must start with
18
+ * a letter or digit. Survey of all 22 production recipes in
19
+ * `~/.patchwork/recipes/` confirmed none use underscore filenames; this
20
+ * matches the JSON Schema `pattern` and the previous strict server
21
+ * regex (which disagreed with the schema by also allowing `_`).
22
+ */
23
+ export const RECIPE_NAME_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
24
+ /**
25
+ * Canonical variable-name regex (for `trigger.vars[].name` and
26
+ * `trigger.inputs[].name`). Mirrors the runtime template-reference
27
+ * regex root group in `validation.ts:extractTemplateDottedPaths`,
28
+ * minus `-` (hyphens in var names parse oddly in template expressions).
29
+ * Permits both SCREAMING_SNAKE and lowercase_snake conventions seen in
30
+ * production recipes.
31
+ */
32
+ export const RECIPE_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
33
+ /**
34
+ * Built-in context keys reserved by the runtime. Declaring a `vars` or
35
+ * `inputs` entry with any of these names would shadow trigger-emitted
36
+ * data silently. The simple-identifier subset of
37
+ * `registerRecipeContextKeys` + `extractTemplateExpressions builtinKeys`
38
+ * (see `src/recipes/validation.ts`).
39
+ */
40
+ export const RESERVED_VAR_NAMES = new Set([
41
+ "date",
42
+ "time",
43
+ "YYYY",
44
+ "ISO_NOW",
45
+ "HH",
46
+ "MM",
47
+ "SS",
48
+ "this",
49
+ "hash",
50
+ "message",
51
+ "branch",
52
+ "payload",
53
+ "webhook_payload",
54
+ "hook_path",
55
+ "webhook_path",
56
+ "file",
57
+ "file_ext",
58
+ "file_basename",
59
+ "runner",
60
+ "failed",
61
+ "passed",
62
+ "total",
63
+ "failures",
64
+ "event",
65
+ ]);
66
+ //# sourceMappingURL=names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names.js","sourceRoot":"","sources":["../../src/recipes/names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,+BAA+B,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC7D,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;IACT,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,MAAM;IACN,SAAS;IACT,QAAQ;IACR,SAAS;IACT,iBAAiB;IACjB,WAAW;IACX,cAAc;IACd,MAAM;IACN,UAAU;IACV,eAAe;IACf,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,UAAU;IACV,OAAO;CACR,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * NestedRecipeStep — handler for calling recipes from within recipes.
3
+ *
4
+ * Supports:
5
+ * - Variable passing via template resolution
6
+ * - Isolated OutputRegistry for child
7
+ * - Risk escalation (child risk > parent risk uses child's)
8
+ * - Depth limiting (prevent infinite recursion)
9
+ */
10
+ import type { OutputRegistry } from "./outputRegistry.js";
11
+ import type { TemplateContext, TemplateError } from "./templateEngine.js";
12
+ export interface NestedRecipeConfig {
13
+ recipe: string;
14
+ vars: Record<string, string>;
15
+ output?: string;
16
+ risk?: "low" | "medium" | "high";
17
+ id: string;
18
+ }
19
+ export interface NestedRecipeContext {
20
+ parentRegistry: OutputRegistry;
21
+ parentEnv: Record<string, string | undefined>;
22
+ recipeMaxDepth: number;
23
+ currentDepth: number;
24
+ dryRun: boolean;
25
+ }
26
+ export interface NestedRecipeResult {
27
+ success: boolean;
28
+ data?: unknown;
29
+ error?: string;
30
+ childOutputs?: Record<string, unknown>;
31
+ }
32
+ export interface RecipeLoader {
33
+ loadRecipe(name: string): Promise<{
34
+ steps: unknown[];
35
+ } | null>;
36
+ }
37
+ /** Resolve template variables against parent context */
38
+ export declare function resolveNestedVars(vars: Record<string, string>, context: TemplateContext): {
39
+ resolved: Record<string, string>;
40
+ errors: TemplateError[];
41
+ };
42
+ /** Validate nested recipe call before execution */
43
+ export declare function validateNestedRecipe(config: NestedRecipeConfig, context: NestedRecipeContext): {
44
+ valid: boolean;
45
+ error?: string;
46
+ };
47
+ /** Calculate effective risk tier */
48
+ export declare function calculateNestedRisk(parentRisk: "low" | "medium" | "high" | undefined, childRisk: "low" | "medium" | "high" | undefined): "low" | "medium" | "high";
49
+ /** Format nested recipe result for parent registry */
50
+ export declare function formatNestedOutput(result: NestedRecipeResult, config: NestedRecipeConfig): {
51
+ stepId: string;
52
+ output: {
53
+ status: "success" | "error" | "skipped";
54
+ data: unknown;
55
+ };
56
+ };
57
+ /** Mock nested recipe execution for dry-run mode */
58
+ export declare function mockNestedRecipe(config: NestedRecipeConfig, context: NestedRecipeContext): Promise<NestedRecipeResult>;