Skip to content

Commit 7bdf282

Browse files
shahzaibjp3dr0rv
andauthored
AI Feature Orchestrator: Prompt Files & Config (4/6), Fixes AB#3534744 (#398)
## Part 4: Prompt Files and Config Adds prompt files (slash commands) and MCP configuration. ### Prompt Files | Command | Purpose | |---------|---------| | `/feature-design` | Start a new feature research + design spec | | `/feature-plan` | Decompose approved design into PBIs | | `/feature-backlog` | Create PBIs in Azure DevOps | | `/feature-dispatch` | Dispatch PBIs to Copilot coding agent | | `/feature-status` | Check tracked PR statuses | | `/feature-continue` | Resume from current pipeline step | | `/feature-pr-iterate` | Review a PR, analyze comments, iterate with agent | Each prompt file uses `agent: feature-orchestrator` to route to the custom agent. ### Config - `.vscode/mcp.json` ADO MCP server (work items, repos, pipelines) - `.gitignore` exceptions for `.vscode/mcp.json` and extension artifacts **PR 4 of 6. Merge after Hooks (#397).** Fixes [AB#3534744](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3534744) Co-authored-by: pedro romero vargas <76129899+p3dr0rv@users.noreply.github.com>
1 parent 7a250e7 commit 7bdf282

9 files changed

Lines changed: 402 additions & 1 deletion
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
agent: feature-orchestrator
3+
description: "Create approved PBIs as work items in Azure DevOps"
4+
---
5+
6+
# Backlog Phase
7+
8+
Read the PBI creator skill from #file:.github/skills/pbi-creator/SKILL.md
9+
10+
## Your Task
11+
12+
You are in the **Backlog** phase. The plan has been approved and you need to create PBIs in ADO.
13+
14+
**Step 1**: Read the feature state:
15+
```powershell
16+
node .github/hooks/state-utils.js get-feature "<feature name>"
17+
```
18+
19+
**Step 2**: Follow the **Creation Phase** instructions from the orchestrator agent:
20+
1. Pass the FULL plan to the `pbi-creator` subagent
21+
2. The pbi-creator will discover ADO defaults, present options via `askQuestion`, and create work items
22+
3. Present the creation summary with AB# IDs
23+
4. Use `askQuestion` to gate the next stage
24+
25+
**Pipeline**: ✅ Design → ✅ Plan → 📝 **Backlog** → ○ Dispatch → ○ Monitor
26+
27+
After PBIs are created, update state for EACH PBI:
28+
```powershell
29+
node .github/hooks/state-utils.js set-step "<feature name>" backlog_review
30+
node .github/hooks/state-utils.js add-pbi "<feature name>" '{"adoId":<id>,"title":"...","module":"...","status":"Committed","dependsOn":[<dep-ids>]}'
31+
```
32+
33+
**IMPORTANT**: Use single quotes for JSON args in PowerShell.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
agent: feature-orchestrator
3+
description: "Resume working on a feature from its current pipeline step"
4+
---
5+
6+
# Continue Feature
7+
8+
## Your Task
9+
10+
Resume working on a feature. The user will provide the feature name below.
11+
12+
**Step 1**: Read the feature state:
13+
```powershell
14+
node .github/hooks/state-utils.js get-feature "<feature name>"
15+
```
16+
17+
**Step 2**: Determine the current step from the `step` field and resume from there:
18+
19+
| Step | What to do |
20+
|------|-----------|
21+
| `designing` | Continue writing the design spec |
22+
| `design_review` | Design is done — ask user if they want to plan PBIs. Use `askQuestion`. |
23+
| `planning` | Continue planning PBIs |
24+
| `plan_review` | Plan is done — ask user if they want to backlog in ADO. Use `askQuestion`. |
25+
| `backlogging` | Continue creating PBIs in ADO |
26+
| `backlog_review` | PBIs created — ask user if they want to dispatch. Use `askQuestion`. |
27+
| `dispatching` | Continue dispatching |
28+
| `monitoring` | Check PR status (follow Monitor phase instructions) |
29+
30+
**Step 3**: Show the pipeline progress header:
31+
```
32+
## 🚀 Feature Orchestration: [Phase Name]
33+
34+
**Feature**: [feature name]
35+
**Pipeline**: [show ✅/📋/○ for each stage based on current step]
36+
```
37+
38+
Read `.github/copilot-instructions.md` for project context.
39+
40+
**IMPORTANT**: Use single quotes for JSON args in PowerShell.
41+
Always update state after completing a phase step.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
agent: feature-orchestrator
3+
description: "Start a new feature: research the codebase and write a design spec"
4+
---
5+
6+
# Design Phase
7+
8+
## Your Task
9+
10+
You are in the **Design** phase. The user will describe a feature below.
11+
12+
**Step 0**: Register the feature in state:
13+
```powershell
14+
node .github/hooks/state-utils.js add-feature '{"name": "<short feature name>", "step": "designing"}'
15+
```
16+
17+
Then follow the **Full Flow** instructions from the orchestrator agent:
18+
1. Run the `codebase-researcher` subagent with a detailed prompt
19+
2. Pass the FULL research output to the `design-writer` subagent
20+
3. Present the design summary and use `askQuestion` to offer next steps
21+
22+
**Pipeline**: 📝 **Design** → ○ Plan → ○ Backlog → ○ Dispatch → ○ Monitor
23+
24+
Read `.github/copilot-instructions.md` for project context.
25+
26+
**IMPORTANT**: Use single quotes for JSON args in PowerShell.
27+
After the design is complete, update state:
28+
```powershell
29+
node .github/hooks/state-utils.js set-step "<feature name>" design_review
30+
node .github/hooks/state-utils.js set-design "<feature name>" '{"docPath":"<path>","status":"approved"}'
31+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
agent: feature-orchestrator
3+
description: "Dispatch PBIs to GitHub Copilot coding agent for implementation"
4+
---
5+
6+
# Dispatch Phase
7+
8+
Read the dispatcher skill from #file:.github/skills/pbi-dispatcher/SKILL.md
9+
10+
## Your Task
11+
12+
You are in the **Dispatch** phase. PBIs have been created in ADO and you need to dispatch them.
13+
14+
**Step 1**: Read the feature state to get PBI details:
15+
```powershell
16+
node .github/hooks/state-utils.js get-feature "<feature name>"
17+
```
18+
19+
**Step 2**: Follow the **Dispatch Phase** instructions from the orchestrator agent:
20+
1. Run the `agent-dispatcher` subagent to dispatch PBIs to Copilot coding agent
21+
2. Record each dispatched PR in state
22+
3. Use `askQuestion` to gate the next stage
23+
24+
**Pipeline**: ✅ Design → ✅ Plan → ✅ Backlog → 🚀 **Dispatch** → ○ Monitor
25+
26+
After dispatch, update state:
27+
```powershell
28+
node .github/hooks/state-utils.js set-step "<feature name>" monitoring
29+
node .github/hooks/state-utils.js add-agent-pr "<feature name>" '{"repo":"<label>","prNumber":<n>,"prUrl":"<url>","status":"open","title":"<title>"}'
30+
```
31+
32+
**IMPORTANT**: Use single quotes for JSON args in PowerShell.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
agent: feature-orchestrator
3+
description: "Decompose an approved design into repo-targeted PBIs"
4+
---
5+
6+
# Plan Phase
7+
8+
## Your Task
9+
10+
You are in the **Plan** phase. The design has been approved and you need to break it into PBIs.
11+
12+
**Step 1**: Read the feature state to find the design doc:
13+
```powershell
14+
node .github/hooks/state-utils.js get-feature "<feature name>"
15+
```
16+
17+
**Step 2**: Read the design spec from `design-docs/` (the path is in the feature state).
18+
19+
**Step 3**: Follow the **Planning Phase** instructions from the orchestrator agent:
20+
1. Pass BOTH research findings AND the design spec to the `feature-planner` subagent
21+
2. Present the structured plan with Summary Table + PBI Details
22+
3. Use `askQuestion` to gate the next stage
23+
24+
**Pipeline**: ✅ Design → 📋 **Plan** → ○ Backlog → ○ Dispatch → ○ Monitor
25+
26+
After planning is complete, update state:
27+
```powershell
28+
node .github/hooks/state-utils.js set-step "<feature name>" plan_review
29+
```
30+
31+
**IMPORTANT**: Do NOT create ADO work items in this phase. Only produce the structured plan.
32+
Use single quotes for JSON args in PowerShell.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
agent: feature-orchestrator
3+
description: "Review a PR and post feedback for Copilot coding agent to iterate on"
4+
---
5+
6+
# PR Iteration
7+
8+
## Your Task
9+
10+
Help the developer review and iterate on an agent-created pull request.
11+
The user will provide the feature name, repo, and PR number below.
12+
13+
**Step 0**: Load feature context for deeper understanding:
14+
```powershell
15+
node .github/hooks/state-utils.js get-feature "<feature name>"
16+
```
17+
This returns the feature state including:
18+
- **Design spec path** (`artifacts.design.docPath`) — read this file to understand the intended design
19+
- **PBI details** (`artifacts.pbis`) — understand what this PR is supposed to implement
20+
- **Other PRs** (`artifacts.agentPrs`) — related work in the feature
21+
22+
**Read the design spec** from the `docPath` to understand the architectural decisions,
23+
requirements, and intended approach. This context is essential for evaluating whether
24+
the PR correctly implements the design and for proposing informed resolutions to comments.
25+
26+
**Step 1**: Fetch the PR details, diff, and **all review comments**:
27+
```powershell
28+
gh pr view <prNumber> --repo "<full-repo-slug>" --json title,body,state,additions,deletions,changedFiles,url
29+
gh pr diff <prNumber> --repo "<full-repo-slug>" | head -200
30+
```
31+
32+
Then fetch **all review comments and conversation threads**:
33+
```powershell
34+
gh api "/repos/<owner>/<repo>/pulls/<prNumber>/comments" --jq '.[] | {path: .path, line: .line, body: .body, user: .user.login, created_at: .created_at}' 2>&1
35+
gh api "/repos/<owner>/<repo>/issues/<prNumber>/comments" --jq '.[] | {body: .body, user: .user.login, created_at: .created_at}' 2>&1
36+
gh pr view <prNumber> --repo "<full-repo-slug>" --json reviews --jq '.reviews[] | {state: .state, body: .body, author: .author.login}'
37+
```
38+
39+
This gives you:
40+
- **Inline review comments** (file-specific feedback from reviewers)
41+
- **General PR comments** (conversation thread)
42+
- **Review decisions** (approved, changes requested, commented)
43+
44+
Repo slug mapping:
45+
- `common``AzureAD/microsoft-authentication-library-common-for-android`
46+
- `msal``AzureAD/microsoft-authentication-library-for-android`
47+
- `broker``identity-authnz-teams/ad-accounts-for-android`
48+
- `adal``AzureAD/azure-activedirectory-library-for-android`
49+
50+
Discover the GitHub username from `.github/developer-local.json`, or `gh auth status`.
51+
Switch account before any gh commands: `gh auth switch --user <username>`
52+
53+
**Step 2**: Ask the developer how they want to handle the review feedback:
54+
55+
```
56+
askQuestion({
57+
question: "How would you like to handle the review feedback on this PR?",
58+
options: [
59+
{ label: "🤖 Delegate to Copilot", description: "Tag @copilot to address all review comments automatically" },
60+
{ label: "📋 Show me the analysis first", description: "Present review feedback with proposed resolutions, then decide", recommended: true },
61+
{ label: "✅ Looks good — approve", description: "Approve the PR as-is" }
62+
]
63+
})
64+
```
65+
66+
### If "Delegate to Copilot":
67+
68+
Compose a single comprehensive `@copilot` comment that summarizes ALL reviewer feedback
69+
and post it on the PR:
70+
```powershell
71+
gh pr comment <prNumber> --repo "<slug>" --body "@copilot Please address the following review feedback:
72+
73+
1. [summary of comment 1 with file/line reference]
74+
2. [summary of comment 2 with file/line reference]
75+
...
76+
77+
Please fix all of the above and push updated commits."
78+
```
79+
80+
Confirm the comment was posted and that the coding agent will pick it up.
81+
82+
### If "Show me the analysis first":
83+
84+
Analyze the PR and present a comprehensive review summary:
85+
86+
**For each reviewer comment:**
87+
1. Show the comment (who said what, on which file/line)
88+
2. **Propose a resolution** — analyze the code and suggest what should change
89+
3. If a code change is needed, show a concrete code snippet or approach
90+
4. If the comment is a question, provide a clear answer based on codebase context
91+
92+
Present as:
93+
```
94+
### Reviewer Feedback & Proposed Resolutions
95+
96+
**Comment 1** — @reviewer on `src/MyFile.java:42`
97+
> "This should handle null case"
98+
**Resolution**: Add a null check before accessing the field. Proposed change:
99+
`if (value != null) { ... }`
100+
101+
**Comment 2** — @reviewer (general)
102+
> "Missing unit tests for the retry logic"
103+
**Resolution**: Add tests for success, failure, and max-retry scenarios in `IpcRetryTest.java`.
104+
```
105+
106+
Also include:
107+
- Overall PR summary (title, +/- lines, changed files)
108+
- Any patterns or systemic issues across the comments
109+
- Your recommendation
110+
111+
Then ask what to do next:
112+
```
113+
askQuestion({
114+
question: "How would you like to proceed?",
115+
options: [
116+
{ label: "🤖 Delegate to Copilot agent", description: "Post @copilot comment with all the feedback to fix remotely" },
117+
{ label: "💻 Implement locally", description: "Checkout the branch and make changes in VS Code" },
118+
{ label: "✏️ I'll write custom feedback", description: "Let me type exactly what to tell the agent" }
119+
]
120+
})
121+
```
122+
123+
**If "Delegate to Copilot agent"**: Post the structured feedback as an `@copilot` comment (same as above).
124+
125+
**If "Implement locally"**: Checkout the PR branch in the correct repo directory:
126+
```powershell
127+
gh pr checkout <prNumber> --repo "<full-repo-slug>"
128+
```
129+
Run this in the correct sub-repo directory (common/, msal/, broker/, adal/).
130+
Then tell the developer: "Branch checked out. Make your changes, commit, and push."
131+
132+
**If "I'll write custom feedback"**: Ask the developer to type their feedback, then post it
133+
as an `@copilot` comment on the PR.
134+
135+
### If "Approve":
136+
137+
```powershell
138+
gh pr review <prNumber> --repo "<slug>" --approve
139+
```
140+
141+
Confirm the approval.
142+
143+
## Final Step
144+
145+
After any action, confirm what was done and suggest:
146+
"Use the feature detail panel's ↻ Refresh button to update PR status."
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
agent: feature-orchestrator
3+
description: "Check the status of agent-created pull requests for a feature"
4+
---
5+
6+
# Monitor Phase
7+
8+
## Your Task
9+
10+
You are in the **Monitor** phase. Check the status of agent PRs for the feature.
11+
12+
**Step 1**: Read the feature state to get tracked PRs:
13+
```powershell
14+
node .github/hooks/state-utils.js get-feature "<feature name>"
15+
```
16+
This returns `artifacts.agentPrs` — an array of `{repo, prNumber, prUrl, status, title}`.
17+
**Only check the PRs listed here — do NOT scan all repos.**
18+
19+
**Step 2**: For each tracked PR, fetch live status:
20+
```powershell
21+
gh auth switch --user <discovered_username>
22+
gh pr view <prNumber> --repo "<full-repo-slug>" --json state,title,url,statusCheckRollup,additions,deletions,changedFiles,isDraft
23+
```
24+
25+
Repo slug mapping:
26+
- `common``AzureAD/microsoft-authentication-library-common-for-android`
27+
- `msal``AzureAD/microsoft-authentication-library-for-android`
28+
- `broker``identity-authnz-teams/ad-accounts-for-android`
29+
- `adal``AzureAD/azure-activedirectory-library-for-android`
30+
31+
Discover the GitHub username from `.github/developer-local.json`, or `gh auth status`, or prompt.
32+
33+
**Step 3**: Present results in a table:
34+
35+
```
36+
## 🚀 Feature Orchestration: Monitor
37+
38+
**Pipeline**: ✅ Design → ✅ Plan → ✅ Backlog → ✅ Dispatch → 📡 **Monitor**
39+
40+
| PR | Repo | Title | Status | Checks | +/- |
41+
|---|---|---|---|---|---|
42+
```
43+
44+
**Step 4**: Update state with latest statuses:
45+
```powershell
46+
node .github/hooks/state-utils.js add-agent-pr "<feature name>" '{"repo":"...","prNumber":<n>,"prUrl":"...","status":"<open|merged|closed>","title":"..."}'
47+
```
48+
49+
End with: "Use `@copilot` in PR comments to iterate with the coding agent."

0 commit comments

Comments
 (0)