Skip to content

Commit 720326a

Browse files
committed
Fix workflow and command documentation issues
- Fix review process to include uncommitted changes alongside committed changes - Add fallback mechanism for base branch detection when origin/HEAD is not set - Standardize timestamp format to YYYYMMDDTHHMM across all commands - Add stash/restore protection to fix-pr workflow before git operations - Add explicit cancel check after final await in async polling example - Make stash/restore conditional on having uncommitted changes in codeit - Add directory verification before destructive rm commands in debug-edge
1 parent ad6523b commit 720326a

6 files changed

Lines changed: 33 additions & 11 deletions

File tree

.cursor/agents/review-async.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const pollForStatus = async (cancel: { cancelled: boolean }) => {
8989
if (cancel.cancelled) return
9090
if (status === 'complete') return status
9191
await sleep(2000)
92+
if (cancel.cancelled) return
9293
}
9394
}
9495
```

.cursor/commands/codeit.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ Execute a planning document and iteratively refine the implementation until it p
1212

1313
### Phase 1: Preparation
1414

15-
1. Stash any uncommitted changes (preserve the working directory)
15+
1. Check for uncommitted changes and stash if present:
16+
- Run `git diff --quiet && git diff --cached --quiet` to check for changes
17+
- If there are changes (command returns non-zero), run `git stash push -m "codeit: preserving work"` and track that a stash was created
18+
- If working directory is clean, skip stashing and note that no restore is needed
1619
2. Identify the target repository from the planning document
1720
3. Change to the repository directory
1821

@@ -69,7 +72,7 @@ Iterate until the code passes review (maximum 5 iterations):
6972

7073
1. Report success to the user
7174
2. Summarize the implementation and any fixes made
72-
3. Restore any stashed changes
75+
3. Restore stashed changes only if a stash was created in Phase 1 (run `git stash pop`)
7376

7477
## Constraints
7578

.cursor/commands/scrapebugs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ mkdir -p .cursor/tmp
216216
```
217217
218218
Then write the report to:
219-
`.cursor/tmp/MMDDhhmm_bug-analysis-<repo>.md`
219+
`.cursor/tmp/YYYYMMDDTHHMM_bug-analysis-<repo>.md`
220220
221-
Example: `.cursor/tmp/01280406_bug-analysis-edge-react-gui.md`
221+
Example: `.cursor/tmp/20260128T0406_bug-analysis-edge-react-gui.md`
222222
223223
---
224224

.cursor/skills/debug-edge/SKILL.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ yarn prepare
3737

3838
## Step 2: Clean iOS Build Artifacts
3939

40-
Remove cached iOS build files:
40+
First verify you are in the correct directory, then remove cached iOS build files:
4141

4242
```bash
43+
# Verify working directory before destructive operations
44+
if [[ "$(basename "$(pwd)")" != "edge-react-gui" ]]; then
45+
echo "Error: Must be in edge-react-gui directory, currently in $(pwd)"
46+
exit 1
47+
fi
4348
rm -rf ios/Pods && rm -rf ios/build
4449
```
4550

.cursor/skills/fix-pr/SKILL.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Skip comments where:
4141

4242
### Plan Document Format
4343

44-
Name the document: `MMDDhhmm_[repository-name]_[branch-name]_pr-[pr-number]_fixplan.md`
44+
Name the document: `YYYYMMDDTHHMM_[repository-name]_[branch-name]_pr-[pr-number]_fixplan.md`
4545

4646
Structure the plan as:
4747

@@ -87,7 +87,14 @@ Do not proceed until the user explicitly confirms the plan.
8787

8888
## Implementing Fixes
8989

90-
Once the user approves the plan, process each fix item:
90+
Once the user approves the plan:
91+
92+
1. **Stash uncommitted changes** to preserve the working directory:
93+
- Check if there are uncommitted changes: `git diff --quiet && git diff --cached --quiet`
94+
- If there are changes (command returns non-zero), run `git stash push -m "fixpr: preserving work"` and note that a stash was created
95+
- If working directory is clean, skip stashing
96+
97+
2. Process each fix item:
9198

9299
For each fix in the plan:
93100

@@ -113,7 +120,8 @@ After all fixes are implemented:
113120
```bash
114121
git push --force-with-lease origin <branch-name>
115122
```
116-
3. Optionally, reply to resolved review comments on GitHub using the MCP server
123+
3. **Restore stashed changes** if a stash was created earlier: `git stash pop`
124+
4. Optionally, reply to resolved review comments on GitHub using the MCP server
117125

118126
## Important Warnings
119127

.cursor/skills/review-code/SKILL.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ If a branch name is provided (not a PR):
4444
```bash
4545
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
4646
```
47+
If this command fails (common in forked repos or non-standard configs), use fallback detection:
48+
- Try `git remote show origin | grep 'HEAD branch' | sed 's/.*: //'`
49+
- If that fails, check if `origin/master` exists: `git rev-parse --verify origin/master`
50+
- If not, check if `origin/main` exists: `git rev-parse --verify origin/main`
51+
- Use whichever branch exists, defaulting to `master` if neither can be verified
4752
5. If the branch has uncommitted or unstaged changes (no commits beyond the base), use `git diff` for unstaged changes and `git diff --cached` for staged changes instead of `git diff <base>...HEAD`. No git checkout operations are needed in this case.
4853
6. Skip the GitHub MCP sections and proceed directly to **Review Process**
4954

@@ -133,7 +138,7 @@ If branch checkout fails (e.g., fork was deleted, network issues), use the attac
133138
## Review Process
134139

135140
1. Get the complete diff:
136-
- **For local branches**: `git diff <base-branch>...HEAD` (e.g., `git diff master...HEAD`)
141+
- **For local branches**: First check for uncommitted changes with `git diff` (unstaged) and `git diff --cached` (staged). If uncommitted changes exist, include them alongside `git diff <base-branch>...HEAD` so the review covers both committed and uncommitted work. If the branch has no commits beyond the base (HEAD equals base), use only `git diff` and `git diff --cached`.
137142
- **For PRs with local checkout**: `git diff <base>...HEAD`
138143
- **For PRs without checkout**: Read the attached diff from `/pull-requests/pr-<number>/all.diff`
139144

@@ -176,8 +181,8 @@ cursor --reuse-window <review-document-path>
176181
```
177182

178183
Name the document:
179-
- **For PRs**: `MMDDhhmm_[repository-name]_[branch-name]_pr-[pr-number].md`
180-
- **For local branches**: `MMDDhhmm_[repository-name]_[branch-name]_review.md`
184+
- **For PRs**: `YYYYMMDDTHHMM_[repository-name]_[branch-name]_pr-[pr-number].md`
185+
- **For local branches**: `YYYYMMDDTHHMM_[repository-name]_[branch-name]_review.md`
181186

182187
Pause for the user to review.
183188

0 commit comments

Comments
 (0)