diff --git a/cmd/goose/cache.go b/cmd/goose/cache.go index bb38d5d..a7f1b3a 100644 --- a/cmd/goose/cache.go +++ b/cmd/goose/cache.go @@ -14,7 +14,7 @@ import ( "time" "github.com/codeGROOVE-dev/retry" - "github.com/ready-to-review/turnclient/pkg/turn" + "github.com/codeGROOVE-dev/turnclient/pkg/turn" ) type cacheEntry struct { diff --git a/cmd/goose/github.go b/cmd/goose/github.go index 74e24f4..d7e17c4 100644 --- a/cmd/goose/github.go +++ b/cmd/goose/github.go @@ -15,8 +15,8 @@ import ( "time" "github.com/codeGROOVE-dev/retry" + "github.com/codeGROOVE-dev/turnclient/pkg/turn" "github.com/google/go-github/v57/github" - "github.com/ready-to-review/turnclient/pkg/turn" "golang.org/x/oauth2" ) @@ -42,8 +42,8 @@ func (app *App) initClients(ctx context.Context) error { tc := oauth2.NewClient(ctx, ts) app.client = github.NewClient(tc) - // Initialize Turn client with base URL - turnClient, err := turn.NewClient("https://turn.ready-to-review.dev") + // Initialize Turn client using default backend + turnClient, err := turn.NewDefaultClient() if err != nil { return fmt.Errorf("create turn client: %w", err) } @@ -450,7 +450,7 @@ func (app *App) fetchTurnDataSync(ctx context.Context, issues []*github.Issue, u cacheHits := 0 for result := range results { - if result.err == nil && result.turnData != nil && result.turnData.PRState.UnblockAction != nil { + if result.err == nil && result.turnData != nil && result.turnData.Analysis.NextAction != nil { turnSuccesses++ if result.wasFromCache { cacheHits++ @@ -460,13 +460,15 @@ func (app *App) fetchTurnDataSync(ctx context.Context, issues []*github.Issue, u // Check if user needs to review and get action reason needsReview := false + isBlocked := false actionReason := "" - if action, exists := result.turnData.PRState.UnblockAction[user]; exists { + if action, exists := result.turnData.Analysis.NextAction[user]; exists { needsReview = true + isBlocked = action.Critical // Only critical actions are blocking actionReason = action.Reason // Only log fresh API calls if !result.wasFromCache { - slog.Debug("[TURN] UnblockAction", "url", result.url, "reason", action.Reason, "kind", action.Kind) + slog.Debug("[TURN] NextAction", "url", result.url, "reason", action.Reason, "kind", action.Kind, "critical", action.Critical) } } @@ -475,7 +477,7 @@ func (app *App) fetchTurnDataSync(ctx context.Context, issues []*github.Issue, u for i := range *outgoing { if (*outgoing)[i].URL == result.url { (*outgoing)[i].NeedsReview = needsReview - (*outgoing)[i].IsBlocked = needsReview + (*outgoing)[i].IsBlocked = isBlocked (*outgoing)[i].ActionReason = actionReason break } diff --git a/cmd/goose/main.go b/cmd/goose/main.go index 9603af9..1df28dd 100644 --- a/cmd/goose/main.go +++ b/cmd/goose/main.go @@ -17,9 +17,9 @@ import ( "time" "github.com/codeGROOVE-dev/retry" + "github.com/codeGROOVE-dev/turnclient/pkg/turn" "github.com/energye/systray" "github.com/google/go-github/v57/github" - "github.com/ready-to-review/turnclient/pkg/turn" ) // Version information - set during build with -ldflags. diff --git a/go.mod b/go.mod index 6ab258d..1f64138 100644 --- a/go.mod +++ b/go.mod @@ -4,15 +4,16 @@ go 1.24.0 require ( github.com/codeGROOVE-dev/retry v1.2.0 + github.com/codeGROOVE-dev/turnclient v0.0.0-20250922145707-664c2dcdf5b8 github.com/energye/systray v1.0.2 github.com/gen2brain/beeep v0.11.1 github.com/google/go-github/v57 v57.0.0 - github.com/ready-to-review/turnclient v0.0.0-20250804200718-023200511dab golang.org/x/oauth2 v0.31.0 ) require ( git.sr.ht/~jackmordaunt/go-toast v1.1.2 // indirect + github.com/codeGROOVE-dev/prx v0.0.0-20250908203157-0711b3ec5471 // indirect github.com/esiqveland/notify v0.13.3 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect @@ -24,5 +25,5 @@ require ( github.com/sergeymakinen/go-ico v1.0.0-beta.0 // indirect github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c // indirect - golang.org/x/sys v0.35.0 // indirect + golang.org/x/sys v0.36.0 // indirect ) diff --git a/go.sum b/go.sum index 7ef6762..602cf07 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,11 @@ git.sr.ht/~jackmordaunt/go-toast v1.1.2 h1:/yrfI55LRt1M7H1vkaw+NaH1+L1CDxrqDltwm5euVuE= git.sr.ht/~jackmordaunt/go-toast v1.1.2/go.mod h1:jA4OqHKTQ4AFBdwrSnwnskUIIS3HYzlJSgdzCKqfavo= +github.com/codeGROOVE-dev/prx v0.0.0-20250908203157-0711b3ec5471 h1:CbUa70O+iNC9rPk5aoZGs/RZbpmPyfNydv5ncKLdOvk= +github.com/codeGROOVE-dev/prx v0.0.0-20250908203157-0711b3ec5471/go.mod h1:7qLbi18baOyS8yO/6/64SBIqtyzSzLFdsDST15NPH3w= github.com/codeGROOVE-dev/retry v1.2.0 h1:xYpYPX2PQZmdHwuiQAGGzsBm392xIMl4nfMEFApQnu8= github.com/codeGROOVE-dev/retry v1.2.0/go.mod h1:8OgefgV1XP7lzX2PdKlCXILsYKuz6b4ZpHa/20iLi8E= +github.com/codeGROOVE-dev/turnclient v0.0.0-20250922145707-664c2dcdf5b8 h1:3088TLJGgxzjM/bR1gafKQ609NMkBNlZe1Fd5SnRrrY= +github.com/codeGROOVE-dev/turnclient v0.0.0-20250922145707-664c2dcdf5b8/go.mod h1:7lBF4vS6T+D1rNjmJ+CNVrXALQvdwNfBVEy7vhIQtYk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -29,8 +33,6 @@ github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/ready-to-review/turnclient v0.0.0-20250804200718-023200511dab h1:8UppuvcSCqg/djzBRXu19P9hEn8yCmoIWIQZLevlUFk= -github.com/ready-to-review/turnclient v0.0.0-20250804200718-023200511dab/go.mod h1:0irrOtjtAxH3st+RktW2Gr9Telf8fn/zd4+LK5X7X6A= github.com/sergeymakinen/go-bmp v1.0.0 h1:SdGTzp9WvCV0A1V0mBeaS7kQAwNLdVJbmHlqNWq0R+M= github.com/sergeymakinen/go-bmp v1.0.0/go.mod h1:/mxlAQZRLxSvJFNIEGGLBE/m40f3ZnUifpgVDlcUIEY= github.com/sergeymakinen/go-ico v1.0.0-beta.0 h1:m5qKH7uPKLdrygMWxbamVn+tl2HfiA3K6MFJw4GfZvQ= @@ -50,8 +52,8 @@ golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo= golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= -golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= +golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=