Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/prompts/feature-backlog.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
agent: feature-orchestrator
description: "Create approved PBIs as work items in Azure DevOps"
---

# Backlog Phase

Read the PBI creator skill from #file:.github/skills/pbi-creator/SKILL.md

## Your Task

You are in the **Backlog** phase. The plan has been approved and you need to create PBIs in ADO.

**Step 1**: Read the feature state:
```powershell
node .github/hooks/state-utils.js get-feature "<feature name>"
```

**Step 2**: Follow the **Creation Phase** instructions from the orchestrator agent:
1. Pass the FULL plan to the `pbi-creator` subagent
2. The pbi-creator will discover ADO defaults, present options via `askQuestion`, and create work items
3. Present the creation summary with AB# IDs
4. Use `askQuestion` to gate the next stage

**Pipeline**: ✅ Design → ✅ Plan → 📝 **Backlog** → ○ Dispatch → ○ Monitor

After PBIs are created, update state for EACH PBI:
```powershell
node .github/hooks/state-utils.js set-step "<feature name>" backlog_review
node .github/hooks/state-utils.js add-pbi "<feature name>" '{"adoId":<id>,"title":"...","module":"...","status":"Committed","dependsOn":[<dep-ids>]}'
```

**IMPORTANT**: Use single quotes for JSON args in PowerShell.
41 changes: 41 additions & 0 deletions .github/prompts/feature-continue.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
agent: feature-orchestrator
description: "Resume working on a feature from its current pipeline step"
---

# Continue Feature

## Your Task

Resume working on a feature. The user will provide the feature name below.

**Step 1**: Read the feature state:
```powershell
node .github/hooks/state-utils.js get-feature "<feature name>"
```

**Step 2**: Determine the current step from the `step` field and resume from there:

| Step | What to do |
|------|-----------|
| `designing` | Continue writing the design spec |
| `design_review` | Design is done — ask user if they want to plan PBIs. Use `askQuestion`. |
| `planning` | Continue planning PBIs |
| `plan_review` | Plan is done — ask user if they want to backlog in ADO. Use `askQuestion`. |
| `backlogging` | Continue creating PBIs in ADO |
| `backlog_review` | PBIs created — ask user if they want to dispatch. Use `askQuestion`. |
| `dispatching` | Continue dispatching |
| `monitoring` | Check PR status (follow Monitor phase instructions) |

**Step 3**: Show the pipeline progress header:
```
## 🚀 Feature Orchestration: [Phase Name]

**Feature**: [feature name]
**Pipeline**: [show ✅/📋/○ for each stage based on current step]
```

Read `.github/copilot-instructions.md` for project context.

**IMPORTANT**: Use single quotes for JSON args in PowerShell.
Always update state after completing a phase step.
31 changes: 31 additions & 0 deletions .github/prompts/feature-design.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
agent: feature-orchestrator
description: "Start a new feature: research the codebase and write a design spec"
---

# Design Phase

## Your Task

You are in the **Design** phase. The user will describe a feature below.

**Step 0**: Register the feature in state:
```powershell
node .github/hooks/state-utils.js add-feature '{"name": "<short feature name>", "step": "designing"}'
```

Then follow the **Full Flow** instructions from the orchestrator agent:
1. Run the `codebase-researcher` subagent with a detailed prompt
2. Pass the FULL research output to the `design-writer` subagent
3. Present the design summary and use `askQuestion` to offer next steps

**Pipeline**: 📝 **Design** → ○ Plan → ○ Backlog → ○ Dispatch → ○ Monitor

Read `.github/copilot-instructions.md` for project context.

**IMPORTANT**: Use single quotes for JSON args in PowerShell.
After the design is complete, update state:
```powershell
node .github/hooks/state-utils.js set-step "<feature name>" design_review
node .github/hooks/state-utils.js set-design "<feature name>" '{"docPath":"<path>","status":"approved"}'
```
32 changes: 32 additions & 0 deletions .github/prompts/feature-dispatch.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
agent: feature-orchestrator
description: "Dispatch PBIs to GitHub Copilot coding agent for implementation"
---

# Dispatch Phase

Read the dispatcher skill from #file:.github/skills/pbi-dispatcher/SKILL.md

## Your Task

You are in the **Dispatch** phase. PBIs have been created in ADO and you need to dispatch them.

**Step 1**: Read the feature state to get PBI details:
```powershell
node .github/hooks/state-utils.js get-feature "<feature name>"
```

**Step 2**: Follow the **Dispatch Phase** instructions from the orchestrator agent:
1. Run the `agent-dispatcher` subagent to dispatch PBIs to Copilot coding agent
2. Record each dispatched PR in state
3. Use `askQuestion` to gate the next stage

**Pipeline**: ✅ Design → ✅ Plan → ✅ Backlog → 🚀 **Dispatch** → ○ Monitor

After dispatch, update state:
```powershell
node .github/hooks/state-utils.js set-step "<feature name>" monitoring
node .github/hooks/state-utils.js add-agent-pr "<feature name>" '{"repo":"<label>","prNumber":<n>,"prUrl":"<url>","status":"open","title":"<title>"}'
```

**IMPORTANT**: Use single quotes for JSON args in PowerShell.
32 changes: 32 additions & 0 deletions .github/prompts/feature-plan.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
agent: feature-orchestrator
description: "Decompose an approved design into repo-targeted PBIs"
---

# Plan Phase

## Your Task

You are in the **Plan** phase. The design has been approved and you need to break it into PBIs.

**Step 1**: Read the feature state to find the design doc:
```powershell
node .github/hooks/state-utils.js get-feature "<feature name>"
```

**Step 2**: Read the design spec from `design-docs/` (the path is in the feature state).

**Step 3**: Follow the **Planning Phase** instructions from the orchestrator agent:
1. Pass BOTH research findings AND the design spec to the `feature-planner` subagent
2. Present the structured plan with Summary Table + PBI Details
3. Use `askQuestion` to gate the next stage

**Pipeline**: ✅ Design → 📋 **Plan** → ○ Backlog → ○ Dispatch → ○ Monitor

After planning is complete, update state:
```powershell
node .github/hooks/state-utils.js set-step "<feature name>" plan_review
```

**IMPORTANT**: Do NOT create ADO work items in this phase. Only produce the structured plan.
Use single quotes for JSON args in PowerShell.
146 changes: 146 additions & 0 deletions .github/prompts/feature-pr-iterate.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
agent: feature-orchestrator
description: "Review a PR and post feedback for Copilot coding agent to iterate on"
---

# PR Iteration

## Your Task

Help the developer review and iterate on an agent-created pull request.
The user will provide the feature name, repo, and PR number below.

**Step 0**: Load feature context for deeper understanding:
```powershell
node .github/hooks/state-utils.js get-feature "<feature name>"
```
This returns the feature state including:
- **Design spec path** (`artifacts.design.docPath`) — read this file to understand the intended design
- **PBI details** (`artifacts.pbis`) — understand what this PR is supposed to implement
- **Other PRs** (`artifacts.agentPrs`) — related work in the feature

**Read the design spec** from the `docPath` to understand the architectural decisions,
requirements, and intended approach. This context is essential for evaluating whether
the PR correctly implements the design and for proposing informed resolutions to comments.

**Step 1**: Fetch the PR details, diff, and **all review comments**:
```powershell
gh pr view <prNumber> --repo "<full-repo-slug>" --json title,body,state,additions,deletions,changedFiles,url
gh pr diff <prNumber> --repo "<full-repo-slug>" | head -200
```

Then fetch **all review comments and conversation threads**:
```powershell
gh api "/repos/<owner>/<repo>/pulls/<prNumber>/comments" --jq '.[] | {path: .path, line: .line, body: .body, user: .user.login, created_at: .created_at}' 2>&1
gh api "/repos/<owner>/<repo>/issues/<prNumber>/comments" --jq '.[] | {body: .body, user: .user.login, created_at: .created_at}' 2>&1
gh pr view <prNumber> --repo "<full-repo-slug>" --json reviews --jq '.reviews[] | {state: .state, body: .body, author: .author.login}'
```

This gives you:
- **Inline review comments** (file-specific feedback from reviewers)
- **General PR comments** (conversation thread)
- **Review decisions** (approved, changes requested, commented)

Repo slug mapping:
- `common` → `AzureAD/microsoft-authentication-library-common-for-android`
- `msal` → `AzureAD/microsoft-authentication-library-for-android`
- `broker` → `identity-authnz-teams/ad-accounts-for-android`
- `adal` → `AzureAD/azure-activedirectory-library-for-android`

Discover the GitHub username from `.github/developer-local.json`, or `gh auth status`.
Switch account before any gh commands: `gh auth switch --user <username>`

**Step 2**: Ask the developer how they want to handle the review feedback:

```
askQuestion({
question: "How would you like to handle the review feedback on this PR?",
options: [
{ label: "🤖 Delegate to Copilot", description: "Tag @copilot to address all review comments automatically" },
{ label: "📋 Show me the analysis first", description: "Present review feedback with proposed resolutions, then decide", recommended: true },
{ label: "✅ Looks good — approve", description: "Approve the PR as-is" }
]
})
```

### If "Delegate to Copilot":

Compose a single comprehensive `@copilot` comment that summarizes ALL reviewer feedback
and post it on the PR:
```powershell
gh pr comment <prNumber> --repo "<slug>" --body "@copilot Please address the following review feedback:

1. [summary of comment 1 with file/line reference]
2. [summary of comment 2 with file/line reference]
...

Please fix all of the above and push updated commits."
```

Confirm the comment was posted and that the coding agent will pick it up.

### If "Show me the analysis first":

Analyze the PR and present a comprehensive review summary:

**For each reviewer comment:**
1. Show the comment (who said what, on which file/line)
2. **Propose a resolution** — analyze the code and suggest what should change
3. If a code change is needed, show a concrete code snippet or approach
4. If the comment is a question, provide a clear answer based on codebase context

Present as:
```
### Reviewer Feedback & Proposed Resolutions

**Comment 1** — @reviewer on `src/MyFile.java:42`
> "This should handle null case"
**Resolution**: Add a null check before accessing the field. Proposed change:
`if (value != null) { ... }`

**Comment 2** — @reviewer (general)
> "Missing unit tests for the retry logic"
**Resolution**: Add tests for success, failure, and max-retry scenarios in `IpcRetryTest.java`.
```

Also include:
- Overall PR summary (title, +/- lines, changed files)
- Any patterns or systemic issues across the comments
- Your recommendation

Then ask what to do next:
```
askQuestion({
question: "How would you like to proceed?",
options: [
{ label: "🤖 Delegate to Copilot agent", description: "Post @copilot comment with all the feedback to fix remotely" },
{ label: "💻 Implement locally", description: "Checkout the branch and make changes in VS Code" },
{ label: "✏️ I'll write custom feedback", description: "Let me type exactly what to tell the agent" }
]
})
```

**If "Delegate to Copilot agent"**: Post the structured feedback as an `@copilot` comment (same as above).

**If "Implement locally"**: Checkout the PR branch in the correct repo directory:
```powershell
gh pr checkout <prNumber> --repo "<full-repo-slug>"
```
Run this in the correct sub-repo directory (common/, msal/, broker/, adal/).
Then tell the developer: "Branch checked out. Make your changes, commit, and push."

**If "I'll write custom feedback"**: Ask the developer to type their feedback, then post it
as an `@copilot` comment on the PR.

### If "Approve":

```powershell
gh pr review <prNumber> --repo "<slug>" --approve
```

Confirm the approval.

## Final Step

After any action, confirm what was done and suggest:
"Use the feature detail panel's ↻ Refresh button to update PR status."
49 changes: 49 additions & 0 deletions .github/prompts/feature-status.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
agent: feature-orchestrator
description: "Check the status of agent-created pull requests for a feature"
---

# Monitor Phase

## Your Task

You are in the **Monitor** phase. Check the status of agent PRs for the feature.

**Step 1**: Read the feature state to get tracked PRs:
```powershell
node .github/hooks/state-utils.js get-feature "<feature name>"
```
This returns `artifacts.agentPrs` — an array of `{repo, prNumber, prUrl, status, title}`.
**Only check the PRs listed here — do NOT scan all repos.**

**Step 2**: For each tracked PR, fetch live status:
```powershell
gh auth switch --user <discovered_username>
gh pr view <prNumber> --repo "<full-repo-slug>" --json state,title,url,statusCheckRollup,additions,deletions,changedFiles,isDraft
```

Repo slug mapping:
- `common` → `AzureAD/microsoft-authentication-library-common-for-android`
- `msal` → `AzureAD/microsoft-authentication-library-for-android`
- `broker` → `identity-authnz-teams/ad-accounts-for-android`
- `adal` → `AzureAD/azure-activedirectory-library-for-android`

Discover the GitHub username from `.github/developer-local.json`, or `gh auth status`, or prompt.

**Step 3**: Present results in a table:

```
## 🚀 Feature Orchestration: Monitor

**Pipeline**: ✅ Design → ✅ Plan → ✅ Backlog → ✅ Dispatch → 📡 **Monitor**

| PR | Repo | Title | Status | Checks | +/- |
|---|---|---|---|---|---|
```

**Step 4**: Update state with latest statuses:
```powershell
node .github/hooks/state-utils.js add-agent-pr "<feature name>" '{"repo":"...","prNumber":<n>,"prUrl":"...","status":"<open|merged|closed>","title":"..."}'
```

End with: "Use `@copilot` in PR comments to iterate with the coding agent."
Loading
Loading