patchwork-os 0.2.0-alpha.3 → 0.2.0-alpha.31

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 (301) hide show
  1. package/README.bridge.md +6 -0
  2. package/README.md +40 -15
  3. package/deploy/bootstrap-vps.sh +184 -0
  4. package/deploy/deploy-dashboard.sh +174 -0
  5. package/deploy/deploy-landing.sh +79 -0
  6. package/dist/activationMetrics.d.ts +67 -0
  7. package/dist/activationMetrics.js +255 -0
  8. package/dist/activationMetrics.js.map +1 -0
  9. package/dist/approvalHttp.d.ts +24 -2
  10. package/dist/approvalHttp.js +150 -10
  11. package/dist/approvalHttp.js.map +1 -1
  12. package/dist/approvalQueue.d.ts +16 -1
  13. package/dist/approvalQueue.js +44 -3
  14. package/dist/approvalQueue.js.map +1 -1
  15. package/dist/automation.d.ts +20 -0
  16. package/dist/automation.js +54 -1
  17. package/dist/automation.js.map +1 -1
  18. package/dist/bridge.d.ts +2 -0
  19. package/dist/bridge.js +55 -130
  20. package/dist/bridge.js.map +1 -1
  21. package/dist/bridgeToken.js +57 -19
  22. package/dist/bridgeToken.js.map +1 -1
  23. package/dist/ccPermissions.js +6 -4
  24. package/dist/ccPermissions.js.map +1 -1
  25. package/dist/claudeOrchestrator.d.ts +1 -1
  26. package/dist/claudeOrchestrator.js +14 -8
  27. package/dist/claudeOrchestrator.js.map +1 -1
  28. package/dist/commands/launchd.d.ts +2 -0
  29. package/dist/commands/launchd.js +94 -0
  30. package/dist/commands/launchd.js.map +1 -0
  31. package/dist/commands/recipe.d.ts +258 -0
  32. package/dist/commands/recipe.js +1130 -0
  33. package/dist/commands/recipe.js.map +1 -0
  34. package/dist/commands/recipeInstall.d.ts +72 -0
  35. package/dist/commands/recipeInstall.js +339 -0
  36. package/dist/commands/recipeInstall.js.map +1 -0
  37. package/dist/config.d.ts +14 -1
  38. package/dist/config.js +99 -8
  39. package/dist/config.js.map +1 -1
  40. package/dist/connectors/baseConnector.d.ts +117 -0
  41. package/dist/connectors/baseConnector.js +213 -0
  42. package/dist/connectors/baseConnector.js.map +1 -0
  43. package/dist/connectors/confluence.d.ts +111 -0
  44. package/dist/connectors/confluence.js +406 -0
  45. package/dist/connectors/confluence.js.map +1 -0
  46. package/dist/connectors/datadog.d.ts +116 -0
  47. package/dist/connectors/datadog.js +385 -0
  48. package/dist/connectors/datadog.js.map +1 -0
  49. package/dist/connectors/fixtureLibrary.d.ts +21 -0
  50. package/dist/connectors/fixtureLibrary.js +70 -0
  51. package/dist/connectors/fixtureLibrary.js.map +1 -0
  52. package/dist/connectors/fixtureRecorder.d.ts +1 -0
  53. package/dist/connectors/fixtureRecorder.js +35 -0
  54. package/dist/connectors/fixtureRecorder.js.map +1 -0
  55. package/dist/connectors/github.d.ts +58 -8
  56. package/dist/connectors/github.js +312 -84
  57. package/dist/connectors/github.js.map +1 -1
  58. package/dist/connectors/gmail.d.ts +4 -1
  59. package/dist/connectors/gmail.js +79 -16
  60. package/dist/connectors/gmail.js.map +1 -1
  61. package/dist/connectors/googleCalendar.d.ts +60 -0
  62. package/dist/connectors/googleCalendar.js +345 -0
  63. package/dist/connectors/googleCalendar.js.map +1 -0
  64. package/dist/connectors/hubspot.d.ts +112 -0
  65. package/dist/connectors/hubspot.js +408 -0
  66. package/dist/connectors/hubspot.js.map +1 -0
  67. package/dist/connectors/intercom.d.ts +102 -0
  68. package/dist/connectors/intercom.js +402 -0
  69. package/dist/connectors/intercom.js.map +1 -0
  70. package/dist/connectors/jira.d.ts +98 -0
  71. package/dist/connectors/jira.js +379 -0
  72. package/dist/connectors/jira.js.map +1 -0
  73. package/dist/connectors/linear.d.ts +69 -19
  74. package/dist/connectors/linear.js +170 -129
  75. package/dist/connectors/linear.js.map +1 -1
  76. package/dist/connectors/mcpClient.d.ts +56 -0
  77. package/dist/connectors/mcpClient.js +189 -0
  78. package/dist/connectors/mcpClient.js.map +1 -0
  79. package/dist/connectors/mcpOAuth.d.ts +84 -0
  80. package/dist/connectors/mcpOAuth.js +389 -0
  81. package/dist/connectors/mcpOAuth.js.map +1 -0
  82. package/dist/connectors/mockConnector.d.ts +28 -0
  83. package/dist/connectors/mockConnector.js +81 -0
  84. package/dist/connectors/mockConnector.js.map +1 -0
  85. package/dist/connectors/notion.d.ts +143 -0
  86. package/dist/connectors/notion.js +424 -0
  87. package/dist/connectors/notion.js.map +1 -0
  88. package/dist/connectors/sentry.d.ts +17 -21
  89. package/dist/connectors/sentry.js +115 -131
  90. package/dist/connectors/sentry.js.map +1 -1
  91. package/dist/connectors/slack.d.ts +50 -0
  92. package/dist/connectors/slack.js +324 -0
  93. package/dist/connectors/slack.js.map +1 -0
  94. package/dist/connectors/stripe.d.ts +116 -0
  95. package/dist/connectors/stripe.js +379 -0
  96. package/dist/connectors/stripe.js.map +1 -0
  97. package/dist/connectors/tokenStorage.d.ts +35 -0
  98. package/dist/connectors/tokenStorage.js +459 -0
  99. package/dist/connectors/tokenStorage.js.map +1 -0
  100. package/dist/connectors/zendesk.d.ts +104 -0
  101. package/dist/connectors/zendesk.js +424 -0
  102. package/dist/connectors/zendesk.js.map +1 -0
  103. package/dist/drivers/gemini/index.d.ts +5 -1
  104. package/dist/drivers/gemini/index.js +39 -5
  105. package/dist/drivers/gemini/index.js.map +1 -1
  106. package/dist/drivers/index.d.ts +5 -0
  107. package/dist/drivers/index.js +1 -1
  108. package/dist/drivers/index.js.map +1 -1
  109. package/dist/featureFlags.d.ts +73 -0
  110. package/dist/featureFlags.js +203 -0
  111. package/dist/featureFlags.js.map +1 -0
  112. package/dist/fp/automationInterpreter.js +1 -0
  113. package/dist/fp/automationInterpreter.js.map +1 -1
  114. package/dist/fp/automationProgram.d.ts +1 -1
  115. package/dist/fp/automationProgram.js.map +1 -1
  116. package/dist/fp/policyParser.js +17 -0
  117. package/dist/fp/policyParser.js.map +1 -1
  118. package/dist/index.js +621 -61
  119. package/dist/index.js.map +1 -1
  120. package/dist/installGuard.d.ts +25 -0
  121. package/dist/installGuard.js +48 -0
  122. package/dist/installGuard.js.map +1 -0
  123. package/dist/oauth.d.ts +4 -1
  124. package/dist/oauth.js +50 -14
  125. package/dist/oauth.js.map +1 -1
  126. package/dist/patchworkConfig.d.ts +9 -0
  127. package/dist/patchworkConfig.js.map +1 -1
  128. package/dist/recipeOrchestration.d.ts +53 -0
  129. package/dist/recipeOrchestration.js +272 -0
  130. package/dist/recipeOrchestration.js.map +1 -0
  131. package/dist/recipes/RecipeOrchestrator.d.ts +40 -0
  132. package/dist/recipes/RecipeOrchestrator.js +51 -0
  133. package/dist/recipes/RecipeOrchestrator.js.map +1 -0
  134. package/dist/recipes/agentExecutor.d.ts +28 -0
  135. package/dist/recipes/agentExecutor.js +42 -0
  136. package/dist/recipes/agentExecutor.js.map +1 -0
  137. package/dist/recipes/chainedRunner.d.ts +140 -0
  138. package/dist/recipes/chainedRunner.js +539 -0
  139. package/dist/recipes/chainedRunner.js.map +1 -0
  140. package/dist/recipes/dependencyGraph.d.ts +39 -0
  141. package/dist/recipes/dependencyGraph.js +199 -0
  142. package/dist/recipes/dependencyGraph.js.map +1 -0
  143. package/dist/recipes/legacyRecipeCompat.d.ts +2 -0
  144. package/dist/recipes/legacyRecipeCompat.js +112 -0
  145. package/dist/recipes/legacyRecipeCompat.js.map +1 -0
  146. package/dist/recipes/manifest.d.ts +47 -0
  147. package/dist/recipes/manifest.js +141 -0
  148. package/dist/recipes/manifest.js.map +1 -0
  149. package/dist/recipes/nestedRecipeStep.d.ts +58 -0
  150. package/dist/recipes/nestedRecipeStep.js +95 -0
  151. package/dist/recipes/nestedRecipeStep.js.map +1 -0
  152. package/dist/recipes/outputRegistry.d.ts +28 -0
  153. package/dist/recipes/outputRegistry.js +52 -0
  154. package/dist/recipes/outputRegistry.js.map +1 -0
  155. package/dist/recipes/scheduler.d.ts +23 -7
  156. package/dist/recipes/scheduler.js +131 -41
  157. package/dist/recipes/scheduler.js.map +1 -1
  158. package/dist/recipes/schema.d.ts +17 -2
  159. package/dist/recipes/schemaGenerator.d.ts +28 -0
  160. package/dist/recipes/schemaGenerator.js +565 -0
  161. package/dist/recipes/schemaGenerator.js.map +1 -0
  162. package/dist/recipes/templateEngine.d.ts +62 -0
  163. package/dist/recipes/templateEngine.js +182 -0
  164. package/dist/recipes/templateEngine.js.map +1 -0
  165. package/dist/recipes/toolRegistry.d.ts +181 -0
  166. package/dist/recipes/toolRegistry.js +300 -0
  167. package/dist/recipes/toolRegistry.js.map +1 -0
  168. package/dist/recipes/tools/calendar.d.ts +6 -0
  169. package/dist/recipes/tools/calendar.js +61 -0
  170. package/dist/recipes/tools/calendar.js.map +1 -0
  171. package/dist/recipes/tools/confluence.d.ts +6 -0
  172. package/dist/recipes/tools/confluence.js +254 -0
  173. package/dist/recipes/tools/confluence.js.map +1 -0
  174. package/dist/recipes/tools/datadog.d.ts +6 -0
  175. package/dist/recipes/tools/datadog.js +239 -0
  176. package/dist/recipes/tools/datadog.js.map +1 -0
  177. package/dist/recipes/tools/diagnostics.d.ts +6 -0
  178. package/dist/recipes/tools/diagnostics.js +36 -0
  179. package/dist/recipes/tools/diagnostics.js.map +1 -0
  180. package/dist/recipes/tools/file.d.ts +6 -0
  181. package/dist/recipes/tools/file.js +170 -0
  182. package/dist/recipes/tools/file.js.map +1 -0
  183. package/dist/recipes/tools/git.d.ts +6 -0
  184. package/dist/recipes/tools/git.js +63 -0
  185. package/dist/recipes/tools/git.js.map +1 -0
  186. package/dist/recipes/tools/github.d.ts +6 -0
  187. package/dist/recipes/tools/github.js +91 -0
  188. package/dist/recipes/tools/github.js.map +1 -0
  189. package/dist/recipes/tools/gmail.d.ts +6 -0
  190. package/dist/recipes/tools/gmail.js +210 -0
  191. package/dist/recipes/tools/gmail.js.map +1 -0
  192. package/dist/recipes/tools/hubspot.d.ts +6 -0
  193. package/dist/recipes/tools/hubspot.js +232 -0
  194. package/dist/recipes/tools/hubspot.js.map +1 -0
  195. package/dist/recipes/tools/index.d.ts +22 -0
  196. package/dist/recipes/tools/index.js +25 -0
  197. package/dist/recipes/tools/index.js.map +1 -0
  198. package/dist/recipes/tools/intercom.d.ts +6 -0
  199. package/dist/recipes/tools/intercom.js +226 -0
  200. package/dist/recipes/tools/intercom.js.map +1 -0
  201. package/dist/recipes/tools/linear.d.ts +6 -0
  202. package/dist/recipes/tools/linear.js +83 -0
  203. package/dist/recipes/tools/linear.js.map +1 -0
  204. package/dist/recipes/tools/notion.d.ts +6 -0
  205. package/dist/recipes/tools/notion.js +278 -0
  206. package/dist/recipes/tools/notion.js.map +1 -0
  207. package/dist/recipes/tools/slack.d.ts +6 -0
  208. package/dist/recipes/tools/slack.js +72 -0
  209. package/dist/recipes/tools/slack.js.map +1 -0
  210. package/dist/recipes/tools/stripe.d.ts +6 -0
  211. package/dist/recipes/tools/stripe.js +265 -0
  212. package/dist/recipes/tools/stripe.js.map +1 -0
  213. package/dist/recipes/tools/zendesk.d.ts +6 -0
  214. package/dist/recipes/tools/zendesk.js +245 -0
  215. package/dist/recipes/tools/zendesk.js.map +1 -0
  216. package/dist/recipes/validation.d.ts +13 -0
  217. package/dist/recipes/validation.js +433 -0
  218. package/dist/recipes/validation.js.map +1 -0
  219. package/dist/recipes/yamlRunner.d.ts +87 -0
  220. package/dist/recipes/yamlRunner.js +693 -409
  221. package/dist/recipes/yamlRunner.js.map +1 -1
  222. package/dist/recipesHttp.d.ts +34 -6
  223. package/dist/recipesHttp.js +285 -15
  224. package/dist/recipesHttp.js.map +1 -1
  225. package/dist/riskTier.js +1 -0
  226. package/dist/riskTier.js.map +1 -1
  227. package/dist/runLog.d.ts +23 -0
  228. package/dist/runLog.js +56 -1
  229. package/dist/runLog.js.map +1 -1
  230. package/dist/schemas/dry-run-plan.v1.json +139 -0
  231. package/dist/schemas/recipe.v1.json +684 -0
  232. package/dist/server.d.ts +32 -1
  233. package/dist/server.js +980 -97
  234. package/dist/server.js.map +1 -1
  235. package/dist/streamableHttp.js +2 -0
  236. package/dist/streamableHttp.js.map +1 -1
  237. package/dist/tools/addLinearComment.d.ts +55 -0
  238. package/dist/tools/addLinearComment.js +72 -0
  239. package/dist/tools/addLinearComment.js.map +1 -0
  240. package/dist/tools/bridgeDoctor.js +2 -2
  241. package/dist/tools/bridgeDoctor.js.map +1 -1
  242. package/dist/tools/createLinearIssue.d.ts +84 -0
  243. package/dist/tools/createLinearIssue.js +146 -0
  244. package/dist/tools/createLinearIssue.js.map +1 -0
  245. package/dist/tools/fetchCalendarEvents.d.ts +94 -0
  246. package/dist/tools/fetchCalendarEvents.js +97 -0
  247. package/dist/tools/fetchCalendarEvents.js.map +1 -0
  248. package/dist/tools/fetchGithubIssue.d.ts +80 -0
  249. package/dist/tools/fetchGithubIssue.js +84 -0
  250. package/dist/tools/fetchGithubIssue.js.map +1 -0
  251. package/dist/tools/fetchGithubPR.d.ts +89 -0
  252. package/dist/tools/fetchGithubPR.js +96 -0
  253. package/dist/tools/fetchGithubPR.js.map +1 -0
  254. package/dist/tools/fetchSlackProfile.d.ts +43 -0
  255. package/dist/tools/fetchSlackProfile.js +46 -0
  256. package/dist/tools/fetchSlackProfile.js.map +1 -0
  257. package/dist/tools/getConnectorStatus.d.ts +58 -0
  258. package/dist/tools/getConnectorStatus.js +56 -0
  259. package/dist/tools/getConnectorStatus.js.map +1 -0
  260. package/dist/tools/github/actions.js +4 -2
  261. package/dist/tools/github/actions.js.map +1 -1
  262. package/dist/tools/github/composite.d.ts +339 -0
  263. package/dist/tools/github/composite.js +343 -0
  264. package/dist/tools/github/composite.js.map +1 -0
  265. package/dist/tools/github/index.d.ts +2 -1
  266. package/dist/tools/github/index.js +2 -1
  267. package/dist/tools/github/index.js.map +1 -1
  268. package/dist/tools/github/issues.js +8 -4
  269. package/dist/tools/github/issues.js.map +1 -1
  270. package/dist/tools/github/pr.d.ts +122 -0
  271. package/dist/tools/github/pr.js +195 -5
  272. package/dist/tools/github/pr.js.map +1 -1
  273. package/dist/tools/index.js +32 -1
  274. package/dist/tools/index.js.map +1 -1
  275. package/dist/tools/searchTools.js +1 -1
  276. package/dist/tools/searchTools.js.map +1 -1
  277. package/dist/tools/slackListChannels.d.ts +65 -0
  278. package/dist/tools/slackListChannels.js +70 -0
  279. package/dist/tools/slackListChannels.js.map +1 -0
  280. package/dist/tools/slackPostMessage.d.ts +57 -0
  281. package/dist/tools/slackPostMessage.js +77 -0
  282. package/dist/tools/slackPostMessage.js.map +1 -0
  283. package/dist/tools/testTraceToSource.js +2 -2
  284. package/dist/tools/testTraceToSource.js.map +1 -1
  285. package/dist/tools/updateLinearIssue.d.ts +89 -0
  286. package/dist/tools/updateLinearIssue.js +117 -0
  287. package/dist/tools/updateLinearIssue.js.map +1 -0
  288. package/dist/transport.d.ts +7 -1
  289. package/dist/transport.js +85 -11
  290. package/dist/transport.js.map +1 -1
  291. package/package.json +5 -2
  292. package/scripts/start-all.sh +56 -19
  293. package/templates/automation-policies/recipe-authoring.json +25 -0
  294. package/templates/automation-policy.example.json +6 -0
  295. package/templates/co.patchwork-os.bridge.plist +34 -0
  296. package/templates/recipes/ctx-loop-test.yaml +75 -0
  297. package/templates/recipes/lint-on-save.yaml +1 -2
  298. package/templates/recipes/morning-brief-slack.yaml +57 -0
  299. package/templates/recipes/morning-brief.yaml +14 -6
  300. package/templates/recipes/project-health-check.yaml +50 -0
  301. package/templates/recipes/sentry-to-linear.yaml +77 -0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- # Full orchestrator for bridge + claude + remote-control.
