# Insertr Development Commands # Use `just ` to run any of these tasks # Default recipe - show available commands default: @just --list # Install all dependencies (root + lib) install: npm install cd lib && npm install # Start full-stack development (primary workflow) dev: build-lib build #!/usr/bin/env bash echo "๐Ÿš€ Starting Full-Stack Insertr Development..." echo "================================================" echo "" # Note: Sites are auto-enhanced by the server on startup echo "" echo "๐Ÿ”Œ Starting Insertr server with all sites..." echo "" # Function to cleanup background processes cleanup() { echo "" echo "๐Ÿ›‘ Shutting down server..." kill $SERVER_PID 2>/dev/null || true wait $SERVER_PID 2>/dev/null || true echo "โœ… Shutdown complete" exit 0 } trap cleanup SIGINT SIGTERM # Start server (serves API + all static sites) INSERTR_DATABASE_PATH=./insertr.db ./insertr serve --dev-mode & SERVER_PID=$! echo "" echo "๐ŸŒ All sites available at:" echo " Default: http://localhost:8080/sites/default/" echo " Simple: http://localhost:8080/sites/simple/" echo " Dan Eden: http://localhost:8080/sites/dan-eden-portfolio/" echo " Devigo (NO): http://localhost:8080/sites/devigo-web/" echo "" echo "๐Ÿ“ Full-stack ready - edit content with real-time persistence!" echo "๐Ÿ”„ Press Ctrl+C to shutdown" echo "" # Wait for server process wait $SERVER_PID # Start development server for about page dev-about: build-lib build #!/usr/bin/env bash echo "๐Ÿš€ Starting full-stack development..." echo "๐ŸŒ About page available at: http://localhost:8080/sites/default/about.html" INSERTR_DATABASE_PATH=./insertr.db ./insertr serve --dev-mode # Check project status and validate setup check: npm run check # Build the entire project (library + unified binary) build: npm run build # Build only the JavaScript library build-lib: npm run build:lib # Watch library files for changes (auto-rebuild) watch: cd lib && npm run dev # Start Air hot-reload for unified binary development air: air # Build unified binary only build-insertr: go build -o insertr . # Run insertr help help: ./insertr --help # Enhance demo site (build-time content injection) enhance input="demos/default" output="dist": ./insertr enhance {{input}} --output {{output}} # === Content API Server Commands === # Start content API server (default port 8080) serve port="8080": INSERTR_DATABASE_PATH=./insertr.db ./insertr serve --port {{port}} --dev-mode # Start API server in production mode serve-prod port="8080" db="./insertr.db": INSERTR_DATABASE_PATH={{db}} ./insertr serve --port {{port}} # Check API server health health port="8080": @echo "๐Ÿ” Checking API server health..." @curl -s http://localhost:{{port}}/health | jq . || echo "โŒ Server not responding at localhost:{{port}}" # Clean all build artifacts clean: rm -rf lib/dist rm -rf insertr rm -rf tmp rm -rf dist rm -rf node_modules rm -rf lib/node_modules rm -f dev.db rm -f insertr.db @echo "๐Ÿงน Cleaned all build artifacts" # Lint code (placeholder for now) lint: npm run lint # Run tests (placeholder for now) test: npm run test # Development workflow: install deps, build lib, start dev server dev-setup: install build-lib dev # Production workflow: install deps, build everything prod-build: install build # Show project status status: @echo "๐Ÿ—๏ธ Insertr Project Status" @echo "=========================" @echo "๐Ÿ“ Root files:" @ls -la package.json justfile go.mod insertr.yaml 2>/dev/null || echo " Missing files" @echo "\n๐Ÿ“š Library files:" @ls -la lib/package.json lib/src lib/dist 2>/dev/null || echo " Missing library components" @echo "\n๐Ÿ”ง Unified binary:" @ls -la insertr main.go cmd/ internal/ 2>/dev/null || echo " Missing unified binary components" @echo "\n๐ŸŒ Demo sites:" @ls -la demos/default/index.html demos/simple/index.html demos/dan-eden-portfolio/index.html demos/devigo-web/index.html 2>/dev/null || echo " Some demo files missing" @echo "" @echo "๐Ÿš€ Development Commands:" @echo " just dev - Full-stack development (recommended)" @echo " just serve - API server only (localhost:8080)" @echo " just enhance - Build-time content injection" @echo "" @echo "๐Ÿ” Check server: just health" # Generate sqlc code (for database schema changes) sqlc: sqlc generate # Clean generated demo directories clean-demos: #!/usr/bin/env bash echo "๐Ÿงน Cleaning generated demo directories..." echo "=========================================" # Demo directories if [ -d "./demos/default_enhanced" ]; then rm -rf "./demos/default_enhanced" echo "๐Ÿ—‘๏ธ Removed: default_enhanced" fi if [ -d "./demos/simple_enhanced" ]; then rm -rf "./demos/simple_enhanced" echo "๐Ÿ—‘๏ธ Removed: simple_enhanced" fi if [ -d "./demos/dan-eden-portfolio_enhanced" ]; then rm -rf "./demos/dan-eden-portfolio_enhanced" echo "๐Ÿ—‘๏ธ Removed: dan-eden-portfolio_enhanced" fi if [ -d "./demos/devigo-web_enhanced" ]; then rm -rf "./demos/devigo-web_enhanced" echo "๐Ÿ—‘๏ธ Removed: devigo-web_enhanced" fi # Clean up any temporary directories if [ -d "./demos/dan-eden-portfolio-temp" ]; then rm -rf "./demos/dan-eden-portfolio-temp" echo "๐Ÿ—‘๏ธ Removed: dan-eden-portfolio-temp" fi if [ -d "./demos/simple-temp" ]; then rm -rf "./demos/simple-temp" echo "๐Ÿ—‘๏ธ Removed: simple-temp" fi # Legacy directories (cleanup from old workflow) for legacy_dir in demo-site demo-site_enhanced demo_enhanced simple/test-simple simple/dan-eden-portfolio; do if [ -d "./demos/${legacy_dir}" ]; then rm -rf "./demos/${legacy_dir}" echo "๐Ÿ—‘๏ธ Removed: ${legacy_dir} (legacy)" fi done # Clean up legacy directories in simple subdirectory if [ -d "./demos/simple" ] && [ -z "$(find ./demos/simple -maxdepth 1 -name '*.html' -o -name '*.yaml')" ]; then # If simple directory exists but contains no HTML/YAML files, it's legacy rm -rf "./demos/simple"/* 2>/dev/null || true fi echo "" echo "โœ… Demo cleanup complete!" echo "๐Ÿ”ง Sites will auto-enhance when you run demo commands"