Skip to content

Commit 11aa7a9

Browse files
committed
docs(ruby-gem): anchor 0.27.0 migrations and write forward
Forward-facing guides teach present MCP and capture behavior; breaking contract changes live under backward-compatibility §0.27.0. Fixes inspect_url auto staying on Faraday in MCP prompts.
1 parent c38e7d8 commit 11aa7a9

6 files changed

Lines changed: 35 additions & 27 deletions

File tree

src/content/docs/ruby-gem/guides/ai-agent-workflows.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ Add `html2rss` to your Claude Desktop configuration (`~/Library/Application Supp
8484

8585
When an agent needs articles immediately without saving a feed configuration:
8686

87-
1. Call `scrape_url` with `strategy: "auto"`. Auto already runs Faraday then Botasaurus.
88-
2. An empty item list is still success for articles-now. Read `payload.items`. Follow `next_step` (including `read_runtime` / `html2rss://runtime` if Botasaurus is unset).
89-
3. Call `inspect_url` only if the result is weak or you need recon. Do not retry `scrape_url` with explicit `faraday` after auto.
87+
1. Call `scrape_url` with `strategy: "auto"`. Auto runs Faraday then Botasaurus when `BOTASAURUS_SCRAPER_URL` is set on the MCP process.
88+
2. An empty item list is still success for articles-now. Read `payload.items`. Follow `next_step` (including `read_runtime` / `html2rss://runtime` when Botasaurus is unset).
89+
3. Call `inspect_url` when the result is weak or you need recon (`final_url`, `status`, `scheme_downgrade`, native RSS/Atom).
9090

9191
### Pattern B: Iterative Feed Config Authoring
9292

src/content/docs/ruby-gem/guides/backward-compatibility.mdx

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ description: "Migration guide and backward-compatibility reference for html2rss
55

66
import { Code } from "@astrojs/starlight/components";
77

8-
This page outlines recent breaking changes, purged legacy aliases, and migration steps for older feed configurations.
8+
This page outlines breaking changes, purged legacy aliases, and migration steps when upgrading the gem.
99

10-
## Current Botasaurus request schema
10+
## 0.27.0
1111

12-
`request.botasaurus` matches the scrape-API OpenAPI 2.0 `ScrapeRequest` (unknown keys rejected):
12+
Upgrade notes for configs and integrators targeting gem **0.27.0** (current `master` after `0.26.0`):
1313

14-
1. **`scroll`** — boolean. There is no `scroll_to_bottom` key; use `scroll: true` for infinite lists.
15-
2. **`window_size`** — object `{ width: 1920, height: 1080 }`, not a two-item array.
16-
3. **`wait_timeout_seconds`** — integer `1..20` (omit to use the scrape-API default of `15`).
17-
4. **`max_retries`** — integer `0..3` (omit to use the scrape-API default of `2`).
14+
1. **MCP result envelope** — Every MCP tool returns `{ ok, next_step, guidance, payload }` in text and `structuredContent`. Read `payload.items`, `payload.yaml`, and `payload.rss`; scrape text is not a raw item array.
15+
2. **MCP AutoFallback**`scrape_url` and `capture_config` with `strategy: "auto"` run Faraday → Botasaurus in one call. `inspect_url` with `auto` stays on Faraday (pin `botasaurus` when you need browser rendering for inspect).
16+
3. **Capture output**`html2rss capture` and MCP `capture_config` emit an items selector plus `enhance: true` only (no per-field title/url/description selector soup). Capture stamps `strategy:` when AutoFallback selects a concrete transport.
17+
4. **CLI `--explain`**`html2rss auto --explain` and `html2rss capture --explain` print telemetry JSON on stderr; stdout stays the feed or YAML. Status includes `admission_drops` when Cleanup dropped items.
18+
5. **`Html2rss.auto_feed_result`** — URL-only auto discovery returns `FeedResult` with the same `status` telemetry as config builds.
19+
6. **`request.botasaurus` OpenAPI 2.0** — Keys must match the scrape-API `ScrapeRequest` (unknown keys rejected). Use `scroll: true` (not `scroll_to_bottom`), `window_size: { width:, height: }` (not a two-item array), and `wait_timeout_seconds` in `1..20`. See [Strategy](/ruby-gem/reference/strategy/#botasaurus).
20+
7. **Botasaurus wire format** — Client expects OpenAPI 2.0 `ScrapeSuccess` / `ScrapeError` envelopes from the scrape API.
21+
8. **`--limit` default** — Auto discovery default is `25` (`AutoSource::DEFAULT_LIMIT`).
1822

1923
Run `html2rss validate config.yml` after editing Botasaurus options.
2024

@@ -30,7 +34,7 @@ Upgrade notes for configs and integrators targeting gem **0.26.0**:
3034
Upgrade notes for configs and integrators targeting gem **0.25.0**:
3135

3236
1. **Removed `link` selector alias** — Custom selector configurations must use the canonical `url` key. The legacy `link` selector alias and exclusivity checks have been removed.
33-
2. **`auto` article limit (`--limit N`)** — Discovery now supports a configurable article limit (`--limit N` CLI flag, default `20`) and `Html2rss.auto_source(url, limit: 20)` in Ruby.
37+
2. **`auto` article limit (`--limit N`)** — Discovery supports a configurable limit (`--limit N` CLI flag). Default was `20` in 0.25.0; **0.27.0** default is `25` (`Html2rss.auto_source(url, limit: 25)`).
3438
3. **Channel metadata in `auto`**`auto_source` automatically extracts channel-level `author` and `image` (favicon, touch-icon, or OpenGraph images) from the host page.
3539
4. **Actionable `NoFeedItemsExtracted` error**`auto` mode fails loud with diagnostic surface classifications (blocked surface, app-shell, unsupported extraction surface) when zero items are found.
3640

@@ -100,13 +104,17 @@ Update any occurrences of `link`, `pubDate`, or `updated` in your `selectors` bl
100104

101105
## Migration Checklist
102106

103-
When upgrading to modern `html2rss` releases:
107+
When upgrading to **0.27.0** or later:
104108

105-
1. **Migrate Browserless to Botasaurus**: Update any feeds using `strategy: browserless` or `request.browserless` to `strategy: botasaurus` or `strategy: auto` with `BOTASAURUS_SCRAPER_URL`.
106-
2. **Rename URL selectors**: Ensure article URL selectors use `url` rather than `link`.
107-
3. **Rename date selectors**: Ensure date selectors use `published_at` rather than `updated` or `pubDate`.
108-
4. **Move channel-level transport keys**: Ensure `strategy` and `headers` are defined at the top level of the YAML file.
109-
5. **Use `enclosure` for RSS media**: Do not rely on `image` becoming an RSS `<enclosure>`; select podcast/media URLs with `enclosure`.
110-
6. **Prefer `feed_result` for dual-format / cache**: Integrators that need RSS + JSON Feed from one scrape (or Marshal caching) should use `Html2rss.feed_result` and `status.to_h`.
111-
7. **Align `request.botasaurus` with OpenAPI 2.0**: Replace `scroll_to_bottom` with `scroll`, use `{ width, height }` for `window_size`, and keep `wait_timeout_seconds` in `1..20`.
112-
8. **Validate configurations**: Run `html2rss validate config.yml` to ensure your YAML conforms to the current schema.
109+
1. **MCP integrators**: Read tool results from the envelope `payload`; configure `BOTASAURUS_SCRAPER_URL` on the MCP process env.
110+
2. **Align `request.botasaurus` with OpenAPI 2.0**: Use `scroll`, `{ width, height }` for `window_size`, and `wait_timeout_seconds` in `1..20` (see [Strategy](/ruby-gem/reference/strategy/#botasaurus)).
111+
3. **Validate configurations**: Run `html2rss validate config.yml`.
112+
113+
When upgrading from releases before **0.26.0**:
114+
115+
4. **Migrate Browserless to Botasaurus**: Use `strategy: botasaurus` or `strategy: auto` with `BOTASAURUS_SCRAPER_URL`.
116+
5. **Rename URL selectors**: Use `url` rather than `link`.
117+
6. **Rename date selectors**: Use `published_at` rather than `updated` or `pubDate`.
118+
7. **Move channel-level transport keys**: Put `strategy` and `headers` at the top level of the YAML file.
119+
8. **Use `enclosure` for RSS media**: Select podcast/media URLs with `enclosure`; `image` does not become RSS `<enclosure>`.
120+
9. **Prefer `feed_result` for dual-format / cache**: Use `Html2rss.feed_result` / `Html2rss.auto_feed_result` and `status.to_h`.

src/content/docs/ruby-gem/guides/capturing-feed-configs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Derive a reusable YAML feed config from a URL with html2rss capture
55

66
import { Aside, Code } from "@astrojs/starlight/components";
77

8-
`html2rss capture` analyzes a page through the auto-source pipeline and prints a reusable YAML draft with an **items selector plus `enhance: true`** — not title/url/description selector soup. `enhance: true` fills missing article fields at feed-build time.
8+
`html2rss capture` analyzes a page through the auto-source pipeline and prints a reusable YAML draft: an **items selector plus `enhance: true`**. At feed-build time, `enhance: true` fills missing article fields from each matched card.
99

1010
<Aside type="tip" title="Treat capture as a draft">
1111
Selector quality depends on page structure. Catalog feeds still need `directory.topics` and explicit channel

src/content/docs/ruby-gem/reference/cli-reference.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Available options:
180180
- `--transport`: MCP transport protocol (`stdio` or `http`). Defaults to `stdio`.
181181
- `--port`: Port for HTTP transport (default: `8080`). Bound strictly to `127.0.0.1` (loopback only).
182182

183-
HTTP transport requires the `rack`, `rackup`, and `webrick` gems. stdio keeps JSON-RPC on stdout; the daemon logs to stderr and defaults to `LOG_LEVEL=info` unless you set `LOG_LEVEL`. See the [MCP Server Reference](/ruby-gem/reference/mcp-server/) and [AI Agent Workflows Guide](/ruby-gem/guides/ai-agent-workflows/) for full configuration and tool schemas.
183+
HTTP transport requires the `rack`, `rackup`, and `webrick` gems. MCP daemon logging (stderr, `LOG_LEVEL`) is documented in the [MCP Server Reference](/ruby-gem/reference/mcp-server/). See also the [AI Agent Workflows Guide](/ruby-gem/guides/ai-agent-workflows/) for client setup and tool schemas.
184184

185185
### Schema
186186

src/content/docs/ruby-gem/reference/mcp-server.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ The MCP server supports two transport mechanisms:
3838

3939
## Strategy Resolution in MCP
4040

41-
`scrape_url` and `capture_config` with `strategy: "auto"` (the default) run Faraday → Botasaurus AutoFallback. One call is enough; do not retry with explicit `faraday` after `auto`.
41+
`scrape_url` and `capture_config` with `strategy: "auto"` (the default) run Faraday → Botasaurus AutoFallback in one call.
4242

43-
`inspect_url` is the exception: `auto` stays on Faraday for a cheap diagnostic. Pin `strategy: "botasaurus"` on inspect when you need browser rendering.
43+
`inspect_url` with `auto` uses Faraday for a cheap diagnostic. Pin `strategy: "botasaurus"` when you need browser rendering for inspect.
4444

4545
Read `html2rss://runtime` for `botasaurus_configured` (boolean only). Set `BOTASAURUS_SCRAPER_URL` on the **MCP process** env (see [AI agent workflows](/ruby-gem/guides/ai-agent-workflows/)).
4646

@@ -62,7 +62,7 @@ Every tool returns the same JSON object in both the text content and `structured
6262
lang="json"
6363
/>
6464

65-
`isError` matches `ok: false`. Hosts that parsed scrape text as a raw JSON array must read `payload.items` instead.
65+
`isError` matches `ok: false`. Scrape results expose articles in `payload.items`.
6666

6767
`next_step` is one of: `done`, `inspect_url`, `validate_config`, `apply_config`, `scrape_url`, `capture_config`, `read_runtime`.
6868

@@ -161,7 +161,7 @@ One `scrape_url` call with `strategy: auto` (AutoFallback already hops). Call `i
161161
Four-step workflow for a durable feed config:
162162

163163
1. Call `capture_config` — YAML is `payload.yaml`. Check `payload.articles_count` and `has_selectors`. Strive `enhance: true`.
164-
2. If weak or you need recon, call `inspect_url`. Auto already hops to Botasaurus.
164+
2. If weak or you need recon, call `inspect_url` (`auto` uses Faraday; pin `botasaurus` for browser rendering).
165165
3. Call `validate_config` with `yaml` (or `config`) — must not be `isError`.
166166
4. Call `apply_config``isError` if zero items. Confirm `payload.item_count` before shipping.
167167

src/content/docs/troubleshooting/troubleshooting.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Common configuration-related errors:
101101
- **`BOTASAURUS_SCRAPER_URL is invalid`:** Fix the URL format and retry.
102102
- **`Configuration must include at least 'selectors' or 'auto_source'`:** You need to specify either manual selectors or enable auto-source.
103103
- **`stylesheet.type invalid`:** Only `text/css` and `text/xsl` are supported for stylesheets.
104-
- **`request.botasaurus` validation:** Unknown keys fail (`scroll_to_bottom` is not valid — use `scroll: true`). `window_size` must be `{ width:, height: }`. `wait_timeout_seconds` must be `1..20`.
104+
- **`request.botasaurus` validation:** Unknown keys are rejected. Valid scroll, window size, and wait-timeout shapes are documented in [Strategy — Botasaurus](/ruby-gem/reference/strategy/#botasaurus).
105105

106106
### Missing Item Parts
107107

0 commit comments

Comments
 (0)