From 7d0543f62d1f23edf250f21af5de6b66d4f3826c Mon Sep 17 00:00:00 2001 From: Lucas Carlson Date: Thu, 8 Oct 2026 01:58:18 -0700 Subject: [PATCH 1/2] ci: index the docs on Context7 and refresh on push Context7 has no simple-rss library yet; a search returns only Ruby's standard rss library, so agents that use Context7 cannot retrieve this gem's API. context7.json indexes the README and CHANGELOG, leaves out the tests, signatures, workflows, and maintainer files, and gives agents six rules taken from the README and checked against lib/. It also carries the url and public_key that Context7 reads to verify the maintainer's claim on the library. The refresh workflow asks Context7 to refresh the index after a push to master that changes the README, the CHANGELOG, or context7.json. Context7 allows one refresh every 10 days for one library and answers too-early before then, so that answer ends the job with a notice. Any other non-200 answer fails the job. --- .github/workflows/context7-refresh.yml | 40 ++++++++++++++++++++++++++ context7.json | 18 ++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/context7-refresh.yml create mode 100644 context7.json diff --git a/.github/workflows/context7-refresh.yml b/.github/workflows/context7-refresh.yml new file mode 100644 index 0000000..149f959 --- /dev/null +++ b/.github/workflows/context7-refresh.yml @@ -0,0 +1,40 @@ +name: Context7 refresh + +on: + push: + branches: + - master + paths: + - "README.md" + - "context7.json" + - "CHANGELOG.md" + +permissions: + contents: read + +jobs: + refresh: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Trigger a Context7 refresh + env: + CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY }} + LIBRARY_NAME: /${{ github.repository }} + run: | + status=$(curl --silent --show-error --max-time 180 --output response.json --write-out '%{http_code}' \ + -X POST https://context7.com/api/v1/refresh \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $CONTEXT7_API_KEY" \ + -d "{\"libraryName\": \"$LIBRARY_NAME\"}") + cat response.json + echo + if [ "$status" = "200" ]; then + exit 0 + fi + if [ "$status" = "400" ] && jq -e '.error == "too-early"' response.json > /dev/null; then + echo "::notice::Context7 refreshed $LIBRARY_NAME recently, so it skipped this refresh." + exit 0 + fi + echo "::error::Context7 refresh failed with HTTP $status." + exit 1 diff --git a/context7.json b/context7.json new file mode 100644 index 0000000..65f422f --- /dev/null +++ b/context7.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://context7.com/schema/context7.json", + "url": "https://context7.com/cardmagic/simple-rss", + "public_key": "pk_veEo2smPvGYMwP1MncN1A", + "projectTitle": "simple-rss (Ruby gem)", + "description": "A liberal RSS, Atom, and JSON Feed reader for Ruby. It parses malformed feeds, fetches URLs with conditional GET, discovers feeds that websites advertise, normalizes entries, and serializes parsed feeds to JSON or XML. No runtime dependencies; requires Ruby 3.1+.", + "folders": [], + "excludeFolders": ["test", "sig", ".github"], + "excludeFiles": ["AGENTS.md", "CLAUDE.md"], + "rules": [ + "Install with gem \"simple-rss\" and require \"simple-rss\". The gem requires Ruby 3.1 or newer and has no runtime dependencies.", + "Parse a string or IO with SimpleRSS.parse. Fetch a URL with SimpleRSS.fetch(url), which supports timeouts, custom headers, redirects, and conditional GET.", + "SimpleRSS.fetch returns nil when a conditional GET answers 304 Not Modified, so handle nil when you poll with ETag or Last-Modified.", + "SimpleRSS.discover finds the feeds that a website advertises. It needs gem \"nokogiri\", \">= 1.16\", \"< 2\" on CRuby; without HTML5 support it raises SimpleRSS::DiscoveryDependencyError before any request.", + "Use normalized_entries for consistent URLs, dates, content, authors, categories, and attachments across RSS, Atom, and JSON Feed.", + "simple-rss reads feeds and does not generate new ones. To write a parsed feed back out, use to_xml(format: :rss2) or to_xml(format: :atom)." + ] +} From 88bac66fd58a683d65e02e34ed72436d761f727a Mon Sep 17 00:00:00 2001 From: Lucas Carlson Date: Thu, 8 Oct 2026 02:04:00 -0700 Subject: [PATCH 2/2] ci: limit the to_xml rule to XML feeds Review feedback on #69. The rule recommended to_xml for any parsed feed, but to_xml raises SimpleRSSError for a JSON Feed (lib/simple-rss.rb and the README both say so). The rule now limits to_xml to parsed XML feeds and states that JSON Feed to XML conversion is not supported. --- context7.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/context7.json b/context7.json index 65f422f..5a6003e 100644 --- a/context7.json +++ b/context7.json @@ -5,14 +5,21 @@ "projectTitle": "simple-rss (Ruby gem)", "description": "A liberal RSS, Atom, and JSON Feed reader for Ruby. It parses malformed feeds, fetches URLs with conditional GET, discovers feeds that websites advertise, normalizes entries, and serializes parsed feeds to JSON or XML. No runtime dependencies; requires Ruby 3.1+.", "folders": [], - "excludeFolders": ["test", "sig", ".github"], - "excludeFiles": ["AGENTS.md", "CLAUDE.md"], + "excludeFolders": [ + "test", + "sig", + ".github" + ], + "excludeFiles": [ + "AGENTS.md", + "CLAUDE.md" + ], "rules": [ "Install with gem \"simple-rss\" and require \"simple-rss\". The gem requires Ruby 3.1 or newer and has no runtime dependencies.", "Parse a string or IO with SimpleRSS.parse. Fetch a URL with SimpleRSS.fetch(url), which supports timeouts, custom headers, redirects, and conditional GET.", "SimpleRSS.fetch returns nil when a conditional GET answers 304 Not Modified, so handle nil when you poll with ETag or Last-Modified.", "SimpleRSS.discover finds the feeds that a website advertises. It needs gem \"nokogiri\", \">= 1.16\", \"< 2\" on CRuby; without HTML5 support it raises SimpleRSS::DiscoveryDependencyError before any request.", "Use normalized_entries for consistent URLs, dates, content, authors, categories, and attachments across RSS, Atom, and JSON Feed.", - "simple-rss reads feeds and does not generate new ones. To write a parsed feed back out, use to_xml(format: :rss2) or to_xml(format: :atom)." + "simple-rss reads feeds and does not generate new ones. To write a parsed XML feed back out, use to_xml(format: :rss2) or to_xml(format: :atom). Calling to_xml on a JSON Feed raises SimpleRSSError; JSON Feed to XML conversion is not supported." ] }