Skip to content

feat(gutenberg): add book browsing commands - #2451

Open
jiejia wants to merge 1 commit into
jackwener:mainfrom
jiejia:feat/gutenberg-adapter
Open

feat(gutenberg): add book browsing commands#2451
jiejia wants to merge 1 commit into
jackwener:mainfrom
jiejia:feat/gutenberg-adapter

Conversation

@jiejia

@jiejia jiejia commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Gutenberg adapter

Adds a public HTML-backed Project Gutenberg adapter with nine commands:

Command Purpose
ebooks <id> Show ebook metadata and download URLs for all available formats
search [title] Search ebooks by title or keyword with optional sorting and limit
author <id> List all books by a Gutenberg author
hot-books Show the top book rankings for yesterday, 7 days, or 30 days
hot-author Show the top author rankings for yesterday, 7 days, or 30 days
main-categories List the main Gutenberg book categories and their parent categories
collections List collections from the Gutenberg Reading Lists page
categories List Reading List categories, optionally filtered by initial letter
category-search <query> Search bookshelf categories with title, downloads, quantity, or release date sorting

Contract and strategy

  • Public reads use server-rendered Gutenberg HTML and declare Strategy.PUBLIC.
  • The adapter does not require authentication, browser sessions, or private credentials.
  • Shared request, parsing, pagination, validation, and error-handling logic is implemented in utils.js.
  • The adapter returns stable identifiers, names, URLs, authors, download counts, and ebook format links.
  • OpenCLI's title sort option is mapped to Gutenberg's alpha sort parameter.
  • category-search merges download-sorted results when the selected sort mode does not expose download counts directly.
  • Gutenberg pagination links are followed and duplicate results are removed.
  • collections preserves Gutenberg's source ordering.
  • author supports title, downloads, and release_date sorting.
  • category-search supports title, downloads, quantity, and release_date sorting.
  • Download counts are normalized to numeric values where available.
  • Empty results, malformed rows, and missing download formats are reported through typed command errors.
  • HTML attributes and entities are decoded consistently across the supported page types.

Verification

  • Focused Gutenberg tests: 9 files / 28 tests pass.
  • npm run typecheck: pass.
  • npm run build: pass; manifest compiled 1,375 entries.
  • opencli validate gutenberg: 0 errors, 0 warnings.
  • npm run check:typed-error-lint: pass with no new violations.
  • npm run check:silent-column-drop: pass with no new violations.
  • git diff --check: pass.

@jiejia
jiejia force-pushed the feat/gutenberg-adapter branch from 7a31fec to da05de3 Compare September 2, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant