Documentation
¶
Overview ¶
Package agent provides the adapter pattern for agent integrations.
Index ¶
- Constants
- func AgentDisplayName(name string) string
- func ApplyLoggingLevel(event *events.Event, level config.LoggingLevel)
- func RedactEvent(event *events.Event, checker *events.PrivacyChecker)
- func SupportedAgents() []string
- type Adapter
- type DetectionResult
- type HookStatus
- type InstallOptions
- type InstallResult
- type Registry
- type UninstallOptions
- type UninstallResult
Constants ¶
const ( AgentClaudeCode = "claude-code" AgentCursor = "cursor" AgentGemini = "gemini" AgentOpenCode = "opencode" AgentOpenClaw = "openclaw" AgentWindsurf = "windsurf" AgentPiAgent = "pi-agent" AgentCodex = "codex" )
Standard agent identifiers.
const ( DisplayClaudeCode = "Claude Code" DisplayCursor = "Cursor" DisplayGemini = "Gemini CLI" DisplayOpenCode = "OpenCode" DisplayOpenClaw = "OpenClaw" DisplayWindsurf = "Windsurf" DisplayPiAgent = "Pi Agent" DisplayCodex = "Codex" )
Standard agent display names.
Variables ¶
This section is empty.
Functions ¶
func AgentDisplayName ¶
AgentDisplayName returns the display name for an agent identifier.
func ApplyLoggingLevel ¶
func ApplyLoggingLevel(event *events.Event, level config.LoggingLevel)
ApplyLoggingLevel strips fields from the event based on the configured logging level. Must be called after parsing and before saving. Sensitive events have their content stripped unconditionally regardless of level.
func RedactEvent ¶ added in v0.7.0
func RedactEvent(event *events.Event, checker *events.PrivacyChecker)
RedactEvent applies the checker's redaction patterns to event fields that may contain user content. Must be called after parsing and before ApplyLoggingLevel, so configured patterns are scrubbed before any storage or logging-level filtering. No-ops on a nil checker or event.
func SupportedAgents ¶
func SupportedAgents() []string
SupportedAgents returns the list of supported agent names.
Types ¶
type Adapter ¶
type Adapter interface {
// Name returns the machine identifier (e.g., "claude-code").
Name() string
// DisplayName returns the human-readable name (e.g., "Claude Code").
DisplayName() string
// Detect determines if the agent is installed.
Detect(ctx context.Context) (*DetectionResult, error)
// Install installs hooks for this agent.
Install(ctx context.Context, opts InstallOptions) (*InstallResult, error)
// Uninstall removes hooks from this agent.
Uninstall(ctx context.Context, opts UninstallOptions) (*UninstallResult, error)
// Status checks the current hook state.
Status(ctx context.Context) (*HookStatus, error)
// ParseEvent converts an agent-specific event to the common format.
ParseEvent(ctx context.Context, hookType string, rawData []byte) (*events.Event, error)
}
Adapter defines the interface for agent integrations.
type DetectionResult ¶
type DetectionResult struct {
// Installed indicates if the agent is installed.
Installed bool
// Version is the detected version of the agent.
Version string
// Path is the installation path of the agent.
Path string
// ConfigPath is the configuration directory path.
ConfigPath string
// HooksPath is the hooks directory path.
HooksPath string
// Message provides additional context (e.g., why not installed).
Message string
}
DetectionResult contains information about a detected agent.
type HookStatus ¶
type HookStatus struct {
// Installed indicates if hooks are installed.
Installed bool
// Hooks is the list of installed hook names.
Hooks []string
// Valid indicates if all hooks are valid (not corrupted).
Valid bool
// Issues lists any problems with the hooks.
Issues []string
}
HookStatus contains the status of installed hooks.
type InstallOptions ¶
type InstallOptions struct {
// DryRun shows what would be installed without making changes.
DryRun bool
// Force overwrites existing hooks without prompting.
Force bool
// Backup creates backups of existing hooks.
Backup bool
// BackupDir is the directory to store backups.
BackupDir string
}
InstallOptions configures hook installation.
type InstallResult ¶
type InstallResult struct {
// Success indicates if installation was successful.
Success bool
// HooksInstalled is the list of hooks that were installed.
HooksInstalled []string
// BackupPaths maps hook names to their backup paths.
BackupPaths map[string]string
// Warnings contains non-fatal warnings.
Warnings []string
// Error contains the error if installation failed.
Error error
}
InstallResult contains the result of hook installation.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages registered agent adapters.
func DefaultRegistry ¶
func DefaultRegistry() *Registry
DefaultRegistry returns a registry with all default adapters registered.
func (*Registry) DetectAll ¶
func (r *Registry) DetectAll(ctx context.Context) map[string]*DetectionResult
DetectAll runs detection on all registered adapters.
type UninstallOptions ¶
type UninstallOptions struct {
// DryRun shows what would be removed without making changes.
DryRun bool
// RestoreBackup restores backed-up hooks if available.
RestoreBackup bool
// BackupDir is the directory containing backups.
BackupDir string
}
UninstallOptions configures hook removal.
type UninstallResult ¶
type UninstallResult struct {
// Success indicates if uninstallation was successful.
Success bool
// HooksRemoved is the list of hooks that were removed.
HooksRemoved []string
// BackupsRestored indicates if backups were restored.
BackupsRestored bool
// Error contains the error if uninstallation failed.
Error error
}
UninstallResult contains the result of hook removal.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package claudecode provides the adapter for Claude Code integration.
|
Package claudecode provides the adapter for Claude Code integration. |
|
Package cursor provides the adapter for Cursor integration.
|
Package cursor provides the adapter for Cursor integration. |