Where Is the Global Configuration for no-mistakes Located?

The global configuration for no-mistakes is defined in the internal/config package and loaded at runtime from .no-mistakes.yaml in the user's home directory (or $NM_HOME).

The global configuration for no-mistakes controls CI timeouts, telemetry, and daemon settings through a centralized system that merges built-in defaults with user-defined values. According to the kunchenguid/no-mistakes source code, this configuration architecture lives in internal/config/config.go and persists in a YAML file that the CLI loads on startup.

Core Configuration Files

Source Code Location

The authoritative definition of the global configuration resides in internal/config/config.go. This file contains the Config struct that defines all available settings, the defaultConfigYAML constant that stores built-in defaults, and the loading logic that merges user preferences.

When the application initializes, it calls config.New(), which internally invokes config.Load() to read and parse the configuration.

User Configuration File

At runtime, no-mistakes searches for .no-mistakes.yaml in the configuration root directory. The loader determines this location through the following precedence:

  1. $NM_HOME environment variable (if set)
  2. $HOME/.no-mistakes (default directory)

The YAML file inside this directory contains the user's persistent global settings that override the compiled-in defaults.

How Configuration Loading Works

The configuration system follows a hierarchical merge strategy implemented in internal/config/config.go:

  1. Default values are loaded from the defaultConfigYAML constant embedded in the binary.
  2. User overrides are read from .no-mistakes.yaml in the configuration directory.
  3. CLI arguments overwrite specific values after the file is loaded.

This three-layer approach ensures the application always has valid fallbacks while allowing granular user control.

Configuring no-mistakes Globally

Sample .no-mistakes.yaml

Create this file in $HOME/.no-mistakes/ (or $NM_HOME) to customize global behavior:

ci_timeout: 15m
telemetry: true
daemon:
  lockfile: "${NM_HOME}/daemon.lock"

Loading Configuration Programmatically

You can interact with the configuration directly using the Go API:

cfg, err := config.Load()  // reads $NM_HOME/.no-mistakes.yaml
if err != nil {
    log.Fatalf("config load failed: %v", err)
}
fmt.Printf("CI timeout: %v\n", cfg.CITimeout)

Runtime Overrides and Precedence

Command-line flags take final precedence over file-based configuration. The flag parsing logic in internal/config/config.go modifies the loaded configuration before the rest of the application accesses it.

To override a setting temporarily:

no-mistakes --ci-timeout=30m run

This bypasses the value defined in .no-mistakes.yaml without modifying the file.

Testing and Validation

The configuration system includes comprehensive tests to ensure reliability:

Summary

  • The global configuration for no-mistakes is defined in internal/config/config.go and consumed via the Config struct.
  • User settings are stored in .no-mistakes.yaml within $NM_HOME or $HOME/.no-mistakes.
  • The config.Load() function merges default values, file settings, and CLI flags in that order of precedence.
  • Use environment variables like $NM_HOME to relocate the configuration directory.

Frequently Asked Questions

Where does no-mistakes look for the global config file?

no-mistakes searches for .no-mistakes.yaml in the directory specified by the $NM_HOME environment variable. If $NM_HOME is unset, it defaults to $HOME/.no-mistakes. The config.Load() function in internal/config/config.go handles this resolution at startup.

What format does the no-mistakes configuration file use?

The global configuration uses YAML format with keys matching the fields of the Config struct defined in internal/config/config.go. Options include ci_timeout, telemetry, and nested objects like daemon with sub-properties such as lockfile.

How are default values defined in no-mistakes?

Default values are stored in the defaultConfigYAML constant within internal/config/config.go. These values are compiled into the binary and serve as fallbacks when the user configuration file is missing or when specific keys are omitted from .no-mistakes.yaml.

Can environment variables override no-mistakes configuration?

While the configuration loader primarily respects the $NM_HOME variable for directory location, specific settings are typically controlled via command-line flags that override file values. The config_args_override_test.go file confirms this behavior, showing that flags take precedence over both defaults and YAML settings.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →