# uip aops connections

> Syntax and options for `uip aops connection` and `uip aops repo`, which sync SourceControl connections and inspect the repositories discovered through them.

`uip aops connection` manages **SourceControl connections** — the per-tenant link to a Git provider (GitHub or Azure DevOps) that StudioAdmin uses to discover repositories, automation projects, and solutions. `uip aops repo` inspects a single repository's branches and automation-project files once you have a repository identifier from `connection repos`. See the [`uip aops` overview](./uip-aops.md) for shared concepts and the SC-service/CICD-service split.

:::note
Connection **creation** is performed via the StudioAdmin UI — this CLI only consumes already-provisioned connections by identifier. Use `connection list` to discover identifiers, then `connection sync --wait` to refresh one.
:::

## Synopsis

```text
uip aops connection list
uip aops connection state [--connection <id>]
uip aops connection sync [connection-id] [--wait] [--timeout <ms>] [--poll-interval <ms>]
uip aops connection delete <connection-id> -y
uip aops connection repos <connection-id> [--azure-projects-ids <csv>] [--organization-identifier <name>]
uip aops connection repos-bulk --ids <csv>
uip aops connection projects <connection-id> [--repository-ids <csv>] [--target-framework <name>] [--project-type <type>] [--azure-projects-ids <csv>] [--organization-identifier <name>] [--sort-by <field>] [--sort-order <asc|desc>] [--offset <n>] [--limit <n>] [--search <term>]
uip aops connection solutions <connection-id> [--offset <n>] [--limit <n>] [--search <term>]
uip aops connection azure-projects <connection-id> [--organization-identifier <name>]

uip aops repo branches <repo-id>
uip aops repo project-files <repo-id> [--reference <ref>]
```

## uip aops connection list

List every SourceControl connection visible to the current user.

### Data shape (--output json)

```json
{
  "Code": "ConnectionList",
  "Data": [
    { "identifier": "f1e2d3c4-0000-0000-0000-000000000001", "name": "GitHub - main org", "type": "GitHub" }
  ]
}
```

Use the returned `identifier` with every other `connection`, `repo`, and `project` command.

## uip aops connection state

Fetch the current sync state for connections.

### Options

| Long | Value | Description |
|---|---|---|
| `--connection <id>` | string | Filter to a single connection identifier. Client-side filter — the API returns every connection's state and the CLI filters locally. |

### Data shape (--output json)

```json
{
  "Code": "ConnectionState",
  "Data": [
    { "identifier": "f1e2d3c4-0000-0000-0000-000000000001", "syncState": "Success", "syncingInProgress": false }
  ]
}
```

`syncState` is `Success`, `Fail`, or `Broken`.

## uip aops connection sync

Trigger a sync for one connection, or every connection in the org if `[connection-id]` is omitted.

### Arguments

| Name | Required | Purpose |
|---|---|---|
| `[connection-id]` | no | Connection identifier from `connection list`. Omit to sync every connection in the org. |

### Options

| Long | Value | Description |
|---|---|---|
| `--wait` | flag | Poll the state endpoint until the sync reaches a terminal state instead of returning immediately. |
| `--timeout <ms>` | integer | Maximum time to wait when `--wait` is set. Default `300000` (5 minutes). |
| `--poll-interval <ms>` | integer | Interval between state polls. Default `2000`. |

The trigger endpoint returns 202 immediately; without `--wait`, control returns as soon as the sync is queued (`Code: "ConnectionSyncStarted"`). With `--wait`, a non-success terminal state (e.g. `Broken`) is reported as a failure, not success.

### Example

```bash
uip aops connection sync f1e2d3c4-0000-0000-0000-000000000001 --wait
```

### Data shape (--output json)

```json
{ "Code": "ConnectionSynced", "Data": { "identifier": "f1e2d3c4-0000-0000-0000-000000000001", "syncState": "Success", "syncingInProgress": false } }
```

Syncing every connection (no `connection-id`) returns an array under `Data` instead of one object.

## uip aops connection delete

Delete a SourceControl connection by identifier. Permanent — projects and solutions discovered through this connection are no longer reachable.

### Arguments

| Name | Required | Purpose |
|---|---|---|
| `<connection-id>` | yes | Connection identifier from `connection list`. |

### Options

| Long | Description |
|---|---|
| `-y, --yes` | **Required.** Confirms this irreversible operation — the CLI never prompts. |

### Data shape (--output json)

```json
{ "Code": "ConnectionDeleted", "Data": { "ConnectionId": "f1e2d3c4-0000-0000-0000-000000000001" } }
```

## uip aops connection repos

List repositories visible through a single connection.

### Arguments

| Name | Required | Purpose |
|---|---|---|
| `<connection-id>` | yes | Connection identifier from `connection list`. |

### Options

| Long | Value | Description |
|---|---|---|
| `--azure-projects-ids <csv>` | comma-separated | Narrow to specific Azure DevOps project identifiers. Azure connections only. |
| `--organization-identifier <name>` | string | Scope to one Azure DevOps organization. Azure connections only, for cross-organization connections. |

### Data shape (--output json)

