-
-
Notifications
You must be signed in to change notification settings - Fork 31
fix(claude-code): catch up to v2.1.118 (mcp_tool hook type) #767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -529,7 +529,7 @@ pub(super) fn validate_cc_hk_013_async_field( | |
| content: &str, | ||
| diagnostics: &mut Vec<Diagnostic>, | ||
| ) { | ||
| let known_non_command = ["prompt", "agent", "http"]; | ||
| let known_non_command = ["prompt", "agent", "http", "mcp_tool"]; | ||
| for_each_raw_hook(raw_value, |event, matcher_idx, hook_idx, hook| { | ||
| if hook.get("async").is_some() { | ||
| if let Some(hook_type) = hook.get("type").and_then(|t| t.as_str()) { | ||
|
|
@@ -604,7 +604,7 @@ pub(super) fn validate_cc_hk_016_unknown_type( | |
| content: &str, | ||
| diagnostics: &mut Vec<Diagnostic>, | ||
| ) { | ||
| let valid_types = ["command", "prompt", "agent", "http"]; | ||
| let valid_types = ["command", "prompt", "agent", "http", "mcp_tool"]; | ||
| for_each_raw_hook(raw_value, |event, matcher_idx, hook_idx, hook| { | ||
| if let Some(type_value) = hook.get("type") { | ||
| let hook_type_str; | ||
|
|
@@ -970,8 +970,8 @@ pub(super) fn validate_all_raw_hooks( | |
| let check_024 = config.is_rule_enabled("CC-HK-024"); | ||
| let check_025 = config.is_rule_enabled("CC-HK-025"); | ||
|
|
||
| let valid_types = ["command", "prompt", "agent", "http"]; | ||
| let known_non_command = ["prompt", "agent", "http"]; | ||
| let valid_types = ["command", "prompt", "agent", "http", "mcp_tool"]; | ||
| let known_non_command = ["prompt", "agent", "http", "mcp_tool"]; | ||
|
Comment on lines
+973
to
+974
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The References
|
||
| let valid_shells = ["bash", "powershell"]; | ||
| let tool_events = HooksSchema::TOOL_EVENTS; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mcp_toolis added to the raw JSON allow-list, but typed parsing still usesschemas::hooks::Hook(internally-tagged enum) which currently only supportscommand|prompt|agent|http. That means configs containing{"type":"mcp_tool"...}will still failserde_json::from_valueand emit CC-HK-012, so this change likely shifts the failure from CC-HK-016 to CC-HK-012 rather than fully supporting v2.1.118. Consider adding anmcp_toolvariant toHook(with at least atoolfield and a#[serde(flatten)] _extramap if you want to avoid strict-field coupling) or otherwise adjusting typed parsing to accept this new type.