feat: non-interactive publish flags, --json output, and Claude usage skill (PAR-407) - #26
Conversation
…uteAmount override
…t, drop dead --rpc
Add parseDecimalsFlag to reject NaN, negative, non-integer, and
out-of-range values for --route-token-decimals/--reward-token-decimals
before they reach parseUnits, which otherwise silently miscomputes
amounts (e.g. parseUnits('5', NaN) === 5n).
Remove the --rpc flag row (removed from the CLI) and document the full non-interactive publish surface: --route-token, --reward-token, --route-token-decimals, --reward-token-decimals, --amount, --route-amount, --private-key-tvm, --prover-type, -y/--yes, and --json. Add a non-interactive publish example mirroring the .claude/skills/routes-cli/SKILL.md recipe.
OverviewThis PR implements a fully non-interactive, Claude-friendly QA & Test CoverageNo issues found in this domain. Web SecuritySkipped: not applicable to this PR — PR is a CLI tool for blockchain intent publishing; no web endpoints, HTTP handlers, or web security concerns are introduced. Blockchain SecurityNo issues found in this domain. PerformanceSkipped: not applicable to this PR — PR adds CLI flags and JSON output formatting; no performance-critical code paths, algorithms, or optimization concerns are evident. Stats
Automated review by Eco's specialized review team. Architecture, business logic, and correctness remain with the human reviewer. |
Summary
Makes
routes publishfully usable without a TTY — by AI agents, CI, or scripts — and ships a committed skill doc that teaches Claude how to drive it.CLI surface
--route-token/--reward-token(symbol or raw address),--route-token-decimals/--reward-token-decimals(validated 0–255, required for raw addresses),--amount,--route-amount(quote-failure fallback),-y/--yes,--json--rpcflag (parsed but never consumed)--dry-runnow exits before the confirmation prompt and before any signing-yand no--recipient, the derived destination-chain address is used without promptingNon-interactive behavior
NonInteractiveErrorthat names the exact flag to pass (e.g.Reward token not specified. Pass --reward-token <symbol|address> when running non-interactively.)--json: human output routes to stderr; stdout carries exactly one JSON object (BigInts as strings) — success, failure ({"success":false,"error":…}+ non-zero exit), and dry-run ("dryRun":true) shapesserviceErrorHandlerswallowed errors thrown fromrun(); we now print the message and set exit code 1RoutesCliError.invalidPrivateKey(existed but was never wired) instead of a raw viem errorDocs & skill
.claude/skills/routes-cli/SKILL.md: agent-facing usage guide — non-interactive recipe, flag table, JSON parsing, error→fix table keyed to the actual runtime messages--rpc)docs/superpowers/Test plan
-y; dry-run before confirm;routeAmountfallback; recipient default; missing-key error (111 tests, 13 suites green)SOLVER_URLunroutable,--dry-run) — full--jsonrun exits 0 with parseable JSON; missing--reward-tokenexits non-zero naming the flag;--rpcrejectedpnpm build+pnpm lintgreenLinear: PAR-407