# RudderTyper v1 Command Reference


> Commands, CLI arguments, development and production modes, and ruddertyper.yml for RudderTyper v1.




**Warning**

RudderTyper v1 (npm) is in maintenance mode and will not receive any new features.

For TypeScript, Kotlin, and Swift support, use [RudderTyper v2](https://www.rudderstack.com/docs/rudder-cli/ruddertyper-v2/).

## Commands

<table>
    <thead>
        <tr>
            <th>Command</th>
            <th><div>Description</div></th>
        </tr>
    </thead>
    <tbody>
    <tr>
            <td>Initialize<br /><br /><pre>$ npx rudder-typer init</pre></td>
            <td>Initializes RudderTyper with a quickstart guide to generate your RudderTyper client .</td>
        </tr>
    <tr>
            <td>Help<br /><br /><pre>$ npx rudder-typer help</pre></td>
            <td>Prints the help message describing different commands available with RudderTyper.</td>
        </tr>
        <tr>
            <td>Update plan<br /><br /><pre>$ npx rudder-typer update | u | *   (default)</pre></td>
            <td>Syncs <code class="inline-code">plan.json</code> with RudderStack to pull the latest changes from your Tracking Plan and generates an updated development client.</td>
        </tr>
        <tr>
            <td>Build development client<br /><br /><pre>$ npx rudder-typer build | b | d | dev | development</pre></td>
            <td>Generates a development client from <code class="inline-code">plan.json</code> with runtime validation.</td>
        </tr>
        <tr>
            <td>Build production client<br /><br /><pre>$ npx rudder-typer prod | p | production</pre></td>
            <td>Generates a production client from <code class="inline-code">plan.json</code> without runtime validation .</td>
        </tr>
        <tr>
            <td>Print token configuration<br /><br /><pre>$ npx rudder-typer token | tokens | t</pre></td>
            <td>Prints the local RudderStack API token configuration.</td>
        </tr>
        <tr>
            <td>Print RudderTyper version<br /><br /><pre>$ npx rudder-typer version</pre></td>
            <td>Prints the RudderTyper CLI version.</td>
        </tr>
    </tbody>
</table>

## CLI arguments

Run the help command (`npx rudder-typer help`) to get the below list of CLI arguments that you can use with RudderTyper:

| Argument  | Description |
| :-------- | :-------- | 
| `config`  | Optional path to a `ruddertyper.yml` \(or a directory with `ruddertyper.yml`\). |
| `debug`   | Optional \(hidden\) flag to turn on/off debug mode. |
| `version` / `v` | Prints the RudderTyper CLI version.  |
| `help` / `h` | Prints help on a command. |

## RudderTyper modes

RudderTyper operates in two distinct modes: **Development** and **Production** mode. Each mode serves a specific purpose in the analytics implementation workflow. By utilizing the required mode, you can streamline the process of implementing and managing analytics with RudderTyper.

#### Development mode

This mode is designed to facilitate testing and validating your changes before the events go live.

This mode is suitable for local development and debugging and helps you:

- Validate the JSON schema to ensure correctness.
- Verify the tracking events against the defined Tracking Plan.
- Include additional validation logic to catch potential errors early.

#### Production mode

This mode is optimized for deployment and ensures seamless event tracking in live environments.

This mode is suitable for staging and production environments and helps you:

- Generate production-ready, optimized code.
- Adhere strictly to the validated schema to maintain consistency.
- Remove unnecessary validation and debugging logic for efficiency.

## Configuration reference

RudderTyper stores its configuration in a `ruddertyper.yml` file in the root of your repository.

A sample configuration looks like the following:

```yaml
# RudderStack RudderTyper configuration reference (https://github.com/rudderlabs/rudder-typer)
# Run `npx rudder-typer` to regenerate a client with the latest versions of these events.

scripts:
  # You can supply a RudderStack service access token using a `scripts.token` command. The output of `script.token` command should be a valid RudderStack API token.
  token: source .env; echo $RUDDERTYPER_TOKEN

  # You can supply the email address linked to your workspace using a `scripts.email` command.The output of `script.email` command should be an email address registered with your workspace.
  email: source .env; echo $EMAIL

  # You can format any of RudderTyper's auto-generated files using a `scripts.after` command.
  # See `Formatting Generated Files` below.
  after: ./node_modules/.bin/prettier --write analytics/plan.json

client:
  # The RudderStack SDK you are generating the client for
  # Valid values: analytics.js, analytics-node, analytics-ios, analytics-android.
  sdk: analytics.js

  # The target language for your RudderTyper client.
  # Valid values: javascript, typescript, objective-c, swift, java.
  language: typescript

  # JavaScript Transpilation Settings
  # Valid values: 'ES3','ES5','ES2015','ES2016','ES2017','ES2018','ES2019','ESNext','Latest'
  scriptTarget: "ES5"

  # Valid values: 'CommonJS','AMD','UMD','System','ES2015','ESNext'
  moduleTarget: "ESNext"

trackingPlans:
  # The RudderStack Tracking Plan that you are generating a client for.
  # Provide your workspace slug and Tracking Plan id
  # You also need to supply a path to a directory to save your RudderTyper client.
  - id: <TRACKING_PLAN_ID>
    workspaceSlug: rudderstack-demo
    path: ./analytics

    # Valid values: v1 (old Tracking Plan), v2 (new Tracking Plan format)
    APIVersion: v2
```

Note the following:

- Store `token` and `email`  in a `.env` file created in the same directory as `ruddertyper.yml` to ensure the scripts automatically use these values. A sample `.env` file is shown below:

```txt
RUDDERTYPER_TOKEN=<SERVICE_ACCESS_TOKEN>
EMAIL=<EMAIL_ADDRESS>
```

- You can get the `id` field by going to the Tracking Plan in the RudderStack dashboard. For example, `https://app.rudderstack.com/trackingPlans/<TRACKING_PLAN_ID>`.

## See more

- [RudderTyper v1](https://www.rudderstack.com/docs/rudder-cli/ruddertyper-v2/v1/): What v1 generates, and how validation works
- [RudderTyper v1 Quickstart](https://www.rudderstack.com/docs/rudder-cli/ruddertyper-v2-walkthrough/v1/): Generate a client and connect it to an SDK
- [RudderTyper v2 Command Reference](https://www.rudderstack.com/docs/rudder-cli/ruddertyper-v2-command-reference/): `rudder-cli typer` commands and flags

