diff --git a/askcc/definitions.py b/askcc/definitions.py index 7cfc36a..ff52f50 100644 --- a/askcc/definitions.py +++ b/askcc/definitions.py @@ -467,6 +467,12 @@ - Check out the PR branch using `gh pr checkout ` to inspect the full source. - Run the project's test suite to confirm all tests pass. +Pre-merge guard (CHANGES_REQUESTED): +- Before merging, check for unresolved CHANGES_REQUESTED reviews using \ +`gh pr view -R --json reviews --jq '[.reviews[] | select(.state == "CHANGES_REQUESTED")]'`. +- If any CHANGES_REQUESTED reviews exist, DO NOT merge. Instead, address the requested changes, \ +reply to all inline comments, push a follow-up fix commit on the PR branch, and re-request review. + Definition of Done checklist: 1. **Acceptance criteria** — verify each criterion from the issue is satisfied by the code changes. 2. **Test coverage** — new and changed logic has unit tests. Look for untested code paths. diff --git a/pyproject.toml b/pyproject.toml index f1f4719..c7bde45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "askcc" -version = "0.2.7" +version = "0.2.8" description = "A one-shot cc cli executor" authors = [{ name = "mknt", email = "shane.cousins@gmail.com" }] readme = "README.md" diff --git a/tests/test_askcc.py b/tests/test_askcc.py index 68bc945..2d6e2e5 100644 --- a/tests/test_askcc.py +++ b/tests/test_askcc.py @@ -13,6 +13,7 @@ from askcc.definitions import ( AGENT_CONFIGS, DEVELOP_AGENT_PROMPT, + REVIEWPR_AGENT_PROMPT, AgentAction, AgentConfig, SupportedLanguage, @@ -278,6 +279,25 @@ def test_removes_legacy_write_tests_line(self): assert "Write tests for every new or changed behavior" not in DEVELOP_AGENT_PROMPT +class TestReviewprPromptMergeGuard: + """The pr-review prompt must block merging when CHANGES_REQUESTED reviews exist (issue #86).""" + + def test_includes_changes_requested_check_command(self): + assert ( + "gh pr view -R --json reviews --jq '[.reviews[] " + '| select(.state == "CHANGES_REQUESTED")]\'' in REVIEWPR_AGENT_PROMPT + ) + + def test_includes_do_not_merge_instruction(self): + assert "DO NOT merge" in REVIEWPR_AGENT_PROMPT + + def test_includes_address_inline_comments_instruction(self): + assert "reply to all inline comments" in REVIEWPR_AGENT_PROMPT + + def test_includes_pre_merge_guard_heading(self): + assert "Pre-merge guard" in REVIEWPR_AGENT_PROMPT + + class TestWritePromptContent: def test_writes_file_with_correct_name(self): filepath = write_prompt_content("plan", "monkut", "askcc-cli", 42, "issue content here") diff --git a/uv.lock b/uv.lock index 2f73f54..dc9f9d5 100644 --- a/uv.lock +++ b/uv.lock @@ -4,7 +4,7 @@ requires-python = "==3.14.*" [[package]] name = "askcc" -version = "0.2.7" +version = "0.2.8" source = { editable = "." } [package.dev-dependencies]