paritytech / paritytech/polkadot-cli

feat: better error messages for incomplete/ambiguous target grammar

Open
#85 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
10
Forks
2
Avg merge
12h 35m
Merged PRs (30d)
4

Description

Summary

parseTarget errors are generic and unhelpful. When a user types dot tx Balances, the error says "Expected format: Pallet.Item" but doesn't suggest how to discover available calls.

Current Behavior

$ dot tx Balances
Error: Expected format: Pallet.Item

Expected Behavior

$ dot tx Balances
Error: Expected format: Pallet.call_name (e.g., Balances.transfer_allow_death)
  Hint: run "dot inspect Balances" to see available calls

$ dot tx Balancez.transfer
Error: Unknown pallet "Balancez". Did you mean "Balances"?
  Available pallets: Balances, System, Staking, ...

Proposed Changes

  • src/utils/parse-target.ts: Add contextual hints to error messages (e.g., suggest dot inspect <Pallet> to discover items)
  • src/commands/tx.ts: Enhance "Unknown pallet" errors with fuzzy suggestions from chain metadata
  • src/commands/query.ts: Same fuzzy suggestion treatment for storage queries

Dependencies

  • Depends on Issue tracking inspect listing calls (#79 or equivalent) — so the hint actually shows useful info.

Related Issues

  • #46 (camelCase normalization) — related input handling improvement.

Priority

P2 — Polish after inspect shows calls. Quick win (size S).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/utils/parse-target.ts, then review src/commands/tx.ts and src/commands/query.ts for the existing target and unknown-pallet errors. Check Issue #79 or its equivalent first, since the inspect listing is a dependency for the suggested hint. Done means incomplete targets explain the grammar, unknown pallets offer fuzzy suggestions and available pallets, and storage queries receive the same treatment.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.