Skip to content

feat(cases): add multiline text buffer with editor/undo and bidirectional step navigation - #21

Merged
grobf5 merged 1 commit into
mainfrom
feat/case-wizard-robust-text-entry
Oct 6, 2026
Merged

grobf5 merged 1 commit into
mainfrom
feat/case-wizard-robust-text-entry

Conversation

@grobf5

@grobf5 grobf5 commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Enhances the interactive Support Case Wizard (myf5 cases create) and case commenting (myf5 cases comment) with a robust multiline text buffer, in-buffer commands (undo, preview, external editor, clear, back), and seamless bidirectional step navigation across all wizard steps.

Key Changes

  1. Multiline Text Buffer (promptMultilineBuffer):

    • Accidental-Enter Protection: Pressing Enter on an empty line in multiline mode prompts with inline guidance rather than accepting premature or default input. Input is completed with a single period (.) on a line or :done.
    • Line-Numbered Prompting: Displays [1] > , [2] > , etc. for clear orientation.
    • Interactive Commands:
      • :u / :undo: Pops and removes the last entered line from the buffer.
      • :p / :show / :list: Displays the current buffer contents formatted with line numbers.
      • :e / :edit: Spawns the user's preferred external editor ($EDITOR, nano, vim, or notepad) with current buffer contents, seamlessly re-reading edits on exit.
      • :c / :clear: Clears the multiline buffer.
      • :b / :back / :cancel: Exits buffer and returns to the previous field or wizard step.
      • :h / :help / ?: Displays buffer command help.
  2. Bidirectional Step & Field Navigation:

    • Refactored RunCaseWizard into a state machine loop tracking step and startField.
    • Returning from Step 4 (Contact Details) lands directly on Step 3 field 4 (Description), rather than resetting the step.
    • Returning from Step 3 (Case Details) lands on Step 2 field 4 (Entitlement).
    • Typing b in Step 5 (Review & Submission) returns to Step 4 to allow editing contact details.
  3. Interactive Multiline Commenting:

    • When myf5 cases comment <case-number> is invoked without a note argument in an interactive terminal, launches the multiline buffer for composing notes.
    • Displays a formatted preview of the note and requires explicit confirmation (Submit this comment to case <case-number>? [y/N]) before making any API request.
  4. TTY Auto-Detection for Case Creation:

    • Running myf5 cases create without flags in a terminal detects interactive TTY and prompts No case parameters specified. Launch interactive Support Case Wizard? [Y/n]: . Non-interactive calls cleanly print usage.
  5. Testing & Security:

    • Added comprehensive tests for multiline buffer commands (:u, :p, :c, :b, :done), bidirectional step transitions, non-TTY execution, and comment usage.
    • Zero secrets logged or accepted in command-line arguments.
    • Dry-run and offline safety verified: zero live case creation or comment submission in tests.
    • Passes all linters, go test -v -race ./..., and OAS validator.

…onal step navigation

- Implement promptMultilineBuffer with accidental-Enter protection, line numbering, and commands:
  - :u / :undo - pops the last line entered
  - :p / :show / :list - displays the current buffer with line numbers
  - :e / :edit - opens an external editor ($EDITOR/nano/vim/notepad)
  - :c / :clear - clears the entire buffer
  - :b / :back / :cancel - retreats to the previous wizard field or step
  - . or :done - finishes multiline input
- Refactor RunCaseWizard into a state machine loop tracking step and startField
- Support seamless bidirectional navigation across wizard steps (Step 1-5):
  - Backtracking from Step 4 lands on Step 3 field 4 (Description)
  - Backtracking from Step 3 lands on Step 2 field 4 (Entitlement)
  - Backtracking from Step 5 Review returns to Step 4 Contact details
- Add interactive multiline note composition for 'cases comment <case-number>' when note is omitted, with buffer preview and safety confirmation before API submission
- Detect interactive TTY in 'cases create' when run with no flags to prompt launching the wizard
- Add unit tests for buffer commands, clear/cancel, step back-navigation, comment usage, and non-TTY execution
@grobf5
grobf5 merged commit 7d40620 into main Oct 6, 2026
24 checks passed
@grobf5
grobf5 deleted the feat/case-wizard-robust-text-entry branch October 6, 2026 15:15
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.

1 participant