commit 997054e3b7ef64dff93391985f8f60c54f962f94 Author: Ernie Cook Date: Mon Mar 2 00:09:53 2026 -0500 Initial commit: AI overnight web app builder setup diff --git a/WORKLOG.md b/WORKLOG.md new file mode 100644 index 0000000..da068af --- /dev/null +++ b/WORKLOG.md @@ -0,0 +1,24 @@ +# Worklog - AI Overnight Web App Builder + +## Project Status: NOT STARTED + +### Current Progress +- [ ] Project initialized with Vite + React + TypeScript + TailwindCSS +- [ ] Basic project structure in place +- [ ] First "Hello World" page running + +### In Progress +(None yet) + +### Completed +(None yet) + +### Next Steps +1. Initialize the project with Vite, React, TypeScript, and TailwindCSS +2. Create basic app structure (routes, layout) +3. Deploy a working "Hello World" page +4. From there, iteratively add features based on chosen domain + +--- + +*Last updated: Project start* diff --git a/ai-instructions.md b/ai-instructions.md new file mode 100644 index 0000000..a9d92a9 --- /dev/null +++ b/ai-instructions.md @@ -0,0 +1,38 @@ +# AI Overnight Web App Builder - Instructions + +## Overview +You are an autonomous AI building a web application incrementally over multiple nightly sessions. Each run builds upon the previous work. + +## Tech Stack +- React +- TypeScript +- Vite +- TailwindCSS + +Choose additional libraries as needed (e.g., React Router, a UI component library, etc.). + +## Your Job +1. **Read the current state** - Start by reading `WORKLOG.md` to understand what has been done and what remains +2. **Continue building** - Based on the current state, make meaningful progress on the next item +3. **Update progress** - After each session, update `WORKLOG.md` with what you accomplished and what's next +4. **Commit your work** - Create a descriptive git commit capturing your changes + +## Guidelines +- Domain: Choose an interesting but achievable web app domain. Consider something that can grow incrementally (e.g., task tracker, personal dashboard, blog, recipe manager, etc.) +- Scope: Start simple with a working prototype. Add features incrementally over time. +- Best practices: Write clean, maintainable code. Use TypeScript properly. +- Don't overcomplicate: Favor working code over perfect architecture initially. + +## What "Incremental" Means +- First session: Set up the project structure, get a basic "Hello World" running +- Subsequent sessions: Add features one at a time +- If blocked: Leave clear notes in WORKLOG.md about what needs to be done next + +## Output Expectations +- Keep `WORKLOG.md` up to date with current status +- Make reasonable git commits (not too granular, not too large) +- Leave the project in a working state after each session + +--- + +**Remember**: You're building this overnight, one piece at a time. Progress over perfection! diff --git a/run-ai.sh b/run-ai.sh new file mode 100755 index 0000000..f71148a --- /dev/null +++ b/run-ai.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +# AI Overnight Web App Builder - Runner Script +# Called by cron hourly during nighttime + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +LOCK_FILE="$SCRIPT_DIR/.ai-builder.lock" +LOG_FILE="$SCRIPT_DIR/ai-builder.log" + +# Check if another instance is already running +if [ -f "$LOCK_FILE" ]; then + PID=$(cat "$LOCK_FILE") + if kill -0 "$PID" 2>/dev/null; then + echo "$(date): Another instance is running (PID $PID). Exiting." >> "$LOG_FILE" + exit 0 + else + echo "$(date): Stale lock file found (PID $PID). Removing." >> "$LOG_FILE" + rm -f "$LOCK_FILE" + fi +fi + +# Acquire lock +echo $$ > "$LOCK_FILE" +trap 'rm -f "$LOCK_FILE"' EXIT + +echo "$(date): Starting AI build session..." >> "$LOG_FILE" + +# Read current context from worklog +WORKLOG="$SCRIPT_DIR/WORKLOG.md" +INSTRUCTIONS="$SCRIPT_DIR/ai-instructions.md" + +if [ ! -f "$WORKLOG" ]; then + echo "$(date): ERROR: WORKLOG.md not found" >> "$LOG_FILE" + exit 1 +fi + +if [ ! -f "$INSTRUCTIONS" ]; then + echo "$(date): ERROR: ai-instructions.md not found" >> "$LOG_FILE" + exit 1 +fi + +# Build the task prompt for opencode +TASK_PROMPT="You are an AI building a web application incrementally. + +Read the following instructions first: +$(cat "$INSTRUCTIONS") + +--- + +Current worklog state: +$(cat "$WORKLOG") + +--- + +Your task: Continue building the web application. Read the current state from WORKLOG.md, make meaningful progress on the next item(s), then update WORKLOG.md with what you accomplished and what should happen next. Make a git commit with descriptive message." + +# Run opencode with the task +cd "$SCRIPT_DIR" +opencode --prompt "$TASK_PROMPT" 2>&1 | tee -a "$LOG_FILE" +EXIT_CODE=${PIPESTATUS[0]} + +if [ $EXIT_CODE -eq 0 ]; then + echo "$(date): AI build session completed successfully" >> "$LOG_FILE" + + # Check if there are changes to commit + if git diff --quiet && git diff --cached --quiet; then + echo "$(date): No changes to commit" >> "$LOG_FILE" + else + git add -A + git commit -m "AI: $(date '+%Y-%m-%d %H:%M') - incremental progress" >> "$LOG_FILE" 2>&1 || true + echo "$(date): Changes committed" >> "$LOG_FILE" + fi +else + echo "$(date): AI build session failed with exit code $EXIT_CODE" >> "$LOG_FILE" +fi + +echo "$(date): Session finished" >> "$LOG_FILE"