-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: gitlab tools #314
base: main
Are you sure you want to change the base?
chore: gitlab tools #314
Conversation
Signed-off-by: Taylor Price <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments, but I don't want to hold this PR up on them.
@@ -0,0 +1,7 @@ | |||
Name: GitLab Credential | |||
Share Credential: github.com/gptscript-ai/credential as gitlabToken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we'll probably want to pull this into the tools repo at some point
fmt.Printf("* Issue #%d: %s\n", issue.IID, issue.Title) | ||
fmt.Printf(" Issue ID: %d\n", issue.ID) | ||
fmt.Printf(" Project Name: %s\n", project.Name) | ||
fmt.Printf(" Project ID: %d\n", issue.ProjectID) | ||
fmt.Printf(" State: %s\n", issue.State) | ||
fmt.Printf(" Author Username: %s\n", issue.Author.Username) | ||
fmt.Printf(" Author ID: %d\n", issue.Author.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Where do we stand on returning minified JSON output vs custom plain text structures like this? In my experience returning minified JSON to the LLM yields pretty good results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we have an official stance, but this is how we have formatted the data in a few other places.
query, err = parseStringToMap(rawQuery) | ||
if err != nil { | ||
fmt.Printf("Failed to parse ISSUE_QUERY: %v\n", err) | ||
os.Exit(1) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if you factor this switch out into a separate function, you can return errors and have a single fmt.Println(err); os.Exit(1);
in main()
.
#!${GPTSCRIPT_TOOL_DIR}/bin/gptscript-go-tool approveMergeRequest | ||
|
||
--- | ||
Name: Lookup User ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: may also be nice to have a Search Users
tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, but it was not part of the scope in the original issue. Lookup User ID
exists only to get the user ID for calls that require a numeric ID instead of accepting a username.
Description: Takes a username and returns the ID for that user. | ||
Share Context: GitLab Context | ||
Credential: ./credential | ||
Param: gitlab_username: A GitLab username. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we expect this tool to get called a lot? If so, I'd consider optimizing it by making this tool a bulk operation that retrieves a list of user IDs given a set of usernames.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I don't think it would be called very often. Most operations accept a username, but there's one or two that require the numeric ID. Those sorts of calls wouldn't typically need to get a bunch of IDs at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: these should be added to the top-level .gitignore
file.
lines := strings.Split(s, "\n") | ||
for i, line := range lines { | ||
lines[i] = " " + line | ||
} | ||
return strings.Join(lines, "\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is slightly more efficient?
lines := strings.Split(s, "\n") | |
for i, line := range lines { | |
lines[i] = " " + line | |
} | |
return strings.Join(lines, "\n") | |
return " " + strings.ReplaceAll(s, "\n", "\n ") |
|
||
notes, _, err := client.Notes.ListIssueNotes(projectID, issueIID, &gitlab.ListIssueNotesOptions{}) | ||
if err != nil { | ||
log.Fatalf("Failed to fetch issue notes: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just return this error and have the top-level error handling do it?
relates to obot-platform/obot#866