korekt-cli 0.8.0 → 0.8.2

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": "korekt-cli",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "AI-powered code review CLI - Keep your kode korekt",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/git-logic.js CHANGED
@@ -238,10 +238,12 @@ export async function runUncommittedReview(mode = 'unstaged') {
238
238
  */
239
239
  export async function getContributors(diffRange, repoRootPath) {
240
240
  try {
241
- // Get all commit authors with email and name
242
- const { stdout: authorOutput } = await execa('git', ['log', '--format=%ae|%an', diffRange], {
243
- cwd: repoRootPath,
244
- });
241
+ // Get all commit authors with email and name (exclude merge commits)
242
+ const { stdout: authorOutput } = await execa(
243
+ 'git',
244
+ ['log', '--no-merges', '--format=%ae|%an', diffRange],
245
+ { cwd: repoRootPath }
246
+ );
245
247
 
246
248
  if (!authorOutput.trim()) {
247
249
  return { author_email: null, author_name: null, contributors: [] };
@@ -398,9 +400,11 @@ export async function runLocalReview(targetBranch = null, ignorePatterns = null)
398
400
  console.error(chalk.gray(`Analyzing commits from ${mergeBase.substring(0, 7)} to HEAD...`));
399
401
 
400
402
  // 3. Get Commit Messages with proper delimiter
401
- const { stdout: logOutput } = await execa('git', ['log', '--pretty=%B---EOC---', diffRange], {
402
- cwd: repoRootPath,
403
- });
403
+ const { stdout: logOutput } = await execa(
404
+ 'git',
405
+ ['log', '--no-merges', '--pretty=%B---EOC---', diffRange],
406
+ { cwd: repoRootPath }
407
+ );
404
408
  const commitMessages = logOutput
405
409
  .split('---EOC---')
406
410
  .map((msg) => msg.trim())
@@ -288,7 +288,10 @@ describe('runLocalReview - fork point detection', () => {
288
288
  'abc123def456 feature-branch@{0}: commit: latest\nfedcba654321 feature-branch@{1}: commit: middle\n510572bc5197788770004d0d0585822adab0128f feature-branch@{2}: branch: Created from master',
289
289
  };
290
290
  }
291
- if (command.includes('log --pretty=%B---EOC---') && command.includes('510572bc')) {
291
+ if (
292
+ command.includes('log --no-merges --pretty=%B---EOC---') &&
293
+ command.includes('510572bc')
294
+ ) {
292
295
  return { stdout: 'feat: add feature---EOC---' };
293
296
  }
294
297
  if (command.includes('diff --name-status') && command.includes('510572bc')) {
@@ -338,7 +341,7 @@ describe('runLocalReview - fork point detection', () => {
338
341
  if (command.includes('merge-base origin/main HEAD')) {
339
342
  return { stdout: 'abc123' };
340
343
  }
341
- if (command.includes('log --pretty=%B---EOC---')) {
344
+ if (command.includes('log --no-merges --pretty=%B---EOC---')) {
342
345
  return { stdout: 'feat: add feature---EOC---' };
343
346
  }
344
347
  if (command.includes('diff --name-status')) {
@@ -542,7 +545,7 @@ describe('getContributors', () => {
542
545
  it('should extract single contributor with commit count', async () => {
543
546
  vi.mocked(execa).mockImplementation(async (cmd, args) => {
544
547
  const command = [cmd, ...args].join(' ');
545
- if (command.includes('log --format=%ae|%an')) {
548
+ if (command.includes('log --no-merges --format=%ae|%an')) {
546
549
  return {
547
550
  stdout: 'john@example.com|John Doe\njohn@example.com|John Doe\njohn@example.com|John Doe',
548
551
  };
@@ -565,7 +568,7 @@ describe('getContributors', () => {
565
568
  it('should identify author as contributor with most commits', async () => {
566
569
  vi.mocked(execa).mockImplementation(async (cmd, args) => {
567
570
  const command = [cmd, ...args].join(' ');
568
- if (command.includes('log --format=%ae|%an')) {
571
+ if (command.includes('log --no-merges --format=%ae|%an')) {
569
572
  return {
570
573
  stdout: [
571
574
  'alice@example.com|Alice Smith',
@@ -595,7 +598,7 @@ describe('getContributors', () => {
595
598
  it('should handle empty commit range', async () => {
596
599
  vi.mocked(execa).mockImplementation(async (cmd, args) => {
597
600
  const command = [cmd, ...args].join(' ');
598
- if (command.includes('log --format=%ae|%an')) {
601
+ if (command.includes('log --no-merges --format=%ae|%an')) {
599
602
  return { stdout: '' };
600
603
  }
601
604
  throw new Error(`Unmocked command: ${command}`);
@@ -623,7 +626,7 @@ describe('getContributors', () => {
623
626
  it('should handle missing name in git log', async () => {
624
627
  vi.mocked(execa).mockImplementation(async (cmd, args) => {
625
628
  const command = [cmd, ...args].join(' ');
626
- if (command.includes('log --format=%ae|%an')) {
629
+ if (command.includes('log --no-merges --format=%ae|%an')) {
627
630
  return { stdout: 'user@example.com|' };
628
631
  }
629
632
  throw new Error(`Unmocked command: ${command}`);
@@ -639,7 +642,7 @@ describe('getContributors', () => {
639
642
  it('should sort contributors by commit count descending', async () => {
640
643
  vi.mocked(execa).mockImplementation(async (cmd, args) => {
641
644
  const command = [cmd, ...args].join(' ');
642
- if (command.includes('log --format=%ae|%an')) {
645
+ if (command.includes('log --no-merges --format=%ae|%an')) {
643
646
  return {
644
647
  stdout: [
645
648
  'c@example.com|C User',