feat(HAI-026): complete Step 3 — add worktreeInitCommand UI field to SettingsModal

This commit is contained in:
Dustin Byrne
2026-03-25 22:12:35 -04:00
parent 8ae79a95de
commit a1380e8637

View File

@@ -9,7 +9,7 @@ interface SettingsModalProps {
}
export function SettingsModal({ onClose, addToast }: SettingsModalProps) {
const [form, setForm] = useState<Settings>({ maxConcurrent: 2, maxWorktrees: 4, pollIntervalMs: 15000, groupOverlappingFiles: false, autoMerge: false });
const [form, setForm] = useState<Settings & { worktreeInitCommand?: string }>({ maxConcurrent: 2, maxWorktrees: 4, pollIntervalMs: 15000, groupOverlappingFiles: false, autoMerge: false, worktreeInitCommand: "" });
const [loading, setLoading] = useState(true);
useEffect(() => {
@@ -41,7 +41,11 @@ export function SettingsModal({ onClose, addToast }: SettingsModalProps) {
const handleSave = useCallback(async () => {
try {
await updateSettings(form);
const payload = {
...form,
worktreeInitCommand: form.worktreeInitCommand?.trim() || undefined,
};
await updateSettings(payload);
addToast("Settings saved", "success");
onClose();
} catch (err: any) {
@@ -116,6 +120,19 @@ export function SettingsModal({ onClose, addToast }: SettingsModalProps) {
</label>
<small>When enabled, tasks that modify the same files are queued serially to avoid merge conflicts</small>
</div>
<div className="form-group">
<label htmlFor="worktreeInitCommand">Worktree Init Command</label>
<input
id="worktreeInitCommand"
type="text"
placeholder="pnpm install"
value={form.worktreeInitCommand || ""}
onChange={(e) =>
setForm((f) => ({ ...f, worktreeInitCommand: e.target.value }))
}
/>
<small>Shell command to run in each new worktree after creation</small>
</div>
</div>
)}
<div className="modal-actions">