Skip to content

Commit 59676b2

Browse files
a-orenclaude
andcommitted
feat: expose package manager name in componentAnalysis result
Attach the matched provider's command name (e.g. pip, uv, poetry) as `packageManager` on the component analysis result so IDE consumers can display provider-specific instructions without re-implementing detection. Jira: TC-4336 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a8c3942 commit 59676b2

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ async function componentAnalysis(manifest, opts = {}) {
210210
fs.accessSync(manifest, fs.constants.R_OK)
211211
opts["manifest-type"] = path.basename(manifest)
212212
let provider = match(manifest, availableProviders, opts) // throws error if no matching provider
213-
return await analysis.requestComponent(provider, manifest, theUrl, opts) // throws error request sending failed
213+
const result = await analysis.requestComponent(provider, manifest, theUrl, opts) // throws error request sending failed
214+
if (typeof provider._cmdName === 'function') {
215+
result.packageManager = provider._cmdName()
216+
}
217+
return result
214218
}
215219

216220
/**

src/providers/python_pip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import Python_controller from './python_controller.js'
1515
import { getParser, getIgnoreQuery, getPinnedVersionQuery } from './requirements_parser.js'
1616

17-
export default { isSupported, validateLockFile, provideComponent, provideStack, readLicenseFromManifest }
17+
export default { isSupported, validateLockFile, provideComponent, provideStack, readLicenseFromManifest, _cmdName() { return 'pip' } }
1818

1919
/** @typedef {{name: string, version: string, dependencies: DependencyEntry[], hashes?: Array<{alg: string, content: string}>}} DependencyEntry */
2020

0 commit comments

Comments
 (0)