68 lines
7.1 KiB
JSON
68 lines
7.1 KiB
JSON
{
|
|
"permissions": {
|
|
"allow": [
|
|
"Bash(rm:*)",
|
|
"Bash(sed:*)",
|
|
"WebFetch(domain:sing-box.sagernet.org)",
|
|
"Bash(find:*)",
|
|
"Bash(shellcheck:*)",
|
|
"Bash(chmod:*)",
|
|
"Bash(bash scripts/validate-improvements.sh:*)",
|
|
"Bash(bash:*)",
|
|
"Bash(for script in common.sh outbound-manager.sh firewall-manager.sh post-deploy-check.sh)",
|
|
"Bash(do echo \"检查 $script:\")",
|
|
"Bash(done)",
|
|
"Bash(for:*)",
|
|
"Bash(do bash -n \"$script\")",
|
|
"Bash(timeout:*)",
|
|
"Read(//c//**)",
|
|
"mcp__sequential-thinking__sequentialthinking",
|
|
"Bash(cp:*)",
|
|
"Bash(git check-ignore:*)",
|
|
"WebFetch(domain:v2.hysteria.network)",
|
|
"Bash(hysteria:*)",
|
|
"Read(//c/**)",
|
|
"Bash(tree:*)",
|
|
"Bash(awk:*)",
|
|
"Bash(RULES_DIR=\"/tmp/hysteria-rules\" RULES_LIBRARY=\"/tmp/hysteria-rules/rules-library.yaml\" RULES_STATE=\"/tmp/hysteria-rules/rules-state.yaml\" bash -c 'source scripts/outbound-manager.sh && init_rules_library && echo \"\"=== 规则库内容 ===\"\" && cat \"\"$RULES_LIBRARY\"\" 2>/dev/null || echo \"\"规则库文件不存在\"\"')",
|
|
"Bash(RULES_LIBRARY=\"/tmp/hysteria-rules/rules-library.yaml\" bash -c '\nsource scripts/outbound-manager.sh\necho \"\"=== 调用 view_outbound_rules 函数 ===\"\"\nview_outbound_rules\necho \"\"\"\"\necho \"\"=== 调试解析过程 ===\"\"\nin_rules_section=false\necho \"\"开始解析 YAML 文件:\"\"\nwhile IFS= read -r line; do\n echo \"\"处理行: \\\"\"$line\\\"\"\"\"\n if [[ \"\"$line\"\" =~ ^rules:[[:space:]]*$ ]]; then\n echo \"\" → 进入 rules 段\"\"\n in_rules_section=true\n continue\n fi\n \n if [ \"\"$in_rules_section\"\" = true ]; then\n if [[ \"\"$line\"\" =~ ^([a-zA-Z_][a-zA-Z0-9_]*):[[:space:]]*$ ]]; then\n echo \"\" → 遇到顶级键,退出 rules 段\"\"\n break\n fi\n \n if [[ \"\"$line\"\" =~ ^[[:space:]]{2}([a-zA-Z_][a-zA-Z0-9_]+):[[:space:]]*$ ]]; then\n rule_name=\"\"${BASH_REMATCH[1]}\"\"\n echo \"\" → 找到规则: $rule_name\"\"\n fi\n fi\ndone < \"\"$RULES_LIBRARY\"\"\n')",
|
|
"Bash(RULES_LIBRARY=\"/tmp/hysteria-rules/rules-library.yaml\" bash -c '\nsource scripts/outbound-manager.sh\necho \"\"=== 测试查看规则功能 ===\"\"\nview_outbound_rules\necho \"\"\"\"\necho \"\"=== 测试类型冲突检测 ===\"\"\necho \"\"检查 socks5 类型冲突:\"\"\ncheck_rule_type_conflict \"\"socks5\"\"\necho \"\"\"\"\necho \"\"检查 direct 类型冲突:\"\"\ncheck_rule_type_conflict \"\"direct\"\"\necho \"\"\"\"\necho \"\"检查不存在类型 (http) 冲突:\"\"\ncheck_rule_type_conflict \"\"http\"\"\n')",
|
|
"Bash(RULES_LIBRARY=\"/tmp/hysteria-rules/rules-library.yaml\" bash -c '\nsource scripts/outbound-manager.sh\ninit_rules_library > /dev/null 2>&1\necho \"\"=== 测试类型冲突检测 ===\"\"\necho -n \"\"检查 socks5 类型冲突: \"\"\nif result=$(check_rule_type_conflict \"\"socks5\"\"); then\n echo \"\"找到冲突规则: $result\"\"\nelse\n echo \"\"无冲突\"\"\nfi\n\necho -n \"\"检查 direct 类型冲突: \"\"\nif result=$(check_rule_type_conflict \"\"direct\"\"); then\n echo \"\"找到冲突规则: $result\"\"\nelse\n echo \"\"无冲突\"\"\nfi\n\necho -n \"\"检查 http 类型冲突: \"\"\nif result=$(check_rule_type_conflict \"\"http\"\"); then\n echo \"\"找到冲突规则: $result\"\"\nelse\n echo \"\"无冲突\"\"\nfi\n')",
|
|
"Bash(head:*)",
|
|
"Bash(do echo \"=== $script ===\")",
|
|
"Bash(cat:*)",
|
|
"Bash(__NEW_LINE__ RULES_LIBRARY=\"/tmp/hysteria-test-rules/rules-library.yaml\" bash -c '\nsource scripts/outbound-manager.sh\necho \"\"调用 view_outbound_rules 函数:\"\"\nview_outbound_rules 2>/dev/null || echo \"\"函数执行出错\"\"\n')",
|
|
"Bash(__NEW_LINE__ find /tmp -name \"*rules*\" -type f)",
|
|
"Bash(__NEW_LINE__ ls -la /tmp/hysteria-rules/)",
|
|
"Bash(__NEW_LINE__ cat /tmp/hysteria-rules/rules-library.yaml)",
|
|
"Bash(__NEW_LINE__ tail -10 /tmp/hysteria-rules/rules-library.yaml)",
|
|
"Bash(__NEW_LINE__ bash -c 'cd /c/code/s-hy2 && source scripts/outbound-manager.sh && view_outbound_rules')",
|
|
"Bash(__NEW_LINE__ timeout 10 bash -c 'cd /c/code/s-hy2 && source scripts/outbound-manager.sh && echo -e \"\"\"\"sk5\\n测试描述\\n1\\n\"\"\"\" | add_outbound_rule_new')",
|
|
"Bash(__NEW_LINE__ echo \"1. 查看功能测试:\")",
|
|
"Bash(__NEW_LINE__ echo \"\")",
|
|
"Bash(__NEW_LINE__ echo \"2. 重复检测功能测试:\")",
|
|
"Bash(__NEW_LINE__ echo \"sk5\")",
|
|
"Bash(__NEW_LINE__ echo \"3. 类型冲突检测测试:\")",
|
|
"Bash(__NEW_LINE__ bash -c 'cd /c/code/s-hy2 && source scripts/outbound-manager.sh && check_rule_type_conflict \"\"\"\"socks5\"\"\"\"')",
|
|
"Bash(__NEW_LINE__ find /tmp /etc -name \"*rules*.yaml\" -o -name \"*rules*.yml\")",
|
|
"Bash(__NEW_LINE__ echo \"=== 2. 检查脚本中的路径定义 ===\")",
|
|
"Bash(__NEW_LINE__ grep -n \"RULES_LIBRARY\\|RULES_DIR\" scripts/outbound-manager.sh)",
|
|
"Bash(__NEW_LINE__ echo \"当前 RULES_LIBRARY 路径:\")",
|
|
"Bash(__NEW_LINE__ bash -c 'cd /c/code/s-hy2 && source scripts/outbound-manager.sh && init_rules_library >/dev/null 2>&1 && echo $RULES_LIBRARY')",
|
|
"Bash(__NEW_LINE__ echo \"当前规则库内容:\")",
|
|
"Bash(__NEW_LINE__ bash -c 'cd /c/code/s-hy2 && source scripts/outbound-manager.sh \n# 模拟查看函数的核心解析逻辑\ninit_rules_library >/dev/null 2>&1\necho \"\"查看功能使用的规则库: $RULES_LIBRARY\"\"\necho \"\"文件是否存在: $(test -f \"\"$RULES_LIBRARY\"\" && echo \"\"存在\"\" || echo \"\"不存在\"\")\"\"\necho \"\"文件内容行数: $(wc -l < \"\"$RULES_LIBRARY\"\" 2>/dev/null || echo \"\"0\"\")\"\"\n\n# 直接测试解析逻辑\necho \"\"=== 直接解析测试 ===\"\"\nin_rules_section=false\nrule_count=0\nwhile IFS= read -r line; do\n if [[ \"\"$line\"\" =~ ^rules:[[:space:]]*$ ]]; then\n in_rules_section=true\n continue\n fi\n if [[ \"\"$in_rules_section\"\" == true ]] && [[ \"\"$line\"\" =~ ^([a-zA-Z_][a-zA-Z0-9_]*):[[:space:]]*$ ]]; then\n break\n fi\n if [[ \"\"$in_rules_section\"\" == true ]] && [[ \"\"$line\"\" =~ ^[[:space:]]{2}([a-zA-Z_][a-zA-Z0-9_]+):[[:space:]]*$ ]]; then\n rule_name=\"\"${BASH_REMATCH[1]}\"\"\n ((rule_count++))\n echo \"\"找到规则 $rule_count: $rule_name\"\"\n fi\ndone < \"\"$RULES_LIBRARY\"\"\necho \"\"总共解析到规则数: $rule_count\"\"\n')",
|
|
"Bash(__NEW_LINE__ echo \"=== 手动解析规则名称 ===\")",
|
|
"Bash(__NEW_LINE__ grep -A 100 \"^rules:\" \"$RULES_FILE\")",
|
|
"Bash(__NEW_LINE__ grep -n \"rules:\" /tmp/hysteria-rules/rules-library.yaml)",
|
|
"Bash(__NEW_LINE__ sed -n '13p;21p;28p' /tmp/hysteria-rules/rules-library.yaml)",
|
|
"Bash(__NEW_LINE__ echo \"从用户角度测试 - 模拟用户直接运行脚本\")",
|
|
"Bash(__NEW_LINE__ cd /c/code/s-hy2)",
|
|
"Bash(__NEW_LINE__ bash -c 'source scripts/outbound-manager.sh && view_outbound_rules')",
|
|
"Bash(./debug_rules_issue.sh:*)",
|
|
"Bash(source:*)",
|
|
"Bash(view_outbound_rules)",
|
|
"Bash(check_rule_type_conflict:*)"
|
|
],
|
|
"deny": []
|
|
}
|
|
} |