Skip to content

Commit d6cab97

Browse files
zwickCopilot
andauthored
Add basic project view management (#2961)
* Add basic project view management Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6f8ede6-efee-4191-900d-59a1bb0af000 * Harden project view mutations Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6f8ede6-efee-4191-900d-59a1bb0af000 * Resolve project view fields by name Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6f8ede6-efee-4191-900d-59a1bb0af000 * Clear project view filters with explicit null Align the filter parameter with the nullable-parameter convention: omit to preserve, pass null to clear. Empty strings are now rejected rather than treated as a clear sentinel. The GraphQL and REST wire format is unchanged, since the API still clears a filter with an empty string. Also replace the "<nil>" string comparison in deleteProjectView with a direct nil check on the returned ID. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Use caller-specific project field hints Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6f8ede6-efee-4191-900d-59a1bb0af000 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c6f8ede6-efee-4191-900d-59a1bb0af000
1 parent ff15f68 commit d6cab97

11 files changed

Lines changed: 1728 additions & 26 deletions

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,7 @@ The following sets of tools are available:
10991099
- `owner_type`: Owner type (user or org). If not provided, will be automatically detected. (string, optional)
11001100
- `project_number`: The project's number. (number, optional)
11011101
- `status_update_id`: The node ID of the project status update. Required for 'get_project_status_update' method. (string, optional)
1102+
- `view_id`: The node ID of the project view. Required for 'get_project_view' method. (string, optional)
11021103

11031104
- **projects_list** - List GitHub Projects resources
11041105
- **Required OAuth Scopes**: `read:project`
@@ -1111,13 +1112,14 @@ The following sets of tools are available:
11111112
- `owner`: The owner (user or organization login). The name is not case sensitive. (string, required)
11121113
- `owner_type`: Owner type (user or org). If not provided, will automatically try both. (string, optional)
11131114
- `per_page`: Results per page (max 50) (number, optional)
1114-
- `project_number`: The project's number. Required for 'list_project_fields', 'list_project_items', and 'list_project_status_updates' methods. (number, optional)
1115+
- `project_number`: The project's number. Required for 'list_project_fields', 'list_project_items', 'list_project_views', and 'list_project_status_updates' methods. (number, optional)
11151116
- `query`: Filter/query string. For list_projects: filter by title text and state (e.g. "roadmap is:open"). For list_project_items: advanced filtering using GitHub's project filtering syntax. (string, optional)
11161117

11171118
- **projects_write** - Manage GitHub Projects
11181119
- **Required OAuth Scopes**: `project`
11191120
- `body`: The body of the status update (markdown). Used for 'create_project_status_update' method. (string, optional)
11201121
- `field_name`: The name of the iteration field (e.g. 'Sprint'). Required for 'create_iteration_field' method. (string, optional)
1122+
- `filter`: Saved view filter; omit on update to preserve it, or pass null to clear it. (string | null, optional)
11211123
- `issue_number`: The issue number. Required for 'add_project_item' when item_type is 'issue'. Also accepted by 'update_project_item' to resolve the item by issue number (combine with item_owner and item_repo). (number, optional)
11221124
- `item_id`: The project item ID. Required for 'delete_project_item'. For 'update_project_item', provide either item_id, or (item_owner + item_repo + issue_number) to resolve the item by issue. (number, optional)
11231125
- `item_owner`: The owner (user or organization) of the repository containing the issue or pull request. Required for 'add_project_item' method. Also accepted by 'update_project_item' when resolving the item by issue number. (string, optional)
@@ -1126,7 +1128,9 @@ The following sets of tools are available:
11261128
- `items`: The items to update with the top-level 'updated_field'. Required for 'update_project_items'; prefer it over calling 'update_project_item' in a loop. Each entry must match exactly one reference variant: 'node_id', numeric 'item_id', or 'item_owner' + 'item_repo' + 'issue_number'. Limit: 50 items per call. (object[], optional)
11271129
- `iteration_duration`: Duration in days for iterations of the field (e.g. 7 for weekly, 14 for bi-weekly). Required for 'create_iteration_field' method. (number, optional)
11281130
- `iterations`: Custom iterations for 'create_iteration_field' method. Only set this when you need iterations with varying durations, breaks between them, or specific titles. Otherwise omit it: GitHub auto-creates three iterations of 'iteration_duration' days starting on 'start_date', which is the right choice for most cases. (object[], optional)
1131+
- `layout`: View layout; required when creating a view. (string, optional)
11291132
- `method`: The method to execute (string, required)
1133+
- `name`: View name; required when creating a view. (string, optional)
11301134
- `owner`: The project owner (user or organization login). The name is not case sensitive. (string, required)
11311135
- `owner_type`: Owner type (user or org). Required for 'create_project' method. If not provided for other methods, will be automatically detected. (string, optional)
11321136
- `project_number`: The project's number. Required for all methods except 'create_project'. (number, optional)
@@ -1136,6 +1140,9 @@ The following sets of tools are available:
11361140
- `target_date`: The target date of the status update in YYYY-MM-DD format. Used for 'create_project_status_update' method. (string, optional)
11371141
- `title`: The project title. Required for 'create_project' method. (string, optional)
11381142
- `updated_field`: The field/value to apply, using {"id": 123, "value": ...} or {"name": "Status", "value": ...}; null clears the field. Required for 'update_project_item' and 'update_project_items', where one top-level field/value applies to every item in a batch. For 'update_project_item' SINGLE_SELECT fields, the name form accepts option names; the ID form expects an option ID. (object, optional)
1143+
- `view_id`: Project view node ID for update or delete; must belong to owner/project_number. (string, optional)
1144+
- `visible_field_names`: Field names for table or board creation; mutually exclusive with visible_fields. (string[], optional)
1145+
- `visible_fields`: Field database IDs for table or board creation; mutually exclusive with visible_field_names. (string[], optional)
11391146

11401147
</details>
11411148

pkg/github/__toolsnaps__/projects_get.snap

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"readOnlyHint": true,
55
"title": "Get details of GitHub Projects resources"
66
},
7-
"description": "Get details about specific GitHub Projects resources.\nUse this tool to get details about individual projects, project fields, and project items by their unique IDs.\n",
7+
"description": "Get details about specific GitHub Projects resources.\nUse this tool to get details about individual projects, project fields, project items, and project views by their unique IDs.\n",
88
"inputSchema": {
99
"properties": {
1010
"field_id": {
@@ -35,7 +35,8 @@
3535
"get_project",
3636
"get_project_field",
3737
"get_project_item",
38-
"get_project_status_update"
38+
"get_project_status_update",
39+
"get_project_view"
3940
],
4041
"type": "string"
4142
},
@@ -58,6 +59,10 @@
5859
"status_update_id": {
5960
"description": "The node ID of the project status update. Required for 'get_project_status_update' method.",
6061
"type": "string"
62+
},
63+
"view_id": {
64+
"description": "The node ID of the project view. Required for 'get_project_view' method.",
65+
"type": "string"
6166
}
6267
},
6368
"required": [

pkg/github/__toolsnaps__/projects_list.snap

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"readOnlyHint": true,
55
"title": "List GitHub Projects resources"
66
},
7-
"description": "Tools for listing GitHub Projects resources.\nUse this tool to list projects for a user or organization, or list project fields and items for a specific project.\n",
7+
"description": "Tools for listing GitHub Projects resources.\nUse this tool to list projects for a user or organization, or list project fields, items, views, and status updates for a specific project.\n",
88
"inputSchema": {
99
"properties": {
1010
"after": {
@@ -35,7 +35,8 @@
3535
"list_projects",
3636
"list_project_fields",
3737
"list_project_items",
38-
"list_project_status_updates"
38+
"list_project_status_updates",
39+
"list_project_views"
3940
],
4041
"type": "string"
4142
},
@@ -56,7 +57,7 @@
5657
"type": "number"
5758
},
5859
"project_number": {
59-
"description": "The project's number. Required for 'list_project_fields', 'list_project_items', and 'list_project_status_updates' methods.",
60+
"description": "The project's number. Required for 'list_project_fields', 'list_project_items', 'list_project_views', and 'list_project_status_updates' methods.",
6061
"type": "number"
6162
},
6263
"query": {

pkg/github/__toolsnaps__/projects_write.snap

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"readOnlyHint": false,
66
"title": "Manage GitHub Projects"
77
},
8-
"description": "Create and manage GitHub Projects: create projects, add/update/delete items, bulk-update many items at once, create status updates, and add iteration fields.",
8+
"description": "Create and manage GitHub Projects: create projects, add/update/delete items, bulk-update many items at once, manage views, create status updates, and add iteration fields.",
99
"inputSchema": {
1010
"properties": {
1111
"body": {
@@ -16,6 +16,17 @@
1616
"description": "The name of the iteration field (e.g. 'Sprint'). Required for 'create_iteration_field' method.",
1717
"type": "string"
1818
},
19+
"filter": {
20+
"anyOf": [
21+
{
22+
"type": "string"
23+
},
24+
{
25+
"type": "null"
26+
}
27+
],
28+
"description": "Saved view filter; omit on update to preserve it, or pass null to clear it."
29+
},
1930
"issue_number": {
2031
"description": "The issue number. Required for 'add_project_item' when item_type is 'issue'. Also accepted by 'update_project_item' to resolve the item by issue number (combine with item_owner and item_repo).",
2132
"type": "number"
@@ -129,6 +140,15 @@
129140
},
130141
"type": "array"
131142
},
143+
"layout": {
144+
"description": "View layout; required when creating a view.",
145+
"enum": [
146+
"table",
147+
"board",
148+
"roadmap"
149+
],
150+
"type": "string"
151+
},
132152
"method": {
133153
"description": "The method to execute",
134154
"enum": [
@@ -137,11 +157,18 @@
137157
"update_project_items",
138158
"delete_project_item",
139159
"create_project_status_update",
160+
"create_project_view",
161+
"update_project_view",
162+
"delete_project_view",
140163
"create_project",
141164
"create_iteration_field"
142165
],
143166
"type": "string"
144167
},
168+
"name": {
169+
"description": "View name; required when creating a view.",
170+
"type": "string"
171+
},
145172
"owner": {
146173
"description": "The project owner (user or organization login). The name is not case sensitive.",
147174
"type": "string"
@@ -224,6 +251,24 @@
224251
}
225252
],
226253
"type": "object"
254+
},
255+
"view_id": {
256+
"description": "Project view node ID for update or delete; must belong to owner/project_number.",
257+
"type": "string"
258+
},
259+
"visible_field_names": {
260+
"description": "Field names for table or board creation; mutually exclusive with visible_fields.",
261+
"items": {
262+
"type": "string"
263+
},
264+
"type": "array"
265+
},
266+
"visible_fields": {
267+
"description": "Field database IDs for table or board creation; mutually exclusive with visible_field_names.",
268+
"items": {
269+
"type": "string"
270+
},
271+
"type": "array"
227272
}
228273
},
229274
"required": [

pkg/github/minimal_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,15 @@ type MinimalProject struct {
433433
OwnerType string `json:"owner_type,omitempty"`
434434
}
435435

436+
type MinimalProjectView struct {
437+
ID string `json:"id"`
438+
Number int `json:"number"`
439+
Name string `json:"name"`
440+
Layout string `json:"layout"`
441+
Filter string `json:"filter"`
442+
VisibleFields []int64 `json:"visible_fields,omitempty"`
443+
}
444+
436445
type MinimalProjectItem struct {
437446
ID int64 `json:"id"`
438447
NodeID string `json:"node_id,omitempty"`

0 commit comments

Comments
 (0)