Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add monorepo workspace support with --sub-path and --workspace-... #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
dacoburn merged 1 commit into main from doug/add-workspace-support-in-monorepo
Sep 12, 2025

Conversation

@dacoburn
Copy link
Collaborator

@dacoburn dacoburn commented Sep 12, 2025

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

Reviewers

@barslev barslev barslev approved these changes

@bmeck bmeck Awaiting requested review from bmeck bmeck is a code owner automatically assigned from SocketDev/eng

@nolanlawson nolanlawson Awaiting requested review from nolanlawson nolanlawson is a code owner automatically assigned from SocketDev/eng

Assignees

No one assigned

Labels

Product Changelog New features for the public changelog

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /