Documentation
¶
Overview ¶
Package proexec reports command-execution metadata (what ran, exit code, environment, resource usage, and optional command-specific structured data) to Atmos Pro whenever Atmos is running in a recognized CI environment and Atmos Pro is configured. Every command gets a fire-and-forget, best-effort asynchronous upload (CaptureAsync); a small allowlist of critical commands (terraform plan/apply, describe affected) additionally calls the blocking, configurable-timeout variant (CaptureSync) from their own execution path.
Index ¶
- func CaptureAsync(cmd *cobra.Command, err error)
- func CaptureSync(atmosConfig *schema.AtmosConfiguration, cmdName string, args []string, ...) error
- func FlagsFromCommand(cmd *cobra.Command) []string
- func IsSyncCommand(commandPath string) bool
- func SetAtmosConfig(atmosConfig *schema.AtmosConfiguration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureAsync ¶
CaptureAsync fires a best-effort, non-blocking execution-record upload for the just-completed command. It re-checks the CI+Pro gate itself (callers don't need to duplicate that check), never alters err or the caller's exit path, and blocks the caller for at most asyncFlushCeiling to maximize the chance the upload is dispatched before the process exits (FR-009).
Commands on the synchronous allowlist (IsSyncCommand) are skipped here: their own execution path already calls CaptureSync directly, and the two delivery paths are mutually exclusive per invocation (FR-007) — a command must never produce two execution records for the same run.
func CaptureSync ¶
func CaptureSync(atmosConfig *schema.AtmosConfiguration, cmdName string, args []string, flags []string, exitCode int, data any) error
CaptureSync uploads an execution record for a command classified as synchronous (terraform plan/apply, describe affected), blocking until the complete upload — including the out-of-band data upload, if data required out-of-band delivery (FR-011a) — completes or the configured timeout elapses. It re-checks the CI+Pro gate itself. Failure/timeout is warn-and-continue for all three initial synchronous commands (data-model.md's Delivery Classification table): a warning is logged and CaptureSync returns nil so a delivery outage never turns a successful command into a failed CI run. args MUST hold only positional arguments and flags MUST hold only CLI flags (FR-003b).
func FlagsFromCommand ¶
FlagsFromCommand derives the execution record's Flags field (FR-003b) from a Cobra command: every flag actually passed (Changed == true), as bare tokens exactly as typed on the command line — a bool-typed flag (e.g. --upload-status) appears alone, with no synthesized value; a value-bearing flag (e.g. -s/--stack) contributes its token and value as two separate array entries. This is the single source of truth for both the async (commandArgsAndFlags, above) and sync (internal/exec's captureExecMetadataSync) delivery paths — they MUST NOT diverge (research.md Decision 14).
func IsSyncCommand ¶
IsSyncCommand reports whether commandPath (a full Cobra command path, e.g. cmd.CommandPath() or "atmos "+"terraform "+subCommand) is on the synchronous execution-record delivery allowlist (FR-007).
func SetAtmosConfig ¶
func SetAtmosConfig(atmosConfig *schema.AtmosConfiguration)
SetAtmosConfig registers the loaded Atmos configuration for use by CaptureAsync. Must be called once during startup (cmd/root.go's Execute), before any command runs.
Types ¶
This section is empty.