@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,119 @@
1
+ ---
2
+ name: mgw:help
3
+ description: Show available MGW commands and usage guide
4
+ argument-hint: ""
5
+ allowed-tools: []
6
+ ---
7
+
8
+ <objective>
9
+ Display the MGW (My GSD Workflow) command reference. No side effects.
10
+ </objective>
11
+
12
+ <process>
13
+
14
+ Display the following help text exactly:
15
+
16
+ ```
17
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
18
+ MGW — My GSD Workflow
19
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
20
+
21
+ GitHub ↔ GSD bridge. Automates the issue → triage → execute → PR lifecycle.
22
+ Work runs in isolated git worktrees — your main workspace stays on the default branch.
23
+ Local state in .mgw/ (gitignored, per-developer).
24
+
25
+ COMMANDS
26
+
27
+ Setup
28
+ ─────
29
+ /mgw:init Bootstrap repo for MGW (state, templates, labels)
30
+
31
+ Project
32
+ ───────
33
+ /mgw:project Initialize project — milestones, issues, ROADMAP from template
34
+
35
+ Browse & Triage
36
+ ───────────────
37
+ /mgw:issues [filters] List open issues (defaults: @me, open)
38
+ /mgw:issue <number> Triage issue against codebase, recommend GSD route
39
+
40
+ Pipeline
41
+ ────────
42
+ /mgw:run <number> Autonomous: triage → GSD execute → PR (worktree-isolated)
43
+ /mgw:milestone Execute milestone issues in dependency order (auto-sync, checkpoint)
44
+ /mgw:next Show next unblocked issue — what to work on now
45
+
46
+ Query
47
+ ─────
48
+ /mgw:status [milestone] [--json] Project dashboard — milestone progress + issue stages
49
+ /mgw:roadmap [--set-dates] [--post-discussion] Roadmap table — milestone completion, due dates, Discussion post
50
+
51
+ GitHub Operations
52
+ ─────────────────
53
+ /mgw:update <number> [msg] Post status comment (auto-detects type, or custom)
54
+ /mgw:pr [number] [--base b] Create PR from GSD artifacts + issue context
55
+ /mgw:link <ref> <ref> Cross-reference issues/PRs/branches
56
+
57
+ Query
58
+ ─────
59
+ /mgw:ask <question> Route a question — in-scope, adjacent, separate, duplicate, out-of-scope
60
+
61
+ Maintenance
62
+ ───────────
63
+ /mgw:sync Reconcile .mgw/ state with GitHub
64
+ /mgw:help This help text
65
+
66
+ TYPICAL FLOW
67
+
68
+ 0. /mgw:init One-time repo setup (state, templates, labels)
69
+ 1. /mgw:project Day 1: create milestones + issue backlog from template
70
+ 2. /mgw:next See what's unblocked — pick your next issue
71
+ 3. /mgw:run 42 Full pipeline: plan → execute → verify → PR
72
+ (runs in worktree, you stay on main)
73
+ 4. /mgw:milestone Auto-run all unblocked issues in dependency order
74
+ 5. /mgw:sync After merge: archive state, clean up branches
75
+
76
+ Or work issue-by-issue:
77
+ /mgw:issues Browse your assigned issues
78
+ /mgw:issue 42 Triage — scope, validity, security, GSD route
79
+ /mgw:run 42 Auto-triages if not done yet
80
+
81
+ MANUAL OPERATIONS
82
+
83
+ /mgw:update 42 "switching approach due to #38"
84
+ /mgw:link 42 #43
85
+ /mgw:link 42 branch:fix/auth-42
86
+ /mgw:pr Standalone PR from current branch
87
+ /mgw:pr 42 --base develop PR linked to issue, custom base
88
+
89
+ FILTER EXAMPLES
90
+
91
+ /mgw:issues Your open issues (default)
92
+ /mgw:issues --label bug Filter by label
93
+ /mgw:issues --assignee all All open issues
94
+ /mgw:issues --milestone v2.0 Filter by milestone
95
+
96
+ GSD ROUTE MAPPING
97
+
98
+ Issue scope → GSD entry point (recommended by /mgw:issue):
99
+ Small (1-2 files) → gsd:quick
100
+ Medium (3-8 files) → gsd:quick --full
101
+ Large (9+ files/new sys) → gsd:new-milestone
102
+
103
+ STATE
104
+
105
+ .mgw/active/ In-progress issues
106
+ .mgw/completed/ Archived after merge
107
+ .mgw/cross-refs.json Issue ↔ PR ↔ branch links
108
+ .mgw/config.json User preferences
109
+ .mgw/project.json Project structure (milestones, phases, template)
110
+
111
+ SHARED WORKFLOWS
112
+
113
+ workflows/state.md State management, staleness detection, validate_and_load
114
+ workflows/github.md All gh CLI patterns (issues, PRs, labels, comments)
115
+ workflows/gsd.md Task() spawn templates, CLAUDE.md injection, GSD utilities
116
+ workflows/validation.md Delegation boundary rule — MGW orchestrates, never codes
117
+ ```
118
+
119
+ </process>
@@ -0,0 +1,250 @@
1
+ ---
2
+ name: mgw:init
3
+ description: Bootstrap current repo for MGW integration — creates .mgw/ state, GitHub templates, gitignore entries
4
+ argument-hint: ""
5
+ allowed-tools:
6
+ - Bash
7
+ - Read
8
+ - Write
9
+ - Edit
10
+ - Glob
11
+ ---
12
+
13
+ <objective>
14
+ One-time setup for a repo to work with MGW. Creates the .mgw/ state directory,
15
+ GitHub issue/PR templates, and ensures gitignore entries. Safe to re-run — skips
16
+ anything that already exists.
17
+ </objective>
18
+
19
+ <execution_context>
20
+ @~/.claude/commands/mgw/workflows/state.md
21
+ @~/.claude/commands/mgw/workflows/github.md
22
+ @~/.claude/commands/mgw/workflows/validation.md
23
+ </execution_context>
24
+
25
+ <process>
26
+
27
+ <step name="verify_repo">
28
+ **Verify we're in a git repo with a GitHub remote:**
29
+
30
+ ```bash
31
+ REPO_ROOT=$(git rev-parse --show-toplevel)
32
+ gh repo view --json nameWithOwner -q .nameWithOwner
33
+ ```
34
+
35
+ If not a git repo → error: "Not a git repository. Run from a repo root."
36
+ If no GitHub remote → error: "No GitHub remote found. MGW requires a GitHub repo."
37
+
38
+ Store REPO_NAME from gh output.
39
+ </step>
40
+
41
+ <step name="init_mgw_state">
42
+ **Initialize .mgw/ directory (from state.md):**
43
+
44
+ Follow initialization procedure from @~/.claude/commands/mgw/workflows/state.md:
45
+ ```bash
46
+ mkdir -p "${REPO_ROOT}/.mgw/active" "${REPO_ROOT}/.mgw/completed"
47
+ ```
48
+
49
+ Ensure .mgw/ is gitignored:
50
+ ```bash
51
+ if ! grep -q "^\.mgw/$" "${REPO_ROOT}/.gitignore" 2>/dev/null; then
52
+ echo ".mgw/" >> "${REPO_ROOT}/.gitignore"
53
+ fi
54
+ ```
55
+
56
+ Initialize cross-refs:
57
+ ```bash
58
+ if [ ! -f "${REPO_ROOT}/.mgw/cross-refs.json" ]; then
59
+ echo '{"links":[]}' > "${REPO_ROOT}/.mgw/cross-refs.json"
60
+ fi
61
+ ```
62
+
63
+ Ensure .worktrees/ is gitignored:
64
+ ```bash
65
+ if ! grep -q "^\.worktrees/$" "${REPO_ROOT}/.gitignore" 2>/dev/null; then
66
+ echo ".worktrees/" >> "${REPO_ROOT}/.gitignore"
67
+ fi
68
+ ```
69
+ </step>
70
+
71
+ <step name="create_issue_templates">
72
+ **Create GitHub issue templates (skip if they exist):**
73
+
74
+ Check for existing templates:
75
+ ```bash
76
+ ls "${REPO_ROOT}/.github/ISSUE_TEMPLATE/" 2>/dev/null
77
+ ```
78
+
79
+ If no templates exist, create:
80
+
81
+ `${REPO_ROOT}/.github/ISSUE_TEMPLATE/bug.yml`:
82
+ ```yaml
83
+ name: Bug Report
84
+ description: Something isn't working as expected
85
+ labels: ["bug"]
86
+ body:
87
+ - type: textarea
88
+ id: bluf
89
+ attributes:
90
+ label: BLUF
91
+ description: Bottom Line Up Front — one sentence summary of the problem
92
+ validations:
93
+ required: true
94
+
95
+ - type: textarea
96
+ id: whats-wrong
97
+ attributes:
98
+ label: What's Wrong
99
+ description: What's broken, with file paths and line numbers where relevant
100
+ validations:
101
+ required: true
102
+
103
+ - type: textarea
104
+ id: whats-involved
105
+ attributes:
106
+ label: What's Involved
107
+ description: Files and systems that need changes
108
+ validations:
109
+ required: true
110
+
111
+ - type: textarea
112
+ id: steps-to-fix
113
+ attributes:
114
+ label: Steps to Fix
115
+ description: Suggested fix approach (optional but helpful for triage)
116
+ validations:
117
+ required: false
118
+
119
+ - type: textarea
120
+ id: context
121
+ attributes:
122
+ label: Additional Context
123
+ validations:
124
+ required: false
125
+ ```
126
+
127
+ `${REPO_ROOT}/.github/ISSUE_TEMPLATE/enhancement.yml`:
128
+ ```yaml
129
+ name: Enhancement
130
+ description: New feature or improvement to existing functionality
131
+ labels: ["enhancement"]
132
+ body:
133
+ - type: textarea
134
+ id: bluf
135
+ attributes:
136
+ label: BLUF
137
+ description: Bottom Line Up Front — one sentence summary of what you want
138
+ validations:
139
+ required: true
140
+
141
+ - type: textarea
142
+ id: whats-needed
143
+ attributes:
144
+ label: What's Needed
145
+ description: What should change or be added, with specifics
146
+ validations:
147
+ required: true
148
+
149
+ - type: textarea
150
+ id: whats-involved
151
+ attributes:
152
+ label: What's Involved
153
+ description: Files, systems, and scope estimate
154
+ validations:
155
+ required: true
156
+
157
+ - type: textarea
158
+ id: context
159
+ attributes:
160
+ label: Additional Context
161
+ validations:
162
+ required: false
163
+ ```
164
+
165
+ If templates already exist → report "Issue templates already exist, skipping."
166
+ </step>
167
+
168
+ <step name="create_pr_template">
169
+ **Create PR template (skip if exists):**
170
+
171
+ Check: `${REPO_ROOT}/.github/PULL_REQUEST_TEMPLATE.md`
172
+
173
+ If not found, create:
174
+ ```markdown
175
+ ## Summary
176
+ <!-- 2-4 bullets: what changed and why -->
177
+
178
+ -
179
+
180
+ Closes #<!-- issue number -->
181
+
182
+ ## Changes
183
+ <!-- Group by system/module -->
184
+
185
+ -
186
+
187
+ ## Test Plan
188
+ <!-- How to verify these changes work -->
189
+
190
+ - [ ]
191
+ ```
192
+
193
+ If exists → report "PR template already exists, skipping."
194
+ </step>
195
+
196
+ <step name="ensure_labels">
197
+ **Ensure standard labels exist on GitHub:**
198
+
199
+ ```bash
200
+ gh label create "bug" --description "Something isn't working" --color "d73a4a" --force
201
+ gh label create "enhancement" --description "New feature or improvement" --color "a2eeef" --force
202
+
203
+ # MGW pipeline labels
204
+ gh label create "mgw:triaged" --description "Issue triaged and ready for pipeline" --color "0e8a16" --force
205
+ gh label create "mgw:needs-info" --description "Blocked — needs more detail or clarification" --color "e4e669" --force
206
+ gh label create "mgw:needs-security-review" --description "Blocked — requires security review" --color "d93f0b" --force
207
+ gh label create "mgw:discussing" --description "Under discussion — not yet approved" --color "c5def5" --force
208
+ gh label create "mgw:approved" --description "Discussion complete — approved for execution" --color "0e8a16" --force
209
+ gh label create "mgw:in-progress" --description "Pipeline actively executing" --color "1d76db" --force
210
+ gh label create "mgw:blocked" --description "Pipeline blocked by stakeholder comment" --color "b60205" --force
211
+ ```
212
+
213
+ `--force` updates existing labels without error.
214
+ </step>
215
+
216
+ <step name="report">
217
+ **Report setup status:**
218
+
219
+ ```
220
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
221
+ MGW ► INIT — ${REPO_NAME}
222
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
223
+
224
+ .mgw/ ${created|exists}
225
+ .mgw/cross-refs.json ${created|exists}
226
+ .gitignore entries ${added|exists}
227
+ Issue templates ${created|exists}
228
+ PR template ${created|exists}
229
+ GitHub labels synced
230
+ MGW pipeline labels synced (7 labels)
231
+
232
+ Ready to use:
233
+ /mgw:issues Browse issues
234
+ /mgw:run <number> Full pipeline
235
+ ```
236
+ </step>
237
+
238
+ </process>
239
+
240
+ <success_criteria>
241
+ - [ ] Verified git repo with GitHub remote
242
+ - [ ] .mgw/ directory structure created
243
+ - [ ] .mgw/ and .worktrees/ in .gitignore
244
+ - [ ] cross-refs.json initialized
245
+ - [ ] Issue templates created (bug + enhancement)
246
+ - [ ] PR template created
247
+ - [ ] GitHub labels ensured (bug, enhancement)
248
+ - [ ] MGW pipeline labels ensured (7 mgw:* labels)
249
+ - [ ] Setup report shown
250
+ </success_criteria>