Skip to content

Fix string CLI arguments being passed through JSON.parse#1

Merged
wille merged 1 commit intomasterfrom
fix/coerce-string-values
Feb 26, 2026
Merged

Fix string CLI arguments being passed through JSON.parse#1
wille merged 1 commit intomasterfrom
fix/coerce-string-values

Conversation

@Djo1e
Copy link
Contributor

@Djo1e Djo1e commented Feb 26, 2026

first

Summary

  • Fix coerceValue so string option values (e.g. --query "Netflix", --product_id "steam-usa") are returned as-is instead of being passed through JSON.parse, which threw parse errors
  • Only object and array types now use JSON.parse; all other types (including string and untyped properties) return the raw value
  • Fix incorrect command names in README (get_product_detailsget-product-details, buy_productsbuy-products)

Test plan

  • bitrefill search-products --query "Netflix" returns results
  • bitrefill get-product-details --product_id "steam-usa" --currency USDC returns product details
  • bitrefill list-orders returns orders
  • bitrefill list-invoices returns invoices
  • bitrefill get-invoice-by-id --invoice_id <id> returns invoice
  • bitrefill get-order-by-id --order_id <id> returns order

String option values (e.g. --query "Netflix", --product_id "steam-usa") were
falling through to the default case in coerceValue which called JSON.parse,
causing parse errors. Now only object/array types use JSON.parse; all other
types return the raw string. Also fixes incorrect command names in README
(underscores → hyphens).
@Djo1e Djo1e requested a review from wille February 26, 2026 13:22
@wille wille merged commit d29ba54 into master Feb 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants