Skip to content

feat(task): allow to set confirmation default#9089

Merged
jdx merged 3 commits intojdx:mainfrom
roele:issues/9067
Apr 14, 2026
Merged

feat(task): allow to set confirmation default#9089
jdx merged 3 commits intojdx:mainfrom
roele:issues/9067

Conversation

@roele
Copy link
Copy Markdown
Contributor

@roele roele commented Apr 14, 2026

Currently the default selected option for confirm in tasks is Yes which might not be a sensible default for destructive actions. While keeping this behaviour we add an option to define confirm as map with message and default=yes|no.

Copilot AI review requested due to automatic review settings April 14, 2026 18:29
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

Adds support for configuring the default-selected value of task confirmation prompts by allowing confirm to be specified as either a string or an object { message, default }.

Changes:

  • Introduces TaskConfirm (string-or-object) and updates task/task_template parsing to use it.
  • Extends the confirmation prompt API to allow specifying the default selection and wires it into task execution.
  • Updates schemas + docs and adds parsing tests for the new confirm object form.

Reviewed changes

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

Show a summary per file
File Description
src/ui/prompt.rs Adds confirm_with_default and changes confirm() behavior.
src/task/task_template.rs Switches confirm from Option<String> to Option<TaskConfirm>.
src/task/task_executor.rs Renders TaskConfirm.message() and applies parsed default selection for prompts.
src/task/task_confirm.rs New TaskConfirm enum with helpers + a test for header parsing.
src/task/mod.rs Updates Task.confirm type and task header parsing for confirm.
src/config/config_file/mise_toml.rs Adds tests ensuring TOML parsing supports confirm object form.
schema/mise.json Expands confirm schema to accept string or {message, default}.
schema/mise-task.json Same as above for task schema.
docs/tasks/task-configuration.md Documents object form for confirm and updates example.

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

Comment thread src/ui/prompt.rs Outdated
Comment thread src/task/task_executor.rs Outdated
Comment thread src/task/task_confirm.rs
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 14, 2026

Greptile Summary

This PR extends the confirm task field to accept either a plain string or an object { message, default }, letting task authors set "no" as the default for destructive actions. The implementation is clean: a new TaskConfirm enum with untagged serde deserialization, schema enum constraints on default, and backwards-compatible executor logic (None => true).

  • P1 – default_yes ignored in non-interactive mode: confirm_with_default returns Ok(false) unconditionally when the terminal is not attended (line 22 of src/ui/prompt.rs), so default = "yes" is silently discarded in CI/non-interactive contexts. Returning Ok(default_yes) there would honour the declared default without breaking the safety-first intent for default = "no".

Confidence Score: 4/5

  • Safe to merge after addressing the non-interactive default behaviour; the rest of the implementation is solid.
  • All three previously raised P1 concerns (confirm() default, schema enum constraint, schema-Rust required mismatch) are correctly resolved. One new P1 remains: confirm_with_default ignores default_yes in non-interactive environments, making default = "yes" a no-op outside interactive terminals and potentially surprising users who expect CI pipelines to auto-proceed.
  • src/ui/prompt.rs — the early Ok(false) return should use Ok(default_yes)

Important Files Changed

