Move installer configuration into code-trace setup - #14
Merged
Conversation
Shrink install.sh from a 365-line script (with an embedded python3 program and several interactive prompts) to a 173-line bootstrap, moving every configuration step into the binary as `code-trace setup` so it is written in Rust, unit-tested, and needs no interpreter. - Hook registration: `setup --register-hook` replaces the embedded python3 JSON program, dropping install.sh's only python3 dependency. Migrates legacy/absolute/with-args code-trace Stop hooks to the canonical command, dedups, preserves unrelated settings, and refuses to overwrite invalid JSON. - Config + email prompt: `setup --write-config` creates the config file and offers to set LANGFUSE_USER_ID from the user's email. Appends safely to a file lacking a trailing newline; leaves an already-set id untouched. - Plugin install: `setup --install-opencode|--offer-opencode| --install-pi|--offer-pi` installs the OpenCode plugin / Pi extension from sources embedded with include_str!, so it works under curl | bash — where the old shell path silently skipped (no checkout to copy from). All prompts now run in the binary, reading /dev/tty in-process, so they can no longer consume the piped curl | bash script — the class of stdin-consumption bug fixed earlier cannot recur. install.sh is now a bootstrap (detect platform, download binary, set PATH) that hands off to `code-trace setup`; the TTY_IN/resolve_tty_in machinery, agent detection, plugin-source resolution, and copy helpers are all gone. Covered by 29 setup unit tests plus 16 integration tests driving the real binary; the python-based tests/install_hook_test.sh is replaced. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
winjer
force-pushed
the
move-installer-logic-into-setup
branch
from
July 20, 2026 15:46
c4cf321 to
6721363
Compare
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.
Collapses #11 + #12 + #13 into a single PR against
main. Shrinksinstall.shfrom 365 → 173 lines by moving every configuration step out of the shell and into the binary ascode-trace setup, where it's written in Rust, unit-tested, and needs no interpreter.What moved into the binary
python3JSON programsetup --register-hook(serde_json)readsetup --write-configcurl | bash)setup --install-*/--offer-*, sources embedded viainclude_str!python3dependency — the installer needs no interpreter.curl | bash— the old shell path silently skipped it (no local checkout to copy from)./dev/ttyin-process, so they can never consume the pipedcurl | bashscript the way a shellreadfrom stdin did (the bug fixed in the earlier /dev/tty PRs).install.shis now a bootstrap: detect platform, download binary, set PATH, hand off tocode-trace setup. TheTTY_IN/resolve_tty_inmachinery, agent detection, plugin-source resolution, and copy helpers are gone.Testing
setupunit tests (pure transforms: hook JSON migration/dedup, config decisions, embedded sources, detection, path building) + 16 integration tests driving the real built binary (hook registration incl. invalid-JSON refusal; config create/append/already-set/no-op; plugin install byte-matches the embedded source; offer skips when not detected). The python-basedtests/install_hook_test.shis replaced.cargo test(108 lib + 16 integration) andcargo clippy --all-targetsclean.curl | bashsimulation (real pipe for stdin, pty for/dev/tty) with OpenCode present: hook registered, plugin offered + installed from the embedded source, email prompted and written — all in one run.Behaviour note
settings.jsonkeys are now serialized alphabetically (serde_json's default) rather than in insertion order. Cosmetic — read back as JSON, functionally identical.Supersedes #11, #12, #13.
🤖 Generated with Claude Code