@in-the-loop-labs/pair-review 2.0.3 → 2.1.1
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 +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
- package/plugin-code-critic/skills/analyze/references/level1-balanced.md +9 -0
- package/plugin-code-critic/skills/analyze/references/level1-fast.md +9 -0
- package/plugin-code-critic/skills/analyze/references/level1-thorough.md +9 -0
- package/plugin-code-critic/skills/analyze/references/level2-balanced.md +9 -0
- package/plugin-code-critic/skills/analyze/references/level2-fast.md +9 -0
- package/plugin-code-critic/skills/analyze/references/level2-thorough.md +9 -0
- package/plugin-code-critic/skills/analyze/references/level3-balanced.md +9 -0
- package/plugin-code-critic/skills/analyze/references/level3-fast.md +9 -0
- package/plugin-code-critic/skills/analyze/references/level3-thorough.md +9 -0
- package/plugin-code-critic/skills/analyze/references/orchestration-balanced.md +9 -0
- package/plugin-code-critic/skills/analyze/references/orchestration-fast.md +9 -0
- package/plugin-code-critic/skills/analyze/references/orchestration-thorough.md +9 -0
- package/public/js/components/ChatPanel.js +1 -1
- package/src/ai/analyzer.js +5 -1
- package/src/ai/prompts/baseline/consolidation/balanced.js +9 -0
- package/src/ai/prompts/baseline/consolidation/fast.js +9 -0
- package/src/ai/prompts/baseline/consolidation/thorough.js +9 -0
- package/src/ai/prompts/baseline/level1/balanced.js +9 -0
- package/src/ai/prompts/baseline/level1/fast.js +9 -0
- package/src/ai/prompts/baseline/level1/thorough.js +9 -0
- package/src/ai/prompts/baseline/level2/balanced.js +9 -0
- package/src/ai/prompts/baseline/level2/fast.js +9 -0
- package/src/ai/prompts/baseline/level2/thorough.js +9 -0
- package/src/ai/prompts/baseline/level3/balanced.js +9 -0
- package/src/ai/prompts/baseline/level3/fast.js +9 -0
- package/src/ai/prompts/baseline/level3/thorough.js +9 -0
- package/src/ai/prompts/baseline/orchestration/balanced.js +9 -0
- package/src/ai/prompts/baseline/orchestration/fast.js +9 -0
- package/src/ai/prompts/baseline/orchestration/thorough.js +9 -0
- package/src/ai/prompts/shared/output-schema.js +10 -1
- package/src/chat/prompt-builder.js +6 -1
- package/src/config.js +83 -1
- package/src/database.js +5 -1
- package/src/git/worktree.js +169 -23
- package/src/main.js +36 -148
- package/src/setup/pr-setup.js +27 -7
package/src/setup/pr-setup.js
CHANGED
|
@@ -16,7 +16,7 @@ const { GitWorktreeManager } = require('../git/worktree');
|
|
|
16
16
|
const { GitHubClient } = require('../github/client');
|
|
17
17
|
const { normalizeRepository } = require('../utils/paths');
|
|
18
18
|
const { findMainGitRoot } = require('../local-review');
|
|
19
|
-
const { getConfigDir, getMonorepoPath } = require('../config');
|
|
19
|
+
const { getConfigDir, getMonorepoPath, resolveMonorepoOptions, DEFAULT_CHECKOUT_TIMEOUT_MS } = require('../config');
|
|
20
20
|
const logger = require('../utils/logger');
|
|
21
21
|
const simpleGit = require('simple-git');
|
|
22
22
|
const fs = require('fs').promises;
|
|
@@ -202,10 +202,13 @@ async function registerRepositoryLocation(db, currentDir, owner, repo) {
|
|
|
202
202
|
* @param {number} params.prNumber - PR number (used for worktree lookup)
|
|
203
203
|
* @param {Object} [params.config] - Application config (used for monorepo path lookup)
|
|
204
204
|
* @param {Function} [params.onProgress] - Optional progress callback
|
|
205
|
-
* @returns {Promise<{ repositoryPath: string, knownPath: string|null, worktreeSourcePath: string|null }>}
|
|
205
|
+
* @returns {Promise<{ repositoryPath: string, knownPath: string|null, worktreeSourcePath: string|null, checkoutScript: string|null, checkoutTimeout: number, worktreeConfig: Object|null }>}
|
|
206
206
|
* - repositoryPath: the main git root (bare repo or .git parent)
|
|
207
207
|
* - knownPath: the known path from database (if any)
|
|
208
208
|
* - worktreeSourcePath: path to use as cwd for `git worktree add` (may be a worktree with sparse-checkout)
|
|
209
|
+
* - checkoutScript: path to the checkout script (if configured)
|
|
210
|
+
* - checkoutTimeout: timeout in ms for checkout script (default: 300000 = 5 minutes)
|
|
211
|
+
* - worktreeConfig: { worktreeBaseDir, nameTemplate } if configured, null otherwise
|
|
209
212
|
*/
|
|
210
213
|
async function findRepositoryPath({ db, owner, repo, repository, prNumber, config, onProgress }) {
|
|
211
214
|
const worktreeManager = new GitWorktreeManager(db);
|
|
@@ -267,6 +270,19 @@ async function findRepositoryPath({ db, owner, repo, repository, prNumber, confi
|
|
|
267
270
|
}
|
|
268
271
|
}
|
|
269
272
|
|
|
273
|
+
// ------------------------------------------------------------------
|
|
274
|
+
// Resolve monorepo worktree options (checkout_script, worktree_directory, worktree_name_template)
|
|
275
|
+
// ------------------------------------------------------------------
|
|
276
|
+
const resolved = config ? resolveMonorepoOptions(config, repository) : { checkoutScript: null, checkoutTimeout: DEFAULT_CHECKOUT_TIMEOUT_MS, worktreeConfig: null };
|
|
277
|
+
const { checkoutScript, checkoutTimeout, worktreeConfig } = resolved;
|
|
278
|
+
|
|
279
|
+
// When a checkout script is configured, null out worktreeSourcePath —
|
|
280
|
+
// the script handles all sparse-checkout setup, so we don't want to
|
|
281
|
+
// inherit from an existing worktree.
|
|
282
|
+
if (checkoutScript) {
|
|
283
|
+
worktreeSourcePath = null;
|
|
284
|
+
}
|
|
285
|
+
|
|
270
286
|
// ------------------------------------------------------------------
|
|
271
287
|
// Tier 0: Check known local path from repo_settings
|
|
272
288
|
// ------------------------------------------------------------------
|
|
@@ -335,7 +351,7 @@ async function findRepositoryPath({ db, owner, repo, repository, prNumber, confi
|
|
|
335
351
|
}
|
|
336
352
|
}
|
|
337
353
|
|
|
338
|
-
return { repositoryPath, knownPath, worktreeSourcePath };
|
|
354
|
+
return { repositoryPath, knownPath, worktreeSourcePath, checkoutScript, checkoutTimeout, worktreeConfig };
|
|
339
355
|
}
|
|
340
356
|
|
|
341
357
|
/**
|
|
@@ -381,7 +397,7 @@ async function setupPRReview({ db, owner, repo, prNumber, githubToken, config, o
|
|
|
381
397
|
// Step: repo - Find (or clone) a local repository
|
|
382
398
|
// ------------------------------------------------------------------
|
|
383
399
|
progress({ step: 'repo', status: 'running', message: 'Locating repository...' });
|
|
384
|
-
const { repositoryPath, knownPath, worktreeSourcePath } = await findRepositoryPath({
|
|
400
|
+
const { repositoryPath, knownPath, worktreeSourcePath, checkoutScript, checkoutTimeout, worktreeConfig } = await findRepositoryPath({
|
|
385
401
|
db,
|
|
386
402
|
owner,
|
|
387
403
|
repo,
|
|
@@ -396,10 +412,10 @@ async function setupPRReview({ db, owner, repo, prNumber, githubToken, config, o
|
|
|
396
412
|
// Step: worktree - Create git worktree for the PR
|
|
397
413
|
// ------------------------------------------------------------------
|
|
398
414
|
progress({ step: 'worktree', status: 'running', message: 'Setting up git worktree...' });
|
|
399
|
-
const worktreeManager = new GitWorktreeManager(db);
|
|
415
|
+
const worktreeManager = new GitWorktreeManager(db, worktreeConfig || {});
|
|
400
416
|
const prInfo = { owner, repo, number: prNumber };
|
|
401
417
|
// Use worktreeSourcePath as cwd for git worktree add (if available) to inherit sparse-checkout
|
|
402
|
-
const worktreePath = await worktreeManager.createWorktreeForPR(prInfo, prData, repositoryPath, { worktreeSourcePath });
|
|
418
|
+
const worktreePath = await worktreeManager.createWorktreeForPR(prInfo, prData, repositoryPath, { worktreeSourcePath, checkoutScript, checkoutTimeout });
|
|
403
419
|
progress({ step: 'worktree', status: 'completed', message: `Worktree created at ${worktreePath}` });
|
|
404
420
|
|
|
405
421
|
// ------------------------------------------------------------------
|
|
@@ -415,7 +431,11 @@ async function setupPRReview({ db, owner, repo, prNumber, githubToken, config, o
|
|
|
415
431
|
//
|
|
416
432
|
// NOTE: prData.changed_files is an INTEGER (count) from the GitHub pulls.get
|
|
417
433
|
// API, not an array. We must fetch the actual file list via pulls.listFiles.
|
|
418
|
-
if (
|
|
434
|
+
if (checkoutScript) {
|
|
435
|
+
// checkout_script handles all sparse-checkout setup — skip built-in expansion
|
|
436
|
+
logger.info('Skipping built-in sparse-checkout expansion (checkout_script configured)');
|
|
437
|
+
progress({ step: 'sparse', status: 'completed', message: 'Sparse-checkout managed by checkout_script' });
|
|
438
|
+
} else if (prData.changed_files > 0) {
|
|
419
439
|
const isSparse = await worktreeManager.isSparseCheckoutEnabled(worktreePath);
|
|
420
440
|
if (isSparse) {
|
|
421
441
|
progress({ step: 'sparse', status: 'running', message: 'Expanding sparse-checkout for PR directories...' });
|