handlers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Health

func Health(w http.ResponseWriter, r *http.Request)

Health returns a simple health check response (liveness probe).

func ValidateGitHubSignature

func ValidateGitHubSignature(body []byte, signature, secret string) bool

ValidateGitHubSignature validates a GitHub webhook signature.

Types

type AddRepoRequest

type AddRepoRequest struct {
	ConnectionID  int64    `json:"connection_id"`
	Name          string   `json:"name"`
	CloneURL      string   `json:"clone_url"`
	DefaultBranch string   `json:"default_branch"`
	Branches      []string `json:"branches,omitempty"`
}

AddRepoRequest represents a request to add a repository.

type BlobAPIResponse

type BlobAPIResponse struct {
	Content      string `json:"content"`
	Path         string `json:"path"`
	Size         int64  `json:"size"`
	Language     string `json:"language"`
	LanguageMode string `json:"language_mode"` // CodeMirror mode
	Binary       bool   `json:"binary"`
	Ref          string `json:"ref"`
}

BlobResponse represents the response for file content.

type BranchesResponse

type BranchesResponse struct {
	Branches      []string `json:"branches"`
	Tags          []string `json:"tags"`
	DefaultBranch string   `json:"default_branch"`
}

BranchesResponse represents the response for branches listing.

type ConnectionResponse

type ConnectionResponse struct {
	ID              int64  `json:"id"`
	Name            string `json:"name"`
	Type            string `json:"type"`
	URL             string `json:"url"`
	TokenSet        bool   `json:"token_set"`
	ExcludeArchived bool   `json:"exclude_archived"`
	CleanupArchived bool   `json:"cleanup_archived"`
	CreatedAt       string `json:"created_at"`
}

ConnectionResponse represents a connection in API responses.

type ConnectionsStatusResponse

type ConnectionsStatusResponse struct {
	ReadOnly bool   `json:"readonly"`
	Message  string `json:"message,omitempty"`
}

ConnectionsStatusResponse represents the status of connections management.

type CreateConnectionRequest

type CreateConnectionRequest struct {
	Name            string `json:"name"`
	Type            string `json:"type"` // github, gitlab, gitea, bitbucket
	URL             string `json:"url"`
	Token           string `json:"token"`
	ExcludeArchived bool   `json:"exclude_archived"`
	CleanupArchived bool   `json:"cleanup_archived"`
}

CreateConnectionRequest represents a request to create a connection.

type FileSymbol

type FileSymbol struct {
	Name      string `json:"name"`
	Kind      string `json:"kind"`
	Line      int    `json:"line"`
	Column    int    `json:"column"`
	Signature string `json:"signature,omitempty"`
	Parent    string `json:"parent,omitempty"`
}

FileSymbol represents a symbol found in a file.

type FileSymbolsResponse

type FileSymbolsResponse struct {
	Symbols []FileSymbol `json:"symbols"`
	Path    string       `json:"path"`
}

FileSymbolsResponse represents the response for symbols in a file.

type FilterSuggestion

type FilterSuggestion struct {
	Keyword     string `json:"keyword"`
	Description string `json:"description"`
	Example     string `json:"example"`
}

FilterSuggestion represents a filter keyword suggestion.

type FindReferencesRequest

type FindReferencesRequest struct {
	FilePath string `json:"filePath"`
	Line     int    `json:"line"`            // 1-indexed (matches editor display)
	Column   int    `json:"column"`          // 0-indexed
	Limit    int    `json:"limit,omitempty"` // 0 for no limit
}

FindReferencesRequest is the request for find-references.

type FindReferencesResponse

type FindReferencesResponse struct {
	Found      bool              `json:"found"`
	Symbol     string            `json:"symbol,omitempty"`
	Definition *scip.Occurrence  `json:"definition,omitempty"`
	References []scip.Occurrence `json:"references"`
	TotalCount int               `json:"totalCount"`
}

FindReferencesResponse is the response for find-references.

type FindRefsRequest

type FindRefsRequest struct {
	Symbol   string   `json:"symbol"`
	Repos    []string `json:"repos,omitempty"`
	Language string   `json:"language,omitempty"`
	Limit    int      `json:"limit"`
}

FindRefsRequest represents a reference search request.

type FindSymbolsRequest

type FindSymbolsRequest struct {
	Name     string   `json:"name"`
	Kind     string   `json:"kind,omitempty"`
	Repos    []string `json:"repos,omitempty"`
	Language string   `json:"language,omitempty"`
	Limit    int      `json:"limit"`
}

FindSymbolsRequest represents a symbol search request.

type GoToDefinitionRequest

type GoToDefinitionRequest struct {
	FilePath string `json:"filePath"`
	Line     int    `json:"line"`   // 1-indexed (matches editor display)
	Column   int    `json:"column"` // 0-indexed
}

GoToDefinitionRequest is the request for go-to-definition.

type GoToDefinitionResponse

type GoToDefinitionResponse struct {
	Found      bool             `json:"found"`
	Symbol     string           `json:"symbol,omitempty"`
	Definition *scip.Occurrence `json:"definition,omitempty"`
	Info       *scip.SymbolInfo `json:"info,omitempty"`
	External   bool             `json:"external"`
}

GoToDefinitionResponse is the response for go-to-definition.

type Handler

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

Handler provides access to services for HTTP handlers.

func NewHandlerWithOptions

func NewHandlerWithOptions(services *Services, opts HandlerOptions) *Handler

NewHandlerWithOptions creates a new handler with services and options.

func (*Handler) AddRepo

func (h *Handler) AddRepo(w http.ResponseWriter, r *http.Request)

AddRepo adds a new repository.

func (*Handler) BulkCancelJobs

func (h *Handler) BulkCancelJobs(w http.ResponseWriter, r *http.Request)

BulkCancelJobs cancels all jobs matching the given filters.

func (*Handler) BulkDeleteJobs

func (h *Handler) BulkDeleteJobs(w http.ResponseWriter, r *http.Request)

BulkDeleteJobs deletes all completed/failed jobs matching the given filters.

func (*Handler) CancelJob

func (h *Handler) CancelJob(w http.ResponseWriter, r *http.Request)

CancelJob cancels a pending job.

func (*Handler) CleanupJobs

func (h *Handler) CleanupJobs(w http.ResponseWriter, r *http.Request)

CleanupJobs removes old completed/failed jobs.

func (*Handler) CleanupStaleIndexing

func (h *Handler) CleanupStaleIndexing(w http.ResponseWriter, r *http.Request)

CleanupStaleIndexing resets repositories stuck in "indexing" status. POST /api/v1/scheduler/cleanup.

func (*Handler) CreateConnection

func (h *Handler) CreateConnection(w http.ResponseWriter, r *http.Request)

CreateConnection creates a new code host connection.

func (*Handler) DeleteAllJobs

func (h *Handler) DeleteAllJobs(w http.ResponseWriter, r *http.Request)

DeleteAllJobs deletes ALL jobs (use with caution).

func (*Handler) DeleteConnection

func (h *Handler) DeleteConnection(w http.ResponseWriter, r *http.Request)

DeleteConnection removes a connection.

func (*Handler) DeleteRepoByID

func (h *Handler) DeleteRepoByID(w http.ResponseWriter, r *http.Request)

DeleteRepoByID removes a repository by ID.

func (*Handler) ExcludeRepoByID

func (h *Handler) ExcludeRepoByID(w http.ResponseWriter, r *http.Request)

ExcludeRepoByID excludes a repository from sync and indexing (soft delete).

func (*Handler) FindRefs

func (h *Handler) FindRefs(w http.ResponseWriter, r *http.Request)

FindRefs finds references to a symbol.

func (*Handler) FindSymbols

func (h *Handler) FindSymbols(w http.ResponseWriter, r *http.Request)

FindSymbols searches for symbol definitions using Zoekt's sym: filter.

func (*Handler) GetBlob

func (h *Handler) GetBlob(w http.ResponseWriter, r *http.Request)

GetBlob returns the content of a file in a repository. GET /api/v1/repos/by-id/{id}/blob?path=&ref=.

func (*Handler) GetBranchesAndTags

func (h *Handler) GetBranchesAndTags(w http.ResponseWriter, r *http.Request)

GetBranchesAndTags returns branches and tags for a repository. GET /api/v1/repos/by-id/{id}/refs.

func (*Handler) GetConnection

func (h *Handler) GetConnection(w http.ResponseWriter, r *http.Request)

GetConnection returns a single connection.

func (*Handler) GetConnectionStats

func (h *Handler) GetConnectionStats(w http.ResponseWriter, r *http.Request)

GetConnectionStats returns statistics for a specific connection. GET /api/v1/connections/{id}/stats.

func (*Handler) GetConnectionsStatus

func (h *Handler) GetConnectionsStatus(w http.ResponseWriter, r *http.Request)

GetConnectionsStatus returns the status of connections management (readonly mode, etc.)

func (*Handler) GetFileSymbols

func (h *Handler) GetFileSymbols(w http.ResponseWriter, r *http.Request)

GetFileSymbols returns symbols in a specific file using Tree-sitter. GET /api/v1/repos/by-id/{id}/symbols?path=&ref=.

func (*Handler) GetJob

func (h *Handler) GetJob(w http.ResponseWriter, r *http.Request)

GetJob returns a single job.

func (*Handler) GetQueueStats

func (h *Handler) GetQueueStats(w http.ResponseWriter, r *http.Request)

GetQueueStats returns queue statistics. GET /api/v1/jobs/stats.

func (*Handler) GetRaw

func (h *Handler) GetRaw(w http.ResponseWriter, r *http.Request)

GetRaw returns the raw content of a file (including binary files). GET /api/v1/repos/by-id/{id}/raw?path=&ref=.

func (*Handler) GetReplaceJob

func (h *Handler) GetReplaceJob(w http.ResponseWriter, r *http.Request)

GetReplaceJob returns a single replace job.

func (*Handler) GetRepoByID

func (h *Handler) GetRepoByID(w http.ResponseWriter, r *http.Request)

GetRepoByID returns a single repository by ID.

func (*Handler) GetRepoStats

func (h *Handler) GetRepoStats(w http.ResponseWriter, r *http.Request)

GetRepoStats returns overall repository statistics. GET /api/v1/repos/stats.

func (*Handler) GetSchedulerStats

func (h *Handler) GetSchedulerStats(w http.ResponseWriter, r *http.Request)

GetSchedulerStats returns scheduler statistics.

func (*Handler) GetUISettings

func (h *Handler) GetUISettings(w http.ResponseWriter, r *http.Request)

GetUISettings returns UI settings for the frontend.

func (*Handler) HandleWebhook

func (h *Handler) HandleWebhook(w http.ResponseWriter, r *http.Request)

HandleWebhook processes incoming webhooks from code hosts. POST /api/v1/webhooks/{provider} Supported providers: github, gitlab, gitea, bitbucket.

func (*Handler) IncludeRepoByID

func (h *Handler) IncludeRepoByID(w http.ResponseWriter, r *http.Request)

IncludeRepoByID includes a previously excluded repository and queues an index job.

func (*Handler) ListConnectionRepos

func (h *Handler) ListConnectionRepos(w http.ResponseWriter, r *http.Request)

ListConnectionRepos lists repos that belong to a specific connection.

func (*Handler) ListConnections

func (h *Handler) ListConnections(w http.ResponseWriter, r *http.Request)

ListConnections returns all code host connections.

func (*Handler) ListJobs

func (h *Handler) ListJobs(w http.ResponseWriter, r *http.Request)

ListJobs lists all jobs with pagination and filtering.

func (*Handler) ListReplaceJobs

func (h *Handler) ListReplaceJobs(w http.ResponseWriter, r *http.Request)

ListReplaceJobs lists all replace jobs.

func (*Handler) ListRepos

func (h *Handler) ListRepos(w http.ResponseWriter, r *http.Request)

ListRepos returns repositories with optional pagination and filtering.

func (*Handler) ListTree

func (h *Handler) ListTree(w http.ResponseWriter, r *http.Request)

ListTree returns the directory listing for a repository. GET /api/v1/repos/by-id/{id}/tree?path=&ref=.

func (*Handler) LookupRepoByName

func (h *Handler) LookupRepoByName(w http.ResponseWriter, r *http.Request)

LookupRepoByName looks up a repository by its Zoekt name (e.g., "gitlab.example.com/org/repo"). GET /api/v1/repos/lookup?name=...

func (*Handler) Ready

func (h *Handler) Ready(w http.ResponseWriter, r *http.Request)

Ready checks if all dependencies are ready (readiness probe).

func (*Handler) RebuildJobIndexes

func (h *Handler) RebuildJobIndexes(w http.ResponseWriter, r *http.Request)

RebuildJobIndexes rebuilds the Redis sorted set indexes for jobs. This fixes stale data from jobs that were created before the index feature or when indexes get out of sync due to bugs.

func (*Handler) ReplaceExecute

func (h *Handler) ReplaceExecute(w http.ResponseWriter, r *http.Request)

ReplaceExecute executes replacements across repositories.

func (*Handler) ReplacePreview

func (h *Handler) ReplacePreview(w http.ResponseWriter, r *http.Request)

ReplacePreview shows what would be replaced without making changes.

func (*Handler) ReposStatus

func (h *Handler) ReposStatus(w http.ResponseWriter, r *http.Request)

ReposStatus returns the readonly status for repos management.

func (*Handler) RestoreRepoByID

func (h *Handler) RestoreRepoByID(w http.ResponseWriter, r *http.Request)

RestoreRepoByID restores a previously deleted repository and queues an index job.

func (*Handler) Search

func (h *Handler) Search(w http.ResponseWriter, r *http.Request)

Search handles synchronous search requests.

func (*Handler) SearchStream

func (h *Handler) SearchStream(w http.ResponseWriter, r *http.Request)

SearchStream handles streaming search requests via SSE.

func (*Handler) SearchSuggestions

func (h *Handler) SearchSuggestions(w http.ResponseWriter, r *http.Request)

SearchSuggestions returns autocomplete suggestions for the search bar.

func (*Handler) SetRepoBranches

func (h *Handler) SetRepoBranches(w http.ResponseWriter, r *http.Request)

SetRepoBranches sets which branches to index for a repository. PUT /api/v1/repos/by-id/{id}/branches.

func (*Handler) SetRepoPollInterval

func (h *Handler) SetRepoPollInterval(w http.ResponseWriter, r *http.Request)

SetRepoPollInterval sets a custom poll interval for a repository.

func (*Handler) SyncConnection

func (h *Handler) SyncConnection(w http.ResponseWriter, r *http.Request)

SyncConnection queues a job to fetch repositories from a connection The actual fetching is done asynchronously by the indexer worker.

func (*Handler) SyncRepoByID

func (h *Handler) SyncRepoByID(w http.ResponseWriter, r *http.Request)

SyncRepoByID triggers a sync/reindex for a repository by ID.

func (*Handler) TestConnection

func (h *Handler) TestConnection(w http.ResponseWriter, r *http.Request)

TestConnection tests if a connection is valid.

func (*Handler) TriggerSyncAll

func (h *Handler) TriggerSyncAll(w http.ResponseWriter, r *http.Request)

TriggerSyncAll triggers a sync for all repositories or stale ones.

func (*Handler) UpdateConnection

func (h *Handler) UpdateConnection(w http.ResponseWriter, r *http.Request)

UpdateConnection updates an existing connection.

type HandlerOptions

type HandlerOptions struct {
	ConnectionsReadOnly bool
	ReposReadOnly       bool
	SchedulerConfig     SchedulerConfig
	UIConfig            UIConfig
	SearchConfig        SearchConfig
}

HandlerOptions contains options for creating a handler.

type HealthCheck

type HealthCheck struct {
	Status  string `json:"status"`
	Message string `json:"message,omitempty"`
	Latency string `json:"latency,omitempty"`
}

HealthCheck represents the status of a single health check.

type HealthResponse

type HealthResponse struct {
	Status string                 `json:"status"`
	Checks map[string]HealthCheck `json:"checks"`
}

HealthResponse represents the overall health response.

type IndexSCIPRequest

type IndexSCIPRequest struct {
	Language string `json:"language,omitempty"` // Auto-detect if empty
}

IndexSCIPRequest is the request for indexing a repository.

type IndexSCIPResponse

type IndexSCIPResponse struct {
	Success     bool   `json:"success"`
	Language    string `json:"language"`
	Duration    string `json:"duration"`
	Files       int    `json:"files"`
	Symbols     int    `json:"symbols"`
	Occurrences int    `json:"occurrences"`
	Error       string `json:"error,omitempty"`
	Output      string `json:"output,omitempty"`
}

IndexSCIPResponse is the response from indexing.

type LanguageSuggestion

type LanguageSuggestion struct {
	Name string `json:"name"`
}

LanguageSuggestion represents a language suggestion.

type ListReposResponse

type ListReposResponse struct {
	Repos      []RepositoryResponse `json:"repos"`
	TotalCount int                  `json:"total_count"`
	Limit      int                  `json:"limit"`
	Offset     int                  `json:"offset"`
	HasMore    bool                 `json:"has_more"`
}

ListReposResponse represents the list repos response with pagination.

type PreviewMatch

type PreviewMatch struct {
	RepositoryID       int64         `json:"repository_id"`
	Repo               string        `json:"repo"`
	File               string        `json:"file"`
	Language           string        `json:"language"`
	Line               int           `json:"line"`
	Column             int           `json:"column"`
	Content            string        `json:"content"`
	MatchStart         int           `json:"match_start"`
	MatchEnd           int           `json:"match_end"`
	Context            ResultContext `json:"context"`
	ConnectionID       *int64        `json:"connection_id,omitempty"`
	ConnectionName     string        `json:"connection_name,omitempty"`
	ConnectionHasToken bool          `json:"connection_has_token"`
}

PreviewMatch represents a single match in the preview response.

type QueueStatsResponse

type QueueStatsResponse struct {
	PendingJobs int64 `json:"pending_jobs"`
}

QueueStatsResponse represents queue statistics.

type Reference

type Reference struct {
	Repo    string `json:"repo"`
	File    string `json:"file"`
	Line    int    `json:"line"`
	Column  int    `json:"column"`
	Context string `json:"context"`
}

Reference represents a reference to a symbol.

type ReplaceExecuteRequest

type ReplaceExecuteRequest struct {
	// Search parameters (kept for reference/logging, not used for search)
	SearchPattern string   `json:"search_pattern"`
	ReplaceWith   string   `json:"replace_with"`
	IsRegex       bool     `json:"is_regex"`
	CaseSensitive bool     `json:"case_sensitive"`
	FilePatterns  []string `json:"file_patterns,omitempty"`

	// Matches from preview (required - Execute uses these directly)
	Matches []ReplaceMatch `json:"matches"`

	// MR options (MR is always created to avoid direct main branch changes)
	BranchName    string `json:"branch_name,omitempty"`
	MRTitle       string `json:"mr_title,omitempty"`
	MRDescription string `json:"mr_description,omitempty"`

	// User-provided tokens for repos without server-side authentication
	// Map of connection_id -> token (allows different tokens per code host)
	UserTokens map[string]string `json:"user_tokens,omitempty"`
}

ReplaceExecuteRequest represents a request to execute replacements.

type ReplaceMatch

type ReplaceMatch struct {
	RepositoryID   int64  `json:"repository_id"`
	RepositoryName string `json:"repository_name"`
	FilePath       string `json:"file_path"`
}

ReplaceMatch represents a pre-computed match from preview.

type ReplacePreviewRequest

type ReplacePreviewRequest struct {
	SearchPattern string   `json:"search_pattern"`
	ReplaceWith   string   `json:"replace_with"`
	IsRegex       bool     `json:"is_regex"`
	CaseSensitive bool     `json:"case_sensitive"`
	FilePatterns  []string `json:"file_patterns,omitempty"`
	Repos         []string `json:"repos,omitempty"`
	Languages     []string `json:"languages,omitempty"`
	Limit         *int     `json:"limit,omitempty"`         // Max results: nil/omit for default (1000), 0 for unlimited
	ContextLines  int      `json:"context_lines,omitempty"` // Lines of context around matches (default: 2)
}

ReplacePreviewRequest represents a request to preview replacements.

type RepoStatsResponse

type RepoStatsResponse struct {
	Total    int `json:"total"`
	Indexed  int `json:"indexed"`
	Pending  int `json:"pending"`
	Indexing int `json:"indexing"`
	Failed   int `json:"failed"`
	Excluded int `json:"excluded"`
}

RepoStatsResponse represents overall repository statistics.

type RepoSuggestion

type RepoSuggestion struct {
	Name        string `json:"name"`         // Escaped regex pattern like "^github\\.com/org/repo$"
	DisplayName string `json:"display_name"` // Human-readable name like "github.com/org/repo"
	FullName    string `json:"full_name"`    // Full name from clone_url
	Status      string `json:"status"`       // Index status
}

RepoSuggestion represents a repository suggestion.

type RepositoryResponse

