whyml

WhyML CLI Commands

The WhyML Command Line Interface provides powerful tools for manifest processing, application generation, and development server management.

πŸš€ Quick Start

# Start development server
whyml run -f manifest.yaml --watch

# Convert manifest using natural language syntax
whyml convert --from manifest.yaml --to app.html -as pwa

# Generate application artifacts
whyml generate pwa -f manifest.yaml -o ./pwa-app

πŸ“‹ Command Overview

Command Description Example
run Start development server whyml run -f manifest.yaml -p 8080
serve Alias for run command whyml serve --port 3000 --watch
convert Convert manifest to different formats whyml convert --from manifest.yaml --to app.html -as spa
generate Generate application artifacts whyml generate docker -f manifest.yaml
validate Validate manifest files whyml validate manifest.yaml
scrape Advanced website scraping to manifests whyml scrape https://example.com -o manifest.yaml --simplify-structure

🎯 Natural Language Syntax

WhyML supports intuitive, natural language-like command syntax:

# Natural conversion syntax
whyml convert --from source.yaml --to output.html -as format

# Supported formats
whyml convert --from manifest.yaml --to app.html -as html      # HTML page
whyml convert --from manifest.yaml --to App.tsx -as react     # React component  
whyml convert --from manifest.yaml --to App.vue -as vue       # Vue component
whyml convert --from manifest.yaml --to app.php -as php       # PHP class
whyml convert --from manifest.yaml --to app.html -as spa      # Single Page App
whyml convert --from manifest.yaml --to app.html -as pwa      # Progressive Web App

βš™οΈ Global Options

whyml [GLOBAL_OPTIONS] <command> [COMMAND_OPTIONS]

Global Options:
  --version          Show WhyML version
  --verbose, -v      Enable verbose output
  --help            Show help message

πŸ”§ Configuration

Environment Variables

# Server configuration
export WHYML_HOST=localhost
export WHYML_PORT=8080
export WHYML_WATCH=true

# Application settings
export WHYML_DEFAULT_FORMAT=html
export WHYML_OUTPUT_DIR=./output
export WHYML_MANIFEST_DIR=./manifests

Configuration Files

WhyML supports configuration via:

Example Config File

# whyml.config.yaml
server:
  host: "localhost"
  port: 8080
  watch: true
  auto_reload: true

conversion:
  optimize_output: true
  include_meta_tags: true
  css_framework: "tailwind"

generation:
  pwa:
    theme_color: "#2196f3"
    background_color: "#ffffff"
  docker:
    node_version: "18-alpine"
    port: 8080

πŸ“± Common Workflows

Development Workflow

# 1. Create or edit your manifest
vim manifest.yaml

# 2. Validate the manifest
whyml validate manifest.yaml

# 3. Start development server with watching
whyml run -f manifest.yaml --watch

# 4. Test different formats
whyml convert --from manifest.yaml --to test.html -as spa
whyml convert --from manifest.yaml --to App.tsx -as react

Production Deployment

# 1. Generate production artifacts
whyml generate pwa -f manifest.yaml -o ./dist
whyml generate docker -f manifest.yaml -o ./docker

# 2. Generate server configuration
whyml generate caddy -f manifest.yaml -o ./Caddyfile.json \
  --config '{"domain": "yourdomain.com", "tls_provider": "letsencrypt"}'

# 3. Deploy using generated configuration
docker-compose up -d

Mobile App Development

# Generate Progressive Web App
whyml generate pwa -f manifest.yaml -o ./pwa

# Generate mobile app configuration (Capacitor)
whyml generate apk -f manifest.yaml -o ./mobile-app

# Generate desktop app (Tauri)
whyml generate tauri -f manifest.yaml -o ./desktop-app

πŸ› οΈ Advanced Usage

Custom Configuration

# Use custom configuration file
whyml convert --from manifest.yaml --to app.html -as pwa --config pwa-config.json

# Use environment file
whyml convert --from manifest.yaml --to app.html -as spa --env-file .env.production

Batch Processing

# Process multiple manifests
for manifest in manifests/*.yaml; do
  whyml convert --from "$manifest" --to "output/$(basename "$manifest" .yaml).html" -as spa
done

Integration with CI/CD

# In your CI/CD pipeline
whyml validate manifest.yaml
whyml generate docker -f manifest.yaml -o ./dist
whyml generate caddy -f manifest.yaml -o ./Caddyfile.json

πŸ” Debugging and Troubleshooting

Verbose Output

# Enable verbose logging
whyml --verbose run -f manifest.yaml

# Debug specific conversions
whyml --verbose convert --from manifest.yaml --to debug.html -as pwa

Common Issues

  1. Manifest Validation Errors
    whyml validate manifest.yaml  # Check for syntax errors
    
  2. Server Won’t Start
    whyml --verbose run -f manifest.yaml  # Check for detailed errors
    
  3. Conversion Failures
    # Test with minimal manifest
    whyml convert --from minimal.yaml --to test.html -as html
    

πŸ“š See Also