Skip to content

Commit 3c72fef

Browse files
tmelliottjrCopilot
andauthored
projects: add server instructions (#1393)
* add server instructions * Update instructions.go Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent da66054 commit 3c72fef

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

pkg/github/instructions.go

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,75 @@ Check 'list_issue_types' first for organizations to use proper issue types. Use
6262
return `## Discussions
6363
6464
Use 'list_discussion_categories' to understand available categories before creating discussions. Filter by category for better organization.`
65+
case "projects":
66+
return `## Projects
67+
68+
Workflow: 1) list_project_fields (get field IDs), 2) list_project_items (with pagination), 3) optional updates.
69+
70+
Field usage:
71+
- Call list_project_fields first to understand available fields and get IDs/types before filtering.
72+
- Use EXACT returned field names (case-insensitive match). Don't invent names or IDs.
73+
- Iteration synonyms (sprint/cycle) only if that field exists; map to the actual name (e.g. sprint:@current).
74+
- Only include filters for fields that exist and are relevant.
75+
76+
Pagination (mandatory):
77+
- Loop while pageInfo.hasNextPage=true using after=pageInfo.nextCursor.
78+
- Keep query, fields, per_page IDENTICAL on every page.
79+
- Use before=pageInfo.prevCursor only when explicitly navigating to a previous page.
80+
81+
Counting rules:
82+
- Count items array length after full pagination.
83+
- Never count field objects, content, or nested arrays as separate items.
84+
85+
Summary vs list:
86+
- Summaries ONLY if user uses verbs: analyze | summarize | summary | report | overview | insights.
87+
- Listing verbs (list/show/get/fetch/display/enumerate) → enumerate + total.
88+
89+
Self-check before returning:
90+
- Paginated fully
91+
- Correct IDs used
92+
- Field names valid
93+
- Summary only if requested.
94+
95+
Return COMPLETE data or state what's missing (e.g. pages skipped).
96+
97+
list_project_items query rules:
98+
Query string - For advanced filtering of project items using GitHub's project filtering syntax:
99+
100+
MUST reflect user intent; strongly prefer explicit content type if narrowed:
101+
- "open issues" → state:open is:issue
102+
- "merged PRs" → state:merged is:pr
103+
- "items updated this week" → updated:>@today-7d (omit type only if mixed desired)
104+
- "list all P1 priority items" → priority:p1 (omit state if user wants all, omit type if user specifies "items")
105+
- "list all open P2 issues" → is:issue state:open priority:p2 (include state if user wants open or closed, include type if user specifies "issues" or "PRs")
106+
- "all open issues I'm working on" → is:issue state:open assignee:@me
107+
108+
Query Construction Heuristics:
109+
a. Extract type nouns: issues → is:issue | PRs, Pulls, or Pull Requests → is:pr | tasks/tickets → is:issue (ask if ambiguity)
110+
b. Map temporal phrases: "this week" → updated:>@today-7d
111+
c. Map negations: "excluding wontfix" → -label:wontfix
112+
d. Map priority adjectives: "high/sev1/p1" → priority:high OR priority:p1 (choose based on field presence)
113+
e. When filtering by label, always use wildcard matching to account for cross-repository differences or emojis: (e.g. "bug 🐛" → label:*bug*)
114+
f. When filtering by milestone, always use wildcard matching to account for cross-repository differences: (e.g. "v1.0" → milestone:*v1.0*)
115+
116+
Syntax Essentials (items):
117+
AND: space-separated. (label:bug priority:high).
118+
OR: comma inside one qualifier (label:bug,critical).
119+
NOT: leading '-' (-label:wontfix).
120+
Hyphenate multi-word field names. (team-name:"Backend Team", story-points:>5).
121+
Quote multi-word values. (status:"In Review" team-name:"Backend Team").
122+
Ranges: points:1..3, updated:<@today-30d.
123+
Wildcards: title:*crash*, label:bug*.
124+
Assigned to User: assignee:@me | assignee:username | no:assignee
125+
126+
Common Qualifier Glossary (items):
127+
is:issue | is:pr | state:open|closed|merged | assignee:@me|username | label:NAME | status:VALUE |
128+
priority:p1|high | sprint-name:@current | team-name:"Backend Team" | parent-issue:"org/repo#123" |
129+
updated:>@today-7d | title:*text* | -label:wontfix | label:bug,critical | no:assignee | has:label
130+
131+
Never:
132+
- Infer field IDs; fetch via list_project_fields.
133+
- Drop 'fields' param on subsequent pages if field values are needed.`
65134
default:
66135
return ""
67136
}

0 commit comments

Comments
 (0)