claude-code-sdk-ruby 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 154889ea495b7743bded0f1cf1ab96b74da5adc93bf19f1e226d6fd9f949dee1
4
- data.tar.gz: 77039484cf7d9acbd273334aad182db014b8a5d471d41019d3565828479716a8
3
+ metadata.gz: 201bb35600be5d00c23889cd6da0de9052423babcc686ce4b49bd67922b76144
4
+ data.tar.gz: d0f26949887331ef0ee43dba2131df613d4a823e4dcfa8a64b7435e89d4b1737
5
5
  SHA512:
6
- metadata.gz: 73ad8a8341c21ef6cbac699ee4ce211619a853676632c6072374821b08737ccacbe8007dd9de0971dacdf3b6bc9e4b69d21275dc2e4b13e7106a1b7f8a8d34e9
7
- data.tar.gz: fc9e88788b6783fd4a335b4553fb6c3607b65083ff1fe898756c4cbb5ee4566012562748107e748ab08f1a1c3dc712eab7bb1e91032bb8ca3818539b6755a1d7
6
+ metadata.gz: e8e14672cb48c916ed7536f9a695cf2e38a6d75df6728b4dffcdb22dd92cdab307eda60b56652e82d06ff723509097a0d0b4bfc04cabc175d1f6a3fcb6463ebc
7
+ data.tar.gz: 82e050ae3ada3def50e92fa74d937331cbae601f85184be9eb407a2b18da3c3e0d48851cfda59813a7e93444f219ccbae9a889fdb4b583ec8ff5e41c560e5dea
data/CHANGELOG.md CHANGED
@@ -7,13 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Changed
11
- - Removed unused `async-process` dependency
10
+ ## [0.1.1] - 2025-07-15
12
11
 
13
- ## [0.0.1] - 2024-07-14
12
+ ### Fixed
13
+ - Fixed permission mode conversion to use camelCase format for CLI compatibility
14
+ - `:bypass_permissions` now correctly converts to `"bypassPermissions"`
15
+ - `:accept_edits` now correctly converts to `"acceptEdits"`
16
+ - This ensures the SDK properly passes permission modes to the Claude CLI
17
+
18
+ ## [0.1.0] - 2025-07-15
14
19
 
15
20
  ### Added
16
- - Initial release of claude-sdk-ruby
21
+ - Initial release of claude-code-sdk-ruby
17
22
  - Core SDK functionality for interacting with Claude Code CLI
18
23
  - Support for async query processing
19
24
  - Message types: User, Assistant, System, and Result
@@ -39,5 +44,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
39
44
  - simplecov (~> 0.22)
40
45
  - yard (~> 0.9)
41
46
 
