Skip to content

Commit 8d3fa6a

Browse files
committed
fix: fetch up to 200 projects for name resolution
The default page size could miss projects beyond the first page. Request a large limit to cover typical org sizes. Made-with: Cursor
1 parent 4024bbb commit 8d3fa6a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cmd/root.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/kernel/cli/pkg/util"
1919
"github.com/kernel/kernel-go-sdk"
2020
"github.com/kernel/kernel-go-sdk/option"
21+
"github.com/kernel/kernel-go-sdk/packages/param"
2122
"github.com/pterm/pterm"
2223
"github.com/spf13/cobra"
2324
)
@@ -264,7 +265,10 @@ func looksLikeCUID(s string) bool {
264265
// one whose name matches (case-insensitive). Returns an error if no match or
265266
// multiple matches are found.
266267
func resolveProjectByName(ctx context.Context, client kernel.Client, name string) (string, error) {
267-
projects, err := client.Projects.List(ctx, kernel.ProjectListParams{})
268+
const maxProjects = 200
269+
projects, err := client.Projects.List(ctx, kernel.ProjectListParams{
270+
Limit: param.NewOpt(int64(maxProjects)),
271+
})
268272
if err != nil {
269273
return "", fmt.Errorf("failed to resolve project name %q: %w", name, err)
270274
}

0 commit comments

Comments
 (0)