or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

build-management.mdcli-commands.mdindex.mdinitialization.mdutilities.md
tile.json

cli-commands.mddocs/

CLI Commands

Main command-line interface for gts providing TypeScript project management operations including initialization, linting, fixing, and cleanup.

Capabilities

Run Function

Main entry point for executing gts CLI commands programmatically.

/**
 * Execute gts commands programmatically
 * @param verb - Command to execute: 'init', 'lint', 'check', 'fix', or 'clean'
 * @param files - Array of file patterns to process (optional for most commands)
 * @returns Promise resolving to true on success, false on failure
 */
function run(verb: string, files: string[]): Promise<boolean>;

Usage Examples:

import { run } from "gts/build/src/cli";

// Initialize gts in current directory
const success = await run("init", []);

// Lint specific files
const lintResult = await run("lint", ["src/**/*.ts"]);

// Fix all TypeScript files
const fixResult = await run("fix", []);

// Clean build output
const cleanResult = await run("clean", []);

CLI Binary

Command-line interface accessible via the gts command after installation.

gts init

Initialize gts configuration in a TypeScript project.

gts init [options]

Options:

  • --yes, -y: Assume yes answer for all prompts
  • --no, -n: Assume no answer for all prompts
  • --dry-run: Preview changes without making them
  • --yarn: Use yarn instead of npm

Actions performed:

  • Adds npm scripts (lint, clean, compile, fix, prepare, pretest, posttest)
  • Installs dev dependencies (gts, typescript, @types/node)
  • Creates .eslintrc.json configuration
  • Creates .eslintignore file
  • Creates tsconfig.json extending gts configuration
  • Creates .prettierrc.js configuration
  • Creates .editorconfig file
  • Installs template TypeScript files in src/ directory
  • Runs npm/yarn install

gts lint / gts check

Check code for formatting and linting issues.

gts lint [file-patterns...]
gts check [file-patterns...]  # Alias for lint

Examples:

gts lint                      # Lint all TypeScript files
gts lint src/**/*.ts         # Lint specific patterns
gts check src/index.ts       # Check single file

Default patterns when no files specified:

  • **/*.ts
  • **/*.js
  • **/*.tsx
  • **/*.jsx

gts fix

Automatically fix formatting and linting issues.

gts fix [file-patterns...] [options]

Options:

  • --dry-run: Preview fixes without applying them

Examples:

gts fix                      # Fix all TypeScript files
gts fix src/**/*.ts         # Fix specific patterns
gts fix --dry-run           # Preview fixes

gts clean

Remove build output files based on tsconfig.json outDir setting.

gts clean [options]

Options:

  • --dry-run: Preview cleanup without deleting files

Node Version Checking

Built-in Node.js version validation.

/**
 * Get the current version of Node.js being run
 * @returns Node.js version string (e.g., "v18.17.0")
 */
function getNodeVersion(): string;

The CLI automatically validates that Node.js version 10 or higher is being used and throws an error for older versions. However, the package.json specifies "node": ">=18" as the engine requirement, so in practice Node.js 18+ is required.

Error Handling

All CLI commands return boolean success indicators:

  • true: Command completed successfully
  • false: Command failed (linting errors, build failures, etc.)

For programmatic usage, catch exceptions for system-level errors:

import { run } from "gts/build/src/cli";

try {
  const success = await run("lint", []);
  if (!success) {
    console.error("Linting failed");
    process.exit(1);
  }
} catch (error) {
  console.error("System error:", error.message);
  process.exit(1);
}