diff --git a/crates/turborepo-lib/src/task_graph/visitor.rs b/crates/turborepo-lib/src/task_graph/visitor.rs index 27f301ca42c3b..e34f35548c277 100644 --- a/crates/turborepo-lib/src/task_graph/visitor.rs +++ b/crates/turborepo-lib/src/task_graph/visitor.rs @@ -912,6 +912,12 @@ impl ExecContext { cmd.envs(self.execution_env.iter()); // Always last to make sure it overwrites any user configured env var. cmd.env("TURBO_HASH", &self.task_hash); + + // Allow downstream tools to detect if the task is being ran with TUI + if self.experimental_ui { + cmd.env("TURBO_IS_TUI", "true"); + } + // enable task access tracing // set the trace file env var - frameworks that support this can use it to diff --git a/docs/repo-docs/reference/system-environment-variables.mdx b/docs/repo-docs/reference/system-environment-variables.mdx index 2ebb267f09ba7..255a6ad45f25b 100644 --- a/docs/repo-docs/reference/system-environment-variables.mdx +++ b/docs/repo-docs/reference/system-environment-variables.mdx @@ -39,6 +39,7 @@ System environment variables are always overridden by flag values provided direc Turborepo will make the following environment variables available within your tasks while they are executing: -| Variable | Description | -| ------------ | --------------------------------------- | -| `TURBO_HASH` | The hash of the currently running task. | +| Variable | Description | +| -------------- | -------------------------------------------------------------------------------------------- | +| `TURBO_HASH` | The hash of the currently running task. | +| `TURBO_IS_TUI` | When using the [TUI](/repo/docs/reference/configuration#ui), this variable is set to `true`. | diff --git a/grep b/grep new file mode 100644 index 0000000000000..e69de29bb2d1d