- Electron + React + TypeScript 桌面宠物外壳 - xterm.js + node-pty 直接对接 Claude CLI 进程 - 宠物 orb(80x80)可拖拽,点击展开终端面板 - CRT 复古终端主题(扫描线、文字发光) - 全局快捷键 Cmd+Shift+C 显隐 - 窗口位置自动保存 - 中华田园犬吉祥物 icon(AI 生成) - Makefile 新增 `make app` 打包命令
62 lines
1.7 KiB
Python
62 lines
1.7 KiB
Python
"""Reinstall myclaude from the local repo."""
|
|
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import click
|
|
from rich.console import Console
|
|
|
|
from bin.commands.init import sync_workspace_links
|
|
from bin.project_root import get_myclaude_project_root
|
|
|
|
console = Console()
|
|
stderr_console = Console(stderr=True)
|
|
|
|
|
|
def _run_make_install(root: Path) -> int:
|
|
return subprocess.run(
|
|
["make", "install"],
|
|
cwd=str(root),
|
|
check=False,
|
|
).returncode
|
|
|
|
|
|
def _run_pip_editable(root: Path) -> int:
|
|
cmd = [sys.executable, "-m", "pip", "install", "-e", str(root)]
|
|
return subprocess.run(cmd, check=False).returncode
|
|
|
|
|
|
@click.command("update")
|
|
def update_cmd() -> None:
|
|
"""Reinstall myclaude and sync workspace symlinks."""
|
|
root = get_myclaude_project_root()
|
|
fallback = Path.home() / ".myclaude"
|
|
if root == fallback:
|
|
stderr_console.print(
|
|
"[red]Not inside myclaude repo.[/red] Set [cyan]MYCLAUDE_PROJECT_ROOT[/cyan] "
|
|
"or run from the clone.",
|
|
)
|
|
raise SystemExit(1)
|
|
|
|
console.print("[bold cyan]Updating myclaude…[/bold cyan]")
|
|
makefile = root / "Makefile"
|
|
if makefile.is_file():
|
|
rc = _run_make_install(root)
|
|
if rc != 0:
|
|
console.print(
|
|
"[yellow]make install failed, trying pip -e…[/yellow]"
|
|
)
|
|
rc = _run_pip_editable(root)
|
|
else:
|
|
rc = _run_pip_editable(root)
|
|
|
|
if rc != 0:
|
|
stderr_console.print("[red]Update failed.[/red]")
|
|
raise SystemExit(rc)
|
|
console.print("[green]myclaude updated.[/green]")
|
|
|
|
console.print()
|
|
console.print("[bold cyan]Syncing workspace links…[/bold cyan]")
|
|
sync_workspace_links()
|