@freshworks/shiftleft-tools 1.1.13 → 1.1.15

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": "@freshworks/shiftleft-tools",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "CLI for managing Cursor rules/skills and Postman test infrastructure across Java Spring Boot and Node.js/Express projects",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -135,7 +135,19 @@ def generate_consolidated_report(args):
135
135
  for col in json.loads(args.collection_links):
136
136
  f = col.get('file', '')
137
137
  slug = f.split('/')[0] if '/' in f else 'legacy'
138
- collections.append({'name': col.get('name', ''), 'file': f, 'product_slug': slug})
138
+ total_a = int(col.get('assertions_total', 0) or 0)
139
+ failed_a = int(col.get('assertions_failed', 0) or 0)
140
+ passed_a = max(total_a - failed_a, 0)
141
+ collections.append({
142
+ 'name': col.get('name', ''),
143
+ 'file': f,
144
+ 'product_slug': slug,
145
+ 'assertions_total': total_a,
146
+ 'assertions_passed': passed_a,
147
+ 'assertions_failed': failed_a,
148
+ 'detail_href': f"{f}#pills-failed" if failed_a > 0 else f,
149
+ 'status': 'passed' if failed_a == 0 else 'failed',
150
+ })
139
151
  except json.JSONDecodeError:
140
152
  pass
141
153
 
@@ -130,12 +130,15 @@ for json_file in "${JSON_FILES[@]}"; do
130
130
  html_file="${col_name}-${TIMESTAMP}.html"
131
131
  display_name=$(echo "$col_name" | sed 's/-/ /g' | sed 's/^[0-9]* //')
132
132
  fi
133
+ # Per-collection assertion counts so the report cards show passed/failed.
134
+ col_total=$(jq '.run.stats.assertions.total // 0' "$json_file" 2>/dev/null || echo 0)
135
+ col_failed=$(jq '.run.stats.assertions.failed // 0' "$json_file" 2>/dev/null || echo 0)
133
136
  if [ "$first" = true ]; then
134
137
  first=false
135
138
  else
136
139
  COLLECTION_LINKS_JSON="${COLLECTION_LINKS_JSON},"
137
140
  fi
138
- COLLECTION_LINKS_JSON="${COLLECTION_LINKS_JSON}{\"name\":\"${display_name}\",\"file\":\"${html_file}\"}"
141
+ COLLECTION_LINKS_JSON="${COLLECTION_LINKS_JSON}{\"name\":\"${display_name}\",\"file\":\"${html_file}\",\"assertions_total\":${col_total},\"assertions_failed\":${col_failed}}"
139
142
  done
140
143
  COLLECTION_LINKS_JSON="${COLLECTION_LINKS_JSON}]"
141
144
 
@@ -400,11 +400,17 @@ fi
400
400
  # links to a stale consolidated report whose per-collection detail files have
401
401
  # already been cleaned up. Only fall back to the newest existing one if this
402
402
  # run produced no consolidated JSON to render.
403
- POSTMAN_CONSOLIDATED_HTML="$REPORTS_DIR/consolidated-${POSTMAN_ENV}-${TIMESTAMP}.html"
404
- CONSOLIDATED_JSON_THIS_RUN="$REPORTS_DIR/consolidated-${POSTMAN_ENV}-${TIMESTAMP}.json"
405
- if [ ! -f "$POSTMAN_CONSOLIDATED_HTML" ] && [ -f "$CONSOLIDATED_JSON_THIS_RUN" ]; then
406
- echo -e "${YELLOW}Generating consolidated HTML report...${NC}"
407
- "$SCRIPT_DIR/report-generators/generate-consolidated-report.sh" "$POSTMAN_ENV" "$TIMESTAMP" "$REPORTS_DIR" "$POSTMAN_PASSED" "$POSTMAN_FAILED" 0 >/dev/null 2>&1 || true
403
+ # The Postman runner self-timestamps its artifacts, so the consolidated JSON's
404
+ # timestamp differs from this orchestrator's $TIMESTAMP. Derive the HTML name
405
+ # from the actual consolidated JSON (resolved above) rather than $TIMESTAMP.
406
+ POSTMAN_CONSOLIDATED_HTML=""
407
+ if [ -n "$CONSOLIDATED_JSON" ] && [ -f "$CONSOLIDATED_JSON" ]; then
408
+ CONSOLIDATED_TS=$(basename "$CONSOLIDATED_JSON" .json | sed "s/^consolidated-${POSTMAN_ENV}-//")
409
+ POSTMAN_CONSOLIDATED_HTML="$REPORTS_DIR/consolidated-${POSTMAN_ENV}-${CONSOLIDATED_TS}.html"
410
+ if [ ! -f "$POSTMAN_CONSOLIDATED_HTML" ]; then
411
+ echo -e "${YELLOW}Generating consolidated HTML report...${NC}"
412
+ "$SCRIPT_DIR/report-generators/generate-consolidated-report.sh" "$POSTMAN_ENV" "$CONSOLIDATED_TS" "$REPORTS_DIR" "$POSTMAN_PASSED" "$POSTMAN_FAILED" 0 >/dev/null 2>&1 || true
413
+ fi
408
414
  fi
409
415
  if [ ! -f "$POSTMAN_CONSOLIDATED_HTML" ]; then
410
416
  POSTMAN_CONSOLIDATED_HTML=$(ls -t "$REPORTS_DIR"/consolidated-*.html 2>/dev/null | head -1 || true)
@@ -276,10 +276,16 @@ if [ "$SKIP_REPORT" = false ]; then
276
276
  # combined report never links to a stale consolidated whose per-collection
277
277
  # detail files have been cleaned up. Fall back to the newest only if this run
278
278
  # produced no consolidated JSON to render.
279
- POSTMAN_CONSOLIDATED_HTML="$REPORTS_DIR/consolidated-${POSTMAN_ENV}-${TIMESTAMP}.html"
280
- CONSOLIDATED_JSON_THIS_RUN="$REPORTS_DIR/consolidated-${POSTMAN_ENV}-${TIMESTAMP}.json"
281
- if [ ! -f "$POSTMAN_CONSOLIDATED_HTML" ] && [ -f "$CONSOLIDATED_JSON_THIS_RUN" ]; then
282
- "$SCRIPT_DIR/report-generators/generate-consolidated-report.sh" "$POSTMAN_ENV" "$TIMESTAMP" "$REPORTS_DIR" "$POSTMAN_PASSED" "$POSTMAN_FAILED" 0 >/dev/null 2>&1 || true
279
+ # The Postman runner self-timestamps, so the consolidated JSON's timestamp
280
+ # differs from this orchestrator's $TIMESTAMP. Derive the HTML name from the
281
+ # actual consolidated JSON rather than $TIMESTAMP.
282
+ POSTMAN_CONSOLIDATED_HTML=""
283
+ if [ -n "$CONSOLIDATED_JSON" ] && [ -f "$CONSOLIDATED_JSON" ]; then
284
+ CONSOLIDATED_TS=$(basename "$CONSOLIDATED_JSON" .json | sed "s/^consolidated-${POSTMAN_ENV}-//")
285
+ POSTMAN_CONSOLIDATED_HTML="$REPORTS_DIR/consolidated-${POSTMAN_ENV}-${CONSOLIDATED_TS}.html"
286
+ if [ ! -f "$POSTMAN_CONSOLIDATED_HTML" ]; then
287
+ "$SCRIPT_DIR/report-generators/generate-consolidated-report.sh" "$POSTMAN_ENV" "$CONSOLIDATED_TS" "$REPORTS_DIR" "$POSTMAN_PASSED" "$POSTMAN_FAILED" 0 >/dev/null 2>&1 || true
288
+ fi
283
289
  fi
284
290
  if [ ! -f "$POSTMAN_CONSOLIDATED_HTML" ]; then
285
291
  POSTMAN_CONSOLIDATED_HTML=$(ls -t "$REPORTS_DIR"/consolidated-*.html 2>/dev/null | head -1 || true)