Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/context7-refresh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Refresh Context7 index

on:
push:
workflow_dispatch:

permissions: {}

concurrency:
group: context7-refresh-${{ github.ref }}
cancel-in-progress: true

jobs:
refresh:
name: Request library refresh
if: >-
github.ref_name == github.event.repository.default_branch &&
vars.CONTEXT7_REFRESH_ENABLED == 'true'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Request Context7 refresh
env:
CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY }}
CONTEXT7_LIBRARY_NAME: /${{ github.repository }}
run: |
if [ -z "$CONTEXT7_API_KEY" ]; then
echo "::error::Set the CONTEXT7_API_KEY repository secret."
exit 1
fi
printf -v authorization "Authorization: %s %s" "Bearer" "$CONTEXT7_API_KEY"

curl --fail-with-body --retry 3 --retry-all-errors \
--silent --show-error --max-time 60 \
--request POST \
--url https://context7.com/api/v1/refresh \
--header "$authorization" \
--header "Content-Type: application/json" \
--data "{\"libraryName\":\"$CONTEXT7_LIBRARY_NAME\"}"
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Added

- Add project-neutral Context7 configuration, opt-in index refresh automation,
and setup guidance for generated projects.

### Changed

### Fixed
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ include .pre-commit-config.yaml
include .python-version
include AGENTS.md
include CHANGELOG.md
include context7.json
include LICENSE
include README.md
include CODE_OF_CONDUCT.md
Expand Down
23 changes: 23 additions & 0 deletions TEMPLATE_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,29 @@ Complete this checklist before the first release.
- [ ] Configure S3 deployment through the protected `docs-production`
environment, AWS OIDC variables, and `DOCS_DEPLOY_ENABLED=true`.

## Context7

The root `context7.json` uses the current schema, indexes `docs/` and the
root-level README, and excludes the template's operational files. It omits
project metadata, branch names, versions, and usage rules so Context7 can infer
safe defaults without template-specific placeholders. Adjust its paths if the
project's user documentation lives elsewhere.

- [ ] Publish useful documentation, then [submit the public repository to
Context7](https://context7.com/add-library).
- [ ] Claim ownership from the library's Context7 admin page. Add the generated
`url` and `public_key` values to `context7.json`, push them to the default
branch, and complete the claim.
- [ ] After claiming, use **Apply for Verification** on the admin page and
provide the requested project and documentation details if the automatic
quality check does not approve it.
- [ ] Rely on Context7's usage-based automatic refreshes, refresh manually after
important releases, or enable `.github/workflows/context7-refresh.yml`.
Once enabled with a `CONTEXT7_API_KEY` repository secret and the
`CONTEXT7_REFRESH_ENABLED=true` repository variable, it refreshes after
each default-branch push so moving documentation files or folders in
`context7.json` does not silently disable automated refreshes.

## Continuous Integration

- [ ] Set the `PACKAGE_IMPORT_NAME` repository variable to the package import
Expand Down
25 changes: 25 additions & 0 deletions context7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://context7.com/schema/context7.json",
"folders": ["docs"],
"excludeFiles": [
"AGENTS.md",
"CHANGELOG.md",
"CHANGELOG.mdx",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md",
"LICENSE",
"LICENSE.md",
"RELEASING.md",
"SECURITY.md",
"TEMPLATE_SETUP.md",
"agents.md",
"changelog.md",
"changelog.mdx",
"code_of_conduct.md",
"contributing.md",
"license.md",
"releasing.md",
"security.md",
"template_setup.md"
]
}