Class: Rubino::Tools::GitHubTool

Inherits:
Base
  • Object
show all
Defined in:
lib/rubino/tools/github_tool.rb

Overview

Tool for GitHub/GitLab operations: PRs, issues, reviews. Uses GitHub CLI (gh) if available, otherwise uses the API directly.

Instance Attribute Summary

Attributes inherited from Base

#cancel_token, #read_tracker, #stream_chunk

Instance Method Summary collapse

Methods inherited from Base

#cancellation_requested?, #config_key, #emit_chunk, #risky?, #to_tool_definition, workspace_root, workspace_roots

Instance Method Details

#call(arguments) ⇒ Object



64
65
66
67
68
69
70
71
72
# File 'lib/rubino/tools/github_tool.rb', line 64

def call(arguments)
  action = arguments["action"] || arguments[:action]

  if gh_available?
    execute_gh(action, arguments)
  else
    execute_api(action, arguments)
  end
end

#descriptionObject



16
17
18
19
# File 'lib/rubino/tools/github_tool.rb', line 16

def description
  "Interact with GitHub: create/list PRs, issues, reviews, check status. " \
    "Requires GITHUB_TOKEN or gh CLI authenticated."
end

#input_schemaObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rubino/tools/github_tool.rb', line 21

def input_schema
  {
    type: "object",
    properties: {
      action: {
        type: "string",
        enum: %w[pr_create pr_list pr_view issue_create issue_list issue_view
                 pr_checks pr_diff repo_view release_list],
        description: "The GitHub action to perform"
      },
      title: {
        type: "string",
        description: "Title (for pr_create, issue_create)"
      },
      body: {
        type: "string",
        description: "Body/description (for pr_create, issue_create)"
      },
      number: {
        type: "integer",
        description: "PR or issue number (for view/checks/diff)"
      },
      repo: {
        type: "string",
        description: "Repository in owner/name format (optional, auto-detects from git remote)"
      },
      base: {
        type: "string",
        description: "Base branch for PR (default: main)"
      },
      labels: {
        type: "string",
        description: "Comma-separated labels"
      }
    },
    required: %w[action]
  }
end

#nameObject



12
13
14
# File 'lib/rubino/tools/github_tool.rb', line 12

def name
  "github"
end

#risk_levelObject



60
61
62
# File 'lib/rubino/tools/github_tool.rb', line 60

def risk_level
  :medium
end