# 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 "" echo "๐Ÿ“ Unified logs below (API server + Demo site):" echo "๐Ÿ”Œ [SERVER] = API server logs" echo "๐ŸŒ [DEMO] = Demo site logs" echo "" # Function to cleanup background processes cleanup() { echo "" echo "๐Ÿ›‘ Shutting down servers..." kill $SERVER_PID $DEMO_PID 2>/dev/null || true wait $SERVER_PID $DEMO_PID 2>/dev/null || true echo "โœ… Shutdown complete" exit 0 } trap cleanup SIGINT SIGTERM # Start API server with prefixed output echo "๐Ÿ”Œ Starting API server (localhost:8080)..." INSERTR_DATABASE_PATH=./dev.db ./insertr serve --dev-mode 2>&1 | sed 's/^/๐Ÿ”Œ [SERVER] /' & SERVER_PID=$! # Wait for server startup echo "โณ Waiting for API server startup..." sleep 3 # Check server health if curl -s http://localhost:8080/health > /dev/null 2>&1; then echo "โœ… API server ready!" else echo "โš ๏ธ API server may not be ready yet" fi echo "" echo "๐ŸŒ Starting demo site (localhost:3000)..." echo "๐Ÿ“ Full-stack ready - edit content with real-time persistence!" echo "" # Start demo site with prefixed output (this will block) - use local installation cd {{justfile_directory()}} && npx --prefer-offline live-server demo-site --port=3000 --host=localhost --open=/index.html 2>&1 | sed 's/^/๐ŸŒ [DEMO] /' & DEMO_PID=$! # Wait for both processes wait $DEMO_PID $SERVER_PID # Demo site only (for specific use cases) demo-only: @echo "๐ŸŒ Starting demo site only (no API server)" @echo "โš ๏ธ Content edits will not persist without API server" npx --prefer-offline live-server demo-site --port=3000 --host=localhost --open=/index.html # Start development server for about page dev-about: build-lib build #!/usr/bin/env bash echo "๐Ÿš€ Starting full-stack development (about page)..." INSERTR_DATABASE_PATH=./dev.db ./insertr serve --dev-mode & SERVER_PID=$! sleep 3 npx --prefer-offline live-server demo-site --port=3000 --host=localhost --open=/about.html kill $SERVER_PID 2>/dev/null || true # Check project status and validate setup check: npm run check # Show demo instructions demo: npm run demo # 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 # Parse demo site with CLI parse: ./insertr enhance demo-site/ --output ./dist --mock # Enhance demo site (build-time content injection) enhance input="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=./dev.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}} # Start API server with auto-restart on Go file changes serve-dev port="8080": find . -name "*.go" | entr -r bash -c 'INSERTR_DATABASE_PATH=./dev.db ./insertr serve --port {{port}} --dev-mode' # 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" # Restore demo site to clean original state restore-clean: @echo "๐Ÿงน Restoring demo site to clean state..." ./insertr restore demo --clean # 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 demo-site/index.html 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-only - Demo site only (no persistence)" @echo " just serve - API server only (localhost:8080)" @echo " just enhance - Build-time content injection" @echo "" @echo "๐Ÿ” Check server: just health" @echo "๐Ÿงน Restore clean: just restore-clean" # Generate sqlc code (for database schema changes) sqlc: sqlc generate