-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync_all.sh
More file actions
executable file
·34 lines (28 loc) · 1.38 KB
/
sync_all.sh
File metadata and controls
executable file
·34 lines (28 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# Sync MCP data from this repo's mcp-servers.json to Cursor / Codex / Claude Code / Xcode.
# 1) Cursor: symlink → .cursor updates when data source updates.
# 2) Codex: generate mcp.generated.toml and merge into config.toml (marked block only; rest unchanged),
# and the same into ~/Library/Developer/Xcode/CodingAssistant/codex/ for Xcode's built-in Codex.
# 3) Claude Code: merge mcpServers into ~/.claude.json and into Xcode's
# ~/Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/.claude.json (per-project mcpServers).
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MCP_JSON="$SCRIPT_DIR/mcp-servers.json"
if [ ! -f "$MCP_JSON" ]; then
echo "[mcp-sync] $MCP_JSON is missing (gitignored local file)." >&2
echo "[mcp-sync] Copy mcp-servers.json.example → mcp-servers.json, edit, then run this script again." >&2
echo "[mcp-sync] Skipping sync; pre-push will not block on this." >&2
exit 0
fi
echo "[1/3] Sync Cursor (symlink)"
mkdir -p ~/.cursor
ln -sf "$MCP_JSON" ~/.cursor/mcp.json
echo "[2/3] Sync Codex (generate TOML; includes Xcode CodingAssistant/codex)"
python3 "$SCRIPT_DIR/sync_mcp.py"
echo "[3/3] Sync Claude Code (merge ~/.claude.json + Xcode ClaudeAgentConfig)"
if [ -f "$SCRIPT_DIR/sync_claude.py" ]; then
python3 "$SCRIPT_DIR/sync_claude.py"
else
echo "sync_claude.py not found; skip Claude."
fi
echo "Done."