# @birchui/doctor API reference

> Diagnose Birch UI installs: versions, duplicates, frameworks, license keys, styles and SSR setup

```bash
npm install @birchui/doctor
```

## @birchui/doctor

### compareVersions

Kind: function. Import from `@birchui/doctor`.

```ts
function compareVersions(a: Version, b: Version): number
```

| Parameter | Type | Description |
| --- | --- | --- |
| `a` | `Version` |  |
| `b` | `Version` |  |

### countBySeverity

Kind: function. Import from `@birchui/doctor`.

```ts
function countBySeverity(findings: readonly Finding[]): Record<Severity, number>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `findings` | `readonly Finding[]` |  |

### maskKey

Kind: function. Import from `@birchui/doctor`.

```ts
function maskKey(key: string): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `key` | `string` |  |

### parseVersion

Kind: function. Import from `@birchui/doctor`.

```ts
function parseVersion(text: string): Version | null
```

| Parameter | Type | Description |
| --- | --- | --- |
| `text` | `string` |  |

### renderReport

Kind: function. Import from `@birchui/doctor`.

```ts
function renderReport(report: DoctorReport): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `report` | `DoctorReport` |  |

### renderSummary

Kind: function. Import from `@birchui/doctor`.

```ts
function renderSummary(report: DoctorReport): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `report` | `DoctorReport` |  |

### runCli

Kind: function. Import from `@birchui/doctor`.

```ts
function runCli(argv: readonly string[], io: CliIo): Promise<number>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `argv` | `readonly string[]` |  |
| `io` | `CliIo` |  |

### runDoctor

Kind: function. Import from `@birchui/doctor`.

```ts
function runDoctor(options: DoctorOptions): Promise<DoctorReport>
```

| Parameter | Type | Description |
| --- | --- | --- |
| `options` | `DoctorOptions` |  |

### satisfies

Kind: function. Import from `@birchui/doctor`.

```ts
function satisfies(versionText: string, range: string): boolean | undefined
```

| Parameter | Type | Description |
| --- | --- | --- |
| `versionText` | `string` |  |
| `range` | `string` |  |

### toJson

Kind: function. Import from `@birchui/doctor`.

```ts
function toJson(report: DoctorReport): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `report` | `DoctorReport` |  |

### CliIo

Kind: interface. Import from `@birchui/doctor`.

```ts
interface CliIo
```

| Property | Type | Description |
| --- | --- | --- |
| `cwd` | `string` |  |
| `env` | `Record<string, string \| undefined>` |  |
| `stdout` | `{ write(text: string): unknown }` |  |
| `stderr` | `{ write(text: string): unknown }` |  |
| `now?` | `() => Date` |  |
| `publicKey?` | `Uint8Array` |  |

### DoctorOptions

Kind: interface. Import from `@birchui/doctor`.

```ts
interface DoctorOptions
```

| Property | Type | Description |
| --- | --- | --- |
| `cwd` | `string` |  |
| `env?` | `Record<string, string \| undefined>` |  |
| `publicKey?` | `Uint8Array` |  |
| `now?` | `Date` |  |
| `nodeVersion?` | `string` |  |
| `platform?` | `string` |  |

### DoctorReport

Kind: interface. Import from `@birchui/doctor`.

```ts
interface DoctorReport
```

| Property | Type | Description |
| --- | --- | --- |
| `root` | `string` |  |
| `projectName?` | `string` |  |
| `nodeVersion` | `string` |  |
| `platform` | `string` |  |
| `packageManager` | `PackageManager` |  |
| `packages` | `PackageSummary[]` |  |
| `frameworks` | `FrameworkSummary[]` |  |
| `ssr` | `string[]` |  |
| `bundler?` | `string` |  |
| `keys` | `KeyReport[]` |  |
| `usedProducts` | `ProductId[]` |  |
| `filesScanned` | `number` |  |
| `findings` | `Finding[]` |  |

### Finding

Kind: interface. Import from `@birchui/doctor`.

```ts
interface Finding
```

| Property | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `area` | `FindingArea` |  |
| `severity` | `Severity` |  |
| `title` | `string` |  |
| `details?` | `string[]` |  |
| `tip?` | `string` |  |

### FrameworkSummary

Kind: interface. Import from `@birchui/doctor`.

```ts
interface FrameworkSummary
```

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` |  |
| `label` | `string` |  |
| `version` | `string` |  |
| `supported` | `string` |  |
| `isSupported` | `boolean \| undefined` |  |

### KeyReport

Kind: interface. Import from `@birchui/doctor`.

```ts
interface KeyReport
```

| Property | Type | Description |
| --- | --- | --- |
| `source` | `KeySource` |  |
| `masked` | `string` |  |
| `status` | `LicenseStatus` |  |
| `payload` | `LicensePayload \| null` |  |
| `coveredProducts` | `ProductId[]` |  |
| `missingProducts` | `ProductId[]` |  |

### KeySource

Kind: interface. Import from `@birchui/doctor`.

```ts
interface KeySource
```

| Property | Type | Description |
| --- | --- | --- |
| `kind` | `'env' \| 'env-file' \| 'source'` |  |
| `where` | `string` |  |
| `variable?` | `string` |  |

### PackageSummary

Kind: interface. Import from `@birchui/doctor`.

```ts
interface PackageSummary
```

| Property | Type | Description |
| --- | --- | --- |
| `name` | `string` |  |
| `declared?` | `string` |  |
| `versions` | `string[]` |  |
| `copies` | `string[]` |  |

### Version

Kind: interface. Import from `@birchui/doctor`.

```ts
interface Version
```

| Property | Type | Description |
| --- | --- | --- |
| `major` | `number` |  |
| `minor` | `number` |  |
| `patch` | `number` |  |
| `prerelease` | `string` |  |

### FindingArea

Kind: type. Import from `@birchui/doctor`.

```ts
type FindingArea = 'packages' | 'frameworks' | 'license' | 'styles' | 'ssr' | 'bundle';
```

### Severity

Kind: type. Import from `@birchui/doctor`.

```ts
type Severity = 'error' | 'warn' | 'info' | 'ok';
```
