or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli-operations.mdconfiguration.mdcore-management.mdindex.mdprogrammatic-api.md
tile.json

cli-operations.mddocs/

CLI Operations

Command-line interface providing direct access to AutoRest functionality, including code generation, extension management, and configuration.

Capabilities

Main CLI Entry Point

The primary command-line interface for AutoRest code generation and management.

# Basic syntax
autorest [options] [input-files]

# Common options
autorest --input-file=<spec> --output-folder=<dir> --<generator>
autorest --help
autorest --version [<version>]
autorest --info
autorest --reset

Usage Examples:

# Generate C# client from OpenAPI spec
autorest --input-file=petstore.yaml --output-folder=./generated --csharp

# Generate TypeScript client with specific core version
autorest --input-file=api.json --typescript --version=3.7.0

# Generate multiple languages
autorest --input-file=spec.yaml --csharp --java --python

# Use configuration file
autorest --input-file=readme.md

# Debug mode with verbose output
autorest --input-file=spec.yaml --csharp --debug --verbose

Version Management

Control which version of AutoRest core to use for generation.

interface VersionOptions {
  version?: string;      // Specific version (e.g., "3.7.0", "^3.0.0")
  latest?: boolean;      // Use latest available version
  preview?: boolean;     // Use preview/prerelease version
  v3?: boolean;         // Use version ^3.2.0 (legacy flag)
}

Usage Examples:

# Use specific version
autorest --version=3.7.0 --input-file=spec.yaml --csharp

# Use latest version
autorest --latest --input-file=spec.yaml --java

# Use preview version
autorest --preview --input-file=spec.yaml --typescript

# Use v3 (equivalent to --version=^3.2.0)
autorest --v3 --input-file=spec.yaml --python

Extension Management

Manage AutoRest extensions and core installations.

interface ExtensionCommands {
  info?: boolean;              // Show installed extensions (alias: list-installed)
  "list-installed"?: boolean;  // Show installed extensions
  "list-available"?: boolean;  // Show available core versions
  reset?: boolean;             // Reset AutoRest installation
  "clear-temp"?: boolean;      // Clear temporary data
}

Usage Examples:

# Show installed extensions and core versions
autorest --info
autorest --list-installed

# Show available core versions from npm
autorest --list-available

# Reset AutoRest installation (removes all extensions)
autorest --reset

# Clear temporary data only
autorest --clear-temp

# Reset and clear temp data
autorest --reset --clear-temp

Output and Logging

Control output format and logging verbosity.

interface OutputOptions {
  debug?: boolean;                    // Enable debug output
  verbose?: boolean;                  // Enable verbose output  
  "message-format"?: "regular" | "json";  // Set message format
  json?: boolean;                     // Alias for --message-format=json
  yaml?: boolean;                     // Alias for --message-format=yaml
  "skip-upgrade-check"?: boolean;     // Skip version upgrade notifications
}

Usage Examples:

# Debug mode with detailed output
autorest --input-file=spec.yaml --csharp --debug

# Verbose logging
autorest --input-file=spec.yaml --java --verbose

# JSON formatted output
autorest --input-file=spec.yaml --typescript --json
autorest --input-file=spec.yaml --python --message-format=json

# Skip upgrade notifications
autorest --input-file=spec.yaml --csharp --skip-upgrade-check

# Combined debugging and verbose output
autorest --input-file=spec.yaml --go --debug --verbose --json

Configuration and Input

Specify input files and configuration options.

interface ConfigurationOptions {
  "input-file"?: string;           // Primary input specification file
  configFileOrFolder?: string;     // Configuration file or folder path
  force?: boolean;                 // Force overwrite existing files
  "debug-cli-config-loading"?: boolean; // Debug configuration loading
}

Usage Examples:

# Single input file
autorest --input-file=petstore.json --csharp

# Configuration from specific folder
autorest --config-file=./config/autorest.md --java

# Force overwrite existing generated files
autorest --input-file=spec.yaml --typescript --force

# Debug configuration loading process
autorest --input-file=spec.yaml --csharp --debug-cli-config-loading

Command Processing

Core argument parsing and processing functionality.

/**
 * Parse command-line arguments into structured options
 * @param argv - Command line arguments array (process.argv)
 * @returns Parsed AutoRest arguments object
 */
function parseAutorestArgs(argv: string[]): AutorestArgs;

interface AutorestArgs {
  // Version control
  v3?: boolean;
  preview?: boolean;
  prerelease?: boolean;
  version?: string;
  latest?: boolean;

  // Operations
  reset?: boolean;
  debug?: boolean;
  info?: boolean;
  json?: boolean;
  configFileOrFolder?: string;
  force?: boolean;

  // Output control
  verbose?: boolean;
  "debug-cli-config-loading"?: boolean;
  "message-format"?: "regular" | "json";
  "list-available"?: boolean;
  "clear-temp"?: boolean;
  "list-installed"?: boolean;
  "skip-upgrade-check"?: boolean;
}

Command Functions

Internal command implementations for various CLI operations.

/**
 * Reset AutoRest installation by clearing extensions and core
 * @param args - CLI arguments
 * @returns Exit code (0 for success, non-zero for failure)
 */
function resetAutorest(args: AutorestArgs): Promise<number>;

/**
 * Show all installed AutoRest extensions and core versions
 * @param args - CLI arguments
 * @returns Exit code (0 for success)
 */
function showInstalledExtensions(args: AutorestArgs): Promise<number>;

/**
 * Show available AutoRest core versions from npm registry
 * @param args - CLI arguments  
 * @returns Exit code (0 for success, non-zero for failure)
 */
function showAvailableCoreVersions(args: AutorestArgs): Promise<number>;

Action Functions

Utility actions for CLI operations.

/**
 * Clear temporary data from AutoRest home directory
 * @returns Promise that resolves when cleanup is complete
 */
function clearTempData(): Promise<void>;

/**
 * Check for available AutoRest updates and notify user
 * @param config - AutoRest configuration object
 * @returns Promise that resolves when check is complete
 */
function checkForAutoRestUpdate(config: AutorestConfiguration): Promise<void>;

Exit Codes

The AutoRest CLI returns standard exit codes:

  • 0: Success
  • 1: General failure (exceptions, invalid arguments)
  • 10: Extension folder locked (during reset operations)

Environment Variables

AutoRest respects the following environment variables:

  • AUTOREST_HOME: Override default AutoRest home directory (default: ~/.autorest)
  • autorest.home: Alternative to AUTOREST_HOME