diff --git a/e2e/tasks/test_task_monorepo_trust b/e2e/tasks/test_task_monorepo_trust index 32dfb6a6e8..f05b8ac8a2 100755 --- a/e2e/tasks/test_task_monorepo_trust +++ b/e2e/tasks/test_task_monorepo_trust @@ -56,4 +56,4 @@ EOF export MISE_TRUSTED_CONFIG_PATHS="" # Verify trust error appears for the parent config (command should fail) -assert_contains "mise -C ../parent-dir tasks ls 2>&1 || true" "are not trusted" +assert_contains "MISE_YES=0 mise -C ../parent-dir tasks ls 2>&1 || true" "are not trusted" diff --git a/e2e/tasks/test_task_untrusted_config_error b/e2e/tasks/test_task_untrusted_config_error index c9f2e1659c..ae170a9fd2 100644 --- a/e2e/tasks/test_task_untrusted_config_error +++ b/e2e/tasks/test_task_untrusted_config_error @@ -18,7 +18,7 @@ EOF # 2. Show a clear "config not trusted" error (not "no tasks defined") # # This test verifies we don't get the misleading "no tasks defined" error -output=$(mise run make 2>&1 || true) +output=$(MISE_YES=0 mise run make 2>&1 || true) # The error should mention "trust" or "untrusted", not just "no tasks defined" if echo "$output" | grep -q "no tasks defined.*Are you in a project directory"; then diff --git a/src/config/config_file/mod.rs b/src/config/config_file/mod.rs index 587c29548c..5f958478c3 100644 --- a/src/config/config_file/mod.rs +++ b/src/config/config_file/mod.rs @@ -300,11 +300,12 @@ pub fn trust_check(path: &Path) -> eyre::Result<()> { return Ok(()); } if cmd != "hook-env" && !is_ignored(&config_root) && !is_ignored(path) { - let ans = prompt::confirm_with_all(format!( - "{} config files in {} are not trusted. Trust them?", - style::eyellow("mise"), - style::epath(&config_root) - ))?; + let ans = (settings::is_loaded() && Settings::get().yes) + || prompt::confirm_with_all(format!( + "{} config files in {} are not trusted. Trust them?", + style::eyellow("mise"), + style::epath(&config_root) + ))?; if ans { trust(&config_root)?; return Ok(());