refactor(tools): narrow optional values

Avoid non-null assertions in tool and doctor code by preserving narrowed locals through each use site.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-15 16:31:13 +09:00
parent d92e78c956
commit 0a3d1875f7
5 changed files with 27 additions and 15 deletions
+3 -2
View File
@@ -22,12 +22,13 @@ export const lsp_symbols: ToolDefinition = tool({
const scope = args.scope ?? "document"
if (scope === "workspace") {
if (!args.query) {
const query = args.query
if (!query) {
return "Error: 'query' is required for workspace scope"
}
const result = await withLspClient(args.filePath, async (client) => {
return (await client.workspaceSymbols(args.query!)) as SymbolInfo[] | null
return (await client.workspaceSymbols(query)) as SymbolInfo[] | null
})
if (!result || result.length === 0) {