spec-kit
spec-kit copied to clipboard
fix(integrations): exit cleanly on unbalanced quote in --integration-options (#3457)
Summary
Closes #3457. _parse_integration_options in src/specify_cli/integrations/_helpers.py called shlex.split(raw_options) unguarded. An unbalanced quote in the flag value made shlex raise ValueError: No closing quotation, so a raw traceback escaped instead of the clean typer.Exit(1) error every other bad-input path in this function produces (unknown option, missing value, unexpected value all print a message and exit 1).
Reachable from specify init --integration-options=... and every specify integration install/switch/upgrade/migrate --integration-options=....
Before:
$ specify integration install generic --integration-options='--commands-dir "foo'
ValueError: No closing quotation # raw traceback
After:
$ specify integration install generic --integration-options='--commands-dir "foo'
Error: Could not parse integration options: No closing quotation.
# exit 1
Changes
- Wrap
shlex.split(raw_options)intry/except ValueError, printing a one-line error and raisingtyper.Exit(1)— matching the loud-fail UX of the sibling bad-input branches in the same function.
Testing
- Added
test_unbalanced_quote_exits_cleanlyunderTestParseIntegrationOptionsEqualsForm: asserts the unbalanced-quote input raisestyper.Exitwith exit code 1. - Test-the-test: confirmed the new test fails without the source change (raw
ValueErrorpropagates). - End-to-end via
CliRunneron the fullintegration install ... --integration-optionspath: exit code 1, clean message, no traceback. pytest tests/integrations/test_integration_subcommand.py→ 108 passed, 7 skipped.
🤖 Generated with Claude Code