# How OmniRoute CLI Setup Commands Configure Coding Tools: ESLint, TypeScript, and Vitest Integration

> OmniRoute CLI setup commands integrate ESLint, TypeScript, and Vitest by orchestrating npm scripts and declarative configurations for consistent linting, type-checking, and testing.

- Repository: [Diego Rodrigues de Sa e Souza/OmniRoute](https://github.com/diegosouzapw/OmniRoute)
- Tags: how-to-guide
- Published: 2026-08-09

---

**OmniRoute CLI setup commands configure coding tools by orchestrating npm scripts that bootstrap ESLint, TypeScript, Prettier, and Vitest through declarative configuration files, ensuring consistent linting, type-checking, and testing across all development environments.**

The OmniRoute repository provides a fully-featured development toolchain that extends far beyond server startup. When developers run the CLI setup commands, they activate a comprehensive static-analysis pipeline that wires linting, formatting, and type-checking tools directly into the project's configuration files.

## Bootstrapping the Environment with `npm install`

Running `npm install` does more than download dependencies. According to the source code in [`package.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/package.json), this command initializes the **`.env`** file from **`.env.example`**, pre-populating environment variables required by the tooling pipeline (such as `JWT_SECRET`, `API_KEY_SECRET`, and `APP_LOG_LEVEL`). This ensures that subsequent lint and type-check processes have access to the configuration they expect.

After installation completes, the following tools are ready for invocation:

- **ESLint** via `eslint.config.mjs`
- **Prettier** via `prettier.config.mjs`
- **TypeScript** via [`tsconfig.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.json) and variants
- **Vitest** and the native Node test runner

## Configuring ESLint with `npm run lint`

The **`npm run lint`** command executes ESLint across the entire codebase using the configuration defined in **`eslint.config.mjs`**. As implemented in `diegosouzapw/OmniRoute`, this script runs:

```bash
eslint . --ext .ts,.tsx,.js,.jsx

```

The ESLint configuration enforces specific formatting standards mandated by the repository's Hard Rule #3:

- **2-space indentation**
- **Semicolons required**
- **Double quotes** for strings
- **No-eval rule** strictly prohibited

When combined with `npm run lint --fix`, Prettier rules from `prettier.config.mjs` automatically apply formatting corrections.

## TypeScript Type Checking Commands

OmniRoute provides granular control over TypeScript strictness through multiple CLI commands:

**`npm run typecheck:core`** runs TypeScript in standard mode using **[`tsconfig.typecheck-core.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.typecheck-core.json)**, targeting the `src/` and `open-sse/` modules to guarantee type safety for core functionality.

**`npm run typecheck:noimplicit:core`** executes the same check with the strictest `noImplicitAny` flag enabled, as defined in **[`tsconfig.typecheck-noimplicit-core.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.typecheck-noimplicit-core.json)**. This command is used by CI to catch any new `any` usage (Hard Rule #8).

Both commands reference the base **[`tsconfig.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.json)** for shared compiler options.

## Testing Infrastructure: Unit Tests and Vitest

The CLI configures two distinct testing environments:

**`npm run test:unit`** executes the native Node test runner on files under `tests/unit/`, validating business logic while keeping TypeScript typings exercised.

**`npm run test:vitest`** starts Vitest for the MCP server, auto-combo routing, and cache tests. This provides a fast, isolated test environment specifically for the streaming-engine code in `open-sse/`.

## The Meta-Script: `npm run check`

The **`npm run check`** command serves as a unified entry point that runs **lint**, **typecheck**, and **unit tests** in sequence. This meta-script guarantees that every commit passes the full static-analysis suite before reaching CI, simplifying pre-commit verification to a single command.

Additionally, **`npm run check:docs-all`** runs the documentation validator that cross-checks generated docs against source code, ensuring that doc snippets (e.g., usage of CLI flags) stay in sync with the actual implementation.

## Configuration File Architecture

The CLI commands reference configuration files located next to the source tree:

- **[`package.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/package.json)** – Defines all npm scripts that drive the tooling pipeline
- **[`tsconfig.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.json)** – Base TypeScript compiler options used by every `typecheck:*` script
- **[`tsconfig.typecheck-core.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.typecheck-core.json)** – Concrete config for the `typecheck:core` script
- **[`tsconfig.typecheck-noimplicit-core.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.typecheck-noimplicit-core.json)** – Stricter variant used by `typecheck:noimplicit:core`
- **`eslint.config.mjs`** – ESLint rule set generated by the repo's scaffolding
- **`prettier.config.mjs`** – Formatting defaults applied by the linting process
- **`bin/omniroute.mjs`** – Entry point that forwards sub-commands to the Commander-based CLI
- **`bin/cli/program.mjs`** – Commander definition mapping user commands to underlying scripts

## Security and Declarative Configuration

Because the scripts are **declarative**—they only call tools already part of the repository—they satisfy OmniRoute's "no-execution of untrusted code" security rule. When a developer runs `npm install && npm run dev`, the CLI:

1. Installs `node_modules` and materializes `.env` from `.env.example`
2. Bootstraps ESLint with the shared config including the no-eval rule
3. Invokes TypeScript with appropriate `tsconfig.*` files matching CI requirements
4. Starts the Next.js dev server using compiled TypeScript output, surfacing lint/type-check errors early

## Practical CLI Usage Examples

Configure the full coding tool ecosystem with these commands:

```bash

# Install dependencies and generate .env

npm install

# Run the full static-analysis suite locally

npm run check

# Only lint the codebase after quick edits

npm run lint

# Run the strict type-check used by CI

npm run typecheck:noimplicit:core

# Execute Vitest for the streaming engine

npm run test:vitest

```

If you need to add a new ESLint rule or adjust TypeScript strictness, edit the corresponding configuration file (`eslint.config.mjs` or [`tsconfig.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.json)). The CLI scripts automatically pick up these changes without additional wiring.

## Summary

- **`npm install`** initializes the environment by creating `.env` from `.env.example` and installing tool dependencies
- **`npm run lint`** configures ESLint with 2-space indentation, semicolons, double-quotes, and the no-eval rule (Hard Rule #3)
- **Type checking** uses [`tsconfig.typecheck-core.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.typecheck-core.json) for standard checks and [`tsconfig.typecheck-noimplicit-core.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.typecheck-noimplicit-core.json) for CI strictness (Hard Rule #8)
- **`npm run check`** orchestrates lint, type-check, and unit tests into a single meta-command
- All configurations are declarative, stored in [`package.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/package.json), `eslint.config.mjs`, and [`tsconfig.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.json) files
- Entry points `bin/omniroute.mjs` and `bin/cli/program.mjs` map CLI commands to these tooling configurations

## Frequently Asked Questions

### How does the OmniRoute CLI configure ESLint rules?

The CLI configures ESLint by reading `eslint.config.mjs`, which contains the project's shared configuration including the mandatory no-eval rule and 2-space formatting policy. When you run `npm run lint`, the script executes `eslint . --ext .ts,.tsx,.js,.jsx` using this configuration file to enforce code standards.

### What is the difference between `typecheck:core` and `typecheck:noimplicit:core`?

`typecheck:core` uses [`tsconfig.typecheck-core.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.typecheck-core.json) to validate types in the `src/` and `open-sse/` modules with standard strictness. `typecheck:noimplicit:core` uses [`tsconfig.typecheck-noimplicit-core.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/tsconfig.typecheck-noimplicit-core.json) to enable the strictest `noImplicitAny` flag, catching any new `any` usage. The latter runs in CI to enforce Hard Rule #8.

### Where are the CLI command definitions stored?

All CLI command definitions reside in [`package.json`](https://github.com/diegosouzapw/OmniRoute/blob/main/package.json) under the `scripts` section. The entry point `bin/omniroute.mjs` forwards commands to `bin/cli/program.mjs`, which uses Commander.js to map user inputs (like `lint`, `typecheck`, or `test`) to the corresponding npm scripts.

### Why does `npm install` create a `.env` file?

The installation process generates `.env` from `.env.example` to ensure that linting, type-checking, and formatting tools have access to required environment variables (such as `APP_LOG_LEVEL`, `JWT_SECRET`, and `API_KEY_SECRET`) before any other CLI commands execute.