#6116: refactor: add explicit type assertion in resolveOptionFromCommand
cli
Cluster:
Refactor Console Logging in Agents
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates `resolveOptionFromCommand` (`src/cli/cli-utils.ts`) to explicitly assert the option value type (`opts[key] as T`) when walking up the commander `Command` parent chain. The behavior at runtime is unchanged; the change is purely for TypeScript typing to align the generic return type `T | undefined` with commander’s untyped `opts()` return shape.
I didn’t find any new functional issues introduced by this change. In current call sites (e.g. `src/cli/models-cli.ts`), callers already treat the returned value as a string/undefined, so the assertion matches existing usage.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is a narrow TypeScript-only type assertion in a helper that reads commander options; it does not alter runtime control flow or values, and current usage aligns with the asserted types.
- No files require special attention
<!-- greptile_other_comments_section -->
**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
75.5%
#6059: fix #6044
by vivganes · 2026-02-01
75.2%
#23594: test(tui): fix mock typing in command handler tests
by Sashamine · 2026-02-22
74.9%
#21027: fix(tests): resolve TypeScript type errors in CLI test files
by kittipond2365 · 2026-02-19
74.2%
#17770: refactor(cli): reuse shared option builders
by iyoda · 2026-02-16
73.8%
#6039: fix: improve type safety in gateway registration
by Bharadwajreddy1406 · 2026-02-01
73.5%
#11979: fix: Change rootDir to project root to allow UI compilation
by fastroc · 2026-02-08
73.0%
#9461: refactor(cli): replace console.warn with SubsystemLogger in health.ts
by dinakars777 · 2026-02-05
71.9%
#9974: refactor(agents): replace console.warn with SubsystemLogger in comp...
by dinakars777 · 2026-02-05
71.3%
#19684: fix: change elevatedDefault fallback from 'on' to 'off'
by neipor · 2026-02-18
70.6%