summaryrefslogtreecommitdiffhomepage
path: root/README.md
diff options
context:
space:
mode:
authorEd Zynda <[email protected]>2025-05-17 16:23:13 +0300
committerGitHub <[email protected]>2025-05-17 08:23:13 -0500
commit307982a0990f597608258b7de053fbf852d8dee3 (patch)
treeaf22a0953f9c88c0a972e715c27520cd0fbf169e /README.md
parentba416e787b651ea045ff955eb32c0e7109a169e8 (diff)
downloadopencode-307982a0990f597608258b7de053fbf852d8dee3.tar.gz
opencode-307982a0990f597608258b7de053fbf852d8dee3.zip
feat: Add tool restriction flags for non-interactive mode (#29)
Diffstat (limited to 'README.md')
-rw-r--r--README.md37
1 files changed, 29 insertions, 8 deletions
diff --git a/README.md b/README.md
index 10be21d5c..4cf83d465 100644
--- a/README.md
+++ b/README.md
@@ -225,10 +225,28 @@ opencode -p "Explain the use of context in Go" -f json
# Run without showing the spinner
opencode -p "Explain the use of context in Go" -q
+
+# Enable verbose logging to stderr
+opencode -p "Explain the use of context in Go" --verbose
+
+# Restrict the agent to only use specific tools
+opencode -p "Explain the use of context in Go" --allowedTools=view,ls,glob
+
+# Prevent the agent from using specific tools
+opencode -p "Explain the use of context in Go" --excludedTools=bash,edit
```
In this mode, OpenCode will process your prompt, print the result to standard output, and then exit. All permissions are auto-approved for the session.
+### Tool Restrictions
+
+You can control which tools the AI assistant has access to in non-interactive mode:
+
+- `--allowedTools`: Comma-separated list of tools that the agent is allowed to use. Only these tools will be available.
+- `--excludedTools`: Comma-separated list of tools that the agent is not allowed to use. All other tools will be available.
+
+These flags are mutually exclusive - you can use either `--allowedTools` or `--excludedTools`, but not both at the same time.
+
### Output Formats
OpenCode supports the following output formats in non-interactive mode:
@@ -242,14 +260,17 @@ The output format is implemented as a strongly-typed `OutputFormat` in the codeb
## Command-line Flags
-| Flag | Short | Description |
-| ----------------- | ----- | ------------------------------------------------------ |
-| `--help` | `-h` | Display help information |
-| `--debug` | `-d` | Enable debug mode |
-| `--cwd` | `-c` | Set current working directory |
-| `--prompt` | `-p` | Run a single prompt in non-interactive mode |
-| `--output-format` | `-f` | Output format for non-interactive mode (text, json) |
-| `--quiet` | `-q` | Hide spinner in non-interactive mode |
+| Flag | Short | Description |
+| ----------------- | ----- | ---------------------------------------------------------- |
+| `--help` | `-h` | Display help information |
+| `--debug` | `-d` | Enable debug mode |
+| `--cwd` | `-c` | Set current working directory |
+| `--prompt` | `-p` | Run a single prompt in non-interactive mode |
+| `--output-format` | `-f` | Output format for non-interactive mode (text, json) |
+| `--quiet` | `-q` | Hide spinner in non-interactive mode |
+| `--verbose` | | Display logs to stderr in non-interactive mode |
+| `--allowedTools` | | Restrict the agent to only use specified tools |
+| `--excludedTools` | | Prevent the agent from using specified tools |
## Keyboard Shortcuts