From cc635485f0682fd2dad632f977713ba3ff2b3478 Mon Sep 17 00:00:00 2001 From: ARUNAVO RAY Date: Mon, 4 May 2026 10:14:09 +0530 Subject: [PATCH] feat: surface auto-mirror toggle in automation settings (refs #278) (#282) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fix in v3.15.8 made scheduleConfig.autoMirror an independent trigger in the scheduler, but it remained reachable only via the AUTO_MIRROR_REPOS env var. This adds a UI checkbox under the Automatic Syncing section so the option can be toggled per-config without touching the environment. The toggle is conditional on scheduling being enabled (since auto-mirror without a scheduler is meaningless) and is independent of the existing "Auto-mirror new starred repositories" toggle in GitHub settings. Together they cover the full owned/starred matrix that the scheduler already supports. Plumbing: config-mapper.ts now round-trips autoMirror through the UI/DB boundary, and ScheduleConfig in types/config.ts gets the matching field. No schema or migration change — autoMirror was already in the zod schema. --- src/components/config/AutomationSettings.tsx | 25 ++++++++++++++++++++ src/lib/utils/config-mapper.ts | 3 +++ src/types/config.ts | 1 + 3 files changed, 29 insertions(+) diff --git a/src/components/config/AutomationSettings.tsx b/src/components/config/AutomationSettings.tsx index 49afb1f..f166aba 100644 --- a/src/components/config/AutomationSettings.tsx +++ b/src/components/config/AutomationSettings.tsx @@ -269,6 +269,31 @@ export function AutomationSettings({ + +
+ + onScheduleChange({ + ...scheduleConfig, + autoMirror: !!checked, + }) + } + /> +
+ +

+ Automatically mirror newly imported repositories on each scheduled sync. When off, new repos are imported for browsing but require a manual mirror click. (Starred repos have their own toggle in GitHub settings.) +

+
+
)} diff --git a/src/lib/utils/config-mapper.ts b/src/lib/utils/config-mapper.ts index de4d178..00b0c56 100644 --- a/src/lib/utils/config-mapper.ts +++ b/src/lib/utils/config-mapper.ts @@ -246,6 +246,7 @@ export function mapUiScheduleToDb(uiSchedule: any, existing?: DbScheduleConfig): enabled: !!uiSchedule.enabled, interval: intervalExpression, timezone, + autoMirror: typeof uiSchedule.autoMirror === "boolean" ? uiSchedule.autoMirror : base.autoMirror, nextRun: scheduleChanged ? undefined : base.nextRun, } as DbScheduleConfig; } @@ -264,6 +265,7 @@ export function mapDbScheduleToUi(dbSchedule: DbScheduleConfig): any { clockFrequencyHours: 24, startTime: "22:00", timezone: "UTC", + autoMirror: false, lastRun: null, nextRun: null, }; @@ -296,6 +298,7 @@ export function mapDbScheduleToUi(dbSchedule: DbScheduleConfig): any { clockFrequencyHours: parsedClockSchedule?.frequencyHours ?? 24, startTime: parsedClockSchedule?.startTime ?? "22:00", timezone: normalizeTimezone(dbSchedule.timezone || "UTC"), + autoMirror: dbSchedule.autoMirror ?? false, lastRun: dbSchedule.lastRun || null, nextRun: dbSchedule.nextRun || null, }; diff --git a/src/types/config.ts b/src/types/config.ts index 47bc71a..b9e969b 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -36,6 +36,7 @@ export interface ScheduleConfig { clockFrequencyHours?: number; startTime?: string; timezone?: string; + autoMirror?: boolean; lastRun?: Date; nextRun?: Date; }