```json
{ "Code": "ConnectionRepos", "Data": [ { "identifier": "abcd1234-0000-0000-0000-000000000001", "name": "automation-hub" } ] }
```

## uip aops connection repos-bulk

Fetch repositories for multiple connections in a single round-trip.

### Options

| Long | Value | Required | Description |
|---|---|---|---|
| `--ids <csv>` | comma-separated | **yes** | Connection identifiers from `connection list`. |

### Data shape (--output json)

```json
{
  "Code": "ConnectionReposBulk",
  "Data": [
    { "ConnectionId": "f1e2d3c4-0000-0000-0000-000000000001", "Repositories": [ { "identifier": "abcd1234-0000-0000-0000-000000000001", "name": "automation-hub" } ] }
  ]
}
```

One row per connection — `ConnectionId` is kept as a plain value (not a normalized key) so it survives output formatting and feeds back into `connection repos <id>`.

## uip aops connection projects

List automation projects discovered through a connection.

### Arguments

| Name | Required | Purpose |
|---|---|---|
| `<connection-id>` | yes | Connection identifier from `connection list`. |

### Options

| Long | Value | Description |
|---|---|---|
| `--repository-ids <csv>` | comma-separated | Narrow to specific repository identifiers from `connection repos`. |
| `--target-framework <name>` | string | Server-side filter on project target framework. |
| `--project-type <type>` | string | Server-side filter on project type (e.g. `Process`, `Library`, `Agent`). |
| `--azure-projects-ids <csv>` | comma-separated | Azure connections only. |
| `--organization-identifier <name>` | string | Azure connections only. |
| `--sort-by <field>` | string | Field to sort by (e.g. `name`, `lastModifiedDate`). |
| `--sort-order <asc\|desc>` | enum | Sort direction. Combine with `--sort-by`. |
| `--offset <n>` | integer | Number to skip. Must be a multiple of `--limit`. Default `0`. |
| `--limit <n>` | integer | Maximum to return. Default `10`. |
| `--search <term>` | string | Server-side substring filter on project name. |

### Examples

```bash
uip aops connection projects f1e2d3c4-0000-0000-0000-000000000001

uip aops connection projects f1e2d3c4-0000-0000-0000-000000000001 \
  --repository-ids abcd1234-0000-0000-0000-000000000001 --sort-by name --sort-order asc
```

### Data shape (--output json)

```json
{
  "Code": "ConnectionProjects",
  "Data": [
    { "ProjectId": "9999dddd-0000-0000-0000-000000000001", "Name": "Invoice Processing", "Description": "Daily invoice ingest", "Type": "Process", "Repository": "automation-hub" }
  ]
}
```

## uip aops connection solutions

List Studio solutions discovered through a connection.

### Arguments

| Name | Required | Purpose |
|---|---|---|
| `<connection-id>` | yes | Connection identifier from `connection list`. |

### Options

| Long | Value | Description |
|---|---|---|
| `--offset <n>` | integer | Number to skip. Must be a multiple of `--limit`. Default `0`. |
| `--limit <n>` | integer | Maximum to return. Default `20`. |
| `--search <term>` | string | Server-side substring filter on solution name. |

### Data shape (--output json)

```json
{ "Code": "ConnectionSolutions", "Data": { "result": [] } }
```

## uip aops connection azure-projects

List Azure DevOps projects reachable through an Azure connection. GitHub connections always return an empty list.

### Arguments

| Name | Required | Purpose |
|---|---|---|
| `<connection-id>` | yes | Azure connection identifier from `connection list`. |

### Options

| Long | Value | Description |
|---|---|---|
| `--organization-identifier <name>` | string | Scope to one Azure DevOps organization, for connections spanning multiple. |

### Data shape (--output json)

```json
{ "Code": "ConnectionAzureProjects", "Data": [] }
```

## uip aops repo

Inspect a repository already surfaced via `connection repos <connection-id>`.

### uip aops repo branches

List branches for a repository.

#### Arguments

| Name | Required | Purpose |
|---|---|---|
| `<repo-id>` | yes | Repository identifier from `connection repos <connection-id>`. |

#### Data shape (--output json)

```json
{ "Code": "RepoBranches", "Data": [ { "Name": "main", "Main": true }, { "Name": "release", "Main": false } ] }
```

Use the branch `Name` as `--reference` on `repo project-files`, `project content`, etc.

### uip aops repo project-files

List automation project files (`project.json` roots) in the repository at a given reference.

#### Arguments

| Name | Required | Purpose |
|---|---|---|
| `<repo-id>` | yes | Repository identifier from `connection repos <connection-id>`. |

#### Options

| Long | Value | Description |
|---|---|---|
| `--reference <ref>` | branch/tag/SHA | Defaults to the default branch's HEAD. |

#### Data shape (--output json)

```json
{ "Code": "RepoProjectFiles", "Data": [] }
```

## Related

- [`uip aops`](./uip-aops.md) — overview and concepts.
- [`projects`](./uip-aops-projects.md) — inspect a project or solution once discovered here.
- [`pipelines`](./uip-aops-pipelines.md) — define and run CI/CD pipelines against a discovered project.

## See also

- [Global options](./global-options.md)
- [Exit codes](./exit-codes.md)
