feat: add Sync Variants feature to copy config between variants#9
feat: add Sync Variants feature to copy config between variants#9MohMaya wants to merge 3 commits intonumman-ali:mainfrom
Conversation
Add ability to sync skills, MCP servers, permissions, and CLAUDE.md from one source variant to multiple target variants. - Add src/core/sync.ts with syncVariants(), createConfigBackup(), restoreConfigBackup() functions - Add TUI flow: sync-source -> sync-targets -> sync-running -> sync-done - Preserve provider-specific env vars (ANTHROPIC_*, CC_MIRROR_*, etc.) - Create single backup before sync (overwrites previous backup) - Multi-select targets with Space key, Enter to confirm Closes numman-ali#8
There was a problem hiding this comment.
Pull request overview
This PR adds a "Sync Variants" feature that allows users to copy configuration from one source variant to multiple target variants. The feature includes interactive TUI screens for selecting source and target variants, syncs skills, MCP servers, permissions, and CLAUDE.md files, and creates backups before making changes.
Key changes:
- New core sync module with functions for syncing config items between variants and managing backups
- TUI screens for source selection (single) and target selection (multi-select with Space key)
- Integration of sync flow into main TUI app with proper state management
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/core/sync.ts | Core sync logic with backup/restore, individual item sync functions, and async variants |
| src/core/index.ts | Exports sync functions and types |
| src/tui/hooks/useSync.ts | TUI hook managing sync operation state and progress |
| src/tui/hooks/index.ts | Exports useSync hook |
| src/tui/screens/SyncSourceScreen.tsx | Single-select screen for choosing source variant |
| src/tui/screens/SyncTargetsScreen.tsx | Multi-select screen for choosing target variants |
| src/tui/screens/index.ts | Exports new sync screens |
| src/tui/screens/HomeScreen.tsx | Adds "Sync Variants" menu item |
| src/tui/app.tsx | Integrates sync screens and state management |
| test/tui.test.ts | Updates tests to account for new menu item |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@claude review thoroughly not only from a technical perspective but from a ux and product perspective Use CEV thinking and consider whether this covers all angles or there is more to make this features applicable universally |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
- Add CLAUDE.md to HomeScreen sync description for accuracy - Fix backup error attribution to report on all requested items - Remove double-counting bug in syncPermissions
this is an issue with Claude Code Action @numman-ali : #223 |
Summary
Changes
New Files
src/core/sync.ts- Core sync logic withsyncVariants(),createConfigBackup(),restoreConfigBackup()src/tui/hooks/useSync.ts- TUI state machine hooksrc/tui/screens/SyncSourceScreen.tsx- Single variant selectionsrc/tui/screens/SyncTargetsScreen.tsx- Multi-select targets with Space keyModified Files
src/core/index.ts- Export sync functionssrc/tui/app.tsx- Add sync screen handlers and statesrc/tui/screens/HomeScreen.tsx- Add "Sync Variants" menu itemtest/tui.test.ts- Fix menu navigation tests for new itemTUI Flow
What Gets Synced
config/skills/.claude.jsonmcpServerssettings.jsonpermissionsconfig/CLAUDE.mdWhat Does NOT Get Synced
Closes #8