Move config-file creation and email prompt into code-trace setup - #12
Closed
winjer wants to merge 1 commit into
Closed
Move config-file creation and email prompt into code-trace setup#12winjer wants to merge 1 commit into
code-trace setup#12winjer wants to merge 1 commit into
Conversation
Second slice of shrinking install.sh: config-file creation and the Langfuse user-id email prompt move from install.sh into the binary as `code-trace setup --write-config`. - src/setup.rs: pure, unit-tested helpers — config_has_user_id (reuses the runtime config parser so a commented placeholder does not count), decide_write, fresh_config, with_appended_user_id (inserts a missing trailing newline so a hand-edited file is never concatenated) — plus a write_config IO layer and terminal prompt. Flags: --write-config, --config-file, --user-email, --no-prompt. - Because the prompt now runs in the binary (a separate process reading /dev/tty), it can no longer consume the piped curl | bash script — the class of stdin-consumption bug fixed in #9/#10 is gone by construction. - install.sh create_config shrinks to a `setup --write-config` call plus the closing message. The OpenCode/Pi prompts stay in bash for now, so TTY_IN/resolve_tty_in remain. - Tests: 10 new unit tests on the pure helpers + 5 integration tests driving the real binary (fresh+email, fresh placeholder, append, already-configured left untouched, existing no-op). Verified end to end through a piped curl | bash simulation with OpenCode present: the binary prompts for and writes the email correctly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 20, 2026
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.
Stacked on #11 (base is the #11 branch). Merge #11 first; GitHub will then retarget this to
main.Second slice of the installer-slimming direction: config-file creation and the Langfuse user-id email prompt move out of
install.shinto the binary ascode-trace setup --write-config.What changed
src/setup.rs— pure, unit-tested helpers:config_has_user_id— reuses the runtime config parser (config::parse_config_str), so a commented# LANGFUSE_USER_ID=…placeholder correctly does not count as configured.decide_write/fresh_config/with_appended_user_id— the latter inserts a missing trailing newline so a hand-edited config is never concatenated (fixes the latent nit flagged back in Attach optional LANGFUSE_USER_ID to traces #8).write_configIO layer + terminal prompt. New flags:--write-config,--config-file,--user-email,--no-prompt./dev/tty, it can no longer consume the pipedcurl | bashscript — the whole class of stdin-consumption bug we fixed in Read installer email prompt from /dev/tty so piped installs ask #9/Route OpenCode/Pi install prompts through /dev/tty too #10 is gone by construction.install.sh—create_configshrinks to asetup --write-configcall plus the closing message. The OpenCode/Pi prompts remain in bash for now (next slice), soTTY_IN/resolve_tty_instay.Verification
cargo test(103 lib incl. 24 setup + 12 integration) andcargo clippy --all-targetsclean.curl | bashsimulation with OpenCode installed (real pipe for stdin, pty for/dev/tty): the binary prompts for and writes the email — the exact scenario reported broken earlier.Next slice, when you want it: OpenCode/Pi plugin install (which would also let plugin install work under
curl | bash, by embedding the plugin sources in the binary — today it only works from a local checkout).🤖 Generated with Claude Code