@ifoxxie_dev/cli
v0.0.4
Published
A powerful CLI tool built with NestJS and nest-commander for scaffolding NestJS projects and generating commands with AI assistance.
Readme
ifoxxie_dev
A powerful CLI tool built with NestJS and nest-commander for scaffolding NestJS projects and generating commands with AI assistance.
Features
- Project Scaffolding: Create new NestJS projects from pre-built templates (standalone or CLI)
- AI-Powered Code Generation: Generate new CLI commands using OpenAI
- Multiple Package Managers: Support for npm, yarn, and pnpm
- Interactive Prompts: User-friendly CLI experience with spinners and formatted output
- Auto Module Registration: Automatically updates
app.module.tswhen generating commands
Installation
# Global installation (recommended)
npm install -g @ifoxxie_dev/cli
# Or with yarn
yarn global add @ifoxxie_dev/cli
# Or with pnpm
pnpm add -g @ifoxxie_dev/cliQuick Start
1. Configure OpenAI Token
Before using AI-powered features, configure your OpenAI API token:
ifoxxie_dev configure --token YOUR_OPENAI_TOKENOr use interactive mode:
ifoxxie_dev configure2. Create a New Project
# Create a standalone NestJS project
ifoxxie_dev new project my-app
# Create a CLI project
ifoxxie_dev new project my-cli --template cli
# With automatic dependency installation
ifoxxie_dev new project my-app --install3. Generate Commands with AI
Inside a CLI project:
ifoxxie_dev new command greet "Create a command that greets users by name with optional formal greeting"Commands
configure (alias: config)
Configure CLI settings.
# Set OpenAI token
ifoxxie_dev configure --token <token>
# Show current configuration
ifoxxie_dev configure --show| Option | Alias | Description |
| ----------------- | ----- | ----------------------------- |
| --token <token> | -t | OpenAI API token |
| --show | -s | Display current configuration |
new project (alias: new p)
Create a new NestJS project from templates.
ifoxxie_dev new project <name> [options]| Option | Alias | Description | Default |
| ----------------------- | ----- | ---------------------------------------- | ------------ |
| --template <template> | -t | Project template (standalone or cli) | standalone |
| --overwrite | -o | Overwrite existing directory | false |
| --install | -i | Install dependencies after creation | false |
| --yarn | - | Use yarn for installation | false |
| --pnpm | - | Use pnpm for installation | false |
new command (alias: new c, new cmd)
Generate a new CLI command using AI.
ifoxxie_dev new command <name> <description>| Argument | Description |
| ------------- | ----------------------------------------- |
| name | Command name (e.g., deploy, generate) |
| description | Description of what the command should do |
Configuration
Configuration is stored in ~/.hcoder/config.json and includes:
- OpenAI API token
- Assistant ID
- CLI version
Templates
Available project templates:
| Template | Description |
| ------------ | ------------------------------------------ |
| standalone | Standard NestJS application |
| cli | NestJS CLI application with nest-commander |
Templates are sourced from nestjs-cli-templates.
Requirements
- Node.js >= 18
- Git (for cloning templates)
- OpenAI API key (for AI-powered command generation)
Examples
Creating a CLI Project with Dependencies
ifoxxie_dev new project my-awesome-cli --template cli --install --pnpmGenerating Multiple Commands
cd my-awesome-cli
# Generate a deploy command
ifoxxie_dev new command deploy "Create a command that deploys the application to a specified environment"
# Generate a backup command
ifoxxie_dev new command backup "Create a command that backs up the database with optional compression"Viewing Configuration
ifoxxie_dev config --showOutput:
┌──────────────────────────────────────┐
│ Configuration │
├──────────────┬───────────────────────┤
│ Token │ sk-... │
├──────────────┼───────────────────────┤
│ Assistant ID │ asst_... │
└──────────────┴───────────────────────┘Tech Stack
- NestJS - Progressive Node.js framework
- nest-commander - CLI framework for NestJS
- OpenAI - AI-powered code generation
- chalk - Terminal styling
- ora - Elegant terminal spinners
- cli-table3 - Pretty unicode tables
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
ifoxxie_dev
Made with :heart: using NestJS and nest-commander
