Skip to content

feat: non-interactive publish flags, --json output, and Claude usage skill (PAR-407) - #26

Merged
carlosfebres merged 15 commits into
mainfrom
cfebres/par-407-claude-friendly-publish
Jul 28, 2026
Merged

feat: non-interactive publish flags, --json output, and Claude usage skill (PAR-407)#26
carlosfebres merged 15 commits into
mainfrom
cfebres/par-407-claude-friendly-publish

Conversation

@carlosfebres

Copy link
Copy Markdown
Collaborator

Summary

Makes routes publish fully 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

  • New flags: --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
  • Removed the dead --rpc flag (parsed but never consumed)
  • --dry-run now exits before the confirmation prompt and before any signing
  • With -y and no --recipient, the derived destination-chain address is used without prompting

Non-interactive behavior

  • Every prompt now fails fast when stdin/stdout isn't a TTY, throwing NonInteractiveError that 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) shapes
  • Fixed a pre-existing bug where command failures exited 0: nest-commander's default serviceErrorHandler swallowed errors thrown from run(); we now print the message and set exit code 1
  • Missing private keys now throw the helpful RoutesCliError.invalidPrivateKey (existed but was never wired) instead of a raw viem error

Docs & 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
  • README publish flags table updated to match the real surface (was documenting the removed --rpc)
  • Design spec + implementation plan under docs/superpowers/

Test plan

  • Unit: prompt guard messages, token resolver (symbol/address/decimals), amount + decimals flag validation, display JSON routing, command flag wiring/JSON emission
  • Flow: no prompts with full overrides + -y; dry-run before confirm; routeAmount fallback; recipient default; missing-key error (111 tests, 13 suites green)
  • Integration: spawned real CLI with piped stdin, offline (SOLVER_URL unroutable, --dry-run) — full --json run exits 0 with parseable JSON; missing --reward-token exits non-zero naming the flag; --rpc rejected
  • pnpm build + pnpm lint green
  • Manual: one real (non-dry-run) publish on a low-value route to confirm end-to-end behavior unchanged

Linear: PAR-407

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.
@eco-ai-app

eco-ai-app Bot commented Jul 28, 2026

Copy link
Copy Markdown

Overview

This PR implements a fully non-interactive, Claude-friendly publish command for the Eco Routes CLI. It introduces a NonInteractiveError to fail fast when prompts are triggered without a TTY, adds a TokenResolverService for resolving token symbols and raw addresses, and implements a JSON mode in DisplayService that routes human output to stderr. Additionally, it updates the publish flow to support --yes gating, dry-run ordering, and route amount overrides, accompanied by a new SKILL.md guide.

QA & Test Coverage

No issues found in this domain.

Web Security

Skipped: 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 Security

No issues found in this domain.

Performance

Skipped: 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

Metric Value
Reviewers 4
Successful 2
Skipped 2
Failed 0
Total findings 0
Cross-domain 0
Tokens (in / out) 104298 / 1658

Automated review by Eco's specialized review team. Architecture, business logic, and correctness remain with the human reviewer.

@linear-code

linear-code Bot commented Jul 28, 2026

Copy link
Copy Markdown

PAR-407

@github-actions
github-actions Bot requested a review from dirkpage July 28, 2026 01:48
@carlosfebres carlosfebres self-assigned this Jul 28, 2026
@carlosfebres
carlosfebres merged commit 7c97f6c into main Jul 28, 2026
4 checks passed
@carlosfebres
carlosfebres deleted the cfebres/par-407-claude-friendly-publish branch July 28, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant