@ysgao/web-cli 0.2.0 → 0.3.1
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 +28 -1
- package/dist/index.js +592 -186
- package/package.json +1 -1
- package/skills/web-cli/SKILL.md +95 -4
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ want just to use the tool.
|
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
65
|
node dist/index.js login <site> [--durationSeconds 90] [--save-credentials] [--forget-credentials]
|
|
66
|
-
node dist/index.js search "<query>" [--site <site>]... [--allow-visible-login] [--disable-login-recovery] [--loginTimeoutSeconds 240] [--markdown [path]] [--out [path]] [--json] [--pretty]
|
|
66
|
+
node dist/index.js search "<query>" [--site <site>]... [--allow-visible-login] [--disable-login-recovery] [--loginTimeoutSeconds 240] [--fulltext-budget <seconds>] [--max-article-chars <n>] [--markdown [path]] [--out [path]] [--json] [--pretty]
|
|
67
67
|
# always searches uptodate, clinicalkey, and googlemedsearch (the login-gated/medically-scoped
|
|
68
68
|
# subscription sites this CLI targets); --site adds more. For anything outside medicine/anatomy/
|
|
69
69
|
# substances/organisms, use `websearch` instead (general/open-web search, not restricted to a
|
|
@@ -76,6 +76,11 @@ node dist/index.js search "<query>" [--site <site>]... [--allow-visible-login] [
|
|
|
76
76
|
# stdout-capturing wraps around the terminal output (a trailing "exit code" marker, a log prefix
|
|
77
77
|
# on every line, stdout/stderr merged together) — the file at "outPath" is always pure, plain
|
|
78
78
|
# JSON.parse-able JSON with nothing else in it. See "Writing a report/JSON result to disk" below.
|
|
79
|
+
# --fulltext-budget (default 5s, per site) stops waiting for a key reference's full text the
|
|
80
|
+
# site is still preparing (large book chapters can take 10s+ on the site's side) and DEFERS it;
|
|
81
|
+
# --max-article-chars (default 60000) cuts a long article to its outline + opening. Either way the
|
|
82
|
+
# entry gets `moreAvailable.command` — an exact `web-cli get <site> '<url>'` that fetches the
|
|
83
|
+
# complete text on demand. Pass 0 to either to turn it off. See "Faster searches" below.
|
|
79
84
|
node dist/index.js get <site> <idOrUrl> [--allow-visible-login] [--disable-login-recovery] [--loginTimeoutSeconds 240]
|
|
80
85
|
node dist/index.js websearch "<query>" [--engine google|bing|gemini] [--model <model>] [--maxResults <n>] [--fallbackWaitSeconds <n>]
|
|
81
86
|
# general open-web search (NOT restricted to a fixed domain list, unlike the default `search`).
|
|
@@ -573,12 +578,34 @@ it.
|
|
|
573
578
|
|
|
574
579
|
Known sites are registered in `src/sites/index.ts`.
|
|
575
580
|
|
|
581
|
+
|
|
582
|
+
## Faster searches: deferred and truncated full texts
|
|
583
|
+
|
|
584
|
+
`search` fetches full text for a handful of top hits per site. Measured live, one very large
|
|
585
|
+
ClinicalKey book chapter (2.5MB) took ~10s to the first byte — the site assembling it — and 0.05s to
|
|
586
|
+
download, so the only way to speed that up is to not wait for it. Two defaults, both on:
|
|
587
|
+
|
|
588
|
+
- **`--fulltext-budget <seconds>`** (default `5`, per site): once the budget elapses, article fetches
|
|
589
|
+
still in flight are cancelled and returned as `moreAvailable.reason: "deferred"` (no `article`;
|
|
590
|
+
title/url/snippet intact). At least one full text per site is always waited for, so a slow start
|
|
591
|
+
can't defer everything. `0` waits for every full text.
|
|
592
|
+
- **`--max-article-chars <n>`** (default `60000`): a longer article keeps its whole `outline` and the
|
|
593
|
+
start of its text, ending in a visible `[… truncated …]` line (`moreAvailable.reason: "truncated"`).
|
|
594
|
+
`0` never truncates.
|
|
595
|
+
|
|
596
|
+
Neither is a failure (neither appears in `agentTask.unrecoveredFailures`). Every such entry carries
|
|
597
|
+
`moreAvailable.command` — an exact, shell-quoted `web-cli get <site> '<url>'` that returns the
|
|
598
|
+
**complete** text (`get` is never budgeted or truncated) — and `agentTask.instructions` tells the
|
|
599
|
+
agent to run it when the snippet, outline or truncated text isn't enough. In one live comparison this
|
|
600
|
+
cut a search from ~9s to ~6s and the JSON result from 5.6MB to 0.8MB.
|
|
601
|
+
|
|
576
602
|
## Troubleshooting
|
|
577
603
|
|
|
578
604
|
| Issue | Solution |
|
|
579
605
|
|-------|----------|
|
|
580
606
|
| Session expired | By default, nothing to do if a credential was saved (`web-cli login clinicalkey --save-credentials`) — it recovers silently. Otherwise pass `--allow-visible-login` to let a window open, or sign in ahead of time: `web-cli login clinicalkey` |
|
|
581
607
|
| `SESSION_EXPIRED` returned | No credential was stored for the site, or the silent refresh didn't recover it (no visible window opens unless you passed `--allow-visible-login`, in which case it timed out). With `--disable-login-recovery`: recovery is fully disabled, by design |
|
|
608
|
+
| A key reference has `moreAvailable` instead of (or with a cut-short) `article.text` | Not a failure — see "Faster searches" below: run its `moreAvailable.command` to fetch the complete text |
|
|
582
609
|
| Full text missing on a hit | Check `keyReferences[].fetchError`. `SESSION_EXPIRED` there means signed in but not entitled to that item; `DISCOVERY_FAILED` means the article endpoint needs re-learning |
|
|
583
610
|
| Your own Chrome is open | Not a problem, and never was worth quitting it for — automation uses its own instance (see `src/discovery/chromeWrapperApp.ts`, and its regression tests in `test/chromeWrapperApp.test.ts`) |
|
|
584
611
|
| Discovery failed | Run: `node dist/index.js observe --site uptodate --intent search --param "test"` — see **Manual discovery with `observe`** above for a full walkthrough |
|