refactor!: replace snapshot with reader fallback, collapse commands
Remove the snapshot command and enhance reader to try Firefox Reader View first, falling back to raw Turndown conversion of document.body when Reader View fails or is skipped via --no-reader. - reader always returns markdown by default (--format=json for structured) - JSON output includes method: 'reader' | 'raw' to signal extraction path - --no-reader skips Reader View (stays on loaded page, preserving JS mutations) - Add @ts-nocheck to test/smoke.js and exclude test/ from tsconfig - Update all tests from snapshot to reader with --no-reader for data URIs - Update AGENTS.md and help text BREAKING CHANGE: snapshot subcommand removed; use reader instead.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
This project provides small Firefox/Selenium browser utilities packaged by Nix:
|
||||
|
||||
- `glimpse` - generic page utilities with subcommands, including provider-backed search
|
||||
- `glimpse` - headless browser CLI with subcommands for page extraction, JS execution, screenshots, and search
|
||||
|
||||
Keep the tools simple, scriptable, and JSON-friendly.
|
||||
|
||||
@@ -18,7 +18,7 @@ npm run test:list
|
||||
node test/smoke.js <tag-or-name>
|
||||
```
|
||||
|
||||
For smoke testing without external network dependencies, use focused tags or scripts such as `npm run test:snapshot`, `npm run test:wait`, `npm run test:errors`, or `node test/smoke.js snapshot js`. Run `npm test` and `nix build .#default --no-link` when the change is broad, touches packaging, or needs full validation. Smoke tests require Firefox and geckodriver on `PATH` and use local `data:` HTML pages.
|
||||
For smoke testing without external network dependencies, use focused tags or scripts such as `npm run test:wait`, `npm run test:errors`, or `node test/smoke.js reader js`. Run `npm test` and `nix build .#default --no-link` when the change is broad, touches packaging, or needs full validation. Smoke tests require Firefox and geckodriver on `PATH` and use local `data:` HTML pages.
|
||||
|
||||
Do not attempt a live Kagi test unless `KAGI_TOKEN` is available.
|
||||
|
||||
@@ -38,10 +38,9 @@ Do not attempt a live Kagi test unless `KAGI_TOKEN` is available.
|
||||
|
||||
Current `glimpse` subcommands:
|
||||
|
||||
- `snapshot <url>` - return an agent-friendly page snapshot as JSON
|
||||
- `reader <url>` - extract page content as Markdown (tries Firefox Reader View, falls back to raw Turndown conversion); supports `--no-reader` to skip Reader View, `--format=json` for structured output
|
||||
- `exec <url> --js=<code>` or `--script=<file>` - execute JavaScript and return the result
|
||||
- `screenshot <url> --output=<file>` - save a PNG screenshot
|
||||
- `reader <url>` - open Firefox Reader View and output readable content as Markdown
|
||||
- `search <query>` - search with a supported provider and output JSON results
|
||||
|
||||
## Runtime Requirements
|
||||
|
||||
Reference in New Issue
Block a user