This file provides guidance to AI coding agents when working with code in this repository.
singed makes it easy to get a flamegraph anywhere in a Ruby codebase. It wraps profiling with stackprof or rbspy and launches speedscope to view results.
bundle install
# Run all tests (RSpec)
bundle exec rspec
# Run a single spec file
bundle exec rspec spec/path/to/spec.rb
# Lint
bundle exec rubocop
bundle exec rubocop -a # auto-correct
# Type check (Sorbet)
bundle exec srb tc
# Regenerate gem RBIs after Gemfile.lock changes
bin/tapioca gemslib/singed.rb— main entry point; providesSinged.flamegraphblock helperlib/singed/— core classes: flamegraph output handling, stackprof/rbspy integrations, speedscope launcherspec/— RSpec tests
- Files under
lib/are# typed: strict. Write their signatures as RBS comments (#: (String) -> bool), notsigblocks. sorbet-runtimeisn't a dependency of the gem, so nothing underlib/may referenceTat runtime. Use the RBS assertion comments (#: Type,#: as !nil,#: as Type,#: as untyped,#: self as Type) instead ofT.let,T.must,T.cast,T.unsafeandT.bind.- Apps that use Tapioca still run these signatures: Tapioca rewrites RBS comments into runtime-checked
sigs while it loads the app. A signature must therefore only name constants that are loaded whenever its file is (notActiveSupportinlib/singed.rb), and must accept every value an app can pass while booting, such asflamegraph [:show, :index]in a controller. Otherwise the app'stapioca gemortapioca dslrun errors. The specs here don't loadsorbet-runtime, so they can't catch this. - Types the generated gem RBIs are missing go in
sorbet/rbi/shims/.