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

Function is_read_command

atomic-agent/src/provenance/classify.rs:376–406  ·  view source on GitHub ↗

Returns `true` if the shell command is primarily reading/searching.

(cmd: &str)

Source from the content-addressed store, hash-verified

374
375/// Returns `true` if the shell command is primarily reading/searching.
376fn is_read_command(cmd: &str) -> bool {
377 let lower = cmd.to_lowercase();
378
379 // Only match if the command starts with (or pipes into) a read-like tool
380 let read_starters = [
381 "cat ",
382 "head ",
383 "tail ",
384 "less ",
385 "more ",
386 "wc ",
387 "file ",
388 "stat ",
389 "find ",
390 "fd ",
391 "rg ",
392 "grep ",
393 "ag ",
394 "ack ",
395 "ls ",
396 "tree ",
397 "git log",
398 "git show",
399 "git diff",
400 "git status",
401 "git blame",
402 ];
403
404 read_starters.iter().any(|p| lower.starts_with(p))
405 || lower.starts_with("echo ") && !lower.contains(">>") && !lower.contains(">")
406}
407
408// =============================================================================
409// Summary Generators

Callers 1

classify_shell_commandFunction · 0.85

Calls 2

iterMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected