How OmniRoute CLI Setup Commands Configure Coding Tools: ESLint, TypeScript, and Vitest Integration
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, 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.jsonand 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:
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, 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. This command is used by CI to catch any new any usage (Hard Rule #8).
Both commands reference the base 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– Defines all npm scripts that drive the tooling pipelinetsconfig.json– Base TypeScript compiler options used by everytypecheck:*scripttsconfig.typecheck-core.json– Concrete config for thetypecheck:corescripttsconfig.typecheck-noimplicit-core.json– Stricter variant used bytypecheck:noimplicit:coreeslint.config.mjs– ESLint rule set generated by the repo's scaffoldingprettier.config.mjs– Formatting defaults applied by the linting processbin/omniroute.mjs– Entry point that forwards sub-commands to the Commander-based CLIbin/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:
- Installs
node_modulesand materializes.envfrom.env.example - Bootstraps ESLint with the shared config including the no-eval rule
- Invokes TypeScript with appropriate
tsconfig.*files matching CI requirements - 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:
# 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). The CLI scripts automatically pick up these changes without additional wiring.
Summary
npm installinitializes the environment by creating.envfrom.env.exampleand installing tool dependenciesnpm run lintconfigures ESLint with 2-space indentation, semicolons, double-quotes, and the no-eval rule (Hard Rule #3)- Type checking uses
tsconfig.typecheck-core.jsonfor standard checks andtsconfig.typecheck-noimplicit-core.jsonfor CI strictness (Hard Rule #8) npm run checkorchestrates lint, type-check, and unit tests into a single meta-command- All configurations are declarative, stored in
package.json,eslint.config.mjs, andtsconfig.jsonfiles - Entry points
bin/omniroute.mjsandbin/cli/program.mjsmap 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 to validate types in the src/ and open-sse/ modules with standard strictness. typecheck:noimplicit:core uses 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 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.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →