Skip to content

Comments

feat: Implement Typer-based CLI skeleton with placeholder commands#52

Open
petems wants to merge 3 commits intomasterfrom
feature/add-improved-cli-options
Open

feat: Implement Typer-based CLI skeleton with placeholder commands#52
petems wants to merge 3 commits intomasterfrom
feature/add-improved-cli-options

Conversation

@petems
Copy link
Owner

@petems petems commented Oct 29, 2025

Summary

This PR implements Phase 1 of the CLI/UX redesign as specified in specs/CLI_CLI_UX_REDESIGN.md. It introduces a modern Typer-based CLI interface with Rich terminal formatting while maintaining full backward compatibility with the existing argparse CLI.

Changes

New CLI Package Structure

  • Created modular src/mcp_github_pr_review/cli/ package
  • Renamed cli.pyserver_runner.py (preserves legacy functionality)
  • Command groups: config, agents, server, doctor, quickstart

Dependencies

  • Added [cli] optional dependency group:
    • typer>=0.12.0 - Modern CLI framework
    • rich>=13.7.0 - Beautiful terminal formatting
  • Install with: uv sync --extra cli

Console Script Entrypoints

  • mcp-github-pr → New Typer-based CLI (recommended)
  • mcp-github-pr-review → Legacy argparse CLI (backward compatible)

Implemented Commands (Placeholders)

All commands display helpful "Not yet implemented" messages with usage hints:

config - Configuration management

  • init - Initialize configuration files
  • set - Set configuration value
  • unset - Unset configuration value
  • show - Display current configuration
  • validate - Validate GitHub token
  • migrate - Migrate from legacy .env setup
  • edit - Open config in $EDITOR
  • reset - Reset to defaults

agents - Agent integration

  • list - Show supported agents
  • snippet - Generate agent config snippet
  • verify - Test agent connectivity

server - Server lifecycle

  • run - Spawn MCP server
  • debug - Run with verbose logging
  • logs - Tail server logs

doctor - Health checks

  • Comprehensive health checks with --ci and --json flags

quickstart - Interactive setup

  • First-time setup wizard

Features

✅ Version command using importlib.metadata
✅ Rich terminal formatting with colors and tables
✅ Graceful error handling for missing CLI dependencies
✅ Comprehensive --help text on all commands
✅ Shell completion support via Typer
✅ Clean command structure following CLI best practices

Testing

  • 51 new tests for Typer CLI in tests/test_cli_new.py
  • 27 updated tests for legacy CLI (updated imports)
  • All 379 tests passing

Quality Checks

ruff format - Code formatted
ruff check - All linting issues resolved
mypy - Type checking passed
make compile-check - Syntax validation passed
pytest - All tests passing

Backward Compatibility

🔒 The existing mcp-github-pr-review command continues to work unchanged, ensuring no breaking changes for current users.

Try It Out

# Install CLI dependencies
uv sync --extra cli

# Explore the new CLI
uv run mcp-github-pr --help
uv run mcp-github-pr --version
uv run mcp-github-pr config --help
uv run mcp-github-pr doctor --help

# Legacy CLI still works
uv run mcp-github-pr-review --help

Next Steps

This PR lays the foundation for implementing the actual functionality in subsequent PRs:

  • Phase 1.2: Settings layer (Pydantic models)
  • Phase 1.3: Core command implementations
  • Phase 1.4: Testing and documentation

Related

  • Spec: specs/CLI_CLI_UX_REDESIGN.md
  • Issue: #XX (if applicable)

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Summary by CodeRabbit

  • New Features

    • New Python-based CLI with command groups for config, agents, server, diagnostics, and quickstart; new executable entry added for users.
    • Optional CLI dependencies declared to enable rich, user-friendly output and interactive UX.
  • Documentation

    • Added a comprehensive CLI UX redesign spec and migration guidance.
  • Tests

    • New and updated CLI tests covering help, version, and placeholder command behavior.

petems and others added 2 commits October 29, 2025 01:36
…ty improvements

Comprehensive review and improvement of the CLI/UX redesign specification to align with MCP best practices, modern Python architecture, and enhanced user experience.

Major improvements:
- CRITICAL: Changed agent integration to snippet generation (no auto-writing to agent configs)
- CRITICAL: Server execution always via subprocess (never in-process, MCP stdio protocol)
- CRITICAL: Clear config precedence (CLI flags > env vars > TOML > .env)
- CRITICAL: Secrets only in .env with secure permissions, never in TOML

Architecture enhancements:
- Separated settings models (GitHubSettings, ServerSettings, LoggingSettings, AppConfig)
- Added config/repository.py for atomic config operations with backups
- Added config/security.py for secure file permissions (0o600 Unix, ACL Windows)
- Added config/github_validator.py for reusable auth validation
- Optional [cli] dependencies for server-only users

