fix(edit): strip formatting whitespace from TOML values in mise edit#8162
fix(edit): strip formatting whitespace from TOML values in mise edit#8162
mise edit#8162Conversation
Allow reading environment variable values from stdin for multiline or binary-safe input. This enables use cases like storing SSH keys or certificates via `cat key.pem | mise set --stdin MY_KEY`. Strips a single trailing newline to match `gh secret set` behavior. Closes #6878 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove "binary-safe" from doc comment since read_to_string requires UTF-8 (Copilot feedback) - Use explicit \r\n / \n check with truncate for clearer newline stripping logic (Gemini feedback) - Regenerate docs/completions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move the stdin field after remove in the Set struct to maintain alphabetical ordering of long-only flags, and add requires = "env_vars" so --stdin without a key gives a clear error instead of silently listing env vars. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
toml_edit's Formatted<T> wrapper preserves original TOML formatting including whitespace around values. Calling .to_string() on these wrappers produced strings like " true" instead of "true", causing invalid config files when saved. Use .value().to_string() to extract raw values, matching the existing pattern for String values. Fixes #8141 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello @jdx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
mise editmise edit
There was a problem hiding this comment.
Code Review
This pull request introduces two main changes. First, it fixes a bug in mise edit where TOML values for integers, floats, booleans, and datetimes were being serialized with extra whitespace, potentially creating invalid configurations. This is corrected by using .value().to_string() to extract the raw value, which is a solid fix. Second, it adds a new --stdin flag to the mise set command, allowing multiline values to be provided via standard input. This new feature is well-implemented with appropriate validation, clear documentation, and comprehensive end-to-end tests. The code quality is high, and I have no concerns or suggestions for improvement.
There was a problem hiding this comment.
Pull request overview
This PR addresses a bug in the interactive TOML editor where toml_edit's Formatted<T> wrapper preserves formatting whitespace, causing booleans and other values to be serialized with unwanted whitespace (e.g., " true" instead of true). The fix extracts raw values using .value().to_string() instead of directly calling .to_string() on formatted values. Additionally, the PR adds a --stdin flag to mise set for reading multiline environment variable values from stdin.
Changes:
- Fixed
value_to_string()inmise-interactive-configto strip formatting whitespace from TOML values - Added
--stdinflag tomise setcommand for multiline environment variable input - Added comprehensive tests for the new
--stdinfunctionality
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/mise-interactive-config/src/document.rs | Fixed value_to_string() to call .value().to_string() on Integer, Float, Boolean, and Datetime types to strip formatting whitespace |
| src/cli/set.rs | Added --stdin flag implementation with validation, stdin reading, and single trailing newline stripping |
| e2e/cli/test_set | Added 6 new test cases covering multiline values, newline stripping, and error cases for --stdin |
| xtasks/fig/src/mise.ts | Added --stdin flag to Fig autocomplete spec |
| mise.usage.kdl | Updated usage spec with --stdin flag and examples |
| man/man1/mise.1 | Updated man page documentation for --stdin flag |
| docs/cli/set.md | Added --stdin documentation and examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
bugbot run |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.13 x -- echo |
23.8 ± 0.5 | 23.1 | 29.1 | 1.00 |
mise x -- echo |
24.4 ± 1.2 | 23.4 | 40.5 | 1.02 ± 0.06 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.13 env |
23.5 ± 0.4 | 22.8 | 24.9 | 1.00 |
mise env |
24.3 ± 0.8 | 23.1 | 28.4 | 1.03 ± 0.04 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.13 hook-env |
24.0 ± 0.5 | 23.3 | 26.6 | 1.00 |
mise hook-env |
24.6 ± 1.1 | 23.6 | 41.4 | 1.02 ± 0.05 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.2.13 ls |
23.0 ± 0.7 | 21.9 | 26.9 | 1.00 |
mise ls |
23.3 ± 0.5 | 22.0 | 24.6 | 1.01 ± 0.04 |
xtasks/test/perf
| Command | mise-2026.2.13 | mise | Variance |
|---|---|---|---|
| install (cached) | 129ms | 129ms | +0% |
| ls (cached) | 80ms | 82ms | -2% |
| bin-paths (cached) | 85ms | 83ms | +2% |
| task-ls (cached) | 830ms | 845ms | -1% |
### 🚀 Features - **(vfox)** allow plugins to request env var redaction via MiseEnvResult by @jdx in [#8166](#8166) - add a default_host setting for rust by @aacebedo in [#8154](#8154) - add github_content package support for aqua backend by @risu729 in [#8147](#8147) - support devEngines.runtime in deno by @risu729 in [#8144](#8144) ### 🐛 Bug Fixes - **(asset_matcher)** penalize vsix files by @risu729 in [#8151](#8151) - **(edit)** strip formatting whitespace from TOML values in `mise edit` by @jdx in [#8162](#8162) - **(install)** improve --locked support for python and ubi backends by @jdx in [#8163](#8163) - **(npm)** suppress npm update notifier while npm install by @risu729 in [#8152](#8152) - **(schema)** add task_templates, extends, and timeout by @risu729 in [#8145](#8145) ### 🚜 Refactor - **(registry)** remove [key=value] options syntax from backends by @risu729 in [#8146](#8146) ### 📚 Documentation - **(settings)** remove wrong tip for github_attestations by @risu729 in [#8158](#8158) ### Chore - **(release-plz)** delete embedded plugins directory before update by @risu729 in [#8149](#8149) - adds necessary env var to the mcp help message in cli by @joaommartins in [#8133](#8133) ### New Contributors - @joaommartins made their first contribution in [#8133](#8133) ## 📦 Aqua Registry Updates #### New Packages (5) - [`containers/podlet`](https://github.com/containers/podlet) - [`hickford/git-credential-azure`](https://github.com/hickford/git-credential-azure) - [`hickford/git-credential-oauth`](https://github.com/hickford/git-credential-oauth) - [`kovetskiy/mark`](https://github.com/kovetskiy/mark) - [`openbao/openbao/bao`](https://github.com/openbao/openbao/bao)
jdx#8162) ## Summary - Fix `mise edit` generating invalid config with booleans like `" true"` instead of `"true"` - `toml_edit`'s `Formatted<T>` wrapper preserves original whitespace; calling `.to_string()` on it includes that whitespace - Use `.value().to_string()` to extract raw values for `Integer`, `Float`, `Boolean`, and `Datetime`, matching the existing pattern for `String` Fixes jdx#8141 ## Test plan - [x] All 37 existing `mise-interactive-config` tests pass - [x] All linting passes - [ ] Manual test: create a `mise.toml` with boolean settings, run `mise edit`, save without changes, verify booleans remain valid 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Touches config serialization and the `mise set` write-path; while changes are small and tested, they affect persisted config output and CLI input handling. > > **Overview** > Fixes TOML value stringification in `mise-interactive-config` by extracting the raw value (`.value()`) for integers, floats, booleans, and datetimes, preventing preserved formatting whitespace from producing invalid output. > > Adds `mise set --stdin` to read a single env var’s value from stdin (supports multiline), strips a single trailing newline, and rejects invalid usage (multiple keys or `KEY=VALUE`). Updates CLI docs/usage, shell completions (Fig), and adds E2E coverage for the new flag. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 25580bc. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
### 🚀 Features - **(vfox)** allow plugins to request env var redaction via MiseEnvResult by @jdx in [jdx#8166](jdx#8166) - add a default_host setting for rust by @aacebedo in [jdx#8154](jdx#8154) - add github_content package support for aqua backend by @risu729 in [jdx#8147](jdx#8147) - support devEngines.runtime in deno by @risu729 in [jdx#8144](jdx#8144) ### 🐛 Bug Fixes - **(asset_matcher)** penalize vsix files by @risu729 in [jdx#8151](jdx#8151) - **(edit)** strip formatting whitespace from TOML values in `mise edit` by @jdx in [jdx#8162](jdx#8162) - **(install)** improve --locked support for python and ubi backends by @jdx in [jdx#8163](jdx#8163) - **(npm)** suppress npm update notifier while npm install by @risu729 in [jdx#8152](jdx#8152) - **(schema)** add task_templates, extends, and timeout by @risu729 in [jdx#8145](jdx#8145) ### 🚜 Refactor - **(registry)** remove [key=value] options syntax from backends by @risu729 in [jdx#8146](jdx#8146) ### 📚 Documentation - **(settings)** remove wrong tip for github_attestations by @risu729 in [jdx#8158](jdx#8158) ### Chore - **(release-plz)** delete embedded plugins directory before update by @risu729 in [jdx#8149](jdx#8149) - adds necessary env var to the mcp help message in cli by @joaommartins in [jdx#8133](jdx#8133) ### New Contributors - @joaommartins made their first contribution in [jdx#8133](jdx#8133) ## 📦 Aqua Registry Updates #### New Packages (5) - [`containers/podlet`](https://github.com/containers/podlet) - [`hickford/git-credential-azure`](https://github.com/hickford/git-credential-azure) - [`hickford/git-credential-oauth`](https://github.com/hickford/git-credential-oauth) - [`kovetskiy/mark`](https://github.com/kovetskiy/mark) - [`openbao/openbao/bao`](https://github.com/openbao/openbao/bao)
Summary
mise editgenerating invalid config with booleans like" true"instead of"true"toml_edit'sFormatted<T>wrapper preserves original whitespace; calling.to_string()on it includes that whitespace.value().to_string()to extract raw values forInteger,Float,Boolean, andDatetime, matching the existing pattern forStringFixes #8141
Test plan
mise-interactive-configtests passmise.tomlwith boolean settings, runmise edit, save without changes, verify booleans remain valid🤖 Generated with Claude Code
Note
Low Risk
Small, localized change to TOML value stringification; primary risk is subtle formatting/round-trip differences for numeric/boolean/datetime values.
Overview
Fixes
mise editround-tripping TOML scalars by extracting raw values fromtoml_edit::Formatted<T>rather than preserving its original formatting.In
TomlDocument::value_to_string(crates/mise-interactive-config/src/document.rs), integer/float/boolean/datetime serialization now uses.value().to_string()(matching strings) instead of.to_string(), preventing emitted values like" true"that can make saved configs invalid.Written by Cursor Bugbot for commit 69dc7ab. This will update automatically on new commits. Configure here.