The grunt command line interface that provides the global grunt command for running locally installed Grunt tasks
npx @tessl/cli install tessl/npm-grunt-cli@1.5.0grunt-cli is the command line interface for Grunt, a JavaScript task runner. It provides the global grunt command that locates and loads locally installed Grunt instances in projects, enabling developers to run Grunt tasks from anywhere in their system while maintaining project-specific Grunt versions.
npm install -g grunt-cligrunt-cli is designed as a global CLI tool, not as a library to import. It provides the grunt command globally after installation.
# Install grunt-cli globally
npm install -g grunt-cli
# Run grunt tasks in a project directory
grunt
grunt build
grunt test
# Display version
grunt --version
# Show help
grunt --help
# Enable shell auto-completion
eval "$(grunt --completion=bash)" # For Bash
eval "$(grunt --completion=zsh)" # For Zshgrunt-cli follows a delegation pattern where the global CLI finds and executes locally installed Grunt instances:
The primary interface for executing Grunt tasks and managing the CLI.
// Command line usage patterns
grunt [tasks...] [options...]
// Available command line options:
--help // Display help information
--version // Show grunt-cli version
--base <path> // Base directory for resolving paths
--gruntfile <path> // Path to Gruntfile
--require <module> // Module(s) to require before loading Gruntfile
--preload <module> // Preload modules
--verbose // Enable verbose mode
--completion <shell> // Output shell completion script (bash/zsh)Shell tab completion functionality for Bash and Zsh shells.
# Enable bash completion
eval "$(grunt --completion=bash)"
# Enable zsh completion
eval "$(grunt --completion=zsh)"Usage Example:
# Add to ~/.bashrc for persistent bash completion
echo 'eval "$(grunt --completion=bash)"' >> ~/.bashrc
# Add to ~/.zshrc for persistent zsh completion
echo 'eval "$(grunt --completion=zsh)"' >> ~/.zshrcThe completion system provides:
The CLI includes internal modules for completion and information display (not intended for external use):
// lib/completion.js
exports.print = function(name: string): void;
// lib/info.js
exports.version = function(): void;
exports.fatal = function(msg: string, code: number): void;
exports.help = function(): void;
exports.helpHeader = function(): void;
exports.helpFooter = function(): void;grunt-cli provides helpful error messages for common issues:
grunt-cli integrates several key dependencies:
# Global installation (recommended)
npm install -g grunt-cli
# Local installation (for npm scripts)
npm install grunt-cli --save-dev
# Usage in package.json scripts
{
"scripts": {
"build": "grunt build",
"test": "grunt test"
}
}npm install -g grunt-cli for the global commandnpm install grunt --save-dev)