New commands:
- quickstart: Interactive first-time setup wizard
- config show/migrate/edit/reset: Enhanced config management
- config rollback: Restore from automatic backups
- agents snippet/verify: Generate snippets + test connectivity (no auto-write)
- server debug/logs: Enhanced server management
- doctor: Comprehensive health checks with detailed implementation spec
- version --check: Version info and update checking

Documentation plan:
- New: docs/cli.md (complete CLI reference with examples)
- New: docs/migration.md (comprehensive migration guide)
- New: docs/ci-migration.md (CI/CD pipeline updates)
- New: docs/quickstart.md (new user onboarding)
- Updates: README.md, AGENTS.md, CLAUDE.md, UV_COMMANDS.md, SECURITY.md

Testing strategy:
- Comprehensive unit tests for all commands
- Integration tests with mocked GitHub API (pytest-httpx)
- Cross-platform tests (Windows/macOS/Linux)
- Security tests (permissions, token masking, .gitignore)
- Migration tests (various legacy scenarios)
- Snapshot tests (help text stability)
- Documentation tests (validate code examples)

Security enhancements:
- Token masking in all output (ghp_abc...xyz)
- Secure .env file permissions (auto-set)
- .gitignore validation for .env files
- Optional audit logging for config changes
- No secrets in TOML files ever

Migration strategy:
- Three-phase approach (introduce → promote → remove)
- Automatic backups before migrations
- Dry-run mode for safe testing
- Rollback capability
- Mixed state detection in doctor command

Doctor command implementation:
- 10 comprehensive health checks with detailed specs
- Multiple output formats (human-readable, JSON, CI mode)
- Clear exit codes and actionable error messages
- Fail-fast on critical errors
- Rate limit and scope checking

Risk mitigation:
- Expanded risks & mitigations table with 11 scenarios
- Impact/likelihood assessment for each risk
- Concrete mitigation strategies
- Breaking changes mitigation for existing users

Acceptance criteria:
- Expanded from 5 to 50+ specific, measurable criteria
- Organized by category (config, agents, server, health, security, etc.)
- Performance targets included
- Test coverage requirements (>=90%)

This specification is now aligned with MCP best practices and ready for implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add a modern CLI interface using Typer and Rich, maintaining backward
compatibility with the existing argparse CLI.

## Changes

- **New CLI Package Structure:**
  - Created `src/mcp_github_pr_review/cli/` package
  - Renamed `cli.py` → `server_runner.py` (preserves legacy argparse CLI)
  - Added modular command groups: config, agents, server, doctor, quickstart

- **Dependencies:**
  - Added `[cli]` optional dependency group with typer>=0.12.0 and rich>=13.7.0
  - Install with: `uv sync --extra cli`

- **Console Script Entrypoints:**
  - `mcp-github-pr` → New Typer-based CLI (recommended)
  - `mcp-github-pr-review` → Legacy argparse CLI (backward compatible)

- **Implemented Commands (placeholders):**
  - `config`: init, set, unset, show, validate, migrate, edit, reset
  - `agents`: list, snippet, verify
  - `server`: run, debug, logs
  - `doctor`: comprehensive health checks with --ci and --json flags
  - `quickstart`: interactive setup wizard

- **Features:**
  - Version command using importlib.metadata
  - Rich terminal formatting with colors and tables
  - Graceful error handling for missing CLI dependencies
  - Comprehensive help text with --help on all commands
  - Shell completion support via Typer

- **Testing:**
  - Added 51 new tests for Typer CLI in test_cli_new.py
  - Updated 27 existing tests to reference server_runner module
  - All 379 tests passing

- **Quality:**
  - Passes ruff format, ruff check, mypy, compile-check
  - Fixed linting issues (shadowed builtins, unused imports)

## Backward Compatibility

The existing `mcp-github-pr-review` command continues to work unchanged,
ensuring no breaking changes for current users.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 29, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR adds a Typer-based CLI (new mcp-github-pr script), moves the main runtime entry back to server_runner, updates pyproject.toml scripts and mypy overrides, introduces CLI spec docs, adds five CLI command modules (config, agents, server, doctor, quickstart) with placeholders, and adds/refactors tests for the new CLI.

Changes

