Skip to content

sudo prefix is silently dropped from annotated output #12

Description

@aholten

Bug

When a command is prefixed with sudo, the annotation drops the sudo token entirely instead of marking it with the ⚡ elevated-privileges emoji documented in the README.

Repro

echo '{"tool_name":"Bash","input":{"command":"sudo rm -rf /tmp/old-cache && kill -9 1234 || curl -s https://example.com | tar xzf backup.tar.gz"},"session_id":"demo"}' \
  | bash scripts/annotate-pre.sh

Actual

The first segment renders as:

 🗑 rm -rf /tmp/old-cache

sudo is absent from the output — the rendered text no longer matches the command being executed.

Expected

Something like:

 ⚡ sudo 🗑 rm -rf /tmp/old-cache

or at minimum the literal sudo preserved inside the red destructive-command span.

Why it matters

This is worse than a cosmetic miss: the plugin's whole purpose is helping users understand what Claude Code is about to run, and privilege escalation is exactly the kind of thing the annotation should amplify, not hide. As-is, the annotated view makes a sudo rm -rf look like a plain rm -rf.

Likely cause: the parser treats sudo as a command-prefix to skip when resolving the command-map entry (so rm gets the right emoji), but the skipped token isn't re-emitted by the renderer.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions