Skip to main content

format_usage_summary

Function format_usage_summary 

Source
pub fn format_usage_summary(
    usage: &WorktreeDiskUsage,
    count: usize,
    config: &WorktreeConfig,
) -> String
Expand description

Formats a one-line disk-usage-and-quota summary, shared by the CLI’s zeph worktree list (src/commands/worktree.rs) and the agent-side /worktree list slash command (crates/zeph-core/src/agent/worktree_commands.rs) so the two surfaces cannot silently diverge in how they report quota status.

count is the total number of git-registered secondary worktrees under root (active + stale), matching the same count WorktreeManager::create and WorktreeManager::sweep use for admission and quota evaluation.

§Examples

use zeph_config::WorktreeConfig;
use zeph_worktree::{WorktreeDiskUsage, format_usage_summary};

let usage = WorktreeDiskUsage { total_bytes: 2 * 1_048_576, per_worktree: Vec::new() };
let config = WorktreeConfig { max_worktrees: Some(5), disk_quota_mb: Some(1), ..Default::default() };
let summary = format_usage_summary(&usage, 2, &config);
assert!(summary.contains("OVER"), "got: {summary}");