@mobb.ai/cli 0.0.1 → 1.4.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.env +10 -0
  2. package/LICENSE +21 -0
  3. package/README.md +216 -0
  4. package/bin/cli.mjs +2 -0
  5. package/dist/args/commands/upload_ai_blame.d.mts +164 -0
  6. package/dist/args/commands/upload_ai_blame.mjs +6614 -0
  7. package/dist/hash_search/index.d.mts +10 -0
  8. package/dist/hash_search/index.mjs +112 -0
  9. package/dist/index.d.mts +2 -0
  10. package/dist/index.mjs +29052 -0
  11. package/package.json +164 -5
  12. package/src/features/codeium_intellij/proto/buf/validate/validate.proto +504 -0
  13. package/src/features/codeium_intellij/proto/exa/auto_cascade_common_pb/auto_cascade_common.proto +81 -0
  14. package/src/features/codeium_intellij/proto/exa/bug_checker_pb/bug_checker.proto +24 -0
  15. package/src/features/codeium_intellij/proto/exa/cascade_plugins_pb/cascade_plugins.proto +108 -0
  16. package/src/features/codeium_intellij/proto/exa/chat_client_server_pb/chat_client_server.proto +56 -0
  17. package/src/features/codeium_intellij/proto/exa/chat_pb/chat.proto +457 -0
  18. package/src/features/codeium_intellij/proto/exa/code_edit/code_edit_pb/code_edit.proto +191 -0
  19. package/src/features/codeium_intellij/proto/exa/codeium_common_pb/codeium_common.proto +3783 -0
  20. package/src/features/codeium_intellij/proto/exa/context_module_pb/context_module.proto +172 -0
  21. package/src/features/codeium_intellij/proto/exa/cortex_pb/cortex.proto +3604 -0
  22. package/src/features/codeium_intellij/proto/exa/diff_action_pb/diff_action.proto +73 -0
  23. package/src/features/codeium_intellij/proto/exa/extension_server_pb/extension_server.proto +565 -0
  24. package/src/features/codeium_intellij/proto/exa/index_pb/index.proto +474 -0
  25. package/src/features/codeium_intellij/proto/exa/knowledge_base_pb/knowledge_base.proto +149 -0
  26. package/src/features/codeium_intellij/proto/exa/language_server_pb/language_server.proto +2504 -0
  27. package/src/features/codeium_intellij/proto/exa/opensearch_clients_pb/opensearch_clients.proto +505 -0
  28. package/src/features/codeium_intellij/proto/exa/product_analytics_pb/product_analytics.proto +31 -0
  29. package/src/features/codeium_intellij/proto/exa/reactive_component_pb/reactive_component.proto +104 -0
  30. package/src/features/codeium_intellij/proto/exa/seat_management_pb/seat_management.proto +2349 -0
  31. package/src/post_install/binary.mjs +89 -0
  32. package/src/post_install/constants.mjs +2 -0
  33. package/src/post_install/cx_install.mjs +72 -0
