fix: accept secret value as separate argument in vault put#881
Conversation
Change vault put argument signature from `<vault_name> <key_value>` to `<vault_name> <key> [value]` so users can pass the secret value as a separate positional argument without needing KEY=VALUE format. This fixes the TooManyArgumentsError when passing GCP access tokens and other values containing special characters as separate arguments. Backward compatible: KEY=VALUE format, stdin piping, and interactive prompt all continue to work when value argument is omitted. Closes #880 Co-authored-by: Blake Irvin <bixu@users.noreply.github.com>
There was a problem hiding this comment.
CLI UX Review
Blocking
None.
Suggestions
-
vault_put.tsargument signature — The new.arguments("<vault_name:string> <key:string> [value:string]")is surfaced in--helpoutput. The[value]bracket correctly signals optionality. One minor note: the help text for this command has no description for the arguments themselves (Cliffy doesn't always show per-argument descriptions), so users discovering the command via--helpmay not immediately see that the oldKEY=VALUEform and stdin piping still work. Consider adding a note to.description()or a.example()call to surface all three input methods, e.g.:.example("Separate args", "swamp vault put myvault MY_KEY secretvalue") .example("Inline KEY=VALUE", "swamp vault put myvault MY_KEY=secretvalue") .example("Stdin", "echo secretvalue | swamp vault put myvault MY_KEY") -
Error message formatting — The updated error message in
resolveKeyValuenow lists three forms (separate arg, inline, stdin), which is clearer than before. The wordingProvide the value as a separate argument, inline, or via stdin:is accurate and readable. No change needed, just a note that this is a nice improvement.
Verdict
PASS — The new 3-arg form is a clear UX improvement with full backward compatibility. Help text and error messages are consistent with the rest of the CLI. No blocking issues.
There was a problem hiding this comment.
Code Review
Blocking Issues
None.
Suggestions
- Consider a unit test for the 3-arg path in the action handler (
vault_put_test.ts): The newvalueArg !== undefinedbranch is straightforward (two assignments), but a test exercising the command with three positional arguments would give full coverage of the new feature. Not blocking since the path is trivial and the manual test plan covers it.
Overall this is a clean, well-structured change. The backward compatibility is preserved correctly, the priority order (explicit arg > KEY=VALUE > stdin > interactive) is clearly commented, the libswamp import boundary is respected, and the error message update with the corresponding test update is thorough.
Summary
vault putargument signature from<vault_name> <key_value>to<vault_name> <key> [value]so users can pass the secret as a separate positional argumentKEY=VALUEparsing needed)KEY=VALUEformat, stdin piping, and interactive prompt all still workTest Plan
<key> <value>form)deno check,deno lint,deno fmtall cleanswamp vault put <vault> KEY valueworksswamp vault put <vault> KEY=valuestill works (backward compat)echo "value" | swamp vault put <vault> KEYstill worksCloses #880
Co-authored-by: Blake Irvin bixu@users.noreply.github.com
🤖 Generated with Claude Code