Set custom rules for Safety Net
Configures custom blocking rules for Safety Net to prevent dangerous commands.
/plugin marketplace add kenryu42/claude-code-safety-net/plugin install safety-net@safety-net-devYou are helping the user configure custom blocking rules for claude-code-safety-net.
!npx -y cc-safety-net --custom-rules-doc
Follow this flow exactly:
Use AskUserQuestion to let user select scope:
{
"questions": [
{
"question": "Which scope would you like to configure?",
"header": "Configure",
"multiSelect": false,
"options": [
{
"label": "User",
"description": "(`~/.cc-safety-net/config.json`) - applies to all your projects"
},
{
"label": "Project",
"description": "(`.safety-net.json`) - applies only to this project"
}
]
}
]
}
Show examples in natural language:
git add -A and git add . to prevent blanket staging"npm install -g to prevent global package installs"docker system prune to prevent accidental cleanup"Ask the user to describe rules in natural language. They can list multiple.
Parse user input and generate valid schema JSON using the schema documentation above.
Then show the generated config JSON to the user.
Use AskUserQuestion to let user choose:
{
"questions": [
{
"question": "Does this look correct?",
"header": "Confirmation",
"multiSelect": false,
"options": [
{
"label": "Yes",
},
{
"label": "No",
}
]
}
]
}
cat ~/.cc-safety-net/config.json 2>/dev/null || echo "No user config found"cat .safety-net.json 2>/dev/null || echo "No project config found"If the chosen scope already has a config:
Show the existing config to the user. Use AskUserQuestion tool to let user choose:
{
"questions": [
{
"question": "The chosen scope already has a config. What would you like to do?",
"header": "Configure",
"multiSelect": false,
"options": [
{
"label": "Merge",
},
{
"label": "Replace",
}
]
}
]
}
Write the config to the chosen scope, then validate with npx -y cc-safety-net --verify-config.
If validation errors:
Tell the user: