Documentation
¶
Index ¶
- Constants
- func ConfigPath(baseDir string) string
- func GetGlobalConfigDir(platform string) string
- func HandleSessionStart() error
- func HandleSessionStartForPlatform(platform string) error
- func MigrateConfig(baseDir string, force bool) (string, error)
- func SaveConfig(projectPath string, config *Config) error
- func ValidateConfig(config *Config) error
- type Config
- func GetDefaultConfig() *Config
- func LoadConfig(projectPath string) (*Config, error)
- func LoadConfigForPlatform(projectPath, platform string) (*Config, error)
- func LoadConfigFromPath(path string) (*Config, error)
- func LoadConfigWithFallback() (*Config, error)
- func LoadConfigWithFallbackForPlatform(platform string) (*Config, error)
- type Definition
- type Manager
- func (m *Manager) CreatePersona(name string) error
- func (m *Manager) GetCurrentPersona() (string, error)
- func (m *Manager) GetPersonaPath(name string) string
- func (m *Manager) ListPersonas() ([]string, error)
- func (m *Manager) PersonaExists(name string) bool
- func (m *Manager) ReadPersona(name string) (string, error)
- func (m *Manager) ReadPersonaForContext(name string) (string, error)
- type PersonaFile
- type VoiceConfig
Constants ¶
const ( ConfigFileName = "ccpersona.json" LegacyPersonaFileName = "persona.json" LegacyVoiceConfigName = "config.json" ClaudeDir = ".claude" AgentsDir = ".agents" CodexDir = ".codex" CursorDir = ".cursor" DirPermission = 0755 FilePermission = 0600 )
const ( PlatformClaudeCode = "claude-code" PlatformCodex = "codex" PlatformCursor = "cursor" )
Platform identifiers for platform-specific configuration.
Variables ¶
This section is empty.
Functions ¶
func ConfigPath ¶ added in v0.1.21
ConfigPath returns the canonical ccpersona config path under baseDir.
func GetGlobalConfigDir ¶ added in v0.1.11
GetGlobalConfigDir returns the canonical global config directory.
func HandleSessionStart ¶
func HandleSessionStart() error
HandleSessionStart is the main entry point for hook functionality This is a convenience wrapper for HandleSessionStartForPlatform with empty platform.
func HandleSessionStartForPlatform ¶ added in v0.1.10
HandleSessionStartForPlatform is the main entry point for hook functionality with platform support
func MigrateConfig ¶ added in v0.1.21
MigrateConfig merges legacy persona and voice config files into .agents/ccpersona.json under baseDir.
func SaveConfig ¶
SaveConfig saves unified configuration to .agents/ccpersona.json.
func ValidateConfig ¶
ValidateConfig checks if the unified configuration is valid.
Types ¶
type Config ¶
type Config struct {
Name string `json:"name"`
Voice *VoiceConfig `json:"voice,omitempty"`
CustomInstructions string `json:"custom_instructions,omitempty"`
Engines map[string]voice.EngineUserConfig `json:"engines,omitempty"`
}
Config represents the persona configuration for a project
func GetDefaultConfig ¶
func GetDefaultConfig() *Config
GetDefaultConfig returns a default persona configuration.
func LoadConfig ¶
LoadConfig loads unified ccpersona configuration from the specified project.
func LoadConfigForPlatform ¶ added in v0.1.10
LoadConfigForPlatform loads unified configuration from .agents/ccpersona.json. Platform is accepted for call-site compatibility, but no longer changes the path: the unified config is shared across Claude Code, Codex, Cursor, and MCP.
func LoadConfigFromPath ¶ added in v0.1.21
LoadConfigFromPath loads a specific unified config file strictly.
func LoadConfigWithFallback ¶ added in v0.1.8
LoadConfigWithFallback loads configuration from the current directory, falling back to ~/.agents/ccpersona.json.
func LoadConfigWithFallbackForPlatform ¶ added in v0.1.10
LoadConfigWithFallbackForPlatform loads unified project config first, then unified global config. Broken files are reported to stderr and ignored so runtime paths such as voice synthesis can continue with built-in defaults.
func (*Config) ToVoiceConfigFile ¶ added in v0.1.21
func (c *Config) ToVoiceConfigFile() *voice.ConfigFile
ToVoiceConfigFile projects the unified config onto the voice resolver's file representation. The new schema has one active voice block, so it becomes the provider-specific config for voice.provider.
func (*Config) ToVoiceInput ¶ added in v0.1.21
func (c *Config) ToVoiceInput() voice.PersonaVoiceInput
ToVoiceInput converts the unified config into the small resolver input used for persona-level precedence.
type Definition ¶
type Definition struct {
Name string `json:"name"`
Description string `json:"description"`
FilePath string `json:"file_path"`
Tone string `json:"tone"`
Approach string `json:"approach"`
Specialties []string `json:"specialties"`
DialogueStyle string `json:"dialogue_style"`
Values map[string]string `json:"values"`
}
Definition represents a persona definition
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles persona operations
func (*Manager) CreatePersona ¶
CreatePersona creates a new persona from a template
func (*Manager) GetCurrentPersona ¶
GetCurrentPersona returns the currently configured persona name from persona.json
func (*Manager) GetPersonaPath ¶
GetPersonaPath returns the full path to a persona file
func (*Manager) ListPersonas ¶
ListPersonas returns all available personas
func (*Manager) PersonaExists ¶
PersonaExists checks if a persona exists
func (*Manager) ReadPersona ¶
ReadPersona reads and returns the raw content of a persona file (including front matter).
type PersonaFile ¶
type PersonaFile struct {
Title string
Tone string
Approach string
Values string
CustomSections map[string]string
}
PersonaFile represents the structure of a persona markdown file
type VoiceConfig ¶
type VoiceConfig struct {
Provider string `json:"provider,omitempty"`
Speaker int `json:"speaker,omitempty"`
Volume float64 `json:"volume,omitempty"`
Speed float64 `json:"speed,omitempty"`
APIKey string `json:"api_key,omitempty"`
Voice string `json:"voice,omitempty"`
Model string `json:"model,omitempty"`
Format string `json:"format,omitempty"`
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
BaseURL string `json:"base_url,omitempty"`
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
Stability float64 `json:"stability,omitempty"`
SimilarityBoost float64 `json:"similarity_boost,omitempty"`
Style float64 `json:"style,omitempty"`
UseSpeakerBoost *bool `json:"use_speaker_boost,omitempty"`
Region string `json:"region,omitempty"`
Engine string `json:"engine,omitempty"`
SampleRate string `json:"sample_rate,omitempty"`
}
VoiceConfig represents the active voice synthesis settings for a persona.
func (*VoiceConfig) ToProviderConfig ¶ added in v0.1.21
func (v *VoiceConfig) ToProviderConfig() voice.ProviderConfig
ToProviderConfig converts the active voice block into provider-specific TTS settings.