mach10 icon indicating copy to clipboard operation
mach10 copied to clipboard

Standardize user input and approval patterns across all commands

Open LeanAndMean opened this issue 9 months ago • 4 comments

Summary

Mach10 commands use inconsistent patterns for asking users for input and approval. Some commands present structured choices (good UX), while others require users to type free-text like "this looks good" to proceed. This makes the workflow less predictable and slower for users.

Current Behavior

There are 31 user interaction points across 15 commands. They fall into several categories with inconsistent patterns:

1. Ambiguity clarification (11 commands)

Pattern: "If the input is ambiguous, ask the user to clarify."

  • Used in: issue-plan, issue-assessment, issue-review-plan, issue-implement, pr-create, pr-review, pr-review-fix, pr-review-validate, pr-ci-fix, pr-pre-merge, pr-merge, doc-review
  • Issue: No guidance on how to ask -- free-text prompt vs. populated choices.

2. Draft approval (5 commands)

Pattern: "Present the draft to the user for approval."

  • Used in: issue-create, pr-create, pr-merge, issue-plan, doc-review
  • Issue: Users must type free-text to approve. No instruction to use AskUserQuestion with structured options like "Approve" / "Modify title" / "Modify body" / "Cancel".

3. Multi-option selection (4 commands)

Pattern: "Ask the user how they want to proceed" with bullet-list options.

  • Used in: issue-review-plan (3 options), pr-review-fix (selection from findings), test-audit (3 options), doc-review (Accept/Modify/Reject per finding)
  • Issue: Options are listed in prose but there is no instruction to use AskUserQuestion with populated choices, so Claude may present them as free-text prompts.

4. Yes/no decisions (2 commands)

Pattern: "Ask the user if they want to..."

  • Used in: pr-merge (create release?), pr-review (create issues for deferred findings?)
  • Issue: Same as above -- no instruction to use structured choices.

5. Branch selection (1 command)

Pattern: "Present the list to the user and ask them to choose."

  • Used in: issue-implement (branch selection)
  • Issue: No instruction to use AskUserQuestion for the branch list.

6. Version bump (1 command)

Pattern: "Ask the user for the version bump level."

  • Used in: pr-pre-merge
  • Issue: Natural fit for AskUserQuestion with Patch/Minor/Major choices, but no explicit instruction.

7. Explicit no-approval (1 command)

Pattern: "Do not ask the user for approval first."

  • Used in: pr-review (posts assessment directly)
  • This is intentional and correct -- no change needed.

Proposed Behavior

  1. Every user interaction point should explicitly specify whether to use AskUserQuestion (structured choices) or free-text.
  2. Use AskUserQuestion with populated choices wherever the set of valid responses is known, including:
    • Draft approvals: choices like "Approve" / "Modify" / "Cancel"
    • Yes/no decisions: "Yes" / "No"
    • Multi-option selections: list the options as choices
    • Version bump: "Patch" / "Minor" / "Major"
    • Branch selection: list discovered branches as choices
  3. Reserve free-text input for truly open-ended questions (e.g., "What is the issue about?" in issue-create when no description is provided, clarifying questions during issue-plan).
  4. Standardize the approval wording so all draft-approval steps use a consistent pattern.

Acceptance Criteria

  • [ ] Every command file that asks for user input explicitly states the interaction method (AskUserQuestion with choices vs. free-text)
  • [ ] All draft approval steps (issue-create, pr-create, pr-merge, issue-plan, doc-review) use AskUserQuestion with structured choices
  • [ ] All multi-option selections (issue-review-plan, pr-review-fix, test-audit, doc-review per-finding) use AskUserQuestion
  • [ ] Yes/no decisions (pr-merge release, pr-review deferred issues) use AskUserQuestion
  • [ ] Version bump selection in pr-pre-merge uses AskUserQuestion with Patch/Minor/Major
  • [ ] Branch selection in issue-implement uses AskUserQuestion
  • [ ] Free-text is only used for open-ended questions where the answer set cannot be enumerated
  • [ ] Ambiguity clarification instructions specify using AskUserQuestion when possible choices can be inferred from context

Technical Notes

  • The AskUserQuestion tool supports 2-4 options with labels and descriptions, plus an automatic "Other" option for custom input
  • It also supports multiSelect: true for non-mutually-exclusive choices (useful for pr-review-fix issue selection)
  • Commands that delegate to feature-dev or pr-review-toolkit inherit those plugins' own interaction patterns -- this issue focuses only on the mach10 command layer

LeanAndMean avatar Feb 24 '26 16:02 LeanAndMean

Implementation Plan

This plan standardizes user input and approval patterns across all mach10 commands. It addresses all acceptance criteria from the issue.

