From dff91e32193b1346df44833a840736a17cde0e65 Mon Sep 17 00:00:00 2001 From: Jordan Partridge Date: Wed, 10 Dec 2025 00:21:34 -0700 Subject: [PATCH] Clean up root directory, modernize README BREAKING: Reorganized project structure for cleaner root Moved to /docs: - ARCHITECTURE.md - COMMENT_FILTERING.md - CONDUIT_CLI_INTEGRATION.md - DTO_MIGRATION_GUIDE.md Moved to /.claude: - CLAUDE.md Deleted (internal notes, not package docs): - ISSUE_73_ANALYSIS.md - TODOS.md (use GitHub issues) - WorkLog/ directory - phpstan-baseline.neon (was empty) README.md completely rewritten: - Hero section with 3-line install + 3-line usage - Removed comparison table (let the work speak) - Real examples: create issues, PRs, merge - Testing section highlighting MockClient - Clean resource table - Removed badge clutter from top Root now has 13 items instead of 20+. Professional. --- CLAUDE.md => .claude/CLAUDE.md | 0 ARCHITECTURE.md | 204 ---------------- COMMENT_FILTERING.md | 190 --------------- CONDUIT_CLI_INTEGRATION.md | 221 ------------------ DTO_MIGRATION_GUIDE.md | 207 ----------------- ISSUE_73_ANALYSIS.md | 127 ---------- README.md | 414 ++++++++++++--------------------- TODOS.md | 36 --- WorkLog/12-10-2024.md | 5 - phpstan-baseline.neon | 0 10 files changed, 153 insertions(+), 1251 deletions(-) rename CLAUDE.md => .claude/CLAUDE.md (100%) delete mode 100644 ARCHITECTURE.md delete mode 100644 COMMENT_FILTERING.md delete mode 100644 CONDUIT_CLI_INTEGRATION.md delete mode 100644 DTO_MIGRATION_GUIDE.md delete mode 100644 ISSUE_73_ANALYSIS.md delete mode 100644 TODOS.md delete mode 100644 WorkLog/12-10-2024.md delete mode 100644 phpstan-baseline.neon diff --git a/CLAUDE.md b/.claude/CLAUDE.md similarity index 100% rename from CLAUDE.md rename to .claude/CLAUDE.md diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md deleted file mode 100644 index 45f2a2f..0000000 --- a/ARCHITECTURE.md +++ /dev/null @@ -1,204 +0,0 @@ -# Architecture - -This document provides a comprehensive overview of the architectural design and components of the Laravel GitHub Client package. - -## Overview - -The GitHub Client for Laravel is built on a clean, modular architecture that follows Laravel's best practices and patterns. The package is designed to be: - -- **User-friendly**: Intuitive API that follows Laravel conventions -- **Maintainable**: Clear separation of concerns and modular components -- **Performant**: Efficient HTTP communication with the GitHub API -- **Testable**: Easy to test with mock responses -- **Type-safe**: Fully typed responses and parameters - -## Core Components - -The architecture consists of these key components: - -``` -┌─────────────────────┐ ┌───────────────────┐ ┌───────────────────┐ -│ GitHub Facade │ │ GitHub Client │ │ Saloon Connector │ -│ (Entry Point) │─────▶│ (Main Service) │─────▶│ (HTTP Layer) │ -└─────────────────────┘ └───────────────────┘ └───────────────────┘ - │ - │ - ▼ -┌─────────────────────┐ ┌───────────────────┐ ┌───────────────────┐ -│ Request Classes │◀─────│ Resources │─────▶│ Data Transfer │ -│ (API Endpoints) │ │ (API Entities) │ │ Objects (DTOs) │ -└─────────────────────┘ └───────────────────┘ └───────────────────┘ -``` - -### 1. Entry Points - -- **Facades**: `Github` and `GithubOAuth` facades provide static access to the client -- **Service Container**: Direct dependency injection of `Github` or `GithubConnector` - -### 2. Core Services - -- **Github**: Main entry point for the API client -- **GithubConnector**: Handles HTTP communication with GitHub's API using Saloon -- **GithubOAuth**: Handles OAuth authentication with GitHub - -### 3. Resources - -Resources implement the Repository pattern for different GitHub entities: - -- **RepoResource**: Manages repository operations -- **CommitResource**: Handles repository commits -- **PullRequestResource**: Manages pull requests, reviews, and comments -- **FileResource**: Handles file operations - -Resources provide a consistent interface: -- `all()`: List all resources with filtering options -- `get()`: Retrieve a specific resource -- Additional specialized methods for specific needs - -### 4. Request Classes - -Each API endpoint is represented by a dedicated Request class in the `Requests` directory: - -- **Index.php**: List/index endpoints -- **Get.php**: Retrieve specific resource -- **Delete.php**: Delete a resource - -These classes handle: -- Endpoint resolution -- Parameter validation -- Query/body parameters - -### 5. Data Transfer Objects (DTOs) - -DTOs provide strongly-typed structures for GitHub API responses: - -- **RepoData**: Repository information -- **CommitData**: Commit information -- **PullRequestDTO**: Pull request information -- **FileDTO**: File information - -DTOs are immutable objects with typed properties, leveraging spatie/laravel-data. - -### 6. Value Objects - -Value objects encapsulate and validate complex identifiers: - -- **Repo**: Validates and normalizes repository names -- Additional value objects for other complex identifiers - -### 7. Enums - -PHP 8.2+ enums are used for type-safe parameter validation: - -- **Visibility**: Repository visibility options (PUBLIC, PRIVATE, ALL) -- **Direction**: Sort direction (ASC, DESC) -- **Sort**: Sort fields (CREATED, UPDATED, PUSHED, FULL_NAME) -- **MergeMethod**: PR merge methods (MERGE, SQUASH, REBASE) -- **State**: PR states (OPEN, CLOSED, ALL) - -## Data Flow - -1. **Request Initiation**: - ```php - Github::repos()->get('owner/repo'); - ``` - -2. **Resource Handling**: - - `RepoResource` creates a `Get` request - - Validates parameters using value objects - -3. **HTTP Communication**: - - `GithubConnector` sends the request to GitHub's API - - Handles authentication and headers - -4. **Response Processing**: - - Response is converted to a DTO - - Types are properly cast (dates, nested objects) - -5. **Result Delivery**: - - Typed DTO is returned to the caller - -## Error Handling - -The package implements a comprehensive error handling approach: - -1. **Input Validation**: - - Type validation through PHP 8.2+ type hints - - Value validation through value objects - - Enum validation for allowed values - -2. **HTTP Errors**: - - GitHub API errors are caught and converted to Laravel-friendly exceptions - - Rate limiting, authentication, and permission errors are properly handled - -3. **Exception Hierarchy**: - - `GithubAuthException`: Authentication issues - - Additional specific exceptions for different error scenarios - -## Testing Approach - -The package is built with testability in mind: - -1. **Mock Responses**: - ```php - Github::connector()->withMockClient($mockClient); - ``` - -2. **Test Categories**: - - Unit tests for value objects and validation - - Feature tests for resources and requests - - Integration tests for the full workflow - -3. **Test Coverage**: - - All public methods have corresponding tests - - Both success and error scenarios are tested - - Edge cases are addressed - -## Extension Points - -The architecture is designed to be extensible: - -1. **New Resources**: - - Create a new class extending `BaseResource` - - Add it to the `GithubConnector` and `GithubConnectorInterface` - -2. **New Methods**: - - Add methods to existing resources - - Create corresponding request classes - -3. **New DTOs**: - - Create new DTO classes in the `Data` directory - - Use spatie/laravel-data attributes for casting - -## Configuration - -The package uses Laravel's configuration system: - -- **github-client.php**: Main configuration file - - API token - - Base URL - - OAuth settings - -## Security Considerations - -1. **Token Handling**: - - Tokens are stored in environment variables - - Token validation ensures proper format - -2. **Rate Limiting**: - - GitHub API rate limits are respected - - Rate limit errors are properly handled - -3. **Authentication**: - - OAuth implementation follows security best practices - - Token refresh mechanisms are properly implemented - -## Performance Optimization - -1. **HTTP Efficiency**: - - Uses Saloon's response caching when appropriate - - Pagination to handle large datasets efficiently - -2. **DTO Optimization**: - - Lazy loading of nested resources - - Selective property mapping for efficiency \ No newline at end of file diff --git a/COMMENT_FILTERING.md b/COMMENT_FILTERING.md deleted file mode 100644 index 196e8df..0000000 --- a/COMMENT_FILTERING.md +++ /dev/null @@ -1,190 +0,0 @@ -# Comment Filtering & Metadata Extraction - -This document explains the new comment filtering and metadata extraction capabilities introduced in v2.7.0. - -## Features - -### 1. Enhanced Comment Fetching with Filtering - -Get PR comments with advanced filtering options: - -```php -use JordanPartridge\GithubClient\Facades\Github; - -// Get all CodeRabbit comments from PR #42 -$comments = Github::comments()->forPullRequest(42, [ - 'repository' => 'owner/repo', - 'author' => 'coderabbitai' -]); - -// Get all bot comments with high severity -$criticalIssues = Github::comments()->forPullRequest(42, [ - 'repository' => 'owner/repo', - 'author_type' => 'bot', - 'severity' => 'high' -]); - -// Get comments from specific file -$fileComments = Github::comments()->forPullRequest(42, [ - 'repository' => 'owner/repo', - 'file_path' => 'app/Http/Controllers/UserController.php' -]); -``` - -### 2. Comment Metadata Extraction - -Automatically extract metadata from comment content: - -```php -// Each comment now includes rich metadata -$comment = $comments[0]; - -echo $comment->metadata->severity; // 'high', 'medium', 'low' -echo $comment->metadata->claim_type; // 'sql_injection', 'null_pointer_exception', etc. -echo $comment->metadata->reviewer_type; // 'coderabbit', 'sonarqube', 'human', etc. -echo $comment->metadata->line_number; // Extracted line number -echo $comment->metadata->code_snippet; // Extracted code block -``` - -### 3. Convenient Shortcut Methods - -```php -// Get all CodeRabbit comments -$coderabbitComments = Github::comments()->codeRabbit(42, [ - 'repository' => 'owner/repo' -]); - -// Get all bot comments (any AI reviewer) -$botComments = Github::comments()->bots(42, [ - 'repository' => 'owner/repo' -]); - -// Get human reviewer comments only -$humanComments = Github::comments()->humans(42, [ - 'repository' => 'owner/repo' -]); - -// Filter by author -$authorComments = Github::comments()->byAuthor(42, 'specific-user', [ - 'repository' => 'owner/repo' -]); - -// Filter by severity -$criticalComments = Github::comments()->bySeverity(42, 'high', [ - 'repository' => 'owner/repo' -]); - -// Get comments for specific file -$fileComments = Github::comments()->forFile(42, 'src/User.php', [ - 'repository' => 'owner/repo' -]); -``` - -## Available Filters - -### Author Filters -- `author` - Specific username (e.g., 'coderabbitai') -- `author_type` - 'bot' or 'human' - -### Content Filters -- `severity` - 'high', 'medium', 'low' -- `claim_type` - 'sql_injection', 'null_pointer_exception', 'security', etc. -- `contains` - Text search within comment body - -### Location Filters -- `file_path` - Specific file path -- `repository` - Repository in 'owner/repo' format (required) - -### Date Filters -- `since` - ISO date string (e.g., '2023-01-01T12:00:00Z') -- `until` - ISO date string - -### Pagination -- `per_page` - Number of results per page (max 100) -- `page` - Page number - -## Metadata Detection Patterns - -### Severity Detection - -The system automatically detects severity from various patterns: - -**Explicit markers:** -- `[SEVERITY: HIGH]` -- `[SEV: MEDIUM]` -- `severity: low` - -**Emoji indicators:** -- 🔴 ❌ ⛔ → high severity -- 🟡 ⚠️ → medium severity -- 🟢 ✅ ℹ️ → low severity - -**Keywords:** -- `critical`, `security`, `vulnerability` → high -- `warning`, `potential`, `consider` → medium -- `suggestion`, `nit`, `style` → low - -**Tool-specific patterns:** -- CodeRabbit: `**Potential security vulnerability**` → high -- SonarQube: `Bug:` → high, `Code smell:` → medium - -### Claim Type Detection - -Automatically identifies types of issues: - -- `null_pointer_exception` - Null pointer issues -- `sql_injection` - SQL injection vulnerabilities -- `xss` - Cross-site scripting -- `memory_leak` - Memory management issues -- `race_condition` - Concurrency issues -- `security` - General security issues -- `performance` - Performance problems -- `complexity` - Code complexity issues -- `unused_code` - Unused variables/imports -- `style` - Code style issues - -### Reviewer Type Detection - -Identifies the type of reviewer: - -- `coderabbit` - CodeRabbit AI -- `sonarqube` - SonarQube analysis -- `dependabot` - Dependabot -- `github_actions` - GitHub Actions -- `bot` - Generic bot -- `human` - Human reviewer - -## Complete Example - -```php -use JordanPartridge\GithubClient\Facades\Github; - -// Get all high-severity security issues from CodeRabbit -$securityIssues = Github::comments()->forPullRequest(42, [ - 'repository' => 'myorg/myproject', - 'author' => 'coderabbitai', - 'severity' => 'high', - 'claim_type' => 'security' -]); - -foreach ($securityIssues as $comment) { - echo "Security Issue in {$comment->path}:\n"; - echo "Line: {$comment->metadata->line_number}\n"; - echo "Severity: {$comment->metadata->severity}\n"; - echo "Type: {$comment->metadata->claim_type}\n"; - echo "Code: {$comment->metadata->code_snippet}\n"; - echo "Comment: {$comment->body}\n\n"; -} -``` - -## Integration with AI Code Review Workflows - -This feature is designed to support AI-powered code review verification pipelines: - -1. **Fetch AI reviewer comments** with specific filtering -2. **Extract structured metadata** for analysis -3. **Identify high-priority issues** automatically -4. **Generate verification tests** based on claims -5. **Track review comment resolution** - -Perfect for tools like Conduit that need to process and analyze code review feedback systematically. \ No newline at end of file diff --git a/CONDUIT_CLI_INTEGRATION.md b/CONDUIT_CLI_INTEGRATION.md deleted file mode 100644 index f47d104..0000000 --- a/CONDUIT_CLI_INTEGRATION.md +++ /dev/null @@ -1,221 +0,0 @@ -# Conduit CLI Comment Management Integration - -## Overview -This document outlines how the new github-client CRUD operations enable comprehensive comment management in Conduit CLI, supporting Issues #91, #92, and #93. - -## Completed API Implementation - -### ✅ Issue/PR General Comments (Issue #91) -- `IssuesResource::getComment($owner, $repo, $commentId): IssueCommentDTO` -- `IssuesResource::updateComment($owner, $repo, $commentId, $body): IssueCommentDTO` -- `IssuesResource::deleteComment($owner, $repo, $commentId): bool` - -### ✅ PR Review Comments (Issue #92) -- `PullRequestResource::getComment($owner, $repo, $commentId): PullRequestCommentDTO` -- `PullRequestResource::updateComment($owner, $repo, $commentId, $body): PullRequestCommentDTO` -- `PullRequestResource::deleteComment($owner, $repo, $commentId): bool` - -### ✅ Advanced Comment Filtering (Already Available) -- `CommentsResource::forPullRequest($prNumber, $filters): array` -- `CommentsResource::byAuthor($prNumber, $author): array` -- `CommentsResource::bySeverity($prNumber, $severity): array` - -## Proposed Conduit CLI Commands (Issue #93) - -### 1. General Comment Management - -```bash -# List comments (leverages existing functionality) -conduit comments:list {issue_or_pr} [--repo=] [--type=issue|review|all] - -# Get specific comment -conduit comments:show {comment_id} [--repo=] [--type=issue|review] - -# Edit comments with external editor integration -conduit comments:edit {comment_id} [--repo=] [--body=] [--editor] [--type=issue|review] - -# Delete comments with confirmation -conduit comments:delete {comment_id} [--repo=] [--confirm] [--type=issue|review] - -# Reply to comments (create new in thread) -conduit comments:reply {comment_id} [--repo=] [--body=] [--editor] -``` - -### 2. Review-Specific Commands - -```bash -# Edit review comments (inline code comments) -conduit prs:comments:edit {comment_id} [--repo=] [--body=] [--editor] - -# Delete review comments -conduit prs:comments:delete {comment_id} [--repo=] [--confirm] - -# Resolve/unresolve conversations (if GitHub API supports) -conduit prs:comments:resolve {comment_id} [--repo=] -``` - -### 3. Bulk Operations - -```bash -# Bulk delete resolved comments -conduit comments:cleanup {pr} [--repo=] [--resolved-only] [--dry-run] - -# Export comment history -conduit comments:export {issue_or_pr} [--repo=] [--format=json|csv|md] -``` - -## Implementation Examples - -### Basic Comment CRUD - -```php -// Conduit CLI would use the github-client like this: - -// Get a comment -$comment = Github::issues()->getComment('owner', 'repo', 12345); - -// Edit a comment -$updated = Github::issues()->updateComment('owner', 'repo', 12345, 'Updated comment text'); - -// Delete a comment -$success = Github::issues()->deleteComment('owner', 'repo', 12345); -``` - -### PR Review Comment Management - -```php -// Get PR review comment -$reviewComment = Github::pullRequests()->getComment('owner', 'repo', 67890); - -// Update PR review comment -$updated = Github::pullRequests()->updateComment('owner', 'repo', 67890, 'Updated review feedback'); - -// Delete PR review comment -$success = Github::pullRequests()->deleteComment('owner', 'repo', 67890); -``` - -### Advanced Filtering for Bulk Operations - -```php -// Get all CodeRabbit comments that can be cleaned up -$aiComments = Github::comments()->forPullRequest(42, [ - 'repository' => 'owner/repo', - 'author' => 'coderabbitai', - 'severity' => 'low' -]); - -// Bulk delete old resolved comments -foreach ($aiComments as $comment) { - if ($comment->isResolved()) { - Github::pullRequests()->deleteComment('owner', 'repo', $comment->id); - } -} -``` - -## Command Integration Patterns - -### 1. Unified Comment Detection - -```php -// Conduit CLI logic to determine comment type -function getCommentType(int $commentId, string $repo): string -{ - try { - // Try as PR review comment first - Github::pullRequests()->getComment(..., $commentId); - return 'review'; - } catch (NotFound $e) { - // Fall back to issue comment - Github::issues()->getComment(..., $commentId); - return 'issue'; - } -} -``` - -### 2. Editor Integration - -```bash -# Conduit CLI can open comments in user's preferred editor -conduit comments:edit 12345 --editor - -# This would: -# 1. Fetch comment with Github::issues()->getComment() -# 2. Open in $EDITOR with current content -# 3. Update with Github::issues()->updateComment() on save -``` - -### 3. Repository Detection - -```php -// Conduit CLI uses existing DetectsRepository trait -class CommentsEditCommand extends Command -{ - use DetectsRepository; - - public function handle() - { - $repo = $this->detectRepository(); - $comment = Github::issues()->getComment($repo->owner, $repo->name, $this->commentId); - // ... rest of edit logic - } -} -``` - -## Benefits for Conduit Users - -### 🔄 Complete Comment Lifecycle -- **Create**: Existing functionality -- **Read**: Enhanced with single comment fetching -- **Update**: New CRUD operations -- **Delete**: New CRUD operations - -### 🎯 Developer Workflow Integration -- Edit comments in preferred editor (vim, nano, code, etc.) -- Bulk operations for comment cleanup -- Scriptable comment management for CI/CD - -### 🤖 Code Review Management -- Resolve discussions programmatically -- Clean up outdated AI feedback -- Export comment history for analysis - -### 🚀 Cross-Platform Consistency -- Unified interface for GitHub comment operations -- Works with both issues and PR comments seamlessly -- Consistent patterns across all comment types - -## Technical Implementation Notes - -### Error Handling -```php -// Robust error handling for missing comments -try { - $comment = Github::issues()->getComment('owner', 'repo', 999999); -} catch (ApiException $e) { - if ($e->getCode() === 404) { - throw new CommentNotFoundException("Comment 999999 not found"); - } - throw $e; -} -``` - -### Validation -- All new request classes validate comment IDs (must be positive integers) -- Comment body validation prevents empty comments -- Proper error messages for debugging - -### Type Safety -- Strongly typed return values (`IssueCommentDTO`, `PullRequestCommentDTO`, `bool`) -- IDE autocompletion and error detection -- Consistent API patterns across all operations - -## Conclusion - -The github-client now provides complete CRUD operations for both issue comments and PR review comments, enabling Conduit CLI to offer comprehensive comment management functionality. The API is designed for: - -- **Consistency**: Same patterns for all comment types -- **Type Safety**: Full PHP type-hinting and validation -- **Developer Experience**: Intuitive method names and clear documentation -- **Error Handling**: Robust validation and meaningful error messages - -This foundation enables Conduit CLI to become the most comprehensive GitHub comment management tool available. \ No newline at end of file diff --git a/DTO_MIGRATION_GUIDE.md b/DTO_MIGRATION_GUIDE.md deleted file mode 100644 index 60e1173..0000000 --- a/DTO_MIGRATION_GUIDE.md +++ /dev/null @@ -1,207 +0,0 @@ -# DTO Migration Guide: Summary vs Detail DTOs - -## Overview - -In v2.8.0, we've introduced a new DTO pattern that **solves Issue #73** and provides better type safety for GitHub API responses. This is a **non-breaking** addition - your existing code continues to work exactly as before. - -## The Problem We Solved - -**Issue #73**: Comment counts always returned 0 from list endpoints because GitHub's API doesn't include detailed statistics in list responses. - -```php -// Before: Misleading zeros from list endpoint -$prs = Github::pullRequests()->all('owner', 'repo'); -echo $prs[0]->comments; // Always 0 😞 (misleading) - -// After: Clear separation -$summaries = Github::pullRequests()->summaries('owner', 'repo'); // Fast, no comment counts -$detail = Github::pullRequests()->detail('owner', 'repo', 47); // Accurate comment counts -echo $detail->comments; // Actual count! 🎉 -``` - -## New DTO Types - -### 1. `PullRequestSummaryDTO` -- **Used for**: List endpoint responses (`/repos/owner/repo/pulls`) -- **Contains**: Basic PR info (title, state, URLs, dates) -- **Does NOT contain**: Comment counts, code statistics -- **Benefits**: Fast, lightweight, no misleading zeros - -### 2. `PullRequestDetailDTO` -- **Used for**: Individual endpoint responses (`/repos/owner/repo/pulls/123`) -- **Contains**: Complete PR data including comment counts and code stats -- **Extends**: `PullRequestSummaryDTO` (has all summary fields plus detailed ones) -- **Benefits**: Accurate data, rich utility methods - -## Migration Paths - -### Option 1: Keep Using Existing Methods (No Changes) - -```php -// Your existing code still works exactly the same -$prs = Github::pullRequests()->all('owner', 'repo'); -$pr = Github::pullRequests()->get('owner', 'repo', 123); - -// Still returns PullRequestDTO objects as before -``` - -### Option 2: Adopt New Explicit Methods (Recommended) - -```php -// NEW: Explicit lightweight listing -$summaries = Github::pullRequests()->summaries('owner', 'repo'); -// Returns: PullRequestSummaryDTO[] - fast, no detailed fields - -// NEW: Explicit detailed fetching -$detail = Github::pullRequests()->detail('owner', 'repo', 123); -// Returns: PullRequestDetailDTO - complete data with accurate counts - -// NEW: Optimized workflow for recent PRs with details -$recentWithDetails = Github::pullRequests()->recentDetails('owner', 'repo', 5); -// Returns: PullRequestDetailDTO[] - recent PRs with accurate comment counts -``` - -### Option 3: Use Smart Factory (Advanced) - -```php -use JordanPartridge\GithubClient\Data\Pulls\PullRequestDTOFactory; - -// Automatically detects response type and creates appropriate DTO -$dto = PullRequestDTOFactory::fromResponse($apiResponseData); - -// Analyze what would be created -$analysis = PullRequestDTOFactory::analyzeResponse($apiResponseData); -``` - -## For Conduit Users - -### Before (Issue #73) -```bash -# conduit prs showed: 💬0 📝0 (incorrect) -conduit prs --repo=conduit-ui/conduit -``` - -### After (Fixed!) -```php -// Update your conduit command to use: -$details = Github::pullRequests()->recentDetails('conduit-ui', 'conduit', 10); - -foreach ($details as $pr) { - echo "PR #{$pr->number}: 💬{$pr->comments} 📝{$pr->review_comments}"; // Accurate! ✅ -} -``` - -## Backward Compatibility Promise - -✅ **100% Backward Compatible** -- All existing methods work unchanged -- All existing DTOs (`PullRequestDTO`) continue to work -- No breaking changes whatsoever -- Opt-in enhancement - -## When to Use Each Approach - -### Use `summaries()` when: -- Displaying PR lists/tables -- Quick overviews without detailed stats -- Performance is critical -- You don't need comment counts - -### Use `detail()` when: -- Showing individual PR pages -- Need accurate comment/review counts -- Displaying code change statistics -- Building detailed PR reports - -### Use `recentDetails()` when: -- Building dashboards with comment counts -- Recent activity feeds with accurate stats -- Workflow prioritization based on activity - -## New Features in Detail DTOs - -```php -$detail = Github::pullRequests()->detail('owner', 'repo', 123); - -// Rich utility methods -echo $detail->getTotalLinesChanged(); // additions + deletions -echo $detail->getAdditionRatio(); // percentage of additions -echo $detail->hasComments(); // bool: any comments? -echo $detail->getTotalComments(); // comments + review_comments - -// Formatted summary for display -$summary = $detail->getSummary(); -// Returns formatted data perfect for CLI/UI display -``` - -## Performance Considerations - -### List Operations (Fast ⚡) -```php -// Single API call, lightweight response -$summaries = Github::pullRequests()->summaries('owner', 'repo'); -``` - -### Detail Operations (Accurate but Slower 🎯) -```php -// Multiple API calls, rate limit aware -$details = Github::pullRequests()->recentDetails('owner', 'repo', 5); // Max 5 for safety -``` - -## Migration Timeline - -- **v2.8.0**: New DTOs introduced, fully optional -- **v3.0.0**: May deprecate old methods with migration warnings -- **v4.0.0**: Potential breaking changes (far future) - -## FAQs - -**Q: Do I need to change my existing code?** -A: No! Your existing code continues to work exactly as before. - -**Q: Will this affect performance?** -A: Only if you choose to use the new `detail()` methods, which make additional API calls for accuracy. - -**Q: How do I fix Issue #73 in my app?** -A: Replace list operations that need comment counts with `recentDetails()` or individual `detail()` calls. - -**Q: Can I mix old and new approaches?** -A: Yes! Use whatever works best for each use case. - -## Example: Complete Migration - -```php -// BEFORE: Potentially misleading data -class PullRequestController { - public function index() { - $prs = Github::pullRequests()->all('owner', 'repo'); - return view('prs.index', compact('prs')); - // Template shows: 💬0 📝0 for all PRs (misleading) - } -} - -// AFTER: Accurate and performant -class PullRequestController { - public function index() { - // Fast listing without misleading zeros - $summaries = Github::pullRequests()->summaries('owner', 'repo'); - return view('prs.index', compact('summaries')); - // Template shows basic info, no comment counts - } - - public function dashboard() { - // Accurate data for dashboard with comment counts - $recentWithDetails = Github::pullRequests()->recentDetails('owner', 'repo', 10); - return view('prs.dashboard', compact('recentWithDetails')); - // Template shows: 💬1 📝19 (accurate!) - } - - public function show($number) { - // Complete data for individual PR page - $detail = Github::pullRequests()->detail('owner', 'repo', $number); - return view('prs.show', compact('detail')); - } -} -``` - -This pattern provides the best of both worlds: **fast listings** and **accurate detailed data** when you need it! 🚀 \ No newline at end of file diff --git a/ISSUE_73_ANALYSIS.md b/ISSUE_73_ANALYSIS.md deleted file mode 100644 index dc43705..0000000 --- a/ISSUE_73_ANALYSIS.md +++ /dev/null @@ -1,127 +0,0 @@ -# Issue #73 Analysis: Why Comment Counts Return 0 - -## Root Cause Identified ✅ - -The issue is **NOT** with our github-client v2.6.0 fix. Our PullRequestDTO correctly handles comment mapping. The problem is that **the GitHub API list endpoint doesn't include comment counts**. - -### The Problem - -**GitHub API Behavior:** -- **List endpoint** (`/repos/owner/repo/pulls`) → ❌ No `comments` or `review_comments` fields -- **Individual endpoint** (`/repos/owner/repo/pulls/47`) → ✅ Includes `comments` and `review_comments` fields - -### Real Data Verification - -```bash -# Individual PR endpoint (works correctly) -$ gh api repos/conduit-ui/conduit/pulls/47 | jq '{comments, review_comments}' -{ - "comments": 1, - "review_comments": 19 -} - -# List endpoint (missing comment fields) -$ gh api repos/conduit-ui/conduit/pulls | jq '.[0] | {comments, review_comments}' -{ - "comments": null, - "review_comments": null -} -``` - -### Why This Happens - -1. **Performance**: Including comment counts for hundreds of PRs would require expensive database queries -2. **API Design**: GitHub separates "lightweight" list operations from "detailed" individual operations -3. **Rate Limiting**: Fetching detailed data for many PRs would quickly exhaust rate limits - -### User's Current Workflow - -The user's `conduit prs` command likely uses our `PullRequestResource::all()` method, which calls the **list endpoint**: - -```php -// This uses the list endpoint (no comment counts) -$prs = Github::pullRequests()->all('conduit-ui', 'conduit'); - -foreach ($prs as $pr) { - echo $pr->comments; // Always 0 - field not in list response -} -``` - -## Solutions - -### Option 1: Fetch Individual PRs (Accurate but Expensive) - -```php -use JordanPartridge\GithubClient\Resources\PullRequestResourceEnhanced; - -$enhanced = new PullRequestResourceEnhanced(Github::getFacadeRoot()); - -// Get recent PRs with accurate comment counts -$prs = $enhanced->recentWithCommentCounts('conduit-ui', 'conduit', 5); - -foreach ($prs as $pr) { - echo "PR #{$pr->number}: 💬{$pr->comments} 📝{$pr->review_comments}"; // Correct counts! -} -``` - -**Pros:** Accurate comment counts -**Cons:** Uses more API calls (rate limit impact) - -### Option 2: Hybrid Approach (Recommended) - -```php -// Get basic PR list quickly -$prs = Github::pullRequests()->all('conduit-ui', 'conduit', ['per_page' => 10]); - -// Get detailed data only for specific PRs the user wants to see -$detailedPRs = []; -foreach ($prs as $pr) { - if ($userWantsDetails($pr)) { - $detailed = Github::pullRequests()->get('conduit-ui', 'conduit', $pr->number); - $detailedPRs[] = $detailed; - } -} -``` - -### Option 3: Document the Limitation - -Add clear documentation that comment counts are only available when fetching individual PRs: - -```php -// ❌ List - no comment counts (by GitHub API design) -$prs = Github::pullRequests()->all('owner', 'repo'); - -// ✅ Individual - includes comment counts -$pr = Github::pullRequests()->get('owner', 'repo', 47); -``` - -## For Conduit Users - -To fix the `conduit prs` command, you have these options: - -### Quick Fix (Update conduit command) -Modify the conduit command to use individual PR fetches for recent PRs: - -```bash -# Instead of fetching all PRs, get recent ones with details -conduit prs --recent --limit=10 # Fetch detailed data for 10 recent PRs -``` - -### Configuration Option -Add a setting to choose between fast (no comments) vs accurate (with comments): - -```bash -conduit prs --with-comments # Slower but accurate -conduit prs --fast # Fast but no comment counts (current behavior) -``` - -## Verification Steps - -1. ✅ **Our DTO works correctly** - Issue #71 tests prove this -2. ✅ **GitHub API confirmed** - List endpoint doesn't include comment fields -3. ✅ **Solution provided** - Enhanced resource with comment count fetching -4. ✅ **Performance considerations** - Rate limit aware implementation - -## Summary - -This is **not a bug** in github-client v2.6.0. It's a **design limitation** of the GitHub API list endpoint. The fix is to use individual PR fetches when comment counts are needed, which we've provided through the `PullRequestResourceEnhanced` class. \ No newline at end of file diff --git a/README.md b/README.md index 8dd4bff..f2a1db4 100644 --- a/README.md +++ b/README.md @@ -1,374 +1,266 @@ # GitHub Client for Laravel -[![Latest Version on Packagist](https://img.shields.io/packagist/v/jordanpartridge/github-client.svg?style=flat-square)](https://packagist.org/packages/jordanpartridge/github-client) -[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/jordanpartridge/github-client/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/jordanpartridge/github-client/actions?query=workflow%3Arun-tests+branch%3Amain) -[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/jordanpartridge/github-client/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/jordanpartridge/github-client/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) -[![Total Downloads](https://img.shields.io/packagist/dt/jordanpartridge/github-client.svg?style=flat-square)](https://packagist.org/packages/jordanpartridge/github-client) -[![PHP Version](https://img.shields.io/packagist/php-v/jordanpartridge/github-client.svg?style=flat-square)](https://packagist.org/packages/jordanpartridge/github-client) -[![Laravel Version](https://img.shields.io/badge/Laravel-11%2B%2C%2012%2B-red?style=flat-square)](https://packagist.org/packages/jordanpartridge/github-client) +**Stop wrestling with GitHub's API. Start shipping.** -A powerful, Laravel-first GitHub API client built on Saloon that makes integrating with GitHub's API simple and intuitive. This package provides strongly-typed responses, resource-based architecture, and an elegant developer experience. +```bash +composer require jordanpartridge/github-client +``` -## 🌟 Features +```php +// That's it. You're done. +$repos = Github::repos()->all(); +$issues = Github::issues()->forRepo('owner', 'repo'); +$pr = Github::pullRequests()->create('owner', 'repo', 'My PR', 'feature', 'main'); +``` -- **Elegant Resource Pattern**: A Laravel-style resource pattern for all GitHub API entities -- **Strongly Typed**: Full type-hinting support with typed responses via DTOs -- **Built on [Saloon](https://github.com/Sammyjo20/Saloon)**: Reliable API handling with MockClient for testing -- **Comprehensive Coverage**: Support for repositories, commits, pull requests, issues, and files -- **Laravel Integration**: Seamless integration with Laravel's configuration and authentication -- **Multiple Access Methods**: Support for facades and dependency injection -- **Modern Codebase**: PHP 8.2+ with modern features like enums and readonly properties -- **Extensive Test Coverage**: Complete test suite using Pest PHP -- **Laravel Compatibility**: Support for Laravel 11 and 12 +[![Tests](https://img.shields.io/github/actions/workflow/status/jordanpartridge/github-client/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/jordanpartridge/github-client/actions) +[![Latest Version](https://img.shields.io/packagist/v/jordanpartridge/github-client.svg?style=flat-square)](https://packagist.org/packages/jordanpartridge/github-client) +[![Downloads](https://img.shields.io/packagist/dt/jordanpartridge/github-client.svg?style=flat-square)](https://packagist.org/packages/jordanpartridge/github-client) -## 📦 Installation +--- -Install the package via Composer: +## Why This Package? -```bash -composer require jordanpartridge/github-client -``` +- **Laravel Native** - Built for Laravel, not wrapped around it +- **Typed Responses** - DTOs everywhere, not arrays +- **Auto-Pagination** - `allWithPagination()` just works +- **Type-Safe Params** - Enums, not magic strings +- **Easy Testing** - Saloon MockClient built in -## ⚙️ Configuration +**One line: Modern GitHub API for modern Laravel.** -1. Generate a GitHub token in your [GitHub Settings](https://github.com/settings/tokens) with appropriate scopes -2. Add the token to your `.env` file: +--- -```dotenv -GITHUB_TOKEN=your-token-here -``` +## Quick Start -3. (Optional) Publish the configuration file if you need custom settings: +### 1. Install ```bash -php artisan vendor:publish --tag="github-client-config" +composer require jordanpartridge/github-client ``` -## 📄 Available Resources +### 2. Configure -This package provides the following GitHub resource classes: +Add your token to `.env`: -| Resource | Description | -|----------|-------------| -| `repos()` | Access and manage GitHub repositories | -| `commits()` | Work with repository commits | -| `pullRequests()` | Manage pull requests, reviews, and comments | -| `issues()` | Manage GitHub issues, comments, and labels | -| `files()` | Access repository file contents | +```env +GITHUB_TOKEN=ghp_your_token_here +``` -## 🚀 Basic Usage +Get one at [github.com/settings/tokens](https://github.com/settings/tokens) -### Working with Repositories +### 3. Use ```php use JordanPartridge\GithubClient\Facades\Github; -// List repositories (first page only, max 30 by default) -$firstPageRepos = Github::repos()->all(); +// Get your repos +$repos = Github::repos()->all(); -// List ALL repositories with automatic pagination +// Get ALL your repos (auto-pagination, no limits) $allRepos = Github::repos()->allWithPagination(); -// Get a specific repository +// Get a specific repo $repo = Github::repos()->get('jordanpartridge/github-client'); -// Filter repositories by visibility -use JordanPartridge\GithubClient\Enums\Visibility; -use JordanPartridge\GithubClient\Enums\Sort; -use JordanPartridge\GithubClient\Enums\Direction; +echo $repo->name; // "github-client" +echo $repo->stargazers_count; // 🤞 +echo $repo->owner->login; // "jordanpartridge" +``` -$publicRepos = Github::repos()->all( - visibility: Visibility::PUBLIC, -); +--- -// Get ALL public repositories with auto-pagination -$allPublicRepos = Github::repos()->allWithPagination( - visibility: Visibility::PUBLIC, - sort: Sort::CREATED, - direction: Direction::DESC -); -``` +## Real Examples -### Working with Commits +### Create an Issue ```php -// Get all commits for a repository -$commits = Github::commits()->all('jordanpartridge/github-client'); +$issue = Github::issues()->create( + owner: 'jordanpartridge', + repo: 'github-client', + title: 'Bug: Something broke', + body: 'Here are the details...', + labels: ['bug', 'high-priority'], + assignees: ['jordanpartridge'] +); -// Get a specific commit by SHA -$specificCommit = Github::commits()->get('jordanpartridge/github-client', 'abc123deadbeef'); +echo $issue->number; // 42 +echo $issue->html_url; // Direct link to GitHub ``` -### Working with Pull Requests +### Create a Pull Request ```php use JordanPartridge\GithubClient\Enums\MergeMethod; -// List all pull requests for a repository -$pullRequests = Github::pullRequests()->all('jordanpartridge/github-client'); - -// Get a specific pull request -$pullRequest = Github::pullRequests()->get('jordanpartridge/github-client', 123); - -// Create a new pull request -$newPr = Github::pullRequests()->create( +// Create PR +$pr = Github::pullRequests()->create( owner: 'jordanpartridge', repo: 'github-client', - title: 'New feature implementation', + title: 'Add new feature', head: 'feature-branch', base: 'main', - body: 'This PR implements the new feature with tests', + body: 'This PR adds the thing.', draft: false ); -// Merge a pull request -$mergeResult = Github::pullRequests()->merge( +// Merge it +Github::pullRequests()->merge( owner: 'jordanpartridge', repo: 'github-client', - number: 123, - commitMessage: 'Implement new feature', + number: $pr->number, mergeMethod: MergeMethod::Squash ); ``` -### Working with Issues +### Work with Issue Comments ```php -use JordanPartridge\GithubClient\Enums\Issues\State; -use JordanPartridge\GithubClient\Enums\Issues\Sort; +// Get all comments on an issue +$comments = Github::issues()->comments('owner', 'repo', 42); -// List issues across all your repositories -$myIssues = Github::issues()->all(); +// Add a comment +Github::issues()->addComment('owner', 'repo', 42, 'Fixed in latest release.'); -// List issues for a specific repository -$repoIssues = Github::issues()->forRepo('jordanpartridge', 'github-client'); +// Close the issue +Github::issues()->close('owner', 'repo', 42); +``` -// Get ALL issues with auto-pagination -$allIssues = Github::issues()->allForRepo('jordanpartridge', 'github-client'); +### Filter with Enums (Type-Safe) -// Filter issues by state, labels, and assignee -$openBugs = Github::issues()->forRepo( - owner: 'jordanpartridge', - repo: 'github-client', - state: State::OPEN, - labels: 'bug,high-priority', +```php +use JordanPartridge\GithubClient\Enums\Visibility; +use JordanPartridge\GithubClient\Enums\Sort; +use JordanPartridge\GithubClient\Enums\Direction; +use JordanPartridge\GithubClient\Enums\Issues\State; + +// Only public repos, sorted by creation date +$repos = Github::repos()->allWithPagination( + visibility: Visibility::PUBLIC, sort: Sort::CREATED, direction: Direction::DESC ); -// Get a specific issue -$issue = Github::issues()->get('jordanpartridge', 'github-client', 123); - -// Create a new issue -$newIssue = Github::issues()->create( +// Open bugs only +$bugs = Github::issues()->forRepo( owner: 'jordanpartridge', repo: 'github-client', - title: 'Bug: Auto-pagination not working', - body: 'Steps to reproduce...', - labels: ['bug', 'high-priority'], - assignees: ['maintainer-username'] + state: State::OPEN, + labels: 'bug' ); +``` -// Update an issue -$updatedIssue = Github::issues()->update( - owner: 'jordanpartridge', - repo: 'github-client', - issue_number: 123, - title: 'Updated title', - state: State::CLOSED -); +--- -// Close/reopen issues -$closedIssue = Github::issues()->close('jordanpartridge', 'github-client', 123); -$reopenedIssue = Github::issues()->reopen('jordanpartridge', 'github-client', 123); - -// Work with issue comments -$comments = Github::issues()->comments('jordanpartridge', 'github-client', 123); -$newComment = Github::issues()->addComment( - 'jordanpartridge', - 'github-client', - 123, - 'This has been fixed in the latest release.' -); -``` +## Testing Your App -### Working with Repository Files +Saloon's MockClient makes testing trivial: ```php -// Get file contents from a repository -$fileContent = Github::files()->get( - owner: 'jordanpartridge', - repo: 'github-client', - path: 'README.md' -); +use Saloon\Http\Faking\MockClient; +use Saloon\Http\Faking\MockResponse; +use JordanPartridge\GithubClient\Facades\Github; -// List directory contents -$files = Github::files()->contents( - owner: 'jordanpartridge', - repo: 'github-client', - path: 'src' -); +it('creates issues', function () { + $mock = new MockClient([ + '*' => MockResponse::make([ + 'id' => 1, + 'number' => 42, + 'title' => 'Test Issue', + 'state' => 'open', + ], 201), + ]); + + Github::connector()->withMockClient($mock); + + $issue = Github::issues()->create('owner', 'repo', 'Test Issue'); + + expect($issue->number)->toBe(42); + expect($issue->title)->toBe('Test Issue'); +}); ``` -### Using Dependency Injection +No HTTP calls. No flaky tests. No rate limits in CI. + +--- + +## Available Resources + +| Resource | Methods | +|----------|---------| +| `repos()` | `all`, `allWithPagination`, `get`, `delete`, `search` | +| `issues()` | `all`, `forRepo`, `allForRepo`, `get`, `create`, `update`, `close`, `reopen`, `comments`, `addComment` | +| `pullRequests()` | `all`, `get`, `create`, `merge`, `files`, `commits` | +| `commits()` | `all`, `get` | +| `files()` | `get`, `contents` | +| `releases()` | `all`, `get`, `latest`, `create` | +| `actions()` | `workflows`, `runs`, `trigger` | + +--- + +## Dependency Injection -You can use dependency injection instead of the Facade: +Don't like facades? Use DI: ```php use JordanPartridge\GithubClient\Contracts\GithubConnectorInterface; -class GitHubService +class MyService { public function __construct( private readonly GithubConnectorInterface $github ) {} - - public function getRepositories() + + public function getMyRepos() { return $this->github->repos()->all(); } } ``` -## 🔄 Type-Safe API Responses - -All responses are properly typed using data transfer objects (DTOs) powered by [spatie/laravel-data](https://github.com/spatie/laravel-data): - -```php -// $repo is a strongly-typed RepoData object -$repo = Github::repos()->get('jordanpartridge/github-client'); - -// Access typed properties -echo $repo->name; -echo $repo->full_name; -echo $repo->created_at->format('Y-m-d'); -echo $repo->owner->login; -``` +--- -## 🧪 Testing +## OAuth Flow -When testing your application, you can use Saloon's MockClient to mock GitHub API responses: +Building a GitHub app? OAuth is built in: ```php -use Saloon\Http\Faking\MockClient; -use Saloon\Http\Faking\MockResponse; -use JordanPartridge\GithubClient\Facades\Github; - -// Set up mock response -$mockClient = new MockClient([ - '*' => MockResponse::make([ - 'id' => 1, - 'name' => 'test-repo', - 'full_name' => 'test/test-repo', - ], 200), -]); - -// Apply mock client to GitHub connector -Github::connector()->withMockClient($mockClient); - -// Now any API calls will return the mock response -$repo = Github::repos()->get('any/repo'); -``` - -## 📖 Advanced Documentation +use JordanPartridge\GithubClient\Facades\GithubOAuth; -### Parameter Type Validation +// 1. Redirect user to GitHub +return redirect(GithubOAuth::getAuthorizationUrl(['repo', 'user'])); -This package uses PHP 8.2+ enums for parameter validation, ensuring you always pass valid values: +// 2. Handle callback +$token = GithubOAuth::getAccessToken($request->code); -```php -use JordanPartridge\GithubClient\Enums\Visibility; -use JordanPartridge\GithubClient\Enums\Sort; -use JordanPartridge\GithubClient\Enums\Direction; -use JordanPartridge\GithubClient\Enums\MergeMethod; -use JordanPartridge\GithubClient\Enums\Pulls\State; -use JordanPartridge\GithubClient\Enums\Issues\State as IssueState; -use JordanPartridge\GithubClient\Enums\Issues\Sort as IssueSort; - -// Using enums for parameter validation -$repos = Github::repos()->all( - visibility: Visibility::PUBLIC, // 'public', 'private', 'all' - sort: Sort::CREATED, // 'created', 'updated', 'pushed', 'full_name' - direction: Direction::DESC // 'asc', 'desc' -); - -// Pull request states -$openPrs = Github::pullRequests()->all( - 'jordanpartridge/github-client', - state: State::OPEN // 'open', 'closed', 'all' -); - -// Merge methods -$mergeResult = Github::pullRequests()->merge( - 'jordanpartridge', - 'github-client', - 123, - mergeMethod: MergeMethod::Squash // 'merge', 'squash', 'rebase' -); - -// Issue states and sorting -$issues = Github::issues()->forRepo( - 'jordanpartridge', - 'github-client', - state: IssueState::OPEN, // 'open', 'closed', 'all' - sort: IssueSort::CREATED // 'created', 'updated', 'comments' -); +// 3. Use their token +$github = new GithubConnector($token); +$theirRepos = $github->repos()->all(); ``` -### OAuth Authentication - -For web applications that need user authentication: - -```php -use JordanPartridge\GithubClient\Facades\GithubOAuth; - -// Get authorization URL -$authUrl = GithubOAuth::getAuthorizationUrl([ - 'repo', // Access repositories - 'user', // Access user profile - 'read:org', // Read organization access -]); +--- -// Redirect user to authorization URL -return redirect()->away($authUrl); +## Requirements -// In your callback route -$token = GithubOAuth::getAccessToken($code); +- PHP 8.2+ +- Laravel 11 or 12 -// Store the token for the authenticated user -auth()->user()->update(['github_token' => $token]); +--- -// Use the user's token for GitHub API requests -$github = new \JordanPartridge\GithubClient\GithubConnector($token); -$userRepos = $github->repos()->all(); -``` +## Contributing -## 🔧 Local Development +PRs welcome. Run tests first: ```bash -# Install dependencies -composer install - -# Run tests composer test - -# Run a specific test -vendor/bin/pest tests/ReposTest.php - -# Run static analysis -composer analyse - -# Format code -composer format ``` -## 📜 License +--- -This package is open-source software licensed under the [MIT license](LICENSE.md). +## License -## ✨ Credits +MIT. Go build something. -- [Jordan Partridge](https://github.com/jordanpartridge) -- [All Contributors](../../contributors) +--- -Built with [Saloon](https://github.com/Sammyjo20/Saloon) and [Laravel](https://laravel.com) \ No newline at end of file +**Built with [Saloon](https://github.com/Sammyjo20/Saloon)** by [Jordan Partridge](https://github.com/jordanpartridge) diff --git a/TODOS.md b/TODOS.md deleted file mode 100644 index dfc907c..0000000 --- a/TODOS.md +++ /dev/null @@ -1,36 +0,0 @@ -# GitHub Client - Current TODOs - -## In Progress -- **Address CodeRabbit review comments** (HIGH) -- **Add safety measures to auto-pagination** (MEDIUM) - Currently working on this - -## Pending - CodeRabbit Fixes -- **Create MergeResponseDTO for standardized merge response** (MEDIUM) - - Define a MergeResponseDTO (with properties like merged, sha, message, etc.) - - Change createDtoFromResponse() in src/Requests/Pulls/Merge.php to return this DTO instead of array - - Update src/Resources/PullRequestResource.php::merge() to consume the new DTO - -## Pending - Phase 2 Roadmap -- **Add GitHub App authentication support (#48)** (HIGH) - Enterprise readiness -- **Enhanced Laravel Integration for Conduit Component Support (#67)** (HIGH) - Conduit ecosystem foundation - -## Completed ✅ -- Fix auto-pagination for repository fetching (#54) -- Fix broken PullRequest tests after Laravel Data migration -- Create PR for Phase 1 improvements - -## Current Status -- PR #68 created and all CI checks passing -- Working on CodeRabbit review feedback to improve code quality -- Safety measures being added to auto-pagination (max 1000 pages limit) -- Next: Create MergeResponseDTO for consistency - -## Context -We successfully completed Phase 1 with: -- Auto-pagination feature for repositories (eliminates 30-repo limit) -- Fixed all PullRequest operations after Laravel Data migration -- All 65 tests passing with 184 assertions -- PHPStan analysis passing -- Complete backward compatibility maintained - -The PR has positive review comments and is ready for merge after addressing these quality improvements. \ No newline at end of file diff --git a/WorkLog/12-10-2024.md b/WorkLog/12-10-2024.md deleted file mode 100644 index 08b3776..0000000 --- a/WorkLog/12-10-2024.md +++ /dev/null @@ -1,5 +0,0 @@ -# Work Log for 12-10-2024: -- [x] Create pull request [index request](src/Requests/Pulls/Index.php) -- [X] update to the correct url and method referencing: https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28 -- [X] Setup constructor parameters with the appropriate optionality -- [X] Utilize enums where appropriate diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon deleted file mode 100644 index e69de29..0000000