Documentation
¶
Index ¶
- Variables
- func Checkout(repoPath string, event protocol.EventMsg) error
- func EnsureRepo(reposDir, repoName, cloneURL string) (string, error)
- func Run(ctx context.Context, cfg Config)
- func RunHook(ctx context.Context, repoPath, hook, hookLabel string, event protocol.EventMsg) error
- func RunHookWithOutput(ctx context.Context, repoPath, hook, hookLabel string, event protocol.EventMsg) (string, error)
- func StartAutoUpdater(ctx context.Context)
- func StartRepoChecker(ctx context.Context, cfg Config)
- type Config
- type EventHooks
- type EventicConfig
- type HookSet
- type RepoLocks
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is set at build time via -ldflags "-X main.version=...". It is copied from the main package at startup.
Functions ¶
func EnsureRepo ¶
EnsureRepo clones the repo if it doesn't exist, or fetches if it does.
func RunHookWithOutput ¶
func RunHookWithOutput(ctx context.Context, repoPath, hook, hookLabel string, event protocol.EventMsg) (string, error)
RunHookWithOutput executes a hook and returns its combined output.
func StartAutoUpdater ¶ added in v0.2.0
StartAutoUpdater runs a background loop that checks for new releases every 5 minutes. When a newer version is found it replaces the running binary and exits so systemd (or the parent supervisor) can restart the service.
func StartRepoChecker ¶ added in v0.3.0
StartRepoChecker runs a background loop that periodically walks the repos directory and verifies every cloned repository is healthy. Repos that are missing a .git directory or fail a basic git sanity check are re-cloned on the default branch. Repos already checked out on a branch are left as-is.
Repos are checked one at a time to avoid overwhelming the system.
Types ¶
type Config ¶
type Config struct {
Relay string `yaml:"relay"`
Token string `yaml:"token"`
ClientID string `yaml:"client_id"`
ReposDir string `yaml:"repos_dir"`
Subscribe []string `yaml:"subscribe"`
AutoUpdate bool `yaml:"auto-update"`
AutoCheck *bool `yaml:"auto-check"`
MaxWorkers int `yaml:"max-workers"`
LogLevel string `yaml:"log-level"`
GlobalHooks struct {
Pre string `yaml:"pre"`
Post string `yaml:"post"`
} `yaml:"global-hooks"`
}
type EventHooks ¶
EventHooks defines pre/post hooks for a specific event or event.action.
type EventicConfig ¶
type EventicConfig struct {
Hooks struct {
Pre string `yaml:"pre"`
Post string `yaml:"post"`
} `yaml:"hooks"`
Events map[string]EventHooks `yaml:"events"`
}
EventicConfig is the in-repo .eventic.yaml format.
Example:
hooks:
pre: "echo preparing..."
post: "echo done"
events:
push:
post: "bruce install .deploy/deploy.yml"
pull_request:
post: "make lint"
pull_request.opened:
post: "claude -p 'Review this PR' --headless"
pull_request.synchronize:
post: "make test"
release.published:
post: "/opt/scripts/notify-release.sh"
workflow_run.completed:
post: "/opt/scripts/on-build-failure.sh"
issues.opened:
post: "claude -p 'Triage this issue' --headless"
check_suite.completed:
post: "/opt/scripts/check-status.sh"
deployment_status:
post: "/opt/scripts/deploy-status.sh"
type HookSet ¶
type HookSet struct {
Pre string // global pre hook — runs for every event
Post string // global post hook — runs for every event
EventPre string // event-specific pre hook
EventPost string // event-specific post hook
}
HookSet holds all hooks resolved for a single event.
func DiscoverHooks ¶
DiscoverHooks checks the repo for .eventic.yaml or .deploy/deploy.yml and resolves global + event-specific hooks for the given event. globalPre and globalPost are fallback hooks from the client config that are used when a repo has no hooks of its own.
type RepoLocks ¶ added in v0.3.0
type RepoLocks struct {
// contains filtered or unexported fields
}
RepoLocks provides per-repository mutual exclusion so that concurrent events targeting the same repo are serialized (queued), while events for different repos run in parallel.
func NewRepoLocks ¶ added in v0.3.0
func NewRepoLocks() *RepoLocks