@socketsecurity/cli-with-sentry 1.1.25 → 1.1.26

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/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [1.1.26](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.26) - 2025-11-08
8
+
9
+ ### Added
10
+ - Debug logging of API requests/responses
11
+
7
12
  ## [1.1.23](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.23) - 2025-09-22
8
13
 
9
14
  ### Changed
package/dist/cli.js CHANGED
@@ -12,9 +12,9 @@ var constants = require('./constants.js');
12
12
  var flags = require('./flags.js');
13
13
  var path = require('node:path');
14
14
  var words = require('../external/@socketsecurity/registry/lib/words');
15
+ var fs$1 = require('node:fs');
15
16
  var arrays = require('../external/@socketsecurity/registry/lib/arrays');
16
17
  var prompts = require('../external/@socketsecurity/registry/lib/prompts');
17
- var fs$1 = require('node:fs');
18
18
  var spawn = require('../external/@socketsecurity/registry/lib/spawn');
19
19
  var fs$2 = require('../external/@socketsecurity/registry/lib/fs');
20
20
  var strings = require('../external/@socketsecurity/registry/lib/strings');
@@ -907,6 +907,17 @@ async function fetchCreateOrgFullScan(packagePaths, orgSlug, config, options) {
907
907
  return sockSdkCResult;
908
908
  }
909
909
  const sockSdk = sockSdkCResult.data;
910
+ if (constants.default.ENV.SOCKET_CLI_DEBUG) {
911
+ const fileInfo = await Promise.all(packagePaths.map(async p => {
912
+ const absPath = path.resolve(process.cwd(), p);
913
+ const stat = await fs$1.promises.stat(absPath);
914
+ return {
915
+ path: absPath,
916
+ size: stat.size
917
+ };
918
+ }));
919
+ logger.logger.info(`[DEBUG] ${new Date().toISOString()} Uploading full scan manifests: ${JSON.stringify(fileInfo)}`);
920
+ }
910
921
  return await utils.handleApiCall(sockSdk.createOrgFullScan(orgSlug, packagePaths, cwd, {
911
922
  ...(branchName ? {
912
923
  branch: branchName
@@ -11969,12 +11980,20 @@ async function downloadManifestFile({
11969
11980
  require$$9.debugDir('inspect', {
11970
11981
  fileUrl
11971
11982
  });
11972
- const downloadUrlResponse = await fetch(fileUrl, {
11973
- method: 'GET',
11974
- headers: {
11975
- Authorization: `Bearer ${githubToken}`
11976
- }
11977
- });
11983
+ utils.debugApiRequest('GET', fileUrl);
11984
+ let downloadUrlResponse;
11985
+ try {
11986
+ downloadUrlResponse = await fetch(fileUrl, {
11987
+ method: 'GET',
11988
+ headers: {
11989
+ Authorization: `Bearer ${githubToken}`
11990
+ }
11991
+ });
11992
+ utils.debugApiResponse('GET', fileUrl, downloadUrlResponse.status);
11993
+ } catch (e) {
11994
+ utils.debugApiResponse('GET', fileUrl, undefined, e);
11995
+ throw e;
11996
+ }
11978
11997
  require$$9.debugFn('notice', 'complete: request');
11979
11998
  const downloadUrlText = await downloadUrlResponse.text();
11980
11999
  require$$9.debugFn('inspect', 'response: raw download url', downloadUrlText);
@@ -12011,7 +12030,9 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
12011
12030
  let response; // Declare response here to access it in catch if needed
12012
12031
 
12013
12032
  try {
12033
+ utils.debugApiRequest('GET', downloadUrl);
12014
12034
  response = await fetch(downloadUrl);
12035
+ utils.debugApiResponse('GET', downloadUrl, response.status);
12015
12036
  if (!response.ok) {
12016
12037
  const errorMsg = `Download failed due to bad server response: ${response.status} ${response.statusText} for ${downloadUrl}`;
12017
12038
  logger.logger.fail(errorMsg);
@@ -12050,6 +12071,9 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
12050
12071
  data: localPath
12051
12072
  };
12052
12073
  } catch (e) {
12074
+ if (!response) {
12075
+ utils.debugApiResponse('GET', downloadUrl, undefined, e);
12076
+ }
12053
12077
  logger.logger.fail('An error was thrown while trying to download a manifest file... url:', downloadUrl);
12054
12078
  require$$9.debugDir('error', e);
12055
12079
 
@@ -12091,11 +12115,19 @@ async function getLastCommitDetails({
12091
12115
  logger.logger.info(`Requesting last commit for default branch ${defaultBranch} for ${orgGithub}/${repoSlug}...`);
12092
12116
  const commitApiUrl = `${repoApiUrl}/commits?sha=${defaultBranch}&per_page=1`;
12093
12117
  require$$9.debugFn('inspect', 'url: commit', commitApiUrl);
12094
- const commitResponse = await fetch(commitApiUrl, {
12095
- headers: {
12096
- Authorization: `Bearer ${githubToken}`
12097
- }
12098
- });
12118
+ utils.debugApiRequest('GET', commitApiUrl);
12119
+ let commitResponse;
12120
+ try {
12121
+ commitResponse = await fetch(commitApiUrl, {
12122
+ headers: {
12123
+ Authorization: `Bearer ${githubToken}`
12124
+ }
12125
+ });
12126
+ utils.debugApiResponse('GET', commitApiUrl, commitResponse.status);
12127
+ } catch (e) {
12128
+ utils.debugApiResponse('GET', commitApiUrl, undefined, e);
12129
+ throw e;
12130
+ }
12099
12131
  const commitText = await commitResponse.text();
12100
12132
  require$$9.debugFn('inspect', 'response: commit', commitText);
12101
12133
  let lastCommit;
@@ -12187,12 +12219,20 @@ async function getRepoDetails({
12187
12219
  require$$9.debugDir('inspect', {
12188
12220
  repoApiUrl
12189
12221
  });
12190
- const repoDetailsResponse = await fetch(repoApiUrl, {
12191
- method: 'GET',
12192
- headers: {
12193
- Authorization: `Bearer ${githubToken}`
12194
- }
12195
- });
12222
+ let repoDetailsResponse;
12223
+ try {
12224
+ utils.debugApiRequest('GET', repoApiUrl);
12225
+ repoDetailsResponse = await fetch(repoApiUrl, {
12226
+ method: 'GET',
12227
+ headers: {
12228
+ Authorization: `Bearer ${githubToken}`
12229
+ }
12230
+ });
12231
+ utils.debugApiResponse('GET', repoApiUrl, repoDetailsResponse.status);
12232
+ } catch (e) {
12233
+ utils.debugApiResponse('GET', repoApiUrl, undefined, e);
12234
+ throw e;
12235
+ }
12196
12236
  logger.logger.success(`Request completed.`);
12197
12237
  const repoDetailsText = await repoDetailsResponse.text();
12198
12238
  require$$9.debugFn('inspect', 'response: repo', repoDetailsText);
@@ -12235,12 +12275,20 @@ async function getRepoBranchTree({
12235
12275
  logger.logger.info(`Requesting default branch file tree; branch \`${defaultBranch}\`, repo \`${orgGithub}/${repoSlug}\`...`);
12236
12276
  const treeApiUrl = `${repoApiUrl}/git/trees/${defaultBranch}?recursive=1`;
12237
12277
  require$$9.debugFn('inspect', 'url: tree', treeApiUrl);
12238
- const treeResponse = await fetch(treeApiUrl, {
12239
- method: 'GET',
12240
- headers: {
12241
- Authorization: `Bearer ${githubToken}`
12242
- }
12243
- });
12278
+ let treeResponse;
12279
+ try {
12280
+ utils.debugApiRequest('GET', treeApiUrl);
12281
+ treeResponse = await fetch(treeApiUrl, {
12282
+ method: 'GET',
12283
+ headers: {
12284
+ Authorization: `Bearer ${githubToken}`
12285
+ }
12286
+ });
12287
+ utils.debugApiResponse('GET', treeApiUrl, treeResponse.status);
12288
+ } catch (e) {
12289
+ utils.debugApiResponse('GET', treeApiUrl, undefined, e);
12290
+ throw e;
12291
+ }
12244
12292
  const treeText = await treeResponse.text();
12245
12293
  require$$9.debugFn('inspect', 'response: tree', treeText);
12246
12294
  let treeDetails;
@@ -14995,5 +15043,5 @@ void (async () => {
14995
15043
  await utils.captureException(e);
14996
15044
  }
14997
15045
  })();
14998
- //# debugId=3a127de6-5ee9-48f9-aded-7e7e7e868c6a
15046
+ //# debugId=6efb19e5-82e5-4a78-9747-dd32059707f5
14999
15047
  //# sourceMappingURL=cli.js.map