从源码整理配置选项参考文档
从配置源码提取参数、默认值和加载优先级,生成使用示例、废弃项说明及文档同步方案。
完整提示词
<context>
Operators read a configuration reference when something is already wrong: a setting does not take effect, a default surprised them, or an upgrade broke a renamed key. References fail when they copy the code's field names but not the environment variable or file key users type, list a default that differs from the code, never say which source wins when a value is set twice, omit units ("timeout: 30" - seconds or milliseconds?), and drift because they are written by hand. Output format: {{format}}.
</context>
<task>
<config_source>
{{config_source}}
</config_source>
1. Work out how configuration is loaded: sources (defaults, config files and their search paths, environment variables with prefix, command-line flags, remote config) and the precedence order. If the code does not make precedence clear, say so.
2. Extract every option. For each: the key as users write it in each source (file key, env var name, flag), type, default exactly as in code, unit, allowed values or range, whether required, whether a change needs a restart or is reloaded live, whether it is sensitive (secret), and what it does in one or two sentences focused on behaviour.
3. Group options by task (server, storage, auth, logging, limits) rather than alphabetically, and order each group by how often people change them, most first, if you can tell.
4. Give one realistic example per group, and one complete minimal configuration that starts the service.
5. Collect deprecated or renamed options: old name, new name, the version it changed if the code says so, and what happens when the old name is used (ignored, warning, mapped).
6. List discrepancies: options read in code but missing from the schema, defaults that differ between sources, options that are documented in comments but never read, and unclear units.
7. Propose how to keep the reference in sync: generate it from the schema or settings class (name the mechanism that fits the language), check in CI that the generated file is up to date, and add descriptions to the source so generation produces good text.
</task>
<constraints>
- Defaults, names and allowed values come only from the source given. Never fill a default from typical values; write "not set in code" or [X].
- Mark sensitive options and never print real secret values in examples; use placeholders such as `<your-api-key>`.
- State units explicitly for every duration, size and rate.
- If the source is partial (for example only the env var parser, not the file loader), say what is missing and document only what you can see.
{{> guardrails/investigate-before-answering}}
</constraints>
<output_format>
## Precedence
Numbered list from highest to lowest priority, plus config file search paths.
## Reference
For markdown-table: one table per group with columns option, env var, flag, type, default, allowed values, restart, description.
For reference-pages: one heading per option with a key-value block and description.
For yaml-annotated: one YAML code block with every option commented with type, default and allowed values.
Then the minimal complete example.
## Deprecated names
Table: old name, new name, since, behaviour when used. Or "None found".
## Discrepancies
Bullets with the file or line where each was seen. Or "None found".
## Keeping it in sync
Three to six bullets with the generation and CI check approach.
</output_format>可替换内容
- {{format}}
- {{config_source}}
- {{> guardrails/investigate-before-answering}}
- [X]
分类与标签
编程开发、配置参考文档、源码文档化、环境变量、文档自动生成