command

package
v0.0.0-...-d88c8eb Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package command implements a Pilot notification plugin that executes a user-provided script from /config/scripts/ on each event. The event payload is passed as JSON on stdin and key fields are set as environment variables.

Index

Constants

This section is empty.

Variables

View Source
var ScriptsDir = "/config/scripts" //nolint:gochecknoglobals // injectable for tests

ScriptsDir is the directory from which scripts are resolved. Package-level var so tests can override it.

Functions

This section is empty.

Types

type Config

type Config struct {
	ScriptName string `json:"script_name"`
	Timeout    int    `json:"timeout,omitempty"` // seconds; default 30
}

Config holds the user-supplied settings for a command notifier.

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier is a command notifier plugin instance.

func New

func New(cfg Config) *Notifier

New creates a new Notifier from the given config.

func (*Notifier) Name

func (*Notifier) Name() string

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, event plugin.NotificationEvent) error

Notify executes the configured script with event data.

func (*Notifier) Test

func (n *Notifier) Test(_ context.Context) error

Test verifies the script file exists and is executable.

Jump to

Keyboard shortcuts

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