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--jsonfor 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 cacheclears only the match cache,--type journalclears only the journal,--type all(default) clears both.
All mutating operations acquire an exclusive file lock before proceeding.
Structs§
- Cache
Apply Item - Per-operation entry inside
CacheApplyPayload::items. - Cache
Apply Payload datapayload forcache applyJSON envelope.- Cache
Clear Payload datapayload forcache clearJSON envelope.- Cache
Item Error - Per-item error embedded in cache JSON payloads.
- Cache
Rollback Payload datapayload forcache rollbackJSON envelope.- Cache
Status Payload datapayload forcache statusJSON envelope.- Stale
File Info - Stale-file entry used inside
CacheStatusPayload::stale_files.
Functions§
- execute
- Dispatch the cache subcommand using the production configuration service.
- execute_
apply - Handle the
cache applysubcommand. - execute_
rollback - Handle the
cache rollbacksubcommand. - execute_
status - Handle the
cache statussubcommand. - execute_
with_ config - Execute cache management command with injected configuration service.