CLI Commands

Complete reference for all Query-2jz CLI commands and their options.

Installation

Install the Query-2jz CLI globally or use it locally in your project.

Global Installation

bash
# Install globally
npm install -g query-2jz

# Verify installation
query-2jz --version

Using with npx (Recommended)

bash
# Use with npx (no installation required)
npx query-2jz --version
npx query-2jz init
npx query-2jz dev

# Or add to package.json scripts
{
  "scripts": {
    "dev": "npx query-2jz dev",
    "build": "npx query-2jz build",
    "generate-types": "npx query-2jz generate-types"
  }
}

Local Installation

bash
# Install locally
npm install query-2jz

# Use locally
npx query-2jz --version

Basic Commands

Essential commands for getting started with Query-2jz.

Core Commands

Basic Query-2jz CLI commands

Help and Version

bash
# Show help
query-2jz --help
query-2jz -h

# Show version
query-2jz --version
query-2jz -v

# Show help for specific command
query-2jz <command> --help

Initialize Project

bash
# Initialize new Query-2jz project
npx query-2jz init

# Initialize with specific template
npx query-2jz init --template basic

# Initialize in specific directory
npx query-2jz init --dir ./my-project

# Initialize with custom configuration
npx query-2jz init --config ./custom-config.json

This creates a complete project structure with package.json, configuration file, and README.

Start Development Server

bash
# Start development server
npx query-2jz dev

# Start with specific port
npx query-2jz dev --port 3001

# Start with custom config file
npx query-2jz dev --config ./custom-config.js

Note: The development server is currently in development. This command shows a placeholder message.

Generate TypeScript Types

bash
# Generate TypeScript types from models
npx query-2jz generate-types

# Generate with custom output directory
npx query-2jz generate-types --output ./types

# Generate with custom config file
npx query-2jz generate-types --config ./custom-config.js

Note: Type generation is currently in development. This command shows a placeholder message.

Build Project

bash
# Build project for production
npx query-2jz build

# Build with custom config file
npx query-2jz build --config ./custom-config.js

Note: The build process is currently in development. This command shows a placeholder message.

Current CLI Status

The Query-2jz CLI is currently in active development. Here's what's available now and what's coming soon.

Available Now

  • npx query-2jz init - Initialize new projects
  • npx query-2jz dev - Development server (placeholder)
  • npx query-2jz generate-types - Type generation (placeholder)
  • npx query-2jz build - Build process (placeholder)
  • npx query-2jz --help - Help and version info

Coming Soon

  • • Database management commands
  • • Backup and restore functionality
  • • Data export/import tools
  • • Model management commands
  • • Production deployment tools
  • • Testing and validation commands

Database Commands

Commands for managing your database and schema. Note: These commands are planned for future releases.

Database Management

Database and schema management commands

Database Setup

bash
# Create database
query-2jz db create

# Create database with specific name
query-2jz db create --name my-database

# Drop database
query-2jz db drop

# Drop database with confirmation
query-2jz db drop --force

# Reset database (drop and recreate)
query-2jz db reset

# Reset with seed data
query-2jz db reset --seed

Schema Management

bash
# Generate schema from models
query-2jz schema generate

# Generate schema with specific output
query-2jz schema generate --output ./schema.sql

# Apply schema to database
query-2jz schema apply

# Apply schema with dry run
query-2jz schema apply --dry-run

# Migrate schema
query-2jz schema migrate

# Rollback schema migration
query-2jz schema rollback

# Show schema status
query-2jz schema status

Seed Data

bash
# Seed database with sample data
query-2jz db seed

# Seed with specific seeder
query-2jz db seed --seeder users
query-2jz db seed --seeder products

# Seed with custom data file
query-2jz db seed --file ./custom-seed.json

# Clear seed data
query-2jz db seed --clear

Backup Commands

Commands for backing up and restoring your data.

Backup Operations

Data backup and restore commands

Create Backup

bash
# Create full backup
query-2jz backup create

# Create backup with custom name
query-2jz backup create --name my-backup

# Create backup to specific location
query-2jz backup create --output ./backups/

# Create incremental backup
query-2jz backup create --incremental

# Create backup since specific date
query-2jz backup create --since 2024-01-01

# Create backup with compression
query-2jz backup create --compress

# Create backup with encryption
query-2jz backup create --encrypt --key-file ./backup.key

List Backups

bash
# List all backups
query-2jz backup list

# List backups with details
query-2jz backup list --detailed

# List backups by date range
query-2jz backup list --since 2024-01-01 --until 2024-12-31

# List backups by type
query-2jz backup list --type full
query-2jz backup list --type incremental

Restore Backup

bash
# Restore from backup
query-2jz backup restore --backup ./backup-2024-01-01

# Restore with validation
query-2jz backup restore --validate --backup ./backup-2024-01-01

# Restore specific models
query-2jz backup restore --models User,Post --backup ./backup-2024-01-01

