commands.json.example 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. {
  2. "$schema": "https://json-schema.org/draft-07/schema#",
  3. "description": "Command configuration for webhook events. Available variables: {{repo}}, {{full_repo}}, {{repo_owner}}, {{branch}}, {{pusher}}, {{event}}, {{commit}}, {{commit_msg}}, {{pr_number}}, {{pr_action}}, {{tag}}, {{ref_type}}, {{issue_number}}, {{issue_title}}, {{issue_action}}, {{issue_body}}, {{issue_assignee}}, {{issue_labels}}, {{comment_body}}",
  4. "commands": {
  5. "push": [
  6. {
  7. "name": "echo-push-event",
  8. "description": "Simple echo command for push events",
  9. "type": "shell",
  10. "command": "echo",
  11. "args": ["Push to {{branch}} by {{pusher}} in {{repo}}"],
  12. "cwd": null,
  13. "timeout": 300000,
  14. "filterBranch": null
  15. },
  16. {
  17. "name": "deploy-production",
  18. "description": "Deploy to production on main branch",
  19. "type": "shell",
  20. "command": "/path/to/deploy.sh",
  21. "args": ["{{branch}}", "{{repo}}", "{{pusher}}"],
  22. "cwd": "/workspace",
  23. "timeout": 600000,
  24. "filterBranch": "main"
  25. }
  26. ],
  27. "pull_request": [
  28. {
  29. "name": "pr-notification",
  30. "description": "Notify team about pull requests",
  31. "type": "shell",
  32. "command": "echo",
  33. "args": ["PR #{{pr_number}} {{pr_action}} by {{pusher}}"],
  34. "cwd": null,
  35. "timeout": 300000,
  36. "filterBranch": null
  37. },
  38. {
  39. "name": "pr-ci-trigger",
  40. "description": "Trigger CI only for opened or synchronized PRs",
  41. "type": "shell",
  42. "command": "/path/to/trigger-ci.sh",
  43. "args": ["{{repo}}", "{{pr_number}}"],
  44. "cwd": null,
  45. "timeout": 300000,
  46. "filterBranch": null,
  47. "filterActions": ["opened", "synchronize"]
  48. }
  49. ],
  50. "create": [
  51. {
  52. "name": "branch-created",
  53. "description": "Handle new branch or tag creation",
  54. "type": "shell",
  55. "command": "echo",
  56. "args": ["Created {{ref_type}} {{branch}} in {{repo}}"],
  57. "cwd": null,
  58. "timeout": 300000,
  59. "filterBranch": null
  60. }
  61. ],
  62. "delete": [
  63. {
  64. "name": "branch-deleted",
  65. "description": "Handle branch or tag deletion",
  66. "type": "shell",
  67. "command": "echo",
  68. "args": ["Deleted {{ref_type}} {{branch}} from {{repo}}"],
  69. "cwd": null,
  70. "timeout": 300000,
  71. "filterBranch": null
  72. }
  73. ],
  74. "release": [
  75. {
  76. "name": "release-notification",
  77. "description": "Handle release events",
  78. "type": "shell",
  79. "command": "echo",
  80. "args": ["Release {{tag}} {{pr_action}} in {{repo}}"],
  81. "cwd": null,
  82. "timeout": 300000,
  83. "filterBranch": null
  84. }
  85. ],
  86. "issues": [
  87. {
  88. "name": "issue-notification",
  89. "description": "Notify team about issues",
  90. "type": "shell",
  91. "command": "echo",
  92. "args": ["Issue #{{issue_number}} {{issue_action}} by {{pusher}} in {{repo}}: {{issue_title}}"],
  93. "cwd": null,
  94. "timeout": 300000,
  95. "filterBranch": null
  96. },
  97. {
  98. "name": "claude-issue-handler",
  99. "description": "Automatically handle issues assigned to Claude with Claude Agent SDK TypeScript client",
  100. "type": "node",
  101. "command": "/data/agent-manager/client/dist/index.js",
  102. "args": ["{{repo_owner}}", "{{repo}}", "{{pusher}}", "{{issue_number}}", "{{issue_title}}", "{{issue_body}}", "{{issue_action}}", "", "{{issue_assignee}}"],
  103. "cwd": null,
  104. "timeout": 600000,
  105. "filterBranch": null,
  106. "filterActions": ["assigned", "opened", "reopened"],
  107. "filterAssignee": "claude"
  108. },
  109. {
  110. "name": "triage-issue",
  111. "description": "Auto-triage issues with a script",
  112. "type": "shell",
  113. "command": "/path/to/triage-issue.sh",
  114. "args": ["{{repo}}", "{{issue_number}}", "{{issue_body}}"],
  115. "cwd": null,
  116. "timeout": 300000,
  117. "filterBranch": null
  118. },
  119. {
  120. "name": "process-issue-with-node",
  121. "description": "Process issue with Node.js script",
  122. "type": "node",
  123. "command": "./scripts/process-issue.js",
  124. "args": ["--repo", "{{repo}}", "--issue", "{{issue_number}}", "--action", "{{issue_action}}"],
  125. "cwd": null,
  126. "timeout": 300000,
  127. "filterBranch": null
  128. }
  129. ],
  130. "issue_comment": [
  131. {
  132. "name": "comment-notification",
  133. "description": "Handle issue comments",
  134. "type": "shell",
  135. "command": "echo",
  136. "args": ["Comment on issue #{{issue_number}} by {{pusher}}: {{comment_body}}"],
  137. "cwd": null,
  138. "timeout": 300000,
  139. "filterBranch": null
  140. },
  141. {
  142. "name": "claude-comment-handler",
  143. "description": "Automatically handle issue comments for issues assigned to Claude with Claude Agent SDK TypeScript client",
  144. "type": "node",
  145. "command": "/data/agent-manager/client/dist/index.js",
  146. "args": ["{{repo_owner}}", "{{repo}}", "{{pusher}}", "{{issue_number}}", "{{issue_title}}", "{{issue_body}}", "{{issue_action}}", "{{comment_body}}", "{{issue_assignee}}"],
  147. "cwd": null,
  148. "timeout": 600000,
  149. "filterBranch": null,
  150. "filterActions": ["created"],
  151. "filterAssignee": "claude"
  152. },
  153. {
  154. "name": "check-comment-commands",
  155. "description": "Check for special commands in comments",
  156. "type": "shell",
  157. "command": "/path/to/check-comment-commands.sh",
  158. "args": ["{{comment_body}}", "{{issue_number}}"],
  159. "cwd": null,
  160. "timeout": 300000,
  161. "filterBranch": null
  162. }
  163. ],
  164. "global": [
  165. {
  166. "name": "log-all-events",
  167. "description": "Log all webhook events (runs for every event)",
  168. "type": "shell",
  169. "command": "echo",
  170. "args": ["Webhook {{event}} received for {{repo}}"],
  171. "cwd": null,
  172. "timeout": 300000,
  173. "filterBranch": null
  174. }
  175. ]
  176. }
  177. }