@sun-asterisk/sunlint 1.3.13 → 1.3.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.
@@ -376,6 +376,26 @@ class OutputService {
376
376
  if (uploadResult.statusCode) {
377
377
  console.log(chalk.green(`📡 HTTP Status: ${uploadResult.statusCode}`));
378
378
  }
379
+ if (uploadResult.response) {
380
+ try {
381
+ const responseData = JSON.parse(uploadResult.response);
382
+ if (responseData.message) {
383
+ console.log(chalk.blue(`💬 Server response: ${responseData.message}`));
384
+ }
385
+ if (responseData.report_id) {
386
+ console.log(chalk.blue(`📝 Report ID: ${responseData.report_id}`));
387
+ }
388
+ if (responseData.repository) {
389
+ console.log(chalk.blue(`🏠 Repository: ${responseData.repository}`));
390
+ }
391
+ if (responseData.actor) {
392
+ console.log(chalk.blue(`👤 Submitted by: ${responseData.actor}`));
393
+ }
394
+ } catch (parseError) {
395
+ // If response is not JSON, show raw response
396
+ console.log(chalk.gray(`📄 Response: ${uploadResult.response.substring(0, 200)}...`));
397
+ }
398
+ }
379
399
  }
380
400
  } else {
381
401
  console.warn(chalk.yellow(`⚠️ Failed to upload report: ${uploadResult.error}`));
@@ -89,25 +89,45 @@ class UploadService {
89
89
  const fileName = path.basename(filePath);
90
90
  const timeout = options.timeout || 30; // 30 seconds default timeout
91
91
 
92
- // Build curl command
92
+ // Build curl command with status code output
93
93
  const curlCommand = this.buildCurlCommand(filePath, apiUrl, fileName, timeout);
94
94
 
95
95
  try {
96
- // Execute curl command synchronously for simplicity
96
+ // Execute curl command with write-out to get status code
97
97
  const output = execSync(curlCommand, {
98
98
  encoding: 'utf8',
99
99
  maxBuffer: 1024 * 1024, // 1MB buffer
100
100
  timeout: timeout * 1000 // Convert to milliseconds
101
101
  });
102
102
 
103
- // Parse response if possible
104
- let response = output.trim();
103
+ // Parse response with headers included (-i flag)
104
+ // Output format: "HTTP/1.1 200 OK\nHeaders...\n\nResponse Body"
105
+ const lines = output.trim().split('\n');
106
+
107
+ // Find the status line (first line starting with HTTP)
105
108
  let statusCode = null;
109
+ const statusLine = lines.find(line => line.startsWith('HTTP/'));
110
+ if (statusLine) {
111
+ const statusMatch = statusLine.match(/HTTP\/[\d.]+\s+(\d{3})/);
112
+ if (statusMatch) {
113
+ statusCode = parseInt(statusMatch[1]);
114
+ }
115
+ }
116
+
117
+ // Find response body (after empty line separating headers from body)
118
+ let response = '';
119
+ let foundEmptyLine = false;
120
+ for (const line of lines) {
121
+ if (foundEmptyLine) {
122
+ response += (response ? '\n' : '') + line;
123
+ } else if (line.trim() === '') {
124
+ foundEmptyLine = true;
125
+ }
126
+ }
106
127
 
107
- // Try to extract status code from curl verbose output
108
- const statusMatch = response.match(/HTTP\/[\d.]+\s+(\d{3})/);
109
- if (statusMatch) {
110
- statusCode = parseInt(statusMatch[1]);
128
+ // If no empty line found, assume entire output is response
129
+ if (!foundEmptyLine) {
130
+ response = output.trim();
111
131
  }
112
132
 
113
133
  return {
@@ -145,6 +165,8 @@ class UploadService {
145
165
 
146
166
  curlOptions.push(
147
167
  `--data-binary @"${filePath}"`,
168
+ '-i', // Include response headers in output
169
+ '-s', // Silent mode (no progress meter)
148
170
  `"${apiUrl}"`
149
171
  );
150
172
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sun-asterisk/sunlint",
3
- "version": "1.3.13",
3
+ "version": "1.3.15",
4
4
  "description": "☀️ SunLint - Multi-language static analysis tool for code quality and security | Sun* Engineering Standards",
5
5
  "main": "cli.js",
6
6
  "bin": {