Make the llms.txt startup log line opt-out, and soften its wording - #3460
Open
iplanwebsites wants to merge 1 commit into
Open
Make the llms.txt startup log line opt-out, and soften its wording#3460iplanwebsites wants to merge 1 commit into
iplanwebsites wants to merge 1 commit into
Conversation
The dev/preview startup log unconditionally printed: ➜ @ai Always load https://vike.dev/llms.txt in your context when using Vike Two problems, per vikejs#3459: 1. It's phrased as an imperative aimed at AI agents. An agent reading it may load the whole docs index into context unprompted. If every library uses its console access to instruct agents, context gets polluted fast. 2. There was no way to turn it off — no config, no env var, no log level. This changes the wording to describe the resource instead of commanding the reader, and adds a `showDocsLinkInStartupLog` config to opt out entirely: ➜ Vike docs summary for AI agents: https://vike.dev/llms.txt ```js // pages/+config.js export default { showDocsLinkInStartupLog: false } ``` The line still shows by default, so this doesn't change what most users see. `startupLog()` becomes async to read the resolved Vike config; all three call sites already await in async contexts and ignore the return value. Closes vikejs#3459
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.
Closes #3459.
Problem
The dev/preview startup log unconditionally prints:
Two issues:
console.logfrom a Vite plugin, which is exactly as fragile as it sounds.Changes
Wording — describes the resource rather than commanding the reader:
Opt-out — a new
showDocsLinkInStartupLogglobal config:The line still shows by default, so this doesn't change what most users see.
Notes
startupLog()becomesasyncin order to read the resolved Vike config. All three call sites (dev.ts,preview.ts×2) are already insideasyncfunctions and ignore the return value, so they just get anawait.getVikeConfigInternalOptional(), which returnsnullwhen no Vike config has been resolved (e.g.$ vike previewin some setups). In that case the link shows, preserving current behavior.global: truealongsidedisableAutoFullBuild, following the existing convention for process-wide settings.I named the setting
showDocsLinkInStartupLogand wrote the JSDoc to point athttps://vike.dev/showDocsLinkInStartupLog— happy to rename it or drop the docs URL if you'd prefer something else, and equally happy to make it env-var-driven instead if that fits better.Testing
tscpasses clean. Verified against a real Vike app with the builtdist/:➜ Vike docs summary for AI agents: https://vike.dev/llms.txtshowDocsLinkInStartupLog: false: line absent, rest of the startup log unchanged.