claude

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IntegrationName is the unique identifier for this integration
	IntegrationName = "claude-code-hook"

	// IntegrationVersion is the adapter version
	IntegrationVersion = "3.0.0"

	// SessionStartEvent is the hook event name for file index injection
	SessionStartEvent = "SessionStart"

	// UserPromptSubmitEvent is the hook event name for facts injection
	UserPromptSubmitEvent = "UserPromptSubmit"
)
View Source
const (
	// MCPIntegrationName is the unique identifier for this integration
	MCPIntegrationName = "claude-code-mcp"

	// MCPIntegrationVersion is the adapter version
	MCPIntegrationVersion = "2.0.0"

	// MCPServerName is the identifier used in ~/.claude.json
	MCPServerName = "memorizer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaudeCodeHookAdapter added in v0.14.0

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

ClaudeCodeHookAdapter implements the Integration interface for Claude Code

func NewClaudeCodeHookAdapter added in v0.14.0

func NewClaudeCodeHookAdapter() *ClaudeCodeHookAdapter

NewClaudeCodeHookAdapter creates a new Claude Code hook integration adapter

func (*ClaudeCodeHookAdapter) Detect added in v0.14.0

func (a *ClaudeCodeHookAdapter) Detect() (bool, error)

Detect checks if Claude Code is installed on the system

func (*ClaudeCodeHookAdapter) FormatFactsOutput added in v0.14.0

func (a *ClaudeCodeHookAdapter) FormatFactsOutput(facts *types.FactsIndex, format integrations.OutputFormat) (string, error)

FormatFactsOutput formats the facts index for Claude Code (UserPromptSubmit JSON wrapper)

func (*ClaudeCodeHookAdapter) FormatOutput added in v0.14.0

func (a *ClaudeCodeHookAdapter) FormatOutput(index *types.FileIndex, format integrations.OutputFormat) (string, error)

FormatOutput formats the file index for Claude Code (SessionStart JSON wrapper)

func (*ClaudeCodeHookAdapter) GetCommand added in v0.14.0

func (a *ClaudeCodeHookAdapter) GetCommand(binaryPath string, format integrations.OutputFormat) string

GetCommand returns the command that should be executed by the hook Returns the SessionStart command for backwards compatibility

func (*ClaudeCodeHookAdapter) GetDescription added in v0.14.0

func (a *ClaudeCodeHookAdapter) GetDescription() string

GetDescription returns a human-readable description

func (*ClaudeCodeHookAdapter) GetName added in v0.14.0

func (a *ClaudeCodeHookAdapter) GetName() string

GetName returns the integration name

func (*ClaudeCodeHookAdapter) GetVersion added in v0.14.0

func (a *ClaudeCodeHookAdapter) GetVersion() string

GetVersion returns the adapter version

func (*ClaudeCodeHookAdapter) IsEnabled added in v0.14.0

func (a *ClaudeCodeHookAdapter) IsEnabled() (bool, error)

IsEnabled checks if the integration is currently configured Returns true only if BOTH SessionStart AND UserPromptSubmit hooks are installed

func (*ClaudeCodeHookAdapter) Reload added in v0.14.0

Reload applies configuration changes

func (*ClaudeCodeHookAdapter) Remove added in v0.14.0

func (a *ClaudeCodeHookAdapter) Remove() error

Remove removes the integration configuration Removes both SessionStart and UserPromptSubmit hooks Continues removing remaining hooks even if one fails, returning aggregated error

func (*ClaudeCodeHookAdapter) Setup added in v0.14.0

func (a *ClaudeCodeHookAdapter) Setup(binaryPath string) error

Setup configures the Claude Code integration Installs both SessionStart (for files) and UserPromptSubmit (for facts) hooks Uses transactional semantics: if UserPromptSubmit fails, SessionStart is rolled back

func (*ClaudeCodeHookAdapter) Update added in v0.14.0

func (a *ClaudeCodeHookAdapter) Update(binaryPath string) error

Update updates the integration configuration

func (*ClaudeCodeHookAdapter) Validate added in v0.14.0

func (a *ClaudeCodeHookAdapter) Validate() error

Validate checks the health of the integration Reports per-hook status for SessionStart and UserPromptSubmit

type ClaudeCodeMCPAdapter

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

ClaudeCodeMCPAdapter implements the Integration interface for Claude Code MCP server

func NewClaudeCodeMCPAdapter

func NewClaudeCodeMCPAdapter() *ClaudeCodeMCPAdapter

NewClaudeCodeMCPAdapter creates a new Claude Code MCP integration adapter

func (*ClaudeCodeMCPAdapter) Detect

func (a *ClaudeCodeMCPAdapter) Detect() (bool, error)

Detect checks if Claude Code with MCP support is installed on the system

func (*ClaudeCodeMCPAdapter) FormatFactsOutput added in v0.14.0

func (a *ClaudeCodeMCPAdapter) FormatFactsOutput(facts *types.FactsIndex, format integrations.OutputFormat) (string, error)

FormatFactsOutput is not used by MCP integrations MCP servers provide output through resources and tools, not direct formatting

func (*ClaudeCodeMCPAdapter) FormatOutput

func (a *ClaudeCodeMCPAdapter) FormatOutput(index *types.FileIndex, format integrations.OutputFormat) (string, error)

FormatOutput is not used by MCP integrations MCP servers provide output through resources and tools, not direct formatting

func (*ClaudeCodeMCPAdapter) GetCommand

func (a *ClaudeCodeMCPAdapter) GetCommand(binaryPath string, format integrations.OutputFormat) string

GetCommand returns the command that should be executed by Claude Code

func (*ClaudeCodeMCPAdapter) GetDescription

func (a *ClaudeCodeMCPAdapter) GetDescription() string

GetDescription returns a human-readable description

func (*ClaudeCodeMCPAdapter) GetName

func (a *ClaudeCodeMCPAdapter) GetName() string

GetName returns the integration name

func (*ClaudeCodeMCPAdapter) GetVersion

func (a *ClaudeCodeMCPAdapter) GetVersion() string

GetVersion returns the adapter version

func (*ClaudeCodeMCPAdapter) IsEnabled

func (a *ClaudeCodeMCPAdapter) IsEnabled() (bool, error)

IsEnabled checks if the integration is currently configured

func (*ClaudeCodeMCPAdapter) Reload

Reload applies configuration changes

func (*ClaudeCodeMCPAdapter) Remove

func (a *ClaudeCodeMCPAdapter) Remove() error

Remove removes the integration configuration

func (*ClaudeCodeMCPAdapter) Setup

func (a *ClaudeCodeMCPAdapter) Setup(binaryPath string) error

Setup configures the Claude Code MCP integration

func (*ClaudeCodeMCPAdapter) Update

func (a *ClaudeCodeMCPAdapter) Update(binaryPath string) error

Update updates the integration configuration

func (*ClaudeCodeMCPAdapter) Validate

func (a *ClaudeCodeMCPAdapter) Validate() error

Validate checks the health of the integration

func (*ClaudeCodeMCPAdapter) VerifyRegistration

func (a *ClaudeCodeMCPAdapter) VerifyRegistration() error

VerifyRegistration verifies the MCP server is properly registered This can be called after setup to confirm the configuration

type Hook

type Hook struct {
	Type    string  `json:"type"`
	Command string  `json:"command"`
	Timeout float64 `json:"timeout,omitempty"`
}

Hook represents a single hook command

type HookEvent

type HookEvent struct {
	Matcher string `json:"matcher,omitempty"`
	Hooks   []Hook `json:"hooks"`
}

HookEvent represents a hook event configuration

type HookSpecificOutput

type HookSpecificOutput struct {
	HookEventName     string `json:"hookEventName"`
	AdditionalContext string `json:"additionalContext,omitempty"`
}

HookSpecificOutput contains the hook-specific output data

type MCPConfig

type MCPConfig struct {
	MCPServers map[string]MCPServer `json:"mcpServers,omitempty"`
}

MCPConfig represents the Claude Code MCP configuration structure

type MCPServer

type MCPServer struct {
	Type    string            `json:"type"`              // stdio, http, sse
	Command string            `json:"command,omitempty"` // For stdio: executable path
	Args    []string          `json:"args,omitempty"`    // For stdio: command arguments
	URL     string            `json:"url,omitempty"`     // For http/sse: server URL
	Env     map[string]string `json:"env,omitempty"`     // Environment variables
}

MCPServer represents a single MCP server configuration

type SessionStartOutput

type SessionStartOutput struct {
	Continue       bool                `json:"continue"`
	SuppressOutput bool                `json:"suppressOutput"`
	SystemMessage  string              `json:"systemMessage,omitempty"`
	HookSpecific   *HookSpecificOutput `json:"hookSpecificOutput,omitempty"`
}

SessionStartOutput represents the Claude Code SessionStart hook response format

type Settings

type Settings struct {
	Hooks map[string][]HookEvent `json:"hooks,omitempty"`
}

Settings represents the Claude Code settings structure

type UserPromptSubmitOutput added in v0.14.0

type UserPromptSubmitOutput struct {
	Continue       bool                `json:"continue"`
	SuppressOutput bool                `json:"suppressOutput"`
	SystemMessage  string              `json:"systemMessage,omitempty"`
	HookSpecific   *HookSpecificOutput `json:"hookSpecificOutput,omitempty"`
}

UserPromptSubmitOutput represents the Claude Code UserPromptSubmit hook response format

Jump to

Keyboard shortcuts

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