@in-the-loop-labs/pair-review 3.0.5 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pair-review",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "pair-review app integration — Open PRs and local changes in the pair-review web UI, run server-side AI analysis, and address review feedback. Requires the pair-review MCP server.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "in-the-loop-labs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-critic",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "AI-powered code review analysis — Run three-level AI analysis and implement-review-fix loops directly in your coding agent. Works standalone, no server required.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "in-the-loop-labs",
|
package/src/git/base-branch.js
CHANGED
|
@@ -171,46 +171,43 @@ function tryDefaultBranch(repoPath, currentBranch, deps) {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
|
-
* Synchronously detect the default branch for a repository
|
|
174
|
+
* Synchronously detect the default branch for a repository using only
|
|
175
|
+
* local refs (no network I/O).
|
|
175
176
|
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
177
|
+
* Priority:
|
|
178
|
+
* 1. `git symbolic-ref refs/remotes/origin/HEAD` — reads the local ref
|
|
179
|
+
* that `git clone` sets automatically.
|
|
180
|
+
* 2. Check whether `refs/heads/main` or `refs/heads/master` exist locally.
|
|
179
181
|
*
|
|
180
|
-
* @param {string}
|
|
182
|
+
* @param {string} localPath - Absolute path to the repository
|
|
181
183
|
* @param {Object} [_deps] - Dependency overrides for testing
|
|
182
184
|
* @returns {string|null} Default branch name, or null if it cannot be determined
|
|
183
185
|
*/
|
|
184
|
-
function getDefaultBranch(
|
|
186
|
+
function getDefaultBranch(localPath, _deps) {
|
|
187
|
+
if (!localPath) return null;
|
|
185
188
|
const deps = { ...defaults, ..._deps };
|
|
186
189
|
|
|
187
|
-
// Try
|
|
190
|
+
// Try symbolic-ref (set by git clone)
|
|
188
191
|
try {
|
|
189
|
-
const
|
|
190
|
-
cwd:
|
|
192
|
+
const ref = deps.execSync('git symbolic-ref refs/remotes/origin/HEAD', {
|
|
193
|
+
cwd: localPath,
|
|
191
194
|
encoding: 'utf8',
|
|
192
195
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (match) {
|
|
198
|
-
const branch = match[1].trim();
|
|
199
|
-
if (branch && branch !== '(unknown)') {
|
|
200
|
-
return branch;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
196
|
+
}).trim();
|
|
197
|
+
// ref looks like "refs/remotes/origin/main"
|
|
198
|
+
const branch = ref.replace(/^refs\/remotes\/origin\//, '');
|
|
199
|
+
if (branch && branch !== ref) return branch;
|
|
203
200
|
} catch {
|
|
204
|
-
//
|
|
201
|
+
// origin/HEAD not set — fall through to local check
|
|
205
202
|
}
|
|
206
203
|
|
|
207
204
|
// Fallback: check if main or master exists locally
|
|
208
205
|
for (const candidate of ['main', 'master']) {
|
|
209
206
|
try {
|
|
210
|
-
deps.execSync(`git rev-parse --verify
|
|
211
|
-
cwd:
|
|
207
|
+
deps.execSync(`git rev-parse --verify refs/heads/${candidate}`, {
|
|
208
|
+
cwd: localPath,
|
|
212
209
|
encoding: 'utf8',
|
|
213
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
210
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
214
211
|
});
|
|
215
212
|
return candidate;
|
|
216
213
|
} catch {
|
package/src/routes/local.js
CHANGED
|
@@ -31,6 +31,9 @@ const { getGeneratedFilePatterns } = require('../git/gitattributes');
|
|
|
31
31
|
const { getShaAbbrevLength } = require('../git/sha-abbrev');
|
|
32
32
|
const { validateCouncilConfig, normalizeCouncilConfig } = require('./councils');
|
|
33
33
|
const { TIERS, TIER_ALIASES, VALID_TIERS, resolveTier } = require('../ai/prompts/config');
|
|
34
|
+
const { getProviderClass, createProvider } = require('../ai/provider');
|
|
35
|
+
const { getDefaultBranch } = require('../git/base-branch');
|
|
36
|
+
const { CommentRepository } = require('../database');
|
|
34
37
|
const {
|
|
35
38
|
activeAnalyses,
|
|
36
39
|
localReviewDiffs,
|
|
@@ -79,9 +82,8 @@ function isBranchAvailable(branchName, scopeStart, localPath) {
|
|
|
79
82
|
if (includesBranch(scopeStart)) return true;
|
|
80
83
|
if (!branchName || branchName === 'HEAD' || branchName === 'unknown') return false;
|
|
81
84
|
|
|
82
|
-
|
|
83
|
-
const defaultBranch =
|
|
84
|
-
// If detection fails, fall back to checking main/master
|
|
85
|
+
// Detect the default branch using only local refs (no network).
|
|
86
|
+
const defaultBranch = getDefaultBranch(localPath);
|
|
85
87
|
if (defaultBranch) {
|
|
86
88
|
return branchName !== defaultBranch;
|
|
87
89
|
}
|
|
@@ -561,19 +563,14 @@ router.get('/api/local/:reviewId', async (req, res) => {
|
|
|
561
563
|
const baseBranch = review.local_base_branch || null;
|
|
562
564
|
|
|
563
565
|
// When scope does NOT include branch, check for branch detection info
|
|
564
|
-
// Frontend uses this to suggest expanding scope to include branch
|
|
566
|
+
// Frontend uses this to suggest expanding scope to include branch.
|
|
567
|
+
// Only use already-cached results here — never block the response on
|
|
568
|
+
// GitHub API calls. Background detection (after res.json) will populate
|
|
569
|
+
// the cache for subsequent requests.
|
|
565
570
|
let branchInfo = null;
|
|
566
571
|
const cachedDiff = getLocalReviewDiff(reviewId);
|
|
567
572
|
if (!includesBranch(scopeStart) && cachedDiff?.branchInfo) {
|
|
568
573
|
branchInfo = cachedDiff.branchInfo;
|
|
569
|
-
} else if (!includesBranch(scopeStart) && !cachedDiff && review.local_path) {
|
|
570
|
-
// No cache (web UI started session) — run detection on-demand
|
|
571
|
-
const config = req.app.get('config') || {};
|
|
572
|
-
branchInfo = await detectAndBuildBranchInfo(review.local_path, branchName, {
|
|
573
|
-
repository: repositoryName,
|
|
574
|
-
githubToken: getGitHubToken(config),
|
|
575
|
-
enableGraphite: config.enable_graphite === true
|
|
576
|
-
});
|
|
577
574
|
}
|
|
578
575
|
|
|
579
576
|
// Check repo settings for auto_branch_review preference
|