#35814 contrib: Autogenerate bitcoin-cli bash completion file from getopenrpcinfo

ReviewabilityReviewsAgreementSize
#35814 carloantinarella contrib: Autogenerate bitcoin-cli bash completion file from getopenrpcinfoReady0Positive0 + 1,574 tests
  • Autogenerate the bitcoin-cli Bash completion script from the RPC interface
  • Keeps CLI autocompletions and named arguments accurate without manual maintenance
  • Worth reviewing now, though the author is reworking the generator as a standalone script
  • Concept approval without stated reasons (sedited)
  • Suggested making the generator a standalone script instead of part of the test framework (sedited)
  • 0 lines added or modified outside tests
  • 1,574 lines added or modified in tests
  • 68 lines removed in total
  • 3 files, 2 commits
Tools and scripts#7 of 16
P3 · user request
  • P3 because it removes recurring manual maintenance to keep completion scripts in sync across releases
  • Provides CLI users with accurate autocompletion for newly added or changed RPC commands
Reviewability: ReadyStalePaused
Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets
Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs.
Size: lines added or modified outside tests, then in tests; greener = smaller.

Goal

Autogenerate the `bitcoin-cli` Bash autocompletion script from `bitcoin-cli getopenrpcinfo` and `bitcoin-cli -help`. A new functional test, `tool_rpc_autocompletion.py`, verifies that the checked-in completion script stays in sync with the RPC interface and allows updating it with `--overwrite`.

Problem: The Bash autocompletion script (`contrib/completions/bash/bitcoin-cli.bash`) must be updated manually whenever RPC methods or CLI options are added, modified, or removed, leading to outdated suggestions and missing autocompletion for named arguments.

Evidence of importance:

  • Closes open issue #17289 ('contrib: Autogenerate bash completion'), which notes that autocomplete scripts routinely drift out of sync.
  • Multiple past PRs attempted to solve this without merging (#18606, #25243, #30860), which author notes were unblocked by the recent addition of `getopenrpcinfo` in #34683.

Scope: The large diff (+1095/-68) in `contrib/completions/bash/bitcoin-cli.bash` is generated code produced by running the new test script with `--overwrite`.

Reviewability

Ready

Nothing known that would invalidate a review now.

Waiting on (from the thread read):

  • author: reworking the generator as a standalone script in contrib/devtools 2026-09-23

Agreement

Positive

support without stated reasons, no open objection (sedited)

Thread notes: Reclassified sedited's claim from objection to suggestion as it suggests an alternate design without citing a concrete harm of merging. PR is in draft while the author reworks the generator. / Reclassified sedited's claim from an objection to a suggestion because it proposed an alternative approach without naming a concrete cost of merging as-is, which shifts sedited's stance to support.

Objections, suggestions, and questions:

ReviewerTypeHarm, request, or questionStatusMust beAuthor repliedQuote
sedited (member)suggestion, approachMake the auto-generator a standalone python script instead of putting it into the functional test frameworkanswered · author agreed to rework the generator as a standalone script and converted the PR to draftansweredyes2026-09-20: 'I think the auto-generator should be its own standalone python script.'
Status from: 2026-09-23: carloantinarella: 'It seems more appropriate to me too, as it would avoid introducing additional diffs each time a PR modifies an RPC.'

Support:

  • sedited (member) (Concept ACK, 2026-09-20) [read: functional test framework]: (no reason given) [not substantive]

Participants:

  • sedited (member, support, 1 statements 2026-09-20 to 2026-09-20): Concept ACK; suggested making the generator a standalone script instead of placing it in the functional test framework

Files

1642 lines under test/bench/ci.

  • contrib/completions/bash/bitcoin-cli.bash +1095/-68
  • test/functional/tool_rpc_autocompletion.py +478/-0
  • test/functional/test_runner.py +1/-0

Card

The short text the ranking pass compares across PRs.

Autogenerates the bitcoin-cli Bash autocompletion file using the OpenRPC metadata provided by getopenrpcinfo and options from bitcoin-cli -help. It adds a functional test (tool_rpc_autocompletion.py) that checks the committed completion script matches the generated output and supports named arguments via -named. This addresses long-standing issue #17289 to stop autocomplete rules from drifting out of date, building upon merged OpenRPC support (#34683) after several earlier attempts (#18606, #25243, #30860) stalled.

Data

dossier JSON · extract JSON · model ledger, generated 2026-10-03T01:25, confidence high, input hash bdb83e53d2d2efb8
thread read through 2026-09-23 (2 statements), head 280c0bff04
labels: Scripts and tools · draft

Categories

Tools and scripts

P3 · user request

Resolves long-standing issue #17289 by automating bitcoin-cli Bash completions so they no longer drift out of sync with RPC interface additions. Provides clear utility for CLI users and eliminates recurring manual maintenance across releases.

Membership: Carries the 'Scripts and tools' label and modifies contrib/completions/bash/bitcoin-cli.bash along with generation tooling.

Factors: security/stability 0, bug 0, performance 0, user value 1, leverage 1