Skip to content

Move installer configuration into code-trace setup - #14

Merged
winjer merged 1 commit into
mainfrom
move-installer-logic-into-setup
Jul 20, 2026
Merged

Move installer configuration into code-trace setup#14
winjer merged 1 commit into
mainfrom
move-installer-logic-into-setup

Conversation

@winjer

@winjer winjer commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Collapses #11 + #12 + #13 into a single PR against main. Shrinks install.sh from 365 → 173 lines by moving every configuration step out of the shell and into the binary as code-trace setup, where it's written in Rust, unit-tested, and needs no interpreter.

What moved into the binary

Step Before After
Claude Code hook registration embedded python3 JSON program setup --register-hook (serde_json)
Config file + email prompt bash + read setup --write-config
OpenCode/Pi plugin install bash copy from checkout (skipped under curl | bash) setup --install-* / --offer-*, sources embedded via include_str!
  • Drops the python3 dependency — the installer needs no interpreter.
  • Plugin install now works under curl | bash — the old shell path silently skipped it (no local checkout to copy from).
  • The prompt-bug class can't recur. All prompts run in the binary reading /dev/tty in-process, so they can never consume the piped curl | bash script the way a shell read from stdin did (the bug fixed in the earlier /dev/tty PRs).
  • install.sh is now a bootstrap: detect platform, download binary, set PATH, hand off to code-trace setup. The TTY_IN/resolve_tty_in machinery, agent detection, plugin-source resolution, and copy helpers are gone.

Testing

  • 29 setup unit 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-based tests/install_hook_test.sh is replaced.
  • cargo test (108 lib + 16 integration) and cargo clippy --all-targets clean.
  • Verified end to end through a piped curl | bash simulation (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.json keys 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

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
winjer force-pushed the move-installer-logic-into-setup branch from c4cf321 to 6721363 Compare July 20, 2026 15:46
@winjer
winjer merged commit 4b2fc69 into main Jul 20, 2026
2 checks passed
@winjer
winjer deleted the move-installer-logic-into-setup branch July 20, 2026 15:48
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.

1 participant