Skip to content

Setup: the questions from a terminal #130

Closed

Description

@JacobStephens2

Parent

#126

What to build

thirdshift setup from a terminal (stdin and stderr both terminals) asks the Setup questions on stderr, then writes the User config the same way as without a terminal (every key, comments, in-place edit). Each question's default answer is the current value from an existing User config, or else the setting's default (including the suggested GitHub email for the address). In order:

  1. Every Run a Merge run? (merge.always, y/N)
  2. Every Run first fast-forwards the Base branch checkout? (launch.pull, y/N)
  3. Run notifications? (email.always, y/N). If yes: the address (email.to), asked again until it contains @, and the sender (email.from), where an empty answer keeps Resend's shared sender.
  4. If notifications are on and RESEND_API_KEY is unset or empty, print the export line to add to a shell profile. The key is never written anywhere.
  5. If notifications are on and RESEND_API_KEY is set, offer to send a test email (default No), reusing email-test unchanged.

logs.dir is never asked about. Stdout stays empty. Ctrl-C during the questions writes no file.

Adds a Scenario helper that runs the binary on a pseudo-terminal (via libc::openpty; libc is already a dependency), feeds scripted answers and returns stdout, stderr, the exit code and the file. See the spec in #126.

Acceptance criteria

  • Answering the questions writes the chosen values; pressing Enter throughout writes the defaults, or keeps an existing file's values.
  • Over a hand-commented User config, the comments survive.
  • An address without @ is asked again.
  • Notifications off: no address, sender, key hint or test-email questions.
  • The RESEND_API_KEY hint appears only when the variable is unset or empty, and the key appears nowhere in the file.
  • Accepting the test-email offer sends one test email through the fake Resend; declining sends none.
  • Ctrl-C mid-questions leaves no file (and an existing file unchanged).
  • All prompts are on stderr; stdout is empty.
  • Terminal-path tests use the new pseudo-terminal Scenario helper; no test-only env var fakes a terminal.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions