feat: export generateSbom and add sbom CLI command#472
Conversation
Review Summary by QodoExport generateSbom function and add sbom CLI command
WalkthroughsDescription• Export new generateSbom() function for local SBOM generation • Add sbom CLI command with manifest path and options • Support --output flag to write SBOM to file • Support --workspaceDir flag for monorepo lock file resolution • Add comprehensive test suite for SBOM generation Diagramflowchart LR
A["generateSbom Function"] -->|exported from| B["src/index.js"]
B -->|imported by| C["src/cli.js"]
C -->|implements| D["sbom CLI Command"]
D -->|supports| E["--output flag"]
D -->|supports| F["--workspaceDir flag"]
G["Test Suite"] -->|validates| A
File Changes1. src/index.js
|
Code Review by Qodo
|
43efad7 to
8c46ca3
Compare
|
/review |
|
Persistent review updated to latest commit 8c46ca3 |
Add public generateSbom(manifestPath, opts) function that generates a CycloneDX SBOM locally without backend HTTP requests. The function validates manifest readability upfront (consistent with stackAnalysis and componentAnalysis), delegates to the existing provider pipeline, and throws descriptive errors on failure. Add 'sbom' CLI command with --output flag to write SBOM JSON to file and --workspaceDir flag for monorepo lock file resolution. CLI handler includes structured error handling consistent with other commands. Comprehensive test suite covers pom.xml and package.json manifests, unsupported manifest error paths, SBOM structure validation, and missing purl detection. Implements TC-3993 Assisted-by: Claude Code
Summary
generateSbom(manifestPath, opts)function that generates a CycloneDX SBOM locally without backend HTTP requestssbomCLI command with--outputand--workspaceDiroptionsDetails
The
generateSbom()function validates manifest readability upfront(consistent with
stackAnalysis()andcomponentAnalysis()), delegatesto the existing provider pipeline via
generateOneSbom(), and throwsdescriptive errors on failure (unsupported manifest, missing purl, etc.).
The
sbomCLI command accepts a manifest path as a positional argument.--output/-owrites the SBOM JSON to a file instead of stdout.--workspaceDir/-wsets the workspace root for monorepo lock fileresolution. Error handling follows the same structured JSON pattern as
the
licensecommand.Implements TC-3993
Test plan
🤖 Generated with Claude Code