diff options
Diffstat (limited to 'hooks/gh-pr-create-confirm.py')
| -rwxr-xr-x | hooks/gh-pr-create-confirm.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/hooks/gh-pr-create-confirm.py b/hooks/gh-pr-create-confirm.py index e3c2f13..f539551 100755 --- a/hooks/gh-pr-create-confirm.py +++ b/hooks/gh-pr-create-confirm.py @@ -27,7 +27,12 @@ Wire in ~/.claude/settings.json alongside git-commit-confirm.py: import re import sys -from _common import read_payload, respond_ask, scan_attribution +from _common import ( + read_payload, + read_referenced_file, + respond_ask, + scan_attribution, +) MAX_BODY_LINES = 20 @@ -91,9 +96,16 @@ def parse_pr_create(cmd: str) -> dict: if b: fields["body"] = b.group(2).strip() else: - bf = re.search(r"--body-file\s+(\S+)", cmd) + bf = re.search(r"--body-file\s+(\"[^\"]+\"|'[^']+'|\S+)", cmd) if bf: - fields["body"] = f"(body read from file: {bf.group(1)})" + path = bf.group(1).strip("\"'") + text = read_referenced_file(path) + if text is not None: + fields["body"] = text.strip() + else: + fields["body"] = ( + f"(body read from file: {path} — could not inspect)" + ) # Base / head base = re.search(r"--base\s+(\S+)", cmd) |
