settings

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 12 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 CheckpointsVersion added in v0.5.6

func CheckpointsVersion(ctx context.Context) int

CheckpointsVersion returns the configured checkpoints format version, or 1 if settings cannot be loaded or the value is unset/invalid.

func IsCheckpointsV2Enabled added in v0.5.2

func IsCheckpointsV2Enabled(ctx context.Context) bool

IsCheckpointsV2Enabled checks if checkpoints v2 is enabled in settings. Returns false by default if settings cannot be loaded or the key is missing.

func IsExternalAgentsEnabled added in v0.5.0

func IsExternalAgentsEnabled(ctx context.Context) bool

IsExternalAgentsEnabled checks if external agent discovery is enabled in settings. Returns false by default if settings cannot be loaded or the key is missing.

func IsFilteredFetchesEnabled added in v0.5.5

func IsFilteredFetchesEnabled(ctx context.Context) bool

IsFilteredFetchesEnabled checks if filtered fetches should be used. When enabled, filtered fetches always resolve remote names to URLs first so git does not persist promisor settings onto named remotes in local config. Returns false by default.

func IsPushV2RefsEnabled added in v0.5.4

func IsPushV2RefsEnabled(ctx context.Context) bool

IsPushV2RefsEnabled checks if pushing v2 refs is enabled in settings. Returns false by default if settings cannot be loaded or flags are missing.

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 IsSetUpAny added in v0.5.1

func IsSetUpAny(ctx context.Context) bool

IsSetUpAny returns true if Entire has been set up in the current repository, checking both .entire/settings.json and .entire/settings.local.json. Use this to detect any prior setup, even if only local settings exist.

func IsSignCheckpointCommitsEnabled added in v0.5.6

func IsSignCheckpointCommitsEnabled(ctx context.Context) bool

IsSignCheckpointCommitsEnabled checks if checkpoint commit signing is enabled in settings. Returns true by default if settings cannot be loaded or the key is missing.

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 CheckpointRemoteConfig added in v0.5.1

type CheckpointRemoteConfig struct {
	Provider string // e.g., "github"
	Repo     string // e.g., "org/checkpoints-repo"
}

CheckpointRemoteConfig holds the structured checkpoint remote configuration. Stored in strategy_options.checkpoint_remote as {"provider": "github", "repo": "org/repo"}.

func (*CheckpointRemoteConfig) Owner added in v0.5.1

func (c *CheckpointRemoteConfig) Owner() string

Owner returns the owner portion of the repo field (before the slash). Returns empty string if the repo field doesn't contain a slash.

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"`

	// Redaction configures PII redaction behavior for transcripts and metadata.
	Redaction *RedactionSettings `json:"redaction,omitempty"`

	// Review maps agent name (e.g. "claude-code") to the review config for
	// that agent. When empty, `entire review` triggers the first-run picker.
	Review map[string]ReviewConfig `json:"review,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"`

	// ExternalAgents enables discovery and registration of external agent
	// plugins (entire-agent-* binaries on $PATH). Defaults to false.
	ExternalAgents bool `json:"external_agents,omitempty"`

	// SummaryGeneration stores provider preferences for explain --generate.
	// This is separate from strategy_options.summarize, which controls
	// checkpoint auto-summarize behavior.
	SummaryGeneration *SummaryGenerationSettings `json:"summary_generation,omitempty"`

	// Vercel indicates that the repository uses Vercel and the metadata branch
	// should include a vercel.json that disables deployments for Entire branches.
	Vercel bool `json:"vercel,omitempty"`

	// SummaryTimeoutSeconds is an optional hard deadline (in seconds) for
	// `entire explain --generate` summary generation. Zero or negative means
	// "unset" -- the caller picks the default. Not yet consumed by the
	// generate path; present so settings round-trip for a follow-up change
	// that wires it into the deadline selection.
	SummaryTimeoutSeconds int `json:"summary_timeout_seconds,omitempty"`

	// SignCheckpointCommits controls whether checkpoint commits are signed.
	// nil/true = sign (default), false = skip signing.
	SignCheckpointCommits *bool `json:"sign_checkpoint_commits,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 LoadFromBytes added in v0.5.4

func LoadFromBytes(data []byte) (*EntireSettings, error)

LoadFromBytes parses settings from raw JSON bytes without merging local overrides. Use this when you have settings content from a non-file source (e.g., git show).

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) CheckpointsVersion added in v0.5.6

func (s *EntireSettings) CheckpointsVersion() int

CheckpointsVersion returns the configured checkpoints format version from strategy_options.checkpoints_version. Returns 1 when unset, invalid, or unsupported. The currently supported versions are 1 and 2.

func (*EntireSettings) GetCheckpointRemote added in v0.5.1

func (s *EntireSettings) GetCheckpointRemote() *CheckpointRemoteConfig

GetCheckpointRemote returns the configured checkpoint remote. Expects a structured object: {"provider": "github", "repo": "org/repo"}. Returns nil if not configured, wrong type, or missing required fields.

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) GetFullTranscriptGenerationRetentionDays added in v0.5.6

func (s *EntireSettings) GetFullTranscriptGenerationRetentionDays() int

GetFullTranscriptGenerationRetentionDays returns the retention window for archived checkpoints v2 /full/* generations. Invalid, missing, or non-positive values fall back to the documented default.

func (*EntireSettings) IsCheckpointsV2Enabled added in v0.5.2

func (s *EntireSettings) IsCheckpointsV2Enabled() bool

IsCheckpointsV2Enabled checks if checkpoints v2 is enabled. Returns true when either checkpoints_v2 is set or checkpoints_version is 2.

func (*EntireSettings) IsFilteredFetchesEnabled added in v0.5.5

func (s *EntireSettings) IsFilteredFetchesEnabled() bool

IsFilteredFetchesEnabled checks if fetches should use --filter=blob:none. When enabled, filtered fetches always use resolved URLs rather than remote names to avoid persisting promisor settings onto named remotes.

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) IsPushV2RefsEnabled added in v0.5.4

func (s *EntireSettings) IsPushV2RefsEnabled() bool

IsPushV2RefsEnabled checks if pushing v2 refs is enabled. checkpoints_version: 2 forces v2 ref pushes on, regardless of push_v2_refs.

func (*EntireSettings) IsSignCheckpointCommitsEnabled added in v0.5.6

func (s *EntireSettings) IsSignCheckpointCommitsEnabled() bool

IsSignCheckpointCommitsEnabled returns true if checkpoint commits should be signed. Defaults to true when the setting is not explicitly set.

func (*EntireSettings) IsSummarizeEnabled

func (s *EntireSettings) IsSummarizeEnabled() bool

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

func (*EntireSettings) ReviewConfigFor added in v0.6.1

func (s *EntireSettings) ReviewConfigFor(agentName string) ReviewConfig

ReviewConfigFor returns the configured review config for the given agent. Returns a zero-value config when the agent has no entry; callers should check IsZero (or the individual fields) to decide whether configuration is present.

func (*EntireSettings) SummaryTimeoutValue added in v0.5.6

func (s *EntireSettings) SummaryTimeoutValue() time.Duration

SummaryTimeoutValue returns the configured hard deadline for `entire explain --generate` summary generation. Zero means "unset" -- the caller picks the default. Negative values are treated as unset.

type PIISettings added in v0.5.1

type PIISettings struct {
	Enabled        bool              `json:"enabled"`
	Email          *bool             `json:"email,omitempty"`
	Phone          *bool             `json:"phone,omitempty"`
	Address        *bool             `json:"address,omitempty"`
	CustomPatterns map[string]string `json:"custom_patterns,omitempty"`
}

PIISettings configures PII detection categories. When Enabled is true, email and phone default to true; address defaults to false.

type RedactionSettings added in v0.5.1

type RedactionSettings struct {
	PII *PIISettings `json:"pii,omitempty"`
}

RedactionSettings configures redaction behavior beyond the default secret detection.

type ReviewConfig added in v0.6.1

type ReviewConfig struct {
	// Skills is the list of slash-prefixed skill invocations configured
	// for this agent. May be empty when Prompt carries the full request.
	Skills []string `json:"skills,omitempty"`

	// Prompt, when non-empty, carries saved review instructions. When
	// Skills is non-empty it is appended after the selected skills; when
	// Skills is empty it is the full prompt for prompt-only review configs.
	Prompt string `json:"prompt,omitempty"`
}

ReviewConfig holds the per-agent review configuration. Both fields are optional; together they describe what `entire review` should ask the agent to do.

Precedence when composing the review prompt sent to the agent:

  • If Prompt is non-empty, it is used verbatim.
  • Otherwise, Skills are composed into a default template ("Please run these review skills in order: 1. /X 2. /Y").

Skills are always recorded on the checkpoint metadata regardless of which path composed the prompt — they're the structured, queryable tag alongside ReviewPrompt (which is the ground truth).

func (ReviewConfig) IsZero added in v0.6.1

func (c ReviewConfig) IsZero() bool

IsZero reports whether the config is effectively unset.

type SummaryGenerationSettings added in v0.5.6

type SummaryGenerationSettings struct {
	// Provider is the selected summary provider agent name
	// (for example "claude-code", "codex", or "gemini").
	Provider string `json:"provider,omitempty"`

	// Model is an optional model hint passed to the selected provider.
	Model string `json:"model,omitempty"`
}

SummaryGenerationSettings configures provider selection for on-demand checkpoint summaries generated by explain --generate.

func (*SummaryGenerationSettings) SetProvider added in v0.5.6

func (s *SummaryGenerationSettings) SetProvider(newProvider, newModel string)

SetProvider updates the provider and optionally the model, clearing any stale model from the previous provider when switching without a replacement. An empty newProvider preserves the current provider; an empty newModel preserves the current model unless the provider is changing, in which case the old model is cleared to avoid passing (say) a Claude model to Codex.

func (*SummaryGenerationSettings) Validate added in v0.5.6

func (s *SummaryGenerationSettings) Validate() error

Validate returns an error if the settings combination is semantically invalid. A model without a provider is meaningless: the model hint needs a provider to route to. The load path calls Validate() after merging, catching hand-edited files that land in this state.

Jump to

Keyboard shortcuts

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