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
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
"""Remove ~/.local/bin/myclaude if it is a symlink to this repo's .venv/bin/myclaude."""
from __future__ import annotations
import os
import sys
def main() -> int:
root = os.path.normpath(os.environ.get("ROOT_DIR", os.getcwd()))
link = os.path.expanduser("~/.local/bin/myclaude")
want = os.path.normpath(os.path.join(root, ".venv", "bin", "myclaude"))
if not os.path.islink(link):
if os.path.lexists(link):
print("Skip: not a symlink, leaving untouched")
else:
print("Nothing to remove")
return 0
target = os.readlink(link)
if not os.path.isabs(target):
target = os.path.join(os.path.dirname(link), target)
target = os.path.normpath(target)
if target == want:
os.unlink(link)
print("Removed", link)
return 0
print("Skip: points to", target, "(not this repo's", want + ")")
return 0
if __name__ == "__main__":
sys.exit(main())