From 327fe0d025de8c53d7579b656d971281c0a6762a Mon Sep 17 00:00:00 2001 From: konard Date: Fri, 12 Sep 2025 23:08:27 +0300 Subject: [PATCH 1/3] Initial commit with task details for issue #142 Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: https://github.com/linksplatform/Bot/issues/142 --- CLAUDE.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..7c8a2a74 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,5 @@ +Issue to solve: https://github.com/linksplatform/Bot/issues/142 +Your prepared branch: issue-142-9dc004a1 +Your prepared working directory: /tmp/gh-issue-solver-1757707702118 + +Proceed. \ No newline at end of file From 2fb1d5fc176b77f6537dfa3c7889ac7dd1e783f7 Mon Sep 17 00:00:00 2001 From: konard Date: Fri, 12 Sep 2025 23:16:16 +0300 Subject: [PATCH 2/3] Implement rubber duck debugging bot for issue #142 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added RubberDuckTrigger and RubberDuckDialogTrigger to provide interactive debugging assistance via GitHub issues. Features: - Responds to trigger words: "help", "help me", "sos", "помощь", "помогите", "помогите мне", "спасите" - Asks if user has a problem with code in both English and Russian - Provides structured debugging guidance when user responds "yes" or "да" - Follows rubber duck debugging methodology with step-by-step problem solving 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- csharp/Platform.Bot/Program.cs | 2 +- .../Triggers/RubberDuckDialogTrigger.cs | 106 ++++++++++++++++++ .../Triggers/RubberDuckTrigger.cs | 102 +++++++++++++++++ 3 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 csharp/Platform.Bot/Triggers/RubberDuckDialogTrigger.cs create mode 100644 csharp/Platform.Bot/Triggers/RubberDuckTrigger.cs diff --git a/csharp/Platform.Bot/Program.cs b/csharp/Platform.Bot/Program.cs index 521a6b95..db469bb9 100644 --- a/csharp/Platform.Bot/Program.cs +++ b/csharp/Platform.Bot/Program.cs @@ -95,7 +95,7 @@ private static async Task Main(string[] args) var dbContext = new FileStorage(databaseFilePath?.FullName ?? new TemporaryFile().Filename); Console.WriteLine($"Bot has been started. {Environment.NewLine}Press CTRL+C to close"); var githubStorage = new GitHubStorage(githubUserName, githubApiToken, githubApplicationName); - var issueTracker = new IssueTracker(githubStorage, new HelloWorldTrigger(githubStorage, dbContext, fileSetName), new OrganizationLastMonthActivityTrigger(githubStorage), new LastCommitActivityTrigger(githubStorage), new AdminAuthorIssueTriggerDecorator(new ProtectDefaultBranchTrigger(githubStorage), githubStorage), new AdminAuthorIssueTriggerDecorator(new ChangeOrganizationRepositoriesDefaultBranchTrigger(githubStorage, dbContext), githubStorage), new AdminAuthorIssueTriggerDecorator(new ChangeOrganizationPullRequestsBaseBranchTrigger(githubStorage, dbContext), githubStorage)); + var issueTracker = new IssueTracker(githubStorage, new HelloWorldTrigger(githubStorage, dbContext, fileSetName), new OrganizationLastMonthActivityTrigger(githubStorage), new LastCommitActivityTrigger(githubStorage), new RubberDuckTrigger(githubStorage), new RubberDuckDialogTrigger(githubStorage), new AdminAuthorIssueTriggerDecorator(new ProtectDefaultBranchTrigger(githubStorage), githubStorage), new AdminAuthorIssueTriggerDecorator(new ChangeOrganizationRepositoriesDefaultBranchTrigger(githubStorage, dbContext), githubStorage), new AdminAuthorIssueTriggerDecorator(new ChangeOrganizationPullRequestsBaseBranchTrigger(githubStorage, dbContext), githubStorage)); var pullRequenstTracker = new PullRequestTracker(githubStorage, new MergeDependabotBumpsTrigger(githubStorage)); var timestampTracker = new DateTimeTracker(githubStorage, new CreateAndSaveOrganizationRepositoriesMigrationTrigger(githubStorage, dbContext, Path.Combine(Directory.GetCurrentDirectory(), "/github-migrations"))); var cancellation = new CancellationTokenSource(); diff --git a/csharp/Platform.Bot/Triggers/RubberDuckDialogTrigger.cs b/csharp/Platform.Bot/Triggers/RubberDuckDialogTrigger.cs new file mode 100644 index 00000000..6037a209 --- /dev/null +++ b/csharp/Platform.Bot/Triggers/RubberDuckDialogTrigger.cs @@ -0,0 +1,106 @@ +using System; +using System.Threading.Tasks; +using Interfaces; +using Octokit; +using Storage.Remote.GitHub; + +namespace Platform.Bot.Triggers +{ + using TContext = Issue; + /// + /// + /// Represents the rubber duck debugging dialog continuation trigger. + /// + /// + /// + /// + internal class RubberDuckDialogTrigger : ITrigger + { + private readonly GitHubStorage _storage; + + /// + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// A git hub api. + /// + /// + public RubberDuckDialogTrigger(GitHubStorage storage) + { + this._storage = storage; + } + + /// + /// + /// Actions the context. + /// + /// + /// + /// + /// The context. + /// + /// + public async Task Action(TContext context) + { + var debuggingGuide = $@"🦆 **Great! Let's debug together!** + +I'm your rubber duck debugging assistant. Please follow these steps: + +## Step 1: Describe Your Problem +Please tell me: +- **What are you trying to do?** +- **What is happening instead?** +- **What error messages (if any) are you seeing?** + +## Step 2: Show Me The Code +- Share the relevant code snippet +- Include any error messages or unexpected output + +## Step 3: Recent Changes +- **What was the last thing you changed before this problem appeared?** +- Have you tried undoing recent changes? + +## Step 4: Let's Think Through This Together +I'll help you by asking questions like: +- What assumptions are you making about the code? +- Can you trace through the code line by line? +- Have you checked the most obvious things first? + +## Step 5: Problem-Solving Techniques +We can try: +- Adding debug logging/print statements +- Testing with simpler inputs +- Checking documentation +- Looking for similar examples + +**🎯 Often, just explaining your problem step-by-step to me will help you spot the issue!** + +Go ahead and describe your problem in detail. I'm listening! 👂"; + + await _storage.CreateIssueComment(context.Repository.Id, context.Number, debuggingGuide); + } + + /// + /// + /// Determines whether this instance condition. + /// + /// + /// + /// + /// The context. + /// + /// + /// + /// The bool + /// + /// + public async Task Condition(TContext context) + { + var title = context.Title.ToLower().Trim(); + return title == "yes" || title == "да"; + } + } +} \ No newline at end of file diff --git a/csharp/Platform.Bot/Triggers/RubberDuckTrigger.cs b/csharp/Platform.Bot/Triggers/RubberDuckTrigger.cs new file mode 100644 index 00000000..c951ec8e --- /dev/null +++ b/csharp/Platform.Bot/Triggers/RubberDuckTrigger.cs @@ -0,0 +1,102 @@ +using System; +using System.Threading.Tasks; +using Interfaces; +using Octokit; +using Storage.Remote.GitHub; + +namespace Platform.Bot.Triggers +{ + using TContext = Issue; + /// + /// + /// Represents the rubber duck debugging trigger. + /// + /// + /// + /// + internal class RubberDuckTrigger : ITrigger + { + private readonly GitHubStorage _storage; + + /// + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// A git hub api. + /// + /// + public RubberDuckTrigger(GitHubStorage storage) + { + this._storage = storage; + } + + /// + /// + /// Actions the context. + /// + /// + /// + /// + /// The context. + /// + /// + public async Task Action(TContext context) + { + var openerQuestion = $@"🦆 **Rubber Duck Debugging Assistant** + +Do you have problem with code? +У вас проблема с кодом? + +**Instructions:** +- Reply with **""Yes""** or **""Да""** to start debugging session +- I'll guide you through the problem-solving process step by step +- Explaining your problem to me (the rubber duck) often helps you find the solution yourself! + +**Common debugging steps I can help with:** +1. Understanding the problem clearly +2. Breaking down the problem into smaller parts +3. Checking assumptions +4. Reviewing recent changes +5. Testing hypotheses +6. Finding similar examples + +Ready to debug? 🐛➡️✨"; + + await _storage.CreateIssueComment(context.Repository.Id, context.Number, openerQuestion); + } + + /// + /// + /// Determines whether this instance condition. + /// + /// + /// + /// + /// The context. + /// + /// + /// + /// The bool + /// + /// + public async Task Condition(TContext context) + { + var title = context.Title.ToLower().Trim(); + var triggerWords = new[] + { + "help", + "help me", + "sos", + "помощь", + "помогите", + "помогите мне", + "спасите" + }; + + return Array.Exists(triggerWords, trigger => title == trigger); + } + } +} \ No newline at end of file From 727ad2a2c086324d82e29933d2f1f27e58c97f1a Mon Sep 17 00:00:00 2001 From: konard Date: Fri, 12 Sep 2025 23:17:52 +0300 Subject: [PATCH 3/3] Remove CLAUDE.md - Claude command completed --- CLAUDE.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 7c8a2a74..00000000 --- a/CLAUDE.md +++ /dev/null @@ -1,5 +0,0 @@ -Issue to solve: https://github.com/linksplatform/Bot/issues/142 -Your prepared branch: issue-142-9dc004a1 -Your prepared working directory: /tmp/gh-issue-solver-1757707702118 - -Proceed. \ No newline at end of file