config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

ABOUTME: Configuration loading, user identity detection, and project identity resolution. ABOUTME: Reads JSON config file with defaults, auto-detects git identity with config override.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAgentsviewDBPath

func DefaultAgentsviewDBPath() string

DefaultAgentsviewDBPath returns the standard agentsview DB location if it exists. Checks ~/.agentsview/sessions.db first, then ~/.claude/agentsview/sessions.db.

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir returns ~/.config/agentlore/data as the default data directory.

func DetectUserIdentity

func DetectUserIdentity() (userName string, userID string, err error)

DetectUserIdentity runs git config to auto-detect the user's name and email. Returns userName, userID (email), error.

func ResolveProjectIdentity

func ResolveProjectIdentity(projectPath string) (projectID string, projectName string)

ResolveProjectIdentity returns the project ID and name for a given project path. projectID is the git remote origin URL; projectName is derived from the last path component of the remote URL without .git, or the directory basename as fallback. If the path is not a git repo or has no remote, returns ("", basename).

Types

type Config

type Config struct {
	ClickHouseAddr     string `json:"clickhouse_addr"`
	ClickHouseDatabase string `json:"clickhouse_database"`
	ClickHouseSecure   bool   `json:"clickhouse_secure"`
	ClickHouseUser     string `json:"clickhouse_user"`
	ClickHousePassword string `json:"clickhouse_password"`
	UserName           string `json:"user_name"`
	UserID             string `json:"user_id"`
	AgentsviewDBPath   string `json:"agentsview_db_path"`
	DataDir            string `json:"data_dir"`
	ServerPort         int    `json:"server_port"`
}

Config holds all daemon configuration fields.

func Load

func Load(path string) (*Config, error)

Load reads configuration from a JSON file at the given path. Returns sensible defaults when the file does not exist.

func (*Config) ResolvedUserIdentity

func (c *Config) ResolvedUserIdentity() (userID string, userName string)

ResolvedUserIdentity returns the user identity, preferring config overrides and falling back to git auto-detection. Returns userID (email), userName.

Jump to

Keyboard shortcuts

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