client

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 Checkout

func Checkout(repoPath string, event protocol.EventMsg) error

Checkout switches to the correct ref based on the event.

func EnsureRepo

func EnsureRepo(reposDir, repoName, cloneURL string) (string, error)

EnsureRepo clones the repo if it doesn't exist, or fetches if it does.

func Run

func Run(ctx context.Context, cfg Config)

Run connects to the relay and processes events. Reconnects on failure.

func RunHook

func RunHook(ctx context.Context, repoPath, hook string, event protocol.EventMsg) error

RunHook executes a hook command in the repo directory.

func RunHookWithOutput

func RunHookWithOutput(ctx context.Context, repoPath, hook string, event protocol.EventMsg) (string, error)

RunHookWithOutput executes a hook and returns its combined output.

func StartAutoUpdater added in v0.2.0

func StartAutoUpdater(ctx context.Context)

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.

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"`
	GlobalHooks struct {
		Pre  string `yaml:"pre"`
		Post string `yaml:"post"`
	} `yaml:"global-hooks"`
}

type EventHooks

type EventHooks struct {
	Pre  string `yaml:"pre"`
	Post string `yaml:"post"`
}

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

func DiscoverHooks(repoPath string, event protocol.EventMsg, globalPre, globalPost string) HookSet

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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