1212Batches all replies into a single GraphQL mutation for efficiency.
1313
1414Example:
15- uv run reply_to_thread.py PRRT_abc "Fixed the issue.\n \n *— Claude Code* "
15+ uv run reply_to_thread.py PRRT_abc "Fixed the issue."
1616 uv run reply_to_thread.py PRRT_abc "Fixed." PRRT_def "Also fixed."
1717"""
1818
1919from __future__ import annotations
2020
2121import argparse
2222import json
23- import re
2423import subprocess
2524import sys
2625
@@ -29,27 +28,9 @@ def _normalize_body(body: str) -> str:
2928 """Normalize escaped newlines from shell input.
3029
3130 Bash double quotes keep "\\ n" literal, but reply bodies should contain
32- actual newlines for readability/signatures .
31+ actual newlines for readability.
3332 """
34- normalized = body .replace ("\\ r\\ n" , "\\ n" ).replace ("\\ n" , "\n " )
35-
36- # Add Claude Code attribution if not already present
37- # Check if the last line matches the bot signature pattern: *— Bot Name* or *- Bot Name*
38- lines = normalized .rstrip ().split ("\n " )
39- last_line = lines [- 1 ] if lines else ""
40-
41- # Match bot signatures like "*— Claude Code*", "*- Any Bot*", etc.
42- bot_signature_pattern = r"^\*[—-]\s+.+\*$"
43-
44- if not re .match (bot_signature_pattern , last_line .strip ()):
45- # Ensure proper spacing before attribution
46- if normalized and not normalized .endswith ("\n " ):
47- normalized += "\n "
48- if normalized and not normalized .endswith ("\n \n " ):
49- normalized += "\n "
50- normalized += "*— Claude Code*"
51-
52- return normalized
33+ return body .replace ("\\ r\\ n" , "\\ n" ).replace ("\\ n" , "\n " )
5334
5435
5536def reply_to_threads (pairs : list [tuple [str , str ]]) -> list [tuple [str , bool ]]:
0 commit comments