-
Notifications
You must be signed in to change notification settings - Fork 1
feat: sync enabledMcpjsonServers from mcp.json #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -132,6 +132,15 @@ mcp-sync: ## Sync MCP configuration from .ruler/mcp.json to CLI tools. | |||||||||||||||||||||||
| exit 1; \ | ||||||||||||||||||||||||
| fi; \ | ||||||||||||||||||||||||
| done | ||||||||||||||||||||||||
| @keys=$$(jq -c '.mcpServers | keys' $(MCP_SRC)); \ | ||||||||||||||||||||||||
| for target in $(MCP_TARGET_DIRS); do \ | ||||||||||||||||||||||||
| settings="$$target/settings.local.json"; \ | ||||||||||||||||||||||||
| if [ -f "$$settings" ]; then \ | ||||||||||||||||||||||||
| jq --argjson keys "$$keys" '.enabledMcpjsonServers = $$keys' "$$settings" > "$$settings.tmp" && \ | ||||||||||||||||||||||||
| mv "$$settings.tmp" "$$settings"; \ | ||||||||||||||||||||||||
| echo "Updated enabledMcpjsonServers in $$settings"; \ | ||||||||||||||||||||||||
|
Comment on lines
+139
to
+141
|
||||||||||||||||||||||||
| jq --argjson keys "$$keys" '.enabledMcpjsonServers = $$keys' "$$settings" > "$$settings.tmp" && \ | |
| mv "$$settings.tmp" "$$settings"; \ | |
| echo "Updated enabledMcpjsonServers in $$settings"; \ | |
| if jq --argjson keys "$$keys" '.enabledMcpjsonServers = $$keys' "$$settings" > "$$settings.tmp" && \ | |
| mv "$$settings.tmp" "$$settings"; then \ | |
| echo "Updated enabledMcpjsonServers in $$settings"; \ | |
| else \ | |
| echo "Failed updating enabledMcpjsonServers in $$settings"; \ | |
| rm -f "$$settings.tmp"; \ | |
| exit 1; \ | |
| fi; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keys=$$(jq ...)will not cause the recipe to fail ifjqerrors (shell assignment returns success), which can lead toenabledMcpjsonServersbeing set to an empty/invalid value. Add explicit error handling for thejqinvocation (e.g.,... || exit 1) and consider usingjq -e/-cwith a safe default like.mcpServers // {} | keysifmcpServersmight be absent.