coderev-cli 1.0.5 → 1.0.7

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
@@ -12,6 +12,13 @@
12
12
  npm install -g coderev-cli
13
13
  ```
14
14
 
15
+ > **Node.js 版本要求:>= 18**
16
+
17
+ ```bash
18
+ # 验证版本
19
+ node -v
20
+ ```
21
+
15
22
  ---
16
23
 
17
24
  ## 快速上手
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coderev-cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Multi-agent AI code review for git -- parallel agents with confidence scoring",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/reviewer.js CHANGED
@@ -446,13 +446,23 @@ async function callAI(apiKey, messages, config) {
446
446
  messages,
447
447
  });
448
448
 
449
- return response.choices[0]?.message?.content || '';
449
+ return response.choices?.[0]?.message?.content || '';
450
450
  }
451
451
 
452
452
  /**
453
453
  * Parse AI response into structured review result.
454
454
  */
455
455
  function parseReviewResponse(text) {
456
+ if (!text || typeof text !== 'string') {
457
+ return {
458
+ summary: 'Empty response from AI',
459
+ score: 0,
460
+ issues: [{ type: 'error', severity: 'high', message: 'AI returned empty response', suggestion: 'Check API key and provider configuration' }],
461
+ suggestions: [],
462
+ praise: [],
463
+ };
464
+ }
465
+
456
466
  try {
457
467
  // Try direct parse first
458
468
  return JSON.parse(text);