From f993409098ea1db064dff1ecab8b2c187a0b0bf3 Mon Sep 17 00:00:00 2001 From: Lucas Carlson Date: Thu, 8 Oct 2026 00:26:35 -0700 Subject: [PATCH 1/2] ci: claim the Context7 library and refresh it Context7 indexed this repository on October 8, 2026. A claimed library has an admin panel and higher refresh limits, and Context7 verifies the claim through the url and public_key in context7.json. The public_key is the maintainer's public account key, which Context7 designs to be committed. Add a workflow that asks Context7 to refresh the index after each push to main that changes the README, context7.json, docs/, or examples/. The release docs no longer ask for a manual refresh. The workflow's request was run locally against the API and returned "Refresh started successfully". It reads the CONTEXT7_API_KEY repository secret, which is set. --- .github/workflows/context7-refresh.yml | 30 ++++++++++++++++++++++++++ AGENTS.md | 5 +++-- CHANGELOG.md | 8 +++++++ context7.json | 2 ++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/context7-refresh.yml diff --git a/.github/workflows/context7-refresh.yml b/.github/workflows/context7-refresh.yml new file mode 100644 index 0000000..a112ed8 --- /dev/null +++ b/.github/workflows/context7-refresh.yml @@ -0,0 +1,30 @@ +name: Context7 refresh + +on: + push: + branches: + - main + paths: + - "README.md" + - "context7.json" + - "docs/**" + - "examples/**" + +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: | + curl --fail --silent --show-error --max-time 60 \ + -X POST https://context7.com/api/v1/refresh \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $CONTEXT7_API_KEY" \ + -d "{\"libraryName\": \"$LIBRARY_NAME\"}" diff --git a/AGENTS.md b/AGENTS.md index ed53cbb..bfccd95 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -57,8 +57,9 @@ Before you tag, read `docs/virtual-actors.md` and `docs/agents.md` against the release and correct any requirement, compatibility, or guarantee statement that changed. After the tag publishes, refresh the solidobjects.dev documentation snapshot from the tag and redeploy the site; its `check:release` step refuses a -snapshot that is not the latest published tag. Then trigger a Context7 refresh -for this repository. +snapshot that is not the latest published tag. The Context7 refresh workflow +refreshes the index after each push to `main` that changes the documentation. +Confirm that its run succeeded. ## Security & Configuration diff --git a/CHANGELOG.md b/CHANGELOG.md index 5760f87..4cd14c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Unreleased + +- Claim the Context7 library: `context7.json` now carries the library `url` and + the maintainer `public_key`. +- Add the Context7 refresh workflow. A push to `main` that changes the README, + `context7.json`, `docs/`, or `examples/` asks Context7 to refresh the index. + It uses the `CONTEXT7_API_KEY` repository secret. + ## 0.17.1 - 2026-10-08 - Name the category in the gem metadata and the README: Solid Objects is a diff --git a/context7.json b/context7.json index e3dd132..abee3e8 100644 --- a/context7.json +++ b/context7.json @@ -1,5 +1,7 @@ { "$schema": "https://context7.com/schema/context7.json", + "url": "https://context7.com/cardmagic/solid-objects-ruby", + "public_key": "pk_veEo2smPvGYMwP1MncN1A", "projectTitle": "Solid Objects for Rails (solid_objects)", "description": "SQL-backed virtual actor library for Ruby on Rails. Actors have stable identities, durable JSON state in SQLite, PostgreSQL, or MySQL, ordered per-identity mailboxes, fenced activation, durable reminders, and transactional effects. Requires Ruby 3.3+ and Rails 7.1+.", "folders": [ From 8ef38560a926b6416a551c3ecf90a5b62a3ce70a Mon Sep 17 00:00:00 2001 From: Lucas Carlson Date: Thu, 8 Oct 2026 00:38:41 -0700 Subject: [PATCH 2/2] ci: treat a too-early Context7 refresh as a skip The first run of the refresh workflow failed. curl timed out after 60 seconds with no response, and later calls returned HTTP 400 {"error":"too-early","message":"... Minimum 10 days required between updates."}. Context7 limits how often one library refreshes, so the workflow failed on most pushes to main. Allow 180 seconds for the response, print the body, and end with a workflow notice when Context7 answers too-early. Any other non-200 answer still fails the job. Against the live API, the old script exited 56 on the too-early answer and the new script exits 0 with the notice. --- .github/workflows/context7-refresh.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/context7-refresh.yml b/.github/workflows/context7-refresh.yml index a112ed8..05732b2 100644 --- a/.github/workflows/context7-refresh.yml +++ b/.github/workflows/context7-refresh.yml @@ -23,8 +23,19 @@ jobs: CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY }} LIBRARY_NAME: /${{ github.repository }} run: | - curl --fail --silent --show-error --max-time 60 \ + 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\"}" + -d "{\"libraryName\": \"$LIBRARY_NAME\"}") + cat response.json + echo + if [ "$status" = "200" ]; then + exit 0 + fi + if [ "$status" = "400" ] && grep -q '"error":"too-early"' response.json; 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