feat: auto-install WeChat article tools during install (#80)
* feat: auto-install WeChat article tools during agent-reach install
WeChat (微信公众号) deps are now auto-installed during 'agent-reach install':
- Python packages: camoufox[geoip], markdownify, beautifulsoup4, httpx, miku_ai
- Tool repo: wechat-article-for-ai cloned to ~/.agent-reach/tools/
No login or configuration needed — works out of the box like YouTube/RSS.
Updated README tables to reflect zero-config status.
Also covers safe mode and dry-run.
* feat: auto-install WeChat + add channel-setup reference to SKILL.md
1. WeChat auto-install during 'agent-reach install':
- pip install camoufox[geoip], markdownify, bs4, httpx, miku_ai
- clone wechat-article-for-ai to ~/.agent-reach/tools/
- covers safe mode and dry-run
- README tables: WeChat → zero-config
2. SKILL.md improvements:
- Added 'configure' triggers to description
- Added references/channel-setup.md with install steps for all
login-required platforms (Twitter, XHS, Douyin, LinkedIn, Boss)
- Principle: user only provides cookies, agent does everything else
* simplify: point to install.md URL instead of bundled reference
No need to maintain a separate channel-setup.md. Just tell agents
to fetch install.md when they need setup instructions.
---------
Co-authored-by: Panniantong <panniantong@users.noreply.github.com>
This commit is contained in:
parent
35073aed54
commit
cd94706d3b
4 changed files with 126 additions and 5 deletions
|
|
@ -442,6 +442,79 @@ def _install_system_deps():
|
|||
except Exception:
|
||||
print(" ⬜ Could not configure yt-dlp JS runtime (YouTube may not work)")
|
||||
|
||||
# ── WeChat Articles (miku_ai + camoufox + wechat-article-for-ai) ──
|
||||
_install_wechat_deps()
|
||||
|
||||
|
||||
def _install_wechat_deps():
|
||||
"""Install WeChat article reading and search dependencies."""
|
||||
import subprocess
|
||||
|
||||
print("📦 Setting up WeChat article tools...")
|
||||
|
||||
# Check if already installed
|
||||
has_camoufox = False
|
||||
has_miku = False
|
||||
try:
|
||||
import camoufox # noqa: F401
|
||||
has_camoufox = True
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
import miku_ai # noqa: F401
|
||||
has_miku = True
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# Install Python packages
|
||||
if has_camoufox and has_miku:
|
||||
print(" ✅ WeChat Python packages already installed")
|
||||
else:
|
||||
pkgs = []
|
||||
if not has_camoufox:
|
||||
pkgs.extend(["camoufox[geoip]", "markdownify", "beautifulsoup4", "httpx"])
|
||||
if not has_miku:
|
||||
pkgs.append("miku_ai")
|
||||
try:
|
||||
cmd = [sys.executable, "-m", "pip", "install", "--break-system-packages", "-q"] + pkgs
|
||||
subprocess.run(cmd, capture_output=True, encoding="utf-8", errors="replace", timeout=120)
|
||||
# Verify
|
||||
ok = True
|
||||
try:
|
||||
import importlib
|
||||
if not has_camoufox:
|
||||
importlib.import_module("camoufox")
|
||||
if not has_miku:
|
||||
importlib.import_module("miku_ai")
|
||||
except ImportError:
|
||||
ok = False
|
||||
if ok:
|
||||
print(f" ✅ WeChat Python packages installed ({', '.join(pkgs)})")
|
||||
else:
|
||||
print(f" ⚠️ Some WeChat packages failed to install. Try: pip install {' '.join(pkgs)}")
|
||||
except Exception:
|
||||
print(f" ⚠️ WeChat packages install failed. Try: pip install {' '.join(pkgs)}")
|
||||
|
||||
# Clone wechat-article-for-ai tool
|
||||
tools_dir = os.path.expanduser("~/.agent-reach/tools")
|
||||
wechat_dir = os.path.join(tools_dir, "wechat-article-for-ai")
|
||||
if os.path.isfile(os.path.join(wechat_dir, "main.py")):
|
||||
print(" ✅ wechat-article-for-ai tool already installed")
|
||||
else:
|
||||
try:
|
||||
os.makedirs(tools_dir, exist_ok=True)
|
||||
subprocess.run(
|
||||
["git", "clone", "--depth", "1",
|
||||
"https://github.com/bzd6661/wechat-article-for-ai.git", wechat_dir],
|
||||
capture_output=True, encoding="utf-8", errors="replace", timeout=60,
|
||||
)
|
||||
if os.path.isfile(os.path.join(wechat_dir, "main.py")):
|
||||
print(" ✅ wechat-article-for-ai tool installed")
|
||||
else:
|
||||
print(" ⚠️ wechat-article-for-ai clone failed. Try: git clone https://github.com/bzd6661/wechat-article-for-ai.git " + wechat_dir)
|
||||
except Exception:
|
||||
print(" ⚠️ wechat-article-for-ai clone failed. Try: git clone https://github.com/bzd6661/wechat-article-for-ai.git " + wechat_dir)
|
||||
|
||||
|
||||
def _install_system_deps_safe():
|
||||
"""Safe mode: check what's installed, print instructions for what's missing."""
|
||||
|
|
@ -472,6 +545,29 @@ def _install_system_deps_safe():
|
|||
else:
|
||||
print(" All system dependencies are installed!")
|
||||
|
||||
# WeChat check (Python packages, not binaries)
|
||||
has_camoufox = has_miku = False
|
||||
try:
|
||||
import camoufox # noqa: F401
|
||||
has_camoufox = True
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
import miku_ai # noqa: F401
|
||||
has_miku = True
|
||||
except ImportError:
|
||||
pass
|
||||
if has_camoufox and has_miku:
|
||||
print(" ✅ WeChat article tools already installed")
|
||||
else:
|
||||
pkgs = []
|
||||
if not has_camoufox:
|
||||
pkgs.extend(["camoufox[geoip]", "markdownify", "beautifulsoup4", "httpx"])
|
||||
if not has_miku:
|
||||
pkgs.append("miku_ai")
|
||||
print(f" ⬜ WeChat article tools not found")
|
||||
print(f" Install: pip install {' '.join(pkgs)}")
|
||||
|
||||
|
||||
def _install_system_deps_dryrun():
|
||||
"""Dry-run: just show what would be checked/installed."""
|
||||
|
|
@ -492,6 +588,23 @@ def _install_system_deps_dryrun():
|
|||
else:
|
||||
print(f" 📥 {label}: would install via: {method}")
|
||||
|
||||
# WeChat
|
||||
has_camoufox = has_miku = False
|
||||
try:
|
||||
import camoufox # noqa: F401
|
||||
has_camoufox = True
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
import miku_ai # noqa: F401
|
||||
has_miku = True
|
||||
except ImportError:
|
||||
pass
|
||||
if has_camoufox and has_miku:
|
||||
print(" ✅ WeChat article tools: already installed, skip")
|
||||
else:
|
||||
print(" 📥 WeChat article tools: would install via: pip install camoufox[geoip] markdownify beautifulsoup4 httpx miku_ai")
|
||||
|
||||
|
||||
def _install_mcporter():
|
||||
"""Install mcporter and configure Exa + XiaoHongShu MCP servers."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue