@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/init.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mgw:init
|
|
3
|
-
description: Bootstrap current repo for MGW integration — creates .mgw/ state, GitHub templates, gitignore entries
|
|
4
|
-
argument-hint: ""
|
|
3
|
+
description: Bootstrap current repo for MGW integration — creates .mgw/ state, GitHub templates, gitignore entries, installs shell completions, and runs config wizard
|
|
4
|
+
argument-hint: "[--no-config]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Bash
|
|
7
7
|
- Read
|
|
@@ -12,8 +12,9 @@ allowed-tools:
|
|
|
12
12
|
|
|
13
13
|
<objective>
|
|
14
14
|
One-time setup for a repo to work with MGW. Creates the .mgw/ state directory,
|
|
15
|
-
GitHub issue/PR templates,
|
|
16
|
-
|
|
15
|
+
GitHub issue/PR templates, ensures gitignore entries, and runs an interactive
|
|
16
|
+
config wizard for first-time setup preferences. Safe to re-run — skips anything
|
|
17
|
+
that already exists. Pass --no-config to skip the wizard.
|
|
17
18
|
</objective>
|
|
18
19
|
|
|
19
20
|
<execution_context>
|
|
@@ -213,6 +214,109 @@ gh label create "mgw:blocked" --description "Pipeline blocked by stakeholder com
|
|
|
213
214
|
`--force` updates existing labels without error.
|
|
214
215
|
</step>
|
|
215
216
|
|
|
217
|
+
<step name="install_completions">
|
|
218
|
+
**Offer to install shell completions (opt-in):**
|
|
219
|
+
|
|
220
|
+
Locate the completions directory bundled with the MGW package:
|
|
221
|
+
```bash
|
|
222
|
+
MGW_PKG_DIR=$(node -e "const path = require('path'); console.log(path.resolve(__dirname, '..', '..'))" 2>/dev/null || echo "")
|
|
223
|
+
COMPLETIONS_DIR="${MGW_PKG_DIR}/completions"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
If completions are not found (package not globally installed or completions dir absent) → skip silently, note "Shell completions not available (mgw not installed globally)" in report.
|
|
227
|
+
|
|
228
|
+
If completions are found, detect the user's shell and determine the install target:
|
|
229
|
+
```bash
|
|
230
|
+
CURRENT_SHELL=$(basename "${SHELL:-}")
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Shell → target directory mapping:
|
|
234
|
+
- `bash` → `~/.local/share/bash-completion/completions/` (source file: `mgw.bash`)
|
|
235
|
+
- `zsh` → `~/.zsh/completions/` (source file: `mgw.zsh`)
|
|
236
|
+
- `fish` → `~/.config/fish/completions/` (source file: `mgw.fish`)
|
|
237
|
+
|
|
238
|
+
If shell is unrecognized or `SHELL` is unset → show all three install commands and skip auto-install.
|
|
239
|
+
|
|
240
|
+
**Interactive mode (default):** Ask the user:
|
|
241
|
+
```
|
|
242
|
+
Shell completions are available for ${CURRENT_SHELL}.
|
|
243
|
+
|
|
244
|
+
Install to ${COMPLETION_TARGET_DIR}? [Y/n]
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
If the user answers yes (or presses Enter for the default):
|
|
248
|
+
```bash
|
|
249
|
+
mkdir -p "${COMPLETION_TARGET_DIR}"
|
|
250
|
+
cp "${COMPLETIONS_DIR}/mgw.${SHELL_EXT}" "${COMPLETION_TARGET_DIR}/mgw.${SHELL_EXT}"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Then show the source/activation line appropriate for the shell:
|
|
254
|
+
- bash: `# Reload with: source ~/.local/share/bash-completion/completions/mgw.bash`
|
|
255
|
+
(or add to ~/.bashrc: `source ~/.local/share/bash-completion/completions/mgw.bash`)
|
|
256
|
+
- zsh: Add to ~/.zshrc (required — ~/.zsh/completions is not in default $fpath):
|
|
257
|
+
```
|
|
258
|
+
fpath=(~/.zsh/completions $fpath)
|
|
259
|
+
autoload -Uz compinit
|
|
260
|
+
compinit
|
|
261
|
+
```
|
|
262
|
+
Then reload: `source ~/.zshrc`
|
|
263
|
+
- fish: `# Completions loaded automatically from ~/.config/fish/completions/`
|
|
264
|
+
|
|
265
|
+
If user answers no → skip, note "Shell completions: skipped" in report.
|
|
266
|
+
|
|
267
|
+
If the completion file already exists at the target → overwrite (idempotent re-run).
|
|
268
|
+
|
|
269
|
+
**Non-interactive mode** (stdin is not a TTY): Skip the prompt entirely, print the install command as a hint:
|
|
270
|
+
```
|
|
271
|
+
Shell completions available. Install manually:
|
|
272
|
+
cp ${COMPLETIONS_DIR}/mgw.${SHELL_EXT} ${COMPLETION_TARGET_DIR}/mgw.${SHELL_EXT}
|
|
273
|
+
```
|
|
274
|
+
</step>
|
|
275
|
+
|
|
276
|
+
<step name="run_config_wizard">
|
|
277
|
+
**Run interactive config wizard for first-time setup (skip if --no-config or config already exists):**
|
|
278
|
+
|
|
279
|
+
Check whether the wizard should run:
|
|
280
|
+
```bash
|
|
281
|
+
# Skip if --no-config flag is present
|
|
282
|
+
# Skip if stdin is not a TTY (CI/piped context)
|
|
283
|
+
# Skip if .mgw/config.json already exists
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Use `lib/config-wizard.cjs` to determine and execute:
|
|
287
|
+
```javascript
|
|
288
|
+
const { runWizard, shouldRunWizard } = require('./lib/config-wizard.cjs');
|
|
289
|
+
const mgwDir = path.join(REPO_ROOT, '.mgw');
|
|
290
|
+
|
|
291
|
+
if (shouldRunWizard(mgwDir, process.argv)) {
|
|
292
|
+
await runWizard(mgwDir);
|
|
293
|
+
} else if (fs.existsSync(path.join(mgwDir, 'config.json'))) {
|
|
294
|
+
// report: ".mgw/config.json exists, skipping wizard"
|
|
295
|
+
} else {
|
|
296
|
+
// report: ".mgw/config.json skipped (--no-config)"
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
The wizard asks the user four questions in order:
|
|
301
|
+
1. **GitHub username** — auto-detected from `gh api user -q .login`; user may accept or override
|
|
302
|
+
2. **Default issue state filter** — `open` (default) or `all`
|
|
303
|
+
3. **Default issue limit** — `10`, `25` (default), or `50`
|
|
304
|
+
4. **Default assignee filter** — `me` (default) or `all`
|
|
305
|
+
|
|
306
|
+
Answers are written to `${REPO_ROOT}/.mgw/config.json`:
|
|
307
|
+
```json
|
|
308
|
+
{
|
|
309
|
+
"github_username": "...",
|
|
310
|
+
"default_issue_state": "open",
|
|
311
|
+
"default_issue_limit": 25,
|
|
312
|
+
"default_assignee": "me",
|
|
313
|
+
"created_at": "<ISO timestamp>"
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
If the wizard errors or is interrupted, report the failure but do not abort the overall init — config is optional.
|
|
318
|
+
</step>
|
|
319
|
+
|
|
216
320
|
<step name="report">
|
|
217
321
|
**Report setup status:**
|
|
218
322
|
|
|
@@ -223,11 +327,13 @@ gh label create "mgw:blocked" --description "Pipeline blocked by stakeholder com
|
|
|
223
327
|
|
|
224
328
|
.mgw/ ${created|exists}
|
|
225
329
|
.mgw/cross-refs.json ${created|exists}
|
|
330
|
+
.mgw/config.json ${written|exists|skipped}
|
|
226
331
|
.gitignore entries ${added|exists}
|
|
227
332
|
Issue templates ${created|exists}
|
|
228
333
|
PR template ${created|exists}
|
|
229
334
|
GitHub labels synced
|
|
230
335
|
MGW pipeline labels synced (7 labels)
|
|
336
|
+
Shell completions ${installed (bash|zsh|fish)|skipped|not available}
|
|
231
337
|
|
|
232
338
|
Ready to use:
|
|
233
339
|
/mgw:issues Browse issues
|
|
@@ -242,9 +348,13 @@ Ready to use:
|
|
|
242
348
|
- [ ] .mgw/ directory structure created
|
|
243
349
|
- [ ] .mgw/ and .worktrees/ in .gitignore
|
|
244
350
|
- [ ] cross-refs.json initialized
|
|
351
|
+
- [ ] Config wizard run (or skipped via --no-config / pre-existing config.json)
|
|
352
|
+
- [ ] .mgw/config.json written with user preferences (unless skipped)
|
|
245
353
|
- [ ] Issue templates created (bug + enhancement)
|
|
246
354
|
- [ ] PR template created
|
|
247
355
|
- [ ] GitHub labels ensured (bug, enhancement)
|
|
248
356
|
- [ ] MGW pipeline labels ensured (7 mgw:* labels)
|
|
249
|
-
- [ ]
|
|
357
|
+
- [ ] Shell completion install offered (interactive) or hint printed (non-interactive)
|
|
358
|
+
- [ ] Completion install skipped gracefully if completions dir not found
|
|
359
|
+
- [ ] Setup report shown with completion status line
|
|
250
360
|
</success_criteria>
|
package/commands/issues.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mgw:issues
|
|
3
3
|
description: List and filter GitHub issues, pick one to triage
|
|
4
|
-
argument-hint: "[--label <label>] [--milestone <name>] [--assignee <user>] [--state open|closed|all]"
|
|
4
|
+
argument-hint: "[--label <label>] [--milestone <name>] [--assignee <user>] [--state open|closed|all] [--search <query>]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Bash
|
|
7
7
|
- Read
|
|
@@ -14,6 +14,10 @@ Browse GitHub issues for the current repo. Presents a scannable table filtered b
|
|
|
14
14
|
assignment (defaults to @me), labels, milestone, or state. Pick an issue to route
|
|
15
15
|
into triage via /mgw:issue.
|
|
16
16
|
|
|
17
|
+
This is the Claude Code slash-command variant (table + AskUserQuestion). When running
|
|
18
|
+
from the CLI (`mgw issues`), an interactive TUI browser launches instead — see
|
|
19
|
+
`docs/TUI-DESIGN.md` and `lib/tui/index.cjs` for the TUI implementation.
|
|
20
|
+
|
|
17
21
|
No side effects — read-only GitHub access. Safe to run anytime.
|
|
18
22
|
</objective>
|
|
19
23
|
|
|
@@ -107,3 +111,61 @@ If invalid → re-prompt.
|
|
|
107
111
|
- [ ] User can pick an issue number
|
|
108
112
|
- [ ] Routes to /mgw:issue <number>
|
|
109
113
|
</success_criteria>
|
|
114
|
+
|
|
115
|
+
## TUI Mode (CLI only)
|
|
116
|
+
|
|
117
|
+
When `mgw issues` runs from the CLI entry point (`bin/mgw.cjs`) in an interactive
|
|
118
|
+
terminal, it launches a full TUI browser instead of a static table.
|
|
119
|
+
|
|
120
|
+
**Entry point:** `lib/tui/index.cjs` — `createIssuesBrowser(options)`
|
|
121
|
+
|
|
122
|
+
**CLI options:**
|
|
123
|
+
```
|
|
124
|
+
mgw issues [options]
|
|
125
|
+
-l, --label <label> Filter by label
|
|
126
|
+
-m, --milestone <name> Filter by milestone
|
|
127
|
+
-a, --assignee <user> Assignee filter (default: @me, 'all' = no filter)
|
|
128
|
+
-s, --search <query> Pre-populate the fuzzy search input
|
|
129
|
+
--state <state> Issue state: open|closed|all (default: open)
|
|
130
|
+
--limit <n> Max issues to load (default: 50)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**TUI keyboard shortcuts:**
|
|
134
|
+
| Key | Action |
|
|
135
|
+
|-----|--------|
|
|
136
|
+
| `j` / `↓` | Scroll down |
|
|
137
|
+
| `k` / `↑` | Scroll up |
|
|
138
|
+
| `/` | Focus search input |
|
|
139
|
+
| `Enter` | Select issue → prints `#N — Title` and exits |
|
|
140
|
+
| `q` / `Esc` | Quit |
|
|
141
|
+
| `Tab` | Cycle focus (list → detail → filter) |
|
|
142
|
+
| `g` / `Home` | Jump to top |
|
|
143
|
+
| `G` / `End` | Jump to bottom |
|
|
144
|
+
| `?` | Toggle keyboard help |
|
|
145
|
+
|
|
146
|
+
**Non-interactive fallback:**
|
|
147
|
+
When stdout is not a TTY (piped, CI, `MGW_NO_TUI=1`), the static table is printed
|
|
148
|
+
to stdout. Pipe-friendly — no ANSI codes, no interactive elements.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
mgw issues | grep "auth"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Implementation modules:**
|
|
155
|
+
```
|
|
156
|
+
lib/tui/
|
|
157
|
+
index.cjs — createIssuesBrowser(options) — entry point
|
|
158
|
+
search.cjs — FuzzySearch class — pure, no UI dependency
|
|
159
|
+
keyboard.cjs — KeyboardHandler (EventEmitter)
|
|
160
|
+
renderer.cjs — createRenderer() — blessed/neo-blessed adapter
|
|
161
|
+
graceful.cjs — isInteractive(), renderStaticTable()
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Design document:** `docs/TUI-DESIGN.md` — library selection rationale, wireframe, full interface contracts.
|
|
165
|
+
|
|
166
|
+
**Rendering library:** `neo-blessed` (optional dependency). Renderer is swappable via `lib/tui/renderer.cjs`.
|
|
167
|
+
|
|
168
|
+
**Slash command vs CLI:**
|
|
169
|
+
This slash command (`/mgw:issues`) uses the static table + `AskUserQuestion` pattern
|
|
170
|
+
because Claude Code sessions don't have raw TTY access. The TUI is CLI-only (`mgw issues`).
|
|
171
|
+
Both paths route to `/mgw:issue <number>` for triage.
|
package/commands/milestone.md
CHANGED
|
@@ -141,6 +141,28 @@ Display:
|
|
|
141
141
|
Issues: ${TOTAL_ISSUES}
|
|
142
142
|
Mode: ${INTERACTIVE ? "Interactive" : "Autonomous"}
|
|
143
143
|
```
|
|
144
|
+
|
|
145
|
+
Then print the initial milestone progress bar (0 done, TOTAL_ISSUES total):
|
|
146
|
+
```bash
|
|
147
|
+
ISSUES_WITH_STAGES=$(echo "$ISSUES_JSON" | python3 -c "
|
|
148
|
+
import json,sys
|
|
149
|
+
issues = json.load(sys.stdin)
|
|
150
|
+
result = [{'number': i['github_number'], 'pipeline_stage': i.get('pipeline_stage', 'new')} for i in issues]
|
|
151
|
+
print(json.dumps(result))
|
|
152
|
+
")
|
|
153
|
+
|
|
154
|
+
node -e "
|
|
155
|
+
const { printMilestoneProgress } = require('./lib/progress.cjs');
|
|
156
|
+
const issues = JSON.parse(process.env.ISSUES_WITH_STAGES || '[]');
|
|
157
|
+
const doneCount = issues.filter(i => i.pipeline_stage === 'done' || i.pipeline_stage === 'pr-created').length;
|
|
158
|
+
printMilestoneProgress({
|
|
159
|
+
done: doneCount,
|
|
160
|
+
total: issues.length,
|
|
161
|
+
label: process.env.MILESTONE_NAME,
|
|
162
|
+
issues
|
|
163
|
+
});
|
|
164
|
+
" MILESTONE_NAME="$MILESTONE_NAME" ISSUES_WITH_STAGES="$ISSUES_WITH_STAGES"
|
|
165
|
+
```
|
|
144
166
|
</step>
|
|
145
167
|
|
|
146
168
|
<step name="resolve_execution_order">
|
|
@@ -723,6 +745,27 @@ writeProjectState(state);
|
|
|
723
745
|
|
|
724
746
|
ISSUES_RUN=$((ISSUES_RUN + 1))
|
|
725
747
|
|
|
748
|
+
# Update and print milestone progress bar after each issue completes
|
|
749
|
+
ISSUES_WITH_STAGES=$(node -e "
|
|
750
|
+
const { loadProjectState, resolveActiveMilestoneIndex } = require('./lib/state.cjs');
|
|
751
|
+
const state = loadProjectState();
|
|
752
|
+
const idx = resolveActiveMilestoneIndex(state);
|
|
753
|
+
if (idx < 0) { console.log('[]'); process.exit(0); }
|
|
754
|
+
const issues = state.milestones[idx].issues || [];
|
|
755
|
+
console.log(JSON.stringify(issues.map(i => ({ number: i.github_number, pipeline_stage: i.pipeline_stage || 'new' }))));
|
|
756
|
+
" 2>/dev/null || echo "[]")
|
|
757
|
+
|
|
758
|
+
node -e "
|
|
759
|
+
const { printMilestoneProgress } = require('./lib/progress.cjs');
|
|
760
|
+
const issues = JSON.parse(process.env.ISSUES_WITH_STAGES || '[]');
|
|
761
|
+
const doneCount = issues.filter(i => i.pipeline_stage === 'done' || i.pipeline_stage === 'pr-created').length;
|
|
762
|
+
printMilestoneProgress({
|
|
763
|
+
done: doneCount,
|
|
764
|
+
total: issues.length,
|
|
765
|
+
issues
|
|
766
|
+
});
|
|
767
|
+
" ISSUES_WITH_STAGES="$ISSUES_WITH_STAGES"
|
|
768
|
+
|
|
726
769
|
# If --interactive: pause between issues
|
|
727
770
|
if [ "$INTERACTIVE" = true ]; then
|
|
728
771
|
AskUserQuestion(
|