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

# idyl context

> Manage saved contexts

View and manage saved contexts.

A context is a named configuration that defines the realm, identity, account,
profile, namespace, and subnet for CLI commands. Contexts let you switch
between environments without re-authenticating.

## Usage

```bash theme={null}
idyl context
```

## Aliases

* `contexts`
* `ctx`

## Commands

| Command               | Description                              |
| --------------------- | ---------------------------------------- |
| `idyl context create` | Create a new context                     |
| `idyl context delete` | Delete a context                         |
| `idyl context edit`   | Edit a context                           |
| `idyl context get`    | Get context details or list all contexts |
| `idyl context show`   | Show current context                     |

## Inherited flags

| Flag                                 | Description                                                        |
| ------------------------------------ | ------------------------------------------------------------------ |
| `-a <string>, --account-id <string>` | Account ID to use, overriding the current context.                 |
| `-c <string>, --context <string>`    | Use the named context for this command.                            |
| `--homedir <string>`                 | Override the configuration directory. Defaults to \~/.config/idyl. |
| `-n <string>, --namespace <string>`  | Namespace to use for this command.                                 |
| `-o <string>, --output <string>`     | Output format (json\|yaml).                                        |
| `-p <string>, --profile <string>`    | Override the access profile for this command.                      |
| `--realm <string>`                   | Override the realm for this command.                               |
| `--subnet <string>`                  | Override the context subnet for this command.                      |

## Examples

```bash theme={null}
# Show current context
idyl context show

# Get details of a specific context
idyl context get staging

# List all saved contexts
idyl context list

# Create a new context
idyl context create staging --account acme-corp/staging --profile Developer

# Edit the current context
idyl context edit --set-subnet my-subnet --set-namespace production

# Delete a context
idyl context delete old-context
```

## Subcommand reference

### `idyl context create`

Create a new context by selecting an account and profile.

A context stores all the configuration needed to interact with an IDYL realm,
including identity, account, profile, namespace, and subnet settings.

When run without arguments, the command enters interactive mode and prompts you
to select an account and profile from available options.

#### Usage

```bash theme={null}
idyl context create [name] [flags]
```

#### Flags

| Flag                   | Description                                                |
| ---------------------- | ---------------------------------------------------------- |
| `--account <string>`   | Account in org/name format, such as acme-corp/staging.     |
| `--namespace <string>` | Namespace for the new context. Default: `default`.         |
| `--profile <string>`   | Access profile name.                                       |
| `--subnet <string>`    | Subnet for workload placement.                             |
| `--use`                | Set the new context as the current context after creation. |

#### Examples

```bash theme={null}
# Interactive mode (prompts for all selections)
idyl context create

# Create with explicit name
idyl context create staging

# Create with explicit account and profile
idyl context create staging \
  --account acme-corp/staging \
  --profile Developer \
  --namespace api

# Create and switch to the new context
idyl context create mydev \
  --account developer@example.com/myproject \
  --profile Owner \
  --use
```

### `idyl context delete`

Delete a context by name.

By default, the current context cannot be deleted. Use --force to override.

#### Usage

```bash theme={null}
idyl context delete <name> [flags]
```

#### Aliases

* `rm`

#### Flags

| Flag      | Description                                           |
| --------- | ----------------------------------------------------- |
| `--force` | Delete the context even if it is the current context. |

#### Examples

```bash theme={null}
# Delete a context
idyl context delete old-context

# Force delete the current context
idyl context delete current-context --force
```

### `idyl context edit`

Edit settings on the current context, or a specific context with --context.

Only the specified flags are updated; other settings remain unchanged.

#### Usage

```bash theme={null}
idyl context edit [flags]
```

#### Flags

| Flag                       | Description        |
| -------------------------- | ------------------ |
| `--set-namespace <string>` | Set the namespace. |
| `--set-subnet <string>`    | Set the subnet.    |

#### Examples

```bash theme={null}
# Set the subnet on the current context
idyl context edit --set-subnet my-subnet

# Set the namespace on the current context
idyl context edit --set-namespace production

# Edit a different context without switching to it
idyl context edit --context staging --set-subnet my-subnet

# Set both at once
idyl context edit --set-subnet my-subnet --set-namespace production
```

### `idyl context get`

Get details of a specific context, or list all saved contexts.

With no arguments, lists all contexts.
With a name argument, shows details of that specific context.

#### Usage

```bash theme={null}
idyl context get [name]
```

#### Aliases

* `list`
* `ls`

#### Examples

```bash theme={null}
# List all saved contexts
idyl context get

# Get details of a specific context
idyl context get staging
```

### `idyl context show`

Show details of the current active context.

#### Usage

```bash theme={null}
idyl context show
```

#### Examples

```bash theme={null}
# Show current context
idyl context show
```
