Repository navigation
Depend on packs-specification instead of packs - #113
Open
corsonknowles wants to merge 1 commit into
Open
corsonknowles wants to merge 1 commit into
corsonknowles wants to merge 1 commit into
Conversation
packs-rails only uses Packs.all, Packs.find and Packs::Pack, all of which are defined by packs-specification. Depending on the full packs gem pulls the packs CLI, packwerk and their dependencies into the production bundle of every app that runs packs-rails (which the README says to install in all environments). Bump the version to 0.1.1 so CD publishes the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joemsak
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The README asks apps to install
packs-railsin all environments, so its runtime dependencies go into every app's production bundle. Right now that dependency is the fullpacksgem: the packs CLI, which brings inpackwerk,code_ownership,parse_packwerk,tty-promptand others.packs-rails only uses three things from it:
Packs.all,Packs.findandPacks::Pack(#name,#relative_path,#is_gem?). All three are defined inpacks-specification, whichpacksalready depends on. packs-specification's entry point says this is its purpose:This follows the same approach as rubyatscale/pack_stats#76.
What changed
packs→packs-specificationlib/packs-rails.rb:require 'packs'→require 'packs-specification'. No other file inlib/requirespacks.The specs don't need
packseither.spec_helper.rb'srequire 'packs/rspec/support'also comes from packs-specification.packsis no longer a development dependency.Verification
Ruby 3.4.11, inside the CI matrix (3.3 / 3.4 / 4.0).
bundle exec rspec(rails-7.0 fixture)RAILS_VERSION=8.0 bundle exec rspecbundle exec srb tcbundle exec rubocopspec/fixtures/rails-8.0, none from this change)Consumer runtime closure. I ran
bundle lockon a Gemfile containing onlygem 'packs-rails'. It resolves 64 gems with 0.1.0 and 44 with this branch. The 20 that drop are:packs,packwerk,better_html,code_ownership,code_teams,constant_resolver,parse_packwerk,parser,ast,parallel,benchmark,rainbow,smart_properties,pastel,tty-color,tty-cursor,tty-prompt,tty-reader,tty-screenandwisper.Load smoke test. I ran
bundle exec ruby -Ilib -e 'require "packs-rails"'and booted the rails-8.0 fixture app:Packs.allreturns the fixture's 6 packs, andPacks.findandPacks::Packare defined.packsgem orpackwerkis in$LOADED_FEATURES.defined?(Packs::Cli)anddefined?(Packwerk)are bothnil.Compatibility note
If an app called
packsCLI APIs (for examplePacks.create_pack!) and relied on packs-rails to load that gem, it now needsgem 'packs'in its own Gemfile. Most apps already list it in their development group, because that's where the CLI is used.🤖 Generated with Claude Code