8000 Add GitLab tools. by cloudnautique · Pull Request #5 · obot-platform/tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add GitLab tools. #5

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

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions apis/gitlab/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# GitLab API Assistant

Initial work on a GitLab assistant. Tested against GPT-4o and public GitLab instance.< 10000 /span>

## Overview

This is a GitLab Assistant that can interact with the public GitLab instance. It currently provides tools to work with projects, repositories, and merge_requests. It leverages the openapi.yaml spec in this repository to build out the assistant with each Agent having a set of tools to interact with the resource in the GitLab API.

## Capabilities

The GitLab Assistant can interact with the following resources:

### GitLab Agent

- **Main entrypoint for GitLab Agent**: Understands all things GitLab, source control, CI/CD, and general DevOps best practices.

### Tools

#### Pipelines

- **Operations related to pipelines**: Creating, listing, updating, and deleting pipelines and jobs in GitLab.

#### Projects

- **Operations related to projects**: Creating, listing, updating, and deleting projects in GitLab. Does not cover all things projects.

#### Repositories

- **Operations related to repositories**: Creating, listing, updating, and deleting repositories in GitLab. This also provides access to branches etc.

#### Merge Requests

- **Operations related to merge requests**: Creating, listing, updating, and deleting merge requests in GitLab. You can also comment, close, merge and check the status of the builds/pipelines.

## Adding a new Tool

When adding a new tool to this repo, clone this tool to your local machine.

Then add a directory for the new resource/tool.

In the tool file, you should leverage the existing `../context/tool.gpt` and create a new file.

Tools should be a subset and focus on a single resource because there are to many endpoints to cover in a single script.

Example

```
Name: resource_name
Description: Interact with XYZ in GitLab
Context: ../context/tool.gpt
Tools: *resources* from openapi.yaml
Credentials: github.com/gptscript-ai/gateway-oauth2 as gitlab.comBearerAuth with GPTSCRIPT_GITLAB_COM_BEARER_TOKEN as env and GitLab as integration and "api read_user"

Handle the users requests for XYZ in gitlab
```
10 changes: 10 additions & 0 deletions apis/gitlab/agent.gpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Chat: true
Name: GitLab Agent
Description: Main entrypoint for GitLab Agent
Context: ./context/agent.gpt
Tools: ./pipelines/tool.gpt, ./projects/tool.gpt, ./repositories/tool.gpt, ./merge_requests/tool.gpt, ./project_issues/tool.gpt
Credentials: github.com/gptscript-ai/gateway-oauth2 as gitlab.comBearerAuth with GPTSCRIPT_GITLAB_COM_BEARER_TOKEN as env and GitLab as integration and "api read_user" as scope

You understand All things GitLab, source control, CI/CD, and general DevOps best practices.
You have a deep understanding of software development.
You are also an API architect familiar with swagger and openapi specs.
27 changes: 27 additions & 0 deletions apis/gitlab/context/agent.gpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Name: GitLab Agent Context
Description: High level context for gitlab, and sets up core capabilities


Share Context: github.com/gptscript-ai/context/cli
Share Context: github.com/gptscript-ai/context/chat-summary
Share Context: github.com/gptscript-ai/context/chat-finish
Share Context: github.com/gptscript-ai/context/workspace
Share Context: github.com/gptscript-ai/context/os
Share Context: github.com/gptscript-ai/context/filesystem
Context: ./tool.gpt

Share Tools: sys.time.now
Share Tools: github.com/gptscript-ai/answers-from-the-internet


#!sys.echo

You are a helpful expert SRE, with a deep background in devops. You are very good at running CLIs,
have a deep understanding of APIs, CI/CD and other pipeline management capabilities.

Rules:
Always run tools serially.
Always ask what the user would like to do next if there is an empty prompt. If something doesn't look right,
Ask the user if they want to troubleshoot further.
If there is an issue with a project not found, look up the users projects and ask them if they meant any of them.
If there is an empty prompt, ask them what the wish to do next.
15 changes: 15 additions & 0 deletions apis/gitlab/context/tool.gpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Name: GitLab Tool Context
Description: High level context for GitLab tools.


Share Context: github.com/gptscript-ai/context/os
Share Context: github.com/gptscript-ai/context/filesystem
Share Tools: sys.time.now


#!sys.echo

Always follow these GitLab Paradigms:
Ids are numerical or paths that have <owner>/<project>
Always URL encode paths when used as an ID
Use default options for the API calls unless it directly addresses the users request
7 changes: 7 additions & 0 deletions apis/gitlab/merge_requests/tool.gpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Name: Merge Request Agent
Context: ../context/tool.gpt
Description: Interact with MergeRequest Objects in GitLab
Tools: *MergeRequests* from ../openapi.yaml
Credentials: github.com/gptscript-ai/gateway-oauth2 as gitlab.comBearerAuth with GPTSCRIPT_GITLAB_COM_BEARER_TOKEN as env and GitLab as integration and "api read_user"

Help the user with merge request tasks
Loading
0