@snipcodeit/mgw 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.
@@ -0,0 +1,260 @@
1
+ ---
2
+ name: mgw:review
3
+ description: Review and classify new comments on a GitHub issue since last triage
4
+ argument-hint: "<issue-number>"
5
+ allowed-tools:
6
+ - Bash
7
+ - Read
8
+ - Write
9
+ - Edit
10
+ - Task
11
+ - AskUserQuestion
12
+ ---
13
+
14
+ <objective>
15
+ Standalone comment review for a triaged issue. Fetches new comments posted since
16
+ triage, classifies them (material/informational/blocking), and updates the state
17
+ file accordingly.
18
+
19
+ Use this when you want to check for stakeholder feedback before running the pipeline,
20
+ or to review comments on a blocked issue before unblocking it.
21
+ </objective>
22
+
23
+ <execution_context>
24
+ @~/.claude/commands/mgw/workflows/state.md
25
+ @~/.claude/commands/mgw/workflows/github.md
26
+ @~/.claude/commands/mgw/workflows/gsd.md
27
+ @~/.claude/commands/mgw/workflows/validation.md
28
+ </execution_context>
29
+
30
+ <context>
31
+ Issue number: $ARGUMENTS
32
+
33
+ State: .mgw/active/ (must exist — issue must be triaged first)
34
+ </context>
35
+
36
+ <process>
37
+
38
+ <step name="validate_and_load">
39
+ **Validate input and load state:**
40
+
41
+ ```bash
42
+ REPO_ROOT=$(git rev-parse --show-toplevel)
43
+ ```
44
+
45
+ Parse $ARGUMENTS for issue number. If missing:
46
+ ```
47
+ AskUserQuestion(
48
+ header: "Issue Number Required",
49
+ question: "Which issue number do you want to review comments for?",
50
+ followUp: "Enter the GitHub issue number (e.g., 42)"
51
+ )
52
+ ```
53
+
54
+ Load state file: `${REPO_ROOT}/.mgw/active/${ISSUE_NUMBER}-*.json`
55
+
56
+ If no state file exists:
57
+ ```
58
+ Issue #${ISSUE_NUMBER} hasn't been triaged yet.
59
+ Run /mgw:issue ${ISSUE_NUMBER} first, then review comments.
60
+ ```
61
+ </step>
62
+
63
+ <step name="fetch_comments">
64
+ **Fetch current comment state from GitHub:**
65
+
66
+ ```bash
67
+ CURRENT_COMMENTS=$(gh issue view $ISSUE_NUMBER --json comments --jq '.comments | length' 2>/dev/null || echo "0")
68
+ STORED_COMMENTS="${triage.last_comment_count}"
69
+
70
+ if [ -z "$STORED_COMMENTS" ] || [ "$STORED_COMMENTS" = "null" ]; then
71
+ STORED_COMMENTS=0
72
+ fi
73
+
74
+ NEW_COUNT=$(($CURRENT_COMMENTS - $STORED_COMMENTS))
75
+ ```
76
+
77
+ If no new comments (`NEW_COUNT <= 0`):
78
+ ```
79
+ No new comments on #${ISSUE_NUMBER} since triage (${STORED_COMMENTS} comments at triage, ${CURRENT_COMMENTS} now).
80
+ ```
81
+ Stop.
82
+
83
+ If new comments exist, fetch them:
84
+ ```bash
85
+ NEW_COMMENTS=$(gh issue view $ISSUE_NUMBER --json comments \
86
+ --jq "[.comments[-${NEW_COUNT}:]] | .[] | {author: .author.login, body: .body, createdAt: .createdAt}" 2>/dev/null)
87
+ ```
88
+ </step>
89
+
90
+ <step name="classify_comments">
91
+ **Spawn classification agent:**
92
+
93
+ ```
94
+ Task(
95
+ prompt="
96
+ <files_to_read>
97
+ - ./CLAUDE.md (Project instructions — if exists, follow all guidelines)
98
+ </files_to_read>
99
+
100
+ Classify new comments on GitHub issue #${ISSUE_NUMBER}.
101
+
102
+ <issue_context>
103
+ Title: ${issue_title}
104
+ Current pipeline stage: ${pipeline_stage}
105
+ GSD Route: ${gsd_route}
106
+ Triage scope: ${triage.scope}
107
+ </issue_context>
108
+
109
+ <new_comments>
110
+ ${NEW_COMMENTS}
111
+ </new_comments>
112
+
113
+ <classification_rules>
114
+ Classify each comment (and the overall batch) into ONE of:
115
+
116
+ - **material** — Comment changes scope, requirements, acceptance criteria, or design.
117
+ Examples: 'Actually we also need to handle X', 'Changed the requirement to Y',
118
+ 'Don't forget about edge case Z'.
119
+
120
+ - **informational** — Status update, acknowledgment, question that doesn't change scope, +1.
121
+ Examples: 'Looks good', 'Thanks for picking this up', 'What's the ETA?', '+1'.
122
+
123
+ - **blocking** — Explicit instruction to stop or wait. Must contain clear hold language.
124
+ Examples: 'Don't work on this yet', 'Hold off', 'Blocked by external dependency',
125
+ 'Wait for design review'.
126
+
127
+ - **resolution** — Comment indicates a previously identified blocker or issue has been resolved.
128
+ Examples: 'The dependency has been updated', 'Security review complete — approved',
129
+ 'Added the missing acceptance criteria', 'Updated the issue with more detail',
130
+ 'Fixed the blocking issue in #42'.
131
+
132
+ If ANY comment in the batch is blocking, overall classification is blocking.
133
+ If ANY comment is resolution (and none blocking), overall classification is resolution.
134
+ If ANY comment is material (and none blocking/resolution), overall classification is material.
135
+ Otherwise, informational.
136
+ </classification_rules>
137
+
138
+ <output_format>
139
+ Return ONLY valid JSON:
140
+ {
141
+ \"classification\": \"material|informational|blocking|resolution\",
142
+ \"reasoning\": \"Brief explanation of why this classification was chosen\",
143
+ \"per_comment\": [
144
+ {
145
+ \"author\": \"username\",
146
+ \"snippet\": \"first 100 chars of comment\",
147
+ \"classification\": \"material|informational|blocking|resolution\"
148
+ }
149
+ ],
150
+ \"new_requirements\": [\"list of new requirements if material, empty array otherwise\"],
151
+ \"blocking_reason\": \"reason if blocking, empty string otherwise\",
152
+ \"resolved_blocker\": \"description of what was resolved, empty string otherwise\"
153
+ }
154
+ </output_format>
155
+ ",
156
+ subagent_type="general-purpose",
157
+ description="Classify comments on #${ISSUE_NUMBER}"
158
+ )
159
+ ```
160
+ </step>
161
+
162
+ <step name="present_and_act">
163
+ **Present classification and offer actions:**
164
+
165
+ Display the classification result:
166
+
167
+ ```
168
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
169
+ MGW ► COMMENT REVIEW — #${ISSUE_NUMBER}
170
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
171
+
172
+ New comments: ${NEW_COUNT} since triage
173
+ Classification: ${classification}
174
+ Reasoning: ${reasoning}
175
+
176
+ ${per_comment_table}
177
+
178
+ ${if material: 'New requirements detected:\n' + new_requirements}
179
+ ${if blocking: 'Blocking reason: ' + blocking_reason}
180
+ ```
181
+
182
+ Offer actions based on classification:
183
+
184
+ **If informational:**
185
+ ```
186
+ AskUserQuestion(
187
+ header: "Informational Comments",
188
+ question: "Mark comments as reviewed and update state?",
189
+ options: [
190
+ { label: "Yes", description: "Update last_comment_count, continue" },
191
+ { label: "No", description: "Keep current state, don't update count" }
192
+ ]
193
+ )
194
+ ```
195
+ If yes: update `triage.last_comment_count` to $CURRENT_COMMENTS in state file.
196
+
197
+ **If material:**
198
+ ```
199
+ AskUserQuestion(
200
+ header: "Material Comments Detected",
201
+ question: "How should MGW handle the scope change?",
202
+ options: [
203
+ { label: "Acknowledge and continue", description: "Update state with new requirements, keep current route" },
204
+ { label: "Re-triage", description: "Run /mgw:issue to re-analyze with new context" },
205
+ { label: "Ignore", description: "Don't update state" }
206
+ ]
207
+ )
208
+ ```
209
+ If acknowledge: update `triage.last_comment_count` and store new_requirements in state.
210
+ If re-triage: suggest running `/mgw:issue ${ISSUE_NUMBER}` to re-triage.
211
+
212
+ **If blocking:**
213
+ ```
214
+ AskUserQuestion(
215
+ header: "Blocking Comment Detected",
216
+ question: "Block the pipeline for this issue?",
217
+ options: [
218
+ { label: "Block", description: "Set pipeline_stage to 'blocked'" },
219
+ { label: "Override", description: "Ignore blocker, keep current stage" },
220
+ { label: "Review", description: "I'll review the comments manually" }
221
+ ]
222
+ )
223
+ ```
224
+ If block: update `pipeline_stage = "blocked"` and `triage.last_comment_count` in state.
225
+ If override: update `triage.last_comment_count` only, keep pipeline_stage.
226
+
227
+ **If resolution:**
228
+ ```
229
+ AskUserQuestion(
230
+ header: "Blocker Resolution Detected",
231
+ question: "A previous blocker appears to be resolved. Re-triage this issue?",
232
+ options: [
233
+ { label: "Re-triage", description: "Run /mgw:issue to re-analyze with updated context" },
234
+ { label: "Acknowledge", description: "Update comment count, keep current pipeline stage" },
235
+ { label: "Ignore", description: "Don't update state" }
236
+ ]
237
+ )
238
+ ```
239
+ If re-triage:
240
+ - Update `triage.last_comment_count`
241
+ - Suggest: "Run `/mgw:issue ${ISSUE_NUMBER}` to re-triage with the resolved context."
242
+ - If pipeline_stage is "blocked" or "needs-info" or "needs-security-review", note:
243
+ "Re-triage will re-evaluate gates and may unblock the pipeline."
244
+ If acknowledge:
245
+ - Update `triage.last_comment_count`
246
+ - Keep current pipeline_stage
247
+ </step>
248
+
249
+ </process>
250
+
251
+ <success_criteria>
252
+ - [ ] Issue state loaded from .mgw/active/
253
+ - [ ] Current comment count fetched from GitHub
254
+ - [ ] New comments identified (delta from stored count)
255
+ - [ ] Classification agent spawned and returned structured result
256
+ - [ ] Classification presented to user with per-comment breakdown
257
+ - [ ] User chose action (acknowledge/re-triage/block/ignore)
258
+ - [ ] State file updated according to user choice
259
+ - [ ] Resolution classification type supported with re-triage prompt
260
+ </success_criteria>