feat(install): symlink myclaude to ~/.local/bin, make uninstall, docs

- Makefile: uv sync or venv pip install -e, then ln -sf to ~/.local/bin/myclaude
- Add scripts/rm_user_local_myclaude.py for safe unlink on make uninstall
- README: install path, shell completion guarded by command -v
- Track uv.lock for reproducible uv sync

Made-with: Cursor
This commit is contained in:
Zhengshou Lai
2026-04-10 08:23:14 +08:00
parent 596da55753
commit 21a7f032bf
4 changed files with 146 additions and 27 deletions
+20 -5
View File
@@ -1,15 +1,30 @@
ROOT_DIR := $(shell pwd)
VENV_MYCLAUDE := $(ROOT_DIR)/.venv/bin/myclaude
USER_LOCAL_MYCLAUDE := $(HOME)/.local/bin/myclaude
.PHONY: help install
.PHONY: help install uninstall _symlink-myclaude
help:
@echo "Usage: make [target]"
@echo ""
@echo " install Editable pip install of myclaude (uses uv when available)"
@echo " install Sync venv (uv or pip), symlink $(USER_LOCAL_MYCLAUDE) -> .venv/bin/myclaude"
@echo " uninstall Remove $(USER_LOCAL_MYCLAUDE) if it is a symlink to this repo"
install:
@if command -v uv >/dev/null 2>&1; then \
uv pip install -e "$(ROOT_DIR)"; \
@cd "$(ROOT_DIR)" && \
if command -v uv >/dev/null 2>&1; then \
uv sync; \
else \
python3 -m pip install -e "$(ROOT_DIR)"; \
test -x .venv/bin/pip || python3 -m venv .venv; \
.venv/bin/pip install -e .; \
fi
@$(MAKE) _symlink-myclaude
_symlink-myclaude:
@test -x "$(VENV_MYCLAUDE)" || { echo "error: missing $(VENV_MYCLAUDE)"; exit 1; }
@mkdir -p "$(HOME)/.local/bin"
@ln -sf "$(VENV_MYCLAUDE)" "$(USER_LOCAL_MYCLAUDE)"
@echo "Linked $(USER_LOCAL_MYCLAUDE) -> $(VENV_MYCLAUDE)"
uninstall:
@ROOT_DIR="$(ROOT_DIR)" python3 "$(ROOT_DIR)/scripts/rm_user_local_myclaude.py"