# jpl-website - Rustelo Implementation
# Generated from basic template
# Self-contained justfile for implementation development

# Default task - show available commands
default:
    @just --list

# Development server with hot reload
dev:
    @echo "🚀 Starting jpl-website development server..."
    @echo "📁 Implementation: jpl-website"
    @echo "🏷️  Template: basic"
    cargo rustelo dev --port 3030 --watch

# Build the application
build:
    @echo "🔨 Building jpl-website..."
    cargo rustelo build

# Build for production
build-release:
    @echo "🔨 Building jpl-website for production..."
    cargo rustelo build --release

# Run tests
test:
    @echo "🧪 Running tests..."
    cargo test

# Format code
fmt:
    @echo "🎨 Formatting code..."
    cargo fmt
    
# Lint code
lint:
    @echo "📝 Linting code..."
    cargo clippy -- -D warnings

# Clean build artifacts
clean:
    @echo "🧹 Cleaning build artifacts..."
    cargo clean
    rm -rf dist/

# Update framework dependencies
update-framework:
    @echo "🔄 Checking for framework updates..."
    cargo rustelo update --check

# Apply framework updates
update:
    @echo "🔄 Applying framework updates..."
    cargo rustelo update

# Sync framework assets (for local development)
sync-assets:
    @echo "📦 Syncing framework assets..."
    cargo rustelo assets sync

# Setup development environment
setup:
    @echo "⚙️ Setting up development environment..."
    @echo "Installing frontend dependencies..."
    npm install
    @echo "✅ Setup complete!"

# Start development with frontend build
dev-full: setup
    @echo "🚀 Starting full development environment..."
    just dev

# Production deployment preparation
prepare-deploy: build-release
    @echo "📦 Preparing for deployment..."
    @echo "✅ Ready for deployment"

# Quick health check
check:
    @echo "🔍 Running health checks..."
    cargo check
    npm run check
    @echo "✅ Health check complete"

# View logs (implementation-specific)
logs:
    @echo "📜 Viewing application logs..."
    tail -f .rustelo/logs/app.log

# Configuration management
config:
    @echo "⚙️ Configuration:"
    @echo "Project: jpl-website"
    @echo "Template: basic"
    @echo "Config file: rustelo-deps.toml"
    @cat rustelo-deps.toml

# Content management helpers
content-new title:
    @echo "📝 Creating new content: {{title}}"
    mkdir -p content/posts
    echo "# {{title}}" > "content/posts/{{title}}.md"
    echo "" >> "content/posts/{{title}}.md"
    echo "Date: $(date -I)" >> "content/posts/{{title}}.md"
    echo "Author: {{author}}" >> "content/posts/{{title}}.md"
    echo "" >> "content/posts/{{title}}.md"
    echo "Your content here..." >> "content/posts/{{title}}.md"

# Backup important files
backup:
    @echo "💾 Creating backup..."
    tar -czf "backup-$(date +%Y%m%d_%H%M%S).tar.gz" src/ content/ config/ rustelo-deps.toml Cargo.toml
    @echo "✅ Backup created"

# Include local tasks if they exist
import? 'local-tasks.just'