Documentation
¶
Index ¶
- Constants
- func AppConfigDir() (string, error)
- func AppendActivityLog(semDir, format string, args ...any)
- func AppendHookError(provider, hook, msg string)
- func AttributionV2Enabled(semDir string) bool
- func CommitAttributionSummaryPath(semDir string) string
- func EnsureGitignoreEntries(repoRoot string, entries []string) error
- func HookErrorLogPath() (string, error)
- func IsConnected(semDir string) bool
- func IsEnabled(semDir string) bool
- func IsEnabledAt(repoPath 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 HookErrorEntry
- type PlaybookAutomation
- type Settings
Constants ¶
const CommitAttributionSummaryFile = ".commit-attribution-summary"
const HookErrorLogBasename = "hook-errors.log"
HookErrorLogBasename is the filename used for the global capture sidecar log. Hooks themselves remain non-blocking (`|| true` is preserved); this file gives doctor a place to read failures that would otherwise be silent.
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 AppendHookError ¶ added in v0.3.9
func AppendHookError(provider, hook, msg string)
AppendHookError writes a JSONL entry to the global sidecar log at <AppConfigDir>/hook-errors.log. Write failures are ignored so diagnostics never block provider hooks.
The log directory is auto-created. Provider and hook may be empty for failures that do not have that context (e.g. unknown provider).
func AttributionV2Enabled ¶ added in v0.6.0
AttributionV2Enabled reads the environment override, then repository settings.
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 HookErrorLogPath ¶ added in v0.3.9
HookErrorLogPath exposes the sidecar log location for diagnostic messages.
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 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 replaces settings.json and updates the enabled marker used by hooks that cannot parse JSON.
Types ¶
type Automations ¶
type Automations struct {
Playbook PlaybookAutomation
// contains filtered or unexported fields
}
Automations configures repository automation while preserving unknown fields.
func (Automations) MarshalJSON ¶ added in v0.6.1
func (a Automations) MarshalJSON() ([]byte, error)
func (*Automations) UnmarshalJSON ¶ added in v0.6.1
func (a *Automations) UnmarshalJSON(b []byte) error
type HookErrorEntry ¶ added in v0.3.9
type HookErrorEntry struct {
Timestamp string `json:"ts"`
Provider string `json:"provider,omitempty"`
Hook string `json:"hook,omitempty"`
Message string `json:"msg"`
}
HookErrorEntry is the JSONL shape doctor consumes when grouping hook errors by provider/hook.
func ReadHookErrorTail ¶ added in v0.3.9
func ReadHookErrorTail(maxLines int) ([]HookErrorEntry, error)
ReadHookErrorTail reads up to maxLines most-recent JSONL entries from the hook-errors.log. Malformed or truncated lines are silently skipped so a partially-written record near the end of the file does not break diagnostics.
type PlaybookAutomation ¶
type PlaybookAutomation struct {
Enabled bool
// contains filtered or unexported fields
}
PlaybookAutomation configures playbook generation while preserving unknown fields.
func (PlaybookAutomation) MarshalJSON ¶ added in v0.6.1
func (p PlaybookAutomation) MarshalJSON() ([]byte, error)
func (*PlaybookAutomation) UnmarshalJSON ¶ added in v0.6.1
func (p *PlaybookAutomation) UnmarshalJSON(b []byte) error
type Settings ¶
type Settings struct {
Enabled bool
Version int
Providers []string
Trailers *bool
Automations *Automations
Connected bool
ConnectedRepoID string
// AttributionV2 enables tool-delta scoring. An absent value is disabled.
AttributionV2 *bool
// contains filtered or unexported fields
}
Settings is the repository configuration stored in settings.json. Unknown fields are preserved when the file is rewritten.
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."