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
- func CheckpointsVersion(ctx context.Context) int
- func ClonePreferencesPath(ctx context.Context) (string, error)
- func IsCheckpointsV2Enabled(ctx context.Context) bool
- func IsExternalAgentsEnabled(ctx context.Context) bool
- func IsFilteredFetchesEnabled(ctx context.Context) bool
- func IsPushV2RefsEnabled(ctx context.Context) bool
- func IsSetUp(ctx context.Context) bool
- func IsSetUpAndEnabled(ctx context.Context) bool
- func IsSetUpAny(ctx context.Context) bool
- func IsSignCheckpointCommitsEnabled(ctx context.Context) bool
- func IsSummarizeEnabled(ctx context.Context) bool
- func LoadLocalRaw(ctx context.Context) (path string, raw map[string]json.RawMessage, exists bool, err error)
- func LoadProjectRaw(ctx context.Context) (path string, raw map[string]json.RawMessage, exists bool, err error)
- func Save(ctx context.Context, settings *EntireSettings) error
- func SaveClonePreferences(ctx context.Context, prefs *ClonePreferences) error
- func SaveLocal(ctx context.Context, settings *EntireSettings) error
- func SaveProjectRaw(path string, raw map[string]json.RawMessage) error
- type CheckpointRemoteConfig
- type ClonePreferences
- type EntireSettings
- func (s *EntireSettings) CheckpointsVersion() int
- func (s *EntireSettings) GetCheckpointRemote() *CheckpointRemoteConfig
- func (s *EntireSettings) GetCommitLinking() string
- func (s *EntireSettings) GetFullTranscriptGenerationRetentionDays() int
- func (s *EntireSettings) IsCheckpointsV2Enabled() bool
- func (s *EntireSettings) IsFilteredFetchesEnabled() bool
- func (s *EntireSettings) IsPushSessionsDisabled() bool
- func (s *EntireSettings) IsPushV2RefsEnabled() bool
- func (s *EntireSettings) IsSignCheckpointCommitsEnabled() bool
- func (s *EntireSettings) IsSummarizeEnabled() bool
- func (s *EntireSettings) ReviewConfigFor(agentName string) ReviewConfig
- func (s *EntireSettings) SummaryTimeoutValue() time.Duration
- type PIISettings
- type RedactionSettings
- type ReviewConfig
- type SummaryGenerationSettings
Constants ¶
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" // ClonePreferencesFile is the path inside the git common dir for clone-local preferences. ClonePreferencesFile = "entire/preferences.json" )
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
CheckpointsVersion returns the configured checkpoints format version, or 1 if settings cannot be loaded or the value is unset/invalid.
func ClonePreferencesPath ¶ added in v0.6.2
ClonePreferencesPath returns the clone-local preferences path in the git common dir.
func IsCheckpointsV2Enabled ¶ added in v0.5.2
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
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
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
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
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
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
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
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 ¶
IsSummarizeEnabled checks if auto-summarize is enabled in settings. Returns false by default if settings cannot be loaded or the key is missing.
func LoadLocalRaw ¶ added in v0.6.2
func LoadLocalRaw(ctx context.Context) (path string, raw map[string]json.RawMessage, exists bool, err error)
LoadLocalRaw reads .entire/settings.local.json as a generic JSON object, mirroring LoadProjectRaw for the per-developer overrides file. Returns exists=false (and an empty raw map) when the file does not exist — the common case for users who haven't created the local override file.
Pair with the migration flow: callers can use this to detect when local overrides would mask a freshly-migrated setting, then warn the user before performing the migration.
func LoadProjectRaw ¶ added in v0.6.2
func LoadProjectRaw(ctx context.Context) (path string, raw map[string]json.RawMessage, exists bool, err error)
LoadProjectRaw reads .entire/settings.json as a generic JSON object so callers can inspect or mutate individual keys without losing unrelated fields to round-trip decoding.
Returns:
- path: absolute path of the project settings file.
- raw: parsed JSON object, or an empty map when the file is missing.
- exists: false when the file does not exist (raw is empty); true otherwise.
- err: parse error or read error other than ENOENT.
Pair with SaveProjectRaw for read-modify-write flows like the review-key migration. Owning the path resolution and raw IO here keeps callers from duplicating settings parsing in violation of the "Settings access must go through the settings package" rule in CLAUDE.md.
func Save ¶ added in v0.3.12
func Save(ctx context.Context, settings *EntireSettings) error
Save saves the settings to .entire/settings.json.
func SaveClonePreferences ¶ added in v0.6.2
func SaveClonePreferences(ctx context.Context, prefs *ClonePreferences) error
SaveClonePreferences saves clone-local preferences to the git common dir.
func SaveLocal ¶ added in v0.3.12
func SaveLocal(ctx context.Context, settings *EntireSettings) error
SaveLocal saves the settings to .entire/settings.local.json.
func SaveProjectRaw ¶ added in v0.6.2
func SaveProjectRaw(path string, raw map[string]json.RawMessage) error
SaveProjectRaw writes a generic JSON object back to .entire/settings.json atomically (temp file + rename). Callers should mutate the map returned by LoadProjectRaw and pass it back here so unrelated fields are preserved.
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 ClonePreferences ¶ added in v0.6.2
type ClonePreferences struct {
Review map[string]ReviewConfig `json:"review,omitempty"`
ReviewFixAgent string `json:"review_fix_agent,omitempty"`
// ReviewMigrationDismissed records that the user declined the one-shot
// migration of review keys from project settings to clone-local prefs.
// Once true, `entire review` stops prompting on every invocation; the
// user can re-enable by editing this file or deleting the key.
ReviewMigrationDismissed bool `json:"review_migration_dismissed,omitempty"`
}
ClonePreferences stores clone-local, uncommitted preferences that should be shared by linked worktrees in the same git clone.
Stored in the git common dir (not the worktree) so multiple worktrees of the same clone see the same preferences. Not committed because the file lives inside .git/.
func LoadClonePreferences ¶ added in v0.6.2
func LoadClonePreferences(ctx context.Context) (*ClonePreferences, error)
LoadClonePreferences loads clone-local preferences from the git common dir.
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"`
// ReviewFixAgent is the default agent used when applying aggregate or
// multi-agent review findings with `entire review --fix`.
ReviewFixAgent string `json:"review_fix_agent,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" -- falls back to the per-run --summary-timeout-seconds flag
// (if set) or the package default (5 minutes). Raise for very large
// transcripts; lower (e.g. 30) for fast-fail in CI.
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 clone-local preferences from the git common dir, then applies any overrides from .entire/settings.local.json if it exists. Returns default settings if no settings or preferences 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"`
// CustomRedactions is a label → RE2 regex map for user-defined patterns
// to scrub from transcripts. Use it for internal credential shapes the
// bundled detectors don't know about, project codenames, or any other
// string pattern you don't want stored. Each match is replaced with the
// bare "REDACTED" token used by the built-in secret layers, not the
// "[REDACTED_<LABEL>]" token used by PII. Failed regex compilations are
// logged via slog.Warn and the rule is skipped.
CustomRedactions map[string]string `json:"custom_redactions,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.