claude-code-github-ci-channel 0.1.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.
- package/.env.example +45 -0
- package/README.md +543 -0
- package/config.example.yaml +153 -0
- package/dist/index.js +210 -0
- package/dist/mux.js +219 -0
- package/package.json +58 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# github-ci-channel configuration
|
|
2
|
+
#
|
|
3
|
+
# All fields are optional — omitted fields keep their default values.
|
|
4
|
+
# Pass this file at startup: npx @modelcontextprotocol/inspector --config ./my-config.yaml
|
|
5
|
+
# Or via the mcp entry in .claude/settings.json:
|
|
6
|
+
# "args": ["run", "src/index.ts", "--config", "/path/to/config.yaml"]
|
|
7
|
+
#
|
|
8
|
+
# Environment variables still override YAML for server.port and server.debounce_ms.
|
|
9
|
+
|
|
10
|
+
# ── Server ────────────────────────────────────────────────────────────────────
|
|
11
|
+
server:
|
|
12
|
+
# HTTP port for the incoming GitHub webhook. Env override: WEBHOOK_PORT
|
|
13
|
+
port: 9443
|
|
14
|
+
|
|
15
|
+
# Milliseconds to wait after the first review event before firing the batched
|
|
16
|
+
# notification. Gives GitHub time to deliver all events from a single review
|
|
17
|
+
# session before Claude acts. Env override: REVIEW_DEBOUNCE_MS
|
|
18
|
+
debounce_ms: 30000
|
|
19
|
+
|
|
20
|
+
# Milliseconds to suppress further notifications for the same PR after one fires.
|
|
21
|
+
# Prevents duplicate responses when a reviewer leaves many comments.
|
|
22
|
+
cooldown_ms: 300000 # 5 minutes
|
|
23
|
+
|
|
24
|
+
# Maximum review events buffered per debounce window.
|
|
25
|
+
# Prevents unbounded memory growth on PR review storms.
|
|
26
|
+
max_events_per_window: 50
|
|
27
|
+
|
|
28
|
+
# Branch names treated as the production/default branch.
|
|
29
|
+
# CI failures on these branches trigger the escalated on_ci_failure_main instruction.
|
|
30
|
+
main_branches:
|
|
31
|
+
- main
|
|
32
|
+
- master
|
|
33
|
+
|
|
34
|
+
# ── Webhook filters ───────────────────────────────────────────────────────────
|
|
35
|
+
webhooks:
|
|
36
|
+
# Allowlist of GitHub event types to process.
|
|
37
|
+
# Empty list (default) means all supported events are processed.
|
|
38
|
+
# Useful for narrowing a shared webhook to only the events you care about.
|
|
39
|
+
#
|
|
40
|
+
# Supported values:
|
|
41
|
+
# push, workflow_run, workflow_job, check_suite, check_run,
|
|
42
|
+
# pull_request, pull_request_review, pull_request_review_comment,
|
|
43
|
+
# pull_request_review_thread, issue_comment
|
|
44
|
+
allowed_events: []
|
|
45
|
+
|
|
46
|
+
# Allowlist of repositories (owner/repo) to process.
|
|
47
|
+
# Empty list (default) means all repositories posting to this webhook are handled.
|
|
48
|
+
# Example: only process two repos from a shared org webhook.
|
|
49
|
+
allowed_repos: []
|
|
50
|
+
# allowed_repos:
|
|
51
|
+
# - myorg/frontend
|
|
52
|
+
# - myorg/backend
|
|
53
|
+
|
|
54
|
+
# ── Agent behaviour ───────────────────────────────────────────────────────────
|
|
55
|
+
# Each section controls the instruction text appended to the channel notification
|
|
56
|
+
# Claude receives. Edit these to match your project's workflow and conventions.
|
|
57
|
+
#
|
|
58
|
+
# Template placeholders use {name} syntax.
|
|
59
|
+
# Unknown placeholders are left unchanged, so you can include literal braces
|
|
60
|
+
# by using names that don't appear in the variable list for that event.
|
|
61
|
+
behavior:
|
|
62
|
+
|
|
63
|
+
# Triggered when a workflow_run fails on a main/master branch.
|
|
64
|
+
# Placeholders: {repo}, {branch}, {run_url}, {workflow}, {status}, {commit}
|
|
65
|
+
on_ci_failure_main:
|
|
66
|
+
instruction: |
|
|
67
|
+
Main branch is broken. Act immediately — no confirmation needed.
|
|
68
|
+
Use the Agent tool NOW to spawn a subagent with these instructions:
|
|
69
|
+
Diagnose and fix the broken CI on main in {repo}:
|
|
70
|
+
1. Call fetch_workflow_logs("{run_url}") to read the failure
|
|
71
|
+
2. Identify the failing step and root cause
|
|
72
|
+
3. Apply a targeted fix in the codebase
|
|
73
|
+
4. Commit and push to restore main
|
|
74
|
+
5. Confirm CI is green.
|
|
75
|
+
|
|
76
|
+
# Triggered when a workflow_run fails on a non-main branch.
|
|
77
|
+
# Placeholders: {repo}, {branch}, {run_url}, {workflow}, {status}, {commit}
|
|
78
|
+
on_ci_failure_branch:
|
|
79
|
+
instruction: |
|
|
80
|
+
Act immediately — no confirmation needed.
|
|
81
|
+
Use the Agent tool NOW to spawn a subagent with these instructions:
|
|
82
|
+
Investigate the CI failure on branch {branch} in {repo}:
|
|
83
|
+
1. Call fetch_workflow_logs("{run_url}") to read the failure
|
|
84
|
+
2. Identify the root cause and fix it
|
|
85
|
+
3. Push the fix to the branch.
|
|
86
|
+
|
|
87
|
+
# Triggered when a PR review, inline comment, or unresolved thread arrives.
|
|
88
|
+
# Placeholder in instruction: {skill} (replaced with the skill field below)
|
|
89
|
+
on_pr_review:
|
|
90
|
+
# When true, the instruction must direct the agent to enter plan mode
|
|
91
|
+
# before making any code changes. Strongly recommended.
|
|
92
|
+
require_plan: true
|
|
93
|
+
|
|
94
|
+
# Skill invoked during the execution phase.
|
|
95
|
+
skill: pr-comment-response
|
|
96
|
+
|
|
97
|
+
instruction: |
|
|
98
|
+
MANDATORY: Enter plan mode first.
|
|
99
|
+
1. Read every linked thread and summarise what each one asks for
|
|
100
|
+
2. Draft a plan listing the file + change for each thread
|
|
101
|
+
3. Only after the plan is complete, use the {skill} skill to execute
|
|
102
|
+
|
|
103
|
+
Do NOT apply any fix before the plan step is done.
|
|
104
|
+
|
|
105
|
+
Execution phase:
|
|
106
|
+
1. For each comment thread above, open the link and read full context
|
|
107
|
+
2. Code comments: apply the fix in a worktree, commit
|
|
108
|
+
3. Questions / style: reply inline with a concise explanation
|
|
109
|
+
4. Use gh-pr-reply.sh --batch to post all replies in one shot
|
|
110
|
+
|
|
111
|
+
# Triggered when a PR has merge conflicts (mergeable_state=dirty).
|
|
112
|
+
# Placeholders: {repo}, {pr_number}, {pr_title}, {pr_url}, {head_branch}, {base_branch}
|
|
113
|
+
on_merge_conflict:
|
|
114
|
+
instruction: |
|
|
115
|
+
PR #{pr_number} has merge conflicts with {base_branch}. Act immediately — no confirmation needed.
|
|
116
|
+
|
|
117
|
+
Use the Agent tool NOW to spawn a subagent with these instructions:
|
|
118
|
+
Resolve merge conflicts for PR #{pr_number} in {repo}:
|
|
119
|
+
1. git worktree add /tmp/pr-{pr_number}-rebase {head_branch}
|
|
120
|
+
2. cd /tmp/pr-{pr_number}-rebase && git fetch origin
|
|
121
|
+
3. git rebase origin/{base_branch} -- fix conflicts, then: git add -A && git rebase --continue
|
|
122
|
+
4. git push --force-with-lease origin {head_branch}
|
|
123
|
+
5. git worktree remove /tmp/pr-{pr_number}-rebase
|
|
124
|
+
|
|
125
|
+
# Triggered when a PR is behind its base branch (mergeable_state=behind).
|
|
126
|
+
# Placeholders: {repo}, {pr_number}, {pr_title}, {pr_url}, {head_branch}, {base_branch}
|
|
127
|
+
on_branch_behind:
|
|
128
|
+
instruction: |
|
|
129
|
+
PR #{pr_number} is behind {base_branch} (no conflicts). Act immediately — no confirmation needed.
|
|
130
|
+
|
|
131
|
+
Use the Agent tool NOW to spawn a subagent with these instructions:
|
|
132
|
+
Rebase PR #{pr_number} in {repo}:
|
|
133
|
+
1. git worktree add /tmp/pr-{pr_number}-rebase {head_branch}
|
|
134
|
+
2. cd /tmp/pr-{pr_number}-rebase && git fetch origin
|
|
135
|
+
3. git rebase origin/{base_branch}
|
|
136
|
+
4. git push --force-with-lease origin {head_branch}
|
|
137
|
+
5. git worktree remove /tmp/pr-{pr_number}-rebase
|
|
138
|
+
|
|
139
|
+
# ── Code style guidelines ─────────────────────────────────────────────────────
|
|
140
|
+
# Free-text block prepended to every PR review notification.
|
|
141
|
+
# Use this to communicate project conventions so the agent applies them
|
|
142
|
+
# when responding to review comments.
|
|
143
|
+
#
|
|
144
|
+
# Leave empty (default) to omit this section from notifications.
|
|
145
|
+
code_style: ""
|
|
146
|
+
|
|
147
|
+
# Example:
|
|
148
|
+
# code_style: |
|
|
149
|
+
# - TypeScript strict mode; no `any`, no `!` assertions.
|
|
150
|
+
# - Prefer functional patterns; avoid class mutation.
|
|
151
|
+
# - All exported symbols must have JSDoc comments.
|
|
152
|
+
# - Tests go in src/__tests__/ as *.test.ts files using bun:test.
|
|
153
|
+
# - Format with Biome before committing.
|