@danmoisan/drm-copilot-mcp 0.0.1

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 (380) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -0
  3. package/out/mcp-server.js +17323 -0
  4. package/package.json +36 -0
  5. package/resources/claude-customizations/.claude/agent-memory/orchestrator/MEMORY.md +3 -0
  6. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_repo_root_is_source_of_truth.md +11 -0
  7. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_vsce_verify_package_location.md +19 -0
  8. package/resources/claude-customizations/.claude/agent-memory/orchestrator/project_extension_location.md +11 -0
  9. package/resources/claude-customizations/.claude/agent-memory/prd-feature/MEMORY.md +1 -0
  10. package/resources/claude-customizations/.claude/agent-memory/prd-feature/project_push_down_pattern.md +13 -0
  11. package/resources/claude-customizations/.claude/agent-memory/task-researcher/MEMORY.md +3 -0
  12. package/resources/claude-customizations/.claude/agent-memory/task-researcher/project_push_down_claude_dir.md +11 -0
  13. package/resources/claude-customizations/.claude/agents/atomic-executor.md +135 -0
  14. package/resources/claude-customizations/.claude/agents/atomic-planner.md +71 -0
  15. package/resources/claude-customizations/.claude/agents/csharp-typed-engineer.md +69 -0
  16. package/resources/claude-customizations/.claude/agents/epic-review.md +40 -0
  17. package/resources/claude-customizations/.claude/agents/feature-review.md +136 -0
  18. package/resources/claude-customizations/.claude/agents/orchestrator.md +83 -0
  19. package/resources/claude-customizations/.claude/agents/powershell-typed-engineer.md +80 -0
  20. package/resources/claude-customizations/.claude/agents/prd-feature.md +42 -0
  21. package/resources/claude-customizations/.claude/agents/python-typed-engineer.md +72 -0
  22. package/resources/claude-customizations/.claude/agents/staged-review.md +41 -0
  23. package/resources/claude-customizations/.claude/agents/status-updater.md +41 -0
  24. package/resources/claude-customizations/.claude/agents/task-researcher.md +81 -0
  25. package/resources/claude-customizations/.claude/agents/typescript-engineer.md +24 -0
  26. package/resources/claude-customizations/.claude/hooks/check-powershell-test-purity.ps1 +111 -0
  27. package/resources/claude-customizations/.claude/hooks/check-python-test-purity.ps1 +146 -0
  28. package/resources/claude-customizations/.claude/hooks/enforce-evidence-locations.ps1 +150 -0
  29. package/resources/claude-customizations/.claude/hooks/enforce-powershell-batch-budget.ps1 +238 -0
  30. package/resources/claude-customizations/.claude/hooks/enforce-promotion-mcp-only.ps1 +147 -0
  31. package/resources/claude-customizations/.claude/hooks/enforce-python-batch-budget.ps1 +235 -0
  32. package/resources/claude-customizations/.claude/hooks/validate-bash.ps1 +69 -0
  33. package/resources/claude-customizations/.claude/hooks/validate-executor-output.ps1 +296 -0
  34. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage.ps1 +389 -0
  35. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +141 -0
  36. package/resources/claude-customizations/.claude/hooks/validate-planner-output.ps1 +288 -0
  37. package/resources/claude-customizations/.claude/hooks/validate-required-artifact-output.ps1 +171 -0
  38. package/resources/claude-customizations/.claude/hooks/validate-task-researcher-output.ps1 +142 -0
  39. package/resources/claude-customizations/.claude/rules/csharp.md +62 -0
  40. package/resources/claude-customizations/.claude/rules/general-code-change.md +71 -0
  41. package/resources/claude-customizations/.claude/rules/general-unit-test.md +60 -0
  42. package/resources/claude-customizations/.claude/rules/powershell.md +97 -0
  43. package/resources/claude-customizations/.claude/rules/python-suppressions.md +143 -0
  44. package/resources/claude-customizations/.claude/rules/python.md +99 -0
  45. package/resources/claude-customizations/.claude/rules/self-explanatory-code-commenting.md +97 -0
  46. package/resources/claude-customizations/.claude/rules/tonality.md +80 -0
  47. package/resources/claude-customizations/.claude/rules/typescript-suppressions.md +66 -0
  48. package/resources/claude-customizations/.claude/rules/typescript.md +45 -0
  49. package/resources/claude-customizations/.claude/settings.json +144 -0
  50. package/resources/claude-customizations/.claude/skills/acceptance-criteria-tracking/SKILL.md +102 -0
  51. package/resources/claude-customizations/.claude/skills/atomic-plan-contract/SKILL.md +189 -0
  52. package/resources/claude-customizations/.claude/skills/commit-message/SKILL.md +65 -0
  53. package/resources/claude-customizations/.claude/skills/csharp-change-budget-router/SKILL.md +90 -0
  54. package/resources/claude-customizations/.claude/skills/csharp-orchestration-state-machine/SKILL.md +58 -0
  55. package/resources/claude-customizations/.claude/skills/csharp-qa-gate/SKILL.md +77 -0
  56. package/resources/claude-customizations/.claude/skills/evidence-and-timestamp-conventions/SKILL.md +164 -0
  57. package/resources/claude-customizations/.claude/skills/execute-hard-lock/SKILL.md +82 -0
  58. package/resources/claude-customizations/.claude/skills/feature-promotion-lifecycle/SKILL.md +115 -0
  59. package/resources/claude-customizations/.claude/skills/feature-review-workflow/SKILL.md +167 -0
  60. package/resources/claude-customizations/.claude/skills/fill-feature-docs/SKILL.md +22 -0
  61. package/resources/claude-customizations/.claude/skills/invoke-csharp-engineer/SKILL.md +64 -0
  62. package/resources/claude-customizations/.claude/skills/invoke-powershell-engineer/SKILL.md +65 -0
  63. package/resources/claude-customizations/.claude/skills/invoke-python-engineer/SKILL.md +64 -0
  64. package/resources/claude-customizations/.claude/skills/make-skill-template/SKILL.md +147 -0
  65. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +132 -0
  66. package/resources/claude-customizations/.claude/skills/policy-audit-template-usage/SKILL.md +49 -0
  67. package/resources/claude-customizations/.claude/skills/policy-compliance-order/SKILL.md +40 -0
  68. package/resources/claude-customizations/.claude/skills/powershell-change-budget-router/SKILL.md +49 -0
  69. package/resources/claude-customizations/.claude/skills/powershell-orchestration-state-machine/SKILL.md +58 -0
  70. package/resources/claude-customizations/.claude/skills/powershell-qa-gate/SKILL.md +77 -0
  71. package/resources/claude-customizations/.claude/skills/pr-author/SKILL.md +50 -0
  72. package/resources/claude-customizations/.claude/skills/pr-base-branch-merge-base/SKILL.md +56 -0
  73. package/resources/claude-customizations/.claude/skills/pr-context-artifacts/SKILL.md +30 -0
  74. package/resources/claude-customizations/.claude/skills/python-change-budget-router/SKILL.md +79 -0
  75. package/resources/claude-customizations/.claude/skills/python-qa-gate/SKILL.md +77 -0
  76. package/resources/claude-customizations/.claude/skills/remediation-handoff-atomic-planner/SKILL.md +40 -0
  77. package/resources/claude-customizations/.claude/skills/research-issue/SKILL.md +67 -0
  78. package/resources/claude-customizations/.claude/skills/review-epic/SKILL.md +21 -0
  79. package/resources/claude-customizations/.claude/skills/review-feature/SKILL.md +25 -0
  80. package/resources/claude-customizations/.claude/skills/review-staged/SKILL.md +21 -0
  81. package/resources/claude-customizations/.claude/skills/skill-canonical-location-audit/SKILL.md +49 -0
  82. package/resources/claude-customizations/.claude/skills/translate-copilot-to-claude/SKILL.md +295 -0
  83. package/resources/claude-customizations/.claude/skills/update-status/SKILL.md +21 -0
  84. package/resources/claude-dir-customizations/.mcp.json +8 -0
  85. package/resources/codex-and-agents-customizations/.agents/README.md +86 -0
  86. package/resources/codex-and-agents-customizations/.agents/skills/README.md +49 -0
  87. package/resources/codex-and-agents-customizations/.agents/skills/acceptance-criteria-tracking/SKILL.md +107 -0
  88. package/resources/codex-and-agents-customizations/.agents/skills/atomic-executor/SKILL.md +73 -0
  89. package/resources/codex-and-agents-customizations/.agents/skills/atomic-plan-contract/SKILL.md +194 -0
  90. package/resources/codex-and-agents-customizations/.agents/skills/atomic-planner/SKILL.md +87 -0
  91. package/resources/codex-and-agents-customizations/.agents/skills/commit-message/SKILL.md +70 -0
  92. package/resources/codex-and-agents-customizations/.agents/skills/commit-message-conventions/SKILL.md +95 -0
  93. package/resources/codex-and-agents-customizations/.agents/skills/csharp/SKILL.md +67 -0
  94. package/resources/codex-and-agents-customizations/.agents/skills/csharp-change-budget-router/SKILL.md +94 -0
  95. package/resources/codex-and-agents-customizations/.agents/skills/csharp-orchestration-state-machine/SKILL.md +64 -0
  96. package/resources/codex-and-agents-customizations/.agents/skills/csharp-qa-gate/SKILL.md +82 -0
  97. package/resources/codex-and-agents-customizations/.agents/skills/evidence-and-timestamp-conventions/SKILL.md +168 -0
  98. package/resources/codex-and-agents-customizations/.agents/skills/execute-hard-lock/SKILL.md +88 -0
  99. package/resources/codex-and-agents-customizations/.agents/skills/feature-promotion-lifecycle/SKILL.md +129 -0
  100. package/resources/codex-and-agents-customizations/.agents/skills/feature-review/SKILL.md +106 -0
  101. package/resources/codex-and-agents-customizations/.agents/skills/feature-review-workflow/SKILL.md +181 -0
  102. package/resources/codex-and-agents-customizations/.agents/skills/fill-feature-docs/SKILL.md +27 -0
  103. package/resources/codex-and-agents-customizations/.agents/skills/invoke-csharp-engineer/SKILL.md +73 -0
  104. package/resources/codex-and-agents-customizations/.agents/skills/invoke-powershell-engineer/SKILL.md +74 -0
  105. package/resources/codex-and-agents-customizations/.agents/skills/invoke-python-engineer/SKILL.md +73 -0
  106. package/resources/codex-and-agents-customizations/.agents/skills/make-skill-template/SKILL.md +152 -0
  107. package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +143 -0
  108. package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +317 -0
  109. package/resources/codex-and-agents-customizations/.agents/skills/policy-audit-template-usage/SKILL.md +53 -0
  110. package/resources/codex-and-agents-customizations/.agents/skills/policy-compliance-order/SKILL.md +49 -0
  111. package/resources/codex-and-agents-customizations/.agents/skills/powershell/SKILL.md +102 -0
  112. package/resources/codex-and-agents-customizations/.agents/skills/powershell-change-budget-router/SKILL.md +53 -0
  113. package/resources/codex-and-agents-customizations/.agents/skills/powershell-orchestration-state-machine/SKILL.md +64 -0
  114. package/resources/codex-and-agents-customizations/.agents/skills/powershell-qa-gate/SKILL.md +83 -0
  115. package/resources/codex-and-agents-customizations/.agents/skills/pr-author/SKILL.md +55 -0
  116. package/resources/codex-and-agents-customizations/.agents/skills/pr-authoring/SKILL.md +124 -0
  117. package/resources/codex-and-agents-customizations/.agents/skills/pr-base-branch-merge-base/SKILL.md +60 -0
  118. package/resources/codex-and-agents-customizations/.agents/skills/pr-context-artifacts/SKILL.md +34 -0
  119. package/resources/codex-and-agents-customizations/.agents/skills/python/SKILL.md +104 -0
  120. package/resources/codex-and-agents-customizations/.agents/skills/python-change-budget-router/SKILL.md +84 -0
  121. package/resources/codex-and-agents-customizations/.agents/skills/python-qa-gate/SKILL.md +82 -0
  122. package/resources/codex-and-agents-customizations/.agents/skills/python-suppressions/SKILL.md +148 -0
  123. package/resources/codex-and-agents-customizations/.agents/skills/remediation-handoff-atomic-planner/SKILL.md +49 -0
  124. package/resources/codex-and-agents-customizations/.agents/skills/repo-automation-adapter/SKILL.md +142 -0
  125. package/resources/codex-and-agents-customizations/.agents/skills/repo-automation-adapter/agents/openai.yaml +5 -0
  126. package/resources/codex-and-agents-customizations/.agents/skills/research-issue/SKILL.md +72 -0
  127. package/resources/codex-and-agents-customizations/.agents/skills/review-epic/SKILL.md +26 -0
  128. package/resources/codex-and-agents-customizations/.agents/skills/review-feature/SKILL.md +30 -0
  129. package/resources/codex-and-agents-customizations/.agents/skills/review-staged/SKILL.md +26 -0
  130. package/resources/codex-and-agents-customizations/.agents/skills/self-explanatory-code-commenting/SKILL.md +102 -0
  131. package/resources/codex-and-agents-customizations/.agents/skills/skill-canonical-location-audit/SKILL.md +52 -0
  132. package/resources/codex-and-agents-customizations/.agents/skills/translate-copilot-to-claude/SKILL.md +317 -0
  133. package/resources/codex-and-agents-customizations/.agents/skills/typescript/SKILL.md +50 -0
  134. package/resources/codex-and-agents-customizations/.agents/skills/typescript-suppressions/SKILL.md +71 -0
  135. package/resources/codex-and-agents-customizations/.agents/skills/update-status/SKILL.md +26 -0
  136. package/resources/codex-and-agents-customizations/.codex/agents/5.1-beast-adjusted.toml +23 -0
  137. package/resources/codex-and-agents-customizations/.codex/agents/5.1-thinking-beast-mode-adjusted.toml +23 -0
  138. package/resources/codex-and-agents-customizations/.codex/agents/api-architect.toml +23 -0
  139. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor.toml +151 -0
  140. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner.toml +93 -0
  141. package/resources/codex-and-agents-customizations/.codex/agents/atomic-planning.toml +24 -0
  142. package/resources/codex-and-agents-customizations/.codex/agents/commentary-remediation.toml +23 -0
  143. package/resources/codex-and-agents-customizations/.codex/agents/commit-steward.toml +20 -0
  144. package/resources/codex-and-agents-customizations/.codex/agents/csharp-atomic-executor.toml +24 -0
  145. package/resources/codex-and-agents-customizations/.codex/agents/csharp-atomic-planning.toml +25 -0
  146. package/resources/codex-and-agents-customizations/.codex/agents/csharp-orchestrator.toml +56 -0
  147. package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer.toml +97 -0
  148. package/resources/codex-and-agents-customizations/.codex/agents/epic-review.toml +52 -0
  149. package/resources/codex-and-agents-customizations/.codex/agents/expert-nextjs-developer.toml +23 -0
  150. package/resources/codex-and-agents-customizations/.codex/agents/expert-react-frontend-engineer.toml +23 -0
  151. package/resources/codex-and-agents-customizations/.codex/agents/feature-review.toml +149 -0
  152. package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer.toml +60 -0
  153. package/resources/codex-and-agents-customizations/.codex/agents/gpt-5-beast-mode.toml +23 -0
  154. package/resources/codex-and-agents-customizations/.codex/agents/hlbpa.toml +23 -0
  155. package/resources/codex-and-agents-customizations/.codex/agents/mentor.toml +23 -0
  156. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator.toml +121 -0
  157. package/resources/codex-and-agents-customizations/.codex/agents/powershell-atomic-executor.toml +24 -0
  158. package/resources/codex-and-agents-customizations/.codex/agents/powershell-atomic-planning.toml +25 -0
  159. package/resources/codex-and-agents-customizations/.codex/agents/powershell-di-unit-test-engineer.toml +24 -0
  160. package/resources/codex-and-agents-customizations/.codex/agents/powershell-orchestrator.toml +56 -0
  161. package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer.toml +108 -0
  162. package/resources/codex-and-agents-customizations/.codex/agents/pr-author.toml +26 -0
  163. package/resources/codex-and-agents-customizations/.codex/agents/prd-feature.toml +53 -0
  164. package/resources/codex-and-agents-customizations/.codex/agents/prd.toml +23 -0
  165. package/resources/codex-and-agents-customizations/.codex/agents/pytest-unit-test-coding.toml +24 -0
  166. package/resources/codex-and-agents-customizations/.codex/agents/python-atomic-executor.toml +24 -0
  167. package/resources/codex-and-agents-customizations/.codex/agents/python-atomic-planning.toml +25 -0
  168. package/resources/codex-and-agents-customizations/.codex/agents/python-execution-only-typed.toml +24 -0
  169. package/resources/codex-and-agents-customizations/.codex/agents/python-orchestrator.toml +54 -0
  170. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer.toml +100 -0
  171. package/resources/codex-and-agents-customizations/.codex/agents/staged-review.toml +53 -0
  172. package/resources/codex-and-agents-customizations/.codex/agents/status-updater.toml +53 -0
  173. package/resources/codex-and-agents-customizations/.codex/agents/task-researcher.toml +103 -0
  174. package/resources/codex-and-agents-customizations/.codex/agents/tdd-green.toml +23 -0
  175. package/resources/codex-and-agents-customizations/.codex/agents/tdd-red.toml +23 -0
  176. package/resources/codex-and-agents-customizations/.codex/agents/tdd-refactor.toml +23 -0
  177. package/resources/codex-and-agents-customizations/.codex/agents/typescript-engineer.toml +48 -0
  178. package/resources/codex-and-agents-customizations/.codex/agents/voidbeast-gpt41enhanced.toml +23 -0
  179. package/resources/codex-and-agents-customizations/.codex/codex-web-setup.plan.md +26 -0
  180. package/resources/codex-and-agents-customizations/.codex/codex-web-setup.sh +384 -0
  181. package/resources/codex-and-agents-customizations/.codex/config.toml +137 -0
  182. package/resources/codex-and-agents-customizations/.codex/hooks/check-powershell-test-purity.ps1 +113 -0
  183. package/resources/codex-and-agents-customizations/.codex/hooks/check-python-test-purity.ps1 +149 -0
  184. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-evidence-locations.ps1 +153 -0
  185. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-powershell-batch-budget.ps1 +241 -0
  186. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +150 -0
  187. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-python-batch-budget.ps1 +238 -0
  188. package/resources/codex-and-agents-customizations/.codex/hooks/validate-bash.ps1 +72 -0
  189. package/resources/codex-and-agents-customizations/.codex/hooks/validate-feature-review-coverage.ps1 +265 -0
  190. package/resources/codex-and-agents-customizations/.codex/prompts/feature-review-remediate.md +10 -0
  191. package/resources/codex-and-agents-customizations/.codex/prompts/generate-commit-message-repo.md +11 -0
  192. package/resources/codex-and-agents-customizations/.codex/prompts/generate-pr.md +15 -0
  193. package/resources/codex-and-agents-customizations/.codex/prompts/orchestrate-work.md +22 -0
  194. package/resources/codex-and-agents-customizations/AGENTS.md +317 -0
  195. package/resources/customizations/.github/agents/5.1-Beast-adjusted.agent.md +181 -0
  196. package/resources/customizations/.github/agents/5.1-Thinking-Beast-Mode-adjusted.agent.md +361 -0
  197. package/resources/customizations/.github/agents/Powershell DI Unit Test Engineer.agent.md +192 -0
  198. package/resources/customizations/.github/agents/api-architect.agent.md +40 -0
  199. package/resources/customizations/.github/agents/atomic_executor.agent.md +251 -0
  200. package/resources/customizations/.github/agents/atomic_planning.agent.md +658 -0
  201. package/resources/customizations/.github/agents/commentary-remediation.agent.md +35 -0
  202. package/resources/customizations/.github/agents/commit-steward.agent.md +200 -0
  203. package/resources/customizations/.github/agents/csharp-atomic-executor.agent.md +288 -0
  204. package/resources/customizations/.github/agents/csharp-atomic-planning.agent.md +354 -0
  205. package/resources/customizations/.github/agents/csharp-orchestrator.agent.md +375 -0
  206. package/resources/customizations/.github/agents/csharp-typed-engineer.agent.md +285 -0
  207. package/resources/customizations/.github/agents/epic-review.agent.md +374 -0
  208. package/resources/customizations/.github/agents/expert-nextjs-developer.agent.md +477 -0
  209. package/resources/customizations/.github/agents/expert-react-frontend-engineer.agent.md +739 -0
  210. package/resources/customizations/.github/agents/feature-review.agent.md +49 -0
  211. package/resources/customizations/.github/agents/gpt-5-beast-mode.agent.md +116 -0
  212. package/resources/customizations/.github/agents/hlbpa.agent.md +219 -0
  213. package/resources/customizations/.github/agents/mentor.agent.md +32 -0
  214. package/resources/customizations/.github/agents/orchestrator.agent.md +449 -0
  215. package/resources/customizations/.github/agents/powershell-atomic-executor.agent.md +287 -0
  216. package/resources/customizations/.github/agents/powershell-atomic-planning.agent.md +647 -0
  217. package/resources/customizations/.github/agents/powershell-orchestrator.agent.md +382 -0
  218. package/resources/customizations/.github/agents/powershell-typed-engineer.agent.md +293 -0
  219. package/resources/customizations/.github/agents/pr-author.agent.md +138 -0
  220. package/resources/customizations/.github/agents/prd-feature.agent.md +52 -0
  221. package/resources/customizations/.github/agents/prd.agent.md +202 -0
  222. package/resources/customizations/.github/agents/pytest-unit-test-coding.agent.md +202 -0
  223. package/resources/customizations/.github/agents/python-atomic-executor.agent.md +289 -0
  224. package/resources/customizations/.github/agents/python-atomic-planning.agent.md +429 -0
  225. package/resources/customizations/.github/agents/python-execution-only-typed.agent.md +217 -0
  226. package/resources/customizations/.github/agents/python-orchestrator.agent.md +380 -0
  227. package/resources/customizations/.github/agents/python-typed-engineer.agent.md +271 -0
  228. package/resources/customizations/.github/agents/staged-review.agent.md +246 -0
  229. package/resources/customizations/.github/agents/status_updater.agent.md +279 -0
  230. package/resources/customizations/.github/agents/task-researcher.agent.md +298 -0
  231. package/resources/customizations/.github/agents/tdd-green.agent.md +60 -0
  232. package/resources/customizations/.github/agents/tdd-red.agent.md +66 -0
  233. package/resources/customizations/.github/agents/tdd-refactor.agent.md +94 -0
  234. package/resources/customizations/.github/agents/typescript-engineer.agent.md +167 -0
  235. package/resources/customizations/.github/agents/voidbeast-gpt41enhanced.agent.md +230 -0
  236. package/resources/customizations/.github/codex/execute-hard-lock.prompt.md +105 -0
  237. package/resources/customizations/.github/codex/resume-hard-lock.prompt.md +92 -0
  238. package/resources/customizations/.github/copilot-instructions.md +7 -0
  239. package/resources/customizations/.github/instructions/csharp-code-change.instructions.md +184 -0
  240. package/resources/customizations/.github/instructions/csharp-unit-test.instructions.md +52 -0
  241. package/resources/customizations/.github/instructions/general-code-change.instructions.md +290 -0
  242. package/resources/customizations/.github/instructions/general-unit-test.instructions.md +106 -0
  243. package/resources/customizations/.github/instructions/github-actions-ci-cd-best-practices.instructions.md +607 -0
  244. package/resources/customizations/.github/instructions/github-actions.instructions.md +23 -0
  245. package/resources/customizations/.github/instructions/powershell-code-change.instructions.md +81 -0
  246. package/resources/customizations/.github/instructions/powershell-unit-test.instructions.md +69 -0
  247. package/resources/customizations/.github/instructions/python-code-change.instructions.md +232 -0
  248. package/resources/customizations/.github/instructions/python-suppressions.instructions.md +609 -0
  249. package/resources/customizations/.github/instructions/python-unit-test.instructions.md +71 -0
  250. package/resources/customizations/.github/instructions/self-explanatory-code-commenting.instructions.md +238 -0
  251. package/resources/customizations/.github/instructions/tonality.instructions.md +133 -0
  252. package/resources/customizations/.github/instructions/typescript-code-change.instructions.md +203 -0
  253. package/resources/customizations/.github/instructions/typescript-suppressions.instructions.md +157 -0
  254. package/resources/customizations/.github/instructions/typescript-unit-test.instructions.md +112 -0
  255. package/resources/customizations/.github/prompts/add-educational-comments.prompt.md +129 -0
  256. package/resources/customizations/.github/prompts/breakdown-bug-prd.prompt.md +29 -0
  257. package/resources/customizations/.github/prompts/breakdown-epic-arch.prompt.md +66 -0
  258. package/resources/customizations/.github/prompts/breakdown-epic-pm.prompt.md +58 -0
  259. package/resources/customizations/.github/prompts/breakdown-feature-implementation.prompt.md +128 -0
  260. package/resources/customizations/.github/prompts/breakdown-feature-prd.prompt.md +61 -0
  261. package/resources/customizations/.github/prompts/code-exemplars-blueprint-generator.prompt.md +126 -0
  262. package/resources/customizations/.github/prompts/drafts/create-github-issues-feature-from-implementation-plan.prompt.md +28 -0
  263. package/resources/customizations/.github/prompts/drafts/create-implementation-plan.prompt.md +158 -0
  264. package/resources/customizations/.github/prompts/drafts/create-technical-spike.prompt.md +231 -0
  265. package/resources/customizations/.github/prompts/drafts/potential-feature-prd.prompt.md +19 -0
  266. package/resources/customizations/.github/prompts/drafts/update-implementation-plan.prompt.md +158 -0
  267. package/resources/customizations/.github/prompts/execute-plan-template.md +21 -0
  268. package/resources/customizations/.github/prompts/export-chat.prompt.md +7 -0
  269. package/resources/customizations/.github/prompts/fillout-prd-feature.prompt.md +46 -0
  270. package/resources/customizations/.github/prompts/generate-atomic-plan.prompt.md +96 -0
  271. package/resources/customizations/.github/prompts/generate-commit-message-repo.prompt.md +108 -0
  272. package/resources/customizations/.github/prompts/generate-pr.prompt.md +151 -0
  273. package/resources/customizations/.github/prompts/javascript-typescript-jest.prompt.md +44 -0
  274. package/resources/customizations/.github/prompts/orchestrate-csharp-work.prompt.md +66 -0
  275. package/resources/customizations/.github/prompts/orchestrate-powershell-work.prompt.md +50 -0
  276. package/resources/customizations/.github/prompts/orchestrate-python-work.prompt.md +50 -0
  277. package/resources/customizations/.github/prompts/orchestrate-work.prompt.md +66 -0
  278. package/resources/customizations/.github/prompts/remediate-comments.prompt.md +53 -0
  279. package/resources/customizations/.github/prompts/research-issue.prompt.md +125 -0
  280. package/resources/customizations/.github/prompts/review-epic.prompt.md +94 -0
  281. package/resources/customizations/.github/prompts/review-feature.prompt.md +130 -0
  282. package/resources/customizations/.github/prompts/review-staged.prompt.md +43 -0
  283. package/resources/customizations/.github/prompts/update_status.prompt.md +68 -0
  284. package/resources/customizations/.github/skills/README.md +26 -0
  285. package/resources/customizations/.github/skills/acceptance-criteria-tracking/SKILL.md +102 -0
  286. package/resources/customizations/.github/skills/atomic-plan-contract/SKILL.md +174 -0
  287. package/resources/customizations/.github/skills/csharp-change-budget-router/SKILL.md +48 -0
  288. package/resources/customizations/.github/skills/csharp-orchestration-state-machine/SKILL.md +57 -0
  289. package/resources/customizations/.github/skills/evidence-and-timestamp-conventions/SKILL.md +135 -0
  290. package/resources/customizations/.github/skills/feature-promotion-lifecycle/SKILL.md +121 -0
  291. package/resources/customizations/.github/skills/feature-review-workflow/SKILL.md +153 -0
  292. package/resources/customizations/.github/skills/make-skill-template/SKILL.md +147 -0
  293. package/resources/customizations/.github/skills/policy-audit-template-usage/SKILL.md +48 -0
  294. package/resources/customizations/.github/skills/policy-compliance-order/SKILL.md +37 -0
  295. package/resources/customizations/.github/skills/powershell-change-budget-router/SKILL.md +48 -0
  296. package/resources/customizations/.github/skills/powershell-orchestration-state-machine/SKILL.md +57 -0
  297. package/resources/customizations/.github/skills/pr-base-branch-merge-base/SKILL.md +55 -0
  298. package/resources/customizations/.github/skills/pr-context-artifacts/SKILL.md +29 -0
  299. package/resources/customizations/.github/skills/remediation-handoff-atomic-planner/SKILL.md +39 -0
  300. package/resources/customizations/.github/skills/skill-canonical-location-audit/SKILL.md +48 -0
  301. package/resources/feature-templates/bug/plan.yyyy-MM-ddTHH-mm.md +44 -0
  302. package/resources/feature-templates/bug/potential_bug.md +59 -0
  303. package/resources/feature-templates/bug/spec.md +99 -0
  304. package/resources/feature-templates/epic/initiative.md +43 -0
  305. package/resources/feature-templates/feature/plan.yyyy-MM-ddTHH-mm.md +53 -0
  306. package/resources/feature-templates/feature/spec.md +66 -0
  307. package/resources/feature-templates/feature/user-story.md +42 -0
  308. package/resources/feature-templates/potential/template.md +33 -0
  309. package/resources/feature-templates/refactor/plan.yyyy-MM-ddTHH-mm.md +52 -0
  310. package/resources/feature-templates/refactor/spec.md +69 -0
  311. package/resources/powershell/PoshQC/PoshQC.Analyzer.psm1 +254 -0
  312. package/resources/powershell/PoshQC/PoshQC.FileDiscovery.psm1 +138 -0
  313. package/resources/powershell/PoshQC/PoshQC.Testing.psm1 +409 -0
  314. package/resources/powershell/PoshQC/PoshQC.psd1 +31 -0
  315. package/resources/powershell/PoshQC/PoshQC.psm1 +101 -0
  316. package/resources/powershell/PoshQC/README.md +80 -0
  317. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +59 -0
  318. package/resources/powershell/PoshQC/settings/pssa.settings.psd1 +55 -0
  319. package/resources/scripts/dev_tools/__init__.py +0 -0
  320. package/resources/scripts/dev_tools/agentic_sync.py +819 -0
  321. package/resources/scripts/dev_tools/codex_native_converter/__init__.py +11 -0
  322. package/resources/scripts/dev_tools/codex_native_converter/__main__.py +6 -0
  323. package/resources/scripts/dev_tools/codex_native_converter/cli.py +11 -0
  324. package/resources/scripts/dev_tools/new_active_feature_folder.py +79 -0
  325. package/resources/scripts/dev_tools/new_active_feature_folder_docs.py +268 -0
  326. package/resources/scripts/dev_tools/new_active_feature_folder_flow.py +366 -0
  327. package/resources/scripts/dev_tools/new_active_feature_folder_io.py +306 -0
  328. package/resources/scripts/dev_tools/new_active_feature_folder_markdown.py +252 -0
  329. package/resources/scripts/dev_tools/new_active_feature_folder_models.py +136 -0
  330. package/resources/scripts/dev_tools/new_potential_bug_entry.py +465 -0
  331. package/resources/scripts/dev_tools/potential_to_issue.py +421 -0
  332. package/resources/scripts/dev_tools/potential_to_issue_content.py +212 -0
  333. package/resources/scripts/dev_tools/pr_context/__init__.py +0 -0
  334. package/resources/scripts/dev_tools/pr_context/collector.py +619 -0
  335. package/resources/scripts/dev_tools/pr_context/feature_docs.py +349 -0
  336. package/resources/scripts/dev_tools/pr_context/git.py +153 -0
  337. package/resources/scripts/dev_tools/pr_context/github.py +549 -0
  338. package/resources/scripts/dev_tools/pr_context/models.py +198 -0
  339. package/resources/scripts/dev_tools/pr_context/render.py +342 -0
  340. package/resources/scripts/dev_tools/pr_context/render_feature_excerpts.py +256 -0
  341. package/resources/scripts/dev_tools/pr_context/render_pr_helpers.py +291 -0
  342. package/resources/scripts/dev_tools/pr_context/summary_helpers.py +386 -0
  343. package/resources/scripts/dev_tools/pr_context/verification_evidence.py +171 -0
  344. package/resources/scripts/dev_tools/prompt_mode_contract.py +152 -0
  345. package/resources/scripts/dev_tools/push_down_claude_customizations.py +188 -0
  346. package/resources/scripts/dev_tools/push_down_codex_and_agents_customizations.py +139 -0
  347. package/resources/scripts/dev_tools/push_down_copilot_customizations.py +504 -0
  348. package/resources/scripts/dev_tools/push_down_copilot_customizations_filesystem.py +217 -0
  349. package/resources/scripts/dev_tools/push_down_copilot_customizations_rewrites.py +293 -0
  350. package/resources/scripts/dev_tools/resolve_file_prompt.py +457 -0
  351. package/resources/scripts/dev_tools/resolve_hard_lock_prompt.py +444 -0
  352. package/resources/scripts/dev_tools/validate_orchestration_artifacts.py +554 -0
  353. package/resources/templates/codex_native_converter.py +35 -0
  354. package/resources/templates/collect_commit_context.py +212 -0
  355. package/resources/templates/collect_pr_context.py +74 -0
  356. package/resources/templates/hello_pwsh.ps1 +3 -0
  357. package/resources/templates/hello_python.py +11 -0
  358. package/resources/templates/link-parent-child.ps1 +480 -0
  359. package/resources/templates/new-claude-worktree-session.ps1 +232 -0
  360. package/resources/templates/new-potential-entry.ps1 +187 -0
  361. package/resources/templates/new_active_feature_folder.py +67 -0
  362. package/resources/templates/new_potential_bug_entry.py +54 -0
  363. package/resources/templates/policy_audit/AGENTS.md +117 -0
  364. package/resources/templates/policy_audit/code-review.yyyy-MM-ddTHH-mm.md +165 -0
  365. package/resources/templates/policy_audit/feature-audit.yyyy-MM-ddTHH-mm.md +124 -0
  366. package/resources/templates/policy_audit/policy-audit.yyyy-MM-ddTHH-mm.md +649 -0
  367. package/resources/templates/potential_to_issue.py +55 -0
  368. package/resources/templates/push_down_claude_customizations.py +188 -0
  369. package/resources/templates/push_down_codex_and_agents_customizations.py +95 -0
  370. package/resources/templates/push_down_copilot_customizations.py +124 -0
  371. package/resources/templates/resolve_atomic_plan_prompt.py +75 -0
  372. package/resources/templates/resolve_hard_lock_prompt.py +65 -0
  373. package/resources/templates/run-poshqc-analyze-autofix.ps1 +16 -0
  374. package/resources/templates/run-poshqc-analyze.ps1 +26 -0
  375. package/resources/templates/run-poshqc-format.ps1 +26 -0
  376. package/resources/templates/run-poshqc-suite.ps1 +24 -0
  377. package/resources/templates/run-poshqc-test.ps1 +32 -0
  378. package/resources/templates/sync-agents-from-instructions.ps1 +400 -0
  379. package/resources/templates/validate_orchestration_artifacts.py +55 -0
  380. package/resources/templates/vscode-cli.helpers.ps1 +63 -0
@@ -0,0 +1,619 @@
1
+ """Collect Git repository context for pull request authorship."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ from pathlib import Path
7
+ from typing import TYPE_CHECKING
8
+
9
+ from .feature_docs import (
10
+ completed_plan_tasks,
11
+ extract_issue_references,
12
+ gather_feature_excerpts,
13
+ )
14
+ from .git import CommandRunner, GitClient, SubprocessRunner
15
+ from .github import GhClient
16
+ from .models import (
17
+ CommandResult,
18
+ FeatureDocExcerpt,
19
+ IssueDetails,
20
+ PRContextResult,
21
+ PullRequestDetails,
22
+ find_user_story_link,
23
+ format_list,
24
+ section,
25
+ truncate_lines,
26
+ )
27
+ from .render import (
28
+ build_close_candidates_section,
29
+ build_pr_context,
30
+ convert_numstat,
31
+ extension_summary,
32
+ extract_changed_paths,
33
+ extract_merge_pr_numbers,
34
+ format_diff_path,
35
+ format_issue_details,
36
+ format_pr_details,
37
+ select_default_base,
38
+ )
39
+ from .render_pr_helpers import build_issues_to_autoclose_section
40
+ from .summary_helpers import (
41
+ append_generation_timestamp,
42
+ bucket_text,
43
+ )
44
+ from .summary_helpers import (
45
+ issue_appendix as _issue_appendix,
46
+ )
47
+ from .summary_helpers import (
48
+ issue_digest as _issue_digest,
49
+ )
50
+ from .summary_helpers import (
51
+ parse_name_status_map as _parse_name_status_map,
52
+ )
53
+ from .summary_helpers import (
54
+ parse_numstat_detailed as _parse_numstat_detailed,
55
+ )
56
+ from .summary_helpers import (
57
+ pr_appendix as _pr_appendix,
58
+ )
59
+ from .summary_helpers import (
60
+ pr_digest as _pr_digest,
61
+ )
62
+ from .summary_helpers import (
63
+ scoping_doc_changes as _scoping_doc_changes,
64
+ )
65
+ from .verification_evidence import (
66
+ VerificationEvidenceRecord,
67
+ parse_verification_evidence_file,
68
+ )
69
+
70
+ if TYPE_CHECKING:
71
+ from collections.abc import Sequence
72
+
73
+ __all__ = [
74
+ "CommandResult",
75
+ "FeatureDocExcerpt",
76
+ "IssueDetails",
77
+ "PRContextResult",
78
+ "PullRequestDetails",
79
+ "GitClient",
80
+ "SubprocessRunner",
81
+ "CommandRunner",
82
+ "GhClient",
83
+ "build_pr_context",
84
+ "build_close_candidates_section",
85
+ "completed_plan_tasks",
86
+ "convert_numstat",
87
+ "extension_summary",
88
+ "extract_issue_references",
89
+ "extract_merge_pr_numbers",
90
+ "format_diff_path",
91
+ "format_issue_details",
92
+ "format_pr_details",
93
+ "gather_feature_excerpts",
94
+ "select_default_base",
95
+ "find_user_story_link",
96
+ "section",
97
+ "extract_changed_paths",
98
+ "collect_and_write",
99
+ "parse_args",
100
+ "main",
101
+ ]
102
+
103
+ SUMMARY_PATH_DEFAULT = "artifacts/pr_context.summary.txt"
104
+ APPENDIX_PATH_DEFAULT = "artifacts/pr_context.appendix.txt"
105
+ SUMMARY_CHAR_BUDGET = 160000 # 10x increase: ~2300 lines at 70 chars/line avg
106
+ APPENDIX_CHAR_BUDGET = 480000 # 10x increase: ~6900 lines at 70 chars/line avg
107
+ ISSUE_SUMMARY_LINE_BUDGET = 25
108
+ ISSUE_APPENDIX_LINE_BUDGET = 120
109
+ COMMENT_SUMMARY_LIMIT = 3
110
+ COMMENT_APPENDIX_LIMIT = 10
111
+ PR_BODY_SUMMARY_LINES = 25
112
+ PR_BODY_APPENDIX_LINES = 120
113
+
114
+
115
+ def _render_verification_evidence_section(
116
+ *, resolved_root: Path, feature_docs: list[FeatureDocExcerpt]
117
+ ) -> str:
118
+ """Render canonical verification evidence rows for summary output.
119
+
120
+ Args:
121
+ resolved_root: Repository root used to read discovered evidence files.
122
+ feature_docs: Feature excerpts whose context files may include evidence paths.
123
+
124
+ Returns:
125
+ A formatted section body containing parsed evidence rows or fallback text.
126
+
127
+ Side Effects:
128
+ Reads evidence files from disk and tolerates unreadable artifacts.
129
+ """
130
+ records: list[VerificationEvidenceRecord] = []
131
+ # Parse only canonical evidence files already enumerated in context files.
132
+ for doc in feature_docs:
133
+ for raw_path in doc.context_files:
134
+ normalized = raw_path.replace("\\", "/")
135
+ if "/evidence/" not in normalized:
136
+ continue
137
+ try:
138
+ record: VerificationEvidenceRecord = parse_verification_evidence_file(
139
+ root=resolved_root,
140
+ feature=doc.feature,
141
+ relative_path=Path(normalized),
142
+ )
143
+ except OSError:
144
+ continue
145
+ records.append(record)
146
+
147
+ parseable_records = [
148
+ item for item in records if item.normalized_result in {"pass", "fail"}
149
+ ]
150
+ if not parseable_records:
151
+ return "No canonical verification evidence parsed"
152
+
153
+ lines: list[str] = []
154
+ # Render deterministic rows sorted by source path for stable artifacts.
155
+ for record in sorted(parseable_records, key=lambda item: item.source_file):
156
+ lines.extend(
157
+ [
158
+ f"- Feature: {record.feature}",
159
+ f" - Source: {record.source_file}",
160
+ f" - Timestamp: {record.timestamp}",
161
+ f" - Command: {record.command}",
162
+ f" - EXIT_CODE: {record.exit_code}",
163
+ f" - Normalized result: {record.normalized_result}",
164
+ ]
165
+ )
166
+ return "\n".join(lines)
167
+
168
+
169
+ # helper functions moved to summary_helpers
170
+
171
+
172
+ def write_output(text: str, out_path: Path, append: bool) -> None:
173
+ out_path.parent.mkdir(parents=True, exist_ok=True)
174
+ mode = "a" if append else "w"
175
+ with out_path.open(mode, encoding="utf-8") as handle:
176
+ handle.write(text)
177
+
178
+
179
+ def collect_and_write(
180
+ *,
181
+ base: str | None,
182
+ head: str | None,
183
+ out: Path,
184
+ appendix_out: Path | None,
185
+ repo_root: Path,
186
+ append: bool,
187
+ include_untracked: bool,
188
+ ) -> None:
189
+ runner = SubprocessRunner()
190
+ git = GitClient(runner, repo_root)
191
+ resolved_root = git.resolve_root()
192
+ git = GitClient(runner, resolved_root)
193
+ gh = GhClient(runner, resolved_root)
194
+ gh_available = True
195
+ gh_status_override: str | None = None
196
+ try:
197
+ gh.ensure_available()
198
+ except RuntimeError as exc: # pragma: no cover - availability gate
199
+ gh_available = False
200
+ gh_status_override = f"GitHub CLI unavailable: {exc}"
201
+
202
+ summary_path = out
203
+ appendix_path = appendix_out or Path(APPENDIX_PATH_DEFAULT)
204
+
205
+ current_pr = gh.current_pr()
206
+
207
+ context_result = build_pr_context(
208
+ git=git,
209
+ gh=gh,
210
+ base_ref=base,
211
+ head_ref=head,
212
+ include_untracked=include_untracked,
213
+ feature_issue_refs=[],
214
+ current_pr=current_pr,
215
+ gh_available=gh_available,
216
+ )
217
+
218
+ changed_paths = extract_changed_paths(context_result.text)
219
+ feature_docs = gather_feature_excerpts(resolved_root, changed_paths)
220
+ additional_context_files = sorted(
221
+ {path for doc in feature_docs for path in doc.context_files if path}
222
+ )
223
+ feature_issue_refs = sorted(
224
+ {ref for doc in feature_docs for ref in doc.issue_refs if ref.strip()}
225
+ )
226
+
227
+ if feature_issue_refs:
228
+ context_result = build_pr_context(
229
+ git=git,
230
+ gh=gh,
231
+ base_ref=base,
232
+ head_ref=head,
233
+ include_untracked=include_untracked,
234
+ feature_issue_refs=feature_issue_refs,
235
+ current_pr=current_pr,
236
+ gh_available=gh_available,
237
+ )
238
+
239
+ referenced_issues_set = set(context_result.referenced_issues)
240
+ referenced_prs_set = set(context_result.referenced_prs)
241
+ invalid_refs_set = set(context_result.invalid_references)
242
+ branch_refs = extract_issue_references(git.branch_name())
243
+ path_refs = extract_issue_references("\n".join(changed_paths))
244
+ if gh_available:
245
+ for ref in feature_issue_refs:
246
+ formatted = ref if ref.startswith("#") else f"#{ref}"
247
+ entity = gh.classify_entity(ref.lstrip("#"))
248
+ if entity == "issue":
249
+ referenced_issues_set.add(formatted)
250
+ elif entity == "pull":
251
+ referenced_prs_set.add(formatted)
252
+ else:
253
+ invalid_refs_set.add(formatted)
254
+ for ref in branch_refs + path_refs:
255
+ formatted = ref if ref.startswith("#") else f"#{ref}"
256
+ entity = gh.classify_entity(ref.lstrip("#"))
257
+ if entity == "issue":
258
+ referenced_issues_set.add(formatted)
259
+ elif entity == "pull":
260
+ referenced_prs_set.add(formatted)
261
+ else:
262
+ invalid_refs_set.add(formatted)
263
+ else:
264
+ referenced_issues_set.update(
265
+ formatted if formatted.startswith("#") else f"#{formatted}"
266
+ for formatted in feature_issue_refs
267
+ )
268
+ referenced_issues_set.update(
269
+ formatted if formatted.startswith("#") else f"#{formatted}"
270
+ for formatted in branch_refs + path_refs
271
+ )
272
+
273
+ referenced_issues = sorted(referenced_issues_set)
274
+ referenced_prs = sorted(referenced_prs_set)
275
+ invalid_refs = sorted(invalid_refs_set)
276
+
277
+ author_asserted: list[str] = []
278
+ author_reason = "None (author has not asserted autoclose issues)"
279
+ verified = context_result.verified_closing if gh_available else []
280
+ if not gh_available:
281
+ verified_reason = "None (GitHub CLI unavailable)"
282
+ elif current_pr is None:
283
+ verified_reason = "None (no PR exists yet for this branch)"
284
+ elif not verified:
285
+ verified_reason = "None (closingIssuesReferences empty)"
286
+ else:
287
+ verified_reason = "(verified from GitHub PR metadata)"
288
+
289
+ if referenced_issues:
290
+ author_asserted = sorted(set(author_asserted + referenced_issues))
291
+ author_reason = "Detected issue references (classified)"
292
+
293
+ # Derive deterministic pending autoclose targets from explicit metadata only
294
+ # when feature readiness is PASS.
295
+ pending_primary: list[str] = []
296
+ for feature_doc in feature_docs:
297
+ if feature_doc.readiness_signal != "PASS":
298
+ continue
299
+ if not feature_doc.primary_issue_ref:
300
+ continue
301
+ if feature_doc.primary_issue_ref not in pending_primary:
302
+ pending_primary.append(feature_doc.primary_issue_ref)
303
+ readiness_signals = sorted(
304
+ {
305
+ feature_doc.readiness_signal
306
+ for feature_doc in feature_docs
307
+ if feature_doc.readiness_signal
308
+ }
309
+ )
310
+ issues_to_autoclose_section = build_issues_to_autoclose_section(
311
+ verified=verified,
312
+ pending_primary=pending_primary,
313
+ readiness_signals=readiness_signals,
314
+ )
315
+
316
+ issues_to_fetch = sorted(set(verified + author_asserted + referenced_issues))
317
+ issue_details: list[IssueDetails] = []
318
+ if gh_available:
319
+ for ref in issues_to_fetch:
320
+ issue_details.append(gh.issue_details(ref.lstrip("#")))
321
+
322
+ pr_details_list: list[PullRequestDetails] = []
323
+ if gh_available:
324
+ for ref in referenced_prs:
325
+ pr_details_list.append(gh.pr_details(ref.lstrip("#")))
326
+
327
+ if context_result.merge_base and context_result.head_sha:
328
+ name_status_text = git.diff_range(
329
+ ["--name-status", context_result.merge_base, context_result.head_sha]
330
+ )
331
+ numstat_text = git.diff_range(
332
+ ["--numstat", context_result.merge_base, context_result.head_sha]
333
+ )
334
+ else:
335
+ name_status_text = git.diff_range(["--name-status"])
336
+ numstat_text = git.diff_range(["--numstat"])
337
+
338
+ _additions, _deletions, per_file_stats = _parse_numstat_detailed(numstat_text)
339
+ status_map = _parse_name_status_map(name_status_text)
340
+
341
+ scoping_changes = _scoping_doc_changes(
342
+ git=git,
343
+ merge_base=context_result.merge_base,
344
+ head_sha=context_result.head_sha,
345
+ root=resolved_root,
346
+ name_status_text=name_status_text,
347
+ numstat_details=per_file_stats,
348
+ )
349
+ material_scoping = [
350
+ (path, reasons, excerpt)
351
+ for path, material, reasons, excerpt in scoping_changes
352
+ if material
353
+ ]
354
+ non_material_scoping = [
355
+ (path, reasons)
356
+ for path, material, reasons, _ in scoping_changes
357
+ if not material
358
+ ]
359
+
360
+ ci_target = context_result.head_sha
361
+ if not ci_target:
362
+ try:
363
+ ci_target = git.rev_parse("HEAD")
364
+ except RuntimeError:
365
+ ci_target = None
366
+ ci_status, ci_jobs = (
367
+ gh.ci_status(ci_target) if (ci_target and gh_available) else (None, [])
368
+ )
369
+
370
+ bucket_core: list[tuple[str, tuple[int, int]]] = []
371
+ bucket_renames: list[tuple[str, tuple[int, int]]] = []
372
+ bucket_docs: list[tuple[str, tuple[int, int]]] = []
373
+ for path, status in status_map.items():
374
+ stats = per_file_stats.get(path, (0, 0))
375
+ if status.startswith("R"):
376
+ bucket_renames.append((path, stats))
377
+ elif path.endswith(".py") or path.endswith(".ps1"):
378
+ bucket_core.append((path, stats))
379
+ elif path.startswith("docs/") or path.startswith(".github") or "AGENTS" in path:
380
+ bucket_docs.append((path, stats))
381
+
382
+ scoping_summary_lines: list[str] = []
383
+ if material_scoping:
384
+ scoping_summary_lines.append("Scoping docs changed (material):")
385
+ for path, reasons, excerpt in material_scoping:
386
+ reason_text = (
387
+ f"Reasons: {', '.join(reasons) if reasons else '(unspecified)'}"
388
+ )
389
+ scoping_summary_lines.append(f"- {path} ({reason_text})")
390
+ if excerpt:
391
+ scoping_summary_lines.append(truncate_lines(excerpt, 40))
392
+ if non_material_scoping:
393
+ scoping_summary_lines.append("Scoping docs changed (non-material):")
394
+ for path, reasons in non_material_scoping[:5]:
395
+ reason_text = (
396
+ f"Reasons: {', '.join(reasons) if reasons else '(unspecified)'}"
397
+ )
398
+ scoping_summary_lines.append(f"- {path} ({reason_text})")
399
+ if not scoping_summary_lines:
400
+ scoping_summary_lines.append("(none)")
401
+
402
+ issue_digests = "\n\n".join(_issue_digest(detail) for detail in issue_details)
403
+ pr_digests = "\n\n".join(_pr_digest(detail) for detail in pr_details_list)
404
+
405
+ feature_summary_lines: list[str] = []
406
+ for doc in feature_docs:
407
+ feature_summary_lines.extend(
408
+ [
409
+ f"Feature: {doc.feature}",
410
+ "Excerpt:",
411
+ truncate_lines(doc.excerpt, 80),
412
+ "Context files:",
413
+ format_list(doc.context_files, "(none)"),
414
+ "",
415
+ ]
416
+ )
417
+ feature_summary = (
418
+ "\n".join(feature_summary_lines).rstrip() if feature_summary_lines else "(none)"
419
+ )
420
+ verification_evidence_section = _render_verification_evidence_section(
421
+ resolved_root=resolved_root,
422
+ feature_docs=feature_docs,
423
+ )
424
+
425
+ close_candidates = build_close_candidates_section(
426
+ verified=verified,
427
+ author_asserted=sorted(set(author_asserted)),
428
+ referenced=referenced_issues,
429
+ verified_reason=verified_reason,
430
+ author_reason=author_reason,
431
+ )
432
+
433
+ gh_status_text = (
434
+ gh_status_override or gh.status_message or "GitHub CLI authenticated."
435
+ )
436
+ if not gh_available and not gh_status_override:
437
+ gh_status_text = "GitHub CLI unavailable; references unverified."
438
+ intent_block = "\n".join(
439
+ [
440
+ section("PR Intent"),
441
+ "Primary outcome:",
442
+ "User/dev impact:",
443
+ "Risks:",
444
+ "Author-asserted autoclose issues:",
445
+ ]
446
+ )
447
+
448
+ summary_sections = [
449
+ section("GitHub CLI status"),
450
+ gh_status_text,
451
+ intent_block,
452
+ section("Base/Head"),
453
+ f"Base ref (requested): {context_result.base_ref or '(default)'}",
454
+ (
455
+ f"Base ref (resolved): {context_result.resolved_base or '(unknown)'} @ "
456
+ f"{context_result.base_sha or '(unknown)'}"
457
+ ),
458
+ (
459
+ f"Head ref (resolved): {context_result.head_ref or head or '(unknown)'} @ "
460
+ f"{context_result.head_sha or '(unknown)'}"
461
+ ),
462
+ f"Merge base: {context_result.merge_base or '(unknown)'}",
463
+ f"Range: {context_result.rev_range or '(unknown)'}",
464
+ ]
465
+ if (
466
+ context_result.base_ref
467
+ and context_result.resolved_base
468
+ and not str(context_result.resolved_base).startswith("origin/")
469
+ ):
470
+ summary_sections.append(
471
+ "WARNING: Requested base is local and may be stale; prefer "
472
+ f"origin/{context_result.base_ref}"
473
+ )
474
+ summary_sections.extend(
475
+ [
476
+ "",
477
+ issues_to_autoclose_section,
478
+ "",
479
+ close_candidates,
480
+ "",
481
+ section("Additional context files"),
482
+ format_list(additional_context_files, "(none)"),
483
+ "",
484
+ section("Feature doc excerpts"),
485
+ feature_summary,
486
+ "",
487
+ section("Referenced issues (classified)"),
488
+ format_list(referenced_issues, "(none)")
489
+ + ("\nNOTE: Unverified (GitHub unavailable)" if not gh_available else ""),
490
+ "",
491
+ section("PRs in range (classified)"),
492
+ format_list(referenced_prs, "(none)"),
493
+ "",
494
+ section("Invalid references (not found)"),
495
+ format_list(invalid_refs, "(none)"),
496
+ "",
497
+ section("Scoping docs changed"),
498
+ "\n".join(scoping_summary_lines),
499
+ "",
500
+ section("Changed files overview"),
501
+ bucket_text("Core logic changes", bucket_core),
502
+ "",
503
+ bucket_text("Mechanical moves/renames", bucket_renames),
504
+ "",
505
+ bucket_text("Docs/templates/agents/tooling", bucket_docs),
506
+ "",
507
+ section("Issue digests"),
508
+ issue_digests or "(none)",
509
+ "",
510
+ section("PR digests"),
511
+ pr_digests or "(none)",
512
+ "",
513
+ section("Verification evidence (feature docs + canonical artifacts)"),
514
+ verification_evidence_section,
515
+ "",
516
+ section("CI status (HEAD)"),
517
+ (
518
+ f"Status: {ci_status}\n"
519
+ + (f"Failing jobs: {', '.join(ci_jobs)}" if ci_jobs else "")
520
+ if ci_status
521
+ else "(not available)"
522
+ ),
523
+ "",
524
+ section("Appendix pointer"),
525
+ f"See {appendix_path}",
526
+ ]
527
+ )
528
+
529
+ summary_text = "\n".join(summary_sections)
530
+ if len(summary_text) > SUMMARY_CHAR_BUDGET:
531
+ summary_text = (
532
+ summary_text[:SUMMARY_CHAR_BUDGET] + "\nTRUNCATED: summary budget exceeded"
533
+ )
534
+
535
+ feature_block = "\n".join(doc.excerpt for doc in feature_docs)
536
+
537
+ issue_sections = [_issue_appendix(detail) for detail in issue_details]
538
+ pr_sections = [_pr_appendix(detail) for detail in pr_details_list]
539
+ appendix_parts = [
540
+ append_generation_timestamp(),
541
+ context_result.text,
542
+ "",
543
+ section("Issue details"),
544
+ "\n\n".join(issue_sections) if issue_sections else "(none)",
545
+ "",
546
+ section("Contributing pull requests"),
547
+ "\n\n".join(pr_sections) if pr_sections else "(none)",
548
+ ]
549
+ if feature_block:
550
+ appendix_parts.extend(["", feature_block])
551
+ appendix_text = "\n".join(appendix_parts)
552
+ if len(appendix_text) > APPENDIX_CHAR_BUDGET:
553
+ appendix_text = (
554
+ appendix_text[:APPENDIX_CHAR_BUDGET]
555
+ + "\nTRUNCATED: appendix budget exceeded"
556
+ )
557
+
558
+ write_output(summary_text, summary_path, append)
559
+ write_output(appendix_text, appendix_path, append)
560
+ print(f"Wrote context summary to: {summary_path}")
561
+ print(f"Wrote context appendix to: {appendix_path}")
562
+
563
+
564
+ def parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace:
565
+ parser = argparse.ArgumentParser(description="Collect PR context for GitHub.")
566
+ parser.add_argument(
567
+ "--base", dest="base", help="Base ref (default: auto-detect origin/main)"
568
+ )
569
+ parser.add_argument("--head", dest="head", help="Head ref (default: HEAD)")
570
+ parser.add_argument(
571
+ "--out",
572
+ dest="out",
573
+ default=SUMMARY_PATH_DEFAULT,
574
+ help="Summary output file path",
575
+ )
576
+ parser.add_argument(
577
+ "--appendix-out",
578
+ dest="appendix_out",
579
+ default=APPENDIX_PATH_DEFAULT,
580
+ help="Appendix output file path",
581
+ )
582
+ parser.add_argument(
583
+ "--repo-root",
584
+ dest="repo_root",
585
+ default=".",
586
+ help="Repository root (defaults to current directory)",
587
+ )
588
+ parser.add_argument(
589
+ "--append",
590
+ dest="append",
591
+ action="store_true",
592
+ help="Append instead of overwrite",
593
+ )
594
+ parser.add_argument(
595
+ "--no-untracked",
596
+ dest="no_untracked",
597
+ action="store_true",
598
+ help="Exclude untracked files from status",
599
+ )
600
+ return parser.parse_args(argv)
601
+
602
+
603
+ def main(argv: Sequence[str] | None = None) -> None:
604
+ args = parse_args(argv)
605
+ out_path = Path(args.out).expanduser()
606
+ repo_root = Path(args.repo_root).expanduser().resolve()
607
+ collect_and_write(
608
+ base=args.base,
609
+ head=args.head,
610
+ out=out_path,
611
+ appendix_out=Path(args.appendix_out).expanduser(),
612
+ repo_root=repo_root,
613
+ append=bool(args.append),
614
+ include_untracked=not bool(args.no_untracked),
615
+ )
616
+
617
+
618
+ if __name__ == "__main__":
619
+ main()