{"modulePath":"github.com/bborbe/github-build-watcher","version":"v0.9.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package command\n\nPackage command defines the TriggerBuildCheckCommand payload and its Kafka sender for the github-build watcher's request topic.\n\n## Constants\n\n```go\nconst TriggerBuildCheckCommandOperation base.CommandOperation = \"trigger-build-check\"\n```\nTriggerBuildCheckCommandOperation is the Kafka command operation for triggering a github-build poll cycle. Wire string: \"trigger-build-check\".\n\n## Functions\n\n```go\nfunc NewTriggerBuildCheckCommandExecutor(\n\twatcher pkg.Watcher,\n) cdb.CommandObjectExecutorTx\n```\nNewTriggerBuildCheckCommandExecutor creates a cdb.CommandObjectExecutorTx that consumes TriggerBuildCheckCommand messages and drives the github-build watcher: unmarshal → validate → invoke w.Poll(ctx) on the shared watcher instance.\n\nExit-path mapping (per spec 068 § Desired Behavior 4):\n\n  - malformed payload (MarshalInto fails)    → cdb.ErrCommandObjectSkipped\n  - cmd.Validate(ctx) failure                → cdb.ErrCommandObjectSkipped\n  - w.Poll(ctx) returns non-nil error        → wrapped error (transient, retried)\n  - w.Poll(ctx) returns nil                  → nil, nil, nil (success)\n\nSendResultEnabled is false (spec Non-goal: fire-and-forget, no result topic). The executor does NOT increment any metrics — the Watcher.Poll call already owns IncPollCycle / IncPublished / IncReposScanned / IncFilterSkipped. The executor reads cmd.Force and forwards it to Watcher.Poll (spec 069): when true, the red×red episode-lock arm of the state machine publishes a salted CreateTaskCommand instead of skipping. cmd.Scope is forwarded to Watcher.Poll: a webhook-triggered command carries \"owner/repo\" and narrows the poll to that single repo (scoped poll, mirroring github-release-watcher), so one workflow\\_run delivery costs ~3 API calls, not a full fleet scan.\n\n## Types\n\n```go\ntype TriggerBuildCheckCommand struct {\n\tScope string `json:\"scope,omitempty\"`\n\tForce bool   `json:\"force,omitempty\"`\n}\n```\nTriggerBuildCheckCommand is the payload for TriggerBuildCheckCommandOperation. It is published to the github-build watcher's request topic by the /trigger HTTP handler and consumed by the in-pod command consumer.\n\nScope is reserved for a future per-repo filter UX; the executor still ignores it. Force is wired (spec 069): when true, the consuming watcher's red×red episode-lock arm publishes a salted CreateTaskCommand via pkg.DeriveTaskIDForce instead of skipping — operators can force a re-publish for a still-red build even when the episode is already locked. All other state-machine arms (green→red, red→green) ignore Force.\n\n```go\nfunc (cmd TriggerBuildCheckCommand) Validate(_ context.Context) error\n```\nValidate enforces the command's schema rules. The empty payload {} is still accepted: Force defaults to false (engages the episode-lock skip, the canonical poll-loop behaviour), and Scope remains reserved-unread. A future spec will add per-repo or per-stage validation here.\n\n```go\ntype TriggerBuildCheckCommandSender interface {\n\tSendCommand(ctx context.Context, cmd TriggerBuildCheckCommand) error\n}\n```\nTriggerBuildCheckCommandSender sends TriggerBuildCheckCommand payloads to Kafka. Calls Validate before publishing — a validation error is returned without touching Kafka.\n\n```go\nfunc NewTriggerBuildCheckCommandSender(\n\tcommandCreator base.CommandCreator,\n\tinitiator cqrsiam.Initiator,\n\tcommandObjectSender cdb.CommandObjectSender,\n) TriggerBuildCheckCommandSender\n```\nNewTriggerBuildCheckCommandSender creates a TriggerBuildCheckCommandSender. The commandCreator and initiator are injected at construction time per the cqrs/docs/producing-commands.md \"Factory Wiring\" pattern (matches trading/frontend/command's reference impl) — built once at wiring, reused across every SendCommand call. The commandObjectSender wraps the Kafka sync producer.\n\n","path":"github.com/bborbe/github-build-watcher/pkg/command","name":"command","synopsis":"Package command defines the TriggerBuildCheckCommand payload and its Kafka sender for the github-build watcher's request topic.","isRedistributable":true}
