settings

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package settings provides configuration loading for Entire. This package is separate from cli to allow strategy package to import it without creating an import cycle (cli imports strategy).

Index

Constants

View Source
const (
	// EntireSettingsFile is the path to the Entire settings file
	EntireSettingsFile = ".entire/settings.json"
	// EntireSettingsLocalFile is the path to the local settings override file (not committed)
	EntireSettingsLocalFile = ".entire/settings.local.json"
)
View Source
const (
	// CommitLinkingAlways auto-links commits to sessions without prompting.
	CommitLinkingAlways = "always"
	// CommitLinkingPrompt prompts the user on each commit (default for existing users).
	CommitLinkingPrompt = "prompt"
)

Commit linking mode constants.

Variables

This section is empty.

Functions

func IsSetUp added in v0.4.6

func IsSetUp(ctx context.Context) bool

IsSetUp returns true if Entire has been set up in the current repository. This checks if .entire/settings.json exists. Use this to avoid creating files/directories in repos where Entire was never enabled.

func IsSetUpAndEnabled added in v0.4.6

func IsSetUpAndEnabled(ctx context.Context) bool

IsSetUpAndEnabled returns true if Entire is both set up and enabled. This checks if .entire/settings.json exists AND has enabled: true. Use this for hooks that should be no-ops when Entire is not active.

func IsSummarizeEnabled

func IsSummarizeEnabled(ctx context.Context) bool

IsSummarizeEnabled checks if auto-summarize is enabled in settings. Returns false by default if settings cannot be loaded or the key is missing.

func Save added in v0.3.12

func Save(ctx context.Context, settings *EntireSettings) error

Save saves the settings to .entire/settings.json.

func SaveLocal added in v0.3.12

func SaveLocal(ctx context.Context, settings *EntireSettings) error

SaveLocal saves the settings to .entire/settings.local.json.

Types

type EntireSettings

type EntireSettings struct {

	// Enabled indicates whether Entire is active. When false, CLI commands
	// show a disabled message and hooks exit silently. Defaults to true.
	Enabled bool `json:"enabled"`

	// LocalDev indicates whether to use "go run" instead of the "entire" binary
	// This is used for development when the binary is not installed
	LocalDev bool `json:"local_dev,omitempty"`

	// LogLevel sets the logging verbosity (debug, info, warn, error).
	// Can be overridden by ENTIRE_LOG_LEVEL environment variable.
	// Defaults to "info".
	LogLevel string `json:"log_level,omitempty"`

	// StrategyOptions contains strategy-specific configuration
	StrategyOptions map[string]any `json:"strategy_options,omitempty"`

	// AbsoluteGitHookPath embeds the full binary path in git hooks instead of
	// bare "entire". This is needed for GUI git clients (Xcode, Tower, etc.)
	// that don't source shell profiles and can't find "entire" on PATH.
	AbsoluteGitHookPath bool `json:"absolute_git_hook_path,omitempty"`

	// Telemetry controls anonymous usage analytics.
	// nil = not asked yet (show prompt), true = opted in, false = opted out
	Telemetry *bool `json:"telemetry,omitempty"`

	// CommitLinking controls how commits are linked to agent sessions.
	// "always" = auto-link without prompting, "prompt" = ask on each commit.
	// Defaults to "prompt" (preserves existing user behavior).
	CommitLinking string `json:"commit_linking,omitempty"`

	// Deprecated: no longer used. Exists to tolerate old settings files
	// that still contain "strategy": "auto-commit" or similar.
	Strategy string `json:"strategy,omitempty"`
}

EntireSettings represents the .entire/settings.json configuration

func Load

func Load(ctx context.Context) (*EntireSettings, error)

Load loads the Entire settings from .entire/settings.json, then applies any overrides from .entire/settings.local.json if it exists. Returns default settings if neither file exists. Works correctly from any subdirectory within the repository.

func LoadFromFile added in v0.3.12

func LoadFromFile(filePath string) (*EntireSettings, error)

LoadFromFile loads settings from a specific file path without merging local overrides. Returns default settings if the file doesn't exist. Use this when you need to display individual settings files separately.

func (*EntireSettings) GetCommitLinking added in v0.4.8

func (s *EntireSettings) GetCommitLinking() string

GetCommitLinking returns the effective commit linking mode. Returns the explicit value if set, otherwise defaults to "prompt" to preserve existing user behavior.

func (*EntireSettings) IsPushSessionsDisabled added in v0.3.12

func (s *EntireSettings) IsPushSessionsDisabled() bool

IsPushSessionsDisabled checks if push_sessions is disabled in settings. Returns true if push_sessions is explicitly set to false.

func (*EntireSettings) IsSummarizeEnabled

func (s *EntireSettings) IsSummarizeEnabled() bool

IsSummarizeEnabled checks if auto-summarize is enabled in this settings instance.

Jump to

Keyboard shortcuts

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