types

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNodeID

func GenerateNodeID(filePath, symbolName string) string

GenerateNodeID creates a deterministic SHA-256 hash ID from file path and symbol name. Uses a null byte separator to prevent collisions (e.g., "a:b"+"c" vs "a"+":b:c").

Types

type ASTEdge

type ASTEdge struct {
	SourceID     string   `json:"source_id"`
	TargetID     string   `json:"target_id"`
	EdgeType     EdgeType `json:"edge_type"`
	TargetSymbol string   `json:"target_symbol,omitempty"` // raw symbol name for cross-file resolution
}

ASTEdge represents a relationship between two AST nodes

type ASTNode

type ASTNode struct {
	ID         string   `json:"id"`
	FilePath   string   `json:"file_path"`
	SymbolName string   `json:"symbol_name"`
	NodeType   NodeType `json:"node_type"`
	StartByte  uint32   `json:"start_byte"`
	EndByte    uint32   `json:"end_byte"`
	ContentSum string   `json:"content_sum"`
}

ASTNode represents a parsed code symbol (function, class, struct, method)

type Community

type Community struct {
	ID      int      `json:"id"`
	NodeIDs []string `json:"node_ids"`
}

Community represents a group of tightly coupled code symbols detected by Louvain

type CriticalPathNode added in v0.3.3

type CriticalPathNode struct {
	ID         string  `json:"id"`
	Name       string  `json:"name"`
	Phase      string  `json:"phase"`
	Confidence float64 `json:"confidence"`
	Verified   bool    `json:"verified"`
}

CriticalPathNode is a workflow node used in the brief critical path representation.

type EdgeType

type EdgeType uint8

EdgeType represents the type of relationship between AST nodes

const (
	EdgeTypeCalls EdgeType = iota + 1
	EdgeTypeImports
	EdgeTypeImplements
	EdgeTypeInstantiates
	EdgeTypeDefines       // file → class/function (containment)
	EdgeTypeDefinesMethod // class → method (containment)
	EdgeTypeInherits      // class → parent class (extends)
	EdgeTypeHandles       // route → controller method (handler resolution)
)

func (EdgeType) MarshalJSON

func (et EdgeType) MarshalJSON() ([]byte, error)

MarshalJSON encodes an EdgeType as its string name (H46).

func (EdgeType) String

func (et EdgeType) String() string

String returns the string representation of an EdgeType

func (*EdgeType) UnmarshalJSON

func (et *EdgeType) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes an EdgeType from its string name or numeric value (H46).

type FileEvent

type FileEvent struct {
	Path   string
	Action FileEventAction
}

type FileEventAction

type FileEventAction uint8

FileEvent represents a filesystem change event

const (
	FileEventCreated FileEventAction = iota + 1
	FileEventModified
	FileEventDeleted
)

type Inspectable

type Inspectable struct {
	Rank       int               `json:"rank"`
	TargetType string            `json:"target_type"`
	Name       string            `json:"name"`
	FilePath   string            `json:"file_path"`
	ID         string            `json:"id,omitempty"`
	Score      float64           `json:"score"`
	Reason     string            `json:"reason"`
	WhyNow     string            `json:"why_now,omitempty"`
	NextTool   string            `json:"next_tool"`
	NextArgs   map[string]string `json:"next_args,omitempty"`
}

Inspectable is a ranked discovery result returned by all discovery tools.

type InspectableResponse

type InspectableResponse struct {
	Inspectables []Inspectable `json:"inspectables"`
	Total        int           `json:"total"`
	Query        string        `json:"query,omitempty"`
	Summary      string        `json:"summary"`
}

InspectableResponse wraps discovery tool output with metadata.

type NodeScore

type NodeScore struct {
	NodeID      string  `json:"node_id"`
	PageRank    float64 `json:"pagerank"`
	Betweenness float64 `json:"betweenness"`
}

NodeScore holds precomputed graph metrics for a node

type NodeType

type NodeType uint8

NodeType represents the type of an AST node

const (
	NodeTypeFunction NodeType = iota + 1
	NodeTypeClass
	NodeTypeStruct
	NodeTypeMethod
	NodeTypeInterface // H22: distinct type for interfaces
	NodeTypeFile      // C1: file-level node for import edge anchoring
	NodeTypeRoute     // HTTP route endpoint (e.g., "POST /v1/merchant/{storeID}/order")
)

func (NodeType) MarshalJSON

func (nt NodeType) MarshalJSON() ([]byte, error)

MarshalJSON encodes a NodeType as its string name (H46).

func (NodeType) String

func (nt NodeType) String() string

String returns the string representation of a NodeType

func (*NodeType) UnmarshalJSON

func (nt *NodeType) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes a NodeType from its string name or numeric value (H46).

type ProjectSummary

type ProjectSummary struct {
	Project    string `json:"project"`
	Summary    string `json:"summary"`
	SourceHash string `json:"source_hash"`
}

ProjectSummary represents an architecture decision record or project summary

type RecommendedStep added in v0.3.2

type RecommendedStep struct {
	Tool   string            `json:"tool"`
	Reason string            `json:"reason"`
	Args   map[string]string `json:"args"`
}

type RiskFlag added in v0.3.3

type RiskFlag struct {
	Severity string `json:"severity"`
	Symbol   string `json:"symbol"`
	FilePath string `json:"file_path,omitempty"`
	Issue    string `json:"issue"`
}

RiskFlag captures verification gaps and failures that affect workflow trust.

type RiskLevel

type RiskLevel string

RiskLevel represents the severity of impact from a change

const (
	RiskCritical RiskLevel = "CRITICAL"
	RiskHigh     RiskLevel = "HIGH"
	RiskMedium   RiskLevel = "MEDIUM"
	RiskLow      RiskLevel = "LOW"
)

type ScoreBreakdown

type ScoreBreakdown struct {
	PPR         float64 `json:"ppr"`
	BM25        float64 `json:"bm25"`
	Betweenness float64 `json:"betweenness"`
	InDegree    float64 `json:"in_degree"`
	Semantic    float64 `json:"semantic"`
}

ScoreBreakdown holds the per-signal normalized scores that compose the final composite score.

type SearchResult

type SearchResult struct {
	Node      ASTNode         `json:"node"`
	Score     float64         `json:"score"`
	Breakdown *ScoreBreakdown `json:"breakdown,omitempty"`
}

SearchResult represents a ranked result from hybrid search

type VerifiedWorkflowItem added in v0.3.2

type VerifiedWorkflowItem struct {
	ID           string   `json:"id"`
	Name         string   `json:"name"`
	FilePath     string   `json:"file_path"`
	Group        string   `json:"group"`
	Verification string   `json:"verification"`
	Confidence   float64  `json:"confidence"`
	Path         []string `json:"path,omitempty"`
	PathIDs      []string `json:"path_ids,omitempty"`
	FailReason   string   `json:"fail_reason,omitempty"`
}

type VerifyWorkflowResponse added in v0.3.2

type VerifyWorkflowResponse struct {
	Query            string                 `json:"query"`
	Items            []VerifiedWorkflowItem `json:"items"`
	Truncated        bool                   `json:"truncated,omitempty"`
	Summary          string                 `json:"summary"`
	Strategy         string                 `json:"strategy"`
	RecommendedSteps []RecommendedStep      `json:"recommended_steps,omitempty"`
}

type WorkflowBriefResponse added in v0.3.3

type WorkflowBriefResponse struct {
	Query            string             `json:"query"`
	Narrative        string             `json:"narrative"`
	CriticalPath     []CriticalPathNode `json:"critical_path"`
	HealthScore      float64            `json:"health_score"`
	Confidence       string             `json:"confidence"`
	PhaseCounts      map[string]int     `json:"phase_counts"`
	RiskFlags        []RiskFlag         `json:"risk_flags,omitempty"`
	Strategy         string             `json:"strategy"`
	RecommendedSteps []RecommendedStep  `json:"recommended_steps,omitempty"`
}

WorkflowBriefResponse is a concise, grounded workflow summary synthesized from verified items.

Jump to

Keyboard shortcuts

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