Filename Overview
src/task/task_confirm.rs New TaskConfirm enum with Message(String) and Options { message, default } variants; untagged serde deserialization is correct, default_value() returns Option<&str> cleanly consumed by the executor.
src/ui/prompt.rs confirm() correctly delegates to confirm_with_default(message, true) preserving backwards-compatible Yes default, but confirm_with_default ignores default_yes in non-interactive environments (always returns Ok(false)).
src/task/task_executor.rs Confirmation logic updated to use TaskConfirm methods; parse_confirm_default handles all valid string values; None => true correctly preserves backwards-compatible default for plain string confirm.
schema/mise-task.json Both confirm schema locations updated with oneOf allowing string or object; default field uses enum constraint and is listed in required, matching the Rust struct.
schema/mise.json All three confirm definitions updated consistently with enum constraint and required: [message, default]; no drift between schema locations.
src/task/mod.rs confirm field type changed from Option<String> to Option<TaskConfirm>; file-based task header parsing updated to use get_raw + TaskConfirm::deserialize with a useful error message.
src/task/task_template.rs confirm field type aligned to Option<TaskConfirm>; merge_template correctly preserves existing "local overrides template" semantics for the new type.
docs/tasks/task-configuration.md Type signature updated to show both forms; example changed to the new object form while the Tera-template example below still illustrates the plain string form.
src/config/config_file/mise_toml.rs Two new unit tests covering TOML [tasks.*] and [task_templates.*] confirm object parsing; both correctly assert the Options variant is deserialized.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Task has confirm field] --> B{TaskConfirm variant}
    B -->|Message string| C[message = string\ndefault_yes = true]
    B -->|Options object| D[message = options.message\ndefault = options.default]
    D --> E[parse_confirm_default]
    E -->|yes / y / true| F[default_yes = true]
    E -->|no / n / false| G[default_yes = false]
    E -->|other| H[Error: invalid default]
    C --> I{Settings.yes flag?}
    F --> I
    G --> I
    I -->|set| J[Skip prompt - Task runs]
    I -->|not set| K{user_attended_stderr?}
    K -->|No terminal| L[Returns Ok false - Task aborts - default_yes ignored]
    K -->|Interactive| M[confirm_with_default with default_yes]
    M -->|User confirms| J
    M -->|User denies| N[Error: aborted by user]
Loading

Comments Outside Diff (1)

  1. src/ui/prompt.rs, line 21-23 (link)

    P1 default_yes ignored in non-interactive mode

    The early return on line 22 always returns Ok(false) regardless of default_yes. A user who sets confirm = { message = "...", default = "yes" } will have their task aborted in CI or any non-attended terminal, even though they explicitly declared yes as the default. The --yes flag (Settings::get().yes) bypasses the prompt entirely via check_confirmation, but the default_yes value is silently discarded here. Consider returning Ok(default_yes) instead of Ok(false) so the declared default is honoured in non-interactive contexts:

Reviews (5): Last reviewed commit: "[autofix.ci] apply automated fixes (atte..." | Re-trigger Greptile

Comment thread src/ui/prompt.rs
Comment thread schema/mise-task.json
@jdx
Copy link
Copy Markdown
Owner

jdx commented Apr 14, 2026

maybe it would also be useful to have some way to force the user to type something in like "I'm really sure" or an app name or something for confirmations?

doesn't replace this though, I think this is still useful on its own

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the task confirmation feature by allowing users to specify a default value (e.g., "yes", "no", "true", "false") through a new object-based configuration for the confirm property. The changes include updates to the documentation, JSON schemas, and the internal task execution logic to support both the legacy string format and the new structured format. Feedback focuses on ensuring the internal Rust implementation of the TaskConfirm enum strictly aligns with the optional nature of the default field as defined in the schema, and correcting a change in the global prompt utility that inadvertently altered the default behavior for existing confirmation prompts.

Comment thread src/task/task_confirm.rs
Comment thread src/task/task_confirm.rs
Comment thread src/ui/prompt.rs Outdated
Comment thread src/task/task_confirm.rs
@jdx jdx merged commit 0a10b87 into jdx:main Apr 14, 2026
35 checks passed
@roele roele deleted the issues/9067 branch April 15, 2026 05:31
mise-en-dev added a commit that referenced this pull request Apr 15, 2026
### 🚀 Features

- **(npm)** use --min-release-age for npm 11.10.0+ supply chain
protection by @webkaz in [#9072](#9072)
- **(registry)** add openfga by @mnm364 in
[#9084](#9084)
- **(task)** allow to set confirmation default by @roele in
[#9089](#9089)
- support os/arch compound syntax in tool os filtering by @RobertDeRose
in [#9088](#9088)

### 🐛 Bug Fixes

- **(activate)** export __MISE_EXE and resolve bare ARGV0 to absolute
path by @fru1tworld in [#9081](#9081)
- **(install)** support aliased installs sharing a backend by @jdx in
[#9093](#9093)
- **(shim)** use which_no_shims when resolving mise binary in reshim and
doctor by @kevinswiber in [#9071](#9071)
- filter empty segments in colon-separated env var parsing by @baby-joel
in [#9076](#9076)

### 📚 Documentation

- fix wrong file reference to forgejo backend implemenation by @roele in
[#9090](#9090)
- fix cli token command for token resolution by @roele in
[#9077](#9077)

### 📦 Registry

- add trzsz-go
([aqua:trzsz/trzsz-go](https://github.com/trzsz/trzsz-go)) by
@ZeroAurora in [#9083](#9083)
- add copilot
([aqua:github/copilot-cli](https://github.com/github/copilot-cli)) by
@risu729 in [#9082](#9082)

### Chore

- add AGENTS.md symlink by @jdx in
[#9094](#9094)

### New Contributors

- @kevinswiber made their first contribution in
[#9071](#9071)
- @webkaz made their first contribution in
[#9072](#9072)
- @RobertDeRose made their first contribution in
[#9088](#9088)

## 📦 Aqua Registry Updates

#### New Packages (7)

-
[`IBM-Cloud/ibm-cloud-cli-release`](https://github.com/IBM-Cloud/ibm-cloud-cli-release)
- [`max-sixty/worktrunk`](https://github.com/max-sixty/worktrunk)
- [`micelio.dev/hif`](https://github.com/micelio.dev/hif)
- [`pgplex/pgschema`](https://github.com/pgplex/pgschema)
-
[`rose-pine/rose-pine-bloom`](https://github.com/rose-pine/rose-pine-bloom)
- [`santosr2/TerraTidy`](https://github.com/santosr2/TerraTidy)
- [`trzsz/trzsz-go`](https://github.com/trzsz/trzsz-go)

#### Updated Packages (3)

- [`mvdan/sh`](https://github.com/mvdan/sh)
- [`rvben/rumdl`](https://github.com/rvben/rumdl)
- [`temporalio/temporal`](https://github.com/temporalio/temporal)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 16, 2026
## [2026.4.14](https://github.com/jdx/mise/compare/v2026.4.13..v2026.4.14) - 2026-04-15

### Chore

- bump sigstore-verification by @jdx in [#9128](jdx/mise#9128)

## [2026.4.13](https://github.com/jdx/mise/compare/v2026.4.12..v2026.4.13) - 2026-04-15

### 🐛 Bug Fixes

- **(go)** honor install_before for module versions by @mariusvniekerk in [#9097](jdx/mise#9097)
- **(vfox-plugin)** support Git URL with commit hash for mise.toml by @Oyami-Srk in [#9099](jdx/mise#9099)
- `MISE_FETCH_REMOTE_VERSIONS_CACHE` not respected by @mcncl in [#9096](jdx/mise#9096)

### 📦️ Dependency Updates

- unblock cargo-deny advisories check by @jdx in [#9112](jdx/mise#9112)

### New Contributors

- @mariusvniekerk made their first contribution in [#9097](jdx/mise#9097)
- @mcncl made their first contribution in [#9096](jdx/mise#9096)
- @Oyami-Srk made their first contribution in [#9099](jdx/mise#9099)

## [2026.4.12](https://github.com/jdx/mise/compare/v2026.4.11..v2026.4.12) - 2026-04-15

### 🚀 Features

- **(npm)** use --min-release-age for npm 11.10.0+ supply chain protection by @webkaz in [#9072](jdx/mise#9072)
- **(registry)** add openfga by @mnm364 in [#9084](jdx/mise#9084)
- **(task)** allow to set confirmation default by @roele in [#9089](jdx/mise#9089)
- support os/arch compound syntax in tool os filtering by @RobertDeRose in [#9088](jdx/mise#9088)

### 🐛 Bug Fixes

- **(activate)** export __MISE_EXE and resolve bare ARGV0 to absolute path by @fru1tworld in [#9081](jdx/mise#9081)
- **(install)** support aliased installs sharing a backend by @jdx in [#9093](jdx/mise#9093)
- **(shim)** use which_no_shims when resolving mise binary in reshim and doctor by @kevinswiber in [#9071](jdx/mise#9071)
- filter empty segments in colon-separated env var parsing by @baby-joel in [#9076](jdx/mise#9076)

### 📚 Documentation

- fix wrong file reference to forgejo backend implemenation by @roele in [#9090](jdx/mise#9090)
- fix cli token command for token resolution by @roele in [#9077](jdx/mise#9077)
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.

4 participants