Skip to content

feat(hooks): support interactive hook scripts#1925

Open
PhilipNelson5 wants to merge 2 commits intocommitizen-tools:masterfrom
PhilipNelson5:feat/interactive-hooks
Open

feat(hooks): support interactive hook scripts#1925
PhilipNelson5 wants to merge 2 commits intocommitizen-tools:masterfrom
PhilipNelson5:feat/interactive-hooks

Conversation

@PhilipNelson5
Copy link
Copy Markdown
Contributor

@PhilipNelson5 PhilipNelson5 commented Apr 6, 2026

Description

When a pre/post bump hook needs user input it fails because stdin, stdout, and stderr are redirected. This feature adds a new cmd utility to run a command without capturing/redirecting input or output to the subprocess. This allows interactive hooks to request input and display output to the user interactively.

Checklist

Was generative AI tooling used to co-author this PR?

  • Yes (please specify the tool below)

Code Changes

  • Add test cases to all the changes you introduce
  • Run uv run poe all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
    • Test edge cases and error conditions
    • Ensure backward compatibility is maintained
    • Document any manual testing steps performed
  • Update the documentation for the changes

Documentation Changes

  • Run uv run poe doc locally to ensure the documentation pages renders correctly
  • Check and fix any broken links (internal or external)

Expected Behavior

When a pre/post bump hook tries to get use input, it successfully does so.

Steps to Test This Pull Request

  1. configure a pre/post bump hook which prompts the user for input.
  2. run cz bump.
  3. the hook successfully requests user input and is able to capture it without issue.

Additional Context

@PhilipNelson5 PhilipNelson5 changed the title feat(hooks): support interactive hooks scripts feat(hooks): support interactive hook scripts Apr 6, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.99%. Comparing base (7c21c21) to head (da45b62).
⚠️ Report is 17 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1925   +/-   ##
=======================================
  Coverage   97.99%   97.99%           
=======================================
  Files          60       60           
  Lines        2689     2691    +2     
=======================================
+ Hits         2635     2637    +2     
  Misses         54       54           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@PhilipNelson5 PhilipNelson5 force-pushed the feat/interactive-hooks branch 2 times, most recently from 335f5c7 to 98d622f Compare April 6, 2026 21:42
@PhilipNelson5 PhilipNelson5 force-pushed the feat/interactive-hooks branch from 98d622f to 8746afc Compare April 6, 2026 21:51
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Then how should we test the cmd.run? Is the test for that removed?

Copy link
Copy Markdown
Contributor Author

@PhilipNelson5 PhilipNelson5 Apr 12, 2026

Choose a reason for hiding this comment

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

I'm not aware of the project history. I don't know if it was ever tested.

@bearomorphism
Copy link
Copy Markdown
Collaborator

Please fix the coverage pipeline, thanks

@PhilipNelson5
Copy link
Copy Markdown
Contributor Author

@bearomorphism I added tests for cmd.run and cmd.run_interactive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants