refactor(cli): show only loaded items in startup status line

Changes the startup status line to only display items that were
actually loaded, instead of showing dots for missing items.

Before: "   · README  · AGENTS.md  ✓ Memory"
After:  "   ✓ Memory"

Also adds include prompt to the status line when specified:
"   ✓ prompt.md  ✓ Memory"

The order matches the load order: README → AGENTS.md → include prompt → Memory
This commit is contained in:
Dhanji R. Prasanna
2026-01-17 15:35:37 +05:30
parent 4877f8ae8a
commit 5622e5b21e
3 changed files with 58 additions and 38 deletions

View File

@@ -139,29 +139,36 @@ pub async fn run_agent_mode(
let readme_content_opt = read_project_readme(&workspace_dir);
let memory_content_opt = read_project_memory(&workspace_dir);
// Show what was loaded
let readme_status = if readme_content_opt.is_some() {
""
} else {
"·"
};
let agents_status = if agents_content_opt.is_some() {
""
} else {
"·"
};
let memory_status = if memory_content_opt.is_some() {
""
} else {
"·"
};
// Always print status line (part of minimal output)
print!(
"{} {} README {} AGENTS.md {} Memory{}\n",
crossterm::style::SetForegroundColor(crossterm::style::Color::DarkGrey),
readme_status, agents_status, memory_status,
crossterm::style::ResetColor
);
// Read include prompt early so we can show it in the status line
let include_prompt = read_include_prompt(include_prompt_path.as_deref());
// Build status line showing only what was loaded (in load order)
let mut loaded_items: Vec<String> = Vec::new();
if readme_content_opt.is_some() {
loaded_items.push("README".to_string());
}
if agents_content_opt.is_some() {
loaded_items.push("AGENTS.md".to_string());
}
if let Some(path) = &include_prompt_path {
if include_prompt.is_some() {
let filename = path.file_name().map(|s| s.to_string_lossy().to_string()).unwrap_or_else(|| "prompt".to_string());
loaded_items.push(filename);
}
}
if memory_content_opt.is_some() {
loaded_items.push("Memory".to_string());
}
// Print status line only if something was loaded
if !loaded_items.is_empty() {
let status_str = loaded_items.iter().map(|s| format!("{}", s)).collect::<Vec<_>>().join(" ");
print!(
"{} {}{}\n",
crossterm::style::SetForegroundColor(crossterm::style::Color::DarkGrey),
status_str,
crossterm::style::ResetColor
);
}
// Get language-specific prompts (same mechanism as normal mode)
let language_content = get_language_prompts_for_workspace(&workspace_dir);
@@ -188,9 +195,6 @@ pub async fn run_agent_mode(
system_prompt
};
// Read include prompt if specified
let include_prompt = read_include_prompt(include_prompt_path.as_deref());
// Combine all content for the agent's context
let combined_content = combine_project_content(
agents_content_opt,

View File

@@ -102,11 +102,8 @@ pub async fn run_interactive<W: UiWriter>(
// Check what was loaded
let has_agents = content.contains("Agent Configuration");
let has_readme = content.contains("Project README");
let has_memory = content.contains("Project Memory");
let readme_status = if has_readme { "" } else { "·" };
let agents_status = if has_agents { "" } else { "·" };
let memory_status = if has_memory { "" } else { "·" };
let has_include_prompt = content.contains("Included Prompt");
let has_memory = content.contains("=== Project Memory");
// Extract project name if README is loaded
let project_name = if has_readme {
@@ -119,12 +116,31 @@ pub async fn run_interactive<W: UiWriter>(
if let Some(name) = project_name {
print!("{}>> {}{}\n", SetForegroundColor(Color::DarkGrey), name, ResetColor);
}
print!(
"{} {} README | {} AGENTS.md | {} Memory{}\n",
SetForegroundColor(Color::DarkGrey),
readme_status, agents_status, memory_status,
ResetColor
);
// Build status line showing only what was loaded (in load order)
let mut loaded_items: Vec<&str> = Vec::new();
if has_readme {
loaded_items.push("README");
}
if has_agents {
loaded_items.push("AGENTS.md");
}
if has_include_prompt {
loaded_items.push("prompt");
}
if has_memory {
loaded_items.push("Memory");
}
// Print status line only if something was loaded
if !loaded_items.is_empty() {
let status_str = loaded_items.iter().map(|s| format!("{}", s)).collect::<Vec<_>>().join(" ");
print!(
"{} {}{}\n",
SetForegroundColor(Color::DarkGrey),
status_str,
ResetColor
);
}
}
// Display workspace path