Add copyToClipboard to bitcore-cli#4196
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the bitcore-cli Threshold Signature (TSS) wallet setup UX by adding a cross-platform copyToClipboard utility and integrating “Copy to clipboard” actions into TSS create/join flows, alongside a handful of CLI robustness tweaks (formatting, error handling, help/options, and proposal/transaction parameter handling).
Changes:
- Added
Utils.copyToClipboard()and integrated “Copy to clipboard” actions into TSS create/join prompts. - Adjusted CLI formatting and error logging (bold/dim reset handling; clearer TSS signing error log).
- Hardened some command flows (tx proposal actions optionality; transaction fee/tag handling; CLI help/usage tweaks) and updated tests accordingly.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bitcore-cli/test/create.test.ts | Updates TSS flow tests to account for the new clipboard option in prompt navigation. |
| packages/bitcore-cli/src/utils.ts | Adds clipboard support and improves ANSI formatting helpers for bold/dim interactions. |
| packages/bitcore-cli/src/tss.ts | Updates TSS signing error logging behavior. |
| packages/bitcore-cli/src/prompts.ts | Adjusts bold rendering in a dimmed prompt context. |
| packages/bitcore-cli/src/commands/txproposals.ts | Makes txp action checks more null-safe (but contains a new optional-chaining .length bug). |
| packages/bitcore-cli/src/commands/transaction.ts | Tightens destination tag validation and adjusts fee/nonce handling. |
| packages/bitcore-cli/src/commands/join/joinThresholdSig.ts | Adds “Copy to clipboard” loop to the join flow for sharing the auth pubkey. |
| packages/bitcore-cli/src/commands/create/createThresholdSig.ts | Adds “Copy to clipboard” loop to the create flow for sharing join codes. |
| packages/bitcore-cli/src/cli.ts | Updates help/usage text and removes non-working --list option in favor of walletName === 'list'. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| static copyToClipboard(text: string): void { | ||
| const platform = os.platform(); | ||
| let attempts: Array<{ cmd: string; args: string[] }>; |
There was a problem hiding this comment.
Declaring as constant and pushing would mitigate potential downstream reassigns that you don't want.
There was a problem hiding this comment.
I'm fine leaving it as is. Pushing implies it's additive. I don't want to be adding. I want it to be defining based on the platform which is more intuitive when you see an assignment than a push. This function is not particularly complicated. I don't think it's a big risk that someone would overwrite it.
Description
Copying public keys and invite codes during the TSS wallet setup can be cumbersome since the @clack/prompts cli interface adds formatting for multi-line outputs. This PR adds a copyToClipboard utility function that's implemented in the TSS wallet creation flow.
Changelog
Testing Notes
Checklist