From d4b0b9050274728c043a83a00d45ab2ff7f335c0 Mon Sep 17 00:00:00 2001 From: Koda Date: Sun, 24 May 2026 20:50:09 +0000 Subject: [PATCH] Expose suggested branch name in ticket responses --- app/Http/Resources/TicketResource.php | 2 ++ tests/Feature/Api/TicketApiTest.php | 5 ++++- tests/Feature/Mcp/KanbanGitMcpTest.php | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Resources/TicketResource.php b/app/Http/Resources/TicketResource.php index 88368f4..a0b7596 100644 --- a/app/Http/Resources/TicketResource.php +++ b/app/Http/Resources/TicketResource.php @@ -2,6 +2,7 @@ namespace App\Http\Resources; +use App\Actions\Git\BuildSuggestedTicketBranchName; use App\Actions\Tickets\Support\AcceptanceCriteriaChecklistMapper; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; @@ -53,6 +54,7 @@ class TicketResource extends JsonResource 'project_id' => $this->project_id, 'sequence_number' => $this->sequence_number, 'story_points' => $this->story_points, + 'suggested_branch_name' => app(BuildSuggestedTicketBranchName::class)->handle($this->resource), 'ticket_key' => $this->ticket_key, 'ticket_priority' => $this->whenLoaded( 'ticketPriority', diff --git a/tests/Feature/Api/TicketApiTest.php b/tests/Feature/Api/TicketApiTest.php index 50fbb50..a5d8505 100644 --- a/tests/Feature/Api/TicketApiTest.php +++ b/tests/Feature/Api/TicketApiTest.php @@ -65,6 +65,7 @@ class TicketApiTest extends TestCase ->assertCreated() ->assertJsonPath('data.ticket_key', 'CORE-1') ->assertJsonPath('data.acceptance_criteria.1.indent', 1) + ->assertJsonPath('data.suggested_branch_name', 'core-1-api-ticket') ->assertJsonPath('meta.message', 'CORE-1 was created.'); $ticket = Ticket::query()->findOrFail($createResponse->json('data.id')); @@ -101,7 +102,9 @@ class TicketApiTest extends TestCase ->getJson(route('api.projects.tickets.show', [$project, $ticket])) ->assertOk() ->assertJsonPath('data.ticket.ticket_key', 'CORE-1') - ->assertJsonPath('data.ticket.story_points', 5); + ->assertJsonPath('data.ticket.story_points', 5) + ->assertJsonPath('data.ticket.suggested_branch_name', 'core-1-updated-api-ticket') + ->assertJsonPath('data.suggestedBranchName', 'core-1-updated-api-ticket'); } public function test_ticket_update_hides_author_for_non_admins_when_author_visibility_is_disabled(): void diff --git a/tests/Feature/Mcp/KanbanGitMcpTest.php b/tests/Feature/Mcp/KanbanGitMcpTest.php index f5dde21..59adf59 100644 --- a/tests/Feature/Mcp/KanbanGitMcpTest.php +++ b/tests/Feature/Mcp/KanbanGitMcpTest.php @@ -203,6 +203,7 @@ class KanbanGitMcpTest extends TestCase ->where('data.project.name', 'Core project') ->where('data.ticket.ticket_key', 'CORE-1') ->where('data.ticket.description', 'Detailed MCP description') + ->where('data.ticket.suggested_branch_name', 'core-1-detailed-ticket') ->etc()); }