or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli.mddevelopment-integration.mdindex.mdprogrammatic-api.md
tile.json

cli.mddocs/

Command Line Interface

Fast CLI tools for transforming Flow files and running Flow-typed JavaScript with support for single files, directories, and advanced options.

Capabilities

Flow Remove Types CLI

Command-line tool for batch transformation of Flow-typed JavaScript files with flexible input/output options.

flow-remove-types [options] [sources]

# Options:
#   -h, --help        Show help message
#   -v, --version     Print version number
#   -i, --ignore      Paths to ignore (Regular Expression)
#   -x, --extensions  File extensions to transform
#   -o, --out-file    Output file path (single file)
#   -d, --out-dir     Output directory path (multiple files)
#   -a, --all         Transform all files, not just @flow files
#   -p, --pretty      Remove types without whitespace replacement
#   --ignore-uninitialized-fields    Remove uninitialized class fields completely
#   --remove-empty-imports           Remove empty import statements
#   -m, --sourcemaps  Generate source maps (optional "inline")
#   -q, --quiet       Suppress progress output

Usage Examples:

# Transform single file
flow-remove-types --out-file output.js input.js

# Transform multiple files to directory
flow-remove-types --out-dir dist/ src/app.js src/utils.js

# Transform entire directory
flow-remove-types --out-dir dist/ src/

# Transform with source maps
flow-remove-types --out-dir dist/ --sourcemaps src/

# Transform with inline source maps
flow-remove-types --out-dir dist/ --sourcemaps inline src/

# Transform from stdin
cat input.js | flow-remove-types > output.js

# Transform all files (ignore @flow pragma)
flow-remove-types --all --out-dir dist/ src/

# Pretty transform with advanced options
flow-remove-types --pretty --ignore-uninitialized-fields --remove-empty-imports --out-dir dist/ src/

Flow Node REPL

Node.js replacement with automatic Flow type removal for development and testing.

flow-node [options] [script.js] [arguments]

# Options:
#   -h, --help         Show help message  
#   -v, --version      Print version number
#   -e, --eval script  Evaluate Flow-typed script
#   -p, --print script Evaluate and print script result
#   -c, --check        Syntax check without execution
#   -a, --all          Interpret all files as Flow-typed

Usage Examples:

# Start Flow-aware REPL
flow-node

# Run Flow-typed script
flow-node app.js

# Evaluate Flow code directly
flow-node -e "const x: number = 42; console.log(x);"

# Print evaluation result
flow-node -p "const users: Array<string> = ['Alice', 'Bob']; users.length"

# Syntax check without running
flow-node -c app.js

# Run with all files as Flow-typed
flow-node -a script.js

CLI Behavior

File Extension Handling

Default supported extensions: .js, .mjs, .cjs, .jsx, .flow, .es6

# Custom extensions
flow-remove-types -x .js,.jsx,.ts,.tsx --out-dir dist/ src/

Directory Processing

When processing directories, the CLI recursively finds files with supported extensions:

# Process all supported files in src/
flow-remove-types --out-dir dist/ src/

# Ignore node_modules (default) and custom patterns
flow-remove-types --ignore "test|spec" --out-dir dist/ src/

Source Map Generation

Source maps help debug transformed code by mapping back to original Flow-typed source:

# External source maps (creates .js.map files)
flow-remove-types --sourcemaps --out-dir dist/ src/

# Inline source maps (embedded in JavaScript)
flow-remove-types --sourcemaps inline --out-dir dist/ src/

Error Handling

The CLI provides formatted error output with source context for syntax errors:

input.js
 ↳ Syntax Error: Unexpected token (12:5)
   12:  const x: invalid syntax here
                  ^

Exit Codes

  • 0: Success
  • 1: Error (syntax error, file not found, invalid options)

Flow Node REPL Features

Interactive Development

The Flow Node REPL provides an interactive environment for testing Flow-typed code:

$ flow-node
> const users: Array<{name: string}> = [{name: 'Alice'}]
undefined
> users[0].name
'Alice'
> users.map((u: {name: string}) => u.name.toUpperCase()) 
['ALICE']

Script Execution

Flow Node can execute Flow-typed scripts directly without pre-compilation:

// math.js
function add(a: number, b: number): number {
  return a + b;
}

console.log(add(2, 3));
$ flow-node math.js
5

Syntax Checking

Validate Flow syntax without executing code:

$ flow-node -c problematic.js
problematic.js:5
const x: invalid syntax here
         ^
SyntaxError: Unexpected token