korekt-cli 0.9.1 → 0.9.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/azure.sh +16 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "korekt-cli",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
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}")
@@ -438,6 +443,7 @@ SUMMARY_PAYLOAD=$(jq -n \
438
443
  '{
439
444
  comments: [
440
445
  {
446
+ parentCommentId: 0,
441
447
  content: $content,
442
448
  commentType: 1
443
449
  }
@@ -445,7 +451,7 @@ SUMMARY_PAYLOAD=$(jq -n \
445
451
  status: 1
446
452
  }')
447
453
 
448
- POST_RESPONSE=$(curl -s -X POST "${BASE_API_URL}/threads?api-version=6.0" \
454
+ POST_RESPONSE=$(curl -s -X POST "${BASE_API_URL}/threads?api-version=7.1" \
449
455
  -H "Authorization: Bearer $SYSTEM_ACCESSTOKEN" \
450
456
  -H "Content-Type: application/json" \
451
457
  --data "$SUMMARY_PAYLOAD" -w "\n%{http_code}")
@@ -483,7 +489,7 @@ STATUS_PAYLOAD=$(jq -n \
483
489
  }
484
490
  }')
485
491
 
486
- STATUS_RESPONSE=$(curl -s -X POST "${BASE_API_URL}/statuses?api-version=6.0" \
492
+ STATUS_RESPONSE=$(curl -s -X POST "${BASE_API_URL}/statuses?api-version=7.1" \
487
493
  -H "Authorization: Bearer $SYSTEM_ACCESSTOKEN" \
488
494
  -H "Content-Type: application/json" \
489
495
  --data "$STATUS_PAYLOAD" -w "\n%{http_code}")