From e210607a1cfeb9cddaa121095991ebaa64c65361 Mon Sep 17 00:00:00 2001 From: rootiest Date: Mon, 19 Jan 2026 21:31:34 -0500 Subject: [PATCH] properly sync closed issues --- .gitea/sync_beads.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.gitea/sync_beads.py b/.gitea/sync_beads.py index 690a4d7..d4fee84 100644 --- a/.gitea/sync_beads.py +++ b/.gitea/sync_beads.py @@ -35,7 +35,7 @@ def sync(): # 2. Parse the Beads JSONL file processed_count = 0 skipped_count = 0 - + with open(beads_path, "r") as f: for line in f: line = line.strip() @@ -61,17 +61,22 @@ def sync(): continue processed_count += 1 + # Normalize the state for Gitea + # Beads can use 'closed', 'done', or 'finished' + is_closed = status in ["closed", "done", "finished"] + gitea_state = "closed" if is_closed else "open" + unique_title = f"[{bid}] {title}" payload = { "title": unique_title, "body": f"{data.get('description', 'No description provided.')}\n\n---\n**Beads ID:** `{bid}`\n**Type:** `{itype}`", - "state": "closed" - if status in ["closed", "done"] - else "open", + "state": gitea_state, # Use the normalized variable here } if bid in existing: - print(f"✅ Updating Gitea Issue #{existing[bid]['number']} for {bid}") + print( + f"✅ Updating Gitea Issue #{existing[bid]['number']} for {bid}" + ) requests.patch( f"{URL}/api/v1/repos/{REPO}/issues/{existing[bid]['number']}", headers=HEADERS, @@ -90,7 +95,7 @@ def sync(): print(f"⚠️ Error processing bead: {e}") print(f"🏁 Finished. Active: {processed_count}, Skipped: {skipped_count}") - + # We check if we have ANY beads (active or tombstone) to validate the file isn't broken if (processed_count + skipped_count) == 0: print("❌ ERROR: File was found but it was EMPTY.")