sync-to-claude.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # sync-to-claude.sh
  3. # Syncs OpenCode Agents to Claude Code plugin directory
  4. SOURCE_DIR=".opencode/agent"
  5. DEST_DIR=".opencode/integrations/claude-code/agents"
  6. CLAUDE_DIR=".claude/plugins/openagent"
  7. echo "🚀 Starting OpenBridge Sync..."
  8. # Ensure destination exists
  9. mkdir -p "$DEST_DIR"
  10. # 1. Sync Subagents (Core logic)
  11. echo "📦 Syncing subagents..."
  12. cp .opencode/agent/subagents/core/*.md "$DEST_DIR/" 2>/dev/null
  13. # 2. Sync Category Agents (Convert to Claude Subagents)
  14. # Note: We rename them to be flatter for Claude's /agents menu
  15. echo "🤖 Syncing category agents..."
  16. find "$SOURCE_DIR" -maxdepth 2 -name "*.md" -not -path "*/subagents/*" | while read -r agent; do
  17. filename=$(basename "$agent")
  18. # Add Claude-specific frontmatter if missing (simple approach)
  19. # Claude needs name and description in frontmatter
  20. cp "$agent" "$DEST_DIR/$filename"
  21. done
  22. # 3. Installation - Link to .claude directory for immediate use
  23. echo "🔗 Installing plugin to .claude/plugins/openagent..."
  24. mkdir -p .claude/plugins
  25. # Use a symbolic link so changes in integrations/ are reflected
  26. rm -rf "$CLAUDE_DIR"
  27. ln -s "$(pwd)/.opencode/integrations/claude-code" "$CLAUDE_DIR"
  28. echo "✅ Sync complete!"
  29. echo "💡 To use in Claude Code, run: claude"
  30. echo " Claude will now automatically use 'context-scout' and apply 'repo-standards'."