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

# CLI commands

> Reference for all npx @effect/tsgo commands: setup, config, patch, unpatch, and get-exe-path.

The `@effect/tsgo` package ships a CLI for installing and managing the Effect Language Service. All commands are available via `npx`:

```bash theme={null}
npx @effect/tsgo <command>
```

## setup

Interactive setup wizard that configures `@effect/tsgo` for your project.

```bash theme={null}
npx @effect/tsgo setup
```

<Steps>
  <Step title="Select a tsconfig.json">
    The wizard scans the current directory and prompts you to choose which `tsconfig.json` to configure.
  </Step>

  <Step title="Add the dependency">
    `@effect/tsgo` is added to your project's `package.json` if it is not already present.
  </Step>

  <Step title="Configure the plugin">
    The `@effect/language-service` plugin entry is added to the selected `tsconfig.json`.
  </Step>

  <Step title="Adjust plugin options">
    An interactive prompt walks you through the available plugin options so you can set them to your preference.
  </Step>

  <Step title="Editor hints">
    After applying changes, the wizard displays any additional editor configuration needed to activate the language server.
  </Step>
</Steps>

<Note>
  You can re-run `setup` at any time. It assesses the current state of your project before proposing changes, so it will not duplicate existing configuration.
</Note>

## config

Interactively configure diagnostic severities for an existing `tsconfig.json`.

```bash theme={null}
npx @effect/tsgo config
```

<Steps>
  <Step title="Select a tsconfig.json">
    The command scans the current directory and prompts you to pick a `tsconfig.json`.
  </Step>

  <Step title="Pick rules and severities">
    An interactive rule picker lists all available diagnostics alongside their current configured severity. Select any rule to change its severity.
  </Step>

  <Step title="Review and apply">
    The computed changes to `diagnosticSeverity` are displayed for review before being written to `tsconfig.json`.
  </Step>
</Steps>

Use `config` when you want to tune diagnostics after the initial setup without re-running the full wizard.

## patch

Patch the `@typescript/native-preview` binary, replacing it with `effect-tsgo`.

```bash theme={null}
npx @effect/tsgo patch
```

`effect-tsgo` is a superset of the official `tsgo` binary — it adds the Effect diagnostics layer on top of standard TypeScript-Go. Patching replaces the binary that editors load through `@typescript/native-preview`, so no separate editor configuration is needed.

**What this command does:**

1. Locates the platform-specific `tsgo` binary inside `@typescript/native-preview`.
2. Creates a backup of the original binary at `tsgo.original` (or `tsgo.original.1`, `tsgo.original.2`, … if a backup already exists).
3. Copies the `effect-tsgo` binary from the platform package into the target location.
4. Sets executable permissions (`0755`) on the patched binary.
5. Runs `tsgo --version` to verify the patched binary works.

<Warning>
  `@typescript/native-preview` must be installed in your project before running `patch`. Install it with:

  ```bash theme={null}
  npm install @typescript/native-preview
  ```
</Warning>

<Tip>
  Prefer using `effect-tsgo` as your sole TypeScript language server. Running both `effect-tsgo` and the stock `tsgo` in parallel produces duplicate diagnostics and degrades editor performance.
</Tip>

## unpatch

Restore the original `@typescript/native-preview` binary from the backup created by `patch`.

```bash theme={null}
npx @effect/tsgo unpatch
```

**What this command does:**

1. Locates the backup file (`tsgo.original`) next to the patched binary.
2. Renames the current patched binary to a uniquely named `.patched` file (preserving it in case you need to inspect it).
3. Renames the backup file back to the original binary name.

<Note>
  If no backup is found, `unpatch` exits without making any changes and prints an informational message.
</Note>

## get-exe-path

Print the absolute path to the `effect-tsgo` executable.

```bash theme={null}
npx @effect/tsgo get-exe-path
```

This is useful when configuring editors that require an explicit path to the language server binary, rather than relying on the `patch` approach.

**Example output:**

```
/path/to/node_modules/@effect/tsgo-linux-x64/lib/tsgo
```

Pass the output to your editor's TypeScript server binary configuration. For example, in a Neovim LSP config:

```lua theme={null}
lspconfig.effect_tsgo.setup({
  cmd = { vim.fn.system("npx @effect/tsgo get-exe-path"):gsub("\n", ""), "lsp" },
})
```

<Tip>
  Use `$(npx @effect/tsgo get-exe-path)` in shell scripts or editor launch configurations to resolve the path dynamically.
</Tip>
