integrations

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirExists

func DirExists(path string) bool

DirExists checks if a directory exists at the given path

func EnsureDir

func EnsureDir(path string) error

EnsureDir creates a directory if it doesn't exist

func ExpandPath

func ExpandPath(path string) (string, error)

ExpandPath expands ~ to the user's home directory

func FileExists

func FileExists(path string) bool

FileExists checks if a file exists at the given path

func FormatSize

func FormatSize(bytes int64) string

FormatSize formats bytes into human-readable size

func IsExecutable

func IsExecutable(path string) bool

IsExecutable checks if a file is executable

func ValidateBinaryPath

func ValidateBinaryPath(path string) error

ValidateBinaryPath validates that a binary path exists and is executable

func ValidateOutputFormat

func ValidateOutputFormat(format string) error

ValidateOutputFormat checks if the given format string is valid

Types

type HealthStatus

type HealthStatus struct {
	// Healthy indicates if the integration is functioning correctly
	Healthy bool

	// Status is a human-readable status message
	Status string

	// Details provides additional information about the health check
	Details map[string]any

	// LastChecked is the timestamp of the last health check
	LastChecked string
}

HealthStatus represents the health status of an integration

type Integration

type Integration interface {

	// GetName returns the unique identifier for this integration (e.g., "claude-code-hook")
	GetName() string

	// GetDescription returns a human-readable description of the integration
	GetDescription() string

	// GetVersion returns the integration adapter version
	GetVersion() string

	// Detect checks if the agent framework is installed on the system
	// Returns true if the framework's configuration directory/files exist
	Detect() (bool, error)

	// IsEnabled checks if this integration is currently configured and active
	// Returns true if hooks/configuration have been set up
	IsEnabled() (bool, error)

	// Setup configures the integration by installing hooks or modifying framework config
	// binaryPath is the path to the agentic-memorizer binary
	// Returns error if setup fails
	Setup(binaryPath string) error

	// Update modifies an existing integration configuration
	// Used when the binary path or integration settings change
	// Returns error if update fails
	Update(binaryPath string) error

	// Remove uninstalls the integration by removing hooks or configuration
	// Returns error if removal fails
	Remove() error

	// GetCommand returns the full command string that the framework should execute
	// binaryPath is the path to the agentic-memorizer binary
	// format is the desired output format (xml, markdown, json)
	// Returns a command string like "agentic-memorizer read --format xml --integration claude-code-hook"
	GetCommand(binaryPath string, format OutputFormat) string

	// FormatOutput formats the index for this specific integration
	// Applies integration-specific wrapping (e.g., SessionStart JSON for Claude Code)
	// index is the memory index to format
	// format is the base output format (xml, markdown, json)
	// Returns formatted string ready for the framework to consume
	FormatOutput(index *types.Index, format OutputFormat) (string, error)

	// Validate checks the health of the integration configuration
	// Returns error if configuration is invalid or inconsistent
	Validate() error

	// Reload applies configuration changes without full teardown/setup
	// newConfig contains the updated integration configuration
	// Returns error if reload fails (caller should rollback)
	Reload(newConfig IntegrationConfig) error
}

Integration defines the interface that all agent framework integrations must implement. Each integration adapter (e.g., Claude Code, Continue, Cline) provides framework-specific implementation for configuration management, output formatting, and lifecycle operations.

type IntegrationConfig

type IntegrationConfig struct {
	// Type is the integration type (e.g., "claude-code-hook", "continue", "cline")
	Type string `mapstructure:"type" yaml:"type"`

	// Enabled indicates if this integration is active
	Enabled bool `mapstructure:"enabled" yaml:"enabled"`

	// OutputFormat is the preferred output format for this integration
	OutputFormat string `mapstructure:"output_format" yaml:"output_format"`

	// Settings contains integration-specific settings
	// For Claude Code: settings_path, matchers
	// For Continue: config_path
	// For Cline: config_path
	Settings map[string]any `mapstructure:"settings" yaml:"settings"`
}

IntegrationConfig represents the configuration for a specific integration. This is stored in the main config file under the integrations section.

type IntegrationsConfig

type IntegrationsConfig struct {
	// Enabled is a list of integration names that are enabled
	Enabled []string `mapstructure:"enabled" yaml:"enabled"`
}

IntegrationsConfig represents the complete integrations configuration section. The Enabled list tracks which integrations have been configured via setup commands. Integration-specific configuration (hooks, tools, etc.) is stored in framework-specific files (e.g., ~/.claude.json, ~/.claude/settings.json) rather than in this config file.

type OutputFormat

type OutputFormat string

OutputFormat represents the base format for rendering the memory index. This is distinct from integration-specific wrappers.

const (
	// FormatXML renders the index as XML (existing format)
	FormatXML OutputFormat = "xml"

	// FormatMarkdown renders the index as Markdown (existing format)
	FormatMarkdown OutputFormat = "markdown"

	// FormatJSON renders the index as JSON (new format - not the storage format)
	// This is a human-readable/agent-readable JSON representation
	FormatJSON OutputFormat = "json"
)

func GetDefaultOutputFormat

func GetDefaultOutputFormat() OutputFormat

GetDefaultOutputFormat returns the default output format

func ParseOutputFormat

func ParseOutputFormat(format string) (OutputFormat, error)

ParseOutputFormat parses a string into an OutputFormat

func (OutputFormat) IsValid

func (f OutputFormat) IsValid() bool

IsValid checks if the output format is valid

func (OutputFormat) String

func (f OutputFormat) String() string

String returns the string representation of the output format

type Registry

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

Registry manages all available integrations. It provides thread-safe registration, lookup, and discovery operations.

func GlobalRegistry

func GlobalRegistry() *Registry

GlobalRegistry returns the singleton registry instance

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new integration registry

func (*Registry) Count

func (r *Registry) Count() int

Count returns the number of registered integrations

func (*Registry) DetectAvailable

func (r *Registry) DetectAvailable() []Integration

DetectAvailable returns all integrations that are detected on the system. This scans for frameworks by checking if their configuration directories/files exist.

func (*Registry) DetectEnabled

func (r *Registry) DetectEnabled() []Integration

DetectEnabled returns all integrations that are currently enabled. This checks if the integration has been configured (hooks installed, etc).

func (*Registry) Exists

func (r *Registry) Exists(name string) bool

Exists checks if an integration with the given name is registered

func (*Registry) Get

func (r *Registry) Get(name string) (Integration, error)

Get retrieves an integration by name. Returns error if the integration is not found.

func (*Registry) List

func (r *Registry) List() []Integration

List returns all registered integrations. The returned slice is a copy and safe for concurrent use.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns all registered integration names

func (*Registry) Register

func (r *Registry) Register(integration Integration)

Register adds an integration to the registry. If an integration with the same name already exists, it will be replaced.

Directories

Path Synopsis
adapters

Jump to

Keyboard shortcuts

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