prune

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package prune implements the ctx system prune subcommand.

It removes stale per-session state files from .context/state/ that exceed the configured age, while preserving global state files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd

func Cmd() *cobra.Command

Cmd returns the "ctx system prune" subcommand.

Returns:

  • *cobra.Command: Configured prune subcommand

func Run

func Run(cmd *cobra.Command, days int, dryRun bool) error

Run executes the prune logic.

Scans the state directory for session-scoped files (identified by UUID patterns) older than the given number of days and removes them. Global state files (non-UUID) are preserved. Supports dry-run mode.

Parameters:

  • cmd: Cobra command for output
  • days: prune files older than this many days
  • dryRun: if true, report what would be pruned without removing

Returns:

  • error: Non-nil on state directory read failure

Types

This section is empty.

Jump to

Keyboard shortcuts

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