allow-agent-commands

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Adding/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:
.config/opencode/opencode.json
under
permission.bash
Format:
json
"uname *": "allow",
Pattern:
"command argpatterns": "action"
where
*
matches any args
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.json
中的
permission.bash
部分
格式:
json
"uname *": "allow",
模式:
"command argpatterns": "action"
,其中
*
匹配任意参数
重要提示:请按命令名称的字母顺序插入新条目。添加新命令时,找到正确的位置以保持排序。请勿重新排序现有条目。

Claude Code Configuration

Claude Code配置

File:
.claude/settings.json
under
permissions.allow
Format:
json
"Bash(uname:*)",
Important: Insert new entries in alphabetical order. Commands are sorted by the command name (the part after
Bash(
and before
:
). Do NOT reorder existing entries.
文件路径:
.claude/settings.json
中的
permissions.allow
部分
格式:
json
"Bash(uname:*)",
重要提示:请按字母顺序插入新条目。命令按命令名称(
Bash(
之后、
:
之前的部分)排序。请勿重新排序现有条目。

General Pattern for New AI Tools

新AI工具的通用配置模式

When adding new AI tools:
  1. Find their config file (usually in
    ~/.config/
    or project root)
  2. Look for
    permissions
    ,
    allowedCommands
    , or similar sections
  3. Add the command with glob patterns for arguments
  4. Insert new entries in alphabetical order by command name
  5. Do NOT reorder existing entries.
添加新AI工具时:
  1. 找到其配置文件(通常位于
    ~/.config/
    或项目根目录)
  2. 查找
    permissions
    allowedCommands
    或类似的配置段
  3. 使用通配符模式添加命令及其参数
  4. 按命令名称的字母顺序插入新条目
  5. 请勿重新排序现有条目。

After Adding Commands

添加命令后的步骤

After adding the new command entries to both config files:
  1. Check if there are any other staged changes with
    git status
  2. If there are NO other staged changes, stage ONLY the new hunks in the two config files using the
    git-stager
    subagent (be careful not to stage unrelated changes)
  3. Invoke the
    git-committer
    subagent to commit the changes
在向两个配置文件中添加新命令条目后:
  1. 使用
    git status
    检查是否有其他已暂存的更改
  2. 如果没有其他已暂存的更改,请使用
    git-stager
    子Agent仅暂存两个配置文件中的新更改部分(注意不要暂存无关更改)
  3. 调用
    git-committer
    子Agent提交更改

Examples

示例

Adding
rg
(ripgrep) to both configs:
OpenCode (insert after
rev *
, before
rpm -q*
):
json
"rg *": "allow",
Claude Code (insert after
Bash(rg:*)
, before
Bash(rpm -q:*)
):
json
"Bash(rg:*)",
向两个配置中添加
rg
(ripgrep):
OpenCode(插入在
rev *
之后,
rpm -q*
之前):
json
"rg *": "allow",
Claude Code(插入在
Bash(rg:*)
之后,
Bash(rpm -q:*)
之前):
json
"Bash(rg:*)",