Documentation
¶
Overview ¶
Package exec is the command source connector: it runs the user's own command on the poll tick and ingests its stdout as an authoritative snapshot, so a CLI is a first-party source with no external scheduler, no webhook bridge, and no hand-rolled state file.
It is the pull counterpart to the webhook connector's push, and it carries the property a webhook structurally cannot: stdout is the complete current set, so an item that stops appearing is authoritatively gone. See ADR a-command-is-a-source for the trust, failure and cadence decisions the shape rests on.
Index ¶
Constants ¶
const SourceKind = "exec"
SourceKind is the inbox source_kind an exec observation carries.
Variables ¶
var Descriptor = connector.Descriptor{ Type: "sources.exec", Title: "Command source", Mode: connector.ModePull, Stability: connector.Stable, Capabilities: connector.CapClassify | connector.CapConfirmAbsence, NewConfig: func() connector.Config { return &Config{} }, }
Descriptor declares the connector. It is pull: the producer drains it on a tick, and the config's own interval is a floor under that.
It declares CapClassify and CapConfirmAbsence for the same reason sources.grafana_alerts does: stdout is the complete current set by contract, so an item that left it is resolved rather than merely unseen.
Functions ¶
func NewFactory ¶
func NewFactory(env Environment) connector.Factory
NewFactory builds the instance half of the declaration over the resolved subprocess environment.
Types ¶
type Config ¶
type Config struct {
// Command is the shell command line, run through `sh -c`.
Command string `` /* 250-byte string literal not displayed */
// Timeout bounds one run. Required: a command with no deadline can hang
// the poll loop, and a source that silently stopped producing is the
// failure this node exists to remove.
Timeout duration.Duration `` /* 198-byte string literal not displayed */
// Cwd is the directory the command runs in. Empty is the desktop
// process's own, which for a launched .app bundle is not a useful place.
Cwd string `` /* 190-byte string literal not displayed */
// Env adds to the resolved environment for this command only.
Env map[string]string `` /* 222-byte string literal not displayed */
// Interval is the floor between runs, for a command that is expensive or
// only worth running hourly. Empty runs it on every poll tick.
Interval duration.Duration `` /* 246-byte string literal not displayed */
// Icon is the glyph feed rows render for this node's items, from the
// shared feed icon set. Purely cosmetic; empty means the default.
Icon string `` /* 167-byte string literal not displayed */
// Image, when set, is the content hash of an uploaded image shown as this
// node's feed mark instead of Icon (see cmd/desktop/internal/app/sourcemark). Empty or a
// missing file falls back to Icon.
Image string `` /* 244-byte string literal not displayed */
}
Config is a command source node's configuration.
The command is a fixed string, never a template: nothing ingested, fetched, or otherwise off-machine can influence what runs. See ADR a-command-is-a-source — that invariant is what keeps this node as trusted as the file it is written in and no more.
func (*Config) MarkImage ¶
MarkImage and SetMarkImage read and record the feed-mark image hash, satisfying the flow store's image-mark interface.
func (*Config) SetMarkImage ¶
type Environment ¶
Environment supplies the environment the command runs in. A desktop launch inherits PATH=/usr/bin:/bin:/usr/sbin:/sbin, and the commands worth polling live wherever a package manager put them (ADR subprocess-environment).