Scope Summary

  • 14 command files modified (13 get AskUserQuestion added to allowed-tools, 1 gets instruction updates)
  • 2 command files unchanged: pr-ci-fix.md (only has parse-level ambiguity clarification), push.md (file staging lists are arbitrarily long, free-text is more appropriate)
  • 1 project file updated: CLAUDE.md gets user interaction guidance for writing commands

Design Decisions

  1. Context-dependent approval options -- approval choices are tailored per command rather than using a universal 3-option pattern. For example, plan approval uses "Approve / Request changes" while PR creation uses "Approve / Modify / Cancel".
  2. Parse-only commands skip AskUserQuestion -- commands that only clarify input parsing (where the valid response set cannot be enumerated) keep free-text clarification. Only pr-ci-fix.md falls in this category.
  3. Free-text for open-ended inputs -- push.md file staging and issue-create.md initial description remain free-text since the answer set cannot be enumerated.
  4. issue-assessment uses two interaction points -- AskUserQuestion for recommendation selection (4 options), then again for draft approval, matching the "Both" pattern.

Stage 1: Draft Approval Commands

5 files modified. Standardizes the most common pattern -- presenting a draft and getting user approval.

File Changes
commands/issue-create.md Add AskUserQuestion to allowed-tools. Update Step 3: use AskUserQuestion with "Approve" / "Modify" / "Cancel" for draft issue approval.
commands/pr-create.md Add AskUserQuestion to allowed-tools. Update Step 3: use AskUserQuestion with "Approve" / "Modify" / "Cancel" for draft PR approval.
commands/pr-merge.md Add AskUserQuestion to allowed-tools. Update Step 4: use AskUserQuestion with "Yes" / "No" for release creation. Update Step 5: use AskUserQuestion with "Approve" / "Modify" / "Skip release" for release draft approval.
commands/issue-plan.md Add AskUserQuestion to allowed-tools. Update Step 5: use AskUserQuestion with "Approve" / "Request changes" for plan approval after presenting the draft.
commands/issue-assessment.md Add AskUserQuestion to allowed-tools. Update Step 5: use AskUserQuestion to let the user select from the 4 recommendation options. Update Step 6: after drafting, use AskUserQuestion with "Approve" / "Modify" / "Cancel" for the drafted content.

Stage 2: Multi-Option and Yes/No Commands

6 files modified. Standardizes multi-option selections, yes/no decisions, and version bump selection.

File Changes
commands/issue-review-plan.md Add AskUserQuestion to allowed-tools. Update Step 5: use AskUserQuestion with "Update the plan" / "Proceed as-is" / "Discuss findings" for next-step selection.
commands/pr-review-fix.md Add AskUserQuestion to allowed-tools. Update Step 3: when no specific issue numbers were provided, use AskUserQuestion with multiSelect: true to let the user select which issues to fix from the presented list. Group issues into severity-based choices if the list exceeds 4 items.
commands/test-audit.md Add AskUserQuestion to allowed-tools. Update Step 5: use AskUserQuestion with "Fix critical issues now" / "Create a GitHub issue" / "Review specific findings" for next-step selection.
commands/pr-review.md Add AskUserQuestion to allowed-tools. Update Step 8: use AskUserQuestion with "Yes, create issues for all" / "Let me select which ones" / "No, skip deferred items" for deferred item handling.
commands/pr-pre-merge.md Add AskUserQuestion to allowed-tools. Update Step 4b: use AskUserQuestion with "Patch" / "Minor" / "Major" for version bump level selection (with descriptions explaining when each applies).
commands/pr-review-validate.md Add AskUserQuestion to allowed-tools. Update Step 5: use AskUserQuestion with "Approve and post" / "Modify before posting" / "Skip posting" for comment posting approval.

Stage 3: Complex Interaction Patterns and Documentation

3 files modified. Handles unique interaction patterns and documents the conventions.

File Changes
commands/issue-implement.md Already has AskUserQuestion in allowed-tools. Update Step 2 instruction text for 3 interaction points: (a) multiple branches found -- already uses AskUserQuestion, add explicit instruction text; (b) no branch found -- use AskUserQuestion with "Create a new branch" / "Specify an existing branch"; (c) unrelated branch warning -- use AskUserQuestion with "Continue on this branch" / "Switch to a different branch".
commands/doc-review.md Add AskUserQuestion to allowed-tools. Update Step 5: for each finding, use AskUserQuestion with "Accept" / "Modify" / "Reject". Instruct to process findings one at a time or in small batches.
CLAUDE.md Add a "User Interaction Patterns" section under "Writing Commands" documenting: (a) when to use AskUserQuestion vs free-text, (b) standard approval patterns, (c) the requirement that every user interaction point explicitly specifies its method.

Files Unchanged (with reasoning)

File Reason
commands/pr-ci-fix.md Only has parse-level ambiguity clarification. The valid response set cannot be enumerated from ambiguous input.
commands/push.md File staging lists can be arbitrarily long and don't fit the 2-4 option constraint of AskUserQuestion. Free-text guidance is more appropriate.

This plan will guide staged implementation via /mach10:issue-implement.

LeanAndMean avatar Feb 24 '26 17:02 LeanAndMean

Stage 1 Progress: Draft Approval Commands

Commit: 0376af2 Branch: feature/issue-16-standardize-user-input-patterns

Changes

Added AskUserQuestion to allowed-tools and replaced free-text approval instructions with structured choices in 5 command files:

File Interaction points updated
issue-create.md Step 3: Approve / Modify / Cancel for draft issue
pr-create.md Step 3: Approve / Modify / Cancel for draft PR
pr-merge.md Step 4: Create release / Skip. Step 5: Approve / Modify / Skip release
issue-plan.md Step 5: Approve / Request changes / Cancel for plan
issue-assessment.md Step 5: 4-option recommendation selection. Step 6: Approve / Modify / Cancel for draft

Decisions

  • Used context-specific descriptions per command rather than generic wording (e.g., "Edit the PR title or body" vs "Edit the issue title, body, labels, or assignees").
  • Used action labels ("Create release" / "Skip") instead of "Yes" / "No" for consistency with other approval steps.
  • Added a Cancel option to issue-plan.md Step 5 (not in the original plan) for consistency -- every approval step now has an escape path.
  • issue-assessment.md Step 5 stays at 4 options (the AskUserQuestion maximum); the built-in "Other" option serves as the escape hatch.

Remaining

Stages 2 and 3 cover multi-option/yes-no commands and complex interaction patterns + documentation.

LeanAndMean avatar Feb 24 '26 17:02 LeanAndMean

Stage 2 Progress: Multi-Option and Yes/No Commands

Commit: 4aa8405 Branch: feature/issue-16-standardize-user-input-patterns

Changes

Added AskUserQuestion to allowed-tools and replaced free-text prompts with structured choices in 6 command files:

File Interaction points updated
issue-review-plan.md Step 5: Update the plan / Proceed as-is / Discuss findings / Cancel
pr-review-fix.md Step 3: multiSelect for issue selection (individual options for <=4 findings, severity-grouped for >4)
test-audit.md Step 5: Fix critical issues now / Create a GitHub issue / Review specific findings
pr-review.md Step 8: Create issues for all / Select which ones / Skip deferred items (with nested multiSelect for selection)
pr-pre-merge.md Step 4b: Patch / Minor / Major for version bump level
pr-review-validate.md Step 5: Approve and post / Modify before posting / Skip posting

Decisions

  • Added a Cancel option to issue-review-plan.md Step 5 (not in the original plan) for consistency with Stage 1's escape-path pattern.
  • Added follow-up instructions for all non-terminal options (e.g., "If the user selects X, do Y") matching Stage 1 conventions.
  • Used nested AskUserQuestion in pr-review.md Step 8: first call selects the strategy, second call uses multiSelect for individual finding selection.
  • Kept pr-review-fix.md multiSelect options in prose form since option labels are dynamically generated based on actual review findings.

Remaining

Stage 3 covers complex interaction patterns (issue-implement branch selection, doc-review per-finding approval) and CLAUDE.md documentation.

LeanAndMean avatar Feb 24 '26 17:02 LeanAndMean

Stage 3 Progress: Complex Interaction Patterns and Documentation

Commit: 71e75ed Branch: feature/issue-16-standardize-user-input-patterns

Changes

Updated 3 files to complete the final stage of AskUserQuestion standardization:

File Interaction points updated
issue-implement.md Step 2: (a) multiple branches -- AskUserQuestion with branch names as options; (b) no branch found -- "Create a new branch" / "Use an existing branch"; (c) unrelated branch -- "Continue on this branch" / "Switch branch" with full checkout/pull follow-up
doc-review.md Added AskUserQuestion to allowed-tools. Step 5: per-finding approval with Accept / Modify / Reject, processed one at a time
CLAUDE.md Added "User Interaction Patterns" subsection under "Writing Commands" documenting when to use AskUserQuestion vs free-text, conventions for option descriptions/escape paths/follow-ups/multiSelect, and a concrete example

Decisions

  • Used static descriptions for all AskUserQuestion options (no runtime placeholders like <branch> or #N), consistent with Stages 1-2.
  • Added full checkout/pull/divergence handling to the "Switch branch" follow-up path (caught during code review -- the original draft was missing this).
  • Softened the escape-path rule in CLAUDE.md documentation to acknowledge forced-choice questions (e.g., version bump level) where all options are valid continuations.
  • Clarified that free-text for branch names is a follow-up scenario after structured selection, not a primary interaction pattern.

Status

All 3 stages are now complete. Ready for PR creation.

LeanAndMean avatar Feb 24 '26 18:02 LeanAndMean