Skip to content

feat(staking): non-interactive wizard mode - #384

Merged
MuncleUscles merged 1 commit into
v0.40-devfrom
feat/cli-wizard-noninteractive
Jul 9, 2026
Merged

MuncleUscles merged 1 commit into
v0.40-devfrom
feat/cli-wizard-noninteractive

Conversation

@MuncleUscles

Copy link
Copy Markdown
Member

What

Adds a fully non-interactive path to `genlayer staking wizard` so every prompt can be supplied by a flag — making the wizard scriptable and e2e-testable (today it is prompt-only).

Flags added

Flag Purpose
`--non-interactive` / `--yes` Run end-to-end with zero prompts (assume-yes to confirmations)
`--funding-source <wallet|vesting>` Where the self-stake is funded from (default `wallet`)
`--vesting-contract ` Vesting contract to fund from
`--operator ` External operator address
`--create-operator ` Create + export a new operator keystore
`--operator-same` Reuse the owner address as operator
`--operator-password ` Password for the exported operator keystore
`--operator-keystore-out ` Output filename for the exported keystore
`--amount ` Self-stake amount (GEN)
`--moniker`, `--logo-uri`, `--website`, `--description`, `--email`, `--twitter`, `--telegram`, `--github` Identity metadata (mirror `set-identity`); `--moniker` enables the identity step

Owner selection (keystore vs browser) reuses the existing `--account` / `--wallet browser` flags.

Non-interactive gate

Mode activates only when `--non-interactive` or `--yes` is passed (explicit, so interactive behavior is untouched). In that mode:

  • Owner: requires `--account` or `--wallet browser` (errors naming `--account` otherwise).
  • Network: requires `--network`.
  • Funding source: defaults to `wallet`; for `vesting`, uses `--vesting-contract`, or auto-resolves when the beneficiary has exactly one contract (zero → error, many → error naming `--vesting-contract`).
  • Operator: exactly one of `--operator-same` / `--operator ` / `--create-operator ` (the last needs `--operator-password`).
  • Amount: requires `--amount`, validated against min-stake and balance.
  • Identity: optional — applied only when `--moniker` is given, otherwise skipped.

Each missing/invalid required flag fails with a clear message naming the flag.

Left interactive (by design)

  • Creating the owner keystore account on the fly (needs a name + a new keypair): NI requires `--account`/`--wallet browser` instead.
  • "Select from my accounts" operator export: an interactive convenience; NI users pass `--operator ` or `--create-operator`.

Notes

  • Interactive path is unchanged (additive NI branches only); shared identity-commit logic extracted into `commitIdentity` with identical behavior.
  • Browser-wallet owner path works non-interactively too (join + identity through the bridge).
  • No version bump.

Testing

  • `npm run build`: clean.
  • `npx tsc --noEmit`: 32 errors, identical to the pre-existing baseline (zero new).
  • `npx vitest run`: 757 passed / 72 files. Added 10 non-interactive tests (keystore + browser owners, wallet/vesting funding, operator variants, and clear-error cases for missing `--amount`, missing operator choice, missing owner, invalid `--funding-source`).

Add a fully non-interactive path to `staking wizard` so every prompt can be
supplied by a flag, making it scriptable and e2e-testable.

New flags: --non-interactive/--yes, --funding-source, --vesting-contract,
--operator, --create-operator, --operator-same, --operator-password,
--operator-keystore-out, --amount, and identity flags (--moniker, --logo-uri,
--website, --description, --email, --twitter, --telegram, --github).

When --non-interactive (or --yes) is set the wizard runs end-to-end with zero
prompts, erroring clearly and naming the missing flag when a required choice is
absent. The interactive path is unchanged (additive branches only). The
browser-wallet owner path works non-interactively too.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 201f1a24-92c0-4154-8f82-26bd5b688e41

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cli-wizard-noninteractive

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MuncleUscles
MuncleUscles merged commit ef47935 into v0.40-dev Jul 9, 2026
10 of 11 checks passed
@MuncleUscles
MuncleUscles deleted the feat/cli-wizard-noninteractive branch July 9, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant