chromium

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package chromium provides clients for the various Chromium developer APIs: Code Search, Gitiles, Gerrit, LUCI, the issue tracker, and reviewer suggestions.

All exported methods on Client return (string, error). The string is always Markdown-formatted text ready to be handed back to an MCP caller. A non-nil error indicates an unexpected programming error; user-visible API errors are reported as formatted text with a nil error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the shared HTTP client used by all Chromium API operations. Construct with NewClient or NewClientWithHTTPDoer.

func NewClient

func NewClient() *Client

NewClient returns a Client with default settings (30 s timeout, 100-entry cache).

func NewClientWithHTTPDoer

func NewClientWithHTTPDoer(h HTTPDoer) *Client

NewClientWithHTTPDoer returns a Client that uses the supplied HTTPDoer. Intended for tests that inject a mock transport.

func (*Client) FindOwners

func (c *Client) FindOwners(ctx context.Context, input FindOwnersInput) (string, error)

FindOwners finds and displays OWNERS files for a given file path.

func (*Client) FindSymbol

func (c *Client) FindSymbol(ctx context.Context, input FindSymbolInput) (string, error)

FindSymbol looks up a symbol's definitions, class, function, and usage examples.

func (*Client) GetBotErrors

func (c *Client) GetBotErrors(ctx context.Context, input GetBotErrorsInput, project string) (string, error)

GetBotErrors fetches detailed error messages from failed try-bots for a CL.

func (*Client) GetCIBuildErrors

func (c *Client) GetCIBuildErrors(ctx context.Context, input GetCIBuildErrorsInput) (string, error)

GetCIBuildErrors fetches detailed test failure information from a CI build.

func (*Client) GetCLComments

func (c *Client) GetCLComments(ctx context.Context, input GetCLCommentsInput, project string) (string, error)

GetCLComments returns formatted review comments for a Gerrit CL patchset.

func (*Client) GetCLDiff

func (c *Client) GetCLDiff(ctx context.Context, input GetCLDiffInput, project string) (string, error)

GetCLDiff returns the diff for a Gerrit CL patchset.

func (*Client) GetCLStatus

func (c *Client) GetCLStatus(ctx context.Context, input GetCLStatusInput, project string) (string, error)

GetCLStatus returns a formatted status summary for a Gerrit CL.

func (*Client) GetFile

func (c *Client) GetFile(ctx context.Context, input GetFileInput) (string, error)

GetFile returns the content of a Chromium source file.

func (*Client) GetIssue

func (c *Client) GetIssue(ctx context.Context, input GetIssueInput) (string, error)

GetIssue fetches a single Chromium bug from issues.chromium.org.

func (*Client) GetPatchsetFile

func (c *Client) GetPatchsetFile(ctx context.Context, input GetPatchsetFileInput, project string) (string, error)

GetPatchsetFile returns the content of a specific file from a Gerrit patchset.

func (*Client) GetTrybotStatus

func (c *Client) GetTrybotStatus(ctx context.Context, input GetTrybotStatusInput, project string) (string, error)

GetTrybotStatus returns the try-bot status for a Gerrit CL.

func (*Client) ListCLs

func (c *Client) ListCLs(ctx context.Context, input ListCLsInput, project string) (string, error)

ListCLs returns a list of Gerrit CLs matching the given query.

func (*Client) ListFolder

func (c *Client) ListFolder(ctx context.Context, input ListFolderInput) (string, error)

ListFolder returns the contents of a directory in the Chromium source tree.

func (*Client) SearchCode

func (c *Client) SearchCode(ctx context.Context, input SearchCodeInput) (string, error)

SearchCode searches Chromium source using the Code Search API.

func (*Client) SearchCommits

func (c *Client) SearchCommits(ctx context.Context, input SearchCommitsInput) (string, error)

SearchCommits searches the Chromium commit log.

func (*Client) SearchIssues

func (c *Client) SearchIssues(ctx context.Context, input SearchIssuesInput) (string, error)

SearchIssues searches the Chromium issue tracker.

func (*Client) SuggestReviewers

func (c *Client) SuggestReviewers(ctx context.Context, input SuggestReviewersInput) (string, error)

