prune

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package prune defines graph pruning operations for excising ephemeral planning entities.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBranchRequired reports a prune request without a branch.
	ErrBranchRequired = branch.ErrRequired
	// ErrBranchNotFound reports a requested branch that does not exist.
	ErrBranchNotFound = branch.ErrNotFound
	// ErrProtectedBranch reports an attempt to prune a protected default branch without force override.
	ErrProtectedBranch = errors.New("cannot prune protected branch without force")
	// ErrUncommittedStagedChanges reports an attempt to prune a branch with uncommitted staged mutations.
	ErrUncommittedStagedChanges = errors.New("branch has uncommitted staged changes")
)

Functions

This section is empty.

Types

type Request

type Request struct {
	// Branch identifies the branch whose ephemeral entities will be pruned.
	Branch string `json:"branch"`
	// DryRun reports whether to simulate pruning without writing commits or advancing branch refs.
	DryRun bool `json:"dryRun,omitempty"`
	// Force permits pruning on protected default branches.
	Force bool `json:"force,omitempty"`
	// Author optionally overrides the commit author for non-dry-run executions.
	Author string `json:"author,omitempty"`
	// Message optionally overrides the commit message for non-dry-run executions.
	Message string `json:"message,omitempty"`
}

Request describes the options for a graph pruning operation.

type Result

type Result struct {
	// Branch identifies the pruned branch.
	Branch string `json:"branch"`
	// Commit identifies the newly created pruning commit, or the unchanged head commit when dry-run/no-op.
	Commit string `json:"commit,omitempty"`
	// DryRun indicates whether this result was produced by a preview simulation.
	DryRun bool `json:"dryRun,omitempty"`
	// PrunedNodesCount is the number of ephemeral nodes removed.
	PrunedNodesCount int `json:"prunedNodesCount"`
	// PrunedEdgesCount is the number of cascading incident edges removed.
	PrunedEdgesCount int `json:"prunedEdgesCount"`
	// PrunedNodeIDs lists the identifiers of all ephemeral nodes excised.
	PrunedNodeIDs []string `json:"prunedNodeIds"`
	// OrphanedDurableNodes lists the identifiers of durable nodes that lost all connected edges.
	OrphanedDurableNodes []string `json:"orphanedDurableNodes"`
}

Result summarizes the entities removed, cascading edges excised, and durable orphans detected.

type Service

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

Service validates prune requests and delegates execution to Store.

func NewService

func NewService(store Store) Service

NewService returns a pruning service backed by store.

func (Service) Prune

func (s Service) Prune(ctx context.Context, request Request) (Result, error)

Prune validates the request, honors context cancellation, and executes pruning through Store.

type Store

type Store interface {
	// Prune performs ephemeral entity discovery, cascading edge excision, orphan detection, and commit generation.
	Prune(request Request) (Result, error)
}

Store provides the repository-level pruning persistence operations.

Jump to

Keyboard shortcuts

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