feat: add wikipedia site shortcuts

Article, search, and non English wiki lookups via clis/wikipedia.org.json,
reachable as oc wiki, oc wikipedia, or oc wikipedia.org.

The article and lang commands use ?action=render, which returns the article
HTML without the interlanguage sidebar and Tools menu that otherwise eat
about half of a 500 token budget before any prose. Its links stay root
relative, so oc do <n> still follows them; the Parsoid endpoints render just
as clean but emit ./Title hrefs that resolve against the API path and break
link following.

Search uses the normal results page. The api.php JSON search endpoint is
cheaper on paper but distills to nothing today, since its results sit in a
nested query.search array.

Closes #21
This commit is contained in:
only-cli
2026-08-23 22:58:56 -04:00
parent 71b032bea5
commit d5e12ab710
3 changed files with 10 additions and 0 deletions
+1
View File
@@ -92,6 +92,7 @@ Works on any mostly-static site with no per-site setup: news sites, blogs, docum
| Stack Overflow | `oc so` (via Atom feeds and the Stack Exchange API) | `search <query>`, `question <id>`, `tag <name>`, `user <id>`, `recent` |
| Yahoo Finance | `oc yahoo` | `quote <symbol>`, `news <symbol>`, `history <symbol>`, `lookup <query>`, `markets`, `gainers`, `losers`, `trending` |
| YouTube | `oc yt` | `video <id>`, `channel <name>` |
| Wikipedia | `oc wiki` (via `action=render`) | `article <title>`, `search <query>`, `lang <code> <title>` |
| AWS docs | `oc aws` (search via DuckDuckGo) | `guide <service> <page>`, `page <service> <guide> <page>`, `cli <command>`, `search <query>` |
| Google Cloud docs | `oc gcp` (via docs.cloud.google.com, search via DuckDuckGo) | `docs <product>`, `page <product> <page>`, `gcloud <command>`, `search <query>` |
| Microsoft Learn | `oc learn` (search via its RSS API) | `azure <page>`, `doc <path>`, `cli <command>`, `search <query>` |
+8
View File
@@ -0,0 +1,8 @@
{
"domain": "wikipedia.org",
"commands": {
"article": { "open": "https://en.wikipedia.org/w/index.php?title={title}&action=render", "args": ["title"] },
"search": { "open": "https://en.wikipedia.org/w/index.php?search={query}&fulltext=1&ns0=1", "args": ["query"] },
"lang": { "open": "https://{code}.wikipedia.org/w/index.php?title={title}&action=render", "args": ["code", "title"] }
}
}
+1
View File
@@ -24,6 +24,7 @@ const ALIASES = {
aws: 'docs.aws.amazon.com',
gcp: 'cloud.google.com',
learn: 'learn.microsoft.com',
wiki: 'wikipedia.org',
};
/** @typedef {{open: string, args?: string[]}} Shortcut */