Skip to content

Commit 9411e8c

Browse files
committed
Fix --base flag, duplicate docs, and silent base branch failures
- Apply --base flag override after baseBranch is determined from PR metadata or git symbolic-ref - Consolidate duplicate Skills and Cursor Skills doc sections into single Skills section - Verify base branch exists before diffing; try origin/branch fallback and exit with clear error if not found
1 parent 2990a3d commit 9411e8c

File tree

2 files changed

+48
-62
lines changed

2 files changed

+48
-62
lines changed

.cursor/skills/review-code/scripts/review-prep.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ if (prNumber) {
193193
) || 'master'
194194
}
195195

196+
// Apply --base override if provided
197+
if (flags.base) {
198+
baseBranch = flags.base
199+
}
200+
196201
// ---------------------------------------------------------------------------
197202
// Diff generation
198203
// ---------------------------------------------------------------------------
@@ -202,6 +207,29 @@ log('Generating diff...')
202207
let diff
203208
let changedFiles
204209

210+
// Verify base branch exists before attempting to diff against it
211+
let baseBranchExists = run(`git rev-parse --verify ${baseBranch}`, {
212+
cwd: repoDir,
213+
allowFailure: true
214+
})
215+
216+
if (isLocalBranch && !baseBranchExists) {
217+
log(`Warning: Base branch '${baseBranch}' not found. Trying 'origin/${baseBranch}'...`)
218+
const originBase = `origin/${baseBranch}`
219+
const originExists = run(`git rev-parse --verify ${originBase}`, {
220+
cwd: repoDir,
221+
allowFailure: true
222+
})
223+
if (originExists) {
224+
baseBranch = originBase
225+
baseBranchExists = originExists
226+
} else {
227+
log(`Error: Base branch '${baseBranch}' does not exist locally or on origin.`)
228+
log('Please specify a valid base branch with --base <branch>')
229+
process.exit(1)
230+
}
231+
}
232+
205233
const hasCommits = run(`git log --oneline ${baseBranch}..HEAD`, {
206234
cwd: repoDir,
207235
allowFailure: true

docs/agent-setup.md

Lines changed: 20 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,19 @@ Execute a planning document and iteratively refine the implementation until it p
3030

3131
## Skills
3232

33-
Skills are defined in `.cursor/skills/` and are automatically invoked by Cursor when relevant. They can also be referenced from commands via `@.cursor/skills/<name>/SKILL.md`.
33+
Skills are defined in `.cursor/skills/` and provide reusable workflows that commands and other skills can invoke. They are automatically invoked by Cursor when relevant and can also be referenced from commands via `@.cursor/skills/<name>/SKILL.md`.
3434

3535
### debug-edge
3636

3737
Compile, launch, and debug the Edge wallet app on an iOS simulator.
3838

3939
**Prerequisites**: Xcode, working directory `edge-react-gui`, MCP servers `xcodebuild` and `mobile-mcp`
4040

41-
**Workflow**: Install deps → Clean iOS → Prepare iOS → Start Metro → Build and launch → Login if needed
41+
**Workflow**: Install deps → Clean iOS build artifacts → Prepare iOS → Clean Xcode build → Start Metro bundler → Build and launch app → Log into test account if needed
4242

43-
**Tip**: For plugin repo debugging (edge-core-js, edge-currency-accountbased, edge-exchange-plugins, edge-currency-plugins), use `log.warn()` instead of `console.log` to see output in Metro logs.
43+
**Tip**: For plugin repo debugging (edge-core-js, edge-currency-accountbased, edge-exchange-plugins, edge-currency-plugins), use `log.warn()` instead of `console.log` to see output in Metro logs. Enable the corresponding `DEBUG_*` flag in `env.json` and run `yarn start` in the plugin repo for hot-reload.
44+
45+
---
4446

4547
### fix-code
4648

@@ -52,46 +54,6 @@ Implement fixes from a plan document by editing code.
5254

5355
**Constraints**: Does not commit or push. Leaves changes unstaged for user review.
5456

55-
### fix-pr
56-
57-
Address reviewer comments on a GitHub pull request.
58-
59-
**Usage**: Provide a GitHub PR URL or number.
60-
61-
**Workflow**: Collect reviewer comments → Create fix plan → Pause for user iteration → Implement fixes with fixup commits → Push with `--force-with-lease`
62-
63-
**Constraints**: Does not auto-squash. Leaves fixup commits visible for reviewer.
64-
65-
### package-deps
66-
67-
Package local dependency repos and link them to edge-react-gui for testing.
68-
69-
**Usage**: Specify dependency repos to package.
70-
71-
**Workflow**: `npm pack` → Rename with UTC timestamp → Copy to edge-react-gui → Update `package.json` reference
72-
73-
### review-code
74-
75-
Review code changes for quality and convention compliance.
76-
77-
**Usage**: Provide a GitHub PR URL, PR number, local branch name, or "current branch".
78-
79-
**Workflow**: Checkout code → Get diff → Launch review subagents (`review-react`, `review-errors`, `review-state`, etc.) → Compile findings → Save to `/tmp` → For PRs: submit inline comments via GitHub MCP
80-
81-
---
82-
83-
## Cursor Skills
84-
85-
Skills are defined in `.cursor/skills/` and provide reusable workflows that commands and other skills can invoke. They are also surfaced to the agent automatically and can be triggered directly.
86-
87-
### review-code
88-
89-
Review code changes for quality and convention compliance. Supports both GitHub pull requests and local branches.
90-
91-
**Usage**: Provide a GitHub PR URL, PR number, local branch name, or "current branch".
92-
93-
**Workflow**: Checkout code → Detect fork vs internal branch → Get diff → Launch review subagents in parallel (`review-react`, `review-errors`, `review-state`, `review-async`, `review-cleaners`, `review-code-quality`, `review-comments`, `review-strings`, `review-tests`, `review-pr`, `review-servers`, `review-repo`) → Compile findings into Critical Issues / Warnings / Suggestions → Save review to `/tmp` → For PRs: submit inline comments via GitHub
94-
9557
---
9658

9759
### fix-pr
@@ -106,41 +68,37 @@ Address reviewer comments on a GitHub pull request.
10668

10769
---
10870

109-
### fix-code
71+
### gh-review
11072

111-
Implement fixes from a plan document by editing code.
73+
Orchestrate an interactive GitHub PR review session using the `gh` CLI.
11274

113-
**Usage**: Provide a plan document path (typically generated by `fix-pr` or `review-code`).
75+
**Prerequisites**: `gh` CLI installed and authenticated
11476

115-
**Workflow**: Parse plan → Edit files → Run `yarn precommit` → Present summary
77+
**Usage**: Provide a PR reference (URL, number, or "current PR") and comment instructions.
11678

117-
**Constraints**: Does not commit or push. Leaves changes unstaged for user review.
79+
**Workflow**: Start or resume a pending review → Add inline comments interactively (single-line or multi-line) via GraphQL API → Present summary of all comments → Submit only after explicit user confirmation as APPROVE, COMMENT, or REQUEST_CHANGES
11880

119-
---
81+
**Key detail**: Uses GraphQL `addPullRequestReviewThread` for incremental comments because the REST API returns 422 when a pending review already exists.
12082

121-
### debug-edge
83+
---
12284

123-
Compile, launch, and debug the Edge wallet app on an iOS simulator.
85+
### package-deps
12486

125-
**Prerequisites**: Xcode, working directory `edge-react-gui`, MCP servers `xcodebuild` and `mobile-mcp`
87+
Package local dependency repos and link them to edge-react-gui for testing.
12688

127-
**Workflow**: Install deps → Clean iOS build artifacts → Prepare iOS → Clean Xcode build → Start Metro bundler → Build and launch app → Log into test account if needed
89+
**Usage**: Specify dependency repos to package.
12890

129-
**Tip**: For plugin repo debugging (edge-core-js, edge-currency-accountbased, edge-exchange-plugins, edge-currency-plugins), use `log.warn()` instead of `console.log` to see output in Metro logs. Enable the corresponding `DEBUG_*` flag in `env.json` and run `yarn start` in the plugin repo for hot-reload.
91+
**Workflow**: `npm pack` → Rename with UTC timestamp → Copy to edge-react-gui → Update `package.json` reference
13092

13193
---
13294

133-
### gh-review
134-
135-
Orchestrate an interactive GitHub PR review session using the `gh` CLI.
136-
137-
**Prerequisites**: `gh` CLI installed and authenticated
95+
### review-code
13896

139-
**Usage**: Provide a PR reference (URL, number, or "current PR") and comment instructions.
97+
Review code changes for quality and convention compliance. Supports both GitHub pull requests and local branches.
14098

141-
**Workflow**: Start or resume a pending review → Add inline comments interactively (single-line or multi-line) via GraphQL API → Present summary of all comments → Submit only after explicit user confirmation as APPROVE, COMMENT, or REQUEST_CHANGES
99+
**Usage**: Provide a GitHub PR URL, PR number, local branch name, or "current branch".
142100

143-
**Key detail**: Uses GraphQL `addPullRequestReviewThread` for incremental comments because the REST API returns 422 when a pending review already exists.
101+
**Workflow**: Checkout code → Detect fork vs internal branch → Get diff → Launch review subagents in parallel (`review-react`, `review-errors`, `review-state`, `review-async`, `review-cleaners`, `review-code-quality`, `review-comments`, `review-strings`, `review-tests`, `review-pr`, `review-servers`, `review-repo`) → Compile findings into Critical Issues / Warnings / Suggestions → Save review to `/tmp` → For PRs: submit inline comments via GitHub
144102

145103
---
146104

0 commit comments

Comments
 (0)