Improve help text, refactor command registration, and fix test assertions#6
Merged
ryan-williams merged 5 commits intomainfrom Nov 9, 2025
Merged
Improve help text, refactor command registration, and fix test assertions#6ryan-williams merged 5 commits intomainfrom
ryan-williams merged 5 commits intomainfrom
Conversation
- Add validation error when using -d without -y (draft incompatible with web editor) - Update command help text to clarify web editor vs API modes - Update -d flag help to note it requires -y - Update -y flag help to explain the three modes clearly - Add automatic gist push after PR/Issue finalization
Convert all register() functions from nested function calls to clean vertical decorator stacks for better readability. Affected commands: create, shell-integration, pull, clone, diff, push, ingest-attachments, upload, open, show
After creating a PR/Issue and updating the local file with link-reference format, push the changes back to GitHub so the PR body includes: - Link-reference definition ([owner/repo#N]: url) - Gist footer (if gist remote exists) This ensures GitHub, local, and gist are all in sync after creation.
The test was doing naive substring matching which incorrectly found 'comment' in command descriptions like 'Clone a PR or Issue description and comments...' Now uses regex to extract exact command names from the Commands: section, preventing false positives from substring matches in help text. Also added docstring to clone_cmd wrapper for better documentation.
- Replace substring matching (assert x in y) with exact equality checks - Replace partial list checks with full list/tuple comparisons - Update test expectations to match exact command arguments - Fix test mocking to include new push() call in _finalize_created_item - Use precise regex matching for shell integration output This makes tests more robust and prevents false positives from substring matches in help text or command descriptions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR includes three improvements to the
ghprcodebase:1. Better Help Text and Validation
-dwithout-y, since draft mode is incompatible with web editorcreatecommand and flag descriptions to clearly explain the three modes:-y): Interactive web editor (waits for user)-yonce: Create via API then view result-yytwice: Create silentlycreatenow automatically pushes to gist remote after finalizing PR/Issue2. Decorator Syntax Refactoring
Converted all 10 command
register()functions from deeply nested function calls to clean vertical decorator stacks:This makes the code much more readable and maintainable. Net result: -32 lines of code!
3. Comprehensive Test Assertion Improvements
Fixed all test assertions across the test suite to use precise equality checks instead of fragile substring matching:
test_import.py- Used regex to extract exact command names from CLI help, fixed shell integration checkstest_create.py- Changed to exact tuple comparisons for gh command arguments, added missing mocks forpush()calltest_files.py- Replaced all substring checks with full content equality, fixed newline handlingtest_gist.py- Replaced substring checks with exact equality, fixed gist footer formatting expectationsImpact: Fixed 51+ problematic assertions that used
assert x in ypatterns. All 92 tests now pass with precise, maintainable assertions that clearly document expected values