Files
jackwener__opencli/docs/adapters/browser/wikipedia.md
jakevin 6f597a2a4b feat: 8 read adapters across 5 sites (arxiv / SO / coingecko / wikipedia / hf) (#1338)
* feat: add 13 read adapters across 6 sites (github / arxiv / SO / coingecko / wikipedia / hf)

New site:
- github: user, repo, search-repos, user-repos, releases (unauth REST API; 60 req/h IP limit)

Existing sites — gap-fill for high-traffic verticals:
- arxiv author (papers by author, newest first; au:"name" phrase match on the public Atom API)
- stackoverflow user / tag (Stack Exchange API 2.3, with HTML-entity decode for display names / titles)
- coingecko coin / trending (single-coin market detail; 24h trending search-volume)
- wikipedia page (full plain-text article extract; opt-in --paragraphs cap, no silent truncation)
- hf models / datasets (downloads/likes/trending/freshness sorted lists)

All adapters use Node-side func + typed errors per the post-#1332 convention:
- ArgumentError for invalid limit / bad enum / empty positional / malformed owner-repo
- EmptyResultError for genuinely-empty results (no silent return [])
- CommandExecutionError for upstream HTTP/JSON failures (rate limit / 5xx / parse)
- AuthRequiredError reserved for endpoints that genuinely refuse anonymous traffic
- No silent clamp on --limit; no sentinel rows; no scalar 'unknown' / '-' fallbacks

Audit gates locally green:
- check:typed-error-lint        196/196 (no new)
- check:silent-column-drop      103/103 (no new)
- check:doc-coverage --strict   113/113 (added github.md, extended 5 existing pages)
- advise:listing-id-pairing     advisory only (+2 wikipedia entries: title is the
                                round-trippable key into wikipedia/page; not a gate)

* chore: drop github adapter set per WAWQAQ directive

WAWQAQ (#opencli-pr-review): "我们不需要GitHub的adapter,因为已经有GH了"

Removes the 5 github commands + utils + docs added in 664ed1aa
(github/user, github/repo, github/search-repos, github/releases,
github/user-repos). The remaining 8 read commands across 5 sites
(arxiv author, stackoverflow user/tag, coingecko coin/trending,
wikipedia page, hf models/datasets) are unaffected.

Audit gates re-checked:
- check:typed-error-lint: 196/196 (baseline unchanged)
- check:silent-column-drop: 103/103 (baseline unchanged)
- doc-coverage: 112/112 (one less site documented)
- advise:listing-id-pairing: 12 advisory (unchanged)

* fix(adapter-expansion): tighten id and currency contracts
2026-05-06 02:24:16 +08:00

1.4 KiB

Wikipedia

Mode: 🌐 Public · Domain: wikipedia.org

Commands

Command Description
opencli wikipedia search Search Wikipedia articles
opencli wikipedia summary Get Wikipedia article summary
opencli wikipedia random Random Wikipedia article
opencli wikipedia trending Trending Wikipedia articles
opencli wikipedia page <title> Full plain-text article extract (optional paragraph cap)

Usage Examples

# Search articles
opencli wikipedia search "quantum computing" --limit 10

# Get article summary
opencli wikipedia summary "Artificial intelligence"

# Get the full article body (plain text, no silent truncation)
opencli wikipedia page "Transformer (deep learning architecture)"

# Cap to first 3 paragraphs explicitly
opencli wikipedia page "Photosynthesis" --paragraphs 3

# Use with other languages
opencli wikipedia search "人工智能" --lang zh
opencli wikipedia page "人工智能" --lang zh --paragraphs 5

# JSON output
opencli wikipedia search "Rust" -f json

Notes

  • summary returns the lead-section blurb truncated to 300 chars (legacy convention)
  • page returns the complete plain-text article body. Pass --paragraphs N to opt into a cap; default 0 means full article — no silent truncation

Prerequisites

  • No browser required — uses public Wikipedia API