# 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 "" # Enhance demo site if needed if [ ! -d "./test-sites/demo-site_enhanced" ]; then echo "๐Ÿ”ง Demo site not ready - enhancing now..." ./insertr enhance test-sites/demo-site --output test-sites/demo-site_enhanced --config test-sites/demo-site/insertr.yaml echo "โœ… Demo site enhanced!" fi 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 " Demo site: http://localhost:8080/sites/demo/" echo " Simple site: http://localhost:8080/sites/simple/" echo " Dan Eden site: http://localhost:8080/sites/dan-eden/" 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/demo/about.html" INSERTR_DATABASE_PATH=./insertr.db ./insertr serve --dev-mode # Check project status and validate setup check: npm run check # Simple demo launcher - all sites now served from main server demo: @echo "๐ŸŒ All demo sites are served from the main server:" @echo " http://localhost:8080/sites/demo/ - Main demo site" @echo " http://localhost:8080/sites/simple/ - Simple test site" @echo " http://localhost:8080/sites/dan-eden/ - Dan Eden portfolio" @echo "" @echo "๐Ÿš€ To start the development server:" @echo " just dev" # 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="test-sites/demo-site" output="dist": ./insertr enhance {{input}} --output {{output}} --mock # === 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 and backups 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 and backups" # 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 site:" @ls -la test-sites/demo-site/index.html test-sites/demo-site/about.html 2>/dev/null || echo " Missing demo files" @echo "" @echo "๐Ÿš€ Development Commands:" @echo " just dev - Full-stack development (recommended)" @echo " just demo - Show available demo sites" @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 "./test-sites/demo-site_enhanced" ]; then rm -rf "./test-sites/demo-site_enhanced" echo "๐Ÿ—‘๏ธ Removed: demo-site_enhanced" fi if [ -d "./test-sites/simple/dan-eden-portfolio_enhanced" ]; then rm -rf "./test-sites/simple/dan-eden-portfolio_enhanced" echo "๐Ÿ—‘๏ธ Removed: dan-eden-portfolio_enhanced" fi if [ -d "./test-sites/simple/test-simple_enhanced" ]; then rm -rf "./test-sites/simple/test-simple_enhanced" echo "๐Ÿ—‘๏ธ Removed: test-simple_enhanced" fi # Clean up any temporary directories if [ -d "./test-sites/simple/dan-eden-portfolio-temp" ]; then rm -rf "./test-sites/simple/dan-eden-portfolio-temp" echo "๐Ÿ—‘๏ธ Removed: dan-eden-portfolio-temp" fi if [ -d "./test-sites/simple/test-simple-temp" ]; then rm -rf "./test-sites/simple/test-simple-temp" echo "๐Ÿ—‘๏ธ Removed: test-simple-temp" fi # Legacy directories (cleanup from old workflow) for legacy_dir in dan-eden-portfolio-auto-enhanced dan-eden-portfolio-full dan-eden-portfolio-auto dan-eden-portfolio-auto-v2 dan-eden-portfolio-auto-enhanced test-simple-auto-enhanced test-simple-full dan-eden-portfolio-enhanced test-simple-enhanced; do if [ -d "./test-sites/simple/${legacy_dir}" ]; then rm -rf "./test-sites/simple/${legacy_dir}" echo "๐Ÿ—‘๏ธ Removed: ${legacy_dir} (legacy)" fi done if [ -d "./test-sites/simple/dan-eden-portfolio-full" ]; then rm -rf "./test-sites/simple/dan-eden-portfolio-full" echo "๐Ÿ—‘๏ธ Removed: dan-eden-portfolio-full" fi if [ -d "./test-sites/simple/test-simple-auto-enhanced" ]; then rm -rf "./test-sites/simple/test-simple-auto-enhanced" echo "๐Ÿ—‘๏ธ Removed: test-simple-auto-enhanced" fi if [ -d "./test-sites/simple/test-simple-full" ]; then rm -rf "./test-sites/simple/test-simple-full" echo "๐Ÿ—‘๏ธ Removed: test-simple-full" fi echo "" echo "โœ… Demo cleanup complete!" echo "๐Ÿ”ง Sites will auto-enhance when you run demo commands"