Cohort / File(s) Summary
Project configuration
pyproject.toml
Updated mcp-github-pr-review script to mcp_github_pr_review.server_runner:main; added mcp-github-pr = "mcp_github_pr_review.cli:cli_main"; added optional cli dependencies (typer, rich); removed old dependency-groups and added mypy overrides.
Specification
specs/CLI_CLI_UX_REDESIGN.md
New design/spec document describing CLI UX migration, architecture, commands, config persistence, security, testing, migration phases, and documentation updates.
Runtime entry
src/mcp_github_pr_review/__main__.py
Replaced import of main from .cli to .server_runner; invocation unchanged under __main__.
CLI root
src/mcp_github_pr_review/cli/__init__.py
New Typer app app with version callback, cli_main() entry, dependency guard for typer/rich, and registration of subcommand groups.
CLI command groups
src/mcp_github_pr_review/cli/config.py, .../agents.py, .../server.py, .../doctor.py, .../quickstart.py
Five new Typer modules exposing app, console, and placeholder commands/subcommands that print “Not yet implemented” guidance.
Entrypoint tests refactor
tests/test_cli.py
Updated imports and patch targets to reference server_runner instead of cli; test logic preserved.
New CLI tests
tests/test_cli_new.py
New Typer CLI test suite using CliRunner to assert help/version output and placeholder behaviors for all command groups.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant Shell
  participant pyproject as pyproject script
  participant CLI as mcp-github-pr (Typer app)
  participant SR as server_runner

  Note over Shell,pyproject: When running installed scripts
  User->>Shell: run `mcp-github-pr ...`
  Shell->>pyproject: launch entrypoint -> `mcp_github_pr_review.cli:cli_main`
  pyproject->>CLI: invoke `cli_main()`
  CLI->>CLI: parse args, dispatch subcommand
  alt subcommand is server-run
    CLI->>SR: call into server_runner (if invoked)
  else placeholder command
    CLI->>CLI: print "Not yet implemented"
  end
Loading
sequenceDiagram
  autonumber
  participant User
  participant Shell
  participant pyproject as pyproject script
  participant MP as mcp-github-pr-review script
  participant SR as server_runner

  Note over Shell,MP: server runtime entry
  User->>Shell: run `mcp-github-pr-review ...`
  Shell->>pyproject: launch entrypoint -> `mcp_github_pr_review.server_runner:main`
  pyproject->>SR: invoke `main()`
  SR->>SR: start server/run logic
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Check spec doc for clarity and actionable migration steps.
  • Verify Typer app wiring: version callback, dependency guard, and correct registration of subcommand modules.
  • Review consistency across five new CLI modules for help text, option definitions, and placeholder messaging.
  • Confirm pyproject.toml scripts and mypy overrides are syntactically correct and align with packaging expectations.
  • Validate test updates: patched targets in tests/test_cli.py and coverage/assertions in tests/test_cli_new.py.

Possibly related issues

Possibly related PRs

Poem

🐇 A rabbit hops with keys so light,

Typer sprouts new commands tonight.
Config, agents, server—doors ajar,
Doctor checks and quickstart star.
Scaffolding set — now let’s code far! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "feat: Implement Typer-based CLI skeleton with placeholder commands" directly corresponds to the main changes in this PR. The changeset introduces a new Typer-based CLI package with multiple command groups (config, agents, server, doctor, quickstart) that currently contain placeholder implementations, which is exactly what the title conveys. The title is concise, specific, and uses clear language without vague terms or noise. A teammate scanning commit history would immediately understand that this PR adds a new CLI framework with placeholder commands, accurately capturing the primary objective of implementing Phase 1 of the CLI/UX redesign.
Docstring Coverage ✅ Passed Docstring coverage is 86.27% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-improved-cli-options

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @petems, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request marks the initial phase of a significant CLI/UX redesign, transitioning the project towards a modern, Typer-based command-line interface. The primary goal is to enhance user experience for configuration, validation, and execution tasks, replacing the current bash-script-heavy approach with a more structured and testable Python-native solution. While introducing a new mcp-github-pr command, it carefully maintains full backward compatibility with the existing mcp-github-pr-review command, ensuring a smooth migration path for all users.

Highlights

  • New Typer-based CLI Skeleton: Introduced a new mcp-github-pr command-line interface built with Typer and Rich, laying the foundation for a modern and user-friendly experience. This new CLI includes placeholder commands for configuration management, agent integration, server control, health checks, and a quickstart wizard.
  • Backward Compatibility Maintained: The existing mcp-github-pr-review argparse-based CLI has been preserved and renamed internally to server_runner.py, ensuring full backward compatibility for current users and existing workflows.
  • Optional CLI Dependencies: Added typer and rich as optional dependencies under a new [cli] extra group, allowing users to install CLI features only if needed, thus keeping the core server lightweight.
  • Comprehensive CLI Redesign Specification: A detailed specification document (specs/CLI_CLI_UX_REDESIGN.md) has been added, outlining the goals, user experience requirements, architectural approach, migration plan, testing strategy, and documentation updates for the complete CLI/UX redesign.
  • Updated Test Suite: Fifty-one new tests have been added specifically for the new Typer CLI, alongside updates to twenty-seven existing tests for the legacy CLI, ensuring robustness and proper functionality for both interfaces.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a well-structured skeleton for a new Typer-based CLI, which is a great step towards improving the user experience as outlined in the new specification document. The separation of the new CLI from the legacy one ensures backward compatibility, and the use of optional dependencies for the CLI is a good practice.

