paritytech / paritytech/polkadot-cli
Expand `<chain>.extensions <Name>` into a copy-pasteable `--ext` skeleton (recursive field expansion)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 2
- Avg merge
- 12h 35m
- Merged PRs (30d)
- 4
Description
Summary
Expand the dot <chain>.extensions <Name> detail view so it recursively unfolds the
value type's nested enum/struct fields and prints a copy-pasteable --ext skeleton
with a <placeholder> per field — instead of stopping at the variant names and a bare
<v>.
Split out from #251 (pain point #2, the "Discoverability" half). The documentation
additions from that point are already done; this is the UX/code change that remains.
Current behaviour
$ dot people.extensions AsCoinage
Value type: Option< AsCoin | AsUnloadTokenPeople | AsUnloadTokenLitePeople | … >
Usage:
dot people.tx.<Pallet>.<Call> --from <acc> --ext '{"AsCoinage":{"value":<v>}}'
The view stops at the variant names; <v> is opaque. To learn that
AsUnloadTokenPeople is { proof, period, counter, alias_proofs: Vec<Proof> } you have
to read the runtime source, even though the metadata already carries those field types.
Desired behaviour
AsCoinage → AsUnloadTokenPeople {
proof: BandersnatchRingVrfProof // 0x… hex
period: u32
counter: u32
alias_proofs: Vec<BandersnatchRingVrfProof>
}
--ext '{"AsCoinage":{"value":{"type":"AsUnloadTokenPeople","value":{
"proof":"0x<…>","period":0,"counter":0,"alias_proofs":["0x<…>"]}}}}'
i.e. recursively expand the value type and emit a ready-to-edit --ext snippet using the
{"type":"…","value":{…}} tagged shape (the same shape dot uses for call args).
Why it's bounded, not a rewrite
The data and traversal already exist:
src/commands/focused-inspect.ts:828-849renders the detail view. The<v>is a
hardcoded literal at:846.prettyTypeById(src/core/pretty-type.ts) already recursively expands struct/enum
fields viaexpandStruct/expandEnum. Two things truncate the output today: the Usage
line never consults it, andprettyTypesummarises large enums asenum(N variants)
(AsCoinageis a bigOption<enum>).
So the work is: (a) walk the value type to emit a JSON skeleton with per-field
placeholders, and (b) decide how to present large enums — likely one skeleton per variant
on request, or expand the variant named after <chain>.extensions <Name> <Variant>.
Scope notes / open questions
- Recursion needs depth/width guards so a deeply nested or huge enum doesn't dump a wall
of text — match the existingprettyTypewidth heuristics. - For
Option<T>value types, the skeleton should targetT(theSomepayload), since
Noneis already the auto-default. - Pure presentation change — no effect on encoding/submission.
--jsonoutput should keep
its current structured shape (optionally add the expanded field tree).
Acceptance
dot <chain>.extensions <CustomExt>prints the nested field tree and a copy-pasteable
--extskeleton for at least one real custom extension (the coinageAsCoinage
variants are the reference case).- Fieldless variants render without a
valuekey; struct variants nest their fields. - README "Passing enum / struct values to
--ext" cross-links the expanded view.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/commands/focused-inspect.ts:828-849, then read src/core/pretty-type.ts and its expandStruct/expandEnum traversal. Implement the bounded recursive field tree and copy-pasteable --ext skeleton for the extensions detail view, including Option payloads and fieldless variants; verify the acceptance cases for CustomExt and AsCoinage without changing --json output.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100