Module: ClaudeAgentSDK::OptionWarnings
- Defined in:
- lib/claude_agent_sdk/option_warnings.rb
Overview
Advisory warnings for option combinations that silently change behavior.
Class Method Summary collapse
-
.reset! ⇒ Object
Test hook: forget which messages were already emitted.
-
.warn_if_can_use_tool_shadowed(options) ⇒ Object
can_use_tool is only consulted when the CLI's permission ladder lands on "ask".
Class Method Details
.reset! ⇒ Object
Test hook: forget which messages were already emitted.
33 34 35 |
# File 'lib/claude_agent_sdk/option_warnings.rb', line 33 def reset! @mutex.synchronize { @emitted.clear } end |
.warn_if_can_use_tool_shadowed(options) ⇒ Object
can_use_tool is only consulted when the CLI's permission ladder lands on "ask". Anything that auto-approves a tool call earlier in the ladder means the callback never runs — so a callback written for security purposes can silently be dead code (real callers have shipped path-jails that never fired because the same tools were listed bare in allowed_tools).
Advisory only (never raises): shadowing can be intentional, e.g. a callback used solely for tools outside allowed_tools. Deliberately silent on permission_mode 'acceptEdits' (it only auto-approves in-cwd file edits, so warning would be a false positive for anyone gating Bash/network/MCP tools) and on real specifiers like "Bash(ls:*)" (they only shadow matching invocations, not the whole tool).
25 26 27 28 29 30 |
# File 'lib/claude_agent_sdk/option_warnings.rb', line 25 def warn_if_can_use_tool_shadowed() return unless .can_use_tool = () emit() if end |