Files
osmedeus/internal/state/types.go
T
j3ssie 9ed02e7eee refactor: code quality improvements, Docker updates, and setup enhancements
- chore: fix code style and remove unused error handling (add blank checks for closed file handles)
- chore: align struct field padding in multiple files for consistency
- fix: add 386 architecture support to goreleaser build config
- feat: add docker-publish target to Makefile for publishing to Docker Hub
- feat: refactor first-time setup into reusable installRequiredBinaries helper function
- feat: add initialization marker tracking for first-time setup completion
- feat: enhance workflow YAML detection to skip non-workflow files and hidden directories
- feat: improve database column display defaults (assets and vulnerabilities tables)
- feat: add fallback mechanism to install.sh for version detection failures
- fix: correct tarball filename generation by stripping 'v' prefix
- chore: update Docker base image from golang:1.22 to golang:1.25
- chore: update goreleaser release flags and simplify Docker build naming
- chore: fix import ordering across multiple files (alphabetical consistency)
- chore: improve install script with better version display formatting
- chore: reduce binaries per row from 10 to 6 in CLI output for better readability
2026-01-19 01:17:04 +08:00

66 lines
2.4 KiB
Go

package state
import "time"
// StateExport represents the run state exported to JSON
type StateExport struct {
Run *RunInfo `json:"run,omitempty"`
Workspace *WorkspaceInfo `json:"workspace,omitempty"`
Artifacts []string `json:"artifacts,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
}
// RunInfo contains run information for export (mirrors database.Run fields)
type RunInfo struct {
RunID string `json:"run_id"`
WorkflowName string `json:"workflow_name"`
WorkflowKind string `json:"workflow_kind"`
Target string `json:"target"`
Params map[string]any `json:"params,omitempty"`
Status string `json:"status"`
WorkspacePath string `json:"workspace_path"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
TotalSteps int `json:"total_steps"`
CompletedSteps int `json:"completed_steps"`
}
// WorkspaceInfo contains workspace information for export
type WorkspaceInfo struct {
Name string `json:"name"`
LocalPath string `json:"local_path,omitempty"`
TotalAssets int `json:"total_assets"`
TotalSubdomains int `json:"total_subdomains"`
TotalURLs int `json:"total_urls"`
TotalVulns int `json:"total_vulns"`
VulnCritical int `json:"vuln_critical"`
VulnHigh int `json:"vuln_high"`
VulnMedium int `json:"vuln_medium"`
VulnLow int `json:"vuln_low"`
VulnPotential int `json:"vuln_potential"`
RiskScore float64 `json:"risk_score"`
Tags []string `json:"tags,omitempty"`
LastRun *time.Time `json:"last_run,omitempty"`
RunWorkflow string `json:"run_workflow,omitempty"`
}
// ExportContext provides the context needed for state export
// This allows callers to provide whatever information they have available
type ExportContext struct {
RunID string
WorkflowName string
WorkflowKind string
Target string
WorkspacePath string
WorkspaceName string
Params map[string]any
Status string
StartedAt *time.Time
CompletedAt *time.Time
ErrorMessage string
TotalSteps int
CompletedSteps int
Artifacts []string
}