Skip to content

feat: RSSフィードの自動配信機能を追加#53

Merged
shin902 merged 17 commits intomainfrom
feat/rss-feed-polling
Apr 30, 2026
Merged

feat: RSSフィードの自動配信機能を追加#53
shin902 merged 17 commits intomainfrom
feat/rss-feed-polling

Conversation

@shin902
Copy link
Copy Markdown
Owner

@shin902 shin902 commented Apr 29, 2026

Summary

nanoclaw.yaml にチャンネル別RSSフィード設定を追加し、15分ポーリングで新着記事URLを自動配信する機能を実装しました。

Changes

  • src/rss-config.ts (新規)

    • nanoclaw.yamlrss.channels セクションを読み込む
    • readRssConfig() — YAMLキャッシュ付き、不正な設定は警告ログでスキップ
  • src/db.ts (変更)

    • rss_seen_items テーブル (feed_url, item_id, seen_at) を追加
    • hasSeenItem() / markItemSeen() アクセサ関数を追加
    • 既存DBへの後方互換(CREATE TABLE IF NOT EXISTS
  • src/rss-poller.ts (新規)

    • 15分間隔 (RSS_POLL_INTERVAL = 15 * 60 * 1000) でフィードをポーリング
    • fast-xml-parser でRSS/Atomをパース
    • pubDate 昇順に1記事ずつ sendMessage を呼ぶ
    • フィード取得失敗時は logger.warn でスキップし、他フィードを継続
  • src/index.ts (変更)

    • main() 内で startRssPoller() を起動
    • sendMessage ラッパーで未登録チャンネルへの配信を防止
  • .claude/skills/setup-rss/SKILL.md (新規)

    • RSS設定手順スキルファイル
  • src/rss.test.ts (新規)

    • 設定読み込み、既読管理、ポーラーのテスト(10件)

Test Results

  • TypeScript型チェック: ✅ クリア
  • 全テスト: 351件合格(新規10件含む)

設定例

rss:
  channels:
    - jid: "dc:1234567890"
      feeds:
        - url: "https://example.com/feed.xml"
          name: "Example Blog"

shin902 added 2 commits April 29, 2026 15:08
nanoclaw.yaml にチャンネル別RSSフィード設定を追加し、15分ポーリングで新着記事URLを自動配信する。

- rss-config.ts: nanoclaw.yaml の rss.channels 読み込み
- db.ts: rss_seen_items テーブルと既読管理関数を追加
- rss-poller.ts: 15分間隔ポーリング、fast-xml-parser でRSS/Atomパース
- index.ts: startRssPoller を main() に統合
- setup-rss スキル: RSS設定手順を追加
- rss.test.ts: 設定読み込み・既読管理・ポーラーのテストを追加
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 848e4291b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/rss-poller.ts Outdated
}

const channel = rss.channel || rss;
let items: RssItem[] = channel.item || rss.item || [];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Parse Atom entries from feed documents

When fetchFeed sees an Atom document (parsed.feed), it still reads only channel.item/rss.item, so Atom <entry> elements are never collected and the poller silently delivers nothing for Atom feeds. This breaks the advertised RSS/Atom support for any channel configured with common Atom sources.

Useful? React with 👍 / 👎.

Comment thread src/rss-poller.ts Outdated
Comment on lines +123 to +124
markItemSeen(feed.url, entry.guid);
await deps.sendMessage(channelConfig.jid, text);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Mark items seen only after send succeeds

markItemSeen is called before sendMessage, so any transient send failure (API error, timeout, disconnected channel) permanently drops that article: it is recorded as seen and filtered out on all future polls. Move the seen-marker after a successful send (or roll it back on error) to avoid data loss.

Useful? React with 👍 / 👎.

shin902 and others added 15 commits April 29, 2026 15:22
Co-authored-by: Copilot <copilot@github.com>
fix: pollOnce関数で未登録のチャンネルをスキップするロジックを修正
test: getSeenItemIdsのユニットテストを追加
refactor: sortByPubDate関数のコードスタイルを改善し、可読性を向上させた
@shin902 shin902 merged commit 43a9fd2 into main Apr 30, 2026
1 check passed
@shin902 shin902 deleted the feat/rss-feed-polling branch April 30, 2026 14:55
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