Documentation
¶
Overview ¶
Package lifecycle contains durable primitives for repo and workspace lifecycle operations.
Index ¶
- Constants
- func CheckCWDOutsideAffectedTree(req CWDSafetyRequest) error
- func ConsumeOperation(repoRoot, operationID string) error
- func MoveSameFilesystemNoOverwrite(sourcePath, destinationPath string) error
- func OperationPath(repoRoot, operationID string) (string, error)
- func OperationsDir(repoRoot string) string
- func SameFilesystem(sourcePath, destinationParent string) (bool, error)
- func WriteOperation(repoRoot string, record OperationRecord) error
- type CWDSafetyRequest
- type OperationRecord
- type UnsafeCWDError
Constants ¶
const ( // SchemaVersion is the lifecycle operation journal schema version. SchemaVersion = 1 // PhaseConsumed marks an operation that should no longer appear as pending. PhaseConsumed = "consumed" )
Variables ¶
This section is empty.
Functions ¶
func CheckCWDOutsideAffectedTree ¶
func CheckCWDOutsideAffectedTree(req CWDSafetyRequest) error
CheckCWDOutsideAffectedTree fails closed if cwd is lexically or physically inside a tree that will be moved or deleted.
func ConsumeOperation ¶
ConsumeOperation removes a completed lifecycle journal record from the pending list.
func MoveSameFilesystemNoOverwrite ¶
MoveSameFilesystemNoOverwrite moves sourcePath to destinationPath using the platform no-overwrite atomic rename primitive. Cross-filesystem moves fail closed so callers do not accidentally fall back to copy+delete semantics.
func OperationPath ¶
OperationPath returns the journal path for a lifecycle operation ID.
func OperationsDir ¶
OperationsDir returns the lifecycle journal directory for repoRoot.
func SameFilesystem ¶
SameFilesystem reports whether sourcePath and destinationParent are on the same filesystem device.
func WriteOperation ¶
func WriteOperation(repoRoot string, record OperationRecord) error
WriteOperation validates and atomically writes a lifecycle journal record.
Types ¶
type CWDSafetyRequest ¶
CWDSafetyRequest describes a mutation that would move or delete AffectedRoot.
type OperationRecord ¶
type OperationRecord struct {
SchemaVersion int `json:"schema_version"`
OperationID string `json:"operation_id"`
OperationType string `json:"operation_type"`
RepoID string `json:"repo_id"`
Phase string `json:"phase"`
RecommendedNextCommand string `json:"recommended_next_command"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastError string `json:"last_error,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
OperationRecord is the durable lifecycle journal record stored as JSON under .jvs/lifecycle/operations/<operation-id>.json.
func ListPendingOperations ¶
func ListPendingOperations(repoRoot string) ([]OperationRecord, error)
ListPendingOperations returns all non-consumed lifecycle journal records in a stable creation-time order.
func ReadOperation ¶
func ReadOperation(repoRoot, operationID string) (OperationRecord, error)
ReadOperation reads one lifecycle journal record by operation ID.
type UnsafeCWDError ¶
UnsafeCWDError carries the user-facing safe command while remaining comparable with errclass.ErrLifecycleUnsafeCWD.
func (*UnsafeCWDError) As ¶
func (e *UnsafeCWDError) As(target any) bool
func (*UnsafeCWDError) Error ¶
func (e *UnsafeCWDError) Error() string
func (*UnsafeCWDError) Is ¶
func (e *UnsafeCWDError) Is(target error) bool