diff --git a/internal/cli/command/pull_requests/summarize.go b/internal/cli/command/pull_requests/summarize.go index 86493d3..0977876 100644 --- a/internal/cli/command/pull_requests/summarize.go +++ b/internal/cli/command/pull_requests/summarize.go @@ -6,7 +6,7 @@ import ( "github.com/Tomas-vilte/MateCommit/internal/cli/completion_helper" cfg "github.com/Tomas-vilte/MateCommit/internal/config" - "github.com/Tomas-vilte/MateCommit/internal/infrastructure/factory" + "github.com/Tomas-vilte/MateCommit/internal/domain/ports" "github.com/Tomas-vilte/MateCommit/internal/ui" "github.com/Tomas-vilte/MateCommit/internal/i18n" @@ -14,12 +14,12 @@ import ( ) type SummarizeCommand struct { - prFactory factory.PRServiceFactoryInterface + prService ports.PRService } -func NewSummarizeCommand(prFactory factory.PRServiceFactoryInterface) *SummarizeCommand { +func NewSummarizeCommand(prService ports.PRService) *SummarizeCommand { return &SummarizeCommand{ - prFactory: prFactory, + prService: prService, } } @@ -38,9 +38,8 @@ func (c *SummarizeCommand) CreateCommand(t *i18n.Translations, _ *cfg.Config) *c }, ShellComplete: completion_helper.DefaultFlagComplete, Action: func(ctx context.Context, cmd *cli.Command) error { - prService, err := c.prFactory.CreatePRService(ctx) - if err != nil { - return fmt.Errorf(t.GetMessage("error.pr_service_creation_error", 0, nil)+": %w", err) + if c.prService == nil { + return fmt.Errorf("%s", t.GetMessage("ai_missing.ai_missing_for_pr", 0, nil)) } prNumber := cmd.Int("pr-number") if prNumber == 0 { @@ -52,7 +51,7 @@ func (c *SummarizeCommand) CreateCommand(t *i18n.Translations, _ *cfg.Config) *c })) spinner.Start() - summary, err := prService.SummarizePR(ctx, prNumber, func(msg string) { + summary, err := c.prService.SummarizePR(ctx, prNumber, func(msg string) { spinner.Log(msg) }) if err != nil { diff --git a/matecommit b/matecommit new file mode 100755 index 0000000..32717f5 Binary files /dev/null and b/matecommit differ