Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

feat(doctor): CLI health + audit techmeme/arXiv/trustpilot (U3)

Matt Van Horn1d55d8bef109
diff --git a/skills/last30days/scripts/lib/doctor.py b/skills/last30days/scripts/lib/doctor.py
index 544e49e2..5c598df2 100644
--- a/skills/last30days/scripts/lib/doctor.py
+++ b/skills/last30days/scripts/lib/doctor.py
@@ -157,6 +157,9 @@ SOURCE_ORDER = (
"polymarket",
"github",
"digg",
+ "techmeme",
+ "arxiv",
+ "trustpilot",
"tiktok",
"instagram",
"threads",
@@ -170,6 +173,21 @@ SOURCE_ORDER = (
"library",
)
+# Sources whose availability depends on a downloaded CLI binary. doctor probes
+# each (installed AND functional, via health.probe_dependency) and surfaces a
+# per-source marker plus a dedicated CLI-health block (R2). Everything not
+# listed is keyless - it needs no CLI. gh is OPTIONAL for GitHub (the REST tier
+# works without it), so its absence is a note, never a failure.
+CLI_DEPENDENCIES = {
+ "youtube": "yt-dlp",
+ "digg": "digg-pp-cli",
+ "techmeme": "techmeme-pp-cli",
+ "arxiv": "arxiv-pp-cli",
+ "trustpilot": "trustpilot-pp-cli",
+ "github": "gh",
+}
+_OPTIONAL_CLI_SOURCES = frozenset({"github"})
+
# Key-presence booleans for the setup block. NEVER values.
KEY_PRESENCE_VARS = (
"SCRAPECREATORS_API_KEY",
@@ -472,6 +490,36 @@ def _digg_record(config):
return _record(status=probe.status, fix=fix, detail=probe.detail, requires=requires)
+def _cli_gated_record(config, cli_name: str, purpose: str):
+ """A source gated purely on a keyless downloaded CLI (mirrors _digg_record).
+
+ ok -> installed and functional; opt-in -> never installed (an optional
+ source simply not enabled); its failing status -> installed off-PATH,
+ broken, or timing out (configured-but-broken).
+ """
+ probe = health.probe_dependency(cli_name)
+ requires = f"{cli_name} on the agent-subprocess PATH"
+ if probe.ok:
+ return _record(status=health.OK, detail=probe.detail, requires=requires)
+ entry = prescriptions.for_dependency_probe(probe)
+ fix = _fix_text(entry) if entry else probe.prescription
+ if probe.status == health.MISSING and not probe.off_path:
+ return _record(status="opt-in", fix=fix, detail=probe.detail, requires=requires)
+ return _record(status=probe.status, fix=fix, detail=probe.detail, requires=requires)
+
+
+def _techmeme_record(config):
+ return _cli_gated_record(config, "techmeme-pp-cli", "techmeme")
+
+
+def _arxiv_record(config):
+ return _cli_gated_record(config, "arxiv-pp-cli", "arxiv")
+
+
+def _trustpilot_record(config):
+ return _cli_gated_record(config, "trustpilot-pp-cli", "trustpilot")
+
+
def _tiktok_record(config):
return _sc_gated_record(config, "tiktok")
@@ -643,6 +691,9 @@ _SOURCE_BUILDERS: Dict[str, Callable[[Dict[str, Any]], Dict[str, Any]]] = {
"polymarket": _polymarket_record,
"github": _github_record,
"digg": _digg_record,
+ "techmeme": _techmeme_record,
+ "arxiv": _arxiv_record,
+ "trustpilot": _trustpilot_record,
"tiktok": _tiktok_record,
"instagram": _instagram_record,
"threads": _threads_record,
@@ -814,6 +865,24 @@ def build_report(config: Dict[str, Any]) -> Dict[str, Any]:
record["run_outcome"] = evidence["outcomes"].get(source) if evidence["fresh"] else None
record["audit_state"] = audit_state(source, record, record["run_outcome"])
+ # U3: annotate each CLI-dependent source with its binary's health so the
+ # per-source marker and the dedicated CLI-health block can render (R2).
+ for source, cli_name in CLI_DEPENDENCIES.items():
+ record = sources.get(source)
+ if record is None:
+ continue
+ try:
+ probe = health.probe_dependency(cli_name)
+ except Exception:
+ continue
+ record["cli"] = {
+ "name": cli_name,
+ "status": probe.status,
+ "off_path": bool(getattr(probe, "off_path", False)),
+ "detail": probe.detail,
+ "optional": source in _OPTIONAL_CLI_SOURCES,
+ }
+
# Sequential on purpose: the permission preflight composes pipeline
# diagnostics and must not race the source builders.
try:
@@ -915,8 +984,32 @@ def _sub_lane_lines(record: Dict[str, Any]) -> List[str]:
def _cli_health_lines(report: Dict[str, Any]) -> List[str]:
- """Dedicated CLI-health block (populated by U3)."""
- return []
+ """Dedicated CLI-health block (R2): one row per CLI-dependent source,
+ plus a note naming the keyless sources that need no CLI at all.
+ """
+ sources = report.get("sources") or {}
+ rows: List[str] = []
+ for source in SOURCE_ORDER:
+ cli = (sources.get(source) or {}).get("cli")
+ if not cli:
+ continue
+ ok = cli.get("status") == health.OK
+ glyph = "✓" if ok else "✗"
+ detail = cli.get("detail") or cli.get("status")
+ tail = ""
+ if not ok:
+ if cli.get("off_path"):
+ tail = " (installed off-PATH)"
+ elif cli.get("optional"):
+ tail = " (optional)"
+ rows.append(f" {glyph} {cli['name']} — {source}{tail}: {detail}")
+ if not rows:
+ return []
+ return (
+ ["CLI health (downloaded binaries):"]
+ + rows
+ + [" · Reddit, Hacker News, Polymarket need no CLI (keyless)"]
+ )
def render_text(report: Dict[str, Any]) -> str:
diff --git a/tests/test_doctor.py b/tests/test_doctor.py
index e7d88a03..19cfa643 100644
--- a/tests/test_doctor.py
+++ b/tests/test_doctor.py
@@ -875,5 +875,62 @@ class FourStateAudit(unittest.TestCase):
self.assertIn("13 items last run", text)
+class CliHealth(unittest.TestCase):
+ """U3: CLI-dependency health + techmeme/arxiv/trustpilot sources."""
+
+ def test_new_cli_sources_present(self):
+ report = _build(
+ {},
+ probe_map={
+ "techmeme-pp-cli": health.OK,
+ "arxiv-pp-cli": health.OK,
+ "trustpilot-pp-cli": health.OK,
+ },
+ )
+ for src in ("techmeme", "arxiv", "trustpilot"):
+ self.assertIn(src, report["sources"], src)
+ self.assertEqual("ok", report["sources"][src]["cli"]["status"], src)
+
+ def test_cli_marker_and_block_for_ytdlp(self):
+ report = _build({}, probe_map={"yt-dlp": health.OK})
+ self.assertEqual("ok", report["sources"]["youtube"]["cli"]["status"])
+ text = doctor.render_text(report)
+ self.assertIn("CLI health", text)
+ self.assertIn("[CLI: yt-dlp ✓]", text)
+
+ def test_keyless_source_has_no_cli(self):
+ report = _build({})
+ self.assertNotIn("cli", report["sources"]["polymarket"])
+ self.assertIn("need no CLI", doctor.render_text(report))
+
+ def test_digg_off_path_is_not_working(self):
+ def fake(name, timeout=health.PROBE_TIMEOUT):
+ if name == "digg-pp-cli":
+ return health.DependencyProbe(
+ name=name,
+ status=health.BROKEN,
+ detail="installed off PATH",
+ off_path=True,
+ prescription="add ~/.local/bin to PATH",
+ )
+ return health.DependencyProbe(
+ name=name, status=health.MISSING, detail="missing",
+ prescription="install",
+ )
+
+ with _Hermetic(), mock.patch("lib.health.probe_dependency", fake):
+ report = doctor.build_report({})
+ self.assertTrue(report["sources"]["digg"]["cli"]["off_path"])
+ self.assertEqual(
+ doctor.AUDIT_NOT_WORKING, report["sources"]["digg"]["audit_state"]
+ )
+
+ def test_gh_absent_github_still_working(self):
+ report = _build({}) # gh missing by default in _Hermetic
+ gh = report["sources"]["github"]
+ self.assertEqual(doctor.AUDIT_WORKING, gh["audit_state"])
+ self.assertTrue(gh["cli"]["optional"])
+
+
if __name__ == "__main__":
unittest.main()