Repository navigation
WordPress plugin: serve llms.txt from the site's own pages - #4
Merged
Merged
Conversation
WordPress is the one surface in this plan with a plausible path to four figures, because its plugin directory is a search surface with its own SEO: people find plugins by typing into wp-admin, not by reading our docs. It SERVES /llms.txt rather than writing one. Every other generator writes the file to disk once, which is wrong twice over here: plenty of hosts have a read-only or inconsistently writable web root, and a file written today is stale the moment somebody publishes a page. This answers a rewrite rule from the posts table, cached in a transient that drops on any publish, edit or delete. A real file at the web root still wins, because rewrite rules only run when WordPress does, so a site already publishing its own keeps it. It will not invent facts. An empty About produces a TODO, not generated prose: a machine reading that states something the site does not support is worse than none, because a model repeats it. Privacy policy, password-protected content and untitled pages are all excluded, so the file only ever contains what is already public. The :defined guard is enqueued by the plugin rather than documented, which is the one thing a WordPress user cannot reasonably be expected to get right by hand. The script tag is version-pinned with an integrity hash, added through a script_loader_tag filter scoped to our handle, since WordPress has no SRI API. That also forces ver => null: a ?ver= query string would break the hash match. Verification is two layers, because linting only proves it parses. A stub of the fourteen WordPress functions the generator touches lets the generator actually run, and 14 assertions cover the exclusions, the TODO fallback, tag stripping and the page cap. CI lints at PHP 7.4, the declared floor, not at whatever the runner ships: syntax that is fine on 8.x and fatal on 7.4 is exactly the failure a user hits and we would not. Not submitted to the directory. That is a manual review queue and then SVN, and the screenshots readme.txt references still need taking against a real install.
CI failed on the first run with 'Call to undefined function str_starts_with'. str_contains and str_starts_with are PHP 8.0, and local PHP is 8.5, so the test passed here while being incapable of running on the version the plugin declares support for. The plugin itself was already clean; only the test was not. That is the more useful half of the result: a suite that cannot run at the floor quietly stops testing the version users are on, and the only reason this surfaced in minutes is that CI pins 7.4 rather than taking whatever the runner ships.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ADV-288. WordPress is the one surface in this plan with a plausible path to four figures, because its plugin directory is a search surface with its own SEO — people find plugins by typing into wp-admin, not by reading our docs.
It serves
/llms.txtrather than writing oneEvery other generator writes the file to disk once. On WordPress that's wrong twice over: plenty of hosts have a read-only or inconsistently writable web root, and a file written today is stale the moment somebody publishes a page.
This answers a rewrite rule from the posts table, cached in a transient dropped on any publish, edit or delete. Publish a page and the machine reading includes it.
A real file at the web root still wins, because rewrite rules only run when WordPress does. Deliberate: a site already publishing its own keeps it.
It will not invent facts
An empty About produces a
TODO, not generated prose. A machine reading that states something the site does not support is worse than none, because a model repeats it. Privacy policy, password-protected content and untitled pages are excluded, so the file only ever contains what is already public.The guard is enqueued, not documented
human-machine-swapper:not(:defined){display:none}is the one thing a WordPress user cannot reasonably be expected to get right by hand, so the plugin enqueues it. They cannot skip it.The script tag is version-pinned with an integrity hash via a
script_loader_tagfilter scoped to our handle, since WordPress has no SRI API. That also forcesver => null— a?ver=query string would break the hash match.Verification, in two layers
Linting only proves it parses. So there's a thin stub of the WordPress functions the generator touches, letting the generator actually run:
CI lints at PHP 7.4, the declared floor, not at whatever the runner ships. Syntax that is fine on 8.x and fatal on 7.4 is exactly the failure a user hits and we would not.
Not submitted yet
WordPress.org is a manual review queue and then SVN, not git.
wordpress/README.mdhas the steps. The screenshotsreadme.txtreferences still need taking against a real install.🤖 Generated with Claude Code