Class: ClaudeCodeSDK::Options
- Inherits:
-
Object
- Object
- ClaudeCodeSDK::Options
- Defined in:
- lib/claude_code_sdk/types.rb
Overview
Options for configuring Claude Code queries
Instance Attribute Summary collapse
-
#allowed_tools ⇒ Object
Returns the value of attribute allowed_tools.
-
#append_system_prompt ⇒ Object
Returns the value of attribute append_system_prompt.
-
#blocked_tools ⇒ Object
Returns the value of attribute blocked_tools.
-
#continue_conversation ⇒ Object
Returns the value of attribute continue_conversation.
-
#cwd ⇒ Object
Returns the value of attribute cwd.
-
#disable_cache ⇒ Object
Returns the value of attribute disable_cache.
-
#max_thinking_tokens ⇒ Object
Returns the value of attribute max_thinking_tokens.
-
#max_turns ⇒ Object
Returns the value of attribute max_turns.
-
#mcp_servers ⇒ Object
Returns the value of attribute mcp_servers.
-
#model ⇒ Object
Returns the value of attribute model.
-
#no_markdown ⇒ Object
Returns the value of attribute no_markdown.
-
#permission_mode ⇒ Object
Returns the value of attribute permission_mode.
-
#resume ⇒ Object
Returns the value of attribute resume.
-
#system_prompt ⇒ Object
Returns the value of attribute system_prompt.
-
#tree ⇒ Object
Returns the value of attribute tree.
-
#tree_symlinks ⇒ Object
Returns the value of attribute tree_symlinks.
-
#tree_verbose ⇒ Object
Returns the value of attribute tree_verbose.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Options
constructor
A new instance of Options.
- #to_cli_args ⇒ Object
Constructor Details
#initialize(**kwargs) ⇒ Options
Returns a new instance of Options.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/claude_code_sdk/types.rb', line 13 def initialize(**kwargs) @allowed_tools = kwargs[:allowed_tools] || [] @blocked_tools = kwargs[:blocked_tools] || [] @permission_mode = kwargs[:permission_mode] || "default" @max_thinking_tokens = kwargs[:max_thinking_tokens] || 8000 @system_prompt = kwargs[:system_prompt] @cwd = kwargs[:cwd] @mcp_servers = kwargs[:mcp_servers] || {} @disable_cache = kwargs[:disable_cache] || false @no_markdown = kwargs[:no_markdown] || false @tree = kwargs[:tree] || [] @tree_symlinks = kwargs[:tree_symlinks] || false @tree_verbose = kwargs[:tree_verbose] || false @max_turns = kwargs[:max_turns] @model = kwargs[:model] @continue_conversation = kwargs[:continue_conversation] || false @resume = kwargs[:resume] @append_system_prompt = kwargs[:append_system_prompt] end |
Instance Attribute Details
#allowed_tools ⇒ Object
Returns the value of attribute allowed_tools.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def allowed_tools @allowed_tools end |
#append_system_prompt ⇒ Object
Returns the value of attribute append_system_prompt.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def append_system_prompt @append_system_prompt end |
#blocked_tools ⇒ Object
Returns the value of attribute blocked_tools.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def blocked_tools @blocked_tools end |
#continue_conversation ⇒ Object
Returns the value of attribute continue_conversation.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def continue_conversation @continue_conversation end |
#cwd ⇒ Object
Returns the value of attribute cwd.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def cwd @cwd end |
#disable_cache ⇒ Object
Returns the value of attribute disable_cache.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def disable_cache @disable_cache end |
#max_thinking_tokens ⇒ Object
Returns the value of attribute max_thinking_tokens.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def max_thinking_tokens @max_thinking_tokens end |
#max_turns ⇒ Object
Returns the value of attribute max_turns.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def max_turns @max_turns end |
#mcp_servers ⇒ Object
Returns the value of attribute mcp_servers.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def mcp_servers @mcp_servers end |
#model ⇒ Object
Returns the value of attribute model.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def model @model end |
#no_markdown ⇒ Object
Returns the value of attribute no_markdown.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def no_markdown @no_markdown end |
#permission_mode ⇒ Object
Returns the value of attribute permission_mode.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def @permission_mode end |
#resume ⇒ Object
Returns the value of attribute resume.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def resume @resume end |
#system_prompt ⇒ Object
Returns the value of attribute system_prompt.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def system_prompt @system_prompt end |
#tree ⇒ Object
Returns the value of attribute tree.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def tree @tree end |
#tree_symlinks ⇒ Object
Returns the value of attribute tree_symlinks.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def tree_symlinks @tree_symlinks end |
#tree_verbose ⇒ Object
Returns the value of attribute tree_verbose.
6 7 8 |
# File 'lib/claude_code_sdk/types.rb', line 6 def tree_verbose @tree_verbose end |
Instance Method Details
#to_cli_args ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/claude_code_sdk/types.rb', line 33 def to_cli_args args = ["--output-format", "stream-json", "--verbose"] args.push("--system-prompt", system_prompt) if system_prompt args.push("--append-system-prompt", append_system_prompt) if append_system_prompt args.push("--allowedTools", allowed_tools.join(",")) unless allowed_tools.empty? args.push("--disallowedTools", blocked_tools.join(",")) unless blocked_tools.empty? args.push("--max-turns", max_turns.to_s) if max_turns args.push("--model", model) if model args.push("--permission-mode", ) if args.push("--continue") if continue_conversation args.push("--resume", resume) if resume args.push("--add-dir", cwd.to_s) if cwd unless mcp_servers.empty? require "json" mcp_config = { mcpServers: mcp_servers }.to_json args.push("--mcp-config", mcp_config) end args end |