From 11b07c8b9552a121825d9b2e4a24afd54a3a1e53 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 20:50:34 +0000 Subject: [PATCH 1/6] Initial plan From a295d7fbb31a1f2137a6bd34eda4783440b02125 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 21:01:03 +0000 Subject: [PATCH 2/6] Add RUSH_QUIET_MODE environment variable Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com> --- .../add-rush-quiet-mode_2026-03-12-20-51.json | 10 ++++++ .../add-rush-quiet-mode_2026-03-12-20-51.json | 10 ++++++ .../src/api/EnvironmentConfiguration.ts | 36 ++++++++++++++++++- .../rush-lib/src/cli/RushCommandLineParser.ts | 7 ++++ .../rush-lib/src/cli/RushXCommandLine.ts | 6 ++++ .../rush-lib/src/scripts/install-run-rush.ts | 9 +++++ 6 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 common/changes/@microsoft/rush-lib/add-rush-quiet-mode_2026-03-12-20-51.json create mode 100644 common/changes/@microsoft/rush/add-rush-quiet-mode_2026-03-12-20-51.json diff --git a/common/changes/@microsoft/rush-lib/add-rush-quiet-mode_2026-03-12-20-51.json b/common/changes/@microsoft/rush-lib/add-rush-quiet-mode_2026-03-12-20-51.json new file mode 100644 index 00000000000..4c9ee61d615 --- /dev/null +++ b/common/changes/@microsoft/rush-lib/add-rush-quiet-mode_2026-03-12-20-51.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush-lib", + "comment": "Add RUSH_QUIET_MODE environment variable that, when set to `1` or `true`, is equivalent to passing `--quiet` for `rush`, `rushx`, and `install-run-rush.ts`", + "type": "minor" + } + ], + "packageName": "@microsoft/rush-lib" +} diff --git a/common/changes/@microsoft/rush/add-rush-quiet-mode_2026-03-12-20-51.json b/common/changes/@microsoft/rush/add-rush-quiet-mode_2026-03-12-20-51.json new file mode 100644 index 00000000000..dc6f3446651 --- /dev/null +++ b/common/changes/@microsoft/rush/add-rush-quiet-mode_2026-03-12-20-51.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Add RUSH_QUIET_MODE environment variable that, when set to `1` or `true`, is equivalent to passing `--quiet` for `rush`, `rushx`, and `install-run-rush.ts`", + "type": "minor" + } + ], + "packageName": "@microsoft/rush" +} diff --git a/libraries/rush-lib/src/api/EnvironmentConfiguration.ts b/libraries/rush-lib/src/api/EnvironmentConfiguration.ts index f7a00179197..e60a37a6f3e 100644 --- a/libraries/rush-lib/src/api/EnvironmentConfiguration.ts +++ b/libraries/rush-lib/src/api/EnvironmentConfiguration.ts @@ -245,7 +245,14 @@ export const EnvironmentVariableNames = { * Other lifecycle scripts should not make assumptions about Rush's command line syntax * if Rush did not explicitly pass along command-line parameters to their process. */ - RUSH_INVOKED_ARGS: 'RUSH_INVOKED_ARGS' + RUSH_INVOKED_ARGS: 'RUSH_INVOKED_ARGS', + + /** + * When set to `1` or `true`, this environment variable is equivalent to passing the `--quiet` flag + * to `rush`, `rushx`, and `install-run-rush.ts`. It suppresses informational startup messages + * while preserving error output. + */ + RUSH_QUIET_MODE: 'RUSH_QUIET_MODE' } as const; /** @@ -293,6 +300,8 @@ export class EnvironmentConfiguration { private static _tarBinaryPath: string | undefined; + private static _quietMode: boolean = false; + /** * If true, the environment configuration has been validated and initialized. */ @@ -456,6 +465,15 @@ export class EnvironmentConfiguration { return EnvironmentConfiguration._tarBinaryPath; } + /** + * If `true`, Rush will suppress informational startup messages, equivalent to passing `--quiet`. + * See {@link EnvironmentVariableNames.RUSH_QUIET_MODE} + */ + public static get quietMode(): boolean { + EnvironmentConfiguration._ensureValidated(); + return EnvironmentConfiguration._quietMode; + } + /** * The front-end RushVersionSelector relies on `RUSH_GLOBAL_FOLDER`, so its value must be read before * `EnvironmentConfiguration` is initialized (and actually before the correct version of `EnvironmentConfiguration` @@ -606,6 +624,20 @@ export class EnvironmentConfiguration { break; } + case EnvironmentVariableNames.RUSH_QUIET_MODE: { + // Accept both "true"/"false" string values and the standard "1"/"0" values + if (value === 'true' || value === 'false') { + EnvironmentConfiguration._quietMode = value === 'true'; + } else { + EnvironmentConfiguration._quietMode = + EnvironmentConfiguration.parseBooleanEnvironmentVariable( + EnvironmentVariableNames.RUSH_QUIET_MODE, + value + ) ?? false; + } + break; + } + case EnvironmentVariableNames.RUSH_PARALLELISM: case EnvironmentVariableNames.RUSH_PREVIEW_VERSION: case EnvironmentVariableNames.RUSH_VARIANT: @@ -662,6 +694,8 @@ export class EnvironmentConfiguration { public static reset(): void { EnvironmentConfiguration._rushTempFolderOverride = undefined; + EnvironmentConfiguration._quietMode = false; + EnvironmentConfiguration._hasBeenValidated = false; } diff --git a/libraries/rush-lib/src/cli/RushCommandLineParser.ts b/libraries/rush-lib/src/cli/RushCommandLineParser.ts index 7828eb1e90d..cce1a59d91c 100644 --- a/libraries/rush-lib/src/cli/RushCommandLineParser.ts +++ b/libraries/rush-lib/src/cli/RushCommandLineParser.ts @@ -63,6 +63,7 @@ import { InitSubspaceAction } from './actions/InitSubspaceAction'; import { RushAlerts } from '../utilities/RushAlerts'; import { initializeDotEnv } from '../logic/dotenv'; import { measureAsyncFn } from '../utilities/performance'; +import { EnvironmentVariableNames } from '../api/EnvironmentConfiguration'; /** * Options for `RushCommandLineParser`. @@ -220,6 +221,12 @@ export class RushCommandLineParser extends CommandLineParser { } } + const quietModeValue: string | undefined = + process.env[EnvironmentVariableNames.RUSH_QUIET_MODE]; + if (quietModeValue === '1' || quietModeValue === 'true') { + return true; + } + return false; } diff --git a/libraries/rush-lib/src/cli/RushXCommandLine.ts b/libraries/rush-lib/src/cli/RushXCommandLine.ts index 03648e831b8..20a856b1f7b 100644 --- a/libraries/rush-lib/src/cli/RushXCommandLine.ts +++ b/libraries/rush-lib/src/cli/RushXCommandLine.ts @@ -295,6 +295,12 @@ export class RushXCommandLine { } } + const quietModeValue: string | undefined = + process.env[EnvironmentVariableNames.RUSH_QUIET_MODE]; + if (quietModeValue === '1' || quietModeValue === 'true') { + quiet = true; + } + if (!commandName) { help = true; } diff --git a/libraries/rush-lib/src/scripts/install-run-rush.ts b/libraries/rush-lib/src/scripts/install-run-rush.ts index bfb986d46e4..5b689b9bf9f 100644 --- a/libraries/rush-lib/src/scripts/install-run-rush.ts +++ b/libraries/rush-lib/src/scripts/install-run-rush.ts @@ -16,6 +16,7 @@ import type { ILogger } from '../utilities/npmrcUtilities'; const PACKAGE_NAME: string = '@microsoft/rush'; const RUSH_PREVIEW_VERSION: string = 'RUSH_PREVIEW_VERSION'; +const RUSH_QUIET_MODE: string = 'RUSH_QUIET_MODE'; const INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE: 'INSTALL_RUN_RUSH_LOCKFILE_PATH' = 'INSTALL_RUN_RUSH_LOCKFILE_PATH'; @@ -74,6 +75,14 @@ function _run(): void { let commandFound: boolean = false; let logger: ILogger = { info: console.log, error: console.error }; + const quietModeEnvValue: string | undefined = process.env[RUSH_QUIET_MODE]; + if (quietModeEnvValue === '1' || quietModeEnvValue === 'true') { + logger = { + info: () => {}, + error: console.error + }; + } + for (const arg of packageBinArgs) { if (arg === '-q' || arg === '--quiet') { // The -q/--quiet flag is supported by both `rush` and `rushx`, and will suppress From 6ae0d6a2063eeeb8c2ee566b8c009bf7bfa26bc1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 21:25:16 +0000 Subject: [PATCH 3/6] Remove erroneous @microsoft/rush-lib change file Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com> --- .../rush-lib/add-rush-quiet-mode_2026-03-12-20-51.json | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 common/changes/@microsoft/rush-lib/add-rush-quiet-mode_2026-03-12-20-51.json diff --git a/common/changes/@microsoft/rush-lib/add-rush-quiet-mode_2026-03-12-20-51.json b/common/changes/@microsoft/rush-lib/add-rush-quiet-mode_2026-03-12-20-51.json deleted file mode 100644 index 4c9ee61d615..00000000000 --- a/common/changes/@microsoft/rush-lib/add-rush-quiet-mode_2026-03-12-20-51.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@microsoft/rush-lib", - "comment": "Add RUSH_QUIET_MODE environment variable that, when set to `1` or `true`, is equivalent to passing `--quiet` for `rush`, `rushx`, and `install-run-rush.ts`", - "type": "minor" - } - ], - "packageName": "@microsoft/rush-lib" -} From b55606c44244bb91070705093f27ea22ddfa8e9a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 21:32:14 +0000 Subject: [PATCH 4/6] Deduplicate quiet mode handling in install-run-rush; fix reset() method Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com> --- .../src/api/EnvironmentConfiguration.ts | 4 ++-- .../rush-lib/src/scripts/install-run-rush.ts | 17 ++++++----------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/libraries/rush-lib/src/api/EnvironmentConfiguration.ts b/libraries/rush-lib/src/api/EnvironmentConfiguration.ts index e60a37a6f3e..de8c8d2d2ff 100644 --- a/libraries/rush-lib/src/api/EnvironmentConfiguration.ts +++ b/libraries/rush-lib/src/api/EnvironmentConfiguration.ts @@ -693,9 +693,9 @@ export class EnvironmentConfiguration { */ public static reset(): void { EnvironmentConfiguration._rushTempFolderOverride = undefined; - EnvironmentConfiguration._quietMode = false; - + EnvironmentConfiguration._gitBinaryPath = undefined; + EnvironmentConfiguration._tarBinaryPath = undefined; EnvironmentConfiguration._hasBeenValidated = false; } diff --git a/libraries/rush-lib/src/scripts/install-run-rush.ts b/libraries/rush-lib/src/scripts/install-run-rush.ts index 5b689b9bf9f..6fa7e8b21b5 100644 --- a/libraries/rush-lib/src/scripts/install-run-rush.ts +++ b/libraries/rush-lib/src/scripts/install-run-rush.ts @@ -73,15 +73,9 @@ function _run(): void { } let commandFound: boolean = false; - let logger: ILogger = { info: console.log, error: console.error }; const quietModeEnvValue: string | undefined = process.env[RUSH_QUIET_MODE]; - if (quietModeEnvValue === '1' || quietModeEnvValue === 'true') { - logger = { - info: () => {}, - error: console.error - }; - } + let quiet: boolean = quietModeEnvValue === '1' || quietModeEnvValue === 'true'; for (const arg of packageBinArgs) { if (arg === '-q' || arg === '--quiet') { @@ -91,10 +85,7 @@ function _run(): void { // To maintain the same user experience, the install-run* scripts pass along this // flag but also use it to suppress any diagnostic information normally printed // to stdout. - logger = { - info: () => {}, - error: console.error - }; + quiet = true; } else if (!arg.startsWith('-') || arg === '-h' || arg === '--help') { // We either found something that looks like a command (i.e. - doesn't start with a "-"), // or we found the -h/--help flag, which can be run without a command @@ -114,6 +105,10 @@ function _run(): void { process.exit(1); } + const logger: ILogger = quiet + ? { info: () => {}, error: console.error } + : { info: console.log, error: console.error }; + runWithErrorAndStatusCode(logger, () => { const version: string = _getRushVersion(logger); logger.info(`The ${RUSH_JSON_FILENAME} configuration requests Rush version ${version}`); From 3910a1c0fe1f3ab48f29f6afdc4a58c7caaff581 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Mar 2026 20:35:57 +0000 Subject: [PATCH 5/6] Update rush-lib.api.md with quietMode and RUSH_QUIET_MODE API entries Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com> --- common/reviews/api/rush-lib.api.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/reviews/api/rush-lib.api.md b/common/reviews/api/rush-lib.api.md index e7004ddbbc2..b4822543b94 100644 --- a/common/reviews/api/rush-lib.api.md +++ b/common/reviews/api/rush-lib.api.md @@ -239,6 +239,7 @@ export class EnvironmentConfiguration { static parseBooleanEnvironmentVariable(name: string, value: string | undefined): boolean | undefined; static get pnpmStorePathOverride(): string | undefined; static get pnpmVerifyStoreIntegrity(): boolean | undefined; + static get quietMode(): boolean; static reset(): void; static get rushGlobalFolderOverride(): string | undefined; static get rushTempFolderOverride(): string | undefined; @@ -269,6 +270,7 @@ export const EnvironmentVariableNames: { readonly RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED: "RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED"; readonly RUSH_GIT_BINARY_PATH: "RUSH_GIT_BINARY_PATH"; readonly RUSH_TAR_BINARY_PATH: "RUSH_TAR_BINARY_PATH"; + readonly RUSH_QUIET_MODE: "RUSH_QUIET_MODE"; readonly _RUSH_RECURSIVE_RUSHX_CALL: "_RUSH_RECURSIVE_RUSHX_CALL"; readonly _RUSH_LIB_PATH: "_RUSH_LIB_PATH"; readonly RUSH_INVOKED_FOLDER: "RUSH_INVOKED_FOLDER"; From 3e8bca27f5d9bb8d895e0b4c54a5be7b100a825a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Mar 2026 21:47:20 +0000 Subject: [PATCH 6/6] Fix RUSH_QUIET_MODE position in rush-lib.api.md to match source declaration order Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com> --- common/reviews/api/rush-lib.api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/reviews/api/rush-lib.api.md b/common/reviews/api/rush-lib.api.md index b4822543b94..14063d1543e 100644 --- a/common/reviews/api/rush-lib.api.md +++ b/common/reviews/api/rush-lib.api.md @@ -270,11 +270,11 @@ export const EnvironmentVariableNames: { readonly RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED: "RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED"; readonly RUSH_GIT_BINARY_PATH: "RUSH_GIT_BINARY_PATH"; readonly RUSH_TAR_BINARY_PATH: "RUSH_TAR_BINARY_PATH"; - readonly RUSH_QUIET_MODE: "RUSH_QUIET_MODE"; readonly _RUSH_RECURSIVE_RUSHX_CALL: "_RUSH_RECURSIVE_RUSHX_CALL"; readonly _RUSH_LIB_PATH: "_RUSH_LIB_PATH"; readonly RUSH_INVOKED_FOLDER: "RUSH_INVOKED_FOLDER"; readonly RUSH_INVOKED_ARGS: "RUSH_INVOKED_ARGS"; + readonly RUSH_QUIET_MODE: "RUSH_QUIET_MODE"; }; // @beta