> ## Documentation Index
> Fetch the complete documentation index at: https://docs.valiqor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ScannerClient

> AST-based static analysis to detect AI features, extract prompts, and map workflows in your codebase.

## Overview

`ValiqorScanner` performs static analysis on your codebase to detect AI-related patterns — LLM calls, tool definitions, retrieval pipelines, and prompt templates. Scan results can be uploaded to the Valiqor backend for use in failure analysis and project setup.

```python theme={"system"}
from valiqor import ValiqorClient

client = ValiqorClient(api_key="your-api-key", project_name="my-app")
scanner = client.scanner
```

Or standalone:

```python theme={"system"}
from valiqor.scanner import ValiqorScanner

scanner = ValiqorScanner()
scanner.configure(api_key="your-api-key", project_name="my-app")
```

***

## `ValiqorScanner`

### Constructor

```python theme={"system"}
ValiqorScanner()
```

The scanner loads configuration from `.valiqorrc` on initialization. Use `configure()` to set credentials programmatically.

### Properties

| Property        | Type            | Description                                    |
| --------------- | --------------- | ---------------------------------------------- |
| `is_configured` | `bool`          | Whether the scanner has valid API credentials. |
| `project_name`  | `Optional[str]` | The active project name.                       |
| `backend_url`   | `str`           | The backend URL.                               |

***

### `configure()`

Set scanner configuration programmatically. Returns `self` for method chaining.

```python theme={"system"}
def configure(
    self,
    api_key: str = None,
    project_name: str = None,
    backend_url: Optional[str] = None,
    local_output_dir: Optional[str] = None,
    valiqor_intelligence: bool = None,
    environment: str = None,
    debug: bool = None,
    verbose: bool = False,
) -> ValiqorScanner
```

| Parameter              | Type            | Default | Description                                   |
| ---------------------- | --------------- | ------- | --------------------------------------------- |
| `api_key`              | `str`           | `None`  | Valiqor API key.                              |
| `project_name`         | `str`           | `None`  | Project name.                                 |
| `backend_url`          | `Optional[str]` | `None`  | Backend URL override.                         |
| `local_output_dir`     | `Optional[str]` | `None`  | Local directory for scan output files.        |
| `valiqor_intelligence` | `bool`          | `None`  | Whether to upload results to Valiqor backend. |
| `environment`          | `str`           | `None`  | Environment label.                            |
| `debug`                | `bool`          | `None`  | Enable debug output.                          |
| `verbose`              | `bool`          | `False` | Enable verbose logging.                       |

```python theme={"system"}
scanner = ValiqorScanner().configure(
    api_key="your-api-key",
    project_name="my-app",
    verbose=True
)
```

***

### `scan()`

Run a scan on a repository or directory.

```python theme={"system"}
def scan(self, repo_path: str, skip_upload: bool = False) -> ScanResult
```

| Parameter     | Type   | Default | Description                                             |
| ------------- | ------ | ------- | ------------------------------------------------------- |
| `repo_path`   | `str`  | —       | Path to the repository or directory to scan.            |
| `skip_upload` | `bool` | `False` | If `True`, only scan locally without uploading results. |

**Returns:** [`ScanResult`](#scanresult)

```python theme={"system"}
result = scanner.scan("./my-ai-app")
print(f"Status: {result.status}")
print(f"Files generated: {result.files_generated}")
print(f"Scan ID: {result.scan_id}")
```

***

## `ScanResult`

Returned by `scan()`. Contains scan metadata and output file paths.

| Attribute          | Type             | Description                                   |
| ------------------ | ---------------- | --------------------------------------------- |
| `status`           | `str`            | Scan status (`"success"` or `"error"`).       |
| `project_name`     | `str`            | Project name used for the scan.               |
| `scan_id`          | `str`            | Unique identifier for this scan.              |
| `local_output_dir` | `str`            | Directory where output files were written.    |
| `files_generated`  | `List[str]`      | List of generated output file paths.          |
| `files_uploaded`   | `List[str]`      | List of files uploaded to the backend.        |
| `upload_response`  | `Optional[Dict]` | Backend response from upload (if applicable). |
| `error`            | `Optional[str]`  | Error message if scan failed.                 |
| `timestamp`        | `str`            | ISO timestamp of the scan.                    |

```python theme={"system"}
result_dict = result.to_dict()
```

***

## `quick_scan()` — Convenience Function

A one-call function that creates a scanner, configures it, and runs a scan:

```python theme={"system"}
from valiqor.scanner import quick_scan

result = quick_scan(
    api_key="your-api-key",
    project_name="my-app",
    repo_path="./my-ai-app",
    verbose=True
)
```

| Parameter      | Type   | Default | Description             |
| -------------- | ------ | ------- | ----------------------- |
| `api_key`      | `str`  | —       | Valiqor API key.        |
| `project_name` | `str`  | —       | Project name.           |
| `repo_path`    | `str`  | —       | Path to scan.           |
| `backend_url`  | `str`  | `None`  | Backend URL override.   |
| `verbose`      | `bool` | `False` | Enable verbose logging. |

***

## Related

* [Code Scanning Workflow](/workflows/code-scanning) — Step-by-step scanning guide
* [Configuration](/sdk/configuration) — `.valiqorrc` and env var reference
