Skip to main content

Configuration System

Configuration System

Project-Scoped

Separate packaged defaults, project ownership, effective-value resolution, and subsystem-specific models.

Command.config/custy/config.toml

Category

Architecture

Quick Command

packaged template -> project file -> loader -> resolver -> consumer

TOMLConfigLoaderinitializationprecedence

Overview

Custy separates the configuration shipped with the application from the copy owned by each initialized project. Runtime command resolvers consume values below [tool.custy], usually applying explicit CLI values first, then project settings, then a built-in fallback.


Configuration Lifecycle

Workflow Timeline

1
Package resources
app/templates/config.toml and changelog/changelog.j2 ship with the Python package.
completed
2
Build initialization plan
InitBuilder selects FileRegistry and DirRegistry entries for the requested mode.
completed
3
Create project resources
ScaffoldGenerator writes missing or approved replacement files beneath .config/custy.
completed
4
Load project TOML
ConfigLoader parses the file and exposes the mapping beneath tool.custy.
current
5
Resolve effective values
Command or subsystem resolvers select CLI, configuration, and fallback values.
pending
6
Apply behavior
Workflow, Git, logging, changelog, initialization, backup, cleanup, and path consumers use the resolved values.
pending

Runtime Loader Contract

Properties

PropertyTypeDescriptionDefaultRequired
get(*keys, default=...)Optional nested accessReturns the nested value or fallback when the path is absent or stops being a mapping.-No
require(*keys)Required accessRaises ConfigurationError when the complete path has no value.-No
get_section(*keys)Mapping accessReturns a dictionary for a subsystem table or an empty mapping.-No
resolve(cli_value, config_keys, default)PrecedenceUses explicit CLI, then the project file, then the built-in default; optional flags alter false and required handling.-No
get_config()Shared instanceCreates ConfigLoader lazily and reuses it for the current process.-No
Runtime namespace
toml
[tool.custy]

[tool.custy.cli.execution]
dry_run = false

[tool.custy.git]
default_remote = "origin"

Configuration Dependencies

Command Resolution

Typer optionCliArgs

Represent explicit or omitted user input.


CliArgs and ConfigLoadercommand resolver

Choose an effective value for each supported property.


resolved dataclassWorkflowEngineBuilder

Transport the command's supported values into WorkflowConfig.


WorkflowConfigWorkflowEngine

Construct services and runtime behavior from immutable input intent.

Subsystem Resolution

ConfigLoaderChangelogConfigResolver

Convert changelog tables into nested typed dataclasses and enums.


ConfigLoaderGitService

Resolve remote and tag-sorting policy when needed.


ConfigLoaderlogging setup

Configure Rich console output and rotating file handlers.


ConfigLoaderpath resolver

Resolve and validate project-source paths relative to the working directory.


Typed Changelog Configuration

The changelog subsystem does not pass arbitrary nested dictionaries throughout its processing stages. ChangelogConfigResolver loads core, pending-commit, cleaning, release, release behavior, links, render, breaking, scope mapping, type mapping, and advanced tables into one ChangelogConfig object. It also normalizes selected enum, mapping, and non-negative integer values.

This resolver creates its own ConfigLoader when the generator is constructed, while most command paths reuse the shared loader from get_config().



Import-Time and Process Boundaries

  • Missing project configuration produces an empty mapping and a warning; consumers may continue when they define fallbacks.
  • Invalid TOML raises ConfigurationError during loading.
  • The shared loader does not watch the filesystem; a new CLI process reloads edits.
  • app/constants/resolver.py resolves TARGET_PROJECT_SOURCE at import time and validates that the configured directory exists.
  • Relative filesystem settings are generally evaluated from the process's current working directory.
  • The project configuration should not store repository credentials or other secrets.

Continue