Repository navigation
npm proxies and groups: a switch to offer the replace-registry-host command - #844
Merged
Merged
Conversation
The Connect sidebar of every npm repository offered `npm config set replace-registry-host <package-lock.json-host>`. It is now optional: a proxy or a group shows it only once an administrator switches on "Show npm's replace-registry-host setting" in its settings (the npm option `show_replace_registry_host`); hosted repositories never take it. A format option can now be a switch (`OptionInput::Switch`): the admin form shows it as a switch, `GET /admin/formats` names its `input`, and the host keeps `true` when it is on and nothing when it is off, without asking the plugin's `check_option`. A switch is never required. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJXfcjjRxskuvtSWDNo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJXfcjjRxskuvtSWDNo
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.
Since #835, the Connect sidebar of every npm repository shows
npm config set replace-registry-host <package-lock.json-host>. This makes the line optional. A proxy or a group shows it only after an administrator turns on Show npm's replace-registry-host setting in the repository's settings (Admin → Repositories, create or edit). It is off by default, and hosted repositories don't offer it.No issue asks for this, so the pull request fixes none, following AGENTS.md. It also updates the unreleased fragment
docs/changes/2.2.0/npm-replace-registry-host.feature.mdso that the 2.2.0 notes describe the optional behaviour.How
FormatOptionin the plugin API gets aninputfield:OptionInput::Text, which is the existing line of text, orOptionInput::Switch."true"(SWITCH_ON) and treats"false"ornullas off, clearing the option. It accepts nothing else and doesn't call the plugin'scheck_option.GET /admin/formatslists each option'sinputastextorswitch.show_replace_registry_host, for proxies and groups. Nothing in the plugin reads it.RepositoryFormshows a switch option as aSwitchand a text option as a text field, as before. When the kind changes on create, the form drops options that the new kind doesn't take, because the server refuses them. Example: the switch turned on for a group, then the kind changed to hosted.connectSnippetsadds thereplace-registry-hostline only when the repository's option is"true". The browse API already returns the options.docs/npm.md, Connecting a client: the switch, and how to set it through the admin API.docs/format-plugins.md, Format options: switch options.Testing
pnpm run tscis clean.pnpm exec vitest run: all 43 files and 593 tests pass, including new tests for the Connect panel and the form's switch.cargo fmt --checkis clean.cargo clippy --workspace --all-targets -- -D warningsis clean.forge-plugin-api,forge-plugin,forge-format-npmandforge-format-aptpass, including a new case that a required switch is refused.the_builtin_formats_describe_themselves_wellpasses.npm::proxies_and_groups_switch_the_replace_registry_host_command_on,npm::routes_only_npm_repositoriesandapt::options_are_checkedpass. The new test covers off by default," true "stored as"true", hosted refused,"yes"refused, and switching off with"false"ornull. It also checks the formats listing.Generated by Claude Code