From 2952c86f1fd59bb355717034c59fae6d33e31b32 Mon Sep 17 00:00:00 2001 From: Abimael Martell Date: Wed, 11 Feb 2026 13:22:52 -0800 Subject: [PATCH] feat(scrape) Add summary format shortcut --- src/__tests__/commands/scrape.test.ts | 14 ++++++++++++++ src/index.ts | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/src/__tests__/commands/scrape.test.ts b/src/__tests__/commands/scrape.test.ts index bf3c13b4b2..13fe04157c 100644 --- a/src/__tests__/commands/scrape.test.ts +++ b/src/__tests__/commands/scrape.test.ts @@ -102,6 +102,20 @@ describe('executeScrape', () => { }); }); + it('should call scrape with summary format when summary option is true', async () => { + const mockResponse = { summary: 'This is a summary of the page.' }; + mockClient.scrape.mockResolvedValue(mockResponse); + + await executeScrape({ + url: 'https://example.com', + formats: ['summary'], + }); + + expect(mockClient.scrape).toHaveBeenCalledWith('https://example.com', { + formats: ['summary'], + }); + }); + it('should include screenshot format when screenshot option is true', async () => { const mockResponse = { markdown: '# Test', diff --git a/src/index.ts b/src/index.ts index f3a571c45f..c36c9dff7d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -104,6 +104,7 @@ function createScrapeCommand(): Command { 'Wait time before scraping in milliseconds', parseInt ) + .option('-S, --summary', 'Output summary (shortcut for --format summary)') .option('--screenshot', 'Take a screenshot', false) .option('--include-tags ', 'Comma-separated list of tags to include') .option('--exclude-tags ', 'Comma-separated list of tags to exclude') @@ -143,6 +144,9 @@ function createScrapeCommand(): Command { } else if (options.html) { // Handle --html shortcut flag format = 'html'; + } else if (options.summary) { + // Handle --summary shortcut flag + format = 'summary'; } else if (options.format) { // Use --format option format = options.format;