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.
- package/README.bridge.md +6 -0
- package/README.md +40 -15
- package/deploy/bootstrap-vps.sh +184 -0
- package/deploy/deploy-dashboard.sh +174 -0
- package/deploy/deploy-landing.sh +79 -0
- package/dist/activationMetrics.d.ts +67 -0
- package/dist/activationMetrics.js +255 -0
- package/dist/activationMetrics.js.map +1 -0
- package/dist/approvalHttp.d.ts +24 -2
- package/dist/approvalHttp.js +150 -10
- package/dist/approvalHttp.js.map +1 -1
- package/dist/approvalQueue.d.ts +16 -1
- package/dist/approvalQueue.js +44 -3
- package/dist/approvalQueue.js.map +1 -1
- package/dist/automation.d.ts +20 -0
- package/dist/automation.js +54 -1
- package/dist/automation.js.map +1 -1
- package/dist/bridge.d.ts +2 -0
- package/dist/bridge.js +55 -130
- package/dist/bridge.js.map +1 -1
- package/dist/bridgeToken.js +57 -19
- package/dist/bridgeToken.js.map +1 -1
- package/dist/ccPermissions.js +6 -4
- package/dist/ccPermissions.js.map +1 -1
- package/dist/claudeOrchestrator.d.ts +1 -1
- package/dist/claudeOrchestrator.js +14 -8
- package/dist/claudeOrchestrator.js.map +1 -1
- package/dist/commands/launchd.d.ts +2 -0
- package/dist/commands/launchd.js +94 -0
- package/dist/commands/launchd.js.map +1 -0
- package/dist/commands/recipe.d.ts +258 -0
- package/dist/commands/recipe.js +1130 -0
- package/dist/commands/recipe.js.map +1 -0
- package/dist/commands/recipeInstall.d.ts +72 -0
- package/dist/commands/recipeInstall.js +339 -0
- package/dist/commands/recipeInstall.js.map +1 -0
- package/dist/config.d.ts +14 -1
- package/dist/config.js +99 -8
- package/dist/config.js.map +1 -1
- package/dist/connectors/baseConnector.d.ts +117 -0
- package/dist/connectors/baseConnector.js +213 -0
- package/dist/connectors/baseConnector.js.map +1 -0
- package/dist/connectors/confluence.d.ts +111 -0
- package/dist/connectors/confluence.js +406 -0
- package/dist/connectors/confluence.js.map +1 -0
- package/dist/connectors/datadog.d.ts +116 -0
- package/dist/connectors/datadog.js +385 -0
- package/dist/connectors/datadog.js.map +1 -0
- package/dist/connectors/fixtureLibrary.d.ts +21 -0
- package/dist/connectors/fixtureLibrary.js +70 -0
- package/dist/connectors/fixtureLibrary.js.map +1 -0
- package/dist/connectors/fixtureRecorder.d.ts +1 -0
- package/dist/connectors/fixtureRecorder.js +35 -0
- package/dist/connectors/fixtureRecorder.js.map +1 -0
- package/dist/connectors/github.d.ts +58 -8
- package/dist/connectors/github.js +312 -84
- package/dist/connectors/github.js.map +1 -1
- package/dist/connectors/gmail.d.ts +4 -1
- package/dist/connectors/gmail.js +79 -16
- package/dist/connectors/gmail.js.map +1 -1
- package/dist/connectors/googleCalendar.d.ts +60 -0
- package/dist/connectors/googleCalendar.js +345 -0
- package/dist/connectors/googleCalendar.js.map +1 -0
- package/dist/connectors/hubspot.d.ts +112 -0
- package/dist/connectors/hubspot.js +408 -0
- package/dist/connectors/hubspot.js.map +1 -0
- package/dist/connectors/intercom.d.ts +102 -0
- package/dist/connectors/intercom.js +402 -0
- package/dist/connectors/intercom.js.map +1 -0
- package/dist/connectors/jira.d.ts +98 -0
- package/dist/connectors/jira.js +379 -0
- package/dist/connectors/jira.js.map +1 -0
- package/dist/connectors/linear.d.ts +69 -19
- package/dist/connectors/linear.js +170 -129
- package/dist/connectors/linear.js.map +1 -1
- package/dist/connectors/mcpClient.d.ts +56 -0
- package/dist/connectors/mcpClient.js +189 -0
- package/dist/connectors/mcpClient.js.map +1 -0
- package/dist/connectors/mcpOAuth.d.ts +84 -0
- package/dist/connectors/mcpOAuth.js +389 -0
- package/dist/connectors/mcpOAuth.js.map +1 -0
- package/dist/connectors/mockConnector.d.ts +28 -0
- package/dist/connectors/mockConnector.js +81 -0
- package/dist/connectors/mockConnector.js.map +1 -0
- package/dist/connectors/notion.d.ts +143 -0
- package/dist/connectors/notion.js +424 -0
- package/dist/connectors/notion.js.map +1 -0
- package/dist/connectors/sentry.d.ts +17 -21
- package/dist/connectors/sentry.js +115 -131
- package/dist/connectors/sentry.js.map +1 -1
- package/dist/connectors/slack.d.ts +50 -0
- package/dist/connectors/slack.js +324 -0
- package/dist/connectors/slack.js.map +1 -0
- package/dist/connectors/stripe.d.ts +116 -0
- package/dist/connectors/stripe.js +379 -0
- package/dist/connectors/stripe.js.map +1 -0
- package/dist/connectors/tokenStorage.d.ts +35 -0
- package/dist/connectors/tokenStorage.js +459 -0
- package/dist/connectors/tokenStorage.js.map +1 -0
- package/dist/connectors/zendesk.d.ts +104 -0
- package/dist/connectors/zendesk.js +424 -0
- package/dist/connectors/zendesk.js.map +1 -0
- package/dist/drivers/gemini/index.d.ts +5 -1
- package/dist/drivers/gemini/index.js +39 -5
- package/dist/drivers/gemini/index.js.map +1 -1
- package/dist/drivers/index.d.ts +5 -0
- package/dist/drivers/index.js +1 -1
- package/dist/drivers/index.js.map +1 -1
- package/dist/featureFlags.d.ts +73 -0
- package/dist/featureFlags.js +203 -0
- package/dist/featureFlags.js.map +1 -0
- package/dist/fp/automationInterpreter.js +1 -0
- package/dist/fp/automationInterpreter.js.map +1 -1
- package/dist/fp/automationProgram.d.ts +1 -1
- package/dist/fp/automationProgram.js.map +1 -1
- package/dist/fp/policyParser.js +17 -0
- package/dist/fp/policyParser.js.map +1 -1
- package/dist/index.js +621 -61
- package/dist/index.js.map +1 -1
- package/dist/installGuard.d.ts +25 -0
- package/dist/installGuard.js +48 -0
- package/dist/installGuard.js.map +1 -0
- package/dist/oauth.d.ts +4 -1
- package/dist/oauth.js +50 -14
- package/dist/oauth.js.map +1 -1
- package/dist/patchworkConfig.d.ts +9 -0
- package/dist/patchworkConfig.js.map +1 -1
- package/dist/recipeOrchestration.d.ts +53 -0
- package/dist/recipeOrchestration.js +272 -0
- package/dist/recipeOrchestration.js.map +1 -0
- package/dist/recipes/RecipeOrchestrator.d.ts +40 -0
- package/dist/recipes/RecipeOrchestrator.js +51 -0
- package/dist/recipes/RecipeOrchestrator.js.map +1 -0
- package/dist/recipes/agentExecutor.d.ts +28 -0
- package/dist/recipes/agentExecutor.js +42 -0
- package/dist/recipes/agentExecutor.js.map +1 -0
- package/dist/recipes/chainedRunner.d.ts +140 -0
- package/dist/recipes/chainedRunner.js +539 -0
- package/dist/recipes/chainedRunner.js.map +1 -0
- package/dist/recipes/dependencyGraph.d.ts +39 -0
- package/dist/recipes/dependencyGraph.js +199 -0
- package/dist/recipes/dependencyGraph.js.map +1 -0
- package/dist/recipes/legacyRecipeCompat.d.ts +2 -0
- package/dist/recipes/legacyRecipeCompat.js +112 -0
- package/dist/recipes/legacyRecipeCompat.js.map +1 -0
- package/dist/recipes/manifest.d.ts +47 -0
- package/dist/recipes/manifest.js +141 -0
- package/dist/recipes/manifest.js.map +1 -0
- package/dist/recipes/nestedRecipeStep.d.ts +58 -0
- package/dist/recipes/nestedRecipeStep.js +95 -0
- package/dist/recipes/nestedRecipeStep.js.map +1 -0
- package/dist/recipes/outputRegistry.d.ts +28 -0
- package/dist/recipes/outputRegistry.js +52 -0
- package/dist/recipes/outputRegistry.js.map +1 -0
- package/dist/recipes/scheduler.d.ts +23 -7
- package/dist/recipes/scheduler.js +131 -41
- package/dist/recipes/scheduler.js.map +1 -1
- package/dist/recipes/schema.d.ts +17 -2
- package/dist/recipes/schemaGenerator.d.ts +28 -0
- package/dist/recipes/schemaGenerator.js +565 -0
- package/dist/recipes/schemaGenerator.js.map +1 -0
- package/dist/recipes/templateEngine.d.ts +62 -0
- package/dist/recipes/templateEngine.js +182 -0
- package/dist/recipes/templateEngine.js.map +1 -0
- package/dist/recipes/toolRegistry.d.ts +181 -0
- package/dist/recipes/toolRegistry.js +300 -0
- package/dist/recipes/toolRegistry.js.map +1 -0
- package/dist/recipes/tools/calendar.d.ts +6 -0
- package/dist/recipes/tools/calendar.js +61 -0
- package/dist/recipes/tools/calendar.js.map +1 -0
- package/dist/recipes/tools/confluence.d.ts +6 -0
- package/dist/recipes/tools/confluence.js +254 -0
- package/dist/recipes/tools/confluence.js.map +1 -0
- package/dist/recipes/tools/datadog.d.ts +6 -0
- package/dist/recipes/tools/datadog.js +239 -0
- package/dist/recipes/tools/datadog.js.map +1 -0
- package/dist/recipes/tools/diagnostics.d.ts +6 -0
- package/dist/recipes/tools/diagnostics.js +36 -0
- package/dist/recipes/tools/diagnostics.js.map +1 -0
- package/dist/recipes/tools/file.d.ts +6 -0
- package/dist/recipes/tools/file.js +170 -0
- package/dist/recipes/tools/file.js.map +1 -0
- package/dist/recipes/tools/git.d.ts +6 -0
- package/dist/recipes/tools/git.js +63 -0
- package/dist/recipes/tools/git.js.map +1 -0
- package/dist/recipes/tools/github.d.ts +6 -0
- package/dist/recipes/tools/github.js +91 -0
- package/dist/recipes/tools/github.js.map +1 -0
- package/dist/recipes/tools/gmail.d.ts +6 -0
- package/dist/recipes/tools/gmail.js +210 -0
- package/dist/recipes/tools/gmail.js.map +1 -0
- package/dist/recipes/tools/hubspot.d.ts +6 -0
- package/dist/recipes/tools/hubspot.js +232 -0
- package/dist/recipes/tools/hubspot.js.map +1 -0
- package/dist/recipes/tools/index.d.ts +22 -0
- package/dist/recipes/tools/index.js +25 -0
- package/dist/recipes/tools/index.js.map +1 -0
- package/dist/recipes/tools/intercom.d.ts +6 -0
- package/dist/recipes/tools/intercom.js +226 -0
- package/dist/recipes/tools/intercom.js.map +1 -0
- package/dist/recipes/tools/linear.d.ts +6 -0
- package/dist/recipes/tools/linear.js +83 -0
- package/dist/recipes/tools/linear.js.map +1 -0
- package/dist/recipes/tools/notion.d.ts +6 -0
- package/dist/recipes/tools/notion.js +278 -0
- package/dist/recipes/tools/notion.js.map +1 -0
- package/dist/recipes/tools/slack.d.ts +6 -0
- package/dist/recipes/tools/slack.js +72 -0
- package/dist/recipes/tools/slack.js.map +1 -0
- package/dist/recipes/tools/stripe.d.ts +6 -0
- package/dist/recipes/tools/stripe.js +265 -0
- package/dist/recipes/tools/stripe.js.map +1 -0
- package/dist/recipes/tools/zendesk.d.ts +6 -0
- package/dist/recipes/tools/zendesk.js +245 -0
- package/dist/recipes/tools/zendesk.js.map +1 -0
- package/dist/recipes/validation.d.ts +13 -0
- package/dist/recipes/validation.js +433 -0
- package/dist/recipes/validation.js.map +1 -0
- package/dist/recipes/yamlRunner.d.ts +87 -0
- package/dist/recipes/yamlRunner.js +693 -409
- package/dist/recipes/yamlRunner.js.map +1 -1
- package/dist/recipesHttp.d.ts +34 -6
- package/dist/recipesHttp.js +285 -15
- package/dist/recipesHttp.js.map +1 -1
- package/dist/riskTier.js +1 -0
- package/dist/riskTier.js.map +1 -1
- package/dist/runLog.d.ts +23 -0
- package/dist/runLog.js +56 -1
- package/dist/runLog.js.map +1 -1
- package/dist/schemas/dry-run-plan.v1.json +139 -0
- package/dist/schemas/recipe.v1.json +684 -0
- package/dist/server.d.ts +32 -1
- package/dist/server.js +980 -97
- package/dist/server.js.map +1 -1
- package/dist/streamableHttp.js +2 -0
- package/dist/streamableHttp.js.map +1 -1
- package/dist/tools/addLinearComment.d.ts +55 -0
- package/dist/tools/addLinearComment.js +72 -0
- package/dist/tools/addLinearComment.js.map +1 -0
- package/dist/tools/bridgeDoctor.js +2 -2
- package/dist/tools/bridgeDoctor.js.map +1 -1
- package/dist/tools/createLinearIssue.d.ts +84 -0
- package/dist/tools/createLinearIssue.js +146 -0
- package/dist/tools/createLinearIssue.js.map +1 -0
- package/dist/tools/fetchCalendarEvents.d.ts +94 -0
- package/dist/tools/fetchCalendarEvents.js +97 -0
- package/dist/tools/fetchCalendarEvents.js.map +1 -0
- package/dist/tools/fetchGithubIssue.d.ts +80 -0
- package/dist/tools/fetchGithubIssue.js +84 -0
- package/dist/tools/fetchGithubIssue.js.map +1 -0
- package/dist/tools/fetchGithubPR.d.ts +89 -0
- package/dist/tools/fetchGithubPR.js +96 -0
- package/dist/tools/fetchGithubPR.js.map +1 -0
- package/dist/tools/fetchSlackProfile.d.ts +43 -0
- package/dist/tools/fetchSlackProfile.js +46 -0
- package/dist/tools/fetchSlackProfile.js.map +1 -0
- package/dist/tools/getConnectorStatus.d.ts +58 -0
- package/dist/tools/getConnectorStatus.js +56 -0
- package/dist/tools/getConnectorStatus.js.map +1 -0
- package/dist/tools/github/actions.js +4 -2
- package/dist/tools/github/actions.js.map +1 -1
- package/dist/tools/github/composite.d.ts +339 -0
- package/dist/tools/github/composite.js +343 -0
- package/dist/tools/github/composite.js.map +1 -0
- package/dist/tools/github/index.d.ts +2 -1
- package/dist/tools/github/index.js +2 -1
- package/dist/tools/github/index.js.map +1 -1
- package/dist/tools/github/issues.js +8 -4
- package/dist/tools/github/issues.js.map +1 -1
- package/dist/tools/github/pr.d.ts +122 -0
- package/dist/tools/github/pr.js +195 -5
- package/dist/tools/github/pr.js.map +1 -1
- package/dist/tools/index.js +32 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/searchTools.js +1 -1
- package/dist/tools/searchTools.js.map +1 -1
- package/dist/tools/slackListChannels.d.ts +65 -0
- package/dist/tools/slackListChannels.js +70 -0
- package/dist/tools/slackListChannels.js.map +1 -0
- package/dist/tools/slackPostMessage.d.ts +57 -0
- package/dist/tools/slackPostMessage.js +77 -0
- package/dist/tools/slackPostMessage.js.map +1 -0
- package/dist/tools/testTraceToSource.js +2 -2
- package/dist/tools/testTraceToSource.js.map +1 -1
- package/dist/tools/updateLinearIssue.d.ts +89 -0
- package/dist/tools/updateLinearIssue.js +117 -0
- package/dist/tools/updateLinearIssue.js.map +1 -0
- package/dist/transport.d.ts +7 -1
- package/dist/transport.js +85 -11
- package/dist/transport.js.map +1 -1
- package/package.json +5 -2
- package/scripts/start-all.sh +56 -19
- package/templates/automation-policies/recipe-authoring.json +25 -0
- package/templates/automation-policy.example.json +6 -0
- package/templates/co.patchwork-os.bridge.plist +34 -0
- package/templates/recipes/ctx-loop-test.yaml +75 -0
- package/templates/recipes/lint-on-save.yaml +1 -2
- package/templates/recipes/morning-brief-slack.yaml +57 -0
- package/templates/recipes/morning-brief.yaml +14 -6
- package/templates/recipes/project-health-check.yaml +50 -0
- package/templates/recipes/sentry-to-linear.yaml +77 -0
package/scripts/start-all.sh
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Full orchestrator for bridge + claude + remote-control.
|
|
3
|
-
# Manages all
|
|
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 —
|
|
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
|
-
#
|
|
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
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
[[ -
|
|
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:
|
|
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
|
-
|
|
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
|
-
[[ -
|
|
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
|
-
[[ -
|
|
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
|
-
[[ -
|
|
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
|
-
[[ -
|
|
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
|
|
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
|
|
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. **
|
|
52
|
-
4. **
|
|
53
|
-
5. **
|
|
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
|
-
|
|
57
|
-
|
|
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}}
|