@only-cli/oc 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -23
- package/clis/reddit.com.json +6 -4
- package/package.json +1 -1
- package/skills/web-browsing-cli/SKILL.md +9 -9
- package/src/fetch.js +31 -6
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ Works on any mostly-static site with no per-site setup: news sites, blogs, docum
|
|
|
81
81
|
| website | command | shortcuts |
|
|
82
82
|
| --- | --- | --- |
|
|
83
83
|
| Hacker News | `oc hn` | `top`, `new`, `item <id>`, `user <name>` |
|
|
84
|
-
| Reddit | `oc reddit` (via
|
|
84
|
+
| Reddit | `oc reddit` (via the Atom feeds on www.reddit.com) | `sub <name>`, `new <name>`, `top <name>`, `post <id>`, `user <name>`, `search <query>` |
|
|
85
85
|
| GitHub | `oc gh` | `repo <owner> <name>`, `user <name>`, `search <query>`, `trending`, `issues <owner> <name>` |
|
|
86
86
|
| X | `oc x` | `user <name>`, `post <id>` |
|
|
87
87
|
| LinkedIn | `oc linkedin` | `profile <name>`, `company <name>`, `jobs <query>` (public guest views) |
|
|
@@ -107,7 +107,7 @@ Works on any mostly-static site with no per-site setup: news sites, blogs, docum
|
|
|
107
107
|
|
|
108
108
|
A shortcut only ever resolves to a URL and then takes the same path `oc open` does, so it changes nothing about what a page costs or how it reads. The last argument takes every word after it, so `oc ddg search claude code cli` and `oc aws search s3 lifecycle rules` need no quoting, and a path argument keeps its slashes, so `oc learn doc azure/aks/what-is-aks` reaches that page.
|
|
109
109
|
|
|
110
|
-
A few of these (X, Stack Overflow, YouTube, Microsoft Learn search) read pages that look login-gated or JS-only from the outside, by finding the server-rendered HTML, feed, inline data, or public API the page already ships without a login. Stack Overflow search goes through the Stack Exchange API, and each result prints its `question_id`: read one with the `question <id>` feed rather than following its link, since the question page itself answers a bot challenge instead of the question. AWS, Google Cloud, Rust, Java, TypeScript, PHP, and cppreference render docs search client-side, or as a page too bare for oc to read, so their `search` goes through DuckDuckGo with a baked-in `site:` filter instead; Go needs no such fallback, because pkg.go.dev renders its search results on the server and `oc go search` simply opens them. Python's docs are built with Sphinx, which publishes the site's full-text search index as one static file, so `oc py search` fetches that index (cached on disk for a day), ranks it locally, and prints a numbered result list; a query that names a symbol exactly, like `json.dumps`, links straight to its anchor. The same backend will work for any Sphinx site, including most Read the Docs projects. MDN also renders its search client-side, but the page gets its results from a public JSON endpoint, so `oc mdn search` asks that endpoint directly and prints the site's own ranking; that `api` shape in a site definition works for any site whose search answers as JSON. Node.js ships no search endpoint at all, but publishes its whole API reference as one static JSON file, so `oc node search` ranks that file locally the same way the Sphinx backend does, under the same day cache, and every module, class, method, property, and event heading links to its own anchor. Ruby's docs are built with RDoc, which also ships its search index as one static file, so `oc ruby search` ranks every class, method, and guide page locally the same way. PHP's manual has a lookup endpoint that sends an exact function name straight to its page, which is what `oc php fn` rides. Not supported yet: pages that only render with JavaScript and sites with hard bot challenges that expose no feed. Sites that genuinely require your account can be reached with `oc login` (bring your own cookies).
|
|
110
|
+
A few of these (X, Reddit, Stack Overflow, YouTube, Microsoft Learn search) read pages that look login-gated or JS-only from the outside, by finding the server-rendered HTML, feed, inline data, or public API the page already ships without a login. Stack Overflow search goes through the Stack Exchange API, and each result prints its `question_id`: read one with the `question <id>` feed rather than following its link, since the question page itself answers a bot challenge instead of the question. Reddit goes through the Atom feeds on www.reddit.com: old.reddit.com has sent logged-out readers to a login page since June 2026 and the `.json` views answer 403 without an OAuth token, so a reddit.com page URL handed to `oc open` still meets that wall, where `oc reddit post <id>`, or the same URL with `/.rss` on the end, reads the post and its comments. oc asks reddit.com with its Firefox fingerprint first, because Reddit's edge refuses the Chrome one more often than not. The feeds carry titles, authors, dates, and bodies but no scores or comment counts, and anonymous reddit.com allows roughly ten requests a minute per address, so a burst of Reddit shortcuts ends in a 429 that takes minutes to clear. AWS, Google Cloud, Rust, Java, TypeScript, PHP, and cppreference render docs search client-side, or as a page too bare for oc to read, so their `search` goes through DuckDuckGo with a baked-in `site:` filter instead; Go needs no such fallback, because pkg.go.dev renders its search results on the server and `oc go search` simply opens them. Python's docs are built with Sphinx, which publishes the site's full-text search index as one static file, so `oc py search` fetches that index (cached on disk for a day), ranks it locally, and prints a numbered result list; a query that names a symbol exactly, like `json.dumps`, links straight to its anchor. The same backend will work for any Sphinx site, including most Read the Docs projects. MDN also renders its search client-side, but the page gets its results from a public JSON endpoint, so `oc mdn search` asks that endpoint directly and prints the site's own ranking; that `api` shape in a site definition works for any site whose search answers as JSON. Node.js ships no search endpoint at all, but publishes its whole API reference as one static JSON file, so `oc node search` ranks that file locally the same way the Sphinx backend does, under the same day cache, and every module, class, method, property, and event heading links to its own anchor. Ruby's docs are built with RDoc, which also ships its search index as one static file, so `oc ruby search` ranks every class, method, and guide page locally the same way. PHP's manual has a lookup endpoint that sends an exact function name straight to its page, which is what `oc php fn` rides. Not supported yet: pages that only render with JavaScript and sites with hard bot challenges that expose no feed. Sites that genuinely require your account can be reached with `oc login` (bring your own cookies).
|
|
111
111
|
|
|
112
112
|
Want a website on that list? Open a pull request, or an issue naming the site; see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
113
113
|
|
|
@@ -168,12 +168,13 @@ Private and internal addresses are refused whether or not a proxy is set. With a
|
|
|
168
168
|
|
|
169
169
|
## Benchmarks
|
|
170
170
|
|
|
171
|
-
Full methodology, per-task rows, and the Codex runs live in [only-cli/benchmarks](https://github.com/only-cli/benchmarks). Where things stand (oc 0.5.
|
|
171
|
+
Full methodology, per-task rows, and the Codex runs live in [only-cli/benchmarks](https://github.com/only-cli/benchmarks). Where things stand (oc 0.5.1, September 2026, live sites):
|
|
172
172
|
|
|
173
|
-
- **
|
|
174
|
-
- **
|
|
175
|
-
- **Half the cost of Claude Code's built-in `WebSearch`** on Wikipedia lookups: $0.
|
|
176
|
-
- **
|
|
173
|
+
- **125x fewer tokens than raw HTML** across the twelve real pages both could read: 8,519 against 1,064,474. 15x fewer than Jina Reader, 59x fewer than Playwright MCP's accessibility snapshot.
|
|
174
|
+
- **Real content on every page it could reach, and an honest failure on the two it could not.** Reddit now sends logged-out readers to a login wall, and every other tool returned that wall, or a 403 block page, as a success. The suite hands every tool the old.reddit.com page URLs, which still end at that wall; since 0.5.2 the `oc reddit` shortcuts read the same threads through Reddit's Atom feeds, a route the suite does not measure yet. Yahoo Finance refuses plain fetch outright and DuckDuckGo still blocks lynx; oc's Chrome impersonation read both.
|
|
175
|
+
- **Half the cost of Claude Code's built-in `WebSearch`** on Wikipedia lookups: $0.23 against $0.45 for five questions, both 5/5 correct, on 25x less fresh input.
|
|
176
|
+
- **21% cheaper than `WebFetch` and 34% cheaper than `WebSearch`** on eleven language docs lookups, at equal or better accuracy.
|
|
177
|
+
- **10% cheaper than `WebFetch` and 49% cheaper than `WebSearch`** on twelve dependency lookups across GitHub, npm, PyPI, RubyGems, crates.io, Docker Hub, Stack Overflow and an RFC, 12/12 correct with no tuned shortcut for most of those sites.
|
|
177
178
|
|
|
178
179
|
The tables behind those numbers:
|
|
179
180
|
|
|
@@ -181,27 +182,30 @@ The tables behind those numbers:
|
|
|
181
182
|
|
|
182
183
|
| method | tokens for 15 pages | notes |
|
|
183
184
|
| --- | ---: | --- |
|
|
184
|
-
| `oc open` |
|
|
185
|
-
| Jina Reader |
|
|
186
|
-
| Playwright MCP | 531,
|
|
187
|
-
| raw HTML fetch | 1,
|
|
185
|
+
| `oc open` | 8,971 | real content on 13 of 15 pages; the two Reddit pages are behind a login wall, and oc is the only reader that reported that instead of returning the wall |
|
|
186
|
+
| Jina Reader | 105,198 | both Reddit results are block pages; failed LinkedIn and the Node.js `fs` page outright |
|
|
187
|
+
| Playwright MCP | 531,303 | accessibility snapshots; both Reddit snapshots are the login wall |
|
|
188
|
+
| raw HTML fetch | 1,240,669 | both Reddit results are the login wall, 88,000 tokens of it each; Yahoo Finance refused the connection |
|
|
188
189
|
|
|
189
|
-
oc's budget keeps every page near 500 tokens however much it weighs: the
|
|
190
|
+
oc's budget keeps every page near 500 tokens however much it weighs: the YouTube watch page is 345,487 tokens raw and 688 through oc, Node's `fs` reference 275,425 against 479. On the twelve pages both could read, raw HTML costs 125x what oc does: 1,064,474 against 8,519.
|
|
190
191
|
|
|
191
|
-
**Whole tasks against the agent's built-in web tools.** Read cost is one thing, what an agent actually spends is another, so a second set of suites runs full lookups end to end in Claude Code (`claude-sonnet-5`), one tool per run, and grades every answer. Five Wikipedia lookups
|
|
192
|
+
**Whole tasks against the agent's built-in web tools.** Read cost is one thing, what an agent actually spends is another, so a second set of suites runs full lookups end to end in Claude Code (`claude-sonnet-5`), one tool per run, and grades every answer. Five Wikipedia lookups, eleven language documentation lookups, and twelve lookups on the pages around a dependency, where oc has shortcuts only for GitHub and Stack Overflow and renders the rest generically:
|
|
192
193
|
|
|
193
194
|
| suite | tool | correct | input tokens | cost | avg time |
|
|
194
195
|
| --- | --- | ---: | ---: | ---: | ---: |
|
|
195
|
-
| Wikipedia | `oc wiki` | 5/5 | 5,535 | $0.
|
|
196
|
-
| | built-in `WebFetch` | 5/5 |
|
|
197
|
-
| | built-in `WebSearch` | 5/5 |
|
|
198
|
-
| Language docs | `oc docs` | 11/11 | 12,
|
|
199
|
-
| | built-in `WebFetch` | 10/11 | 203,
|
|
200
|
-
| | built-in `WebSearch` | 11/11 |
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
196
|
+
| Wikipedia | `oc wiki` | 5/5 | 5,535 | $0.23 | 8s |
|
|
197
|
+
| | built-in `WebFetch` | 5/5 | 129,257 | $0.35 | 12s |
|
|
198
|
+
| | built-in `WebSearch` | 5/5 | 136,982 | $0.45 | 16s |
|
|
199
|
+
| Language docs | `oc docs` | 11/11 | 12,967 | $0.56 | 8s |
|
|
200
|
+
| | built-in `WebFetch` | 10/11 | 203,497 | $0.71 | 12s |
|
|
201
|
+
| | built-in `WebSearch` | 11/11 | 215,833 | $0.85 | 14s |
|
|
202
|
+
| Dependency research | `oc open` | 12/12 | 13,261 | $0.63 | 10s |
|
|
203
|
+
| | built-in `WebFetch` | 10/12 | 173,779 | $0.70 | 11s |
|
|
204
|
+
| | built-in `WebSearch` | 12/12 | 326,088 | $1.22 | 19s |
|
|
205
|
+
|
|
206
|
+
Input tokens are the fresh context each tool put in front of the model, which is the number the page size drives; totals including cache reads sit closer together because the agent's own prompt dominates them. oc stays flat at roughly 1,100 to 1,200 tokens per task, while `WebFetch` pays for whatever the page weighs, from 5.9x more on a short Wikipedia stub to 35x more on the German Berlin article. `WebFetch`'s three misses are access results: cppreference, npm, and Stack Overflow all refuse it, while oc's Chrome impersonation reads the same pages. The dependency suite is also where oc's generic renderer pays for hard pages: the JavaScript-only crates.io entry and a support table whose row spans several blocks each cost it eight turns, and on the two tasks that start a link away the built-in tools were cheaper. `WebSearch` was given only the question, never the URL, which is the honest way to use it and part of why it costs the most.
|
|
207
|
+
|
|
208
|
+
The same suites through Codex (`gpt-5.6-sol`, on the 0.4.0 and 0.5.0 runs) split. On Wikipedia, `oc wiki` was cheaper and also right where Codex's own search quoted a stale Berlin population. On the docs lookups Codex's search won by 16%: those facts are already in its snippets, and it answered most tasks in two turns without opening a page.
|
|
205
209
|
|
|
206
210
|
## Status
|
|
207
211
|
|
package/clis/reddit.com.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"domain": "reddit.com",
|
|
3
3
|
"commands": {
|
|
4
|
-
"sub": { "open": "https://
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
4
|
+
"sub": { "open": "https://www.reddit.com/r/{name}/.rss", "args": ["name"] },
|
|
5
|
+
"new": { "open": "https://www.reddit.com/r/{name}/new/.rss", "args": ["name"] },
|
|
6
|
+
"top": { "open": "https://www.reddit.com/r/{name}/top/.rss?t=week", "args": ["name"] },
|
|
7
|
+
"post": { "open": "https://www.reddit.com/comments/{id}/.rss", "args": ["id"] },
|
|
8
|
+
"user": { "open": "https://www.reddit.com/user/{name}/.rss", "args": ["name"] },
|
|
9
|
+
"search": { "open": "https://www.reddit.com/search.rss?q={query}", "args": ["query"] }
|
|
8
10
|
}
|
|
9
11
|
}
|
package/package.json
CHANGED
|
@@ -8,15 +8,15 @@ description: Token-efficient web browsing and web content extraction for AI agen
|
|
|
8
8
|
Renders a web page as a compact, numbered terminal view instead of raw HTML. A typical page is under 500 tokens.
|
|
9
9
|
|
|
10
10
|
```
|
|
11
|
-
npx --yes @only-cli/oc@0.5.
|
|
12
|
-
npx --yes @only-cli/oc@0.5.
|
|
13
|
-
npx --yes @only-cli/oc@0.5.
|
|
11
|
+
npx --yes @only-cli/oc@0.5.3 open <url> compact view, numbered elements
|
|
12
|
+
npx --yes @only-cli/oc@0.5.3 do <n> follow link [n], or read it if [n] is text
|
|
13
|
+
npx --yes @only-cli/oc@0.5.3 find <query> where a string appears, or that place itself
|
|
14
14
|
when only one matches
|
|
15
|
-
npx --yes @only-cli/oc@0.5.
|
|
16
|
-
npx --yes @only-cli/oc@0.5.
|
|
17
|
-
npx --yes @only-cli/oc@0.5.
|
|
18
|
-
npx --yes @only-cli/oc@0.5.
|
|
19
|
-
npx --yes @only-cli/oc@0.5.
|
|
15
|
+
npx --yes @only-cli/oc@0.5.3 next next ~500 tokens of the page already open
|
|
16
|
+
npx --yes @only-cli/oc@0.5.3 read <n> full text of region [n]
|
|
17
|
+
npx --yes @only-cli/oc@0.5.3 raw [url] whole page as markdown (--html for cleaned HTML)
|
|
18
|
+
npx --yes @only-cli/oc@0.5.3 login seed cookies (--cookie, --domain, --expires)
|
|
19
|
+
npx --yes @only-cli/oc@0.5.3 logout [session] forget a session: cookies and saved page
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
None of these except `open`/`do`/`raw <url>` fetch anything; they replay the page `open` already saved.
|
|
@@ -32,7 +32,7 @@ oc ddg search claude code oc so question 231767 oc learn doc azur
|
|
|
32
32
|
oc py library json oc mdn js Array/map oc node api fs
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Sites: `hn`, `reddit`, `gh`, `x`, `linkedin`, `ddg`, `bing`, `so`, `yahoo`, `yt`, `aws`, `gcp`, `learn`, `wiki`, `py`, `mdn`, `node`, `ruby`, `go`, `rust`, `java`, `php`, `cpp`, `ts`. Name one by short name, bare name, or domain (`oc hn`, `oc ycombinator`, `oc news.ycombinator.com`). The last argument takes every word after it, so a query or title needs no quoting. `oc sites` lists every site with its verbs, which is cheaper than guessing one.
|
|
35
|
+
Sites: `hn`, `reddit`, `gh`, `x`, `linkedin`, `ddg`, `bing`, `so`, `yahoo`, `yt`, `aws`, `gcp`, `learn`, `wiki`, `py`, `mdn`, `node`, `ruby`, `go`, `rust`, `java`, `php`, `cpp`, `ts`. Name one by short name, bare name, or domain (`oc hn`, `oc ycombinator`, `oc news.ycombinator.com`). The last argument takes every word after it, so a query or title needs no quoting. `oc sites` lists every site with its verbs, which is cheaper than guessing one. Reddit reads through its Atom feeds: a reddit.com page URL given to `open` meets a login wall or a 403, so use `oc reddit post <id>` or add `/.rss` to the URL, and keep Reddit calls under about ten a minute or the site answers 429.
|
|
36
36
|
|
|
37
37
|
Prefer a shortcut over a hand-built URL when one exists for the site, and prefer `oc wiki article <title>` over a search when you already know the article's name.
|
|
38
38
|
|
package/src/fetch.js
CHANGED
|
@@ -555,6 +555,29 @@ function captureSetCookie(jar, url, res) {
|
|
|
555
555
|
jar.storeFromResponse(url, getSetCookieHeaders(res));
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
+
// Hosts whose edge answers the chrome fingerprint with a 403 or a 429 while
|
|
559
|
+
// letting firefox through. reddit.com started doing this in 2026 (#52), so
|
|
560
|
+
// starting with chrome there would turn every read into two requests against
|
|
561
|
+
// a per-address rate limit of about ten a minute. Subdomains inherit the
|
|
562
|
+
// entry.
|
|
563
|
+
const FIREFOX_FIRST_HOSTS = ['reddit.com'];
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* The order in which impers identities are tried for a URL.
|
|
567
|
+
* @param {string} target
|
|
568
|
+
* @returns {['chrome', 'firefox'] | ['firefox', 'chrome']}
|
|
569
|
+
*/
|
|
570
|
+
export function identityOrder(target) {
|
|
571
|
+
let host = '';
|
|
572
|
+
try {
|
|
573
|
+
host = new URL(target).hostname.toLowerCase();
|
|
574
|
+
} catch {
|
|
575
|
+
return ['chrome', 'firefox'];
|
|
576
|
+
}
|
|
577
|
+
const firefoxFirst = FIREFOX_FIRST_HOSTS.some((h) => host === h || host.endsWith(`.${h}`));
|
|
578
|
+
return firefoxFirst ? ['firefox', 'chrome'] : ['chrome', 'firefox'];
|
|
579
|
+
}
|
|
580
|
+
|
|
558
581
|
/**
|
|
559
582
|
* Fetch a page through impers, downgrading identity when one is refused.
|
|
560
583
|
* Exported so the downgrade chain can be proven against a fake impers; the
|
|
@@ -565,14 +588,15 @@ function captureSetCookie(jar, url, res) {
|
|
|
565
588
|
* @returns {Promise<{url: string, html: string, status: number, via: string}>}
|
|
566
589
|
*/
|
|
567
590
|
export async function viaImpers(impers, target, jar) {
|
|
568
|
-
//
|
|
569
|
-
// blocked first attempt gets one cheap retry with a second identity. An
|
|
591
|
+
// A blocked first attempt gets one cheap retry with the other identity. An
|
|
570
592
|
// ImpersonateError is the same story one layer down: impers resolves the
|
|
571
593
|
// 'chrome' alias to its newest fingerprint, but the native library it loads
|
|
572
594
|
// can be an older system copy of libcurl-impersonate that predates that
|
|
573
595
|
// fingerprint and refuses it before any request leaves. Firefox aliases to
|
|
574
596
|
// an older target that such a library usually still knows, and when both
|
|
575
597
|
// identities are refused the plain fetch transport still gets the page.
|
|
598
|
+
// Hosts that are known to refuse chrome outright start with firefox, so the
|
|
599
|
+
// usual case there costs one request instead of a 403 and a retry.
|
|
576
600
|
const asking = (impersonate) => (url) =>
|
|
577
601
|
impers.get(url, {
|
|
578
602
|
impersonate,
|
|
@@ -590,11 +614,12 @@ export async function viaImpers(impers, target, jar) {
|
|
|
590
614
|
return null;
|
|
591
615
|
}
|
|
592
616
|
};
|
|
593
|
-
|
|
594
|
-
let
|
|
617
|
+
const [first, second] = identityOrder(target);
|
|
618
|
+
let via = `impers:${first}`;
|
|
619
|
+
let got = await attempt(first);
|
|
595
620
|
if (!got || got.status >= 400) {
|
|
596
|
-
via =
|
|
597
|
-
got = (await attempt(
|
|
621
|
+
via = `impers:${second}`;
|
|
622
|
+
got = (await attempt(second)) ?? got;
|
|
598
623
|
}
|
|
599
624
|
if (!got) return viaFetch(target, jar);
|
|
600
625
|
const { res, status } = got;
|