korekt-cli 0.9.1 → 0.9.3

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.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "AI-powered code review CLI - Keep your kode korekt",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/scripts/azure.sh CHANGED
@@ -102,27 +102,31 @@ delete_old_summary_comments() {
102
102
  fi
103
103
 
104
104
  # Find threads that contain the bot marker and have no threadContext (summary comments)
105
- echo "$existing_threads" | jq -r '.[] | select(.comments[0].content | contains("🤖 **Automated Code Review Results**")) | select(.threadContext == null) | .id' | while IFS= read -r thread_id; do
106
- if [ -z "$thread_id" ] || [ "$thread_id" = "null" ]; then
105
+ echo "$existing_threads" | jq -r '.[] | select((.comments[0].content? // "") | contains("🤖 **Automated Code Review Results**")) | select(.threadContext == null) | {id: .id, comment_id: .comments[0].id} | @json' | while IFS= read -r thread_json; do
106
+ local thread_id
107
+ local comment_id
108
+ thread_id=$(echo "$thread_json" | jq -r '.id')
109
+ comment_id=$(echo "$thread_json" | jq -r '.comment_id')
110
+
111
+ if [ -z "$thread_id" ] || [ "$thread_id" = "null" ] || [ -z "$comment_id" ] || [ "$comment_id" = "null" ]; then
107
112
  continue
108
113
  fi
109
114
 
110
- echo "Deleting old summary thread (ID: $thread_id)..."
115
+ echo "Deleting old summary comment (thread ID: $thread_id, comment ID: $comment_id)..."
111
116
 
112
117
  local delete_response
113
- delete_response=$(curl -s -X PATCH "${BASE_API_URL}/threads/${thread_id}?api-version=6.0" \
118
+ delete_response=$(curl -s -X DELETE "${BASE_API_URL}/threads/${thread_id}/comments/${comment_id}?api-version=7.1" \
114
119
  -H "Authorization: Bearer $SYSTEM_ACCESSTOKEN" \
115
120
  -H "Content-Type: application/json" \
116
- --data '{"status": "closed"}' \
117
121
  -w "\n%{http_code}")
118
122
 
119
123
  local http_status
120
124
  http_status=$(echo "$delete_response" | tail -n1)
121
125
 
122
126
  if [ "$http_status" -ge 200 ] && [ "$http_status" -lt 300 ]; then
123
- echo "Successfully closed thread $thread_id"
127
+ echo "Successfully deleted comment in thread $thread_id"
124
128
  else
125
- echo "Warning: Could not close thread $thread_id (HTTP $http_status)"
129
+ echo "Warning: Could not delete comment in thread $thread_id (HTTP $http_status)"
126
130
  fi
127
131
  done
128
132
  }
@@ -189,6 +193,7 @@ post_review_thread() {
189
193
  '{
190
194
  comments: [
191
195
  {
196
+ parentCommentId: 0,
192
197
  content: $content,
193
198
  commentType: 1
194
199
  }
@@ -208,7 +213,7 @@ post_review_thread() {
208
213
  }')
209
214
 
210
215
  local post_response
211
- post_response=$(curl -s -X POST "${BASE_API_URL}/threads?api-version=6.0" \
216
+ post_response=$(curl -s -X POST "${BASE_API_URL}/threads?api-version=7.1" \
212
217
  -H "Authorization: Bearer $SYSTEM_ACCESSTOKEN" \
213
218
  -H "Content-Type: application/json" \
214
219
  --data "$thread_payload" -w "\n%{http_code}")
@@ -423,9 +428,6 @@ if [ -n "$BUILD_BUILDID" ]; then
423
428
  echo "" >> "$COMMENT_FILE"
424
429
  fi
425
430
 
426
- echo "---" >> "$COMMENT_FILE"
427
- echo "*Powered by [korekt-cli](https://github.com/korekt-ai/korekt-cli)*" >> "$COMMENT_FILE"
428
-
429
431
  # Delete old summaries
430
432
  delete_old_summary_comments
431
433
 
@@ -438,6 +440,7 @@ SUMMARY_PAYLOAD=$(jq -n \
438
440
  '{
439
441
  comments: [
440
442
  {
443
+ parentCommentId: 0,
441
444
  content: $content,
442
445
  commentType: 1
443
446
  }
@@ -445,7 +448,7 @@ SUMMARY_PAYLOAD=$(jq -n \
445
448
  status: 1
446
449
  }')
447
450
 
448
- POST_RESPONSE=$(curl -s -X POST "${BASE_API_URL}/threads?api-version=6.0" \
451
+ POST_RESPONSE=$(curl -s -X POST "${BASE_API_URL}/threads?api-version=7.1" \
449
452
  -H "Authorization: Bearer $SYSTEM_ACCESSTOKEN" \
450
453
  -H "Content-Type: application/json" \
451
454
  --data "$SUMMARY_PAYLOAD" -w "\n%{http_code}")
@@ -483,7 +486,7 @@ STATUS_PAYLOAD=$(jq -n \
483
486
  }
484
487
  }')
485
488
 
486
- STATUS_RESPONSE=$(curl -s -X POST "${BASE_API_URL}/statuses?api-version=6.0" \
489
+ STATUS_RESPONSE=$(curl -s -X POST "${BASE_API_URL}/statuses?api-version=7.1" \
487
490
  -H "Authorization: Bearer $SYSTEM_ACCESSTOKEN" \
488
491
  -H "Content-Type: application/json" \
489
492
  --data "$STATUS_PAYLOAD" -w "\n%{http_code}")
@@ -398,9 +398,6 @@ if [ -n "${BITBUCKET_BUILD_NUMBER:-}" ]; then
398
398
  echo "" >> "$COMMENT_FILE"
399
399
  fi
400
400
 
401
- echo "---" >> "$COMMENT_FILE"
402
- echo "*Powered by [korekt-cli](https://github.com/korekt-ai/korekt-cli)*" >> "$COMMENT_FILE"
403
-
404
401
  # Delete old summaries
405
402
  delete_old_summary_comments
406
403
 
package/scripts/github.sh CHANGED
@@ -389,9 +389,6 @@ else
389
389
  fi
390
390
  fi
391
391
 
392
- echo "---" >> "$COMMENT_FILE"
393
- echo "*Powered by [korekt-cli](https://github.com/korekt-ai/korekt-cli)*" >> "$COMMENT_FILE"
394
-
395
392
  # Delete old summaries
396
393
  delete_old_summary_comments
397
394