@freshworks/shiftleft-tools 1.1.10 → 1.1.12

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.10",
3
+ "version": "1.1.12",
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",
@@ -36,6 +36,7 @@ def parse_args():
36
36
  parser.add_argument('--controller-dir', required=True, help='Path to Java controller directory')
37
37
  parser.add_argument('--postman-dir', required=True, help='Path to Postman directory')
38
38
  parser.add_argument('--html-output', required=True, help='Path for HTML output file')
39
+ parser.add_argument('--logo', default='API Tests', help='Display name shown on the report (repo/service name)')
39
40
  return parser.parse_args()
40
41
 
41
42
 
@@ -43,6 +44,7 @@ args = parse_args()
43
44
  CONTROLLER_DIR = args.controller_dir
44
45
  POSTMAN_DIR = args.postman_dir
45
46
  HTML_OUTPUT_FILE = args.html_output
47
+ REPORT_LOGO = args.logo
46
48
 
47
49
  endpoints = []
48
50
  tested = []
@@ -1018,7 +1020,7 @@ content = summary_html + coverage_html + gaps_html + details_html + qp_html + bo
1018
1020
  if USE_HELPERS:
1019
1021
  html = get_html_template(
1020
1022
  title='API Test Coverage Report',
1021
- logo='DP Apps',
1023
+ logo=REPORT_LOGO,
1022
1024
  content=content,
1023
1025
  health_badge={'class': health_class, 'icon': health_icon, 'label': health_label},
1024
1026
  footer_text=f'API Test Coverage Report • Generated by API Coverage Matrix Generator • {total_tests} test cases analyzed'
@@ -1030,7 +1032,7 @@ else:
1030
1032
  <head>
1031
1033
  <meta charset="UTF-8">
1032
1034
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
1033
- <title>API Coverage Report | DP Apps</title>
1035
+ <title>API Coverage Report | {REPORT_LOGO}</title>
1034
1036
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
1035
1037
  <style>{SHARED_CSS if SHARED_CSS else "/* Error: shared CSS library not loaded */"}</style>
1036
1038
  </head>
@@ -1038,7 +1040,7 @@ else:
1038
1040
  <div class="container">
1039
1041
  <div class="header">
1040
1042
  <div class="header-left">
1041
- <div class="logo">DP Apps</div>
1043
+ <div class="logo">{REPORT_LOGO}</div>
1042
1044
  <h1>API Test Coverage Report</h1>
1043
1045
  <p class="timestamp">Generated: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}</p>
1044
1046
  </div>
@@ -205,18 +205,15 @@ def generate_consolidated_report(args):
205
205
 
206
206
  status_parts = []
207
207
  if total_a > 0:
208
- if failed_a > 0:
209
- tip = esc(', '.join(col.get('failure_labels', [])[:3]))
210
- status_parts.append(
211
- f'<span class="cr-badge cr-badge-fail" title="{tip}">{failed_a} failed</span>'
212
- )
213
- status_parts.append(
214
- f'<span class="cr-badge cr-badge-muted">{passed_a}/{total_a} passed</span>'
215
- )
216
- else:
217
- status_parts.append(
218
- f'<span class="cr-badge cr-badge-pass">{total_a} passed</span>'
219
- )
208
+ # Always show both totals alongside the collection title.
209
+ status_parts.append(
210
+ f'<span class="cr-badge cr-badge-pass">{passed_a} passed</span>'
211
+ )
212
+ fail_cls = 'cr-badge-fail' if failed_a > 0 else 'cr-badge-muted'
213
+ tip = esc(', '.join(col.get('failure_labels', [])[:3])) if failed_a > 0 else ''
214
+ status_parts.append(
215
+ f'<span class="cr-badge {fail_cls}" title="{tip}">{failed_a} failed</span>'
216
+ )
220
217
  status_html = ''.join(status_parts)
221
218
 
222
219
  return f'''<div class="card {" ".join(row_classes)}">
@@ -66,6 +66,8 @@ log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
66
66
  log_error() { echo -e "${RED}[ERROR]${NC} $1" >&2; }
67
67
 
68
68
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
69
+ # Display name on the report — repo/service name, overridable.
70
+ REPORT_LOGO="${SHIFTLEFT_REPORT_LOGO:-$(basename "$(cd "$SCRIPT_DIR/../../.." && pwd)")}"
69
71
 
70
72
  #------------------------------------------------------------------------------
71
73
  # Check Python availability
@@ -239,7 +241,8 @@ cd "$SCRIPT_DIR/../lib"
239
241
  python3 api_coverage.py \
240
242
  --controller-dir "$CONTROLLER_DIR" \
241
243
  --postman-dir "$POSTMAN_DIR" \
242
- --html-output "$HTML_OUTPUT_FILE"
244
+ --html-output "$HTML_OUTPUT_FILE" \
245
+ --logo "$REPORT_LOGO"
243
246
 
244
247
  # Capture exit code
245
248
  PYTHON_EXIT=$?
@@ -27,6 +27,8 @@ log_error() { echo -e "${RED}[ERROR]${NC} $1" >&2; }
27
27
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
28
28
  PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
29
29
  REPO_ROOT="$PROJECT_ROOT"
30
+ # Display name on the report — repo/service name, overridable.
31
+ REPORT_LOGO="${SHIFTLEFT_REPORT_LOGO:-$(basename "$(cd "$SCRIPT_DIR/../../.." && pwd)")}"
30
32
 
31
33
  source "$SCRIPT_DIR/../lib/cleanup-reports.sh"
32
34
 
@@ -136,7 +138,8 @@ fi
136
138
  python3 "$COVERAGE_SCRIPT" \
137
139
  --routes-dir "$ROUTES_DIR" \
138
140
  --postman-dir "$POSTMAN_DIR" \
139
- --html-output "$HTML_OUTPUT_FILE"
141
+ --html-output "$HTML_OUTPUT_FILE" \
142
+ --logo "$REPORT_LOGO"
140
143
  PYTHON_EXIT=$?
141
144
 
142
145
  if [ $PYTHON_EXIT -ne 0 ]; then
@@ -14,6 +14,7 @@ def parse_args():
14
14
  parser.add_argument('--routes-dir', required=True, help='Path to Express routes/controllers directory')
15
15
  parser.add_argument('--postman-dir', required=True, help='Path to Postman directory')
16
16
  parser.add_argument('--html-output', required=True, help='Path for HTML output file')
17
+ parser.add_argument('--logo', default='API Tests', help='Display name shown on the report (repo/service name)')
17
18
  return parser.parse_args()
18
19
 
19
20
 
@@ -33,6 +34,7 @@ _args = parse_args()
33
34
  ROUTES_DIR = _args.routes_dir
34
35
  POSTMAN_DIR = _args.postman_dir
35
36
  HTML_OUTPUT_FILE = _args.html_output
37
+ REPORT_LOGO = _args.logo
36
38
 
37
39
  endpoints = []
38
40
  tested = []
@@ -1052,14 +1054,14 @@ html = f'''<!DOCTYPE html>
1052
1054
  <head>
1053
1055
  <meta charset="UTF-8">
1054
1056
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
1055
- <title>API Coverage Report | freshapps_api_node</title>
1057
+ <title>API Coverage Report | {REPORT_LOGO}</title>
1056
1058
  <style>{CSS}</style>
1057
1059
  </head>
1058
1060
  <body>
1059
1061
  <div class="container">
1060
1062
  <div class="header">
1061
1063
  <div class="header-left">
1062
- <div class="logo">freshapps_api_node</div>
1064
+ <div class="logo">{REPORT_LOGO}</div>
1063
1065
  <h1>API Test Coverage Report</h1>
1064
1066
  <p class="timestamp">Generated: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}</p>
1065
1067
  </div>