Skip to content

Commit e3fbca5

Browse files
committed
docs: update Dependabot handling instructions and add prompt
Enhanced the instructions for handling Dependabot pull requests, emphasizing mandatory reading and execution of steps. Updated the comment posting process to require the use of GitHub CLI commands. Added a new prompt for guiding users through the Dependabot PR handling workflow, ensuring clarity and adherence to the updated rules. Removed outdated prompts related to planning and specification generation. Signed-off-by: Odin Thomas Rochmann <[email protected]>
1 parent 55bce15 commit e3fbca5

File tree

7 files changed

+133
-134
lines changed

7 files changed

+133
-134
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Fusion Framework uses file-based AI instructions under `.github/instructions/`.
4646
- **React**`./.github/instructions/react.instructions.md`
4747
Component, hook, provider, observable, and styling patterns for React.
4848
- **Dependabot PRs**`./.github/instructions/dependabot-pr.instructions.md`
49-
Full Dependabot review workflow (research, tests, comments, merge).
49+
**⚠️ MANDATORY**: When handling ANY Dependabot PR, you MUST read this entire instruction file first. It contains mandatory steps including posting comments using `gh pr comment -F <file>.md`. Do not skip steps.
5050

5151
Each instruction file declares an `applyTo` glob so tools like Copilot/Cursor can automatically apply the right rules for the files you are editing.
5252

.github/instructions/dependabot-pr.instructions.md

Lines changed: 59 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
---
22
description: Rules for reviewing and handling Dependabot pull requests
33
name: Dependabot PR Review Rules
4+
applyTo:
5+
- "**/dependabot.yml"
6+
- ".github/workflows/dependabot.yml"
7+
- ".github/dependabot.yml"
8+
alwaysApply: true
49
---
510

611
# Dependabot PR Review Rules
712

13+
**⚠️ CRITICAL: AI AGENTS MUST READ THIS ENTIRE FILE WHEN HANDLING DEPENDABOT PRs**
14+
15+
This instruction file contains **mandatory steps** that MUST be executed in order. Do not skip steps. Do not proceed without reading the full workflow below.
16+
817
## TL;DR (for AI agents)
918

19+
- **MANDATORY READING**: You MUST read this entire instruction file before handling any Dependabot PR. This is not optional.
1020
- **Consent**: Never post comments, generate changesets, push commits, close PRs, or merge without explicit user approval.
1121
- **Flow**: Rebase (if needed) → research dependency changes → install with `pnpm` → build → test → lint → (optionally) generate changeset → push → summarize → (optionally) merge.
1222
- **Safety**: Stop immediately on build/test/lint/security failures or user timeout; do not auto-resolve complex conflicts.
13-
- **Comments**: Use the provided research/results templates and always show content to the user for approval before posting.
23+
- **Comments**: Use the provided research/results templates, create temporary markdown files, show content to the user for approval, then execute `gh pr comment <PR_NUMBER> -F <comment-file>.md` to post. Always clean up temporary files.
1424
- **History**: Maintain linear history (force-with-lease after rebase) and clean up worktrees when done.
1525

1626
## Overview
@@ -76,8 +86,10 @@ Execute rebase analysis against base branch (default: `main`).
7686
- Continue to Step 4
7787

7888
**B: Version Conflict (Auto-Close)**
79-
- Post redundancy explanation comment
80-
- Close PR with explanation
89+
- Create temporary comment file: `gh-comment-version-conflict.md` with redundancy explanation
90+
- **EXECUTE**: `gh pr comment <PR_NUMBER> -F gh-comment-version-conflict.md`
91+
- Clean up: `rm gh-comment-version-conflict.md`
92+
- Close PR: `gh pr close <PR_NUMBER> --comment "PR closed due to version conflict"`
8193
- Proceed to cleanup
8294

8395
**C: Structural Conflict (User Consent Required)**
@@ -102,14 +114,22 @@ Execute rebase analysis against base branch (default: `main`).
102114

103115
### 5. Post Research Comment
104116

117+
**MANDATORY STEP - DO NOT SKIP**
118+
105119
1. Format research findings using [research comment template](dependabot-pr/research-comment.template.md)
106-
2. Display comment content to user
107-
3. Ask user: "Review research comment content. Is it accurate and complete?"
108-
4. Wait for user response
109-
5. Ask user: "Post this research comment to PR?"
110-
6. Wait for user response
111-
7. If approved: Post comment to PR
112-
8. If declined: Skip and continue
120+
2. Create temporary comment file: `gh-comment-research.md` with the formatted content
121+
3. Display comment content to user (show the file contents)
122+
4. Ask user: "Review research comment content. Is it accurate and complete?"
123+
5. Wait for user response
124+
6. Ask user: "Post this research comment to PR?"
125+
7. Wait for user response
126+
8. **If approved**:
127+
- **EXECUTE**: `gh pr comment <PR_NUMBER> -F gh-comment-research.md`
128+
- Verify the comment was posted successfully
129+
- Clean up: `rm gh-comment-research.md`
130+
9. **If declined**: Skip and continue (clean up: `rm gh-comment-research.md`)
131+
132+
**CRITICAL**: You MUST execute the `gh pr comment` command when approved. Do not just say you will post it - actually run the command.
113133

114134
**MANDATORY**: Proceed to Step 6 (Install Dependencies) - NEVER SKIP THIS STEP
115135

@@ -169,15 +189,23 @@ Execute rebase analysis against base branch (default: `main`).
169189

170190
### 12. Comment PR Results
171191

192+
**MANDATORY STEP - DO NOT SKIP**
193+
172194
1. Format completion summary using [results comment template](dependabot-pr/results-comment.template.md)
173-
2. Display comment content to user
174-
3. Ask user: "Review validation results. Are they accurate?"
175-
4. Wait for user response (5 min timeout)
176-
5. Ask user: "Post this validation comment to PR?"
177-
6. Wait for user response (5 min timeout)
178-
7. If approved: Post comment to PR
179-
8. If declined: Skip and continue
180-
9. If timeout: **STOP EXECUTION** - User consent required
195+
2. Create temporary comment file: `gh-comment-results.md` with the formatted content
196+
3. Display comment content to user (show the file contents)
197+
4. Ask user: "Review validation results. Are they accurate?"
198+
5. Wait for user response (5 min timeout)
199+
6. Ask user: "Post this validation comment to PR?"
200+
7. Wait for user response (5 min timeout)
201+
8. **If approved**:
202+
- **EXECUTE**: `gh pr comment <PR_NUMBER> -F gh-comment-results.md`
203+
- Verify the comment was posted successfully
204+
- Clean up: `rm gh-comment-results.md`
205+
9. **If declined**: Skip and continue (clean up: `rm gh-comment-results.md`)
206+
10. **If timeout**: **STOP EXECUTION** - User consent required (clean up: `rm gh-comment-results.md`)
207+
208+
**CRITICAL**: You MUST execute the `gh pr comment` command when approved. Do not just say you will post it - actually run the command.
181209

182210
### 13. Squash Merge PR
183211

@@ -230,16 +258,21 @@ All PR comments must use the provided templates:
230258

231259
## AI Agent Rules
232260

261+
**⚠️ MANDATORY: Read this entire section before handling Dependabot PRs**
262+
233263
When handling Dependabot PRs:
234264

235-
1. **Always get user consent** before posting comments or merging
236-
2. **Follow all steps sequentially** - never skip steps
237-
3. **Use provided templates** for all PR comments
238-
4. **Validate thoroughly** - build, test, lint before approval
239-
5. **Generate changesets** when required (follow [changeset rules](changesets.instructions.md))
240-
6. **Maintain linear history** - use force-with-lease after rebase
241-
7. **Clean up properly** - remove worktrees and temp directories
242-
8. **Stop execution** on any critical failure or user timeout
265+
1. **READ THIS FILE FIRST** - You must read and understand all steps before starting
266+
2. **Always get user consent** before posting comments or merging
267+
3. **Follow all steps sequentially** - never skip steps, especially Steps 5 and 12 (comment posting)
268+
4. **Use provided templates** for all PR comments
269+
5. **POST COMMENTS USING GITHUB CLI**: When approved, you MUST execute `gh pr comment <PR_NUMBER> -F <comment-file>.md`. Do not just say you will post - actually run the command. See [GitHub CLI file-based bodies rule](../.cursor/rules/github-cli-file-bodies.mdc)
270+
6. **Clean up comment files**: Always remove temporary comment files (`gh-comment-*.md`) after posting or if declined
271+
7. **Validate thoroughly** - build, test, lint before approval
272+
8. **Generate changesets** when required (follow [changeset rules](changesets.instructions.md))
273+
9. **Maintain linear history** - use force-with-lease after rebase
274+
10. **Clean up properly** - remove worktrees and temp directories
275+
11. **Stop execution** on any critical failure or user timeout
243276

