aws / aws/amazon-q-developer-cli
Inquiring about trusted commands with Q CLI did not inform me of /tools trust API and instead hallucinated some options that didn't work
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
### Checks
- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again
### Operating system
macOS 15.4.1 (24E263)
### Expected behaviour
When I ask Q CLI how I can add trusted commands, I would expect it to inform me about /trust instead of sending me on a wild goose chase with q.json config that doesn't work, or q trust commandline that doesn't exist.
### Actual behaviour
Commands added to the trustedCommands list in ~/.aws/q/config.json (both as ["xargs grep"] and ["xargs", "grep"]) still prompt for approval when executed
```
[chat-transcript]
I understand that the `xargs grep` command still asked for your approval despite being added to the trusted commands list. Let me explain how the trusted commands feature works in Amazon Q CLI.
> Yes, try option 1
I'll update your config file with option 1, which separates "xargs" and "grep" as individual trusted commands.
[Tool uses: fs_write]
> y
[Tool uses: execute_bash]
> y
I've updated your config file with option 1, separating the commands as individual entries:
\```json
{
"trustedCommands": ["xargs", "grep"]
}
\```
The test command ran successfully. Did it still ask for your approval this time? If it did, there might be a few other factors to consider:
1. Amazon Q might need to be restarted to pick up the new configuration
2. The config file format might need additional adjustments
3. There could be a specific way the CLI interprets command patterns
If you're still being prompted for approval, we could try option 3 with wildcards:
\```json
{
"trustedCommands": ["xargs*grep*"]
}
\```
Would you like me to try this approach instead?
[Tool uses: none]
We've been configuring trusted commands for Amazon Q CLI. You wanted to add "xargs grep" to avoid approval prompts. I created a config file at ~/.aws/q/config.json, first trying with ["xargs grep"] and then with ["xargs", "grep"] as separate entries. We tested the configuration but found that approval prompts were still appearing.
[Tool uses: none]
> Yes, can you retry xarg grep command and see if the trustedCommands was picked up by Q CLI this time?
I'll retry the `xargs grep` command to see if the trusted commands configuration has been picked up by the Q CLI this time.
[Tool uses: execute_bash]
> y
The command executed successfully and returned the matching lines:
\```
to test xargs grep functionality
grep should find this line
\```
Did the Q CLI still ask for your approval this time? If it did, it might be that:
1. The Q CLI might need to be restarted to pick up the new configuration
2. There might be a specific format requirement for the trusted commands that we haven't met yet
If you're still being prompted, we could try option 3 with wildcards or check if there's any documentation on the exact format required for trusted commands in the Q CLI.
[Tool uses: none]
> /tools trust
> /tools
> I'd like to report a Q CLI issue
I'd be happy to help you report an issue with the Q CLI. You can report issues directly to the Amazon Q development team so they can investigate and fix the problem.
Would you like to report the issue about the trusted commands configuration not working as expected? If so, I can help you prepare a detailed report with the steps we've tried and the behavior we've observed.
Alternatively, if you're experiencing a different issue with the Q CLI, please provide more details about what's happening, and I'll help you report it.
[Tool uses: none]
> Can you use the report_issue tool?
I'll help you report an issue with the Q CLI using the report_issue tool.
[Tool uses: report_issue]
(...truncated)
```
### Steps to reproduce
1. Asked Q CLI how to add trusted commands
2. Q CLI decided it should add ~/.aws/q/config.json with trustedCommands configuration
3. Added xargs grep to the trusted commands list
4. Tested with a simple command: echo "test_file.txt" | xargs grep "grep"
5. Command still prompted for approval despite being in trusted commands
6. Read slack comms and conclude /trust API exists and should be used instead.
### Environment
```yaml
[q-details]
version = "1.10.1"
hash = "cb90e381cf8391beef4b966623d913e258cbb08d"
date = "2025-05-16T13:53:39.016927Z (4d ago)"
[system-info]
os = "macOS 15.4.1 (24E263)"
chip = "Apple M3 Pro"
total-cores = 12
memory = "36.00 GB"
[environment]
cwd = "/Users/USER"
cli-path = "/Users/USER"
install-method = "brew"
[env-vars]
PATH = "/Users/USER/.toolbox/bin:/opt/homebrew/opt/python3@/libexec/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/USER/.local/bin"
QTERM_SESSION_ID = "9654039764ad463faa543c4e88cb4693"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.10.1"
SHELL = "/bin/zsh"
TERM = "xterm-256color"
__CFBundleIdentifier = "com.apple.Terminal"
[chat-settings]
interactive=true
[chat-trusted_tools]
[chat-failed_request_ids]
none
[chat-context]
current_profile=default
profiles=
default
codetree-dev
global_context=
.amazonq/rules/**/*.md
README.md
AmazonQ.md
profile_context=none
files=none
```
Contributor guide
Assessment
This issue has not been assessed yet.