claude-dev-env 8.109.6 → 8.109.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/pr-lifecycle/SKILL.md +1 -1
- package/bin/install-pstack-plugin.mjs +80 -14
- package/bin/install-pstack-plugin.test.mjs +111 -40
- package/bin/install.mjs +23 -20
- package/bin/install.test.mjs +22 -17
- package/docs/rule-guides/proof-before-pull-request.md +3 -1
- package/hooks/blocking/pull_request_proof.py +258 -50
- package/hooks/blocking/test_pull_request_proof.py +512 -2
- package/hooks/hooks_constants/pull_request_proof_constants.py +19 -1
- package/package.json +1 -1
- package/scripts/durable_post_lint.py +28 -4
- package/scripts/test_durable_post_lint.py +135 -0
|
@@ -17,6 +17,16 @@ if hooks_directory not in sys.path:
|
|
|
17
17
|
from blocking.followup_pr_dedupe import body_from_arguments, create_tool_fields, title_from_arguments
|
|
18
18
|
from hooks_constants.pr_lifecycle_skill_gate_constants import SHELL_TOOL_NAMES, UPDATE_PULL_REQUEST_TOOL_SUFFIX
|
|
19
19
|
from hooks_constants.pull_request_proof_constants import (
|
|
20
|
+
ADDED_FILE_NAMES_QUERY,
|
|
21
|
+
GIT_URL_SUFFIX,
|
|
22
|
+
REMOTE_LINE_FIELD_COUNT,
|
|
23
|
+
RUN_WORD_PATTERN,
|
|
24
|
+
WORKFLOW_NAME_MATCH_TEMPLATE,
|
|
25
|
+
WORKFLOW_SUBJECT_PATTERN,
|
|
26
|
+
AFTER_MERGE_HEADING_PATTERN,
|
|
27
|
+
AFTER_MERGE_NO_RECORDER_PATTERN,
|
|
28
|
+
AFTER_MERGE_RECORDER_PATTERN,
|
|
29
|
+
AFTER_MERGE_SENTENCE_SEPARATOR_PATTERN,
|
|
20
30
|
ALL_GH_CREATE_WORDS,
|
|
21
31
|
ALL_GH_EDIT_WORDS,
|
|
22
32
|
ALL_PYTHON_PROGRAM_NAMES,
|
|
@@ -50,6 +60,7 @@ from hooks_constants.pull_request_proof_constants import (
|
|
|
50
60
|
MISSING_EXISTING_WORK_REASON,
|
|
51
61
|
MISSING_LOOK_REASON,
|
|
52
62
|
MISSING_PROOF_REASON,
|
|
63
|
+
NEW_WORKFLOW_PATH_PATTERN,
|
|
53
64
|
NEXT_HEADING_PATTERN,
|
|
54
65
|
PROOF_HEADING_PATTERN,
|
|
55
66
|
PURE_RENAME_STATUS,
|
|
@@ -450,17 +461,17 @@ def _prose_lines(section: str) -> Iterator[tuple[str, str]]:
|
|
|
450
461
|
yield each_line, re.sub(INLINE_CODE_SPAN_PATTERN, "", each_line.replace(CODE_FENCE_MARKER, "`"))
|
|
451
462
|
|
|
452
463
|
|
|
453
|
-
def
|
|
454
|
-
"""Return
|
|
464
|
+
def unproven_admissions(section: str) -> list[str]:
|
|
465
|
+
"""Return every prose line of a proof section that says something is not proven.
|
|
455
466
|
|
|
456
467
|
::
|
|
457
468
|
|
|
458
|
-
"Not proven here: a fresh Convert run." -> "Not proven here: a fresh Convert run."
|
|
459
|
-
"The live run is untested." -> "The live run is untested."
|
|
460
|
-
"It has not been tested on the target." -> "It has not been tested on the target."
|
|
461
|
-
"`not proven` printed by the probe" ->
|
|
462
|
-
"> Not proven here: the live run." -> "> Not proven here: the live run."
|
|
463
|
-
"Ran `python run.py`, quoted below." ->
|
|
469
|
+
"Not proven here: a fresh Convert run." -> ["Not proven here: a fresh Convert run."]
|
|
470
|
+
"The live run is untested." -> ["The live run is untested."]
|
|
471
|
+
"It has not been tested on the target." -> ["It has not been tested on the target."]
|
|
472
|
+
"`not proven` printed by the probe" -> []
|
|
473
|
+
"> Not proven here: the live run." -> ["> Not proven here: the live run."]
|
|
474
|
+
"Ran `python run.py`, quoted below." -> []
|
|
464
475
|
|
|
465
476
|
The markers are not proven, not tested and not verified, each with any
|
|
466
477
|
run of yet, been or fully after the not, plus unproven, untested and
|
|
@@ -472,17 +483,15 @@ def unproven_admission(section: str) -> str | None:
|
|
|
472
483
|
Inline code spans and fenced blocks are skipped, so output quoted there
|
|
473
484
|
never counts.
|
|
474
485
|
"""
|
|
475
|
-
return
|
|
476
|
-
|
|
486
|
+
return [
|
|
487
|
+
each_line.strip()
|
|
488
|
+
for each_line, each_prose in _prose_lines(section)
|
|
489
|
+
if re.search(UNPROVEN_ADMISSION_PATTERN, each_prose, re.IGNORECASE)
|
|
490
|
+
]
|
|
477
491
|
|
|
478
|
-
def _first_prose_match(section: str, pattern: str) -> str | None:
|
|
479
|
-
for each_line, each_prose in _prose_lines(section):
|
|
480
|
-
if re.search(pattern, each_prose, re.IGNORECASE):
|
|
481
|
-
return each_line.strip()
|
|
482
|
-
return None
|
|
483
492
|
|
|
484
493
|
|
|
485
|
-
def merge_word_line(section: str) -> str | None:
|
|
494
|
+
def merge_word_line(section: str, all_covered_names: list[str] | None = None) -> str | None:
|
|
486
495
|
"""Return the first prose line of a proof section that holds a merge word, or None.
|
|
487
496
|
|
|
488
497
|
::
|
|
@@ -498,10 +507,18 @@ def merge_word_line(section: str) -> str | None:
|
|
|
498
507
|
so a command or file name that holds the word passes when it sits in
|
|
499
508
|
backticks.
|
|
500
509
|
|
|
510
|
+
A line that is about the first run of a covered new workflow is skipped.
|
|
511
|
+
|
|
501
512
|
Args:
|
|
502
513
|
section: The text under the 'Proof in practice' heading.
|
|
514
|
+
all_covered_names: The added workflow files the After merge section covers.
|
|
503
515
|
"""
|
|
504
|
-
|
|
516
|
+
for each_line, each_prose in _prose_lines(section):
|
|
517
|
+
if re.search(MERGE_WORD_PATTERN, each_prose, re.IGNORECASE) and not _admission_is_about_a_first_run(
|
|
518
|
+
each_line, all_covered_names or []
|
|
519
|
+
):
|
|
520
|
+
return each_line.strip()
|
|
521
|
+
return None
|
|
505
522
|
|
|
506
523
|
|
|
507
524
|
def missing_proof_reason(all_payload_fields: Mapping[str, object]) -> str | None:
|
|
@@ -532,9 +549,14 @@ def missing_proof_reason(all_payload_fields: Mapping[str, object]) -> str | None
|
|
|
532
549
|
flags before -m unittest still count. coverage run -m unittest counts.
|
|
533
550
|
A pipe into tee, tail, head, grep or cat keeps a test run a test run.
|
|
534
551
|
A section whose prose says part of the change is not proven, untested or
|
|
535
|
-
unverified is denied, with the line quoted;
|
|
552
|
+
unverified is denied, with the line quoted; unproven_admissions lists the
|
|
536
553
|
markers. A prose line with a merge word is denied in the proof section;
|
|
537
|
-
merge_word_line lists the words.
|
|
554
|
+
merge_word_line lists the words. The unproven line passes when the pull
|
|
555
|
+
request adds a workflow file the default branch lacks and the body has an
|
|
556
|
+
'After merge' section that names that file in backticks and says who records
|
|
557
|
+
the run, and the line uses the word run outside code spans and says workflow
|
|
558
|
+
or GitHub Actions or names a covered workflow file; see
|
|
559
|
+
_first_unwaived_admission. The same covered line is exempt from the merge word.
|
|
538
560
|
|
|
539
561
|
Args:
|
|
540
562
|
all_payload_fields: The parsed PreToolUse input.
|
|
@@ -545,21 +567,30 @@ def missing_proof_reason(all_payload_fields: Mapping[str, object]) -> str | None
|
|
|
545
567
|
section = proof_section(each_body)
|
|
546
568
|
if not section:
|
|
547
569
|
return MISSING_PROOF_REASON
|
|
548
|
-
section_reason = _proof_section_reason(section)
|
|
570
|
+
section_reason = _proof_section_reason(section, each_body, all_payload_fields)
|
|
549
571
|
if section_reason is not None:
|
|
550
572
|
return section_reason
|
|
551
573
|
return None
|
|
552
574
|
|
|
553
575
|
|
|
554
|
-
def _proof_section_reason(
|
|
576
|
+
def _proof_section_reason(
|
|
577
|
+
section: str, body: str | None = None, all_payload_fields: Mapping[str, object] | None = None
|
|
578
|
+
) -> str | None:
|
|
555
579
|
if COMMAND_MARKER not in section:
|
|
556
580
|
return MISSING_PROOF_REASON
|
|
557
581
|
if _proof_runs_only_tests(section):
|
|
558
582
|
return TEST_ONLY_PROOF_REASON
|
|
559
|
-
|
|
560
|
-
if
|
|
561
|
-
|
|
562
|
-
|
|
583
|
+
all_admissions = unproven_admissions(section)
|
|
584
|
+
if body is None or all_payload_fields is None:
|
|
585
|
+
unwaived_admission = all_admissions[0] if all_admissions else None
|
|
586
|
+
all_covered_names: list[str] = []
|
|
587
|
+
else:
|
|
588
|
+
needs_waiver = bool(all_admissions) or merge_word_line(section) is not None
|
|
589
|
+
all_covered_names = _covered_workflow_names(body, all_payload_fields) if needs_waiver else []
|
|
590
|
+
unwaived_admission = _first_unwaived_admission(all_admissions, all_covered_names)
|
|
591
|
+
if unwaived_admission is not None:
|
|
592
|
+
return UNPROVEN_PROOF_REASON.format(admission=unwaived_admission)
|
|
593
|
+
deferral = merge_word_line(section, all_covered_names)
|
|
563
594
|
return None if deferral is None else DEFERRED_PROOF_REASON.format(deferral=deferral)
|
|
564
595
|
|
|
565
596
|
|
|
@@ -701,15 +732,10 @@ def visible_changed_files(working_directory: str, head_branch: object) -> list[s
|
|
|
701
732
|
working_directory: The session directory the hook payload names.
|
|
702
733
|
head_branch: The head branch a create call names, or None.
|
|
703
734
|
"""
|
|
704
|
-
|
|
735
|
+
merge_base_and_head = _merge_base_and_head(working_directory, head_branch)
|
|
736
|
+
if merge_base_and_head is None:
|
|
705
737
|
return None
|
|
706
|
-
|
|
707
|
-
if head_reference is None:
|
|
708
|
-
return None
|
|
709
|
-
merge_base = _first_merge_base(working_directory, head_reference)
|
|
710
|
-
if merge_base is None:
|
|
711
|
-
return None
|
|
712
|
-
raw_output = _git_output(working_directory, "diff", "--raw", "--no-abbrev", "-M", "-z", merge_base, head_reference)
|
|
738
|
+
raw_output = _git_output(working_directory, "diff", "--raw", "--no-abbrev", "-M", "-z", *merge_base_and_head)
|
|
713
739
|
if raw_output is None:
|
|
714
740
|
return None
|
|
715
741
|
all_changes = _git_changes(raw_output.split("\0"))
|
|
@@ -718,6 +744,16 @@ def visible_changed_files(working_directory: str, head_branch: object) -> list[s
|
|
|
718
744
|
return _visible_paths(all_changes)
|
|
719
745
|
|
|
720
746
|
|
|
747
|
+
def _merge_base_and_head(working_directory: str, head_branch: object) -> tuple[str, str] | None:
|
|
748
|
+
if not working_directory:
|
|
749
|
+
return None
|
|
750
|
+
head_reference = _head_reference(working_directory, head_branch)
|
|
751
|
+
if head_reference is None:
|
|
752
|
+
return None
|
|
753
|
+
merge_base = _first_merge_base(working_directory, head_reference)
|
|
754
|
+
return None if merge_base is None else (merge_base, head_reference)
|
|
755
|
+
|
|
756
|
+
|
|
721
757
|
def _git_changes(all_raw_fields: list[str]) -> list[ChangedFile] | None:
|
|
722
758
|
all_changes = []
|
|
723
759
|
field_index = 0
|
|
@@ -769,6 +805,34 @@ def _visible_paths(all_changes: list[ChangedFile]) -> list[str]:
|
|
|
769
805
|
]
|
|
770
806
|
|
|
771
807
|
|
|
808
|
+
def _workflow_paths(all_added_paths: list[str]) -> list[str]:
|
|
809
|
+
return [each_path for each_path in all_added_paths if re.match(NEW_WORKFLOW_PATH_PATTERN, each_path)]
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
def added_workflow_files(working_directory: str, head_branch: object) -> list[str] | None:
|
|
813
|
+
"""Return the workflow files the head branch adds, or None when git cannot tell.
|
|
814
|
+
|
|
815
|
+
The head and base are chosen as in visible_changed_files. Only a file git
|
|
816
|
+
reports as added counts, and a rename counts as an add, so a workflow the
|
|
817
|
+
branch edits is left out::
|
|
818
|
+
|
|
819
|
+
branch adds .github/workflows/release.yml -> [".github/workflows/release.yml"]
|
|
820
|
+
branch edits an existing workflow -> []
|
|
821
|
+
named head exists nowhere in the clone -> None
|
|
822
|
+
|
|
823
|
+
Args:
|
|
824
|
+
working_directory: The session directory the hook payload names.
|
|
825
|
+
head_branch: The head branch a create call names, or None.
|
|
826
|
+
"""
|
|
827
|
+
merge_base_and_head = _merge_base_and_head(working_directory, head_branch)
|
|
828
|
+
if merge_base_and_head is None:
|
|
829
|
+
return None
|
|
830
|
+
all_added_paths = _git_lines(
|
|
831
|
+
working_directory, "diff", "--name-only", "--no-renames", "--diff-filter=A", *merge_base_and_head
|
|
832
|
+
)
|
|
833
|
+
return None if all_added_paths is None else _workflow_paths(all_added_paths)
|
|
834
|
+
|
|
835
|
+
|
|
772
836
|
def _gh_api_lines(endpoint: str, query: str) -> list[str] | None:
|
|
773
837
|
try:
|
|
774
838
|
completed = subprocess.run(
|
|
@@ -796,22 +860,20 @@ def _compare_base_branch(repository: str, base_branch: str | None) -> str | None
|
|
|
796
860
|
return all_default_branch_lines[0]
|
|
797
861
|
|
|
798
862
|
|
|
799
|
-
def
|
|
800
|
-
|
|
863
|
+
def _compare_lines(
|
|
864
|
+
repository: str | None, base_branch: str | None, head_branch: str | None, query: str
|
|
865
|
+
) -> list[str] | None:
|
|
866
|
+
if not repository or not head_branch:
|
|
867
|
+
return None
|
|
868
|
+
resolved_base_branch = _compare_base_branch(repository, base_branch)
|
|
869
|
+
if resolved_base_branch is None:
|
|
870
|
+
return None
|
|
871
|
+
return _gh_api_lines(
|
|
801
872
|
COMPARE_ENDPOINT_TEMPLATE.format(
|
|
802
|
-
repository=repository, base_branch=
|
|
873
|
+
repository=repository, base_branch=resolved_base_branch, head_branch=head_branch
|
|
803
874
|
),
|
|
804
|
-
|
|
875
|
+
query,
|
|
805
876
|
)
|
|
806
|
-
if all_status_lines is None:
|
|
807
|
-
return None
|
|
808
|
-
all_changes = _compare_changes(all_status_lines)
|
|
809
|
-
if all_changes is None:
|
|
810
|
-
return None
|
|
811
|
-
all_visible_paths = _visible_paths(all_changes)
|
|
812
|
-
if all_visible_paths or len(all_status_lines) < COMPARE_FILE_LIST_LIMIT:
|
|
813
|
-
return all_visible_paths
|
|
814
|
-
return None
|
|
815
877
|
|
|
816
878
|
|
|
817
879
|
def remote_visible_changed_files(
|
|
@@ -838,12 +900,158 @@ def remote_visible_changed_files(
|
|
|
838
900
|
base_branch: The base branch the create call names, or None.
|
|
839
901
|
head_branch: The head branch the create call names, or None.
|
|
840
902
|
"""
|
|
841
|
-
|
|
903
|
+
all_status_lines = _compare_lines(repository, base_branch, head_branch, COMPARE_FILE_STATUS_QUERY)
|
|
904
|
+
if all_status_lines is None:
|
|
842
905
|
return None
|
|
843
|
-
|
|
844
|
-
if
|
|
906
|
+
all_changes = _compare_changes(all_status_lines)
|
|
907
|
+
if all_changes is None:
|
|
908
|
+
return None
|
|
909
|
+
all_visible_paths = _visible_paths(all_changes)
|
|
910
|
+
if all_visible_paths or len(all_status_lines) < COMPARE_FILE_LIST_LIMIT:
|
|
911
|
+
return all_visible_paths
|
|
912
|
+
return None
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
def remote_added_workflow_files(
|
|
916
|
+
repository: str | None, base_branch: str | None, head_branch: str | None
|
|
917
|
+
) -> list[str] | None:
|
|
918
|
+
"""Return the workflow files the head branch adds, read from the GitHub compare API, or None.
|
|
919
|
+
|
|
920
|
+
::
|
|
921
|
+
|
|
922
|
+
compare adds .github/workflows/release.yml -> [".github/workflows/release.yml"]
|
|
923
|
+
compare adds only tool.py -> []
|
|
924
|
+
compare returns 300 files and adds no workflow -> None
|
|
925
|
+
repository or head missing -> None
|
|
926
|
+
|
|
927
|
+
A full page of 300 files is the compare API's cap, so a workflow could sit
|
|
928
|
+
on a later page and the answer is None.
|
|
929
|
+
|
|
930
|
+
Args:
|
|
931
|
+
repository: The owner/name the create call names, or None.
|
|
932
|
+
base_branch: The base branch the create call names, or None.
|
|
933
|
+
head_branch: The head branch the create call names, or None.
|
|
934
|
+
"""
|
|
935
|
+
all_lines = _compare_lines(repository, base_branch, head_branch, ADDED_FILE_NAMES_QUERY)
|
|
936
|
+
if not all_lines or not all_lines[0].isdigit():
|
|
845
937
|
return None
|
|
846
|
-
|
|
938
|
+
all_workflow_paths = _workflow_paths(all_lines[1:])
|
|
939
|
+
if all_workflow_paths or int(all_lines[0]) < COMPARE_FILE_LIST_LIMIT:
|
|
940
|
+
return all_workflow_paths
|
|
941
|
+
return None
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
def _added_workflow_files_for_create(all_payload_fields: Mapping[str, object]) -> list[str]:
|
|
945
|
+
working_directory = str(all_payload_fields.get("cwd") or "")
|
|
946
|
+
head_branch = _named_head_branch(all_payload_fields)
|
|
947
|
+
repository = _named_repository(all_payload_fields)
|
|
948
|
+
all_workflow_paths = None
|
|
949
|
+
if _local_checkout_may_answer(working_directory, repository, head_branch):
|
|
950
|
+
all_workflow_paths = added_workflow_files(working_directory, head_branch)
|
|
951
|
+
if all_workflow_paths is None:
|
|
952
|
+
all_workflow_paths = remote_added_workflow_files(
|
|
953
|
+
repository, _named_base_branch(all_payload_fields), head_branch
|
|
954
|
+
)
|
|
955
|
+
return all_workflow_paths or []
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
def _local_checkout_may_answer(
|
|
959
|
+
working_directory: str, repository: str | None, head_branch: str | None
|
|
960
|
+
) -> bool:
|
|
961
|
+
return not head_branch or checkout_is_for(working_directory, repository)
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
def checkout_is_for(working_directory: str, repository: str | None) -> bool:
|
|
965
|
+
if repository is None:
|
|
966
|
+
return True
|
|
967
|
+
all_remote_lines = _git_lines(working_directory, "remote", "-v") if working_directory else None
|
|
968
|
+
all_repository_endings = ("/" + repository.lower(), ":" + repository.lower())
|
|
969
|
+
for each_line in all_remote_lines or []:
|
|
970
|
+
all_fields = each_line.split()
|
|
971
|
+
if len(all_fields) >= REMOTE_LINE_FIELD_COUNT and all_fields[1].lower().rstrip("/").removesuffix(GIT_URL_SUFFIX).endswith(
|
|
972
|
+
all_repository_endings
|
|
973
|
+
):
|
|
974
|
+
return True
|
|
975
|
+
return False
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
def _first_unwaived_admission(all_admissions: list[str], all_covered_names: list[str]) -> str | None:
|
|
979
|
+
"""Return the first unproven line a new workflow's after-merge run does not explain, or None.
|
|
980
|
+
|
|
981
|
+
::
|
|
982
|
+
|
|
983
|
+
"Not proven here: the live GitHub Actions run." with a covered new workflow -> None
|
|
984
|
+
"Untested on Windows." with a covered new workflow -> that line
|
|
985
|
+
"Not proven here: the live GitHub Actions run." with no covered workflow -> that line
|
|
986
|
+
no unproven line -> None
|
|
987
|
+
|
|
988
|
+
Each admission line must use the word run and also say GitHub Actions or
|
|
989
|
+
workflow, or name a covered workflow file, so an admission about anything
|
|
990
|
+
else keeps the refusal. The line returned is the one that failed.
|
|
991
|
+
|
|
992
|
+
Args:
|
|
993
|
+
all_admissions: The proof section's unproven lines.
|
|
994
|
+
all_covered_names: The added workflow files the After merge section covers.
|
|
995
|
+
"""
|
|
996
|
+
return next(
|
|
997
|
+
(each for each in all_admissions if not _admission_is_about_a_first_run(each, all_covered_names)), None
|
|
998
|
+
)
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
def _admission_is_about_a_first_run(admission: str, all_workflow_names: list[str]) -> bool:
|
|
1002
|
+
admission_prose = re.sub(INLINE_CODE_SPAN_PATTERN, "", admission)
|
|
1003
|
+
if not all_workflow_names or re.search(RUN_WORD_PATTERN, admission_prose, re.IGNORECASE) is None:
|
|
1004
|
+
return False
|
|
1005
|
+
return re.search(WORKFLOW_SUBJECT_PATTERN, admission_prose, re.IGNORECASE) is not None or any(
|
|
1006
|
+
re.search(WORKFLOW_NAME_MATCH_TEMPLATE.format(workflow_name=re.escape(each_name)), admission, re.IGNORECASE)
|
|
1007
|
+
for each_name in all_workflow_names
|
|
1008
|
+
)
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
def _covered_workflow_names(body: str, all_payload_fields: Mapping[str, object]) -> list[str]:
|
|
1012
|
+
"""Return the added workflow files whose first run the body plans for after the merge.
|
|
1013
|
+
|
|
1014
|
+
::
|
|
1015
|
+
|
|
1016
|
+
adds release.yml, "## After merge" names `release.yml` and "records the run link" -> ["release.yml"]
|
|
1017
|
+
the branch adds no workflow file, or git and the compare API cannot tell -> []
|
|
1018
|
+
|
|
1019
|
+
A workflow added by a pull request runs only from the default branch, so
|
|
1020
|
+
its live run cannot come before the merge. The section must name the added
|
|
1021
|
+
workflow file in backticks, by file name or by its full path, and say who
|
|
1022
|
+
records the run or its link in prose. Code spans and fenced blocks do not
|
|
1023
|
+
count as that prose. A sentence with a negation ahead of the verb does not count.
|
|
1024
|
+
|
|
1025
|
+
Args:
|
|
1026
|
+
body: The pull request body.
|
|
1027
|
+
all_payload_fields: The parsed PreToolUse input.
|
|
1028
|
+
"""
|
|
1029
|
+
after_merge = _section_text(body, AFTER_MERGE_HEADING_PATTERN)
|
|
1030
|
+
if not after_merge:
|
|
1031
|
+
return []
|
|
1032
|
+
outside_fence_text = _text_outside_fences(after_merge)
|
|
1033
|
+
if not _prose_names_a_recorder(re.sub(INLINE_CODE_SPAN_PATTERN, "", outside_fence_text)):
|
|
1034
|
+
return []
|
|
1035
|
+
all_names = []
|
|
1036
|
+
for each_path in _added_workflow_files_for_create(all_payload_fields):
|
|
1037
|
+
each_name = each_path.rsplit("/", 1)[-1]
|
|
1038
|
+
if f"`{each_path}`" in outside_fence_text or f"`{each_name}`" in outside_fence_text:
|
|
1039
|
+
all_names.append(each_name)
|
|
1040
|
+
return all_names
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
def _text_outside_fences(section: str) -> str:
|
|
1044
|
+
return LINE_SEPARATOR.join(
|
|
1045
|
+
each_line for each_line, each_is_inside_fence in _lines_with_fence_state(section) if not each_is_inside_fence
|
|
1046
|
+
)
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
def _prose_names_a_recorder(prose: str) -> bool:
|
|
1050
|
+
return any(
|
|
1051
|
+
re.search(AFTER_MERGE_RECORDER_PATTERN, each_sentence, re.IGNORECASE) is not None
|
|
1052
|
+
and re.search(AFTER_MERGE_NO_RECORDER_PATTERN, each_sentence, re.IGNORECASE) is None
|
|
1053
|
+
for each_sentence in re.split(AFTER_MERGE_SENTENCE_SEPARATOR_PATTERN, prose)
|
|
1054
|
+
)
|
|
847
1055
|
|
|
848
1056
|
|
|
849
1057
|
def missing_look_reason(all_payload_fields: Mapping[str, object]) -> str | None:
|