Repository navigation
Setup: the questions from a terminal - #151
Merged
Merged
Conversation
thirdshift setup, with stdin and stderr on a terminal, asks on stderr whether every Run is a Merge run, fast-forwards the Base branch and sends Run notifications, and if so where to and from whom; then hints at RESEND_API_KEY or offers a test email. Answers are written in place, keeping comments. Tests drive the binary on a pseudo-terminal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ordering Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS libc declares openpty's termios and winsize arguments as *mut; Linux declares them *const. A *mut null coerces to either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
thirdshift setupasks the Setup questions on stderr when stdin and stderr are both terminals, then writes the User config the same way as with no terminal: every key, with comments, edited in place.src/ +├── questions.rs # the questions, on stderr; answers from stdin └── config.rs # setup() asks when there is a terminal; with_answers edits the TOML tests/ ├── support/mod.rs # + Scenario::run_on_terminal: the binary on a libc::openpty pseudo-terminal, │ # the pty as its controlling terminal so Ctrl-C sends a real SIGINT └── setup.rs # + 12 terminal-path testsThe README's User config section and the help line for
setupnow describe the questions.Evidence
cargo test --test setupwith the new tests and no questions: 11 of the terminal tests fail. The terminal never showed"Merge run?";setupwrote the defaults without asking.After: 28 of 28 pass.
cargo testpasses in full and clippy is clean.Merge Danger
Door: two-way
Additive: with no terminal,
setupbehaves exactly as before, so scripted uses aren't affected.Blast Radius: interactive-setup
Only
thirdshift setuprun from a terminal changes. Runs,email-test,update,versionandhelpare untouched.Unaddressed findings
Standards
questions::ask, so it can be tested in-process: skipped. The spec makes the binary the seam ("No new seam goes into the production code"), and the pty tests cover the behavior.has_terminal()must be called beforeask(); returnOption<Answers>instead: skipped. The first-Run offer (a sibling issue) needs the terminal test on its own, before it asks anything.with_answers: kept. They pin formatting edge cases that are costly to reach end to end, as the module's existingcomplete()tests do.config::setup()(UI, email and TOML in one function) and its repeated parsing: deferred. The first-Run offer will reshape this entry point, and the right split is clearer then. The extra parses are of a small file.askedfor the outcome message: skipped. It picks one of four distinct messages, and a match reads more plainly than an abstraction would."merge", "always"), so a new question touches several places: skipped. This matchesDEFAULTSandparse, which name keys the same way.answer/read/say, theKeystrokestuple alias,TerminalResultrepeatingRunResult's fields, and the fully qualifiedDEFAULT_FROMin the tests: skipped. They are private helpers or test support, their doc comments say what they do, and the issue asks the helper to return the file alongside stdout, stderr and the exit code.Spec
email.fromrather than going back toonboarding@resend.dev: kept. The spec also says "Each question's default answer is the current value", and with no custom sender, Enter keeps Resend's shared sender.email-test, and the file is already written by then.Closes #130
🤖 Generated with Claude Code