Skip to content

Add context7.json, tag code fences, refresh Context7 on push - #104

Merged
DavidLambauer merged 3 commits into
mage-os:mainfrom
ProxiBlue:docs/context7
Oct 5, 2026
Merged

DavidLambauer merged 3 commits into
mage-os:mainfrom
ProxiBlue:docs/context7

Conversation

@ProxiBlue

Copy link
Copy Markdown
Contributor

What this does

These docs are already indexed by Context7 as /mage-os/devdocs. Context7 feeds library documentation to AI coding assistants (Cursor, Claude Code, Copilot and others). This PR makes Context7 read the repo on purpose rather than with its defaults.

No documentation prose changes. Everything here is metadata or config.

1. Add context7.json

  • excludeFiles — leaves out documentation.md (nav only), README.md, CODEOWNERS, and the 13 markdown files that are not linked from documentation.md and so render nowhere on devdocs.mage-os.org (acl.md, di.md, db_schema.md, … and the two merged-page leftovers rest-apis-soap-apis.md and the-magento-application-and-service-contracts.md).
    Context7 was indexing these unreachable duplicates instead of the published *_xml pages. In the live index, six File Reference pages (db_schema_xml, fieldset_xml, indexer_xml, menu_xml, webapi_xml, widget_xml) contribute 0 snippets, while their orphan copies supply 44 snippets (8% of the index), each pointing at a path with no published page. The files stay in the repo; three of them hold material their published twin lacks, which should be ported across in a separate content PR before the orphans are deleted.
  • description — says what Mage-OS is, that it is compatible with Magento 2 extensions and themes, and that it ships features Magento Open Source lacks (RMA). Context7 matches library lookups on this metadata, not on page content. Context7 documents it as a suggestion it may override, so it's worth measuring after the next parse.
  • rules[] — short facts sent to every assistant that looks up Mage-OS, covering things they currently get wrong:
    • the repo.mage-os.org install command
    • PHP 8.3 / 8.4 / 8.5 for 3.x
    • Magento\* namespaces and bin/magento are unchanged
    • db_schema.xml over InstallSchema.php for new modules
    • plugins/observers over preferences
    • RMA ships in core from 3.0.0: mage-os/product-community-edition requires mage-os/module-rma from 3.0.0 through 3.5.0, according to the package metadata on repo.mage-os.org. Assistants today either say you need a third-party extension or suggest building one yourself.

2. Tag 25 untagged code fences

Code blocks with no language make Context7 guess, and its guesses end up as text/APIDOC. Directory trees and ASCII diagrams are now plaintext (the existing repo convention), HTTP request lines http, CLI commands bash, and the php.ini line ini. Only the opening fence line changes; the code inside is untouched.

3. Refresh Context7 on push

.github/workflows/context7-refresh.yml uses Context7's documented refresh call so the index follows main rather than lagging behind it (the last parse was 2026-08-02, before the latest commit). It runs only on mage-os/devdocs and exits cleanly without doing anything until the secret below is set, so it can't fail on forks or before setup.

Needs a maintainer (not doable from a fork)

  1. Add the repository secret CONTEXT7_API_KEY (from the Context7 dashboard) to turn on the refresh workflow.
  2. Claim /mage-os/devdocs on Context7. It currently shows verified: false. Claiming gives the org an admin panel, higher refresh limits and version management.
  3. Ask Context7 to remove or merge /websites/devdocs_mage-os_main. It's a crawl of devdocs.mage-os.org last parsed 2026-02-23, and it outranks this repo's entry on mage-os lookups, so assistants can end up on a copy that is seven months out of date.

Out of scope, as follow-ups

  • Port the extra content from extension_attributes.md, routes.md and acl.md into their *_xml pages, then delete the 13 orphan files.
  • Eight nav pages have no code blocks at all, so Context7 extracts nothing from them. They need worked examples.
  • RMA has no page in the docs.

Findings were measured against the live Context7 index (546 snippets, pulled as JSON) at 291815b.

🤖 Generated with Claude Code

ProxiBlue and others added 2 commits September 26, 2026 00:25
25 opening fences in nav pages had no language, so Context7 guessed and
filed them under buckets like text/APIDOC. Directory trees and ASCII
diagrams are now plaintext, HTTP request lines http, CLI commands bash,
php.ini lines ini. Metadata only; no code or prose changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Context7 already indexes this repo as /mage-os/devdocs. This config makes
it parse the repo deliberately:

- excludeFiles: documentation.md (nav only), README.md, CODEOWNERS, and
  the 13 markdown files not linked from documentation.md. Context7 was
  indexing those unreachable duplicates instead of the published *_xml
  pages (6 File Reference pages contributed 0 snippets).
- description names Magento 2 extension/theme compatibility and core RMA;
  the library-resolve step matches on this metadata.
- rules[] gives coding agents the Mage-OS specifics they get wrong: the
  repo.mage-os.org install command, PHP 8.3+, unchanged Magento\*
  namespaces and bin/magento, db_schema.xml over InstallSchema.php, and
  RMA in core from 3.0.0 (product-community-edition requires
  mage-os/module-rma).

Workflow triggers a Context7 re-index on push to main. Runs only on
mage-os/devdocs and no-ops until a CONTEXT7_API_KEY secret is set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ProxiBlue
ProxiBlue requested review from a team as code owners September 25, 2026 16:38
DavidLambauer
DavidLambauer previously approved these changes Sep 29, 2026
@rhoerr

rhoerr commented Sep 30, 2026

Copy link
Copy Markdown
Member

Thanks! @DavidLambauer are you able to handle the Context7 key?

@DavidLambauer

Copy link
Copy Markdown
Contributor

@rhoerr Done, CONTEXT7_API_KEY is set on the repo, so the refresh workflow is live on pushes to main. I'll also claim /mage-os/devdocs on Context7 and follow up with them about merging/removing the stale /websites/devdocs_mage-os_main entry.

@ProxiBlue

Copy link
Copy Markdown
Contributor Author

@DavidLambauer Nice.

Let me know, then I can run tests via claude to see if the prior issues I noted had been resolved.

@DavidLambauer

Copy link
Copy Markdown
Contributor

@rhoerr Could you approve this PR and merge it? Once done, I can trigger the context7 scan

@DavidLambauer DavidLambauer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-approving on the current commit. My earlier approval was dismissed when the Context7 claim verification fields (url, public_key) were pushed to this branch; no other content changed.

@DavidLambauer
DavidLambauer merged commit ed825ba into mage-os:main Oct 5, 2026
1 check passed
DavidLambauer pushed a commit that referenced this pull request Oct 7, 2026
The description added in #104 was 361 characters. Context7's schema
(https://context7.com/schema/context7.json) caps it at 200, and the file
failed validation. Context7 has since re-parsed the repo (2026-10-05)
but its stored settings for /mage-os/devdocs are still the defaults: the
generated description, default excludeFiles, and no rules. So none of
the config from #104 took effect, and the 13 unlinked duplicate pages
are still indexed in place of the published *_xml pages.

This is the only schema error in the file; it now validates cleanly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DavidLambauer pushed a commit that referenced this pull request Oct 7, 2026
Context7 gives no error when context7.json is invalid. The description
added in #104 exceeded the schema's 200-character limit and the library
kept its default settings. This workflow runs check-jsonschema against
https://context7.com/schema/context7.json whenever the file changes, so
a schema error fails the PR instead of going unnoticed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

3 participants