Conversation
Move scriptShell, shellEmulator, updateNotifier, trustPolicy*, globalVirtualStoreDir, stateDir, registrySupportsTimeField, initPackageManager, initType, and agent from the workspace-only exclusion list into the global config allowlist. These are personal/system preferences (not workspace structure), and in v10 they could be set via ~/.npmrc. v11 silently dropped them from both ~/.npmrc and the new global config.yaml, with pnpm-workspace.yaml as the only working location. Closes #11474.
📝 WalkthroughWalkthroughThis PR expands global PNPM configuration support by enabling system-wide preferences in ChangesGlobal Config Key Expansion
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Move side-effects-cache, side-effects-cache-readonly, strict-dep-builds, use-stderr, verify-deps-before-run, verify-store-integrity, virtual-store-dir, and virtual-store-dir-max-length from the workspace-only exclusion list into the global config allowlist.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/reader/test/index.ts (1)
1713-1736: ⚡ Quick winAssert the full “no warnings” contract.
Line 1736 only filters one warning substring, so this regression still passes if any of these newly allowed keys starts emitting a different warning. Since the expected behavior here is “applies without warnings”, please assert that
warningsis empty.Suggested tightening
- expect(warnings.find((w) => w.includes('global config file'))).toBeUndefined() + expect(warnings).toStrictEqual([])🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@config/reader/test/index.ts` around lines 1713 - 1736, The test currently only checks that no warning contains "global config file" which misses other possible warnings; update the assertion on the `warnings` value returned by `getConfig` to assert it is empty (e.g., replace the `expect(warnings.find((w) => w.includes('global config file'))).toBeUndefined()` line with an assertion that `warnings` is an empty array such as `expect(warnings).toEqual([])` or `expect(warnings).toHaveLength(0)`), keeping the `getConfig` call and the `warnings` variable unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@config/reader/test/index.ts`:
- Around line 1713-1736: The test currently only checks that no warning contains
"global config file" which misses other possible warnings; update the assertion
on the `warnings` value returned by `getConfig` to assert it is empty (e.g.,
replace the `expect(warnings.find((w) => w.includes('global config
file'))).toBeUndefined()` line with an assertion that `warnings` is an empty
array such as `expect(warnings).toEqual([])` or
`expect(warnings).toHaveLength(0)`), keeping the `getConfig` call and the
`warnings` variable unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d2069fd3-e492-4795-9160-0bb3cfe8af5c
📒 Files selected for processing (3)
.changeset/global-yaml-user-prefs.mdconfig/reader/src/configFileKey.tsconfig/reader/test/index.ts
There was a problem hiding this comment.
Pull request overview
Enables a set of user-level preference options to be read from (and written to) the global config.yaml by expanding the global YAML allowlist in @pnpm/config.reader, restoring behavior that previously worked via user-level config in pnpm v10.
Changes:
- Added 20 user-level preference keys to the global config.yaml allowlist (
pnpmConfigFileKeys) so they are no longer filtered out. - Added a regression test asserting several of these preferences are applied from global
config.yamlwithout triggering “ignored keys” warnings. - Added a changeset to publish the behavior change for
@pnpm/config.readerandpnpm.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| config/reader/src/configFileKey.ts | Moves user-preference keys from the excluded list into the global YAML allowlist so they can be set globally. |
| config/reader/test/index.ts | Adds a regression test verifying select user-preference keys are applied from global config.yaml without warnings. |
| .changeset/global-yaml-user-prefs.md | Documents the newly-supported global config.yaml keys and bumps packages with a patch changeset. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
sounds good |
Moves 20 user-level preference settings from the workspace-only exclusion list into the global config allowlist (`config/reader/src/configFileKey.ts`): - Shell / scripts: `scriptShell`, `shellEmulator` - Notifications & UI: `updateNotifier`, `useStderr` - Trust policy (already DLX-inherited as user-level posture): `trustPolicy`, `trustPolicyExclude`, `trustPolicyIgnoreAfter` - Store / virtual store: `globalVirtualStoreDir`, `virtualStoreDir`, `virtualStoreDirMaxLength`, `verifyStoreIntegrity`, `sideEffectsCache`, `sideEffectsCacheReadonly` - Build / dep verification: `strictDepBuilds`, `verifyDepsBeforeRun` - Misc personal/system prefs: `stateDir`, `registrySupportsTimeField`, `initPackageManager`, `initType`, `agent` These are personal/system preferences rather than workspace structure. In v10 they could be set in `~/.npmrc`. v11 silently dropped them from both `~/.npmrc` and the new global `config.yaml`, leaving `pnpm-workspace.yaml` as the only working location — which the issue author rightly points out is impractical for system-level defaults like `scriptShell`. After this change: - Settings in `~/.config/pnpm/config.yaml` are applied instead of being filtered out by `isConfigFileKey` (`config/reader/src/index.ts:296`). - `pnpm config set --location global scriptShell <path>` succeeds instead of throwing `ConfigSetUnsupportedYamlConfigKeyError` (same predicate used in `config/commands/src/configSet.ts:237`). `pmOnFail` and `runtimeOnFail` are intentionally left workspace-only because they would cause lockfile divergence between contributors when set globally. `~/.npmrc` support for non-auth/non-network keys is also intentionally not restored — the team has moved those settings to YAML config. Closes #11474.
Summary
Moves 20 user-level preference settings from the workspace-only exclusion list into the global config allowlist (
config/reader/src/configFileKey.ts):scriptShell,shellEmulatorupdateNotifier,useStderrtrustPolicy,trustPolicyExclude,trustPolicyIgnoreAfterglobalVirtualStoreDir,virtualStoreDir,virtualStoreDirMaxLength,verifyStoreIntegrity,sideEffectsCache,sideEffectsCacheReadonlystrictDepBuilds,verifyDepsBeforeRunstateDir,registrySupportsTimeField,initPackageManager,initType,agentThese are personal/system preferences rather than workspace structure. In v10 they could be set in
~/.npmrc. v11 silently dropped them from both~/.npmrcand the new globalconfig.yaml, leavingpnpm-workspace.yamlas the only working location — which the issue author rightly points out is impractical for system-level defaults likescriptShell.After this change:
~/.config/pnpm/config.yamlare applied instead of being filtered out byisConfigFileKey(config/reader/src/index.ts:296).pnpm config set --location global scriptShell <path>succeeds instead of throwingConfigSetUnsupportedYamlConfigKeyError(same predicate used inconfig/commands/src/configSet.ts:237).pmOnFailandruntimeOnFailare intentionally left workspace-only because they would cause lockfile divergence between contributors when set globally.~/.npmrcsupport for non-auth/non-network keys is also intentionally not restored — the team has moved those settings to YAML config.Closes #11474.
Test plan
tsgo --build— the_proofExcludedPnpmKeysIsExhaustiveand_proofNoContradictionstatic type assertions still hold after the move.config/reader/test/index.ts(reads user-level preference settings from global config.yaml) that writes 14 of these keys to a globalconfig.yamland asserts they're applied without warnings.pnpm run lintpasses.Written by an agent (Claude Code, claude-opus-4-7).
Summary by CodeRabbit
New Features
Documentation