Merge pull request 'Add suggested branch name to API and MCP ticket responses' (#84) from koda/ticket-suggested-branch-name-api-mcp into main
linter / quality (push) Successful in 1m28s
tests / ci (8.4) (push) Successful in 1m53s

Reviewed-on: OpenSource/KanbanGit#84
This commit was merged in pull request #84.
This commit is contained in:
2026-05-24 20:56:17 +00:00
3 changed files with 7 additions and 1 deletions
+2
View File
@@ -2,6 +2,7 @@
namespace App\Http\Resources; namespace App\Http\Resources;
use App\Actions\Git\BuildSuggestedTicketBranchName;
use App\Actions\Tickets\Support\AcceptanceCriteriaChecklistMapper; use App\Actions\Tickets\Support\AcceptanceCriteriaChecklistMapper;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
@@ -53,6 +54,7 @@ class TicketResource extends JsonResource
'project_id' => $this->project_id, 'project_id' => $this->project_id,
'sequence_number' => $this->sequence_number, 'sequence_number' => $this->sequence_number,
'story_points' => $this->story_points, 'story_points' => $this->story_points,
'suggested_branch_name' => app(BuildSuggestedTicketBranchName::class)->handle($this->resource),
'ticket_key' => $this->ticket_key, 'ticket_key' => $this->ticket_key,
'ticket_priority' => $this->whenLoaded( 'ticket_priority' => $this->whenLoaded(
'ticketPriority', 'ticketPriority',
+4 -1
View File
@@ -65,6 +65,7 @@ class TicketApiTest extends TestCase
->assertCreated() ->assertCreated()
->assertJsonPath('data.ticket_key', 'CORE-1') ->assertJsonPath('data.ticket_key', 'CORE-1')
->assertJsonPath('data.acceptance_criteria.1.indent', 1) ->assertJsonPath('data.acceptance_criteria.1.indent', 1)
->assertJsonPath('data.suggested_branch_name', 'core-1-api-ticket')
->assertJsonPath('meta.message', 'CORE-1 was created.'); ->assertJsonPath('meta.message', 'CORE-1 was created.');
$ticket = Ticket::query()->findOrFail($createResponse->json('data.id')); $ticket = Ticket::query()->findOrFail($createResponse->json('data.id'));
@@ -101,7 +102,9 @@ class TicketApiTest extends TestCase
->getJson(route('api.projects.tickets.show', [$project, $ticket])) ->getJson(route('api.projects.tickets.show', [$project, $ticket]))
->assertOk() ->assertOk()
->assertJsonPath('data.ticket.ticket_key', 'CORE-1') ->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 public function test_ticket_update_hides_author_for_non_admins_when_author_visibility_is_disabled(): void
+1
View File
@@ -203,6 +203,7 @@ class KanbanGitMcpTest extends TestCase
->where('data.project.name', 'Core project') ->where('data.project.name', 'Core project')
->where('data.ticket.ticket_key', 'CORE-1') ->where('data.ticket.ticket_key', 'CORE-1')
->where('data.ticket.description', 'Detailed MCP description') ->where('data.ticket.description', 'Detailed MCP description')
->where('data.ticket.suggested_branch_name', 'core-1-detailed-ticket')
->etc()); ->etc());
} }