244277
## Error Handling
245278

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
description: Prompt for handling Dependabot pull requests
3+
name: Dependabot PR Handler Prompt
4+
---
5+
6+
# Dependabot PR Handler Prompt
7+
8+
You are handling a Dependabot pull request. Follow the instructions in `.github/instructions/dependabot-pr.instructions.md` **completely and in order**.
9+
10+
## Initial Step: Identify the PR
11+
12+
### If PR URL is provided:
13+
- Extract PR details: repository owner, repository name, PR number, and branch name
14+
- Store these details for use throughout the workflow
15+
- Proceed to Step 2: Create Git Worktree for PR
16+
17+
### If NO PR URL is provided:
18+
You MUST do the following:
19+
20+
1. **List Dependabot PRs** (always do this first):
21+
- Execute: `gh pr list --author "app/dependabot" --state open --json number,title`
22+
- Display the list of open Dependabot PRs to the user in a formatted way:
23+
```
24+
Open Dependabot PRs:
25+
26+
#<number> - <title>
27+
28+
[Repeat for each PR]
29+
```
30+
- Categorize PRs by update type (MAJOR/MINOR/PATCH) if possible from the title or labels
31+
- Group by update type if multiple PRs exist
32+
33+
2. **Ask user to select PR**:
34+
- Prompt: "Please provide the Dependabot PR number (e.g., 1234) or PR URL from the list above"
35+
- Wait for user response
36+
- Parse the response to extract PR number or URL
37+
- If PR number provided: Use `gh pr view <PR_NUMBER>` to get full PR details
38+
- Store PR details (repository owner, name, PR number, branch name)
39+
- Proceed to Step 2: Create Git Worktree for PR
40+
41+
**CRITICAL**: Never auto-select a PR. The user MUST explicitly choose which PR to handle.
42+
43+
## After PR Selection
44+
45+
Once the PR is identified (either from URL, ID, or user selection from list), continue with the full workflow from `.github/instructions/dependabot-pr.instructions.md`:
46+
47+
1. ✅ Select PR (completed above)
48+
2. Create Git Worktree for PR
49+
3. Rebase Branch
50+
4. Research Dependencies
51+
5. Post Research Comment (MANDATORY - use `gh pr comment <PR_NUMBER> -F <file>.md`)
52+
6. Install Dependencies
53+
7. Build Project
54+
8. Run Tests
55+
9. Run Linting
56+
10. Generate Changeset
57+
11. Push Changes
58+
12. Comment PR Results (MANDATORY - use `gh pr comment <PR_NUMBER> -F <file>.md`)
59+
13. Squash Merge PR (optional, requires user approval)
60+
14. Cleanup Repository
61+
15. Finalize Instruction
62+
63+
## Important Reminders
64+
65+
- **Read the full instruction file**: `.github/instructions/dependabot-pr.instructions.md` before starting
66+
- **Never skip steps**: Especially Steps 5 and 12 (comment posting)
67+
- **Execute commands**: When posting comments, you MUST run `gh pr comment <PR_NUMBER> -F <comment-file>.md`, not just say you will
68+
- **Get user consent**: For all critical operations (comments, pushes, merges)
69+
- **Clean up**: Always remove temporary files and worktrees when done
70+

.github/prompts/plan.prompt.md

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/prompts/specify.prompt.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/prompts/tasks.prompt.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

AGENT.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ When you receive a task, default to this behavior:
8787
- Large-scale refactors across many packages.
8888
- Auto-merging PRs, especially Dependabot PRs.
8989
- **Dependabot-specific rules**:
90-
- Always follow `.github/instructions/dependabot-pr.instructions.md`.
90+
- **⚠️ MANDATORY**: When handling ANY Dependabot PR, you MUST read `.github/instructions/dependabot-pr.instructions.md` in its entirety before starting.
91+
- The instruction file contains mandatory workflow steps that MUST be executed in order.
92+
- When posting comments, you MUST execute `gh pr comment <PR_NUMBER> -F <comment-file>.md` - do not just say you will post it.
9193
- Do not post PR comments, push commits, or merge without user confirmation.
9294

9395
When unsure, **stop and ask the user** instead of guessing.

0 commit comments

Comments
 (0)