-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add argument support to account deploy and info commands (Phase 3 - Part 2) #31
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
Add CLI argument support and JSON output mode for deploy and info commands: **account deploy** - Add `--skip-confirmation` option to bypass deployment confirmation prompt - Integrate password-handler for secure password input (supports --password, --password-file, env var) - Add JSON output mode with `--json` flag - Update error handling to use standardized exit codes **account info** - Add JSON output mode with `--json` flag - Fetch and output Safe information including: - Basic details (name, address, chain, deployment status) - On-chain data (version, nonce, balance, owners, threshold) - Advanced config (modules, guard, fallback handler, master copy) - Maintain backward compatibility with interactive Ink rendering Both commands work seamlessly in interactive and non-interactive modes. 🤖 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 pull request adds support for non-interactive/JSON output mode to the account info and account deploy commands, enabling better automation and CI/CD integration. The changes replace interactive UI elements with structured JSON output when in non-interactive mode.
Key changes:
- Added JSON mode support to
account infoandaccount deploycommands with structured error handling - Replaced
logError+p.cancelerror handling withoutputErrorthat uses appropriate exit codes - Integrated password handling via environment variables/files for non-interactive deployments
- Added
--skip-confirmationflag toaccount deploycommand
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/commands/account/info.ts | Added JSON mode support for retrieving Safe info and standardized error handling with exit codes |
| src/commands/account/deploy.ts | Added JSON mode support, password handler integration, and skip-confirmation option for automated deployments |
| src/cli.ts | Added --skip-confirmation option to the deploy command definition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!safe.predictedConfig) { | ||
| logError('Safe does not have deployment configuration') | ||
| return | ||
| outputError('Safe does not have deployment configuration', ExitCode.ERROR) | ||
| } |
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.
After outputError is called on line 81, the function exits via process.exit(), but TypeScript doesn't know this is a never return. On lines 124, 168-170, safe.predictedConfig is accessed without null checking, which could cause a type error. Add a return type annotation or explicit return/throw after the check to help TypeScript understand the control flow.
| if (!safe) { | ||
| logError(`Safe not found: ${address} on chain ${chainId}`) | ||
| p.cancel('Operation cancelled') | ||
| return | ||
| outputError(`Safe not found: ${address} on chain ${chainId}`, ExitCode.SAFE_NOT_FOUND) | ||
| } |
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.
After outputError is called on line 77, the function exits, but TypeScript doesn't recognize this. Subsequent code accesses safe (lines 80, 85, 94-95, 101-102, 115, 120-124, 168-170, 176) without null checking, which could cause type errors. Add an explicit return type annotation or assertion to help TypeScript understand the control flow.
| logError('No active wallet found. Please import a wallet first.') | ||
| p.cancel('Use "safe wallet import" to import a wallet') | ||
| return | ||
| outputError('No active wallet found. Please import a wallet first.', ExitCode.WALLET_ERROR) |
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.
After outputError is called on line 112, the function exits, but TypeScript doesn't know this is a never return. On lines 127 and 163, activeWallet is accessed without null checking, which could cause type errors. Add an explicit return type annotation or assertion to help TypeScript understand the control flow.
| outputError('No active wallet found. Please import a wallet first.', ExitCode.WALLET_ERROR) | |
| outputError('No active wallet found. Please import a wallet first.', ExitCode.WALLET_ERROR) | |
| return |
| if (!chain) { | ||
| logError(`Chain not found: ${chainId}`) | ||
| p.cancel( | ||
| 'Operation cancelled. Use "safe config chains" to add this chain or "safe config init" to load default chains' | ||
| ) | ||
| return | ||
| outputError(`Chain not found: ${chainId}`, ExitCode.CONFIG_ERROR) | ||
| } |
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.
After outputError is called on line 81, the function exits, but TypeScript doesn't recognize this. On lines 87, 91, and 98, chain is accessed without null checking, which could cause type errors. Add an explicit return type annotation or assertion to help TypeScript understand the control flow.
Summary
This PR implements Part 2 of Phase 3, adding argument support and JSON output mode to the
account deployandaccount infocommands for full automation support.Changes
account deploy
--skip-confirmationoption to bypass deployment confirmation prompt--passwordCLI flag--password-filefor file-based passwordsSAFE_WALLET_PASSWORDenvironment variable--jsonflagaccount info
--jsonflagBoth commands work seamlessly in interactive and non-interactive modes.
Examples
Test plan
Related
Part of Phase 3 (Account commands) of the non-interactive CLI enhancement plan. This completes the simpler deployment and info commands. The complex
account createcommand will be addressed separately.Related PRs:
🤖 Generated with Claude Code