feat(experience): one-liner install/update docs catch up + version-watching skill

The one-liner entry docs were untouched by the backend upgrade — new users
following "帮我安装 Agent Reach" would still get the old world. Now:

- docs/install.md: xiaohongshu section rewritten (desktop OpenCLI with the
  one manual extension click / server xiaohongshu-mcp with QR + 150MB
  first-run warning / legacy xhs-cli kept as fallback); Reddit section says
  plainly there is no zero-config path; optional-channel menu gains OpenCLI;
  upstream table matches the new routing with a doctor --json pointer
- docs/update.md: full rewrite — upgrade-only-what-exists tool refresh
  (incl. npm update for OpenCLI/mcporter, pinned git source for rdt-cli),
  one-time OpenCLI offer for desktops, skill sync now rides doctor's
  auto-sync instead of an inline python blob, WeChat-era content removed
- check-update / watch: "update available" now leads with the one-liner
  (帮我更新 Agent Reach:<update.md>) which updates package + tools + skill;
  bare pip stays as the package-only alternative
- fix: version compare was `!=` — a local build AHEAD of the latest release
  (installed from main during a release window) was told to "update" into a
  downgrade; now semantic tuple compare with fallback (+4 tests)
- skill (zh+en): description gains a NOT-for boundary (fetch-only, no write
  ops, defer to dedicated skills); new standing rule — after substantial
  tasks run check-update and append a one-liner update hint to the wrap-up,
  never interrupting or nagging
- SKILL_en.md restructured to the same three-layer skeleton as the Chinese
  version (124-line body, shared references/) instead of a 263-line
  everything-inline page

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Pnant
2026-06-11 17:14:57 +08:00
parent 380cfd565d
commit fc24fb699b
6 changed files with 223 additions and 324 deletions
+34 -6
View File
@@ -1635,6 +1635,35 @@ def _github_get_with_retry(url, timeout=10, retries=3, sleeper=time.sleep):
return None, "unknown", retries
#: Full update = package + upstream tools + skill. The one-liner walks an
#: agent through all three (docs/update.md); bare pip only updates the package.
_UPDATE_INSTRUCTIONS = (
"更新方式(推荐,复制这句话给你的 AI Agent,会完整更新本体+上游工具+skill):\n"
" 帮我更新 Agent Reachhttps://raw.githubusercontent.com/Panniantong/agent-reach/main/docs/update.md\n"
"仅更新本体(不含上游工具和 skill):\n"
" pip install --upgrade https://github.com/Panniantong/agent-reach/archive/main.zip"
)
def _is_newer_version(remote: str, local: str) -> bool:
"""True if remote is strictly newer than local (semantic compare).
A plain != would tell users "update available" when their local build is
AHEAD of the latest release (e.g. installed from main during a release
window) — and walk them into a downgrade.
"""
def parse(v):
try:
return tuple(int(x) for x in v.strip().split("."))
except ValueError:
return None
r, l = parse(remote), parse(local)
if r is None or l is None:
return remote != local # unparseable — fall back to old behavior
return r > l
def _cmd_check_update():
"""Check for newer versions on GitHub."""
from agent_reach import __version__
@@ -1654,7 +1683,7 @@ def _cmd_check_update():
latest = data.get("tag_name", "").lstrip("v")
body = data.get("body", "")
if latest and latest != __version__:
if latest and _is_newer_version(latest, __version__):
print(f"最新版本: v{latest} ← 有更新!")
if body:
print()
@@ -1663,8 +1692,7 @@ def _cmd_check_update():
for line in body.strip().split("\n")[:20]:
print(f" {line}")
print()
print("更新命令:")
print(" pip install --upgrade https://github.com/Panniantong/agent-reach/archive/main.zip")
print(_UPDATE_INSTRUCTIONS)
return "update_available"
print(f"✅ 已是最新版本")
return "up_to_date"
@@ -1686,8 +1714,7 @@ def _cmd_check_update():
date = commit.get("commit", {}).get("committer", {}).get("date", "")[:10]
print(f"最新提交: {sha} ({date}) {msg}")
print()
print("更新命令:")
print(" pip install --upgrade https://github.com/Panniantong/agent-reach/archive/main.zip")
print(_UPDATE_INSTRUCTIONS)
return "unknown"
commit_err = _classify_github_response_error(resp2)
@@ -1760,7 +1787,8 @@ def _cmd_watch():
if release_body:
for line in release_body.strip().split("\n")[:10]:
print(f" {line}")
print(f" 更新: pip install --upgrade https://github.com/Panniantong/agent-reach/archive/main.zip")
print(" 更新(一句话发给 Agent 即可完整更新):")
print(" 帮我更新 Agent Reachhttps://raw.githubusercontent.com/Panniantong/agent-reach/main/docs/update.md")
if __name__ == "__main__":