package/.env ADDED
@@ -0,0 +1,10 @@
1
+ # production@v21
2
+ API_URL="https://api.mobb.ai/v1/graphql"
3
+ WEB_APP_URL="https://app.mobb.ai"
4
+ GITLAB_API_TOKEN=""
5
+ GITHUB_API_TOKEN=""
6
+ ADO_TEST_ACCESS_TOKEN=""
7
+ HASURA_ACCESS_KEY=""
8
+ LOCAL_GRAPHQL_ENDPOINT=""
9
+ GIT_PROXY_HOST="http://tinyproxy:8888"
10
+ DD_RUM_TOKEN="pubf59c0182545bfb4c299175119f1abf9b"
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mobb.dev Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,216 @@
1
+ # Bugsy
2
+
3
+ Bugsy is a command-line interface (CLI) tool that provides automatic security vulnerability remediation for your code. It is the community edition version of [Mobb](https://mobb.ai), the first vendor-agnostic automated security vulnerability remediation tool. Bugsy is designed to help developers quickly identify and fix security vulnerabilities in their code.
4
+
5
+ <img width="1888" alt="Bugsy" src="./img/bugsy2.png">
6
+
7
+ ## What is [Mobb](https://mobb.ai)?
8
+
9
+ [Mobb](https://mobb.ai) is the first vendor-agnostic automatic security vulnerability remediation tool. It ingests SAST results from Checkmarx, CodeQL (GitHub Advanced Security), OpenText Fortify, and Snyk and produces code fixes for developers to review and commit to their code.
10
+
11
+ ## What does Bugsy do?
12
+
13
+ Bugsy has two modes - Scan (no SAST report needed) & Analyze (the user needs to provide a pre-generated SAST report from one of the supported SAST tools).
14
+
15
+ Scan
16
+
17
+ - Uses Checkmarx or Snyk CLI tools to run a SAST scan on a given open-source GitHub/GitLab/ADO repo
18
+ - Analyzes the vulnerability report to identify issues that can be remediated automatically
19
+ - Produces the code fixes and redirects the user to the fix report page on the Mobb platform
20
+
21
+ Analyze
22
+
23
+ - Analyzes the a Checkmarx/CodeQL/Fortify/Snyk vulnerability report to identify issues that can be remediated automatically
24
+ - Produces the code fixes and redirects the user to the fix report page on the Mobb platform
25
+
26
+ ## Disclaimer
27
+
28
+ This is a community edition version that only analyzes public GitHub repositories. Analyzing private repositories is allowed for a limited amount of time.
29
+ Bugsy does not detect any vulnerabilities in your code, it uses findings detected by the SAST tools mentioned above.
30
+
31
+ ## Usage
32
+
33
+ ### Command Line Interface
34
+
35
+ You can simply run Bugsy from the command line, using npx:
36
+
37
+ ```shell
38
+ npx mobbdev
39
+ ```
40
+
41
+ This will show you Bugsy's usage help:
42
+
43
+ ```shell
44
+ Bugsy - Trusted, Automatic Vulnerability Fixer 🕵️‍♂️
45
+
46
+ Usage:
47
+ mobbdev <command> [options]
48
+
49
+
50
+ Commands:
51
+ mobbdev scan Scan your code for vulnerabilities, get automated fixes right away.
52
+ mobbdev analyze Provide a vulnerability report and relevant code repository, get automated fixes right away.
53
+
54
+ Options:
55
+ -h, --help Show help [boolean]
56
+
57
+ Examples:
58
+ mobbdev scan -r https://github.com/WebGoat/WebGoat Scan an existing repository
59
+
60
+ Made with ❤️ by Mobb
61
+ ```
62
+
63
+ To run a new SAST scan on a repo and get fixes, run the **Bugsy Scan** command. Example:
64
+
65
+ ```shell
66
+ npx mobbdev scan --repo https://github.com/mobb-dev/simple-vulnerable-java-project
67
+ ```
68
+
69
+ To get fixes for a pre-generated SAST report, run the **Bugsy Analyze** command. Example:
70
+ npx mobbdev analyze --scan-file sast_results.json --repo https://github.com/mobb-dev/simple-vulnerable-java-project
71
+
72
+ Bugsy will automatically generate a fix for each supported vulnerability identified in the results, and refer the developer to review and commit the fixes to their code.
73
+
74
+ To see all the options Bugsy allows, use the Scan or Analyze commands with the -h option:
75
+
76
+ ```shell
77
+ npx mobbdev scan -h
78
+ npx mobbdev analyze -h
79
+ ```
80
+
81
+ ### Model Context Protocol (MCP) Server
82
+
83
+ Bugsy can also be used as an MCP server, allowing AI assistants like Claude to automatically scan and fix vulnerabilities in your code repositories.
84
+
85
+ #### Prerequisites
86
+
87
+ 1. **API Key**: You need a Mobb API key to use the MCP server functionality
88
+ - Sign up at [mobb.ai](https://app.mobb.ai) to get your API key
89
+ - Set the `API_KEY` environment variable: `export API_KEY=your_api_key_here`
90
+
91
+ 2. **Local Git Repository**: The MCP server analyzes git repositories with uncommitted changes
92
+ - Make sure your code is in a local git repository
93
+ - Have some modified, added, or staged files to analyze
94
+
95
+ #### Installation
96
+
97
+ Run mobb-mcp from command line:
98
+
99
+ ```shell
100
+ npx mobbdev mcp
101
+ ```
102
+
103
+ #### Configuration
104
+
105
+ Add Mobb MCP to your Cursor MCP client configuration:
106
+ `API_URL` is only required if you are not using https://app.mobb.ai
107
+
108
+ ```json
109
+ {
110
+ "mcpServers": {
111
+ "mobb-mcp": {
112
+ "command": "npx",
113
+ "args": ["mobbdev", "mcp"],
114
+ "env": {
115
+ "API_KEY": "your_mobb_api_key_here",
116
+ "API_URL": "optional__your_mobb_api_url_here",
117
+ "MVS_AUTO_FIX": "true"
118
+ }
119
+ }
120
+ }
121
+ }
122
+ ```
123
+
124
+ **Environment Variables:**
125
+ - `API_KEY`: Your Mobb API key (required)
126
+ - `API_URL`: Custom Mobb API URL (optional, defaults to https://app.mobb.ai)
127
+ - `MVS_AUTO_FIX`: Override auto-fix setting - set to `"true"` or `"false"` to force enable/disable automatic fix application regardless of user's database setting (optional)
128
+
129
+ #### Usage
130
+
131
+ Once configured, you can use the MCP server through your AI assistant:
132
+
133
+ 1. **Ask Claude to scan for vulnerabilities**:
134
+ ```
135
+ run a scan with mobb-mcp
136
+ ```
137
+ or
138
+ ```
139
+ run fix-vulnerabilities mcp tool
140
+ ```
141
+
142
+ 2. **The MCP server will**:
143
+ - Validate the repository path
144
+ - Check for git changes (modified, added, or staged files)
145
+ - Upload the changed files for analysis
146
+ - Generate automated fixes for detected vulnerabilities
147
+ - Return detailed fix recommendations
148
+
149
+ #### Available MCP Tools
150
+
151
+ - **`fix_vulnerabilities`**: Scans the current code changes and returns fixes for potential vulnerabilities
152
+ - **Parameter**: `path` (string) - The path to the local git repository
153
+ - **Returns**: Detailed vulnerability fixes with code patches and explanations
154
+
155
+ #### Example MCP Workflow
156
+
157
+ 1. Make changes to your code
158
+ 2. Stage or modify files in git
159
+ 3. Ask your AI assistant: "Can you check my code for security vulnerabilities?"
160
+ 4. The assistant will use the MCP server to analyze your changes
161
+ 5. Receive detailed fix recommendations with code patches
162
+
163
+ #### Troubleshooting
164
+
165
+ - **"API_KEY environment variable is not set"**: Make sure you've set your Mobb API key
166
+ - **"Path is not a valid git repository"**: Ensure you're pointing to a valid git repository
167
+ - **"No changed files found"**: Make sure you have modified, added, or staged files in your repository
168
+
169
+ ## Using Bugsy as part of a CI/CD pipeline
170
+
171
+ If you utilize SAST scans as part of the CI/CD pipeline, Bugsy can be easiy added and provide immediate fix for every issue detected.
172
+ Here is a simple example of a command line that will run Bugsy in your pipeline:
173
+
174
+ ```shell
175
+ npx mobbdev analyze --ci --scan-file $SAST_RESULTS_FILENAME --repo $CI_PROJECT_URL --ref $CI_COMMIT_REF_NAME --api-key $MOBB_API_KEY
176
+ ```
177
+
178
+ ### Polling Mode
179
+
180
+ By default, Bugsy uses WebSocket connections for real-time status updates during analysis. However, some proxy environments or firewalls may block WebSocket connections. In these cases, you can use the `--polling` flag to use HTTP polling instead:
181
+
182
+ ```shell
183
+ npx mobbdev analyze --scan-file report.json --repo https://github.com/org/repo --polling
184
+ ```
185
+
186
+ **When to use `--polling`:**
187
+ - Your network blocks WebSocket connections (ws:// or wss://)
188
+ - You're behind a corporate proxy that doesn't support WebSocket
189
+ - You experience connection timeouts with the default WebSocket mode
190
+
191
+ **Polling characteristics:**
192
+ - Polling interval: 5 seconds
193
+ - Timeout: 30 minutes
194
+ - Slightly higher latency compared to WebSocket mode, but works in restricted environments
195
+
196
+ ## Contribution
197
+
198
+ Install the dependencies and run the tests:
199
+
200
+ ```shell
201
+ pnpm install
202
+
203
+ # or use npm run build:dev to watch for changes
204
+ pnpm run build
205
+
206
+ # or use npm test:watch to watch for changes
207
+ pnpm run test
208
+ ```
209
+
210
+ ### Debugging
211
+
212
+ If you're using VSCode, you can use the `launch.json` file to debug the code. Run the `CLI tests` configuration to continuously run and debug the tests.
213
+
214
+ ## Getting support
215
+
216
+ If you need support using Bugsy or just want to share your thoughts and learn more, you are more than welcome to join our [discord server](https://bit.ly/Mobb-discord)
package/bin/cli.mjs ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../dist/index.mjs'
@@ -0,0 +1,164 @@
1
+ import * as Yargs from 'yargs';
2
+ import z from 'zod';
3
+
4
+ declare enum AiBlameInferenceType {
5
+ Chat = "CHAT",
6
+ HumanEdit = "HUMAN_EDIT",
7
+ TabAutocomplete = "TAB_AUTOCOMPLETE"
8
+ }
9
+
10
+ type SanitizationCounts = {
11
+ detections: {
12
+ total: number;
13
+ high: number;
14
+ medium: number;
15
+ low: number;
16
+ };
17
+ };
18
+
19
+ type Logger = {
20
+ info: (msg: string, data?: unknown) => void;
21
+ error: (msg: string, data?: unknown) => void;
22
+ };
23
+ declare const PromptItemZ: z.ZodObject<{
24
+ type: z.ZodEnum<{
25
+ USER_PROMPT: "USER_PROMPT";
26
+ AI_RESPONSE: "AI_RESPONSE";
27
+ TOOL_EXECUTION: "TOOL_EXECUTION";
28
+ AI_THINKING: "AI_THINKING";
29
+ MCP_TOOL_CALL: "MCP_TOOL_CALL";
30
+ }>;
31
+ attachedFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
32
+ relativePath: z.ZodString;
33
+ startLine: z.ZodOptional<z.ZodNumber>;
34
+ }, z.core.$strip>>>;
35
+ tokens: z.ZodOptional<z.ZodObject<{
36
+ inputCount: z.ZodNumber;
37
+ outputCount: z.ZodNumber;
38
+ }, z.core.$strip>>;
39
+ text: z.ZodOptional<z.ZodString>;
40
+ date: z.ZodOptional<z.ZodDate>;
41
+ tool: z.ZodOptional<z.ZodObject<{
42
+ name: z.ZodString;
43
+ parameters: z.ZodString;
44
+ result: z.ZodString;
45
+ rawArguments: z.ZodOptional<z.ZodString>;
46
+ accepted: z.ZodOptional<z.ZodBoolean>;
47
+ mcpServer: z.ZodOptional<z.ZodString>;
48
+ mcpToolName: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strip>>;
50
+ }, z.core.$strip>;
51
+ type PromptItem = z.infer<typeof PromptItemZ>;
52
+ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
53
+ type: z.ZodEnum<{
54
+ USER_PROMPT: "USER_PROMPT";
55
+ AI_RESPONSE: "AI_RESPONSE";
56
+ TOOL_EXECUTION: "TOOL_EXECUTION";
57
+ AI_THINKING: "AI_THINKING";
58
+ MCP_TOOL_CALL: "MCP_TOOL_CALL";
59
+ }>;
60
+ attachedFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
61
+ relativePath: z.ZodString;
62
+ startLine: z.ZodOptional<z.ZodNumber>;
63
+ }, z.core.$strip>>>;
64
+ tokens: z.ZodOptional<z.ZodObject<{
65
+ inputCount: z.ZodNumber;
66
+ outputCount: z.ZodNumber;
67
+ }, z.core.$strip>>;
68
+ text: z.ZodOptional<z.ZodString>;
69
+ date: z.ZodOptional<z.ZodDate>;
70
+ tool: z.ZodOptional<z.ZodObject<{
71
+ name: z.ZodString;
72
+ parameters: z.ZodString;
73
+ result: z.ZodString;
74
+ rawArguments: z.ZodOptional<z.ZodString>;
75
+ accepted: z.ZodOptional<z.ZodBoolean>;
76
+ mcpServer: z.ZodOptional<z.ZodString>;
77
+ mcpToolName: z.ZodOptional<z.ZodString>;
78
+ }, z.core.$strip>>;
79
+ }, z.core.$strip>>;
80
+ type PromptItemArray = z.infer<typeof PromptItemArrayZ>;
81
+ type RepoState = {
82
+ repositoryUrl: string | null;
83
+ branch: string | null;
84
+ commitSha: string | null;
85
+ };
86
+ /**
87
+ * Reads git state for tracy event attribution: repo URL, current branch, and
88
+ * HEAD commit SHA. Each field is read fresh — no caching across calls. Detached
89
+ * HEAD (rebase, bisect) returns `branch: null` rather than the literal string
90
+ * "HEAD" that `git rev-parse --abbrev-ref HEAD` would produce.
91
+ *
92
+ * Both the CLI daemon and the VS Code extension flow through the shared
93
+ * `GitService.getCurrentRepoState()` so detached-HEAD handling and SHA
94
+ * normalization stay in lockstep across the two clients.
95
+ *
96
+ * The repository URL is the canonical form (parseScmURL().canonicalUrl) for any
97
+ * SCM host, including self-hosted / enterprise remotes (scmType "Unknown"); only
98
+ * an absent or genuinely unparseable remote resolves to `repositoryUrl: null`.
99
+ *
100
+ * Never throws — a non-existent dir, missing git binary, or absent/unparseable
101
+ * remote resolves to null so the daemon hot path can rely on a value.
102
+ */
103
+ declare function readRepoState(workingDir?: string): Promise<RepoState>;
104
+ /**
105
+ * Gets the canonical remote repository URL for the working directory's repo, for
106
+ * any SCM host (GitHub, GitLab, Azure DevOps, Bitbucket, and self-hosted /
107
+ * enterprise). Returns null when there is no remote or it can't be parsed.
108
+ */
109
+ declare function getRepositoryUrl(workingDir?: string): Promise<string | null>;
110
+ /**
111
+ * Get system information for tracking inference source.
112
+ * Works cross-platform (Windows, macOS, Linux).
113
+ * Handles errors gracefully for containerized environments where user info may not be available.
114
+ */
115
+ declare function getSystemInfo(): {
116
+ computerName: string;
117
+ userName: string | undefined;
118
+ };
119
+ type UploadAiBlameOptions = {
120
+ prompt: string[];
121
+ inference: string[];
122
+ aiResponseAt?: string[];
123
+ model?: string[];
124
+ toolName?: string[];
125
+ blameType?: AiBlameInferenceType[];
126
+ sessionId?: string[];
127
+ 'ai-response-at'?: string[];
128
+ 'tool-name'?: string[];
129
+ 'blame-type'?: AiBlameInferenceType[];
130
+ 'session-id'?: string[];
131
+ };
132
+ declare function uploadAiBlameBuilder(args: Yargs.Argv<unknown>): Yargs.Argv<UploadAiBlameOptions>;
133
+ type UploadAiBlameResult = {
134
+ promptsCounts: SanitizationCounts;
135
+ inferenceCounts: SanitizationCounts;
136
+ promptsUUID?: string;
137
+ inferenceUUID?: string;
138
+ sanitizationDurationMs?: number;
139
+ };
140
+ declare function uploadAiBlameHandlerFromExtension(args: {
141
+ prompts: PromptItemArray;
142
+ inference: string;
143
+ model: string;
144
+ tool: string;
145
+ responseTime: string;
146
+ blameType?: AiBlameInferenceType;
147
+ sessionId?: string;
148
+ apiUrl?: string;
149
+ webAppUrl?: string;
150
+ repositoryUrl?: string | null;
151
+ sanitize?: boolean;
152
+ }): Promise<UploadAiBlameResult>;
153
+ type UploadAiBlameHandlerOptions = {
154
+ args: UploadAiBlameOptions;
155
+ exitOnError?: boolean;
156
+ apiUrl?: string;
157
+ webAppUrl?: string;
158
+ logger?: Logger;
159
+ repositoryUrl?: string | null;
160
+ };
161
+ declare function uploadAiBlameHandler(options: UploadAiBlameHandlerOptions): Promise<void>;
162
+ declare function uploadAiBlameCommandHandler(args: UploadAiBlameOptions): Promise<void>;
163
+
164
+ export { type PromptItem, type PromptItemArray, type RepoState, type UploadAiBlameOptions, type UploadAiBlameResult, getRepositoryUrl, getSystemInfo, readRepoState, uploadAiBlameBuilder, uploadAiBlameCommandHandler, uploadAiBlameHandler, uploadAiBlameHandlerFromExtension };