korekt-cli 0.13.2 → 0.13.5

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/README.md CHANGED
@@ -38,7 +38,7 @@ kk review -m gemini-3-flash-preview # Direct selection
38
38
  Available models (ranked by recommendation):
39
39
 
40
40
  1. **gemini-3-flash-preview** - Most efficient, recommended for daily use
41
- 2. **gemini-3-pro-preview** - Best quality for complex reviews
41
+ 2. **gemini-3.1-pro-preview** - Best quality for complex reviews
42
42
  3. **gemini-2.5-pro** - High quality alternative
43
43
  4. **gemini-2.5-flash** - Legacy, avoid
44
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "korekt-cli",
3
- "version": "0.13.2",
3
+ "version": "0.13.5",
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
@@ -18,7 +18,9 @@ export function truncateContent(content, maxLines = 2000) {
18
18
  const halfMax = Math.floor(maxLines / 2);
19
19
  const head = lines.slice(0, halfMax).join('\n');
20
20
  const tail = lines.slice(-halfMax).join('\n');
21
- return `${head}\n\n... [truncated] ...\n\n${tail}`;
21
+ const linesKept = 2 * halfMax;
22
+ const omittedLines = lines.length - linesKept;
23
+ return `${head}\n\n... [${omittedLines} lines truncated] ...\n\n${tail}`;
22
24
  }
23
25
 
24
26
  /**
@@ -450,7 +450,7 @@ describe('truncateContent', () => {
450
450
  // Should contain head and tail
451
451
  expect(result).toContain('line 0');
452
452
  expect(result).toContain('line 999'); // Last line of head (first 1000 lines)
453
- expect(result).toContain('... [truncated] ...');
453
+ expect(result).toContain('... [1000 lines truncated] ...');
454
454
  expect(result).toContain('line 2000'); // First line of tail (last 1000 lines)
455
455
  expect(result).toContain('line 2999');
456
456
 
@@ -464,7 +464,7 @@ describe('truncateContent', () => {
464
464
 
465
465
  expect(result).toContain('line 0');
466
466
  expect(result).toContain('line 49'); // Last of first 50
467
- expect(result).toContain('... [truncated] ...');
467
+ expect(result).toContain('... [100 lines truncated] ...');
468
468
  expect(result).toContain('line 150'); // First of last 50
469
469
  expect(result).toContain('line 199');
470
470
  });
package/src/index.js CHANGED
@@ -19,6 +19,9 @@ import { detectCIProvider, truncateFileData, formatErrorOutput } from './utils.j
19
19
  // Re-export utilities for backward compatibility
20
20
  export { detectCIProvider, truncateFileData, formatErrorOutput, getPrUrl } from './utils.js';
21
21
 
22
+ // Export for testing
23
+ export { GEMINI_MODELS, resolveModel };
24
+
22
25
  const require = createRequire(import.meta.url);
23
26
  const { version } = require('../package.json');
24
27
 
@@ -96,13 +99,29 @@ export function handleSkippedResponse(response, options, spinner) {
96
99
  const GEMINI_MODELS = [
97
100
  { value: 'gemini-2.5-pro', label: 'gemini-2.5-pro (high quality)' },
98
101
  { value: 'gemini-2.5-flash', label: 'gemini-2.5-flash (avoid, the worst quality)' },
99
- { value: 'gemini-3-pro-preview', label: 'gemini-3-pro-preview (experimental - the best model)' },
102
+ {
103
+ value: 'gemini-3.1-pro-preview',
104
+ label: 'gemini-3.1-pro-preview (experimental - the best model)',
105
+ },
100
106
  {
101
107
  value: 'gemini-3-flash-preview',
102
108
  label: 'gemini-3-flash-preview (experimental - the most efficient model)',
103
109
  },
104
110
  ];
105
111
 
112
+ /**
113
+ * Resolve model input - supports numeric shortcuts (1-4) or full model names
114
+ * @param {string} input - Model input (number or name)
115
+ * @returns {string} - Resolved model name
116
+ */
117
+ function resolveModel(input) {
118
+ const num = parseInt(input, 10);
119
+ if (!isNaN(num) && num >= 1 && num <= GEMINI_MODELS.length) {
120
+ return GEMINI_MODELS[num - 1].value;
121
+ }
122
+ return input;
123
+ }
124
+
106
125
  /**
107
126
  * Prompt user to select a Gemini model
108
127
  * @returns {Promise<string>} - Selected model name
@@ -258,7 +277,8 @@ program
258
277
  selectedModel = await selectModel();
259
278
  log(chalk.green(`Using model: ${selectedModel}\n`));
260
279
  } else if (typeof options.model === 'string') {
261
- selectedModel = options.model;
280
+ selectedModel = resolveModel(options.model);
281
+ log(chalk.green(`Using model: ${selectedModel}\n`));
262
282
  }
263
283
 
264
284
  // Fetch file rules config from API
@@ -465,7 +485,8 @@ async function reviewUncommitted(mode, options) {
465
485
  selectedModel = await selectModel();
466
486
  log(chalk.green(`Using model: ${selectedModel}\n`));
467
487
  } else if (typeof options.model === 'string') {
468
- selectedModel = options.model;
488
+ selectedModel = resolveModel(options.model);
489
+ log(chalk.green(`Using model: ${selectedModel}\n`));
469
490
  }
470
491
 
471
492
  // Fetch file rules config from API
package/src/index.test.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  detectCIProvider,
6
6
  getPrUrl,
7
7
  handleSkippedResponse,
8
+ resolveModel,
8
9
  } from './index.js';
9
10
 
10
11
  describe('CLI JSON output mode', () => {
@@ -543,7 +544,7 @@ describe('--model flag behavior', () => {
543
544
  const validModels = [
544
545
  'gemini-2.5-pro',
545
546
  'gemini-2.5-flash',
546
- 'gemini-3-pro-preview',
547
+ 'gemini-3.1-pro-preview',
547
548
  'gemini-3-flash-preview',
548
549
  ];
549
550
 
@@ -553,6 +554,34 @@ describe('--model flag behavior', () => {
553
554
  });
554
555
  });
555
556
  });
557
+
558
+ describe('numeric model shortcuts', () => {
559
+ it('should resolve "1" to gemini-2.5-pro', () => {
560
+ expect(resolveModel('1')).toBe('gemini-2.5-pro');
561
+ });
562
+
563
+ it('should resolve "2" to gemini-2.5-flash', () => {
564
+ expect(resolveModel('2')).toBe('gemini-2.5-flash');
565
+ });
566
+
567
+ it('should resolve "3" to gemini-3.1-pro-preview', () => {
568
+ expect(resolveModel('3')).toBe('gemini-3.1-pro-preview');
569
+ });
570
+
571
+ it('should resolve "4" to gemini-3-flash-preview', () => {
572
+ expect(resolveModel('4')).toBe('gemini-3-flash-preview');
573
+ });
574
+
575
+ it('should pass through full model names unchanged', () => {
576
+ expect(resolveModel('gemini-3.1-pro-preview')).toBe('gemini-3.1-pro-preview');
577
+ });
578
+
579
+ it('should pass through invalid input unchanged', () => {
580
+ expect(resolveModel('invalid')).toBe('invalid');
581
+ expect(resolveModel('0')).toBe('0');
582
+ expect(resolveModel('5')).toBe('5');
583
+ });
584
+ });
556
585
  });
557
586
 
558
587
  describe('skipped response handling', () => {