-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add full argument support to account create command (Phase 3 - Complete) #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implement comprehensive non-interactive support for Safe account creation: **account create** - Add `--chain-id <chainId>` option to specify chain without selection prompt - Add `--owners <addresses>` option supporting: - Comma-separated addresses: `0xabc,0xdef` - JSON array format: `["0xabc","0xdef"]` - Automatic validation and checksumming - Add `--threshold <number>` option to set signature threshold - Add `--name <name>` option to set Safe name - Add `--no-deploy` flag to skip deployment prompt - Add JSON output mode with `--json` flag including: - Safe details (name, address, EIP-3770 format, chain) - Configuration (owners, threshold, salt nonce) - Deployment status All parameters maintain backward compatibility with interactive prompts when not provided. ### Example Usage ```bash # Fully automated Safe creation safe account create \ --chain-id 1 \ --owners "0x123...,0x456..." \ --threshold 2 \ --name production-safe \ --no-deploy \ --json # JSON array format for owners safe account create \ --chain-id 137 \ --owners '["0xabc...","0xdef..."]' \ --threshold 2 \ --name polygon-safe \ --json ``` This completes Phase 3 of the non-interactive CLI enhancement, providing full automation support for all account management commands. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds non-interactive mode support to the account create command, enabling programmatic Safe account creation through command-line options. This allows the command to be used in scripts and CI/CD pipelines where user interaction is not possible.
Key changes:
- Introduced command-line options (
--chain-id,--owners,--threshold,--name,--no-deploy) to bypass interactive prompts - Added conditional logic to skip interactive prompts when options are provided or when in non-interactive mode (JSON/quiet mode)
- Implemented JSON output for non-interactive mode using new
outputSuccessandoutputErrorhelpers with standardized exit codes
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/commands/account/create.ts | Refactored createSafe to accept options parameter and support both interactive and non-interactive modes with appropriate conditional logic for prompts, validation, and output formatting |
| src/cli.ts | Added command-line options to the account create command and updated action handler to pass options to createSafe function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const parsedOwners = parseOwnersArgument(options.owners) | ||
| // Validate and checksum each address | ||
| owners = parsedOwners.map((owner) => { | ||
| return validator.assertAddressWithChain(owner, chainId, chainsConfig, 'Owner address') | ||
| }) |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parseOwnersArgument function validates addresses using isAddress which doesn't support EIP-3770 format (like eth:0x...). However, the interactive mode (lines 135-137) explicitly supports EIP-3770 format. This creates an inconsistency where users cannot use EIP-3770 format with the --owners option, even though they can in interactive mode. Consider modifying parseOwnersArgument to skip validation and just parse the strings, letting assertAddressWithChain handle validation and EIP-3770 format support on line 87.
| export interface SafeCreateOptions { | ||
| chainId?: string | ||
| owners?: string | ||
| threshold?: string | ||
| name?: string | ||
| noDeploy?: boolean | ||
| } |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SafeCreateOptions interface lacks documentation. Consider adding JSDoc comments to describe each option, including:
- Expected format for
chainId - Expected format for
owners(comma-separated addresses or JSON array) - Expected format for
threshold(number as string) - Purpose of
noDeployflag
This would help API consumers understand how to use the non-interactive mode.
| addingOwners = false | ||
| break | ||
| } | ||
|
|
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value assigned to addingOwners here is unused.
| addingOwners = false | |
| break | |
| } | |
| break | |
| } |
|
|
||
| return undefined | ||
| }, | ||
| while (addingOwners) { |
Copilot
AI
Nov 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This use of variable 'addingOwners' always evaluates to true.
Resolved conflict in src/commands/account/create.ts by keeping the full implementation over the placeholder from PR #30.
Summary
This PR completes Phase 3 by implementing comprehensive non-interactive support for the
account createcommand, the most complex account management command.Changes
account create - Full Argument Support
--chain-id <chainId>option to specify chain without interactive selection--owners <addresses>option with flexible input formats:--owners "0x123...,0x456..."--owners '["0x123...","0x456..."]'--threshold <number>option to set signature threshold--name <name>option to set Safe name--no-deployflag to skip deployment prompt in interactive mode--jsonflag including:All parameters maintain full backward compatibility - the command works interactively when options are not provided.
Examples
Test plan
Related
This completes Phase 3 (Account commands) of the non-interactive CLI enhancement plan:
All account management commands now support full non-interactive automation with comprehensive argument support and JSON output modes.
🤖 Generated with Claude Code