Documentation
¶
Index ¶
- func CalculateDuration(node *StateNode) float64
- func CaptureModulePath() string
- func CountSteps(node *StateNode) (total, passed, failed, skipped int)
- type Event
- type EventType
- type GitInfo
- type Log
- type LogEntry
- type Logger
- func (l *Logger) GetElapsed() float64
- func (l *Logger) GetEvents() []*Event
- func (l *Logger) GetStartTime() time.Time
- func (l *Logger) LogCommand(entry LogEntry)
- func (l *Logger) LogExec(result Result, id, run string, start float64, durationMs int64, err error)
- func (l *Logger) Write(state *StateNode, summary *RunSummary) error
- type Result
- type RunMetadata
- type RunSummary
- type RuntimeStats
- type StateNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateDuration ¶
CalculateDuration calculates the total duration from node timing.
func CaptureModulePath ¶
func CaptureModulePath() string
CaptureModulePath captures the Go module path from go.mod if present.
func CountSteps ¶
CountSteps counts steps by result in a StateNode tree.
Types ¶
type Event ¶
type Event struct {
// Common fields
ID string `yaml:"id"`
Type EventType `yaml:"type,omitempty"`
Start float64 `yaml:"start"` // Seconds since run started
Duration float64 `yaml:"duration"` // Seconds
Error string `yaml:"error,omitempty"` // Error message if failed
// Step event fields
Run string `yaml:"run,omitempty"`
Result Result `yaml:"result,omitempty"`
GoroutineID uint64 `yaml:"goroutine_id,omitempty"` // Only when debug is enabled
// Command event fields
Command string `yaml:"command,omitempty"` // The actual command executed
Dir string `yaml:"dir,omitempty"` // Working directory
Output string `yaml:"output,omitempty"` // stdout output
ExitCode int `yaml:"exit_code,omitempty"` // Process exit code
ParentID string `yaml:"parent_id,omitempty"` // Parent step/job ID for $() commands
Env []string `yaml:"env,omitempty"` // Environment variables (when debug enabled)
}
Event represents a single execution event in the log.
type GitInfo ¶
type GitInfo struct {
Commit string `yaml:"commit,omitempty"`
Branch string `yaml:"branch,omitempty"`
RemoteURL string `yaml:"remote_url,omitempty"`
Repository string `yaml:"repository,omitempty"` // Extracted from remote URL
}
GitInfo contains git repository information.
func CaptureGitInfo ¶
func CaptureGitInfo() *GitInfo
CaptureGitInfo captures git repository information.
type Log ¶
type Log struct {
Metadata RunMetadata `yaml:"metadata"`
State *StateNode `yaml:"state"`
Events []*Event `yaml:"events"`
Summary *RunSummary `yaml:"summary,omitempty"`
}
Log is the complete log structure written to YAML.
type LogEntry ¶ added in v0.5.2
type LogEntry struct {
Type EventType
ID string
ParentID string
Command string
Dir string
Output string
Error string
ExitCode int
Start float64
DurationMs int64
Env []string
}
LogEntry is the input for LogCommand with named fields.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger collects events during execution and writes the final log.
func NewLogger ¶
NewLogger creates a new event logger. If filePath is empty, returns nil (no logging occurs).
func (*Logger) GetElapsed ¶
GetElapsed returns the current elapsed time in seconds.
func (*Logger) GetStartTime ¶
GetStartTime returns the start time of the run.
func (*Logger) LogCommand ¶ added in v0.5.2
LogCommand logs a command execution with full details.
type RunMetadata ¶
type RunMetadata struct {
RunID string `yaml:"run_id"`
CreatedAt time.Time `yaml:"created_at"`
Pipeline string `yaml:"pipeline,omitempty"`
File string `yaml:"file,omitempty"`
ModulePath string `yaml:"module_path,omitempty"`
Git *GitInfo `yaml:"git,omitempty"`
}
RunMetadata contains information about the execution environment.
type RunSummary ¶
type RunSummary struct {
Duration float64 `yaml:"duration"` // Total duration in seconds
TotalSteps int `yaml:"total_steps"` // Total steps executed
PassedSteps int `yaml:"passed_steps"` // Steps that passed
FailedSteps int `yaml:"failed_steps"` // Steps that failed
SkippedSteps int `yaml:"skipped_steps"` // Steps that were skipped
Result Result `yaml:"result"` // Overall result
MemoryAlloc uint64 `yaml:"memory_alloc,omitempty"` // Memory allocated in bytes
Goroutines int `yaml:"goroutines,omitempty"` // Number of goroutines running
}
RunSummary provides aggregate statistics for the run.
type RuntimeStats ¶ added in v0.3.0
RuntimeStats holds memory and goroutine statistics.
func CaptureRuntimeStats ¶ added in v0.3.0
func CaptureRuntimeStats() RuntimeStats
CaptureRuntimeStats captures current memory allocation and goroutine count.
type StateNode ¶
type StateNode struct {
Name string `yaml:"name"`
ID string `yaml:"id,omitempty"`
Status string `yaml:"status"` // Readable string: pending, running, passed, failed, skipped, conditional
Result Result `yaml:"result,omitempty"`
If string `yaml:"if,omitempty"` // Condition that was evaluated
CreatedAt time.Time `yaml:"created_at"`
UpdatedAt time.Time `yaml:"updated_at,omitempty"`
Start float64 `yaml:"start,omitempty"` // Seconds offset from run start
Duration float64 `yaml:"duration,omitempty"` // Total duration in seconds
Steps int `yaml:"steps,omitempty"` // Number of steps executed (for jobs/workflow)
Children []*StateNode `yaml:"children,omitempty"`
}
StateNode represents a node in the execution state tree for YAML output.
func NodeToStateNode ¶
NodeToStateNode converts a treeview.Node to a StateNode for serialization.
func TreeNodeToStateNode ¶
TreeNodeToStateNode converts a treeview.TreeNode to a StateNode.