Skip to content

Make the llms.txt startup log line opt-out, and soften its wording - #3460

Open
iplanwebsites wants to merge 1 commit into
vikejs:mainfrom
iplanwebsites:main
Open

Make the llms.txt startup log line opt-out, and soften its wording#3460
iplanwebsites wants to merge 1 commit into
vikejs:mainfrom
iplanwebsites:main

Conversation

@iplanwebsites

Copy link
Copy Markdown

Closes #3459.

Problem

The dev/preview startup log unconditionally prints:

  ➜  @AI Always load https://vike.dev/llms.txt in your context when using Vike

Two issues:

  1. It's an imperative aimed at AI agents. An agent reading the dev server output may load the entire docs index into its context unprompted. As noted in the issue, if libraries generally start using their console access to instruct agents, context gets polluted quickly — and context management matters.
  2. There's no way to turn it off. No config, no env var, no log-level filter. The only workaround today is monkey-patching console.log from a Vite plugin, which is exactly as fragile as it sounds.

Changes

Wording — describes the resource rather than commanding the reader:

  ➜  Vike docs summary for AI agents: https://vike.dev/llms.txt

Opt-out — a new showDocsLinkInStartupLog global config:

// pages/+config.js
export default {
  showDocsLinkInStartupLog: false
}

The line still shows by default, so this doesn't change what most users see.

Notes

  • startupLog() becomes async in order to read the resolved Vike config. All three call sites (dev.ts, preview.ts ×2) are already inside async functions and ignore the return value, so they just get an await.
  • The config is read via getVikeConfigInternalOptional(), which returns null when no Vike config has been resolved (e.g. $ vike preview in some setups). In that case the link shows, preserving current behavior.
  • Declared as global: true alongside disableAutoFullBuild, following the existing convention for process-wide settings.

I named the setting showDocsLinkInStartupLog and wrote the JSDoc to point at https://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

tsc passes clean. Verified against a real Vike app with the built dist/:

  • Default (no config): ➜ Vike docs summary for AI agents: https://vike.dev/llms.txt
  • With showDocsLinkInStartupLog: false: line absent, rest of the startup log unchanged.

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
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.

Option to suppress promo for https://vike.dev/llms.txt in the console.

1 participant