From 3ea2c72e2c50c0d73614d9ac82f41508b6ab1ce4 Mon Sep 17 00:00:00 2001
From: soryu <soryu@soryu.co>
Date: Sat, 31 Jan 2026 22:17:09 +0000
Subject: Add auto_merge_local option for local-only contracts (#50)

When local_only=true on a contract, all completion actions are skipped.
This adds a new option auto_merge_local that, when enabled along with
local_only, will automatically merge completed task changes to the
master/main branch locally (without pushing or creating PRs).

Changes:
- Add auto_merge_local column to contracts table (migration)
- Add auto_merge_local field to Contract model and summary
- Update CreateContractRequest and UpdateContractRequest structs
- Update contract repository create/update functions
- Add auto_merge_local to WebSocket protocol StartTask command
- Pass auto_merge_local through spawn_task and run_task functions
- Modify task manager completion logic: if local_only=true AND
  auto_merge_local=true, execute 'merge' completion action locally
- Update all server handlers to retrieve and pass auto_merge_local
- Add TypeScript types to frontend components

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
---
 makima/migrations/20260130000001_add_auto_merge_local.sql | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 makima/migrations/20260130000001_add_auto_merge_local.sql

(limited to 'makima/migrations/20260130000001_add_auto_merge_local.sql')

diff --git a/makima/migrations/20260130000001_add_auto_merge_local.sql b/makima/migrations/20260130000001_add_auto_merge_local.sql
new file mode 100644
index 0000000..1dd5e5c
--- /dev/null
+++ b/makima/migrations/20260130000001_add_auto_merge_local.sql
@@ -0,0 +1,8 @@
+-- Add auto_merge_local column to contracts table
+-- When enabled alongside local_only, completed task changes will be automatically
+-- merged to the master/main branch locally (without pushing or creating PRs).
+
+ALTER TABLE contracts
+ADD COLUMN IF NOT EXISTS auto_merge_local BOOLEAN NOT NULL DEFAULT FALSE;
+
+COMMENT ON COLUMN contracts.auto_merge_local IS 'Whether to auto-merge to target branch locally when local_only mode is enabled';
-- 
cgit v1.2.3

