> For the complete documentation index, see [llms.txt](https://docs.sealights.io/knowledgebase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/go-agent/go-agent-v1/command-reference.md).

# Command Reference

{% hint style="warning" %}
Every command and option listed below is documented via the agent's `--help` option.
{% endhint %}

{% code overflow="wrap" lineNumbers="true" %}

```
Usage:
  slcli [command]

Available Commands:
  completion        Generate the autocompletion script for the specified shell
  config            configuration command
  help              Help about any command
  integration-build
  scan              scans the code
  test
  test-sessions

Flags:
  -h, --help      help for slcli
  -v, --version   version for slcli

Use "slcli [command] --help" for more information about a command.
```

{% endcode %}

## Initializing the Go Agent Configuration <a href="#initializing-the-go-agent-configuration" id="initializing-the-go-agent-configuration"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
./slcli config init --lang go --token ./sltoken.txt
```

{% endcode %}

<table><thead><tr><th width="155.33331298828125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the Sealights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>lang</code></td><td></td></tr><tr><td><code>help</code></td><td>Show Help message and exit.</td></tr></tbody></table>

{% code overflow="wrap" lineNumbers="true" %}

```
Usage:
  slcli config [flags]
  slcli config [command]

Available Commands:
  create-bsid    command creates new build session id
  create-pr-bsid A brief description of your command
  init           Create SL configuration file
  verify         verify backend server and proxy
```

{% endcode %}

## Generating a session ID <a href="#generating-a-session-id" id="generating-a-session-id"></a>

### Standard Session ID <a href="#standard-session-id" id="standard-session-id"></a>

{% code overflow="wrap" lineNumbers="true" %}

```sh
slcli config create-bsid {--token <token> | --tokenfile <file>} --appname <appname> --branchname <branch> --buildname <build> --workspacepath <path> [--include <include>] [--exclude <exclude>] [--buildsessionid <buildsessionid>] [--proxy <proxy>] [--help]
```

{% endcode %}

<table><thead><tr><th width="167.02734375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the Sealights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>appname</code></td><td>Name of the application</td></tr><tr><td><code>branchname</code></td><td>The source branch of the application</td></tr><tr><td><code>buildname</code></td><td>The build label of the current build</td></tr><tr><td><code>workspacepath</code></td><td>Path to the workspace where the source code exists</td></tr><tr><td><code>include</code></td><td>Include only files whose paths match one of these patterns.<br>Accepts shell-style wildcards, which must be quoted.<br>If you want to provide multiple patterns, please use a comma between each quoted pattern. For example, "pattern1", "pattern2".</td></tr><tr><td><code>exclude</code></td><td>Omit files whose paths match one of these patterns.<br>Accepts shell-style wildcards, which must be quoted.<br>If you want to provide multiple patterns, please use a comma between each quoted pattern. For example, "pattern1", "pattern2".</td></tr><tr><td><code>buildsessionid</code></td><td>Optional: A user provided session ID (case-sensitive)</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>help</code></td><td>Show Help message and exit.</td></tr></tbody></table>

{% code overflow="wrap" lineNumbers="true" %}

```
slcli config create-bsid [flags]

Flags:
      --app string
      --branch string
      --bsid-save-location string
      --build string
      --custom-bsid string
      --fail-build
  -h, --help                        help for create-bsid
```

{% endcode %}

### Pull Request Session ID <a href="#pull-request-session-id" id="pull-request-session-id"></a>

{% code overflow="wrap" lineNumbers="true" %}

```sh
slcli config create-pr-bsid {--token <token> | --tokenfile <file>} --appname <appname> --targetbranch <branch> --latestcommit <commit_sha> --pullrequestnumber <number> --repourl <url> --workspacepath <path> [--include <include>] [--exclude <exclude>] [--buildsessionid <buildsessionid>] [--proxy <proxy>] [--help]
```

{% endcode %}

<table><thead><tr><th width="182.88018798828125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the Sealights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>appname</code></td><td>Name of the application</td></tr><tr><td><code>targetbranch</code></td><td>The branch to which this PR will be merged into (already reported to SeaLights)</td></tr><tr><td><code>latestcommit</code></td><td>The full SHA of the last commit made to the Pull Request</td></tr><tr><td><code>pullrequestnumber</code></td><td>he number assigned to the Pull Request from the source control</td></tr><tr><td><code>repourl</code></td><td>The pull request URL for the PR to be scanned, up until the section before the pullRequestNumber value</td></tr><tr><td><code>workspacepath</code></td><td>Path to the workspace where the source code exists</td></tr><tr><td><code>include</code></td><td>Include only files whose paths match one of these patterns.<br>Accepts shell-style wildcards, which must be quoted.</td></tr><tr><td><code>exclude</code></td><td>Omit files whose paths match one of these patterns.<br>Accepts shell-style wildcards, which must be quoted.</td></tr><tr><td><code>buildsessionid</code></td><td>Optional: A user provided session ID (case-sensitive)</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>help</code></td><td>Show Help message and exit.</td></tr></tbody></table>

{% code overflow="wrap" lineNumbers="true" %}

```
Usage:
  slcli config create-pr-bsid [flags]

Flags:
      --app string
      --bsid-save-location string
      --custom-bsid string
      --fail-build
  -h, --help                        help for create-pr-bsid
      --latest-commit string
      --packages-included string
      --pull-request-number int
      --repository-url string
      --target-branch string
```

{% endcode %}

## Scanning a build <a href="#scanning-a-build" id="scanning-a-build"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
slcli scan {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --scm {git|none} [--scmBaseUrl <url> --scmProvider {github|gitlab|bitbucket} [--scmVersion <version>] [--proxy <proxy>] [--help]
```

{% endcode %}

<table><thead><tr><th width="187.60546875">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>path-to-scanner</code></td><td>Path to the executable of the golang agent. It should refer to the executable file and not to its folder.</td></tr><tr><td><code>disable-on-init</code></td><td>Default <code>false</code></td></tr><tr><td><code>disable-token-save</code></td><td>Default <code>false</code></td></tr><tr><td><code>scm</code></td><td><p>Source control used</p><p>Current options are: git, none</p></td></tr><tr><td><code>scmprovider</code></td><td>The provider name of your Source Control Management (SCM) tool.<br>Values: Github, Bitbucket and Gitlab (Default is Github)</td></tr><tr><td><code>scmbaseurl</code></td><td><p>The URL to the repository which contains the code.</p><p>If not provided, the url of the remote GIT origin will be used</p><p>Example: <code>https://my.</code><a href="http://bitbucket.com/">bitbucket.com</a><code>/projects/ABCD/repos/XYZ/browse/A1</code></p></td></tr><tr><td><code>scmversion</code></td><td>The version of your Source Control Management (SCM) tool. If left blank, cloud version is assumed. Otherwise, specify the version of your on-premise server.</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>help</code></td><td>Show Help message and exit.</td></tr></tbody></table>

{% code overflow="wrap" lineNumbers="true" %}

```
Usage:
  slcli scan [flags]

Flags:
      --bsid string                 (default "./buildSessionId.txt")
      --collector-url string
      --debug
      --disable-on-init
      --disable-token-save
      --enable-ginkgo
      --fail-build
      --gomodfile string
  -h, --help                       help for scan
      --light-mode
      --packages-excluded string
      --packages-included string
      --path-to-scanner string      (default "./build-scanner")
      --scm string
      --scmBaseUrl string
      --scmProvider string
      --scmVersion string
      --tests-runner
      --workspacepath string        (default "./")
```

{% endcode %}

## Test Listener <a href="#test-listener" id="test-listener"></a>

### Instrument your Tests running with Ginkgo <a href="#instrument-your-tests-running-with-ginkgo" id="instrument-your-tests-running-with-ginkgo"></a>

These commands will be further documented soon, please refer to their `--help` option via the command below

{% code overflow="wrap" lineNumbers="true" %}

```
slcli scan --tests-runner --enable-ginkgo
```

{% endcode %}

### Starting a test stage <a href="#starting-a-test-stage" id="starting-a-test-stage"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
slcli test start-stage {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --teststage <teststage> [--labid <labid>] [--proxy <proxy>] [--help]
```

{% endcode %}

<table><thead><tr><th width="187.3333740234375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>teststage</code></td><td>Name of the test stage</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr></tbody></table>

### Upload report files <a href="#upload-report-files" id="upload-report-files"></a>

Report files must be JUnit style XML reports

{% code overflow="wrap" lineNumbers="true" %}

```
slcli test upload-reports {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} {--reportfile <reportFile> | --reportfilesfolder <reportFilesFolder>} [--hasmorerequests {False|True}] [--labid <labid>] [--source <source>] [--type <type>] [--proxy <proxy>] [--help]
```

{% endcode %}

<table><thead><tr><th width="196.6666259765625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>reportfile</code></td><td>Path to report file. This argument can be declared multiple times in order to upload multiple files.</td></tr><tr><td><code>reportfilesfolder</code></td><td><p>Path to folder that contains nothing but report files. All files in folder will be uploaded.<br>This argument can be declared multiple times in order to upload multiple files from multiple folders containing report files.</p><p>Note: all files in the folder will be uploaded</p></td></tr><tr><td><code>hasmorerequests</code></td><td>Set to ‘True’ if test results contains multiple reports (Default: ‘False’).</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously (case-sensitive)</td></tr><tr><td><code>source</code></td><td>The reports provider. If not set, the default will be 'Junit xml report'.</td></tr><tr><td><code>type</code></td><td><p>Name of testing framework type. The report type. If not set, the default will be 'JunitReport'</p><ul><li>JUnitReport - For uploading JUnit test report files</li><li>commitLog - For uploading git style commit logs</li></ul></td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>help</code></td><td>Show Help message and exit.</td></tr></tbody></table>

### Ending a test stage <a href="#ending-a-test-stage" id="ending-a-test-stage"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
slcli test end-stage {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}]
```

{% endcode %}

<table><thead><tr><th width="183.33331298828125">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>Access token generated from the SeaLights server</td></tr><tr><td><code>tokenfile</code></td><td>Path to file containing access token generated from the SeaLights server</td></tr><tr><td><code>buildsessionid</code></td><td>Session ID of configuration created</td></tr><tr><td><code>buildsessionidfile</code></td><td>Path to file containing the Session ID of configuration created</td></tr><tr><td><code>labid</code></td><td>Unique ID for a set of test labs in case multiple labs are running simultaneously</td></tr><tr><td><code>proxy</code></td><td>Address of proxy to run connection through</td></tr><tr><td><code>help</code></td><td>Show Help message and exit.</td></tr></tbody></table>

## Logging <a href="#logging" id="logging"></a>

The Sealights Go agent supports only console output and does not support file logging. To enable logging, set the following environment variable:

{% code overflow="wrap" lineNumbers="true" %}

```sh
export SL_DEBUG=true
```

{% endcode %}

To disable logging, simply set the variable to `false` .

You can refine the logging level using the `SEALIGHTS_LOG_LEVEL` environment variable, which accepts five values (from least to most verbose): `none`, `error`, `warn`, `info` (default level), and `debug`. Note that `none` is equivalent to disabling logging.

{% code overflow="wrap" lineNumbers="true" %}

```sh
export SEALIGHTS_LOG_LEVEL=info
```

{% endcode %}

## Environment Variables <a href="#environment-variables" id="environment-variables"></a>

You can define or override some agent parameters using the environment variables below.

<table data-full-width="true"><thead><tr><th width="289.3333740234375">Environment Variable Name</th><th width="136.333251953125">Default Value</th><th width="545.6666259765625">Description</th><th>Scope</th></tr></thead><tbody><tr><td><code>SEALIGHTS_DISABLE_ON_INIT</code></td><td><code>TRUE</code></td><td>You need to set this env variable to false to enable sealights when running the scan with <code>--disable-on-init true</code></td><td>Runtime</td></tr><tr><td><code>SEALIGHTS_DISABLE</code></td><td><code>FALSE</code></td><td>If you do not run the scan with <code>--disable-on-init true</code>, then use this flag to disable Sealights. (For instance in production)</td><td>Runtime</td></tr><tr><td><code>SEALIGHTS_COLLECTOR_URL</code></td><td>““</td><td>Setting Collector URL in light mode (for lambda apps)</td><td>Runtime</td></tr><tr><td><code>SEALIGHTS_LAB_ID</code></td><td>BuildSession Id</td><td>Setting Lab Id</td><td>Runtime, Testing</td></tr><tr><td><code>SEALIGHTS_PROXY_URL</code></td><td>““</td><td>Proxy URL for connection to server</td><td></td></tr><tr><td><code>SEALIGHTS_LIGHT_MODE</code></td><td><code>FALSE</code></td><td>Enable/Disable agent mode in light mode (for lambda apps)</td><td>Runtime</td></tr><tr><td><code>SEALIGHTS_TEST_STAGE</code></td><td>-</td><td>Name of the test stage to appear in the dashboard.</td><td>Testing</td></tr><tr><td><code>SEALIGHTS_BUILD_SESSION_ID</code></td><td>-</td><td>Session ID of configuration created</td><td></td></tr><tr><td><code>SEALIGHTS_AGENT_TOKEN</code></td><td>-</td><td>Access token generated from the SeaLights server</td><td></td></tr><tr><td><code>SEALIGHTS_IGNORE_GO_TESTS</code></td><td><code>false</code></td><td>Disable integration with the <code>testing.T</code> type for Go tests. It is commonly used with Ginkgo integration.</td><td>Testing</td></tr></tbody></table>


---

# 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:

```
GET https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/go-agent/go-agent-v1/command-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