3
- # Manages all three in tmux panes with health monitoring.
2
+ # Full orchestrator for bridge + claude + remote-control + dashboard.
3
+ # Manages all processes in tmux panes with health monitoring.
4
4
  #
5
5
  # Pane layout:
6
6
  # 0 — health monitor (orchestrator)
@@ -8,7 +8,8 @@
8
8
  # 2 — claude --ide (Claude Code CLI, connects to bridge for IDE tools)
9
9
  # 3 — claude remote-control --spawn=session (exposes the workspace to claude.ai;
10
10
  # spawned sessions auto-discover the bridge via ~/.claude/ide/*.lock)
11
- # 4 — SSH reverse tunnel to VPS (optional, enabled with --vps <user@host:port>)
11
+ # 4 — Patchwork dashboard (Next.js, http://localhost:3200)
12
+ # 5 — SSH reverse tunnel to VPS (optional, enabled with --vps <user@host:port>)
12
13
  # Forwards VPS_PORT on the remote host back to the local bridge port.
13
14
  # Allows claude.ai integrations to use a static VPS URL instead of a
14
15
  # rotating remote-control session URL.
@@ -20,6 +21,8 @@
20
21
  # Options:
21
22
  # --workspace <path> Directory to open in Claude (default: current directory)
22
23
  # --full Register all ~95 bridge tools (git, terminal, file ops, HTTP, GitHub).
24
+ # --no-dashboard Skip starting the Patchwork dashboard (pane 4).
25
+ # --dashboard-port <N> Dashboard port (default: 3200).
23
26
  # Default is slim mode (27 IDE-exclusive tools). Add --full if your
24
27
  # workflow requires git/terminal/file tools.
25
28
  # --notify <topic> Push notifications via ntfy.sh when remote-control connects or
@@ -48,6 +51,8 @@ NTFY_TOPIC=""
48
51
  IDE_NAME=""
49
52
  VPS=""
50
53
  FULL_MODE=""
54
+ NO_DASHBOARD=""
55
+ DASHBOARD_PORT="3200"
51
56
  AUTOMATION_POLICY=""
52
57
  CLAUDE_DRIVER="subprocess"
53
58
  BRIDGE_READY_TIMEOUT="${BRIDGE_READY_TIMEOUT:-30}"
@@ -64,6 +69,8 @@ while [[ $# -gt 0 ]]; do
64
69
  --ide) IDE_NAME="$2"; shift 2 ;;
65
70
  --vps) VPS="$2"; shift 2 ;;
66
71
  --full) FULL_MODE="--full"; shift ;;
72
+ --no-dashboard) NO_DASHBOARD=1; shift ;;
73
+ --dashboard-port) DASHBOARD_PORT="$2"; shift 2 ;;
67
74
  --automation-policy) AUTOMATION_POLICY="$2"; shift 2 ;;
68
75
  --claude-driver) CLAUDE_DRIVER="$2"; shift 2 ;;
69
76
  *) echo "Unknown option: $1" >&2; exit 1 ;;
@@ -90,23 +97,31 @@ fi
90
97
 
91
98
  # --- Bridge conflict check ---
92
99
  # Detect an already-running bridge instance and abort early with a clear message.
93
- # Iterates lock files safely (no xargs injection); filters to isBridge:true + live PID.
100
+ # Validates: isBridge:true + live PID + process is actually a bridge (not Windsurf reusing PID)
101
+ # by checking whether the lock file's port has an active listener.
94
102
  while IFS= read -r lock; do
95
103
  [[ -f "$lock" ]] || continue
96
- bridge_pid=$(python3 -c "
104
+ lock_info=$(python3 -c "
97
105
  import json, sys
98
106
  try:
99
107
  d = json.load(open(sys.argv[1]))
100
108
  if d.get('isBridge') is True:
101
- print(d.get('pid', ''))
109
+ print(d.get('pid', ''), d.get('port', ''))
102
110
  except Exception:
103
111
  pass
104
112
  " "$lock" 2>/dev/null || true)
113
+ bridge_pid="${lock_info%% *}"
114
+ bridge_port="${lock_info##* }"
105
115
  if [[ -n "$bridge_pid" ]] && kill -0 "$bridge_pid" 2>/dev/null; then
106
- echo "Error: bridge already running (PID $bridge_pid, lock: $(basename "$lock"))." >&2
107
- echo " Stop it first: kill $bridge_pid" >&2
108
- echo " Or kill the tmux session: tmux kill-session -t claude-all" >&2
109
- exit 1
116
+ # Cross-check: verify a process is actually listening on the lock's port.
117
+ # Windsurf may reuse PIDs from stale locks — if nothing listens on that port,
118
+ # the bridge is not actually running.
119
+ if [[ -n "$bridge_port" ]] && lsof -i ":${bridge_port}" 2>/dev/null | grep -q LISTEN; then
120
+ echo "Error: bridge already running (PID $bridge_pid, port $bridge_port, lock: $(basename "$lock"))." >&2
121
+ echo " Stop it first: kill $bridge_pid" >&2
122
+ echo " Or kill the tmux session: tmux kill-session -t claude-all" >&2
123
+ exit 1
124
+ fi
110
125
  fi
111
126
  done < <(ls ~/.claude/ide/*.lock 2>/dev/null)
112
127
 
@@ -141,6 +156,7 @@ echo "=== Claude IDE Bridge Full Orchestrator ==="
141
156
  echo " Ctrl+C in any pane — stops that process"
142
157
  echo " Ctrl+B then D (press Ctrl+B, release, then press D) — detach (keeps running)"
143
158
  echo " tmux kill-session -t $SESSION — stop everything"
159
+ [[ -z "$NO_DASHBOARD" ]] && echo " Dashboard: http://localhost:${DASHBOARD_PORT}"
144
160
  [[ -n "$NTFY_TOPIC" ]] && echo " Push notifications: ntfy.sh/$NTFY_TOPIC"
145
161
  if [[ -z "$FULL_MODE" ]]; then
146
162
  echo ""
@@ -276,11 +292,12 @@ while true; do
276
292
  sleep \$delay
277
293
  done'"
278
294
 
279
- # --- Create additional panes (pane 0 = orchestrator, 1 = bridge, 2 = claude, 3 = remote-control, 4 = ssh tunnel) ---
295
+ # --- Create additional panes (pane 0 = orchestrator, 1 = bridge, 2 = claude, 3 = remote-control, 4 = dashboard, 5 = ssh tunnel) ---
280
296
  tmux split-window -v -t "$SESSION" # pane 1 for bridge
281
297
  tmux split-window -v -t "$SESSION" # pane 2 for claude --ide
282
298
  tmux split-window -v -t "$SESSION" # pane 3 for claude remote-control
283
- [[ -n "$TUNNEL_CMD" ]] && tmux split-window -v -t "$SESSION" # pane 4 for ssh tunnel (optional)
299
+ [[ -z "$NO_DASHBOARD" ]] && tmux split-window -v -t "$SESSION" # pane 4 for dashboard (optional)
300
+ [[ -n "$TUNNEL_CMD" ]] && tmux split-window -v -t "$SESSION" # pane 5 for ssh tunnel (optional)
284
301
  tmux select-layout -t "$SESSION" even-vertical
285
302
 
286
303
  # --- Helper: wait for a NEW lock file (ignores pre-existing ones) ---
@@ -359,10 +376,20 @@ sleep 3
359
376
  # Pane 3: Remote control with auto-restart loop
360
377
  tmux send-keys -t "${SESSION}:0.3" "$REMOTE_CMD" Enter
361
378
 
362
- # Pane 4: SSH reverse tunnel (only if --vps was set)
379
+ # Pane 4: Dashboard (only if not --no-dashboard and dashboard dir exists)
380
+ DASHBOARD_DIR="$BRIDGE_DIR/dashboard"
381
+ if [[ -z "$NO_DASHBOARD" ]] && [[ -d "$DASHBOARD_DIR" ]]; then
382
+ BRIDGE_PORT=$(basename "$LOCK_FILE" .lock)
383
+ DASHBOARD_CMD="cd $(printf '%q' "$DASHBOARD_DIR") && PATCHWORK_BRIDGE_PORT=${BRIDGE_PORT} npm run dev"
384
+ notify "Starting dashboard on http://localhost:${DASHBOARD_PORT}"
385
+ tmux send-keys -t "${SESSION}:0.4" "$DASHBOARD_CMD" Enter
386
+ fi
387
+
388
+ # Pane 5: SSH reverse tunnel (only if --vps was set)
363
389
  if [[ -n "$TUNNEL_CMD" ]]; then
364
390
  notify "Starting SSH tunnel to ${VPS}..."
365
- tmux send-keys -t "${SESSION}:0.4" "$TUNNEL_CMD" Enter
391
+ TUNNEL_PANE=$([[ -z "$NO_DASHBOARD" ]] && echo 5 || echo 4)
392
+ tmux send-keys -t "${SESSION}:0.${TUNNEL_PANE}" "$TUNNEL_CMD" Enter
366
393
  fi
367
394
 
368
395
  # --- Health monitor (runs in pane 0 — the orchestrator pane) ---
@@ -377,10 +404,12 @@ cleanup() {
377
404
  tmux send-keys -t "${SESSION}:0.1" C-c 2>/dev/null
378
405
  tmux send-keys -t "${SESSION}:0.2" C-c 2>/dev/null
379
406
  tmux send-keys -t "${SESSION}:0.3" C-c 2>/dev/null
380
- [[ -n "$TUNNEL_CMD" ]] && tmux send-keys -t "${SESSION}:0.4" C-c 2>/dev/null
407
+ [[ -z "$NO_DASHBOARD" ]] && tmux send-keys -t "${SESSION}:0.4" C-c 2>/dev/null
408
+ [[ -n "$TUNNEL_CMD" ]] && tmux send-keys -t "${SESSION}:0.${TUNNEL_PANE:-4}" C-c 2>/dev/null
381
409
  # Wait up to 5s for panes to exit gracefully, then force-kill
382
410
  local panes=(1 2 3)
383
- [[ -n "$TUNNEL_CMD" ]] && panes=(1 2 3 4)
411
+ [[ -z "$NO_DASHBOARD" ]] && panes=(1 2 3 4)
412
+ [[ -n "$TUNNEL_CMD" ]] && panes=("${panes[@]}" "${TUNNEL_PANE:-4}")
384
413
  for _ in $(seq 1 5); do
385
414
  sleep 1
386
415
  all_idle=true
@@ -396,7 +425,8 @@ cleanup() {
396
425
  done
397
426
  sleep 1
398
427
  local rpanes=(3 2 1)
399
- [[ -n "$TUNNEL_CMD" ]] && rpanes=(4 3 2 1)
428
+ [[ -z "$NO_DASHBOARD" ]] && rpanes=(4 3 2 1)
429
+ [[ -n "$TUNNEL_CMD" ]] && rpanes=("${TUNNEL_PANE:-4}" "${rpanes[@]}")
400
430
  for pane in "${rpanes[@]}"; do
401
431
  tmux kill-pane -t "${SESSION}:0.${pane}" 2>/dev/null || true
402
432
  done
@@ -413,7 +443,8 @@ while true; do
413
443
  tmux send-keys -t "${SESSION}:0.1" C-c
414
444
  tmux send-keys -t "${SESSION}:0.2" C-c
415
445
  tmux send-keys -t "${SESSION}:0.3" C-c
416
- [[ -n "$TUNNEL_CMD" ]] && tmux send-keys -t "${SESSION}:0.4" C-c
446
+ [[ -z "$NO_DASHBOARD" ]] && tmux send-keys -t "${SESSION}:0.4" C-c
447
+ [[ -n "$TUNNEL_CMD" ]] && tmux send-keys -t "${SESSION}:0.${TUNNEL_PANE:-4}" C-c
417
448
  # Wait for bridge (pane 1) and claude (pane 2) to actually stop
418
449
  for _ in $(seq 1 10); do
419
450
  pane1_cmd=$(tmux display-message -t "${SESSION}:0.1" -p '#{pane_current_command}' 2>/dev/null || echo "")
@@ -476,9 +507,15 @@ while true; do
476
507
  sleep 3
477
508
  # Restart remote-control
478
509
  tmux send-keys -t "${SESSION}:0.3" "$REMOTE_CMD" Enter
510
+ # Restart dashboard with updated bridge port
511
+ if [[ -z "$NO_DASHBOARD" ]] && [[ -d "$DASHBOARD_DIR" ]]; then
512
+ NEW_BRIDGE_PORT=$(basename "$LOCK_FILE" .lock)
513
+ DASHBOARD_CMD="cd $(printf '%q' "$DASHBOARD_DIR") && PATCHWORK_BRIDGE_PORT=${NEW_BRIDGE_PORT} npm run dev"
514
+ tmux send-keys -t "${SESSION}:0.4" "$DASHBOARD_CMD" Enter
515
+ fi
479
516
  # Restart SSH tunnel (port may have changed — tunnel cmd reads lock file dynamically)
480
517
  if [[ -n "$TUNNEL_CMD" ]]; then
481
- tmux send-keys -t "${SESSION}:0.4" "$TUNNEL_CMD" Enter
518
+ tmux send-keys -t "${SESSION}:0.${TUNNEL_PANE:-4}" "$TUNNEL_CMD" Enter
482
519
  fi
483
520
  notify "All processes restarted"
484
521
  else
@@ -0,0 +1,25 @@
1
+ {
2
+ "_comment": "recipe-authoring — runs preflight automatically when a .yaml recipe file is saved. Closes the authoring inner loop: edit → save → instant validation feedback via Claude task.",
3
+ "_usage": "Copy to automation-policy.json. Requires --automation --automation-policy <path> --claude-driver subprocess",
4
+
5
+ "automationSystemPrompt": "Recipe lint bot. ≤10 lines. No preamble. List issues with file:line if available. End with 'Recipe OK' when clean.",
6
+
7
+ "onRecipeSave": {
8
+ "enabled": true,
9
+ "cooldownMs": 10000
10
+ },
11
+
12
+ "onFileSave": {
13
+ "enabled": false,
14
+ "_comment": "Disabled — onRecipeSave handles .yaml files. Enable this for non-recipe YAML if needed.",
15
+ "patterns": ["**/*.yaml", "**/*.yml"],
16
+ "cooldownMs": 10000,
17
+ "prompt": "{{file}} saved. getDiagnostics → report issues ≤5 lines."
18
+ },
19
+
20
+ "onGitCommit": {
21
+ "enabled": true,
22
+ "cooldownMs": 15000,
23
+ "prompt": "Committed recipes on {{branch}}: {{files}}\nFor each modified .yaml file: run preflight and report any issues. If all pass, reply 'All recipes OK'."
24
+ }
25
+ }
@@ -20,6 +20,12 @@
20
20
  "cooldownMs": 10000
21
21
  },
22
22
 
23
+ "onRecipeSave": {
24
+ "enabled": false,
25
+ "_comment": "Fires when any .yaml/.yml file is saved. No prompt needed — default runs patchwork recipe preflight and reports issues. Enable when authoring recipes.",
26
+ "cooldownMs": 10000
27
+ },
28
+
23
29
  "onDiagnosticsError": {
24
30
  "enabled": true,
25
31
  "minSeverity": "error",
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
3
+ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
4
+ <plist version="1.0">
5
+ <dict>
6
+ <key>Label</key>
7
+ <string>co.patchwork-os.bridge</string>
8
+ <key>ProgramArguments</key>
9
+ <array>
10
+ <string>__BINARY_PATH__</string>
11
+ <string>--claude-driver</string>
12
+ <string>subprocess</string>
13
+ </array>
14
+ <key>RunAtLoad</key>
15
+ <true/>
16
+ <key>KeepAlive</key>
17
+ <true/>
18
+ <key>StandardOutPath</key>
19
+ <string>__HOME__/Library/Logs/patchwork-os/bridge.log</string>
20
+ <key>StandardErrorPath</key>
21
+ <string>__HOME__/Library/Logs/patchwork-os/bridge.err</string>
22
+ <key>EnvironmentVariables</key>
23
+ <dict>
24
+ <key>HOME</key>
25
+ <string>__HOME__</string>
26
+ <key>PATH</key>
27
+ <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
28
+ </dict>
29
+ <key>WorkingDirectory</key>
30
+ <string>__HOME__</string>
31
+ <key>ThrottleInterval</key>
32
+ <integer>30</integer>
33
+ </dict>
34
+ </plist>
@@ -0,0 +1,75 @@
1
+ name: ctx-loop-test
2
+ description: |
3
+ End-to-end test of the agent-read loop. An agent writes a decision trace with
4
+ ctxSaveTrace, then reads it back with ctxQueryTraces, and confirms the trace
5
+ appears in the result. Output lands in ~/.patchwork/inbox/ for manual inspection.
6
+ Run this after deploying a new bridge build to confirm the memory moat is live.
7
+
8
+ NOTE: requires --claude-driver subprocess and a running bridge with HTTP port
9
+ so the agent subprocess has MCP access. Running via `patchwork recipe run`
10
+ (local yamlRunner) will fail at Step 1 — the local claude -p subprocess has
11
+ no bridge MCP context. Trigger from the dashboard Recipes page instead.
12
+ trigger:
13
+ type: manual
14
+ steps:
15
+ - tool: git.log_since
16
+ since: 1h
17
+ into: recent_commits
18
+
19
+ - agent:
20
+ prompt: |
21
+ You are validating the Patchwork cross-session memory loop end-to-end.
22
+
23
+ RECENT COMMITS (context only):
24
+ {{recent_commits}}
25
+
26
+ Perform the following steps IN ORDER. Stop immediately if any step fails and
27
+ report the failure clearly in your output.
28
+
29
+ ## Step 1 — Write a trace
30
+ Call ctxSaveTrace with these exact values:
31
+ ref: "ctx-loop-test-{{date}}"
32
+ problem: "Validating that ctxSaveTrace persists traces readable by future sessions"
33
+ solution: "ctxSaveTrace writes to decision_traces.jsonl; ctxQueryTraces reads it back"
34
+ tags: ["loop-test", "dogfood"]
35
+
36
+ Record the returned `seq` number.
37
+
38
+ ## Step 2 — Read it back
39
+ Call ctxQueryTraces with:
40
+ traceType: "decision"
41
+ limit: 5
42
+
43
+ Check that the trace you just wrote (ref "ctx-loop-test-{{date}}") appears in
44
+ the results. If it does, the loop is confirmed closed.
45
+
46
+ ## Step 3 — Write your report
47
+ Output a markdown block in this exact format:
48
+
49
+ ```
50
+ # ctx-loop-test — {{date}} {{time}}
51
+
52
+ ## Result: PASS / FAIL
53
+
54
+ ### Step 1 — ctxSaveTrace
55
+ - seq: <returned seq>
56
+ - ref: ctx-loop-test-{{date}}
57
+ - Status: OK / ERROR: <message>
58
+
59
+ ### Step 2 — ctxQueryTraces
60
+ - Traces returned: <count>
61
+ - Test trace found: yes / no
62
+ - Status: OK / ERROR: <message>
63
+
64
+ ### Verdict
65
+ <one sentence summary>
66
+ ```
67
+
68
+ Output ONLY the markdown block. No preamble.
69
+ driver: claude-code
70
+ model: claude-haiku-4-5-20251001
71
+ into: report
72
+
73
+ - tool: file.write
74
+ path: ~/.patchwork/inbox/ctx-loop-test-{{date}}.md
75
+ content: "{{report}}\n"
@@ -9,5 +9,4 @@ steps:
9
9
  into: diags
10
10
  - tool: file.append
11
11
  path: ~/.patchwork/inbox/lint.md
12
- content: "- {{time}} {{file}} — {{diags.errors}} errors, {{diags.warnings}} warnings\n"
13
- when: "{{diags.errors}} > 0 || {{diags.warnings}} > 0"
12
+ content: "- {{time}} {{file}} — {{diags}}\n"
@@ -0,0 +1,57 @@
1
+ name: morning-brief-slack
2
+ description: Daily morning brief combining calendar, GitHub PRs, and Linear issues — posted to Slack.
3
+ trigger:
4
+ type: cron
5
+ at: "0 8 * * 1-5"
6
+ steps:
7
+ - tool: github.list_prs
8
+ author: "@me"
9
+ max: 10
10
+ into: prs
11
+ - tool: linear.list_issues
12
+ assignee: "@me"
13
+ state: "started,unstarted"
14
+ max: 15
15
+ into: linear_issues
16
+ - tool: calendar.list_events
17
+ days_ahead: 1
18
+ max: 10
19
+ into: calendar
20
+ - agent:
21
+ prompt: |
22
+ You are a personal assistant writing a concise morning brief. Use ONLY the data provided below — do not call any tools or fetch additional information.
23
+
24
+ OPEN PULL REQUESTS (authored by me):
25
+ {{prs}}
26
+
27
+ LINEAR ISSUES (assigned to me, in progress or unstarted):
28
+ {{linear_issues}}
29
+
30
+ TODAY'S CALENDAR EVENTS:
31
+ {{calendar}}
32
+
33
+ Write a short morning brief for Slack. Rules:
34
+ - Plain text only. No markdown headers (no # or ## lines). No code blocks.
35
+ - Use emoji to start each section.
36
+ - Do NOT include a title or greeting line like "Morning Brief" or "Good morning" — start directly with the first section.
37
+
38
+ 📅 *Calendar* — list today's meetings with time; write "No meetings today" if empty or error
39
+ 🔀 *Pull Requests* — list open PRs needing attention; omit section entirely if empty
40
+ 📋 *Linear* — list in-progress and unstarted issues by priority; omit section entirely if empty or error
41
+
42
+ Keep it under 15 lines. Be direct. Output only the brief, nothing else.
43
+ driver: claude-code
44
+ model: claude-haiku-4-5-20251001
45
+ into: brief
46
+ - tool: file.write
47
+ path: ~/.patchwork/inbox/morning-brief-{{date}}.md
48
+ content: |
49
+ # Morning brief — {{date}}
50
+
51
+ {{brief}}
52
+ - tool: slack.post_message
53
+ channel: all-massappealdesigns
54
+ text: |
55
+ *Morning Brief — {{date}}*
56
+
57
+ {{brief}}
@@ -1,5 +1,5 @@
1
1
  name: morning-brief
2
- description: Daily morning brief combining unread emails, recent git activity, and open GitHub issues.
2
+ description: Daily morning brief combining unread emails, calendar, recent git activity, and open GitHub issues.
3
3
  trigger:
4
4
  type: cron
5
5
  at: "0 8 * * 1-5"
@@ -24,6 +24,10 @@ steps:
24
24
  state: "started,unstarted"
25
25
  max: 15
26
26
  into: linear_issues
27
+ - tool: calendar.list_events
28
+ days_ahead: 1
29
+ max: 10
30
+ into: calendar
27
31
  - agent:
28
32
  prompt: |
29
33
  You are a personal assistant writing a concise morning brief. Use ONLY the data provided below — do not call any tools or fetch additional information.
@@ -45,16 +49,20 @@ steps:
45
49
  LINEAR ISSUES (assigned to me, in progress or unstarted):
46
50
  {{linear_issues}}
47
51
 
52
+ TODAY'S CALENDAR EVENTS:
53
+ {{calendar}}
54
+
48
55
  Write a morning brief with these sections:
49
56
  1. **Email triage** — list emails needing action today (sender, subject, one-line summary)
50
57
  2. **FYI emails** — informational only, no action needed
51
- 3. **Code activity** — summarize the RECENT GIT COMMITS above; if the list is empty write "No commits in the last 24 hours"
52
- 4. **GitHub** — list open issues and PRs needing attention; omit this section entirely if both lists are empty
53
- 5. **Linear** — list in-progress and unstarted issues by priority; omit this section entirely if the list is empty or returned an error
58
+ 3. **Calendar** — list today's meetings with time and attendees; omit if calendar returned an error or no events
59
+ 4. **Code activity** — summarize the RECENT GIT COMMITS above; if the list is empty write "No commits in the last 24 hours"
60
+ 5. **GitHub** — list open issues and PRs needing attention; omit this section entirely if both lists are empty
61
+ 6. **Linear** — list in-progress and unstarted issues by priority; omit this section entirely if the list is empty or returned an error
54
62
 
55
63
  Be concise. Skip newsletters and automated notifications.
56
- driver: claude-code
57
- model: claude-haiku-4-5-20251001
64
+ # Use claude (not gemini) — Gemini free tier hits daily quota mid-recipe
65
+ driver: claude
58
66
  into: brief
59
67
  - tool: file.write
60
68
  path: ~/.patchwork/inbox/morning-brief-{{date}}.md
@@ -0,0 +1,50 @@
1
+ # yaml-language-server: $schema=https://patchworkos.com/schema/recipe.v1.json
2
+ apiVersion: patchwork.sh/v1
3
+ name: project-health-check
4
+ description: Fetch git activity, open issues, and diagnostics in parallel, then write a health summary.
5
+ trigger:
6
+ type: manual
7
+ maxConcurrency: 4
8
+ steps:
9
+ - id: gather
10
+ parallel:
11
+ - id: commits
12
+ tool: git.log_since
13
+ since: 24h
14
+ - id: issues
15
+ tool: github.list_issues
16
+ assignee: "@me"
17
+ max: 20
18
+ - id: prs
19
+ tool: github.list_prs
20
+ author: "@me"
21
+ max: 10
22
+ - id: summarize
23
+ agent:
24
+ prompt: |
25
+ Write a concise project health summary using ONLY the data below.
26
+
27
+ RECENT COMMITS (last 24h):
28
+ {{commits}}
29
+
30
+ OPEN ISSUES (assigned to me):
31
+ {{issues}}
32
+
33
+ OPEN PULL REQUESTS:
34
+ {{prs}}
35
+
36
+ Sections:
37
+ 1. **Activity** — what shipped or changed in the last 24 hours
38
+ 2. **Issues** — issues needing attention today; omit if empty
39
+ 3. **PRs** — PRs waiting on review or action; omit if empty
40
+ 4. **Health** — one-sentence overall assessment (on track / needs attention / blocked)
41
+ driver: claude
42
+ awaits: [gather]
43
+ - id: write
44
+ tool: file.write
45
+ path: ~/.patchwork/inbox/health-{{date}}.md
46
+ content: |
47
+ # Project health — {{date}}
48
+
49
+ {{summarize}}
50
+ awaits: [summarize]
@@ -0,0 +1,77 @@
1
+ name: sentry-to-linear
2
+ description: |
3
+ Fetch a Sentry issue, enrich it with git blame, and create a triage-ready
4
+ Linear ticket. Requires both Sentry and Linear connectors connected.
5
+ Run ad-hoc or trigger via webhook / automation policy.
6
+
7
+ # Example manual trigger:
8
+ # patchwork-os run-recipe sentry-to-linear --var SENTRY_ISSUE_ID=12345678
9
+ #
10
+ # Example automation trigger (add to ~/.patchwork/automation-policy.json):
11
+ # "onFileSave": { ... } — or fire from a Sentry webhook handler
12
+
13
+ trigger:
14
+ type: manual
15
+ vars:
16
+ - name: SENTRY_ISSUE_ID
17
+ description: "Sentry issue ID or URL (e.g. '12345678' or 'https://sentry.io/...')"
18
+ required: true
19
+ - name: LINEAR_TEAM_KEY
20
+ description: "Linear team key to create the issue in (e.g. 'ENG'). Defaults to first team."
21
+ required: false
22
+ - name: LINEAR_PRIORITY
23
+ description: "Linear priority: 1=urgent, 2=high, 3=medium, 4=low (default: 2)"
24
+ required: false
25
+ default: "2"
26
+
27
+ steps:
28
+ - agent:
29
+ prompt: |
30
+ You are a triage assistant. Your job is to:
31
+ 1. Fetch the Sentry issue using fetchSentryIssue with issueId "{{SENTRY_ISSUE_ID}}"
32
+ 2. Create a Linear issue using createLinearIssue with the data you received
33
+
34
+ For the Linear issue:
35
+ - title: Use the Sentry issue title verbatim
36
+ - description: Write a structured Markdown body with these sections:
37
+ ## Error
38
+ (one-line error type + message from the Sentry title)
39
+
40
+ ## Stack trace
41
+ (the top 5 frames from the stackTrace field, formatted as a code block)
42
+
43
+ ## Suspect commit
44
+ (if topSuspect is present: sha, author, date, subject — otherwise write "No suspect commit identified")
45
+
46
+ ## Confidence
47
+ (the confidence field value + a one-sentence explanation of what it means)
48
+
49
+ ## Sentry link
50
+ (a link back to the Sentry issue — construct from the issueId: https://sentry.io/issues/{{SENTRY_ISSUE_ID}}/)
51
+
52
+ - teamKey: "{{LINEAR_TEAM_KEY}}" (pass as-is; if blank the tool picks the first team)
53
+ - priority: {{LINEAR_PRIORITY}} (as an integer)
54
+ - labelNames: ["bug"]
55
+
56
+ After creating the ticket, respond with ONLY a JSON object:
57
+ {
58
+ "sentryIssueId": "<the issueId from fetchSentryIssue>",
59
+ "sentryTitle": "<the title>",
60
+ "linearIdentifier": "<e.g. ENG-101>",
61
+ "linearUrl": "<the url from createLinearIssue>",
62
+ "confidence": "<high|medium|low>",
63
+ "suspectCommit": "<sha or null>"
64
+ }
65
+
66
+ If either tool returns an error (sentryConnected: false or linearConnected: false),
67
+ respond with the same JSON shape but set linearUrl to "" and add an "error" key
68
+ explaining which connector is not connected.
69
+ driver: claude-code
70
+ model: claude-haiku-4-5-20251001
71
+ into: result
72
+ - tool: file.write
73
+ path: ~/.patchwork/inbox/sentry-to-linear-{{date}}.md
74
+ content: |
75
+ # Sentry → Linear triage ({{date}})
76
+
77
+ {{result}}