42
- [Unreleased]: https://github.com/anthropics/claude-code-sdk-ruby/compare/v0.0.1...HEAD
43
- [0.0.1]: https://github.com/anthropics/claude-code-sdk-ruby/releases/tag/v0.0.1
47
+ [Unreleased]: https://github.com/parruda/claude-code-sdk-ruby/compare/v0.1.1...HEAD
48
+ [0.1.1]: https://github.com/parruda/claude-code-sdk-ruby/compare/v0.1.0...v0.1.1
49
+ [0.1.0]: https://github.com/parruda/claude-code-sdk-ruby/releases/tag/v0.1.0
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Claude SDK Ruby
1
+ # Claude Code SDK Ruby
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/claude-sdk-ruby.svg)](https://badge.fury.io/rb/claude-sdk-ruby)
3
+ [![Gem Version](https://badge.fury.io/rb/claude-code-sdk-ruby.svg)](https://badge.fury.io/rb/claude-code-sdk-ruby)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
6
  Official Ruby SDK for interacting with Claude Code CLI. This gem provides a Ruby-idiomatic interface to Claude Code with full async support, proper error handling, and comprehensive type definitions.
@@ -10,7 +10,7 @@ Official Ruby SDK for interacting with Claude Code CLI. This gem provides a Ruby
10
10
  Add this line to your application's Gemfile:
11
11
 
12
12
  ```ruby
13
- gem 'claude-sdk-ruby'
13
+ gem 'claude-code-sdk-ruby'
14
14
  ```
15
15
 
16
16
  And then execute:
@@ -22,7 +22,7 @@ bundle install
22
22
  Or install it yourself as:
23
23
 
24
24
  ```bash
25
- gem install claude-sdk-ruby
25
+ gem install claude-code-sdk-ruby
26
26
  ```
27
27
 
28
28
  ## Prerequisites
@@ -203,17 +203,17 @@ bundle exec rspec
203
203
  COVERAGE=true bundle exec rspec
204
204
 
205
205
  # Build the gem
206
- gem build claude-sdk-ruby.gemspec
206
+ gem build claude-code-sdk-ruby.gemspec
207
207
 
208
208
  # Install locally
209
- gem install ./claude-sdk-ruby-0.1.0.gem
209
+ gem install ./claude-code-sdk-ruby-0.1.0.gem
210
210
  ```
211
211
 
212
212
  To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
213
213
 
214
214
  ## Contributing
215
215
 
216
- Bug reports and pull requests are welcome on GitHub at https://github.com/anthropics/claude-code-sdk-ruby.
216
+ Bug reports and pull requests are welcome on GitHub at https://github.com/parruda/claude-code-sdk-ruby.
217
217
 
218
218
  ## License
219
219
 
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "claude_sdk"
5
+
6
+ # Example showing how to use bypass permissions mode
7
+ # This will pass --permission-mode bypassPermissions to the CLI
8
+
9
+ options = ClaudeSDK::ClaudeCodeOptions.new(
10
+ permission_mode: :bypass_permissions,
11
+ )
12
+
13
+ client = ClaudeSDK::Client.new(options)
14
+
15
+ begin
16
+ response = client.query("List the files in the current directory")
17
+
18
+ response.each do |message|
19
+ if message["type"] == "user"
20
+ puts "User: #{message["content"]}"
21
+ elsif message["type"] == "assistant"
22
+ message["content"].each do |block|
23
+ if block["type"] == "text"
24
+ puts "Assistant: #{block["text"]}"
25
+ end
26
+ end
27
+ end
28
+ end
29
+ rescue ClaudeSDK::CLINotFoundError => e
30
+ puts "Error: #{e.message}"
31
+ puts "Please install Claude Code CLI first"
32
+ rescue StandardError => e
33
+ puts "Error: #{e.message}"
34
+ end
@@ -334,7 +334,7 @@ module ClaudeSDK
334
334
  cmd.push("--permission-prompt-tool", @options.permission_prompt_tool_name)
335
335
  end
336
336
 
337
- cmd.push("--permission-mode", @options.permission_mode.to_s) if @options.permission_mode
337
+ cmd.push("--permission-mode", format_permission_mode(@options.permission_mode)) if @options.permission_mode
338
338
 
339
339
  cmd.push("--continue") if @options.continue_conversation
340
340
 
@@ -357,6 +357,23 @@ module ClaudeSDK
357
357
  server.respond_to?(:to_h) ? server.to_h : server
358
358
  end
359
359
  end
360
+
361
+ # Convert permission mode from Ruby symbol format to CLI camelCase format
362
+ #
363
+ # @param mode [Symbol] the permission mode symbol
364
+ # @return [String] the camelCase formatted mode
365
+ def format_permission_mode(mode)
366
+ case mode
367
+ when :default
368
+ "default"
369
+ when :accept_edits
370
+ "acceptEdits"
371
+ when :bypass_permissions
372
+ "bypassPermissions"
373
+ else
374
+ mode.to_s
375
+ end
376
+ end
360
377
  end
361
378
  end
362
379
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeSDK
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude-code-sdk-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-07-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: async
@@ -55,6 +55,7 @@ files:
55
55
  - claude-code-sdk-ruby.gemspec
56
56
  - examples/async_multiple_queries.rb
57
57
  - examples/basic_usage.rb
58
+ - examples/bypass_permissions.rb
58
59
  - examples/enumerator_usage.rb
59
60
  - examples/error_handling.rb
60
61
  - examples/mcp_servers.rb
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  - !ruby/object:Gem::Version
90
91
  version: '0'
91
92
  requirements: []
92
- rubygems_version: 3.6.2
93
+ rubygems_version: 3.6.7
93
94
  specification_version: 4
94
95
  summary: Ruby SDK for Claude Code
95
96
  test_files: []