mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-24 12:23:07 +00:00
Fix: Dev server detection bug fixes. Settings sync bug fixes. Cli provider fixes. Terminal background/foreground colors (#791)
* Changes from fix/dev-server-state-bug * feat: Add configurable max turns setting with user overrides. Address pr comments * fix: Update default behaviors and improve state management across server and UI * feat: Extract branch sync logic to separate service. Fix settings sync bug. Address pr comments * refactor: Extract magic numbers to named constants and improve branch tracking logic - Add DEFAULT_MAX_TURNS (1000) and MAX_ALLOWED_TURNS (2000) constants to settings-helpers - Replace hardcoded 1000 values with DEFAULT_MAX_TURNS constant throughout codebase - Improve max turns validation with explicit Number.isFinite check - Update getTrackingBranch to split on first slash instead of last for better remote parsing - Change isBranchCheckedOut return type from boolean to string|null to return worktree path - Add comments explaining skipFetch parameter in worktree creation - Fix cleanup order in AgentExecutor finally block to run before logging ``` * feat: Add comment refresh and improve model sync in PR dialog
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import {
|
||||
FlaskConical,
|
||||
TestTube,
|
||||
@@ -12,6 +14,7 @@ import {
|
||||
FastForward,
|
||||
Sparkles,
|
||||
Cpu,
|
||||
RotateCcw,
|
||||
} from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import {
|
||||
@@ -34,6 +37,7 @@ interface FeatureDefaultsSectionProps {
|
||||
defaultRequirePlanApproval: boolean;
|
||||
enableAiCommitMessages: boolean;
|
||||
defaultFeatureModel: PhaseModelEntry;
|
||||
defaultMaxTurns: number;
|
||||
onDefaultSkipTestsChange: (value: boolean) => void;
|
||||
onEnableDependencyBlockingChange: (value: boolean) => void;
|
||||
onSkipVerificationInAutoModeChange: (value: boolean) => void;
|
||||
@@ -41,6 +45,7 @@ interface FeatureDefaultsSectionProps {
|
||||
onDefaultRequirePlanApprovalChange: (value: boolean) => void;
|
||||
onEnableAiCommitMessagesChange: (value: boolean) => void;
|
||||
onDefaultFeatureModelChange: (value: PhaseModelEntry) => void;
|
||||
onDefaultMaxTurnsChange: (value: number) => void;
|
||||
}
|
||||
|
||||
export function FeatureDefaultsSection({
|
||||
@@ -51,6 +56,7 @@ export function FeatureDefaultsSection({
|
||||
defaultRequirePlanApproval,
|
||||
enableAiCommitMessages,
|
||||
defaultFeatureModel,
|
||||
defaultMaxTurns,
|
||||
onDefaultSkipTestsChange,
|
||||
onEnableDependencyBlockingChange,
|
||||
onSkipVerificationInAutoModeChange,
|
||||
@@ -58,7 +64,16 @@ export function FeatureDefaultsSection({
|
||||
onDefaultRequirePlanApprovalChange,
|
||||
onEnableAiCommitMessagesChange,
|
||||
onDefaultFeatureModelChange,
|
||||
onDefaultMaxTurnsChange,
|
||||
}: FeatureDefaultsSectionProps) {
|
||||
const [maxTurnsInput, setMaxTurnsInput] = useState(String(defaultMaxTurns));
|
||||
|
||||
// Keep the displayed input in sync if the prop changes after mount
|
||||
// (e.g. when settings are loaded asynchronously or reset from parent)
|
||||
useEffect(() => {
|
||||
setMaxTurnsInput(String(defaultMaxTurns));
|
||||
}, [defaultMaxTurns]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
@@ -104,6 +119,55 @@ export function FeatureDefaultsSection({
|
||||
{/* Separator */}
|
||||
<div className="border-t border-border/30" />
|
||||
|
||||
{/* Max Turns Setting */}
|
||||
<div className="group flex items-start space-x-3 p-3 rounded-xl hover:bg-accent/30 transition-colors duration-200 -mx-3">
|
||||
<div className="w-10 h-10 mt-0.5 rounded-xl flex items-center justify-center shrink-0 bg-orange-500/10">
|
||||
<RotateCcw className="w-5 h-5 text-orange-500" />
|
||||
</div>
|
||||
<div className="flex-1 space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label htmlFor="default-max-turns" className="text-foreground font-medium">
|
||||
Max Agent Turns
|
||||
</Label>
|
||||
<Input
|
||||
id="default-max-turns"
|
||||
type="number"
|
||||
min={1}
|
||||
max={2000}
|
||||
step={1}
|
||||
value={maxTurnsInput}
|
||||
onChange={(e) => {
|
||||
setMaxTurnsInput(e.target.value);
|
||||
}}
|
||||
onBlur={() => {
|
||||
const value = Number(maxTurnsInput);
|
||||
if (Number.isInteger(value) && value >= 1 && value <= 2000) {
|
||||
onDefaultMaxTurnsChange(value);
|
||||
} else {
|
||||
// Reset to current valid value if invalid (including decimals like "1.5")
|
||||
setMaxTurnsInput(String(defaultMaxTurns));
|
||||
}
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
(e.target as HTMLInputElement).blur();
|
||||
}
|
||||
}}
|
||||
className="w-[100px] h-8 text-right"
|
||||
data-testid="default-max-turns-input"
|
||||
/>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground/80 leading-relaxed">
|
||||
Maximum number of tool-call round-trips the AI agent can perform per feature. Higher
|
||||
values allow more complex tasks but use more API credits. Default: 1000, Range:
|
||||
1-2000. Supported by Claude and Codex providers.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Separator */}
|
||||
<div className="border-t border-border/30" />
|
||||
|
||||
{/* Planning Mode Default */}
|
||||
<div className="group flex items-start space-x-3 p-3 rounded-xl hover:bg-accent/30 transition-colors duration-200 -mx-3">
|
||||
<div
|
||||
|
||||
@@ -16,6 +16,9 @@ import {
|
||||
Terminal,
|
||||
SquarePlus,
|
||||
SplitSquareHorizontal,
|
||||
Palette,
|
||||
Type,
|
||||
X,
|
||||
} from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useAppStore } from '@/store/app-store';
|
||||
@@ -38,6 +41,8 @@ export function TerminalSection() {
|
||||
defaultTerminalId,
|
||||
setDefaultTerminalId,
|
||||
setOpenTerminalMode,
|
||||
setTerminalBackgroundColor,
|
||||
setTerminalForegroundColor,
|
||||
} = useAppStore();
|
||||
|
||||
const {
|
||||
@@ -48,6 +53,8 @@ export function TerminalSection() {
|
||||
lineHeight,
|
||||
defaultFontSize,
|
||||
openTerminalMode,
|
||||
customBackgroundColor,
|
||||
customForegroundColor,
|
||||
} = terminalState;
|
||||
|
||||
// Get available external terminals
|
||||
@@ -205,6 +212,138 @@ export function TerminalSection() {
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{/* Background Color */}
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label className="text-foreground font-medium">Background Color</Label>
|
||||
{customBackgroundColor && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-7 px-2 text-xs text-muted-foreground hover:text-foreground"
|
||||
onClick={() => {
|
||||
setTerminalBackgroundColor(null);
|
||||
toast.success('Background color reset to theme default');
|
||||
}}
|
||||
>
|
||||
<X className="w-3 h-3 mr-1" />
|
||||
Reset
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Override the terminal background color. Leave empty to use the theme default.
|
||||
</p>
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex items-center gap-2 flex-1">
|
||||
<div
|
||||
className="w-10 h-10 rounded-lg border border-border/50 shadow-sm flex items-center justify-center"
|
||||
style={{
|
||||
backgroundColor: customBackgroundColor || 'var(--card)',
|
||||
}}
|
||||
>
|
||||
<Palette
|
||||
className={cn(
|
||||
'w-5 h-5',
|
||||
customBackgroundColor ? 'text-white/80' : 'text-muted-foreground'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<Input
|
||||
type="color"
|
||||
value={customBackgroundColor || '#000000'}
|
||||
onChange={(e) => {
|
||||
const color = e.target.value;
|
||||
setTerminalBackgroundColor(color);
|
||||
}}
|
||||
className="w-14 h-10 p-1 cursor-pointer bg-transparent border-border/50"
|
||||
title="Pick a color"
|
||||
/>
|
||||
<Input
|
||||
type="text"
|
||||
value={customBackgroundColor || ''}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
// Validate hex color format
|
||||
if (value === '' || /^#[0-9A-Fa-f]{0,6}$/.test(value)) {
|
||||
if (value === '' || /^#[0-9A-Fa-f]{6}$/.test(value)) {
|
||||
setTerminalBackgroundColor(value || null);
|
||||
}
|
||||
}
|
||||
}}
|
||||
placeholder="e.g., #1a1a1a"
|
||||
className="flex-1 bg-accent/30 border-border/50 font-mono text-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Foreground Color */}
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label className="text-foreground font-medium">Foreground Color</Label>
|
||||
{customForegroundColor && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-7 px-2 text-xs text-muted-foreground hover:text-foreground"
|
||||
onClick={() => {
|
||||
setTerminalForegroundColor(null);
|
||||
toast.success('Foreground color reset to theme default');
|
||||
}}
|
||||
>
|
||||
<X className="w-3 h-3 mr-1" />
|
||||
Reset
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Override the terminal text/foreground color. Leave empty to use the theme default.
|
||||
</p>
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex items-center gap-2 flex-1">
|
||||
<div
|
||||
className="w-10 h-10 rounded-lg border border-border/50 shadow-sm flex items-center justify-center"
|
||||
style={{
|
||||
backgroundColor: customForegroundColor || 'var(--foreground)',
|
||||
}}
|
||||
>
|
||||
<Type
|
||||
className={cn(
|
||||
'w-5 h-5',
|
||||
customForegroundColor ? 'text-black/80' : 'text-background'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<Input
|
||||
type="color"
|
||||
value={customForegroundColor || '#ffffff'}
|
||||
onChange={(e) => {
|
||||
const color = e.target.value;
|
||||
setTerminalForegroundColor(color);
|
||||
}}
|
||||
className="w-14 h-10 p-1 cursor-pointer bg-transparent border-border/50"
|
||||
title="Pick a color"
|
||||
/>
|
||||
<Input
|
||||
type="text"
|
||||
value={customForegroundColor || ''}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
// Validate hex color format
|
||||
if (value === '' || /^#[0-9A-Fa-f]{0,6}$/.test(value)) {
|
||||
if (value === '' || /^#[0-9A-Fa-f]{6}$/.test(value)) {
|
||||
setTerminalForegroundColor(value || null);
|
||||
}
|
||||
}
|
||||
}}
|
||||
placeholder="e.g., #ffffff"
|
||||
className="flex-1 bg-accent/30 border-border/50 font-mono text-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Default Font Size */}
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center justify-between">
|
||||
|
||||
Reference in New Issue
Block a user