> For the complete documentation index, see [llms.txt](https://docs.xygeni.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xygeni.io/xygeni-scanner-cli/xygeni-cli-overview/xygeni-cli-operation-modes/organization-scan.md).

# Organization scan

## Org-Scan (Discover & Scan Organization repositories) <a href="#org_scan" id="org_scan"></a>

{% hint style="warning" %}
It’s important to ensure that the **JAVA\_HOME** environment variable points to the directory where Java is installed, which may or may not be done automatically depending on your platform. Additionally, you need to make sure that the $JAVA\_HOME/bin directory is included in your system’s PATH so that you can access the Java executable from anywhere on your system. Please see [Xygeni CLI Prerequisites](/xygeni-scanner-cli/xygeni-cli-overview/xygeni-cli-prerequisites.md) for further info.
{% endhint %}

When invoked, `xygeni org-scan` command discovers and analyzes all the Organization's repositories.

```
xygeni org-scan [options] 
```

As part of the process, the checkout of each repository is done into a temporary directory. Then, it’s deleted at the end of the scan process.

This command is very useful to quickly generate the inventory of an organization, and especially for performing smooth onboardings.

To discover the repos into a SCM organization, you must indicate the *name* of the organization as well as the *hostname* of the SCM system

```
Discovery options:
      --org, --group, --workspace=<name>
                             Name of the Organization, Group or Workspace to discover.
      --hostname=<hostname>  Hostname of the SCM system. Like 'https://github.com' or 'https://my.on.
                               premise.github.com'. GitHub Cloud will be used by default.
```

You can even filter the repos to be scanned thru inclusion/exclusions

```
      -ri, --repo-includes="<includesPattern>"
                             Regex for repositories to be included in the discovery. Everything is
                               matched by default.
                             Example: -ri "^micros/AGI_.*|^deploy/AGI_.*|^fe/AGI_.*"
      -re, --repo-excludes="<excludesPattern>"
                             Regex for repositories to be excluded in the discovery. Nothing is matched
                               by default.
                             Example: -re "^micros/AGI_.*|^deploy/AGI_.*|^fe/AGI_.*"
```

Finally, you can also execute it in dry-run mode ( `--dry-run` )

As an example, you might use `--dry-run` option to show the discovered repositories.

```console
$ xygeni -q org-scan --org xygeni --dry-run
    --run inventory,secrets,iac,codetamper \
    -e '**/test/**,build/**' -f none
```

And then, after reviewing the results, you might want to filter the projects and run the scans:

```console
$ xygeni -q org-scan --org xygeni -ri "^xy.*" -re "^xygeni\-(a|c).*"
    --run inventory,secrets,iac,codetamper \
    -e '**/test/**,build/**' -f none
```

### Cryptographic inventory of the organization

Adding `--cbom` discovers the cryptography of every repository, and `--cbom-file` writes one CycloneDX CBOM document per repository — the filename is prefixed with the repository name, so the documents do not overwrite each other.

```console
$ xygeni -q org-scan --org xygeni --run inventory --cbom --cbom-file cbom.json
```

See [Generate a CBOM with the Xygeni CLI](/xygeni-scanner-cli/xygeni-cli-overview/generate-cbom-with-the-xygeni-cli.md), and note that cryptographic discovery parses the whole source tree of each repository.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.xygeni.io/xygeni-scanner-cli/xygeni-cli-overview/xygeni-cli-operation-modes/organization-scan.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
