Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 17 additions & 0 deletions src/renderer/components/SettingsDialog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLInputElement>('.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<HTMLInputElement>('[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<HTMLButtonElement>('[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<HTMLInputElement>('.codex-settings-launch input')!;
await change(model, 'provider/model');
Expand Down
96 changes: 56 additions & 40 deletions src/renderer/components/SettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 (
<div className="dialog-overlay">
Expand Down Expand Up @@ -1267,18 +1270,10 @@ export function SettingsDialog({ isOpen, initialSection, onClose, currentTheme,
{activeSection === 'cli-tools' && matchingSections.length > 0 && (
<>
<SectionHeader section="cli-tools" />
{onOpenCliMaintenance && <div className="form-group">
<div className="form-label">CLI updates</div>
<p className="form-hint">Check versions and update Codex, Claude Code, or OpenCode on your local machine, an SSH host, or a Coder workspace.</p>
<button className="form-btn" onClick={onOpenCliMaintenance}>Manage CLI tools…</button>
</div>}
<div className="form-group" style={{ marginTop: 20 }}>
<label className="form-label" htmlFor={`${settingsId}-default-cli-tool`} style={{ fontSize: 14, marginBottom: 8 }}>
Default CLI Tool
<div className="form-group">
<label className="form-label settings-subheading" htmlFor={`${settingsId}-default-cli-tool`}>
Default tool
</label>
<p className="form-hint" style={{ marginBottom: 8 }}>
Preselected when you open the New Session dialog. You can still change it per session.
</p>
<select
id={`${settingsId}-default-cli-tool`}
className="form-input"
Expand All @@ -1300,30 +1295,34 @@ export function SettingsDialog({ isOpen, initialSection, onClose, currentTheme,
style={{ marginTop: 8 }}
/>
)}
<p className="form-hint">
Preselected when you open the New Session dialog. You can still change it per session.
</p>
</div>

<div className="form-group" style={{ marginTop: 20 }}>
<div className="form-label" style={{ fontSize: 14, marginBottom: 8 }}>
Default CLI Flags
</div>
<p className="form-hint" style={{ marginBottom: 8 }}>
Applied to sessions using the selected CLI tool.
<div className="form-group cli-tool-defaults">
<div className="form-label settings-subheading">Launch defaults</div>
<p className="form-hint">
Added to every new session of the selected tool. Launch profiles and individual sessions can add their own on top.
</p>

<div style={{ display: 'flex', flexWrap: 'wrap', gap: 4, marginBottom: 10 }}>
<div className="cli-tool-tabs">
{FLAG_TOOLS.map(id => (
<button
key={id}
className={`form-btn${flagTool === id ? ' form-btn--primary' : ''}`}
style={{ fontSize: 12, padding: '3px 10px' }}
type="button"
className={`cli-tool-tab${flagTool === id ? ' cli-tool-tab--active' : ''}`}
aria-pressed={flagTool === id}
data-default={defaultCliTool === id || undefined}
title={defaultCliTool === id ? `${CLI_TOOL_REGISTRY[id].displayName} is the default tool` : undefined}
onClick={() => { setFlagTool(id); setCustomFlag(''); }}
>
{CLI_TOOL_REGISTRY[id].displayName}
</button>
))}
</div>

<div className="cli-tool-panel">
<CliLaunchControls
key={flagTool}
tool={flagTool}
Expand All @@ -1333,44 +1332,51 @@ export function SettingsDialog({ isOpen, initialSection, onClose, currentTheme,
/>
{loaded && (
<>
{commonFlags.length > 0 ? commonFlags.map(({ flag, label }) => (
<label key={flag} className="form-radio-label" style={{ marginBottom: 4 }}>
<input
type="checkbox"
checked={currentToolFlags.includes(flag)}
onChange={() => toggleFlag(flag)}
/>
<code className="cli-flag-code">{flag}</code>
<span className="form-hint" style={{ display: 'inline', marginLeft: 6 }}>{label}</span>
</label>
)) : (
<p className="form-hint" style={{ marginBottom: 8 }}>No common flags defined for {toolDef?.displayName || flagTool}.</p>
<div className="form-label">Common flags</div>
{commonFlags.length > 0 ? (
<div className="cli-flag-list">
{commonFlags.map(({ flag, label }) => (
<label key={flag} className="cli-flag-option">
<input
type="checkbox"
checked={currentToolFlags.includes(flag)}
onChange={() => toggleFlag(flag)}
/>
<code className="cli-flag-code">{flag}</code>
<span className="cli-flag-option-label">{label}</span>
</label>
))}
</div>
) : (
<p className="form-hint">No common flags defined for {toolDef?.displayName || flagTool}.</p>
)}

<div className="form-label" style={{ marginTop: 14 }}>Other flags</div>
{extraFlags.length > 0 && (
<div style={{ marginTop: 8 }}>
<div className="cli-flag-chips">
{extraFlags.map(flag => (
<div key={flag} className="cli-flag-custom">
<code className="cli-flag-code">{flag}</code>
<button className="env-editor-btn env-editor-btn--remove" onClick={() => removeFlag(flag)}>&times;</button>
<button type="button" className="env-editor-btn env-editor-btn--remove" aria-label={`Remove ${flag}`} onClick={() => removeFlag(flag)}>&times;</button>
</div>
))}
</div>
)}

<div className="form-row" style={{ marginTop: 8 }}>
<div className="form-row">
<input
className="form-input"
aria-label={`Custom ${toolDef?.displayName || flagTool} flag`}
value={customFlag}
onChange={e => setCustomFlag(e.target.value)}
placeholder="--custom-flag"
placeholder="--flag or --flag value"
spellCheck={false}
onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); addCustomFlag(); } }}
/>
<button className="form-btn" onClick={addCustomFlag}>Add Flag</button>
<button type="button" className="form-btn" disabled={!customFlag.trim()} onClick={addCustomFlag}>Add flag</button>
</div>
</>
)}
</div>
</div>

{flagTool === 'codex' && (
Expand All @@ -1388,6 +1394,16 @@ export function SettingsDialog({ isOpen, initialSection, onClose, currentTheme,
sessions={sessions}
/>
)}

{onOpenCliMaintenance && (
<div className="form-group cli-tool-updates">
<div>
<div className="form-label settings-subheading">Versions and updates</div>
<p className="form-hint">Check versions and update Codex, Claude Code, or OpenCode on your local machine, an SSH host, or a Coder workspace.</p>
</div>
<button type="button" className="form-btn" onClick={onOpenCliMaintenance}>Manage CLI tools…</button>
</div>
)}
</>
)}

Expand Down
19 changes: 19 additions & 0 deletions src/renderer/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -2067,6 +2067,25 @@ summary.form-label, .settings-advanced > summary {
}
summary.form-label::marker, .settings-advanced > summary::marker { color: var(--accent); }
.settings-advanced { border-top: 1px solid var(--border-color); margin-top: var(--space-5); }
.settings-subheading { font-size: 14px; color: var(--text-primary); margin-bottom: 8px; }
.cli-tool-defaults { margin-top: var(--space-5); }
.cli-tool-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 10px; border-bottom: 1px solid var(--border-color); }
.cli-tool-tab { position: relative; padding: 7px 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--text-secondary); font: inherit; font-size: var(--text-sm); cursor: pointer; border-radius: var(--control-radius) var(--control-radius) 0 0; }
.cli-tool-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.cli-tool-tab--active { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }
.cli-tool-tab[data-default]::after { content: 'default'; margin-left: 6px; padding: 1px 5px; border: 1px solid var(--border-color); border-radius: 999px; color: var(--text-muted); font-size: var(--text-2xs); font-weight: 500; }
.cli-tool-panel { padding: 14px 0 0; }
.cli-tool-panel .codex-settings-launch { margin-bottom: 14px; }
.cli-flag-list { display: grid; gap: 2px; }
.cli-flag-option { display: flex; align-items: center; gap: 8px; padding: 4px 6px; margin: 0 -6px; border-radius: var(--control-radius); cursor: pointer; }
.cli-flag-option:hover { background: var(--bg-hover); }
.cli-flag-option input { accent-color: var(--accent); flex: none; }
.cli-flag-option-label { color: var(--text-secondary); font-size: var(--text-sm); }
.cli-flag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cli-flag-chips .cli-flag-custom { margin: 0; }
.cli-tool-updates { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border-color); }
.cli-tool-updates .form-hint { margin-bottom: 0; }
.cli-tool-updates .form-btn { flex: none; }
.pip-settings-limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); margin-top: 12px; }
.pip-settings-status { display: block; }
.pip-settings-status:empty { display: none; }
Expand Down
Loading