Skip to content

feat: add generate subcommand to CLI#6

Merged
gagip merged 6 commits intomainfrom
feature/cli-generate
Feb 26, 2026
Merged

feat: add generate subcommand to CLI#6
gagip merged 6 commits intomainfrom
feature/cli-generate

Conversation

@gagip
Copy link
Copy Markdown
Owner

@gagip gagip commented Feb 26, 2026

Summary

  • Add generate subcommand: Generates monthly Git logs from a specified repository.
  • Update MCP server architecture documentation: Added constraints and usage rules.
  • Standardize documentation: Unified installation and execution commands to use uv in README.md and docs/usage.md.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added generate CLI subcommand to extract and organize monthly git logs from repositories with configurable year and month parameters.
  • Documentation

    • Consolidated and reorganized README sections for clarity.
    • Updated all CLI command examples to use UV-based workflows (uv run).
    • Enhanced usage guidance with examples for all subcommands.
    • Updated architecture documentation.

- Add generate_command.py with -r, -y, -m options (-m optional, default: 1)
- Register generate subcommand in cli.py and cli/__init__.py
- Add error handling for invalid repo path, year, and month
- Add TestGenerateCommand with 7 tests using a real git repository
- Update README.md and docs/usage.md to reflect the new subcommand
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 26, 2026

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between e1f3d8e and 972a99f.

📒 Files selected for processing (7)
  • README.md
  • cli.py
  • docs/architecture.md
  • docs/usage.md
  • git_log_analysis/cli/__init__.py
  • git_log_analysis/cli/generate_command.py
  • tests/test_cli_commands.py

📝 Walkthrough

Walkthrough

This PR introduces a new "generate" CLI subcommand for extracting monthly git logs, refactors documentation to use UV-based command syntax throughout the project, integrates the new subcommand into the CLI framework, and adds comprehensive test coverage for the new functionality.

Changes

Cohort / File(s) Summary
CLI Subcommand Implementation
git_log_analysis/cli/generate_command.py, git_log_analysis/cli/__init__.py, cli.py
Adds new generate subcommand module with argument parsing for -r/--repo-path, -y/--year, and -m/--month; registers subcommand in main CLI entry point; exports setup_generate_parser in CLI package API.
Documentation Updates
README.md, docs/usage.md, docs/architecture.md
Consolidates installation sections; replaces Python invocations with uv run equivalents across all CLI examples; adds MCP server integration guidance; introduces MCP stdio mode constraints and coding guidelines.
Test Suite Expansion
tests/test_cli_commands.py
Adds TestGenerateCommand with real Git repository fixture; covers missing arguments, invalid inputs, output directory creation, file generation, and content verification; adjusts assertion formatting in existing test suites.

Sequence Diagram

sequenceDiagram
    actor User
    participant CLI as CLI Parser
    participant Handler as Generate Handler
    participant FileSystem as File System
    
    User->>CLI: uv run ... generate -r <repo_path> -y 2024 -m 1
    CLI->>Handler: _generate_command(args)
    Handler->>Handler: Validate arguments
    Handler->>Handler: Resolve repository path
    Handler->>Handler: Call generate_git_logs(repo_path, year, month)
    Handler->>FileSystem: Create git_logs_by_month/ directory
    Handler->>FileSystem: Write git_log_2024_01.txt
    FileSystem-->>Handler: File creation complete
    Handler-->>User: Print status + output path
    Handler-->>CLI: Return exit code (0=success, 1=error)
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A new command springs forth with lunar grace,
Monthly logs extracted to their place,
UV paths light the way so bright,
Tests verify each step is right,
The warren's toolkit grows complete tonight! 🌙


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new generate subcommand to the CLI for extracting monthly Git logs from repositories, updates documentation about MCP server constraints, and standardizes all installation/execution commands to use uv instead of python or pip.

Changes:

  • Added generate subcommand to extract monthly Git logs with year/month arguments
  • Documented MCP server stdout constraints and usage rules in architecture.md
  • Standardized all README.md and docs/usage.md commands to use uv run prefix

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
git_log_analysis/cli/generate_command.py New CLI command implementation for generating monthly Git logs with argument parsing and error handling
git_log_analysis/cli/init.py Exports the new setup_generate_parser function and organizes imports alphabetically
cli.py Registers the generate subcommand and updates help text to include it
tests/test_cli_commands.py Comprehensive test suite for the generate command covering edge cases and success scenarios
docs/architecture.md Documents MCP server constraints requiring no stdout usage in tool handlers
docs/usage.md Updates all command examples to use uv run and documents the generate command
README.md Simplifies installation instructions to only use uv sync and updates all command examples to use uv run

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gagip and others added 3 commits February 26, 2026 18:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gagip gagip merged commit 906b09c into main Feb 26, 2026
3 checks passed
@gagip gagip deleted the feature/cli-generate branch February 26, 2026 09:38
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.

2 participants