fix(ai-tools): honor defaultAI config in termly start - #63
Open
kozliatko wants to merge 1 commit into
Open
Conversation
`defaultAI` was a write-only config key. `termly setup` and `termly config set defaultAI <tool>` stored it and `termly config` printed it back, but `getDefaultAI()` had no call sites, so the value never influenced tool selection. Users who configured a default still got the interactive "Multiple AI tools detected" prompt on every start. selectAITool() now consults it between the --ai flag and auto-detection: --ai flag -> defaultAI config -> --no-auto-detect error -> auto-detect Unlike --ai, defaultAI is a stored preference that may be months old, so a stale value must not break `termly start`. If the configured tool is unknown or no longer installed, Termly warns and falls back to auto-detection rather than exiting.
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.
Problem
defaultAIis currently a write-only config key.Three code paths write it, none read it:
lib/config/manager.js:7lib/commands/setup.js:30termly setupstores the answerlib/commands/config.jstermly config set defaultAI <tool>stores it,termly configprints itlib/config/manager.js:44getDefaultAI()— exported, zero call sitesgrep -rn "getDefaultAI" lib/onmainreturns only the definition and the export.The user-visible effect: someone runs
termly setup, answers "Default AI tool: claude-code", seesDefault AI: claude-codeintermly config— and still gets the interactiveMultiple AI tools detected: Which tool would you like to use?prompt on every singletermly start. The setting silently does nothing.Fix
selectAITool()now consults the config between the--aiflag and auto-detection:--aistill wins, so nothing changes for explicit invocations.Stale values are non-fatal
Unlike
--ai,defaultAIis a stored preference that may have been set months ago. Routing it straight throughselectManualTool()would have madetermly startexit 1 the day a user uninstalls or renames their configured tool.So
selectConfiguredDefault()warns and returnsnull, letting the caller fall back to auto-detection:Behavior change
Users who already have
defaultAIset — possibly without realizing, since it never did anything — will stop seeing the tool-selection prompt. That is the behavior the setting always advertised, but it is a change worth calling out in release notes.Verification
All four paths exercised against a stubbed
getDefaultAI():--ai claude-code+defaultAI=democlaude-code— flag winsdefaultAI=demo(installed)Using Demo Mode (configured default)defaultAI=nonexistent-xyzdefaultAI=aider(not installed)defaultAI=''Scope:
lib/ai-tools/selector.js(+41) and a README note (+4). No dependency, protocol, or config-schema changes.