Repository navigation
feat(task): allow customizing confirm answer labels - #13944
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013RFawR941sEpBL1ZrKgDbJ
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughTask confirmations now accept optional defaults and custom affirmative and negative labels. The task executor renders templates in confirmation messages and labels, then passes the resulting text to the prompt. ChangesTask confirmation options
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant TaskExecutor
participant UsageTemplateContext
participant confirm_with_labels
TaskExecutor->>UsageTemplateContext: Build context when confirmation text contains templates
UsageTemplateContext-->>TaskExecutor: Return template values
TaskExecutor->>TaskExecutor: Render templated message and labels
TaskExecutor->>confirm_with_labels: Pass rendered text, default answer, and labels
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable issue was identified that needs to be resolved before merging. Interactive display with custom labels has not been verified in a TTY. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The approval and rejection behavior is preserved, and no new approval bypass was established. Confirmation labels now share the existing ability to evaluate executable configuration before approval. Interactive behavior and the broader configuration trust context remain incompletely verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. (3 skipped: 3 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| for (slot, text) in rendered.iter_mut().zip(texts) { | ||
| if let Some(text) = text | ||
| && contains_template_syntax(text) | ||
| { | ||
| *slot = Some(render_str(&mut tera, text, &tera_ctx)?); |
There was a problem hiding this comment.
Both added tests use fixed labels and stop after parsing. They would pass even if check_confirmation stopped rendering labels, leaving users with raw templates. Add a test with a plain message and yes/no labels using usage.*, then assert the rendered labels reach the prompt. This covers the new case where only a label needs Tera.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
<!-- entire-trail-link-start --> https://entire.io/gh/jdx/mise/trails/411 <!-- entire-trail-link-end --> ### 🚀 Features - **(bootstrap)** render templates in Compose projects by @jdx in [#13938](#13938) - **(dotfiles)** add dotfile groups by @jdx in [#13945](#13945) - **(task)** allow customizing confirm answer labels by @jdx in [#13944](#13944) ### 🐛 Bug Fixes - **(env)** resolve dotenv ${VAR} against the file's own values before ambient env by @jdx in [#13946](#13946) - **(exec)** limit @latest resolution to the tools named on the command line by @jdx in [#13943](#13943) - **(ruby)** expose depends tools to ruby-build by @seuros in [#13942](#13942) ### 📚 Documentation - show pinned packslip bootstraps for mise and Docker by @jdx in [#13935](#13935) ### Chore - update pr-closer policy by @jdx in [e19e8cb](e19e8cb) ### Security - **(env)** stop copying secret values into shell state and the env cache by @jdx in [#13950](#13950)
https://entire.io/gh/jdx/mise/trails/414
Requested by Jeff · project thread
Task
confirmprompts always showed "Yes" / "No", which doesn't fit confirmations whose outcome isn't a plain yes or no (see discussion #13940). The object form ofconfirmnow acceptsyesandnolabels:The interactive prompt shows
Deploy/Cancelinstead ofYes/No.defaultis now optional in the object form (it still defaults toyes), so{ message, yes, no }is valid on its own.usage.*values.echo y | mise run deploy) still accepty/n, and--yesstill skips the prompt. When labels are set, the stdin hint adds(y = Deploy, n = Cancel).confirmand existing{ message, default }configs behave as before.Docs and both JSON schemas are updated. Added unit tests for parsing (header and
mise.toml);cargo clippy --workspace --all-features --all-targets -- -D warningsis clean. The interactive widget rendering itself wasn't exercised in a TTY.AI-assisted — Tool: Claude Code; model: anthropic/claude-sonnet-5-5; version: unavailable.
🤖 Generated with Claude Code
https://claude.ai/code/session_013RFawR941sEpBL1ZrKgDbJ
Generated by Claude Code
Note
Low Risk
UX-focused extension to task confirmation with backward-compatible defaults; piped answers and
--yesbehavior are preserved.Overview
Task
confirmprompts can now use custom affirmative/negative labels instead of fixed Yes / No. The object form accepts optionalyesandnostrings (Tera-templated likemessage), anddefaultis optional (still defaults to yes when omitted).Runtime wiring renders message and labels through Tera when needed, then
confirm_with_labelsdrives both the interactive dialog and piped stdin (y/nunchanged; custom labels appear in the stdin hint).TaskConfirmparsing, JSON schemas, docs, and parse tests are updated accordingly.Reviewed by Cursor Bugbot for commit 1574460. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
yandn, regardless of the displayed labels.