codesearch

package
v0.8.42 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RepoStats

type RepoStats struct {
	Repo       string `json:"repo"`
	MatchCount int    `json:"match_count"`
	FileCount  int    `json:"file_count"`
}

RepoStats holds per-repo match statistics.

type Result

type Result struct {
	Repo          string   `json:"repo"`
	Path          string   `json:"path"`
	Line          int      `json:"line"`
	Column        int      `json:"column"`
	ContextBefore []string `json:"context_before"`
	ContextLine   string   `json:"context_line"`
	ContextAfter  []string `json:"context_after"`
	Score         float64  `json:"score"`
}

Result is a single code search match from peregrine.

type SearchRequest

type SearchRequest struct {
	Query         string
	Repos         []string
	MaxResults    int
	CaseSensitive bool
}

SearchRequest holds the parameters for a code search call to peregrine via the cell's entire-api gateway at GET /api/v1/search/api/search.

type SearchResponse

type SearchResponse struct {
	Query     string      `json:"query"`
	Stats     Stats       `json:"stats"`
	RepoStats []RepoStats `json:"repo_stats"`
	Results   []Result    `json:"results"`

	// FailedJurisdictions is set by the CLI's merge layer (not by peregrine)
	// when one or more cells failed during multi-region fan-out.
	FailedJurisdictions []string `json:"failed_jurisdictions,omitempty"`
}

SearchResponse is peregrine's code search response.

func Search(ctx context.Context, client *api.Client, req SearchRequest) (*SearchResponse, error)

Search calls peregrine's code search endpoint through the cell's entire-api gateway: GET /api/v1/search/api/search?q=...&max_results=...&repo=... The client must already be authenticated against the cell.

type Stats

type Stats struct {
	TotalMatches  int     `json:"total_matches"`
	TotalFiles    int     `json:"total_files"`
	DurationMs    float64 `json:"duration_ms"`
	ReposSearched int     `json:"repos_searched"`
}

Stats holds aggregate search statistics.

Jump to

Keyboard shortcuts

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