My review includes a few suggestions to improve maintainability by removing duplicated code in the pyproject.toml file and across the new CLI modules. I've also pointed out a minor formatting issue in the new specification document that affects its readability.

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: 1

♻️ Duplicate comments (5)
src/mcp_github_pr_review/cli/server.py (1)

7-44: Resolve mypy type check failures (same pattern as agents.py).

This file has the same mypy failures as agents.py: missing type stubs for typer (line 8) and untyped decorators on lines 25, 33, and 40. Apply the same fixes described in the agents.py review.

src/mcp_github_pr_review/cli/doctor.py (1)

7-54: Resolve mypy type check failures (same pattern as other CLI modules).

This file has the same mypy failures: missing type stubs for typer (line 8) and an untyped decorator on line 25. Apply the same fixes described in the agents.py review.

src/mcp_github_pr_review/cli/__init__.py (1)

8-69: Resolve mypy type check failures (same pattern as other CLI modules).

This file has the same mypy failures: missing type stubs for typer (line 9) and an untyped decorator on line 50. Apply the same fixes described in the agents.py review.

src/mcp_github_pr_review/cli/quickstart.py (1)

7-40: Resolve mypy type check failures (same pattern as other CLI modules).

This file has the same mypy failures: missing type stubs for typer (line 8) and an untyped decorator on line 25. Apply the same fixes described in the agents.py review.

src/mcp_github_pr_review/cli/config.py (1)

7-82: Resolve mypy type check failures (same pattern as other CLI modules).

This file has the same mypy failures: missing type stubs for typer (line 8) and untyped decorators on lines 25, 32, 39, 46, 53, 62, 71, and 78. Apply the same fixes described in the agents.py review to all eight command decorators.

🧹 Nitpick comments (3)
specs/CLI_CLI_UX_REDESIGN.md (1)

65-65: Polish docs: capitalization, fenced languages, and markdownlint fixes.

  • Capitalize “GitHub” consistently (Lines 5, 27, 70, 117, 243).
  • Avoid bare URLs (Lines 65, 586, 641). Use link text.
  • Add a language to the fenced block (Line 646).
  • Ensure tables are surrounded by blank lines (Lines 189–196).
  • Use hyphenated “rate-limiting” when adjectival (Line 243).

Examples:

- 1. Generate a new token: https://github.com/settings/tokens/new?scopes=repo
+ 1. Generate a new token: [Create a new token](https://github.com/settings/tokens/new?scopes=repo)
-#### Default (Human-Readable)
-```
+#### Default (Human-Readable)
+```text
 Running MCP GitHub PR Review health checks...
 ...

```diff
- |------|-----------|
+ 
+|------|-----------|

Also applies to: 586-586, 641-641, 646-646, 189-196, 5-5, 27-27, 70-70, 117-117, 243-243

pyproject.toml (1)

42-45: Keep “cli” dependencies in sync across extras and dependency-groups.

You define “cli” in both [project.optional-dependencies] and [dependency-groups]. This is fine, but it can drift. Consider adding a small CI check to verify parity, or centralize maintenance policy.

Also applies to: 181-201

tests/test_cli_new.py (1)

61-96: Placeholders tightly coupled in tests; plan for future behavior changes.

As commands get implemented, assertions like “Not yet implemented” will break. Consider marking these tests with a custom marker (e.g., @pytest.mark.placeholder) or matching on broader invariants (exit codes/help sections) to ease the transition.

Also applies to: 107-124, 135-152, 163-182, 193-197

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fee4c40 and c455758.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • pyproject.toml (3 hunks)
  • specs/CLI_CLI_UX_REDESIGN.md (1 hunks)
  • src/mcp_github_pr_review/__main__.py (1 hunks)
  • src/mcp_github_pr_review/cli/__init__.py (1 hunks)
  • src/mcp_github_pr_review/cli/agents.py (1 hunks)
  • src/mcp_github_pr_review/cli/config.py (1 hunks)
  • src/mcp_github_pr_review/cli/doctor.py (1 hunks)
  • src/mcp_github_pr_review/cli/quickstart.py (1 hunks)
  • src/mcp_github_pr_review/cli/server.py (1 hunks)
  • tests/test_cli.py (9 hunks)
  • tests/test_cli_new.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use async/await patterns for all I/O operations (GitHub API calls, file operations)
Use type hints for all function parameters and return values
Handle errors gracefully with proper logging (log to stderr)
Pass ruff linting with zero violations
Format code with ruff format
Code must pass static type checks with mypy
Implement retry logic for transient failures (e.g., GitHub API)
Validate all input parameters (URLs, filenames, numeric limits)
Use safe file operations (exclusive create, path validation)
Enforce pagination safety caps and rate limiting when calling GitHub APIs
Ensure code is compatible with Python 3.10+
Run make compile-check to catch import/syntax errors early; code must be syntactically valid
Return meaningful error messages to MCP clients

Files:

  • src/mcp_github_pr_review/cli/quickstart.py
  • src/mcp_github_pr_review/cli/agents.py
  • src/mcp_github_pr_review/cli/doctor.py
  • src/mcp_github_pr_review/cli/__init__.py
  • src/mcp_github_pr_review/__main__.py
  • tests/test_cli.py
  • src/mcp_github_pr_review/cli/server.py
  • tests/test_cli_new.py
  • src/mcp_github_pr_review/cli/config.py
tests/test_*.py

📄 CodeRabbit inference engine (AGENTS.md)

Place test files under tests/ with filename pattern tests/test_*.py

Files:

  • tests/test_cli.py
  • tests/test_cli_new.py
tests/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.py: Name test functions with the test_ prefix
Use pytest-asyncio for async test functions
Mock external dependencies (GitHub API, filesystem) in tests

Files:

  • tests/test_cli.py
  • tests/test_cli_new.py
🧬 Code graph analysis (3)
src/mcp_github_pr_review/cli/__init__.py (2)
src/mcp_github_pr_review/cli/doctor.py (1)
  • doctor (26-54)
src/mcp_github_pr_review/cli/quickstart.py (1)
  • quickstart (26-40)
src/mcp_github_pr_review/__main__.py (2)
src/mcp_github_pr_review/cli/__init__.py (1)
  • main (51-69)
src/mcp_github_pr_review/server_runner.py (1)
  • main (80-104)
tests/test_cli.py (1)
src/mcp_github_pr_review/server_runner.py (3)
  • _positive_int (37-44)
  • main (80-104)
  • parse_args (47-77)
🪛 GitHub Actions: Lint
src/mcp_github_pr_review/cli/quickstart.py

[error] 8-8: Cannot find implementation or library stub for module named "typer" [import-not-found]


[error] 25-25: Untyped decorator makes function "quickstart" untyped [misc]

src/mcp_github_pr_review/cli/agents.py

[error] 8-8: Cannot find implementation or library stub for module named "typer" [import-not-found]


[error] 25-25: Untyped decorator makes function "list_agents" untyped [misc]


[error] 32-32: Untyped decorator makes function "snippet" untyped [misc]


[error] 40-40: Untyped decorator makes function "verify" untyped [misc]

src/mcp_github_pr_review/cli/doctor.py

[error] 8-8: Cannot find implementation or library stub for module named "typer" [import-not-found]


[error] 25-25: Untyped decorator makes function "doctor" untyped [misc]

src/mcp_github_pr_review/cli/__init__.py

[error] 9-9: Cannot find implementation or library stub for module named "typer" [import-not-found]


[error] 50-50: Untyped decorator makes function "main" untyped [misc]

src/mcp_github_pr_review/cli/server.py

[error] 8-8: Cannot find implementation or library stub for module named "typer" [import-not-found]


[error] 25-25: Untyped decorator makes function "run" untyped [misc]


[error] 33-33: Untyped decorator makes function "debug" untyped [misc]


[error] 40-40: Untyped decorator makes function "logs" untyped [misc]

src/mcp_github_pr_review/cli/config.py

[error] 8-8: Cannot find implementation or library stub for module named "typer" [import-not-found]


[error] 25-25: Untyped decorator makes function "init" untyped [misc]


[error] 32-32: Untyped decorator makes function "set_value" untyped [misc]


[error] 39-39: Untyped decorator makes function "unset" untyped [misc]


[error] 46-46: Untyped decorator makes function "show" untyped [misc]


[error] 53-53: Untyped decorator makes function "validate" untyped [misc]


[error] 62-62: Untyped decorator makes function "migrate" untyped [misc]


[error] 71-71: Untyped decorator makes function "edit" untyped [misc]


[error] 78-78: Untyped decorator makes function "reset" untyped [misc]

🪛 LanguageTool
specs/CLI_CLI_UX_REDESIGN.md

[style] ~4-~4: To elevate your writing, try using a synonym here.
Context: ...ript spans hundreds of lines, making it hard to maintain, test, and extend. - Shell ...

(HARD_TO)


[uncategorized] ~5-~5: The official name of this software platform is spelled with a capital “H”.
Context: ...on (for example, GitHub token checks in src/mcp_github_pr_review/server.py) and forces contri...

(GITHUB)


[uncategorized] ~27-~27: The official name of this software platform is spelled with a capital “H”.
Context: ...ports scripting, uses dotted paths like github.token). - config validate: verify ...

(GITHUB)


[uncategorized] ~65-~65: The official name of this software platform is spelled with a capital “H”.
Context: ...\n 2. Update: mcp-github-pr config set github.token ghp_xxx\n 3. Verify: mcp-github-...

(GITHUB)


[uncategorized] ~70-~70: The official name of this software platform is spelled with a capital “H”.
Context: ...server. - Settings layer: Introduce src/mcp_github_pr_review/config/ package using `pydan...

(GITHUB)


[uncategorized] ~117-~117: The official name of this software platform is spelled with a capital “H”.
Context: ...HTTP client setup from server.py into config/github_validator.py for reuse. Provide async ...

(GITHUB)


[uncategorized] ~243-~243: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...ction) - Network timeout handling - Rate limiting responses - Retry logic on transient ...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[uncategorized] ~599-~599: The official name of this software platform is spelled with a capital “H”.
Context: ..._TOKEN or run: mcp-github-pr config set github.token ghp_xxx" 5. **GitHub API Connect...

(GITHUB)


[uncategorized] ~641-~641: The official name of this software platform is spelled with a capital “H”.
Context: ... - Mask secrets - Example: "Config: github.api_url=https://api.github.com (TOML), ...

(GITHUB)


[uncategorized] ~641-~641: The official name of this software platform is spelled with a capital “H”.
Context: ....api_url=https://api.github.com (TOML), github.token=ghp_abc...xyz (ENV)" ### Output ...

(GITHUB)


[uncategorized] ~739-~739: The official name of this software platform is spelled with a capital “H”.
Context: ...onfig setsupports dotted paths (e.g.,github.token) and validates values - ✅ mcp-g...

(GITHUB)

🪛 markdownlint-cli2 (0.18.1)
specs/CLI_CLI_UX_REDESIGN.md

65-65: Bare URL used

(MD034, no-bare-urls)


189-189: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


586-586: Bare URL used

(MD034, no-bare-urls)


641-641: Bare URL used

(MD034, no-bare-urls)


646-646: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (3)
src/mcp_github_pr_review/__main__.py (1)

1-4: Entrypoint shim looks good.

Clean handoff to server_runner.main with proper exit code propagation.

tests/test_cli.py (1)

106-121: Solid coverage of legacy argparse entrypoint.

Good assertions on dotenv behavior, env overrides scoping, and exit code 130 on SIGINT.

Also applies to: 232-245, 246-265

pyproject.toml (1)

21-24: ****

The function cli_main is already defined at line 72 of src/mcp_github_pr_review/cli/__init__.py. The script entry point mcp-github-pr = "mcp_github_pr_review.cli:cli_main" correctly resolves to this existing callable. There is no packaging or runtime risk.

Likely an incorrect or invalid review comment.

Resolve code review comments from gemini-code-assist and coderabbitai:

1. Remove duplicate [dependency-groups] section
   - Removed redundant dependency-groups section that duplicated
     [project.optional-dependencies]
   - Standard pyproject.toml structure now followed

2. Fix markdown rendering issues
   - Removed stray escaped backticks in specs/CLI_CLI_UX_REDESIGN.md
   - Code blocks now render correctly

3. Remove redundant ImportError handling
   - Removed try/except ImportError blocks from CLI submodules
   - Main CLI __init__.py already handles missing dependencies
   - Cleaner, DRY code

4. Add mypy overrides for optional CLI dependencies
   - Added mypy.overrides for typer.* and rich.* modules
   - Resolves "cannot find implementation or library stub" errors
   - Allows mypy to pass when CLI dependencies are optional

All quality checks passing:
- ruff format ✅
- ruff check ✅
- mypy ✅
- pytest (379 tests) ✅

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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

🧹 Nitpick comments (6)
specs/CLI_CLI_UX_REDESIGN.md (6)

65-65: Wrap bare URLs in Markdown link syntax.

Line 65 contains a bare URL that should be wrapped in [link text](URL) format for consistency and proper rendering.

-  - Example: "✗ GitHub token invalid (401 Unauthorized)\n\nYour token at GITHUB_TOKEN may have expired or lack required scopes.\n\nNext steps:\n  1. Generate a new token: https://github.com/settings/tokens/new?scopes=repo\n  2. Update: mcp-github-pr config set github.token ghp_xxx\n  3. Verify: mcp-github-pr config validate"
+  - Example: "✗ GitHub token invalid (401 Unauthorized)\n\nYour token at GITHUB_TOKEN may have expired or lack required scopes.\n\nNext steps:\n  1. Generate a new token: [create new token](https://github.com/settings/tokens/new?scopes=repo)\n  2. Update: mcp-github-pr config set github.token ghp_xxx\n  3. Verify: mcp-github-pr config validate"

189-189: Add blank lines around table for Markdown compliance.

Per markdownlint rule MD058, tables should be surrounded by blank lines. Add blank lines before line 189 and after the table ends (around line 196).


381-382: Wrap bare URL and specify code fence language.

Line 381 contains a bare URL that should be wrapped in Markdown link syntax. Additionally, line 382's code fence is missing a language identifier for proper syntax highlighting.

-**See also:** https://github.com/.../docs/cli.md#validate
-```
+**See also:** [CLI Reference](https://github.com/.../docs/cli.md#validate)
+```bash

424-440: Add blank line before table and ensure all code fence language specifiers are present.

Line 424 (table start) and lines 440+ need formatting adjustments:

  1. Add blank line before the table at line 424
  2. Verify lines 440+ have language specifiers on code fences (line 440 appears to be missing yaml identifier)

478-486: Add blank lines around table and specify code fence language.

Lines 478–486 show a table that is missing blank lines above (before line 478) and after (after line 485). Additionally, line 486's code fence is missing a language identifier.

+
| Task | Command |
|------|---------|
| Configure server | `mcp-github-pr config init` |
...
| Get agent snippets | `mcp-github-pr agents snippet claude-cli` |
-```
+
+```bash

550-560: Specify language identifiers for all code fences.

Multiple code fences are missing language identifiers for syntax highlighting:

  • Line 550: Code fence for audit log format (likely text or log)
  • Line 560: Code fence for best practices (likely python or toml context)
  • Line 662: Code fence for default output (likely text or console)

Specify appropriate language identifiers (e.g., ```log, ```text) to enable syntax highlighting and comply with Markdown standards.

Also applies to: 662-662

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c455758 and 5e45e63.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • pyproject.toml (3 hunks)
  • specs/CLI_CLI_UX_REDESIGN.md (1 hunks)
  • src/mcp_github_pr_review/cli/agents.py (1 hunks)
  • src/mcp_github_pr_review/cli/config.py (1 hunks)
  • src/mcp_github_pr_review/cli/doctor.py (1 hunks)
  • src/mcp_github_pr_review/cli/quickstart.py (1 hunks)
  • src/mcp_github_pr_review/cli/server.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use async/await patterns for all I/O operations (GitHub API calls, file operations)
Use type hints for all function parameters and return values
Handle errors gracefully with proper logging (log to stderr)
Pass ruff linting with zero violations
Format code with ruff format
Code must pass static type checks with mypy
Implement retry logic for transient failures (e.g., GitHub API)
Validate all input parameters (URLs, filenames, numeric limits)
Use safe file operations (exclusive create, path validation)
Enforce pagination safety caps and rate limiting when calling GitHub APIs
Ensure code is compatible with Python 3.10+
Run make compile-check to catch import/syntax errors early; code must be syntactically valid
Return meaningful error messages to MCP clients

Files:

  • src/mcp_github_pr_review/cli/quickstart.py
  • src/mcp_github_pr_review/cli/agents.py
  • src/mcp_github_pr_review/cli/config.py
  • src/mcp_github_pr_review/cli/doctor.py
  • src/mcp_github_pr_review/cli/server.py
🪛 LanguageTool
specs/CLI_CLI_UX_REDESIGN.md

[style] ~4-~4: To elevate your writing, try using a synonym here.
Context: ...ript spans hundreds of lines, making it hard to maintain, test, and extend. - Shell ...

(HARD_TO)


[uncategorized] ~5-~5: The official name of this software platform is spelled with a capital “H”.
Context: ...on (for example, GitHub token checks in src/mcp_github_pr_review/server.py) and forces contri...

(GITHUB)


[uncategorized] ~27-~27: The official name of this software platform is spelled with a capital “H”.
Context: ...ports scripting, uses dotted paths like github.token). - config validate: verify ...

(GITHUB)


[uncategorized] ~65-~65: The official name of this software platform is spelled with a capital “H”.
Context: ...\n 2. Update: mcp-github-pr config set github.token ghp_xxx\n 3. Verify: mcp-github-...

(GITHUB)


