CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-nx

AI-first build platform designed for monorepo development that provides task orchestration, project graph generation, and CLI tools for managing complex software projects

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

cli.mddocs/

Command Line Interface

Nx provides a comprehensive CLI toolkit with 41 commands for monorepo management, project generation, task execution, workspace maintenance, and cloud integration.

Capabilities

Workspace Management

Commands for creating, initializing, and maintaining Nx workspaces.

# Create new workspace
nx new <workspace-name> [options]

# Initialize Nx in existing workspace  
nx init [options]

# Connect workspace to Nx Cloud
nx connect-to-nx-cloud

# Repair workspace configuration
nx repair

# Reset workspace cache and state
nx reset

Project Operations

Commands for managing projects within the workspace.

# Add packages and capabilities to workspace
nx add <package> [options]

# Generate code using generators
nx generate <schematic> [options]
nx g <schematic> [options]

# Import external projects into workspace
nx import <github-url> [options]

# List installed plugins and generators
nx list [plugin]

# Show project information and configuration
nx show project <project-name> [options]

Task Execution

Commands for running tasks and managing task execution.

# Run target on specific project
nx run <project:target[:configuration]> [options]
nx <target> <project> [options]

# Run targets on multiple projects
nx run-many --target=<target> [options]

# Run tasks on affected projects only
nx affected --target=<target> [options]

# Execute command in workspace context
nx exec -- <command>

# Watch files and run commands on changes
nx watch --all -- <command>

Analysis and Reporting

Commands for analyzing workspace structure and generating reports.

# View interactive project dependency graph
nx graph [options]

# Generate workspace report
nx report

# Sync workspace dependencies
nx sync

# Check if workspace needs syncing
nx sync:check

# Format files in workspace
nx format [options]

# Check formatting without modifying files
nx format:check

# Write formatting changes to files  
nx format:write

# View execution logs
nx view-logs

Migration and Maintenance

Commands for upgrading workspace and migrating code.

# Migrate workspace to newer versions
nx migrate <package> [options]

# Register plugin with Nx
nx register <plugin>

Release Management

Commands for versioning and publishing packages.

# Release and versioning commands
nx release [options]

Daemon Operations

Commands for managing the Nx daemon process.

# Nx daemon operations (start/stop/status)
nx daemon [options]

CI and Analysis

Commands for continuous integration and task analysis.

# Fix CI configuration issues
nx fix-ci

# Record task execution for analysis
nx record

# Start CI run processes
nx start-ci-run

Cloud Integration

Commands for Nx Cloud authentication and integration.

# Login to Nx Cloud
nx login

# Logout from Nx Cloud  
nx logout

# Connect workspace to Nx Cloud (deprecated, use nx connect)
nx connect-to-nx-cloud

Development Tools

Commands for development workflow and compliance.

# Model Context Protocol server operations
nx mcp [options]

# Check workspace conformance rules
nx conformance [options]

# Run conformance checks
nx conformance:check

Legacy Commands

Deprecated commands maintained for backward compatibility.

# Print affected projects (deprecated, use nx affected)
nx print-affected [options]

# Show affected dependency graph (deprecated, use nx graph)
nx affected:graph [options]

# Build affected projects (deprecated, use nx affected --target=build)  
nx affected:build [options]

# Test affected projects (deprecated, use nx affected --target=test)
nx affected:test [options]

# Lint affected projects (deprecated, use nx affected --target=lint)
nx affected:lint [options]

# E2E test affected projects (deprecated, use nx affected --target=e2e)
nx affected:e2e [options]

Command Details

Core Workspace Commands

new

Creates a new Nx workspace from scratch.

nx new <workspace-name> [options]

Options:
  --preset                 The preset to use for generating the workspace
  --packageManager         Package manager to use (npm, yarn, pnpm)
  --nxCloud               Enable Nx Cloud integration
  --interactive           Enable interactive mode for prompts

init

Initializes Nx in an existing workspace with workspace-specific configuration.

nx init [options]

Options:
  --nxCloud               Enable Nx Cloud integration
  --interactive           Enable interactive mode for prompts
  --cacheable             Specify which targets should be cacheable

generate

Generates code using available generators/schematics.

nx generate <schematic> [options]
nx generate <plugin>:<schematic> [options]

Examples:
  nx generate @nx/react:app my-app
  nx generate @nx/react:component my-component --project=my-app
  nx generate workspace-generator my-generator
  
Options:
  --dry-run               Preview changes without writing files
  --interactive           Enable interactive mode for prompts

Task Execution Commands

run

Runs a target on a specific project.

nx run <project:target[:configuration]> [options]
nx <target> <project> [options]

Examples:
  nx run my-app:build
  nx run my-app:build:production
  nx build my-app
  nx test my-lib
  
Options:
  --configuration         Configuration to use
  --skip-nx-cache        Skip Nx cache
  --verbose              Print additional error stack trace

run-many

Runs a target on multiple projects.

nx run-many --target=<target> [options]

Options:
  --target                Target to run
  --projects              Projects to run target on
  --all                   Run target on all projects
  --parallel              Max number of parallel processes
  --exclude               Exclude specific projects
  --skip-nx-cache        Skip Nx cache
  --configuration         Configuration to use

affected

Runs tasks only on projects affected by code changes.

nx affected --target=<target> [options]

Options:
  --target                Target to run on affected projects
  --base                  Base of the current branch (SHA or branch name)
  --head                  Latest commit of the current branch (SHA or branch name)
  --files                 Change the way Nx is calculating the affected
  --parallel              Max number of parallel processes
  --exclude               Exclude specific projects
  --skip-nx-cache        Skip Nx cache

Analysis Commands

graph

Displays an interactive project dependency graph.

nx graph [options]

Options:
  --file                  Output file (default: nx-graph.html)
  --focus                 Focus on specific project
  --exclude               Exclude projects from graph
  --groupByFolder         Group projects by folder structure
  --watch                 Watch for changes and update graph
  --open                  Open graph in browser (default: true)

show

Shows configuration and information about projects.

nx show project <project-name> [options]
nx show projects [options]

Options:
  --json                  Output in JSON format
  --web                   Show project details in browser

list

Lists installed plugins and available generators/executors.

nx list [plugin]

Examples:
  nx list                     # List all installed plugins
  nx list @nx/react          # Show generators/executors for @nx/react

Utility Commands

format

Formats files in the workspace using configured formatters.

nx format [options]

Options:
  --files                 Format specific files
  --all                   Format all files
  --uncommitted          Format uncommitted files only
  --untracked            Format untracked files only
  --base                  Base branch for comparison
  --head                  Head branch for comparison

report

Generates a report about the workspace configuration and environment.

nx report

# Outputs information about:
# - Nx version
# - Operating system
# - Package manager
# - Installed plugins
# - Project structure

sync

Synchronizes workspace dependencies and configurations.

nx sync

# Analyzes package.json files and updates workspace configuration
# to ensure all projects have consistent dependencies

login

Authenticates with Nx Cloud for remote caching and distributed execution.

nx login

# Opens browser for authentication with Nx Cloud
# Stores authentication token for future operations

logout

Removes Nx Cloud authentication.

nx logout

# Removes stored authentication token
# Disables remote caching until login again

Advanced Commands

migrate

Migrates workspace to newer versions and applies code transformations.

nx migrate <package> [options]
nx migrate --run-migrations

Options:
  --from                  Starting version for migration
  --to                    Target version for migration
  --run-migrations       Apply pending migrations
  --interactive          Enable interactive mode

daemon

Manages the Nx daemon for improved performance.

nx daemon [options]

Options:
  --start                Start the daemon
  --stop                 Stop the daemon  
  --restart              Restart the daemon
  --status               Check daemon status

Exit Codes

All Nx CLI commands return appropriate exit codes:

  • 0: Success
  • 1: General error
  • 3: Task execution failure (some tasks failed)

Environment Variables

Key environment variables that affect CLI behavior:

  • NX_DAEMON: Enable/disable daemon (true/false)
  • NX_CACHE_DIRECTORY: Override cache directory location
  • NX_DEFAULT_BASE: Default base branch for affected calculations
  • NX_PARALLEL: Default number of parallel processes
  • NX_VERBOSE_LOGGING: Enable verbose logging
  • NX_DRY_RUN: Enable dry-run mode for all operations

Install with Tessl CLI

npx tessl i tessl/npm-nx

docs

cli.md

devkit-core.md

devkit-files.md

devkit-tasks.md

generators-executors.md

index.md

plugins.md

tile.json