claude-dev-env 1.38.0 → 1.39.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 (271) hide show
  1. package/CLAUDE.md +10 -36
  2. package/_shared/pr-loop/audit-reply-template.md +147 -0
  3. package/_shared/pr-loop/fix-protocol.md +25 -4
  4. package/_shared/pr-loop/gh-payloads.md +37 -50
  5. package/_shared/pr-loop/scripts/code_rules_gate.py +0 -60
  6. package/_shared/pr-loop/scripts/config/post_audit_thread_constants.py +189 -0
  7. package/_shared/pr-loop/scripts/post_audit_thread.py +947 -0
  8. package/_shared/pr-loop/scripts/tests/test_code_rules_gate.py +0 -19
  9. package/_shared/pr-loop/scripts/tests/test_post_audit_thread.py +923 -0
  10. package/_shared/pr-loop/scripts/tests/test_post_audit_thread_constants.py +127 -0
  11. package/_shared/pr-loop/state-schema.md +1 -1
  12. package/agents/clean-coder.md +2 -2
  13. package/bin/install.mjs +6 -7
  14. package/bin/install.test.mjs +8 -0
  15. package/commands/doc-gist.md +16 -0
  16. package/commands/plan.md +0 -2
  17. package/commands/review-plan.md +1 -1
  18. package/docs/CODE_RULES.md +122 -2
  19. package/hooks/blocking/bot_mention_comment_blocker.py +75 -0
  20. package/hooks/blocking/code_rules_enforcer.py +1236 -161
  21. package/hooks/blocking/convergence_gate_blocker.py +130 -0
  22. package/hooks/blocking/destructive_command_blocker.py +74 -0
  23. package/hooks/blocking/gh_body_arg_blocker.py +30 -0
  24. package/hooks/blocking/md_to_html_blocker.py +119 -0
  25. package/hooks/blocking/test_bot_mention_comment_blocker.py +131 -0
  26. package/hooks/blocking/test_code_rules_enforcer.py +21 -0
  27. package/hooks/blocking/test_code_rules_enforcer_any_exempt_files.py +70 -0
  28. package/hooks/blocking/test_code_rules_enforcer_any_imports_and_cast.py +92 -0
  29. package/hooks/blocking/test_code_rules_enforcer_banned_import_alias.py +143 -0
  30. package/hooks/blocking/test_code_rules_enforcer_banned_prefixes.py +152 -0
  31. package/hooks/blocking/test_code_rules_enforcer_bare_except.py +120 -0
  32. package/hooks/blocking/test_code_rules_enforcer_boundary_types.py +175 -0
  33. package/hooks/blocking/test_code_rules_enforcer_cap_meta.py +0 -1
  34. package/hooks/blocking/test_code_rules_enforcer_collection_prefix.py +50 -0
  35. package/hooks/blocking/test_code_rules_enforcer_docstring_format.py +255 -0
  36. package/hooks/blocking/test_code_rules_enforcer_inline_tuple_string_magic.py +130 -0
  37. package/hooks/blocking/test_code_rules_enforcer_stub_implementations.py +141 -0
  38. package/hooks/blocking/test_code_rules_enforcer_test_branching.py +143 -0
  39. package/hooks/blocking/test_code_rules_enforcer_thin_wrapper_files.py +169 -0
  40. package/hooks/blocking/test_code_rules_enforcer_todo_markers.py +99 -0
  41. package/hooks/blocking/test_code_rules_enforcer_typed_dict_pairs.py +141 -0
  42. package/hooks/blocking/test_code_rules_enforcer_unused_imports.py +158 -0
  43. package/hooks/blocking/test_convergence_gate_blocker.py +63 -0
  44. package/hooks/blocking/test_destructive_command_blocker.py +146 -0
  45. package/hooks/blocking/test_destructive_command_blocker_no_verify.py +102 -0
  46. package/hooks/blocking/test_gh_body_arg_blocker.py +45 -0
  47. package/hooks/blocking/test_md_to_html_blocker.py +317 -0
  48. package/hooks/config/any_type_config.py +7 -0
  49. package/hooks/config/banned_identifiers_constants.py +11 -0
  50. package/hooks/config/blocking_check_limits.py +38 -0
  51. package/hooks/config/bot_mention_comment_blocker_constants.py +20 -0
  52. package/hooks/config/code_rules_enforcer_constants.py +53 -0
  53. package/hooks/config/convergence_branch_constants.py +9 -0
  54. package/hooks/config/doc_gist_auto_publish_constants.py +18 -0
  55. package/hooks/config/html_companion_constants.py +20 -0
  56. package/hooks/config/inline_tuple_string_magic_constants.py +22 -0
  57. package/hooks/config/test_banned_identifiers_constants.py +17 -0
  58. package/hooks/hooks.json +28 -20
  59. package/hooks/pyproject.toml +69 -0
  60. package/hooks/validators/mypy_integration.py +47 -1
  61. package/hooks/validators/run_all_validators.py +3 -3
  62. package/hooks/validators/test_mypy_integration.py +50 -1
  63. package/hooks/workflow/doc_gist_auto_publish.py +144 -0
  64. package/hooks/workflow/md_to_html_companion.py +365 -0
  65. package/hooks/workflow/test_doc_gist_auto_publish.py +117 -0
  66. package/hooks/workflow/test_md_to_html_companion.py +452 -0
  67. package/package.json +1 -1
  68. package/rules/gh-body-file.md +2 -0
  69. package/scripts/Install-SweepEmptyDirs.ps1 +111 -0
  70. package/scripts/check.ps1 +106 -0
  71. package/scripts/config/timing.py +11 -0
  72. package/scripts/sweep_empty_dirs.py +138 -0
  73. package/scripts/sync_to_cursor/rules.py +1 -1
  74. package/scripts/test_sweep_empty_dirs.py +183 -0
  75. package/skills/_shared/pr-loop/prompts/pr-consistency-audit.xml +323 -0
  76. package/skills/_shared/pr-loop/scripts/_cli_utils.py +22 -0
  77. package/skills/_shared/pr-loop/scripts/_path_resolver.py +165 -0
  78. package/skills/_shared/pr-loop/scripts/_xml_utils.py +20 -0
  79. package/skills/_shared/pr-loop/scripts/build_audit_prompt.py +182 -0
  80. package/skills/_shared/pr-loop/scripts/build_fix_prompt.py +185 -0
  81. package/skills/_shared/pr-loop/scripts/config/__init__.py +0 -0
  82. package/skills/_shared/pr-loop/scripts/config/path_resolver_constants.py +78 -0
  83. package/skills/_shared/pr-loop/scripts/init_loop_state.py +135 -0
  84. package/skills/_shared/pr-loop/scripts/teardown_worktrees.py +175 -0
  85. package/skills/_shared/pr-loop/scripts/write_audit_outcomes.py +182 -0
  86. package/skills/_shared/pr-loop/scripts/write_fix_outcomes.py +206 -0
  87. package/skills/bugteam/CONSTRAINTS.md +21 -22
  88. package/skills/bugteam/EXAMPLES.md +3 -3
  89. package/skills/bugteam/PROMPTS.md +227 -67
  90. package/skills/bugteam/SKILL.md +114 -455
  91. package/skills/bugteam/reference/README.md +1 -1
  92. package/skills/bugteam/reference/audit-and-teammates.md +112 -39
  93. package/skills/bugteam/reference/audit-contract.md +4 -22
  94. package/skills/bugteam/reference/copilot-gap-analysis.md +8 -5
  95. package/skills/bugteam/reference/design-rationale.md +2 -2
  96. package/skills/bugteam/reference/github-pr-reviews.md +50 -57
  97. package/skills/bugteam/reference/obstacles/audit-assign-ids.md +13 -0
  98. package/skills/bugteam/reference/obstacles/audit-capture-excerpts.md +13 -0
  99. package/skills/bugteam/reference/obstacles/audit-walk-categories.md +13 -0
  100. package/skills/bugteam/reference/obstacles/audit-write-xml.md +13 -0
  101. package/skills/bugteam/reference/obstacles/fix-append-summary.md +13 -0
  102. package/skills/bugteam/reference/obstacles/fix-apply-fixes.md +13 -0
  103. package/skills/bugteam/reference/obstacles/fix-git-add-commit.md +13 -0
  104. package/skills/bugteam/reference/obstacles/fix-git-push.md +13 -0
  105. package/skills/bugteam/reference/obstacles/fix-post-reply.md +13 -0
  106. package/skills/bugteam/reference/obstacles/fix-publish-summary.md +13 -0
  107. package/skills/bugteam/reference/obstacles/fix-py-compile.md +13 -0
  108. package/skills/bugteam/reference/obstacles/fix-read-files.md +13 -0
  109. package/skills/bugteam/reference/obstacles/fix-resolve-thread.md +13 -0
  110. package/skills/bugteam/reference/obstacles/fix-test-suite.md +13 -0
  111. package/skills/bugteam/reference/obstacles/fix-violation-count.md +13 -0
  112. package/skills/bugteam/reference/obstacles/fix-write-xml.md +13 -0
  113. package/skills/bugteam/reference/team-setup.md +106 -9
  114. package/skills/bugteam/reference/teardown-publish-permissions.md +39 -8
  115. package/skills/bugteam/scripts/README.md +60 -0
  116. package/skills/bugteam/scripts/_claude_permissions_common.py +358 -0
  117. package/skills/bugteam/scripts/bugteam_code_rules_gate.py +976 -0
  118. package/skills/bugteam/scripts/bugteam_fix_hookspath.py +375 -0
  119. package/skills/bugteam/scripts/bugteam_preflight.py +294 -0
  120. package/skills/bugteam/scripts/config/bugteam_code_rules_gate_constants.py +25 -0
  121. package/skills/bugteam/scripts/config/bugteam_fix_hookspath_constants.py +26 -0
  122. package/skills/bugteam/scripts/config/bugteam_preflight_constants.py +35 -0
  123. package/skills/bugteam/scripts/config/claude_permissions_common_constants.py +20 -0
  124. package/skills/bugteam/scripts/config/probe_code_rules_enforcer_check_constants.py +12 -0
  125. package/skills/bugteam/scripts/config/windows_safe_rmtree_constants.py +7 -0
  126. package/skills/bugteam/scripts/grant_project_claude_permissions.py +175 -0
  127. package/skills/bugteam/scripts/probe_code_rules_enforcer_check.py +107 -0
  128. package/skills/bugteam/scripts/revoke_project_claude_permissions.py +220 -0
  129. package/skills/bugteam/scripts/test__claude_permissions_common.py +112 -0
  130. package/skills/bugteam/scripts/test_bugteam_code_rules_gate.py +400 -0
  131. package/skills/bugteam/scripts/test_bugteam_fix_hookspath.py +384 -0
  132. package/skills/bugteam/scripts/test_bugteam_preflight.py +268 -0
  133. package/skills/bugteam/scripts/test_claude_permissions_common.py +195 -0
  134. package/skills/bugteam/scripts/test_grant_project_claude_permissions.py +55 -0
  135. package/skills/bugteam/scripts/test_probe_code_rules_enforcer_check.py +76 -0
  136. package/skills/bugteam/scripts/test_revoke_project_claude_permissions.py +55 -0
  137. package/skills/bugteam/scripts/test_windows_safe_rmtree.py +108 -0
  138. package/skills/bugteam/scripts/windows_safe_rmtree.py +100 -0
  139. package/skills/bugteam/test_skill_additions.py +1 -11
  140. package/skills/code/SKILL.md +176 -0
  141. package/skills/doc-gist/SKILL.md +99 -0
  142. package/skills/doc-gist/references/examples/01-exploration-code-approaches.html +453 -0
  143. package/skills/doc-gist/references/examples/02-exploration-visual-designs.html +515 -0
  144. package/skills/doc-gist/references/examples/03-code-review-pr.html +638 -0
  145. package/skills/doc-gist/references/examples/04-code-understanding.html +491 -0
  146. package/skills/doc-gist/references/examples/05-design-system.html +629 -0
  147. package/skills/doc-gist/references/examples/06-component-variants.html +605 -0
  148. package/skills/doc-gist/references/examples/07-prototype-animation.html +455 -0
  149. package/skills/doc-gist/references/examples/08-prototype-interaction.html +396 -0
  150. package/skills/doc-gist/references/examples/09-slide-deck.html +592 -0
  151. package/skills/doc-gist/references/examples/10-svg-illustrations.html +492 -0
  152. package/skills/doc-gist/references/examples/11-status-report.html +528 -0
  153. package/skills/doc-gist/references/examples/12-incident-report.html +596 -0
  154. package/skills/doc-gist/references/examples/13-flowchart-diagram.html +395 -0
  155. package/skills/doc-gist/references/examples/14-research-feature-explainer.html +381 -0
  156. package/skills/doc-gist/references/examples/15-research-concept-explainer.html +368 -0
  157. package/skills/doc-gist/references/examples/16-implementation-plan.html +702 -0
  158. package/skills/doc-gist/references/examples/17-pr-writeup.html +595 -0
  159. package/skills/doc-gist/references/examples/18-editor-triage-board.html +573 -0
  160. package/skills/doc-gist/references/examples/19-editor-feature-flags.html +663 -0
  161. package/skills/doc-gist/references/examples/20-editor-prompt-tuner.html +722 -0
  162. package/skills/doc-gist/references/examples/README.md +5 -0
  163. package/skills/doc-gist/scripts/config/__init__.py +0 -0
  164. package/skills/doc-gist/scripts/config/gist_upload_constants.py +16 -0
  165. package/skills/doc-gist/scripts/gist_upload.py +177 -0
  166. package/skills/doc-gist/scripts/test_gist_upload.py +51 -0
  167. package/skills/findbugs/SKILL.md +68 -2
  168. package/skills/monitor-open-prs/SKILL.md +13 -32
  169. package/skills/monitor-open-prs/test_skill_contract.py +0 -11
  170. package/skills/pr-consistency-audit/SKILL.md +112 -0
  171. package/skills/pr-consistency-audit/reference/detection-rules.md +96 -0
  172. package/skills/pr-consistency-audit/reference/illustrations.md +78 -0
  173. package/skills/pr-converge/SKILL.md +227 -23
  174. package/skills/pr-converge/config/__init__.py +0 -0
  175. package/skills/pr-converge/config/constants.py +62 -0
  176. package/skills/pr-converge/reference/convergence-gates.md +138 -44
  177. package/skills/pr-converge/reference/examples.md +43 -11
  178. package/skills/pr-converge/reference/fix-protocol.md +6 -5
  179. package/skills/pr-converge/reference/ground-rules.md +5 -3
  180. package/skills/pr-converge/reference/multi-pr-orchestration.md +44 -19
  181. package/skills/pr-converge/reference/obstacles/fix-post-replies.md +13 -0
  182. package/skills/pr-converge/reference/obstacles/fix-publish-summary.md +13 -0
  183. package/skills/pr-converge/reference/obstacles/fix-push.md +13 -0
  184. package/skills/pr-converge/reference/obstacles/fix-read-filelines.md +13 -0
  185. package/skills/pr-converge/reference/obstacles/fix-reset-state.md +13 -0
  186. package/skills/pr-converge/reference/obstacles/fix-resolve-threads.md +13 -0
  187. package/skills/pr-converge/reference/obstacles/fix-spawn-clean-coder.md +13 -0
  188. package/skills/pr-converge/reference/obstacles/fix-stage-commit.md +13 -0
  189. package/skills/pr-converge/reference/obstacles/fix-trigger-bugbot.md +13 -0
  190. package/skills/pr-converge/reference/obstacles/fix-write-test.md +13 -0
  191. package/skills/pr-converge/reference/per-tick.md +90 -31
  192. package/skills/pr-converge/reference/state-schema.md +22 -1
  193. package/skills/pr-converge/reference/stop-conditions.md +9 -7
  194. package/skills/pr-converge/scripts/README.md +34 -46
  195. package/skills/pr-converge/scripts/check_bugbot_ci.py +174 -0
  196. package/skills/pr-converge/scripts/check_convergence.py +497 -0
  197. package/skills/pr-converge/scripts/check_pending_reviews.py +154 -0
  198. package/skills/pr-converge/scripts/config/pr_converge_constants.py +118 -0
  199. package/skills/pr-converge/scripts/fetch_copilot_reviews.py +134 -0
  200. package/skills/pr-converge/scripts/post_fix_reply.py +168 -0
  201. package/skills/pr-converge/workflows/schedule-wakeup-loop.md +5 -12
  202. package/skills/qbug/SKILL.md +132 -27
  203. package/skills/session-log/SKILL.md +216 -114
  204. package/skills/session-tidy/SKILL.md +1 -1
  205. package/skills/skill-builder/SKILL.md +138 -56
  206. package/skills/skill-builder/references/delegation-map.md +72 -113
  207. package/skills/skill-builder/references/progressive-disclosure.md +122 -0
  208. package/skills/skill-builder/references/self-audit-checklist.md +92 -0
  209. package/skills/skill-builder/references/skill-types.md +228 -0
  210. package/skills/skill-builder/references/thariq-x-post-skills.json +33 -0
  211. package/skills/skill-builder/templates/gap-analysis.md +15 -8
  212. package/skills/skill-builder/workflows/improve-skill.md +86 -57
  213. package/skills/skill-builder/workflows/new-skill.md +80 -168
  214. package/skills/skill-builder/workflows/polish-skill.md +78 -54
  215. package/skills/structure-prompt/SKILL.md +50 -0
  216. package/skills/structure-prompt/reference/adversarial-tuning.md +62 -0
  217. package/skills/structure-prompt/reference/block-classification.md +27 -0
  218. package/skills/structure-prompt/reference/canonical-case.md +48 -0
  219. package/skills/structure-prompt/reference/citation-depth.md +70 -0
  220. package/skills/structure-prompt/reference/cleanup.md +33 -0
  221. package/skills/structure-prompt/reference/constraints.md +33 -0
  222. package/skills/structure-prompt/reference/directives.md +37 -0
  223. package/skills/structure-prompt/reference/examples.md +72 -0
  224. package/skills/structure-prompt/reference/instantiation.md +51 -0
  225. package/skills/structure-prompt/reference/output-contract.md +72 -0
  226. package/skills/structure-prompt/reference/per-category.md +23 -0
  227. package/skills/structure-prompt/reference/persona.md +38 -0
  228. package/skills/structure-prompt/reference/research.md +33 -0
  229. package/skills/structure-prompt/reference/structure.md +28 -0
  230. package/agents/code-standards-agent.md +0 -93
  231. package/agents/groq-coder.md +0 -113
  232. package/agents/plan-executor.md +0 -226
  233. package/agents/project-docs-analyzer.md +0 -53
  234. package/agents/project-structure-organizer-agent.md +0 -72
  235. package/agents/skill-to-agent-converter.md +0 -370
  236. package/agents/skill-writer-agent.md +0 -470
  237. package/agents/user-docs-writer.md +0 -67
  238. package/agents/workflow-visual-documenter.md +0 -82
  239. package/commands/readability-review.md +0 -20
  240. package/hooks/mypy.ini +0 -2
  241. package/hooks/notification/attention_needed_notify.py +0 -71
  242. package/hooks/notification/claude_notification_handler.py +0 -67
  243. package/hooks/notification/notification_utils.py +0 -267
  244. package/hooks/notification/subagent_complete_notify.py +0 -381
  245. package/hooks/notification/test_attention_needed_notify.py +0 -47
  246. package/hooks/notification/test_claude_notification_handler.py +0 -54
  247. package/hooks/notification/test_notification_utils.py +0 -91
  248. package/hooks/notification/test_subagent_complete_notify.py +0 -79
  249. package/scripts/config/groq_bugteam_config.py +0 -230
  250. package/scripts/config/test_groq_bugteam_config.py +0 -83
  251. package/scripts/config/test_spec_implementer_prompt.py +0 -32
  252. package/scripts/groq_bugteam.README.md +0 -131
  253. package/scripts/groq_bugteam.py +0 -647
  254. package/scripts/groq_bugteam_dotenv.py +0 -40
  255. package/scripts/groq_bugteam_spec.py +0 -226
  256. package/scripts/test_groq_bugteam.py +0 -529
  257. package/scripts/test_groq_bugteam_apply_fix_from_spec.py +0 -426
  258. package/scripts/test_groq_bugteam_dotenv.py +0 -66
  259. package/scripts/test_groq_bugteam_spec.py +0 -338
  260. package/skills/bugteam/SKILL_EVALS.md +0 -309
  261. package/skills/dream/SKILL.md +0 -118
  262. package/skills/ingest/SKILL.md +0 -40
  263. package/skills/npm-creator/SKILL.md +0 -187
  264. package/skills/readability-review/SKILL.md +0 -127
  265. package/skills/resume-review/SKILL.md +0 -261
  266. package/skills/rule-audit/SKILL.md +0 -307
  267. package/skills/rule-creator/SKILL.md +0 -150
  268. package/skills/searching-obsidian-vault/SKILL.md +0 -131
  269. package/skills/skill-writer/REFERENCE.md +0 -284
  270. package/skills/skill-writer/SKILL.md +0 -222
  271. package/skills/tdd-team/SKILL.md +0 -128
