refactor(core): unify the per-ecosystem setup backends under setup/ - #155
Conversation
Four naming schemes for one concept, now one umbrella: gem_setup -> setup::gem, composer_setup -> setup::composer, pth_hook -> setup::pypi, plus a thin setup::npm alias re-exporting package_json's setup-facing surface. package_json itself stays top-level: it doubles as the crate-wide shared npm-manifest library (crawlers and vendor parse package.json through it), which is exactly why it never fit under a setup umbrella wholesale. Pure git-mv moves — the pypi backend's generic TOML helpers were already extracted to utils::toml_edit_ext, so nothing vendor-shaped rides along. Old top-level paths keep compiling through lib.rs aliases for external consumers of the published crate; internal references are repointed and the CI alias-path grep now rejects the three old paths. The shared per-backend Status enum the four modules' docs describe informally is deliberately NOT introduced here: their status semantics differ subtly (gem template regeneration), and unification is a behavior decision, not motion. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Stale CI template paths
- Updated CI workflow paths from gem_setup/templates/ to setup/gem/templates/ to match the template file relocation.
Or push these changes by commenting:
@cursor push 15869d3fcb
Preview (15869d3fcb)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -94,8 +94,8 @@ jobs:
( cd gem/socket-patch && ruby -c lib/socket_patch/launcher.rb && ruby -c exe/socket-patch && gem build socket-patch.gemspec )
( cd gem/socket-patch-bundler && ruby -c plugins.rb && gem build socket-patch-bundler.gemspec )
# The generated-plugin templates are pure Ruby — keep them parseable.
- ruby -c crates/socket-patch-core/src/gem_setup/templates/plugins.rb.tmpl
- ruby -c crates/socket-patch-core/src/gem_setup/templates/gemspec.tmpl
+ ruby -c crates/socket-patch-core/src/setup/gem/templates/plugins.rb.tmpl
+ ruby -c crates/socket-patch-core/src/setup/gem/templates/gemspec.tmpl
- name: PHP — lint the Composer launcher + validate composer.json
# composer.json lives at the repo root (Packagist requires the
@@ -94,8 +94,8 @@ jobs:
( cd gem/socket-patch && ruby -c lib/socket_patch/launcher.rb && ruby -c exe/socket-patch && gem build socket-patch.gemspec )
( cd gem/socket-patch-bundler && ruby -c plugins.rb && gem build socket-patch-bundler.gemspec )
# The generated-plugin templates are pure Ruby — keep them parseable.
- ruby -c crates/socket-patch-core/src/gem_setup/templates/plugins.rb.tmpl
- ruby -c crates/socket-patch-core/src/gem_setup/templates/gemspec.tmpl
+ ruby -c crates/socket-patch-core/src/setup/gem/templates/plugins.rb.tmpl
+ ruby -c crates/socket-patch-core/src/setup/gem/templates/gemspec.tmpl
- name: PHP — lint the Composer launcher + validate composer.json
# composer.json lives at the repo root (Packagist requires theYou can send follow-ups to the cloud agent here.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 639e3f0. Configure here.
| -e 'patch::go_redirect' -e 'patch::bun_lock_text' \ | ||
| -e 'utils::telemetry' -e 'utils::cleanup_blobs' \ | ||
| -e 'utils::date' -e 'utils::fuzzy_match' \ | ||
| -e 'gem_setup::' -e 'composer_setup::' -e 'pth_hook::' \ |
There was a problem hiding this comment.
Stale CI template paths
High Severity
The Bundler plugin templates moved from gem_setup/templates/ to setup/gem/templates/, but the lint-ecosystems job still runs ruby -c against the old paths. Those files no longer exist there, so the Ruby syntax-check step fails and the templates stop getting CI coverage.
Reviewed by Cursor Bugbot for commit 639e3f0. Configure here.
639e3f0
into
fix/sweep-bugfixes-and-test-harness



Summary
Stacked on #153 (sibling of #154) — retarget as the stack lands. The last taxonomy fix from the 2026-08-10 structure review: the four per-ecosystem setup backends lived as four top-level modules under four different naming schemes (
gem_setup={eco}_setup,composer_setup={eco}_setup,pth_hook={mechanism},package_json={file edited}), all consumed by the CLI'ssetupcommand with mirrored doc contracts.gem_setup/→setup/gem/,composer_setup/→setup/composer/,pth_hook/→setup/pypi/— puregit mv, templates included.setup/npm.rsis a thin alias overpackage_json's setup-facing surface.package_jsonitself stays top-level deliberately: it doubles as the crate-wide shared npm-manifest library (crawlers and vendor parse package.json through it).Verification
setup_invariants(19),setup_contract_gaps(8),cli_parse_setup(29) all green.cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkclean.🤖 Generated with Claude Code
Note
Low Risk
Structural refactor with backward-compatible
pub usealiases and grep enforcement; setup hook wiring logic is unchanged. Note:lint-ecosystemsin CI may still point at oldgem_setup/templatespaths if not updated elsewhere in the stack.Overview
Consolidates the gem, Composer, and PyPI setup backends under
setup/(setup/gem,setup/composer,setup/pypi) and addssetup/npmas a thin re-export over the existingpackage_jsonsetup surface so every ecosystem backend lives under one module tree.socket-patch-cliand internal core code now importsetup::gem,setup::composer, andsetup::pypiinstead ofgem_setup,composer_setup, andpth_hook.lib.rskeepscomposer_setup,gem_setup, andpth_hookas public aliases for external crate consumers; CI’s moved-module grep now rejects new internal uses of those old paths (along withgem_setup::,composer_setup::,pth_hook::).Doc and comment references are updated to the canonical paths (e.g.
setup::gem::discover_bundler_project). No intentional behavior change—moves, aliases, and import repoints only.Reviewed by Cursor Bugbot for commit 639e3f0. Configure here.