← Back to PRs

#6110: refactor: simplify boolean logic using nullish coalescing

by T1mn open 2026-02-01 08:56 View on GitHub →
<!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR refactors `formatTerminalLink` in `src/utils.ts` to simplify the `allow` computation for emitting OSC-8 terminal hyperlinks. The nested ternary that treated `opts.force` as a tri-state override is replaced with nullish coalescing, keeping the default behavior of enabling links only when `process.stdout.isTTY` is truthy and allowing explicit `true`/`false` overrides. Change is localized to a utility function used for terminal output formatting; no broader control flow or API surface changes are introduced. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - The change is a small refactor in a single utility function that preserves the intended tri-state behavior of `opts.force` (true/false override, otherwise fall back to TTY detection) via `??`. No behavioral change is apparent for valid inputs, and the modification is unlikely to impact unrelated parts of the codebase. - No files require special attention <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</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