allow-agent-commands
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAdding/Changing Allowed Commands
添加/修改允许的命令
When to use this skill
何时使用此技能
Use this skill when:
- A command needs to be added to the allow list for AI agents
- Permission settings need to be modified for existing commands
- Setting up a new AI tool that requires command permissions
在以下场景使用此技能:
- 需要将命令添加到AI Agent的允许列表中
- 需要修改现有命令的权限设置
- 配置需要命令权限的新AI工具
How it works
工作原理
Commands must be explicitly allowed in the permission configs before agents
can run them. This skill covers adding entries to both OpenCode and Claude
Code configuration files.
IMPORTANT: The config files are stowed into via GNU Stow symlinks.
Always edit them directly from within the ai-config repository, NOT from .
The paths below are relative to the ai-config repository root.
~~在Agent可以运行命令之前,必须在权限配置中明确允许这些命令。此技能涵盖向OpenCode和Claude Code的配置文件中添加条目。
重要提示:配置文件通过GNU Stow符号链接存储在目录下。请始终直接在ai-config仓库中编辑它们,不要从目录编辑。以下路径均为相对于ai-config仓库根目录的路径。
~~OpenCode Configuration
OpenCode配置
File: under
.config/opencode/opencode.jsonpermission.bashFormat:
json
"uname *": "allow",Pattern: where matches any args
"command argpatterns": "action"*Important: Insert new entries in alphabetical order by command name.
When adding a new command, find the correct position to maintain sorting.
Do NOT reorder existing entries.
文件路径:中的部分
.config/opencode/opencode.jsonpermission.bash格式:
json
"uname *": "allow",模式:,其中匹配任意参数
"command argpatterns": "action"*重要提示:请按命令名称的字母顺序插入新条目。添加新命令时,找到正确的位置以保持排序。请勿重新排序现有条目。
Claude Code Configuration
Claude Code配置
File: under
.claude/settings.jsonpermissions.allowFormat:
json
"Bash(uname:*)",Important: Insert new entries in alphabetical order. Commands are sorted
by the command name (the part after and before ).
Do NOT reorder existing entries.
Bash(:文件路径:中的部分
.claude/settings.jsonpermissions.allow格式:
json
"Bash(uname:*)",重要提示:请按字母顺序插入新条目。命令按命令名称(之后、之前的部分)排序。请勿重新排序现有条目。
Bash(:General Pattern for New AI Tools
新AI工具的通用配置模式
When adding new AI tools:
- Find their config file (usually in or project root)
~/.config/ - Look for ,
permissions, or similar sectionsallowedCommands - Add the command with glob patterns for arguments
- Insert new entries in alphabetical order by command name
- Do NOT reorder existing entries.
添加新AI工具时:
- 找到其配置文件(通常位于或项目根目录)
~/.config/ - 查找、
permissions或类似的配置段allowedCommands - 使用通配符模式添加命令及其参数
- 按命令名称的字母顺序插入新条目
- 请勿重新排序现有条目。
After Adding Commands
添加命令后的步骤
After adding the new command entries to both config files:
- Check if there are any other staged changes with
git status - If there are NO other staged changes, stage ONLY the new hunks in the two
config files using the subagent (be careful not to stage unrelated changes)
git-stager - Invoke the subagent to commit the changes
git-committer
在向两个配置文件中添加新命令条目后:
- 使用检查是否有其他已暂存的更改
git status - 如果没有其他已暂存的更改,请使用子Agent仅暂存两个配置文件中的新更改部分(注意不要暂存无关更改)
git-stager - 调用子Agent提交更改
git-committer
Examples
示例
Adding (ripgrep) to both configs:
rgOpenCode (insert after , before ):
rev *rpm -q*json
"rg *": "allow",Claude Code (insert after , before ):
Bash(rg:*)Bash(rpm -q:*)json
"Bash(rg:*)",向两个配置中添加(ripgrep):
rgOpenCode(插入在之后,之前):
rev *rpm -q*json
"rg *": "allow",Claude Code(插入在之后,之前):
Bash(rg:*)Bash(rpm -q:*)json
"Bash(rg:*)",