MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / format_file_group

Function format_file_group

atomic-agent/src/record/message.rs:340–348  ·  view source on GitHub ↗

Format a group of files with a verb prefix. - 1-3 files: `"Add src/main.rs, Cargo.toml, lib.rs"` - 4+ files: `"Add src/main.rs, Cargo.toml (+2 more)"`

(verb: &str, files: &[String])

Source from the content-addressed store, hash-verified

338/// - 1-3 files: `"Add src/main.rs, Cargo.toml, lib.rs"`
339/// - 4+ files: `"Add src/main.rs, Cargo.toml (+2 more)"`
340pub(crate) fn format_file_group(verb: &str, files: &[String]) -> String {
341 match files.len() {
342 0 => String::new(),
343 1 => format!("{} {}", verb, files[0]),
344 2 => format!("{} {}, {}", verb, files[0], files[1]),
345 3 => format!("{} {}, {}, {}", verb, files[0], files[1], files[2]),
346 n => format!("{} {}, {} (+{} more)", verb, files[0], files[1], n - 2),
347 }
348}
349
350/// Truncate a prompt to the given maximum length, adding "..." if needed.
351pub(crate) fn truncate_prompt(prompt: &str, max_len: usize) -> String {

Callers 1

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected