-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync.sh
More file actions
executable file
·268 lines (232 loc) · 8.46 KB
/
Copy pathsync.sh
File metadata and controls
executable file
·268 lines (232 loc) · 8.46 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#!/bin/bash
# sync.sh — Distribute Fluid Creative OS skills to Claude Code and Cursor
# Usage: ./sync.sh [--target claude|cursor|both] [--dry-run] [--uninstall]
set -euo pipefail
# ──────────────────────────────────────────────
# CONFIG
# ──────────────────────────────────────────────
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
CLAUDE_DIR="$HOME/.claude"
CURSOR_DIR="$HOME/.cursor"
NAMESPACE="fluid"
# Skills to distribute (relative to .claude/skills/)
SKILLS=("brand-intelligence" "brand-compliance-check" "scaffold-section" "fluid-design-os" "fluid-design-os-feedback" "feedback-ingest")
# Parse arguments
TARGET="both"
DRY_RUN=false
UNINSTALL=false
while [[ $# -gt 0 ]]; do
case "$1" in
--target)
TARGET="$2"
shift 2
;;
--dry-run)
DRY_RUN=true
shift
;;
--uninstall)
UNINSTALL=true
shift
;;
-h|--help)
echo "Usage: ./sync.sh [--target claude|cursor|both] [--dry-run] [--uninstall]"
echo ""
echo "Options:"
echo " --target Install to: claude, cursor, or both (default: both)"
echo " --dry-run Show what would happen without making changes"
echo " --uninstall Remove all ${NAMESPACE}-* skills from target platforms"
echo ""
echo "This script installs Fluid Creative OS skills into Claude Code and/or Cursor."
echo "It also distributes marketing skills from skills/marketing/ to ~/.agents/skills/ globally."
echo "It does NOT touch ~/.agents/ orchestrator skills or global Claude Code commands."
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# ──────────────────────────────────────────────
# PREFLIGHT CHECKS
# ──────────────────────────────────────────────
if [ ! -d "$REPO_DIR/.claude/skills" ]; then
echo "ERROR: .claude/skills/ directory not found at $REPO_DIR/.claude/skills"
echo "Are you running sync.sh from the Fluid DesignOS repo root?"
exit 1
fi
if [ ! -d "$REPO_DIR/tools" ]; then
echo "WARNING: tools/ directory not found at $REPO_DIR/tools"
echo "CLI tools may not be available yet. Continuing with skill installation."
fi
echo "=== Fluid Creative OS Sync ==="
echo "Repo: $REPO_DIR"
echo "Target: $TARGET"
echo "Dry run: $DRY_RUN"
echo "Uninstall: $UNINSTALL"
echo ""
# Helper: execute or print (respects --dry-run)
run() {
if [ "$DRY_RUN" = true ]; then
echo " [dry-run] $*"
else
"$@"
fi
}
# Track what was done
INSTALLED=0
REMOVED=0
# ──────────────────────────────────────────────
# UNINSTALL
# ──────────────────────────────────────────────
if [ "$UNINSTALL" = true ]; then
echo "--- Uninstalling ${NAMESPACE}-* skills ---"
if [ "$TARGET" = "claude" ] || [ "$TARGET" = "both" ]; then
echo ""
echo "Claude Code:"
for skill in "${SKILLS[@]}"; do
link="$CLAUDE_DIR/skills/${NAMESPACE}-${skill}"
if [ -L "$link" ] || [ -d "$link" ]; then
echo " Removing: $link"
run rm -rf "$link"
((REMOVED++))
else
echo " Not found: $link (skipping)"
fi
done
fi
if [ "$TARGET" = "cursor" ] || [ "$TARGET" = "both" ]; then
echo ""
echo "Cursor:"
for skill in "${SKILLS[@]}"; do
dir="$CURSOR_DIR/skills/${NAMESPACE}-${skill}"
if [ -d "$dir" ]; then
echo " Removing: $dir"
run rm -rf "$dir"
((REMOVED++))
else
echo " Not found: $dir (skipping)"
fi
done
fi
# Remove marketing skills from ~/.agents/skills/
echo ""
echo "Marketing Skills (global):"
MARKETING_SKILLS_DIR="$REPO_DIR/skills/marketing"
if [ -d "$MARKETING_SKILLS_DIR" ]; then
for skill_dir in "$MARKETING_SKILLS_DIR"/*/; do
skill_name=$(basename "$skill_dir")
dst_dir="$HOME/.agents/skills/$skill_name"
if [ -d "$dst_dir" ]; then
echo " Removing: $dst_dir"
run rm -rf "$dst_dir"
((REMOVED++))
else
echo " Not found: $dst_dir (skipping)"
fi
done
fi
echo ""
echo "=== Uninstall Complete ==="
echo "Removed: $REMOVED items"
exit 0
fi
# ──────────────────────────────────────────────
# INSTALL: CLAUDE CODE
# ──────────────────────────────────────────────
if [ "$TARGET" = "claude" ] || [ "$TARGET" = "both" ]; then
echo "--- Claude Code ---"
echo ""
echo "Primary: Add this repo as an additional directory in Claude Code:"
echo " claude --add-dir $REPO_DIR"
echo " (Skills in .claude/skills/ are auto-discovered with hot reload)"
echo ""
echo "Fallback: Symlinking skills with ${NAMESPACE}- prefix..."
run mkdir -p "$CLAUDE_DIR/skills"
for skill in "${SKILLS[@]}"; do
src="$REPO_DIR/.claude/skills/$skill"
dst="$CLAUDE_DIR/skills/${NAMESPACE}-${skill}"
if [ ! -d "$src" ]; then
echo " SKIP: $src (not found)"
continue
fi
# Remove stale symlink or directory
if [ -L "$dst" ] || [ -d "$dst" ]; then
run rm -rf "$dst"
fi
echo " Symlink: $dst -> $src"
run ln -sfn "$src" "$dst"
((INSTALLED++))
done
echo ""
echo " Note: .claude/settings.json hooks are project-scoped (auto-loaded when"
echo " working in this repo). No global hook installation needed."
fi
# ──────────────────────────────────────────────
# INSTALL: CURSOR
# ──────────────────────────────────────────────
if [ "$TARGET" = "cursor" ] || [ "$TARGET" = "both" ]; then
echo ""
echo "--- Cursor ---"
run mkdir -p "$CURSOR_DIR/skills"
for skill in "${SKILLS[@]}"; do
src="$REPO_DIR/.claude/skills/$skill"
dst="$CURSOR_DIR/skills/${NAMESPACE}-${skill}"
if [ ! -d "$src" ]; then
echo " SKIP: $src (not found)"
continue
fi
# Create directory and copy files
run mkdir -p "$dst"
if [ "$DRY_RUN" = true ]; then
echo " [dry-run] cp $src/SKILL.md $dst/SKILL.md"
else
cp "$src/SKILL.md" "$dst/SKILL.md"
fi
echo " Copied: $dst"
((INSTALLED++))
done
fi
# ──────────────────────────────────────────────
# INSTALL: MARKETING SKILLS (global distribution)
# ──────────────────────────────────────────────
MARKETING_SKILLS_DIR="$REPO_DIR/skills/marketing"
if [ -d "$MARKETING_SKILLS_DIR" ]; then
echo ""
echo "--- Marketing Skills (global) ---"
for skill_dir in "$MARKETING_SKILLS_DIR"/*/; do
skill_name=$(basename "$skill_dir")
dst_dir="$HOME/.agents/skills/$skill_name"
if [ ! -f "$skill_dir/SKILL.md" ]; then
echo " SKIP: $skill_name (SKILL.md not found)"
continue
fi
run mkdir -p "$dst_dir"
if [ "$DRY_RUN" = true ]; then
echo " [dry-run] cp -r $skill_dir/* $dst_dir/"
else
cp -r "$skill_dir"/* "$dst_dir/"
fi
echo " Overwrote: $dst_dir"
((INSTALLED++))
done
fi
# ──────────────────────────────────────────────
# REPORT
# ──────────────────────────────────────────────
echo ""
echo "=== Sync Complete ==="
echo "Installed: $INSTALLED skill links/copies"
echo ""
echo "Verify:"
if [ "$TARGET" = "claude" ] || [ "$TARGET" = "both" ]; then
echo " ls ~/.claude/skills/ | grep ${NAMESPACE}"
fi
if [ "$TARGET" = "cursor" ] || [ "$TARGET" = "both" ]; then
echo " ls ~/.cursor/skills/ | grep ${NAMESPACE}"
fi
echo " ls ~/.agents/skills/ | grep -c ''"
echo ""
echo "Important: This script distributes marketing skills to ~/.agents/skills/ globally."
echo "Orchestrator skills (Claude/Cursor) are NOT modified by this script."