Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)); \
Copy link

Copilot AI Feb 17, 2026

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 if jq errors (shell assignment returns success), which can lead to enabledMcpjsonServers being set to an empty/invalid value. Add explicit error handling for the jq invocation (e.g., ... || exit 1) and consider using jq -e/-c with a safe default like .mcpServers // {} | keys if mcpServers might be absent.

Suggested change
@keys=$$(jq -c '.mcpServers | keys' $(MCP_SRC)); \
@tmp_keys_file=$$(mktemp); \
if jq -e -c '.mcpServers // {} | keys' $(MCP_SRC) > "$$tmp_keys_file"; then \
keys=$$(cat "$$tmp_keys_file"); \
rm -f "$$tmp_keys_file"; \
else \
echo "Error: failed to parse .mcpServers from $(MCP_SRC)"; \
rm -f "$$tmp_keys_file"; \
exit 1; \
fi; \

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The jq ... > "$settings.tmp" && mv ...; echo "Updated..." sequence will print the success message even when jq fails (because echo runs unconditionally after the && list), and the recipe will still exit 0. Consider making the echo conditional on success and failing the target on error (e.g., include the echo in the && chain or use an if ...; then ...; else ...; exit 1; fi block; also clean up the temp file on failure).

Suggested change
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; \

Copilot uses AI. Check for mistakes.
fi; \
done

# ====================================================================================
# RULER GLOBAL
Expand Down