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
Updated readme and updated sdk requirements (#121)
* Updated readme and updated sdk requirements
* feat: enhance monorepo support with multiple --sub-path options
- Add support for multiple --sub-path arguments to scan different directories within a single workspace
- Require --workspace-name when using --sub-path for proper workspace identification
- Optimize base_paths parameter to pass target_path for simplified SDK integration
- Update argument validation to enforce sub_paths and workspace_name pairing
- Add comprehensive README documentation with monorepo examples and usage patterns
- Include GitHub Actions workflow examples for monorepo CI/CD scenarios
- Extend parameter table with detailed descriptions of new CLI options
This enhancement enables scanning multiple directories (e.g., frontend, backend, services/api)
as a single workspace while preserving git context from the repository root, making it ideal
for organizations with monorepo structures.
Copy file name to clipboardExpand all lines: README.md
+63-15Lines changed: 63 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,15 +41,60 @@ Pre-configured workflow examples are available in the [`workflows/`](workflows/)
41
41
42
42
These examples are production-ready and include best practices for each platform.
43
43
44
+
## Monorepo Workspace Support
45
+
46
+
The Socket CLI supports scanning specific workspaces within monorepo structures while preserving git context from the repository root. This is useful for organizations that maintain multiple applications or services in a single repository.
47
+
48
+
### Key Features
49
+
50
+
-**Multiple Sub-paths**: Specify multiple `--sub-path` options to scan different directories within your monorepo
51
+
-**Combined Workspace**: All sub-paths are scanned together as a single workspace in Socket
52
+
-**Git Context Preserved**: Repository metadata (commits, branches, etc.) comes from the main target-path
53
+
-**Workspace Naming**: Use `--workspace-name` to differentiate scans from different parts of your monorepo
54
+
55
+
### Usage Examples
56
+
57
+
**Scan multiple frontend and backend workspaces:**
58
+
```bash
59
+
socketcli --target-path /path/to/monorepo \
60
+
--sub-path frontend \
61
+
--sub-path backend \
62
+
--sub-path services/api \
63
+
--workspace-name main-app
64
+
```
65
+
66
+
**GitHub Actions for monorepo workspace:**
67
+
```bash
68
+
socketcli --target-path $GITHUB_WORKSPACE \
69
+
--sub-path packages/web \
70
+
--sub-path packages/mobile \
71
+
--workspace-name mobile-web \
72
+
--scm github \
73
+
--pr-number $PR_NUMBER
74
+
```
75
+
76
+
This will:
77
+
- Scan manifest files in `./packages/web/` and `./packages/mobile/`
78
+
- Combine them into a single workspace scan
79
+
- Create a repository in Socket named like `my-repo-mobile-web`
80
+
- Preserve git context (commits, branch info) from the repository root
81
+
82
+
### Requirements
83
+
84
+
- Both `--sub-path` and `--workspace-name` must be specified together
85
+
-`--sub-path` can be used multiple times to include multiple directories
86
+
- All specified sub-paths must exist within the target-path
| --files | False | *auto* | Files to analyze (JSON array string). Auto-detected from git commit changes when not specified |
87
-
| --excluded-ecosystems | False | [] | List of ecosystems to exclude from analysis (JSON array string). You can get supported files from the [Supported Files API](https://docs.socket.dev/reference/getsupportedfiles) |
88
131
| --license-file-name | False | `license_output.json` | Name of the file to save the license details to if enabled |
89
132
| --save-submitted-files-list | False | | Save list of submitted file names to JSON file for debugging purposes |
90
133
| --save-manifest-tar | False | | Save all manifest files to a compressed tar.gz archive with original directory structure |
134
+
| --files | False | *auto* | Files to analyze (JSON array string). Auto-detected from git commit changes when not specified |
135
+
| --sub-path | False | | Sub-path within target-path for manifest file scanning (can be specified multiple times). All sub-paths are combined into a single workspace scan while preserving git context from target-path. Must be used with --workspace-name |
136
+
| --workspace-name | False | | Workspace name suffix to append to repository name (repo-name-workspace_name). Must be used with --sub-path |
137
+
| --excluded-ecosystems | False | [] | List of ecosystems to exclude from analysis (JSON array string). You can get supported files from the [Supported Files API](https://docs.socket.dev/reference/getsupportedfiles) |
help="Sub-path within target-path for manifest file scanning (while preserving git context from target-path)"
304
+
action="append",
305
+
help="Sub-path within target-path for manifest file scanning (can be specified multiple times). All sub-paths will be combined into a single workspace scan while preserving git context from target-path"
0 commit comments