[uncategorized] ~70-~70: The official name of this software platform is spelled with a capital “H”.
Context: ...server. - Settings layer: Introduce src/mcp_github_pr_review/config/ package using `pydan...

(GITHUB)


[uncategorized] ~117-~117: The official name of this software platform is spelled with a capital “H”.
Context: ...HTTP client setup from server.py into config/github_validator.py for reuse. Provide async ...

(GITHUB)


[uncategorized] ~243-~243: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...ction) - Network timeout handling - Rate limiting responses - Retry logic on transient ...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[uncategorized] ~481-~481: The official name of this software platform is spelled with a capital “H”.
Context: ...-pr config init| | Set GitHub token |mcp-github-pr config set github.token ghp_xxx| | Validate setup |mc...

(GITHUB)


[uncategorized] ~739-~739: The official name of this software platform is spelled with a capital “H”.
Context: ...onfig setsupports dotted paths (e.g.,github.token) and validates values - ✅ mcp-g...

(GITHUB)

🪛 markdownlint-cli2 (0.18.1)
specs/CLI_CLI_UX_REDESIGN.md

65-65: Bare URL used

(MD034, no-bare-urls)


189-189: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


381-381: Bare URL used

(MD034, no-bare-urls)


382-382: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


440-440: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


478-478: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


485-485: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


486-486: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


550-550: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


560-560: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


662-662: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (8)
specs/CLI_CLI_UX_REDESIGN.md (3)

130-156: Verify Phase 1 scope alignment with implementation.

The specification outlines Phase 1 as including three subphases:

  1. CLI skeleton (Typer app with placeholders and --version)
  2. Settings layer (Pydantic models + SettingsRepository)
  3. Core commands implementation
  4. Testing foundation
  5. Documentation

However, the PR objectives mention "Phase 1.2 settings layer (Pydantic)" as a next step, suggesting the current PR (Phase 1) may focus only on the skeleton (items 1, 4, 5). Please clarify:

  • Is Phase 1 (current PR) the skeleton-only version with placeholder commands and deferred settings layer?
  • Or does Phase 1 include settings layer implementation?

This distinction affects test coverage expectations and documentation priorities. If only the skeleton is included, ensure the acceptance criteria (lines 725–837) are adjusted accordingly, as many criteria assume a working settings/config layer.


725-837: Acceptance criteria scope verification needed.

The acceptance criteria (lines 725–837) are comprehensive and well-defined, but many assume a fully functional settings/config layer and command implementations. Examples:

  • "✅ mcp-github-pr config init creates both config.toml and .env with proper structure and permissions"
  • "✅ mcp-github-pr config set supports dotted paths (e.g., github.token)"
  • "✅ mcp-github-pr agents snippet <name> generates syntactically valid configuration snippets"

If the current PR (Phase 1) is skeleton-only with placeholder commands (as suggested in PR objectives: "Phase 1.2 settings layer" and "Phase 1.3 core command implementations"), these criteria should be marked as deferred to Phase 1.2/1.3 rather than current acceptance targets.

Suggested clarification:
Add a subsection distinguishing between:

  • Phase 1 acceptance criteria (skeleton: help text, version, placeholder commands, structure)
  • Phase 1.2+ acceptance criteria (settings layer, config commands, agent integration)

1-100: Specification is comprehensive and well-aligned with PR objectives.

The CLI/UX redesign specification is thorough, covering architecture, migration strategy, testing, documentation, and risk mitigations. The command structure, settings layer design, and phased rollout approach are clearly articulated and appear consistent with the PR's implementation of Phase 1 skeleton components.

Primary action items for maintainers:

  1. Clarify Phase 1 scope (skeleton-only vs. including settings layer) — affects acceptance criteria interpretation
  2. Fix markdown formatting — bare URLs, code fence language specifiers, table spacing (flagged in separate comments above)
  3. Track deferred criteria — Phase 1.2 (settings layer) and 1.3 (core commands) criteria should be documented separately to avoid confusion
src/mcp_github_pr_review/cli/agents.py (1)

1-36: LGTM - Clean placeholder implementation for Phase 1.

The placeholder commands follow a consistent pattern with proper type hints. The "Not yet implemented" messages provide clear guidance for future usage. When implementing the actual logic in Phase 1.3, ensure these commands follow the coding guidelines: use async/await for GitHub API calls, implement proper error handling and logging, validate input parameters, and implement retry logic for transient failures.

Note: The past review comments about duplicate try...except blocks and mypy configuration appear to have been addressed or are outside the scope of these module files.

src/mcp_github_pr_review/cli/server.py (1)

1-35: LGTM - Consistent placeholder pattern.

The server management commands follow the same clean pattern as other CLI modules. When implementing these commands in later phases, remember that the logs command (line 32-35) will need async file I/O operations and safe file path validation per the coding guidelines.

src/mcp_github_pr_review/cli/quickstart.py (1)

16-31: LGTM - Proper callback pattern for interactive wizard.

The callback decorator with invoke_without_command=True and the ctx.invoked_subcommand check is the correct pattern for a standalone command. The outlined 5-step wizard flow is clear and aligns with the PR objectives. Future implementation will need async/await for GitHub API connectivity checks (step 3) and file operations (steps 1, 4) per coding guidelines.

src/mcp_github_pr_review/cli/config.py (1)

1-73: LGTM - Comprehensive config command set with proper naming.

The config module provides a complete set of 8 commands covering initialization, CRUD operations, validation, and migration. Good use of name="set" for the set_value function (line 23) to avoid conflicts with the Python built-in. When implementing these commands, note that most will require async file I/O operations, input validation, and safe file path handling per the coding guidelines.

src/mcp_github_pr_review/cli/doctor.py (1)

16-45: LGTM - Well-designed health check command with output modes.

The doctor command properly implements the callback pattern with two useful flags (--ci and --json). The comprehensive docstring (lines 22-34) clearly documents the 8 planned health checks. When implementing the actual checks, ensure GitHub API calls use async/await with retry logic, subprocess checks handle errors gracefully, and JSON output mode provides structured, machine-readable results per the coding guidelines.

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