Skip to content

Implement create-comments command for bulk comment creation #1

@hillairet

Description

@hillairet

🔭 Task Overview

Add a new CLI command create-comments that allows bulk creation of comments on existing GitHub issues from CSV data. This feature is designed to support migrations from other systems (like JIRA) to GitHub by preserving comment history.

🎯 Objectives

  • Create a new CLI command ciftt.py create-comments following existing patterns
  • Support CSV input with issue URLs and comment text
  • Extract owner/repo from URLs in each CSV row
  • Preserve original author attribution in comment text
  • Include dry-run support for testing
  • Handle errors gracefully (invalid URLs, permissions, rate limits)
  • Follow project code standards and testing practices

🔬 Steps or Implementation Details

  1. Create CLI Command Module (cli/create_comments.py)

    • Follow existing pattern from create_issues.py
    • Accept only CSV file parameter (no repo parameter needed)
    • Support --dry-run flag
    • Include proper error handling and logging
  2. Extend GitHub Client (github/client.py)

    • Add create_issue_comment(owner, repo, issue_number, body) method
    • Use GitHub REST API: POST /repos/{owner}/{repo}/issues/{issue_number}/comments
    • Handle API errors and rate limiting
  3. CSV Data Processing

    • Required columns: URL, Comment
    • Optional columns: Author, Date for attribution
    • Parse issue URLs to extract owner/repo/issue_number from each row
    • Format comment body to include original author/date if provided
  4. Add to Main CLI (ciftt.py)

    • Register new command with Typer
    • Follow existing command integration pattern
  5. Testing

    • Add integration tests in tests/integration/
    • Create test fixtures with sample CSV data
    • Test success cases, error handling, and dry-run mode
    • Test mixed repositories in single CSV file
  6. Documentation

    • Update help text and command examples
    • Add sample CSV format to existing samples

📝 Additional context

Expected CSV format:

URL,Comment,Author,Date
https://github.com/owner1/repo1/issues/123,"This was reported in JIRA-456","john.doe","2024-01-15"
https://github.com/owner2/repo2/issues/124,"Fixed in legacy system","jane.smith","2024-01-16"

Command usage:

python ciftt.py create-comments comments.csv
python ciftt.py create-comments comments.csv --dry-run

Technical considerations:

  • Comments are created as the authenticated user, so original author info should be included in comment text
  • GitHub API rate limits apply (5000 requests/hour for authenticated users)
  • Need to validate issue URLs and extract owner/repo/issue_number from each row
  • Should handle multiple repositories in single CSV file
  • Should handle both public and private repositories based on token permissions

🕸️ Dependencies

  • Requires existing GitHub client infrastructure
  • Depends on current CSV processing patterns
  • No blocking dependencies - can be implemented independently

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions