app

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, c *Components) error

Run wires the scan callback, registers MCP tools, starts the scanner, then blocks on either HTTP or stdio transport until ctx is cancelled.

Types

type AutoIndexer

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

AutoIndexer automatically populates the knowledge graph from manifest files and optionally refreshes the content cache after each scan.

func New

New creates an AutoIndexer. cache may be nil if SCAN_CONTENT is disabled.

func (*AutoIndexer) Run

func (ai *AutoIndexer) Run(ctx context.Context, repos []corescan.RepoInfo)

Run is the OnScanComplete callback. It:

  1. Refreshes the content cache for all indexed files (if enabled).
  2. Runs all registered parsers and upserts entities/relations into the graph.
  3. Soft-deletes entities from repos no longer in the scan.

type Components

type Components struct {
	DB           *gorm.DB
	Scanner      *ghinfra.Scanner
	Graph        *GraphAuditLogger
	AuditStore   coreaudit.AuditStore
	ContentCache corecontent.ContentRepository
	SemanticSrv  adaptermcp.SemanticSearch
	ToolMetrics  *adaptermcp.ToolMetrics
	DocMetrics   *adaptermcp.DocMetrics
	MCPServer    *mcp.Server
	Indexer      *AutoIndexer
	Cfg          Config
}

Components holds all wired application dependencies.

func Wire

func Wire(ctx context.Context, cfg Config) (*Components, error)

Wire builds and wires all application components from cfg.

type Config

type Config struct {
	GitHubToken    string
	GitHubOrg      string
	ScanInterval   time.Duration
	TargetFiles    []string
	ScanDirs       []string
	InfraDirs      []string
	ExtraRepos     []string
	RepoTopics     []string
	RepoRegex      *regexp.Regexp
	HTTPAddr       string
	DatabaseURL    string
	ScanContent    bool
	GraphReadOnly  bool
	MaxContentSize int
	AgentID        string
	WebhookSecret  string
	BearerToken    string
	EmbedConfig    embeddings.Config
}

Config holds all runtime configuration read from environment variables.

func LoadConfig

func LoadConfig() (Config, error)

LoadConfig reads and validates all environment variables.

type FileGetter

type FileGetter interface {
	GetFileContent(ctx context.Context, repo, path string) (string, error)
}

FileGetter fetches the raw content of an indexed documentation file.

type GraphAuditLogger

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

func NewGraphAuditLogger

func NewGraphAuditLogger(inner coregraph.GraphService, agentFn func() string, store coreaudit.AuditStore) *GraphAuditLogger

func (*GraphAuditLogger) AddObservations

func (a *GraphAuditLogger) AddObservations(observations []coregraph.Observation) ([]coregraph.Observation, error)

func (*GraphAuditLogger) CreateEntities

func (a *GraphAuditLogger) CreateEntities(entities []coregraph.Entity) ([]coregraph.Entity, error)

func (*GraphAuditLogger) CreateRelations

func (a *GraphAuditLogger) CreateRelations(relations []coregraph.Relation) ([]coregraph.Relation, error)

func (*GraphAuditLogger) DeleteEntities

func (a *GraphAuditLogger) DeleteEntities(entityNames []string) error

func (*GraphAuditLogger) DeleteObservations

func (a *GraphAuditLogger) DeleteObservations(deletions []coregraph.Observation) error

func (*GraphAuditLogger) DeleteRelations

func (a *GraphAuditLogger) DeleteRelations(relations []coregraph.Relation) error

func (*GraphAuditLogger) EntityCount

func (a *GraphAuditLogger) EntityCount() (int64, error)

func (*GraphAuditLogger) EntityTypeCounts

func (a *GraphAuditLogger) EntityTypeCounts() (map[string]int64, error)

func (*GraphAuditLogger) FindPath

func (a *GraphAuditLogger) FindPath(from, to string, maxDepth int) ([]coregraph.PathEdge, error)

func (*GraphAuditLogger) GetIntegrationMap

func (a *GraphAuditLogger) GetIntegrationMap(ctx context.Context, service string, depth int) (coregraph.IntegrationMap, error)

func (*GraphAuditLogger) ListEntities

func (a *GraphAuditLogger) ListEntities(entityType string) (coregraph.KnowledgeGraph, error)

func (*GraphAuditLogger) ListRelations

func (a *GraphAuditLogger) ListRelations(relationType, fromEntity string) ([]coregraph.Relation, error)

func (*GraphAuditLogger) OpenNodes

func (a *GraphAuditLogger) OpenNodes(names []string) (coregraph.KnowledgeGraph, error)

func (*GraphAuditLogger) OpenNodesFiltered

func (a *GraphAuditLogger) OpenNodesFiltered(names []string, includeArchived bool) (coregraph.KnowledgeGraph, error)

func (*GraphAuditLogger) ReadGraph

func (a *GraphAuditLogger) ReadGraph() (coregraph.KnowledgeGraph, error)

func (*GraphAuditLogger) SearchNodes

func (a *GraphAuditLogger) SearchNodes(query string) (coregraph.KnowledgeGraph, error)

func (*GraphAuditLogger) SearchNodesFiltered

func (a *GraphAuditLogger) SearchNodesFiltered(query string, includeArchived bool) (coregraph.KnowledgeGraph, error)

func (*GraphAuditLogger) TraverseGraph

func (a *GraphAuditLogger) TraverseGraph(entity, relationType, direction string, maxDepth int) ([]coregraph.TraverseNode, []coregraph.TraverseEdge, error)

func (*GraphAuditLogger) UpdateEntity

func (a *GraphAuditLogger) UpdateEntity(oldName, newName, newType string) error

type GraphWriter

type GraphWriter interface {
	CreateEntities([]coregraph.Entity) ([]coregraph.Entity, error)
	CreateRelations([]coregraph.Relation) ([]coregraph.Relation, error)
	AddObservations([]coregraph.Observation) ([]coregraph.Observation, error)
	SearchNodes(query string) (coregraph.KnowledgeGraph, error)
	EntityCount() (int64, error)
}

GraphWriter writes entities and relations to the knowledge graph.

Jump to

Keyboard shortcuts

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