@snipcodeit/mgw 0.2.2 → 0.3.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,230 @@
1
+ ---
2
+ name: board:views
3
+ description: Create GitHub Projects v2 layout views (kanban, table, roadmap)
4
+ ---
5
+
6
+ <step name="subcommand_views">
7
+ **Execute 'views' subcommand:**
8
+
9
+ Only run if `$SUBCOMMAND = "views"`.
10
+
11
+ Creates GitHub Projects v2 layout views. Subcommand argument is the view type:
12
+ `kanban`, `table`, or `roadmap`. GitHub's API supports creating views but does NOT
13
+ support programmatic configuration of board grouping — that must be set in the UI.
14
+
15
+ ```bash
16
+ if [ "$SUBCOMMAND" = "views" ]; then
17
+ if [ "$BOARD_CONFIGURED" = "false" ]; then
18
+ echo "No board configured. Run /mgw:board create first."
19
+ exit 1
20
+ fi
21
+
22
+ VIEW_TYPE=$(echo "$ARGUMENTS" | awk '{print $2}')
23
+
24
+ if [ -z "$VIEW_TYPE" ]; then
25
+ echo "Usage: /mgw:board views <kanban|table|roadmap>"
26
+ echo ""
27
+ echo " kanban Create Board layout view (swimlanes by Status)"
28
+ echo " table Create Table layout view (flat list with all fields)"
29
+ echo " roadmap Create Roadmap layout view (timeline grouped by Milestone)"
30
+ exit 1
31
+ fi
32
+
33
+ case "$VIEW_TYPE" in
34
+ kanban|table|roadmap) ;;
35
+ *)
36
+ echo "Unknown view type: ${VIEW_TYPE}"
37
+ echo "Valid: kanban, table, roadmap"
38
+ exit 1
39
+ ;;
40
+ esac
41
+ ```
42
+
43
+ **Map view type to layout and name:**
44
+
45
+ ```bash
46
+ case "$VIEW_TYPE" in
47
+ kanban)
48
+ VIEW_NAME="Kanban — Pipeline Stages"
49
+ VIEW_LAYOUT="BOARD_LAYOUT"
50
+ VIEW_KEY="kanban"
51
+ ;;
52
+ table)
53
+ VIEW_NAME="Triage Table — Team Planning"
54
+ VIEW_LAYOUT="TABLE_LAYOUT"
55
+ VIEW_KEY="table"
56
+ ;;
57
+ roadmap)
58
+ VIEW_NAME="Roadmap — Milestone Timeline"
59
+ VIEW_LAYOUT="ROADMAP_LAYOUT"
60
+ VIEW_KEY="roadmap"
61
+ ;;
62
+ esac
63
+
64
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
65
+ echo " MGW ► BOARD VIEWS: ${VIEW_NAME}"
66
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
67
+ echo ""
68
+ echo "Board: #${BOARD_NUMBER} — ${BOARD_URL}"
69
+ echo "Creating ${VIEW_LAYOUT} view: '${VIEW_NAME}'..."
70
+ echo ""
71
+ ```
72
+
73
+ **Create the view via GraphQL:**
74
+
75
+ ```bash
76
+ CREATE_VIEW_RESULT=$(gh api graphql -f query='
77
+ mutation($projectId: ID!, $name: String!, $layout: ProjectV2ViewLayout!) {
78
+ createProjectV2View(input: {
79
+ projectId: $projectId
80
+ name: $name
81
+ layout: $layout
82
+ }) {
83
+ projectV2View {
84
+ id
85
+ name
86
+ layout
87
+ }
88
+ }
89
+ }
90
+ ' -f projectId="$BOARD_NODE_ID" \
91
+ -f name="$VIEW_NAME" \
92
+ -f layout="$VIEW_LAYOUT" 2>&1)
93
+
94
+ VIEW_ID=$(echo "$CREATE_VIEW_RESULT" | python3 -c "
95
+ import json,sys
96
+ d = json.load(sys.stdin)
97
+ print(d['data']['createProjectV2View']['projectV2View']['id'])
98
+ " 2>/dev/null)
99
+
100
+ VIEW_LAYOUT_RETURNED=$(echo "$CREATE_VIEW_RESULT" | python3 -c "
101
+ import json,sys
102
+ d = json.load(sys.stdin)
103
+ print(d['data']['createProjectV2View']['projectV2View']['layout'])
104
+ " 2>/dev/null)
105
+
106
+ if [ -z "$VIEW_ID" ]; then
107
+ echo "ERROR: Failed to create view."
108
+ echo "GraphQL response: ${CREATE_VIEW_RESULT}"
109
+ exit 1
110
+ fi
111
+
112
+ echo "View created:"
113
+ echo " Name: ${VIEW_NAME}"
114
+ echo " Layout: ${VIEW_LAYOUT_RETURNED}"
115
+ echo " ID: ${VIEW_ID}"
116
+ echo ""
117
+ ```
118
+
119
+ **Store view ID in project.json:**
120
+
121
+ ```bash
122
+ python3 << PYEOF
123
+ import json
124
+
125
+ with open('${MGW_DIR}/project.json') as f:
126
+ project = json.load(f)
127
+
128
+ # Ensure views dict exists under project_board
129
+ board = project.setdefault('project', {}).setdefault('project_board', {})
130
+ views = board.setdefault('views', {})
131
+
132
+ views['${VIEW_KEY}'] = {
133
+ 'view_id': '${VIEW_ID}',
134
+ 'name': '${VIEW_NAME}',
135
+ 'layout': '${VIEW_LAYOUT}'
136
+ }
137
+
138
+ with open('${MGW_DIR}/project.json', 'w') as f:
139
+ json.dump(project, f, indent=2)
140
+
141
+ print('project.json updated with view ID')
142
+ PYEOF
143
+ ```
144
+
145
+ **Output instructions and next steps:**
146
+
147
+ ```bash
148
+ echo "View ID stored in .mgw/project.json under project.project_board.views.${VIEW_KEY}"
149
+ echo ""
150
+
151
+ case "$VIEW_TYPE" in
152
+ kanban)
153
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
154
+ echo " NEXT STEP: Configure Group By in GitHub UI"
155
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
156
+ echo ""
157
+ echo "GitHub's API does not support setting board grouping programmatically."
158
+ echo "To create swimlanes by pipeline stage:"
159
+ echo ""
160
+ echo " 1. Open the board: ${BOARD_URL}"
161
+ echo " 2. Click '${VIEW_NAME}' in the view tabs"
162
+ echo " 3. Click the view settings (down-arrow next to view name)"
163
+ echo " 4. Select 'Group by' -> 'Status'"
164
+ echo ""
165
+ echo "Each pipeline stage will become a swimlane column:"
166
+ echo " New / Triaged / Planning / Executing / Verifying / PR Created / Done"
167
+ echo " + Needs Info / Needs Security Review / Discussing / Approved / Failed / Blocked"
168
+ echo ""
169
+ echo "See docs/BOARD-SCHEMA.md for full view configuration reference."
170
+ ;;
171
+ table)
172
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
173
+ echo " NEXT STEP: Configure Columns in GitHub UI"
174
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
175
+ echo ""
176
+ echo "Triage Table view created for team planning visibility."
177
+ echo "GitHub's API does not support setting table columns or sort order"
178
+ echo "programmatically — configure in the GitHub UI:"
179
+ echo ""
180
+ echo " 1. Open the board: ${BOARD_URL}"
181
+ echo " 2. Click '${VIEW_NAME}' in the view tabs"
182
+ echo " 3. Click the view settings (down-arrow next to view name)"
183
+ echo " 4. Add these columns in order:"
184
+ echo " Status (sort ascending — pipeline order)"
185
+ echo " Milestone"
186
+ echo " Phase"
187
+ echo " GSD Route"
188
+ echo " AI Agent State"
189
+ echo " 5. Set 'Sort by' -> 'Status' ascending"
190
+ echo ""
191
+ echo "This column order surfaces triage planning context:"
192
+ echo " Status first shows pipeline position at a glance."
193
+ echo " Milestone + Phase + GSD Route give scope and routing context."
194
+ echo " AI Agent State shows live execution activity."
195
+ echo ""
196
+ echo "See docs/BOARD-SCHEMA.md for full column and sort configuration reference."
197
+ ;;
198
+ roadmap)
199
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
200
+ echo " NEXT STEP: Configure Roadmap in GitHub UI"
201
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
202
+ echo ""
203
+ echo "Roadmap view created for milestone-based timeline visualization."
204
+ echo "GitHub's API does not support setting roadmap grouping or date fields"
205
+ echo "programmatically — configure in the GitHub UI:"
206
+ echo ""
207
+ echo " 1. Open the board: ${BOARD_URL}"
208
+ echo " 2. Click '${VIEW_NAME}' in the view tabs"
209
+ echo " 3. Click the view settings (down-arrow next to view name)"
210
+ echo " 4. Set 'Group by' -> 'Milestone'"
211
+ echo " Items will be grouped by the Milestone field value."
212
+ echo ""
213
+ echo "Timeline date field limitation:"
214
+ echo " GitHub Roadmap requires date fields (start date + end date) to render"
215
+ echo " items on the timeline. MGW uses iteration-based tracking without"
216
+ echo " explicit date fields — items will appear in the roadmap grouped by"
217
+ echo " Milestone but without timeline bars unless date fields are added."
218
+ echo ""
219
+ echo " To enable timeline bars, set milestone due dates via:"
220
+ echo " gh api repos/{owner}/{repo}/milestones/{number} --method PATCH \\"
221
+ echo " -f due_on='YYYY-MM-DDT00:00:00Z'"
222
+ echo " GitHub Projects v2 can read milestone due dates as a date source."
223
+ echo ""
224
+ echo "See docs/BOARD-SCHEMA.md for full roadmap configuration reference."
225
+ ;;
226
+ esac
227
+
228
+ fi # end views subcommand
229
+ ```
230
+ </step>