Skip to content

Add thirdshift setup: write the defaults User config with no terminal - #135

Merged
JacobStephens2 merged 5 commits into
mainfrom
issue-127
Sep 29, 2026
Merged

JacobStephens2 merged 5 commits into
mainfrom
issue-127

Conversation

@JacobStephens2

Copy link
Copy Markdown
Owner

Summary

A new command, thirdshift setup. This PR adds only its no-terminal form: with no User config, it writes ~/.thirdshift/config.toml with every setting at its default and asks no questions.

 main
   args::parse
+    "setup"          → Command::Setup      # an argument after it → exit 2
+    "setup" <extra>  → argument error
+  Command::Setup → config::setup()
+    User config exists → parse it as a Run would (exit 1 if broken), keep it
+    none               → write DEFAULTS, "wrote the User config <path>" on stderr

The file it writes (the README's User config section now shows it too):

[merge]
always = false   # every Run is a Merge run, without the merge word; default false

[launch]
pull = false     # every Run first fast-forwards your checkout of the Base branch; default false

[email]
always = false                  # every Run sends a Run notification, without the email word; default false
# to = "you@example.com"        # where email goes when the command names no address; no default
from = "onboarding@resend.dev"  # the sender; default onboarding@resend.dev, which only delivers to your Resend account's address

[logs]
dir = "~/.thirdshift/logs"   # where session logs go; default ~/.thirdshift/logs

help now lists thirdshift setup.

Evidence

  • Before: thirdshift setup was read as an Issue URL and failed with an argument error.
    After: tests/setup.rs has 7 tests, all passing. They run the binary through the piped Scenario harness and check:
    • the file is written, exit 0, stdout empty
    • every key has a comment giving its default, and only email.to is commented out
    • a Run on the written file behaves as with no User config: ready for review, logs in ~/.thirdshift/logs
    • --email still stops for want of email.to
    • setup extra exits 2 with the help text and writes nothing
    • an existing User config keeps its values and comments
    • a broken one is refused and left untouched
  • A unit test checks that DEFAULTS parses to the same UserConfig a Run uses with no file.
  • The full cargo test suite passes, and clippy is clean.

Merge Danger

Door: two-way

It adds a command and writes a file only when asked to. Nothing changes for Runs.

Blast Radius: minimal

Only people who run thirdshift setup are affected.

Unaddressed findings

Standards

  • Duplicated Code / Shotgun Surgery: the default values appear in DEFAULTS, UserConfig::defaults, email::DEFAULT_FROM, the README and the help text. The spec requires the README to show the file, and a unit test ties DEFAULTS to UserConfig::defaults. The README copy is documentation, not code.
  • Duplicated Code: setup() repeats load()'s "read, else NotFound" shape. It is two short matches whose arms differ, and a shared helper wouldn't make either clearer.
  • email.from written out explicitly pins onboarding@resend.dev. The spec requires it ("email.from = "onboarding@resend.dev"", and real values wherever there is a default).
  • "Setup with no terminal" doc comment is speculative: the interactive form is planned in thirdshift setup #126, so the comment names the case this slice covers.
  • DEFAULT_FROM is pub rather than pub(crate): this is a binary crate, and the rest of the codebase uses pub.
  • AGENT_OPENS_PR/PR_URL are copied into tests/setup.rs: this matches the existing practice in five other test files. Moving them into tests/support belongs in its own change.
  • Squash the interrupted-run WIP commit: I left the history as it is, since the branch had to build on that commit rather than rewrite it.

Spec

  • No terminal check: setup writes the defaults even from a terminal. The questions don't exist yet, so a terminal check would have nothing to branch to. It belongs to the thirdshift setup #126 slice that adds the questions.
  • Existing User config handling is beyond Setup: thirdshift setup writes the defaults User config with no terminal #127: I kept it because it follows thirdshift setup #126 stories 32 and 34, and it never overwrites a user's file. It keeps values and refuses a broken file, and its test and README now say "keeps its values" rather than "left as it is", so the next slice can add missing keys without reversing anything.

Closes #127

🤖 Generated with Claude Code

JacobStephens2 and others added 5 commits September 29, 2026 22:18
2026-09-29T22:18:13Z, host tracewake. Uncommitted work at the time of failure is included in this commit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2
JacobStephens2 merged commit 5bf0dd0 into main Sep 29, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-127 branch September 29, 2026 22:39
@JacobStephens2 JacobStephens2 mentioned this pull request Sep 30, 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.

Setup: thirdshift setup writes the defaults User config with no terminal

1 participant