a37e9aa190
BREAKING CHANGE: Remove all `agent-reach read` and `agent-reach search-*` commands. Agent Reach is now an installer, configuration tool, and doctor — not a wrapper layer. After installation, agents call upstream tools directly (bird CLI, yt-dlp, mcporter, gh CLI, Jina Reader, etc.). What's kept: - agent-reach install: one-shot installer - agent-reach doctor: channel status overview - agent-reach configure: cookies, proxy, credentials - agent-reach setup: interactive wizard - SKILL.md: complete guide for agents to use upstream tools directly What's removed: - agent-reach read URL (and all channel read() methods) - agent-reach search-* commands (and all channel search() methods) - ReadResult / SearchResult data classes - URL routing system (get_channel_for_url) - All parsing/conversion logic (VTT, Reddit JSON, bird text parser, etc.) - MCP server read/search tools (kept only get_status) Net change: -1790 lines. Less code = fewer bugs.
30 lines
925 B
Python
30 lines
925 B
Python
# -*- coding: utf-8 -*-
|
|
"""GitHub — check if gh CLI is available."""
|
|
|
|
import shutil
|
|
import subprocess
|
|
from .base import Channel
|
|
|
|
|
|
class GitHubChannel(Channel):
|
|
name = "github"
|
|
description = "GitHub 仓库和代码"
|
|
backends = ["gh CLI"]
|
|
tier = 0
|
|
|
|
def can_handle(self, url: str) -> bool:
|
|
from urllib.parse import urlparse
|
|
return "github.com" in urlparse(url).netloc.lower()
|
|
|
|
def check(self, config=None):
|
|
if not shutil.which("gh"):
|
|
return "warn", "gh CLI 未安装。安装:https://cli.github.com"
|
|
try:
|
|
subprocess.run(
|
|
["gh", "auth", "status"],
|
|
capture_output=True, text=True, timeout=5
|
|
)
|
|
return "ok", "完整可用(读取、搜索、Fork、Issue、PR 等)"
|
|
except Exception:
|
|
return "ok", "gh CLI 已装但未认证。运行 gh auth login 可解锁完整功能"
|