libsql-ruby2 — Ruby bindings for libSQL using the libsql crate + magnus. Resolves issues in the existing turso_libsql gem (INTEGER sign bug, debug logging, encoding, etc.).
- All code, comments, commit messages, and documentation must be in English.
Design documents are in docs/. Review before implementation.
docs/README.md— Document indexdocs/architecture.md— Architecture, tech choices, implementation patternsdocs/api.md— Ruby API design, type mappingdocs/testcase.md— TDD test case specificationsdocs/private/README.md— Internal development documents index (gitignored)
- Ruby: gem (libsql2), RSpec, rake-compiler, rb_sys
- Rust: magnus 0.8, libsql 0.9, tokio (rt-multi-thread)
- Build: rb-sys + rake-compiler, ext/libsql2/extconf.rb
- Release: GitHub Actions cross-compilation via oxidize-rb/actions
├── ext/libsql2/ # Rust native extension (magnus)
│ ├── src/ # Rust source
│ ├── Cargo.toml
│ └── extconf.rb
├── lib/ # Ruby code
│ ├── libsql2.rb # require entry point
│ └── libsql/ # module
├── spec/ # RSpec tests
├── docs/ # Design documents
├── Cargo.toml # Rust workspace
├── Rakefile
├── Gemfile
└── libsql2.gemspec
bundle install # Install Ruby dependencies
rake compile # Compile Rust extension
rake spec # Run RSpec tests
rake build # Build gem
rake lint # Run all linters (rubocop + clippy)
rake fmt # Auto-format all code (rubocop -a + cargo fmt)
rake fmt:check # Check formatting (CI)- TDD: write tests first, implement to make them pass
- Test cases defined in
docs/testcase.md(RSpec-style specs) - Follow development phases in
docs/private/(Phase 0–7) - API must conform to
docs/api.md
- tokio Runtime: Owned by Database, shared to Connection/Statement via Arc
- Rows fetching: Eager (all rows read into Vec at query time)
- Thread safety: Assumes GVL. Ractor support is a future consideration
- Parameters: Positional (Array) only. Named params (Hash) not in initial release
- Blob detection: Blob is a String subclass — check
is_a?(Blob)beforeis_a?(String) - Fork safety:
Database#discard!for explicit resource cleanup. tokio Runtime is not fork-safe