GitHubTools

Reusable GitHub function tools backed by the org.kohsuke:github-api client. Each returns a Map with a status of "success" or "error". Reads GITHUB_TOKEN from the environment; callers set dryRun to gate writes.

Defense in depth against prompt injection: the agent reads untrusted GitHub content (diffs, file contents, issue/PR titles) and could be steered into harmful writes. Independently of the prompt, the write tools (a) only target writeRepoOwner/writeRepoName when set, (b) only modify Markdown files under docs/, and (c) are capped per run.

Properties

Link copied to clipboard

When true, create_issue/create_pull_request return a preview instead of writing.

Link copied to clipboard
Link copied to clipboard

When both are set, create_issue/create_pull_request refuse to write to any other repository, regardless of the owner/repo the model passes. Set by the entry point to the docs repository so untrusted content cannot redirect writes elsewhere.

Functions

Link copied to clipboard
fun createIssue(repoOwner: String, repoName: String, title: String, body: String): Map<String, Any>

Creates a new issue with the "docs updates" label.

Link copied to clipboard
fun createPullRequest(repoOwner: String, repoName: String, baseBranch: String, filePaths: List<String>, newContents: List<String>, title: String, body: String): Map<String, Any>

Opens ONE pull request for a recommendation, updating one or more documentation files.

Link copied to clipboard
fun findDocIssues(repoOwner: String, repoName: String, codeRepo: String): Map<String, Any>

Lists open issues carrying the "docs updates" label, to avoid filing duplicates.

Link copied to clipboard
fun findPullRequestsForIssue(repoOwner: String, repoName: String, issueNumber: Int): Map<String, Any>

Lists open PRs referencing an issue number, to check whether it already has PRs.

Link copied to clipboard
fun getChangedFiles(repoOwner: String, repoName: String, startTag: String, endTag: String, pathFilter: String? = null): Map<String, Any>

Lists files changed between two release tags, optionally filtered to a path prefix.

Link copied to clipboard
fun getFileContent(repoOwner: String, repoName: String, filePath: String): Map<String, Any>

Reads and returns the raw content of a file.

Link copied to clipboard
fun getFileDiff(repoOwner: String, repoName: String, startTag: String, endTag: String, filePath: String): Map<String, Any>

Gets the patch/diff for a single file between two release tags.

Link copied to clipboard
fun listReleases(repoOwner: String, repoName: String): Map<String, Any>

Lists releases for a repository (most recent first) with their tag_name and name.

Link copied to clipboard
fun searchCode(repoOwner: String, repoName: String, query: String): Map<String, Any>

Searches a repository's content via the GitHub code search API.