@snipcodeit/mgw 0.1.3 → 0.2.1
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/commands/init.md +115 -5
- package/commands/issues.md +63 -1
- package/commands/milestone.md +43 -0
- package/commands/review.md +289 -149
- package/commands/status.md +95 -1
- package/commands/workflows/gsd.md +70 -0
- package/completions/mgw.bash +112 -0
- package/completions/mgw.fish +99 -0
- package/completions/mgw.zsh +142 -0
- package/dist/bin/mgw.cjs +113 -29
- package/dist/index-CXfe9U4l.cjs +1818 -0
- package/dist/lib/index.cjs +109 -8
- package/package.json +6 -1
- package/dist/claude-Dk1oVsaG.cjs +0 -622
package/commands/status.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mgw:status
|
|
3
3
|
description: Project status dashboard — milestone progress, issue pipeline stages, open PRs
|
|
4
|
-
argument-hint: "[milestone_number] [--json] [--board]"
|
|
4
|
+
argument-hint: "[milestone_number] [--json] [--board] [--watch [--interval N]]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Bash
|
|
7
7
|
- Read
|
|
@@ -13,6 +13,11 @@ pipeline stages, open PRs, and next milestone preview. Pure read-only — no sta
|
|
|
13
13
|
mutations, no agent spawns, no GitHub writes.
|
|
14
14
|
|
|
15
15
|
Falls back gracefully when no project.json exists (lists active issues only via GitHub API).
|
|
16
|
+
|
|
17
|
+
When `--watch` is passed, enters live-refresh mode: clears the terminal and redraws the
|
|
18
|
+
dashboard every N seconds (default 30). Displays a "Last refreshed" timestamp. User exits
|
|
19
|
+
by pressing 'q' or Ctrl+C. If both `--watch` and `--json` are supplied, print an error and
|
|
20
|
+
exit 1.
|
|
16
21
|
</objective>
|
|
17
22
|
|
|
18
23
|
<execution_context>
|
|
@@ -35,11 +40,21 @@ Repo detected via: gh repo view --json nameWithOwner -q .nameWithOwner
|
|
|
35
40
|
MILESTONE_NUM=""
|
|
36
41
|
JSON_OUTPUT=false
|
|
37
42
|
OPEN_BOARD=false
|
|
43
|
+
WATCH_MODE=false
|
|
44
|
+
WATCH_INTERVAL=30
|
|
45
|
+
NEXT_IS_INTERVAL=false
|
|
38
46
|
|
|
39
47
|
for ARG in $ARGUMENTS; do
|
|
48
|
+
if [ "$NEXT_IS_INTERVAL" = true ]; then
|
|
49
|
+
WATCH_INTERVAL="$ARG"
|
|
50
|
+
NEXT_IS_INTERVAL=false
|
|
51
|
+
continue
|
|
52
|
+
fi
|
|
40
53
|
case "$ARG" in
|
|
41
54
|
--json) JSON_OUTPUT=true ;;
|
|
42
55
|
--board) OPEN_BOARD=true ;;
|
|
56
|
+
--watch) WATCH_MODE=true ;;
|
|
57
|
+
--interval) NEXT_IS_INTERVAL=true ;;
|
|
43
58
|
[0-9]*) MILESTONE_NUM="$ARG" ;;
|
|
44
59
|
esac
|
|
45
60
|
done
|
|
@@ -418,6 +433,77 @@ Rendering rules:
|
|
|
418
433
|
- If no open PRs matched to milestone, show "No open PRs for this milestone."
|
|
419
434
|
- If no next milestone, show "No more milestones planned."
|
|
420
435
|
- If `TARGET_MILESTONE != CURRENT_MILESTONE`, add "(viewing milestone ${TARGET_MILESTONE})" to header
|
|
436
|
+
- In watch mode, append the footer: `[ Refreshing every ${WATCH_INTERVAL}s — last refreshed HH:MM:SS | press q to quit ]`
|
|
437
|
+
</step>
|
|
438
|
+
|
|
439
|
+
<step name="watch_mode">
|
|
440
|
+
**If --watch flag: enter live-refresh loop:**
|
|
441
|
+
|
|
442
|
+
`--watch` is incompatible with `--json`. If both are passed, print an error and exit 1.
|
|
443
|
+
|
|
444
|
+
The watch loop is implemented as a Node.js one-shot script executed via `node -e` (or saved
|
|
445
|
+
to a temp file). It wraps the full dashboard render cycle with `setInterval`, clears the
|
|
446
|
+
terminal before each redraw, and uses `process.stdin.setRawMode(true)` to detect a 'q'
|
|
447
|
+
keypress for clean exit.
|
|
448
|
+
|
|
449
|
+
```javascript
|
|
450
|
+
// watch-mode runner (pseudocode — shows the pattern)
|
|
451
|
+
const { execSync } = require('child_process');
|
|
452
|
+
const INTERVAL = parseInt(process.env.WATCH_INTERVAL || '30', 10) * 1000;
|
|
453
|
+
const REPO_ROOT = process.env.REPO_ROOT;
|
|
454
|
+
|
|
455
|
+
function renderDashboard() {
|
|
456
|
+
// Re-run all data collection and dashboard build steps synchronously
|
|
457
|
+
// (same logic as the non-watch single-shot path above, but called in a loop)
|
|
458
|
+
const output = buildDashboardOutput(); // all the python/gh calls assembled into a string
|
|
459
|
+
// Implementation note: buildDashboardOutput() is a pseudocode placeholder.
|
|
460
|
+
// The executor must refactor the full `display_dashboard` step into a reusable
|
|
461
|
+
// function that collects all GitHub and project.json data and returns the rendered
|
|
462
|
+
// dashboard string, then call it from both the single-shot path and the watch loop.
|
|
463
|
+
const now = new Date().toLocaleTimeString();
|
|
464
|
+
process.stdout.write('\x1B[2J\x1B[H'); // clear terminal, cursor home
|
|
465
|
+
process.stdout.write(output);
|
|
466
|
+
process.stdout.write(`\n[ Refreshing every ${INTERVAL / 1000}s — last refreshed ${now} | press q to quit ]\n`);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// Initial render
|
|
470
|
+
renderDashboard();
|
|
471
|
+
|
|
472
|
+
// Poll on interval
|
|
473
|
+
const timer = setInterval(renderDashboard, INTERVAL);
|
|
474
|
+
|
|
475
|
+
// Detect 'q' to exit
|
|
476
|
+
if (process.stdin.isTTY) {
|
|
477
|
+
process.stdin.setRawMode(true);
|
|
478
|
+
process.stdin.resume();
|
|
479
|
+
process.stdin.setEncoding('utf8');
|
|
480
|
+
process.stdin.on('data', (key) => {
|
|
481
|
+
if (key === 'q' || key === '\u0003') { // 'q' or Ctrl+C
|
|
482
|
+
clearInterval(timer);
|
|
483
|
+
process.stdin.setRawMode(false);
|
|
484
|
+
process.stdout.write('\nWatch mode exited.\n');
|
|
485
|
+
process.exit(0);
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Implementation notes for the executor:
|
|
492
|
+
- The watch runner re-executes the full data fetch on each interval tick (re-reads
|
|
493
|
+
project.json, re-calls `gh pr list`, etc.) so the display reflects live GitHub state.
|
|
494
|
+
- `process.stdout.write('\x1B[2J\x1B[H')` clears the screen without spawning `clear`.
|
|
495
|
+
- The footer line shows "last refreshed HH:MM:SS" only. No countdown timer.
|
|
496
|
+
- SIGINT (Ctrl+C) should also trigger clean exit — the `'\u0003'` check above handles it,
|
|
497
|
+
but also register `process.on('SIGINT', ...)` as a fallback when `setRawMode` is false
|
|
498
|
+
(non-TTY or piped stdin).
|
|
499
|
+
- If `--watch` and `--json` are both supplied, print the error message and exit 1 before
|
|
500
|
+
entering the watch loop.
|
|
501
|
+
|
|
502
|
+
If both flags are supplied, emit:
|
|
503
|
+
```
|
|
504
|
+
Error: --watch and --json cannot be used together.
|
|
505
|
+
```
|
|
506
|
+
and exit 1.
|
|
421
507
|
</step>
|
|
422
508
|
|
|
423
509
|
<step name="json_output">
|
|
@@ -523,4 +609,12 @@ The JSON structure:
|
|
|
523
609
|
- [ ] Velocity computed from .mgw/active/ and .mgw/completed/ file mtimes
|
|
524
610
|
- [ ] --json output includes board_url and milestone.health object
|
|
525
611
|
- [ ] Board URL line omitted when board_url is not set in project.json
|
|
612
|
+
- [ ] --watch flag enters live-refresh loop, refreshing every N seconds (default 30)
|
|
613
|
+
- [ ] --interval N overrides the default 30s refresh interval
|
|
614
|
+
- [ ] Watch mode clears terminal before each redraw
|
|
615
|
+
- [ ] Watch mode footer shows last refresh time
|
|
616
|
+
- [ ] 'q' keypress exits watch mode cleanly (stdin raw mode)
|
|
617
|
+
- [ ] Ctrl+C (SIGINT) exits watch mode cleanly
|
|
618
|
+
- [ ] --watch and --json are mutually exclusive — error + exit 1 if both supplied
|
|
619
|
+
- [ ] Watch mode re-fetches all data on each tick (live GitHub state)
|
|
526
620
|
</success_criteria>
|
|
@@ -374,4 +374,74 @@ and codebase to classify, then MGW presents the result and offers follow-up acti
|
|
|
374
374
|
| Milestone pipeline | run.md, milestone.md |
|
|
375
375
|
| Question classification | ask.md |
|
|
376
376
|
| Model resolution | run.md |
|
|
377
|
+
TB|## PR Review Pattern
|
|
378
|
+
|
|
379
|
+
MGW:review has two modes:
|
|
380
|
+
1. **Issue Comment Review** (default) — Classifies new comments on an issue since triage
|
|
381
|
+
2. **PR Deep Review** (with --pr flag or PR URL) — Comprehensive senior engineer review
|
|
382
|
+
|
|
383
|
+
The PR Deep Review pattern below is for Mode 2. This is problem-solving orchestration
|
|
384
|
+
|
|
385
|
+
Used by `/mgw:review` for deep PR analysis. This is problem-solving orchestration
|
|
386
|
+
(not execution orchestration) — the reviewer has high autonomy to analyze, question
|
|
387
|
+
assumptions, and provide architectural guidance.
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
# 1. Prepare review context
|
|
391
|
+
REVIEW_DIR=".mgw/reviews"
|
|
392
|
+
mkdir -p "$REVIEW_DIR"
|
|
393
|
+
REVIEW_ID="pr-${PR_NUMBER}-$(date +%Y%m%d-%H%M%S)"
|
|
394
|
+
|
|
395
|
+
# 2. Create context file with PR details, diff, linked issue
|
|
396
|
+
cat > "${REVIEW_DIR}/${REVIEW_ID}-context.md" << EOF
|
|
397
|
+
# PR Review Context
|
|
398
|
+
|
|
399
|
+
## PR Information
|
|
400
|
+
- Number: #${PR_NUMBER}
|
|
401
|
+
- Title: ${PR_TITLE}
|
|
402
|
+
...
|
|
403
|
+
EOF
|
|
404
|
+
|
|
405
|
+
# 3. Spawn deep review agent
|
|
406
|
+
Task(
|
|
407
|
+
prompt="
|
|
408
|
+
<files_to_read>
|
|
409
|
+
- ./CLAUDE.md
|
|
410
|
+
- ${REVIEW_CONTEXT_FILE}
|
|
411
|
+
</files_to_read>
|
|
412
|
+
|
|
413
|
+
You are a senior code reviewer performing comprehensive PR review.
|
|
414
|
+
Analyze across five dimensions: test, rationale, intent vs implementation,
|
|
415
|
+
impact analysis, and architectural review.
|
|
416
|
+
|
|
417
|
+
Return structured JSON with test_results, rationale, intent_vs_implementation,
|
|
418
|
+
impact_analysis, architectural_review, and overall_verdict.
|
|
419
|
+
",
|
|
420
|
+
subagent_type="general-purpose",
|
|
421
|
+
model="sonnet",
|
|
422
|
+
description="Deep review PR #${PR_NUMBER}"
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
# 4. Store results in .mgw/reviews/
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
**State separation:**
|
|
429
|
+
- `.mgw/active/` — MGW pipeline state
|
|
430
|
+
- `.mgw/reviews/` — PR review state (think tank context)
|
|
431
|
+
- `.planning/` — GSD execution state
|
|
432
|
+
|
|
433
|
+
This separation gives the reviewer space to handle larger context for
|
|
434
|
+
mission-critical review processes without polluting pipeline or execution state.
|
|
435
|
+
|
|
436
|
+
## Consumers
|
|
437
|
+
|
|
438
|
+
| Pattern | Referenced By |
|
|
439
|
+
|---------|---------------|
|
|
440
|
+
| Standard spawn template | run.md, issue.md, pr.md, ask.md, review.md |
|
|
441
|
+
| PR deep review | review.md (new) |
|
|
442
|
+
| Comment classification | run.md (pre-flight) |
|
|
443
|
+
| Quick pipeline | run.md |
|
|
444
|
+
| Milestone pipeline | run.md, milestone.md |
|
|
445
|
+
| Question classification | ask.md |
|
|
446
|
+
| Model resolution | run.md |
|
|
377
447
|
| Utility patterns | run.md, pr.md, issue.md, sync.md, link.md, update.md, ask.md |
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# mgw bash completion script
|
|
3
|
+
# Source this file or add to /etc/bash_completion.d/mgw
|
|
4
|
+
# Generated by bin/generate-completions.cjs
|
|
5
|
+
|
|
6
|
+
_mgw() {
|
|
7
|
+
local cur prev words cword
|
|
8
|
+
_init_completion 2>/dev/null || {
|
|
9
|
+
COMPREPLY=()
|
|
10
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
11
|
+
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
local subcommands="run init project milestone next issue update pr sync issues link help"
|
|
15
|
+
|
|
16
|
+
local global_flags="--dry-run --json --verbose -v --debug --model"
|
|
17
|
+
|
|
18
|
+
case "$prev" in
|
|
19
|
+
mgw)
|
|
20
|
+
COMPREPLY=( $(compgen -W "$subcommands $global_flags" -- "$cur") )
|
|
21
|
+
return
|
|
22
|
+
;;
|
|
23
|
+
run)
|
|
24
|
+
COMPREPLY=( $(compgen -W "--quiet --auto $global_flags" -- "$cur") )
|
|
25
|
+
return
|
|
26
|
+
;;
|
|
27
|
+
init)
|
|
28
|
+
COMPREPLY=( $(compgen -W "$global_flags" -- "$cur") )
|
|
29
|
+
return
|
|
30
|
+
;;
|
|
31
|
+
project)
|
|
32
|
+
COMPREPLY=( $(compgen -W "$global_flags" -- "$cur") )
|
|
33
|
+
return
|
|
34
|
+
;;
|
|
35
|
+
milestone)
|
|
36
|
+
COMPREPLY=( $(compgen -W "--interactive $global_flags" -- "$cur") )
|
|
37
|
+
return
|
|
38
|
+
;;
|
|
39
|
+
next)
|
|
40
|
+
COMPREPLY=( $(compgen -W "$global_flags" -- "$cur") )
|
|
41
|
+
return
|
|
42
|
+
;;
|
|
43
|
+
issue)
|
|
44
|
+
COMPREPLY=( $(compgen -W "$global_flags" -- "$cur") )
|
|
45
|
+
return
|
|
46
|
+
;;
|
|
47
|
+
update)
|
|
48
|
+
COMPREPLY=( $(compgen -W "$global_flags" -- "$cur") )
|
|
49
|
+
return
|
|
50
|
+
;;
|
|
51
|
+
pr)
|
|
52
|
+
COMPREPLY=( $(compgen -W "--base $global_flags" -- "$cur") )
|
|
53
|
+
return
|
|
54
|
+
;;
|
|
55
|
+
sync)
|
|
56
|
+
COMPREPLY=( $(compgen -W "$global_flags" -- "$cur") )
|
|
57
|
+
return
|
|
58
|
+
;;
|
|
59
|
+
issues)
|
|
60
|
+
COMPREPLY=( $(compgen -W "--label --milestone --assignee --state --search -s --limit $global_flags" -- "$cur") )
|
|
61
|
+
return
|
|
62
|
+
;;
|
|
63
|
+
link)
|
|
64
|
+
COMPREPLY=( $(compgen -W "--quiet $global_flags" -- "$cur") )
|
|
65
|
+
return
|
|
66
|
+
;;
|
|
67
|
+
help)
|
|
68
|
+
COMPREPLY=()
|
|
69
|
+
return
|
|
70
|
+
;;
|
|
71
|
+
--model)
|
|
72
|
+
# Offer common Claude model names
|
|
73
|
+
COMPREPLY=( $(compgen -W "claude-opus-4-5 claude-sonnet-4-5 claude-haiku-4-5" -- "$cur") )
|
|
74
|
+
return
|
|
75
|
+
;;
|
|
76
|
+
--state)
|
|
77
|
+
COMPREPLY=( $(compgen -W "open closed all" -- "$cur") )
|
|
78
|
+
return
|
|
79
|
+
;;
|
|
80
|
+
--assignee)
|
|
81
|
+
COMPREPLY=( $(compgen -W "all @me" -- "$cur") )
|
|
82
|
+
return
|
|
83
|
+
;;
|
|
84
|
+
esac
|
|
85
|
+
|
|
86
|
+
# If cur starts with - complete flags for the current subcommand
|
|
87
|
+
if [[ "$cur" == -* ]]; then
|
|
88
|
+
# Find the subcommand in words
|
|
89
|
+
local subcmd=""
|
|
90
|
+
for word in "${words[@]}"; do
|
|
91
|
+
if [[ " $subcommands " == *" $word "* ]]; then
|
|
92
|
+
subcmd="$word"
|
|
93
|
+
break
|
|
94
|
+
fi
|
|
95
|
+
done
|
|
96
|
+
|
|
97
|
+
case "$subcmd" in
|
|
98
|
+
run) COMPREPLY=( $(compgen -W "--quiet --auto $global_flags" -- "$cur") ) ;;
|
|
99
|
+
milestone) COMPREPLY=( $(compgen -W "--interactive $global_flags" -- "$cur") ) ;;
|
|
100
|
+
pr) COMPREPLY=( $(compgen -W "--base $global_flags" -- "$cur") ) ;;
|
|
101
|
+
issues) COMPREPLY=( $(compgen -W "--label --milestone --assignee --state --search -s --limit $global_flags" -- "$cur") ) ;;
|
|
102
|
+
link) COMPREPLY=( $(compgen -W "--quiet $global_flags" -- "$cur") ) ;;
|
|
103
|
+
*) COMPREPLY=( $(compgen -W "$global_flags" -- "$cur") ) ;;
|
|
104
|
+
esac
|
|
105
|
+
return
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
# Default: suggest subcommands
|
|
109
|
+
COMPREPLY=( $(compgen -W "$subcommands" -- "$cur") )
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
complete -F _mgw mgw
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# mgw fish completion script
|
|
2
|
+
# Place in ~/.config/fish/completions/mgw.fish
|
|
3
|
+
# or run: fisher install (if using a fish plugin manager)
|
|
4
|
+
# Generated by bin/generate-completions.cjs
|
|
5
|
+
|
|
6
|
+
# Disable file completions by default for mgw
|
|
7
|
+
complete -c mgw -f
|
|
8
|
+
|
|
9
|
+
# ---------------------------------------------------------------------------
|
|
10
|
+
# Global flags (available for all subcommands)
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
complete -c mgw -n '__fish_use_subcommand' -l dry-run -d 'show what would happen without executing'
|
|
13
|
+
complete -c mgw -n '__fish_use_subcommand' -l json -d 'output structured JSON'
|
|
14
|
+
complete -c mgw -n '__fish_use_subcommand' -s v -l verbose -d 'show API calls and file writes'
|
|
15
|
+
complete -c mgw -n '__fish_use_subcommand' -l debug -d 'full payloads and timings'
|
|
16
|
+
complete -c mgw -n '__fish_use_subcommand' -l model -d 'Claude model override' -r
|
|
17
|
+
|
|
18
|
+
# ---------------------------------------------------------------------------
|
|
19
|
+
# Subcommands
|
|
20
|
+
# ---------------------------------------------------------------------------
|
|
21
|
+
complete -c mgw -n '__fish_use_subcommand' -a run -d 'Run the full pipeline for an issue'
|
|
22
|
+
complete -c mgw -n '__fish_use_subcommand' -a init -d 'Bootstrap repo for MGW (state, templates, labels)'
|
|
23
|
+
complete -c mgw -n '__fish_use_subcommand' -a project -d 'Initialize project from template (milestones, issues, ROADMAP)'
|
|
24
|
+
complete -c mgw -n '__fish_use_subcommand' -a milestone -d 'Execute milestone issues in dependency order'
|
|
25
|
+
complete -c mgw -n '__fish_use_subcommand' -a next -d 'Show next unblocked issue'
|
|
26
|
+
complete -c mgw -n '__fish_use_subcommand' -a issue -d 'Triage issue against codebase'
|
|
27
|
+
complete -c mgw -n '__fish_use_subcommand' -a update -d 'Post status comment on issue'
|
|
28
|
+
complete -c mgw -n '__fish_use_subcommand' -a pr -d 'Create PR from GSD artifacts'
|
|
29
|
+
complete -c mgw -n '__fish_use_subcommand' -a sync -d 'Reconcile .mgw/ state with GitHub'
|
|
30
|
+
complete -c mgw -n '__fish_use_subcommand' -a issues -d 'Browse open issues'
|
|
31
|
+
complete -c mgw -n '__fish_use_subcommand' -a link -d 'Cross-reference issues/PRs/branches'
|
|
32
|
+
complete -c mgw -n '__fish_use_subcommand' -a help -d 'Show command reference'
|
|
33
|
+
|
|
34
|
+
# ---------------------------------------------------------------------------
|
|
35
|
+
# run <issue-number>
|
|
36
|
+
# ---------------------------------------------------------------------------
|
|
37
|
+
complete -c mgw -n '__fish_seen_subcommand_from run' -l quiet -d 'buffer output, show summary at end'
|
|
38
|
+
complete -c mgw -n '__fish_seen_subcommand_from run' -l auto -d 'phase chaining: discuss -> plan -> execute'
|
|
39
|
+
complete -c mgw -n '__fish_seen_subcommand_from run' -l dry-run -d 'show what would happen without executing'
|
|
40
|
+
complete -c mgw -n '__fish_seen_subcommand_from run' -l json -d 'output structured JSON'
|
|
41
|
+
complete -c mgw -n '__fish_seen_subcommand_from run' -s v -l verbose -d 'show API calls and file writes'
|
|
42
|
+
complete -c mgw -n '__fish_seen_subcommand_from run' -l debug -d 'full payloads and timings'
|
|
43
|
+
complete -c mgw -n '__fish_seen_subcommand_from run' -l model -d 'Claude model override' -r
|
|
44
|
+
|
|
45
|
+
# ---------------------------------------------------------------------------
|
|
46
|
+
# milestone [number]
|
|
47
|
+
# ---------------------------------------------------------------------------
|
|
48
|
+
complete -c mgw -n '__fish_seen_subcommand_from milestone' -l interactive -d 'pause between issues for review'
|
|
49
|
+
complete -c mgw -n '__fish_seen_subcommand_from milestone' -l dry-run -d 'show what would happen without executing'
|
|
50
|
+
complete -c mgw -n '__fish_seen_subcommand_from milestone' -l json -d 'output structured JSON'
|
|
51
|
+
complete -c mgw -n '__fish_seen_subcommand_from milestone' -s v -l verbose -d 'show API calls and file writes'
|
|
52
|
+
complete -c mgw -n '__fish_seen_subcommand_from milestone' -l debug -d 'full payloads and timings'
|
|
53
|
+
complete -c mgw -n '__fish_seen_subcommand_from milestone' -l model -d 'Claude model override' -r
|
|
54
|
+
|
|
55
|
+
# ---------------------------------------------------------------------------
|
|
56
|
+
# pr [number]
|
|
57
|
+
# ---------------------------------------------------------------------------
|
|
58
|
+
complete -c mgw -n '__fish_seen_subcommand_from pr' -l base -d 'custom base branch' -r
|
|
59
|
+
complete -c mgw -n '__fish_seen_subcommand_from pr' -l dry-run -d 'show what would happen without executing'
|
|
60
|
+
complete -c mgw -n '__fish_seen_subcommand_from pr' -l json -d 'output structured JSON'
|
|
61
|
+
complete -c mgw -n '__fish_seen_subcommand_from pr' -s v -l verbose -d 'show API calls and file writes'
|
|
62
|
+
complete -c mgw -n '__fish_seen_subcommand_from pr' -l debug -d 'full payloads and timings'
|
|
63
|
+
complete -c mgw -n '__fish_seen_subcommand_from pr' -l model -d 'Claude model override' -r
|
|
64
|
+
|
|
65
|
+
# ---------------------------------------------------------------------------
|
|
66
|
+
# issues [filters]
|
|
67
|
+
# ---------------------------------------------------------------------------
|
|
68
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -l label -d 'filter by label' -r
|
|
69
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -l milestone -d 'filter by milestone' -r
|
|
70
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -l assignee -d 'filter by assignee' -r -a 'all @me'
|
|
71
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -l state -d 'issue state' -r -a 'open closed all'
|
|
72
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -s s -l search -d 'pre-populate fuzzy search input' -r
|
|
73
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -l limit -d 'max issues to load' -r -a '10 25 50 100'
|
|
74
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -l dry-run -d 'show what would happen without executing'
|
|
75
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -l json -d 'output structured JSON'
|
|
76
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -s v -l verbose -d 'show API calls and file writes'
|
|
77
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -l debug -d 'full payloads and timings'
|
|
78
|
+
complete -c mgw -n '__fish_seen_subcommand_from issues' -l model -d 'Claude model override' -r
|
|
79
|
+
|
|
80
|
+
# ---------------------------------------------------------------------------
|
|
81
|
+
# link <ref-a> <ref-b>
|
|
82
|
+
# ---------------------------------------------------------------------------
|
|
83
|
+
complete -c mgw -n '__fish_seen_subcommand_from link' -l quiet -d 'no GitHub comments'
|
|
84
|
+
complete -c mgw -n '__fish_seen_subcommand_from link' -l dry-run -d 'show what would happen without executing'
|
|
85
|
+
complete -c mgw -n '__fish_seen_subcommand_from link' -l json -d 'output structured JSON'
|
|
86
|
+
complete -c mgw -n '__fish_seen_subcommand_from link' -s v -l verbose -d 'show API calls and file writes'
|
|
87
|
+
complete -c mgw -n '__fish_seen_subcommand_from link' -l debug -d 'full payloads and timings'
|
|
88
|
+
complete -c mgw -n '__fish_seen_subcommand_from link' -l model -d 'Claude model override' -r
|
|
89
|
+
|
|
90
|
+
# ---------------------------------------------------------------------------
|
|
91
|
+
# Subcommands that only take global flags (no subcommand-specific flags)
|
|
92
|
+
# ---------------------------------------------------------------------------
|
|
93
|
+
for _mgw_cmd in init project next issue update sync help
|
|
94
|
+
complete -c mgw -n "__fish_seen_subcommand_from $_mgw_cmd" -l dry-run -d 'show what would happen without executing'
|
|
95
|
+
complete -c mgw -n "__fish_seen_subcommand_from $_mgw_cmd" -l json -d 'output structured JSON'
|
|
96
|
+
complete -c mgw -n "__fish_seen_subcommand_from $_mgw_cmd" -s v -l verbose -d 'show API calls and file writes'
|
|
97
|
+
complete -c mgw -n "__fish_seen_subcommand_from $_mgw_cmd" -l debug -d 'full payloads and timings'
|
|
98
|
+
complete -c mgw -n "__fish_seen_subcommand_from $_mgw_cmd" -l model -d 'Claude model override' -r
|
|
99
|
+
end
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#compdef mgw
|
|
2
|
+
# mgw zsh completion script
|
|
3
|
+
# Place in a directory on your $fpath (e.g. /usr/local/share/zsh/site-functions/_mgw)
|
|
4
|
+
# or source directly: source completions/mgw.zsh
|
|
5
|
+
# Generated by bin/generate-completions.cjs
|
|
6
|
+
|
|
7
|
+
_mgw() {
|
|
8
|
+
local context state state_descr line
|
|
9
|
+
typeset -A opt_args
|
|
10
|
+
|
|
11
|
+
local -a global_flags
|
|
12
|
+
global_flags=(
|
|
13
|
+
'--dry-run[show what would happen without executing]'
|
|
14
|
+
'--json[output structured JSON]'
|
|
15
|
+
'(-v --verbose)'{-v,--verbose}'[show API calls and file writes]'
|
|
16
|
+
'--debug[full payloads and timings]'
|
|
17
|
+
'--model[Claude model override]:model:(claude-opus-4-5 claude-sonnet-4-5 claude-haiku-4-5)'
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
_arguments -C \
|
|
21
|
+
"${global_flags[@]}" \
|
|
22
|
+
'(-h --help)'{-h,--help}'[display help]' \
|
|
23
|
+
'(-V --version)'{-V,--version}'[output the version number]' \
|
|
24
|
+
'1: :_mgw_subcommands' \
|
|
25
|
+
'*:: :->subcommand_args' \
|
|
26
|
+
&& return 0
|
|
27
|
+
|
|
28
|
+
case "$state" in
|
|
29
|
+
subcommand_args)
|
|
30
|
+
case "$words[1]" in
|
|
31
|
+
run)
|
|
32
|
+
_arguments \
|
|
33
|
+
"${global_flags[@]}" \
|
|
34
|
+
'--quiet[buffer output, show summary at end]' \
|
|
35
|
+
'--auto[phase chaining: discuss -> plan -> execute]' \
|
|
36
|
+
'1:issue-number:_mgw_issue_numbers' \
|
|
37
|
+
&& return 0
|
|
38
|
+
;;
|
|
39
|
+
init)
|
|
40
|
+
_arguments "${global_flags[@]}" && return 0
|
|
41
|
+
;;
|
|
42
|
+
project)
|
|
43
|
+
_arguments "${global_flags[@]}" && return 0
|
|
44
|
+
;;
|
|
45
|
+
milestone)
|
|
46
|
+
_arguments \
|
|
47
|
+
"${global_flags[@]}" \
|
|
48
|
+
'--interactive[pause between issues for review]' \
|
|
49
|
+
'1::milestone-number:' \
|
|
50
|
+
&& return 0
|
|
51
|
+
;;
|
|
52
|
+
next)
|
|
53
|
+
_arguments "${global_flags[@]}" && return 0
|
|
54
|
+
;;
|
|
55
|
+
issue)
|
|
56
|
+
_arguments \
|
|
57
|
+
"${global_flags[@]}" \
|
|
58
|
+
'1:issue-number:_mgw_issue_numbers' \
|
|
59
|
+
&& return 0
|
|
60
|
+
;;
|
|
61
|
+
update)
|
|
62
|
+
_arguments \
|
|
63
|
+
"${global_flags[@]}" \
|
|
64
|
+
'1:issue-number:_mgw_issue_numbers' \
|
|
65
|
+
'2::message:' \
|
|
66
|
+
&& return 0
|
|
67
|
+
;;
|
|
68
|
+
pr)
|
|
69
|
+
_arguments \
|
|
70
|
+
"${global_flags[@]}" \
|
|
71
|
+
'--base[custom base branch]:branch:_git_branch_names' \
|
|
72
|
+
'1::issue-number:_mgw_issue_numbers' \
|
|
73
|
+
&& return 0
|
|
74
|
+
;;
|
|
75
|
+
sync)
|
|
76
|
+
_arguments "${global_flags[@]}" && return 0
|
|
77
|
+
;;
|
|
78
|
+
issues)
|
|
79
|
+
_arguments \
|
|
80
|
+
"${global_flags[@]}" \
|
|
81
|
+
'--label[filter by label]:label:' \
|
|
82
|
+
'--milestone[filter by milestone]:milestone:' \
|
|
83
|
+
'--assignee[filter by assignee]:assignee:(all @me)' \
|
|
84
|
+
'--state[issue state]:state:(open closed all)' \
|
|
85
|
+
'(-s --search)'{-s,--search}'[pre-populate fuzzy search input]:query:' \
|
|
86
|
+
'--limit[max issues to load]:number:(10 25 50 100)' \
|
|
87
|
+
&& return 0
|
|
88
|
+
;;
|
|
89
|
+
link)
|
|
90
|
+
_arguments \
|
|
91
|
+
"${global_flags[@]}" \
|
|
92
|
+
'--quiet[no GitHub comments]' \
|
|
93
|
+
'1:ref-a:' \
|
|
94
|
+
'2:ref-b:' \
|
|
95
|
+
&& return 0
|
|
96
|
+
;;
|
|
97
|
+
help)
|
|
98
|
+
return 0
|
|
99
|
+
;;
|
|
100
|
+
esac
|
|
101
|
+
;;
|
|
102
|
+
esac
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_mgw_subcommands() {
|
|
106
|
+
local -a subcommands
|
|
107
|
+
subcommands=(
|
|
108
|
+
'run:Run the full pipeline for an issue'
|
|
109
|
+
'init:Bootstrap repo for MGW (state, templates, labels)'
|
|
110
|
+
'project:Initialize project from template (milestones, issues, ROADMAP)'
|
|
111
|
+
'milestone:Execute milestone issues in dependency order'
|
|
112
|
+
'next:Show next unblocked issue'
|
|
113
|
+
'issue:Triage issue against codebase'
|
|
114
|
+
'update:Post status comment on issue'
|
|
115
|
+
'pr:Create PR from GSD artifacts'
|
|
116
|
+
'sync:Reconcile .mgw/ state with GitHub'
|
|
117
|
+
'issues:Browse open issues'
|
|
118
|
+
'link:Cross-reference issues/PRs/branches'
|
|
119
|
+
'help:Show command reference'
|
|
120
|
+
)
|
|
121
|
+
_describe 'mgw subcommand' subcommands
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
_mgw_issue_numbers() {
|
|
125
|
+
# Attempt to complete issue numbers from active .mgw/ state
|
|
126
|
+
local -a active_issues
|
|
127
|
+
local active_dir=".mgw/active"
|
|
128
|
+
if [[ -d "$active_dir" ]]; then
|
|
129
|
+
for f in "$active_dir"/*.json; do
|
|
130
|
+
[[ -f "$f" ]] || continue
|
|
131
|
+
local num="${${f:t}%%[-_]*}"
|
|
132
|
+
[[ "$num" =~ ^[0-9]+$ ]] && active_issues+=("$num")
|
|
133
|
+
done
|
|
134
|
+
fi
|
|
135
|
+
if (( ${#active_issues[@]} > 0 )); then
|
|
136
|
+
_describe 'issue number' active_issues
|
|
137
|
+
else
|
|
138
|
+
_message 'issue number'
|
|
139
|
+
fi
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
_mgw "$@"
|