Migrate from Claude Code to OpenCode structure
- Move legacy content to legacy/ folder (old, old2, docs, learnings, scripts) - Create new .opencode/ structure with skills/, tools/, agents/ folders - Update Makefile to symlink to ~/.config/opencode/ instead of ~/.claude/ - Update Makefile to manage skills, tools, and agents (remove settings.json) - Simplify install/uninstall (no backup logic) - Add README.md documenting the new structure - Keep settings.json as historical reference
This commit is contained in:
49
Makefile
49
Makefile
@@ -1,55 +1,48 @@
|
||||
.PHONY: install uninstall status
|
||||
|
||||
CLAUDE_DIR := $(HOME)/.claude
|
||||
OPENCODE_DIR := $(HOME)/.config/opencode
|
||||
REPO_DIR := $(shell pwd)
|
||||
|
||||
# Items to symlink
|
||||
ITEMS := scripts skills agents settings.json
|
||||
ITEMS := skills tools agents
|
||||
|
||||
# LLM services to manage
|
||||
LLM_SERVICES := atlas forge swift sage
|
||||
LLM_SERVICES := atlas forge swift
|
||||
|
||||
install:
|
||||
@echo "Installing Claude Code config symlinks..."
|
||||
@mkdir -p $(CLAUDE_DIR)
|
||||
@echo "Installing OpenCode config symlinks..."
|
||||
@mkdir -p $(OPENCODE_DIR)
|
||||
@for item in $(ITEMS); do \
|
||||
if [ -e "$(REPO_DIR)/$$item" ]; then \
|
||||
if [ -L "$(CLAUDE_DIR)/$$item" ]; then \
|
||||
if [ -e "$(REPO_DIR)/.opencode/$$item" ]; then \
|
||||
if [ -L "$(OPENCODE_DIR)/$$item" ]; then \
|
||||
echo " $$item: already symlinked"; \
|
||||
elif [ -e "$(CLAUDE_DIR)/$$item" ]; then \
|
||||
echo " $$item: backing up existing to $$item.bak"; \
|
||||
mv "$(CLAUDE_DIR)/$$item" "$(CLAUDE_DIR)/$$item.bak"; \
|
||||
ln -s "$(REPO_DIR)/$$item" "$(CLAUDE_DIR)/$$item"; \
|
||||
echo " $$item: symlinked"; \
|
||||
else \
|
||||
ln -s "$(REPO_DIR)/$$item" "$(CLAUDE_DIR)/$$item"; \
|
||||
ln -s "$(REPO_DIR)/.opencode/$$item" "$(OPENCODE_DIR)/$$item"; \
|
||||
echo " $$item: symlinked"; \
|
||||
fi \
|
||||
else \
|
||||
echo " $$item: skipped (not found)"; \
|
||||
fi \
|
||||
done
|
||||
@echo "Done! Restart Claude Code to apply changes."
|
||||
@echo "Done!"
|
||||
|
||||
uninstall:
|
||||
@echo "Removing Claude Code config symlinks..."
|
||||
@echo "Removing OpenCode config symlinks..."
|
||||
@for item in $(ITEMS); do \
|
||||
if [ -L "$(CLAUDE_DIR)/$$item" ]; then \
|
||||
rm "$(CLAUDE_DIR)/$$item"; \
|
||||
if [ -L "$(OPENCODE_DIR)/$$item" ]; then \
|
||||
rm "$(OPENCODE_DIR)/$$item"; \
|
||||
echo " $$item: removed symlink"; \
|
||||
if [ -e "$(CLAUDE_DIR)/$$item.bak" ]; then \
|
||||
mv "$(CLAUDE_DIR)/$$item.bak" "$(CLAUDE_DIR)/$$item"; \
|
||||
echo " $$item: restored backup"; \
|
||||
fi \
|
||||
fi \
|
||||
done
|
||||
@echo "Done!"
|
||||
|
||||
status:
|
||||
@echo "Claude Code config status:"
|
||||
@echo "OpenCode config status:"
|
||||
@for item in $(ITEMS); do \
|
||||
if [ -L "$(CLAUDE_DIR)/$$item" ]; then \
|
||||
target=$$(readlink "$(CLAUDE_DIR)/$$item"); \
|
||||
if [ -L "$(OPENCODE_DIR)/$$item" ]; then \
|
||||
target=$$(readlink "$(OPENCODE_DIR)/$$item"); \
|
||||
echo " $$item: symlink -> $$target"; \
|
||||
elif [ -e "$(CLAUDE_DIR)/$$item" ]; then \
|
||||
elif [ -e "$(OPENCODE_DIR)/$$item" ]; then \
|
||||
echo " $$item: exists (not symlinked)"; \
|
||||
else \
|
||||
echo " $$item: not found"; \
|
||||
@@ -58,7 +51,7 @@ status:
|
||||
|
||||
restart-llm-%:
|
||||
@echo "Restarting com.vllm-mlx-$*..."
|
||||
@launchctl bootout gui/$$(id -u) ~/Library/LaunchAgents/com.vllm-mlx-$*.plist || true
|
||||
@launchctl bootstrap gui/$$(id -u) ~/Library/LaunchAgents/com.vllm-mlx-$*.plist
|
||||
@launchctl bootout gui/$$(id -u) ~/Library/LaunchAgents/com.vllm-mlx.$*.plist || true
|
||||
@launchctl bootstrap gui/$$(id -u) ~/Library/LaunchAgents/com.vllm-mlx.$*.plist
|
||||
|
||||
restart-llm: $(patsubst %,restart-llm-%,$(LLM_SERVICES))
|
||||
restart-llm: $(patsubst %,restart-llm-%,$(LLM_SERVICES))
|
||||
Reference in New Issue
Block a user