Skip to main content

is_agent_readonly_shell_command

Function is_agent_readonly_shell_command 

Source
pub fn is_agent_readonly_shell_command(command: &str) -> bool
Expand description

Read-only shell surface for ShellPolicy::ReadOnly agents (fleet scouts and reviewers, #5356 follow-up): the parallel auto-approve table widened by exactly the shapes real repo reconnaissance needs, still mutation-proof-by-construction.

Relaxations relative to is_parallel_readonly_command (which stays untouched for the parent’s parallel auto-approve chunks, where its tightness is load-bearing):

  • pipelines a | b, where every segment must itself be an admitted read-only command (an empty segment — including || — rejects);
  • literal * arguments (for tools such as find -name '*.rs'); shell expansion is never allowed to introduce operands after validation;
  • git -C <dir> <subcommand> and git --no-pager <subcommand>, whose remainder re-enters the existing per-subcommand option tables;
  • find without any mutating primary (-delete, -exec, -execdir, -ok, -okdir, -fprintf, -fls, -fprint, -fprint0);
  • sed -n '<range>p — numeric line-range print only, no script verbs (w/r/e/s) can appear in a two-token range script;
  • npm view|show|info <pkg> — registry reads, matching the scout role’s network-capable read-only posture;
  • pure text filters sort, uniq, cut, tr, comm as pipeline stages.

Everything else keeps the parallel classifier’s posture: no separators, redirects, backgrounding, command/parameter expansion, subshells, or env-assignment prefixes.