Repository navigation
Add codesmith bridge init, and auth login --home/--to-file - #22
Merged
Merged
Conversation
codesmith_core::home names the folders a run with HOME=DIR uses (no XDG or CODESMITH_CONFIG_DIR, as under a tailbus bridge), resolves a --home folder (it must exist and can't be your own home), and writes a key or token to a file of its own: 0600, O_NOFOLLOW, in an owner-only folder, never through a symlink, replaced only when asked. config::load_home reads that home's global config alone, never a project's.
A bridge's run with no key said to run `HOME=DIR codesmith auth login`, which also moves the config and everything else that command reads. It now names `codesmith auth login PROVIDER --home DIR` (shell-quoted) and points at `codesmith bridge init`.
…re from /login codesmith bridge init NAME asks in the terminal how a tailbus bridge runs (headless or a relay to a shared session), then for a headless one where it works, a provider (untested ones tagged), a sign-in made for the bridge (a key pasted or taken from a named environment variable, a Claude Code token, or the provider's OAuth into the bridge home), a model, and an effort from that model's own levels. It writes the bridge's folder and a 0600 key file, tries the bridge exactly as tailbus runs it (cleared environment, secrets read from their files, message on stdin, output redacted), prints the [bridges.NAME] table, and only after a yes appends it to tailbus's config and runs tailbus bridge install. A bridge already in the config, a symlinked config or one that isn't valid TOML is left alone; without a terminal nothing is written. codesmith auth login --home DIR saves a login in another home's auth store, reading that home's config; --to-file PATH writes a key or Claude Code token to a file of its own and prints the secrets line. Logins that rest on your own home's files aren't offered for either. The sign-in picker, in /login and in auth login, ends with "For a bridge or another home", which runs bridge init, --home or --to-file (from the UI, handing over the terminal). /bus share points at bridge init.
docs/tailbus.md now leads with codesmith bridge init, with the hand-made tables kept as the manual route; cli.md, bus.md, getting-started.md, interactive-ui.md and the CHANGELOG cover the new command, auth login --home and --to-file, and the picker's new row.
The refusals (your own home, a missing folder, an existing or symlinked file, flags --to-file can't take) exit before reading the key, so writing it could hit a closed pipe and fail the test now and then.
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.
Setting up a tailbus bridge for CodeSmith meant hand-assembling a bridge home, a key file and a
[bridges.NAME]table. This adds a guided flow and the sign-in pieces it needs.What's new
codesmith bridge init NAME:O_NOFOLLOW, never through a symlink).[bridges.NAME]table.tailbus bridge install./, and when the bridge already exists.codesmith auth login PROVIDER --home DIRsaves a login into another home.--to-file PATHwrites a key or Claude Code token to a 0600 file and prints thesecretsline./loginand theauth loginpicker./bus sharepoints atbridge init, and a run with no key suggestsauth login --home.docs/tailbus.mdleads withbridge init; the hand-made route stays under "By hand".Choices to review
provider/model#high), because tailbus has no per-bridge default effort.toml_edit 0.25, already in the lockfile.Tests
About 60 new tests, including 17 PTY-driven e2e tests in
tests/e2e/bridge.rs. They cover modes, symlink refusal, declining, an existing table, no tailbus, no terminal, and a project config trying to steer secrets. Every test checks that no secret reaches the output.Not done