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

# Version

> Display version and build information about the Mizu CLI

The `mizu version` command shows information about the installed Mizu CLI, including the version number, Go version, and build details. Use this command to verify your installation works or to include version info in bug reports.

## Basic Usage

```bash theme={null}
mizu version
```

Output:

```
mizu version 0.1.0
go version: go1.23.0
commit: abc1234
built: 2024-01-15T10:30:00Z
```

## What Each Field Means

| Field        | Description                       | Example                |
| ------------ | --------------------------------- | ---------------------- |
| `version`    | The semantic version of the CLI   | `0.1.0`                |
| `go version` | The Go version used to compile    | `go1.23.0`             |
| `commit`     | Short Git commit hash             | `abc1234`              |
| `built`      | When this version was built (UTC) | `2024-01-15T10:30:00Z` |

## Flags

| Flag         | Description    |
| ------------ | -------------- |
| `--json`     | Output as JSON |
| `-h, --help` | Show help      |

## JSON Output

For scripts and automation, use `--json`:

```bash theme={null}
mizu version --json
```

Output:

```json theme={null}
{
  "version": "0.1.0",
  "go_version": "go1.23.0",
  "commit": "abc1234",
  "built_at": "2024-01-15T10:30:00Z"
}
```

## When to Use This Command

### Verify Installation

After installing the CLI, confirm it's working:

```bash theme={null}
mizu version
```

If you see version information, the CLI is installed correctly.

### Check for Updates

Compare your version with the latest release:

```bash theme={null}
# Check your version
mizu version

# Update to latest
go install github.com/go-mizu/mizu/cmd/mizu@latest

# Verify update
mizu version
```

### Include in Bug Reports

When reporting issues, include your version information:

```bash theme={null}
mizu version --json > version.json
```

Share this file with your bug report so maintainers know your exact setup.

### CI/CD Version Checks

Ensure a minimum version in build scripts:

```bash theme={null}
#!/bin/bash

# Get the version
VERSION=$(mizu version --json | jq -r '.version')

# Compare versions (requires semver comparison)
if [[ "$VERSION" == "dev" ]]; then
  echo "Warning: Using development build"
fi

echo "Using mizu $VERSION"
```

## Development Builds

If you built from source without setting version flags, you'll see:

```
mizu version dev
go version: go1.23.0
commit: unknown
built: unknown
```

This is normal for local development builds.

## Setting Build Information

When building the CLI, you can embed version information using Go's `-ldflags`:

```bash theme={null}
go build -ldflags "\
  -X github.com/go-mizu/mizu/cli.Version=1.0.0 \
  -X github.com/go-mizu/mizu/cli.Commit=$(git rev-parse --short HEAD) \
  -X github.com/go-mizu/mizu/cli.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
  -o mizu ./cmd/mizu
```

This is useful for:

* Release builds
* CI/CD pipelines
* Custom distribution

### Variables

| Variable        | Default   |
| --------------- | --------- |
| `cli.Version`   | `dev`     |
| `cli.Commit`    | `unknown` |
| `cli.BuildTime` | `unknown` |

## Exit Codes

| Code | Description      |
| ---- | ---------------- |
| 0    | Success (always) |

The version command always succeeds if the CLI is running.

## Troubleshooting

### "command not found: mizu"

The CLI isn't installed or isn't in your PATH. See [Installation](/cli/installation).

### Version Shows "dev"

You're running a development build. This is fine for testing but you may want to install a release version:

```bash theme={null}
go install github.com/go-mizu/mizu/cmd/mizu@latest
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/cli/installation">
    Learn how to install or update the CLI
  </Card>

  <Card title="Create a Project" icon="rocket" href="/cli/new">
    Start building with Mizu
  </Card>
</CardGroup>
