Skip to content

feat(config): add .miserc.toml for early initialization settings#7596

Merged
jdx merged 2 commits into
mainfrom
feat/miserc-toml
Jan 8, 2026
Merged

feat(config): add .miserc.toml for early initialization settings#7596
jdx merged 2 commits into
mainfrom
feat/miserc-toml

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Jan 8, 2026

Summary

  • Adds .miserc.toml - a config file loaded very early in the initialization process, before main config files are parsed
  • Primary use case: setting MISE_ENV in a config file instead of only via env vars or CLI args
  • Settings marked with rc = true in settings.toml can be set in .miserc.toml:
    • env - the primary use case for setting MISE_ENV
    • cd - change directory before loading config
    • ceiling_paths (new setting) - where to stop searching for config files
    • ignored_config_paths - paths to skip during config discovery
    • override_config_filenames - override default config filenames
    • override_tool_versions_filenames - override .tool-versions filenames

File locations (in order of precedence):

  1. Local: .miserc.toml in cwd and ancestors
  2. Global: ~/.config/mise/miserc.toml
  3. System: /etc/mise/miserc.toml

Precedence: CLI args > env vars > .miserc.toml

Also generates a JSON schema for .miserc.toml at schema/miserc.json.

Test plan

  • New E2E test test_miserc verifies:
    • Setting MISE_ENV via .miserc.toml loads correct env-specific config
    • Environment variables override .miserc.toml
    • Subdirectories pick up parent .miserc.toml
  • Existing test_config_env test continues to pass
  • Manual testing with .miserc.toml files

🤖 Generated with Claude Code


Note

Enables early initialization via .miserc.toml so settings marked rc = true (e.g., env, ceiling_paths, ignored_config_paths, override_*_filenames) can influence config discovery before main files load.

  • New src/config/miserc.rs to locate/merge .miserc.toml from local→global→system; Cli::run loads it at startup
  • env.rs reads rc settings from miserc as fallback with precedence: CLI > env vars > .miserc.toml
  • Codegen: build.rs emits MisercSettings; xtasks/render/schema.ts generates schema/miserc.json from settings.toml entries with rc=true
  • Add ceiling_paths setting and mark applicable settings with rc=true in settings.toml; adjust schema/mise.json/mise-settings.json
  • Docs update for setting MISE_ENV via .miserc.toml; new e2e e2e/config/test_miserc validating behavior

Written by Cursor Bugbot for commit 267fb20. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings January 8, 2026 02:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces .miserc.toml, a configuration file loaded during early initialization before main config files are parsed. The primary use case is setting MISE_ENV in a config file rather than only through environment variables or CLI arguments, enabling environment-specific configuration (e.g., mise.development.toml) to be selected via file-based settings.

Key changes:

  • Adds .miserc.toml support with precedence: CLI args > env vars > .miserc.toml
  • New ceiling_paths setting to control config file search boundaries
  • Generates JSON schema for .miserc.toml validation

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/config/miserc.rs New module implementing .miserc.toml loading, merging, and accessor functions
src/env.rs Updates lazy statics to fall back to .miserc.toml values when env vars are unset
src/cli/mod.rs Initializes .miserc.toml early in CLI execution before accessing MISE_ENV
settings.toml Marks eligible settings with rc = true flag and adds new ceiling_paths setting
build.rs Generates MisercSettings struct from settings marked with rc = true
xtasks/render/schema.ts Generates JSON schema for .miserc.toml filtering settings by rc = true
schema/miserc.json Generated JSON schema for .miserc.toml validation
schema/mise.json Updated with ceiling_paths setting and revised descriptions
schema/mise-settings.json Adds rc field definition to settings schema
e2e/config/test_miserc E2E test verifying .miserc.toml functionality and precedence rules

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread xtasks/render/schema.ts

for (const key in doc) {
const props = doc[key];
if (hasSubkeys(props) && props.rc === true) {
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition hasSubkeys(props) checks if props is a Props type with a type field, but then accesses props.rc directly. This creates a type mismatch because hasSubkeys is a type guard that narrows to Props, but Props doesn't include an rc field in its type definition. Add rc?: boolean to the Props type definition at the top of the file to match the actual usage.

Copilot uses AI. Check for mistakes.
Comment thread src/config/miserc.rs
.unwrap_or_else(|_| PathBuf::from("/etc/mise"));
let system_path = system_dir.join("miserc.toml");
if system_path.is_file() {
files.push(system_path);
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The find_miserc_files function collects files in precedence order (highest first) but the calling code in load_miserc_settings iterates in reverse. Consider reversing the collection order here and removing the .rev() in the caller for clearer intent, or add a comment explaining why files are collected highest-first when they'll be processed lowest-first.

Copilot uses AI. Check for mistakes.
Comment thread e2e/config/test_miserc
MISE_ENV=ci assert "mise ls dummy" "dummy 1.1.0 (missing) ~/workdir/mise.toml 1"

# Test ceiling_paths in .miserc.toml - subdirectory should pick up parent miserc
rm -f .miserc.toml
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test removes .miserc.toml on line 17 and immediately recreates it on line 18 with identical content. This appears to be redundant—consider removing line 17 or clarifying with a comment if this serves a specific testing purpose.

Suggested change
rm -f .miserc.toml

Copilot uses AI. Check for mistakes.
@jdx jdx force-pushed the feat/miserc-toml branch 2 times, most recently from 8df6e1f to 16dc7c7 Compare January 8, 2026 02:05
This adds support for .miserc.toml, a config file that is loaded very
early in the initialization process, before the main config files are
parsed. This allows setting MISE_ENV in a config file instead of only
via environment variables or CLI args.

Settings that can be set in .miserc.toml (marked with `rc = true` in
settings.toml):
- env - the primary use case for setting MISE_ENV
- cd - change directory before loading config
- ceiling_paths - where to stop searching for config files
- ignored_config_paths - paths to skip during config discovery
- override_config_filenames - override default config filenames
- override_tool_versions_filenames - override .tool-versions filenames

File locations (in order of precedence):
1. Local: .miserc.toml in cwd and ancestors
2. Global: ~/.config/mise/miserc.toml
3. System: /etc/mise/miserc.toml

Precedence: CLI args > env vars > .miserc.toml

Closes #XXXX

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jdx jdx force-pushed the feat/miserc-toml branch from 16dc7c7 to 4153a74 Compare January 8, 2026 02:07
Comment thread src/config/miserc.rs
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 8, 2026

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.0 x -- echo 19.5 ± 0.8 18.7 27.6 1.00
mise x -- echo 19.6 ± 0.5 18.7 21.8 1.00 ± 0.05

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.0 env 18.9 ± 0.4 18.1 21.9 1.00
mise env 19.3 ± 0.9 18.3 26.9 1.02 ± 0.05

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.0 hook-env 19.1 ± 0.4 18.4 22.8 1.00
mise hook-env 19.3 ± 0.6 18.5 26.3 1.01 ± 0.04

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.0 ls 17.3 ± 0.4 16.4 19.6 1.00
mise ls 17.4 ± 0.8 16.6 27.3 1.01 ± 0.05

xtasks/test/perf

Command mise-2026.1.0 mise Variance
install (cached) 109ms 108ms +0%
ls (cached) 66ms 66ms +0%
bin-paths (cached) 70ms 70ms +0%
task-ls (cached) 276ms 278ms +0%

@jdx jdx enabled auto-merge (squash) January 8, 2026 03:24
@jdx jdx merged commit 8b04189 into main Jan 8, 2026
35 checks passed
@jdx jdx deleted the feat/miserc-toml branch January 8, 2026 03:26
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.

2 participants