feat: xiaohe upgrade + 启动器更名 Xiaohe Agent + CLI 输出全英文
- upgrade: 查版本(install.sh)→确认→rich 进度条下载→落 runtime 切 current(留两版)→重装三件套→自动 sync
- launcher: 'Xiaohe Agent.app' / 'Xiaohe Agent.desktop',自动清理旧 XiaoheAgent.{command,app,desktop}
- 修复 _current_version 对缺失 current 软链误判为 'current'
- 全部提示/log 英文化;93 tests passed
This commit is contained in:
@@ -100,19 +100,23 @@ class TestCreateLauncher:
|
||||
) -> None:
|
||||
(runtime / "assets" / "icon").mkdir(parents=True)
|
||||
(runtime / "assets" / "icon" / "XiaoheAgent.icns").write_bytes(b"icns")
|
||||
legacy = fake_home / "Desktop" / "XiaoheAgent.command"
|
||||
legacy.write_text("#!/bin/sh\n")
|
||||
legacy_cmd = fake_home / "Desktop" / "XiaoheAgent.command"
|
||||
legacy_cmd.write_text("#!/bin/sh\n")
|
||||
legacy_app = fake_home / "Desktop" / "XiaoheAgent.app"
|
||||
legacy_app.mkdir()
|
||||
monkeypatch.setattr(
|
||||
sync_mod.os, "uname", lambda: type("U", (), {"sysname": "Darwin"})
|
||||
)
|
||||
sync_mod._create_launcher()
|
||||
app = fake_home / "Desktop" / "XiaoheAgent.app"
|
||||
app = fake_home / "Desktop" / "Xiaohe Agent.app"
|
||||
executable = app / "Contents" / "MacOS" / "XiaoheAgent"
|
||||
assert (app / "Contents" / "Info.plist").is_file()
|
||||
plist = (app / "Contents" / "Info.plist").read_text()
|
||||
assert "Xiaohe Agent" in plist
|
||||
assert (app / "Contents" / "Resources" / "XiaoheAgent.icns").is_file()
|
||||
assert executable.stat().st_mode & 0o111
|
||||
assert "xiaohe" in executable.read_text()
|
||||
assert not legacy.exists() # superseded .command removed
|
||||
assert not legacy_cmd.exists() # superseded .command removed
|
||||
assert not legacy_app.exists() # renamed from XiaoheAgent.app
|
||||
|
||||
def test_linux_desktop_entry_with_icon(
|
||||
self, runtime: Path, fake_home: Path, monkeypatch: pytest.MonkeyPatch
|
||||
@@ -124,16 +128,8 @@ class TestCreateLauncher:
|
||||
)
|
||||
sync_mod._create_launcher()
|
||||
entry = (
|
||||
fake_home / ".local" / "share" / "applications" / "XiaoheAgent.desktop"
|
||||
fake_home / ".local" / "share" / "applications" / "Xiaohe Agent.desktop"
|
||||
)
|
||||
assert "Icon=xiaohe-agent" in entry.read_text()
|
||||
assert (
|
||||
fake_home
|
||||
/ ".local"
|
||||
/ "share"
|
||||
/ "icons"
|
||||
/ "hicolor"
|
||||
/ "512x512"
|
||||
/ "apps"
|
||||
/ "xiaohe-agent.png"
|
||||
).is_file()
|
||||
text = entry.read_text()
|
||||
assert "Name=Xiaohe Agent" in text
|
||||
assert "Icon=xiaohe-agent" in text
|
||||
|
||||
Reference in New Issue
Block a user