Skip to content

feat(init): prompt for + persist a Discord username during setup#106

Merged
barnabasbusa merged 1 commit into
bbusa/discord-dm-on-buildfrom
bbusa/init-discord-username
May 13, 2026
Merged

feat(init): prompt for + persist a Discord username during setup#106
barnabasbusa merged 1 commit into
bbusa/discord-dm-on-buildfrom
bbusa/init-discord-username

Conversation

@barnabasbusa
Copy link
Copy Markdown

Summary

Stacked on top of #105. Adds an optional Discord username step to `panda init` so build-completion DMs work without ever having to remember the `--discord-dm` flag.

  • Interactive: after authentication, prompts `Discord username:` on a TTY. Blank = skip.
  • Non-interactive: `--discord-username @barnabasbusa` sets it directly; `--skip-discord` silences the prompt entirely. No TTY ⇒ no prompt and no failure (CI-safe).
  • Idempotent: if `notifications.discord.username` is already set in `config.user.yaml`, prints `already configured for …` and moves on.
  • Persistence: same `config.SaveUserConfig` path that `panda build`'s first-use save uses in feat(build): DM the user on Discord when a triggered build finishes #105, so both flows produce identical YAML.

Why

You asked for the username to be remembered after setup so `panda build geth` notifies you without flag plumbing. #105 already auto-saves on first `--discord-dm` use; this PR also gives you a chance to set it up front during `panda init`.

Stack

Base: `bbusa/discord-dm-on-build` (PR #105). Please merge #105 first; this PR will then retarget to `master` automatically.

Test plan

  • Fresh `panda init` on a TTY: prompts after auth, accepts `barnabasbusa`, writes to `config.user.yaml`.
  • `panda init --discord-username '@bbusa' --skip-auth --skip-docker --skip-start --force`: no prompt, value persisted.
  • `panda init --skip-discord --skip-auth --skip-docker --skip-start --force`: no prompt, no save.
  • `panda init` with stdin not a TTY (e.g. `</dev/null`): no prompt, no error.
  • Re-run `panda init` after a value is configured: prints `already configured for …`, no re-prompt.
  • After init, `panda build geth` (no flag) → DM still goes out because the default is wired.

Adds an optional Discord username step to `panda init` so build-completion
DMs work out of the box without ever passing --discord-dm. The value lands
in config.user.yaml under notifications.discord.username, which `panda
build` already reads as its default target.

- Interactive: prompts on a TTY after auth, unless --skip-discord is set or
  a username is already configured.
- Non-interactive: --discord-username <value> sets it directly; --skip-discord
  silences the prompt entirely. Stdin not a TTY ⇒ no prompt, no failure.
- Persists via the same config.SaveUserConfig path used by `panda build`'s
  auto-save behavior, so the flows produce identical YAML.
@barnabasbusa barnabasbusa merged commit 1682348 into bbusa/discord-dm-on-build May 13, 2026
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