@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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 snipcodeit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,517 @@
1
+ # MGW — My GSD Workflow
2
+
3
+ [![npm version](https://img.shields.io/npm/v/mgw)](https://www.npmjs.com/package/mgw)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![node](https://img.shields.io/node/v/mgw)](https://nodejs.org)
6
+ [![GitHub stars](https://img.shields.io/github/stars/snipcodeit/mgw)](https://github.com/snipcodeit/mgw)
7
+
8
+ > Issue in. PR out. No excuses.
9
+
10
+ **GitHub-native issue-to-PR automation for [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview), powered by [Get Shit Done](https://github.com/glittercowboy/get-shit-done).**
11
+
12
+ MGW bridges GitHub Issues and the GSD planning framework into a single pipeline. Point it at an issue, and it triages, plans, executes, and opens a PR — posting structured status updates at every stage. No context switching, no tab juggling, no copy-pasting between GitHub and your terminal.
13
+
14
+ ```
15
+ /mgw:run 42
16
+ ```
17
+
18
+ That's it. One command takes an issue from open to PR-ready.
19
+
20
+ ---
21
+
22
+ ## What It Does
23
+
24
+ MGW is a [Claude Code slash command](https://docs.anthropic.com/en/docs/claude-code/slash-commands) suite and standalone Node.js CLI that automates the lifecycle of a GitHub issue:
25
+
26
+ ```
27
+ /mgw:project State-aware init: Vision Cycle → GSD alignment → milestone scaffold
28
+ |
29
+ /mgw:issue 42 Triage: scope, validity, security, conflicts
30
+ |
31
+ /mgw:run 42 Plan → Execute → Verify → PR (autonomous)
32
+ |
33
+ /mgw:milestone Execute all issues in dependency order
34
+ |
35
+ PR created + status comments posted
36
+ |
37
+ Merge → issue auto-closes
38
+ ```
39
+
40
+ Each step is composable. Use the full pipeline or pick individual commands. For a detailed breakdown of the pipeline stages and agent delegation model, see the [Architecture Guide](docs/ARCHITECTURE.md).
41
+
42
+ ## Why I Built This
43
+
44
+ I'm a solo developer. On any given day I might be writing a game server, reverse-engineering a VM, building a mobile app, or reorganizing my entire dotfiles setup for the third time this week. My brain has one mode: *build*. The part where you go back and update the issue, post a comment, open a PR with a nice description, cross-reference the other thing you broke — that part doesn't exist in my workflow. It's not that I don't care. It's that by the time the feature works, I've already mentally moved on to the next thing.
45
+
46
+ The result is a graveyard of GitHub issues that say "Fix auth" with zero follow-up, branches named things only I understand, and PRs that my past self apparently thought were self-documenting. They were not.
47
+
48
+ So I built MGW to be the responsible adult in the room. I point it at an issue, it does all the paperwork I was never going to do, and my GitHub history finally looks like a person who has their life together. It's the professional version of me that answers emails on time and keeps a clean desk — except it's a dozen Markdown files, a Node CLI, and Claude doing all the work.
49
+
50
+ ## Who This Is For
51
+
52
+ MGW is for **solo developers and small teams using Claude Code** who want their GitHub history to reflect the work they actually did — without spending time on project management.
53
+
54
+ **You'll get the most out of MGW if you:**
55
+
56
+ - Use [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) as your primary development tool
57
+ - Have a pile of GitHub issues that never get proper status updates, PR descriptions, or cross-references
58
+ - Want a repeatable issue-to-PR pipeline that handles triage, planning, execution, and documentation automatically
59
+ - Work across multiple projects and lose context switching between GitHub and your terminal
60
+
61
+ **When to use MGW vs. Claude Code directly:**
62
+
63
+ | Scenario | Use |
64
+ |----------|-----|
65
+ | One-off code changes with no issue tracking | Claude Code directly |
66
+ | Issues that need triage, planning, status updates, and PRs | MGW |
67
+ | Executing a backlog of issues in dependency order | MGW (`/mgw:milestone`) |
68
+ | Scaffolding a new project from a description | MGW (`/mgw:project`) |
69
+ | Quick code question or file edit | Claude Code directly |
70
+
71
+ **Prerequisites:**
72
+
73
+ - Node.js >= 18
74
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) CLI installed and working
75
+ - [GitHub CLI](https://cli.github.com/) (`gh`) installed and authenticated (`gh auth status`)
76
+ - [Get Shit Done](https://github.com/glittercowboy/get-shit-done) (GSD) installed in Claude Code
77
+ - A GitHub repository with issues enabled
78
+
79
+ If you're already using Claude Code and GSD for development, MGW is the missing piece that connects your work back to GitHub. If you're not using either yet, start with Claude Code, then add GSD, then add MGW.
80
+
81
+ ## Commands
82
+
83
+ | Command | What it does |
84
+ |---------|-------------|
85
+ | `/mgw:project` | State-aware project init — detects Fresh/Aligned/Diverged/GSD-Only state and routes to the right flow (Vision Cycle, alignment backfill, drift reconciliation, or extend) |
86
+ | `/mgw:init` | Bootstrap repo for MGW — creates .mgw/ state, GitHub templates, gitignore entries |
87
+ | `/mgw:issues` | Browse and filter your GitHub issues |
88
+ | `/mgw:issue <n>` | Deep triage — scope analysis, security review, GSD route recommendation |
89
+ | `/mgw:next` | Show next unblocked issue based on dependency order |
90
+ | `/mgw:run <n>` | Full autonomous pipeline: triage through PR creation; enforces cross-milestone consistency |
91
+ | `/mgw:milestone [n]` | Execute a milestone's issues in dependency order with checkpointing and failed-issue recovery |
92
+ | `/mgw:update <n>` | Post structured status comments on issues |
93
+ | `/mgw:pr [n]` | Create PR from GSD artifacts with phase context and plan traceability |
94
+ | `/mgw:ask <question>` | Route a question or observation — classify as in-scope, adjacent, separate, duplicate, or out-of-scope |
95
+ | `/mgw:review <n>` | Review and classify new comments on an issue since last triage |
96
+ | `/mgw:link <ref> <ref>` | Cross-reference issues, PRs, and branches (including milestone ↔ GSD milestone maps-to links) |
97
+ | `/mgw:status [n]` | Project dashboard — milestone progress, issue stages, open PRs |
98
+ | `/mgw:sync` | Reconcile local state with GitHub; verifies GSD milestone consistency |
99
+ | `/mgw:help` | Command reference |
100
+
101
+ For detailed usage of every command including flags, examples, and edge cases, see the [User Guide](docs/USER-GUIDE.md#command-reference).
102
+
103
+ ## How Triage Works
104
+
105
+ `/mgw:issue` spawns an analysis agent that reads your codebase and evaluates the issue across five dimensions:
106
+
107
+ - **Scope** — which files and systems are affected, estimated size
108
+ - **Validity** — can the issue be confirmed by reading the code?
109
+ - **Purpose** — who benefits, what's the impact of inaction?
110
+ - **Security** — does it touch auth, user data, external APIs?
111
+ - **Conflicts** — does it overlap with other in-progress work?
112
+
113
+ Based on scope, MGW recommends a GSD route:
114
+
115
+ | Issue Size | GSD Route | What Happens |
116
+ |-----------|-----------|--------------|
117
+ | Small (1-2 files) | `gsd:quick` | Single-pass plan + execute |
118
+ | Medium (3-8 files) | `gsd:quick --full` | Plan with verification loop |
119
+ | Large (9+ files) | `gsd:new-milestone` | Full milestone with phased execution |
120
+ | Bug (unclear root cause) | `gsd:diagnose-issues` | Debug agent investigates root cause first, then routes to quick fix |
121
+
122
+ For a deeper explanation of how GSD routes work, including dependency ordering and how MGW selects the right route, see the [User Guide](docs/USER-GUIDE.md#gsd-routes-explained).
123
+
124
+ ## Status Comments
125
+
126
+ Every pipeline step posts a structured comment on the issue so you (and your team) can follow along on GitHub without touching the terminal:
127
+
128
+ ```
129
+ > MGW · `work-started` · 2026-02-26T03:31:00Z
130
+ > Milestone: v1.0 — Auth & Data Layer | Phase 1: Database Schema
131
+
132
+ ### Work Started
133
+
134
+ | | |
135
+ |---|---|
136
+ | **Issue** | #71 — Implement user registration |
137
+ | **Route** | `plan-phase` |
138
+ | **Phase** | 1 of 6 — Database Schema |
139
+ | **Milestone** | v1.0 — Auth & Data Layer |
140
+
141
+ <details>
142
+ <summary>Milestone Progress (1/6 complete)</summary>
143
+ | # | Issue | Status | PR |
144
+ |---|-------|--------|----|
145
+ | 70 | Design SQLite schema | ✓ Done | #85 |
146
+ | **71** | **User registration** | ◆ In Progress | — |
147
+ | 72 | JWT middleware | ○ Pending | — |
148
+ </details>
149
+ ```
150
+
151
+ Comments are posted for: `work-started`, `triage-complete`, `execution-complete`, `pr-ready`, and `pipeline-failed`. The milestone orchestrator handles all comment posting directly (not delegated to sub-agents), guaranteeing every stage is logged. For the full list of comment formats and customization options, see the [User Guide](docs/USER-GUIDE.md#status-comments-and-pr-descriptions).
152
+
153
+ ## PR Descriptions
154
+
155
+ PRs follow a consistent structure with milestone context:
156
+
157
+ ```markdown
158
+ ## Summary
159
+ - 2-4 bullets of what was built and why
160
+
161
+ Closes #71
162
+
163
+ ## Milestone Context
164
+ - **Milestone:** v1.0 — Auth & Data Layer
165
+ - **Phase:** 1 — Database Schema
166
+ - **Issue:** 2 of 6 in milestone
167
+
168
+ ## Changes
169
+ - File-level changes grouped by module
170
+
171
+ ## Test Plan
172
+ - Verification checklist
173
+ ```
174
+
175
+ ## State Management
176
+
177
+ MGW tracks pipeline state in a local `.mgw/` directory (gitignored, per-developer):
178
+
179
+ ```
180
+ .mgw/
181
+ project.json Milestones, issues, phases, pipeline stages, GSD milestone links
182
+ config.json User prefs (GitHub username, default filters)
183
+ active/ In-progress issue pipelines
184
+ 42-fix-auth.json Issue state: triage results, pipeline stage, artifacts
185
+ completed/ Archived after PR merge
186
+ cross-refs.json Bidirectional issue/PR/branch/milestone links
187
+ vision-draft.md (Fresh projects) Rolling decisions from questioning loop
188
+ vision-brief.json (Fresh projects) Structured Vision Brief (MoSCoW, personas, scope)
189
+ alignment-report.json (GSD-Only projects) GSD state mapped for milestone backfill
190
+ ```
191
+
192
+ Pipeline stages flow: `new` → `triaged` → `planning` → `executing` → `verifying` → `pr-created` → `done` (or `failed`/`blocked`). Bugs routed to `gsd:diagnose-issues` pass through `diagnosing` before `planning`.
193
+
194
+ The `/mgw:sync` command reconciles local state with GitHub reality — archiving completed work, flagging stale branches, and catching drift. For the complete state schema and configuration reference, see the [User Guide](docs/USER-GUIDE.md#the-mgw-directory). For how state flows through the system, see the [Architecture Guide](docs/ARCHITECTURE.md#state-management).
195
+
196
+ ## Requirements
197
+
198
+ - [Node.js](https://nodejs.org/) >= 18
199
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) (CLI)
200
+ - [Get Shit Done](https://github.com/glittercowboy/get-shit-done) (GSD) installed in Claude Code
201
+ - [GitHub CLI](https://cli.github.com/) (`gh`) authenticated
202
+ - A GitHub repository with issues enabled
203
+
204
+ ## Quick Start
205
+
206
+ Try MGW without installing anything:
207
+
208
+ ```bash
209
+ # See available commands
210
+ npx mgw --help
211
+
212
+ # List your open issues
213
+ npx mgw issues
214
+
215
+ # Sync local state with GitHub
216
+ npx mgw sync
217
+
218
+ # Cross-reference two issues
219
+ npx mgw link 42 43
220
+ ```
221
+
222
+ `npx mgw` gives you the full CLI subset that works without Claude Code. For the AI-powered pipeline commands (`run`, `issue`, `project`, `milestone`, etc.), do a full install below.
223
+
224
+ ## Installation
225
+
226
+ ### Full install (CLI + slash commands)
227
+
228
+ ```bash
229
+ git clone https://github.com/snipcodeit/mgw.git
230
+ cd mgw
231
+ npm install && npm run build
232
+ npm link
233
+ # Slash commands are installed automatically by npm postinstall
234
+ ```
235
+
236
+ ### Slash commands only (no CLI)
237
+
238
+ ```bash
239
+ npm install -g mgw
240
+ # Slash commands are automatically deployed to ~/.claude/commands/mgw/
241
+ ```
242
+
243
+ ### Verify
244
+
245
+ ```bash
246
+ # CLI (if installed)
247
+ mgw --version
248
+
249
+ # Slash commands (installed automatically by postinstall)
250
+ ls ~/.claude/commands/mgw/
251
+ # ask.md board.md help.md init.md issue.md issues.md link.md milestone.md
252
+ # next.md pr.md project.md review.md run.md status.md sync.md
253
+ # update.md workflows/
254
+ ```
255
+
256
+ Then in Claude Code:
257
+
258
+ ```
259
+ /mgw:help
260
+ ```
261
+
262
+ ### npx vs full install
263
+
264
+ Not all commands work via `npx`. The CLI has two tiers:
265
+
266
+ | Tier | Commands | Requirements |
267
+ |------|----------|--------------|
268
+ | **CLI-only** (works with npx) | `issues`, `sync`, `link`, `help`, `--help`, `--version` | Node.js >= 18, `gh` CLI |
269
+ | **AI-powered** (requires full install) | `run`, `init`, `project`, `milestone`, `next`, `issue`, `update`, `pr`, `ask`, `review` | Node.js >= 18, `gh` CLI, Claude Code CLI, GSD |
270
+
271
+ AI-powered commands call `claude -p` under the hood and require the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code/overview) to be installed and authenticated. The slash command `.md` files must also be deployed to `~/.claude/commands/mgw/` for the full pipeline to work. Use `npx mgw` to explore the CLI and verify your GitHub setup before committing to a full install.
272
+
273
+ ## Typical Workflow
274
+
275
+ ### New project (from scratch)
276
+
277
+ ```bash
278
+ # 1. Run the project initializer (state-aware — safe to run on any repo)
279
+ /mgw:project
280
+ # On a fresh repo: launches a 6-stage Vision Collaboration Cycle
281
+ # → Intake (describe your idea)
282
+ # → Domain research (AI expands your concept)
283
+ # → Structured questioning (8–15 rounds)
284
+ # → Vision synthesis (structured brief: MoSCoW features, personas, scope)
285
+ # → Review + condense
286
+ # → Spawns gsd:new-project → creates GitHub milestones/issues automatically
287
+ #
288
+ # On a repo with GSD state but no GitHub structure:
289
+ # → Backfills GitHub milestones/issues from existing ROADMAP.md
290
+ #
291
+ # On an already-configured repo (Aligned state):
292
+ # → Shows status + offers to add new milestones
293
+
294
+ # 2. Execute the first milestone (issues run in dependency order)
295
+ /mgw:milestone
296
+
297
+ # 3. Review PRs as they're created, merge when ready
298
+ ```
299
+
300
+ ### Existing issues
301
+
302
+ ```bash
303
+ # 1. See what's assigned to you
304
+ /mgw:issues
305
+
306
+ # 2. Pick the next unblocked issue
307
+ /mgw:next
308
+
309
+ # 3. Run the full pipeline
310
+ /mgw:run 42
311
+ # → Creates branch, triages (if needed), plans via GSD, executes,
312
+ # verifies, opens PR, posts status comments on the issue
313
+
314
+ # 4. Review the PR, merge when ready
315
+ ```
316
+
317
+ ### Manual control
318
+
319
+ ```bash
320
+ /mgw:issue 42 # Triage
321
+ /mgw:link 42 #43 # Cross-reference related issue
322
+ /mgw:update 42 "blocked on #43" # Post custom status
323
+ /mgw:pr 42 --base develop # Create PR to specific base
324
+ /mgw:sync # Clean up stale state
325
+ ```
326
+
327
+ For step-by-step walkthroughs of common scenarios including failure recovery, see the [User Guide](docs/USER-GUIDE.md#workflow-walkthrough).
328
+
329
+ ## Project Structure
330
+
331
+ ```
332
+ bin/
333
+ mgw.cjs CLI entry point (Commander.js)
334
+ lib/
335
+ index.cjs Barrel export
336
+ claude.cjs Claude Code invocation helpers
337
+ github.cjs GitHub CLI wrappers (issues, PRs, milestones, Projects v2)
338
+ gsd.cjs GSD integration
339
+ state.cjs .mgw/ state management (migrateProjectState, resolveActiveMilestoneIndex)
340
+ output.cjs Logging and formatting
341
+ templates.cjs Template system
342
+ template-loader.cjs Output validation (JSON Schema) + parseRoadmap()
343
+ commands/ Slash command source files (deployed to ~/.claude/commands/mgw/ at install time)
344
+ ask.md Contextual question routing during milestone execution
345
+ board.md GitHub Projects v2 board management
346
+ help.md Command reference display
347
+ init.md One-time repo bootstrap (state, templates, labels)
348
+ project.md State-aware project init (Vision Cycle, alignment, drift, extend)
349
+ issues.md Issue browser with filters
350
+ issue.md Deep triage with agent analysis
351
+ next.md Next unblocked issue picker (surfaces failed issues as advisory)
352
+ review.md Comment review and classification since last triage
353
+ run.md Autonomous pipeline orchestrator (cross-milestone enforcement)
354
+ milestone.md Milestone execution with dependency ordering and failed-issue recovery
355
+ update.md Structured GitHub comment templates
356
+ pr.md PR creation from GSD artifacts with phase context + plan traceability
357
+ link.md Cross-referencing system (incl. maps-to milestone links)
358
+ status.md Project status dashboard and milestone progress query
359
+ sync.md State reconciliation (GSD milestone consistency check)
360
+ workflows/
361
+ state.md Shared state schema and initialization
362
+ github.md Shared GitHub CLI patterns
363
+ gsd.md GSD agent spawn templates
364
+ validation.md Delegation boundary rules
365
+ board-sync.md Board sync utilities (update_board_status, sync_pr_to_board)
366
+ templates/
367
+ schema.json JSON Schema for project output validation
368
+ vision-brief-schema.json JSON Schema for Vision Brief output from vision-synthesizer
369
+ ```
370
+
371
+ For a detailed walkthrough of the directory structure, slash command anatomy, and CLI architecture, see the [Architecture Guide](docs/ARCHITECTURE.md#directory-structure).
372
+
373
+ ## Documentation
374
+
375
+ | Document | Description |
376
+ |----------|-------------|
377
+ | [Wiki](https://github.com/snipcodeit/mgw/wiki) | Comprehensive documentation hub: getting started, commands reference, workflow guide, architecture, configuration, troubleshooting |
378
+ | [Architecture Guide](docs/ARCHITECTURE.md) | System design: the two-layer model (MGW orchestrates, GSD executes), delegation boundary, pipeline data flow, state schema, agent model, and slash command anatomy |
379
+ | [User Guide](docs/USER-GUIDE.md) | Practical usage: configuration reference, full command reference with examples, workflow walkthroughs, GSD route explanations, dependency ordering, failure recovery, and FAQ |
380
+
381
+ ## Acknowledgments
382
+
383
+ MGW wouldn't exist without **[Get Shit Done](https://github.com/glittercowboy/get-shit-done)** by [Lex Christopherson](https://github.com/glittercowboy) — a structured project management framework for Claude Code that handles planning, execution, and verification. GSD does the heavy lifting; MGW just connects it to GitHub so the rest of the world can see what you actually accomplished.
384
+
385
+ Seriously, if you're using Claude Code for development, go install GSD. MGW is just the GitHub layer on top.
386
+
387
+ ## Troubleshooting
388
+
389
+ ### GitHub CLI not authenticated
390
+
391
+ ```
392
+ Error: gh: not logged in
393
+ ```
394
+
395
+ Run `gh auth status` to check. If not authenticated:
396
+
397
+ ```bash
398
+ gh auth login
399
+ # Select GitHub.com, HTTPS, and authenticate via browser
400
+ ```
401
+
402
+ MGW requires the `repo` scope. If you're authenticated but getting permission errors, re-authenticate with the correct scopes:
403
+
404
+ ```bash
405
+ gh auth login --scopes repo
406
+ ```
407
+
408
+ ### GSD not installed
409
+
410
+ ```
411
+ Error: GSD slash commands not found
412
+ ```
413
+
414
+ MGW delegates planning and execution to [Get Shit Done](https://github.com/glittercowboy/get-shit-done). Install it following the GSD README, then verify the commands are available in Claude Code:
415
+
416
+ ```
417
+ /gsd:quick --help
418
+ ```
419
+
420
+ ### State file issues (.mgw/ directory)
421
+
422
+ **State drift** — Local `.mgw/` state can fall out of sync with GitHub if you merge PRs from the web UI, close issues manually, or work from a different machine. Run sync to reconcile:
423
+
424
+ ```
425
+ /mgw:sync
426
+ ```
427
+
428
+ **Corrupted state** — If `.mgw/` gets into a bad state, you can safely delete it and re-initialize:
429
+
430
+ ```bash
431
+ rm -rf .mgw/
432
+ /mgw:init
433
+ ```
434
+
435
+ This won't affect anything on GitHub. The `.mgw/` directory is local-only and gitignored.
436
+
437
+ **Missing .mgw/ directory** — If you cloned a repo that uses MGW but don't have a `.mgw/` directory, run init:
438
+
439
+ ```
440
+ /mgw:init
441
+ ```
442
+
443
+ ### Worktree cleanup
444
+
445
+ MGW creates git worktrees in `.worktrees/` for each issue pipeline. If a pipeline fails mid-execution, stale worktrees can accumulate:
446
+
447
+ ```bash
448
+ # List active worktrees
449
+ git worktree list
450
+
451
+ # Remove a specific stale worktree
452
+ git worktree remove .worktrees/issue/42-fix-auth
453
+
454
+ # Prune all stale worktree references
455
+ git worktree prune
456
+ ```
457
+
458
+ The associated branches are not deleted automatically. Clean them up after removing the worktree:
459
+
460
+ ```bash
461
+ git branch -d issue/42-fix-auth
462
+ ```
463
+
464
+ ### Rate limiting
465
+
466
+ MGW posts comments on GitHub issues at each pipeline stage. If you're executing many issues in quick succession (e.g., via `/mgw:milestone`), you may hit GitHub's API rate limits:
467
+
468
+ ```
469
+ Error: API rate limit exceeded
470
+ ```
471
+
472
+ Check your current rate limit status:
473
+
474
+ ```bash
475
+ gh api rate_limit --jq '.resources.core'
476
+ ```
477
+
478
+ If rate-limited, wait for the reset window (usually under an hour) or reduce the number of concurrent pipelines. Authenticated requests get 5,000 requests per hour — plenty for normal use, but milestone-level execution with many issues can approach the limit.
479
+
480
+ ### Common errors
481
+
482
+ | Error | Cause | Fix |
483
+ |-------|-------|-----|
484
+ | `Issue #N not found` | Issue doesn't exist or is in a different repo | Check the issue number and ensure you're in the correct repo |
485
+ | `Branch already exists` | A previous pipeline run created the branch | Delete the branch (`git branch -D issue/N-...`) or use the existing one |
486
+ | `No GSD route determined` | Triage couldn't determine issue scope | Run `/mgw:issue N` manually to inspect the triage output |
487
+ | `Merge conflict in worktree` | Main branch diverged during execution | Resolve conflicts in the worktree, then resume with `/mgw:run N` |
488
+ | `Permission denied` | GitHub token lacks required scopes | Re-authenticate: `gh auth login --scopes repo` |
489
+
490
+ ### Uninstalling
491
+
492
+ ```bash
493
+ # Remove CLI
494
+ npm unlink mgw
495
+
496
+ # Remove slash commands
497
+ rm -rf ~/.claude/commands/mgw/
498
+
499
+ # Remove local state (per-repo, if initialized)
500
+ rm -rf .mgw/
501
+ ```
502
+
503
+ ## Contributing
504
+
505
+ MGW is young and there's plenty of room to make it better:
506
+
507
+ - **Multi-repo support** — monorepo and cross-repo issue tracking
508
+ - **GitHub Actions integration** — trigger MGW from CI events
509
+ - **Review cycle automation** — handle PR review comments → fix → re-request
510
+ - **Dashboard** — terminal UI for pipeline visualization
511
+ - **Webhook support** — react to issue assignments and label changes in real-time
512
+
513
+ The slash commands are plain Markdown with a simple frontmatter + process structure. The CLI is a lightweight Node.js wrapper (`bin/mgw.cjs`) that delegates AI work to Claude and handles non-AI commands (sync, issues, link) directly. If any of the above interests you, open an issue or submit a PR. I promise MGW will keep mine updated even if I won't.
514
+
515
+ ## License
516
+
517
+ [MIT](LICENSE)
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * bin/mgw-install.cjs — Idempotent slash command installer
6
+ *
7
+ * Runs automatically via npm postinstall. Copies the commands/ source tree
8
+ * into ~/.claude/commands/mgw/ so Claude Code slash commands are available
9
+ * without any manual copy step.
10
+ *
11
+ * Behavior:
12
+ * - If ~/.claude/ does not exist: prints a skip message and exits 0 (non-fatal)
13
+ * - If ~/.claude/ exists: creates ~/.claude/commands/mgw/ and recursively
14
+ * copies commands/ into it (overwriting existing files — idempotent)
15
+ * - Exits 0 in both cases
16
+ *
17
+ * Dependencies: Node.js built-ins only (path, fs, os)
18
+ */
19
+
20
+ const path = require('path');
21
+ const fs = require('fs');
22
+ const os = require('os');
23
+
24
+ // Source: commands/ directory relative to this script (bin/ → ../commands/)
25
+ const sourceDir = path.join(__dirname, '..', 'commands');
26
+
27
+ // Target: ~/.claude/commands/mgw/
28
+ const claudeDir = path.join(os.homedir(), '.claude');
29
+ const targetDir = path.join(claudeDir, 'commands', 'mgw');
30
+
31
+ // Guard: if ~/.claude/ does not exist, skip silently with a clear message
32
+ if (!fs.existsSync(claudeDir)) {
33
+ console.log(
34
+ 'mgw: ~/.claude/ not found — skipping slash command install ' +
35
+ '(run `node ./bin/mgw-install.cjs` after installing Claude Code)'
36
+ );
37
+ process.exit(0);
38
+ }
39
+
40
+ // Guard: ensure commands/ source exists in this package
41
+ if (!fs.existsSync(sourceDir)) {
42
+ console.log('mgw: commands/ source not found — skipping slash command install');
43
+ process.exit(0);
44
+ }
45
+
46
+ /**
47
+ * Recursively copy a directory tree from src to dest.
48
+ * Creates dest and any subdirectories as needed.
49
+ * Overwrites existing files (idempotent).
50
+ * @param {string} src - Source directory path
51
+ * @param {string} dest - Destination directory path
52
+ * @returns {number} Number of files copied
53
+ */
54
+ function copyDirRecursive(src, dest) {
55
+ let count = 0;
56
+
57
+ // Create destination directory if it doesn't exist
58
+ if (!fs.existsSync(dest)) {
59
+ fs.mkdirSync(dest, { recursive: true });
60
+ }
61
+
62
+ const entries = fs.readdirSync(src);
63
+ for (const entry of entries) {
64
+ const srcPath = path.join(src, entry);
65
+ const destPath = path.join(dest, entry);
66
+
67
+ const stat = fs.statSync(srcPath);
68
+ if (stat.isDirectory()) {
69
+ count += copyDirRecursive(srcPath, destPath);
70
+ } else if (stat.isFile()) {
71
+ fs.copyFileSync(srcPath, destPath);
72
+ count++;
73
+ }
74
+ }
75
+
76
+ return count;
77
+ }
78
+
79
+ // Perform the install
80
+ const fileCount = copyDirRecursive(sourceDir, targetDir);
81
+ console.log(`mgw: installed ${fileCount} slash commands to ${targetDir}`);