Skip to content

> /dev/null and 2>&1 should be special-cased to not require permission #211

@andrewneilson

Description

@andrewneilson

Describe the bug

It seems cd is a special case in that you have to approve it every time. This is probably fine, but the issue is that copilot CLI frequently wants to cd into the current directory before running other commands. So even if those commands are already approved, the fact that the cd is there means we still have to approve it.

Here is an example:

 ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
 │ Check desktop apps files:                                                                                                        │
 │                                                                                                                                  │
 │ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
 │ │ cd /current/directory && for file in sub/dir/fileA sub/dir/fileB                   │ │
 │ │ sub/dir/fileC; do echo "=== $file ==="; grep -n "NEEDLE" "$file" 2>/dev/null | head -3;  │ │
 │ │ done                                                                                                                         │ │
 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
 │                                                                                                                                  │
 │ Do you want to run this command?                                                                                                 │
 │                                                                                                                                  │
 │ ❯ 1. Yes                                                                                                                         │
 │   2. No, and tell Copilot what to do differently (Esc)                                                                           │
 │                                                                                                                                  │
 │ Confirm with number keys or ↑↓ keys and Enter, Cancel with Esc                                                                   │
 ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

And especially note that the approval is one-time.

This happens constantly with many commands so I don't think it has anything to do with the for loop.

Affected version

0.0.334

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions