@schoolai/shipyard-mcp 0.1.3-next.464 → 0.1.3-next.466
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/apps/server/dist/index.js +91 -28
- package/package.json +1 -1
|
@@ -4149,7 +4149,9 @@ USAGE (for non-hook agents):
|
|
|
4149
4149
|
1. Call this tool to get monitoring script
|
|
4150
4150
|
2. Run script in background: bash <script> &
|
|
4151
4151
|
3. Script polls registry server for status changes
|
|
4152
|
-
4. Exits when status becomes '
|
|
4152
|
+
4. Exits when status becomes 'in_progress' (approved) or 'changes_requested' (needs work)
|
|
4153
|
+
|
|
4154
|
+
REQUIREMENTS: The script requires 'jq' for URL encoding. Install with: brew install jq (macOS) or apt install jq (Linux)`,
|
|
4153
4155
|
inputSchema: {
|
|
4154
4156
|
type: "object",
|
|
4155
4157
|
properties: {
|
|
@@ -4167,25 +4169,64 @@ USAGE (for non-hook agents):
|
|
|
4167
4169
|
const { planId, pollIntervalSeconds = 30 } = input;
|
|
4168
4170
|
const registryPort2 = registryConfig.REGISTRY_PORT[0];
|
|
4169
4171
|
const trpcUrl = `http://localhost:${registryPort2}/trpc`;
|
|
4170
|
-
const
|
|
4171
|
-
|
|
4172
|
+
const statusInProgress = PlanStatusValues.find((s) => s === "in_progress");
|
|
4173
|
+
const statusChangesRequested = PlanStatusValues.find((s) => s === "changes_requested");
|
|
4174
|
+
if (!statusInProgress || !statusChangesRequested) {
|
|
4175
|
+
throw new Error("Required status values not found in PlanStatusValues");
|
|
4176
|
+
}
|
|
4177
|
+
const script = `#!/bin/bash
|
|
4178
|
+
# Monitor plan "${planId}" for approval status changes
|
|
4179
|
+
# Polls the Shipyard registry server and exits when approved/rejected
|
|
4180
|
+
|
|
4181
|
+
# Check for required dependency
|
|
4182
|
+
if ! command -v jq &> /dev/null; then
|
|
4183
|
+
echo "Error: jq is required but not installed."
|
|
4184
|
+
echo "Install with: brew install jq (macOS) or apt install jq (Linux)"
|
|
4185
|
+
exit 1
|
|
4186
|
+
fi
|
|
4187
|
+
|
|
4188
|
+
TRPC_URL="${trpcUrl}"
|
|
4189
|
+
PLAN_ID="${planId}"
|
|
4190
|
+
POLL_INTERVAL=${pollIntervalSeconds}
|
|
4191
|
+
|
|
4192
|
+
# Subscribe to status changes via tRPC mutation
|
|
4193
|
+
echo "Subscribing to plan changes..."
|
|
4194
|
+
RESPONSE=$(curl -sf -X POST "$TRPC_URL/subscription.create" \\
|
|
4172
4195
|
-H "Content-Type: application/json" \\
|
|
4173
|
-
-d '{"planId":"$
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
echo "
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4196
|
+
-d '{"planId":"'"$PLAN_ID"'","subscribe":["status","comments"],"windowMs":5000,"threshold":1}')
|
|
4197
|
+
|
|
4198
|
+
# Extract clientId from response: {"result":{"data":{"clientId":"..."}}}
|
|
4199
|
+
CLIENT_ID=$(echo "$RESPONSE" | sed -n 's/.*"clientId":"\\([^"]*\\)".*/\\1/p')
|
|
4200
|
+
|
|
4201
|
+
if [ -z "$CLIENT_ID" ]; then
|
|
4202
|
+
echo "Failed to subscribe. Is the Shipyard registry server running?"
|
|
4203
|
+
echo "Response: $RESPONSE"
|
|
4204
|
+
exit 1
|
|
4205
|
+
fi
|
|
4206
|
+
|
|
4207
|
+
echo "Subscribed with clientId: $CLIENT_ID"
|
|
4208
|
+
echo "Polling every $POLL_INTERVAL seconds..."
|
|
4209
|
+
|
|
4210
|
+
# Poll for changes via tRPC query (GET with url-encoded input)
|
|
4211
|
+
while true; do
|
|
4212
|
+
sleep $POLL_INTERVAL
|
|
4213
|
+
|
|
4214
|
+
# URL-encode the input JSON for GET request
|
|
4215
|
+
INPUT='{"planId":"'"$PLAN_ID"'","clientId":"'"$CLIENT_ID"'"}'
|
|
4216
|
+
ENCODED_INPUT=$(printf '%s' "$INPUT" | jq -sRr @uri)
|
|
4217
|
+
|
|
4218
|
+
RESULT=$(curl -sf "$TRPC_URL/subscription.getChanges?input=$ENCODED_INPUT" 2>/dev/null)
|
|
4219
|
+
|
|
4220
|
+
# Check if changes are ready: {"result":{"data":{"ready":true,"changes":"..."}}}
|
|
4221
|
+
if echo "$RESULT" | grep -q '"ready":true'; then
|
|
4222
|
+
CHANGES=$(echo "$RESULT" | sed -n 's/.*"changes":"\\([^"]*\\)".*/\\1/p')
|
|
4223
|
+
echo "Changes detected: $CHANGES"
|
|
4224
|
+
|
|
4225
|
+
# Exit on status change to in_progress (approved) or changes_requested (needs work)
|
|
4226
|
+
if echo "$CHANGES" | grep -qE "Status:.*(${statusInProgress}|${statusChangesRequested})"; then
|
|
4227
|
+
echo "Plan status changed. Exiting."
|
|
4228
|
+
exit 0
|
|
4229
|
+
fi
|
|
4189
4230
|
fi
|
|
4190
4231
|
done`;
|
|
4191
4232
|
return {
|
|
@@ -4198,10 +4239,13 @@ done`;
|
|
|
4198
4239
|
${script}
|
|
4199
4240
|
\`\`\`
|
|
4200
4241
|
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4242
|
+
**Usage:** Save to a file and run in background: \`bash script.sh &\`
|
|
4243
|
+
|
|
4244
|
+
The script:
|
|
4245
|
+
- Subscribes to status/comment changes via tRPC
|
|
4246
|
+
- Polls every ${pollIntervalSeconds} seconds
|
|
4247
|
+
- Exits when status becomes in_progress (approved) or changes_requested (needs work)
|
|
4248
|
+
- Requires \`jq\` for URL encoding (install: brew install jq)`
|
|
4205
4249
|
}
|
|
4206
4250
|
]
|
|
4207
4251
|
};
|
|
@@ -4788,17 +4832,36 @@ Parameters:
|
|
|
4788
4832
|
- pollIntervalSeconds (number, optional): Polling interval (default: 30)
|
|
4789
4833
|
|
|
4790
4834
|
Returns:
|
|
4791
|
-
- script: Bash script that polls registry server and exits when status becomes '
|
|
4835
|
+
- script: Bash script that polls registry server and exits when status becomes 'in_progress' (approved) or 'changes_requested' (needs work)
|
|
4792
4836
|
|
|
4793
|
-
|
|
4837
|
+
**IMPORTANT:** This is ONLY for agents WITHOUT hook support (Cursor, Devin, Windsurf, etc).
|
|
4838
|
+
Claude Code users have automatic blocking via the shipyard hook - you don't need this.
|
|
4794
4839
|
|
|
4795
|
-
|
|
4840
|
+
**Complete workflow for non-hook agents (example user code):**
|
|
4796
4841
|
\`\`\`typescript
|
|
4842
|
+
// 1. Create plan and get the monitoring script in ONE code block
|
|
4843
|
+
const plan = await createPlan({
|
|
4844
|
+
title: "My Feature Implementation",
|
|
4845
|
+
content: "- [ ] Screenshot of working feature {#deliverable}"
|
|
4846
|
+
});
|
|
4847
|
+
|
|
4848
|
+
// 2. Get the polling script (returns bash script as string)
|
|
4797
4849
|
const { script } = await setupReviewNotification(plan.planId, 15);
|
|
4798
|
-
|
|
4799
|
-
|
|
4850
|
+
|
|
4851
|
+
// 3. Return both so the agent can run the script
|
|
4852
|
+
return {
|
|
4853
|
+
planId: plan.planId,
|
|
4854
|
+
sessionToken: plan.sessionToken,
|
|
4855
|
+
monitoringScript: script,
|
|
4856
|
+
instructions: "Run the monitoring script in background: bash <script> &"
|
|
4857
|
+
};
|
|
4800
4858
|
\`\`\`
|
|
4801
4859
|
|
|
4860
|
+
The agent then runs the returned bash script in the background. The script will:
|
|
4861
|
+
- Poll the registry server every N seconds
|
|
4862
|
+
- Print status changes to stdout
|
|
4863
|
+
- Exit with code 0 when the plan is approved/rejected
|
|
4864
|
+
|
|
4802
4865
|
---
|
|
4803
4866
|
|
|
4804
4867
|
### requestUserInput(opts): Promise<{ success, response?, status, reason? }>
|