fix(cli): normalize numeric technical terms#16
Open
kkkano wants to merge 1 commit intohsingjui:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
cw searchcurrently assumesoptions.technicalTermsis always a string:However, the CLI uses
cac, andcacauto-casts numeric-looking option values to JavaScript numbers. Passing a year or other numeric token as--technical-termstherefore crashes before retrieval starts.Repro
On current
main, this crashes:node dist/index.js search \ --repo-path . \ --information-request example \ --technical-terms 2026Observed error:
I also verified the underlying parser behavior directly:
So the bug is not downstream-specific: a direct CLI invocation with a numeric technical term can trigger it.
Fix
Normalize the CLI option at the CLI boundary before splitting:
This keeps existing string behavior unchanged while making numeric values safe:
2026becomes'2026'undefined/nullbecome''Validation
pnpm buildsucceeds..split is not a functionerror:The command reaches retrieval with normalized terms:
Mixed values also normalize correctly:
In my local environment the retrieval later hit an unrelated embedding API batch-size error during indexing, but the CLI parsing crash covered by this PR is fixed and the command proceeds past the previous failure point.
Scope
This PR intentionally keeps the change minimal and only fixes the reported
--technical-termscrash. Other string-like CLI options may deserve a separate audit because they are parsed by the samecaclayer, but they are outside this small fix.