@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 36 lines 1.22 KB
Raw
1 import type { EnvironmentId, ProjectId, ServerSettings } from "@t3tools/contracts";
2
3 export type AutoSettleSettings = Pick<
4 ServerSettings,
5 "sidebarAutoSettleAfterDays" | "sidebarAutoSettleOnMerge"
6 >;
7
8 interface AutoSettleSyncTarget {
9 readonly environmentId: EnvironmentId;
10 readonly projectId?: ProjectId | null;
11 readonly label: string;
12 readonly settings: AutoSettleSettings | null;
13 }
14
15 export function planAutoSettleSettingsSync(
16 reference: {
17 readonly environmentId: EnvironmentId;
18 readonly projectId?: ProjectId | null;
19 readonly settings: AutoSettleSettings;
20 },
21 targets: readonly AutoSettleSyncTarget[],
22 ) {
23 const patch: AutoSettleSettings = {
24 sidebarAutoSettleAfterDays: reference.settings.sidebarAutoSettleAfterDays,
25 sidebarAutoSettleOnMerge: reference.settings.sidebarAutoSettleOnMerge,
26 };
27 const mismatches = targets.filter(
28 (target) =>
29 (target.environmentId !== reference.environmentId ||
30 target.projectId !== reference.projectId) &&
31 target.settings !== null &&
32 (target.settings.sidebarAutoSettleAfterDays !== patch.sidebarAutoSettleAfterDays ||
33 target.settings.sidebarAutoSettleOnMerge !== patch.sidebarAutoSettleOnMerge),
34 );
35 return { patch, mismatches };
36 }