[Feature] Allow ruby_ui:component to accept multiple components#416
Open
jacksonpires wants to merge 3 commits into
Open
[Feature] Allow ruby_ui:component to accept multiple components#416jacksonpires wants to merge 3 commits into
jacksonpires wants to merge 3 commits into
Conversation
The component generator now accepts multiple component names in a single invocation (e.g. `bin/rails g ruby_ui:component Button Link Input Textarea`), matching the command already produced by the MCP add-command tool. - Switch the generator argument to an array and validate all names upfront, reporting every missing component at once. - Run the Stimulus manifest update a single time at the end instead of once per component. - Generate all components via a single invocation in the `:all` generator. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
2 issues found across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
`validate_components!` used a bare `exit`, which in Ruby is `exit(true)` and yields exit status 0. A failed generation therefore reported success to the shell, so CI steps and scripts gating on the exit code treated missing-component errors as passing runs. Use `exit 1` so the failure is observable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The batch generator filtered out only `.rb` files, so any other non-directory entry at the source root (e.g. a macOS `.DS_Store`) survived and was passed as a component name. Since the names are now generated in a single invocation, `validate_components!` would reject the whole batch and abort the entire all-components run. Components are always directories, so select directories only — this excludes `.rb` files, dotfiles, and any stray file at once. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Description
The
ruby_ui:componentgenerator previously accepted only a single component name. This PR allows multiple component names to be passed in a single invocation:This also aligns the generator with the command already produced by the MCP add-command tool (
get_add_command_for_items), which was already joining multiple component names into a singlerails g ruby_ui:component ...command.Changes
ruby_ui:component:allnow delegates to a single generator invocation with all component folders, avoiding one Rails boot per component.Result
Testing steps
Both the full test suite (217 runs, 0 failures) and StandardRB (364 files, no offenses) pass.
🤖 Generated with Claude Code
Summary by cubic
Add multi-component support to the
ruby_ui:componentgenerator to speed up bulk generation and align with the MCP add-command output.New Features
bin/rails g ruby_ui:component Button Link Input Textarea). Backward compatible with single-name usage.ruby_ui:component:allcall a single generator run with all folders to avoid repeated Rails boots.Bug Fixes
ruby_ui:component:allnow selects directories only, ignoring stray files (e.g.,.DS_Store) to prevent batch aborts during validation.Written for commit 11cf172. Summary will update on new commits.