core

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalysisResult

type AnalysisResult struct {
	ProjectID      ID             `json:"project_id"`
	Nodes          []Node         `json:"nodes"`
	Relationships  []Relationship `json:"relationships"`
	TotalFiles     int            `json:"total_files"`
	TotalPackages  int            `json:"total_packages"`
	TotalFunctions int            `json:"total_functions"`
	TotalStructs   int            `json:"total_structs"`
	AnalyzedAt     time.Time      `json:"analyzed_at"`
	Duration       time.Duration  `json:"duration"`
}

AnalysisResult represents the result of analyzing a codebase

type Error

type Error struct {
	Err      error          `json:"error"`
	Code     ErrorCode      `json:"code"`
	Metadata map[string]any `json:"metadata,omitempty"`
}

Error represents a structured error with code and metadata

func NewError

func NewError(err error, code ErrorCode, metadata map[string]any) *Error

NewError creates a new structured error for domain boundaries

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface

func (*Error) Is

func (e *Error) Is(target error) bool

Is checks if the error matches the target error

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the wrapped error

type ErrorCode

type ErrorCode string

ErrorCode represents a unique error code

const (
	// Parser errors
	ErrorCodeParseFailure      ErrorCode = "PARSE_FAILURE"
	ErrorCodeInvalidSyntax     ErrorCode = "INVALID_SYNTAX"
	ErrorCodeFileNotFound      ErrorCode = "FILE_NOT_FOUND"
	ErrorCodeDirectoryNotFound ErrorCode = "DIRECTORY_NOT_FOUND"

	// Graph errors
	ErrorCodeGraphConnection  ErrorCode = "GRAPH_CONNECTION_FAILED"
	ErrorCodeGraphQuery       ErrorCode = "GRAPH_QUERY_FAILED"
	ErrorCodeGraphWrite       ErrorCode = "GRAPH_WRITE_FAILED"
	ErrorCodeGraphTransaction ErrorCode = "GRAPH_TRANSACTION_FAILED"

	// Configuration errors
	ErrorCodeConfigNotFound ErrorCode = "CONFIG_NOT_FOUND"
	ErrorCodeConfigInvalid  ErrorCode = "CONFIG_INVALID"
	ErrorCodeConfigWrite    ErrorCode = "CONFIG_WRITE_FAILED"

	// Analysis errors
	ErrorCodeAnalysisFailed ErrorCode = "ANALYSIS_FAILED"
	ErrorCodeNoGoFiles      ErrorCode = "NO_GO_FILES_FOUND"

	// Validation errors
	ErrorCodeValidationFailed ErrorCode = "VALIDATION_FAILED"
	ErrorCodeInvalidInput     ErrorCode = "INVALID_INPUT"
)

type ID

type ID string

ID represents a unique identifier

func NewID

func NewID() ID

NewID generates a new unique ID

func (ID) String

func (id ID) String() string

String returns the string representation of the ID

type Node

type Node struct {
	ID         ID             `json:"id"`
	Type       NodeType       `json:"type"`
	Name       string         `json:"name"`
	Path       string         `json:"path,omitempty"`
	Properties map[string]any `json:"properties,omitempty"`
	CreatedAt  time.Time      `json:"created_at"`
}

Node represents a node in the code graph

type NodeType

type NodeType string

NodeType represents the type of a node in the graph

const (
	NodeTypePackage   NodeType = "Package"
	NodeTypeFile      NodeType = "File"
	NodeTypeFunction  NodeType = "Function"
	NodeTypeStruct    NodeType = "Struct"
	NodeTypeInterface NodeType = "Interface"
	NodeTypeMethod    NodeType = "Method"
	NodeTypeImport    NodeType = "Import"
	NodeTypeConstant  NodeType = "Constant"
	NodeTypeVariable  NodeType = "Variable"
)

type Project

type Project struct {
	ID         ID        `json:"id"`
	Name       string    `json:"name"`
	RootPath   string    `json:"root_path"`
	Neo4jURI   string    `json:"neo4j_uri"`
	Neo4jUser  string    `json:"neo4j_user"`
	ConfigPath string    `json:"config_path"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

Project represents a project configuration

type RelationType

type RelationType string

RelationType represents the type of relationship between nodes

const (
	RelationContains   RelationType = "CONTAINS"
	RelationDefines    RelationType = "DEFINES"
	RelationCalls      RelationType = "CALLS"
	RelationImplements RelationType = "IMPLEMENTS"
	RelationEmbeds     RelationType = "EMBEDS"
	RelationImports    RelationType = "IMPORTS"
	RelationBelongsTo  RelationType = "BELONGS_TO"
	RelationReferences RelationType = "REFERENCES"
	RelationDependsOn  RelationType = "DEPENDS_ON"
)

type Relationship

type Relationship struct {
	ID         ID             `json:"id"`
	Type       RelationType   `json:"type"`
	FromNodeID ID             `json:"from_node_id"`
	ToNodeID   ID             `json:"to_node_id"`
	Properties map[string]any `json:"properties,omitempty"`
	CreatedAt  time.Time      `json:"created_at"`
}

Relationship represents a relationship between nodes

Jump to

Keyboard shortcuts

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