You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support JS/TS monorepo workspace batch analysis (#423)
* feat: allow monorepo lock files using workspaceDir
Signed-off-by: Ruben Romero Montes <rromerom@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Implements TC-3862
* refactor: improve workspace discovery robustness and batch analysis maintainability
- 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
* fix: address qodo review findings for batch analysis
- 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>
* refactor: use TRUSTIFY_DA_WORKSPACE_DIR convention consistently
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>
* fix: resolve eslint warnings in workspace.js and batch test
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>
---------
Signed-off-by: Ruben Romero Montes <rromerom@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@@ -404,6 +436,21 @@ let imageAnalysisWithArch = await client.imageAnalysis(['httpd:2.4.49^^amd64'],
404
436
**_Environment variables takes precedence._**
405
437
</p>
406
438
439
+
<h4>Monorepo / Workspace Support</h4>
440
+
<p>
441
+
For monorepos (Cargo workspaces, npm/pnpm/yarn workspaces) where the lock file lives at the workspace root rather than next to the manifest, pass the workspace root via <code>workspaceDir</code> or <code>TRUSTIFY_DA_WORKSPACE_DIR</code>:
442
+
</p>
443
+
<ul>
444
+
<li><strong>Cargo:</strong> When set, the client checks only the given directory for<code>Cargo.lock</code> instead of walking up from the manifest.</li>
445
+
<li><strong>JavaScript (npm, pnpm, yarn):</strong> When set, the client looks for the lock file (<code>package-lock.json</code>, <code>pnpm-lock.yaml</code>, <code>yarn.lock</code>) at the workspace root.</li>
446
+
</ul>
447
+
<p>
448
+
Use <code>stackAnalysisBatch(workspaceRoot, html, opts)</code> to analyze all packages/crates in a workspace in one request. Supports Cargo workspaces and JS/TS workspaces (pnpm, npm, yarn). Optional <code>batchConcurrency</code> (or <code>TRUSTIFY_DA_BATCH_CONCURRENCY</code>) limits parallel SBOM generation (default 10). For JS/TS, each <code>package.json</code> must have non-empty <code>name</code> and <code>version</code>; invalid manifests are skipped (warnings). Per-manifest SBOM failures are skipped if at least one SBOM succeeds (unless <code>continueOnError: false</code>). Set <code>batchMetadata: true</code> (or <code>TRUSTIFY_DA_BATCH_METADATA</code>) to receive <code>{ analysis, metadata }</code> with <code>errors[]</code>. CLI: <code>stack-batch --metadata</code>, <code>--fail-fast</code>. See <a href="./docs/monorepo-implementation-plan.md">monorepo implementation plan</a> §2.3 and §3.5.
449
+
</p>
450
+
<p>
451
+
See <a href="./docs/vscode-extension-integration-requirements.md">VS Code Extension Integration Requirements</a>for integration details.
452
+
</p>
453
+
407
454
<h4>Proxy Configuration</h4>
408
455
<p>
409
456
You can configure a proxy for all HTTP/HTTPS requests made by the API. This is useful when your environment requires going through a proxy to access external services.
@@ -508,6 +555,11 @@ following keys for setting custom paths for the said executables.
0 commit comments