You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
types(mcp): type the stdio CLI's option plumbing, fixing three crashes it hid (#9773)
`parseOptions` is now typed from CLI_FLAG_SPEC -- repeatable flags as arrays, boolean flags as
booleans, anything else as `string | boolean` behind an index signature, because the parser
genuinely accepts any `--flag` and a closed record would be a lie. That type flows into every
`options` parameter, every argv parameter becomes `readonly string[]`, and the config parameters
take the contract's LoopoverConfig.
Three defects fell out immediately, each reproduced against main before the fix:
TypeError: (options[key] ?? []) is not iterable
repoFullName.includes is not a function
LoopOver API 404: {"error":"not_found"}
The first is `--issue --issue 5`: a bare repeatable flag is stored as `true` by the no-value
branch, and the accumulator then spread it. Anything not already a list now starts a fresh one --
the only sane reading of a flag that carried no value to keep.
The second is `maintain <sub> --repo` with no value. `true` passed the `!repoFullName` truthiness
guard and then died on a string method, where "Pass --repo owner/repo." was intended.
The third is a bare `--login`, read as the literal string "true", so `decision-pack --login`
requested a contributor NAMED "true" and reported them not found instead of saying the value was
missing. Options are read through optionText() now, which treats a valueless flag as absent -- and
every one of those call sites already had an env or profile fallback for absent.
Also: the contract's LoopoverConfig was missing `session`, `telemetryEnabled`, and profile
`createdAt`, all three read and written by the CLI with nothing checking they existed. The legacy
top-level `session` is still written on the default profile so an older CLI reading the same file
keeps working, which is exactly why it cannot be left undeclared.
277 -> 184 `: any` occurrences in the bin. The remainder is a long tail of callbacks over API
payloads that stay untyped for a structural reason worth its own issue: CLI_RESPONSE_SCHEMAS
covers only the 24 STATIC paths, so all 53 parameterised calls fall through to the untyped
overload. #9773 stays open for that.
0 commit comments