type RepositoryResponse struct {
	ID            int64    `json:"id"`
	Name          string   `json:"name"`
	CloneURL      string   `json:"clone_url"`
	DefaultBranch string   `json:"default_branch"`
	Branches      []string `json:"branches"`
	Status        string   `json:"status"`
	LastIndexed   string   `json:"last_indexed,omitempty"`
	Excluded      bool     `json:"excluded"`
	Deleted       bool     `json:"deleted"`
}

RepositoryResponse represents a repository in API responses.

type ResultContext

type ResultContext struct {
	Before []string `json:"before"`
	After  []string `json:"after"`
}

ResultContext represents lines around a match.

type SCIPHandler

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

SCIPHandler handles SCIP-related endpoints.

func NewSCIPHandler

func NewSCIPHandler(services *Services, scipSvc *scip.Service) *SCIPHandler

NewSCIPHandler creates a new SCIP handler.

func (*SCIPHandler) ClearSCIPIndex

func (h *SCIPHandler) ClearSCIPIndex(w http.ResponseWriter, r *http.Request)

ClearSCIPIndex removes the SCIP index for a repository.

func (*SCIPHandler) FindReferences

func (h *SCIPHandler) FindReferences(w http.ResponseWriter, r *http.Request)

FindReferences finds all references to a symbol using SCIP.

func (*SCIPHandler) GetAvailableIndexers

func (h *SCIPHandler) GetAvailableIndexers(w http.ResponseWriter, r *http.Request)

GetAvailableIndexers returns which SCIP indexers are available.

func (*SCIPHandler) GetSCIPStatus

func (h *SCIPHandler) GetSCIPStatus(w http.ResponseWriter, r *http.Request)

GetSCIPStatus returns the SCIP index status for a repository.

func (*SCIPHandler) GoToDefinition

func (h *SCIPHandler) GoToDefinition(w http.ResponseWriter, r *http.Request)

GoToDefinition finds the definition of a symbol using SCIP.

func (*SCIPHandler) IndexRepository

func (h *SCIPHandler) IndexRepository(w http.ResponseWriter, r *http.Request)

IndexRepository runs SCIP indexing on a repository.

func (*SCIPHandler) ListFiles

func (h *SCIPHandler) ListFiles(w http.ResponseWriter, r *http.Request)

ListFiles lists all indexed files for a repository.

func (*SCIPHandler) SearchSymbols

func (h *SCIPHandler) SearchSymbols(w http.ResponseWriter, r *http.Request)

SearchSymbols searches for symbols by name.

func (*SCIPHandler) UploadSCIPIndex

func (h *SCIPHandler) UploadSCIPIndex(w http.ResponseWriter, r *http.Request)

UploadSCIPIndex uploads a pre-built SCIP index.

type SCIPStatusResponse

type SCIPStatusResponse struct {
	HasIndex          bool            `json:"has_index"`
	AvailableIndexers map[string]bool `json:"available_indexers"`
	Stats             map[string]any  `json:"stats,omitempty"`
}

SCIPStatusResponse contains SCIP index status.

type SchedulerConfig

type SchedulerConfig struct {
	Enabled       bool
	PollInterval  time.Duration
	CheckInterval time.Duration
}

SchedulerConfig holds scheduler configuration for handlers.

type SchedulerStatsResponse

type SchedulerStatsResponse struct {
	Enabled       bool      `json:"enabled"`
	TotalRepos    int       `json:"total_repos"`
	IndexedRepos  int       `json:"indexed_repos"`
	PendingRepos  int       `json:"pending_repos"`
	IndexingRepos int       `json:"indexing_repos"`
	FailedRepos   int       `json:"failed_repos"`
	StaleRepos    int       `json:"stale_repos"`
	NextCheckAt   time.Time `json:"next_check_at"`
	PollInterval  string    `json:"default_poll_interval"`
	CheckInterval string    `json:"check_interval"`
}

SchedulerStatsResponse represents scheduler statistics.

type SearchConfig

type SearchConfig struct {
	EnableStreaming bool // Enable true streaming from Zoekt
}

SearchConfig holds search behavior settings.

type SearchSuggestionsResponse

type SearchSuggestionsResponse struct {
	Repos     []RepoSuggestion     `json:"repos"`
	Languages []LanguageSuggestion `json:"languages"`
	Filters   []FilterSuggestion   `json:"filters"`
}

SearchSuggestionsResponse contains search suggestions for autocomplete.

type SearchSymbolsRequest

type SearchSymbolsRequest struct {
	Query string `json:"query"`
	Limit int    `json:"limit,omitempty"`
}

