Skip to main content

Module cache_command

Module cache_command 

Source
Expand description

Cache management command implementation.

This module provides cache management functionality through the cache subcommand, enabling users to inspect, apply, rollback, and clear cached data from SubX operations.

§Subcommands

  • cache status — display cache metadata (path, size, age, AI model, operation count, config hash validity, snapshot freshness, journal presence). Supports --json for machine-readable output.
  • cache apply — replay cached dry-run results without calling the AI provider. Validates file snapshot and target paths, prompts for confirmation, and writes a journal for rollback.
  • cache rollback — undo the most recent batch of file operations by reading the journal and reversing entries in LIFO order.
  • cache clear — remove cached data. --type cache clears only the match cache, --type journal clears only the journal, --type all (default) clears both.

All mutating operations acquire an exclusive file lock before proceeding.

Structs§

CacheApplyItem
Per-operation entry inside CacheApplyPayload::items.
CacheApplyPayload
data payload for cache apply JSON envelope.
CacheClearPayload
data payload for cache clear JSON envelope.
CacheItemError
Per-item error embedded in cache JSON payloads.
CacheRollbackPayload
data payload for cache rollback JSON envelope.
CacheStatusPayload
data payload for cache status JSON envelope.
StaleFileInfo
Stale-file entry used inside CacheStatusPayload::stale_files.

Functions§

execute
Dispatch the cache subcommand using the production configuration service.
execute_apply
Handle the cache apply subcommand.
execute_rollback
Handle the cache rollback subcommand.
execute_status
Handle the cache status subcommand.
execute_with_config
Execute cache management command with injected configuration service.