11import { Command } from 'commander' ;
22import { RssClient } from '../services/rss/client' ;
33import { handleError } from '../utils/errors' ;
4+ import { addExamples } from '../utils/command-tree' ;
45import {
56 printRssArticleList ,
67 printRssArticle ,
@@ -13,56 +14,92 @@ export function registerRssCommands(program: Command): void {
1314 . description ( 'RSS feed operations' ) ;
1415
1516 // Get articles from a feed
16- rss
17- . command ( 'articles' )
18- . description ( 'List articles from a blog' )
19- . argument ( '<url>' , 'Blog URL (feed will be auto-discovered)' )
20- . option ( '--limit <n>' , 'Number of articles' , '20' )
21- . option ( '--since <date>' , 'Only articles after this date (YYYY-MM-DD)' )
22- . action ( async ( url , options ) => {
23- try {
24- const client = new RssClient ( ) ;
25- const listOptions = {
26- limit : parseInt ( options . limit , 10 ) ,
27- since : options . since ? new Date ( options . since ) : undefined ,
28- } ;
17+ addExamples (
18+ rss
19+ . command ( 'articles' )
20+ . description ( 'List articles from a blog' )
21+ . argument ( '<url>' , 'Blog URL (feed will be auto-discovered)' )
22+ . option ( '--limit <n>' , 'Number of articles' , '20' )
23+ . option ( '--since <date>' , 'Only articles after this date (YYYY-MM-DD)' )
24+ . action ( async ( url , options ) => {
25+ try {
26+ const client = new RssClient ( ) ;
27+ const listOptions = {
28+ limit : parseInt ( options . limit , 10 ) ,
29+ since : options . since ? new Date ( options . since ) : undefined ,
30+ } ;
2931
30- const info = await client . getInfo ( url ) ;
31- const articles = await client . list ( url , listOptions ) ;
32- printRssArticleList ( articles , info . title ) ;
33- } catch ( error ) {
34- handleError ( error ) ;
35- }
36- } ) ;
32+ const info = await client . getInfo ( url ) ;
33+ const articles = await client . list ( url , listOptions ) ;
34+ printRssArticleList ( articles , info . title ) ;
35+ } catch ( error ) {
36+ handleError ( error ) ;
37+ }
38+ } ) ,
39+ `Examples:
40+
41+ # 20 most recent articles (feed auto-discovered from blog URL)
42+ agentio rss articles https://simonwillison.net
43+
44+ # cap to 5 articles
45+ agentio rss articles https://simonwillison.net --limit 5
46+
47+ # only articles since a date
48+ agentio rss articles https://steipete.me --since 2026-01-01
49+
50+ # direct feed URL also works
51+ agentio rss articles https://example.com/feed.xml --limit 10` ,
52+ ) ;
3753
3854 // Get a specific article
39- rss
40- . command ( 'get' )
41- . description ( 'Get a specific article' )
42- . argument ( '<url>' , 'Blog URL (feed will be auto-discovered)' )
43- . argument ( '<article-id>' , 'Article ID or URL' )
44- . action ( async ( url , articleId ) => {
45- try {
46- const client = new RssClient ( ) ;
47- const article = await client . get ( url , articleId ) ;
48- printRssArticle ( article ) ;
49- } catch ( error ) {
50- handleError ( error ) ;
51- }
52- } ) ;
55+ addExamples (
56+ rss
57+ . command ( 'get' )
58+ . description ( 'Get a specific article' )
59+ . argument ( '<url>' , 'Blog URL (feed will be auto-discovered)' )
60+ . argument ( '<article-id>' , 'Article ID or URL' )
61+ . action ( async ( url , articleId ) => {
62+ try {
63+ const client = new RssClient ( ) ;
64+ const article = await client . get ( url , articleId ) ;
65+ printRssArticle ( article ) ;
66+ } catch ( error ) {
67+ handleError ( error ) ;
68+ }
69+ } ) ,
70+ `Examples:
71+
72+ # fetch full content by article URL (most common — copy from 'rss articles' output)
73+ agentio rss get https://blog.fsck.com https://blog.fsck.com/2025/12/27/streamlinear/
74+
75+ # by GUID (also shown in the articles list)
76+ agentio rss get https://simonwillison.net "tag:simonwillison.net,2024:/blog/2024/jan/12/article"` ,
77+ ) ;
5378
5479 // Get feed info
55- rss
56- . command ( 'info' )
57- . description ( 'Get feed information' )
58- . argument ( '<url>' , 'Blog URL (feed will be auto-discovered)' )
59- . action ( async ( url ) => {
60- try {
61- const client = new RssClient ( ) ;
62- const info = await client . getInfo ( url ) ;
63- printRssFeedInfo ( info ) ;
64- } catch ( error ) {
65- handleError ( error ) ;
66- }
67- } ) ;
80+ addExamples (
81+ rss
82+ . command ( 'info' )
83+ . description ( 'Get feed information' )
84+ . argument ( '<url>' , 'Blog URL (feed will be auto-discovered)' )
85+ . action ( async ( url ) => {
86+ try {
87+ const client = new RssClient ( ) ;
88+ const info = await client . getInfo ( url ) ;
89+ printRssFeedInfo ( info ) ;
90+ } catch ( error ) {
91+ handleError ( error ) ;
92+ }
93+ } ) ,
94+ `Examples:
95+
96+ # title, description, discovered feed URL, article count
97+ agentio rss info https://kau.sh
98+
99+ # also accepts a direct feed URL
100+ agentio rss info https://example.com/atom.xml
101+
102+ Auto-discovery looks for HTML <link rel="alternate"> tags first, then falls
103+ back to common paths: /feed, /feed.xml, /rss.xml, /atom.xml, /index.xml.` ,
104+ ) ;
68105}
0 commit comments