SuggestReviewers returns a ranked list of reviewer candidates for a given CL.

type FindOwnersInput

type FindOwnersInput struct {
	FilePath string `json:"file_path" jsonschema:"Path to the file to find OWNERS for (e.g., 'chrome/browser/ui/browser.cc')"`
}

FindOwnersInput holds the arguments for FindOwners.

type FindSymbolInput

type FindSymbolInput struct {
	Symbol   string `json:"symbol"              jsonschema:"Symbol to find (function, class, method, etc.)"`
	FilePath string `json:"file_path,omitempty" jsonschema:"Optional file path context for better symbol resolution"`
}

FindSymbolInput holds the arguments for FindSymbol.

type GetBotErrorsInput

type GetBotErrorsInput struct {
	CLNumber   string `json:"cl_number"              jsonschema:"CL number or full Gerrit URL"`
	Patchset   int    `json:"patchset,omitempty"     jsonschema:"Optional specific patchset number"`
	BotFilter  string `json:"bot_filter,omitempty"   jsonschema:"Optional bot name filter for partial matching"`
	FailedOnly bool   `json:"failed_only,omitempty"  jsonschema:"Only check failed bots (default: false)"`
}

GetBotErrorsInput holds the arguments for GetBotErrors.

type GetCIBuildErrorsInput

type GetCIBuildErrorsInput struct {
	BuildURL string `json:"build_url" jsonschema:"CI build URL or Buildbucket build ID"`
}

GetCIBuildErrorsInput holds the arguments for GetCIBuildErrors.

type GetCLCommentsInput

type GetCLCommentsInput struct {
	CLNumber        string `json:"cl_number"                  jsonschema:"CL number or full Gerrit URL"`
	Patchset        int    `json:"patchset,omitempty"         jsonschema:"Optional specific patchset number"`
	ExcludeResolved bool   `json:"exclude_resolved,omitempty" jsonschema:"Exclude resolved comments (default: include all)"`
}

GetCLCommentsInput holds the arguments for GetCLComments.

type GetCLDiffInput

type GetCLDiffInput struct {
	CLNumber string `json:"cl_number"          jsonschema:"CL number or full Gerrit URL"`
	Patchset int    `json:"patchset,omitempty"  jsonschema:"Optional specific patchset number"`
	FilePath string `json:"file_path,omitempty" jsonschema:"Optional specific file path to get diff for"`
}

GetCLDiffInput holds the arguments for GetCLDiff.

type GetCLStatusInput

type GetCLStatusInput struct {
	CLNumber string `json:"cl_number" jsonschema:"CL number or full Gerrit URL (e.g., '6624568')"`
}

GetCLStatusInput holds the arguments for GetCLStatus.

type GetFileInput

type GetFileInput struct {
	FilePath  string `json:"file_path"            jsonschema:"Path to the file in Chromium source (e.g., 'base/logging.cc')"`
	LineStart int    `json:"line_start,omitempty" jsonschema:"Optional starting line number"`
	LineEnd   int    `json:"line_end,omitempty"   jsonschema:"Optional ending line number"`
}

GetFileInput holds the arguments for GetFile.

type GetIssueInput

type GetIssueInput struct {
	IssueID string `json:"issue_id" jsonschema:"Issue ID or full URL (e.g., '422768753')"`
}

GetIssueInput holds the arguments for GetIssue.

type GetPatchsetFileInput

type GetPatchsetFileInput struct {
	CLNumber string `json:"cl_number"         jsonschema:"CL number or full Gerrit URL"`
	FilePath string `json:"file_path"          jsonschema:"Path to the file (e.g., 'chrome/browser/ui/browser.cc')"`
	Patchset int    `json:"patchset,omitempty" jsonschema:"Optional specific patchset number"`
}

GetPatchsetFileInput holds the arguments for GetPatchsetFile.

type GetTrybotStatusInput

type GetTrybotStatusInput struct {
	CLNumber   string `json:"cl_number"             jsonschema:"CL number or full Gerrit URL"`
	Patchset   int    `json:"patchset,omitempty"    jsonschema:"Optional specific patchset number"`
	FailedOnly bool   `json:"failed_only,omitempty" jsonschema:"Only return failed bots (default: false)"`
}

GetTrybotStatusInput holds the arguments for GetTrybotStatus.

type HTTPDoer

type HTTPDoer interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPDoer is the narrow interface satisfied by *http.Client. Replacing it in tests allows full HTTP-level mocking without a real server.

type ListCLsInput

type ListCLsInput struct {
	Query      string `json:"query,omitempty"       jsonschema:"Gerrit search query (e.g., 'owner:me', 'status:open')"`
	AuthCookie string `json:"auth_cookie,omitempty" jsonschema:"Authentication cookie (__Secure-1PSID=... or similar)"`
	Limit      int    `json:"limit,omitempty"       jsonschema:"Maximum number of CLs to return (default: 25, max: 100)"`
}

ListCLsInput holds the arguments for ListCLs.

type ListFolderInput

type ListFolderInput struct {
	FolderPath string `json:"folder_path" jsonschema:"Path to the folder in Chromium source (e.g., 'third_party/blink/renderer/core/style')"`
}

ListFolderInput holds the arguments for ListFolder.

type SearchCodeInput

type SearchCodeInput struct {
	Query           string `` /* 165-byte string literal not displayed */
	CaseSensitive   bool   `json:"case_sensitive,omitempty"   jsonschema:"Make search case sensitive (adds 'case:yes' to query)"`
	Language        string `json:"language,omitempty"         jsonschema:"Filter by programming language (e.g., 'cpp', 'javascript', 'python')"`
	FilePattern     string `json:"file_pattern,omitempty"     jsonschema:"File pattern filter (e.g., '*.cc', '*.h', 'chrome/browser/*')"`
	SearchType      string `json:"search_type,omitempty"      jsonschema:"Specific search type: 'content', 'function', 'class', 'symbol', 'comment'"`
	ExcludeComments bool   `json:"exclude_comments,omitempty" jsonschema:"Exclude comments and string literals from search"`
	Limit           int    `json:"limit,omitempty"            jsonschema:"Maximum number of results to return (default: 20)"`
}

SearchCodeInput holds the arguments for SearchCode.

type SearchCommitsInput

type SearchCommitsInput struct {
	Query  string `json:"query"           jsonschema:"Search query for commit messages, file paths, or metadata"`
	Author string `json:"author,omitempty" jsonschema:"Filter by author name or email (optional)"`
	Since  string `json:"since,omitempty"  jsonschema:"Only commits after this date (YYYY-MM-DD format, optional)"`
	Until  string `json:"until,omitempty"  jsonschema:"Only commits before this date (YYYY-MM-DD format, optional)"`
	Limit  int    `json:"limit,omitempty"  jsonschema:"Maximum number of commits to return (default: 20, max: 100)"`
}

SearchCommitsInput holds the arguments for SearchCommits.

type SearchIssuesInput

type SearchIssuesInput struct {
	Query      string `json:"query"                 jsonschema:"Search query for issue titles, descriptions, or metadata"`
	Limit      int    `json:"limit,omitempty"       jsonschema:"Maximum number of results (default: 50, max: 100)"`
	StartIndex int    `json:"start_index,omitempty" jsonschema:"Starting index for pagination (default: 0)"`
}

SearchIssuesInput holds the arguments for SearchIssues.

type SuggestReviewersInput

type SuggestReviewersInput struct {
	CLNumber         string   `json:"cl_number"                   jsonschema:"CL number or full Gerrit URL"`
	Patchset         int      `json:"patchset,omitempty"          jsonschema:"Optional specific patchset number"`
	MaxReviewers     int      `json:"max_reviewers,omitempty"     jsonschema:"Maximum number of reviewers to suggest (default: 5)"`
	Fast             bool     `json:"fast,omitempty"              jsonschema:"Skip activity analysis for faster results (default: false)"`
	ExcludeReviewers []string `json:"exclude_reviewers,omitempty" jsonschema:"Email addresses to exclude from suggestions"`
}

SuggestReviewersInput holds the arguments for SuggestReviewers.

Jump to

Keyboard shortcuts

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