Conversation
|
Latest downloadable build artifacts for this PR commit
Available artifact names
|
|
Not really sure how to test this but there is definitely a lack of tests. |
|
bt auth profiles does nothing |
… into cedric/better-dx
7448035 to
73568b4
Compare
…have to manually create one
…update the .bt/config.json file and always update the file
Welcome message and project selection Thanks abhi
Asking to use auto instrumentation
70ae3ba to
d56b32a
Compare
not mentionning unsued languages when --language is passed or a language is detected
repeating url formatting information
example echo 'bt setup' | sh
08f9657 to
7c4ba61
Compare
b71e9ae to
8566ae9
Compare
There was a problem hiding this comment.
Ideally we can split this file up a bit, getting unwieldy to review
Abhijeet Prasad (AbhiPrasad)
left a comment
There was a problem hiding this comment.
could we maybe split this PR up so the changes are a bit easier to review and land? Let me know if you need advice on how that should be. Claude told me this:
Based on the diff, here's how I'd split it into 4-5 independent PRs that can land in order:
PR 1: Flag restructuring + deprecation
The mechanical rename/removal of CLI flags. Smallest blast radius, easiest to review.
--quiet→--verbose(invert default)--agents(repeatable) →--agent(single), removeAgentArg::All--no-mcp-skill→--no-skills+--no-mcp- Add
--no-instrument,--tui/--background,--no-workflow - Remove
--no-input, move--yesto#[arg(skip)] set_quiet(true)as global default- All the
BaseArgsfield renames (quiet→verbose) and test fixups - Consider adding hidden deprecation aliases so existing scripts don't break
PR 2: TTY fallback + agent detection
Self-contained infra changes that the wizard depends on.
tty_term()function insrc/ui/select.rs(/dev/ttyfallback)fuzzy_selectusinginteract_on(&term)detect_runnable_agents()(PATH-only check)detect_agentssimplification (drop config-dir heuristics)resolve_unambiguous_instrument_agent/dev/ttystdin fallback inrun_agent_invocationfor interactive mode
PR 3: Auth + API key creation
The OAuth-related changes, isolated from the wizard.
ensure_authrewrite (credential recovery flow,is_missing_credential_error)maybe_create_api_key_for_oauth(auto-create key, print-once)login_interactive_oauthmadepub(crate)#[allow(dead_code)]onlogin_interactive_api_key(or just remove it)- Remove
login_interactive(the old method-chooser) - Auth output tweaks (warning→info, spacing)
PR 4: MCP key embedding
Depends on PR 3 (needs the API key to embed).
merge_mcp_configtakesapi_key+mcp_urlparamsinstall_mcp_for_claude_user(usesclaude mcp add -s user)mcp_url_from_api_urlhelperrun_mcp_setupbecomesasync(needs auth resolution)- Updated tests for
merge_mcp_config/install_mcp_for_agent
PR 5: Wizard UX + template changes
The big UX PR, but now much smaller because infra landed in PRs 1-4.
--interactive/-iflag and wizard flow- ASCII logo + welcome banner
select_projectwith auto-create{whoami}-testand+ Create new project- Consolidate with
select_project_interactive(deduplicate) prompt_instrument_language_selection,prompt_instrument_workflow_selectionin wizard- Agent invocation rework (Claude
--permission-mode/--settings, Codex/Cursor TUI vs background split) instrument-task.mdandbraintrust-url-formats.mdtemplate changesLanguageArg::doc_filename()render_instrument_taskrework- SSE
strip_prefixcleanup (could also go in PR 1)
Dependency order: PR 1 → PR 2 → PR 3 → PR 4 → PR 5 (though 2 and 3 are independent of each other and could land in parallel).
The biggest win is separating the flag restructuring (PR 1) from the wizard logic (PR 5) — those are the two hardest things to review when interleaved.
…h agents are available
added (and forgot to commit) a small test file to check if bt setup --no-instrument would complete without any prompt with the correct env variables. After re-reading it it's probably better to add it in a future PR.
| pub fn set_no_input(val: bool) { | ||
| NO_INPUT.store(val, Ordering::Relaxed); | ||
| } | ||
|
|
There was a problem hiding this comment.
I don't know if we should remove this. there should be an explicit wait for users to tell the cli that the current session is not interactive/to not require user input
| #[arg(long, global = true)] | ||
| pub prefer_profile: bool, | ||
|
|
||
| /// Disable all interactive prompts |
There was a problem hiding this comment.
see other comment. i don't think we should remove this, but it's possible I'm missing something.
bt setupasks 0 and 2 questions: project and coding agent (and needs authentication)org choice:
if --api-key is passed, use the provided api key
else if --prefer-profile, use the already registered profile (probably registered with OAuth previously)
else if the user has an api key in the env (variable BRAINTRUST_API_KEY), use it
else if there is already a registered profile, use it. If a profile is registered but the access token isn't accessible (for example storing the access token in plain text in ~/.config/bt/secrets.json but the file was deleted), just force re authentication
else same behavior as a user picking OAuth: give a url to paste in the browser
project choice:
if -p/--project is passed, use the specified project. If the project does not exist, stop the setup.
else if BRAINTRUST_DEFAULT_PROJECT exist in the env, same as for -p/--project
else the user has exactly one project, the default 'My Project' projects. Create a project in the user's organization named '{whoami}-test' where {whoami} is the result of the whoami command and use this project
else prompt the user to choose the project to use (creating a project is possible so the user isn't locked even with 0 projects)
skills, mcp, local, global:
by default, choose skills, no mcp and global scope
--no-skill, --no-mcp unselect skill/mcp
--local selects local instead of global
--no-mcp/skills don't remove pre-existing mcp/skills.
instrument:
by default, instrument
--(no-)instrument (un)select instrumentation
--no-instrument still configures mcp and skills, the only difference is that the agent isn't launched
agent:
if --agent AGENT flag is passed, use the specified agent
else if only one exists in [claude code, codex, cursor, opencode] (ie only one exist in PATH), use it
otherwise, prompt the user
If AGENT does not exist in PATH, try to launch it anyway.
Opencode support for starting with a prompt is lackluster as it can only start in the background.
workflow docs:
if one or multiple --workflow WORKFLOW flags are passed, fetch these workflows
otherwise, fetch all workflows
language:
try to identify the language based on file like pyproject.toml in the project root/sub folders (in current folder and subfolder with depth 1)
if nothing is found, alter the start prompt of the agent to find which language to instrument
conflicts with --no-instrument as the choice of language is only relevant if the agent is launched
TUI/background:
TUI by default
if --background is passed, launch the agent in the background
--tui exist only to conflict with --background (and --no-instrument)
Highly recommended to use --background with --yolo, as the agent won't be able to ask the user to allow it to run commands (and fail on step 1, checking if BRAINTRUST_API_KEY is in the env)
yolo mode
self explanatory for claude, codex, cursor
opencode is in yolo mode by default for the directory it is launched in
Besides, --yolo or equivalent don't exist in opencode yet (don't trust your LLM about this, there are many closed/merged/open PRs about this but just check
opencode -hand you'll see it's not there).interactive mode
-i/--interactive
Prompt the user to choose the configuration instead of passing options. Does not ask questions which are already answered by options or env variables.
Bugs
--json is very buggy
workflows and scope broken
Untested/poorly tested:
env variables
no-color, api/app-url, env-file, no-fetch-docs, refresh-docs, workers
TODO
Better help message in the interactive wizard
better json objects, they are not consistent
only make the available agents selectable when multiple are on PATH, print the other ones but in grey or something
if in a folder, don't look at the parent folder when detecting language (both prompt and auto detect)