Skip to content

feat: Add sync command for Claude Code personal config - #123

Merged
kieranklaassen merged 4 commits into
EveryInc:mainfrom
terry-li-hm:feat/claude-home-sync
Feb 8, 2026
Merged

kieranklaassen merged 4 commits into
EveryInc:mainfrom
terry-li-hm:feat/claude-home-sync

Conversation

@terry-li-hm

@terry-li-hm terry-li-hm commented Jan 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add compound-plugin sync command to sync ~/.claude/ personal configuration to OpenCode or Codex.

Problem: The current convert command only handles .claude-plugin/ directories. Users with personal skills in ~/.claude/skills/ or MCP servers in ~/.claude/settings.json cannot sync these to OpenCode/Codex without manual work.

Solution: New dedicated sync command that:

  • Parses ~/.claude/skills/ for personal skills (supports symlinks)
  • Parses ~/.claude/settings.json for MCP servers
  • Syncs skills as symlinks (single source of truth, instant updates)
  • Converts MCP to JSON (OpenCode) or TOML (Codex)

Usage

# Sync to OpenCode
compound-plugin sync --target opencode

# Sync to Codex
compound-plugin sync --target codex

# Custom Claude home path
compound-plugin sync --target opencode --claude-home /path/to/.claude

Files Changed

File Purpose
src/parsers/claude-home.ts Parse ~/.claude/ for skills and MCP
src/commands/sync.ts New sync command
src/sync/opencode.ts Dedicated OpenCode sync
src/sync/codex.ts Dedicated Codex sync
src/utils/symlink.ts Safe symlink + path validation utils
src/index.ts Register sync command
README.md Document sync command

Security Considerations

  • Path traversal validation: isValidSkillName() rejects ../, /, \, null bytes
  • Secrets warning: Warns when MCP servers contain potential secrets (API keys, tokens)
  • Restrictive permissions: Config files written with mode 600
  • Safe symlink: Refuses to delete real directories (only replaces symlinks/files)
  • TOML escaping: Proper escaping for quotes, backslashes, control characters

Design Decisions

  1. Dedicated sync functions instead of modifying existing converters — keeps existing code clean, sync only needs skills + MCP (not agents/commands/hooks)
  2. Always symlinks — single source of truth, changes in Claude Code reflected immediately
  3. Separate parser (ClaudeHomeConfig) — doesn't pollute ClaudePlugin type with home directory semantics

Testing

$ bun run src/index.ts sync --target opencode
⚠️  Warning: MCP servers contain env vars that may include secrets...
Syncing 47 skills, 1 MCP servers...
✓ Synced to opencode: /Users/terry/.config/opencode

All 34 tests pass after rebase on upstream/main.


Compound Engineered 🤖 Generated with Claude Code

terry-li-hm and others added 3 commits January 26, 2026 10:56
Add `compound-plugin sync` command to sync ~/.claude/ personal config
(skills and MCP servers) to OpenCode or Codex.

Features:
- Parses ~/.claude/skills/ for personal skills (supports symlinks)
- Parses ~/.claude/settings.json for MCP servers
- Syncs skills as symlinks (single source of truth)
- Converts MCP to JSON (OpenCode) or TOML (Codex)
- Dedicated sync functions bypass existing converter architecture

Usage:
  compound-plugin sync --target opencode
  compound-plugin sync --target codex

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Security fixes:
- Add path traversal validation with isValidSkillName()
- Warn when MCP servers contain potential secrets (API keys, tokens)
- Set restrictive file permissions (600) on config files
- Safe forceSymlink refuses to delete real directories
- Proper TOML escaping for quotes/backslashes/control chars

Code quality fixes:
- Extract shared symlink utils to src/utils/symlink.ts
- Replace process.exit(1) with thrown error
- Distinguish ENOENT from other errors in catch blocks
- Remove unused `root` field from ClaudeHomeConfig
- Make Codex sync idempotent (remove+rewrite managed section)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@terry-li-hm
terry-li-hm force-pushed the feat/claude-home-sync branch from 8c6c3dd to 34f3f91 Compare January 26, 2026 02:56
@kieranklaassen

Copy link
Copy Markdown
Collaborator

Ohh sick! Will try tomorrow!

@terry-li-hm

Copy link
Copy Markdown
Contributor Author

This one is ready as well—I've bumped the root version to 0.2.0. It remains separate as it contains the TypeScript logic for the new sync command.

@kieranklaassen kieranklaassen added the enhancement New feature or request label Feb 8, 2026
@kieranklaassen
kieranklaassen merged commit 1bdd103 into EveryInc:main Feb 8, 2026
1 check passed
kprimdal added a commit to primux-dk/laravel-compound-engineering that referenced this pull request Feb 9, 2026
- Add `sync` command to sync ~/.claude/ personal config to OpenCode/Codex (EveryInc#123)
- Backup existing config files before overwriting (EveryInc#119)
- Remove worktree creation confirmation prompt (EveryInc#144)
- Fix .git file detection in worktrees (use -e instead of -d) (EveryInc#159)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@terry-li-hm

Copy link
Copy Markdown
Contributor Author

Thanks for the merge, Kieran — made my day! Let me know if there's anything else I can contribute.

@terry-li-hm
terry-li-hm deleted the feat/claude-home-sync branch February 9, 2026 02:40
This was referenced Mar 18, 2026
tmchow added a commit that referenced this pull request Apr 26, 2026
…ription

DU-3 was reading the PR body but not gathering the branch diff/commit
list — the writing reference assumes both are already in context, so
description updates would compose from stale or empty diff context.
The description-only mode also promised to describe a pasted PR
URL/number but never threaded that ref into Step 6's gh pr view calls,
so "describe PR #123" silently described the current branch. Fixes
both gaps without restructuring either flow.

Address PR review feedback (#700)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
tmchow added a commit that referenced this pull request Aug 18, 2026
…d stop

Cursor Bugbot: a refused scratch root only gates 2e media downloads, so listing
it as leaving state unwritable could stop a run that can still record and
release. The stop condition is a state write that cannot land; scratch failure
joins download and analysis as a mark-and-continue.

Cursor Security Reviewer (medium): a validated ref like #123 interpolated
unquoted starts a shell comment and truncates the verification command. Strip
the leading # and quote the substituted values in run.md's 2f commands.

Claude-Session: https://claude.ai/code/session_01VKhf7iAsmem2ARmutqBzQS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants