pull-pal/pullpal/common.go
Moby von Briesen 6c42bbd7b8 Implement Github client
Added "version control client" interface and created a Github
implementation of it. Right now it only creates pull requests and lists
issues.

Restructued some code. Idk if it will be permanent.

Next I plan to add behavior around replacing files in the local repo,
and creating commits.
2023-04-22 16:23:56 -04:00

36 lines
746 B
Go

package pullpal
import (
"context"
"github.com/mobyvb/pull-pal/vc"
"go.uber.org/zap"
)
// PullPal is the service responsible for:
// * Interacting with git server (e.g. reading issues and making PRs on Github)
// * Generating LLM prompts
// * Parsing LLM responses
// * Interacting with LLM (e.g. with GPT via OpenAI API)
type PullPal struct {
ctx context.Context
log *zap.Logger
vcClient vc.VCClient
}
func NewPullPal(ctx context.Context, log *zap.Logger, self vc.Author, repo vc.Repository) (*PullPal, error) {
ghClient, err := vc.NewGithubClient(ctx, log, self, repo)
if err != nil {
log.Error("Failed to setup Github client.", zap.Error(err))
}
return &PullPal{
ctx: ctx,
log: log,
vcClient: ghClient,
}, nil
}