# Restore with rollback option
query-2jz backup restore --rollback --backup ./backup-2024-01-01

Backup Management

bash
# Validate backup integrity
query-2jz backup validate --backup ./backup-2024-01-01

# Validate with checksum
query-2jz backup validate --checksum --backup ./backup-2024-01-01

# Clean up old backups
query-2jz backup cleanup --retention-days 30

# Clean up with dry run
query-2jz backup cleanup --dry-run --retention-days 30

Export Commands

Commands for exporting data in various formats.

Export Data

bash
# Export all data to JSON
query-2jz export data --format json --output ./exports/data.json

# Export specific models
query-2jz export data --models User,Post --format json

# Export with filters
query-2jz export data --where '{"status":"active"}' --format json

# Export to CSV
query-2jz export data --format csv --output ./exports/data.csv

# Export to SQL
query-2jz export data --format sql --output ./exports/data.sql

# Export with date range
query-2jz export data --since 2024-01-01 --until 2024-12-31

# Export with compression
query-2jz export data --compress --output ./exports/data.json.gz

Export Schema

bash
# Export schema only
query-2jz export schema --output ./exports/schema.json

# Export schema to SQL
query-2jz export schema --format sql --output ./exports/schema.sql

# Export specific models schema
query-2jz export schema --models User,Post --output ./exports/schema.json

Import Commands

Commands for importing data from various sources.

Import Data

bash
# Import from JSON
query-2jz import data --format json --input ./imports/data.json

# Import from CSV
query-2jz import data --format csv --input ./imports/data.csv

# Import from SQL
query-2jz import data --format sql --input ./imports/data.sql

# Import with validation
query-2jz import data --validate --input ./imports/data.json

# Import with batch size
query-2jz import data --batch-size 1000 --input ./imports/data.json

# Import with rollback on error
query-2jz import data --rollback-on-error --input ./imports/data.json

Import Schema

bash
# Import schema from JSON
query-2jz import schema --format json --input ./imports/schema.json

# Import schema from SQL
query-2jz import schema --format sql --input ./imports/schema.sql

# Import with validation
query-2jz import schema --validate --input ./imports/schema.json

Development Commands

Commands for development and testing.

Code Generation

bash
# Generate types
query-2jz generate types

# Generate types with specific output
query-2jz generate types --output ./types/

# Generate API client
query-2jz generate client

# Generate client with specific language
query-2jz generate client --language typescript
query-2jz generate client --language javascript

# Generate documentation
query-2jz generate docs

# Generate docs with specific format
query-2jz generate docs --format markdown
query-2jz generate docs --format html

Testing

bash
# Run tests
query-2jz test

# Run tests with coverage
query-2jz test --coverage

# Run specific test file
query-2jz test --file ./tests/user.test.js

# Run tests in watch mode
query-2jz test --watch

# Run tests with specific environment
query-2jz test --env test

Linting and Formatting

bash
# Lint code
query-2jz lint

# Lint with auto-fix
query-2jz lint --fix

# Format code
query-2jz format

# Format with specific options
query-2jz format --write

Production Commands

Commands for production deployment and management.

Build and Deploy

bash
# Build for production
query-2jz build

# Build with specific environment
query-2jz build --env production

# Build with optimization
query-2jz build --optimize

# Deploy to production
query-2jz deploy

# Deploy to specific environment
query-2jz deploy --env staging
query-2jz deploy --env production

# Deploy with rollback option
query-2jz deploy --rollback

Monitoring

bash
# Show application status
query-2jz status

# Show detailed status
query-2jz status --detailed

# Show logs
query-2jz logs

# Show logs with tail
query-2jz logs --tail

# Show logs with filter
query-2jz logs --filter error

# Show metrics
query-2jz metrics

# Show metrics with specific time range
query-2jz metrics --since 1h

Command Options

Common options available across all commands.

Global Options

bash
# Configuration file
--config, -c <file>     Use specific configuration file
--env <environment>     Use specific environment
--verbose, -v           Enable verbose output
--quiet, -q             Suppress output
--help, -h              Show help
--version, -V           Show version

# Examples
query-2jz backup create --config ./prod-config.json
query-2jz export data --env production --verbose
query-2jz dev --quiet

Output Options

bash
# Output formatting
--output, -o <path>     Specify output path
--format <format>       Specify output format (json, csv, sql)
--pretty                Pretty print JSON output
--no-color              Disable colored output

# Examples
query-2jz export data --output ./data.json --format json --pretty
query-2jz backup create --output ./backups/ --no-color

Best Practices

Do

  • • Use version control for configuration files
  • • Test commands in development first
  • • Use dry-run options when available
  • • Keep backups before major operations
  • • Use environment-specific configurations
  • • Document custom commands and scripts
  • • Use verbose mode for debugging

Don't

  • • Run destructive commands without backup
  • • Use production data in development
  • • Ignore error messages
  • • Skip validation steps
  • • Use hardcoded paths in scripts
  • • Ignore security warnings
  • • Skip testing after changes