This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
create-ruby-gem is an interactive TUI wizard wrapping bundle gem. It detects the user's Ruby/Bundler versions, shows only compatible options via a static compatibility matrix, and builds the correct bundle gem command. Config (presets, last-used options) is stored in ~/.config/create-ruby-gem/config.yml.
bundle exec rake # run tests + rubocop (default task)
bundle exec rake spec # tests only
bundle exec rake rubocop # lint only (with --parallel --autocorrect)
bundle exec rspec spec/create_ruby_gem/cli_spec.rb # single test file
bundle exec rspec spec/create_ruby_gem/cli_spec.rb:42 # single example by line
bin/console # IRB with gem loaded
exe/create-ruby-gem # run the CLI locallyEntry point: exe/create-ruby-gem → CreateRubyGem::CLI.start(ARGV).
Key flow: CLI parses flags → detects runtime versions → looks up Compatibility::Matrix entry for the Bundler version → runs Wizard (interactive) or loads a preset → validates options → CommandBuilder assembles the bundle gem command array → Runner executes it.
CLI— option parsing (OptionParser), flag validation, orchestrates the entire flow. All collaborators are injected via constructor for testability.Detection::BundlerVersion— detects installed Bundler version viabundle --version.Detection::BundlerDefaults— reads Bundler's own default settings from~/.bundle/config.Detection::Runtime— detects Ruby, RubyGems, and Bundler versions. Returns aDetection::RuntimeInfostruct.Compatibility::Matrix— staticTABLEofEntrystructs mapping Bundler version ranges (2.4–2.x, 3.x, 4.x) to supportedbundle gemoptions. Single source of truth for what each Bundler version supports.Options::Catalog— defines everybundle gemoption (type::toggle,:flag,:enum,:string) with its CLI flags.ORDERarray controls wizard step sequence.Options::Validator— validates user-selected options against the compatibility entry.Wizard— step-by-step interactive prompt loop with back-navigation (Ctrl+B). UsesPrompterfor all I/O.CommandBuilder— converts option hash into a['bundle', 'gem', name, ...]array. Pure translator (validation is done by CLI before building).Config::Store— YAML persistence for presets and last-used options. Atomic writes viaTempfile+ rename.Runner— shells out viaCLI::Kit::System.system. Supports--dry-run.UI::Prompter— thin wrapper aroundcli-uigem. All user interaction goes through this (for test doubles). CallPrompter.setup!once before use.UI::Palette— color constants for terminal output.UI::BackNavigationPatch— monkey-patchesCLI::UI::Promptto intercept Ctrl+B.
Options in Catalog::DEFINITIONS use four types:
:toggle— boolean, emits--flag/--no-flag:flag— opt-in only, emits--flagwhen true, nothing when false:enum— pick one value from a list, emits--flag=valueor--no-flag:string— free text, emits--flag=value
- cli-ui (2.7.0) — interactive prompts, frames, colors
- cli-kit (5.0.1) — system command execution
GitHub Actions matrix: Ruby 3.2–4.0 × Bundler 2.4–4.0. Runs bundle exec rake (spec + rubocop).
- Ruby >= 3.2.
frozen_string_literal: trueeverywhere. - RSpec with
expectsyntax only, monkey patching disabled. - Version in
lib/create_ruby_gem/version.rb. SemVer, currently0.x.y.
All classes and methods must have YARD documentation. Follow these conventions:
- Always leave a blank line between the main description and
@attributes (params, return, etc.) - Document all public methods with description, params, and return types
- Document all private methods with params and return types, add description for complex logic
- Include
@exampleblocks for non-obvious usage patterns - Use
@raiseto document exceptions - Omit descriptions that just repeat the code - if the method name and signature make it obvious, only include
@param,@return, and@raisetags without a description
# Good - blank line before @param
# Calculates the check digit for this identifier.
#
# @param value [String] the value to calculate
# @return [Integer] the calculated check digit
def calculate(value)
end
# Bad - no blank line
# Calculates the check digit for this identifier.
# @param value [String] the value to calculate
# @return [Integer] the calculated check digit
def calculate(value)
endBefore committing changes, always verify these files are updated to accurately reflect the changes:
- CLAUDE.md - Update this file
- README.md - Update usage examples, Table of Contents, and compatibility matrix
- CHANGELOG.md - Add entry under
[Unreleased]section describing the change (use only standard Keep a Changelog categories — see sec_id's CLAUDE.md for the canonical list) - create-ruby-gem.gemspec - Update
descriptionif adding/removing supported features
This project follows Semantic Versioning 2.0.0:
- MAJOR — breaking changes (incompatible API changes)
- MINOR — new features (backwards-compatible)
- PATCH — bug fixes (backwards-compatible)
- Update
lib/create_ruby_gem/version.rbwith the new version number - Update
CHANGELOG.md: change[Unreleased]to[X.Y.Z] - YYYY-MM-DDand add new empty[Unreleased]section - Commit changes:
git commit -am "chore: bump version to X.Y.Z" - Release:
bundle exec rake release— builds the gem, creates and pushes the git tag, pushes to RubyGems.org - Create GitHub release at https://github.com/svyatov/create-ruby-gem/releases with notes from CHANGELOG