Help us shape the future of Go! Take the 2026 Go Developer Survey

pullrequestreviewcontext

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 10 Imported by: 0

README

pull-request-review-context

Pull request review comment と、そのコメントが指しているコード行だけを抽出するCLIです。 LLMへ渡すことを想定し、差分全体やpull request本文などの重複情報は出力しません。

前提

  • Go 1.26.1以上
  • GitHub CLI (gh)
  • gh auth login 済みであること

使い方

カレントディレクトリのリポジトリを対象にする場合:

go run ./cmd/pull-request-review-context 123

リポジトリを明示する場合:

go run ./cmd/pull-request-review-context --repository OWNER/REPOSITORY 123

標準出力は、ファイル名・行番号・対象コード行・レビュー本文だけです。

file: internal/example.go
line: 42

code:
return value, nil

review:
エラー処理を追加してください

機械処理用にはJSONを指定できます。

go run ./cmd/pull-request-review-context --format json 123

ファイル単位のコメントや対象行を持たないコメントは、コード行を抽出できないため出力しません。

実在するOSSのレビューコメントを使う統合テストも用意しています。gh auth login 済みの環境で実行してください。

go test -tags integration ./...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CLI struct {
	Repository  string           `name:"repository" short:"R" help:"GitHub repository in OWNER/REPOSITORY format." env:"GITHUB_REPOSITORY"`
	Format      string           `name:"format" help:"Output format." enum:"llm,json" default:"llm"`
	PullRequest int              `arg:"" name:"pull-request" help:"Pull request number."`
	Version     kong.VersionFlag `name:"version" help:"Print version information and quit."`
}

Functions

func Execute

func Execute(ctx context.Context, writer io.Writer, client gh.Client, options Options) error

func Run

func Run() error

Types

type Options

type Options struct {
	Repository  string
	Format      string
	PullRequest int
}

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL