Skip to content

Commit 1f7fe63

Browse files
authored
chore(claude): add respond-to-discussion-features claude command (#15391)
# Overview Adds a Claude command that automates finding GitHub discussions resolved by recent releases and generates draft comments to inform the community. Invoked with `/respond-to-discussion-features` command. **NOTE:** This does not automatically respond. Only drafts a helpful answer. ## Key Changes - **New Claude command**: `.claude/commands/respond-to-discussion-features.md` - Fetches releases within a configurable time window (default: 2 months) - Parses release notes for `feat:` and `fix:` entries - Fetches all open Feature Request discussions via GraphQL - Matches features to discussions using keyword extraction - Generates markdown output with matches table and draft comments ## Design Decisions The command is fully agentic—it provides structured instructions that Claude executes step-by-step, using TodoWrite for progress tracking. This approach allows flexibility in matching logic while maintaining reproducibility through explicit process steps. Output goes to `.claude/artifacts/` (gitignored) rather than requiring manual cleanup of generated files. ## Overall Flow ```mermaid sequenceDiagram participant User participant Claude participant GitHub API participant Output User->>Claude: /respond-to-discussion-features [time-period] Claude->>GitHub API: gh release list (get releases in window) Claude->>GitHub API: gh release view (fetch release notes) Claude->>Claude: Parse feat:/fix: entries, extract keywords Claude->>GitHub API: GraphQL paginate discussions Claude->>Claude: Match keywords to discussion titles/bodies Claude->>Output: Write .claude/artifacts/community-response-YYYY-MM-DD.md Claude->>User: "Found N matches. Output written to..." ```
1 parent 17c0a3f commit 1f7fe63

1 file changed

Lines changed: 135 additions & 0 deletions

File tree

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
description: Find GitHub discussions resolved by recent releases and draft response comments to inform the community.
3+
argument-hint: <time-period> (default: 2months, e.g., "3months", "6weeks", "2025-11-01")
4+
allowed-tools: Bash(gh release list:*, gh release view:*, gh api graphql:*), Glob, Grep, Read, Write, TodoWrite
5+
---
6+
7+
# Respond to Community
8+
9+
Find open GitHub discussions in "Feature Requests & Ideas" that have been resolved by recent releases, and generate draft comments to post.
10+
11+
## Arguments
12+
13+
- `$ARGUMENTS` - Time period to analyze (default: `2months`)
14+
- Accepts: `Ndays`, `Nweeks`, `Nmonths`, or ISO date `YYYY-MM-DD`
15+
16+
## Process
17+
18+
### Step 1: Setup & Fetch Releases
19+
20+
1. Parse time period from `$ARGUMENTS` (default: 2months)
21+
2. Create TodoWrite with: Fetch releases | Parse release notes | Fetch discussions | Match features to discussions | Generate output
22+
3. Run `gh release list --repo payloadcms/payload --limit 30` to get recent releases
23+
4. Filter to releases within the time period
24+
5. For each release, fetch notes: `gh release view <tag> --repo payloadcms/payload --json body -q '.body'`
25+
26+
### Step 2: Parse Release Notes
27+
28+
1. Extract feature and fix entries from each release:
29+
- Lines containing `feat:` or `feat(`
30+
- Lines containing `fix:` or `fix(`
31+
2. For each entry, capture:
32+
- PR title (the description text)
33+
- PR number (from `#NNNN` pattern)
34+
- Package scope if present (from `feat(scope):` pattern)
35+
- Version it shipped in
36+
3. Build keyword list from titles (feature names, package names, key terms)
37+
38+
### Step 3: Fetch Discussions
39+
40+
1. Use GraphQL to paginate through all open Feature Request discussions:
41+
42+
```
43+
gh api graphql -f query='
44+
{
45+
repository(owner: "payloadcms", name: "payload") {
46+
discussions(first: 100, states: OPEN, categoryId: "MDE4OkRpc2N1c3Npb25DYXRlZ29yeTMyMzY4NTUx", orderBy: {field: CREATED_AT, direction: DESC}) {
47+
pageInfo { hasNextPage endCursor }
48+
nodes {
49+
number
50+
title
51+
url
52+
createdAt
53+
body
54+
}
55+
}
56+
}
57+
}'
58+
```
59+
60+
2. Continue paginating with `after: "<endCursor>"` until all discussions fetched
61+
3. Store: number, title, URL, createdAt, body (for matching)
62+
63+
### Step 4: Match Features to Discussions
64+
65+
For each feature/fix from releases:
66+
67+
1. Search discussion titles and bodies for keyword matches
68+
2. Consider semantic variations (e.g., "groupBy" matches "group by", "group-by")
69+
3. Filter: only include if discussion was created BEFORE the feature's release date
70+
4. Score matches by keyword overlap
71+
5. Flag ambiguous matches as "Needs Verification"
72+
73+
Multiple discussions can match the same PR - include all matches.
74+
75+
### Step 5: Generate Output
76+
77+
1. Create output directory if needed: `.claude/artifacts/`
78+
2. Generate markdown file: `.claude/artifacts/community-response-YYYY-MM-DD.md`
79+
80+
**Output structure:**
81+
82+
```markdown
83+
# Community Response: Features Shipped [start date][end date]
84+
85+
## Summary
86+
87+
Found **N discussions** resolved by releases vX.XX.X → vX.XX.X
88+
89+
## Matches
90+
91+
| Discussion Title | Discussion Link | PR Title | PR Link |
92+
| ---------------- | ------------------------------------------------------ | ---------- | ----------------------------------------------- |
93+
| [title] | https://github.com/payloadcms/payload/discussions/NNNN | [pr title] | https://github.com/payloadcms/payload/pull/NNNN |
94+
95+
## Draft Comments
96+
97+
### 1. [Discussion Title]
98+
99+
**Link:** https://github.com/payloadcms/payload/discussions/NNNN
100+
101+
> [Draft comment]
102+
103+
---
104+
```
105+
106+
**Comment template:**
107+
108+
- Lead with "Shipped in vX.XX.X 🎉" or "Fixed in vX.XX.X 🎉"
109+
- Brief description of what shipped (1-2 sentences)
110+
- Code example if the feature involves configuration
111+
- PR link at the end
112+
- Keep concise: 3-6 lines typical
113+
114+
3. Present summary to user: "Found N matches. Output written to .claude/artifacts/community-response-YYYY-MM-DD.md"
115+
116+
## Edge Cases
117+
118+
| Scenario | Action |
119+
| ------------------------------------ | --------------------------------------------- |
120+
| No `$ARGUMENTS` | Use default: 2months |
121+
| No releases in time period | Report "No releases found" and stop |
122+
| No matches found | Create output with "No matches found" message |
123+
| API rate limited | Report error, suggest waiting and retrying |
124+
| Ambiguous match | Include with "⚠️ Needs Verification" note |
125+
| Discussion already has team response | Include anyway - human reviewer will skip |
126+
127+
## Remember
128+
129+
- Create TodoWrite with 5 steps upfront
130+
- Mark steps in_progress before starting, completed after finishing
131+
- Full URLs in output table (not just issue numbers)
132+
- Comments should be helpful and concise
133+
- Better to surface a false positive than miss a real match
134+
- Human will review before posting - don't need to be perfect
135+
- Auto-save to `.claude/artifacts/` directory

0 commit comments

Comments
 (0)