> For the complete documentation index, see [llms.txt](https://docs.ox.security/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ox.security/scan-and-analyze-with-ox/scanning/ox-cli-1/scanning-code-with-ox-cli/scanning-code-manually-with-ox-cli.md).

# Scanning Code Manually with OX CLI

Manual scans let you analyze your code on demand from the command line. Use the `scan` command to scan modified files, an entire directory, or selected security categories. By default, the OX CLI scans only modified files in the current directory.

| Scan mode                        | Command                                           | Options                              | Description                                                                                          | Typical use case                                                                      |
| -------------------------------- | ------------------------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| **Modified files**               | `ox-cli scan`                                     | None                                 | Scans only modified files in the current directory. This is the default behavior.                    | Scan the changes you're currently working on.                                         |
| **Specific directory**           | `ox-cli scan <targetDir>`                         | `<targetDir>`                        | Scans the specified directory. If no directory is specified, the current directory is scanned.       | Scan a repository or project located outside the current directory.                   |
| **Full scan**                    | `ox-cli scan --full-scan`                         | `--full-scan`                        | Scans all files in the target directory instead of only modified files.                              | Validate the entire codebase, such as after cloning a repository or before a release. |
| **Scan by category**             | `ox-cli scan --category <categories>`             | `--category <categories>`            | Scans only the specified security categories. Specify multiple categories as a comma-separated list. | Focus on specific security checks.                                                    |
| **Full scan by category**        | `ox-cli scan --full-scan --category <categories>` | `--full-scan--category <categories>` | Scans all files in the target directory for the specified security categories.                       | Validate one or more security categories across the entire repository.                |
| **Compare against a Git remote** | `ox-cli scan --git-remote-name <remote>`          | `--git-remote-name <remote>`         | Uses the specified Git remote when determining which files have changed.                             | Compare changes against a remote other than the default.                              |
| **Use VibeSec authentication**   | `ox-cli scan --use-vibesec-auth`                  | `--use-vibesec-auth`                 | Uses the authentication token stored by a supported VibeSec IDE integration for the current scan.    | Run a scan using your existing VibeSec authentication.                                |

### Supported scan categories

Use the `--category` option with one or more of the following values:

| Category                   | Value     |
| -------------------------- | --------- |
| Code Security              | `code`    |
| Open Source Security       | `oss`     |
| Secrets and PII            | `secrets` |
| Infrastructure as Code     | `iac`     |
| Software Bill of Materials | `sbom`    |

To scan multiple categories, specify a comma-separated list.

Example:

```bash
ox-cli scan --category code,secrets
```

### Examples

Scan modified files in the current directory:

```bash
ox-cli scan
```

Scan a specific directory:

```bash
ox-cli scan ./my-project
```

Run a full scan:

```bash
ox-cli scan --full-scan
```

Run a full scan for a specific directory:

```bash
ox-cli scan ./my-project --full-scan
```

Scan only Secrets and Infrastructure as Code issues:

```bash
ox-cli scan --category secrets,iac
```

Run a full scan for Open Source Security issues:

```bash
ox-cli scan --full-scan --category oss
```

Scan Code Security and Secrets issues and display only Critical and High severity findings:

```bash
ox-cli scan --category code,secrets --severity Critical,High
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ox.security/scan-and-analyze-with-ox/scanning/ox-cli-1/scanning-code-with-ox-cli/scanning-code-manually-with-ox-cli.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
