claude-dev-env 1.37.0 → 1.38.0

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.
Files changed (95) hide show
  1. package/CLAUDE.md +3 -0
  2. package/_shared/pr-loop/audit-contract.md +4 -3
  3. package/_shared/pr-loop/fix-protocol.md +2 -0
  4. package/_shared/pr-loop/gh-payloads.md +38 -37
  5. package/_shared/pr-loop/scripts/README.md +0 -1
  6. package/_shared/pr-loop/scripts/preflight.py +2 -1
  7. package/_shared/pr-loop/scripts/tests/test_code_rules_gate.py +2 -2
  8. package/_shared/pr-loop/scripts/tests/test_preflight.py +22 -0
  9. package/_shared/pr-loop/state-schema.md +10 -10
  10. package/agents/clean-coder.md +4 -0
  11. package/agents/code-quality-agent.md +23 -85
  12. package/agents/groq-coder.md +8 -6
  13. package/hooks/blocking/__init__.py +0 -0
  14. package/hooks/blocking/hedging_language_blocker.py +2 -2
  15. package/hooks/blocking/state_description_blocker.py +243 -0
  16. package/hooks/blocking/tdd_enforcer.py +94 -0
  17. package/hooks/blocking/test_hedging_language_blocker.py +1 -1
  18. package/hooks/blocking/test_state_description_blocker.py +618 -0
  19. package/hooks/blocking/test_tdd_enforcer.py +152 -0
  20. package/hooks/config/state_description_blocker_constants.py +130 -0
  21. package/hooks/hooks.json +10 -0
  22. package/package.json +1 -1
  23. package/rules/gh-paginate.md +4 -50
  24. package/rules/no-historical-clutter.md +57 -0
  25. package/scripts/config/groq_bugteam_config.py +13 -5
  26. package/skills/bugteam/CONSTRAINTS.md +20 -27
  27. package/skills/bugteam/EXAMPLES.md +1 -1
  28. package/skills/bugteam/PROMPTS.md +78 -42
  29. package/skills/bugteam/SKILL.md +76 -63
  30. package/skills/bugteam/SKILL_EVALS.md +12 -12
  31. package/skills/bugteam/reference/audit-and-teammates.md +21 -48
  32. package/skills/bugteam/reference/audit-contract.md +7 -7
  33. package/skills/bugteam/reference/github-pr-reviews.md +31 -31
  34. package/skills/bugteam/reference/team-setup.md +1 -1
  35. package/skills/bugteam/reference/teardown-publish-permissions.md +4 -4
  36. package/skills/copilot-review/SKILL.md +7 -14
  37. package/skills/findbugs/SKILL.md +2 -2
  38. package/skills/fixbugs/SKILL.md +1 -1
  39. package/skills/monitor-open-prs/SKILL.md +6 -6
  40. package/skills/pr-converge/SKILL.md +7 -6
  41. package/skills/pr-converge/reference/convergence-gates.md +46 -44
  42. package/skills/pr-converge/reference/examples.md +4 -4
  43. package/skills/pr-converge/reference/fix-protocol.md +8 -8
  44. package/skills/pr-converge/reference/multi-pr-orchestration.md +10 -10
  45. package/skills/pr-converge/reference/per-tick.md +24 -36
  46. package/skills/pr-converge/reference/stop-conditions.md +7 -7
  47. package/skills/pr-converge/scripts/README.md +65 -117
  48. package/skills/pr-review-responder/EXAMPLES.md +2 -2
  49. package/skills/pr-review-responder/PRINCIPLES.md +2 -8
  50. package/skills/pr-review-responder/README.md +7 -48
  51. package/skills/pr-review-responder/SKILL.md +2 -3
  52. package/skills/pr-review-responder/TESTING.md +8 -65
  53. package/skills/qbug/SKILL.md +10 -16
  54. package/_shared/pr-loop/scripts/config/gh_util_constants.py +0 -31
  55. package/_shared/pr-loop/scripts/gh_util.py +0 -193
  56. package/_shared/pr-loop/scripts/tests/test_gh_util.py +0 -257
  57. package/_shared/pr-loop/scripts/tests/test_gh_util_constants.py +0 -61
  58. package/skills/pr-converge/scripts/check_pr_mergeability.py +0 -78
  59. package/skills/pr-converge/scripts/config/pr_converge_constants.py +0 -118
  60. package/skills/pr-converge/scripts/config/test_pr_converge_constants.py +0 -152
  61. package/skills/pr-converge/scripts/fetch_bugbot_inline_comments.py +0 -70
  62. package/skills/pr-converge/scripts/fetch_bugbot_reviews.py +0 -57
  63. package/skills/pr-converge/scripts/fetch_claude_inline_comments.py +0 -70
  64. package/skills/pr-converge/scripts/fetch_claude_reviews.py +0 -61
  65. package/skills/pr-converge/scripts/fetch_copilot_inline_comments.py +0 -70
  66. package/skills/pr-converge/scripts/fetch_copilot_reviews.py +0 -61
  67. package/skills/pr-converge/scripts/mark_pr_ready.py +0 -54
  68. package/skills/pr-converge/scripts/post-bugbot-run.helpers.ps1 +0 -49
  69. package/skills/pr-converge/scripts/post-bugbot-run.ps1 +0 -33
  70. package/skills/pr-converge/scripts/reply_to_inline_comment.py +0 -84
  71. package/skills/pr-converge/scripts/request_copilot_review.py +0 -71
  72. package/skills/pr-converge/scripts/resolve_pr_head.py +0 -58
  73. package/skills/pr-converge/scripts/review_field_helpers.py +0 -43
  74. package/skills/pr-converge/scripts/reviewer_fetch_core.py +0 -153
  75. package/skills/pr-converge/scripts/reviewer_specs.py +0 -98
  76. package/skills/pr-converge/scripts/test_check_pr_mergeability.py +0 -126
  77. package/skills/pr-converge/scripts/test_fetch_bugbot_inline_comments.py +0 -443
  78. package/skills/pr-converge/scripts/test_fetch_bugbot_reviews.py +0 -299
  79. package/skills/pr-converge/scripts/test_fetch_claude_inline_comments.py +0 -485
  80. package/skills/pr-converge/scripts/test_fetch_claude_reviews.py +0 -368
  81. package/skills/pr-converge/scripts/test_fetch_copilot_inline_comments.py +0 -440
  82. package/skills/pr-converge/scripts/test_fetch_copilot_reviews.py +0 -366
  83. package/skills/pr-converge/scripts/test_mark_pr_ready.py +0 -69
  84. package/skills/pr-converge/scripts/test_post_bugbot_run.py +0 -195
  85. package/skills/pr-converge/scripts/test_reply_to_inline_comment.py +0 -159
  86. package/skills/pr-converge/scripts/test_request_copilot_review.py +0 -101
  87. package/skills/pr-converge/scripts/test_resolve_pr_head.py +0 -79
  88. package/skills/pr-converge/scripts/test_review_field_helpers.py +0 -80
  89. package/skills/pr-converge/scripts/test_reviewer_fetch_core.py +0 -448
  90. package/skills/pr-converge/scripts/test_reviewer_specs.py +0 -107
  91. package/skills/pr-converge/scripts/test_trigger_bugbot.py +0 -139
  92. package/skills/pr-converge/scripts/test_view_pr_context.py +0 -111
  93. package/skills/pr-converge/scripts/trigger_bugbot.py +0 -77
  94. package/skills/pr-converge/scripts/view_pr_context.py +0 -47
  95. package/skills/pr-review-responder/scripts/respond_to_reviews.py +0 -376
@@ -1,440 +0,0 @@
1
- """Tests for fetch_copilot_inline_comments.
2
-
3
- Covers:
4
- - gh command uses --paginate --slurp on the comments endpoint
5
- - only copilot-pull-request-reviewer[bot] inline comments are returned
6
- - comments not anchored to the requested commit are filtered out
7
- - comments on the same commit but from an older Copilot review are filtered out
8
- - multi-page responses are flattened correctly
9
- - subprocess errors propagate
10
- """
11
-
12
- from __future__ import annotations
13
-
14
- import importlib.util
15
- import json
16
- import subprocess
17
- from pathlib import Path
18
- from types import ModuleType
19
- from unittest.mock import MagicMock, patch
20
-
21
- import pytest
22
-
23
-
24
- def _load_module() -> ModuleType:
25
- module_path = Path(__file__).parent / "fetch_copilot_inline_comments.py"
26
- spec = importlib.util.spec_from_file_location(
27
- "fetch_copilot_inline_comments", module_path
28
- )
29
- assert spec is not None
30
- assert spec.loader is not None
31
- module = importlib.util.module_from_spec(spec)
32
- spec.loader.exec_module(module)
33
- return module
34
-
35
-
36
- fetch_copilot_inline_comments_module = _load_module()
37
-
38
-
39
- def _completed(stdout: str) -> subprocess.CompletedProcess:
40
- process = MagicMock(spec=subprocess.CompletedProcess)
41
- process.stdout = stdout
42
- process.returncode = 0
43
- return process
44
-
45
-
46
- def _default_review_for_head(*, commit: str, review_id: int) -> list[dict]:
47
- return [
48
- {
49
- "review_id": review_id,
50
- "commit_id": commit,
51
- "submitted_at": "2026-01-01T00:00:00Z",
52
- "state": "CHANGES_REQUESTED",
53
- "body": "Please address the inline notes.",
54
- "classification": "dirty",
55
- }
56
- ]
57
-
58
-
59
- def test_should_invoke_gh_with_paginate_slurp_against_comments_endpoint() -> None:
60
- pages_payload = json.dumps([[]])
61
- with (
62
- patch.object(
63
- fetch_copilot_inline_comments_module,
64
- "fetch_copilot_reviews",
65
- return_value=_default_review_for_head(commit="abc123", review_id=1),
66
- ),
67
- patch("subprocess.run") as mock_run,
68
- ):
69
- mock_run.return_value = _completed(pages_payload)
70
- fetch_copilot_inline_comments_module.fetch_copilot_inline_comments(
71
- owner="acme", repo="widget", number=42, current_head="abc123"
72
- )
73
- invoked_argv = mock_run.call_args[0][0]
74
- assert invoked_argv[0] == "gh"
75
- assert invoked_argv[1] == "api"
76
- assert "repos/acme/widget/pulls/42/comments?per_page=100" in invoked_argv[2]
77
- assert "--paginate" in invoked_argv
78
- assert "--slurp" in invoked_argv
79
-
80
-
81
- def test_should_filter_to_copilot_reviewer_only() -> None:
82
- pages_payload = json.dumps(
83
- [
84
- [
85
- {
86
- "id": 100,
87
- "user": {"login": "cursor[bot]"},
88
- "commit_id": "abc123",
89
- "pull_request_review_id": 1,
90
- "body": "bugbot finding",
91
- "path": "x.py",
92
- "line": 5,
93
- },
94
- {
95
- "id": 101,
96
- "user": {"login": "copilot-pull-request-reviewer[bot]"},
97
- "commit_id": "abc123",
98
- "pull_request_review_id": 1,
99
- "body": "copilot finding",
100
- "path": "x.py",
101
- "line": 6,
102
- },
103
- ]
104
- ]
105
- )
106
- with (
107
- patch.object(
108
- fetch_copilot_inline_comments_module,
109
- "fetch_copilot_reviews",
110
- return_value=_default_review_for_head(commit="abc123", review_id=1),
111
- ),
112
- patch("subprocess.run") as mock_run,
113
- ):
114
- mock_run.return_value = _completed(pages_payload)
115
- all_inline_comments = (
116
- fetch_copilot_inline_comments_module.fetch_copilot_inline_comments(
117
- owner="acme", repo="widget", number=42, current_head="abc123"
118
- )
119
- )
120
- assert len(all_inline_comments) == 1
121
- assert all_inline_comments[0]["comment_id"] == 101
122
-
123
-
124
- def test_should_filter_out_comments_not_on_current_head() -> None:
125
- pages_payload = json.dumps(
126
- [
127
- [
128
- {
129
- "id": 200,
130
- "user": {"login": "copilot-pull-request-reviewer[bot]"},
131
- "commit_id": "old_sha",
132
- "pull_request_review_id": 1,
133
- "body": "stale finding",
134
- "path": "x.py",
135
- "line": 5,
136
- },
137
- {
138
- "id": 201,
139
- "user": {"login": "copilot-pull-request-reviewer[bot]"},
140
- "commit_id": "current_sha",
141
- "pull_request_review_id": 2,
142
- "body": "fresh finding",
143
- "path": "x.py",
144
- "line": 6,
145
- },
146
- ]
147
- ]
148
- )
149
- with (
150
- patch.object(
151
- fetch_copilot_inline_comments_module,
152
- "fetch_copilot_reviews",
153
- return_value=_default_review_for_head(commit="current_sha", review_id=2),
154
- ),
155
- patch("subprocess.run") as mock_run,
156
- ):
157
- mock_run.return_value = _completed(pages_payload)
158
- all_inline_comments = (
159
- fetch_copilot_inline_comments_module.fetch_copilot_inline_comments(
160
- owner="acme", repo="widget", number=42, current_head="current_sha"
161
- )
162
- )
163
- assert len(all_inline_comments) == 1
164
- assert all_inline_comments[0]["comment_id"] == 201
165
-
166
-
167
- def test_should_ignore_inline_comments_from_older_copilot_review_on_same_commit() -> (
168
- None
169
- ):
170
- pages_payload = json.dumps(
171
- [
172
- [
173
- {
174
- "id": 300,
175
- "user": {"login": "copilot-pull-request-reviewer[bot]"},
176
- "commit_id": "same_sha",
177
- "pull_request_review_id": 10,
178
- "body": "stale dirty thread",
179
- "path": "x.py",
180
- "line": 1,
181
- },
182
- {
183
- "id": 301,
184
- "user": {"login": "copilot-pull-request-reviewer[bot]"},
185
- "commit_id": "same_sha",
186
- "pull_request_review_id": 11,
187
- "body": "current clean thread",
188
- "path": "x.py",
189
- "line": 2,
190
- },
191
- ]
192
- ]
193
- )
194
- reviews_newest_first = [
195
- {
196
- "review_id": 11,
197
- "commit_id": "same_sha",
198
- "submitted_at": "2026-01-02T00:00:00Z",
199
- "state": "APPROVED",
200
- "body": "lgtm",
201
- "classification": "clean",
202
- },
203
- {
204
- "review_id": 10,
205
- "commit_id": "same_sha",
206
- "submitted_at": "2026-01-01T00:00:00Z",
207
- "state": "CHANGES_REQUESTED",
208
- "body": "fix the thing",
209
- "classification": "dirty",
210
- },
211
- ]
212
- with (
213
- patch.object(
214
- fetch_copilot_inline_comments_module,
215
- "fetch_copilot_reviews",
216
- return_value=reviews_newest_first,
217
- ),
218
- patch("subprocess.run") as mock_run,
219
- ):
220
- mock_run.return_value = _completed(pages_payload)
221
- all_inline_comments = (
222
- fetch_copilot_inline_comments_module.fetch_copilot_inline_comments(
223
- owner="acme", repo="widget", number=42, current_head="same_sha"
224
- )
225
- )
226
- assert [each_comment["comment_id"] for each_comment in all_inline_comments] == [301]
227
-
228
-
229
- def test_should_return_empty_when_no_copilot_review_exists_for_commit() -> None:
230
- with (
231
- patch.object(
232
- fetch_copilot_inline_comments_module,
233
- "fetch_copilot_reviews",
234
- return_value=[
235
- {
236
- "review_id": 1,
237
- "commit_id": "other_sha",
238
- "submitted_at": "2026-01-01T00:00:00Z",
239
- "state": "APPROVED",
240
- "body": "",
241
- "classification": "clean",
242
- }
243
- ],
244
- ),
245
- patch("subprocess.run") as mock_run,
246
- ):
247
- all_inline_comments = (
248
- fetch_copilot_inline_comments_module.fetch_copilot_inline_comments(
249
- owner="acme", repo="widget", number=42, current_head="missing_sha"
250
- )
251
- )
252
- assert all_inline_comments == []
253
- mock_run.assert_not_called()
254
-
255
-
256
- def test_should_flatten_across_pages() -> None:
257
- pages_payload = json.dumps(
258
- [
259
- [
260
- {
261
- "id": 1,
262
- "user": {"login": "copilot-pull-request-reviewer[bot]"},
263
- "commit_id": "abc",
264
- "pull_request_review_id": 9,
265
- "body": "a",
266
- "path": "f.py",
267
- "line": 1,
268
- }
269
- ],
270
- [
271
- {
272
- "id": 2,
273
- "user": {"login": "copilot-pull-request-reviewer[bot]"},
274
- "commit_id": "abc",
275
- "pull_request_review_id": 9,
276
- "body": "b",
277
- "path": "f.py",
278
- "line": 2,
279
- },
280
- {
281
- "id": 3,
282
- "user": {"login": "copilot-pull-request-reviewer[bot]"},
283
- "commit_id": "abc",
284
- "pull_request_review_id": 9,
285
- "body": "c",
286
- "path": "f.py",
287
- "line": 3,
288
- },
289
- ],
290
- ]
291
- )
292
- with (
293
- patch.object(
294
- fetch_copilot_inline_comments_module,
295
- "fetch_copilot_reviews",
296
- return_value=_default_review_for_head(commit="abc", review_id=9),
297
- ),
298
- patch("subprocess.run") as mock_run,
299
- ):
300
- mock_run.return_value = _completed(pages_payload)
301
- all_inline_comments = (
302
- fetch_copilot_inline_comments_module.fetch_copilot_inline_comments(
303
- owner="acme", repo="widget", number=42, current_head="abc"
304
- )
305
- )
306
- assert [each_comment["comment_id"] for each_comment in all_inline_comments] == [
307
- 1,
308
- 2,
309
- 3,
310
- ]
311
-
312
-
313
- def test_should_match_login_case_insensitively() -> None:
314
- pages_payload = json.dumps(
315
- [
316
- [
317
- {
318
- "id": 300,
319
- "user": {"login": "Copilot"},
320
- "commit_id": "abc123",
321
- "pull_request_review_id": 1,
322
- "body": "uppercase login",
323
- "path": "x.py",
324
- "line": 5,
325
- },
326
- {
327
- "id": 301,
328
- "user": {"login": "GITHUB-COPILOT[bot]"},
329
- "commit_id": "abc123",
330
- "pull_request_review_id": 1,
331
- "body": "screaming login",
332
- "path": "x.py",
333
- "line": 6,
334
- },
335
- ]
336
- ]
337
- )
338
- with (
339
- patch.object(
340
- fetch_copilot_inline_comments_module,
341
- "fetch_copilot_reviews",
342
- return_value=_default_review_for_head(commit="abc123", review_id=1),
343
- ),
344
- patch("subprocess.run") as mock_run,
345
- ):
346
- mock_run.return_value = _completed(pages_payload)
347
- all_inline_comments = (
348
- fetch_copilot_inline_comments_module.fetch_copilot_inline_comments(
349
- owner="acme", repo="widget", number=42, current_head="abc123"
350
- )
351
- )
352
- assert {each_comment["comment_id"] for each_comment in all_inline_comments} == {300, 301}
353
-
354
-
355
- def test_should_match_login_containing_copilot_substring() -> None:
356
- pages_payload = json.dumps(
357
- [
358
- [
359
- {
360
- "id": 400,
361
- "user": {"login": "internal-copilot-fork[bot]"},
362
- "commit_id": "abc123",
363
- "pull_request_review_id": 1,
364
- "body": "non-canonical login still matches",
365
- "path": "x.py",
366
- "line": 5,
367
- }
368
- ]
369
- ]
370
- )
371
- with (
372
- patch.object(
373
- fetch_copilot_inline_comments_module,
374
- "fetch_copilot_reviews",
375
- return_value=_default_review_for_head(commit="abc123", review_id=1),
376
- ),
377
- patch("subprocess.run") as mock_run,
378
- ):
379
- mock_run.return_value = _completed(pages_payload)
380
- all_inline_comments = (
381
- fetch_copilot_inline_comments_module.fetch_copilot_inline_comments(
382
- owner="acme", repo="widget", number=42, current_head="abc123"
383
- )
384
- )
385
- assert len(all_inline_comments) == 1
386
- assert all_inline_comments[0]["comment_id"] == 400
387
-
388
-
389
- def test_should_raise_when_gh_subprocess_fails() -> None:
390
- failure = subprocess.CalledProcessError(
391
- returncode=1, cmd=["gh"], stderr="auth failure"
392
- )
393
- with (
394
- patch.object(
395
- fetch_copilot_inline_comments_module,
396
- "fetch_copilot_reviews",
397
- return_value=_default_review_for_head(commit="abc", review_id=1),
398
- ),
399
- patch("subprocess.run", side_effect=failure),
400
- ):
401
- with pytest.raises(subprocess.CalledProcessError):
402
- fetch_copilot_inline_comments_module.fetch_copilot_inline_comments(
403
- owner="acme", repo="widget", number=42, current_head="abc"
404
- )
405
-
406
-
407
- def test_should_return_entries_whose_keys_are_strings() -> None:
408
- pages_payload = json.dumps(
409
- [
410
- [
411
- {
412
- "id": 101,
413
- "user": {"login": "copilot-pull-request-reviewer[bot]"},
414
- "commit_id": "abc123",
415
- "pull_request_review_id": 1,
416
- "body": "copilot finding",
417
- "path": "x.py",
418
- "line": 6,
419
- }
420
- ]
421
- ]
422
- )
423
- with (
424
- patch.object(
425
- fetch_copilot_inline_comments_module,
426
- "fetch_copilot_reviews",
427
- return_value=_default_review_for_head(commit="abc123", review_id=1),
428
- ),
429
- patch("subprocess.run") as mock_run,
430
- ):
431
- mock_run.return_value = _completed(pages_payload)
432
- all_inline_comments = (
433
- fetch_copilot_inline_comments_module.fetch_copilot_inline_comments(
434
- owner="acme", repo="widget", number=42, current_head="abc123"
435
- )
436
- )
437
- assert len(all_inline_comments) == 1
438
- first_comment_entry = all_inline_comments[0]
439
- assert isinstance(first_comment_entry, dict)
440
- assert all(isinstance(each_key, str) for each_key in first_comment_entry.keys())