SearchSymbolsRequest is the request for searching symbols.

type Services

type Services struct {
	Search         *search.Service
	Repos          *repos.Service
	Files          *files.Service
	FederatedFiles *files.FederatedClient // For sharded deployments
	FederatedSCIP  *scip.FederatedClient  // For sharded SCIP access
	Symbols        *symbols.Service
	Replace        *replace.Service
	Queue          *queue.Queue
	Pool           db.Pool
	Redis          *redis.Client
	Logger         *zap.Logger
	IndexPath      string // Path to Zoekt index shards
	ReposPath      string // Path to cloned repositories

	// Extension points for enterprise features.
	// These default to no-op implementations in the open-source core.
	Authenticator      middleware.Authenticator
	Authorizer         middleware.Authorizer
	AuditLogger        audit.AuditLogger
	SearchResultFilter func(ctx context.Context, results []search.SearchResult) []search.SearchResult // Optional enterprise result filtering
}

Services holds all service dependencies for handlers.

func NewServices

func NewServices(
	pool db.Pool,
	redisClient *redis.Client,
	zoektURL, indexPath, reposPath string,
	tokenEncryptor *crypto.TokenEncryptor,
	logger *zap.Logger,
) *Services

NewServices creates all services with their dependencies.

type SetRepoBranchesRequest

type SetRepoBranchesRequest struct {
	Branches []string `json:"branches"`
}

SetRepoBranchesRequest represents a request to set branches to index.

type SetRepoPollIntervalRequest

type SetRepoPollIntervalRequest struct {
	IntervalSeconds int `json:"interval_seconds"`
}

SetRepoPollIntervalRequest represents a request to set poll interval.

type Symbol

type Symbol struct {
	Name      string `json:"name"`
	Kind      string `json:"kind"`
	Repo      string `json:"repo"`
	File      string `json:"file"`
	Line      int    `json:"line"`
	Column    int    `json:"column"`
	Signature string `json:"signature,omitempty"`
	Language  string `json:"language"`
}

Symbol represents a code symbol.

type TreeResponse

type TreeResponse struct {
	Entries []files.TreeEntry `json:"entries"`
	Path    string            `json:"path"`
	Ref     string            `json:"ref"`
}

TreeResponse represents the response for tree listing.

type TriggerSyncAllRequest

type TriggerSyncAllRequest struct {
	Force bool `json:"force"` // If true, sync all regardless of last_indexed
}

TriggerSyncAllRequest represents a request to sync all repos.

type UIConfig

type UIConfig struct {
	HideReadOnlyBanner  bool
	HideFileNavigator   bool
	DisableBrowseAPI    bool
	HideReposPage       bool
	HideConnectionsPage bool
	HideJobsPage        bool
	HideReplacePage     bool
	AuthEnabled         bool
}

UIConfig holds UI display settings.

type UISettingsResponse

type UISettingsResponse struct {
	HideReadOnlyBanner  bool `json:"hide_readonly_banner"`
	HideFileNavigator   bool `json:"hide_file_navigator"`
	DisableBrowseAPI    bool `json:"disable_browse_api"`
	ConnectionsReadOnly bool `json:"connections_readonly"`
	ReposReadOnly       bool `json:"repos_readonly"`
	EnableStreaming     bool `json:"enable_streaming"`
	HideReposPage       bool `json:"hide_repos_page"`
	HideConnectionsPage bool `json:"hide_connections_page"`
	HideJobsPage        bool `json:"hide_jobs_page"`
	HideReplacePage     bool `json:"hide_replace_page"`
	AuthEnabled         bool `json:"auth_enabled"`
}

UISettingsResponse contains UI settings for the frontend.

type UpdateConnectionRequest

type UpdateConnectionRequest struct {
	Name            string `json:"name"`
	Type            string `json:"type"`
	URL             string `json:"url"`
	Token           string `json:"token,omitempty"` // Optional - if empty, keep existing
	ExcludeArchived bool   `json:"exclude_archived"`
	CleanupArchived bool   `json:"cleanup_archived"`
}

UpdateConnectionRequest represents a request to update a connection.

type WebhookConfig

type WebhookConfig struct {
	Secret string // Shared secret for webhook signature validation
}

WebhookConfig holds webhook configuration.

Jump to

Keyboard shortcuts

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