#3978: refactor: changing nested ternaries to a switch statement
scripts
Cluster:
Refactor Console Logging in Agents
## Summary
The nested ternary in `ui.js` was modified to use a switch statement for a cleaner, simpler, and easier-to-maintain solution.
## Changes
The nested ternary statements were replaced with a switch statement, which reduces nesting and is easier to maintain.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Replaced a nested ternary used to select the UI `pnpm run` script with a `switch` statement in `scripts/ui.js`, aiming to make the action-to-script mapping easier to read and extend. The rest of the script still resolves a pnpm runner, ensures UI deps are installed, and then runs `pnpm install` or `pnpm run <script>` from the `ui/` directory.
<h3>Confidence Score: 3/5</h3>
- This PR is mostly safe to merge, with one small behavior change worth addressing.
- The change is localized to `scripts/ui.js` and primarily refactors control flow, but it changes the `install` case from `script=null` to `script="install"`, which could cause subtle issues if future code relies on `script` for the install path. Formatting inconsistencies are minor but may trip lint/format checks depending on repo configuration.
- scripts/ui.js
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#6110: refactor: simplify boolean logic using nullish coalescing
by T1mn · 2026-02-01
78.6%
#11951: Prepending Windows Node to PATH didn’t help
by tranhoangtu-it · 2026-02-08
76.0%
#11979: fix: Change rootDir to project root to allow UI compilation
by fastroc · 2026-02-08
74.5%
#3006: fix(scripts): use local pnpm binary in run-node.mjs if global is mi...
by elliotsecops · 2026-01-27
74.4%
#9628: fix: resolve tsconfig rootDir errors by separating UI config (AI-as...
by KGBos · 2026-02-05
74.4%
#7316: fix: /chat dashboard performance
by felipcsousa · 2026-02-02
74.2%
#13838: UI: fix config panel CI failures and modularize rendering
by fresed05 · 2026-02-11
74.2%
#3973: fix: enhance npm package integrity checks and include critical files
by YeSuX · 2026-01-29
73.7%
#7824: fix(ui): remove --prod install flag that causes vite not found error
by adityarao3 · 2026-02-03
73.4%
#6819: fix(tui): handle unstructured tool results and errors in tool execu...
by TreyDong · 2026-02-02
73.2%