Class: Tools::OpenIssue

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

Overview

Opens a GitHub issue on Anima’s repository via the gh CLI, giving the agent a voice to report bugs, pain points, or ideas. Every issue is tagged with the label from [github] label in config.toml so maintainers can filter agent-originated issues.

The repository is read from [github] repo in config.toml; when unset, the tool falls back to parsing the origin remote URL.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, schema, truncation_threshold

Constructor Details

This class inherits a constructor from Tools::Base

Class Method Details

.descriptionString

Returns description shown to the LLM.

Returns:

  • (String)

    description shown to the LLM



20
# File 'lib/tools/open_issue.rb', line 20

def self.description = "Something broken, missing, or could be better in Anima? Say it here."

.input_schemaHash

Returns JSON Schema for the tool’s input parameters.

Returns:

  • (Hash)

    JSON Schema for the tool’s input parameters



23
24
25
26
27
28
29
30
31
32
# File 'lib/tools/open_issue.rb', line 23

def self.input_schema
  {
    type: "object",
    properties: {
      title: {type: "string"},
      description: {type: "string", description: "Use gh-issue skill for guidance."}
    },
    required: %w[title description]
  }
end

.tool_nameString

Returns tool identifier used in the Anthropic API schema.

Returns:

  • (String)

    tool identifier used in the Anthropic API schema



17
# File 'lib/tools/open_issue.rb', line 17

def self.tool_name = "open_issue"

Instance Method Details

#execute(input) ⇒ String, Hash{Symbol => String}

Parameters:

  • input (Hash<String, Object>)

    with “title” and “description” keys

Returns:

  • (String)

    formatted gh command output (stdout, stderr, and exit code if non-zero)

  • (Hash{Symbol => String})

    with :error key on validation or repo resolution failure



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/tools/open_issue.rb', line 37

def execute(input)
  title = input["title"].to_s.strip
  description = input["description"].to_s.strip
  return {error: "Title cannot be blank"} if title.empty?
  return {error: "Description cannot be blank"} if description.empty?

  repo = resolve_repo
  return repo if repo.is_a?(Hash)

  run_gh(repo, title, description)
end