Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dacoburn
Copy link
Collaborator

This PR adds monorepo workspace support to the Socket CLI by introducing two new command-line options: --sub-path and --workspace-name. These options enable users to scan specific subdirectories within a monorepo while preserving the git context from the main repository root and organizing scans with distinct workspace names in Socket.

Why?

Many organizations use monorepo structures where multiple applications or services live in subdirectories, each with their own manifest files (package.json, requirements.txt, etc.). Previously, the Socket CLI would either:

  1. Scan the entire repository from the root (potentially missing subdirectory manifests)
  2. Lose git context when run from within a subdirectory

This feature solves both problems by:

  • Allowing users to specify a subdirectory path for manifest scanning while maintaining git repository context from the root
  • Enabling workspace-specific repository naming in Socket to organize and differentiate scans from different parts of the monorepo
  • Supporting CI/CD workflows that need to scan specific workspaces within larger repositories
  • Maintaining proper commit, branch, and repository metadata for accurate diff analysis

The two options must be used together to ensure proper workspace organization and prevent configuration errors.

Public Changelog

Added monorepo workspace support with --sub-path and --workspace-name options. Users can now scan specific subdirectories within a repository while preserving git context and organizing results with workspace-specific naming in Socket. Both options are required together for proper workspace configuration.

…name

- Add --sub-path option to scan manifest files in a subdirectory while preserving git context from target-path
- Add --workspace-name option to append suffix to repository name (repo-name-workspace_name)
- Require both options to be used together with validation
- Update scanning logic to use combined target_path + sub_path for manifest file detection
- Modify repository naming to include workspace suffix when provided
- Preserve git repository context (commits, branches, etc.) from main target-path
- Enable Socket CLI to work with monorepo structures where manifests are in subdirectories

This allows users to scan specific workspaces within a monorepo while maintaining proper git context and
@dacoburn dacoburn requested a review from a team as a code owner September 12, 2025 04:20
@dacoburn dacoburn requested review from bmeck and nolanlawson and removed request for a team September 12, 2025 04:20
@dacoburn dacoburn added the Product Changelog New features for the public changelog label Sep 12, 2025
Copy link

🚀 Preview package published!

Install with:

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==2.2.9.dev1

Docker image: socketdev/cli:pr-120

@dacoburn dacoburn merged commit 40fc69e into main Sep 12, 2025
6 checks passed
@dacoburn dacoburn deleted the doug/add-workspace-support-in-monorepo branch September 12, 2025 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product Changelog New features for the public changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants