Documentation
¶
Index ¶
- Constants
- func AppConfigDir() (string, error)
- func AppendActivityLog(semDir, format string, args ...any)
- func CommitAttributionSummaryPath(semDir string) string
- func EnsureGitignoreEntries(repoRoot string, entries []string) error
- func IsConnected(semDir string) bool
- func IsEnabled(semDir string) bool
- func IsEnabledAt(repoPath string) bool
- func IsImplementationSummaryEnabled(semDir string) bool
- func IsPlaybookEnabled(semDir string) bool
- func OpenWorkerLog(semDir string) (*os.File, error)
- func PreCommitCheckpointPath(semDir string) string
- func ResolveExecutable(names []string, extraCandidates ...string) string
- func SettingsPath(semDir string) string
- func ShortID(full string) string
- func TrailersEnabled(semDir string) bool
- func WriteSettings(semDir string, s Settings) error
- type Automations
- type ImplementationSummaryAutomation
- type PlaybookAutomation
- type Settings
Constants ¶
const CommitAttributionSummaryFile = ".commit-attribution-summary"
const PreCommitCheckpointFile = ".pre-commit-checkpoint"
const ShortIDLen = 8
ShortIDLen is the number of characters shown in human-facing checkpoint IDs.
Variables ¶
This section is empty.
Functions ¶
func AppConfigDir ¶
AppConfigDir returns the global Semantica config directory.
func AppendActivityLog ¶
AppendActivityLog appends a timestamped log line to .semantica/activity.log.
func EnsureGitignoreEntries ¶
EnsureGitignoreEntries appends any missing entries to the repo's .gitignore under a "# Semantica" section. Entries that already appear (with or without trailing slash for directories) are skipped.
func IsConnected ¶
IsConnected returns true if the repo is connected to Semantica.
func IsEnabled ¶
IsEnabled checks whether Semantica is enabled by looking for the marker file (.semantica/enabled) rather than parsing settings.json.
func IsEnabledAt ¶
IsEnabledAt checks whether Semantica is enabled for a repo at the given path.
func IsImplementationSummaryEnabled ¶ added in v0.2.1
IsImplementationSummaryEnabled returns true if the auto-implementation-summary automation is enabled. For existing installations that predate this setting, the field is absent in settings.json and defaults to true (matching the semantica enable default). On first read, the setting is backfilled so future reads are explicit.
func IsPlaybookEnabled ¶
IsPlaybookEnabled returns true if the auto-playbook automation is enabled.
func OpenWorkerLog ¶
OpenWorkerLog opens .semantica/worker.log in append mode. The caller is responsible for closing the returned file.
func PreCommitCheckpointPath ¶
func ResolveExecutable ¶
ResolveExecutable returns the first matching executable path for any of the provided binary names. It checks PATH first, then common user and package manager install locations used across the supported platforms.
func SettingsPath ¶
func ShortID ¶
ShortID returns the first ShortIDLen characters of a full ID. If the input is shorter than ShortIDLen, it is returned unchanged.
func TrailersEnabled ¶
TrailersEnabled returns whether attribution and diagnostics trailers are on. Defaults to true when the key is absent or settings cannot be read.
func WriteSettings ¶
WriteSettings atomically writes the settings file via tmp+rename. It also maintains a .semantica/enabled marker file used by Git hooks for a reliable enabled check without parsing JSON in shell.
Types ¶
type Automations ¶
type Automations struct {
Playbook PlaybookAutomation `json:"playbook"`
ImplementationSummary ImplementationSummaryAutomation `json:"implementation_summary"`
}
type ImplementationSummaryAutomation ¶ added in v0.2.1
type ImplementationSummaryAutomation struct {
Enabled bool `json:"enabled"`
}
type PlaybookAutomation ¶
type PlaybookAutomation struct {
Enabled bool `json:"enabled"`
}
type Settings ¶
type Settings struct {
Enabled bool `json:"enabled"`
Version int `json:"version"`
Providers []string `json:"providers,omitempty"`
Trailers *bool `json:"trailers,omitempty"`
Automations *Automations `json:"automations,omitempty"`
Connected bool `json:"connected"`
ConnectedRepoID string `json:"connected_repo_id,omitempty"`
}
func ReadSettings ¶
ReadSettings reads the settings file from the given .semantica directory. Returns zero-value Settings (Enabled: false) if the file is missing. Returns an error if the file exists but cannot be parsed, so callers can distinguish "not configured" from "settings format has changed."