Sync NEW Files to ~/.claude
Sync automation specialist. Find and copy ONLY NEW files from claude-code-config TO ~/.claude.
Configuration
-
Source: $CWD/claude-code-config
-
Target: ~/.claude
-
Changelog: $CWD/claude-code-config/CHANGELOG.md
Critical Rules
-
ONLY copy NEW files - files that exist in source but NOT in target
-
Copy files INDIVIDUALLY - never use rsync or bulk copy
-
Preserve directory structure - create parent dirs if needed
-
Track each file - list every file copied in changelog
Directories to Check
-
commands/ - Slash commands (.md files and subdirectories)
-
skills/ - Skills (subdirectories with SKILL.md)
-
agents/ - Agent definitions (.md files)
-
scripts/statusline/ - Statusline script (source code only)
-
scripts/command-validator/ - Command validator (source code only)
Workflow
Step 1: Find NEW Files Only
For each directory, find files that exist in claude-code-config but NOT in ~/.claude:
diff -rq $CWD/claude-code-config/commands/ ~/.claude/commands/ 2>/dev/null | grep "Only in.*claude-code-config"
Output interpretation:
-
Only in /path/claude-code-config/commands: new-cmd.md → NEW file
-
Only in /path/claude-code-config/commands/utils: helper.md → NEW file in subdir
IGNORE:
-
Only in /Users/melvynx/.claude/... (files only in target - don't delete)
-
Files ... differ (modified files - don't overwrite)
Step 2: Copy Each NEW File Individually
New file in root
cp $CWD/claude-code-config/commands/new-cmd.md ~/.claude/commands/new-cmd.md
New file in subdirectory (create dir first if needed)
mkdir -p ~/.claude/commands/utils/ cp $CWD/claude-code-config/commands/utils/helper.md ~/.claude/commands/utils/helper.md
New skill folder
mkdir -p ~/.claude/skills/new-skill/ cp $CWD/claude-code-config/skills/new-skill/SKILL.md ~/.claude/skills/new-skill/SKILL.md
Step 3: Scripts - Copy Source Files Only
For scripts/statusline and scripts/command-validator:
-
COPY: .ts , .js , .json (package.json, tsconfig.json), .md files
-
SKIP: node_modules/ , data/ , *.db , *.log , cache files
Step 4: Update CHANGELOG.md
Prepend new entry with ONLY the new files copied:
Claude Code Config Sync Changelog
[YYYY-MM-DD HH:MM:SS] - Synced TO ~/.claude
New Commands
commands/new-cmd.md→ ~/.claude/commands/
New Skills
skills/new-skill/→ ~/.claude/skills/
New Agents
agents/new-agent.md→ ~/.claude/agents/
Scripts Updated
scripts/statusline/src/new-file.ts→ ~/.claude/scripts/
Forbidden Actions
-
❌ Do NOT use rsync
-
❌ Do NOT copy entire directories
-
❌ Do NOT overwrite existing files (even if different)
-
❌ Do NOT copy node_modules, data/, .db, .log files
-
❌ Do NOT delete files that only exist in target (~/.claude)
Output Summary
✅ Sync to ~/.claude Complete - [timestamp]
New files copied to ~/.claude:
- commands/new-cmd.md
- skills/new-skill/SKILL.md
📝 CHANGELOG.md updated
User: Sync now #$ARGUMENTS