@@ -5,7 +5,7 @@ import semver from 'semver'
55
66import { getManifestData } from '@socketsecurity/registry'
77import { arrayUnique } from '@socketsecurity/registry/lib/arrays'
8- import { debugFn , isDebug } from '@socketsecurity/registry/lib/debug'
8+ import { debugDir , debugFn , isDebug } from '@socketsecurity/registry/lib/debug'
99import { logger } from '@socketsecurity/registry/lib/logger'
1010import { runNpmScript } from '@socketsecurity/registry/lib/npm'
1111import {
@@ -134,15 +134,15 @@ export async function agentFix(
134134 spinner ?. stop ( )
135135 logger . info ( 'No fixable vulns found.' )
136136 if ( alertsMap . size ) {
137- debugFn ( 'inspect: ' , { alertsMap } )
137+ debugDir ( 'inspect' , { alertsMap } )
138138 } else {
139- debugFn ( 'inspect: { alertsMap: Map(0) {} }' )
139+ debugFn ( 'inspect' , ' { alertsMap: Map(0) {} }')
140140 }
141141 return { ok : true , data : { fixed : false } }
142142 }
143143
144- if ( isDebug ( ) ) {
145- debugFn ( 'found: cves for' , Array . from ( infoByPartialPurl . keys ( ) ) )
144+ if ( isDebug ( 'notice' ) ) {
145+ debugFn ( 'notice' , ' found: cves for', Array . from ( infoByPartialPurl . keys ( ) ) )
146146 }
147147
148148 // Lazily access constants.packumentCache.
@@ -198,7 +198,7 @@ export async function agentFix(
198198 spinner ?. indent ( )
199199
200200 if ( getManifestData ( partialPurlObj . type , name ) ) {
201- debugFn ( `found: Socket Optimize variant for ${ name } ` )
201+ debugFn ( 'notice' , `found: Socket Optimize variant for ${ name } ` )
202202 }
203203 // eslint-disable-next-line no-await-in-loop
204204 const packument = await fetchPackagePackument ( name )
@@ -266,7 +266,7 @@ export async function agentFix(
266266 )
267267
268268 if ( ! oldVersions . length ) {
269- debugFn ( `skip: ${ name } not found\n` )
269+ debugFn ( 'notice' , `skip: ${ name } not found\n` )
270270 // Skip to next package.
271271 cleanupInfoEntriesLoop ( )
272272 continue infoEntriesLoop
@@ -283,7 +283,7 @@ export async function agentFix(
283283 let hasAnnouncedWorkspace = false
284284 let workspaceLogCallCount = logger . logCallCount
285285 if ( isDebug ( ) ) {
286- debugFn ( `check: workspace ${ workspace } ` )
286+ debugFn ( 'notice' , `check: workspace ${ workspace } ` )
287287 hasAnnouncedWorkspace = true
288288 workspaceLogCallCount = logger . logCallCount
289289 }
@@ -294,7 +294,7 @@ export async function agentFix(
294294
295295 const node = findPackageNode ( actualTree , name , oldVersion )
296296 if ( ! node ) {
297- debugFn ( `skip: ${ oldId } not found` )
297+ debugFn ( 'notice' , `skip: ${ oldId } not found` )
298298 continue oldVersionsLoop
299299 }
300300 infosLoop: for ( const {
@@ -319,7 +319,7 @@ export async function agentFix(
319319 continue infosLoop
320320 }
321321 if ( semver . gte ( oldVersion , newVersion ) ) {
322- debugFn ( `skip: ${ oldId } is >= ${ newVersion } ` )
322+ debugFn ( 'notice' , `skip: ${ oldId } is >= ${ newVersion } ` )
323323 continue infosLoop
324324 }
325325 if (
@@ -328,7 +328,7 @@ export async function agentFix(
328328 b . workspace === branchWorkspace && b . newVersion === newVersion ,
329329 )
330330 ) {
331- debugFn ( `skip: open PR found for ${ name } @${ newVersion } ` )
331+ debugFn ( 'notice' , `skip: open PR found for ${ name } @${ newVersion } ` )
332332 if ( ++ count >= limit ) {
333333 cleanupInfoEntriesLoop ( )
334334 break infoEntriesLoop
@@ -366,7 +366,7 @@ export async function agentFix(
366366 )
367367 // eslint-disable-next-line no-await-in-loop
368368 if ( ! ( await editablePkgJson . save ( { ignoreWhitespace : true } ) ) ) {
369- debugFn ( `skip: ${ workspace } /package.json unchanged` )
369+ debugFn ( 'notice' , `skip: ${ workspace } /package.json unchanged` )
370370 // Reset things just in case.
371371 if ( ciEnv ) {
372372 // eslint-disable-next-line no-await-in-loop
@@ -461,12 +461,12 @@ export async function agentFix(
461461 )
462462 ) {
463463 skipPr = true
464- debugFn ( `skip: branch "${ branch } " exists` )
464+ debugFn ( 'notice' , `skip: branch "${ branch } " exists` )
465465 }
466466 // eslint-disable-next-line no-await-in-loop
467467 else if ( await gitRemoteBranchExists ( branch , cwd ) ) {
468468 skipPr = true
469- debugFn ( `skip: remote branch "${ branch } " exists` )
469+ debugFn ( 'notice' , `skip: remote branch "${ branch } " exists` )
470470 } else if (
471471 // eslint-disable-next-line no-await-in-loop
472472 ! ( await gitCreateAndPushBranch (
@@ -613,8 +613,7 @@ export async function agentFix(
613613 cause : `Update failed for ${ oldId } in ${ workspace } ${ error ? '; ' + error : '' } ` ,
614614 }
615615 }
616- debugFn ( 'name:' , name )
617- debugFn ( 'increment: count' , count + 1 )
616+ debugFn ( 'notice' , 'increment: count' , count + 1 )
618617 if ( ++ count >= limit ) {
619618 cleanupInfoEntriesLoop ( )
620619 break infoEntriesLoop
0 commit comments