@@ -25,7 +25,10 @@ import { runAgentInstall } from '../../utils/agent.mts'
2525import { getAlertsMapFromPurls } from '../../utils/alerts-map.mts'
2626
2727import type { FixOptions , InstallOptions } from './agent-fix.mts'
28- import type { NodeClass } from '../../shadow/npm/arborist/types.mts'
28+ import type {
29+ ArboristOptions ,
30+ NodeClass ,
31+ } from '../../shadow/npm/arborist/types.mts'
2932import type { CResult } from '../../types.mts'
3033import type { EnvDetails } from '../../utils/package-environment.mts'
3134import type { PackageJson } from '@socketsecurity/registry/lib/packages'
@@ -86,11 +89,17 @@ export async function npmFix(
8689 shorthands : npmConfigShorthands ,
8790 } )
8891 await config . load ( )
89- debugFn ( 'npm config:' , config )
92+
93+ const flatConfig = { __proto__ : null , ...config . flat } as ArboristOptions
94+ flatConfig . nodeVersion = constants . NODE_VERSION
95+ flatConfig . npmVersion = pkgEnvDetails . agentVersion . toString ( )
96+ flatConfig . npmCommand = 'install'
97+ debugFn ( 'npm config:' , flatConfig )
98+
9099 const arb = new Arborist ( {
91100 path : pkgEnvDetails . pkgPath ,
101+ ...flatConfig ,
92102 ...SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES ,
93- config,
94103 } )
95104 actualTree = await arb . reify ( )
96105 // Calling arb.reify() creates the arb.diff object, nulls-out arb.idealTree,
0 commit comments