Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 14, 2025

πŸ€– AI-Powered Solution

This pull request implements a private messaging system to address issue #37: "Send bot messages to the user".

πŸ“‹ Issue Reference

Fixes #37

✨ Solution Overview

The issue requested sending bot messages to users privately instead of posting them as public issue comments, because "bot messages take up too much space". Since GitHub doesn't have a traditional private messaging system, this implementation uses a Bot Communication Repository approach.

πŸ”§ Implementation Details

1. New Interface: IPrivateMessageTrigger<TContext>

  • Extends ITrigger<TContext> with private messaging capabilities
  • Defines methods for target user, message subject, and content generation
  • Backward compatible with existing triggers

2. Enhanced GitHubStorage

  • SendPrivateMessage(): Creates issues in a dedicated bot-communications repository
  • CreateMinimalIssueComment(): Posts brief notifications with links to private messages
  • Automatic user mentions for email notifications

3. Updated IssueTracker

  • Automatically detects IPrivateMessageTrigger implementations
  • Routes private message triggers through the new messaging system
  • Falls back to standard behavior for regular triggers

4. Converted Triggers

  • LastCommitActivityTrigger: Now sends activity reports privately
  • OrganizationLastMonthActivityTrigger: Sends activity summaries privately

πŸš€ How It Works

  1. Trigger Execution: When a IPrivateMessageTrigger condition is met
  2. Private Message Creation: Detailed message is posted to bot-communications repository
  3. User Notification: Target user is mentioned (gets email notification)
  4. Minimal Comment: Original issue gets a small comment with link to private message
  5. Issue Management: Original issue is closed/managed as needed

πŸ“Š Benefits

  • βœ… Reduced Clutter: Public issue threads stay clean and readable
  • βœ… User Notification: Users still get notified via email mentions
  • βœ… Message Preservation: All bot messages are preserved in dedicated space
  • βœ… Backward Compatibility: Existing triggers continue to work unchanged
  • βœ… Flexible Configuration: Bot communication repository name is configurable

πŸ“– Setup Requirements

  1. Create a private repository named bot-communications (or configure custom name)
  2. Ensure the bot has write access to this repository
  3. Deploy the updated bot code

πŸ“ Example Usage

// Before: Creates large public comments
internal class MyTrigger : ITrigger<Issue> 
{
    public async Task Action(Issue issue) 
    {
        await _github.CreateIssueComment(issue.Repository.Id, issue.Number, "Very long report...");
    }
}

// After: Sends private messages
internal class MyTrigger : IPrivateMessageTrigger<Issue> 
{
    public string GetTargetUserLogin(Issue issue) => issue.User.Login;
    public string GetMessageSubject(Issue issue) => "Report Title";
    public async Task<string> GetPrivateMessageContent(Issue issue) => "Very long report...";
    public async Task Action(Issue issue) => await CloseIssue(issue);
}

πŸ§ͺ Testing

  • βœ… Solution compiles successfully
  • βœ… Backward compatibility maintained
  • βœ… Example documentation provided

This PR was created automatically by the AI issue solver

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #37
@konard konard self-assigned this Sep 14, 2025
- Add IPrivateMessageTrigger interface for private messaging support
- Extend GitHubStorage with SendPrivateMessage and CreateMinimalIssueComment methods
- Update IssueTracker to handle private message triggers differently
- Convert LastCommitActivityTrigger and OrganizationLastMonthActivityTrigger to use private messaging
- Add setup documentation and examples

This addresses issue #37 by sending detailed bot messages to a private
bot-communications repository instead of cluttering public issue threads.
Users are notified via mentions and get email notifications, while the
original issue threads remain clean and readable.

πŸ€– Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] Send bot messages to the user Implement private messaging system for bot communications Sep 14, 2025
@konard konard marked this pull request as ready for review September 14, 2025 01:02
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.

Send bot messages to the user

1 participant