.PHONY: install uninstall status start-llm stop-llm restart-llm OPENCODE_DIR := $(HOME)/.config/opencode REPO_DIR := $(shell pwd) # Items to symlink ITEMS := skills tools agents # LLM services to manage LLM_SERVICES := atlas forge swift PLIST_PATH := ~/Library/LaunchAgents install: @echo "Installing OpenCode config symlinks..." @mkdir -p $(OPENCODE_DIR) @for item in $(ITEMS); do \ if [ -e "$(REPO_DIR)/.opencode/$$item" ]; then \ if [ -L "$(OPENCODE_DIR)/$$item" ]; then \ echo " $$item: already symlinked"; \ else \ ln -s "$(REPO_DIR)/.opencode/$$item" "$(OPENCODE_DIR)/$$item"; \ echo " $$item: symlinked"; \ fi \ else \ echo " $$item: skipped (not found)"; \ fi \ done @echo "Done!" uninstall: @echo "Removing OpenCode config symlinks..." @for item in $(ITEMS); do \ if [ -L "$(OPENCODE_DIR)/$$item" ]; then \ rm "$(OPENCODE_DIR)/$$item"; \ echo " $$item: removed symlink"; \ fi \ done @echo "Done!" status: @echo "OpenCode config status:" @for item in $(ITEMS); do \ if [ -L "$(OPENCODE_DIR)/$$item" ]; then \ target=$$(readlink "$(OPENCODE_DIR)/$$item"); \ echo " $$item: symlink -> $$target"; \ elif [ -e "$(OPENCODE_DIR)/$$item" ]; then \ echo " $$item: exists (not symlinked)"; \ else \ echo " $$item: not found"; \ fi \ done stop-llm-%: @echo "Stopping com.vllm-mlx-$*..." @launchctl bootout gui/$$(id -u) $(PLIST_PATH)/com.vllm-mlx.$*.plist 2>/dev/null || true stop-llm: $(patsubst %,stop-llm-%,$(LLM_SERVICES)) start-llm-%: @echo "Starting com.vllm-mlx-$*..." @launchctl bootstrap gui/$$(id -u) $(PLIST_PATH)/com.vllm-mlx.$*.plist start-llm: $(patsubst %,start-llm-%,$(LLM_SERVICES)) restart-llm-%: @echo "Restarting com.vllm-mlx-$*..." @launchctl bootout gui/$$(id -u) $(PLIST_PATH)/com.vllm-mlx.$*.plist || true @launchctl bootstrap gui/$$(id -u) $(PLIST_PATH)/com.vllm-mlx.$*.plist restart-llm: $(patsubst %,restart-llm-%,$(LLM_SERVICES))