ops

package
v0.32.33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitMutationStage          = "stage"
	GitMutationUnstage        = "unstage"
	GitMutationDiscard        = "discard"
	GitMutationCommit         = "commit"
	GitMutationSwitchBranch   = "switch_branch"
	GitMutationCheckoutCommit = "checkout_commit"
	GitMutationWorktreeAdd    = "worktree_add"
	GitMutationWorktreeRemove = "worktree_remove"
	GitMutationFetch          = "fetch"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Approval

type Approval struct {
	ID          string           `json:"id"`
	Type        string           `json:"type"`
	Status      string           `json:"status"`
	RequestedAt time.Time        `json:"requested_at"`
	UpdatedAt   time.Time        `json:"updated_at"`
	ReviewedAt  *time.Time       `json:"reviewed_at,omitempty"`
	Plan        CleanupPlan      `json:"plan"`
	GitMutation *GitMutationPlan `json:"git_mutation,omitempty"`
	Note        string           `json:"note,omitempty"`
}

type AutomationAuditEntry added in v0.31.108

type AutomationAuditEntry struct {
	ID        string         `json:"id"`
	Timestamp time.Time      `json:"timestamp"`
	Actor     string         `json:"actor"`
	Action    string         `json:"action"`
	Reason    string         `json:"reason,omitempty"`
	SessionID string         `json:"session_id,omitempty"`
	CWD       string         `json:"cwd,omitempty"`
	Result    string         `json:"result"`
	Details   map[string]any `json:"details,omitempty"`
}

type AutomationAuditListOptions added in v0.31.108

type AutomationAuditListOptions struct {
	Limit     int
	SessionID string
}

type CleanupApplyResult

type CleanupApplyResult struct {
	ApprovalID   string   `json:"approval_id"`
	DeletedCount int      `json:"deleted_count"`
	DeletedBytes int64    `json:"deleted_bytes"`
	Errors       []string `json:"errors,omitempty"`
}

type CleanupCandidate

type CleanupCandidate struct {
	Path      string `json:"path"`
	SizeBytes int64  `json:"size_bytes"`
	Reason    string `json:"reason,omitempty"`
}

type CleanupPlan

type CleanupPlan struct {
	ApprovalID string             `json:"approval_id"`
	CreatedAt  time.Time          `json:"created_at"`
	TotalBytes int64              `json:"total_bytes"`
	Candidates []CleanupCandidate `json:"candidates"`
}

type GitMutationApplyResult added in v0.31.109

type GitMutationApplyResult struct {
	ApprovalID   string `json:"approval_id"`
	SessionID    string `json:"session_id,omitempty"`
	Root         string `json:"root"`
	Action       string `json:"action"`
	Path         string `json:"path,omitempty"`
	Branch       string `json:"branch,omitempty"`
	Hash         string `json:"hash,omitempty"`
	WorktreePath string `json:"worktree_path,omitempty"`
	NewBranch    string `json:"new_branch,omitempty"`
	Result       string `json:"result"`
	Output       string `json:"output,omitempty"`
	Destructive  bool   `json:"destructive,omitempty"`
}

type GitMutationPlan added in v0.31.109

type GitMutationPlan struct {
	ApprovalID   string    `json:"approval_id"`
	Type         string    `json:"type"`
	CreatedAt    time.Time `json:"created_at"`
	SessionID    string    `json:"session_id,omitempty"`
	Root         string    `json:"root"`
	Action       string    `json:"action"`
	Path         string    `json:"path,omitempty"`
	Branch       string    `json:"branch,omitempty"`
	Message      string    `json:"message,omitempty"`
	Hash         string    `json:"hash,omitempty"`
	WorktreePath string    `json:"worktree_path,omitempty"`
	NewBranch    string    `json:"new_branch,omitempty"`
	Reason       string    `json:"reason,omitempty"`
	Command      string    `json:"command"`
	Destructive  bool      `json:"destructive,omitempty"`
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(workspaceDir string, opts Options) *Manager

func (*Manager) ApplyCleanup

func (m *Manager) ApplyCleanup(ctx context.Context, approvalID string) (CleanupApplyResult, error)

func (*Manager) ApplyGitMutation added in v0.31.109

func (m *Manager) ApplyGitMutation(ctx context.Context, approvalID string) (GitMutationApplyResult, error)

func (*Manager) Approve

func (m *Manager) Approve(approvalID string) error

func (*Manager) CreateCleanupPlan

func (m *Manager) CreateCleanupPlan(ctx context.Context) (CleanupPlan, error)

func (*Manager) CreateGitMutationApproval added in v0.31.109

func (m *Manager) CreateGitMutationApproval(ctx context.Context, plan GitMutationPlan) (GitMutationPlan, error)

func (*Manager) GetApproval added in v0.31.109

func (m *Manager) GetApproval(approvalID string) (Approval, error)

func (*Manager) ListApprovals

func (m *Manager) ListApprovals() ([]Approval, error)

func (*Manager) ListAutomationAudit added in v0.31.108

func (m *Manager) ListAutomationAudit(opts AutomationAuditListOptions) ([]AutomationAuditEntry, error)

func (*Manager) RecordAutomationAudit added in v0.31.108

func (m *Manager) RecordAutomationAudit(entry AutomationAuditEntry) (AutomationAuditEntry, error)

func (*Manager) Reject

func (m *Manager) Reject(approvalID string) error

func (*Manager) SetNote added in v0.14.0

func (m *Manager) SetNote(approvalID, note string) error

SetNote updates the note field of an approval record.

func (*Manager) Status

func (m *Manager) Status(ctx context.Context) (Status, error)

type Options

type Options struct {
	HomeDir    string
	Now        func() time.Time
	MinFileAge time.Duration
}

type Status

type Status struct {
	Timestamp       time.Time `json:"timestamp"`
	DiskTotalBytes  uint64    `json:"disk_total_bytes"`
	DiskFreeBytes   uint64    `json:"disk_free_bytes"`
	DiskUsedPercent float64   `json:"disk_used_percent"`
	ProcessCount    int       `json:"process_count"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL