[rush-lib] Forward parameterNamesToIgnore to child processes via environment variable
Summary
Adds RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES environment variable to forward the parameterNamesToIgnore operation setting from rush-project.json to child processes during phased command execution. The environment variable name is exported as a public constant for use by consumers.
Details
Implementation:
- Created
IgnoredParametersPluginthat taps thecreateEnvironmentForOperationhook - Reads
parameterNamesToIgnoredirectly fromoperation.settings(raw configuration value, not CLI-affected values) - Sets
RUSHSTACK_CLI_IGNORED_PARAMETER_NAMESwith comma-separated parameter names when defined - Exported the environment variable name as
RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES_ENV_VARconstant for external use - Integrated into
PhasedScriptActionalongside other standard plugins
Design:
- Follows pattern established by
NodeDiagnosticDirPlugin - Naming consistent with existing
RUSHSTACK_FILE_ERROR_BASE_FOLDERconvention - Only sets environment variable when configuration explicitly defines ignored parameters
- Environment variable name exported as public constant to avoid hardcoded strings in consuming code
- Uses comma separator to clearly indicate enumeration of parameter names (not command line arguments)
Example:
Given a rush-project.json with:
{
"operationSettings": [
{
"operationName": "build",
"parameterNamesToIgnore": ["--verbose", "--production"]
}
]
}
Child processes will receive:
RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES="--verbose,--production"
Consumers can reference the environment variable name using:
import { RUSHSTACK_CLI_IGNORED_PARAMETER_NAMES_ENV_VAR } from '@microsoft/rush-lib';
How it was tested
Added unit tests verifying:
- Environment variable set correctly when
parameterNamesToIgnoreis specified - Environment variable not set when
parameterNamesToIgnoreis absent - Correct values forwarded for different project configurations
- Tests use the exported constant to avoid hardcoded strings
All tests pass. No regressions in existing test suite.
Impacted documentation
None. This is an internal implementation detail for plugin authors.
Original prompt
In rush-lib, use the
createEnvironmentForOperationphased command hook to forward the value of theparameterNamesToIgnoreoperation setting to child processes as an environment variable. Use similar naming to theRUSHSTACK_BASE_ERROR_FOLDERenvironment variable.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
@copilot Run rush change --no-fetch --bulk --bump-type none --message "${description}" to create a change file, then ensure that the file path and content of the created change file reference @microsoft/rush and not any other package.
@copilot Run
rush change --no-fetch --bulk --bump-type none --message "${description}"to create a change file, then ensure that the file path and content of the created change file reference `@micr...
Created change file at common/changes/@microsoft/rush/copilot-forward-parameter-names-ignore_2025-12-10-21-30.json with bump-type "none" and the specified message. The file correctly references @microsoft/rush package. See commit 3614780.