Skip to content

Enhance documentation and CLI help text formatting#55

Merged
tonyblank merged 1 commit intomainfrom
help-update
Jun 13, 2025
Merged

Enhance documentation and CLI help text formatting#55
tonyblank merged 1 commit intomainfrom
help-update

Conversation

@tonyblank
Copy link
Owner

@tonyblank tonyblank commented Jun 13, 2025

  • Added best practices for Click CLI help text formatting in CLAUDE.md, including key principles, formatting templates, and common issues.
  • Updated README.md to include smart PR detection and troubleshooting sections for authentication issues and common errors.
  • Improved command documentation in cli.py, fetch.py, reply.py, and resolve.py with consistent formatting and examples.
  • Adjusted test assertions in various CLI tests to reflect updated documentation and ensure accuracy in help text outputs.

These changes aim to improve user guidance and enhance the overall clarity of the CLI documentation.

Summary by CodeRabbit

  • Documentation

    • Improved CLI help text formatting and structure for multiple commands, enhancing readability and consistency.
    • Updated and expanded documentation in the README, including new sections on smart PR detection and troubleshooting common issues.
    • Added best practices for CLI help text formatting to the development guide.
    • Corrected and clarified example commands and usage instructions throughout help texts.
  • Tests

    • Updated test assertions to match revised CLI help text formatting and capitalization.
    • Enhanced test handling for edge cases, such as empty CLI output during interactive workflows.

- Added best practices for Click CLI help text formatting in CLAUDE.md, including key principles, formatting templates, and common issues.
- Updated README.md to include smart PR detection and troubleshooting sections for authentication issues and common errors.
- Improved command documentation in cli.py, fetch.py, reply.py, and resolve.py with consistent formatting and examples.
- Adjusted test assertions in various CLI tests to reflect updated documentation and ensure accuracy in help text outputs.

These changes aim to improve user guidance and enhance the overall clarity of the CLI documentation.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Walkthrough

This unholy mess is a documentation overhaul. Help text and docstrings for CLI commands (fetch, reply, resolve) got a formatting facelift: better structure, explicit line breaks, and less confusing examples. The README and CLAUDE.md now have new best-practices and troubleshooting sections. Tests were tweaked to match the new, less-shitty output.

Changes

Files/Paths Change Summary
CLAUDE.md, README.md Added best-practices for CLI help text and troubleshooting sections; improved user guidance.
src/toady/cli.py, src/toady/commands/fetch.py, src/toady/commands/reply.py, src/toady/commands/resolve.py Reformatted docstrings and help text for clarity, structure, and consistency. No logic changes.
tests/integration/cli/test_fetch_cli.py, tests/integration/cli/test_reply_cli.py, tests/integration/cli/test_resolve_cli.py, tests/unit/commands/test_reply.py, tests/unit/test_cli.py Updated test assertions to match new help text formatting and corrected example commands.
tests/integration/real_api/test_end_to_end_workflows.py Made test robust to empty JSON output from canceled PR selection.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant HelpText

    User->>CLI: Run command with --help
    CLI->>HelpText: Fetch formatted docstring
    HelpText-->>CLI: Return structured, pretty help text
    CLI-->>User: Display improved help output
Loading

Possibly related PRs

Poem

Oh, you beautiful bastard, help text reborn,
No more walls of shit, no more users forlorn.
Bullets, examples, and structure galore—
Now reading the docs won’t be such a chore.
So here’s to the devs who gave a damn,
And made the CLI less of a scam.
🐸

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch help-update
  • Post Copyable Unit Tests in Comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
src/toady/commands/resolve.py (1)

128-132: ⚠️ Potential issue

F-string mixed with plain literal => SyntaxError at import-time

f"\n{action_symbol} {action_present} {len(target_threads)} " "thread(s)..."

An f-string cannot be implicitly concatenated with a normal string literal.
Python raises a SyntaxError: cannot mix f-string and non f-string literals.
This will break every runtime path that imports resolve.py.

Proposed fix – keep a single f-string:

-f"\n{action_symbol} {action_present} {len(target_threads)} " "thread(s)..."
+f"\n{action_symbol} {action_present} {len(target_threads)} thread(s)..."

Apply the same pattern anywhere else this “f-string + literal” form appears.

🧹 Nitpick comments (6)
CLAUDE.md (1)

195-255: Fuckin’ awesome doc section but watch list punctuation.
You’ve nailed the “Click CLI Help Text Formatting Best Practices” section, but your numbered list hyphens should be en dashes (–) per LanguageTool.

🧰 Tools
🪛 LanguageTool

[typographical] ~237-~237: If specifying a range, consider using an en dash instead of a hyphen.
Context: ...ode examples** with proper indentation (4-6 spaces) - Use quotes consistently: ...

(HYPHEN_TO_EN)

src/toady/commands/fetch.py (1)

55-67: This docstring is goddamn solid but duplicate “Default:” bullets.
You’ve got two bullets starting with Default: (auto-detect vs only unresolved). Rename the second to avoid confusing shit (e.g., “Unresolved only by default”).

src/toady/cli.py (1)

29-49: Non-ASCII bullets may garble on minimal terminals

The docstring now uses the • U+2022 bullet. On headless CI boxes or Windows cmd, these occasionally render as ? or break alignment. Consider plain - or * for maximum portability.
Purely cosmetic but easy to future-proof.

tests/integration/cli/test_reply_cli.py (1)

561-574: Hard-coded command in assertions

The updated guidance toady fetch --format pretty is duplicated in multiple assertions. If the flag set changes again, every test will need editing. Consider extracting expected snippets to a constant helper so future changes touch one place.

tests/unit/test_cli.py (1)

376-380: Guard against more section additions

expected_sections is manually enumerated. When new sections are added the test will fail even though the CLI is fine. Optional: loop through only required sections or assert subset to reduce churn.

README.md (1)

259-291: Nitpick: include “the” for smoother phrasing
Consider adding the definite article before flags and options in this block:

  • “use the --debug flag”
  • “Use the --limit option to reduce API calls”
🧰 Tools
🪛 LanguageTool

[uncategorized] ~276-~276: You might be missing the article “the” here.
Context: ...ug Mode - Set TOADY_DEBUG=1 or use --debug flag for detailed error info - ...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~287-~287: You might be missing the article “the” here.
Context: ...comment IDs ### Rate Limiting - Use --limit option to reduce API calls - ...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~288-~288: Possible missing preposition found.
Context: ...limit` option** to reduce API calls - Add delays between operations in scripts ...

(AI_HYDRA_LEO_MISSING_TO)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f7e7f96 and 89dd3d6.

📒 Files selected for processing (12)
  • CLAUDE.md (1 hunks)
  • README.md (2 hunks)
  • src/toady/cli.py (1 hunks)
  • src/toady/commands/fetch.py (1 hunks)
  • src/toady/commands/reply.py (5 hunks)
  • src/toady/commands/resolve.py (3 hunks)
  • tests/integration/cli/test_fetch_cli.py (1 hunks)
  • tests/integration/cli/test_reply_cli.py (3 hunks)
  • tests/integration/cli/test_resolve_cli.py (1 hunks)
  • tests/integration/real_api/test_end_to_end_workflows.py (1 hunks)
  • tests/unit/commands/test_reply.py (1 hunks)
  • tests/unit/test_cli.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/unit/test_cli.py (1)
src/toady/cli.py (1)
  • cli (23-91)
🪛 LanguageTool
CLAUDE.md

[typographical] ~237-~237: If specifying a range, consider using an en dash instead of a hyphen.
Context: ...ode examples** with proper indentation (4-6 spaces) - Use quotes consistently: ...

(HYPHEN_TO_EN)

README.md

[uncategorized] ~276-~276: You might be missing the article “the” here.
Context: ...ug Mode - Set TOADY_DEBUG=1 or use --debug flag for detailed error info - ...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~287-~287: You might be missing the article “the” here.
Context: ...comment IDs ### Rate Limiting - Use --limit option to reduce API calls - ...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~288-~288: Possible missing preposition found.
Context: ...limit` option** to reduce API calls - Add delays between operations in scripts ...

(AI_HYDRA_LEO_MISSING_TO)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: test (windows-latest, 3.12)
  • GitHub Check: test (windows-latest, 3.11)
  • GitHub Check: test (windows-latest, 3.9)
  • GitHub Check: test (windows-latest, 3.10)
  • GitHub Check: integration-test
🔇 Additional comments (11)
src/toady/commands/fetch.py (1)

84-103: Examples block looks tight. Approving.
The Examples section follows the \b formatting guidelines perfectly.

tests/integration/cli/test_resolve_cli.py (1)

369-372: Corrected help header check.
Updated test to assert capitalized “Examples:” matches the new help formatting.

tests/integration/cli/test_fetch_cli.py (1)

132-136: Capitalized header assertion is on point.
Switching from “EXAMPLES:” to “Examples:” aligns with doc updates.

tests/unit/commands/test_reply.py (1)

501-508: Updated help content expectations.
The test now checks for the corrected fetch syntax toady fetch --format pretty and the decorated “📚 EXAMPLES:” header, matching the updated reply docstring.

tests/integration/cli/test_reply_cli.py (1)

280-281: Ensure help header casing really is Examples:

The assertion now looks for the capitalised header. Double-check that the underlying Click help actually emits Examples: (not EXAMPLES: or examples:) on all locales; otherwise this test will be noisy.

tests/unit/test_cli.py (1)

63-66: Section headers now case-sensitive

The unit test assumptions (Prerequisites:, etc.) match the new docstring. Good catch – confirms docs/tests stay in sync.

tests/integration/real_api/test_end_to_end_workflows.py (1)

334-343: Graceful empty-output handling looks solid

The try/except JSON parse plus strip() check avoids spurious failures when the interactive fetch returns nothing. Nice resilience tweak.

src/toady/commands/reply.py (3)

56-57: Verify updated fetch example in ID help
The example now uses toady fetch --format pretty—please confirm that this flag is supported by your Click option definitions and that existing tests have been updated accordingly.


85-85: Ensure consistent troubleshooting example syntax
The second help step also uses toady fetch --format pretty. Double-check that both instances align with your CLI’s legacy and new formatting options, and update tests if needed.


511-579: Docstring formatting improvements approved
The explicit \b markers, clear section ordering, and uniform indentation follow the best-practice guidelines in CLAUDE.md. Examples and error codes are well-structured and consistent.

README.md (1)

90-102: Smart PR Detection section looks good
The new section clearly outlines auto-detection behavior and override usage with well-formatted code blocks.

@tonyblank tonyblank merged commit 785e57e into main Jun 13, 2025
20 checks passed
@tonyblank tonyblank deleted the help-update branch June 13, 2025 17:45
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