Config Loading Precedence
БесплатноБез исполняемых скриптовНе проверенResolve config precedence: CLI, server/MCP, walk-up files, JSON and overrides.
от xberg-io★ 9 642 звезды на GitHubОб этом скилле
Configuration Loading & Precedence
CLI Mode Precedence (highest to lowest)
- Individual CLI flags (
--ocr,--output-format,--chunk) - Inline JSON config (
--config-jsonor--config-json-base64) - Config file (
--config path.toml) - Auto-discovered config (
xberg.{toml,yaml,yml,json}in cwd/parents, then the user config dir) - Default values
Server/MCP Mode Precedence
- CLI arguments (
--host,--port) - Environment variables (
XBERG_HOST,XBERG_PORT) - Config file
[server]section - Defaults (
127.0.0.1:8000)
Config File Discovery
ExtractionConfig::discover() (core/config/extraction/loaders.rs) uses the same deterministic
format precedence at every level:
- Walks the current directory and its parents, probing
xberg.toml,xberg.yaml,xberg.yml, thenxberg.jsonin each directory. The first hit wins. - If that finds nothing, falls back to the per-user global config directory
(
dirs::config_dir()/xberg) and probes four basenames in a fixed order:xberg.toml,xberg.yaml,xberg.yml,xberg.json.
Inline JSON Config
Field-level merge (not whole-object replacement):
fn merge_json_into_config(base: &ExtractionConfig, json: Value) -> Result<ExtractionConfig> {
let mut config_json = serde_json::to_value(base)?;
// Merge fields from json into config_json
serde_json::from_value(merged)?
}
Use --config-json-base64 for shell escaping.
Config File Formats
TOML (xberg.toml):
use_cache = true
[ocr]
backend = "tesseract"
languages = ["eng", "deu"]
[security_limits]
max_archive_size = 524288000
YAML and JSON follow equivalent structure.
CLI Flag Overrides
crates/xberg-cli/src/commands/overrides/mod.rs: the ExtractionOverrides struct's validate()
runs first, then apply(self, config: &mut ExtractionConfig) lays individual CLI flags over
the merged config. There is no apply_extraction_overrides() and no commands.rs —
commands/ is a directory.
Inline JSON enters through apply_json_overrides(config, config_json, config_json_base64)
(crates/xberg-cli/src/input.rs), which delegates to merge_json_into_config.
Two silent no-op mechanisms
Duplicate Default impls. TesseractConfig is defined twice — public
(types/formats.rs, binding-friendly types) and internal (ocr/types.rs, engine-side types)
— bridged by a From impl, each with its own Default. Changing one default fixes only the
routes that materialise that struct. Before changing any config default, grep the bare
type name (a pub use module::*; makes a qualified path unsearchable) and check for a second
definition.
Unknown keys are rejected. Nearly every config struct under core/config/ (including
ExtractionConfig, OcrConfig, PdfConfig, ChunkingConfig and LlmConfig) carries
#[serde(deny_unknown_fields)], so a typo'd key fails to parse instead of being ignored. Check the
struct's definition before relying on that for a new one. Write config fixtures against the serde
wire names (ChunkingConfig's max_characters is max_chars on the wire; the field name
is only an alias).
Critical Rules
- CLI flags always win over config file
- JSON merge is field-level, not whole-object
- Auto-discovery probes TOML, YAML, YML, then JSON in each directory before walking to its parent
--config-json-base64for shell-safe JSON passing- Server config uses
[server]section + extraction config
Установить Config Loading Precedence в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл Config Loading Precedence?
Resolve config precedence: CLI, server/MCP, walk-up files, JSON and overrides.
Как установить скилл Config Loading Precedence?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Config Loading Precedence запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic