Remove MetaBot coupling from uninstall and workspace init.
Keep silent cleanup of legacy metabot stubs; drop METABOT_HOME symlink.
This commit is contained in:
@@ -19,7 +19,6 @@ stderr_console = Console(stderr=True)
|
|||||||
_LINK_MAP: dict[str, list[str]] = {
|
_LINK_MAP: dict[str, list[str]] = {
|
||||||
"myacademia": ["path_myacademia"],
|
"myacademia": ["path_myacademia"],
|
||||||
"myslides": ["path_myslides", "MYSLIDES_ROOT"],
|
"myslides": ["path_myslides", "MYSLIDES_ROOT"],
|
||||||
"metabot": ["METABOT_HOME"],
|
|
||||||
"mytoolkit": ["path_mytoolkit", "MYTOOLKIT_ROOT"],
|
"mytoolkit": ["path_mytoolkit", "MYTOOLKIT_ROOT"],
|
||||||
"mywebpage": ["path_mywebpage", "MYWEBPAGE_ROOT"],
|
"mywebpage": ["path_mywebpage", "MYWEBPAGE_ROOT"],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
"""``uninstall`` — remove CLI entry points; keep config/workspace by default.
|
"""``uninstall`` — remove CLI entry points; keep config/workspace by default.
|
||||||
|
|
||||||
Also removes leftover metabot stubs if present. ``--all`` deletes ~/.xiaohe,
|
Also removes leftover legacy stubs (metabot / mb / mm / doubao-tts) if present.
|
||||||
~/.metabot and ~/.mytoolkit; workspace is never touched.
|
``--all`` deletes ~/.xiaohe, ~/.mytoolkit and leftover ~/.metabot;
|
||||||
|
workspace is never touched.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -17,12 +18,30 @@ stderr_console = Console(stderr=True)
|
|||||||
console = Console()
|
console = Console()
|
||||||
|
|
||||||
BIN_NAMES = (
|
BIN_NAMES = (
|
||||||
"xiaohe", "myagents", "myclaude", "mykimi", "mycodex", "myhermes",
|
"xiaohe",
|
||||||
"mycursor", "mytoolkit", "metabot", "mb", "mm", "doubao-tts",
|
"myagents",
|
||||||
|
"myclaude",
|
||||||
|
"mykimi",
|
||||||
|
"mycodex",
|
||||||
|
"myhermes",
|
||||||
|
"mycursor",
|
||||||
|
"mytoolkit",
|
||||||
)
|
)
|
||||||
METABOT_COMPLETIONS = (
|
LEGACY_BIN_NAMES = (
|
||||||
"mb", "mm", "metabot", "doubao-tts",
|
"metabot",
|
||||||
"_mb", "_mm", "_metabot", "_doubao-tts",
|
"mb",
|
||||||
|
"mm",
|
||||||
|
"doubao-tts",
|
||||||
|
)
|
||||||
|
LEGACY_COMPLETIONS = (
|
||||||
|
"mb",
|
||||||
|
"mm",
|
||||||
|
"metabot",
|
||||||
|
"doubao-tts",
|
||||||
|
"_mb",
|
||||||
|
"_mm",
|
||||||
|
"_metabot",
|
||||||
|
"_doubao-tts",
|
||||||
)
|
)
|
||||||
PY_PACKAGES = ("mytoolkit", "myagents")
|
PY_PACKAGES = ("mytoolkit", "myagents")
|
||||||
|
|
||||||
@@ -91,20 +110,23 @@ def uninstall_cmd(remove_all: bool, yes: bool) -> None:
|
|||||||
console.print(
|
console.print(
|
||||||
" - CLI entry points: xiaohe, myclaude, mykimi, mycodex, myhermes,"
|
" - CLI entry points: xiaohe, myclaude, mykimi, mycodex, myhermes,"
|
||||||
)
|
)
|
||||||
|
console.print(" mycursor, myagents, mytoolkit")
|
||||||
console.print(
|
console.print(
|
||||||
" mycursor, myagents, mytoolkit, metabot, mb, mm, doubao-tts"
|
" - legacy leftovers if present: metabot, mb, mm, doubao-tts"
|
||||||
)
|
)
|
||||||
console.print(" - shell completions for the above")
|
console.print(" - shell completions for the above")
|
||||||
console.print(" - desktop launcher (Xiaohe Agent.app / Xiaohe Agent.desktop)")
|
console.print(" - desktop launcher (Xiaohe Agent.app / Xiaohe Agent.desktop)")
|
||||||
console.print(" - pip packages: mytoolkit, myagents")
|
console.print(" - pip packages: mytoolkit, myagents")
|
||||||
if remove_all:
|
if remove_all:
|
||||||
console.print(" - [red]~/.xiaohe (settings, secrets, keys)[/red]")
|
console.print(" - [red]~/.xiaohe (settings, secrets, keys)[/red]")
|
||||||
console.print(" - [red]~/.metabot (Feishu bot config)[/red]")
|
|
||||||
console.print(" - [red]~/.mytoolkit (mytoolkit config, incl. keys)[/red]")
|
console.print(" - [red]~/.mytoolkit (mytoolkit config, incl. keys)[/red]")
|
||||||
|
console.print(
|
||||||
|
" - [red]~/.metabot (legacy leftover, if present)[/red]"
|
||||||
|
)
|
||||||
console.print("[bold]Will keep:[/bold]")
|
console.print("[bold]Will keep:[/bold]")
|
||||||
if not remove_all:
|
if not remove_all:
|
||||||
console.print(" - ~/.xiaohe (settings, keys)")
|
console.print(" - ~/.xiaohe (settings, keys)")
|
||||||
console.print(" - ~/.metabot and ~/.mytoolkit (bot/tool configs)")
|
console.print(" - ~/.mytoolkit (tool configs)")
|
||||||
console.print(f" - workspace: {get_workspace_root(create=False)}")
|
console.print(f" - workspace: {get_workspace_root(create=False)}")
|
||||||
console.print(" - rc-file edits (PATH line, ANTHROPIC_* exports) and the claude CLI")
|
console.print(" - rc-file edits (PATH line, ANTHROPIC_* exports) and the claude CLI")
|
||||||
|
|
||||||
@@ -115,8 +137,8 @@ def uninstall_cmd(remove_all: bool, yes: bool) -> None:
|
|||||||
# Deleting these dirs destroys settings and every saved credential —
|
# Deleting these dirs destroys settings and every saved credential —
|
||||||
# always require the full confirmation chain, even with --yes.
|
# always require the full confirmation chain, even with --yes.
|
||||||
if not click.confirm(
|
if not click.confirm(
|
||||||
"This also deletes ~/.xiaohe, ~/.metabot and ~/.mytoolkit — config, "
|
"This also deletes ~/.xiaohe, ~/.mytoolkit and any leftover "
|
||||||
"bot config and ALL saved API keys. Continue?",
|
"~/.metabot — config and ALL saved API keys. Continue?",
|
||||||
default=False,
|
default=False,
|
||||||
err=True,
|
err=True,
|
||||||
):
|
):
|
||||||
@@ -136,9 +158,9 @@ def uninstall_cmd(remove_all: bool, yes: bool) -> None:
|
|||||||
|
|
||||||
# Entry-point scripts in ~/.local/bin (defensive: pip removes its own).
|
# Entry-point scripts in ~/.local/bin (defensive: pip removes its own).
|
||||||
local_bin = home / ".local" / "bin"
|
local_bin = home / ".local" / "bin"
|
||||||
for name in BIN_NAMES:
|
for name in (*BIN_NAMES, *LEGACY_BIN_NAMES):
|
||||||
_remove_path(local_bin / name, removed)
|
_remove_path(local_bin / name, removed)
|
||||||
for name in METABOT_COMPLETIONS:
|
for name in LEGACY_COMPLETIONS:
|
||||||
_remove_path(local_bin / "completions" / name, removed)
|
_remove_path(local_bin / "completions" / name, removed)
|
||||||
comp_dir = local_bin / "completions"
|
comp_dir = local_bin / "completions"
|
||||||
if comp_dir.is_dir() and not any(comp_dir.iterdir()):
|
if comp_dir.is_dir() and not any(comp_dir.iterdir()):
|
||||||
@@ -151,8 +173,8 @@ def uninstall_cmd(remove_all: bool, yes: bool) -> None:
|
|||||||
|
|
||||||
if remove_all:
|
if remove_all:
|
||||||
_remove_path(home / ".xiaohe", removed)
|
_remove_path(home / ".xiaohe", removed)
|
||||||
_remove_path(home / ".metabot", removed)
|
|
||||||
_remove_path(home / ".mytoolkit", removed)
|
_remove_path(home / ".mytoolkit", removed)
|
||||||
|
_remove_path(home / ".metabot", removed)
|
||||||
|
|
||||||
for warning in warnings:
|
for warning in warnings:
|
||||||
stderr_console.print(f"[yellow]warning: {warning}[/yellow]")
|
stderr_console.print(f"[yellow]warning: {warning}[/yellow]")
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class TestUninstall:
|
|||||||
assert not (local_bin / "completions").exists() # empty dir cleaned
|
assert not (local_bin / "completions").exists() # empty dir cleaned
|
||||||
assert not (fake_home / "Desktop" / "Xiaohe Agent.app").exists()
|
assert not (fake_home / "Desktop" / "Xiaohe Agent.app").exists()
|
||||||
assert (fake_home / ".xiaohe" / "agent" / "config.json").is_file()
|
assert (fake_home / ".xiaohe" / "agent" / "config.json").is_file()
|
||||||
|
# Legacy leftover dir kept unless --all
|
||||||
assert (fake_home / ".metabot" / "bots.json").is_file()
|
assert (fake_home / ".metabot" / "bots.json").is_file()
|
||||||
assert (fake_home / ".mytoolkit" / "config.json").is_file()
|
assert (fake_home / ".mytoolkit" / "config.json").is_file()
|
||||||
assert (fake_home / "workspace").is_dir()
|
assert (fake_home / "workspace").is_dir()
|
||||||
@@ -64,7 +65,7 @@ class TestUninstall:
|
|||||||
)
|
)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert not (fake_home / ".xiaohe").exists()
|
assert not (fake_home / ".xiaohe").exists()
|
||||||
assert not (fake_home / ".metabot").exists()
|
assert not (fake_home / ".metabot").exists() # legacy leftover
|
||||||
assert not (fake_home / ".mytoolkit").exists()
|
assert not (fake_home / ".mytoolkit").exists()
|
||||||
assert (fake_home / "workspace").is_dir() # workspace never touched
|
assert (fake_home / "workspace").is_dir() # workspace never touched
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user