Complete command-line interface for CSpell providing comprehensive spell checking workflows, configuration management, and debugging tools.
Primary spell checking command that recursively checks files against configuration and dictionaries.
cspell [options] [globs...]
cspell lint [options] [globs...]
# File patterns supported:
# - Glob patterns: "**/*.js", "src/**/*.ts"
# - File paths: file://path/to/file
# - Stdin: stdin or stdin://path/for/context
# - Multiple patterns: "**/*.txt" "**/*.js"Key Options:
-c, --config <cspell.json>: Configuration file path-v, --verbose: Display detailed information--locale <locale>: Set language locales (e.g., "en,fr", "en-GB")--language-id <file-type>: Force programming language for unknown extensions-e, --exclude <glob>: Exclude files matching glob patterns--words-only: Only output words not found in dictionaries-u, --unique: Only output first instance of each unknown word--no-issues: Don't show spelling errors--no-progress: Turn off progress messages--no-summary: Turn off summary message-s, --silent: Silent mode--no-exit-code: Don't return exit code for issues--fail-fast: Exit after first file with issue--show-context: Show surrounding text around issues--show-suggestions: Show spelling suggestions--cache: Use cache for changed files only--cache-location <path>: Path to cache file/directory--cache-strategy <strategy>: Cache strategy for detecting changed files (content|metadata)--gitignore: Use .gitignore files to exclude files--must-find-files: Error if no files are found to check--reporter <module|path>: Specify custom reporters--issue-template [template]: Custom issue output template--dot: Include files/directories starting with '.' in glob search--root <path>: Root directory for relative pathsUsage Examples:
# Basic usage
cspell . # Check all files recursively
cspell "*.js" # Check all .js files in current directory
cspell "**/*.js" # Check all .js files recursively
cspell "src/**/*.js" # Only check .js under src
cspell "**/*.txt" "**/*.js" # Check both .txt and .js files
cspell "**/*.{txt,js,md}" # Check .txt, .js, and .md files
# Advanced usage
cspell . --reporter @cspell/cspell-json-reporter # Use JSON reporter
cspell . --reporter default # Force default reporter
cspell "*.md" --exclude CHANGELOG.md --files README.md CHANGELOG.md # Exclude specific files
cat LICENSE | cspell stdin # Check stdin
cspell stdin://docs/doc.md # Check stdin with file contextInteractive spell checking that shows the entire file with spelling issues highlighted in color.
cspell check [files...]Options:
-c, --config <cspell.json>: Configuration file path--validate-directives: Validate in-document CSpell directives--no-color: Turn off color output--color: Force color output--no-exit-code: Don't return exit code for issuesUsage Examples:
cspell check README.md # Interactive check single file
cspell check src/*.ts --no-color # Check TypeScript files without color
cspell check . --validate-directives # Validate CSpell directives in filesDebug and trace word lookup through dictionaries and configurations to understand how words are processed.
cspell trace [words...]Options:
-c, --config <cspell.json>: Configuration file path--locale <locale>: Set language locales--language-id <language>: Use specific programming language--allow-compound-words: Enable compound word checking--ignore-case: Ignore case and accents when searching--dictionary <name>: Enable specific dictionaries--dictionary-path <format>: Configure dictionary path display (hide/short/long/full)--stdin: Read words from stdin--all: Show all dictionaries--only-found: Show only dictionaries containing the wordsUsage Examples:
cspell trace "JavaScript" "camelCase" # Trace specific words
cspell trace --stdin < words.txt # Trace words from stdin
cspell trace "API" --all # Show all dictionaries for word
cspell trace "someWord" --only-found # Show only dictionaries containing word
cspell trace "compoundword" --allow-compound-words # Enable compound word checkingGenerate spelling suggestions for misspelled words with configurable suggestion algorithms.
cspell suggestions [words...]
# Aliases: cspell sug [words...]
# cspell suggest [words...]Options:
-c, --config <cspell.json>: Configuration file path--locale <locale>: Set language locales--language-id <language>: Use specific programming language-s, --no-strict: Ignore case and accents (alias: --ignore-case)--num-changes <number>: Number of changes allowed (default: 4)--num-suggestions <number>: Number of suggestions (default: 8)--no-include-ties: Limit suggestions strictly--stdin: Use stdin for input--repl: Interactive REPL interface-v, --verbose: Show detailed output-d, --dictionary <name>: Use specific dictionariesUsage Examples:
cspell suggestions "teh" "recieve" # Get suggestions for words
cspell sug "javscript" --num-suggestions 5 # Limit to 5 suggestions
cspell suggest --repl # Interactive REPL mode
cspell suggestions --stdin < misspelled.txt # Process words from stdin
cspell sug "api" --verbose # Show detailed suggestion infoInitialize a new CSpell configuration file with customizable settings and format options.
cspell init [options]Options:
-c, --config <path>: Path to configuration file (conflicts with --output/--format)-o, --output <path>: Define where to write file--format <format>: File format (yaml/yml/json/jsonc, default: yaml)--import <path|package>: Import configuration file or dictionary package--locale <locale>: Define locale for spell checking--dictionary <dictionary>: Enable dictionaries--no-comments: Don't add comments to config file--no-schema: Don't add schema reference--stdout: Write configuration to stdoutUsage Examples:
cspell init # Create default cspell.yaml
cspell init --format json # Create JSON format config
cspell init --output .cspell.json --format json # Specific output file
cspell init --locale en-US,es-ES # Multi-locale configuration
cspell init --dictionary typescript,python # Enable specific dictionaries
cspell init --stdout # Output to stdout
cspell init --no-comments --no-schema # Minimal config fileUpdate an existing CSpell configuration file with new settings and imports.
cspell config [options]Options:
-c, --config <path>: Path to configuration file--import <path|package>: Import configuration or dictionary package--locale <locale>: Define locale for spell checking--dictionary <dictionary>: Enable dictionaries--no-comments: Don't add comments to config fileUsage Examples:
cspell config --dictionary medical # Add medical dictionary
cspell config --locale fr-FR # Add French locale
cspell config --import @cspell/dict-python # Import Python dictionary package
cspell config --config custom.json --dictionary typescript # Update specific configManage global CSpell configuration and dictionary links for system-wide settings.
cspell link <subcommand>
# Subcommands:
cspell link list # List linked configurations (default)
cspell link ls # Alias for list
cspell link add <dictionaries...> # Add dictionaries to global config
cspell link a <dictionaries...> # Alias for add
cspell link remove <paths...> # Remove paths/packages from global config
cspell link r <paths...> # Alias for removeUsage Examples:
cspell link list # Show current global links
cspell link add typescript python # Add dictionaries globally
cspell link add @cspell/dict-medical # Add dictionary package globally
cspell link remove @cspell/dict-old # Remove dictionary from global configList and manage available dictionaries with detailed information about their configurations and supported file types.
cspell dictionaries [options]Options:
-c, --config <cspell.json>: Configuration file path--path-format <format>: Configure dictionary path display (hide/short/long/full)--enabled: Show only enabled dictionaries--no-enabled: Don't show enabled dictionaries--locale <locale>: Set language locales--file-type <fileType>: File type to filter by--no-show-location: Don't show dictionary location--show-file-types: Show supported file types--show-locales: Show supported language localesUsage Examples:
cspell dictionaries # List all available dictionaries
cspell dictionaries --enabled # Show only enabled dictionaries
cspell dictionaries --locale en-US # Filter by locale
cspell dictionaries --file-type javascript # Show dictionaries for JavaScript
cspell dictionaries --show-file-types # Display supported file types
cspell dictionaries --path-format full # Show full dictionary pathsAll commands support these global options:
--flag <flag:value> # Declare execution flag values (hidden)
--default-configuration # Load default configuration and dictionaries
--no-default-configuration # Don't load default configuration
--color # Force color output
--no-color # Turn off color outputCSpell supports various flexible input patterns across commands:
# Glob patterns
"**/*.js" # All JavaScript files recursively
"src/**/*.{ts,tsx}" # TypeScript files in src
"!node_modules/**" # Exclude node_modules
# File URLs
file://./path/to/file.txt # Direct file path
# Stdin patterns
stdin # Read from stdin (assume text file)
stdin://path/to/file.js # Read from stdin, use path for file type/config
# Multiple patterns
"**/*.md" "**/*.txt" "src/**" # Multiple glob patternsCSpell uses standard exit codes to indicate different result states:
Several options help optimize performance for large codebases:
--cache # Enable file caching for faster subsequent runs
--cache-location <path> # Specify cache directory location
--fail-fast # Exit immediately after first file with issues
--gitignore # Use .gitignore to exclude files automatically
--dot # Include/exclude dotfiles in glob matchingCI/CD Integration:
# Basic CI check
cspell "**" --no-progress --no-summary
# With custom reporter for CI
cspell "**" --reporter @cspell/cspell-json-reporter --no-progress
# Check only changed files in Git
git diff --name-only | cspell --file-list stdinCustom Templates:
# Custom issue template
cspell . --issue-template "{filename}:{row}:{col} - {text}"
# With color templates
cspell . --issue-template "{green $filename}:{yellow $row:$col} - {red $text}"Multi-language Projects:
# Multiple locales
cspell . --locale "en-US,es-ES,fr-FR"
# Language-specific checking
cspell "*.py" --language-id python
cspell "*.js" --language-id javascript