# 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 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 # 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" # Generate sqlc code (for database schema changes) sqlc: sqlc generate