feat: support JS/TS monorepo workspace batch analysis#423
feat: support JS/TS monorepo workspace batch analysis#423ruromero merged 6 commits intoguacsec:mainfrom
Conversation
Review Summary by QodoAdd monorepo workspace batch analysis with concurrent SBOM generation
WalkthroughsDescription• Add stackAnalysisBatch() API for workspace-level batch stack analysis - Discovers JS/TS workspace packages from pnpm-workspace.yaml and package.json workspaces - Discovers Cargo workspace crates via cargo metadata - Generates SBOMs in parallel with configurable concurrency (default 10) • Support workspaceDir option to locate lock files at workspace root - Enables monorepo analysis where lock file is separate from manifest - Propagates through provider matching and validation • Add CLI stack-batch command with options for concurrency, discovery ignores, metadata, and fail-fast modes • Implement robust workspace discovery with negation pattern handling and configurable ignore globs Diagramflowchart LR
A["Workspace Root"] -->|detect ecosystem| B["Cargo or JS/TS"]
B -->|discover manifests| C["Manifest Paths"]
C -->|validate JS packages| D["Valid Manifests"]
D -->|generate SBOMs| E["SBOM Map"]
E -->|batch request| F["Backend Analysis"]
F -->|optional metadata| G["Analysis + Metadata"]
File Changes1. src/analysis.js
|
Code Review by Qodo
1.
|
Signed-off-by: Ruben Romero Montes <rromerom@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com> Implements TC-3862
…aintainability - Replace hand-rolled pnpm-workspace.yaml parser with js-yaml - Fix negation pattern handling in workspace discovery (e.g. !**/test/**) - Refactor stackAnalysisBatch into focused helpers, eliminating duplicated SBOM generation logic between fail-fast and continue-on-error paths - Add integration tests for stackAnalysisBatch with mocked providers and HTTP backend Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Implements TC-3862
- Make generateOneSbom async and await provider.provideStack() to support async providers (e.g. python_pip) - Propagate workspaceDir as cwd for package manager commands so npm/pnpm/yarn run from workspace root in monorepos - Fix CLI --html --metadata printing wrapper object instead of HTML string Implements TC-3862 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
efc1054 to
01b45a5
Compare
Remove the opts.workspaceDir fallback pattern and use only the TRUSTIFY_DA_WORKSPACE_DIR key through getCustom(), keeping the existing single-convention pattern for option propagation. TC-3862 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use named import for js-yaml load function and fix import ordering in stack_analysis_batch.test.js. TC-3862 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
stackAnalysisBatch()API for workspace-level batch stack analysispnpm-workspace.yamlandpackage.jsonworkspacesworkspaceDirso sub-packages find the root lock filestack-batchcommand with--concurrency,--ignore,--metadata,--fail-fastoptionsRelated
Implements TC-3862
Parent feature: TC-3767
Test plan
🤖 Generated with Claude Code