diff --git a/src/docs/settings.md b/src/docs/settings.md index 7c6695e..ce4ee1a 100644 --- a/src/docs/settings.md +++ b/src/docs/settings.md @@ -400,19 +400,19 @@ Two buttons here — **Export as CSV…** and **Export as JSON…**. CSV is one ## CLI tools -Select Claude Code, Codex CLI, OpenCode or GitHub Copilot CLI to edit that tool's defaults and flags. The same native launch controls are available in the per-tool launch profile editor under **Sessions**. **Save** applies defaults to future sessions; running sessions keep their launch settings. Use **Manage CLI tools…** for version checks and updates. +Pick the **Default tool**, then choose a tab under **Launch defaults** (Claude Code, Codex CLI, GitHub Copilot CLI or OpenCode) to edit that tool's defaults and flags. The tab of the default tool is marked **default**. The same native launch controls are available in the per-tool launch profile editor under **Sessions**. **Save** applies defaults to future sessions; running sessions keep their launch settings. Use **Manage CLI tools…** for version checks and updates. ### Default CLI tool -The CLI tool preselected when you open the New Session dialog. Pick Claude Code, Codex CLI, GitHub Copilot CLI, OpenCode, or Custom. Custom also stores the binary name/path to prefill in the session form. +**Default tool** is the CLI preselected when you open the New Session dialog. Pick Claude Code, Codex CLI, GitHub Copilot CLI, OpenCode, or Custom. Custom also stores the binary name/path to prefill in the session form. ### Default CLI flags (per tool) -Default command-line flags appended whenever a session of that CLI tool is launched. Separate presets are available for Claude Code, Codex CLI, GitHub Copilot CLI, and OpenCode. Use **Add Flag** for additional flags for the selected tool. Custom binaries accept flags in the New Session dialog; they do not have a preset tab here. Multi-token entries like `--permission-mode plan` are split on whitespace. Entries in `--flag=value` form are kept together. This is not a shell-style quoted-argument parser. +**Launch defaults** are command-line flags appended whenever a session of that CLI tool is launched. Separate presets are available for Claude Code, Codex CLI, GitHub Copilot CLI, and OpenCode. Tick **Common flags**, or type any other flag under **Other flags** and choose **Add flag**. A flag set through a guided field, such as Claude's model, is shown in that field only. Custom binaries accept flags in the New Session dialog; they do not have a preset tab here. Multi-token entries like `--permission-mode plan` are split on whitespace. Entries in `--flag=value` form are kept together. This is not a shell-style quoted-argument parser. ### Claude Code and OpenCode -Claude has a guided model field; OpenCode has model (`provider/model`) and agent fields. Enter identifiers supported by the installed CLI, or clear a field to use the CLI's own configuration. Controls update the corresponding native flags and preserve unrelated flags. Incomplete or combined manual presets must be resolved in **Default CLI Flags** before guided edits can apply. Tether does not edit these tools' native configuration or request account information. Claude status hooks are controlled under **Sessions → Advanced session options**; usage for every supported CLI remains under **Usage**. +Claude has a guided model field; OpenCode has model (`provider/model`) and agent fields. Enter identifiers supported by the installed CLI, or clear a field to use the CLI's own configuration. Controls update the corresponding native flags and preserve unrelated flags. Incomplete or combined manual presets must be resolved under **Other flags** before guided edits can apply. Tether does not edit these tools' native configuration or request account information. Claude status hooks are controlled under **Sessions → Advanced session options**; usage for every supported CLI remains under **Usage**. ### Codex diff --git a/src/renderer/components/SettingsDialog.test.ts b/src/renderer/components/SettingsDialog.test.ts index 7674c58..09c82fc 100644 --- a/src/renderer/components/SettingsDialog.test.ts +++ b/src/renderer/components/SettingsDialog.test.ts @@ -34,6 +34,23 @@ describe('CLI settings navigation and persistence', () => { onKeybindingChange: vi.fn(), onKeybindingsResetAll: vi.fn(), onOpenCliMaintenance: vi.fn() })); expect(view.container.querySelector('[role="tab"][aria-selected="true"]')?.textContent).toBe('CLI tools'); expect(view.container.textContent).toContain('Default Claude Code launch'); + // The tab of the default tool is marked, and a flag the guided field owns is not repeated as a chip. + expect(button(view.container, 'Claude Code').dataset.default).toBe('true'); + expect(button(view.container, 'OpenCode').dataset.default).toBeUndefined(); + const chips = () => [...view.container.querySelectorAll('.cli-flag-chips code')].map(code => code.textContent); + expect(chips()).toEqual([]); + const claudeModel = view.container.querySelector('.codex-settings-launch input')!; + await change(claudeModel, 'opus'); + await act(async () => claudeModel.dispatchEvent(new FocusEvent('focusout', { bubbles: true }))); + expect(chips()).toEqual([]); + const custom = view.container.querySelector('[aria-label="Custom Claude Code flag"]')!; + expect(button(view.container, 'Add flag').disabled).toBe(true); + await change(custom, '--add-dir ../shared'); + await click(button(view.container, 'Add flag')); + expect(chips()).toEqual(['--add-dir ../shared']); + await click(view.container.querySelector('[aria-label="Remove --add-dir ../shared"]')!); + await change(claudeModel, ''); + await act(async () => claudeModel.dispatchEvent(new FocusEvent('focusout', { bubbles: true }))); await click(button(view.container, 'OpenCode')); const model = view.container.querySelector('.codex-settings-launch input')!; await change(model, 'provider/model'); diff --git a/src/renderer/components/SettingsDialog.tsx b/src/renderer/components/SettingsDialog.tsx index 3f2449e..9f12539 100644 --- a/src/renderer/components/SettingsDialog.tsx +++ b/src/renderer/components/SettingsDialog.tsx @@ -13,7 +13,7 @@ import { suggestVaultPath, VAULT_REF_PREFIX } from '../utils/vault-path'; const isVaultRef = (v: string): boolean => v.startsWith(VAULT_REF_PREFIX); import type { GitProviderInfo, GitProviderType, LaunchProfileInfo, VaultConfig, VaultStatus, CliToolId, KnownHostInfo, UsageExportFormat, NotificationPrefs, JobsStatus, JobsSettings, SessionInfo } from '../../shared/types'; import { DEFAULT_NOTIFICATION_PREFS } from '../../shared/types'; -import { CLI_TOOL_REGISTRY } from '../../shared/cli-tools'; +import { CLI_TOOL_REGISTRY, readCliLaunchOption } from '../../shared/cli-tools'; import { KeybindingsEditor } from './KeybindingsEditor'; import { PipSettingsSection, type PipSettingsControl } from './PipSettingsSection'; import { HelpAnchor } from './HelpAnchor'; @@ -648,7 +648,10 @@ export function SettingsDialog({ isOpen, initialSection, onClose, currentTheme, const toolDef = CLI_TOOL_REGISTRY[flagTool]; const commonFlags = toolDef?.commonFlags || []; const commonFlagSet = new Set(commonFlags.map(f => f.flag)); - const extraFlags = currentToolFlags.filter(f => !commonFlagSet.has(f)); + // A flag the guided fields own (for example `--model opus`) is edited there, not listed again as a chip. + const guidedOptions = toolDef?.launchOptions ?? []; + const extraFlags = currentToolFlags.filter(f => !commonFlagSet.has(f) + && !guidedOptions.some(option => readCliLaunchOption([f], option) !== '')); return (
@@ -1267,18 +1270,10 @@ export function SettingsDialog({ isOpen, initialSection, onClose, currentTheme, {activeSection === 'cli-tools' && matchingSections.length > 0 && ( <> - {onOpenCliMaintenance &&
-
CLI updates
-

Check versions and update Codex, Claude Code, or OpenCode on your local machine, an SSH host, or a Coder workspace.

- -
} -
-