Skip to content

chore: add context7.json so agents get v5, not v4 - #3091

Open
vishr wants to merge 2 commits into
masterfrom
chore/context7-config
Open

chore: add context7.json so agents get v5, not v4#3091
vishr wants to merge 2 commits into
masterfrom
chore/context7-config

Conversation

@vishr

@vishr vishr commented Sep 9, 2026

Copy link
Copy Markdown
Member

Why

Context7 is what many AI coding agents query for library documentation. Echo's records there are fragmented, and the one that scores highest is v4-only:

entry versions snippets trust verified
/labstack/echo ["v4.15.0"] 183 7.7 no
/labstack/echox 569 7.7 no
/websites/echo_labstack 15 9.1 yes

An agent asking Context7 about Echo resolves to the first row and gets the v4 API — then writes v4 code against a v5 module. This is a large part of why "Echo code from an LLM doesn't compile."

What this does

Adds context7.json at the repo root:

  • branch: master so v5 is what gets parsed
  • previousVersions: [{ branch: "v4" }] so v4 stays queryable rather than disappearing
  • excludeFolders for _test, _fixture, .github
  • rules stating the v5/v4 split, most importantly:
// v4 — Context is an interface
func(c echo.Context) error
// v5 — Context is a struct
func(c *echo.Context) error

Verified against the source rather than from memory: context.go:63 type Context struct, echo.go:130 type HandlerFunc func(c *Context) error, against v4's type Context interface / func(c Context) error.

Not in this PR

Claiming the entry needs url and public_key from context7.com/dashboard, which only the account owning the project can generate. Merging the three fragmented records needs an upstream issue at upstash/context7.

Companion PR on the docs site: labstack/echox#438.

https://claude.ai/code/session_01ABWLbEypvJUVLLY26pHxtT

Context7 is what many AI coding agents query for library documentation.
Echo's entry there currently reports `versions: ["v4.15.0"]` with no v5
at all, so an agent asking Context7 for Echo gets the v4 API and writes
v4 code against a v5 module.

This pins the parsed branch to master (v5), records the v4 branch as a
previous version so both remain queryable, and spells out the v5/v4
split in `rules` -- most importantly the signature change from
`func(c echo.Context) error` to `func(c *echo.Context) error`, which is
the difference that makes v4 snippets fail to compile.

Claiming the entry additionally needs `url` and `public_key` from the
Context7 dashboard, which has to be generated by the account that owns
the project; that is not in this commit.

Claude-Session: https://claude.ai/code/session_01ABWLbEypvJUVLLY26pHxtT
`url` and `public_key` come from the Claim Library dialog at
context7.com/labstack/echo/admin. Both are claim identifiers meant to be
published in the repository root, which is how Context7 verifies that
whoever configured the library controls the repo.

Verification reads the default branch, so the claim can only be
completed once this is merged to master.

Claude-Session: https://claude.ai/code/session_01ABWLbEypvJUVLLY26pHxtT
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