Loading...
Loading...
Compare original and translation side by side
references/security-requirements.mdreferences/security-requirements.mdreferences/reliability-performance.mdreferences/reliability-performance.mdreferences/reliability-performance.mdreferences/reliability-performance.mdPreToolUsePostToolUseUserPromptSubmitSessionStartSessionEndNotificationStopSubagentStopPreCompactPreToolUsePostToolUseUserPromptSubmitSessionStartSessionEndNotificationStopSubagentStopPreCompactmatcher: "*""Write""Edit|Write""Bash""mcp__github__*""*"matcher: "*""Write""Edit|Write""Bash""mcp__github__*""*"undefinedundefined
**Validate fields exist before using them:**
```bash
FILE=$(echo "$INPUT" | jq -r '.input.file_path // empty')
if [[ -z "$FILE" ]]; then
echo "No file path provided" >&2
exit 1
fi
**使用前务必验证字段是否存在**:
```bash
FILE=$(echo "$INPUT" | jq -r '.input.file_path // empty')
if [[ -z "$FILE" ]]; then
echo "未提供文件路径" >&2
exit 1
fitype: "command"type: "prompt"type: "command"type: "prompt"exit 0exit 2exit 1exit 0exit 2exit 1undefinedundefined
**Why this matters**: Files with spaces (`"my file.txt"`), Unicode (`"文件.txt"`), or special chars (`"file (1).txt"`) are common.
**For quoting best practices**: Load `references/security-requirements.md` for comprehensive input handling patterns.
---
**重要性**:含空格(`"my file.txt"`)、Unicode(`"文件.txt"`)或特殊字符(`"file (1).txt"`)的文件很常见。
**引号最佳实践参考**:加载`references/security-requirements.md`获取全面的输入处理模式。
---undefinedundefined
**Why this matters**: Prevents path traversal attacks, protects files outside project, prevents malformed input crashes.
**For complete security patterns**: Load `references/security-requirements.md`.
---
**重要性**:防止路径遍历攻击,保护项目外的文件,避免格式错误的输入导致崩溃。
**完整安全模式参考**:加载`references/security-requirements.md`。
---undefinedundefined
**Why this matters**: Slow hooks create bad user experience. Target < 100ms for PreToolUse, < 500ms for PostToolUse.
**For performance optimization**: Load `references/reliability-performance.md`.
---
**重要性**:缓慢的Hook会带来糟糕的用户体验。PreToolUse Hook目标耗时<100ms,PostToolUse Hook目标耗时<500ms。
**性能优化参考**:加载`references/reliability-performance.md`。
---undefinedundefined
**Why this matters**: Exit 1 only logs errors. Exit 2 is required to block in PreToolUse hooks.
**For exit code patterns**: Load `references/hook-templates.md` for complete hook response patterns.
---
**重要性**:退出码1仅记录错误。在PreToolUse Hook中必须使用退出码2来阻止操作。
**退出码模式参考**:加载`references/hook-templates.md`获取完整的Hook响应模式。
---undefinedundefined
**Why this matters**: Users may not have all tools installed. Hooks should degrade gracefully.
**For reliability patterns**: Load `references/reliability-performance.md`.
---
**重要性**:用户可能未安装所有工具。Hook应优雅降级。
**可靠性模式参考**:加载`references/reliability-performance.md`。
---jq -r '... // empty'${CLAUDE_PLUGIN_ROOT}/....env*.keycommand -v toolname${CLAUDE_PLUGIN_ROOT}/....env*.keycommand -v toolname..matcher: "*"..matcher: "*"references/security-requirements.mdreferences/security-requirements.md.env.envreferences/reliability-performance.mdreferences/reliability-performance.mdreferences/code-templates.mdreferences/code-templates.mdreferences/testing-debugging.mdreferences/testing-debugging.mdreferences/publishing-guide.mdreferences/publishing-guide.mdcontinuestopReasonsuppressOutputsystemMessagecontinuestopReasonsuppressOutputsystemMessagereferences/quick-reference.mdreferences/quick-reference.md.env*.key.env*.keysecurity-requirements.mdreliability-performance.mdcode-templates.mdquick-reference.mdtesting-debugging.mdpublishing-guide.mdsecurity-requirements.mdreliability-performance.mdcode-templates.mdquick-reference.mdtesting-debugging.mdpublishing-guide.md