@@ -0,0 +1,13 @@
1
+ # py_compile
2
+
3
+ Run py_compile or language-equivalent on every modified file
4
+
5
+ ## Self-population
6
+
7
+ Hit a wall on this step? Spawn a background agent to record it. Keep working.
8
+
9
+ 1. Spawn — brief it: check for an open PR touching this file, add a commit to it, or create a fresh branch + worktree + draft PR.
10
+ 2. Tell the agent your obstacle and what fixed it. It writes the entry below.
11
+
12
+ ## Obstacles
13
+
@@ -0,0 +1,13 @@
1
+ # Read files
2
+
3
+ Read each referenced file before editing
4
+
5
+ ## Self-population
6
+
7
+ Hit a wall on this step? Spawn a background agent to record it. Keep working.
8
+
9
+ 1. Spawn — brief it: check for an open PR touching this file, add a commit to it, or create a fresh branch + worktree + draft PR.
10
+ 2. Tell the agent your obstacle and what fixed it. It writes the entry below.
11
+
12
+ ## Obstacles
13
+
@@ -0,0 +1,13 @@
1
+ # Resolve threads
2
+
3
+ Resolve each thread via pull_request_review_write resolve_thread using thread_node_id
4
+
5
+ ## Self-population
6
+
7
+ Hit a wall on this step? Spawn a background agent to record it. Keep working.
8
+
9
+ 1. Spawn — brief it: check for an open PR touching this file, add a commit to it, or create a fresh branch + worktree + draft PR.
10
+ 2. Tell the agent your obstacle and what fixed it. It writes the entry below.
11
+
12
+ ## Obstacles
13
+
@@ -0,0 +1,13 @@
1
+ # Test suite
2
+
3
+ Run test suite, diagnose and fix regressions before committing
4
+
5
+ ## Self-population
6
+
7
+ Hit a wall on this step? Spawn a background agent to record it. Keep working.
8
+
9
+ 1. Spawn — brief it: check for an open PR touching this file, add a commit to it, or create a fresh branch + worktree + draft PR.
10
+ 2. Tell the agent your obstacle and what fixed it. It writes the entry below.
11
+
12
+ ## Obstacles
13
+
@@ -0,0 +1,13 @@
1
+ # Violation count
2
+
3
+ Post-fix violation count must not exceed previous loop total
4
+
5
+ ## Self-population
6
+
7
+ Hit a wall on this step? Spawn a background agent to record it. Keep working.
8
+
9
+ 1. Spawn — brief it: check for an open PR touching this file, add a commit to it, or create a fresh branch + worktree + draft PR.
10
+ 2. Tell the agent your obstacle and what fixed it. It writes the entry below.
11
+
12
+ ## Obstacles
13
+
@@ -0,0 +1,13 @@
1
+ # Write fix outcomes
2
+
3
+ Write fix outcomes XML to worktree path with reply IDs, resolution status
4
+
5
+ ## Self-population
6
+
7
+ Hit a wall on this step? Spawn a background agent to record it. Keep working.
8
+
9
+ 1. Spawn — brief it: check for an open PR touching this file, add a commit to it, or create a fresh branch + worktree + draft PR.
10
+ 2. Tell the agent your obstacle and what fixed it. It writes the entry below.
11
+
12
+ ## Obstacles
13
+
@@ -1,8 +1,48 @@
1
1
  # Run setup and loop state
2
2
 
3
+ ## Pre-flight (before Step 0)
4
+
5
+ ### Utility scripts
6
+
7
+ Bugteam-specific utilities (preflight, fix_hookspath, grant, revoke) live in
8
+ the skill-local [`scripts/`](../scripts/) directory. Shared utilities remain in
9
+ [`_shared/pr-loop/scripts/`](../../_shared/pr-loop/scripts/) (run, do not paste
10
+ into context). Utility scripts are **executed**, not loaded as primary context
11
+ ([`sources.md`](sources.md) § Progressive disclosure and utility scripts).
12
+
13
+ ```bash
14
+ python "${CLAUDE_SKILL_DIR}/scripts/bugteam_preflight.py"
15
+ ```
16
+
17
+ Non-zero → fix before grant. `BUGTEAM_PREFLIGHT_SKIP=1` emergency only.
18
+ `--pre-commit` if `.pre-commit-config.yaml` exists.
19
+
20
+ **Auto-remediation for `core.hooksPath`:** when preflight fails with stderr
21
+ containing `core.hooksPath` (the message starts with `bugteam_preflight:
22
+ core.hooksPath is`, or `Git-side CODE_RULES enforcement is not active`), Claude
23
+ must auto-invoke the fix script — do not fall through to `AskUserQuestion`, do
24
+ not punt to the user, do not ask for confirmation:
25
+
26
+ ```bash
27
+ python "${CLAUDE_SKILL_DIR}/scripts/bugteam_fix_hookspath.py"
28
+ ```
29
+
30
+ The fix script removes any non-canonical local-scope override on the active
31
+ repository, sets the global `core.hooksPath` to `~/.claude/hooks/git-hooks` if
32
+ missing or wrong, and re-runs `bugteam_preflight.py`. Its exit code becomes the
33
+ preflight outcome. Exit 0 → continue to Step 0. Non-zero only when the
34
+ canonical hooks directory is missing (run `npx claude-dev-env .` first) or
35
+ `git config --global` writes are blocked. Other preflight failures (pytest,
36
+ pre-commit) still require manual fixes —
37
+ the auto-remediation only applies to the `core.hooksPath` failure mode.
38
+
3
39
  ## Step 0 — Grant project permissions (detail)
4
40
 
5
- Before spawning any subagents, grant the session write access to the projects `.claude/**` tree. Command in `SKILL.md`.
41
+ Before spawning any subagents, grant the session write access to the project's `.claude/**` tree:
42
+
43
+ ```bash
44
+ python "${CLAUDE_SKILL_DIR}/scripts/grant_project_claude_permissions.py"
45
+ ```
6
46
 
7
47
  `${CLAUDE_SKILL_DIR}` is a Claude Code host-managed token, pre-substituted by the runtime before any shell sees it. Unlike `${TMPDIR}` and similar shell parameter expansions, it does not depend on the shell’s expansion semantics, so it behaves the same on Unix and Windows shells.
8
48
 
@@ -14,21 +54,45 @@ This is the **first** action of every `/bugteam` invocation, before any subagent
14
54
 
15
55
  Same resolution path as `/findbugs`:
16
56
 
17
- 1. `pull_request_read(method="get", pullNumber=N, owner=O, repo=R)` extracts `number`, `baseRefName`, `headRefName`, `url` from response (`N` comes from the parent skill's PR context, or fall back to `pull_request_read` with the default branch lookup to recover the PR number).
57
+ 1. Call `pull_request_read(method="get", pullNumber=N, owner=O, repo=R)` to fetch PR metadata; capture `number`, `headRefName`, `baseRefName`, and `url` from the response. Falls back to the merge-base diff path when no PR exists.
18
58
  2. Fall back to `git merge-base HEAD origin/<default>` then `git diff <merge-base>...HEAD`.
19
59
  3. Neither → refuse per refusal cases in `SKILL.md`.
20
60
 
21
61
  Capture `<owner>/<repo>`, head branch, base branch, PR number, PR URL. This scope persists across every loop — `/bugteam` runs to completion from the single up-front confirmation.
22
62
 
23
- ## Step 2 Run name and temp directory (detail)
63
+ For multi-PR invocations, capture `all_prs = [{number, owner, repo, baseRef, headRef, url}, ...]`. A single-PR invocation produces a one-element list and follows the same downstream rules.
24
64
 
25
- ### Run specification
65
+ ### Per-PR workspace
26
66
 
27
- - **Run name:** `bugteam-pr-<number>-<YYYYMMDDHHMMSS>` for single-PR invocations, `bugteam-<YYYYMMDDHHMMSS>` for multi-PR invocations (or `bugteam-<sanitized-head-branch>-<YYYYMMDDHHMMSS>` if no PR). The timestamp is captured once at invocation start and prevents two concurrent invocations on the same PR from colliding.
67
+ For each PR in `all_prs`:
28
68
 
29
- - **Branch-name sanitization (no-PR fallback only):** Before substituting `<head-branch>` into the `run_name` template, replace every character outside `[A-Za-z0-9._-]` with `-`. The whitelist keeps safe portable filename characters only; OS-reserved and shell-special characters (`/ \ : * ? < > | "` plus ASCII control characters `0x00`–`0x1F`) fall outside the whitelist and become `-`. Example: `feat/foo*bar` → `feat-foo-bar`; `run_name` becomes `bugteam-feat-foo-bar-<YYYYMMDDHHMMSS>`. Apply sanitization when `run_name` is first assembled so every downstream use (temp dir, cleanup) sees the safe form.
69
+ Canonical path functions live in
70
+ [`_shared/pr-loop/scripts/_path_resolver.py`](../../_shared/pr-loop/scripts/_path_resolver.py):
71
+ `per_pr_workspace(run_temp_dir, owner, repo, pr_number)` returns dict with keys
72
+ `worktree`, `diff_patch_template`, `outcome_xml_template`, `fix_outcome_xml_template`.
30
73
 
31
- - **Per-run temp directory (resolved once, reused everywhere):** After `run_name` is captured, resolve a portable absolute path: `Path(tempfile.gettempdir()) / run_name` (requires `import tempfile`). `tempfile.gettempdir()` honors `TMPDIR`, `TEMP`, and `TMP` in platform-correct order and falls back to `C:\Users\<user>\AppData\Local\Temp` on Windows or `/tmp` on Unix. Capture the resolved absolute path as `<run_temp_dir>` and pass that literal path to every shell command that follows.
74
+ 1. Create `<run_temp_dir>/pr-<N>/`.
75
+ 2. Run `git worktree add "<run_temp_dir>/pr-<N>/worktree" origin/<headRef>`.
76
+ 3. Record the absolute worktree path alongside the PR's other fields.
77
+
78
+ Background subagents for a PR operate inside that PR's worktree. Step 4 teardown
79
+ runs [`teardown_worktrees.py`](../../_shared/pr-loop/scripts/teardown_worktrees.py)
80
+ for each PR before the shared `rmtree`.
81
+
82
+ ## Step 2 — Run name and temp directory (detail)
83
+
84
+ Canonical path resolution lives in
85
+ [`_shared/pr-loop/scripts/_path_resolver.py`](../../_shared/pr-loop/scripts/_path_resolver.py).
86
+ The functions below are its public API; the implementation is the single source of
87
+ truth.
88
+
89
+ - **Run name:** `build_run_name(pr_number, head_branch, *, is_multi_pr)` — returns
90
+ `bugteam-pr-<number>` for single-PR, `bugteam-<sanitized-head-branch>` for multi-PR.
91
+ - **Branch-name sanitization:** `sanitize_branch_name(head_branch)` — maps every
92
+ character outside `[A-Za-z0-9._-]` to `-`.
93
+ - **Per-run temp directory:** `resolve_run_temp_dir(run_name)` — returns
94
+ `Path(tempfile.gettempdir()) / run_name`. Capture the resolved absolute path as
95
+ `<run_temp_dir>` and pass that literal path to every shell command that follows.
32
96
 
33
97
  - **Subagent roles (spawned per loop, not at invocation start):**
34
98
  - `bugfind` — `code-quality-agent`, model opus (Opus 4.7 at default xhigh effort)
@@ -36,8 +100,41 @@ Capture `<owner>/<repo>`, head branch, base branch, PR number, PR URL. This scop
36
100
 
37
101
  ### Loop state block
38
102
 
39
- The block in `SKILL.md` mixes lead-internal variables and one shell command (`starting_sha`). Read it as instructions, not a single runnable script.
103
+ Loop state (lead; not a single script; per-PR): the variables below are tracked
104
+ independently for each PR in `all_prs`. Each PR has its own cycle, state, and
105
+ exit reason.
106
+
107
+ Create the initial state file with
108
+ [`init_loop_state.py`](../../_shared/pr-loop/scripts/init_loop_state.py):
109
+
110
+ ```
111
+ python scripts/init_loop_state.py --pr-number <N> --head-ref <ref> --starting-sha <SHA> [--is-multi-pr]
112
+ ```
113
+
114
+ Outputs the path to `<run_temp_dir>/pr-<N>/loop-state.json` with keys
115
+ `loop_count`, `last_action`, `last_findings`, `starting_sha`, `loop_comment_index`.
40
116
 
41
117
  **`loop_comment_index` scope (per-loop, not cross-loop):** Reset at the start of every AUDIT action, populated as finding comments are posted during AUDIT, consumed by the matching FIX action when it posts fix replies, and discarded after FIX completes. It does not persist across loops; each loop starts with an empty index and its own fresh set of comment URLs.
42
118
 
43
- Each entry: `{loop, finding_id, finding_comment_id, finding_comment_url, used_fallback, fix_status}`. Populated by AUDIT, consumed by FIX.
119
+ Shape: dict keyed by `finding_id`. Each value: `{finding_comment_id, finding_comment_url, thread_node_id, fix_status}` where `thread_node_id` is the PR review thread node id (`PRRT_kwDOxxx`) captured at audit time when calling `get_review_comments`, used by the FIX step's `resolve_thread` call. The loop number is implicit (the index resets at every AUDIT) so it does not repeat in each value. AUDIT populates `finding_comment_id`, `finding_comment_url`, and `thread_node_id` when it posts the per-loop review; FIX sets `fix_status` when its commit lands.
120
+
121
+ #### Multi-PR sub-team tracking
122
+
123
+ When `/bugteam` runs against multiple PRs across repos, each PR operates as a
124
+ logical sub-team within the master `bugteam` team. The PR identity token is
125
+ `{owner}/{repo}#{N}` (e.g. `jl-cmd/claude-code-config#422`). The slugified form
126
+ comes from `slugify_pr_identity(owner, repo, pr_number)` in
127
+ [`_path_resolver.py`](../../_shared/pr-loop/scripts/_path_resolver.py).
128
+
129
+ - **Teammate name:** `bugfind-{owner}-{repo}-pr{N}-loop{L}-{letter}`
130
+ - **Task subject:** `{owner}/{repo}#{N} audit {letter}`
131
+ - **Outcome XML:** `diff_patch_path(run_temp_dir, owner, repo, pr_number, loop_number)` from `_path_resolver.py`
132
+
133
+ The lead filters by the slugified prefix to group tasks and teammates by PR.
134
+ Self-claiming by task subject prefix keeps each teammate on its assigned PR.
135
+
136
+ ### --bugbot-retrigger flag
137
+
138
+ **`--bugbot-retrigger` flag:** when present, the FIX subagent posts a `bugbot
139
+ run` issue comment via the Step 2.5 issue-comments fallback endpoint after
140
+ every successful FIX push, to re-trigger Cursor's bugbot on the new commit.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Utility scripts (progressive disclosure)
4
4
 
5
- Fragile or repeatable shell sequences belong in `_shared/pr-loop/scripts/`. Anthropic: [Progressive disclosure patterns](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#progressive-disclosure-patterns) — utility scripts are **executed**, not loaded into context as primary reading. Script inventory and entry points: [`../../../_shared/pr-loop/scripts/README.md`](../../../_shared/pr-loop/scripts/README.md). Gate-only merge-base / diff semantics: [`../../../_shared/pr-loop/code-rules-gate.md`](../../../_shared/pr-loop/code-rules-gate.md).
5
+ Fragile or repeatable shell sequences belong in `_shared/pr-loop/scripts/`. Bugteam-specific scripts (e.g. revoke, see Step 5) live in the skill-local [`scripts/`](../scripts/) directory. Anthropic: [Progressive disclosure patterns](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#progressive-disclosure-patterns) — utility scripts are **executed**, not loaded into context as primary reading. Shared-script inventory: [`../../../_shared/pr-loop/scripts/README.md`](../../../_shared/pr-loop/scripts/README.md). Bugteam-script inventory: [`../scripts/README.md`](../scripts/README.md). Gate-only merge-base / diff semantics: [`../../../_shared/pr-loop/code-rules-gate.md`](../../../_shared/pr-loop/code-rules-gate.md).
6
6
 
7
7
  ### Pre-flight (recommended before Step 0)
8
8
 
@@ -12,7 +12,21 @@ From the repository root, run the command in `SKILL.md`. If the exit code is non
12
12
 
13
13
  When the cycle exits (any reason), run these steps in order from **this** session (the lead).
14
14
 
15
- 1. **Delete the per-run temp directory** using the Python one-liner in `SKILL.md` with the same literal `<run_temp_dir>` from Step 2. The one-liner uses an `onexc`/`onerror` handler that strips the Windows ReadOnly attribute and retries the failing syscall`ignore_errors=True` is unsafe on Windows because it silently swallows ReadOnly-attribute failures (see `~/.claude/rules/windows-filesystem-safe.md`).
15
+ 1. **Delete the team:** `TeamDelete` removes `~/.claude/teams/bugteam/` and `~/.claude/tasks/bugteam/`. Only at convergence/cap/stucknot between loops.
16
+
17
+ 2. Run [`teardown_worktrees.py`](../../_shared/pr-loop/scripts/teardown_worktrees.py)
18
+ to remove each PR's worktree (`git worktree remove`) and the run temp
19
+ directory (Windows-safe `shutil.rmtree`):
20
+
21
+ ```bash
22
+ python "${CLAUDE_SKILL_DIR}/../../_shared/pr-loop/scripts/teardown_worktrees.py" \
23
+ --run-temp-dir "<run_temp_dir>" \
24
+ --all-pr-jsons '<json array of {number, owner, repo}>'
25
+ ```
26
+
27
+ Tolerates already-removed worktrees and missing directories. Uses an
28
+ `onexc`/`onerror` handler for Windows ReadOnly attribute safety
29
+ (see `~/.claude/rules/windows-filesystem-safe.md`).
16
30
 
17
31
  ## Step 4.5 — Finalize the PR description (mandatory)
18
32
 
@@ -25,6 +39,7 @@ The lead delegates body text to the `pr-description-writer` agent so the global
25
39
  ```
26
40
  Agent(
27
41
  subagent_type="pr-description-writer",
42
+ mode="bypassPermissions",
28
43
  description="Rewrite PR <number> body from cumulative diff",
29
44
  prompt="<brief from steps below>"
30
45
  )
@@ -34,25 +49,41 @@ If that subagent is missing, fall back to `general-purpose` with the same brief
34
49
 
35
50
  **Steps:**
36
51
 
37
- 1. Capture cumulative diff: `pull_request_read(method="get_diff", pullNumber=N, owner=O, repo=R)` → write output to `.bugteam-final.diff` with `Write` tool.
38
- 2. Capture original body: `pull_request_read(method="get", pullNumber=N, owner=O, repo=R)` → extract `.body` from response, write to `.bugteam-original-body.md` with `Write` tool.
52
+ 1. Capture cumulative diff: `pull_request_read(method="get_diff", pullNumber=N, owner=O, repo=R)` → write the response text to `.bugteam-final.diff` using the `Write` tool.
53
+ 2. Capture original body: `pull_request_read(method="get", pullNumber=N, owner=O, repo=R)` → extract `.body` from the response, write it to `.bugteam-original-body.md` using the `Write` tool.
39
54
  3. Agent brief:
40
55
  - **Inputs:** diff path, original body path, head branch, base branch.
41
56
  - **Constraint:** describe what the PR delivers from the cumulative diff — behavior, user-visible effect, merge rationale. Process metadata (loops, fix counts, findings) stays in review comments.
42
- - **Preservation rule:** if the original body has manually curated sections (linked issues, screenshots, test plan, "Risk Assessment", etc.), preserve them verbatim and only rewrite narrative around them.
57
+ - **Preservation rule:** if the original body has manually curated sections (linked issues, screenshots, test plan, Risk Assessment”, etc.), preserve them verbatim and only rewrite narrative around them.
43
58
  - **Output:** new body markdown.
44
59
  4. Write `.bugteam-final-body.md`.
45
- 5. `update_pull_request(pullNumber=N, owner=O, repo=R, body=<body_text>)`.
60
+ 5. Publish the new body: `update_pull_request(pullNumber=N, owner=O, repo=R, body=<contents of .bugteam-final-body.md>)`.
46
61
  6. Delete `.bugteam-final.diff`, `.bugteam-original-body.md`, `.bugteam-final-body.md`.
47
62
 
48
63
  If Step 4.5 fails (agent error, hook block, network), report in the final report and continue to Step 5. The original PR body remains; commits and comments are unaffected.
49
64
 
50
65
  ## Step 5 — Revoke project permissions (mandatory, always)
51
66
 
52
- After team cleanup — including on error, cap-reached, or stuck exits — run the revoke command from `SKILL.md`.
67
+ After team cleanup — including on error, cap-reached, or stuck exits — run:
68
+
69
+ ```bash
70
+ python "${CLAUDE_SKILL_DIR}/scripts/revoke_project_claude_permissions.py"
71
+ ```
53
72
 
54
73
  This removes allow rules and `additionalDirectories` added in Step 0. Revoke is non-negotiable: leaving the grant in place would let future sessions inherit elevated `.claude/**` access without an explicit opt-in. Run revoke even if Step 4 partially failed; log cleanup errors separately.
55
74
 
56
75
  ## Step 6 — Final report
57
76
 
58
- Template and exit hints are in `SKILL.md`. If exit = `cap reached`, name remaining bug count and suggest `/findbugs` for human triage. If `stuck`, name which findings the fix agent could not resolve. If `error`, surface the error and loop number.
77
+ ```
78
+ /bugteam exit: <converged | cap reached | stuck | error>
79
+ Loops: <loop_count>
80
+ Starting commit: <starting_sha7>
81
+ Final commit: <current_HEAD_sha7>
82
+ Net change: <total_files> files, +<total_add>/-<total_del>
83
+
84
+ Loop log:
85
+ 1 audit: 3P0 2P1 0P2
86
+ ...
87
+ ```
88
+
89
+ If exit = `cap reached`, name remaining bug count and suggest `/findbugs` for human triage. If `stuck`, name which findings the fix agent could not resolve. If `error`, surface the error and loop number.
@@ -0,0 +1,60 @@
1
+ # Bugteam utility scripts
2
+
3
+ Scripts in this directory are **executed** by the lead or teammates. They are not loaded into context as instructions (see Anthropic [Skill authoring best practices — Progressive disclosure](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#progressive-disclosure-patterns)).
4
+
5
+ | Script | Purpose |
6
+ |--------|---------|
7
+ | `bugteam_preflight.py` | Run pytest (when configured) and optional `pre-commit` before `/bugteam`. |
8
+ | `bugteam_fix_hookspath.py` | Auto-remediate a stale local `core.hooksPath` override, set canonical global value, re-run `bugteam_preflight.py`. Invoked by Claude when preflight reports a `core.hooksPath` failure. |
9
+ | `bugteam_code_rules_gate.py` | Run `validate_content` from `code-rules-enforcer.py` on PR-scoped files (`git diff` vs merge-base). Exit `1` if any mandatory rule fails. Invoked **before each audit**; the fixer clears it before the auditor runs. |
10
+ | `grant_project_claude_permissions.py` | Idempotent grant of Edit/Write/Read on `cwd/.claude/**` into `~/.claude/settings.json`. |
11
+ | `revoke_project_claude_permissions.py` | Removes the matching grant entries from `~/.claude/settings.json`. |
12
+ | `test_claude_permissions_common.py` | Pytest module for path normalization and glob-metacharacter guards in `_claude_permissions_common.py`. |
13
+ | `_claude_permissions_common.py` | Shared helpers for the grant/revoke scripts (atomic JSON writes, settings sections). |
14
+ | `windows_safe_rmtree.py` | Recursively remove a directory tree on Windows by stripping ReadOnly attributes and retrying the failing syscall. Invoked from SKILL.md Step 4 to delete `<run_temp_dir>` after teardown. |
15
+ | `probe_code_rules_enforcer_check.py` | Dynamically load `~/.claude/hooks/blocking/code_rules_enforcer.py` and invoke a named check function against a fixture file. Used by the historical Copilot gap-analysis investigation as a verification shape (see `reference/copilot-gap-analysis.md`). |
16
+
17
+ ## `bugteam_preflight.py`
18
+
19
+ From the repository root:
20
+
21
+ ```bash
22
+ python "${CLAUDE_SKILL_DIR}/scripts/bugteam_preflight.py"
23
+ ```
24
+
25
+ - Skips pytest when `BUGTEAM_PREFLIGHT_SKIP=1`.
26
+ - Skips pytest when `pytest.ini` / `pyproject.toml` exists but no `test_*.py` / `*_test.py` files are found under the repo root.
27
+ - Pytest exit code `5` (no tests collected) is treated as success.
28
+ - Add `--pre-commit` to run `pre-commit run --all-files` when `.pre-commit-config.yaml` exists.
29
+
30
+ ## `bugteam_fix_hookspath.py`
31
+
32
+ From the repository root:
33
+
34
+ ```bash
35
+ python "${CLAUDE_SKILL_DIR}/scripts/bugteam_fix_hookspath.py"
36
+ ```
37
+
38
+ - Removes any local-scope `core.hooksPath` value that does not end in `hooks/git-hooks`.
39
+ - Sets `git config --global core.hooksPath ~/.claude/hooks/git-hooks` when the global value is unset or non-canonical.
40
+ - Refuses to run (exit non-zero) when `~/.claude/hooks/git-hooks` does not exist on disk — install via `npx claude-dev-env .` first.
41
+ - Idempotent: a second invocation is a clean no-op.
42
+ - Re-runs `bugteam_preflight.py --no-pytest` and propagates its exit code.
43
+
44
+ The bugteam SKILL invokes this automatically when preflight stderr indicates a `core.hooksPath` failure, so Claude does not surface the error to the user.
45
+
46
+ ## `bugteam_code_rules_gate.py`
47
+
48
+ From the repository root (same merge-base rules as the PR head vs base — default `--base origin/main`):
49
+
50
+ ```bash
51
+ python "${CLAUDE_SKILL_DIR}/scripts/bugteam_code_rules_gate.py"
52
+ ```
53
+
54
+ Optional explicit files instead of `git diff`:
55
+
56
+ ```bash
57
+ python "${CLAUDE_SKILL_DIR}/scripts/bugteam_code_rules_gate.py" path/to/a.py path/to/b.ts
58
+ ```
59
+
60
+ This loads `validate_content` from `hooks/blocking/code-rules-enforcer.py` inside `claude-dev-env` (same logic as the PreToolUse hook). Exit `0` = mandatory checks pass on scanned files; exit `1` = violations printed to stderr.