buildCommandEnv
buildCommandEnv(
policy?,source?):CommandEnv
Defined in: packages/agent/src/tools/shell/env.ts:161
Build the environment for a spawned command from the parent env (the live process.env via
systemUtils by default; a source can be injected for testing).
In EVERY configuration it drops a NODE_ENV we synthesized ourselves (see
SYNTHESIZED_NODE_ENV_MARKER) along with the marker. Our reason for setting it — picking
React’s production build for the Ink renderer — has nothing to do with the commands the agent
runs, and NODE_ENV=production changes real behaviour in a child: it makes npm install skip
devDependencies, and flips framework build and logging defaults. Inheriting it would mean a shell
tool invocation behaved differently depending on whether the user happened to be in the TUI. An
operator-set NODE_ENV has no marker and is passed through untouched. This drop is not governed
by policy: turning scrubbing off must not bring the synthesised value back.
With policy.scrubCredentials on, it also removes every variable shouldScrubEnvVar
selects and reports their names in removed.
Parameters
Section titled “Parameters”policy?
Section titled “policy?”CommandEnvPolicy = DEFAULT_COMMAND_ENV_POLICY
source?
Section titled “source?”ProcessEnv = processEnv